file.cpp

changeset 172
a65547b84ef8
parent 169
f562323760a2
child 179
f98391b179ab
equal deleted inserted replaced
171:36165e58e457 172:a65547b84ef8
285 } 285 }
286 286
287 // ============================================================================= 287 // =============================================================================
288 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 288 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
289 // ============================================================================= 289 // =============================================================================
290 void openMainFile (str zPath) { 290 void openMainFile (str path) {
291 closeAll (); 291 closeAll ();
292 292
293 OpenFile* pFile = openDATFile (zPath, false); 293 OpenFile* file = openDATFile (path, false);
294 294
295 if (!pFile) { 295 if (!file) {
296 // Tell the user loading failed. 296 // Tell the user loading failed.
297 setlocale (LC_ALL, "C"); 297 setlocale (LC_ALL, "C");
298 QMessageBox::critical (g_win, "Load Failure", 298 critical (fmt ("Failed to open %s: %s", path.chars(), strerror (errno)));
299 fmt ("Failed to open %s\nReason: %s", zPath.chars(), strerror (errno)),
300 (QMessageBox::Close), QMessageBox::Close);
301
302 return; 299 return;
303 } 300 }
304 301
305 pFile->m_implicit = false; 302 file->m_implicit = false;
306 g_curfile = pFile; 303 g_curfile = file;
307 304
308 // Recalculate the bounding box 305 // Recalculate the bounding box
309 g_BBox.calculate(); 306 g_BBox.calculate();
310 307
311 // Rebuild the object tree view now. 308 // Rebuild the object tree view now.
312 g_win->refresh (); 309 g_win->refresh ();
313 g_win->setTitle (); 310 g_win->setTitle ();
311 g_win->R ()->resetAngles ();
312
313 History::clear ();
314 314
315 // Add it to the recent files list. 315 // Add it to the recent files list.
316 addRecentFile (zPath); 316 addRecentFile (path);
317 } 317 }
318 318
319 // ============================================================================= 319 // =============================================================================
320 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 320 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
321 // ============================================================================= 321 // =============================================================================

mercurial