home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2002 December
/
PCWorld_2002-12_cd.bin
/
Software
/
Komercni
/
Baltik
/
katB.exe
/
katB
/
DESIGN
/
DESIGN_C.MEM
< prev
next >
Wrap
Text File
|
2002-09-16
|
4KB
|
117 lines
////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------//
//-----project DESINGER, copyright 2002 Libor Bareτ-------------------------//
//----------------------------------------------------------------------------//
////////////////////////////////////////////////////////////////////////////////
void InitCell(DIAGRAMCELL * pCell){
memset(pCell,0,sizeof(DIAGRAMCELL));
StrVytvo²(pCell->ClassName);
StrVytvo²(pCell->strExStereotypes);
StrVytvo²(pCell->strExProperties);
}
int* DependentItemDelete(int* SrcPointer, int &nSize, int nID){
if((nID < nSize-1)){
memmove(&SrcPointer[nID],&SrcPointer[nID+1],sizeof(int)*(nSize-nID-1));
}
SrcPointer = (int*)realloc(SrcPointer,sizeof(int)*(nSize-1));
nSize--;
if( nSize != 0 && SrcPointer==0)KERNELSTOP(0);
return SrcPointer;
}
void* ClassItemInit(void* SrcPointer, int &nSize, int nNewSize){
if(nSize == nNewSize)return SrcPointer; // do nothing ...
// Wait();
int it;
if(nSize > nNewSize){
for(it = nSize-1; it > nNewSize-1; it--){
StrZruτ(((CLASSITEM*)SrcPointer)[it].strText);
}
SrcPointer = realloc(SrcPointer,sizeof(CLASSITEM)*nNewSize);
}
if(nSize < nNewSize){
if(nSize == 0)SrcPointer=malloc(sizeof(CLASSITEM)*nNewSize);
else SrcPointer = realloc(SrcPointer,sizeof(CLASSITEM)*nNewSize);
if(SrcPointer==0)KERNELSTOP(0);
for(it = nSize; it < nNewSize; it++){
StrVytvo²(((CLASSITEM*)SrcPointer)[it].strText);
((CLASSITEM*)SrcPointer)[it].nType = 0;
}
}
nSize = nNewSize;
return SrcPointer;
}
void* tagClassItemDelete(CLASSITEM * pData,int &nSize,int nID){
if((nID < nSize-1)){
int id=nSize-2;
for(nID++;id >= nID-1;nID++){
pData[nID-1].strText = pData[nID].strText;
pData[nID-1].nType = pData[nID].nType;
}
}
pData = (CLASSITEM*)ClassItemInit(pData,nSize,nSize-1);
if(pData==0 && nSize != 0)KERNELSTOP(0);
return pData;
}
WND* GetWindow(unsigned hWnd);
void ListBox__DeleteItem(unsigned hWnd, int nID){
// destroy memory space for string
// move memory
WND* pWnd=GetWindow(hWnd);
pWnd->pData=(void*)tagClassItemDelete((CLASSITEM*)pWnd->pData,GetWindow(hWnd)->lParam,nID);
pWnd->misc=0;
pWnd->misc2=-1;
SendMessage(0 /* DESKTOP */,9 /*WM_COMMAND*/,200/*LV_SELCHANGE*/,hWnd);
}
void * ArrayInit(void * SrcPointer, int& nSize, int nNewSize, unsigned size_of){
if(nSize == nNewSize)return SrcPointer; // do nothing ...
int it;
if(nSize > nNewSize){
nSize = nNewSize;
SrcPointer = realloc(SrcPointer,sizeof(size_of)*nNewSize);
}
if(nSize < nNewSize){
if(nSize == 0)SrcPointer=malloc(sizeof(size_of)*nNewSize);
else SrcPointer = realloc(SrcPointer,sizeof(size_of)*nNewSize);
if(nNewSize != 0 && SrcPointer==0)KERNELSTOP(0);
nSize = nNewSize;
}
return SrcPointer;
}
WND** AddChildWindow(WND**SrcPointer, int &nSize, int nNewSize){
return ArrayInit(SrcPointer,nSize, nNewSize, sizeof(WND*));
}
int* DependentItemInit(int*SrcPointer, int &nSize, int nNewSize){
return (int*)ArrayInit(SrcPointer, nSize, nNewSize, sizeof(int));
}
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////