Changeset 286
- Timestamp:
- 06/26/08 13:50:18 (2 months ago)
- Files:
-
- GtkRadiant/trunk/radiant/gtkmisc.cpp (modified) (5 diffs)
- GtkRadiant/trunk/radiant/gtkmisc.h (modified) (1 diff)
- GtkRadiant/trunk/radiant/mainframe.cpp (modified) (8 diffs)
- GtkRadiant/trunk/radiant/preferences.cpp (modified) (1 diff)
- GtkRadiant/trunk/radiant/preferences.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
GtkRadiant/trunk/radiant/gtkmisc.cpp
r285 r286 1198 1198 }; 1199 1199 1200 const char* file_dialog (void *parent, gboolean open, const char* title, const char* path, const char* pattern) 1200 /** 1201 * @param[in] baseSubDir should have a trailing slash if not @c NULL 1202 */ 1203 const char* file_dialog (void *parent, gboolean open, const char* title, const char* path, const char* pattern, const char *baseSubDir) 1201 1204 { 1202 1205 // Gtk dialog … … 1291 1294 { 1292 1295 #endif 1296 char buf[PATH_MAX]; 1293 1297 // do that the Gtk way 1294 1298 if (title == NULL) … … 1301 1305 if (!path || path[0] == '\0') 1302 1306 { 1303 #ifdef _WIN32 1304 path = "C:\\"; 1305 #elif defined (__linux__) || defined (__APPLE__) 1306 path = "/"; 1307 #else 1308 path = "/"; 1309 #endif 1310 } 1307 strcpy(buf, g_pGameDescription->mEnginePath.GetBuffer()); 1308 strcat(buf, g_pGameDescription->mBaseGame.GetBuffer()); 1309 strcat(buf, "/"); 1310 if (baseSubDir) 1311 strcat(buf, baseSubDir); 1312 path = buf; 1313 } 1311 1314 1312 1315 // alloc new path with extra char for dir separator … … 1321 1324 1322 1325 #ifdef FILEDLG_DBG 1323 Sys_Printf("Done.\n"); 1324 Sys_Printf("Calling gtk_file_selection_new with title: %s...", title); 1325 #endif 1326 1326 Sys_Printf("Done.\n"); 1327 Sys_Printf("Calling gtk_file_selection_new with title: %s...", title); 1328 #endif 1327 1329 file_sel = gtk_file_selection_new (title); 1328 gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_sel), "/home/mattn/dev/ufoai/trunk/base/maps/"); 1329 1330 #ifdef FILEDLG_DBG 1331 Sys_Printf("Done.\n"); 1332 Sys_Printf("Set the masks..."); 1330 #ifdef FILEDLG_DBG 1331 Sys_Printf("Done.\n"); 1332 Sys_Printf("Set the masks..."); 1333 1333 #endif 1334 1334 … … 1381 1381 { 1382 1382 #ifdef FILEDLG_DBG 1383 Sys_Printf("gtk_file_selection_set_filename... %p ", file_sel);1383 Sys_Printf("gtk_file_selection_set_filename... %p (%s)", file_sel, new_path); 1384 1384 #endif 1385 1385 gtk_file_selection_set_filename (GTK_FILE_SELECTION (file_sel), new_path); GtkRadiant/trunk/radiant/gtkmisc.h
r264 r286 82 82 // NOTE: the returned filename is allocated with g_malloc and MUST be freed with g_free (both for win32 and Gtk dialogs) 83 83 // GtkWidget *parent 84 const char* file_dialog (void *parent, gboolean open, const char* title, const char* path = (char*)NULL, const char* pattern = NULL );84 const char* file_dialog (void *parent, gboolean open, const char* title, const char* path = (char*)NULL, const char* pattern = NULL, const char *baseSubDir = NULL); 85 85 86 86 /*! GtkRadiant/trunk/radiant/mainframe.cpp
r275 r286 1426 1426 GTK_SIGNAL_FUNC (HandleCommand), ID_MISC_PREVIOUSLEAKSPOT); 1427 1427 // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=394 1428 // create_menu_item_with_mnemonic (menu, "_Print XY View", GTK_SIGNAL_FUNC (HandleCommand), ID_MISC_PRINTXY);1428 // create_menu_item_with_mnemonic (menu, _("_Print XY View"), GTK_SIGNAL_FUNC (HandleCommand), ID_MISC_PRINTXY); 1429 1429 item = create_menu_item_with_mnemonic (menu, _("_Select Entity Color..."), 1430 1430 GTK_SIGNAL_FUNC (HandleCommand), ID_MISC_SELECTENTITYCOLOR); … … 4265 4265 char buf[NAME_MAX]; 4266 4266 4267 strcpy(buf, g_qeglobals.m_strHomeMaps.GetBuffer()); 4268 strcat(buf, "maps/"); 4269 4270 str = file_dialog (m_pWidget, TRUE, _("Open Map"), buf, MAP_MAJOR); 4267 if (!g_pGameDescription->noMapsInHome) { 4268 strcpy(buf, g_qeglobals.m_strHomeMaps.GetBuffer()); 4269 strcat(buf, "maps/"); 4270 } else { 4271 buf[0] = '\0'; 4272 } 4273 4274 str = file_dialog (m_pWidget, TRUE, _("Open Map"), buf, MAP_MAJOR, "maps/"); 4271 4275 4272 4276 if (str != NULL) … … 4283 4287 char buf[NAME_MAX]; 4284 4288 4285 strcpy(buf, g_qeglobals.m_strHomeMaps.GetBuffer()); 4286 strcat(buf, "maps/"); 4287 4288 str = file_dialog (m_pWidget, TRUE, _("Import Map"), buf, MAP_MAJOR); 4289 if (!g_pGameDescription->noMapsInHome) { 4290 strcpy(buf, g_qeglobals.m_strHomeMaps.GetBuffer()); 4291 strcat(buf, "maps/"); 4292 } else { 4293 buf[0] = '\0'; 4294 } 4295 4296 str = file_dialog (m_pWidget, TRUE, _("Import Map"), buf, MAP_MAJOR, "maps/"); 4289 4297 4290 4298 if (str != NULL) … … 4307 4315 char buf[NAME_MAX]; 4308 4316 4309 strcpy(buf, g_qeglobals.m_strHomeMaps.GetBuffer()); 4310 strcat(buf, "maps/"); 4311 4312 str = file_dialog (g_pParentWnd->m_pWidget, FALSE, _("Save Map"), buf, MAP_MAJOR); 4317 if (!g_pGameDescription->noMapsInHome) { 4318 strcpy(buf, g_qeglobals.m_strHomeMaps.GetBuffer()); 4319 strcat(buf, "maps/"); 4320 } else { 4321 buf[0] = '\0'; 4322 } 4323 4324 str = file_dialog (g_pParentWnd->m_pWidget, FALSE, _("Save Map"), buf, MAP_MAJOR, "maps/"); 4313 4325 4314 4326 if (str != NULL) … … 4325 4337 char buf[NAME_MAX]; 4326 4338 4327 strcpy(buf, g_qeglobals.m_strHomeMaps.GetBuffer()); 4328 strcat(buf, "maps/"); 4329 4330 str = file_dialog (m_pWidget, FALSE, _("Export Selection"), buf, MAP_MAJOR); 4339 if (!g_pGameDescription->noMapsInHome) { 4340 strcpy(buf, g_qeglobals.m_strHomeMaps.GetBuffer()); 4341 strcat(buf, "maps/"); 4342 } else { 4343 buf[0] = '\0'; 4344 } 4345 4346 str = file_dialog (m_pWidget, FALSE, _("Export Selection"), buf, MAP_MAJOR, "maps/"); 4331 4347 4332 4348 if (str != NULL) … … 4341 4357 char buf[NAME_MAX]; 4342 4358 4343 strcpy(buf, g_qeglobals.m_strHomeMaps.GetBuffer()); 4344 strcat(buf, "maps/"); 4345 4346 str = file_dialog (g_pParentWnd->m_pWidget, FALSE, _("Export Region"), buf, MAP_MAJOR); 4359 if (!g_pGameDescription->noMapsInHome) { 4360 strcpy(buf, g_qeglobals.m_strHomeMaps.GetBuffer()); 4361 strcat(buf, "maps/"); 4362 } else { 4363 buf[0] = '\0'; 4364 } 4365 4366 str = file_dialog (g_pParentWnd->m_pWidget, FALSE, _("Export Region"), buf, MAP_MAJOR, "maps/"); 4347 4367 4348 4368 if (str != NULL) … … 4577 4597 } 4578 4598 4579 filename = file_dialog (m_pWidget, TRUE, _("Import Prefab"), CurPath.GetBuffer(), MAP_MAJOR );4599 filename = file_dialog (m_pWidget, TRUE, _("Import Prefab"), CurPath.GetBuffer(), MAP_MAJOR, "prefabs/"); 4580 4600 4581 4601 if (filename != NULL) … … 4601 4621 AddSlash (CurPath); 4602 4622 4603 filename = file_dialog (m_pWidget, FALSE, _("Export Prefab"), CurPath.GetBuffer(), MAP_MAJOR );4623 filename = file_dialog (m_pWidget, FALSE, _("Export Prefab"), CurPath.GetBuffer(), MAP_MAJOR, "prefabs/"); 4604 4624 if (filename != NULL) 4605 4625 { GtkRadiant/trunk/radiant/preferences.cpp
r285 r286 760 760 } 761 761 762 // if this is set, the open maps dialoge will open the engine path not the 763 // home dir for map loading and saving 764 prop = (char*)xmlGetProp(pNode, (xmlChar*)"no_maps_in_home"); 765 if (prop == NULL) 766 { 767 // default 768 noMapsInHome = false; 769 } 770 else 771 { 772 noMapsInHome = true; 773 xmlFree(prop); 774 } 775 762 776 prop = (char*)xmlGetProp(pNode, (xmlChar*)"basegame"); 763 777 if (prop == NULL) GtkRadiant/trunk/radiant/preferences.h
r264 r286 182 182 Str mCaulkShader; ///< the shader to use for caulking 183 183 bool quake2; ///< set this to true to get quake2 184 bool noMapsInHome; ///< set this if you want to open the engine path/base dir/maps dir for map open/save dialoges */ 184 185 185 186 CGameDescription() { mpDoc = NULL; }
