#include "select.h"
#include "map.h"
#include "preferences.h"
+#include "preferencesystem.h"
+#include "stringio.h"
#include "gtkdlgs.h"
#include "mainframe.h"
#include "qe3.h"
}
}
-const char *misc_model_dialog(ui::Widget parent)
-{
- StringOutputStream buffer(1024);
-
- buffer << g_qeglobals.m_userGamePath.c_str() << "models/";
+CopiedString g_strLastModelFolder = "";
- if (!file_readable(buffer.c_str())) {
- // just go to fsmain
- buffer.clear();
- buffer << g_qeglobals.m_userGamePath.c_str() << "/";
+const char *getLastModelFolderPath()
+{
+ if (g_strLastModelFolder.empty()) {
+ GlobalPreferenceSystem().registerPreference("LastModelFolder", make_property_string(g_strLastModelFolder));
+ if (g_strLastModelFolder.empty()) {
+ StringOutputStream buffer(1024);
+ buffer << g_qeglobals.m_userGamePath.c_str() << "models/";
+ if (!file_readable(buffer.c_str())) {
+ // just go to fsmain
+ buffer.clear();
+ buffer << g_qeglobals.m_userGamePath.c_str() << "/";
+ }
+ g_strLastModelFolder = buffer.c_str();
+ }
}
+ return g_strLastModelFolder.c_str();
+}
+
+const char *misc_model_dialog(ui::Widget parent)
+{
+ const char *filename = parent.file_dialog(TRUE, "Choose Model", getLastModelFolderPath(), ModelLoader::Name());
- const char *filename = parent.file_dialog(TRUE, "Choose Model", buffer.c_str(), ModelLoader::Name());
- if (filename != 0) {
+ if (filename != NULL) {
+ g_strLastModelFolder = g_path_get_dirname(filename);
// use VFS to get the correct relative path
const char *relative = path_make_relative(filename, GlobalFileSystem().findRoot(filename));
if (relative == filename) {
}
-#include "preferencesystem.h"
-#include "stringio.h"
-
void Entity_Construct()
{
GlobalCommands_insert("EntityColor", makeCallbackF(Entity_setColour), Accelerator('K'));
#include "cmdlib.h"
#include "stream/textfilestream.h"
#include "os/path.h"
+#include "os/file.h"
#include "uniquenames.h"
#include "modulesystem/singletonmodule.h"
#include "modulesystem/moduleregistry.h"
}
};
-CopiedString g_strLastFolder = "";
+CopiedString g_strLastMapFolder = "";
/*
================
ScopeDisableScreenUpdates disableScreenUpdates("Processing...", "Loading Map");
MRU_AddFile(filename);
- g_strLastFolder = g_path_get_dirname(filename);
+ g_strLastMapFolder = g_path_get_dirname(filename);
{
ScopeTimer timer("map load");
{
ScopeDisableScreenUpdates disableScreenUpdates("Processing...", "Loading Map");
- g_strLastFolder = g_path_get_dirname(filename);
+ g_strLastMapFolder = g_path_get_dirname(filename);
bool success = false;
return g_mapsPath.c_str();
}
-const char *getLastFolderPath()
+const char *getLastMapFolderPath()
{
- if (g_strLastFolder.empty()) {
- GlobalPreferenceSystem().registerPreference("LastFolder", make_property_string(g_strLastFolder));
- if (g_strLastFolder.empty()) {
- g_strLastFolder = g_qeglobals.m_userGamePath;
+ if (g_strLastMapFolder.empty()) {
+ GlobalPreferenceSystem().registerPreference("LastMapFolder", make_property_string(g_strLastMapFolder));
+ if (g_strLastMapFolder.empty()) {
+ StringOutputStream buffer(1024);
+ buffer << getMapsPath();
+ if (!file_readable(buffer.c_str())) {
+ buffer.clear();
+ buffer << g_qeglobals.m_userGamePath.c_str() << "/";
+ }
+ g_strLastMapFolder = buffer.c_str();
}
}
- return g_strLastFolder.c_str();
+ return g_strLastMapFolder.c_str();
}
const char *map_open(const char *title)
{
- return MainFrame_getWindow().file_dialog(TRUE, title, getLastFolderPath(), MapFormat::Name(), true, false, false);
+ return MainFrame_getWindow().file_dialog(TRUE, title, getLastMapFolderPath(), MapFormat::Name(), true, false, false);
}
const char *map_import(const char *title)
{
- return MainFrame_getWindow().file_dialog(TRUE, title, getLastFolderPath(), MapFormat::Name(), false, true, false);
+ return MainFrame_getWindow().file_dialog(TRUE, title, getLastMapFolderPath(), MapFormat::Name(), false, true, false);
}
const char *map_save(const char *title)
{
- return MainFrame_getWindow().file_dialog(FALSE, title, getLastFolderPath(), MapFormat::Name(), false, false, true);
+ return MainFrame_getWindow().file_dialog(FALSE, title, getLastMapFolderPath(), MapFormat::Name(), false, false, true);
}
void OpenMap()
const char *filename = map_save("Save Map");
if (filename != NULL) {
- g_strLastFolder = g_path_get_dirname(filename);
+ g_strLastMapFolder = g_path_get_dirname(filename);
MRU_AddFile(filename);
Map_Rename(filename);
return Map_Save();
const char *filename = map_save("Export Selection");
if (filename != NULL) {
- g_strLastFolder = g_path_get_dirname(filename);
+ g_strLastMapFolder = g_path_get_dirname(filename);
Map_SaveSelected(filename);
}
}
const char *filename = map_save("Export Region");
if (filename != NULL) {
- g_strLastFolder = g_path_get_dirname(filename);
+ g_strLastMapFolder = g_path_get_dirname(filename);
Map_SaveRegion(filename);
}
}