| 97 | } |
| 98 | |
| 99 | bool saveConfig() |
| 100 | { |
| 101 | char editorPath[TFE_MAX_PATH]; |
| 102 | TFE_Paths::appendPath(PATH_USER_DOCUMENTS, "editor.ini", editorPath); |
| 103 | |
| 104 | FileStream configFile; |
| 105 | if (!configFile.open(editorPath, Stream::MODE_WRITE)) |
| 106 | { |
| 107 | return false; |
| 108 | } |
| 109 | |
| 110 | TFE_IniParser::writeKeyValue_String(configFile, "EditorPath", s_editorConfig.editorPath); |
| 111 | TFE_IniParser::writeKeyValue_String(configFile, "ExportPath", s_editorConfig.exportPath); |
| 112 | TFE_IniParser::writeKeyValue_Int(configFile, "FontScale", s_editorConfig.fontScale); |
| 113 | TFE_IniParser::writeKeyValue_Int(configFile, "ThumbnailSize", s_editorConfig.thumbnailSize); |
| 114 | |
| 115 | // Level Editor |
| 116 | TFE_IniParser::writeKeyValue_Int(configFile, "Interface_Flags", s_editorConfig.interfaceFlags); |
| 117 | TFE_IniParser::writeKeyValue_Float(configFile, "Curve_SegmentSize", s_editorConfig.curve_segmentSize); |
| 118 | TFE_IniParser::writeKeyValue_String(configFile, "DarkForcesPort", s_editorConfig.darkForcesPort); |
| 119 | TFE_IniParser::writeKeyValue_String(configFile, "OutlawsPort", s_editorConfig.outlawsPort); |
| 120 | TFE_IniParser::writeKeyValue_String(configFile, "DarkForcesAddCmdLine", s_editorConfig.darkForcesAddCmdLine); |
| 121 | TFE_IniParser::writeKeyValue_String(configFile, "OutlawsAddCmdLine", s_editorConfig.outlawsAddCmdLine); |
| 122 | TFE_IniParser::writeKeyValue_Int(configFile, "LevelEditorFlags", s_editorConfig.levelEditorFlags); |
| 123 | |
| 124 | // Recent files. |
| 125 | std::vector<RecentProject>* recentProjects = getRecentProjects(); |
| 126 | if (recentProjects && !recentProjects->empty()) |
| 127 | { |
| 128 | char key[256]; |
| 129 | const s32 count = (s32)recentProjects->size(); |
| 130 | for (s32 i = 0; i < count; i++) |
| 131 | { |
| 132 | sprintf(key, "Recent[%d]", i); |
| 133 | TFE_IniParser::writeKeyValue_String(configFile, key, (*recentProjects)[i].path.c_str()); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | // Keybindings |
| 138 | LevelEditor::writeLevelEditorShortcuts(configFile); |
| 139 | |
| 140 | configFile.close(); |
| 141 | s_configLoaded = true; |
| 142 | return true; |
| 143 | } |
| 144 | |
| 145 | void fontScaleControl() |
| 146 | { |