Fri, 15 Mar 2013 20:52:34 +0200
improve opening, don't auto-load 55966.dat (:P)
0 | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | |
3 | #include "common.h" | |
4 | #include "io.h" | |
5 | #include "gui.h" | |
6 | #include "draw.h" | |
7 | ||
8 | // Clear everything from the model | |
9 | void closeModel () { | |
10 | // Remove all loaded files and the objects they contain | |
11 | for (ushort i = 0; i < g_LoadedFiles.size(); i++) { | |
12 | OpenFile* f = g_LoadedFiles[i]; | |
13 | ||
14 | for (ushort j = 0; j < f->objects.size(); ++j) | |
15 | delete f->objects[j]; | |
16 | ||
17 | delete f; | |
18 | } | |
19 | ||
20 | // Clear the array | |
21 | g_LoadedFiles.clear(); | |
22 | g_CurrentFile = NULL; | |
23 | ||
24 | g_qWindow->R->hardRefresh(); | |
25 | } | |
26 | ||
27 | void newModel () { | |
28 | // Create a new anonymous file and set it to our current | |
29 | if (g_LoadedFiles.size()) | |
30 | closeModel (); // Close any open file first, though | |
31 | ||
32 | OpenFile* f = new OpenFile; | |
33 | f->filename = ""; | |
34 | g_LoadedFiles.push_back (f); | |
35 | g_CurrentFile = f; | |
36 | ||
37 | g_qWindow->R->hardRefresh(); | |
38 | } |