ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/Installer/trunk/source/main_window.cpp
(Generate patch)

Comparing AE/Installer/trunk/source/main_window.cpp (file contents):
Revision 385 by gumby, Mon Jul 6 00:59:40 2009 UTC vs.
Revision 396 by gumby, Mon Jul 6 19:18:00 2009 UTC

# Line 1 | Line 1
1 + #ifndef NTDDI_VERSION          
2 + #define NTDDI_VERSION NTDDI_WIN7
3 + #endif
4 + #ifdef WIN32
5 + #include <windows.h>
6 + #include <shobjidl.h>
7 + HWND Handle;
8 +
9 + ITaskbarList *pTaskbarList;
10 + ITaskbarList3 *pTaskbarList3;
11 + #endif
12 +
13   /*
14   AE/Mod Installer
15   by Gumby and Iritscen
# Line 58 | Line 70 | using namespace std;
70   #include "boost/date_time/date_parsing.hpp"
71   #include "boost/date_time/posix_time/posix_time.hpp"
72  
73 + string escapePath(string input) {
74 +        
75 +        string output;
76 +        string escape_me = "& ;()|<>\"'\\#*?$";
77 +        for(int i = 0; i < input.size(); i++)  {
78 +                for(int j = 0; j < escape_me.size(); j++) if (input[i] == escape_me[j]) output += '//';
79 +                output += input[i];
80 +        }
81 +        return output;
82 + }
83 +
84   int globalizeData(void)
85   {
86          busy = 1;
# Line 148 | Line 171 | int globalizeData(void)
171  
172                  if (exists("packages/VanillaDats")) remove_all("packages/VanillaDats");
173                  create_directory( "packages/VanillaDats" );
151
174                  create_directory( "packages/VanillaDats/level0_Final/" );
175                  //blah blah finish this.
176                  //logfile <<  "packages/VanillaDats/level0_Final/ created";
# Line 261 | Line 283 | int globalizeData(void)
283                                                                  if(!exists( Archive / dir_itr->filename())) rename(dir_itr->path(), Archive / dir_itr->filename());
284                                                                  else remove(dir_itr->path());
285                                                  }
286 +                                                else if (dir_itr->path().filename().substr(0,4) == "ONWC") { //fix for buggy ONWC overriding
287 +                                                                cout <<dir_itr->path().filename() << "\n";
288 +
289 +                                                                if(!exists( "packages/VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final/" +  dir_itr->filename())) rename(dir_itr->path(), "packages/VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final/" +  dir_itr->filename());
290 +                                                                else remove(dir_itr->path());
291 +                                                }
292                                                  if (exists(dir_itr->path())) {
293  
294                                                  }
# Line 290 | Line 318 | int globalizeData(void)
318                          logfile << (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final packages/VanillaDats/level" + levels[i] + "_Final/level"
319                                  + levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize.log").c_str() << '\n';
320                          string sys_str = (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final packages/VanillaDats/level" + levels[i] + "_Final/level"
321 <                                + levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize2.log");
321 >                                + levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize.log");
322                                  system(sys_str.c_str() );
323                          setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) ));
324                          parts_done++;
# Line 330 | Line 358 | int globalizeData(void)
358                  setProgressBar( 1000 );
359                  
360                  // CIP:last of all, set up the edition folder as a playable Oni installation by placing the latest application (+ Daodan DLL on Windows) in edition/
361 <                
362 <                // CIP:then copy persist.dat and keyconfig.txt into edition/ as well
363 <                
361 >                // or we could just include it in the zip in the proper place already.
362 >
363 >                copy("../../persist.dat","../persist.dat");
364 >                copy("../../keyconfig.txt","../keyconfig.txt");
365   #ifndef WIN32
366                  /* On Mac only, set the current GDF to the AE GDF by writing to Oni's global preferences file (thankfully a standard OS X ".plist" XML file).
367                     If there are no Oni prefs (only possible if Oni has not been run even once), then the above line will fail silently, no harm done,
# Line 345 | Line 374 | int globalizeData(void)
374                  
375   #endif
376                  
377 +                
378                  setStatusArea((string)"Done! Now select your mod packages and click install.");
379                  //      while(1) Sleep(-1);
380  
# Line 974 | Line 1004 | void MainWindow::CreateControls()
1004      itemMenu42->Append(wxID_OPTIONS, _("Show Advanced Options..."), wxEmptyString, wxITEM_CHECK);
1005      menuBar->Append(itemMenu42, _("Options"));
1006      wxMenu* itemMenu44 = new wxMenu;
1007 <    itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL);
1008 <    menuBar->Append(itemMenu44, _("Help"));
1007 > #ifdef WIN32
1008 >        itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL);
1009 >        menuBar->Append(itemMenu44, _("Help"));
1010 > #else
1011 >        itemMenu37->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL);
1012 > #endif  
1013 >
1014      itemFrame1->SetMenuBar(menuBar);
1015  
1016      wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
# Line 1108 | Line 1143 | void MainWindow::CreateControls()
1143      Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this);
1144          ////@end MainWindow content construction
1145  
1146 +        Handle = (HWND)GetHWND();
1147 +        ::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbarList);
1148 +
1149 +
1150          if ( exists( "../../GameDataFolder/level0_Final.sep" ) ) {
1151                  strImportOption = "-import:sep";
1152                  splitInstances = NOT_SPLIT;
# Line 1116 | Line 1155 | void MainWindow::CreateControls()
1155                  strImportOption = "-import:nosep";
1156                  splitInstances = SPLIT;
1157          }
1158 <
1158 >        
1159          globalPackages = getPackages();
1160          globalInstalledMods = getInstallString();
1161          for (int i = 0; i < globalPackages.size(); i++) {
# Line 1128 | Line 1167 | void MainWindow::CreateControls()
1167          TheInstallButton = InstallButton;
1168          TheProgressBar = ProgressBar;
1169          OptionsPanel->Hide();
1170 +        
1171 + //#ifndef WIN32
1172 + //      itemMenu37->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL);
1173 +        
1174 + //#endif
1175 +        
1176          if(splitInstances == SPLIT) SeperatedRadio->SetValue(true);
1177          else CompleteRadio->SetValue(true);
1133
1134
1135
1178          if(strImportOption == "-import:nosep") NoSepRadio->SetValue(true);
1179          else SepRadio->SetValue(true);
1180  
# Line 1373 | Line 1415 | void MainWindow::OnInstallButtonClick( w
1415  
1416   void setProgressBar( int i ) {
1417          //TheProgressBar->SetValue(
1418 + #ifdef WIN32
1419 +        
1420 +
1421 +
1422 + if (SUCCEEDED(pTaskbarList->QueryInterface(IID_ITaskbarList3, (void **)&pTaskbarList3)))
1423 + {
1424 +        
1425 +        pTaskbarList3->SetProgressValue(Handle,i, 1000);
1426 +        if ( i == 0 ) {
1427  
1428 +        pTaskbarList3->SetProgressState(Handle,TBPF_NOPROGRESS);
1429 +        }
1430 + }
1431 +
1432 +
1433 + #endif
1434          TheProgressBar->SetValue(i);
1435  
1436   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)