[UPDATE] Make project recompilable on VS2005

pull/23/merge
Don HO 10 years ago
parent 572f67f511
commit c40a6fc384

@ -928,7 +928,6 @@ generic_string NppParameters::getCloudSettingsPath(CloudChoice cloudChoice)
generic_string settingsPath4dropbox = TEXT(""); generic_string settingsPath4dropbox = TEXT("");
ITEMIDLIST *pidl; ITEMIDLIST *pidl;
static_assert( SUCCEEDED( S_OK ), "bad HRESULT test!" );
const HRESULT specialFolderLocationResult_1 = SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl); const HRESULT specialFolderLocationResult_1 = SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl);
if ( !SUCCEEDED( specialFolderLocationResult_1 ) ) if ( !SUCCEEDED( specialFolderLocationResult_1 ) )
@ -1137,7 +1136,6 @@ generic_string NppParameters::getSettingsFolder()
else else
{ {
ITEMIDLIST *pidl; ITEMIDLIST *pidl;
static_assert( SUCCEEDED( S_OK ), "Bad HRESULT code check!!" );
const HRESULT specialLocationResult = SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl); const HRESULT specialLocationResult = SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl);
if ( !SUCCEEDED( specialLocationResult ) ) if ( !SUCCEEDED( specialLocationResult ) )
{ {
@ -1172,7 +1170,6 @@ bool NppParameters::load()
if (_winVersion >= WV_VISTA) if (_winVersion >= WV_VISTA)
{ {
ITEMIDLIST *pidl; ITEMIDLIST *pidl;
static_assert( SUCCEEDED( S_OK ), "Bad HRESULT code check!!" );
const HRESULT specialLocationResult = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidl); const HRESULT specialLocationResult = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidl);
if ( !SUCCEEDED( specialLocationResult ) ) if ( !SUCCEEDED( specialLocationResult ) )
{ {
@ -1196,7 +1193,6 @@ bool NppParameters::load()
else else
{ {
ITEMIDLIST *pidl; ITEMIDLIST *pidl;
static_assert( SUCCEEDED( S_OK ), "Bad HRESULT code check!!" );
const HRESULT specialLocationResult = SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl); const HRESULT specialLocationResult = SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl);
if ( !SUCCEEDED( specialLocationResult ) ) if ( !SUCCEEDED( specialLocationResult ) )
{ {

@ -35,7 +35,6 @@
#include "Notepad_plus_Window.h" #include "Notepad_plus_Window.h"
#include "keys.h" #include "keys.h"
#include <array>
const int KEY_STR_LEN = 16; const int KEY_STR_LEN = 16;
@ -454,7 +453,11 @@ BOOL CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
// return true if one of CommandShortcuts is deleted. Otherwise false. // return true if one of CommandShortcuts is deleted. Otherwise false.
void Accelerator::updateShortcuts() void Accelerator::updateShortcuts()
{ {
const std::array<int, 3> IFAccIds = { IDM_SEARCH_FINDNEXT, IDM_SEARCH_FINDPREV, IDM_SEARCH_FINDINCREMENT }; vector<int> IFAccIds;
IFAccIds.push_back(IDM_SEARCH_FINDNEXT);
IFAccIds.push_back(IDM_SEARCH_FINDPREV);
IFAccIds.push_back(IDM_SEARCH_FINDINCREMENT);
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters *pNppParam = NppParameters::getInstance();
vector<CommandShortcut> & shortcuts = pNppParam->getUserShortcuts(); vector<CommandShortcut> & shortcuts = pNppParam->getUserShortcuts();
@ -475,20 +478,26 @@ void Accelerator::updateShortcuts()
int offset = 0; int offset = 0;
size_t i = 0; size_t i = 0;
//no validation performed, it might be that invalid shortcuts are being used by default. Allows user to 'hack', might be a good thing //no validation performed, it might be that invalid shortcuts are being used by default. Allows user to 'hack', might be a good thing
for(i = 0; i < nbMenu; ++i) { for(i = 0; i < nbMenu; ++i)
if (shortcuts[i].isEnabled()) {// && shortcuts[i].isValid()) { {
if (shortcuts[i].isEnabled())
{
_pAccelArray[offset].cmd = (WORD)(shortcuts[i].getID()); _pAccelArray[offset].cmd = (WORD)(shortcuts[i].getID());
_pAccelArray[offset].fVirt = shortcuts[i].getAcceleratorModifiers(); _pAccelArray[offset].fVirt = shortcuts[i].getAcceleratorModifiers();
_pAccelArray[offset].key = shortcuts[i].getKeyCombo()._key; _pAccelArray[offset].key = shortcuts[i].getKeyCombo()._key;
// Special extra handling for shortcuts shared by Incremental Find dialog // Special extra handling for shortcuts shared by Incremental Find dialog
if (std::find(IFAccIds.begin(), IFAccIds.end(), shortcuts[i].getID()) != IFAccIds.end()) if (std::find(IFAccIds.begin(), IFAccIds.end(), shortcuts[i].getID()) != IFAccIds.end())
IFAcc.push_back(_pAccelArray[offset]); IFAcc.push_back(_pAccelArray[offset]);
++offset; ++offset;
} }
} }
for(i = 0; i < nbMacro; ++i) { for(i = 0; i < nbMacro; ++i)
if (macros[i].isEnabled()) {// && macros[i].isValid()) { {
if (macros[i].isEnabled())
{
_pAccelArray[offset].cmd = (WORD)(macros[i].getID()); _pAccelArray[offset].cmd = (WORD)(macros[i].getID());
_pAccelArray[offset].fVirt = macros[i].getAcceleratorModifiers(); _pAccelArray[offset].fVirt = macros[i].getAcceleratorModifiers();
_pAccelArray[offset].key = macros[i].getKeyCombo()._key; _pAccelArray[offset].key = macros[i].getKeyCombo()._key;
@ -496,8 +505,10 @@ void Accelerator::updateShortcuts()
} }
} }
for(i = 0; i < nbUserCmd; ++i) { for(i = 0; i < nbUserCmd; ++i)
if (userCommands[i].isEnabled()) {// && userCommands[i].isValid()) { {
if (userCommands[i].isEnabled())
{
_pAccelArray[offset].cmd = (WORD)(userCommands[i].getID()); _pAccelArray[offset].cmd = (WORD)(userCommands[i].getID());
_pAccelArray[offset].fVirt = userCommands[i].getAcceleratorModifiers(); _pAccelArray[offset].fVirt = userCommands[i].getAcceleratorModifiers();
_pAccelArray[offset].key = userCommands[i].getKeyCombo()._key; _pAccelArray[offset].key = userCommands[i].getKeyCombo()._key;
@ -505,8 +516,10 @@ void Accelerator::updateShortcuts()
} }
} }
for(i = 0; i < nbPluginCmd; ++i) { for(i = 0; i < nbPluginCmd; ++i)
if (pluginCommands[i].isEnabled()) {// && pluginCommands[i].isValid()) { {
if (pluginCommands[i].isEnabled())
{
_pAccelArray[offset].cmd = (WORD)(pluginCommands[i].getID()); _pAccelArray[offset].cmd = (WORD)(pluginCommands[i].getID());
_pAccelArray[offset].fVirt = pluginCommands[i].getAcceleratorModifiers(); _pAccelArray[offset].fVirt = pluginCommands[i].getAcceleratorModifiers();
_pAccelArray[offset].key = pluginCommands[i].getKeyCombo()._key; _pAccelArray[offset].key = pluginCommands[i].getKeyCombo()._key;
@ -519,12 +532,21 @@ void Accelerator::updateShortcuts()
updateFullMenu(); updateFullMenu();
//update the table //update the table
if (_hAccTable) if (_hAccTable)
::DestroyAcceleratorTable(_hAccTable); ::DestroyAcceleratorTable(_hAccTable);
_hAccTable = ::CreateAcceleratorTable(_pAccelArray, _nbAccelItems); _hAccTable = ::CreateAcceleratorTable(_pAccelArray, _nbAccelItems);
if (_hIncFindAccTab)
::DestroyAcceleratorTable(_hIncFindAccTab); if (_hIncFindAccTab)
_hIncFindAccTab = ::CreateAcceleratorTable(IFAcc.data(), IFAcc.size()); ::DestroyAcceleratorTable(_hIncFindAccTab);
size_t nb = IFAcc.size();
ACCEL *tmpAccelArray = new ACCEL[nb];
for (i = 0; i < nb; ++i)
{
tmpAccelArray[i] = IFAcc[i];
}
_hIncFindAccTab = ::CreateAcceleratorTable(tmpAccelArray, nb);
delete tmpAccelArray;
return; return;
} }

@ -346,7 +346,7 @@ public:
~Accelerator() { ~Accelerator() {
if (_hAccTable) if (_hAccTable)
::DestroyAcceleratorTable(_hAccTable); ::DestroyAcceleratorTable(_hAccTable);
if (_hIncFindAccTab) if (_hIncFindAccTab)
::DestroyAcceleratorTable(_hIncFindAccTab); ::DestroyAcceleratorTable(_hIncFindAccTab);
if (_pAccelArray) if (_pAccelArray)
delete [] _pAccelArray; delete [] _pAccelArray;

Loading…
Cancel
Save