This commit is contained in:
2024-08-16 13:56:54 -04:00
parent 75df00b3e3
commit 2e364ff470
19 changed files with 211 additions and 125 deletions

View File

@@ -24,7 +24,8 @@ template <class T>
T &Block<T>::find(LONG itemIndex)
{
Container<T> *lpCursor=mContainer;
for(Index i=0;i<mSize&&i<itemIndex;i++)lpCursor=lpCursor->next();
Index i=0;
for(i=0;i<mSize&&i<itemIndex;i++)lpCursor=lpCursor->next();
if(i==itemIndex)
{
mLastIndexReferenced=i;

View File

@@ -187,7 +187,7 @@ void BitmapInfo::height(LONG height)
inline
BitmapInfo::BitsPerPixel BitmapInfo::bitCount(void)const
{
return BitsPerPixel(mlpBitmapInfo->bmiHeader.biBitCount);
return BitmapInfo::BitsPerPixel(mlpBitmapInfo->bmiHeader.biBitCount);
}
inline

View File

@@ -82,7 +82,7 @@ bool FileIO::read(DWORD &value)
bool FileIO::read(char *lpBuffer,DWORD lengthData)
{
BYTE byteValue;
BYTE byteValue(0);
if(!isOkay()||!lpBuffer)return false;
return (1==::fread(lpBuffer,lengthData,1,mlpFilePointer));
@@ -190,7 +190,7 @@ bool FileIO::writeLine(const String &strLine)
{
if(!isOkay()||strLine.isNull())return false;
if(!write((char*)(String&)strLine,strLine.length()))return false;
return write("\r\n",2);
return write((char*)"\r\n",2);
}
bool FileIO::write(char *lpBuffer,DWORD lengthData)

View File

@@ -13,6 +13,12 @@
#include <common/intel.hpp>
#endif
#if _MSC_VER > 1200
#pragma warning( disable : 26812)
#endif
// Optimized for fast reading of files.
class FileIO
{
public:

View File

@@ -107,7 +107,6 @@ GDIPoint &GDIPoint::operator-=(const GDIPoint &someGDIPoint)
{
x(x()-someGDIPoint.x());
y(y()-someGDIPoint.y());
return *this;
return *this;
}

View File

@@ -17,14 +17,16 @@ GUIWindow::~GUIWindow()
bool GUIWindow::insertModelessDialog(GUIWindow &modelessDialog)
{
if(!isValid()||!modelessDialog.isValid())return false;
mModelessDialogs.insert(&WindowPointer(&modelessDialog));
// mModelessDialogs.insert(&WindowPointer(&modelessDialog));
mModelessDialogs.insert(new WindowPointer(&modelessDialog));
return true;
}
void GUIWindow::removeModelessDialog(GUIWindow &modelessDialog)
{
if(!isValid())return;
mModelessDialogs.remove(&WindowPointer(&modelessDialog));
// mModelessDialogs.remove(&WindowPointer(&modelessDialog));
mModelessDialogs.remove(new WindowPointer(&modelessDialog));
}
GUIWindow &GUIWindow::operator=(const GUIWindow &/*someGUIWindow*/)

View File

@@ -122,7 +122,7 @@ protected:
#else
static LONG FAR PASCAL _export WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
static int FAR PASCAL _export DlgProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
static UINT FAR PASCAL OFHookProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
static UINT FAR PASCAL OFHookProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
static LONG FAR PASCAL _export FrameProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
static LONG FAR PASCAL _export MDIProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
#endif

View File

@@ -17,8 +17,14 @@
#include <common/overlap.hpp>
#endif
#if _MSC_VER > 1200
#pragma warning( disable : 6031 26812)
#endif
class Overlapped;
// good for writing files
class FileHandle
{
public:
@@ -70,7 +76,6 @@ public:
SystemTime lastModifyTime(void)const;
void disposition(Disposition disposition);
private:
// enum {CarriageReturn=0x0D,LineFeed=0x0A,NullChar=0x00};
enum {CarriageReturn=0x0D,LineFeed=0x0A,TabChar=0x09,NullChar=0x00};
Disposition disposition(void)const;
void pathFileName(const String &pathFileName);

View File

@@ -167,14 +167,10 @@ DWORD PureBitmap::getBitmapBits(GlobalData<BYTE> &bitmapBytes,BitmapInfo::BitsPe
BitmapInfo bmInfo;
DWORD scanLines(0);
DWORD scanLineWidth;
WORD scanWidth;
WORD scanHeight;
if(!isOkay())return scanLines;
scanLineWidth=width();
if(scanLineWidth%2L)scanLineWidth++;
scanWidth=scanLineWidth;
scanHeight=height();
bitmapBytes.size(scanLineWidth*(DWORD)height()*(bitsPerPixel/8));
systemPalette.systemPalette();
bmInfo.width(width());
@@ -193,14 +189,10 @@ DWORD PureBitmap::getBitmapBits(GlobalData<BYTE> &bitmapBytes,BitmapInfo::BitsPe
BitmapInfo bmInfo;
DWORD scanLines(0);
DWORD scanLineWidth;
WORD scanWidth;
WORD scanHeight;
if(!isOkay())return scanLines;
scanLineWidth=width();
if(scanLineWidth%2L)scanLineWidth++;
scanWidth=scanLineWidth;
scanHeight=height();
bitmapBytes.size(scanLineWidth*(DWORD)height()*(bitsPerPixel/8));
purePalette.systemPalette();
bmInfo.width(width());
@@ -238,14 +230,10 @@ DWORD PureBitmap::getBitmapBits(GlobalData<BYTE> &bitmapBytes,BOOL bottomUp)cons
BitmapInfo bmInfo;
DWORD scanLines(0);
DWORD scanLineWidth;
WORD scanWidth;
WORD scanHeight;
if(!isOkay())return scanLines;
scanLineWidth=width();
if(scanLineWidth%2L)scanLineWidth++;
scanWidth=scanLineWidth;
scanHeight=height();
bitmapBytes.size(scanLineWidth*(DWORD)height()*(mBitmap.bmBitsPixel/8));
systemPalette.systemPalette();
bmInfo.width(width());
@@ -261,16 +249,12 @@ DWORD PureBitmap::setBitmapBits(GlobalData<BYTE> &bitmapBytes,BOOL bottomUp)cons
{
DWORD scanLines(0);
DWORD scanLineWidth;
DWORD scanWidth;
DWORD scanHeight;
PureDevice pureDevice;
BitmapInfo bmInfo;
if(!isOkay())return scanLines;
scanLineWidth=width();
if(scanLineWidth%2L)scanLineWidth++;
scanWidth=scanLineWidth;
scanHeight=height();
bitmapBytes.size(scanLineWidth*(DWORD)height()*(mBitmap.bmBitsPixel/8));
PurePalette systemPalette;
systemPalette.systemPalette();

View File

@@ -59,7 +59,8 @@ DWORD PureViewOfFile::peek(BYTE *npBuffer,DWORD sizeBuffer)
BYTE *npPeekCursor=(BYTE*)mnpCursor;
if(!npPeekCursor)return FALSE;
for(DWORD itemIndex=0;itemIndex<sizeBuffer;itemIndex++)
DWORD itemIndex=0;
for(itemIndex=0;itemIndex<sizeBuffer;itemIndex++)
{
if(npPeekCursor>mnpLastValidAddress)return itemIndex;
*(npBuffer+itemIndex)=*((BYTE*)npPeekCursor);

View File

@@ -319,21 +319,25 @@ WORD PurePalette::identityPalette(void)
paletteData.systemPalette();
if(SYSPAL_NOSTATIC==::GetSystemPaletteUse(pureDevice))
{
Array<RGBColor> paletteColors;
Array<RGBColor> paletteColors;
RGBColor colorWhite(255,255,255);
RGBColor colorBlack(0,0,0);
getPaletteColors(paletteColors);
setPaletteColors(paletteColors,PaletteEntry::NoCollapse);
setPaletteColor(PurePalette::MaxColors-1,RGBColor(255,255,255));
setPaletteColor(0,RGBColor(0,0,0));
setPaletteColor(PurePalette::MaxColors-1,colorWhite);
setPaletteColor(0,colorBlack);
createPalette();
return TRUE;
}
if(SystemStaticColors!=(staticColors=::GetDeviceCaps(pureDevice,NUMCOLORS)))return FALSE;
staticColors/=2;
for(int paletteIndex=0;paletteIndex<staticColors;paletteIndex++)
int paletteIndex=0;
for(paletteIndex=0;paletteIndex<staticColors;paletteIndex++)
systemTree.insertItem(paletteData[paletteIndex]);
for(paletteIndex=MaxColors-staticColors;paletteIndex<MaxColors;paletteIndex++)
systemTree.insertItem(paletteData[paletteIndex]);
for(int index=0;index<staticColors;index++)paletteData[index].flags(PaletteEntry::NullFlag);
systemTree.insertItem(paletteData[paletteIndex]);
int index=0;
for(index=0;index<staticColors;index++)paletteData[index].flags(PaletteEntry::NullFlag);
while(index<MaxColors-staticColors&&useableIndex<MaxColors)
{
getPaletteColor(useableIndex,rgbColor);
@@ -373,7 +377,8 @@ WORD PurePalette::isIdentityPalette(void)const
}
if(SystemStaticColors!=(staticColors=::GetDeviceCaps(pureDevice,NUMCOLORS)))return FALSE;
staticColors/=2;
for(int paletteIndex=0;paletteIndex<staticColors;paletteIndex++)
int paletteIndex=0;
for(paletteIndex=0;paletteIndex<staticColors;paletteIndex++)
if(!(RGBColor(((PurePalette&)*this).mPaletteData[paletteIndex])==RGBColor(paletteData[paletteIndex])))return FALSE;
for(paletteIndex=paletteEntries()-staticColors;paletteIndex<paletteEntries();paletteIndex++)
if(!(RGBColor(((PurePalette&)*this).mPaletteData[paletteIndex])==RGBColor(paletteData[paletteIndex])))return FALSE;

View File

@@ -45,7 +45,8 @@ public:
LONG height(void)const;
void height(LONG newHeight);
tagRECT &getRect(void);
String Rect::toString(void)const;
// String Rect::toString(void)const;
String toString(void)const;
private:
};

View File

@@ -6,15 +6,19 @@
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _COMMON_BLOCK_HPP_
#include <common/block.hpp>
#endif
class ResType
{
public:
enum Resource{RtAccelerator=RT_ACCELERATOR,RtBitmap=RT_BITMAP,RtDialog=RT_DIALOG,
RtFont=RT_FONT,RtFontDir=RT_FONTDIR,RtMenu=RT_MENU,RtData=RT_RCDATA,
RtString=RT_STRING,RtMessageTable=RT_MESSAGETABLE,RtCursor=RT_CURSOR,
RtGroupCursor=RT_GROUP_CURSOR,RtIcon=RT_ICON,RtGroupIcon=RT_GROUP_ICON,
RtVersion=RT_VERSION};
enum Resource {RtAccelerator = (int)RT_ACCELERATOR, RtBitmap = (int)RT_BITMAP, RtDialog = (int)RT_DIALOG,
RtFont=(int)RT_FONT,RtFontDir=(int)RT_FONTDIR,RtMenu=(int)RT_MENU,RtData=(int)RT_RCDATA,
RtString=(int)RT_STRING,RtMessageTable=(int)RT_MESSAGETABLE,RtCursor=(int)RT_CURSOR,
RtGroupCursor=(int)RT_GROUP_CURSOR,RtIcon=(int)RT_ICON,RtGroupIcon=(int)RT_GROUP_ICON,
RtVersion=(int)RT_VERSION};
};
class ResDisposition
@@ -29,15 +33,18 @@ class ResData
public:
ResData(void);
ResData(const ResData &someResData);
ResData(const String &resName,ResType::Resource resType=ResType::RtData,HMODULE hResModule=GetModuleHandle(0));
ResData(WORD resourceId,ResType::Resource resType=ResType::RtData,HMODULE hResModule=GetModuleHandle(0));
ResData(const String& resName, ResType::Resource resType = ResType::RtData, HMODULE hResModule = GetModuleHandle(0));
virtual ~ResData();
ResData &operator=(const ResData &someResData);
ResData &operator=(const String &resName);
operator T*(void)const;
DWORD getSize()const;
WORD isOkay(void)const;
private:
void create(const String &resName,ResType::Resource resType=ResType::RtData,HMODULE hResModule=::GetModuleHandle(0));
void destroy(void);
void create(WORD resourceId, ResType::Resource resType = ResType::RtData, HMODULE hResModule = ::GetModuleHandle(0));
void destroy(void);
HRSRC resHandle(void)const;
void resHandle(HRSRC resHandle);
HGLOBAL resData(void)const;
@@ -45,8 +52,10 @@ private:
ResDisposition::Disposition resDisp(void)const;
void resDisp(ResDisposition::Disposition resDisp);
HRSRC mhResHandle;
HGLOBAL mhResData;
HRSRC mhResHandle; // returned from ::FindResource()
HGLOBAL mhResData; // returned from ::LoadResource();
HMODULE mhResModule; // the module
T* pData;
ResDisposition::Disposition mDisposition;
};
@@ -68,11 +77,21 @@ ResData<T>::ResData(const ResData &someResData)
template <class T>
inline
ResData<T>::ResData(const String &resName,ResType::Resource resType,HMODULE hResModule)
: mhResHandle(0), mhResData(0), mDisposition(ResDisposition::Delete)
: mhResHandle(0), mhResData(0), mhResModule(hResModule), mDisposition(ResDisposition::Delete)
{
create(resName,resType,hResModule);
}
template <class T>
inline
ResData<T>::ResData(WORD resourceId, ResType::Resource resType, HMODULE hResModule)
: mhResHandle(0), mhResData(0), mhResModule(hResModule), mDisposition(ResDisposition::Delete)
{
create(resourceId, resType, hResModule);
}
template <class T>
inline
ResData<T>::~ResData()
@@ -102,24 +121,50 @@ ResData<T> &ResData<T>::operator=(const String &resName)
return *this;
}
template <class T>
inline
DWORD ResData<T>::getSize()const
{
if (!isOkay())return 0;
return ::SizeofResource(mhResModule, mhResHandle);
}
template <class T>
inline
ResData<T>::operator T*(void)const
{
return (T*)mhResData;
return pData;
}
template <class T>
inline
void ResData<T>::create(const String &resName,ResType::Resource resType,HMODULE hResModule)
{
ResType resourceType = ResType();
destroy();
resHandle(::FindResource(hResModule,resName,(const char*)resType));
resHandle(::FindResource(hResModule, resName, MAKEINTRESOURCE(resType)));
if(!resHandle())return;
resData(::LoadResource(hResModule,mhResHandle));
resDisp(ResDisposition::Delete);
pData = (T*)::LockResource(resData());
}
template <class T>
inline
void ResData<T>::create(WORD resourceId, ResType::Resource resType, HMODULE hResModule)
{
ResType resourceType = ResType();
destroy();
// resHandle(::FindResource(hResModule, resName, (const char*)resType));
resHandle(::FindResource(hResModule, MAKEINTRESOURCE(resourceId), MAKEINTRESOURCE(resType)));
if (!resHandle())return;
resData(::LoadResource(hResModule, mhResHandle));
resDisp(ResDisposition::Delete);
pData = (T*)::LockResource(resData());
}
template <class T>
inline
void ResData<T>::destroy(void)
@@ -128,6 +173,7 @@ void ResData<T>::destroy(void)
::FreeResource(resData());
resData(0);
resHandle(0);
pData = 0;
resDisp(ResDisposition::Invalid);
}

View File

@@ -4,6 +4,7 @@
#include <common/string.hpp>
#include <common/block.hpp>
#include <common/macro.hpp>
#include <common/array.hpp>
String::String(const char *npStr)
: mnpStr(0), mLengthBytes(0)
@@ -16,7 +17,8 @@ String::String(const char *npStr)
except(0,EXCEPTION_EXECUTE_HANDLER){stringLength=0;}
#else
__try{stringLength=::strlen(npStr);}
__except(0,EXCEPTION_EXECUTE_HANDLER){stringLength=0;}
// __except(0,EXCEPTION_EXECUTE_HANDLER){stringLength=0;}
__except (EXCEPTION_EXECUTE_HANDLER) { stringLength = 0; }
#endif
if(!stringLength)return;
stringLength++;
@@ -232,6 +234,23 @@ String String::betweenString(char beginToken,char endToken)const
return String(nullString);
}
Block<String> String::split(char delimeter)const
{
Block<String> stringList = Block<String>();
String strDelimeter = String(delimeter);
String runningString = String(*this);
int position = runningString.strpos(strDelimeter);
while (-1 != position)
{
stringList.insert(new String(runningString.substr(0, position - 1)));
runningString = runningString.substr(position + 1);
position = runningString.strpos(strDelimeter);
}
if (runningString.length())stringList.insert(new String(runningString));
return stringList;
}
WORD String::makeBlock(Block<String> &receiveStrings,const String &tokenString)const
{
String stringData(*this);
@@ -383,7 +402,8 @@ String &String::trimLeft(void)
size_t strLen;
if(isNull()||(0==(strLen=length())))return *this;
for(short index=0;index<strLen;index++)if(Blank!=*(mnpStr+index))break;
short index=0;
for(index=0;index<strLen;index++)if(Blank!=*(mnpStr+index))break;
if(!index)return *this;
*this=substr(index);
return *this;
@@ -409,7 +429,8 @@ void String::replaceToken(BYTE tokenFind,BYTE tokenReplace)
String tempString;
if(!length)return;
for(int pos=0;pos<length;pos++)if(*(mnpStr+pos)==tokenFind)*(mnpStr+pos)=tokenReplace;
int pos=0;
for(pos=0;pos<length;pos++)if(*(mnpStr+pos)==tokenFind)*(mnpStr+pos)=tokenReplace;
for(pos=0;pos<length;pos++){if((mnpStr+pos))tempString+=*(mnpStr+pos);}
*this=tempString;
}
@@ -571,7 +592,7 @@ short String::toShort(void)const
unsigned short String::toUShort(void)const
{
if(isNull())return 0;
if (isNull())return 0;
return unsigned short(::atoi(str()));
}
@@ -643,6 +664,7 @@ String &String::fromBool(bool boolValue)
// non-member
istream &operator>>(istream &stream,String &someString)
{
char charData;
@@ -666,6 +688,8 @@ ostream &operator<<(ostream &stream,const String &someString)
return stream<<(char*)((String&)someString);
}
String operator+(const char *str,const String &string)
{
return String(str)+string;

View File

@@ -10,6 +10,8 @@
template <class T>
class Block;
template <class T>
class Array;
class istream;
class ostream;
class String;
@@ -71,6 +73,7 @@ public:
String &trimLeft(void);
void spaceTerm(void);
String betweenString(char beginToken,char endToken)const;
Block<String> split(char delimter)const;
String substr(WORD startPosition,WORD endPosition)const;
String substr(WORD startPosition)const;
String extractDigits(void)const;
@@ -231,7 +234,7 @@ int String::operator==(const String &someString)const
{
if(!mnpStr&&!someString.mnpStr)return 1;
if(!mnpStr||!someString.mnpStr)return 0;
return (!::strcmp(mnpStr,someString.mnpStr));
return (0==::strcmp(mnpStr,someString.mnpStr));
}
inline
@@ -255,7 +258,7 @@ int String::operator==(const char *someCharStar)const
{
if(!mnpStr&&!someCharStar)return 1;
if(!mnpStr||!someCharStar)return 0;
return (!::strcmp(mnpStr,someCharStar));
return (0==::strcmp(mnpStr,someCharStar));
}
inline

View File

@@ -12,6 +12,10 @@
#include <common/filetime.hpp>
#endif
#if _MSC_VER > 1200
#pragma warning( disable : 26812)
#endif
class SystemTime : private SYSTEMTIME
{
public:

View File

@@ -2,7 +2,7 @@
WORD VectorHandler::insertHandler(HandlerType handlerType,PureCallback *lpCallback,CallOrder callOrder)
{
WORD returnCode;
WORD returnCode(0);
switch(handlerType)
{
@@ -412,7 +412,7 @@ CallbackData::ReturnType VectorHandler::callHandler(Block<CallbackPointer> &some
CallbackData::ReturnType returnCode(0);
CallbackData::ReturnType callReturn;
for(int vectorIndex=0;vectorIndex<size;vectorIndex++)
for(int vectorIndex=0;vectorIndex<(int)size;vectorIndex++)
{
if(FALSE!=(callReturn=someCallbackVector[vectorIndex].callback(someCallbackData)))returnCode=callReturn;
size=(size_t)someCallbackVector.size();
@@ -422,199 +422,200 @@ CallbackData::ReturnType VectorHandler::callHandler(Block<CallbackPointer> &some
void VectorHandler::removeHandler(HandlerType handlerType,PureCallback *lpCallback)
{
CallbackPointer callbackPointer(lpCallback);
switch(handlerType)
{
case ChangeCBChainHandler :
removeHandler(mChangeCBChainVector,CallbackPointer(lpCallback));
removeHandler(mChangeCBChainVector,callbackPointer);
break;
case DrawClipboardHandler :
removeHandler(mDrawClipboardVector,CallbackPointer(lpCallback));
removeHandler(mDrawClipboardVector,callbackPointer);
break;
case UserHandler :
removeHandler(mUserVector,CallbackPointer(lpCallback));
removeHandler(mUserVector,callbackPointer);
break;
case NCCreateHandler :
removeHandler(mNCCreateVector,CallbackPointer(lpCallback));
removeHandler(mNCCreateVector,callbackPointer);
break;
case CreateHandler :
removeHandler(mCreateVector,CallbackPointer(lpCallback));
removeHandler(mCreateVector,callbackPointer);
break;
case InitDialogHandler :
removeHandler(mInitDialogVector,CallbackPointer(lpCallback));
removeHandler(mInitDialogVector,callbackPointer);
break;
case SetFontHandler :
removeHandler(mSetFontVector,CallbackPointer(lpCallback));
removeHandler(mSetFontVector,callbackPointer);
break;
case TimerHandler :
removeHandler(mTimerVector,CallbackPointer(lpCallback));
removeHandler(mTimerVector,callbackPointer);
break;
case CharHandler :
removeHandler(mCharVector,CallbackPointer(lpCallback));
removeHandler(mCharVector,callbackPointer);
break;
case SizeHandler :
removeHandler(mSizeVector,CallbackPointer(lpCallback));
removeHandler(mSizeVector,callbackPointer);
break;
case CompactingHandler :
removeHandler(mCompactingVector,CallbackPointer(lpCallback));
removeHandler(mCompactingVector,callbackPointer);
break;
case WinIniChangeHandler :
removeHandler(mWinIniChangeVector,CallbackPointer(lpCallback));
removeHandler(mWinIniChangeVector,callbackPointer);
break;
case SysColorChangeHandler :
removeHandler(mSysColorChangeVector,CallbackPointer(lpCallback));
removeHandler(mSysColorChangeVector,callbackPointer);
break;
case LeftButtonDoubleHandler :
removeHandler(mLeftButtonDoubleVector,CallbackPointer(lpCallback));
removeHandler(mLeftButtonDoubleVector,callbackPointer);
break;
case LeftButtonDownHandler :
removeHandler(mLeftButtonDownVector,CallbackPointer(lpCallback));
removeHandler(mLeftButtonDownVector,callbackPointer);
break;
case LeftButtonUpHandler :
removeHandler(mLeftButtonUpVector,CallbackPointer(lpCallback));
removeHandler(mLeftButtonUpVector,callbackPointer);
break;
case RightButtonDoubleHandler :
removeHandler(mRightButtonDoubleVector,CallbackPointer(lpCallback));
removeHandler(mRightButtonDoubleVector,callbackPointer);
break;
case RightButtonDownHandler :
removeHandler(mRightButtonDownVector,CallbackPointer(lpCallback));
removeHandler(mRightButtonDownVector,callbackPointer);
break;
case RightButtonUpHandler :
removeHandler(mRightButtonUpVector,CallbackPointer(lpCallback));
removeHandler(mRightButtonUpVector,callbackPointer);
break;
case NCLeftButtonDownHandler :
removeHandler(mNCLeftButtonDownVector,CallbackPointer(lpCallback));
removeHandler(mNCLeftButtonDownVector,callbackPointer);
break;
case NCLeftButtonUpHandler :
removeHandler(mNCLeftButtonUpVector,CallbackPointer(lpCallback));
removeHandler(mNCLeftButtonUpVector,callbackPointer);
break;
case NCRightButtonDownHandler :
removeHandler(mNCRightButtonDownVector,CallbackPointer(lpCallback));
removeHandler(mNCRightButtonDownVector,callbackPointer);
break;
case NCRightButtonUpHandler :
removeHandler(mNCRightButtonUpVector,CallbackPointer(lpCallback));
removeHandler(mNCRightButtonUpVector,callbackPointer);
break;
case PaintHandler :
removeHandler(mPaintVector,CallbackPointer(lpCallback));
removeHandler(mPaintVector,callbackPointer);
break;
case EraseBackgroundHandler :
removeHandler(mEraseBackgroundVector,CallbackPointer(lpCallback));
removeHandler(mEraseBackgroundVector,callbackPointer);
break;
case PaletteChangedHandler :
removeHandler(mPaletteChangedVector,CallbackPointer(lpCallback));
removeHandler(mPaletteChangedVector,callbackPointer);
break;
case CommandHandler :
removeHandler(mCommandVector,CallbackPointer(lpCallback));
removeHandler(mCommandVector,callbackPointer);
break;
case SetFocusHandler :
removeHandler(mSetFocusVector,CallbackPointer(lpCallback));
removeHandler(mSetFocusVector,callbackPointer);
break;
case KillFocusHandler :
removeHandler(mKillFocusVector,CallbackPointer(lpCallback));
removeHandler(mKillFocusVector,callbackPointer);
break;
case KeyUpHandler :
removeHandler(mKeyUpVector,CallbackPointer(lpCallback));
removeHandler(mKeyUpVector,callbackPointer);
break;
case KeyDownHandler :
removeHandler(mKeyDownVector,CallbackPointer(lpCallback));
removeHandler(mKeyDownVector,callbackPointer);
break;
case SysKeyUpHandler :
removeHandler(mSysKeyUpVector,CallbackPointer(lpCallback));
removeHandler(mSysKeyUpVector,callbackPointer);
break;
case SysKeyDownHandler :
removeHandler(mSysKeyDownVector,CallbackPointer(lpCallback));
removeHandler(mSysKeyDownVector,callbackPointer);
break;
case MinMaxHandler :
removeHandler(mMinMaxVector,CallbackPointer(lpCallback));
removeHandler(mMinMaxVector,callbackPointer);
break;
case EnterIdleHandler :
removeHandler(mEnterIdleVector,CallbackPointer(lpCallback));
removeHandler(mEnterIdleVector,callbackPointer);
break;
case DrawItemHandler :
removeHandler(mDrawItemVector,CallbackPointer(lpCallback));
removeHandler(mDrawItemVector,callbackPointer);
break;
case ControlColorHandler :
removeHandler(mControlColorVector,CallbackPointer(lpCallback));
removeHandler(mControlColorVector,callbackPointer);
break;
case NotifyHandler :
removeHandler(mNotifyVector,CallbackPointer(lpCallback));
removeHandler(mNotifyVector,callbackPointer);
break;
case MenuSelectHandler :
removeHandler(mMenuSelectVector,CallbackPointer(lpCallback));
removeHandler(mMenuSelectVector,callbackPointer);
break;
case MeasureItemHandler :
removeHandler(mMeasureItemVector,CallbackPointer(lpCallback));
removeHandler(mMeasureItemVector,callbackPointer);
break;
case DDEInitiateHandler :
removeHandler(mDDEInitiateVector,CallbackPointer(lpCallback));
removeHandler(mDDEInitiateVector,callbackPointer);
break;
case DDEAckHandler :
removeHandler(mDDEAckVector,CallbackPointer(lpCallback));
removeHandler(mDDEAckVector,callbackPointer);
break;
case DDERequestHandler :
removeHandler(mDDERequestVector,CallbackPointer(lpCallback));
removeHandler(mDDERequestVector,callbackPointer);
break;
case DDETerminateHandler :
removeHandler(mDDETerminateVector,CallbackPointer(lpCallback));
removeHandler(mDDETerminateVector,callbackPointer);
break;
case DDEDataHandler :
removeHandler(mDDEDataVector,CallbackPointer(lpCallback));
removeHandler(mDDEDataVector,callbackPointer);
break;
case MMOpenHandler :
removeHandler(mMMOpenVector,CallbackPointer(lpCallback));
removeHandler(mMMOpenVector,callbackPointer);
break;
case MMCloseHandler :
removeHandler(mMMCloseVector,CallbackPointer(lpCallback));
removeHandler(mMMCloseVector,callbackPointer);
break;
case MMDoneHandler :
removeHandler(mMMDoneVector,CallbackPointer(lpCallback));
removeHandler(mMMDoneVector,callbackPointer);
break;
case CloseHandler :
removeHandler(mCloseVector,CallbackPointer(lpCallback));
removeHandler(mCloseVector,callbackPointer);
break;
case MouseMoveHandler :
removeHandler(mMouseMoveVector,CallbackPointer(lpCallback));
removeHandler(mMouseMoveVector,callbackPointer);
break;
case DialogCodeHandler :
removeHandler(mDialogCodeVector,CallbackPointer(lpCallback));
removeHandler(mDialogCodeVector,callbackPointer);
break;
case DestroyHandler :
removeHandler(mDestroyVector,CallbackPointer(lpCallback));
removeHandler(mDestroyVector,callbackPointer);
break;
case NCDestroyHandler :
removeHandler(mNCDestroyVector,CallbackPointer(lpCallback));
removeHandler(mNCDestroyVector,callbackPointer);
break;
case HorizontalScrollHandler :
removeHandler(mHorizontalScrollVector,CallbackPointer(lpCallback));
removeHandler(mHorizontalScrollVector,callbackPointer);
break;
case VerticalScrollHandler :
removeHandler(mVerticalScrollVector,CallbackPointer(lpCallback));
removeHandler(mVerticalScrollVector,callbackPointer);
break;
case DropFilesHandler :
removeHandler(mDropFilesVector,CallbackPointer(lpCallback));
removeHandler(mDropFilesVector,callbackPointer);
break;
case MDIActivateHandler :
removeHandler(mMDIActivateVector,CallbackPointer(lpCallback));
removeHandler(mMDIActivateVector,callbackPointer);
break;
case MDIDestroyHandler :
removeHandler(mMDIDestroyVector,CallbackPointer(lpCallback));
removeHandler(mMDIDestroyVector,callbackPointer);
break;
case QueryEndSessionHandler :
removeHandler(mQueryEndSessionVector,CallbackPointer(lpCallback));
removeHandler(mQueryEndSessionVector,callbackPointer);
break;
case ActivateAppHandler :
removeHandler(mActivateAppVector,CallbackPointer(lpCallback));
removeHandler(mActivateAppVector,callbackPointer);
break;
case DisplayChangeHandler :
removeHandler(mDisplayChangeVector,CallbackPointer(lpCallback));
removeHandler(mDisplayChangeVector,callbackPointer);
break;
case ShowWindowHandler :
removeHandler(mShowWindowVector,CallbackPointer(lpCallback));
removeHandler(mShowWindowVector,callbackPointer);
break;
case CaptureChangedHandler :
removeHandler(mCaptureChangedVector,CallbackPointer(lpCallback));
removeHandler(mCaptureChangedVector,callbackPointer);
break;
case DeviceChangeHandler :
removeHandler(mDeviceChangeVector,CallbackPointer(lpCallback));
removeHandler(mDeviceChangeVector,callbackPointer);
break;
}
@@ -624,7 +625,7 @@ void VectorHandler::removeHandler(Block<CallbackPointer> &someCallbackVector,Cal
{
size_t size((size_t)someCallbackVector.size());
for(int vectorIndex=0;vectorIndex<size;vectorIndex++)
for(int vectorIndex=0;vectorIndex<(int)size;vectorIndex++)
{
if(someCallbackVector[vectorIndex]==locatePointer)
{
@@ -777,10 +778,13 @@ WORD VectorHandler::insert(Block<CallbackPointer> &someHandlerBlock,PureCallback
if(FirstHandler==callOrder&&someHandlerBlock.size())
{
CallbackPointer firstCallback(someHandlerBlock[0]);
someHandlerBlock[0]=CallbackPointer(lpCallback);
someHandlerBlock.insert(&firstCallback);
CallbackPointer callback(lpCallback);
someHandlerBlock[0]=callback;
// someHandlerBlock[0]=CallbackPointer(lpCallback);
someHandlerBlock.insert(&firstCallback);
}
else someHandlerBlock.insert(&CallbackPointer(lpCallback));
return (WORD)someHandlerBlock.size();
// else someHandlerBlock.insert(&CallbackPointer(lpCallback));
else someHandlerBlock.insert(new CallbackPointer(lpCallback));
return (WORD)someHandlerBlock.size();
}

View File

@@ -188,11 +188,9 @@ int Window::windowProcedure(HWND hWnd,WORD message,WPARAM wParam,LPARAM lParam)
case WM_ACTIVATEAPP :
if(!installedHandlers(VectorHandler::ActivateAppHandler))return ::DefWindowProc(hWnd,message,wParam,lParam);
return callHandlers(VectorHandler::ActivateAppHandler,CallbackData(wParam,lParam,hWnd));
break;
case WM_DISPLAYCHANGE :
if(!installedHandlers(VectorHandler::DisplayChangeHandler))return ::DefWindowProc(hWnd,message,wParam,lParam);
return callHandlers(VectorHandler::DisplayChangeHandler,CallbackData(wParam,lParam,hWnd));
break;
case WM_DESTROY :
callHandlers(VectorHandler::DestroyHandler,CallbackData(wParam,lParam,hWnd));
InstanceData::removeInstanceData(hWnd);

View File

@@ -1,5 +1,8 @@
#ifndef _COMMON_WINDOWS_HPP_
#define _COMMON_WINDOWS_HPP_
#ifndef _MSC_VER
#define _MSC_VER 1200
#endif
#define WIN32_LEAN_AND_MEAN
#define NOSERVICE
#define NOKANJI