void MRU_Activate( int index ){ char *text = MRU_GetText( index ); if ( access( text, R_OK ) == 0 ) { text = strdup( text ); MRU_AddFile( text ); Map_LoadFile( text ); free( text ); } else { MRU_used--; for ( int i = index; i < MRU_used; i++ ) MRU_SetText( i, MRU_GetText( i + 1 ) ); if ( MRU_used == 0 ) { gtk_label_set_text( GTK_LABEL( GTK_BIN( MRU_items[0] )->child ), "Recent Files" ); gtk_widget_set_sensitive( MRU_items[0], FALSE ); } else { gtk_widget_hide( MRU_items[MRU_used] ); } } }
void MRU_Activate (std::size_t index) { char text[1024]; strcpy(text, MRU_GetText(index)); if (file_readable(text)) //\todo Test 'map load succeeds' instead of 'file is readable'. { MRU_AddFile (text); Map_RegionOff(); Map_Free(); Map_LoadFile (text); } else { MRU_used--; for (std::size_t i = index; i < MRU_used; i++) MRU_SetText (i, MRU_GetText (i+1)); if (MRU_used == 0) { gtk_label_set_text(GTK_LABEL(GTK_BIN(MRU_items[0])->child), "Recent Files"); gtk_widget_set_sensitive(GTK_WIDGET(MRU_items[0]), FALSE); } else { gtk_widget_hide(GTK_WIDGET(MRU_items[MRU_used])); } } }
BOOL DoMru(HWND hWnd,WORD wId) { char szFileName[128]; OFSTRUCT of; BOOL fExist; GetMenuItem(g_qeglobals.d_lpMruMenu, wId, TRUE, szFileName, sizeof(szFileName)); // Test if the file exists. fExist = OpenFile(szFileName ,&of,OF_EXIST) != HFILE_ERROR; if (fExist) { // Place the file on the top of MRU. AddNewItem(g_qeglobals.d_lpMruMenu,(LPSTR)szFileName); // Now perform opening this file !!! Map_LoadFile (szFileName); } else // Remove the file on MRU. DelMenuItem(g_qeglobals.d_lpMruMenu,wId,TRUE); // Refresh the File menu. PlaceMenuMRUItem(g_qeglobals.d_lpMruMenu,GetSubMenu(GetMenu(hWnd),0), ID_FILE_EXIT); return fExist; }
void OpenDialog( void ) { /* * Obtain the system directory name and * store it in szDirName. */ strcpy( szDirName, ValueForKey( g_qeglobals.d_project_entity, "mapspath" ) ); if ( strlen( szDirName ) == 0 ) { strcpy( szDirName, ValueForKey( g_qeglobals.d_project_entity, "basepath" ) ); strcat( szDirName, "\\maps" ); } /* Place the terminating null character in the szFile. */ szFile[0] = '\0'; /* Set the members of the OPENFILENAME structure. */ ofn.lStructSize = sizeof( OPENFILENAME ); ofn.hwndOwner = g_qeglobals.d_hwndCamera; ofn.lpstrFilter = szFilter; ofn.nFilterIndex = 1; ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof( szFile ); ofn.lpstrFileTitle = szFileTitle; ofn.nMaxFileTitle = sizeof( szFileTitle ); ofn.lpstrInitialDir = szDirName; ofn.Flags = OFN_SHOWHELP | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; /* Display the Open dialog box. */ if ( !GetOpenFileName( &ofn ) ) return; // canceled // Add the file in MRU. //FIXME AddNewItem( g_qeglobals.d_lpMruMenu, ofn.lpstrFile ); // Refresh the File menu. //FIXME PlaceMenuMRUItem( g_qeglobals.d_lpMruMenu, GetSubMenu( GetMenu( g_qeglobals.d_hwndMain ), 0 ), ID_FILE_EXIT ); /* Open the file. */ Map_LoadFile( ofn.lpstrFile ); }
void Map_VerifyCurrentMap(const char *map) { if ( idStr::Icmp( map, currentmap ) != 0 ) { Map_LoadFile( map ); } }