Fri, 15 Mar 2013 21:53:50 +0200
Set window title dynamically based on filename
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; | |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
33 | f->zFileName = ""; |
0 | 34 | g_LoadedFiles.push_back (f); |
35 | g_CurrentFile = f; | |
36 | ||
37 | g_qWindow->R->hardRefresh(); | |
38 | } |