Mercurial > msvpvf
comparison src/gui.c @ 56:0d62f49c1948
Update gui.c
author | Paper <37962225+mrpapersonic@users.noreply.github.com> |
---|---|
date | Mon, 18 Jul 2022 12:03:45 -0400 |
parents | cf9a14755472 |
children | fcd4b9fe957b |
comparison
equal
deleted
inserted
replaced
55:dbed5f51d635 | 56:0d62f49c1948 |
---|---|
47 } type; | 47 } type; |
48 char* file_name = " "; | 48 char* file_name = " "; |
49 | 49 |
50 void display_file(char* path) { | 50 void display_file(char* path) { |
51 /* Read the file to memory */ | 51 /* Read the file to memory */ |
52 /* eventually this will contain code to show the version and type */ | |
52 FILE* file; | 53 FILE* file; |
53 file = fopen(path, "rb"); | 54 file = fopen(path, "rb"); |
54 fseek(file, 0, SEEK_END); | 55 fseek(file, 0, SEEK_END); |
55 int _size = ftell(file); | 56 int _size = ftell(file); |
56 rewind(file); | 57 rewind(file); |
108 return; | 109 return; |
109 } | 110 } |
110 | 111 |
111 if (CopyFile((TCHAR*)input_file, (TCHAR*)output_file, 0) == 0) { | 112 if (CopyFile((TCHAR*)input_file, (TCHAR*)output_file, 0) == 0) { |
112 MessageBox(hWnd, TEXT("Failed to copy original project file! Does the destination file already exist?"), TEXT("Saving project failed!"), MB_ICONEXCLAMATION); | 113 MessageBox(hWnd, TEXT("Failed to copy original project file! Does the destination file already exist?"), TEXT("Saving project failed!"), MB_ICONEXCLAMATION); |
114 return; | |
113 } | 115 } |
114 FILE* output = fopen(output_file, "r+b"); | 116 FILE* output = fopen(output_file, "r+b"); |
115 if (output == NULL) { | 117 if (output == NULL) { |
116 MessageBox(hWnd, TEXT("Failed to save project file!"), TEXT("Saving project failed!"), MB_ICONEXCLAMATION); | 118 MessageBox(hWnd, TEXT("Failed to save project file!"), TEXT("Saving project failed!"), MB_ICONEXCLAMATION); |
117 return; | 119 return; |
186 type = SendMessage((HWND) lParam, (UINT) LB_GETCURSEL, (WPARAM) 0, (LPARAM) 0); | 188 type = SendMessage((HWND) lParam, (UINT) LB_GETCURSEL, (WPARAM) 0, (LPARAM) 0); |
187 } | 189 } |
188 switch(wParam) { | 190 switch(wParam) { |
189 case OPEN_FILE_BUTTON: | 191 case OPEN_FILE_BUTTON: |
190 file_name = open_file(hWnd); | 192 file_name = open_file(hWnd); |
191 break; | |
192 case COMBOBOX: | 193 case COMBOBOX: |
193 break; /* NOTE: remove these 4 lines if we don't end up doing anything with them */ | |
194 case LISTBOX: | 194 case LISTBOX: |
195 break; | 195 break; |
196 case SAVE_FILE_BUTTON: | 196 case SAVE_FILE_BUTTON: |
197 save_file(hWnd, file_name); | 197 save_file(hWnd, file_name); |
198 break; | 198 break; |