Use system-agnostic return values for SaveFileYesNoCancel()

This function was returning ID{YES,NO,CANCEL}, which are specific to
Windows as return values for MessageBox(). These have been replaced with
SAVE_{YES,NO,CANCEL}, which we define ourselves.
This commit is contained in:
Daniel Richard G 2013-09-18 16:49:32 -04:00
parent 70b6bad551
commit 42a46e83fa
3 changed files with 16 additions and 5 deletions

View File

@ -343,16 +343,16 @@ bool SolveSpace::OkayToStartNewFile(void) {
if(!unsaved) return true;
switch(SaveFileYesNoCancel()) {
case IDYES:
case SAVE_YES:
return GetFilenameAndSave(false);
case IDNO:
case SAVE_NO:
return true;
case IDCANCEL:
case SAVE_CANCEL:
return false;
default: oops();
default: oops(); break;
}
}

View File

@ -82,7 +82,11 @@ class ExprQuaternion;
extern char RecentFile[MAX_RECENT][MAX_PATH];
void RefreshRecentMenus(void);
#define SAVE_YES (1)
#define SAVE_NO (-1)
#define SAVE_CANCEL (0)
int SaveFileYesNoCancel(void);
// SolveSpace native file format
#define SLVS_PATTERN "SolveSpace Models (*.slvs)\0*.slvs\0All Files (*)\0*\0\0"
#define SLVS_EXT "slvs"

View File

@ -873,7 +873,14 @@ int SaveFileYesNoCancel(void)
EnableWindow(GraphicsWnd, TRUE);
SetForegroundWindow(GraphicsWnd);
return r;
switch(r) {
case IDYES: return SAVE_YES;
case IDNO: return SAVE_NO;
case IDCANCEL: return SAVE_CANCEL;
}
oops();
return SAVE_CANCEL;
}
void LoadAllFontFiles(void)