mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-04-20 15:17:50 +00:00
Merge branch 'strings' of ssh://github.com/audetto/AppleWin into audetto-strings
This commit is contained in:
@@ -137,8 +137,8 @@ void CPropertySheetHelper::SetSlot5(SS_CARDTYPE NewCardType)
|
||||
// . CPageAdvanced: IDC_PRINTER_DUMP_FILENAME_BROWSE
|
||||
std::string CPropertySheetHelper::BrowseToFile(HWND hWindow, TCHAR* pszTitle, TCHAR* REGVALUE, TCHAR* FILEMASKS)
|
||||
{
|
||||
static char PathToFile[MAX_PATH] = {0}; //This is a really awkward way to prevent mixing CiderPress and SaveStated values (RAPCS), but it seem the quickest. Here is its Line 1.
|
||||
strcpy(PathToFile, Snapshot_GetFilename()); //RAPCS, line 2.
|
||||
static std::string PathToFile; //This is a really awkward way to prevent mixing CiderPress and SaveStated values (RAPCS), but it seem the quickest. Here is its Line 1.
|
||||
PathToFile = Snapshot_GetFilename(); //RAPCS, line 2.
|
||||
TCHAR szDirectory[MAX_PATH] = TEXT("");
|
||||
TCHAR szFilename[MAX_PATH];
|
||||
RegLoadString(TEXT("Configuration"), REGVALUE, 1, szFilename, MAX_PATH, TEXT(""));
|
||||
@@ -163,11 +163,11 @@ std::string CPropertySheetHelper::BrowseToFile(HWND hWindow, TCHAR* pszTitle, TC
|
||||
int nRes = GetOpenFileName(&ofn);
|
||||
if(nRes) // Okay is pressed
|
||||
{
|
||||
strcpy(m_szNewFilename, &szFilename[ofn.nFileOffset]); // TODO:TC: m_szNewFilename not used! (Was g_szNewFilename)
|
||||
m_szNewFilename = &szFilename[ofn.nFileOffset]; // TODO:TC: m_szNewFilename not used! (Was g_szNewFilename)
|
||||
|
||||
szFilename[ofn.nFileOffset] = 0;
|
||||
if (_tcsicmp(szDirectory, szFilename))
|
||||
strcpy(m_szSSNewDirectory, szFilename); // TODO:TC: m_szSSNewDirectory looks dodgy! (Was g_szSSNewDirectory)
|
||||
m_szSSNewDirectory = szFilename; // TODO:TC: m_szSSNewDirectory looks dodgy! (Was g_szSSNewDirectory)
|
||||
|
||||
PathName = szFilename;
|
||||
PathName.append (m_szNewFilename);
|
||||
@@ -178,7 +178,7 @@ std::string CPropertySheetHelper::BrowseToFile(HWND hWindow, TCHAR* pszTitle, TC
|
||||
PathName = szFilename;
|
||||
}
|
||||
|
||||
strcpy(m_szNewFilename, PathToFile); //RAPCS, line 3 (last).
|
||||
m_szNewFilename = PathToFile; //RAPCS, line 3 (last).
|
||||
return PathName;
|
||||
}
|
||||
|
||||
@@ -190,52 +190,56 @@ void CPropertySheetHelper::SaveStateUpdate()
|
||||
|
||||
RegSaveString(TEXT(REG_CONFIG), REGVALUE_SAVESTATE_FILENAME, 1, m_szSSNewPathname);
|
||||
|
||||
if(m_szSSNewDirectory[0])
|
||||
if(!m_szSSNewDirectory.empty())
|
||||
RegSaveString(TEXT(REG_PREFS), REGVALUE_PREF_START_DIR, 1, m_szSSNewDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
void CPropertySheetHelper::GetDiskBaseNameWithAWS(TCHAR* pszFilename)
|
||||
void CPropertySheetHelper::GetDiskBaseNameWithAWS(std::string & pszFilename)
|
||||
{
|
||||
LPCTSTR pDiskName = sg_Disk2Card.GetBaseName(DRIVE_1);
|
||||
if (pDiskName && pDiskName[0])
|
||||
const std::string & pDiskName = sg_Disk2Card.GetBaseName(DRIVE_1);
|
||||
if (!pDiskName.empty())
|
||||
{
|
||||
strcpy(pszFilename, pDiskName);
|
||||
strcpy(&pszFilename[strlen(pDiskName)], ".aws.yaml");
|
||||
pszFilename = pDiskName + ".aws.yaml";
|
||||
}
|
||||
}
|
||||
|
||||
// NB. OK'ing this property sheet will call Snapshot_SetFilename() with this new filename
|
||||
int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bool bSave)
|
||||
{
|
||||
TCHAR szDirectory[MAX_PATH] = TEXT("");
|
||||
TCHAR szFilename[MAX_PATH] = {0};
|
||||
std::string szDirectory;
|
||||
std::string tempFilename;
|
||||
|
||||
if (bSave)
|
||||
{
|
||||
// Attempt to use drive1's image name as the name for the .aws file
|
||||
// Else Attempt to use the Prop Sheet's filename
|
||||
GetDiskBaseNameWithAWS(szFilename);
|
||||
if (szFilename[0] == 0)
|
||||
GetDiskBaseNameWithAWS(tempFilename);
|
||||
if (tempFilename.empty())
|
||||
{
|
||||
strcpy(szFilename, Snapshot_GetFilename());
|
||||
tempFilename = Snapshot_GetFilename();
|
||||
}
|
||||
}
|
||||
else // Load (or Browse)
|
||||
{
|
||||
// Attempt to use the Prop Sheet's filename first
|
||||
// Else attempt to use drive1's image name as the name for the .aws file
|
||||
strcpy(szFilename, Snapshot_GetFilename());
|
||||
if (szFilename[0] == 0)
|
||||
tempFilename = Snapshot_GetFilename();
|
||||
if (tempFilename.empty())
|
||||
{
|
||||
GetDiskBaseNameWithAWS(szFilename);
|
||||
GetDiskBaseNameWithAWS(tempFilename);
|
||||
}
|
||||
|
||||
strcpy(szDirectory, Snapshot_GetPath());
|
||||
szDirectory = Snapshot_GetPath();
|
||||
}
|
||||
|
||||
if (szDirectory[0] == 0)
|
||||
strcpy(szDirectory, g_sCurrentDir);
|
||||
if (szDirectory.empty())
|
||||
szDirectory = g_sCurrentDir;
|
||||
|
||||
// convert tempFilename to char * for the rest of the function
|
||||
TCHAR szFilename[MAX_PATH] = {0};
|
||||
strcpy(szFilename, tempFilename.c_str());
|
||||
tempFilename.clear(); // do NOT use this any longer
|
||||
|
||||
//
|
||||
|
||||
@@ -257,7 +261,7 @@ int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bo
|
||||
}
|
||||
ofn.lpstrFile = szFilename; // Dialog strips the last .EXT from this string (eg. file.aws.yaml is displayed as: file.aws
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrInitialDir = szDirectory;
|
||||
ofn.lpstrInitialDir = szDirectory.c_str();
|
||||
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
|
||||
ofn.lpstrTitle = pszTitle;
|
||||
|
||||
@@ -297,12 +301,12 @@ int CPropertySheetHelper::SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bo
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(m_szSSNewFilename, &szFilename[ofn.nFileOffset]);
|
||||
strcpy(m_szSSNewPathname, szFilename);
|
||||
m_szSSNewFilename = &szFilename[ofn.nFileOffset];
|
||||
m_szSSNewPathname = szFilename;
|
||||
|
||||
szFilename[ofn.nFileOffset] = 0;
|
||||
if (_tcsicmp(szDirectory, szFilename))
|
||||
strcpy(m_szSSNewDirectory, szFilename);
|
||||
if (_tcsicmp(szDirectory.c_str(), szFilename))
|
||||
m_szSSNewDirectory = szFilename;
|
||||
}
|
||||
|
||||
m_bSSNewFilename = nRes ? true : false;
|
||||
@@ -336,7 +340,7 @@ void CPropertySheetHelper::PostMsgAfterClose(HWND hWnd, PAGETYPE page)
|
||||
|
||||
if (m_ConfigNew.m_Apple2Type == A2TYPE_CLONE)
|
||||
{
|
||||
MessageBox(hWnd, "Error - Unable to change configuration\n\nReason: A specific clone wasn't selected from the Advanced tab", g_pAppTitle, MB_ICONSTOP | MB_SETFOREGROUND);
|
||||
MessageBox(hWnd, "Error - Unable to change configuration\n\nReason: A specific clone wasn't selected from the Advanced tab", g_pAppTitle.c_str(), MB_ICONSTOP | MB_SETFOREGROUND);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user