Yeah, comments may help. I’ll definitely want a good review once I get the whitespace pushed up in a few days. 🙂
Astyle took care of the mixture of tabs and spaces for indentation a few months ago but I always turn on whitespace viewing in my editor to make sure nothing creeps in. I like to use tabs for indentation as everyone has different preferences for tab size. 🙂
Yeah, fonts can be annoying. That’s why I always use a monospace font 😛
In InitInstance() in project/MWEdit.cpp we have CString path = "E:\\GitHub\\MWEdit\\project\\Debug\\MWEdit.ini";. That needs to be changed. Most people only have a C:\ partition and sometimes D:\. It isn’t in a conditional so there’s a good chance the program crashes when it hits that line as the file can’t be created or accessed. Not even sure where that INI file comes from. I don’t recall seeing anything about one, just the registry where settings are stored, but I may have missed it. Loading from the registry in that function is also commented out. Just did a search and that’s the only line where that file is mentioned:
grep --recursive -n "MWEdit.ini" .
./project/MWEdit.cpp:358: CString path = "E:\\GitHub\\MWEdit\\project\\Debug\\MWEdit.ini";
The next line says it changes the name of the file before it’s used so the file path may not be an issue. I’m still not sure it uses an INI file but I’ll go back and check after I look at setting up build automation. I’m also still concerned about it trying to read from the registry without initializing the registry path first but I don’t know anything about working with the Windows Registry through code, just as a user.
A few lines later, it tries to read from the registry even though the loading from registry code is commented out. This will take investigation for sure so we probably want to get it up on the issue tracker
May be fixable by simply uncommenting the registry lines and commenting that line.
For reference, here are the lines that concern me:
/* Change the registry key under which our settings are stored. */
//SetRegistryKey(_T("MWEdit"));
//FindMWRegistryPath();
//Create the .ini file in application's folder
CString path = "E:\\GitHub\\MWEdit\\project\\Debug\\MWEdit.ini";
//First free the string allocated by MFC at CWinApp startup
//The string is allocated before InitInstance is called..
free((void *)m_pszProfileName);
//Change the name of the .INI file.
//The CWinApp destructor will free the memory.
m_pszProfileName = _tcsdup(_T(path));
/* Load standard INI file options (including MRU) */
LoadStdProfileSettings(0);
/* Load the options from the registry */
m_Options.ReadFromRegistry();
Edit:
Looks like some of the fonts are hardcoded to use MS Sans Serif. We’ll probably want to change them down the road to use more generic font aliases to allow more font flexibility
