| 1 |
< |
/* |
| 2 |
< |
AE/Mod Installer |
| 3 |
< |
by Gumby and Iritscen |
| 4 |
< |
*/ |
| 5 |
< |
|
| 6 |
< |
// To-do: - |
| 7 |
< |
// - Institute lots of checks into file-handling |
| 8 |
< |
// - Clear mod info fields when mod is de-selected ??? |
| 9 |
< |
|
| 10 |
< |
#define DEBUG |
| 11 |
< |
#include <stdio.h> |
| 12 |
< |
//#include <conio.h> |
| 13 |
< |
//#include <process.h> |
| 14 |
< |
#include <string> |
| 15 |
< |
#include <iostream> |
| 16 |
< |
#include <cctype> |
| 17 |
< |
#include <vector> |
| 18 |
< |
#include <fstream> |
| 19 |
< |
#include <errno.h> |
| 20 |
< |
#include <sstream> |
| 21 |
< |
|
| 22 |
< |
#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations |
| 23 |
< |
#include "boost/lexical_cast.hpp" //int -> string |
| 24 |
< |
#include "installer.h" |
| 1 |
> |
/***************************************************************************\ |
| 2 |
> |
| Project: AE Installer | |
| 3 |
> |
| By: Gumby & Iritscen | |
| 4 |
> |
| File: Main_Window.cpp | |
| 5 |
> |
| Function: Handles the GUI. | |
| 6 |
> |
| Created: 07/05/2009 20:38:25 | |
| 7 |
> |
\***************************************************************************/ |
| 8 |
|
|
| 9 |
< |
#ifdef WIN32 |
| 10 |
< |
#include <windows.h> |
| 28 |
< |
#else // assume we're on Mac |
| 29 |
< |
#include <stdlib.h> |
| 30 |
< |
#include <dirent.h> |
| 9 |
> |
#ifndef NTDDI_VERSION |
| 10 |
> |
#define NTDDI_VERSION NTDDI_WIN7 |
| 11 |
|
#endif |
| 32 |
– |
|
| 33 |
– |
const string strInstallerVersion = "1.0"; |
| 34 |
– |
const bool SPLIT = 1; |
| 35 |
– |
const bool NOT_SPLIT = 0; |
| 36 |
– |
bool splitInstances = SPLIT; |
| 37 |
– |
bool busy = 0; |
| 12 |
|
#ifdef WIN32 |
| 13 |
< |
const string strOniSplit = "Onisplit.exe"; |
| 14 |
< |
string strImportOption = "-import:nosep"; |
| 15 |
< |
const char* strClsCmd = "cls"; |
| 16 |
< |
const char* strPauseCmd = "PAUSE"; |
| 17 |
< |
#else // set up Mac equivalents since we're in Mac OS |
| 44 |
< |
const string strOniSplit = "mono Onisplit.exe"; |
| 45 |
< |
string strImportOption = "-import:sep"; |
| 46 |
< |
const char* strClsCmd = "clear"; |
| 47 |
< |
const char* strPauseCmd = "read -n 1 -p \"Press any key to continue\""; |
| 48 |
< |
void Sleep(int ms) { sleep( ms / 1000 ); } |
| 13 |
> |
#include <windows.h> |
| 14 |
> |
#include <shobjidl.h> |
| 15 |
> |
HWND Handle; |
| 16 |
> |
ITaskbarList *pTaskbarList; |
| 17 |
> |
ITaskbarList3 *pTaskbarList3; |
| 18 |
|
#endif |
| 19 |
|
|
| 51 |
– |
using namespace boost::filesystem; |
| 52 |
– |
using namespace std; |
| 53 |
– |
|
| 54 |
– |
|
| 55 |
– |
|
| 56 |
– |
|
| 57 |
– |
#include "boost/date_time/gregorian/gregorian.hpp" |
| 58 |
– |
#include "boost/date_time/date_parsing.hpp" |
| 59 |
– |
#include "boost/date_time/posix_time/posix_time.hpp" |
| 60 |
– |
|
| 61 |
– |
int globalizeData(void) |
| 62 |
– |
{ |
| 63 |
– |
busy = 1; |
| 64 |
– |
using boost::lexical_cast; |
| 65 |
– |
using boost::bad_lexical_cast; |
| 66 |
– |
// using namespace boost::posix_time; |
| 67 |
– |
using namespace boost::gregorian; |
| 68 |
– |
using namespace boost::posix_time; |
| 69 |
– |
ptime start_time(second_clock::local_time()); |
| 70 |
– |
|
| 71 |
– |
setStatusArea("Globalizing!"); |
| 72 |
– |
int err = 0; |
| 73 |
– |
int parts_done = 0; |
| 74 |
– |
char Step_x_x[300]; |
| 75 |
– |
//char levels[i][5]; |
| 76 |
– |
remove("Globalize.log"); |
| 77 |
– |
ofstream logfile("Globalize.log"); |
| 78 |
– |
logfile << "Globalization started " << to_simple_string(start_time) << endl; |
| 79 |
– |
try { |
| 80 |
– |
|
| 81 |
– |
char levels_cstr[15][3] = {"0", "1", "2", "3", "4", "6", "8", "9", "10", "11", "12", "13", "14", "18", "19"}; // the levels Oni has...probably should have made a string array. Oops. |
| 82 |
– |
//const vector<double> ck(cv, &cv[CvSize]); |
| 83 |
– |
vector<string> levels; |
| 84 |
– |
for (int f = 0; f < 15; f++) { |
| 85 |
– |
levels.push_back(levels_cstr[f]); |
| 86 |
– |
} |
| 87 |
– |
char choice = 0; |
| 88 |
– |
|
| 89 |
– |
//SetCurrentDirectory("C:/Program Files/Oni/edition/install"); |
| 90 |
– |
///char levels[i][3]; |
| 91 |
– |
path Characters = "../GameDataFolder/level0_Characters"; |
| 92 |
– |
path Particles = "../GameDataFolder/level0_Particles"; |
| 93 |
– |
path Archive = "../GameDataFolder/Archive"; |
| 94 |
– |
path Textures = "../GameDataFolder/level0_Textures"; |
| 95 |
– |
path Sounds = "../GameDataFolder/level0_Sounds"; |
| 96 |
– |
path Animations = "../GameDataFolder/level0_Animations"; |
| 97 |
– |
path TRAC = Animations / "level0_TRAC"; |
| 98 |
– |
path TRAM = Animations / "level0_TRAM"; |
| 99 |
– |
|
| 100 |
– |
vector<path> GDFPaths; |
| 101 |
– |
GDFPaths.push_back(Characters); |
| 102 |
– |
GDFPaths.push_back(Particles); |
| 103 |
– |
GDFPaths.push_back(Textures); |
| 104 |
– |
GDFPaths.push_back(Sounds); |
| 105 |
– |
GDFPaths.push_back(TRAC); |
| 106 |
– |
GDFPaths.push_back(TRAM); |
| 107 |
– |
|
| 108 |
– |
|
| 109 |
– |
path VanillaCharacters = "packages/VanillaDats/level0_Final/level0_Characters/level0_Characters.oni"; |
| 110 |
– |
path VanillaParticles = "packages/VanillaDats/level0_Final/level0_Particles/level0_Particles.oni"; |
| 111 |
– |
path VanillaTextures = "packages/VanillaDats/level0_Final/level0_Textures/level0_Textures.oni"; |
| 112 |
– |
path VanillaSounds = "packages/VanillaDats/level0_Final/level0_Sounds/level0_Sounds.oni"; |
| 113 |
– |
path VanillaAnimations = "packages/VanillaDats/level0_Final/level0_Animations/level0_Animations.oni"; |
| 114 |
– |
path VanillaTRAC = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAC.oni"; |
| 115 |
– |
path VanillaTRAM = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAM.oni"; |
| 116 |
– |
|
| 117 |
– |
vector<path> VanillaPaths; |
| 118 |
– |
|
| 119 |
– |
VanillaPaths.push_back(VanillaCharacters); |
| 120 |
– |
VanillaPaths.push_back(VanillaParticles); |
| 121 |
– |
VanillaPaths.push_back(VanillaTextures); |
| 122 |
– |
VanillaPaths.push_back(VanillaSounds); |
| 123 |
– |
VanillaPaths.push_back(VanillaTRAC); |
| 124 |
– |
VanillaPaths.push_back(VanillaTRAM); |
| 125 |
– |
|
| 126 |
– |
/* |
| 127 |
– |
if (exists("../GameDataFolder/")) |
| 128 |
– |
{ |
| 129 |
– |
//cout << "\nIt looks like you've already globalized Oni's data.\nDo you want to re-globalize?\n(This will erase existing mods installed to the AE's game data.)" |
| 130 |
– |
// << "\n1. Re-globalize" |
| 131 |
– |
// << "\n2. Return to main menu\n"; |
| 132 |
– |
//choice = cin.get(); |
| 133 |
– |
cin.ignore(128, '\n'); |
| 134 |
– |
if (choice == '1') |
| 135 |
– |
remove_all("../GameDataFolder"); // remove AE GDF |
| 136 |
– |
if (choice == '2') |
| 137 |
– |
return 0; |
| 138 |
– |
} |
| 139 |
– |
*/ |
| 140 |
– |
setStatusArea("Removing old GameDataFolder...\n"); |
| 141 |
– |
logfile << "Removing old GameDataFolder...\n"; |
| 142 |
– |
remove_all( "../GameDataFolder/" ); |
| 143 |
– |
setStatusArea("Creating needed directories..."); |
| 144 |
– |
logfile << "Creating needed directories...\n"; |
| 145 |
– |
create_directory( "../GameDataFolder/" ); |
| 146 |
– |
|
| 147 |
– |
create_directory( "packages" ); |
| 148 |
– |
|
| 149 |
– |
if (exists("packages/VanillaDats")) remove_all("packages/VanillaDats"); |
| 150 |
– |
create_directory( "packages/VanillaDats" ); |
| 151 |
– |
|
| 152 |
– |
create_directory( "packages/VanillaDats/level0_Final/" ); |
| 153 |
– |
//blah blah finish this. |
| 154 |
– |
//logfile << "packages/VanillaDats/level0_Final/ created"; |
| 155 |
– |
create_directory( Characters ); |
| 156 |
– |
create_directory( Particles ); |
| 157 |
– |
create_directory( Archive ); |
| 158 |
– |
create_directory( Textures ); |
| 159 |
– |
create_directory( Sounds ); |
| 160 |
– |
create_directory( Animations ); |
| 161 |
– |
create_directory( TRAC ); |
| 162 |
– |
create_directory( TRAM ); |
| 163 |
– |
int num_levels = 0; |
| 164 |
– |
for(int i = 1; i < 15; i++) |
| 165 |
– |
{ |
| 166 |
– |
if (exists("../../GameDataFolder/level" + levels[i] + "_Final.dat")) { |
| 167 |
– |
num_levels++; |
| 168 |
– |
|
| 169 |
– |
} |
| 170 |
– |
} |
| 171 |
– |
logfile << "Exporting and moving...\n\n"; |
| 172 |
– |
int total_steps = 8 + 2 * num_levels; |
| 173 |
– |
for(int i = 0; i < 15; i++) |
| 174 |
– |
{ |
| 175 |
– |
|
| 176 |
– |
//printf(levels[i],"%d",levels[i]); // int to char array |
| 177 |
– |
|
| 178 |
– |
if (exists("../../GameDataFolder/level" + levels[i] + "_Final.dat")) { |
| 179 |
– |
logfile << "level" << levels[i] << "_Final\n"; |
| 180 |
– |
logfile << "\tExporting level" << levels[i] << "_Final.dat\n"; |
| 181 |
– |
//printf(Step_x_x,"Step %d/%d: exporting level%d_final.dat", parts_done + 1,, levels[i]); setStatusArea((string)Step_x_x); |
| 182 |
– |
setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + " exporting level" + levels[i]+"_Final.dat"); |
| 183 |
– |
create_directory( "../GameDataFolder/level" + levels[i] + "_Final" ); |
| 184 |
– |
// setStatusArea(strOniSplit + " -export ../GameDataFolder/level" + levels[i] + "_Final ../../GameDataFolder/level" + levels[i] + "_Final.dat"); |
| 185 |
– |
system((strOniSplit + " -export ../GameDataFolder/level" + levels[i] + "_Final ../../GameDataFolder/level" + levels[i] + "_Final.dat").c_str()); |
| 186 |
– |
create_directory( "packages/VanillaDats/level" + levels[i] + "_Final" ); |
| 187 |
– |
create_directory( "packages/VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final" ); |
| 188 |
– |
|
| 189 |
– |
directory_iterator end_iter; |
| 190 |
– |
for ( directory_iterator dir_itr( "../GameDataFolder/level" + levels[i] + "_Final" ); dir_itr != end_iter; ++dir_itr ) |
| 191 |
– |
{ |
| 192 |
– |
//cout << dir_itr->path().filename(); |
| 193 |
– |
if ( is_regular_file( dir_itr->status() ) ) |
| 194 |
– |
{ |
| 195 |
– |
if ( dir_itr->path().filename().substr(0,8) == "TXMPfail" || |
| 196 |
– |
dir_itr->path().filename().substr(0,9) == "TXMPlevel" || |
| 197 |
– |
( dir_itr->path().filename().substr(0,4) == "TXMP" && dir_itr->path().filename().find("intro")!=string::npos) || |
| 198 |
– |
dir_itr->path().filename().substr(0,4) == "TXMB" || |
| 199 |
– |
dir_itr->path().filename() == "M3GMpowerup_lsi.oni" || |
| 200 |
– |
dir_itr->path().filename() == "TXMPlsi_icon.oni" || |
| 201 |
– |
( dir_itr->path().filename().substr(0,4) == "TXMB" && dir_itr->path().filename().find("splash_screen.oni")!=string::npos) ) |
| 202 |
– |
{ |
| 203 |
– |
cout <<dir_itr->path().filename() << "\n"; |
| 204 |
– |
create_directory( dir_itr->path().parent_path() / "NoGlobal"); |
| 205 |
– |
if(!exists( dir_itr->path().parent_path() / "NoGlobal" / dir_itr->filename())) rename(dir_itr->path(), dir_itr->path().parent_path() / "NoGlobal" / |
| 206 |
– |
dir_itr->filename()); |
| 207 |
– |
else remove(dir_itr->path()); |
| 208 |
– |
} |
| 209 |
– |
else if (dir_itr->path().filename().substr(0,4) == "TRAC" |
| 210 |
– |
|| dir_itr->path().filename().substr(0,4) == "ONVL") { |
| 211 |
– |
cout <<dir_itr->path().filename() << "\n"; |
| 212 |
– |
if(!exists( TRAC / dir_itr->filename())) rename(dir_itr->path(), TRAC / dir_itr->filename()); |
| 213 |
– |
else remove(dir_itr->path()); |
| 214 |
– |
} |
| 215 |
– |
else if (dir_itr->path().filename().substr(0,4) == "TRAM") { |
| 216 |
– |
cout <<dir_itr->path().filename() << "\n"; |
| 217 |
– |
if(!exists( TRAM / dir_itr->filename())) rename(dir_itr->path(), TRAM / dir_itr->filename()); |
| 218 |
– |
else remove(dir_itr->path()); |
| 219 |
– |
} |
| 220 |
– |
else if (dir_itr->path().filename().substr(0,4) == "ONSK" || |
| 221 |
– |
dir_itr->path().filename().substr(0,4) == "TXMP") { |
| 222 |
– |
cout <<dir_itr->path().filename() << "\n";\ |
| 223 |
– |
create_directory( dir_itr->path().parent_path() / "TexFix"); |
| 224 |
– |
if(!exists( Textures / dir_itr->filename())) rename(dir_itr->path(), Textures / dir_itr->filename()); |
| 225 |
– |
//rename(dir_itr->path(), dir_itr->path().parent_path() / "TexFix" / dir_itr->filename()); |
| 226 |
– |
} |
| 227 |
– |
else if (dir_itr->path().filename().substr(0,4) == "ONCC" |
| 228 |
– |
|| dir_itr->path().filename().substr(0,4) == "TRBS" |
| 229 |
– |
|| dir_itr->path().filename().substr(0,4) == "ONCV" |
| 230 |
– |
|| dir_itr->path().filename().substr(0,4) == "TRMA" |
| 231 |
– |
|| dir_itr->path().filename().substr(0,4) == "TRSC" |
| 232 |
– |
|| dir_itr->path().filename().substr(0,4) == "TRAS") { |
| 233 |
– |
cout <<dir_itr->path().filename() << "\n"; |
| 234 |
– |
if(!exists( Characters / dir_itr->filename())) rename(dir_itr->path(), Characters / dir_itr->filename()); |
| 235 |
– |
else remove(dir_itr->path()); |
| 236 |
– |
} |
| 237 |
– |
else if (dir_itr->path().filename().substr(0,4) == "OSBD" |
| 238 |
– |
|| dir_itr->path().filename().substr(0,4) == "SNDD") { |
| 239 |
– |
cout << dir_itr->path().filename() << "\n"; |
| 240 |
– |
if(!exists( Sounds / dir_itr->filename())) rename(dir_itr->path(), Sounds / dir_itr->filename()); |
| 241 |
– |
else remove(dir_itr->path()); |
| 242 |
– |
} |
| 243 |
– |
else if (dir_itr->path().filename().substr(0,5) == "BINA3" |
| 244 |
– |
|| dir_itr->path().filename().substr(0,10) == "M3GMdebris" |
| 245 |
– |
|| dir_itr->path().filename() == "M3GMtoxic_bubble.oni" |
| 246 |
– |
|| dir_itr->path().filename().substr(0,8) == "M3GMelec" |
| 247 |
– |
|| dir_itr->path().filename().substr(0,7) == "M3GMrat" |
| 248 |
– |
|| dir_itr->path().filename().substr(0,7) == "M3GMjet" |
| 249 |
– |
|| dir_itr->path().filename().substr(0,9) == "M3GMbomb_" |
| 250 |
– |
|| dir_itr->path().filename() == "M3GMbarab_swave.oni" |
| 251 |
– |
|| dir_itr->path().filename() == "M3GMbloodyfoot.oni" |
| 252 |
– |
){ |
| 253 |
– |
cout <<dir_itr->path().filename() << "\n"; |
| 254 |
– |
if(!exists( Particles / dir_itr->filename())) rename(dir_itr->path(), Particles / dir_itr->filename()); |
| 255 |
– |
else remove(dir_itr->path()); |
| 256 |
– |
} |
| 257 |
– |
else if (dir_itr->path().filename().substr(0,4) == "AGDB" |
| 258 |
– |
|| dir_itr->path().filename().substr(0,4) == "TRCM") { |
| 259 |
– |
cout <<dir_itr->path().filename() << "\n"; |
| 260 |
– |
|
| 261 |
– |
if(!exists( Archive / dir_itr->filename())) rename(dir_itr->path(), Archive / dir_itr->filename()); |
| 262 |
– |
else remove(dir_itr->path()); |
| 263 |
– |
} |
| 264 |
– |
if (exists(dir_itr->path())) { |
| 265 |
– |
|
| 266 |
– |
} |
| 267 |
– |
else { |
| 268 |
– |
logfile << "\tMoved file: " << dir_itr->path().filename() << "\n"; |
| 269 |
– |
} |
| 270 |
– |
} |
| 271 |
– |
|
| 272 |
– |
|
| 273 |
– |
|
| 274 |
– |
} |
| 275 |
– |
logfile << "\tCleaning up TXMPs...\n"; |
| 276 |
– |
system( (strOniSplit + " -move:delete " + Textures.string() + " ../GameDataFolder/level" + levels[i] + "_Final/TXMP*.oni").c_str()); |
| 277 |
– |
parts_done++; |
| 278 |
– |
|
| 279 |
– |
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 280 |
– |
|
| 281 |
– |
} |
| 282 |
– |
} |
| 283 |
– |
logfile << "Reimporting levels\n"; |
| 284 |
– |
for (int i = 0; i < 15; i++) |
| 285 |
– |
{ |
| 286 |
– |
logfile << "\tReimporting level" << levels[i] << "_Final.oni\n"; |
| 287 |
– |
//printf(levels[i],"%d",levels[i]); |
| 288 |
– |
//printf(Step_x_x,"Step %d/%d: reimporting level", parts_done + 1, 7 + 2 * num_levels); setStatusArea((string)Step_x_x + levels[i] + (string)"_Final.dat"); |
| 289 |
– |
setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + " reimporting level" + levels[i]+"_Final.oni"); |
| 290 |
– |
system( (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final packages/VanillaDats/level" + levels[i] + "_Final/level" |
| 291 |
– |
+ levels[i] + "_Final/level" + levels[i] + "_Final.oni > Globalize.oni").c_str()); |
| 292 |
– |
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 293 |
– |
parts_done++; |
| 294 |
– |
} |
| 295 |
– |
create_directory( VanillaCharacters.parent_path() ); |
| 296 |
– |
create_directory( VanillaParticles.parent_path() ); |
| 297 |
– |
create_directory( VanillaTextures.parent_path() ); |
| 298 |
– |
create_directory( VanillaSounds.parent_path() ); |
| 299 |
– |
create_directory( VanillaAnimations.remove_filename() ); |
| 300 |
– |
|
| 301 |
– |
for(int j = 0; j < GDFPaths.size(); j++) { |
| 302 |
– |
logfile << "\tReimporting " << GDFPaths[j].filename() << ".oni\n"; |
| 303 |
– |
setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + ": reimporting " + GDFPaths[j].filename() ); |
| 304 |
– |
system((strOniSplit + " " + strImportOption + " " + GDFPaths[j].string() + " " + VanillaPaths[j].string()).c_str()); |
| 305 |
– |
parts_done++; |
| 306 |
– |
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 307 |
– |
} |
| 308 |
– |
/* |
| 309 |
– |
printf(Step_x_x,"Step %d/%d: reimporting level0_Characters", parts_done,7 + 2 * num_levels); setStatusArea((string)Step_x_x);setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) )); |
| 310 |
– |
system((strOniSplit + " " + strImportOption + " " + Characters.string() + " " + VanillaCharacters.string()).c_str()); |
| 311 |
– |
parts_done++; printf(Step_x_x,"Step %d/%d: reimporting level0_Particles", parts_done,7 + 2 * num_levels); setStatusArea((string)Step_x_x);setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) )); |
| 312 |
– |
system((strOniSplit + " " + strImportOption + " " + Particles.string() + " " + VanillaParticles.string()).c_str()); |
| 313 |
– |
parts_done++; printf(Step_x_x,"Step %d/%d: reimporting level0_Textures", parts_done,7 + 2 * num_levels); setStatusArea((string)Step_x_x);setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) )); |
| 314 |
– |
system((strOniSplit + " " + strImportOption + " " + Textures.string() + " " + VanillaTextures.string()).c_str()); |
| 315 |
– |
//system((strOniSplit + " " + strImportOption + (string)" " + Animations.string() + (string)" " + VanillaAnimations.string()).c_str()); |
| 316 |
– |
parts_done++; printf(Step_x_x,"Step %d/%d: reimporting level0_TRAC", parts_done,7 + 2 * num_levels); setStatusArea((string)Step_x_x);setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) )); |
| 317 |
– |
system((strOniSplit + " " + strImportOption + " " + TRAC.string() + " " + VanillaTRAC.string()).c_str()); |
| 318 |
– |
parts_done++; printf(Step_x_x,"Step %d/%d: reimporting level0_Sounds", parts_done,7 + 2 * num_levels); setStatusArea((string)Step_x_x);setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) )); |
| 319 |
– |
system((strOniSplit + " " + strImportOption + " " + Sounds.string() + " " + VanillaSounds.string()).c_str()); |
| 320 |
– |
parts_done++; printf(Step_x_x,"Step %d/%d: reimporting level0_TRAM", parts_done,7 + 2 * num_levels); setStatusArea((string)Step_x_x);setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) )); |
| 321 |
– |
system((strOniSplit + " " + strImportOption + " " + TRAM.string() + " " + VanillaTRAM.string()).c_str()); |
| 322 |
– |
//parts_done++; setStatusArea((string)"Copying level scripts...");setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) )); |
| 323 |
– |
if (exists("../GameDataFolder/IGMD")) remove_all("../GameDataFolder/IGMD"); |
| 324 |
– |
*/ |
| 325 |
– |
create_directory((path)"../GameDataFolder/IGMD"); |
| 326 |
– |
copy((path)"packages/VanillaBSL/IGMD", (path)"../GameDataFolder"); |
| 327 |
– |
setProgressBar( 1000 ); |
| 328 |
– |
setStatusArea((string)"Done! Now select your mod packages and click install."); |
| 329 |
– |
// while(1) Sleep(-1); |
| 330 |
– |
|
| 331 |
– |
} |
| 332 |
– |
catch (exception ex) { |
| 333 |
– |
setStatusArea("Warning, handled exception: " + (string)ex.what()); |
| 334 |
– |
} |
| 335 |
– |
|
| 336 |
– |
ptime end_time(second_clock::local_time()); |
| 337 |
– |
time_period total_time (start_time, end_time); |
| 338 |
– |
logfile << "\n\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length(); |
| 339 |
– |
//total_time.length().hours(); |
| 340 |
– |
logfile.close(); |
| 341 |
– |
busy = 0; |
| 342 |
– |
return err; |
| 343 |
– |
} |
| 344 |
– |
|
| 345 |
– |
|
| 346 |
– |
vector<ModPackage> getPackages(void) |
| 347 |
– |
{ |
| 348 |
– |
vector<ModPackage> packages; |
| 349 |
– |
packages.reserve(65536); // come on, we shouldn't need this much space...right?! |
| 350 |
– |
fstream file; |
| 351 |
– |
string filename = "\0"; |
| 352 |
– |
string MODINFO_CFG = "Mod_Info.cfg"; |
| 353 |
– |
|
| 354 |
– |
try |
| 355 |
– |
{ |
| 356 |
– |
directory_iterator end_iter; |
| 357 |
– |
for (directory_iterator dir_itr("./packages"); dir_itr != end_iter; ++dir_itr) |
| 358 |
– |
{ |
| 359 |
– |
file.open((dir_itr->path().string() + "/" + MODINFO_CFG).c_str()); |
| 360 |
– |
//cout << filename << "\n"; |
| 361 |
– |
|
| 362 |
– |
if(!file.fail()) |
| 363 |
– |
{ |
| 364 |
– |
//cout << dir_itr->path().string() + MODINFO_CFG; |
| 365 |
– |
//would prefer to push a pointer to a package, but this will do for now |
| 366 |
– |
packages.push_back(fileToModPackage(file)); |
| 367 |
– |
} |
| 368 |
– |
file.close(); |
| 369 |
– |
file.clear(); |
| 370 |
– |
} |
| 371 |
– |
sort(packages.begin(), packages.end()); |
| 372 |
– |
} |
| 373 |
– |
catch (const std::exception & ex) |
| 374 |
– |
{ |
| 375 |
– |
cout << "Warning, something odd happened!\n"; |
| 376 |
– |
} |
| 377 |
– |
|
| 378 |
– |
return packages; |
| 379 |
– |
} |
| 380 |
– |
|
| 381 |
– |
ModPackage fileToModPackage(fstream &file) |
| 382 |
– |
{ |
| 383 |
– |
/* |
| 384 |
– |
This converts a file to a ModPackage struct. |
| 385 |
– |
|
| 386 |
– |
A few notes... |
| 387 |
– |
"iter" is the current word we are on. I should have named it "token" or something, but I don't have multiple iterators, so its ok. |
| 388 |
– |
I refer to (*iter) at the beginning of each if statement block. I could probably store it as a variable, but I'm pretty sure that dereferencing a pointer\iterator isn't much |
| 389 |
– |
slower than reading a variable. |
| 390 |
– |
*/ |
| 391 |
– |
ModPackage package; |
| 392 |
– |
string line; |
| 393 |
– |
static string NameOfMod = "NameOfMod"; //used for comparing to the current token... |
| 394 |
– |
//I could have done it in reverse (*iter).compare("ModString") or |
| 395 |
– |
static string ARROW = "->"; //did something like "ModString".compare(*iter), and it would have been |
| 396 |
– |
static string ModString = "ModString"; //functionably the same. |
| 397 |
– |
static string HasOnis = "HasOnis"; |
| 398 |
– |
static string HasDeltas = "HasDeltas"; |
| 399 |
– |
static string HasBSL = "HasBSL"; |
| 400 |
– |
static string HasDats = "HasDats"; |
| 401 |
– |
static string IsEngine = "IsEngine"; |
| 402 |
– |
static string Readme = "Readme"; |
| 403 |
– |
static string GlobalNeeded = "GlobalNeeded"; |
| 404 |
– |
static string Category = "Category"; |
| 405 |
– |
static string Creator = "Creator"; |
| 406 |
– |
while (! file.eof() ) |
| 407 |
– |
{ |
| 408 |
– |
getline (file,line); |
| 409 |
– |
vector<string> tokens; |
| 410 |
– |
vector<string>::iterator iter; |
| 411 |
– |
tokenize(line, tokens); //string to vector of "words" |
| 412 |
– |
if (tokens.capacity() >= 2) { //make sure they are using enough stuff |
| 413 |
– |
iter = tokens.begin(); //what word we are on, starts at first word |
| 414 |
– |
/* |
| 415 |
– |
if (!AEInstallVersion.compare(*iter)) |
| 416 |
– |
If mod is too old, skip this mod. |
| 417 |
– |
*/ |
| 418 |
– |
/*else*/if (!NameOfMod.compare(*iter)) { //if it contains the name |
| 419 |
– |
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 420 |
– |
if (ARROW.compare(*iter) && NameOfMod.compare(*iter)) { //ignores "->" and "NameOfMod" |
| 421 |
– |
//cout << *iter; |
| 422 |
– |
//cout << " "; |
| 423 |
– |
package.name += *iter + " "; |
| 424 |
– |
} |
| 425 |
– |
} |
| 426 |
– |
|
| 427 |
– |
} |
| 428 |
– |
else if (!ModString.compare(*iter)) { |
| 429 |
– |
iter++; iter++; |
| 430 |
– |
package.modStringName = *iter; |
| 431 |
– |
iter++; |
| 432 |
– |
package.modStringVersion = atoi((*iter).c_str()); |
| 433 |
– |
} |
| 434 |
– |
else if (!HasOnis.compare(*iter)) { |
| 435 |
– |
iter++; iter++; |
| 436 |
– |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasOnis = 1; //Gotta love c++'s lack of a standard case-insensitive |
| 437 |
– |
else if (!HasBSL.compare(*iter)) { // string comparer...I know my implementation here sucks. I need to change it to check each character one by one. At the moment, |
| 438 |
– |
iter++; iter++;} // using "YFR" would probably set it off. :< |
| 439 |
– |
|
| 440 |
– |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasBSL = 1; |
| 441 |
– |
} |
| 442 |
– |
else if (!HasDeltas.compare(*iter)) { |
| 443 |
– |
iter++; iter++; |
| 444 |
– |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasDeltas = 1; |
| 445 |
– |
} |
| 446 |
– |
else if (!HasDats.compare(*iter)) { |
| 447 |
– |
iter++; iter++; |
| 448 |
– |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasDats = 1; |
| 449 |
– |
} |
| 450 |
– |
else if (!IsEngine.compare(*iter)) { |
| 451 |
– |
iter++; iter++; |
| 452 |
– |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.isEngine = 1; |
| 453 |
– |
} |
| 454 |
– |
else if (!GlobalNeeded.compare(*iter)) { |
| 455 |
– |
iter++; iter++; |
| 456 |
– |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.globalNeeded = 1; |
| 457 |
– |
else if (toupper((*iter)[0]) + toupper((*iter)[1]) == 'N' + 'O') package.globalNeeded = 1; //Really the only place where checking for "No" is important atm. |
| 458 |
– |
} |
| 459 |
– |
else if (!Category.compare(*iter)) { |
| 460 |
– |
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 461 |
– |
if (ARROW.compare(*iter) && Category.compare(*iter)) { //ignores "->" and "Category" |
| 462 |
– |
//cout << *iter; |
| 463 |
– |
//cout << " "; |
| 464 |
– |
package.category += *iter + " "; |
| 465 |
– |
} |
| 466 |
– |
} |
| 467 |
– |
} |
| 468 |
– |
else if (!Creator.compare(*iter)) { //if it contains the name |
| 469 |
– |
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 470 |
– |
if (ARROW.compare(*iter) && Creator.compare(*iter)) { //ignores "->" and "Category" |
| 471 |
– |
//cout << *iter; |
| 472 |
– |
//cout << " "; |
| 473 |
– |
package.creator += *iter + " "; |
| 474 |
– |
} |
| 475 |
– |
} |
| 476 |
– |
} |
| 477 |
– |
else if (!Readme.compare(*iter)) { //if it contains the name |
| 478 |
– |
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 479 |
– |
if (ARROW.compare(*iter) && Readme.compare(*iter)) { //ignores "->" and "Category" |
| 480 |
– |
if(!(*iter).compare("\\n")) package.readme += '\n'; |
| 481 |
– |
else package.readme += *iter + " "; |
| 482 |
– |
} |
| 483 |
– |
} |
| 484 |
– |
} |
| 485 |
– |
} |
| 486 |
– |
|
| 487 |
– |
} |
| 488 |
– |
package.doOutput(); |
| 489 |
– |
return package; |
| 490 |
– |
} |
| 491 |
– |
|
| 492 |
– |
void recompileAll(vector<string> installedMods) |
| 493 |
– |
{ |
| 494 |
– |
busy = 1; |
| 495 |
– |
using namespace boost::gregorian; |
| 496 |
– |
using namespace boost::posix_time; |
| 497 |
– |
using boost::lexical_cast; |
| 498 |
– |
using boost::bad_lexical_cast; |
| 499 |
– |
|
| 500 |
– |
setStatusArea("Importing levels..."); |
| 501 |
– |
//setStatusArea("Recompiling Data..."); |
| 502 |
– |
path vanilla_dir = "./packages/VanillaDats/"; |
| 503 |
– |
string importCommand = ""; |
| 504 |
– |
char statusString[128]; |
| 505 |
– |
int numberOfDats = 0; |
| 506 |
– |
int j = 1; |
| 507 |
– |
string datString; |
| 508 |
– |
std::stringstream out; |
| 509 |
– |
|
| 510 |
– |
ptime start_time(second_clock::local_time()); |
| 511 |
– |
clearOldDats(); |
| 512 |
– |
remove("Install.log"); |
| 513 |
– |
ofstream logfile("Install.log"); |
| 514 |
– |
logfile << "Mod Installation started " << to_simple_string(start_time) << endl; |
| 515 |
– |
logfile.close(); |
| 516 |
– |
if(splitInstances == SPLIT){ |
| 517 |
– |
recursive_directory_iterator end_iter; |
| 518 |
– |
|
| 519 |
– |
for ( recursive_directory_iterator dir_itr( vanilla_dir ); |
| 520 |
– |
dir_itr != end_iter; |
| 521 |
– |
++dir_itr ) |
| 522 |
– |
{ |
| 523 |
– |
try{ |
| 524 |
– |
if ( is_directory( dir_itr->status() ) && dir_itr.level() == 1) |
| 525 |
– |
{ |
| 526 |
– |
numberOfDats++; |
| 527 |
– |
} |
| 528 |
– |
} |
| 529 |
– |
catch(exception ex) { |
| 530 |
– |
|
| 531 |
– |
} |
| 532 |
– |
} |
| 533 |
– |
|
| 534 |
– |
//recursive_directory_iterator end_iter; |
| 535 |
– |
|
| 536 |
– |
|
| 537 |
– |
out << numberOfDats; |
| 538 |
– |
datString = out.str(); |
| 539 |
– |
try { |
| 540 |
– |
for ( recursive_directory_iterator dir_itr( vanilla_dir ); |
| 541 |
– |
dir_itr != end_iter; |
| 542 |
– |
++dir_itr ) |
| 543 |
– |
{ |
| 544 |
– |
try |
| 545 |
– |
{ |
| 546 |
– |
if ( is_directory( dir_itr->status() ) && dir_itr.level() == 1) |
| 547 |
– |
{ |
| 548 |
– |
importCommand = strOniSplit + " " + strImportOption + " " + dir_itr->path().parent_path().string() + '/' + dir_itr->path().filename(); |
| 549 |
– |
for (int i = 0; i < installedMods.size(); ++i) { |
| 550 |
– |
if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename() )) |
| 551 |
– |
importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename(); |
| 552 |
– |
|
| 553 |
– |
//else cout << " packages/VanillaDats/" + installedMods[i] + "/oni/"; |
| 554 |
– |
} |
| 555 |
– |
importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Install.log"; |
| 556 |
– |
|
| 557 |
– |
|
| 558 |
– |
setProgressBar( (int)(1000 * (float)(j-1) / (float)numberOfDats) ); //100% * dat we're on / total dats |
| 559 |
– |
setStatusArea("Step " + lexical_cast<std::string>(j) + '/' + lexical_cast<std::string>(numberOfDats)+ ": Importing " + dir_itr->path().filename() + " "); |
| 560 |
– |
|
| 561 |
– |
system(importCommand.c_str()); |
| 562 |
– |
//Sleep(1000); |
| 563 |
– |
//cout << importCommand << "\n"; |
| 564 |
– |
j++; |
| 565 |
– |
|
| 566 |
– |
} |
| 567 |
– |
} |
| 568 |
– |
catch ( const std::exception & ex ) |
| 569 |
– |
{ |
| 570 |
– |
|
| 571 |
– |
remove("Install.log"); |
| 572 |
– |
ofstream logfile("Install.log"); |
| 573 |
– |
|
| 574 |
– |
|
| 575 |
– |
logfile << "Warning, exception " << ex.what() << "!"; |
| 576 |
– |
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 577 |
– |
logfile.close(); |
| 578 |
– |
} |
| 579 |
– |
} |
| 580 |
– |
|
| 581 |
– |
} |
| 582 |
– |
catch( const std::exception & ex ) { |
| 583 |
– |
|
| 584 |
– |
remove("Install.log"); |
| 585 |
– |
ofstream logfile("Install.log"); |
| 586 |
– |
|
| 587 |
– |
|
| 588 |
– |
logfile << "Warning, exception " << ex.what() << "!"; |
| 589 |
– |
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 590 |
– |
logfile.close(); |
| 591 |
– |
} |
| 592 |
– |
|
| 593 |
– |
} |
| 594 |
– |
else if(splitInstances == NOT_SPLIT){ |
| 595 |
– |
directory_iterator end_iter; |
| 596 |
– |
|
| 597 |
– |
for ( directory_iterator dir_itr( vanilla_dir ); |
| 598 |
– |
dir_itr != end_iter; |
| 599 |
– |
++dir_itr ) |
| 600 |
– |
{ |
| 601 |
– |
|
| 602 |
– |
if ( is_directory( dir_itr->status() ) ) |
| 603 |
– |
{ |
| 604 |
– |
numberOfDats++; |
| 605 |
– |
} |
| 606 |
– |
|
| 607 |
– |
|
| 608 |
– |
} |
| 609 |
– |
|
| 610 |
– |
out << numberOfDats; |
| 611 |
– |
datString = out.str(); |
| 612 |
– |
|
| 613 |
– |
for ( directory_iterator dir_itr( vanilla_dir ); |
| 614 |
– |
dir_itr != end_iter; |
| 615 |
– |
++dir_itr ) |
| 616 |
– |
{ |
| 617 |
– |
try |
| 618 |
– |
{ |
| 619 |
– |
if ( is_directory( dir_itr->status() ) ) |
| 620 |
– |
{ |
| 621 |
– |
importCommand = strOniSplit + " " + strImportOption + " " + vanilla_dir.string() + dir_itr->path().filename() + " " + "../GameDataFolder/" + dir_itr->path().filename() |
| 622 |
– |
+ ".dat"; |
| 623 |
– |
for (int i = 0; i < installedMods.size(); ++i) { |
| 624 |
– |
if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename() )) |
| 625 |
– |
importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename(); |
| 626 |
– |
} |
| 627 |
– |
importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Install.log"; |
| 628 |
– |
|
| 629 |
– |
|
| 630 |
– |
setProgressBar( (int)(1000 * (float)(j-1) / (float)numberOfDats) ); //100% * dat we're on / total dats |
| 631 |
– |
setStatusArea("Step " + lexical_cast<std::string>(j) + '/' + lexical_cast<std::string>(numberOfDats)+ ": Importing " + dir_itr->path().filename() + " "); |
| 632 |
– |
|
| 633 |
– |
system(importCommand.c_str()); |
| 634 |
– |
|
| 635 |
– |
j++; |
| 636 |
– |
} |
| 637 |
– |
} |
| 638 |
– |
catch ( const std::exception & ex ) |
| 639 |
– |
{ |
| 640 |
– |
|
| 641 |
– |
remove("Install.log"); |
| 642 |
– |
ofstream logfile("Install.log"); |
| 643 |
– |
|
| 644 |
– |
|
| 645 |
– |
logfile << "Warning, exception " << ex.what() << "!"; |
| 646 |
– |
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 647 |
– |
logfile.close(); |
| 648 |
– |
}} |
| 649 |
– |
} |
| 650 |
– |
logfile << "Writing config file"; |
| 651 |
– |
writeInstalledMods(installedMods); |
| 652 |
– |
setProgressBar(1000); |
| 653 |
– |
setStatusArea("Done! You can now play Oni."); |
| 654 |
– |
|
| 655 |
– |
ptime end_time(second_clock::local_time()); |
| 656 |
– |
time_period total_time (start_time, end_time); |
| 657 |
– |
|
| 658 |
– |
|
| 659 |
– |
ofstream logfile2("Install.log", ios::app | ios::ate); |
| 660 |
– |
string outstring = (string)"\n\nGlobalization ended " + to_simple_string(end_time) + "\nThe process took ";// + (string)total_time.length(); |
| 661 |
– |
|
| 662 |
– |
logfile2 << "\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length(); |
| 663 |
– |
|
| 664 |
– |
//logfile2.write(outstring.c_str(), outstring.length()); |
| 665 |
– |
logfile2.close(); |
| 666 |
– |
|
| 667 |
– |
//total_time.length().hours(); |
| 668 |
– |
|
| 669 |
– |
Sleep(1000); |
| 670 |
– |
setProgressBar(0); |
| 671 |
– |
busy = 0; |
| 672 |
– |
} |
| 673 |
– |
|
| 674 |
– |
void writeInstalledMods(vector<string> installedMods) |
| 675 |
– |
{ |
| 676 |
– |
|
| 677 |
– |
if ( exists( strInstallCfg ) ) |
| 678 |
– |
{ |
| 679 |
– |
remove( strInstallCfg ); |
| 680 |
– |
} |
| 681 |
– |
|
| 682 |
– |
ofstream file(strInstallCfg.c_str()); |
| 683 |
– |
|
| 684 |
– |
vector<string>list = installedMods; |
| 685 |
– |
vector<string>::iterator begin_iter = list.begin(); |
| 686 |
– |
vector<string>::iterator end_iter = list.end(); |
| 687 |
– |
|
| 688 |
– |
sort( list.begin(), list.end() ); |
| 689 |
– |
|
| 690 |
– |
for( ; begin_iter != end_iter; ++begin_iter) { |
| 691 |
– |
file << *begin_iter << " "; |
| 692 |
– |
} |
| 693 |
– |
|
| 694 |
– |
file.close(); |
| 695 |
– |
file.clear(); |
| 696 |
– |
|
| 697 |
– |
} |
| 698 |
– |
|
| 699 |
– |
vector<string> getInstallString(string Cfg) |
| 700 |
– |
{ |
| 701 |
– |
//system(strPauseCmd); |
| 702 |
– |
vector<string> returnval; |
| 703 |
– |
|
| 704 |
– |
string line; |
| 705 |
– |
fstream file; |
| 706 |
– |
|
| 707 |
– |
if (exists( Cfg )) |
| 708 |
– |
{ |
| 709 |
– |
file.open(Cfg.c_str()); |
| 710 |
– |
getline(file, line); |
| 711 |
– |
tokenize(line, returnval); |
| 712 |
– |
file.close(); |
| 713 |
– |
file.clear(); |
| 714 |
– |
sort(returnval.begin(), returnval.end()); |
| 715 |
– |
} |
| 716 |
– |
else cout << "fail"; |
| 717 |
– |
|
| 718 |
– |
return returnval; |
| 719 |
– |
} |
| 720 |
– |
|
| 721 |
– |
//stolen token function... |
| 722 |
– |
void tokenize(const string& str, vector<string>& tokens, const string& delimiters) |
| 723 |
– |
{ |
| 724 |
– |
// Skip delimiters at beginning. |
| 725 |
– |
string::size_type lastPos = str.find_first_not_of(delimiters, 0); |
| 726 |
– |
// Find first "non-delimiter". |
| 727 |
– |
string::size_type pos = str.find_first_of(delimiters, lastPos); |
| 728 |
– |
|
| 729 |
– |
while (string::npos != pos || string::npos != lastPos) |
| 730 |
– |
{ |
| 731 |
– |
// Found a token, add it to the vector. |
| 732 |
– |
tokens.push_back(str.substr(lastPos, pos - lastPos)); |
| 733 |
– |
// Skip delimiters. Note the "not_of" |
| 734 |
– |
lastPos = str.find_first_not_of(delimiters, pos); |
| 735 |
– |
// Find next "non-delimiter" |
| 736 |
– |
pos = str.find_first_of(delimiters, lastPos); |
| 737 |
– |
} |
| 738 |
– |
} |
| 739 |
– |
|
| 740 |
– |
void clearOldDats(void) { |
| 741 |
– |
directory_iterator end_iter_gdf; |
| 742 |
– |
for ( directory_iterator dir_itr_gdf( "../GameDataFolder" ); |
| 743 |
– |
dir_itr_gdf != end_iter_gdf; |
| 744 |
– |
++dir_itr_gdf ) |
| 745 |
– |
{ |
| 746 |
– |
//cout << dir_itr_gdf->path().extension() << "\n"; |
| 747 |
– |
if ( dir_itr_gdf->path().extension() == ".dat" || dir_itr_gdf->path().extension() == ".raw" || dir_itr_gdf->path().extension() == ".sep" ) { |
| 748 |
– |
remove( dir_itr_gdf->path() ); |
| 749 |
– |
} |
| 750 |
– |
|
| 751 |
– |
} |
| 752 |
– |
|
| 753 |
– |
} |
| 754 |
– |
|
| 755 |
– |
vector<string> globalInstalledMods; |
| 756 |
– |
vector<ModPackage> globalPackages; |
| 757 |
– |
#include "boost/thread.hpp" |
| 20 |
|
#include <boost/thread/mutex.hpp> |
| 759 |
– |
|
| 760 |
– |
///////////////////////////////////////////////////////////////////////////// |
| 761 |
– |
// Name: main_window.cpp |
| 762 |
– |
// Purpose: |
| 763 |
– |
// Author: |
| 764 |
– |
// Modified by: |
| 765 |
– |
// Created: 07/05/2009 20:38:25 |
| 766 |
– |
// RCS-ID: |
| 767 |
– |
// Copyright: |
| 768 |
– |
// Licence: |
| 769 |
– |
///////////////////////////////////////////////////////////////////////////// |
| 770 |
– |
|
| 21 |
|
// For compilers that support precompilation, includes "wx/wx.h". |
| 22 |
|
#include "wx/wxprec.h" |
| 23 |
|
|
| 30 |
|
#endif |
| 31 |
|
|
| 32 |
|
////@begin includes |
| 33 |
< |
#include "about_window.h" |
| 784 |
< |
////@end includes |
| 785 |
< |
|
| 33 |
> |
#include "about.h" |
| 34 |
|
#include "main_window.h" |
| 35 |
+ |
#include "installer.h" |
| 36 |
+ |
////@end includes |
| 37 |
|
|
| 38 |
|
////@begin XPM images |
| 39 |
< |
#include "redo.xpm" |
| 39 |
> |
#include "aelogosmall.xpm" |
| 40 |
> |
#include "undo.xpm" |
| 41 |
|
#include "fileopen.xpm" |
| 42 |
|
#include "filesaveas.xpm" |
| 43 |
|
#include "quit.xpm" |
| 44 |
|
////@end XPM images |
| 45 |
|
|
| 46 |
< |
//#define wxDebug 1; |
| 47 |
< |
//#define wxUSE_UNICODE 1; |
| 46 |
> |
bool busy = false; |
| 47 |
> |
int updateStatus; |
| 48 |
> |
bool installerJustUpdated = false; |
| 49 |
> |
vector<string> globalInstalledMods; |
| 50 |
> |
vector<ModPackage> globalPackages; |
| 51 |
> |
// Variable declarations |
| 52 |
> |
#ifdef WIN32 |
| 53 |
> |
bool splitInstances = false; |
| 54 |
> |
string strImportOption = "-import:nosep"; |
| 55 |
> |
string strOniSplit = "Onisplit.exe"; |
| 56 |
> |
#else |
| 57 |
> |
bool splitInstances = false; |
| 58 |
> |
string strImportOption = "-import:sep"; |
| 59 |
> |
string strOniSplit = "mono Onisplit.exe"; |
| 60 |
> |
#endif |
| 61 |
|
|
| 62 |
|
/* |
| 63 |
|
* MainWindow type definition |
| 73 |
|
BEGIN_EVENT_TABLE( MainWindow, wxFrame ) |
| 74 |
|
|
| 75 |
|
////@begin MainWindow event table entries |
| 76 |
< |
EVT_CHECKBOX( SelectAll_Checkbox, MainWindow::OnSelectAllCheckboxClick ) |
| 76 |
> |
EVT_CHECKBOX( SelectAll_Checkbox, MainWindow::OnSelectAllCheckboxClick ) |
| 77 |
|
|
| 78 |
< |
EVT_BUTTON( Refresh_Button, MainWindow::OnRefreshButtonClick ) |
| 78 |
> |
EVT_BUTTON( Refresh_Button, MainWindow::OnRefreshButtonClick ) |
| 79 |
|
|
| 80 |
< |
EVT_LISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Selected ) |
| 81 |
< |
EVT_CHECKLISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Toggled ) |
| 80 |
> |
EVT_LISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Selected ) |
| 81 |
> |
EVT_CHECKLISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Toggled ) |
| 82 |
|
|
| 83 |
< |
EVT_UPDATE_UI( ID_STATUSBAR, MainWindow::OnStatusbarUpdate ) |
| 83 |
> |
EVT_UPDATE_UI( ID_STATUSBAR, MainWindow::OnStatusbarUpdate ) |
| 84 |
|
|
| 85 |
< |
EVT_BUTTON( Install_Button, MainWindow::OnInstallButtonClick ) |
| 85 |
> |
EVT_BUTTON( Install_Button, MainWindow::OnInstallButtonClick ) |
| 86 |
|
|
| 87 |
< |
EVT_RADIOBUTTON( Sep_RadioButton, MainWindow::OnSepRadioButtonSelected ) |
| 87 |
> |
EVT_RADIOBUTTON( Sep_RadioButton, MainWindow::OnSepRadioButtonSelected ) |
| 88 |
|
|
| 89 |
< |
EVT_RADIOBUTTON( NoSep_RadioButton, MainWindow::OnNoSepRadioButtonSelected ) |
| 89 |
> |
EVT_RADIOBUTTON( NoSep_RadioButton, MainWindow::OnNoSepRadioButtonSelected ) |
| 90 |
|
|
| 91 |
< |
EVT_RADIOBUTTON( Separated_RadioButton, MainWindow::OnSeparatedRadioButtonSelected ) |
| 91 |
> |
EVT_RADIOBUTTON( Seperated_RadioButton, MainWindow::OnSeperatedRadioButtonSelected ) |
| 92 |
|
|
| 93 |
< |
EVT_RADIOBUTTON( Complete_RadioButton, MainWindow::OnCompleteRadioButtonSelected ) |
| 93 |
> |
EVT_RADIOBUTTON( Complete_RadioButton, MainWindow::OnCompleteRadioButtonSelected ) |
| 94 |
|
|
| 95 |
< |
EVT_BUTTON( ReGlobalize_Button, MainWindow::OnReGlobalizeButtonClick ) |
| 95 |
> |
EVT_BUTTON( ReGlobalize_Button, MainWindow::OnReGlobalizeButtonClick ) |
| 96 |
|
|
| 97 |
< |
EVT_MENU( wxID_LOAD, MainWindow::OnLoadClick ) |
| 97 |
> |
EVT_MENU( wxID_LOAD, MainWindow::OnLoadClick ) |
| 98 |
|
|
| 99 |
< |
EVT_MENU( wxID_SAVE, MainWindow::OnSaveClick ) |
| 99 |
> |
EVT_MENU( wxID_SAVE, MainWindow::OnSaveClick ) |
| 100 |
|
|
| 101 |
< |
EVT_MENU( wxID_EXIT, MainWindow::OnExitClick ) |
| 101 |
> |
EVT_MENU( wxID_EXIT, MainWindow::OnExitClick ) |
| 102 |
|
|
| 103 |
< |
EVT_MENU( wxID_OPTIONS, MainWindow::OnOptionsClick ) |
| 103 |
> |
EVT_MENU( wxID_OPTIONS, MainWindow::OnOptionsClick ) |
| 104 |
|
|
| 105 |
< |
EVT_MENU( wxID_ABOUT, MainWindow::OnAboutClick ) |
| 105 |
> |
EVT_MENU( wxID_ABOUT, MainWindow::OnAboutClick ) |
| 106 |
|
|
| 107 |
+ |
EVT_BUTTON( Dir_Button, MainWindow::OnDirButtonClick ) |
| 108 |
|
////@end MainWindow event table entries |
| 109 |
|
|
| 110 |
|
END_EVENT_TABLE() |
| 115 |
|
*/ |
| 116 |
|
|
| 117 |
|
MainWindow::MainWindow() |
| 118 |
< |
{ |
| 118 |
> |
{ |
| 119 |
|
Init(); |
| 120 |
|
} |
| 121 |
|
|
| 133 |
|
bool MainWindow::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) |
| 134 |
|
{ |
| 135 |
|
////@begin MainWindow creation |
| 136 |
< |
wxFrame::Create( parent, id, caption, pos, size, style ); |
| 872 |
< |
|
| 873 |
< |
CreateControls(); |
| 874 |
< |
SetIcon(GetIconResource(wxT("oni_special.ico"))); |
| 875 |
< |
Centre(); |
| 876 |
< |
|
| 136 |
> |
wxFrame::Create( parent, id, caption, pos, size, style ); |
| 137 |
|
|
| 138 |
+ |
CreateControls(); |
| 139 |
+ |
SetIcon(GetIconResource(wxT("aelogosmall.png"))); |
| 140 |
+ |
Centre(); |
| 141 |
|
////@end MainWindow creation |
| 142 |
|
return true; |
| 143 |
|
} |
| 144 |
|
|
| 882 |
– |
|
| 145 |
|
/* |
| 146 |
|
* MainWindow destructor |
| 147 |
|
*/ |
| 152 |
|
////@end MainWindow destruction |
| 153 |
|
} |
| 154 |
|
|
| 893 |
– |
|
| 155 |
|
/* |
| 156 |
|
* Member initialisation |
| 157 |
|
*/ |
| 159 |
|
void MainWindow::Init() |
| 160 |
|
{ |
| 161 |
|
////@begin MainWindow member initialisation |
| 162 |
< |
MainSplitter = NULL; |
| 163 |
< |
SelectAll = NULL; |
| 164 |
< |
RefreshButton = NULL; |
| 165 |
< |
Mods_CheckboxList = NULL; |
| 166 |
< |
titleText = NULL; |
| 167 |
< |
creatorText = NULL; |
| 168 |
< |
descriptionText = NULL; |
| 169 |
< |
StatusArea = NULL; |
| 170 |
< |
ProgressBar = NULL; |
| 171 |
< |
InstallButton = NULL; |
| 172 |
< |
OptionsPanel = NULL; |
| 173 |
< |
SepRadio = NULL; |
| 174 |
< |
NoSepRadio = NULL; |
| 175 |
< |
SeparatedRadio = NULL; |
| 176 |
< |
CompleteRadio = NULL; |
| 177 |
< |
ReglobalizeButton = NULL; |
| 917 |
< |
////@end MainWindow member initialisation |
| 162 |
> |
MainSplitter = NULL; |
| 163 |
> |
SelectAll = NULL; |
| 164 |
> |
RefreshButton = NULL; |
| 165 |
> |
Mods_CheckboxList = NULL; |
| 166 |
> |
titleText = NULL; |
| 167 |
> |
creatorText = NULL; |
| 168 |
> |
descriptionText = NULL; |
| 169 |
> |
StatusArea = NULL; |
| 170 |
> |
ProgressBar = NULL; |
| 171 |
> |
InstallButton = NULL; |
| 172 |
> |
OptionsPanel = NULL; |
| 173 |
> |
SepRadio = NULL; |
| 174 |
> |
NoSepRadio = NULL; |
| 175 |
> |
SeperatedRadio = NULL; |
| 176 |
> |
CompleteRadio = NULL; |
| 177 |
> |
ReglobalizeButton = NULL; |
| 178 |
|
|
| 179 |
+ |
ChangeDirectoryButton = NULL; |
| 180 |
+ |
////@end MainWindow member initialisation |
| 181 |
|
} |
| 182 |
|
|
| 921 |
– |
|
| 183 |
|
/* |
| 184 |
|
* Control creation for MainWindow |
| 185 |
|
*/ |
| 189 |
|
void MainWindow::CreateControls() |
| 190 |
|
{ |
| 191 |
|
////@begin MainWindow content construction |
| 192 |
< |
// Generated by DialogBlocks, 31/05/2009 19:03:55 (unregistered) |
| 192 |
> |
MainWindow* itemFrame1 = this; |
| 193 |
|
|
| 194 |
< |
MainWindow* itemFrame1 = this; |
| 195 |
< |
|
| 196 |
< |
wxMenuBar* menuBar = new wxMenuBar; |
| 197 |
< |
wxMenu* itemMenu37 = new wxMenu; |
| 198 |
< |
{ |
| 199 |
< |
wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_LOAD, _("&Load Configuration..."), wxEmptyString, wxITEM_NORMAL); |
| 200 |
< |
wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("fileopen.xpm"))); |
| 201 |
< |
menuItem->SetBitmap(bitmap); |
| 202 |
< |
itemMenu37->Append(menuItem); |
| 203 |
< |
} |
| 204 |
< |
{ |
| 205 |
< |
wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_SAVE, _("&Save Configuration..."), wxEmptyString, wxITEM_NORMAL); |
| 206 |
< |
wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("filesaveas.xpm"))); |
| 207 |
< |
menuItem->SetBitmap(bitmap); |
| 208 |
< |
itemMenu37->Append(menuItem); |
| 209 |
< |
} |
| 210 |
< |
itemMenu37->AppendSeparator(); |
| 211 |
< |
{ |
| 212 |
< |
wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_EXIT, _("Exit"), wxEmptyString, wxITEM_NORMAL); |
| 213 |
< |
wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("quit.xpm"))); |
| 214 |
< |
menuItem->SetBitmap(bitmap); |
| 215 |
< |
itemMenu37->Append(menuItem); |
| 216 |
< |
} |
| 217 |
< |
menuBar->Append(itemMenu37, _("&File")); |
| 218 |
< |
wxMenu* itemMenu42 = new wxMenu; |
| 219 |
< |
itemMenu42->Append(wxID_OPTIONS, _("Show Advanced Options..."), wxEmptyString, wxITEM_CHECK); |
| 220 |
< |
menuBar->Append(itemMenu42, _("Options")); |
| 221 |
< |
wxMenu* itemMenu44 = new wxMenu; |
| 222 |
< |
itemMenu44->Append(wxID_HELP, _("Help"), wxEmptyString, wxITEM_NORMAL); |
| 223 |
< |
itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 224 |
< |
menuBar->Append(itemMenu44, _("Help")); |
| 225 |
< |
itemFrame1->SetMenuBar(menuBar); |
| 226 |
< |
|
| 227 |
< |
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); |
| 228 |
< |
itemFrame1->SetSizer(itemBoxSizer2); |
| 229 |
< |
|
| 230 |
< |
MainSplitter = new wxSplitterWindow( itemFrame1, ID_SPLITTERWINDOW, wxDefaultPosition, wxSize(100, 100), wxSP_LIVE_UPDATE|wxNO_BORDER ); |
| 231 |
< |
MainSplitter->SetMinimumPaneSize(150); |
| 232 |
< |
MainSplitter->SetName(_T("MainSplitter")); |
| 233 |
< |
|
| 234 |
< |
wxPanel* itemPanel4 = new wxPanel( MainSplitter, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); |
| 235 |
< |
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL); |
| 236 |
< |
itemPanel4->SetSizer(itemBoxSizer5); |
| 237 |
< |
|
| 238 |
< |
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL); |
| 239 |
< |
itemBoxSizer5->Add(itemBoxSizer6, 0, wxGROW|wxALL, 0); |
| 240 |
< |
SelectAll = new wxCheckBox( itemPanel4, SelectAll_Checkbox, _("Select All/None"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE ); |
| 241 |
< |
SelectAll->SetValue(false); |
| 242 |
< |
SelectAll->SetName(_T("SelectAll_Checkbox")); |
| 243 |
< |
itemBoxSizer6->Add(SelectAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); |
| 244 |
< |
|
| 245 |
< |
RefreshButton = new wxBitmapButton( itemPanel4, Refresh_Button, itemFrame1->GetBitmapResource(wxT("redo.xpm")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); |
| 246 |
< |
RefreshButton->SetName(_T("RefreshButton")); |
| 247 |
< |
itemBoxSizer6->Add(RefreshButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); |
| 248 |
< |
|
| 249 |
< |
wxArrayString Mods_CheckboxListStrings; |
| 250 |
< |
Mods_CheckboxList = new wxCheckListBox( itemPanel4, Mods_CheckboxList1, wxDefaultPosition, wxDefaultSize, Mods_CheckboxListStrings, wxLB_HSCROLL ); |
| 251 |
< |
Mods_CheckboxList->SetName(_T("Mods_CheckboxList")); |
| 252 |
< |
itemBoxSizer5->Add(Mods_CheckboxList, 1, wxGROW|wxALL, 0); |
| 253 |
< |
|
| 254 |
< |
wxPanel* itemPanel10 = new wxPanel( MainSplitter, DescriptionHolder_Panel, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); |
| 255 |
< |
itemPanel10->SetName(_T("DescriptionHolder_Panel")); |
| 256 |
< |
wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL); |
| 257 |
< |
itemPanel10->SetSizer(itemBoxSizer11); |
| 258 |
< |
|
| 259 |
< |
wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL); |
| 260 |
< |
itemBoxSizer11->Add(itemBoxSizer12, 0, wxGROW|wxALL, 0); |
| 261 |
< |
wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL); |
| 262 |
< |
itemBoxSizer12->Add(itemBoxSizer13, 1, wxALIGN_CENTER_VERTICAL|wxALL, 0); |
| 263 |
< |
titleText = new wxTextCtrl( itemPanel10, Title_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); |
| 264 |
< |
titleText->SetName(_T("Title_Text")); |
| 265 |
< |
titleText->SetBackgroundColour(wxColour(240, 240, 240)); |
| 266 |
< |
itemBoxSizer13->Add(titleText, 1, wxGROW|wxLEFT, 5); |
| 267 |
< |
|
| 268 |
< |
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL); |
| 269 |
< |
itemBoxSizer12->Add(itemBoxSizer15, 1, wxGROW|wxALL, 0); |
| 270 |
< |
creatorText = new wxTextCtrl( itemPanel10, Author_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_RIGHT ); |
| 271 |
< |
creatorText->SetName(_T("Author_Text")); |
| 272 |
< |
creatorText->SetBackgroundColour(wxColour(240, 240, 240)); |
| 273 |
< |
itemBoxSizer15->Add(creatorText, 1, wxGROW|wxRIGHT, 5); |
| 274 |
< |
|
| 275 |
< |
wxStaticLine* itemStaticLine17 = new wxStaticLine( itemPanel10, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); |
| 276 |
< |
itemStaticLine17->Show(false); |
| 277 |
< |
itemBoxSizer11->Add(itemStaticLine17, 0, wxGROW|wxALL, 5); |
| 278 |
< |
|
| 279 |
< |
descriptionText = new wxTextCtrl( itemPanel10, Description_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH|wxTE_AUTO_URL ); |
| 280 |
< |
descriptionText->SetName(_T("DescriptionName")); |
| 281 |
< |
descriptionText->SetBackgroundColour(wxColour(240, 240, 240)); |
| 282 |
< |
itemBoxSizer11->Add(descriptionText, 1, wxGROW|wxLEFT|wxRIGHT, 5); |
| 283 |
< |
|
| 284 |
< |
MainSplitter->SplitVertically(itemPanel4, itemPanel10, 150); |
| 285 |
< |
itemBoxSizer2->Add(MainSplitter, 1, wxGROW|wxALL, 0); |
| 286 |
< |
|
| 287 |
< |
StatusArea = new wxStatusBar( itemFrame1, ID_STATUSBAR, 0 ); |
| 288 |
< |
StatusArea->SetName(_T("StatusArea")); |
| 289 |
< |
StatusArea->SetFieldsCount(1); |
| 290 |
< |
StatusArea->SetStatusText(_("Status Area"), 0); |
| 291 |
< |
itemBoxSizer2->Add(StatusArea, 0, wxGROW|wxALL, 0); |
| 292 |
< |
|
| 293 |
< |
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL); |
| 294 |
< |
itemBoxSizer2->Add(itemBoxSizer20, 0, wxGROW|wxALL, 0); |
| 295 |
< |
|
| 296 |
< |
ProgressBar = new wxGauge( itemFrame1, ProgressBar_Gauge, 1000, wxDefaultPosition, wxSize(-1, 30), wxGA_SMOOTH ); |
| 297 |
< |
ProgressBar->SetValue(0); |
| 298 |
< |
itemBoxSizer20->Add(ProgressBar, 1, wxGROW|wxALL, 0); |
| 299 |
< |
|
| 300 |
< |
InstallButton = new wxButton( itemFrame1, Install_Button, _("Install!"), wxDefaultPosition, wxSize(-1, 30), 0 ); |
| 301 |
< |
itemBoxSizer20->Add(InstallButton, 0, wxGROW|wxALL, 0); |
| 302 |
< |
|
| 303 |
< |
wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxVERTICAL); |
| 304 |
< |
itemBoxSizer2->Add(itemBoxSizer23, 0, wxGROW|wxALL, 0); |
| 305 |
< |
|
| 306 |
< |
OptionsPanel = new wxPanel( itemFrame1, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); |
| 307 |
< |
itemBoxSizer2->Add(OptionsPanel, 0, wxGROW, 0); |
| 308 |
< |
|
| 309 |
< |
wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL); |
| 310 |
< |
OptionsPanel->SetSizer(itemBoxSizer25); |
| 311 |
< |
|
| 312 |
< |
wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxVERTICAL); |
| 313 |
< |
itemBoxSizer25->Add(itemBoxSizer26, 0, wxGROW|wxALL, 5); |
| 314 |
< |
|
| 315 |
< |
SepRadio = new wxRadioButton( OptionsPanel, Sep_RadioButton, _("Sep"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); |
| 316 |
< |
SepRadio->SetValue(false); |
| 317 |
< |
if (MainWindow::ShowToolTips()) |
| 318 |
< |
SepRadio->SetToolTip(_("For PC Demo and Mac")); |
| 319 |
< |
itemBoxSizer26->Add(SepRadio, 0, wxALIGN_LEFT|wxALL, 5); |
| 320 |
< |
|
| 321 |
< |
NoSepRadio = new wxRadioButton( OptionsPanel, NoSep_RadioButton, _("NoSep"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 322 |
< |
NoSepRadio->SetValue(false); |
| 323 |
< |
if (MainWindow::ShowToolTips()) |
| 324 |
< |
NoSepRadio->SetToolTip(_("For PC Retail")); |
| 325 |
< |
itemBoxSizer26->Add(NoSepRadio, 0, wxALIGN_LEFT|wxALL, 5); |
| 326 |
< |
|
| 327 |
< |
wxStaticLine* itemStaticLine29 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); |
| 328 |
< |
itemBoxSizer25->Add(itemStaticLine29, 0, wxGROW|wxALL, 5); |
| 329 |
< |
|
| 330 |
< |
wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxVERTICAL); |
| 331 |
< |
itemBoxSizer25->Add(itemBoxSizer30, 0, wxGROW|wxALL, 5); |
| 332 |
< |
|
| 333 |
< |
SeparatedRadio = new wxRadioButton( OptionsPanel, Separated_RadioButton, _("Separated Level0"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); |
| 334 |
< |
SeparatedRadio->SetValue(false); |
| 335 |
< |
SeparatedRadio->SetName(_T("Separated_RadioButton")); |
| 336 |
< |
itemBoxSizer30->Add(SeparatedRadio, 0, wxALIGN_LEFT|wxALL, 5); |
| 337 |
< |
|
| 338 |
< |
CompleteRadio = new wxRadioButton( OptionsPanel, Complete_RadioButton, _("Complete Level0"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 339 |
< |
CompleteRadio->SetValue(false); |
| 340 |
< |
CompleteRadio->SetName(_T("Complete_RadioButton")); |
| 341 |
< |
itemBoxSizer30->Add(CompleteRadio, 0, wxALIGN_LEFT|wxALL, 5); |
| 342 |
< |
|
| 343 |
< |
wxStaticLine* itemStaticLine33 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); |
| 344 |
< |
itemBoxSizer25->Add(itemStaticLine33, 0, wxGROW|wxALL, 5); |
| 345 |
< |
|
| 346 |
< |
wxBoxSizer* itemBoxSizer34 = new wxBoxSizer(wxVERTICAL); |
| 347 |
< |
itemBoxSizer25->Add(itemBoxSizer34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); |
| 348 |
< |
|
| 349 |
< |
ReglobalizeButton = new wxButton( OptionsPanel, ReGlobalize_Button, _("Reglobalize"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 350 |
< |
ReglobalizeButton->SetName(_T("Reglobalize_Button")); |
| 351 |
< |
itemBoxSizer34->Add(ReglobalizeButton, 0, wxGROW|wxALL, 5); |
| 194 |
> |
wxMenuBar* menuBar = new wxMenuBar; |
| 195 |
> |
wxMenu* itemMenu37 = new wxMenu; |
| 196 |
> |
{ |
| 197 |
> |
wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_LOAD, _("&Load Configuration..."), wxEmptyString, wxITEM_NORMAL); |
| 198 |
> |
wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("fileopen.xpm"))); |
| 199 |
> |
menuItem->SetBitmap(bitmap); |
| 200 |
> |
itemMenu37->Append(menuItem); |
| 201 |
> |
} |
| 202 |
> |
{ |
| 203 |
> |
wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_SAVE, _("&Save Configuration..."), wxEmptyString, wxITEM_NORMAL); |
| 204 |
> |
wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("filesaveas.xpm"))); |
| 205 |
> |
menuItem->SetBitmap(bitmap); |
| 206 |
> |
itemMenu37->Append(menuItem); |
| 207 |
> |
} |
| 208 |
> |
itemMenu37->AppendSeparator(); |
| 209 |
> |
{ |
| 210 |
> |
wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_EXIT, _("Exit"), wxEmptyString, wxITEM_NORMAL); |
| 211 |
> |
wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("quit.xpm"))); |
| 212 |
> |
menuItem->SetBitmap(bitmap); |
| 213 |
> |
itemMenu37->Append(menuItem); |
| 214 |
> |
} |
| 215 |
> |
menuBar->Append(itemMenu37, _("&File")); |
| 216 |
> |
wxMenu* itemMenu42 = new wxMenu; |
| 217 |
> |
itemMenu42->Append(wxID_OPTIONS, _("Show Advanced Options..."), wxEmptyString, wxITEM_CHECK); |
| 218 |
> |
menuBar->Append(itemMenu42, _("Options")); |
| 219 |
> |
//#ifdef WIN32 |
| 220 |
> |
// itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 221 |
> |
// menuBar->Append(itemMenu44, _("Help")); |
| 222 |
> |
//#else |
| 223 |
> |
itemMenu37->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 224 |
> |
//#endif |
| 225 |
> |
|
| 226 |
> |
itemFrame1->SetMenuBar(menuBar); |
| 227 |
> |
|
| 228 |
> |
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); |
| 229 |
> |
itemFrame1->SetSizer(itemBoxSizer2); |
| 230 |
> |
|
| 231 |
> |
MainSplitter = new wxSplitterWindow( itemFrame1, ID_SPLITTERWINDOW, wxDefaultPosition, wxSize(100, 100), wxSP_LIVE_UPDATE|wxNO_BORDER ); |
| 232 |
> |
MainSplitter->SetMinimumPaneSize(1); |
| 233 |
> |
MainSplitter->SetName(_T("MainSplitter")); |
| 234 |
> |
|
| 235 |
> |
wxPanel* itemPanel4 = new wxPanel( MainSplitter, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); |
| 236 |
> |
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL); |
| 237 |
> |
itemPanel4->SetSizer(itemBoxSizer5); |
| 238 |
> |
|
| 239 |
> |
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL); |
| 240 |
> |
itemBoxSizer5->Add(itemBoxSizer6, 0, wxGROW|wxALL, 0); |
| 241 |
> |
SelectAll = new wxCheckBox( itemPanel4, SelectAll_Checkbox, _("Select All/None"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE ); |
| 242 |
> |
SelectAll->SetValue(false); |
| 243 |
> |
SelectAll->SetName(_T("SelectAll_Checkbox")); |
| 244 |
> |
itemBoxSizer6->Add(SelectAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); |
| 245 |
> |
|
| 246 |
> |
RefreshButton = new wxBitmapButton( itemPanel4, Refresh_Button, itemFrame1->GetBitmapResource(wxT("undo.xpm")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); |
| 247 |
> |
RefreshButton->SetName(_T("RefreshButton")); |
| 248 |
> |
itemBoxSizer6->Add(RefreshButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); |
| 249 |
> |
|
| 250 |
> |
wxArrayString Mods_CheckboxListStrings; |
| 251 |
> |
Mods_CheckboxList = new wxCheckListBox( itemPanel4, Mods_CheckboxList1, wxDefaultPosition, wxDefaultSize, Mods_CheckboxListStrings, wxLB_HSCROLL ); |
| 252 |
> |
Mods_CheckboxList->SetName(_T("Mods_CheckboxList")); |
| 253 |
> |
itemBoxSizer5->Add(Mods_CheckboxList, 1, wxGROW|wxALL, 0); |
| 254 |
> |
|
| 255 |
> |
wxPanel* itemPanel10 = new wxPanel( MainSplitter, DescriptionHolder_Panel, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); |
| 256 |
> |
itemPanel10->SetName(_T("DescriptionHolder_Panel")); |
| 257 |
> |
wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL); |
| 258 |
> |
itemPanel10->SetSizer(itemBoxSizer11); |
| 259 |
> |
|
| 260 |
> |
wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL); |
| 261 |
> |
itemBoxSizer11->Add(itemBoxSizer12, 0, wxGROW|wxALL, 0); |
| 262 |
> |
wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL); |
| 263 |
> |
itemBoxSizer12->Add(itemBoxSizer13, 1, wxALIGN_CENTER_VERTICAL|wxALL, 0); |
| 264 |
> |
titleText = new wxTextCtrl( itemPanel10, Title_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); |
| 265 |
> |
titleText->SetName(_T("Title_Text")); |
| 266 |
> |
titleText->SetBackgroundColour(wxColour(240, 240, 240)); |
| 267 |
> |
itemBoxSizer13->Add(titleText, 1, wxGROW|wxLEFT, 5); |
| 268 |
> |
|
| 269 |
> |
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL); |
| 270 |
> |
itemBoxSizer12->Add(itemBoxSizer15, 1, wxGROW|wxALL, 0); |
| 271 |
> |
creatorText = new wxTextCtrl( itemPanel10, Author_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_RIGHT ); |
| 272 |
> |
creatorText->SetName(_T("Author_Text")); |
| 273 |
> |
creatorText->SetBackgroundColour(wxColour(240, 240, 240)); |
| 274 |
> |
itemBoxSizer15->Add(creatorText, 1, wxGROW|wxRIGHT, 5); |
| 275 |
> |
|
| 276 |
> |
wxStaticLine* itemStaticLine17 = new wxStaticLine( itemPanel10, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); |
| 277 |
> |
itemStaticLine17->Show(false); |
| 278 |
> |
itemBoxSizer11->Add(itemStaticLine17, 0, wxGROW|wxALL, 5); |
| 279 |
> |
|
| 280 |
> |
descriptionText = new wxTextCtrl( itemPanel10, Description_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH|wxTE_RICH2 ); |
| 281 |
> |
descriptionText->SetName(_T("DescriptionName")); |
| 282 |
> |
descriptionText->SetBackgroundColour(wxColour(240, 240, 240)); |
| 283 |
> |
itemBoxSizer11->Add(descriptionText, 1, wxGROW|wxLEFT|wxRIGHT, 5); |
| 284 |
> |
|
| 285 |
> |
MainSplitter->SplitVertically(itemPanel4, itemPanel10, 200); |
| 286 |
> |
itemBoxSizer2->Add(MainSplitter, 1, wxGROW|wxALL, 0); |
| 287 |
> |
|
| 288 |
> |
StatusArea = new wxStatusBar( itemFrame1, ID_STATUSBAR, 0 ); |
| 289 |
> |
StatusArea->SetName(_T("StatusArea")); |
| 290 |
> |
StatusArea->SetFieldsCount(1); |
| 291 |
> |
string versionText = "AE Installer v" + gInstallerVersion; |
| 292 |
> |
StatusArea->SetStatusText(versionText.c_str(), 0); |
| 293 |
> |
itemBoxSizer2->Add(StatusArea, 0, wxGROW|wxALL, 0); |
| 294 |
> |
|
| 295 |
> |
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL); |
| 296 |
> |
itemBoxSizer2->Add(itemBoxSizer20, 0, wxGROW|wxALL, 0); |
| 297 |
> |
|
| 298 |
> |
ProgressBar = new wxGauge( itemFrame1, ProgressBar_Gauge, 1000, wxDefaultPosition, wxDefaultSize, wxGA_SMOOTH ); |
| 299 |
> |
ProgressBar->SetValue(0); |
| 300 |
> |
itemBoxSizer20->Add(ProgressBar, 1, wxGROW|wxALL, 0); |
| 301 |
> |
|
| 302 |
> |
InstallButton = new wxButton( itemFrame1, Install_Button, _("Install!"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 303 |
> |
itemBoxSizer20->Add(InstallButton, 0, wxGROW|wxALL, 0); |
| 304 |
> |
|
| 305 |
> |
wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxVERTICAL); |
| 306 |
> |
itemBoxSizer2->Add(itemBoxSizer23, 0, wxGROW|wxALL, 0); |
| 307 |
> |
|
| 308 |
> |
OptionsPanel = new wxPanel( itemFrame1, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); |
| 309 |
> |
itemBoxSizer2->Add(OptionsPanel, 0, wxGROW, 0); |
| 310 |
> |
|
| 311 |
> |
wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL); |
| 312 |
> |
OptionsPanel->SetSizer(itemBoxSizer25); |
| 313 |
> |
|
| 314 |
> |
wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxVERTICAL); |
| 315 |
> |
itemBoxSizer25->Add(itemBoxSizer26, 0, wxGROW|wxALL, 5); |
| 316 |
> |
|
| 317 |
> |
SepRadio = new wxRadioButton( OptionsPanel, Sep_RadioButton, _("Sep"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); |
| 318 |
> |
SepRadio->SetValue(false); |
| 319 |
> |
if (MainWindow::ShowToolTips()) |
| 320 |
> |
SepRadio->SetToolTip(_("For PC Demo and Mac")); |
| 321 |
> |
itemBoxSizer26->Add(SepRadio, 0, wxALIGN_LEFT|wxALL, 5); |
| 322 |
> |
|
| 323 |
> |
NoSepRadio = new wxRadioButton( OptionsPanel, NoSep_RadioButton, _("NoSep"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 324 |
> |
NoSepRadio->SetValue(false); |
| 325 |
> |
if (MainWindow::ShowToolTips()) |
| 326 |
> |
NoSepRadio->SetToolTip(_("For PC Retail")); |
| 327 |
> |
itemBoxSizer26->Add(NoSepRadio, 0, wxALIGN_LEFT|wxALL, 5); |
| 328 |
> |
|
| 329 |
> |
wxStaticLine* itemStaticLine29 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); |
| 330 |
> |
itemBoxSizer25->Add(itemStaticLine29, 0, wxGROW|wxALL, 5); |
| 331 |
> |
|
| 332 |
> |
wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxVERTICAL); |
| 333 |
> |
itemBoxSizer25->Add(itemBoxSizer30, 0, wxGROW|wxALL, 5); |
| 334 |
> |
|
| 335 |
> |
SeperatedRadio = new wxRadioButton( OptionsPanel, Seperated_RadioButton, _("Separated Level0"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); |
| 336 |
> |
SeperatedRadio->SetValue(false); |
| 337 |
> |
SeperatedRadio->SetName(_T("Seperated_RadioButton")); |
| 338 |
> |
itemBoxSizer30->Add(SeperatedRadio, 0, wxALIGN_LEFT|wxALL, 5); |
| 339 |
> |
|
| 340 |
> |
CompleteRadio = new wxRadioButton( OptionsPanel, Complete_RadioButton, _("Complete Level0"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 341 |
> |
CompleteRadio->SetValue(false); |
| 342 |
> |
CompleteRadio->SetName(_T("Complete_RadioButton")); |
| 343 |
> |
itemBoxSizer30->Add(CompleteRadio, 0, wxALIGN_LEFT|wxALL, 5); |
| 344 |
> |
|
| 345 |
> |
wxStaticLine* itemStaticLine33 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); |
| 346 |
> |
itemBoxSizer25->Add(itemStaticLine33, 0, wxGROW|wxALL, 5); |
| 347 |
> |
|
| 348 |
> |
wxBoxSizer* itemBoxSizer34 = new wxBoxSizer(wxVERTICAL); |
| 349 |
> |
itemBoxSizer25->Add(itemBoxSizer34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); |
| 350 |
> |
|
| 351 |
> |
ReglobalizeButton = new wxButton( OptionsPanel, ReGlobalize_Button, _("Reglobalize"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 352 |
> |
ReglobalizeButton->SetName(_T("Reglobalize_Button")); |
| 353 |
> |
itemBoxSizer34->Add(ReglobalizeButton, 0, wxGROW|wxALL, 5); |
| 354 |
> |
|
| 355 |
> |
wxStaticLine* itemStaticLine100 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); |
| 356 |
> |
itemBoxSizer25->Add(itemStaticLine100, 0, wxGROW|wxALL, 5); |
| 357 |
> |
|
| 358 |
> |
ChangeDirectoryButton = new wxButton( OptionsPanel, Dir_Button, _("Change Dir"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 359 |
> |
ChangeDirectoryButton->SetName(_T("Dir_Button")); |
| 360 |
> |
itemBoxSizer34->Add(ChangeDirectoryButton, 0, wxGROW|wxALL, 5); |
| 361 |
|
|
| 362 |
|
// Connect events and objects |
| 363 |
< |
Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this); |
| 363 |
> |
Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this); |
| 364 |
|
////@end MainWindow content construction |
| 365 |
+ |
#ifdef WIN32 |
| 366 |
+ |
Handle = (HWND)GetHWND(); |
| 367 |
+ |
::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbarList); |
| 368 |
+ |
#endif |
| 369 |
|
|
| 370 |
< |
if ( exists( "../../GameDataFolder/level0_Final.sep" ) ) { |
| 371 |
< |
static_cast<string>("-import:sep"); |
| 1098 |
< |
splitInstances = NOT_SPLIT; |
| 1099 |
< |
} |
| 1100 |
< |
else { |
| 1101 |
< |
static_cast<string>("-import:nosep"); |
| 1102 |
< |
splitInstances = SPLIT; |
| 1103 |
< |
} |
| 1104 |
< |
|
| 370 |
> |
updateStatus = GetUpdateStatus(¤tAE, &updateAE, &installerJustUpdated); |
| 371 |
> |
|
| 372 |
|
globalPackages = getPackages(); |
| 373 |
|
globalInstalledMods = getInstallString(); |
| 374 |
< |
for (int i = 0; i < globalPackages.size(); i++) { |
| 374 |
> |
for (unsigned int i = 0; i < globalPackages.size(); i++) |
| 375 |
> |
{ |
| 376 |
|
Mods_CheckboxList->Append(globalPackages[i].name.c_str()); |
| 377 |
< |
if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); |
| 377 |
> |
if (binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName)) Mods_CheckboxList->Check(i); |
| 378 |
|
} |
| 379 |
|
|
| 380 |
|
TheStatusBar = &StatusArea; |
| 381 |
|
TheInstallButton = InstallButton; |
| 382 |
|
TheProgressBar = ProgressBar; |
| 383 |
|
OptionsPanel->Hide(); |
| 384 |
< |
if(splitInstances == SPLIT) SeparatedRadio->SetValue(true); |
| 384 |
> |
|
| 385 |
> |
if(splitInstances) SeperatedRadio->SetValue(true); |
| 386 |
|
else CompleteRadio->SetValue(true); |
| 1118 |
– |
|
| 1119 |
– |
|
| 1120 |
– |
|
| 387 |
|
if(strImportOption == "-import:nosep") NoSepRadio->SetValue(true); |
| 388 |
|
else SepRadio->SetValue(true); |
| 389 |
|
|
| 1124 |
– |
|
| 390 |
|
#ifdef WIN32 |
| 391 |
|
RedirectIOToConsole(); |
| 392 |
|
HWND hWnd = GetConsoleWindow(); |
| 393 |
|
ShowWindow( hWnd, SW_HIDE ); |
| 394 |
|
#endif |
| 1130 |
– |
|
| 1131 |
– |
//MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight() ); |
| 395 |
|
} |
| 396 |
|
|
| 1134 |
– |
|
| 397 |
|
/* |
| 398 |
|
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for SelectAll_Checkbox |
| 399 |
|
*/ |
| 402 |
|
{ |
| 403 |
|
switch(SelectAll->Get3StateValue()) { |
| 404 |
|
case wxCHK_UNCHECKED: |
| 405 |
< |
for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 1144 |
< |
//SelectAll->Set3StateValue(wxCHK_CHECKED); |
| 405 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 406 |
|
break; |
| 407 |
|
case wxCHK_CHECKED: |
| 408 |
< |
for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true); |
| 1148 |
< |
//SelectAll->Set3StateValue(wxCHK_UNCHECKED); |
| 408 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true); |
| 409 |
|
break; |
| 410 |
|
case wxCHK_UNDETERMINED: |
| 411 |
< |
for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 1152 |
< |
//SelectAll->Set3StateValue(wxCHK_CHECKED); |
| 411 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 412 |
|
break; |
| 1154 |
– |
|
| 413 |
|
} |
| 1156 |
– |
|
| 414 |
|
} |
| 415 |
|
|
| 1159 |
– |
|
| 416 |
|
/* |
| 417 |
|
* wxEVT_CREATE event handler for Mods_CheckboxList |
| 418 |
|
*/ |
| 420 |
|
void MainWindow::ModList_OnCreate( wxWindowCreateEvent& event ) |
| 421 |
|
{ |
| 422 |
|
|
| 1167 |
– |
|
| 423 |
|
} |
| 424 |
|
|
| 425 |
|
|
| 440 |
|
{ |
| 441 |
|
// Bitmap retrieval |
| 442 |
|
////@begin MainWindow bitmap retrieval |
| 443 |
< |
wxUnusedVar(name); |
| 444 |
< |
if (name == _T("redo.xpm")) |
| 445 |
< |
{ |
| 446 |
< |
wxBitmap bitmap(redo_xpm); |
| 447 |
< |
return bitmap; |
| 448 |
< |
} |
| 449 |
< |
else if (name == _T("fileopen.xpm")) |
| 450 |
< |
{ |
| 451 |
< |
wxBitmap bitmap( fileopen_xpm); |
| 452 |
< |
return bitmap; |
| 453 |
< |
} |
| 454 |
< |
else if (name == _T("filesaveas.xpm")) |
| 455 |
< |
{ |
| 456 |
< |
wxBitmap bitmap( filesaveas_xpm); |
| 457 |
< |
return bitmap; |
| 458 |
< |
} |
| 459 |
< |
else if (name == _T("quit.xpm")) |
| 460 |
< |
{ |
| 461 |
< |
wxBitmap bitmap( quit_xpm); |
| 462 |
< |
return bitmap; |
| 463 |
< |
} |
| 464 |
< |
return wxNullBitmap; |
| 443 |
> |
wxUnusedVar(name); |
| 444 |
> |
if (name == _T("undo.xpm")) |
| 445 |
> |
{ |
| 446 |
> |
wxBitmap bitmap( undo_xpm); |
| 447 |
> |
return bitmap; |
| 448 |
> |
} |
| 449 |
> |
else if (name == _T("fileopen.xpm")) |
| 450 |
> |
{ |
| 451 |
> |
wxBitmap bitmap( fileopen_xpm); |
| 452 |
> |
return bitmap; |
| 453 |
> |
} |
| 454 |
> |
else if (name == _T("filesaveas.xpm")) |
| 455 |
> |
{ |
| 456 |
> |
wxBitmap bitmap( filesaveas_xpm); |
| 457 |
> |
return bitmap; |
| 458 |
> |
} |
| 459 |
> |
else if (name == _T("quit.xpm")) |
| 460 |
> |
{ |
| 461 |
> |
wxBitmap bitmap( quit_xpm); |
| 462 |
> |
return bitmap; |
| 463 |
> |
} |
| 464 |
> |
return wxNullBitmap; |
| 465 |
|
////@end MainWindow bitmap retrieval |
| 466 |
|
} |
| 467 |
|
|
| 471 |
|
|
| 472 |
|
wxIcon MainWindow::GetIconResource( const wxString& name ) |
| 473 |
|
{ |
| 1219 |
– |
|
| 474 |
|
// Icon retrieval |
| 475 |
|
////@begin MainWindow icon retrieval |
| 476 |
< |
wxUnusedVar(name); |
| 477 |
< |
if (name == _T("oni_special.ico")) |
| 478 |
< |
{ |
| 479 |
< |
// wxIcon icon(_T("oni_special.ico"), wxBITMAP_TYPE_ICO); |
| 480 |
< |
// return icon; |
| 481 |
< |
} |
| 482 |
< |
return wxNullIcon; |
| 476 |
> |
wxUnusedVar(name); |
| 477 |
> |
if (name == _T("aelogosmall.png")) |
| 478 |
> |
{ |
| 479 |
> |
wxIcon icon(aelogosmall_xpm); |
| 480 |
> |
return icon; |
| 481 |
> |
} |
| 482 |
> |
return wxNullIcon; |
| 483 |
|
////@end MainWindow icon retrieval |
| 484 |
|
} |
| 485 |
|
|
| 1232 |
– |
|
| 486 |
|
/* |
| 487 |
|
* wxEVT_COMMAND_LISTBOX_SELECTED event handler for Mods_CheckboxList1 |
| 488 |
|
*/ |
| 489 |
|
|
| 490 |
|
void MainWindow::OnModsCheckboxList1Selected( wxCommandEvent& event ) |
| 491 |
|
{ |
| 1239 |
– |
//event.GetSelection |
| 492 |
|
titleText->SetValue(globalPackages[event.GetSelection()].name.c_str()); |
| 493 |
|
creatorText->SetValue(globalPackages[event.GetSelection()].creator.c_str()); |
| 494 |
|
descriptionText->SetValue(globalPackages[event.GetSelection()].readme.c_str()); |
| 1243 |
– |
|
| 1244 |
– |
//creatorText->Refresh(); |
| 495 |
|
} |
| 496 |
|
|
| 1247 |
– |
|
| 497 |
|
/* |
| 498 |
|
* wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event handler for Mods_CheckboxList1 |
| 499 |
|
*/ |
| 522 |
|
|
| 523 |
|
void MainWindow::OnOptionsClick( wxCommandEvent& event ) |
| 524 |
|
{ |
| 1276 |
– |
|
| 1277 |
– |
|
| 1278 |
– |
|
| 1279 |
– |
|
| 525 |
|
if (!event.GetInt() ) { |
| 526 |
|
OptionsPanel->Hide(); |
| 527 |
+ |
|
| 528 |
|
this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());} |
| 529 |
|
else { |
| 530 |
< |
// Uncomment this when we release, it gets annoying if you are testing globalization a lot ;) |
| 531 |
< |
wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: These options are for advanced users only, use with caution.", "AE Installer Alert", wxOK | wxICON_EXCLAMATION , wxDefaultPosition); |
| 530 |
> |
wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: These options are for advanced users only, use with caution.", |
| 531 |
> |
"AE Installer Alert", wxOK | wxICON_EXCLAMATION , wxDefaultPosition); |
| 532 |
|
YesNoDialog->ShowModal(); |
| 533 |
|
OptionsPanel->Show(); |
| 534 |
< |
this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight()); |
| 534 |
> |
this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight()+1); |
| 535 |
> |
this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-1); |
| 536 |
|
} |
| 1290 |
– |
|
| 537 |
|
} |
| 538 |
|
|
| 1293 |
– |
|
| 539 |
|
/* |
| 540 |
|
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_EXIT |
| 541 |
|
*/ |
| 545 |
|
exit(0); |
| 546 |
|
} |
| 547 |
|
|
| 1303 |
– |
|
| 548 |
|
/* |
| 549 |
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for Install_Button |
| 550 |
|
*/ |
| 551 |
|
|
| 1308 |
– |
|
| 552 |
|
struct recompile |
| 553 |
|
{ |
| 554 |
|
recompile(vector<string> localPackages) : thePackages(localPackages) { } |
| 557 |
|
TheInstallButton->Disable(); |
| 558 |
|
recompileAll(thePackages); |
| 559 |
|
TheInstallButton->Enable(); |
| 560 |
+ |
|
| 561 |
|
} |
| 1318 |
– |
|
| 562 |
|
vector<string> thePackages; |
| 563 |
|
}; |
| 564 |
|
|
| 565 |
+ |
void globalize2(void) { |
| 566 |
+ |
TheInstallButton->Disable(); |
| 567 |
+ |
globalizeData(); |
| 568 |
+ |
TheInstallButton->Enable(); |
| 569 |
+ |
} |
| 570 |
+ |
|
| 571 |
|
void MainWindow::OnInstallButtonClick( wxCommandEvent& event ) |
| 572 |
|
{ |
| 1324 |
– |
|
| 573 |
|
vector<string> localPackages; |
| 574 |
< |
localPackages.push_back("Globalize"); |
| 575 |
< |
for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName ); |
| 574 |
> |
localPackages.push_back("00000Globalize"); |
| 575 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName ); |
| 576 |
|
if ( !localPackages.empty() ) { |
| 577 |
< |
|
| 578 |
< |
//MainWindow::MainWindow().Hide(); |
| 1331 |
< |
// boost::thread thrd2(recompileAll(localPackages) ); |
| 1332 |
< |
//MainWindow::MainWindow().Show(); |
| 577 |
> |
sort(localPackages.begin(), localPackages.end()); |
| 578 |
> |
localPackages[0] = "Globalize"; |
| 579 |
|
this->InstallButton->Disable(); |
| 580 |
|
this->ReglobalizeButton->Disable(); |
| 581 |
|
#ifdef WIN32 |
| 584 |
|
#else |
| 585 |
|
recompileAll(localPackages); |
| 586 |
|
#endif |
| 1341 |
– |
|
| 587 |
|
this->InstallButton->Enable(); |
| 588 |
|
this->ReglobalizeButton->Enable(); |
| 589 |
|
} |
| 1345 |
– |
|
| 1346 |
– |
|
| 590 |
|
} |
| 591 |
|
|
| 592 |
< |
/*void setStatusArea( string s ) { |
| 593 |
< |
//TheStatusBar = MainWindow::StatusArea; |
| 594 |
< |
(**TheStatusBar).SetStatusText(_(s.c_str()), 0); |
| 595 |
< |
|
| 596 |
< |
//MainWindow::MainWindow().SetSize(MainWindow::MainWindow().GetRect().GetWidth(), MainWindow::MainWindow().GetRect().GetHeight()+1); |
| 597 |
< |
|
| 598 |
< |
//MainWindow::StatusBar->SetLabel("Importing Files..."); |
| 599 |
< |
//StatusBar->SetLabel(s); |
| 600 |
< |
//->SetLabel(s); |
| 601 |
< |
|
| 602 |
< |
}*/ |
| 603 |
< |
|
| 1361 |
< |
void setProgressBar( int i ) { |
| 1362 |
< |
//TheProgressBar->SetValue( |
| 1363 |
< |
|
| 592 |
> |
void setProgressBar( int i ) |
| 593 |
> |
{ |
| 594 |
> |
#ifdef WIN32 |
| 595 |
> |
if (SUCCEEDED(pTaskbarList->QueryInterface(IID_ITaskbarList3, (void **)&pTaskbarList3))) |
| 596 |
> |
{ |
| 597 |
> |
pTaskbarList3->SetProgressValue(Handle,i, 1000); |
| 598 |
> |
if ( i == 0 ) |
| 599 |
> |
{ |
| 600 |
> |
pTaskbarList3->SetProgressState(Handle,TBPF_NOPROGRESS); |
| 601 |
> |
} |
| 602 |
> |
} |
| 603 |
> |
#endif |
| 604 |
|
TheProgressBar->SetValue(i); |
| 1365 |
– |
|
| 605 |
|
} |
| 606 |
|
|
| 1368 |
– |
|
| 607 |
|
/* |
| 608 |
|
* wxEVT_UPDATE_UI event handler for ID_STATUSBAR |
| 609 |
|
*/ |
| 611 |
|
void MainWindow::OnStatusbarUpdate( wxUpdateUIEvent& event ) |
| 612 |
|
{ |
| 613 |
|
////@begin wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow. |
| 614 |
< |
// Before editing this code, remove the block markers. |
| 615 |
< |
event.Skip(); |
| 614 |
> |
// Before editing this code, remove the block markers. |
| 615 |
> |
event.Skip(); |
| 616 |
|
////@end wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow. |
| 617 |
|
} |
| 618 |
|
|
| 1381 |
– |
|
| 619 |
|
/* |
| 620 |
|
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT |
| 621 |
|
*/ |
| 623 |
|
void MainWindow::OnAboutClick( wxCommandEvent& event ) |
| 624 |
|
{ |
| 625 |
|
////@begin wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow. |
| 626 |
< |
// Before editing this code, remove the block markers. |
| 627 |
< |
About* window = new About(this); |
| 628 |
< |
int returnValue = window->ShowModal(); |
| 629 |
< |
window->Destroy(); |
| 626 |
> |
// Before editing this code, remove the block markers. |
| 627 |
> |
About* window = new About(this); |
| 628 |
> |
window->ShowModal(); |
| 629 |
> |
window->Destroy(); |
| 630 |
|
////@end wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow. |
| 631 |
|
} |
| 632 |
|
|
| 1396 |
– |
|
| 633 |
|
/* |
| 634 |
|
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for NoSep_RadioButton |
| 635 |
|
*/ |
| 636 |
< |
|
| 636 |
> |
|
| 637 |
|
void MainWindow::OnNoSepRadioButtonSelected( wxCommandEvent& event ) |
| 638 |
|
{ |
| 639 |
|
static_cast<string>("-import:nosep"); |
| 640 |
|
} |
| 641 |
|
|
| 1406 |
– |
|
| 642 |
|
/* |
| 643 |
|
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Sep_RadioButton |
| 644 |
|
*/ |
| 648 |
|
static_cast<string>("-import:sep"); |
| 649 |
|
} |
| 650 |
|
|
| 1416 |
– |
|
| 651 |
|
/* |
| 652 |
|
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton |
| 653 |
|
*/ |
| 654 |
|
|
| 1421 |
– |
void MainWindow::OnSeparatedRadioButtonSelected( wxCommandEvent& event ) |
| 1422 |
– |
{ |
| 1423 |
– |
splitInstances = SPLIT; |
| 1424 |
– |
|
| 1425 |
– |
} |
| 1426 |
– |
|
| 1427 |
– |
|
| 655 |
|
/* |
| 656 |
|
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Complete_RadioButton |
| 657 |
|
*/ |
| 658 |
|
|
| 659 |
|
void MainWindow::OnCompleteRadioButtonSelected( wxCommandEvent& event ) |
| 660 |
|
{ |
| 661 |
< |
splitInstances = NOT_SPLIT; |
| 1435 |
< |
|
| 661 |
> |
splitInstances = false; |
| 662 |
|
} |
| 663 |
|
|
| 1438 |
– |
|
| 664 |
|
/* |
| 665 |
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BITMAPBUTTON |
| 666 |
|
*/ |
| 667 |
|
|
| 668 |
|
void MainWindow::OnRefreshButtonClick( wxCommandEvent& event ) |
| 669 |
|
{ |
| 670 |
+ |
globalPackages = getPackages(); |
| 671 |
|
refreshMods(globalInstalledMods); |
| 672 |
|
} |
| 673 |
|
|
| 1448 |
– |
|
| 674 |
|
/* |
| 675 |
|
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_LOAD |
| 676 |
|
*/ |
| 677 |
|
|
| 678 |
< |
|
| 679 |
< |
|
| 1455 |
< |
|
| 1456 |
< |
void MainWindow::refreshMods (vector<string> s) { |
| 1457 |
< |
|
| 678 |
> |
void MainWindow::refreshMods (vector<string> s) |
| 679 |
> |
{ |
| 680 |
|
Mods_CheckboxList->Clear(); |
| 681 |
< |
//globalInstalledMods = getPackages(); |
| 1460 |
< |
for (int i = 0; i < globalPackages.size(); i++) { |
| 681 |
> |
for (unsigned int i = 0; i < globalPackages.size(); i++) { |
| 682 |
|
Mods_CheckboxList->Append(globalPackages[i].name.c_str()); |
| 683 |
< |
if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); |
| 684 |
< |
//else Mods_CheckboxList->Check(i,0); |
| 1464 |
< |
|
| 683 |
> |
if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) |
| 684 |
> |
Mods_CheckboxList->Check(i); |
| 685 |
|
} |
| 686 |
|
} |
| 687 |
|
|
| 701 |
|
{ |
| 702 |
|
refreshMods(getInstallString( string(openFileDialog->GetPath()) )); |
| 703 |
|
} |
| 1484 |
– |
|
| 1485 |
– |
|
| 704 |
|
} |
| 705 |
|
|
| 1488 |
– |
|
| 706 |
|
/* |
| 707 |
|
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_SAVE |
| 708 |
|
*/ |
| 721 |
|
|
| 722 |
|
if ( openFileDialog->ShowModal() == wxID_OK ) |
| 723 |
|
{ |
| 1507 |
– |
|
| 1508 |
– |
|
| 1509 |
– |
//Mods_CheckboxList-> |
| 1510 |
– |
|
| 1511 |
– |
|
| 1512 |
– |
|
| 1513 |
– |
// |
| 1514 |
– |
|
| 724 |
|
if ( exists( openFileDialog->GetPath().c_str() ) ) |
| 725 |
|
{ |
| 726 |
|
remove( openFileDialog->GetPath().c_str() ); |
| 729 |
|
ofstream file(openFileDialog->GetPath().c_str()); |
| 730 |
|
|
| 731 |
|
vector<string>list; |
| 732 |
< |
for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName ); |
| 732 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName ); |
| 733 |
|
vector<string>::iterator begin_iter = list.begin(); |
| 734 |
|
vector<string>::iterator end_iter = list.end(); |
| 735 |
|
|
| 741 |
|
|
| 742 |
|
file.close(); |
| 743 |
|
file.clear(); |
| 1535 |
– |
|
| 1536 |
– |
//SetCurrentFilename(openFileDialog->GetFilename()); |
| 1537 |
– |
//theText->LoadFile(openFileDialog->GetFilename()); |
| 1538 |
– |
//SetStatusText(GetCurrentFilename(), 0); |
| 1539 |
– |
//SetStatusText(openFileDialog->GetDirectory(),1); |
| 744 |
|
} |
| 745 |
|
} |
| 746 |
|
|
| 1543 |
– |
|
| 1544 |
– |
|
| 747 |
|
/* |
| 748 |
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ReGlobalize_Button |
| 749 |
|
*/ |
| 750 |
|
|
| 751 |
|
void MainWindow::OnReGlobalizeButtonClick( wxCommandEvent& event ) |
| 752 |
|
{ |
| 753 |
< |
wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: This will DELETE the Edition's GameDataFolder and reglobalize all of your data. \n Are you SURE you want to do this? ", "AE Installer Alert", wxYES_NO | wxICON_EXCLAMATION , wxDefaultPosition); |
| 754 |
< |
|
| 755 |
< |
if (YesNoDialog->ShowModal() == wxID_NO) { //if the user said no... |
| 753 |
> |
string YesNoMsg = "WARNING: This will DELETE the Edition's GameDataFolder and recreate it from the vanilla Oni game data.\n"; |
| 754 |
> |
YesNoMsg = YesNoMsg + "Are you SURE you want to do this?"; |
| 755 |
> |
wxMessageDialog* YesNoDialog = new wxMessageDialog(this, YesNoMsg.c_str(), "AE Installer Alert", wxYES_NO | wxICON_EXCLAMATION , wxDefaultPosition); |
| 756 |
|
|
| 757 |
+ |
if (YesNoDialog->ShowModal() == wxID_NO) |
| 758 |
+ |
{ |
| 759 |
+ |
//if the user said no... |
| 760 |
|
} |
| 761 |
< |
else { |
| 762 |
< |
|
| 761 |
> |
else |
| 762 |
> |
{ |
| 763 |
|
this->InstallButton->Disable(); |
| 764 |
|
this->ReglobalizeButton->Disable(); |
| 1560 |
– |
|
| 765 |
|
#ifdef WIN32 |
| 1562 |
– |
|
| 766 |
|
boost::thread thrd2(globalizeData); |
| 767 |
|
//globalizeData(); |
| 768 |
|
//boost::thread::create_thread(&globalizeData); |
| 770 |
|
// Tg.create_thread( &globalizeData(), this ); |
| 771 |
|
#else |
| 772 |
|
globalizeData(); |
| 1570 |
– |
setProgressBar(1000); |
| 1571 |
– |
setStatusArea("Done!"); |
| 773 |
|
#endif |
| 1573 |
– |
|
| 774 |
|
this->InstallButton->Enable(); |
| 775 |
|
this->ReglobalizeButton->Enable(); |
| 776 |
|
} |
| 1577 |
– |
|
| 777 |
|
} |
| 778 |
|
/* |
| 779 |
|
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton |
| 780 |
|
*/ |
| 781 |
|
|
| 782 |
< |
/*void MainWindow::OnSeparatedRadioButtonSelected( wxCommandEvent& event ) |
| 782 |
> |
/* |
| 783 |
> |
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Seperated_RadioButton |
| 784 |
> |
*/ |
| 785 |
> |
|
| 786 |
> |
void MainWindow::OnSeperatedRadioButtonSelected( wxCommandEvent& event ) |
| 787 |
|
{ |
| 788 |
< |
////@begin wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow. |
| 789 |
< |
// Before editing this code, remove the block markers. |
| 1587 |
< |
event.Skip(); |
| 1588 |
< |
////@end wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow. |
| 1589 |
< |
}*/ |
| 788 |
> |
splitInstances = true; |
| 789 |
> |
} |
| 790 |
|
|
| 791 |
+ |
void MainWindow::OnDirButtonClick( wxCommandEvent& event ) |
| 792 |
+ |
{ |
| 793 |
+ |
wxDirDialog* newDir = new wxDirDialog(this, "Set current directory", "", wxDD_DEFAULT_STYLE, |
| 794 |
+ |
wxDefaultPosition, wxDefaultSize, "wxDirCtrl"); |
| 795 |
+ |
newDir->ShowModal(); |
| 796 |
+ |
if(newDir->GetPath()[0]) current_path( (path)newDir->GetPath() ); |
| 797 |
+ |
OnRefreshButtonClick(event); |
| 798 |
+ |
} |