Clean up and fix some issues with the dialogs for compression and decompression of iso and gcm images. Also added a confirmation to overwrite existing files.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6024 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-08-01 04:09:59 +00:00
parent 949fec41ca
commit 2c6f851bba
5 changed files with 134 additions and 110 deletions

View File

@ -227,7 +227,7 @@ bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type,
if (inpos != 0) if (inpos != 0)
ratio = (int)(100 * position / inpos); ratio = (int)(100 * position / inpos);
char temp[512]; char temp[512];
sprintf(temp, "%i of %i blocks. compression ratio %i%%", i, header.num_blocks, ratio); sprintf(temp, "%i of %i blocks. Compression ratio %i%%", i, header.num_blocks, ratio);
callback(temp, (float)i / (float)header.num_blocks, arg); callback(temp, (float)i / (float)header.num_blocks, arg);
} }

View File

@ -432,9 +432,9 @@ CFrame::CFrame(wxFrame* parent,
else else
{ {
if (SConfig::GetInstance().m_InterfaceLogWindow) if (SConfig::GetInstance().m_InterfaceLogWindow)
ToggleLogWindow(true); ToggleLogWindow(true);
if (SConfig::GetInstance().m_InterfaceConsole) if (SConfig::GetInstance().m_InterfaceConsole)
ToggleConsole(true); ToggleConsole(true);
} }
// Show window // Show window
@ -450,7 +450,7 @@ CFrame::CFrame(wxFrame* parent,
#if defined(HAVE_XRANDR) && HAVE_XRANDR #if defined(HAVE_XRANDR) && HAVE_XRANDR
m_XRRConfig = new X11Utils::XRRConfiguration(X11Utils::XDisplayFromHandle(GetHandle()), m_XRRConfig = new X11Utils::XRRConfiguration(X11Utils::XDisplayFromHandle(GetHandle()),
X11Utils::XWindowFromHandle(GetHandle())); X11Utils::XWindowFromHandle(GetHandle()));
#endif #endif
// ------------------------- // -------------------------
@ -666,8 +666,8 @@ bool CFrame::RendererHasFocus()
return false; return false;
// Why these different cases? // Why these different cases?
if (m_RenderParent == wxWindow::FindFocus() || if (m_RenderParent == wxWindow::FindFocus() ||
m_RenderParent == wxWindow::FindFocus()->GetParent() || m_RenderParent == wxWindow::FindFocus()->GetParent() ||
m_RenderParent->GetParent() == wxWindow::FindFocus()->GetParent()) m_RenderParent->GetParent() == wxWindow::FindFocus()->GetParent())
return true; return true;
#endif #endif
return false; return false;

View File

@ -145,8 +145,8 @@ void CFrame::ToggleConsole(bool bShow)
ConsoleParent->Enable(); ConsoleParent->Enable();
DoAddPage(ConsoleParent, DoAddPage(ConsoleParent,
g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[1] : 0, g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[1] : 0,
g_pCodeWindow ? bFloatWindow[1] : false); g_pCodeWindow ? bFloatWindow[1] : false);
} }
else // Hide else // Hide
{ {
@ -246,9 +246,9 @@ void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event)
wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject(); wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject();
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_LOGWINDOW) if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_LOGWINDOW)
ToggleLogWindow(false); ToggleLogWindow(false);
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_CONSOLEWINDOW) if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_CONSOLEWINDOW)
ToggleConsole(false); ToggleConsole(false);
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_REGISTERWINDOW) if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_REGISTERWINDOW)
g_pCodeWindow->ToggleRegisterWindow(false); g_pCodeWindow->ToggleRegisterWindow(false);
if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_BREAKPOINTWINDOW) if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_BREAKPOINTWINDOW)
@ -308,7 +308,7 @@ void CFrame::DoFloatNotebookPage(wxWindowID Id)
nb->RemovePage(nb->GetPageIndex(Win)); nb->RemovePage(nb->GetPageIndex(Win));
// Create the parent frame and reparent the window // Create the parent frame and reparent the window
CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW, CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW,
Win->GetName(), Win); Win->GetName(), Win);
if (nb->GetPageCount() == 0) if (nb->GetPageCount() == 0)
AddRemoveBlankPage(); AddRemoveBlankPage();
} }
@ -335,7 +335,7 @@ void CFrame::OnTab(wxAuiNotebookEvent& event)
wxMenu* MenuPopup = new wxMenu; wxMenu* MenuPopup = new wxMenu;
wxMenuItem* Item = new wxMenuItem(MenuPopup, wxID_ANY, wxMenuItem* Item = new wxMenuItem(MenuPopup, wxID_ANY,
wxT("Select floating windows")); wxT("Select floating windows"));
MenuPopup->Append(Item); MenuPopup->Append(Item);
Item->Enable(false); Item->Enable(false);
MenuPopup->Append(new wxMenuItem(MenuPopup)); MenuPopup->Append(new wxMenuItem(MenuPopup));
@ -345,7 +345,7 @@ void CFrame::OnTab(wxAuiNotebookEvent& event)
if (Win && Win->IsEnabled()) if (Win && Win->IsEnabled())
{ {
Item = new wxMenuItem(MenuPopup, i + IDM_FLOAT_LOGWINDOW - IDM_LOGWINDOW, Item = new wxMenuItem(MenuPopup, i + IDM_FLOAT_LOGWINDOW - IDM_LOGWINDOW,
Win->GetName(), wxT(""), wxITEM_CHECK); Win->GetName(), wxT(""), wxITEM_CHECK);
MenuPopup->Append(Item); MenuPopup->Append(Item);
Item->Check(!!FindWindowById(i + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW)); Item->Check(!!FindWindowById(i + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW));
} }
@ -402,7 +402,7 @@ void CFrame::DoRemovePage(wxWindow *Win, bool bHide)
if (!Win) return; if (!Win) return;
wxWindow *Parent = FindWindowById(Win->GetId() + wxWindow *Parent = FindWindowById(Win->GetId() +
IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW); IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW);
if (Parent) if (Parent)
{ {
@ -446,7 +446,7 @@ void CFrame::DoAddPage(wxWindow *Win, int i, bool Float)
GetNotebookFromId(i)->AddPage(Win, Win->GetName(), true); GetNotebookFromId(i)->AddPage(Win, Win->GetName(), true);
else else
CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW, CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW,
Win->GetName(), Win); Win->GetName(), Win);
} }
// Toolbar // Toolbar
@ -464,15 +464,15 @@ void CFrame::OnDropDownSettingsToolbar(wxAuiToolBarEvent& event)
wxMenu* menuPopup = new wxMenu; wxMenu* menuPopup = new wxMenu;
wxMenuItem* Item = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_ADD_PANE, wxMenuItem* Item = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_ADD_PANE,
wxT("Add new pane")); wxT("Add new pane"));
menuPopup->Append(Item); menuPopup->Append(Item);
menuPopup->Append(new wxMenuItem(menuPopup)); menuPopup->Append(new wxMenuItem(menuPopup));
Item = new wxMenuItem(menuPopup, IDM_TAB_SPLIT, wxT("Tab split"), Item = new wxMenuItem(menuPopup, IDM_TAB_SPLIT, wxT("Tab split"),
wxT(""), wxITEM_CHECK); wxT(""), wxITEM_CHECK);
menuPopup->Append(Item); menuPopup->Append(Item);
Item->Check(m_bTabSplit); Item->Check(m_bTabSplit);
Item = new wxMenuItem(menuPopup, IDM_NO_DOCKING, wxT("No docking"), Item = new wxMenuItem(menuPopup, IDM_NO_DOCKING, wxT("No docking"),
wxT(""), wxITEM_CHECK); wxT(""), wxITEM_CHECK);
menuPopup->Append(Item); menuPopup->Append(Item);
Item->Check(m_bNoDocking); Item->Check(m_bNoDocking);
@ -500,7 +500,7 @@ void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
// create the popup menu // create the popup menu
wxMenu* menuPopup = new wxMenu; wxMenu* menuPopup = new wxMenu;
wxMenuItem* Item = new wxMenuItem(menuPopup, IDM_ADD_PERSPECTIVE, wxMenuItem* Item = new wxMenuItem(menuPopup, IDM_ADD_PERSPECTIVE,
wxT("Create new perspective")); wxT("Create new perspective"));
menuPopup->Append(Item); menuPopup->Append(Item);
if (Perspectives.size() > 0) if (Perspectives.size() > 0)
@ -509,8 +509,8 @@ void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
for (u32 i = 0; i < Perspectives.size(); i++) for (u32 i = 0; i < Perspectives.size(); i++)
{ {
wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i, wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i,
wxString::FromAscii(Perspectives[i].Name.c_str()), wxString::FromAscii(Perspectives[i].Name.c_str()),
wxT(""), wxITEM_CHECK); wxT(""), wxITEM_CHECK);
menuPopup->Append(mItem); menuPopup->Append(mItem);
if (i == ActivePerspective) mItem->Check(true); if (i == ActivePerspective) mItem->Check(true);
} }
@ -564,10 +564,10 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
case IDM_ADD_PERSPECTIVE: case IDM_ADD_PERSPECTIVE:
{ {
wxTextEntryDialog dlg(this, wxTextEntryDialog dlg(this,
wxT("Enter a name for the new perspective:"), wxT("Enter a name for the new perspective:"),
wxT("Create new perspective")); wxT("Create new perspective"));
wxString DefaultValue = wxString::Format(wxT("Perspective %d"), wxString DefaultValue = wxString::Format(wxT("Perspective %d"),
Perspectives.size() + 1); Perspectives.size() + 1);
dlg.SetValue(DefaultValue); dlg.SetValue(DefaultValue);
bool DlgOk = false; int Return = 0; bool DlgOk = false; int Return = 0;
while (!DlgOk) while (!DlgOk)
@ -578,7 +578,7 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
else if (dlg.GetValue().Find(wxT(",")) != -1) else if (dlg.GetValue().Find(wxT(",")) != -1)
{ {
wxMessageBox(wxT("The name can not contain the character ','"), wxMessageBox(wxT("The name can not contain the character ','"),
wxT("Notice"), wxOK, this); wxT("Notice"), wxOK, this);
wxString Str = dlg.GetValue(); wxString Str = dlg.GetValue();
Str.Replace(wxT(","), wxT(""), true); Str.Replace(wxT(","), wxT(""), true);
dlg.SetValue(Str); dlg.SetValue(Str);
@ -586,7 +586,7 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
else if (dlg.GetValue().IsSameAs(wxT(""))) else if (dlg.GetValue().IsSameAs(wxT("")))
{ {
wxMessageBox(wxT("The name can not be empty"), wxMessageBox(wxT("The name can not be empty"),
wxT("Notice"), wxOK, this); wxT("Notice"), wxOK, this);
dlg.SetValue(DefaultValue); dlg.SetValue(DefaultValue);
} }
else else
@ -697,7 +697,7 @@ void CFrame::ResizeConsole()
if (!Win) return; if (!Win) return;
const int wxBorder = 2, Border = 4, const int wxBorder = 2, Border = 4,
MenuBar = 30, ScrollBar = 19; MenuBar = 30, ScrollBar = 19;
// Get the client size // Get the client size
int X = Win->GetSize().GetX(); int X = Win->GetSize().GetX();
@ -705,14 +705,14 @@ void CFrame::ResizeConsole()
int InternalWidth = X - wxBorder*2 - ScrollBar; int InternalWidth = X - wxBorder*2 - ScrollBar;
int InternalHeight = Y - wxBorder*2; int InternalHeight = Y - wxBorder*2;
int WindowWidth = InternalWidth + Border*2 + int WindowWidth = InternalWidth + Border*2 +
/*max out the width in the word wrap mode*/ 100; /*max out the width in the word wrap mode*/ 100;
int WindowHeight = InternalHeight + MenuBar; int WindowHeight = InternalHeight + MenuBar;
// Resize buffer // Resize buffer
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener(); ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
Console->PixelSpace(0,0, InternalWidth, InternalHeight, false); Console->PixelSpace(0,0, InternalWidth, InternalHeight, false);
// Move the window to hide the border // Move the window to hide the border
MoveWindow(GetConsoleWindow(), -Border-wxBorder, -MenuBar-wxBorder, MoveWindow(GetConsoleWindow(), -Border-wxBorder, -MenuBar-wxBorder,
WindowWidth + 100, WindowHeight, true); WindowWidth + 100, WindowHeight, true);
#endif #endif
} }
@ -734,16 +734,16 @@ void CFrame::SetPaneSize()
{ {
if (!m_Mgr->GetAllPanes()[i].IsOk()) return; if (!m_Mgr->GetAllPanes()[i].IsOk()) return;
if (Perspectives[ActivePerspective].Width.size() <= j || if (Perspectives[ActivePerspective].Width.size() <= j ||
Perspectives[ActivePerspective].Height.size() <= j) Perspectives[ActivePerspective].Height.size() <= j)
continue; continue;
u32 W = Perspectives[ActivePerspective].Width[j], u32 W = Perspectives[ActivePerspective].Width[j],
H = Perspectives[ActivePerspective].Height[j]; H = Perspectives[ActivePerspective].Height[j];
// Check limits // Check limits
W = Limit(W, 5, 95); W = Limit(W, 5, 95);
H = Limit(H, 5, 95); H = Limit(H, 5, 95);
// Convert percentages to pixel lengths // Convert percentages to pixel lengths
W = (W * iClientX) / 100; W = (W * iClientX) / 100;
H = (H * iClientY) / 100; H = (H * iClientY) / 100;
m_Mgr->GetAllPanes()[i].BestSize(W,H).MinSize(W,H); m_Mgr->GetAllPanes()[i].BestSize(W,H).MinSize(W,H);
j++; j++;
@ -826,7 +826,7 @@ void CFrame::LoadIniPerspectives()
_Section = StringFromFormat("P - %s", Tmp.Name.c_str()); _Section = StringFromFormat("P - %s", Tmp.Name.c_str());
ini.Get(_Section.c_str(), "Perspective", &_Perspective, ini.Get(_Section.c_str(), "Perspective", &_Perspective,
"layout2|" "layout2|"
"name=Pane 0;caption=Pane 0;state=768;dir=5;prop=100000;|" "name=Pane 0;caption=Pane 0;state=768;dir=5;prop=100000;|"
"name=Pane 1;caption=Pane 1;state=31458108;dir=4;prop=100000;|" "name=Pane 1;caption=Pane 1;state=31458108;dir=4;prop=100000;|"
"dock_size(5,0,0)=22|dock_size(4,0,0)=333|"); "dock_size(5,0,0)=22|dock_size(4,0,0)=333|");
@ -868,7 +868,7 @@ void CFrame::UpdateCurrentPerspective()
// Save width and height as a percentage of the client width and height // Save width and height as a percentage of the client width and height
current->Width.push_back( current->Width.push_back(
(m_Mgr->GetAllPanes()[i].window->GetClientSize().GetX() * 100) / (m_Mgr->GetAllPanes()[i].window->GetClientSize().GetX() * 100) /
iClientX); iClientX);
current->Height.push_back( current->Height.push_back(
(m_Mgr->GetAllPanes()[i].window->GetClientSize().GetY() * 100) / (m_Mgr->GetAllPanes()[i].window->GetClientSize().GetY() * 100) /
iClientY); iClientY);
@ -913,7 +913,7 @@ void CFrame::SaveIniPerspectives()
} }
// Remove the ending "," // Remove the ending ","
SWidth = SWidth.substr(0, SWidth.length()-1); SWidth = SWidth.substr(0, SWidth.length()-1);
SHeight = SHeight.substr(0, SHeight.length()-1); SHeight = SHeight.substr(0, SHeight.length()-1);
ini.Set(_Section.c_str(), "Width", SWidth.c_str()); ini.Set(_Section.c_str(), "Width", SWidth.c_str());
ini.Set(_Section.c_str(), "Height", SHeight.c_str()); ini.Set(_Section.c_str(), "Height", SHeight.c_str());
@ -945,7 +945,7 @@ wxWindow * CFrame::GetNotebookPageFromId(wxWindowID Id)
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue; continue;
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
for(u32 j = 0; j < NB->GetPageCount(); j++) for(u32 j = 0; j < NB->GetPageCount(); j++)
{ {
@ -956,10 +956,10 @@ wxWindow * CFrame::GetNotebookPageFromId(wxWindowID Id)
} }
wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title, wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title,
wxWindow * Child) wxWindow * Child)
{ {
wxFrame * Frame = new wxFrame(this, Id, Title, wxFrame * Frame = new wxFrame(this, Id, Title,
wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE); wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE);
Child->Reparent(Frame); Child->Reparent(Frame);
@ -989,10 +989,10 @@ wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title,
wxAuiNotebook* CFrame::CreateEmptyNotebook() wxAuiNotebook* CFrame::CreateEmptyNotebook()
{ {
const long NOTEBOOK_STYLE = wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | const long NOTEBOOK_STYLE = wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT |
wxAUI_NB_TAB_EXTERNAL_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_TAB_EXTERNAL_MOVE | wxAUI_NB_SCROLL_BUTTONS |
wxAUI_NB_WINDOWLIST_BUTTON | wxNO_BORDER; wxAUI_NB_WINDOWLIST_BUTTON | wxNO_BORDER;
wxAuiNotebook* NB = new wxAuiNotebook(this, wxID_ANY, wxAuiNotebook* NB = new wxAuiNotebook(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize, NOTEBOOK_STYLE); wxDefaultPosition, wxDefaultSize, NOTEBOOK_STYLE);
return NB; return NB;
} }
@ -1001,15 +1001,15 @@ void CFrame::AddRemoveBlankPage()
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue; continue;
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
for(u32 j = 0; j < NB->GetPageCount(); j++) for(u32 j = 0; j < NB->GetPageCount(); j++)
{ {
if (NB->GetPageText(j).IsSameAs(wxT("<>")) && NB->GetPageCount() > 1) if (NB->GetPageText(j).IsSameAs(wxT("<>")) && NB->GetPageCount() > 1)
NB->DeletePage(j); NB->DeletePage(j);
} }
if (NB->GetPageCount() == 0) if (NB->GetPageCount() == 0)
NB->AddPage(new wxPanel(this, wxID_ANY), wxT("<>"), true); NB->AddPage(new wxPanel(this, wxID_ANY), wxT("<>"), true);
} }
} }
@ -1018,12 +1018,12 @@ int CFrame::GetNotebookAffiliation(wxWindowID Id)
for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue; continue;
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
for(u32 k = 0; k < NB->GetPageCount(); k++) for(u32 k = 0; k < NB->GetPageCount(); k++)
{ {
if (NB->GetPage(k)->GetId() == Id) if (NB->GetPage(k)->GetId() == Id)
return j; return j;
} }
j++; j++;
} }
@ -1050,7 +1050,7 @@ int CFrame::GetNotebookCount()
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{ {
if (m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
Ret++; Ret++;
} }
return Ret; return Ret;
} }
@ -1060,9 +1060,9 @@ wxAuiNotebook * CFrame::GetNotebookFromId(u32 NBId)
for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{ {
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook))) if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue; continue;
if (j == NBId) if (j == NBId)
return (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; return (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
j++; j++;
} }
return NULL; return NULL;

View File

@ -316,7 +316,7 @@ wxString CFrame::GetMenuLabel(int Id)
case HK_WIIMOTE3_CONNECT: case HK_WIIMOTE3_CONNECT:
case HK_WIIMOTE4_CONNECT: case HK_WIIMOTE4_CONNECT:
Label = wxString::Format(_T("Connect Wiimote %i\t"), Label = wxString::Format(_T("Connect Wiimote %i\t"),
Id - HK_WIIMOTE1_CONNECT + 1); Id - HK_WIIMOTE1_CONNECT + 1);
break; break;
} }
@ -361,7 +361,7 @@ void CFrame::PopulateToolbar(wxAuiToolBar* ToolBar)
void CFrame::PopulateToolbarAui(wxAuiToolBar* ToolBar) void CFrame::PopulateToolbarAui(wxAuiToolBar* ToolBar)
{ {
int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(), int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(),
h = m_Bitmaps[Toolbar_FileOpen].GetHeight(); h = m_Bitmaps[Toolbar_FileOpen].GetHeight();
ToolBar->SetToolBitmapSize(wxSize(w, h)); ToolBar->SetToolBitmapSize(wxSize(w, h));
ToolBar->AddTool(IDM_SAVE_PERSPECTIVE, wxT("Save"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], wxT("Save current perspective")); ToolBar->AddTool(IDM_SAVE_PERSPECTIVE, wxT("Save"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], wxT("Save current perspective"));
@ -719,7 +719,7 @@ void CFrame::OnRenderParentResize(wxSizeEvent& event)
m_RenderParent->GetSize(&width, &height); m_RenderParent->GetSize(&width, &height);
m_RenderParent->GetPosition(&x, &y); m_RenderParent->GetPosition(&x, &y);
X11Utils::SendClientEvent(X11Utils::XDisplayFromHandle(GetHandle()), X11Utils::SendClientEvent(X11Utils::XDisplayFromHandle(GetHandle()),
"RESIZE", x, y, width, height); "RESIZE", x, y, width, height);
#endif #endif
m_LogWindow->Refresh(); m_LogWindow->Refresh();
m_LogWindow->Update(); m_LogWindow->Update();
@ -736,7 +736,7 @@ void CFrame::ToggleDisplayMode (bool bFullscreen)
memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize = sizeof(dmScreenSettings); dmScreenSettings.dmSize = sizeof(dmScreenSettings);
sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str(), sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str(),
"%dx%d", &dmScreenSettings.dmPelsWidth, &dmScreenSettings.dmPelsHeight); "%dx%d", &dmScreenSettings.dmPelsWidth, &dmScreenSettings.dmPelsHeight);
dmScreenSettings.dmBitsPerPel = 32; dmScreenSettings.dmBitsPerPel = 32;
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
@ -1450,20 +1450,20 @@ void CFrame::DoToggleToolbar(bool _show)
{ {
m_Mgr->GetPane(wxT("TBMain")).Show(); m_Mgr->GetPane(wxT("TBMain")).Show();
if (g_pCodeWindow) if (g_pCodeWindow)
{ {
m_Mgr->GetPane(wxT("TBDebug")).Show(); m_Mgr->GetPane(wxT("TBDebug")).Show();
m_Mgr->GetPane(wxT("TBAui")).Show(); m_Mgr->GetPane(wxT("TBAui")).Show();
} }
m_Mgr->Update(); m_Mgr->Update();
} }
else else
{ {
m_Mgr->GetPane(wxT("TBMain")).Hide(); m_Mgr->GetPane(wxT("TBMain")).Hide();
if (g_pCodeWindow) if (g_pCodeWindow)
{ {
m_Mgr->GetPane(wxT("TBDebug")).Hide(); m_Mgr->GetPane(wxT("TBDebug")).Hide();
m_Mgr->GetPane(wxT("TBAui")).Hide(); m_Mgr->GetPane(wxT("TBAui")).Hide();
} }
m_Mgr->Update(); m_Mgr->Update();
} }
} }

View File

@ -1200,19 +1200,19 @@ void CGameListCtrl::CompressSelection(bool _compress)
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
); );
progressDialog.SetSize(wxSize(600, 180)); progressDialog.SetSize(wxSize(340, 180));
progressDialog.CenterOnParent(); progressDialog.CenterOnParent();
m_currentItem = 0; m_currentItem = 0;
m_numberItem = GetSelectedItemCount(); m_numberItem = GetSelectedItemCount();
for (u32 i=0; i<m_numberItem; i++) for (u32 i=0; i < m_numberItem; i++)
{ {
const GameListItem *iso = GetSelectedISO(); const GameListItem *iso = GetSelectedISO();
if (!iso->IsCompressed() && _compress) if (!iso->IsCompressed() && _compress)
{ {
std::string FileName; std::string FileName, FileExt;
SplitPath(iso->GetFileName(), NULL, &FileName, NULL); SplitPath(iso->GetFileName(), NULL, &FileName, &FileExt);
m_currentFilename = FileName; m_currentFilename = FileName;
FileName.append(".gcz"); FileName.append(".gcz");
@ -1221,6 +1221,14 @@ void CGameListCtrl::CompressSelection(bool _compress)
(const char *)browseDialog.GetPath().mb_str(wxConvUTF8), (const char *)browseDialog.GetPath().mb_str(wxConvUTF8),
FileName); FileName);
if (wxFileExists(wxString::FromAscii(OutputFileName.c_str())) &&
wxMessageBox(
_("The file ") + wxString::FromAscii(OutputFileName.c_str()) +
_(" already exists.\nDo you wish to replace it?"),
_("Confirm File Overwrite"),
wxYES_NO) == wxNO)
continue;
DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), DiscIO::CompressFileToBlob(iso->GetFileName().c_str(),
OutputFileName.c_str(), OutputFileName.c_str(),
(iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0, (iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0,
@ -1228,8 +1236,8 @@ void CGameListCtrl::CompressSelection(bool _compress)
} }
else if (iso->IsCompressed() && !_compress) else if (iso->IsCompressed() && !_compress)
{ {
std::string FileName; std::string FileName, FileExt;
SplitPath(iso->GetFileName(), NULL, &FileName, NULL); SplitPath(iso->GetFileName(), NULL, &FileName, &FileExt);
m_currentFilename = FileName; m_currentFilename = FileName;
if (iso->GetPlatform() == GameListItem::WII_DISC) if (iso->GetPlatform() == GameListItem::WII_DISC)
FileName.append(".iso"); FileName.append(".iso");
@ -1241,6 +1249,14 @@ void CGameListCtrl::CompressSelection(bool _compress)
(const char *)browseDialog.GetPath().mb_str(wxConvUTF8), (const char *)browseDialog.GetPath().mb_str(wxConvUTF8),
FileName); FileName);
if (wxFileExists(wxString::FromAscii(OutputFileName.c_str())) &&
wxMessageBox(
_("The file ") + wxString::FromAscii(OutputFileName.c_str()) +
_(" already exists.\nDo you wish to replace it?"),
_("Confirm File Overwrite"),
wxYES_NO) == wxNO)
continue;
DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(), DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(),
OutputFileName.c_str(), &MultiCompressCB, &progressDialog); OutputFileName.c_str(), &MultiCompressCB, &progressDialog);
} }
@ -1261,52 +1277,60 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
if (!iso) if (!iso)
return; return;
wxString path, Ext; wxString path;
std::string FileName; std::string FileName, FilePath, FileExtension;
SplitPath(iso->GetFileName(), NULL, &FileName, NULL); SplitPath(iso->GetFileName(), &FilePath, &FileName, &FileExtension);
if (iso->IsCompressed()) do
{ {
if (iso->GetPlatform() == GameListItem::WII_DISC) if (iso->IsCompressed())
Ext = wxT("*.iso"); {
wxString Ext;
if (iso->GetPlatform() == GameListItem::WII_DISC)
Ext = wxT("*.iso");
else
Ext = wxT("*.gcm");
path = wxFileSelector(
_T("Save decompressed GCM/ISO"),
wxString(FilePath.c_str(), *wxConvCurrent),
wxString(FileName.c_str(), *wxConvCurrent) + Ext.After('*'),
wxEmptyString,
wxString::Format
(
_T("All GC/Wii ISO files (%s)|%s|All files (%s)|%s"),
(wxChar *)Ext.After('.').wchar_str(),
(wxChar *)Ext.wchar_str(),
wxFileSelectorDefaultWildcardStr,
wxFileSelectorDefaultWildcardStr
),
wxFD_SAVE,
this);
}
else else
Ext = wxT("*.gcm"); {
path = wxFileSelector(
path = wxFileSelector( _T("Save compressed GCM/ISO"),
_T("Save decompressed ISO"), wxString(FilePath.c_str(), *wxConvCurrent),
wxEmptyString, wxString(FileName.c_str(), *wxConvCurrent), wxEmptyString, wxString(FileName.c_str(), *wxConvCurrent) + _T(".gcz"),
wxString::Format wxEmptyString,
( wxString::Format
_T("All GC/Wii ISO files (%s)|%s|All files (%s)|%s"), (
(char *)Ext.After('.').char_str(wxConvUTF8), _T("All compressed GC/Wii ISO files (gcz)|*.gcz|All files (%s)|%s"),
(char *)Ext.char_str(wxConvUTF8), wxFileSelectorDefaultWildcardStr,
wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr
wxFileSelectorDefaultWildcardStr ),
), wxFD_SAVE,
wxFD_SAVE, this);
this); }
if (!path) if (!path)
return; return;
} } while (wxFileExists(path) &&
else wxMessageBox(
{ _("The file ") + path + _(" already exists.\nDo you wish to replace it?"),
path = wxFileSelector( _("Confirm File Overwrite"),
_T("Save compressed ISO"), wxYES_NO) == wxNO);
wxEmptyString, wxString(FileName.c_str(), *wxConvCurrent), wxEmptyString,
wxString::Format
(
_T("All compressed GC/Wii ISO files (gcz)|*.gcz|All files (%s)|%s"),
wxFileSelectorDefaultWildcardStr,
wxFileSelectorDefaultWildcardStr
),
wxFD_SAVE,
this);
if (!path)
return;
}
wxProgressDialog dialog(iso->IsCompressed() ? wxProgressDialog dialog(iso->IsCompressed() ?
_T("Decompressing ISO") : _T("Compressing ISO"), _T("Decompressing ISO") : _T("Compressing ISO"),
@ -1320,7 +1344,7 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
); );
dialog.SetSize(wxSize(280, 180)); dialog.SetSize(wxSize(340, 180));
dialog.CenterOnParent(); dialog.CenterOnParent();
if (iso->IsCompressed()) if (iso->IsCompressed())