MsgRetType WMessageDialog::domessage( WWindow *parent, const char *text, const char *caption, unsigned type ) { /************************************************************/ if( caption == NULL ) { if( type & GUI_EXCLAMATION ) { // don't call warnings errors caption = "Warning"; } else if( type & GUI_STOP ) { caption = "Error"; } else { caption = "Information"; } } gui_window *handle = NULL; if( parent != NULL ) { handle = parent->handle(); } MsgRetType ret = (MsgRetType)GUIDisplayMessage( handle, (char *)text, (char *)caption, (gui_message_type)type ); return( ret ); }
void ut_fatal( char *s ) { GUIDisplayMessage( NULL, s, " Memory ERROR ", GUI_OK ); // nyi - kanji exit( 1 ); }
/* * processFileName - process a new file name */ static process_rc processFileName( gui_window *gui ) { char *tmp; char *txt; size_t len; char path[_MAX_PATH]; char dir[_MAX_DIR]; char drive[_MAX_DRIVE]; char fname[_MAX_PATH]; char ext[_MAX_PATH]; char *buff; bool has_wild; struct stat buf; int rc; dlg_info *dlg = GUIGetExtra( gui ); tmp = GUIGetText( gui, CTL_EDIT ); if( tmp == NULL ) { return( PROCESS_FALSE ); } txt = alloca( strlen( tmp ) + 1 ); if( txt == NULL ) { GUIMemFree( tmp ); return( PROCESS_FALSE ); } strcpy( txt, tmp ); GUIMemFree( tmp ); splitPath( txt, drive, dir, fname, ext ); has_wild = hasWild( txt ); if( has_wild && fname[0] == 0 ) { return( PROCESS_FALSE ); } if( !has_wild ) { rc = stat( txt, &buf ); if( !rc ) { if( S_ISDIR( buf.st_mode ) ) { goToDir( gui, txt ); if( !initDialog( gui, dlg->fileExtensions[dlg->currExtIndex], NULL ) ) { return( PROCESS_FAIL ); } return( PROCESS_FALSE ); } } _makepath( path, drive, dir, NULL, NULL ); if( !goToDir( gui, path ) ) { return( PROCESS_FALSE ); } if( !rc && (dlg->currOFN->flags & OFN_OVERWRITEPROMPT) ) { buff = alloca( strlen( txt ) + 100 ); strcpy( buff, txt ); strcat( buff, LIT( File_Exists_Replace ) ); rc = GUIDisplayMessage( gui, buff, dlg->currOFN->title, GUI_YES_NO ); if( rc == GUI_RET_NO ) { return( PROCESS_FALSE ); } } _makepath( path, NULL, NULL, fname, ext ); if( dlg->currOFN->base_file_name != NULL ) { len = strlen( txt ); if( len >= dlg->currOFN->max_base_file_name ) { len = dlg->currOFN->max_base_file_name - 1; } memcpy( dlg->currOFN->base_file_name, txt, len ); dlg->currOFN->base_file_name[len] = 0; } if( dlg->currOFN->file_name != NULL ) { getcwd( path, sizeof( path ) ); len = strlen( path ); if( path[len - 1] != FILE_SEP_CHAR ) { path[len] = FILE_SEP_CHAR; path[len + 1] = 0; } strcat( path, fname ); strcat( path, ext ); len = strlen( path ); if( len >= dlg->currOFN->max_file_name ) { len = dlg->currOFN->max_file_name-1; } memcpy( dlg->currOFN->file_name, path, len ); dlg->currOFN->file_name[len] = 0; } return( PROCESS_TRUE ); } _makepath( path, drive, dir, NULL, NULL ); if( !goToDir( gui, path ) ) { return( PROCESS_FALSE ); } _makepath( path, NULL, NULL, fname, ext ); if( !initDialog( gui, path, NULL ) ) { return( PROCESS_FAIL ); } return( PROCESS_FALSE ); } /* processFileName */