Wiimote: Added optional status icons for the Wiimote speaker and leds. And a few other small changes.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1455 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2008-12-09 05:37:15 +00:00
parent 668337eb84
commit fee145244c
22 changed files with 739 additions and 88 deletions

View File

@ -83,6 +83,9 @@ void SConfig::SaveSettings()
ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
ini.Set("Wii", "ShowWiimoteLeds", m_LocalCoreStartupParameter.bWiiLeds);
ini.Set("Wii", "ShowWiimoteSpeakers", m_LocalCoreStartupParameter.bWiiSpeakers);
}
ini.Save(CONFIG_FILE);
@ -166,5 +169,9 @@ void SConfig::LoadSettings()
ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
ini.Get("Wii", "ShowWiimoteLeds", &m_LocalCoreStartupParameter.bWiiLeds, false);
ini.Get("Wii", "ShowWiimoteSpeakers", &m_LocalCoreStartupParameter.bWiiSpeakers, false);
}
}

View File

@ -22,6 +22,9 @@
#include "ConfigMain.h"
#include "PluginManager.h"
#include "Frame.h"
extern CFrame* main_frame;
BEGIN_EVENT_TABLE(CConfigMain, wxDialog)
@ -35,12 +38,16 @@ EVT_CHECKBOX(ID_OPTIMIZEQUANTIZERS, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_ENABLECHEATS, CConfigMain::CoreSettingsChanged)
EVT_CHOICE(ID_GC_SRAM_LNG, CConfigMain::GCSettingsChanged)
EVT_CHOICE(ID_WII_BT_BAR, CConfigMain::WiiSettingsChanged)
EVT_CHECKBOX(ID_WII_BT_LEDS, CConfigMain::WiiSettingsChanged)
EVT_CHECKBOX(ID_WII_BT_SPEAKERS, CConfigMain::WiiSettingsChanged)
EVT_CHECKBOX(ID_WII_IPL_SSV, CConfigMain::WiiSettingsChanged)
EVT_CHECKBOX(ID_WII_IPL_PGS, CConfigMain::WiiSettingsChanged)
EVT_CHECKBOX(ID_WII_IPL_E60, CConfigMain::WiiSettingsChanged)
EVT_CHOICE(ID_WII_IPL_AR, CConfigMain::WiiSettingsChanged)
EVT_CHOICE(ID_WII_IPL_LNG, CConfigMain::WiiSettingsChanged)
EVT_LISTBOX(ID_ISOPATHS, CConfigMain::ISOPathsSelectionChanged)
EVT_BUTTON(ID_ADDISOPATH, CConfigMain::AddRemoveISOPaths)
EVT_BUTTON(ID_REMOVEISOPATH, CConfigMain::AddRemoveISOPaths)
@ -174,12 +181,19 @@ void CConfigMain::CreateGUIControls()
GamecubePage->SetSizer(sGamecube);
sGamecube->Layout();
// Wii SYSCONF page
//////////////////////////////////
// Wii page
// --------
sbWiimoteSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Wiimote Settings"));
arrayStringFor_WiiSensBarPos.Add(wxT("Bottom")); arrayStringFor_WiiSensBarPos.Add(wxT("Top"));
WiiSensBarPosText = new wxStaticText(WiiPage, ID_WII_BT_BAR_TEXT, wxT("Sensor Bar Position:"), wxDefaultPosition, wxDefaultSize);
WiiSensBarPos = new wxChoice(WiiPage, ID_WII_BT_BAR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSensBarPos, 0, wxDefaultValidator);
WiiSensBarPos->SetSelection(m_SYSCONF[BT_BAR]);
WiiLeds = new wxCheckBox(WiiPage, ID_WII_BT_LEDS, wxT("Show Wiimote Leds in status bar"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
WiiLeds->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiLeds);
WiiSpeakers = new wxCheckBox(WiiPage, ID_WII_BT_SPEAKERS, wxT("Show Wiimote Speaker status in status bar"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
WiiSpeakers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers);
sbWiiIPLSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("IPL Settings"));
WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, wxT("Enable Screen Saver (burn-in reduction)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
@ -198,10 +212,13 @@ void CConfigMain::CreateGUIControls()
WiiSystemLang = new wxChoice(WiiPage, ID_WII_IPL_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSystemLang, 0, wxDefaultValidator);
WiiSystemLang->SetSelection(m_SYSCONF[IPL_LNG]);
// Populate sbWiimoteSettings
sWii = new wxBoxSizer(wxVERTICAL);
sWiimoteSettings = new wxGridBagSizer(0, 0);
sWiimoteSettings->Add(WiiSensBarPosText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sWiimoteSettings->Add(WiiSensBarPos, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL, 5);
sWiimoteSettings->Add(WiiLeds, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
sWiimoteSettings->Add(WiiSpeakers, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
sbWiimoteSettings->Add(sWiimoteSettings);
sWii->Add(sbWiimoteSettings, 0, wxEXPAND|wxALL, 5);
@ -218,6 +235,7 @@ void CConfigMain::CreateGUIControls()
WiiPage->SetSizer(sWii);
sWii->Layout();
// Paths page
sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, wxT("ISO Directories"));
ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator);
@ -323,6 +341,9 @@ void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
// save the config... dolphin crashes by far to often to save the settings on closing only
SConfig::GetInstance().SaveSettings();
// Update the status bar
main_frame->ModifyStatusBar(WiiLeds->IsChecked(), WiiSpeakers->IsChecked());
}
void CConfigMain::CloseClick(wxCommandEvent& WXUNUSED (event))
@ -372,10 +393,17 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
{
switch (event.GetId())
{
case ID_WII_BT_BAR:
case ID_WII_BT_BAR: // Wiimote settings
m_SYSCONF[BT_BAR] = WiiSensBarPos->GetSelection();
break;
case ID_WII_IPL_AR:
case ID_WII_BT_LEDS:
SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiLeds = WiiLeds->IsChecked();
break;
case ID_WII_BT_SPEAKERS:
SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers = WiiSpeakers->IsChecked();
break;
case ID_WII_IPL_AR: // IPL settings
m_SYSCONF[IPL_AR] = WiiAspectRatio->GetSelection();
break;
case ID_WII_IPL_SSV:
@ -537,3 +565,4 @@ bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
return(false);
}

View File

@ -148,10 +148,12 @@ class CConfigMain
0x1576 4 NET.CTPC Net Content Restrictions ("Content Parental Control"?)
0x17E7 4 NET.WCFG WC24 Configuration flags
*/
wxArrayString arrayStringFor_WiiSensBarPos;
wxArrayString arrayStringFor_WiiSensBarPos; // Wiimote Settings
wxStaticText* WiiSensBarPosText;
wxChoice* WiiSensBarPos;
wxCheckBox* WiiScreenSaver;
wxCheckBox* WiiLeds, * WiiSpeakers;
wxCheckBox* WiiScreenSaver; // IPL settings
wxCheckBox* WiiProgressiveScan;
wxCheckBox* WiiEuRGB60;
wxArrayString arrayStringFor_WiiAspectRatio;
@ -202,8 +204,11 @@ class CConfigMain
ID_ENABLEISOCACHE,
ID_GC_SRAM_LNG_TEXT,
ID_GC_SRAM_LNG,
ID_WII_BT_BAR_TEXT,
ID_WII_BT_BAR,
ID_WII_BT_LEDS, ID_WII_BT_SPEAKERS,
ID_WII_IPL_SSV,
ID_WII_IPL_PGS,
ID_WII_IPL_E60,

View File

@ -120,6 +120,7 @@ EVT_MENU(IDM_SAVESLOT7, CFrame::OnSaveState)
EVT_MENU(IDM_SAVESLOT8, CFrame::OnSaveState)
EVT_MENU(IDM_SAVESLOT9, CFrame::OnSaveState)
EVT_MENU(IDM_SAVESLOT10, CFrame::OnSaveState)
EVT_SIZE(CFrame::MoveIcons)
EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage)
END_EVENT_TABLE()
@ -144,6 +145,7 @@ CFrame::CFrame(wxFrame* parent,
, m_pStatusBar(NULL)
, m_pMenuBar(NULL)
, m_pBootProcessDialog(NULL)
, HaveLeds(false), HaveSpeakers(false)
{
InitBitmaps();
@ -153,9 +155,8 @@ CFrame::CFrame(wxFrame* parent,
SetIcon(IconTemp);
// Give it a status line
m_pStatusBar = CreateStatusBar(2);
int StylesField[] = {wxSB_FLAT, wxSB_FLAT};
m_pStatusBar->SetStatusStyles(2, StylesField);
CreateStatusBar_();
CreateMenu();
// This panel is the parent for rendering and it holds the gamelistctrl
@ -208,6 +209,13 @@ WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
#endif
// =======================================================
// Create menu items
// -------------
void CFrame::CreateMenu()
{
delete m_pMenuBar;

View File

@ -17,6 +17,27 @@ class CFrame : public wxFrame
void* GetRenderHandle() {return(m_Panel->GetHandle());}
wxStatusBar* m_pStatusBar;
// --------------------------------
// Wiimote leds
// ---------
void CreateStatusBar_();
void ModifyStatusBar(bool LedsOn, bool SpeakerOn);
void CreateDestroy(int Case);
void CreateLeds(); void CreateSpeakers();
void UpdateLeds(); void UpdateSpeakers();
wxBitmap CreateBitmapForLeds(bool On);
wxBitmap CreateBitmapForSpeakers(int BitmapType, bool On);
void MoveIcons(wxSizeEvent& event); void DoMoveIcons(); void MoveLeds(); void MoveSpeakers();
bool HaveLeds; bool HaveSpeakers;
wxStaticBitmap *m_StatBmp[7];
u8 g_Leds[4]; u8 g_Leds_[4];
u8 g_Speakers[3]; u8 g_Speakers_[3];
// ---------
private:
@ -38,7 +59,16 @@ class CFrame : public wxFrame
Toolbar_PluginPAD,
Toolbar_FullScreen,
Toolbar_Help,
Bitmaps_Max
Bitmaps_Max,
END
};
enum WiimoteBitmaps // Wiimote speaker bitmaps
{
CREATELEDS = END,
DESTROYLEDS,
CREATESPEAKERS,
DESTROYSPEAKERS
};
wxBitmap m_Bitmaps[Bitmaps_Max];
@ -80,7 +110,6 @@ class CFrame : public wxFrame
void OnSaveState(wxCommandEvent& event);
void OnClose(wxCloseEvent &event);
wxStatusBar* m_pStatusBar;
wxMenuBar* m_pMenuBar;
wxMenuItem* m_pMenuItemPlay;
@ -103,4 +132,3 @@ class CFrame : public wxFrame
};
#endif // __FRAME_H_

View File

@ -0,0 +1,368 @@
// Copyright (C) 2003-2008 Dolphin Project.
// 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 "Globals.h"
#include "Frame.h"
#include "FileUtil.h"
#include "StringUtil.h"
#include "GameListCtrl.h"
#include "BootManager.h"
#include "Common.h"
#include "Config.h"
#include "Core.h"
#include "State.h"
#include "ConfigMain.h"
#include "PluginManager.h"
#include "MemcardManager.h"
#include "CheatsWindow.h"
#include "AboutDolphin.h"
#include <wx/statusbr.h>
namespace WiimoteLeds
{
int LED_SIZE_X = 8;
int LED_SIZE_Y = 8;
int SPEAKER_SIZE_X = 8;
int SPEAKER_SIZE_Y = 8;
static const int WidthsOn[] = { -1, 100, 50 + LED_SIZE_X * 4 };
static const int StylesFieldOn[] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL };
static const int SpWidthsOn[] = { -1, 100, 40 + SPEAKER_SIZE_X * 3 };
static const int SpStylesFieldOn[] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL };
static const int LdSpWidthsOn[] = { -1, 100, 32 + SPEAKER_SIZE_X * 3, 50 + LED_SIZE_X * 4 };
static const int LdSpStylesFieldOn[] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL };
static const int WidthsOff[] = { -1, 50 + 100 };
static const int StylesFieldOff[] = { wxSB_NORMAL, wxSB_NORMAL };
};
// =======================================================
// Create status bar
// -------------
void CFrame::CreateStatusBar_()
{
// Get settings
bool LedsOn = SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiLeds;
bool SpeakersOn = SConfig::GetInstance().m_LocalCoreStartupParameter.bWiiSpeakers;
m_pStatusBar = CreateStatusBar();
ModifyStatusBar(LedsOn, SpeakersOn);
}
// =======================================================
// Modify status bar
// -------------
void CFrame::ModifyStatusBar(bool LedsOn, bool SpeakersOn)
{
// Declarations
int Fields;
int *Widths;
int *StylesFields;
// ---------------------------------------
// Leds only
// -------------
if(LedsOn && !SpeakersOn)
{
Fields = 3;
Widths = (int*)WiimoteLeds::WidthsOn;
StylesFields = (int*)WiimoteLeds::StylesFieldOn;
}
// ---------------------------------------
// Speaker only
// -------------
else if(!LedsOn && SpeakersOn)
{
Fields = 3;
Widths = (int*)WiimoteLeds::SpWidthsOn;
StylesFields = (int*)WiimoteLeds::SpStylesFieldOn;
}
// ---------------------------------------
// Both on
// -------------
else if(LedsOn && SpeakersOn)
{
Fields = 4;
Widths = (int*)WiimoteLeds::LdSpWidthsOn;
StylesFields = (int*)WiimoteLeds::LdSpStylesFieldOn;
}
// ---------------------------------------
// Both off
// -------------
else if(!LedsOn && !SpeakersOn)
{
Fields = 2;
Widths = (int*)WiimoteLeds::WidthsOff;
StylesFields = (int*)WiimoteLeds::StylesFieldOff;
}
/* Destroy and create all, and check for HaveLeds and HaveSpeakers in case we have
gotten a confirmed on or off setting, in which case we don't do anything */
if(!LedsOn && HaveLeds) CreateDestroy(DESTROYLEDS);
if(!SpeakersOn && HaveSpeakers) CreateDestroy(DESTROYSPEAKERS);
if(LedsOn && !HaveLeds) CreateDestroy(CREATELEDS);
if(SpeakersOn && !HaveSpeakers) CreateDestroy(CREATESPEAKERS);
// Update the settings
m_pStatusBar->SetFieldsCount(Fields);
m_pStatusBar->SetStatusWidths(Fields, Widths);
m_pStatusBar->SetStatusStyles(Fields, StylesFields);
DoMoveIcons();
m_pStatusBar->Refresh(); // avoid small glitches that can occur
}
// =======================================================
// Create and destroy leds and speakers icons
// -------------
void CFrame::CreateDestroy(int Case)
{
switch(Case)
{
case CREATELEDS:
{
CreateLeds();
//UpdateLeds(g_Leds);
HaveLeds = true;
break;
}
case DESTROYLEDS:
{
for(int i = 0; i < 4; i++)
{
m_StatBmp[i]->Destroy();
}
HaveLeds = false;
break;
}
case CREATESPEAKERS:
{
CreateSpeakers();
HaveSpeakers = true;
break;
}
case DESTROYSPEAKERS:
{
for(int i = 4; i < 7; i++)
{
m_StatBmp[i]->Destroy();
}
HaveSpeakers = false;
break;
}
} // end of switch
DoMoveIcons();
}
// =============
// =======================================================
// Create and update leds
// -------------
void CFrame::CreateLeds()
{
// Begin with blank ones
memset(&g_Leds, 0, sizeof(g_Leds));
for(int i = 0; i < 4; i++)
{
m_StatBmp[i] = new wxStaticBitmap(m_pStatusBar, wxID_ANY,
CreateBitmapForLeds((bool)g_Leds[i]));
}
}
// Update leds
void CFrame::UpdateLeds()
{
for(int i = 0; i < 4; i++)
{
m_StatBmp[i]->SetBitmap(CreateBitmapForLeds((bool)g_Leds[i]));
}
}
// ==============
// =======================================================
// Create and speaker icons
// -------------
void CFrame::CreateSpeakers()
{
// Begin with blank ones
memset(&g_Speakers, 0, sizeof(g_Speakers));
memset(&g_Speakers_, 0, sizeof(g_Speakers_));
for(int i = 0; i < 3; i++)
{
m_StatBmp[i+4] = new wxStaticBitmap(m_pStatusBar, wxID_ANY,
CreateBitmapForSpeakers(i, (bool)g_Speakers[i]));
}
}
// Update icons
void CFrame::UpdateSpeakers()
{
for(int i = 0; i < 3; i++)
{
m_StatBmp[i+4]->SetBitmap(CreateBitmapForSpeakers(i, (bool)g_Speakers[i]));
}
if(g_Leds[0] == 0)
{
// LOGV(CONSOLE, 0, "Break");
}
std::string Temp = ArrayToString(g_Speakers, sizeof(g_Speakers));
LOGV(CONSOLE, 0, "Speakers: %s", Temp.c_str());
Temp = ArrayToString(g_Leds, sizeof(g_Leds));
LOGV(CONSOLE, 0, "Leds: %s", Temp.c_str());
}
// ==============
// =======================================================
// Create the Leds bitmap
// -------------
wxBitmap CFrame::CreateBitmapForLeds(bool On)
{
wxBitmap bitmap(WiimoteLeds::LED_SIZE_X, WiimoteLeds::LED_SIZE_Y);
wxMemoryDC dc;
dc.SelectObject(bitmap);
// Set outline and fill colors
wxBrush LightBlueBrush(_T("#0383f0"));
wxPen LightBluePen(_T("#80c5fd"));
wxPen LightGrayPen(_T("#909090"));
dc.SetPen(On ? LightBluePen : LightGrayPen);
dc.SetBrush(On ? LightBlueBrush : *wxWHITE_BRUSH);
dc.Clear();
dc.DrawRectangle(0, 0, WiimoteLeds::LED_SIZE_X, WiimoteLeds::LED_SIZE_Y);
dc.SelectObject(wxNullBitmap);
return bitmap;
}
// =======================================================
// Create the Speaker bitmap
// -------------
wxBitmap CFrame::CreateBitmapForSpeakers(int BitmapType, bool On)
{
wxBitmap bitmap(WiimoteLeds::LED_SIZE_X, WiimoteLeds::LED_SIZE_Y);
wxMemoryDC dc;
dc.SelectObject(bitmap);
wxBrush BackgroundGrayBrush(_T("#ece9d8")); // the right color in windows
switch(BitmapType)
{
case 0:
{
// Set outline and fill colors
dc.SetPen(On ? *wxMEDIUM_GREY_PEN : *wxMEDIUM_GREY_PEN);
dc.SetBrush(On ? *wxGREEN_BRUSH : *wxWHITE_BRUSH);
dc.SetBackground(BackgroundGrayBrush);
dc.Clear();
dc.DrawEllipse(0, 0, WiimoteLeds::SPEAKER_SIZE_X, WiimoteLeds::SPEAKER_SIZE_Y);
dc.SelectObject(wxNullBitmap);
return bitmap;
}
case 1:
{
// Set outline and fill colors
dc.SetPen(On ? *wxMEDIUM_GREY_PEN : *wxMEDIUM_GREY_PEN);
dc.SetBrush(On ? *wxBLUE_BRUSH : *wxWHITE_BRUSH);
dc.SetBackground(BackgroundGrayBrush);
dc.Clear();
dc.DrawEllipse(0, 0, WiimoteLeds::SPEAKER_SIZE_X, WiimoteLeds::SPEAKER_SIZE_Y);
dc.SelectObject(wxNullBitmap);
return bitmap;
}
case 2:
{
// Set outline and fill colors
dc.SetPen(On ? *wxMEDIUM_GREY_PEN : *wxMEDIUM_GREY_PEN);
dc.SetBrush(On ? *wxGREEN_BRUSH : *wxWHITE_BRUSH);
dc.SetBackground(BackgroundGrayBrush);
dc.Clear();
dc.DrawEllipse(0, 0, WiimoteLeds::SPEAKER_SIZE_X, WiimoteLeds::SPEAKER_SIZE_Y);
dc.SelectObject(wxNullBitmap);
return bitmap;
}
}
}
// =======================================================
// Move the bitmaps
// -------------
void CFrame::MoveIcons(wxSizeEvent& event)
{
DoMoveIcons();
event.Skip();
}
void CFrame::DoMoveIcons()
{
if(HaveLeds) MoveLeds();
if(HaveSpeakers) MoveSpeakers();
}
void CFrame::MoveLeds()
{
wxRect Rect;
// Get the bitmap field coordinates
m_pStatusBar->GetFieldRect((HaveLeds && HaveSpeakers) ? 3 : 2, Rect);
wxSize Size = m_StatBmp[0]->GetSize(); // Get the bitmap size
//wxMessageBox(wxString::Format("%i", Rect.x));
int x = Rect.x + 10;
int Dist = WiimoteLeds::LED_SIZE_X + 7;
int y = Rect.y + (Rect.height - Size.y) / 2;
for(int i = 0; i < 4; i++)
{
if(i > 0) x = m_StatBmp[i-1]->GetPosition().x + Dist;
m_StatBmp[i]->Move(x, y);
}
}
void CFrame::MoveSpeakers()
{
wxRect Rect;
m_pStatusBar->GetFieldRect(2, Rect); // Get the bitmap field coordinates
// Get the actual bitmap size, currently it's the same as SPEAKER_SIZE_Y
wxSize Size = m_StatBmp[4]->GetSize();
//wxMessageBox(wxString::Format("%i", Rect.x));
int x = Rect.x + 9;
int Dist = WiimoteLeds::SPEAKER_SIZE_X + 7;
int y = Rect.y + (Rect.height - Size.y) / 2;
for(int i = 0; i < 3; i++)
{
if(i > 0) x = m_StatBmp[i-1+4]->GetPosition().x + Dist;
m_StatBmp[i+4]->Move(x, y);
}
}
// ==============

View File

@ -492,8 +492,11 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
popupMenu.AppendSeparator();
popupMenu.Append(IDM_OPENCONTAININGFOLDER, _("Open &containing folder"));
popupMenu.AppendCheckItem(IDM_SETDEFAULTGCM, _("Set as &default ISO"));
if(selected_iso->GetFileName() == SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM)
popupMenu.FindItemByPosition(3)->Check();
// First we have to decide a starting value when we append it
if(selected_iso->GetFileName() == SConfig::GetInstance().
m_LocalCoreStartupParameter.m_strDefaultGCM)
popupMenu.FindItem(IDM_SETDEFAULTGCM)->Check();
popupMenu.AppendSeparator();
popupMenu.Append(IDM_DELETEGCM, _("&Delete ISO..."));
@ -562,12 +565,21 @@ void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event))
// =======================================================
// Save this file as the default file
// -------------
void CGameListCtrl::OnSetDefaultGCM(wxCommandEvent& WXUNUSED (event))
void CGameListCtrl::OnSetDefaultGCM(wxCommandEvent& event)
{
const GameListItem *iso = GetSelectedISO();
if (!iso) return;
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = iso->GetFileName();
SConfig::GetInstance().SaveSettings();
if (event.IsChecked()) // Write the new default value and save it the ini file
{
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = iso->GetFileName();
SConfig::GetInstance().SaveSettings();
}
else // Othwerise blank the value and save it
{
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = "";
SConfig::GetInstance().SaveSettings();
}
}
// =============