home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2002 December
/
PCWorld_2002-12_cd.bin
/
Software
/
Komercni
/
Baltik
/
katB.exe
/
katB
/
DESIGN
/
DESIGN.SGP
< prev
next >
Wrap
Text File
|
2002-09-26
|
122KB
|
2,611 lines
SGPC 5.04 SGP#DEMO99208 16.08.2002 9:46:13 StructNo46 46
#define _XP_THEME // Program will use Windows XP Theme Style
// if is not defined program will use Windows 2000 Theme Style
//#define _DEBUG
//#define _MEMORY_PREVIEW for memory debug
//#define _MOUSE_DEBUG for mouse position debug
long _UNDER_WINDOWS_2k;
char m_LastedMessage = 0;
string m_strExInfo[6];
# include "design_h.blt"
# include "design_h.str"
# include "design_h.api"
long NoXP; // :-))))))
long UnderXP;
# include "design_c.cha"
# include "design_h.dia"
# include "design_c.io"
TypMyτUdálost MouseEvent;
long MouseObject;
int m_keyIDKey;
// pro IDC_MENU
int IDC_MENU_OVER = -1;
static int IDC_MENU_RECT[]={45,91,133,182,244};
//POINT MOUSEOFFSET;
WND * m_ControlArray=0;
MENU * m_MenuArray=0;
char * m_ControlzOrderArray=0;
int m_ZOrderControlSize=0;
int m_MOUSESHOW= 1;
RECT MEMRECT;
static char* IDC_MENU_HORITEM[]={"Soubor","┌pravy","Objekt","Zobrazit","Nßpov∞da"};
#define Diagram__GetCell(x) (&m_DiagramCells[x])
string AddDialog__CreateString();
DIAGRAMCELL* Diagram__GetFocusCell( void );
//DIAGRAMCELL* Diagram__GetCell(unsigned nId);
void Diagram__DestroyCell( unsigned nID);
int Diagram__AddOperation(unsigned nID, string str, unsigned nState );
void Diagram__RecalculateCellRect( unsigned nID, char bRedraw);
int Diagram__AddVariable( unsigned nID, string str, unsigned nState );
void NormalizeRect(RECT* dest);
void Diagram__OnDrawClipRect( int x,int y, int x2, int y2 );
void SgpAsciiToWinChar(char& Char);
void SendMessage(unsigned dest, unsigned nMessage,long lParam, long wParam);
void TextOut(int x, int y, string szText,char color,char bg, char FontType);
int ListBox__AddItem(unsigned hWnd, int nID, string strText);
void DrawFrameControl2(int x, int y, int x2, int y2,unsigned nType, long nState,char* szText,unsigned hBitmap);
void ListBox__DeleteAll(unsigned hWnd );
int m_nm_ControlArraySize = 0;
#define ListBox__GetSize(x) GetWindow(x)->lParam
# include "design_h.res"
# include "design.rc"
# include "design_c.mem"
# include "design_c.ui"
# include "design_c.men"
# include "design_c.gdi"
# include "design_c.car"
# include "design_c.dia"
// Globální prom╪nné
// Globální makra
-o1-Globals
-c1-Globals
===Globals
/*-hf(*/
/*-hf-*/
void ApplyLayout( void )
/*-hf-*/;
void CommandProc( long lParam, long wParam )
/*-hf-*/;
void MyWndProc(unsigned hWnd,unsigned nMessage, long lParam, long wParam)
/*-hf-*/;
void Diagram__DependentDelPointer(int nDep,int nIDCellFrom )
/*-hf-*/;
void Diagram__InvalidateMemRect(void)
/*-hf-*/;
void Diagram__SetMemRect( int nID )
/*-hf-*/;
void Diagram__DestroyCell( unsigned nID) // ONLY FOR DESTRUCT ELEMENT(not for FREE MEMORY)
/*-hf-*/;
void Diagram__RecalculateCellRect( unsigned nID,char bRedraw)
/*-hf-*/;
int Diagram__CreateImageCell(int x, int y, string path )
/*-hf-*/;
unsigned Diagram__CreateCell(int x, int y, unsigned nType )
/*-hf-*/;
void Diagram__AddSomething()
/*-hf-*/;
int Diagram__AddOperation(unsigned nID, string str, unsigned nState )
/*-hf-*/;
int Diagram__AddVariable( unsigned nID, string str, unsigned nState )
/*-hf-*/;
DIAGRAMCELL* Diagram__GetFocusCell( void )
/*-hf-*/;
void Diagram__OnEditMember( void )
/*-hf-*/;
void Diagram__OnDrawClipRect( int x,int y, int x2, int y2 )
/*-hf-*/;
char Diagram__OverIDObject(int nID, int x, int y )
/*-hf-*/;
int Diagram__OverObject( int x, int y )
/*-hf-*/;
int Diagram__SelectNewObject( int x, int y)
/*-hf-*/;
void Diagram__RecalculateDepRect(int nID,char bRedraw )
/*-hf-*/;
void Diagram__MoveCellTo(int nID ,int x, int y )
/*-hf-*/;
void Diagram__CutLineOnBorderOfCell( int nCell, POINT* dest, LINE* ln )
/*-hf-*/;
void Diagram__ConnectDependent(unsigned nDependent, unsigned nCell )
/*-hf-*/;
int Diagram__CreateDependent(long nType)
/*-hf-*/;
void Diagram__WndProc( unsigned nMessage, long lParam, long wParam )
/*-hf-*/;
int Edit__SearchForNearestChar( int nIDEdit, POINT &pt )
/*-hf-*/;
string Edit__GetVisibleText(unsigned nID )
/*-hf-*/;
int Edit__GetMaxVisibleTextWidth( unsigned hWnd )
/*-hf-*/;
void Edit__DrawText( unsigned hWnd )
/*-hf-*/;
void Edit__WndProc( unsigned hWnd,unsigned nMessage, long lParam, long wParam )
/*-hf-*/;
void Edit__MoveCaretToPos(unsigned nID, int nPos )
/*-hf-*/;
int ListBox__GetCurSel( unsigned hWnd )
/*-hf-*/;
void ListBox__DeleteAll(unsigned hWnd )
/*-hf-*/;
void ListBox__DrawItems( unsigned hWnd, int nToDraw )
/*-hf-*/;
string ListBox__GetItemText( unsigned hWnd, nID )
/*-hf-*/;
void ListBox__SetItemText(unsigned hWnd, int nID, string str )
/*-hf-*/;
int ListBox__AddItem(unsigned hWnd, int nID, string strText)
/*-hf-*/;
string AddDialog__CreateString()
/*-hf-*/;
string AddDialog__MakeParameterString( void )
/*-hf-*/;
void Dialog__WndProc(unsigned hWnd, unsigned nMessage, long lParam, long wParam )
/*-hf-*/;
void Button__SetCheckRange(int nPosStart,int nPosEnd,long dwFlags)
/*-hf-*/;
void Button__GetCheckRange(int nPosStart,int nPosEnd,long& dwFlags)
/*-hf-*/;
void Button__GetCheckEx( unsigned hWnd, long& dwState, long nType )
/*-hf-*/;
int Button__GetCheck( unsigned hWnd )
/*-hf-*/;
void Button__SetCheck(unsigned hWnd, long bCheck )
/*-hf-*/;
void WndProc(unsigned hWnd,unsigned nMessage, long lParam, long wParam)
/*-hf-*/;
void main( void )
/*-hf)*/;
;-h---------------------------------------------------------------------------
void ApplyLayout( void )
-s--ApplyLayout ■ 4 -2 -25 3
ApplyLayout
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
HideMouse();
GrNaƒtiPaletu("*\\design.pal");
MyτNastavRozsah(-10,-10,GrMaxX(),GrMaxY());
#ifdef _XP_THEME
FillSolidRect2(0,0,GrMaxX(),32,1);
#else
FillSolidRect2(0,0,GrMaxX(),32,0);
#endif
SetWindowRect2(2 /* IDC_DIAGRAM */,-2,30,GrMaxX()+2,GrMaxY()+2);
#ifdef _XP_THEME
GrNastavLinku(8|2,0xAAAA);
LineFromTo2(5,4,5,19,3);
GrNastavLinku(1|4);
LineFromTo2(0,30,GrMaxX(),30,0);
LineFromTo2(0,31,GrMaxX(),31,3);
#else
DrawEdge(GetWindowRect(2 /* IDC_DIAGRAM */),0x0001/*DES_CLIENT*/);
Draw3dRect2(4,4,6,21,5,3);
#endif
SetWindowRect2(7/*IDC_COMBOBOX1*/,GrMaxX()-240,3,GrMaxX()-4,24);
SetWindowRect2(8/*IDC_LISTBOX1*/,GrMaxX()-240,25,GrMaxX()-4,193);
// SetWindowRect2(1 /* IDC_MENU */,9,3,239,22);
SendMessage(1 /* IDC_MENU */,8/*WM_PAINT*/ ,-2,-1);
Invalidate(2 /* IDC_DIAGRAM */);
Invalidate(7/*IDC_COMBOBOX1*/);
ShowMouse();
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void CommandProc( long lParam, long wParam )
-s--CommandProc ■ 4 -2 -25 3
CommandProc
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
DIAGRAMCELL * pCell =Diagram__GetFocusCell();
long dwFlags=pCell->dwFlags;
int nBreakA = pCell->nBreakA;
int nBreakB = pCell->nBreakB;
long dw400 = dwFlags & 0x00000400L;
long dw800 = dwFlags & 0x00000800L;
long dw1000 = dwFlags & 0x00001000L;
string str;
if(lParam == 200/*ED_ENTER*/ && wParam == 6/*IDC_EDITPOPUP*/)SetFocus(2 /* IDC_DIAGRAM */);
else if(lParam == 201/*LV_ITEMCLICK*/){
switch(wParam){
case 8/*IDC_LISTBOX1*/ :
SetFocus(2 /* IDC_DIAGRAM */);
long n=ListBox__GetCurSel(wParam);
Diagram__SetInterFocus(n);
Diagram__SetInterZOrder(n);
break;
case 21/*IDC_PARA_LIST*/:
SendMessage(DESKTOP,9,200/*LV_SELCHANGE*/,wParam);
string str = ListBox__GetItemText(21/*IDC_PARA_LIST*/,ListBox__GetCurSel(21/*IDC_PARA_LIST*/));
AddDialog__AddParaByString(str);
break;
}
}
else if(lParam == 200/*LV_SELCHANGE*/){
switch(wParam){
case 21/*IDC_PARA_LIST*/:
if(ListBox__GetCurSel(21/*IDC_PARA_LIST*/) != -1 && ListBox__GetSize(21) > 0){
EnableWindow(23/*IDC_PARA_DELETE*/,1);
EnableWindow(28/*IDC_PARA_UPDATE*/,1);
}else{
EnableWindow(23/*IDC_PARA_DELETE*/,0);
EnableWindow(28/*IDC_PARA_UPDATE*/,0);
};
break;
}
}
else
if(lParam == 1 /*BN_CLICK*/){
if(wParam > 700 && wParam < 900){
if(wParam >= 800){
int nID = Diagram__CreateDependent(wParam-800);
if(wParam == 816)// MESSAGE
{
Diagram__GetCell(nID)->dwFlags|= 0x00000400L;
Diagram__SetInterFocus(nID);
SendMessage(0,9,1,303);
}
}
else{
int idx;
if(wParam != 705)
idx=Diagram__CreateCell(0,0,wParam - 700);
else idx=Diagram__CreateImageCell(0,0,"");
Diagram__SetInterFocus(idx);
}
}
else
switch(wParam){
case 128:
DestroyDialog();
int i = 112;
for(;i< 118;i++)
m_strExInfo[i-112] = GetWindowText(i);
break;
case 207:
case 205:
HideMouse();
int nMode = GrMód();
MyτKonecObsluhy();
P²epniNaText();
DOSProve╘(ProgramCesta()+"\\designie.exe "+StrD¼íslo(wParam,-1,0));
GrNastavMód(nMode);
MyτZaƒátekObsluhy();
ApplyLayout();
break;
case 206:
ShowDialog(120);
GrKresliP²edm╪ty(21001,1,GetWindowRect(120)->left+3,GetWindowRect(120)->top+24,11,9);
break;
case 40/*IDC_MSG_OK*/:
DestroyDialog();
pCell->ClassName = GetWindowText(42);
if(Button__GetCheck(48) ){pCell->strExProperties = GetWindowText(45);}else {pCell->strExProperties="";}
if(Button__GetCheck(43) &&Button__GetCheck(46)){pCell->strExStereotypes = GetWindowText(47);
}
else {pCell->strExStereotypes="";}
Button__GetCheckRange(44,44,dwFlags);
Button__GetCheckRange(48,49,dwFlags);
pCell->dwFlags = dwFlags;
RECT rx;
CopyRect(&rx,&Diagram__GetFocusCell()->Rect);
MakeMaximalRect(&rx,&Diagram__GetCell(nBreakA)->Rect);
MakeMaximalRect(&rx,&Diagram__GetCell(nBreakB)->Rect);
Diagram__RecalculateCellRect(nBreakA,0);
Diagram__RecalculateCellRect(nBreakB,0);
Diagram__RecalculateDepRect(m_nInterCellFocus,0);
CopyRect(&MEMRECT,&rx);
// MakeMaximalRect(&MEMRECT,&Diagram__GetCell(nBreakA)->Rect);
// MakeMaximalRect(&MEMRECT,&Diagram__GetCell(nBreakB)->Rect);
Diagram__InvalidateMemRect();
break;
case 303/*IDC_DEPENDENTSETTING*/:
if(dwFlags & 16 /*MESSAGES*/){
ResetControl(70);
if(dw400)
Button__SetCheck(44/*SYNCHRONMSG*/,1);
else {Button__SetCheck(43/*ASCH*/,1);
if(pCell->strExStereotypes != ""){
Button__SetCheck(46/*PRIOBUTTON*/,1);SetWindowText(47/*MSGPRIO*/,pCell->strExStereotypes);}
}
Button__SetCheckRange(48,49,dwFlags);
if(dw1000){SetWindowText(45,pCell->strExProperties);}
SetWindowText(42/*IDC_MSG_TEXT*/,pCell->ClassName);
ShowDialog(70/*IDC_DEPENDENTSETTING*/);
}
else if(dwFlags & 1){
ResetControl(99);
Button__SetCheckRange(86,89,dwFlags);
Button__SetCheckRange(91,92,dwFlags);
SetWindowText(118,pCell->ClassName);
ShowDialog(99);
}
else {
ResetControl(90);
str="???";
if(nBreakA > -1)str=Diagram__GetCell(nBreakA)->ClassName;
SetWindowText(69,"Prvek "+str);
str="???";
if(nBreakB > -1)str=Diagram__GetCell(nBreakB)->ClassName;
SetWindowText(77,"Prvek "+str);
SetWindowText(65,pCell->ClassName);
Button__SetCheckRange(79,83,dwFlags);
int nPos=0;
for(;nPos < 4;nPos++)
SetWindowText(71+nPos,((CLASSITEM*)pCell->pVariable)[nPos+1].strText);
ShowDialog(90);
}
break;
case 63:
DestroyDialog();
Button__GetCheckRange(79,83,pCell->dwFlags);
pCell->ClassName = GetWindowText(65);
int nPos=0;
for(;nPos < 4;nPos++)
((CLASSITEM*)pCell->pVariable)[nPos+1].strText = GetWindowText(71+nPos);
Diagram__RecalculateDepRect(m_nInterCellFocus,1);
break;
case 84:
DestroyDialog();
Button__GetCheckRange(86,89,dwFlags);
Button__GetCheckRange(91,92,dwFlags);
pCell->ClassName=GetWindowText(118);
pCell->dwFlags = dwFlags;
Diagram__RecalculateDepRect(m_nInterCellFocus,1);
break;
case 601/*IDC_EDIT_ITEM*/:
Diagram__OnEditMember();
break;
case 604/*IDC_DELETE_ITEM*/:
if(m_MOUSEOVER_PTY < 0){
pCell->pVariable=tagClassItemDelete((CLASSITEM*)pCell->pVariable,pCell->nSizeVariable,-m_MOUSEOVER_PTY-1);
}
else {
pCell->pOperation=tagClassItemDelete((CLASSITEM*)pCell->pOperation,pCell->nSizeOperation,m_MOUSEOVER_PTY-1);
}
Diagram__RecalculateCellRect(m_nInterCellFocus,1);
break;
case 600/*IDC_SETTING_CLASS*/:
ResetControl(50);
DIAGRAMCELL * xpCell = Diagram__GetFocusCell();
SetWindowText(30/*IDC_SC_CLASSNAME*/,xpCell->ClassName);
Button__SetCheckRange(35,39,xpCell->dwFlags);
SetWindowText(33/*IDC_SC_ELSEPR*/,xpCell->strExProperties);
SetWindowText(34/*IDC_SC_ELSEST*/,xpCell->strExStereotypes);
ShowDialog(50/*IDC_CLASSSETTING */);
break;
case 22/*IDC_PARA_INSERT*/:
ListBox__AddItem(21/*IDC_PARA_LIST*/,ListBox__GetSize(21/*IDC_PARA_LIST*/),AddDialog__MakeParameterString());
Invalidate(21/*IDC_PARA_LIST*/);
break;
case 23/*IDC_PARA_DELETE*/:
ListBox__DeleteItem(21/*IDC_PARA_LIST*/,ListBox__GetCurSel(21/*IDC_PARA_LIST*/));
Invalidate(21/*IDC_PARA_LIST*/);
break;
case 28/*IDC_PARA_UPDATE*/:
ListBox__SetItemText(21/*IDC_PARA_LIST*/,ListBox__GetCurSel(21/*IDC_PARA_LIST*/),AddDialog__MakeParameterString());
Invalidate(21/*IDC_PARA_LIST*/);
break;
case 500/*IDC_VIEW_VESA1*/:
case 501/*IDC_VIEW_VESA2*/ :
case 502/*IDC_VIEW_VESA3*/ :
HideMouse();
GrNastavMód(wParam-497);
ApplyLayout();
ShowMouse();
break;
case 9/*IDC_INSERT*/:
Diagram__OnInsert();
break;
case 31/*IDC_SC_OK*/:
pCell->ClassName = GetWindowText(30/*IDC_SC_CLASSNAME*/);
Button__GetCheckRange(35,39,dwFlags);
pCell->strExProperties=GetWindowText(33/*IDC_SC_ELSEPR*/);
pCell->strExStereotypes=GetWindowText(34/*IDC_SC_ELSEST*/);
pCell->dwFlags = dwFlags;
DestroyDialog();
Diagram__RecalculateCellRect(m_nInterCellFocus,1);
break;
case 32/*IDC_SC_CANCEL*/:
DestroyDialog();
break;
case 402/*IDC_INSERT_NEWOPERATION*/:
ResetControl(10);
SetWindowText(10 /*IDC_ADDINGDIALOG*/,"Vlo₧it operaci objektu");
GetWindow(10 /*IDC_ADDINGDIALOG*/)->lParam = 1;
case 403/*IDC_INSERT_NEWVARIABLE*/:
if(wParam==403){
ResetControl(10);
SetWindowText(10 /*IDC_ADDINGDIALOG*/,"Vlo₧it atribut objektu");
GetWindow(10 /*IDC_ADDINGDIALOG*/)->lParam = 2;
}
Diagram__AddSomething();
break;
case 301/*IDC_CELL_CLASSONLY*/:
case 302/*IDC_CELL_CLASSFULL*/:
if(wParam == 301/*IDC_CELL_CLASSONLY*/){pCell->nType = 1/*TYPE_CLASS_ONLY*/;}
else {pCell->nType = 2/*TYPE_CLASS_FULL*/;}
Diagram__RecalculateCellRect(m_nInterCellFocus,1);
break;
case 215/*IDC_EDIT_DOCKING_DEPENDENT*/:
ResetControl(129);
int ixx = 112;
for(;ixx< 118;ixx++)
SetWindowText(ixx,m_strExInfo[ixx-112]);
ShowDialog(129);
break;
case 401/*IDC_INSERT_DEPENDENT*/:
SetCapture(2 /* IDC_DIAGRAM */);
m_DIAGRAM_ADDINGDEPENDENT = 1;
m_DIAGRAM_ADDINGDEPENDENT_USEMOVING =(m_DIAGRAM_DOCKING_DEPENDENT)?0:1;
SetCursor((m_DIAGRAM_DOCKING_DEPENDENT)?115:116);
m_LAST_POINTS.left=-1;
m_DEPENDENT_FROM=m_nInterCellFocus;
SetPoint(&m_DIAGRAM_DEPENDENT_FROM,m_DiagramCells[m_nInterCellFocus].Rect.left + (Diagram__MakeCellWidth(m_nInterCellFocus)/2),m_DiagramCells[m_nInterCellFocus].Rect.top + (Diagram__MakeCellHeight(m_nInterCellFocus)/2));
Diagram__ClientToScreen(m_DIAGRAM_DEPENDENT_FROM.top);
break;
case 400/*IDC_INSERT_NEWOBJECT*/:
LoadMenu(26,3);
TrackPopUpMenu(MouseEvent.X,MouseEvent.Y);
break;
case 214/*IDC_EDIT_DELETEALL*/:
if(m_nm_DiagramCellsSize <= 0)break;
int ic;
for(ic=0; ic < m_nm_DiagramCellsSize;ic++){
Diagram__DestroyCell(ic);
}
m_nm_DiagramCellsSize=0;
free(m_DiagramCells);
free(m_DiagramZOrder);
m_nInterCellFocus = -1;
Invalidate(2 /* IDC_DIAGRAM */);
break;
case 212/*IDC_EDIT_PASTE*/: // insert cell from memory to diagram
Diagram__WCPaste();
break;
case 210/*IDC_EDIT_CUT*/: // copy to memory and delete cell
Diagram__WCCopy();
Diagram__WCDelete();
break;
case 213/*IDC_EDIT_DELETE*/: // delete actually cell
Diagram__WCDelete();
break;
case 211/*IDC_EDIT_COPY*/: // copy actually cell to memory
Diagram__WCCopy();
break;
case 300/*IDC_CELL_RENAME*/:
int id = m_nInterCellFocus;
RECT rc;
CopyRect(&rc,&pCell->Rect);
InflateRect(&rc,-4,-4,-4,0);
rc.bottom=rc.top+26;
Diagram__ClientToScreen2(rc);
SetWindowRect2(6,rc.left,rc.top,rc.right,rc.bottom);
SetWindowText(6,pCell->ClassName);
GetWindow(6)->hFont = FONT_ARIAL_BOLD_10;
ShowWindow(6,1);
Invalidate(6);
Edit__DrawText(6);
SetFocus(6);
break;
case 200: // new !
strOpenFile="";
int h=0;
for(;h < 6;h++)m_strExInfo[h]="";
SendMessage(0,9/*9*/,1,214);
break;
case 201/*IDC_FILE_EXIT*/:
SendMessage(0,10/*WM_CLOSE*/,-1,-1);
break;
case 202/*IDC_FILE_OPEN*/:
//strOpenFile="*\\test.umd";
ResetControl(105);
SetWindowText(103,ProgramCesta());
ShowDialog(105);
//
break;
case 101:
DestroyDialog();
strOpenFile = GetWindowText(103);
case 208/*IDC_FILE_OPENING*/:
if(m_nm_DiagramCellsSize > 0)SendMessage(0,9,1/*BN_CLICK*/,214/*IDC_EDIT_DELETEALL*/);
long file = SouborOtev²i(strOpenFile,0x200|0x01);
if(DOSChyba())break;
m_DiagramCells=IO_READ(file,m_DiagramCells,&m_DiagramZOrder,m_nm_DiagramCellsSize);
SouborZav²i(file);
Invalidate(2 /* IDC_DIAGRAM */);
break;
case 106:
DestroyDialog();
strOpenFile = GetWindowText(109);
case 204/*IDC_FILE_SAVE*/:
case 203:
if(( wParam != 106 && strOpenFile == "") || wParam == 203){
ResetControl(110);
SetWindowText(109,ProgramCesta());
ShowDialog(110);
break;
}
long fxile = SouborOtev²i(strOpenFile,0x200|0x02);
IO_WRITE(fxile,m_DiagramCells,m_DiagramZOrder,m_nm_DiagramCellsSize);
SouborZav²i(fxile);
break;
default:
WndProc(0,9 /*9*/,lParam,wParam); // standartni odpoved pro nezpracovane zpravy
break;
}
}
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void MyWndProc(unsigned hWnd,unsigned nMessage, long lParam, long wParam)
-s--MyWndProc ■ 4 -1 -27 3
MyWndProc
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
switch(hWnd){
case 6/*IDC_EDITPOPUP*/:
if(nMessage == 12 /*WM_KILLFOCUS*/){
WndProc(hWnd,nMessage,lParam,wParam); // use default response and after them do some code ...
DIAGRAMCELL *pcell = Diagram__GetFocusCell();
pcell->ClassName=GetWindow(6/*IDC_EDITPOPUP*/)->szText;
Diagram__SetMemRect(m_nInterCellFocus);
if(pcell->nType == 5/*TYPE_CLASS_IMG*/){
if(!SouborExistuje(pcell->ClassName))pcell->ClassName="*\\"+pcell->ClassName;
}
ShowWindow(6/*IDC_EDITPOPUP*/,0);
Diagram__RecalculateCellRect(m_nInterCellFocus,1);
Diagram__InvalidateMemRect();
return;
}
break;
case 2 /* IDC_DIAGRAM */:
Diagram__WndProc(nMessage,lParam,wParam);
return;
case 0:
if(nMessage == 9 /*WM_COMMAND*/){
CommandProc(lParam,wParam);
return;
}
}
WndProc(hWnd,nMessage,lParam,wParam); // standartni odpoved pro nezpracovane zpravy
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__DependentDelPointer(int nDep,int nIDCellFrom )
-s--Diagram__DependentDelPointer ■ 4 -2 -18 3
Diagram__DependentDelPointer
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
//
// step 1. : search pointer array (pDependent) in GetCell(nIDCellFrom)
// step 2. : delete item in array and realloc memory
// step 3. : finish this function
//
if (nIDCellFrom < 0)return; // error
if (nIDCellFrom >= m_nm_DiagramCellsSize)return; // error
DIAGRAMCELL * pCell = Diagram__GetCell(nIDCellFrom);
int nPos;
for(nPos = 0; nPos < pCell->nSizeDependents; nPos++){
if(pCell->pDependents[nPos] == nDep){
// here is it :-)
pCell->pDependents=DependentItemDelete(pCell->pDependents,pCell->nSizeDependents,nPos);
}
}
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__InvalidateMemRect(void)
-s--Diagram__InvalidateMemRect ■ 4 -2 -18 3
Diagram__InvalidateMemRect
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
Diagram__OnDrawClipRect(MEMRECT.left,MEMRECT.top,MEMRECT.right,MEMRECT.bottom);
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__SetMemRect( int nID )
-s--Diagram__SetMemRect ■ 4 -2 -22 3
Diagram__SetMemRect
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
CopyRect(&MEMRECT,&Diagram__GetCell(nID)->Rect);
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__DestroyCell( unsigned nID) // ONLY FOR DESTRUCT ELEMENT(not for FREE MEMORY)
-s--Diagram__DestroyCell ■ 4 -2 -21 3
Diagram__DestroyCell
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
// delete cell
DIAGRAMCELL * pCell=Diagram__GetCell(nID);
// destructor for cells (all)
StrZruτ(pCell->ClassName);
StrZruτ(pCell->strExStereotypes);
StrZruτ(pCell->strExProperties);
if(pCell->nSizeVariable != 0){
ClassItemInit(pCell->pVariable,pCell->nSizeVariable,0);
}
if(pCell->nSizeOperation != 0){
ClassItemInit(pCell->pOperation,pCell->nSizeOperation,0);
}
if(pCell->nType == 4/*TYPE_CLASS_DEPENDENT*/){
// note:
// when aplication is calling this function for destruct dependents, its necessary
// to delete pointer to this dependents from all cells ... -> if we dont do this == BUG
//
Diagram__DependentDelPointer(nID,pCell->nBreakA); // delete connection ID_1
Diagram__DependentDelPointer(nID,pCell->nBreakB); // delete connection ID_2
}
pCell->nSizeDependents = 0; // !!!
free(pCell->pDependents); // free memory space for dependents array.
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__RecalculateCellRect( unsigned nID,char bRedraw)
-s--Diagram__RecalculateCellRect ■ 4 -2 -17 3
Diagram__RecalculateCellRect
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
// class size ...
RECT rx;
int nNewX=0,nNewY=0;
DIAGRAMCELL *pCell = Diagram__GetCell(nID);
if(bRedraw)CopyRect(&rx,&pCell->Rect);
if(pCell->nType != 5/*TYPE_CLASS_IMG*/){
Diagram__DrawCell(nID,0,nNewX,nNewY);
}
else {
TypBMPInfo typinfo;
if(GrNaƒtiBMPInfo(pCell->ClassName,typinfo)==0){
nNewX = typinfo.µí²ka+2;
nNewY = typinfo.V∞τka+2;
if(nNewX < 100)nNewX=100;
if(nNewY < 30)nNewY = 30;
}
else {
pCell->ClassName = "*\\designer.dir\\common\\bitmap\\error.bmp";
nNewX =155;
nNewY = 45;
}
}
pCell->Rect.right = pCell->Rect.left + nNewX;
pCell->Rect.bottom = pCell->Rect.top + nNewY;
if(bRedraw){
Diagram__MoveCellTo(nID,pCell->Rect.left,pCell->Rect.top);
CopyRect(&MEMRECT,&rx);
Diagram__InvalidateMemRect();
}
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
int Diagram__CreateImageCell(int x, int y, string path )
-s--Diagram__CreateImageCell ■ 4 -2 -19 3
Diagram__CreateImageCell
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
TypBMPInfo typinfo;
int nID = Diagram__CreateCell(x,y,5/*TYPE_CLASS_IMG*/);
DIAGRAMCELL * pCell= Diagram__GetCell(nID);
if(path != "" && GrNaƒtiBMPInfo(path,typinfo)==0){
pCell->ClassName = path;
}
else {
pCell->ClassName = "*\\designer.dir\\common\\bitmap\\error.bmp";
typinfo.µí²ka =153;
typinfo.V∞τka = 43;
}
pCell->Rect.right = pCell->Rect.left+typinfo.µí²ka+2;
pCell->Rect.bottom = pCell->Rect.top+typinfo.V∞τka+2;
Diagram__SetInterZOrder(nID);
return nID;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
unsigned Diagram__CreateCell(int x, int y, unsigned nType )
-s--Diagram__CreateCell ■ 4 -2 -22 3
Diagram__CreateCell
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 ; create new cell
if(m_nm_DiagramCellsSize ==0){
m_DiagramCells = (DIAGRAMCELL*)malloc(sizeof(DIAGRAMCELL));
m_DiagramZOrder = (int*)malloc(sizeof(int));
}
m_DiagramCells = (DIAGRAMCELL*)realloc(m_DiagramCells,sizeof(DIAGRAMCELL)*(m_nm_DiagramCellsSize+1));
m_DiagramZOrder = (int*)realloc(m_DiagramZOrder,sizeof(int)*(m_nm_DiagramCellsSize+1));
InitCell(&m_DiagramCells[m_nm_DiagramCellsSize]);
m_nm_DiagramCellsSize++;
DIAGRAMCELL* pCell = &m_DiagramCells[m_nm_DiagramCellsSize-1];
pCell->nType = nType;
SetRect(&pCell->Rect,x,y,x+120,y+38);
pCell->ClassName = StrD¼íslo(m_nm_DiagramCellsSize,-1,0);
switch(nType){
case 3/*TYPE_CLASS_OBJECT*/:
pCell->ClassName = "Objekt_"+pCell->ClassName;
break;
case 4/*TYPE_CLASS_DEPENDENT*/ :
pCell->ClassName = "Zßvislost_"+pCell->ClassName;
break;
default:
pCell->ClassName = "Class_"+pCell->ClassName;
break;
}
int retvalue = m_nm_DiagramCellsSize-1;
Diagram__SetInterZOrder(retvalue);
return retvalue;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__AddSomething()
-s--Diagram__AddSomething ■ 4 -2 -21 3
Diagram__AddSomething
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
int i;
i =GetWindow(10 /* IDC_ADDINGDIALOG */)->lParam;
if(abs(i)==2){
int x;
for(x=19;x < 62;x++){if(x==26)x++;if(x==29)x=60;
EnableWindow(x,0);
}
}
EnableWindow(23 /* IDC_PARA_DELETE*/,0);
EnableWindow(28 /* IDC_PARA_UPDATE */,0);
string strText;
if(i < 0)
strText = "Upravit ";
else
strText = "Vlo₧it ";
if(abs(i) == 1){
strText+= "operaci objektu";
EnableWindow(18/*IDC_TYPE_CONSTANT*/,0);
EnableWindow(17/*IDC_TYPE_DELIVER*/,0);
}
else{
strText += "atribut objektu";
EnableWindow(16/*IDC_TYPE_ABSTRACT*/,0);
}
SetWindowText(10 /* IDC_ADDINGDIALOG */,strText);
if(i > 0)ListBox__DeleteAll(21/*IDC_PARA_LIST*/);
ShowDialog(10 /*IDC_ADDINGDIALOG*/);
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
int Diagram__AddOperation(unsigned nID, string str, unsigned nState )
-s--Diagram__AddOperation ■ 4 -2 -21 3
Diagram__AddOperation
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
DIAGRAMCELL * pCell=Diagram__GetCell(nID);
pCell->pOperation=ClassItemInit(pCell->pOperation,pCell->nSizeOperation,pCell->nSizeOperation+1);
CLASSITEM* pItem = &(((CLASSITEM*)(pCell->pOperation))[pCell->nSizeOperation-1]);
pItem->strText =str;
pItem->nType =nState;
return Diagram__GetCell(nID)->nSizeOperation;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
int Diagram__AddVariable( unsigned nID, string str, unsigned nState )
-s--Diagram__AddVariable ■ 4 -2 -21 3
Diagram__AddVariable
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
DIAGRAMCELL * pCell=Diagram__GetCell(nID);
pCell->pVariable=ClassItemInit(pCell->pVariable,pCell->nSizeVariable,pCell->nSizeVariable+1);
CLASSITEM* pItem = &(((CLASSITEM*)(pCell->pVariable))[pCell->nSizeVariable-1]);
pItem->strText =str;
pItem->nType =nState;
return Diagram__GetCell(nID)->nSizeVariable ;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
DIAGRAMCELL* Diagram__GetFocusCell( void )
-s--Diagram__GetFocusCell ■ 4 -2 -21 3
Diagram__GetFocusCell
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 return Diagram__GetCell(m_nInterCellFocus);
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__OnEditMember( void )
-s--Diagram__OnEditMember ■ 4 -2 -21 3
Diagram__OnEditMember
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
DIAGRAMCELL *pCell=Diagram__GetFocusCell();
ResetControl(10);
if(m_MOUSEOVER_PTY > 0){
GetWindow(10 /*IDC_ADDINGDIALOG*/)->lParam = -1;
AddDialog__ParserString(((CLASSITEM*)pCell->pOperation)[m_MOUSEOVER_PTY-1].strText);
Button__SetCheckRange(13,18,((CLASSITEM*)pCell->pOperation)[m_MOUSEOVER_PTY-1].nType);
}
else {
GetWindow(10 /*IDC_ADDINGDIALOG*/)->lParam = -2;
AddDialog__ParserString(((CLASSITEM*)pCell->pVariable)[-m_MOUSEOVER_PTY-1].strText);
Button__SetCheckRange(13,18,((CLASSITEM*)pCell->pVariable)[-m_MOUSEOVER_PTY-1].nType);
}
Diagram__AddSomething();
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__OnDrawClipRect( int x,int y, int x2, int y2 )
-s--Diagram__OnDrawClipRect ■ 10 -2 -14 3
__________Diagram__OnDrawClipRect__________
Draw~background~and~client Draw~cells,idicators ShowCursor
edge cells :ShowMouse();
1! 2!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 ; draw background and client edge !
HideMouse();
if(y < 0)y=0;
FillSolidRect2(x,32+y,x2,32+y2,5);
2 ; draw cell
int i;
RECT intersect;
SetRect(&intersect,x,y,x2,y2);
// optimaliz
/*
int* pPos=m_DiagramZOrder; // faster
for(i =m_nm_DiagramCellsSize-1;i >= 0 ;i--,pPos++){
// drawing speed is optimized ... (program will draw only object which actually need redrawing !)
if(IntersectRect(&intersect,&m_DiagramCells[*pPos].Rect)){
Diagram__DrawCellEx(*pPos);
}
}
*/
for(i =m_nm_DiagramCellsSize-1;i >= 0 ;i--){
// drawing speed is optimized ... (program will draw only object which actually need redrawing !)
if(IntersectRect(&intersect,&m_DiagramCells[m_DiagramZOrder[i]].Rect)){
// GrNastavPozici(0,0);
// GrNastavBarvuPop²edí(2);
// GrPiτD¼íslo(m_DiagramZOrder[i],-1,2);
// VyprázdniFrontuKláves();
// ¼ekej(0x8001);
Diagram__DrawCellEx(m_DiagramZOrder[i]);
}
}
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
char Diagram__OverIDObject(int nID, int x, int y )
-s--Diagram__OverIDObject ■ 4 -2 -21 3
Diagram__OverIDObject
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
RECT rc;
DIAGRAMCELL * pCell = Diagram__GetCell(nID);
CopyRect(&rc,&pCell->Rect);
Diagram__ScreenToClient(y);
if(PtInRect(x,y,&rc)){
switch(pCell->nType){
case 1/*TYPE_CLASS_ONLY*/:
case 2/*TYPE_CLASS_FULL*/:
case 3/*TYPE_CLASS_OBJECT*/:
case 5/*TYPE_CLASS_IMG*/:
return 1;
case 4/*TYPE_CLASS_DEPENDENT*/:
// now, we must check if is really user clicked on this cell,
// because this type is nonrectangle object !
// step 1. : cover line by 5px
// step 2. : test if point[x,y] is inside line(covered by 5px);
// more in CoverLine documents.
int n;
RECT mem;
for(n=0;n < pCell->nSizeVariable; n++){
CopyRect(&mem,&((CLASSITEM*)(pCell->pVariable))[n].nRectType);
NormalizeRect(&mem);
Diagram__ScreenToClient2(mem);
if(PtInRect(x,y,&mem)){
return 1;}
}
POINT pt[6];
CoverLine(&pCell->PT,pt,8);
if(PtInRGN(x,y,pt,6))
return 1;
}
}
return 0;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
int Diagram__OverObject( int x, int y )
-s--Diagram__OverObject ■ 4 -2 -22 3
Diagram__OverObject
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
int i;
for(i = 0; i < m_nm_DiagramCellsSize; i++){
if(Diagram__OverIDObject(m_DiagramZOrder[i],x,y)==1)return m_DiagramZOrder[i];
}
return -1;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
int Diagram__SelectNewObject( int x, int y)
-s--Diagram__SelectNewObject ■ 4 -2 -19 3
Diagram__SelectNewObject
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 ; search array with cells. If some cell will be in area of POINT[x,y], check zOrder and select it...
int i=Diagram__OverObject(x,y);
if(i != -1){
Diagram__SetInterFocus(i);
Diagram__SetInterZOrder(i);
return m_DiagramZOrder[0];
}
Diagram__SetInterFocus(-1);
return -1;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__RecalculateDepRect(int nID,char bRedraw )
-s--Diagram__RecalculateDepRect ■ 2 -2 -18 3
Diagram__RecalculateDepRect
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
Diagram__SetMemRect(nID);
DIAGRAMCELL * pDep = Diagram__GetCell(nID);
RECT* Rect =&pDep->Rect;
CopyRect(Rect,&pDep->PT);
if(bRedraw)
NormalizeRect(Rect);
POINT pt[6];
CoverLine(&pDep->PT,pt,16);
int n;
for(n=1;n < 6; n++){if(n==3)n++;
MakeMaximalRect2(Rect,pt[n].left,pt[n].top);
}
// calculate rect ...
RECT PT; CopyRect(&PT,&pDep->PT);Diagram__ClientToScreen2(PT);
for(n=0;n < pDep->nSizeVariable; n++){SetRect(&((CLASSITEM*)(pDep->pVariable))[n].nRectType,PT.left,PT.top,PT.left,PT.top);}
Diagram__DrawDependent(PT.left,PT.top,PT.right,PT.bottom,2,pDep->dwFlags,nID);
Diagram__ClientToScreen2(*Rect);
for(n=0;n < pDep->nSizeVariable; n++){
MakeMaximalRect(Rect,&((CLASSITEM*)(pDep->pVariable))[n].nRectType);
}
Diagram__ScreenToClient2(*Rect);
if(bRedraw){
Diagram__InvalidateMemRect();
}
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__MoveCellTo(int nID ,int x, int y )
-s--Diagram__MoveCellTo ■ 4 -2 -22 3
Diagram__MoveCellTo
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 ; moving by ...
RECT last;
DIAGRAMCELL *pDep,* pCell = Diagram__GetCell(nID);
CopyRect(&last,&pCell->Rect);
SetRect(&pCell->Rect,x,y,Diagram__MakeCellWidth(nID)+x,Diagram__MakeCellHeight(nID)+y);
// move dependents
if(pCell->nSizeDependents > 0){
POINT dest;
LINE ln;
int n;
RECT PT;
for(n=0;n < pCell->nSizeDependents;n++){
pDep =Diagram__GetCell(pCell->pDependents[n]);
int nSecond;
RECT* rc=&pDep->Rect;
MakeMaximalRect(&last,rc);
if(pDep->nBreakA == nID){
Diagram__GetCenterCell(nID,ln.x,ln.y);
if(pDep->nBreakB >= 0){
Diagram__GetCenterCell(pDep->nBreakB,ln.x2,ln.y2);
}
else {ln.x2 = pDep->PT.right;ln.y2 = pDep->PT.bottom;}
nSecond = pDep->nBreakB;
}
else{
if(pDep->nBreakA >= 0){
Diagram__GetCenterCell(pDep->nBreakA,ln.x,ln.y);}
else {ln.x = pDep->PT.left;ln.y = pDep->PT.top;}
Diagram__GetCenterCell(nID,ln.x2,ln.y2);
nSecond = pDep->nBreakA;
}
Diagram__ClientToScreen2(*((RECT*)(&ln)));
Diagram__CutLineOnBorderOfCell(nID,&dest,&ln);
RECT end;
if(dest.left < 0 || dest.top < 0){
SetRect(&end,ln.x,ln.y,ln.x2,ln.y2);
}
else {
end.left=dest.left;
end.top=dest.top;
if(nSecond >= 0){
Diagram__CutLineOnBorderOfCell(nSecond,&dest,&ln);
end.right=dest.left;
end.bottom=dest.top;
if(dest.left < 0 || dest.top < 0){
SetRect(&end,ln.x,ln.y,ln.x2,ln.y2);
}
}
}
Diagram__ScreenToClient2(end);
if(nSecond < 0) {
CopyRect(&PT,&pDep->PT);
if(pDep->nBreakA == nID){
end.right = PT.right;end.bottom = PT.bottom;
}
else{
end.right = PT.left;end.bottom = PT.top;
}
}
if(pDep->nBreakA == nID)
SetRect(&pDep->PT,end.left,end.top,end.right,end.bottom);
else {
SetRect(&pDep->PT,end.right,end.bottom,end.left,end.top);
}
Diagram__RecalculateDepRect(pCell->pDependents[n],0);
MakeMaximalRect(&last,rc);
}
}
// invalidate !
Diagram__OnDrawClipRect(last.left,last.top,last.right,last.bottom);
// optimal.. : sometimes when user move cell is interselection of old client rectagle and new client rectagle and this case is catched by DIA_DRAWCLIPRECT
if(!IntersectRect(&last,&pCell->Rect))SendMessage(2 /* IDC_DIAGRAM */,100/*DIA_PAINTOBJECT*/,nID,-1);
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__CutLineOnBorderOfCell( int nCell, POINT* dest, LINE* ln )
-s--Diagram__CutLineOnBorderOfCell ■ 4 -2 -16 3
Diagram__CutLineOnBorderOfCell
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
// developing time : 10h:24m
POINT pt[4];
RECT * Rect = &Diagram__GetCell(nCell)->Rect;
SetPoint(dest,-1,-1);
SetPoint(&pt[0],Rect->left,Rect->top);
SetPoint(&pt[2],Rect->right,Rect->bottom);
Diagram__ClientToScreen(pt[0].top);
Diagram__ClientToScreen(pt[2].top);
SetPoint(&pt[1],pt[2].left,pt[0].top);
SetPoint(&pt[3],pt[0].left,pt[2].top);
RGNLineIntersect(ln,pt,4,dest);
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__ConnectDependent(unsigned nDependent, unsigned nCell )
-s--Diagram__ConnectDependent ■ 4 -2 -19 3
Diagram__ConnectDependent
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
DIAGRAMCELL * ConnectTo = Diagram__GetCell(nCell);
ConnectTo->pDependents=DependentItemInit(ConnectTo->pDependents,ConnectTo->nSizeDependents,ConnectTo->nSizeDependents+1);
ConnectTo->pDependents[ConnectTo->nSizeDependents-1] = nDependent;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
int Diagram__CreateDependent(long nType)
-s--Diagram__CreateDependent ■ 4 -2 -19 3
Diagram__CreateDependent
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 unsigned nID = Diagram__CreateCell(0,0,4/*TYPE_CLASS_DEPENDENT*/);
DIAGRAMCELL * pCell = Diagram__GetCell(nID);
Diagram__AddVariable(nID,"",0x0000); // FOR VCENTER|CENTER CELL // dependents pos
if(nType > 1 && nType < 16){
int p;
for(p=1;p < 5;p++){
Diagram__AddVariable(nID,"",((p > 2)?16:0)+p%2);
}
}
if(nType == 16){
Diagram__AddVariable(nID,"",0x0000); // FOR VCENTER|CENTER CELL // dependents pos2 (extra info)
Diagram__AddVariable(nID,"",0x0001); // FOR VCENTER|CENTER CELL // dependents pos2 (extra info)
}
CopyRect(&pCell->Rect,&m_LAST_POINTS);
NormalizeRect(&pCell->Rect);
pCell->dwFlags = nType;
// create ReGiN for arrow and line.
CopyRect(&pCell->PT,&m_LAST_POINTS);
Diagram__ScreenToClient2(pCell->PT);
Diagram__ScreenToClient2(pCell->Rect);
Diagram__ConnectDependent(nID,m_DEPENDENT_FROM);
if(m_DEPENDENT_TO != -1) Diagram__ConnectDependent(nID,m_DEPENDENT_TO);
pCell->nBreakA = m_DEPENDENT_FROM;
pCell->nBreakB = m_DEPENDENT_TO;
// 0x0001 FOR VCENTER|CENTER CELL (over line)
// 0x0002 FOR DEPENDENT CELL (for example cell which recieve message)
// 0x0004 TOPSIDE // always top
// 0x0008 BOTTOMSIDE // always bottom
// 0x0010 TOPTOPSIDE //
Diagram__MoveCellTo(m_DEPENDENT_FROM,Diagram__GetCell(m_DEPENDENT_FROM)->Rect.left,Diagram__GetCell(m_DEPENDENT_FROM)->Rect.top);
Diagram__SetInterZOrder(nID);
return nID;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Diagram__WndProc( unsigned nMessage, long lParam, long wParam )
-s--Diagram__WndProc ■ 4 -2 -23 3
Diagram__WndProc
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
DIAGRAMCELL * pCell =Diagram__GetFocusCell();
switch(nMessage){
case 14 /* WM_CHAR*/:
if(lParam == 0x5300/*KlDel*/){
if(m_nInterCellFocus != -1)Diagram__WCDelete();
}
break;
case 1/*WM_LBUTTONDOWN*/:
if(m_DIAGRAM_ADDINGDEPENDENT == 1){
break;
}
SetCapture(2 /* IDC_DIAGRAM */);
m_bDiaStartDraging = 1;
m_bDiaDraging = 1;
if(Diagram__SelectNewObject(MouseEvent.X,MouseEvent.Y) != -1 && Diagram__GetFocusCell()->nType != 4/*TYPE_CLASS_DEPENDENT*/){
// AnimP²edm╪tZruτ(MouseObject);
// MouseObject=AnimP²edm╪tVytvo²(130,1,0,1);
// SetPoint(&MOUSEOFFSET,8,8);
SetCursor(130);
m_LastEvent.x = -1;m_LastEvent.y=-1;
m_StartDrag.x = MouseEvent.X;m_StartDrag.y=MouseEvent.Y;
pCell = Diagram__GetFocusCell();
SetPoint(&m_DiaIncrease,MouseEvent.X-pCell->Rect.left,MouseEvent.Y-pCell->Rect.top-31);
}
break;
case 7/*WM_LBUTTONUP*/:
if(m_DIAGRAM_ADDINGDEPENDENT == 1){
Diagram__HideAddingDependent();
if(MouseEvent.Y > 32 && m_DEPENDENT_TO != m_DEPENDENT_FROM ){ LoadMenu(29,5);
TrackPopUpMenu(MouseEvent.X,MouseEvent.Y);}
break;
}
SetCursor(85);
if(m_bDiaDraging == 0)break;
ReleaseCapture();
m_bDiaDraging = 0;
int x,y;
if(m_bDiaStartDraging != 1){
Diagram__HideDragingRect();
}
m_bDiaStartDraging = 0;
if(m_nInterCellFocus != -1 && (m_StartDrag.x != MouseEvent.X || MouseEvent.Y != m_StartDrag.y) && m_StartDrag.x >= 0){
// nastavim pozici
x=MouseEvent.X;
y=MouseEvent.Y;
Diagram__ScreenToClient(y);
x-=m_DiaIncrease.left;
y-=m_DiaIncrease.top;
if (y < 0)y=0; // croping is not implemented :/ it will be better in WinVersion, comming soon.
if (x < 0)x=0;
Diagram__MoveCellTo(m_nInterCellFocus,x,y);
}
SetPoint((POINT*)&m_StartDrag,-10,-10);
break;
case 3/* WM_MOUSEMOVE*/:
if(m_DIAGRAM_ADDINGDEPENDENT == 1){
POINT dest;
int x,y;
LINE ln;
int OverCell = Diagram__OverObject(MouseEvent.X,MouseEvent.Y);
if(Diagram__GetCell(OverCell)->nType == 4)OverCell=-1;
if(OverCell != -1 ){
Diagram__GetCenterCell(OverCell,x,y);
Diagram__ClientToScreen(y);
SetRect((RECT*)&ln,x,y,m_DIAGRAM_DEPENDENT_FROM.left,m_DIAGRAM_DEPENDENT_FROM.top);
Diagram__CutLineOnBorderOfCell(OverCell,&dest,&ln);
if(dest.left >= 0){
x=dest.left;
y=dest.top;
}
dest.left=-1;dest.top=-1;
}
else {x=MouseEvent.X;y=MouseEvent.Y;}
m_DEPENDENT_TO = OverCell;
dest.left=-1;dest.top=-1;
SetRect((RECT*)&ln,x,y,m_DIAGRAM_DEPENDENT_FROM.left,m_DIAGRAM_DEPENDENT_FROM.top);
Diagram__CutLineOnBorderOfCell(m_nInterCellFocus,&dest,&ln);
HideMouse();
// is the line same ?? if is 1, break process
if((m_LAST_POINTS.left == dest.left && m_LAST_POINTS.top == dest.top && m_LAST_POINTS.right == x && m_LAST_POINTS.bottom == y))break;
if(m_LAST_POINTS.left >= 0){
Diagram__DrawDependent(m_LAST_POINTS.left,m_LAST_POINTS.top,m_LAST_POINTS.right,m_LAST_POINTS.bottom,1,1/*TYPE_DEPENDENT_INHERITANCE*/,-1);
}
if(dest.left >= 0){
Diagram__DrawDependent(dest.left,dest.top,x,y,1,1/*TYPE_DEPENDENT_INHERITANCE*/,-1);
}
ShowMouse();
SetRect(&m_LAST_POINTS,dest.left,dest.top,x,y);
break;
}
if(MouseEvent.TlaĒtka == 1 && m_nInterCellFocus != -1 && m_StartDrag.x >= 0 && pCell->nType != 4/*TYPE_CLASS_DEPENDENT*/){
int sizex = Diagram__MakeCellWidth(m_nInterCellFocus);
int sizey = Diagram__MakeCellHeight(m_nInterCellFocus);
GrNastavBarvuPop²edí(1);
HideMouse();
GrNastavLinku(42/*8|2|0x20*/,0xAAAA);
int x,y;
if(m_bDiaStartDraging != 1){
x=m_LastEvent.x-m_DiaIncrease.left;y=m_LastEvent.y-m_DiaIncrease.top;
GrKresliObdélník(x+1,y+1,
x-1+sizex,
y -1+sizey);
}
x = MouseEvent.X-m_DiaIncrease.left;
y = MouseEvent.Y-m_DiaIncrease.top;
GrKresliObdélník(x+1,y+1,x-1+sizex,y+sizey-1);
m_LastEvent.x = MouseEvent.X;
m_LastEvent.y = MouseEvent.Y;
m_bDiaStartDraging = 0;
GrNastavLinku(21/*4|1|0x10*/,0xFFFF);
ShowMouse();
// drag object ...
// m_DragEdge = m_DragPos;
}
break;
case 102/*DIA_SETFOCUS*/: // set focus to some cell / object
Diagram__DrawCellEx(lParam);
break;
case 101/*DIA_KILLFOCUS*/:
Diagram__DrawCellEx(lParam);
break;
case 100/*DIA_PAINTOBJECT*/: // draw cell / object
Diagram__DrawCellEx(lParam);
break;
case 8/*WM_PAINT*/ :
Diagram__OnDrawClipRect(0,0,GrMaxX(),GrMaxY());
break;
case 6 /* WM_RBUTTONUP */:
if(m_DIAGRAM_ADDINGDEPENDENT == 1){
Diagram__HideAddingDependent();
// m_DIAGRAM_ADDINGDEPENDENT = 0;
break;
}
if(m_bDiaDraging == 1 && m_bDiaStartDraging != 1){
// delete draging rectangle !
Diagram__HideDragingRect();
}
m_bDiaDraging = 0;
int count=0;
if(Diagram__SelectNewObject(MouseEvent.X,MouseEvent.Y) != -1){
pCell = Diagram__GetFocusCell();
unsigned nType = pCell->nType;
if(nType == 2/*TYPE_CLASS_FULL*/ || nType == 1/*TYPE_CLASS_ONLY*/ || nType == 3/*TYPE_CLASS_OBJECT*/){
MENUITEM(count,300/*IDC_CELL_RENAME*/,"Zm∞nit nßzev objektu",-1/*IDB_NOTHING*/ ,1); count++;
if(nType != 3/*TYPE_CLASS_OBJECT*/){MENUITEM(count,600/*IDC_SETTING_CLASS*/,"Vlastnosti t°φdy",87/*IDB_PROPERTIES*/,1);count++;}
if(nType == 1/*TYPE_CLASS_ONLY*/){
MENUITEM(count,302/*IDC_CELL_CLASSFULL*/,"Zobrazit cel² objekt",149/*IDB_CLASSFULL*/,1);count++;}
else if(nType == 2/*TYPE_CLASS_FULL*/){
MENUITEM(count,301/*IDC_CELL_CLASSONLY*/,"Zobrazit pouze nßzev",59/*IDB_CLASSONLY*/,1);count++;}
// check where use clicked ...
}
else {
if(nType == 4/*TYPE_CLASS_DEPENDENT*/){
MENUITEM(count,303/*IDC_CELL_CHANGEDEPENDENT*/,"Zm∞nit vlastnosti",-1/*IDB_NOTHING*/ ,1);count++;
}
else if(nType == 5/*TYPE_CLASS_IMG*/){
MENUITEM(count,300/*IDC_CELL_CHANGESOURCE*/,"Zm∞nit obrßzek",-1/*IDB_NOTHING*/ ,1);count++;
}
}
MENUITEM(count,-1/*ID_SEPARATE*/ ,"-",-1/*IDB_NOTHING*/ ,1);count++;
if(nType != 4/*TYPE_CLASS_DEPENDENT*/){MENUITEM(count,401/*IDC_INSERT_DEPENDENT*/,"Vlo₧it novou zßvislost",132/*IDB_DEPENDENT*/,(m_nm_DiagramCellsSize > 0)?1:0);count++;}
MENUITEM(count,400/*IDC_INSERT_NEWOBJECT*/,"Vlo₧it nov² objekt",119/*IDB_NEWOBJECT*/,1);count++;
if(nType == 2/*TYPE_CLASS_FULL*/ || nType == 1/*TYPE_CLASS_ONLY*/){
MENUITEM(count,-1/*ID_SEPARATE*/ ,"-",-1/*IDB_NOTHING*/ ,1);count++;
MENUITEM(count,403/*IDC_INSERT_NEWVARIABLE*/,"Vlo₧it atribut objektu",51/*IDB_NEWVARIABLE*/,1);count++;
MENUITEM(count,402/*IDC_INSERT_NEWOPERATION*/,"Vlo₧it operaci objektu",36/*IDB_NEWOPERATION*/,1);count++;
if(nType == 2/*TYPE_CLASS_FULL*/){
m_MOUSEOVER_PTY = MouseEvent.Y;
if(Diagram__HitTestCell(m_nInterCellFocus,m_MOUSEOVER_PTY)==1){
MENUITEM(count,-1/*ID_SEPARATE*/ ,"-",-1/*IDB_NOTHING*/ ,1);count++;
MENUITEM(count,601/*IDC_EDIT_ITEM*/,(string)"Upravit "+(string)((m_MOUSEOVER_PTY < 0)?"atribut objektu":"operaci objektu"),38/*IDB_EDIT_ITEM*/+((m_MOUSEOVER_PTY < 0)?15:0),1);count++;
MENUITEM(count,604/*IDC_DELETE_ITEM*/,(string)"Odebrat "+(string)((m_MOUSEOVER_PTY < 0)?"atribut objektu":"operaci objektu"),40/*IDB_DELETE_ITEM*/+((m_MOUSEOVER_PTY < 0)?15:0),1);count++;
}
}
}
MENUITEM(count,-1/*ID_SEPARATE*/ ,"-",-1/*IDB_NOTHING*/ ,1);count++;
if(nType != 4/*TYPE_CLASS_DEPENDENT*/){MENUITEM(count,210/*IDC_EDIT_CUT*/,"Vyjmout",102/*IDB_CUT*/,1);count++;}
if(nType != 4/*TYPE_CLASS_DEPENDENT*/){MENUITEM(count,211/*IDC_EDIT_COPY*/,"Kopφrovat",14/*IDB_COPY*/,1);count++;}
MENUITEM(count,212/*IDC_EDIT_PASTE*/,"Vlo₧it",29/*IDB_PASTE*/,m_MEMORY_CELL.nType == 0 ?0:1);count++;
MENUITEM(count,213/*IDC_EDIT_DELETE*/,"Odstranit",44/*IDB_DELETE*/,1);count++;
MENUITEM(count,214/*IDC_EDIT_DELETEALL*/,"Odstranit vÜe",-1/*IDB_NOTHING*/ ,((m_nm_DiagramCellsSize > 0)?1:0));count++;
}
else {
MENUITEM(count,400/*IDC_INSERT_NEWOBJECT*/,"Vlo₧it nov² objekt",119/*IDB_NEWOBJECT*/,1);count++;
MENUITEM(count,-1/*ID_SEPARATE*/ ,"-",-1/*IDB_NOTHING*/ ,1);count++;
MENUITEM(count,212/*IDC_EDIT_PASTE*/,"Vlo₧it",29/*IDB_PASTE*/,m_MEMORY_CELL.nType == 0 ?0:1);count++;
MENUITEM(count,214/*IDC_EDIT_DELETEALL*/,"Odstranit vÜe",-1/*IDB_NOTHING*/ ,((m_nm_DiagramCellsSize > 0)? 1:0));count++;
}
if(count > 0){
SetMenuCount(count);
TrackPopUpMenu(MouseEvent.X,MouseEvent.Y);}
break;
case 2/*WM_RBUTTONDOWN*/:
if(m_DIAGRAM_ADDINGDEPENDENT == 1){
Diagram__HideAddingDependent();
break;
}
break;
default:
break;
}
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
int Edit__SearchForNearestChar( int nIDEdit, POINT &pt )
-s--Edit__SearchForNearestChar ■ 4 -2 -18 3
Edit__SearchForNearestChar
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
// return 0 if point(pt.x, pt.y) is on leftside from text in edit box
int starttextx = GetWindow(nIDEdit)->Rect.left+((GetWindow(nIDEdit)->dwStyle & 0x00200000L/*WS_CLIENTEDGE*/)? 2: 0 )+2;
if(pt.left <= (starttextx)){
return 0;
}
// return lenght string, if point(pt.x, pt.y) is on rightside from text in text box
SIZE sz;
string str=Edit__GetVisibleText(nIDEdit);
int nLen = StrDélka(str);
GetTextExtent(str,sz,GetWindow(nIDEdit)->hFont);
if(pt.left >= (starttextx + sz.x)){
return nLen;
}
//
// if the point(pt.x,pt.y) is located inside text in edit box,
// convert coordinate to invex char.
//
int i = 0;
int nCharBefore = starttextx;
int nNextChar = starttextx;
while(nNextChar < pt.left){
i++;
nCharBefore = nNextChar;
GetTextExtent(StrKopie(str,0,i),sz,GetWindow(nIDEdit)->hFont);
nNextChar = starttextx + sz.x;
}
return ((pt.left - nCharBefore) < (nNextChar - pt.left))?i-1:i;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
string Edit__GetVisibleText(unsigned nID )
-s--Edit__GetVisibleText ■ 4 -2 -21 3
Edit__GetVisibleText
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 WND * pWnd=GetWindow(nID);
int width = 0;
int nSizeX = Edit__GetMaxVisibleTextWidth(nID);
int counter = pWnd->lParam;
if(counter < 0)counter=0;
SIZE size;
while(width < nSizeX){
GetTextExtent(pWnd->szText[counter],size,pWnd->hFont);
width+=size.x;
counter++;
}
if(width >= nSizeX){
width-=size.x;
counter--;
}
return StrKopie(pWnd->szText,pWnd->lParam,counter-pWnd->lParam);
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
int Edit__GetMaxVisibleTextWidth( unsigned hWnd )
-s--Edit__GetMaxVisibleTextWidth ■ 4 -2 -17 3
Edit__GetMaxVisibleTextWidth
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 return (GetWindowWidth(hWnd)-((GetWindow(hWnd)->dwStyle & 0x00200000L)?10:6))
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Edit__DrawText( unsigned hWnd )
-s--Edit__DrawText ■ 4 -2 -24 3
Edit__DrawText
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 WND * pWnd = GetWindow(hWnd);
HideMouse();
RECT rc;
CopyRect(&rc,&pWnd->Rect);
if(pWnd->dwStyle & 0x00200000L/*WS_CLIENTEDGE*/)InflateRect(&rc,-2,-2,-2,-2);
InflateRect(&rc,-2,0,-2,0);
string str =Edit__GetVisibleText(hWnd);
SIZE sz;GetTextExtent(str,sz,pWnd->hFont);
FillSolidRect2(rc.left+sz.x-1,rc.top,rc.right,rc.bottom,5);
DrawText(str,&rc,4,5,0x00000000/*DT_LEFT*/|0x00000004/*DT_CENTER*/,pWnd->hFont);
ShowMouse();
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Edit__WndProc( unsigned hWnd,unsigned nMessage, long lParam, long wParam )
-s--Edit__WndProc ■ 4 -2 -25 3
Edit__WndProc
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
WND* pWnd = GetWindow(hWnd);
long dwStyle = pWnd->dwStyle;
RECT * Rect = &pWnd->Rect;
long bMouseOver = (dwStyle & 0x00100000L/*WS_MOUSEOVER*/);
long bClientEdge = (dwStyle & 0x00200000L/*WS_CLIENTEDGE*/);
switch(nMessage){
case 16 /* WM_SHOWWINDOW */:
if(lParam == 1)pWnd->lParam=0;
break;
case 14 /* WM_CHAR*/:
if(m_ObjectWithFocus == hWnd){
switch(lParam){
case 0x000d/*KlEnter*/:
SendMessage(0,9 /*WM_COMMAND*/,200/*ED_ENTER*/,hWnd);
break;
case 0x4b00/*KlDoleva*/:
if((pWnd->lParam+pWnd->misc) > 0){
HideCaret();
if(pWnd->misc == 0){
pWnd->lParam--;
SendMessage(hWnd,8/*WM_PAINT*/ ,-2,-1);
}
else {
pWnd->misc--;
Edit__MoveCaretToPos(hWnd,pWnd->misc);
}
ShowCaret();
}
break;
case 0x4d00/*KlDoprava*/:
if(StrDélka(pWnd->szText) >= (pWnd->lParam+pWnd->misc+1)){
HideCaret();
if(StrDélka(Edit__GetVisibleText(hWnd)) >= pWnd->misc+1){
pWnd->misc++;
Edit__MoveCaretToPos(hWnd,pWnd->misc);
}
else {
pWnd->misc++;
Edit__MoveCaretToPos(hWnd,pWnd->misc);
SendMessage(hWnd,8/*WM_PAINT*/ ,-2,-1);
}
}
ShowCaret();
break;
case 0x4f00/*KlEnd*/ :
pWnd->lParam=0;
pWnd->misc = StrDélka(pWnd->szText);
HideCaret();
Edit__MoveCaretToPos(hWnd,pWnd->misc);
SendMessage(hWnd,8/*WM_PAINT*/ ,-2,-1);
ShowCaret();
break;
case 0x4700/*KlHome*/ :
pWnd->misc = 0;
pWnd->lParam = 0;
Edit__MoveCaretToPos(hWnd,pWnd->misc);
SendMessage(hWnd,8/*WM_PAINT*/ ,-2,-1);
break;
case 0x5300/*KlDel*/ :
pWnd->szText = StrKopie(pWnd->szText,0,pWnd->misc+pWnd->lParam)+StrKopie(pWnd->szText,pWnd->misc+pWnd->lParam+1,-1);
HideCaret();
SendMessage(hWnd,8/*WM_PAINT*/ ,-2,-1);
ShowCaret();
break;
case 8 : // BkSp
if(pWnd->misc+pWnd->lParam <= 0)break;
pWnd->szText = StrKopie(pWnd->szText,0,pWnd->misc+pWnd->lParam-1)+StrKopie(pWnd->szText,pWnd->misc+pWnd->lParam,-1);
HideCaret();
if(!(pWnd->misc > 0)){
pWnd->lParam--;
if(pWnd->lParam > 10){ pWnd->lParam-=10; pWnd->misc=10;}
else{ pWnd->misc=pWnd->lParam; pWnd->lParam=0; }
}
else {
pWnd->misc--;
}
Edit__MoveCaretToPos(hWnd,pWnd->misc);
SendMessage(hWnd,8/*WM_PAINT*/ ,-2,-1);
ShowCaret();
break;
default:
if(lParam > 31 && StrDélka(pWnd->szText)+1 < 1000){ // normal chars
pWnd->szText = StrKopie(pWnd->szText,0,pWnd->misc+pWnd->lParam)+(string)((char)lParam)+StrKopie(pWnd->szText,pWnd->misc+pWnd->lParam,-1);
HideCaret();
pWnd->misc++;
Edit__MoveCaretToPos(hWnd,pWnd->misc);
SendMessage(hWnd,8/*WM_PAINT*/ ,-2,-1);
ShowCaret();
}
break;
}
}
break;
case 8/*WM_PAINT*/ :
if(lParam != -2)DrawFrameControl(Rect,pWnd->nType,pWnd->dwStyle|(m_ObjectWithFocus == hWnd ?0x00400000L/*WS_FOCUS*/:0),pWnd->szText,pWnd->hFont);
if(!(pWnd->dwStyle & 0x00080000L))Edit__DrawText(hWnd);
break;
case 5/* WM_MOUSEENTER*/: // 100
case 4/*WM_MOUSELEAVE*/: // 85
SetCursor(85+(nMessage-4)*15);
break;
case 7/*WM_LBUTTONUP*/:
ReleaseCapture();
break;
case 1/*WM_LBUTTONDOWN*/:
SetCapture(hWnd);
POINT pt;pt.left = MouseEvent.X;pt.top = MouseEvent.Y;
int i = Edit__SearchForNearestChar(hWnd,pt);
if (pWnd->misc != i){
pWnd->misc = i;
Edit__MoveCaretToPos(hWnd,pWnd->misc);
}
break;
case 12 /*WM_KILLFOCUS*/:
DestroyCaret();
ShowMouse();
break;
case 11/*WM_SETFOCUS*/:
SIZE sz;GetTextExtent("",sz,pWnd->hFont);
CreateCaret(sz.y);
POINT tt;SetPoint(&tt,MouseEvent.X,MouseEvent.Y);
pWnd->misc = Edit__SearchForNearestChar(hWnd,tt);
Edit__MoveCaretToPos(hWnd,pWnd->misc);
ShowCaret();
break;
}
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Edit__MoveCaretToPos(unsigned nID, int nPos )
-s--Edit__MoveCaretToPos ■ 4 -2 -22 3
Edit__MoveCaretToPos
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
WND * pWnd = GetWindow(nID);
SIZE sz;
GetTextExtent(StrKopie(GetWindowText(nID),pWnd->lParam,nPos),sz,pWnd->hFont);
int delta=0;
while(sz.x >= Edit__GetMaxVisibleTextWidth(nID)){
pWnd->lParam++;
pWnd->misc--;
delta--;
GetTextExtent(StrKopie(GetWindowText(nID),pWnd->lParam,nPos+delta),sz,pWnd->hFont);
}
SetCaretPos(sz.x+pWnd->Rect.left+2,pWnd->Rect.top+((pWnd->dwStyle & WS_CLIENTEDGE)? 2: 0 )+2);
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
int ListBox__GetCurSel( unsigned hWnd )
-s--ListBox__GetCurSel ■ 3 -2 -22 3
ListBox__GetCurSel
!1
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 return (GetWindow(hWnd)->misc2+GetWindow(hWnd)->misc);
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void ListBox__DeleteAll(unsigned hWnd )
-s--ListBox__DeleteAll ■ 4 -2 -22 3
ListBox__DeleteAll
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 WND* pWnd = GetWindow(hWnd);
ClassItemInit(pWnd->pData,pWnd->lParam,0);
SendMessage(0,9 /*WM_COMMAND*/,200/*LV_SELCHANGE*/,hWnd);
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void ListBox__DrawItems( unsigned hWnd, int nToDraw )
-s--ListBox__DrawItems ■ 4 -2 -22 3
ListBox__DrawItems
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
HideMouse();
WND* pWnd = GetWindow(hWnd);
int FocusCell = pWnd->misc2+pWnd->misc;
int TopMostCell = nToDraw+pWnd->misc;
RECT rc;CopyRect(&rc,&pWnd->Rect);
CLASSITEM* items= (CLASSITEM*)pWnd->pData;
rc.left+=2;
rc.right-=20;
rc.top+=2+15*nToDraw;
rc.bottom=rc.top+14;
if(FocusCell == TopMostCell)FillSolidRect(&rc,12 /* BLUE*/);
else FillSolidRect(&rc,5);
rc.left+=3;
DrawText(items[TopMostCell].strText,&rc,(FocusCell == TopMostCell)?5:4,5,0x00000004/*DT_VCENTER*/,FONT_TAHOMA_8);
ShowMouse();
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
string ListBox__GetItemText( unsigned hWnd, nID )
-s--ListBox__GetItemText ■ 4 -2 -21 3
ListBox__GetItemText
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 return ((CLASSITEM*)GetWindow(hWnd)->pData)[nID].strText;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void ListBox__SetItemText(unsigned hWnd, int nID, string str )
-s--ListBox__SetItemText ■ 4 -2 -21 3
ListBox__SetItemText
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 ((CLASSITEM*)GetWindow(hWnd)->pData)[nID].strText=str;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
int ListBox__AddItem(unsigned hWnd, int nID, string strText)
-s--ListBox__AddItem ■ 4 -2 -23 3
ListBox__AddItem
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
WND* pWnd = GetWindow(hWnd);
long lParam =pWnd->lParam;
if(lParam < 0)pWnd->lParam = 0;
pWnd->pData=(CLASSITEM*)ClassItemInit(pWnd->pData,pWnd->lParam,lParam+1);
CLASSITEM* pData=&((CLASSITEM*)pWnd->pData)[lParam];
pData->strText = strText;
pData->nType = nID;
SendMessage(0,9 /*WM_COMMAND*/,200/*LV_SELCHANGE*/,hWnd);
return pWnd->lParam;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
string AddDialog__CreateString()
-s--AddDialog__CreateString ■ 4 -2 -20 3
AddDialog__CreateString
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
string strText;
int i=0;
if(abs(GetWindow(10 /*IDC_ADDINGDIALOG*/)->lParam) == 1){
for(;i < ListBox__GetSize(21/*IDC_PARA_LIST*/);i++){
if(i != 0)
strText+=", ";
strText+=ListBox__GetItemText(21/*IDC_PARA_LIST*/,i);
}
strText=trim(GetWindowText(26/*IDC_ADD_NAME*/))+" ("+strText+" ) ";
}else{
strText=trim(GetWindowText(26/*IDC_ADD_NAME*/))+" ";
}
string sx=trim(GetWindowText(12/*IDC_ADD_TYPENAME*/));
if(sx!="")
strText +=": "+sx;
return strText;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
string AddDialog__MakeParameterString( void )
-s--AddDialog__MakeParameterString ■ 4 -2 -16 3
AddDialog__MakeParameterString
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
string str=GetWindowText(20/*IDC_PARA_NAME*/)+":"+GetWindowText(19/*IDC_PARA_TYPE*/);
if(Button__GetCheck(24/*IDC_PARA_INOUT*/)){str="inout "+str;}
else if (Button__GetCheck(25/*IDC_PARA_OUT*/)){str="out "+str;}
else if (Button__GetCheck(27/*IDC_PARA_IN*/)){str="in "+str;}
return str;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Dialog__WndProc(unsigned hWnd, unsigned nMessage, long lParam, long wParam )
-s--Dialog__WndProc ■ 4 -2 -24 3
Dialog__WndProc
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
WND* pWnd = GetWindow(hWnd);
long dwStyle = pWnd->dwStyle;
RECT Rect;
CopyRect(&Rect,GetWindowRect(hWnd));
long bMouseOver = (dwStyle & 0x00100000L/*WS_MOUSEOVER*/);
long bClientEdge = (dwStyle & 0x00200000L/*WS_CLIENTEDGE*/);
switch(nMessage){
case 16 /* WM_SHOWWINDOW */:
// show all client controls/ windows
if(lParam == 0)GrKresliP²edm╪ty(16001,0,Rect.left,Rect.top,GetWindowWidth(hWnd)/39+1,GetWindowHeight(hWnd)/29+1);
else {
GrNastavObrazP²edm╪tà(16001,Rect.left,Rect.top,GetWindowWidth(hWnd)/39+1,GetWindowHeight(hWnd)/29+1,1);
SendMessage(hWnd,8,-1,-1);
}
if(pWnd->nChildSize > 0){
int i=0,p;
for(;i < pWnd->nChildSize; i++){
p = pWnd->pChild[i]->hWnd;
ShowWindow(p,lParam);
if(lParam)Invalidate(p);
}
}
break;
case 8/*WM_PAINT*/ :
pWnd->hFont = FONT_TAHOMA_BOLD_8;
HideMouse();
#ifdef _XP_THEME
Draw3dRect2(Rect.left,Rect.top+22,Rect.right,Rect.bottom,2,2);
Draw3dRect2(Rect.left+1,Rect.top+22,Rect.right-1,Rect.bottom-1,2,2);
FillSolidRect2(Rect.left+2,Rect.top+23,Rect.right-2,Rect.bottom-2,1);
FillSolidRect2(Rect.left+7,Rect.top,Rect.right-7,Rect.top+23,2 /* BLUE*/);
GrKresliP²edm╪t(50,1,Rect.left,Rect.top);
GrKresliP²edm╪t(65,1,Rect.right-6,Rect.top);
TextOut(Rect.left+10,Rect.top+6,pWnd->szText,5,2 /* BLUE*/,pWnd->hFont);
#else
DrawEdge(&Rect,0x0004/*DES_MODAL*/);
FillSolidRect2(Rect.left+2,Rect.top+2,Rect.right-2,Rect.bottom-2,0);
FillSolidRect2(Rect.left+3,Rect.top+3,Rect.left+150,Rect.top+20,12 /* BLUE*/);
GrKresliP²edm╪ty(95,1,Rect.left+150,Rect.top+3,3,1);
FillSolidRect2(Rect.left+267,Rect.top+3,Rect.right-3,Rect.top+20,2 /* BLUE*/);
TextOut(Rect.left+7,Rect.top+5,pWnd->szText,5,2 /* BLUE*/,pWnd->hFont);
#endif
ShowMouse();
break;
}
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Button__SetCheckRange(int nPosStart,int nPosEnd,long dwFlags)
-s--Button__SetCheckRange ■ 4 -2 -21 3
Button__SetCheckRange
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 for(;nPosStart <= nPosEnd;nPosStart++){
Button__SetCheck(nPosStart,(dwFlags & GetWindow(nPosStart)->misc));
}
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Button__GetCheckRange(int nPosStart,int nPosEnd,long& dwFlags)
-s--Button__GetCheckRange ■ 4 -2 -21 3
Button__GetCheckRange
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 for(;nPosStart <= nPosEnd;nPosStart++){
Button__GetCheckEx(nPosStart,dwFlags,GetWindow(nPosStart)->misc);
}
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Button__GetCheckEx( unsigned hWnd, long& dwState, long nType )
-s--Button__GetCheckEx ■ 4 -2 -22 3
Button__GetCheckEx
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
if(Button__GetCheck(hWnd))dwState|=nType;
else STYLEMINUS(dwState,nType);
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
int Button__GetCheck( unsigned hWnd )
-s--Button__GetCheck ■ 4 -2 -23 3
Button__GetCheck
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 return ( GetWindow(hWnd)->dwStyle & 0x0000200L/*DFCS_PUSHED*/);
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void Button__SetCheck(unsigned hWnd, long bCheck )
-s--Button__SetCheck ■ 4 -2 -23 3
Button__SetCheck
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1 WND* pWnd = GetWindow(hWnd);
long dwStyle =pWnd->dwStyle;
if((dwStyle & 0x0000002L/*DFCS_BUTTONRADIO*/)){
if(!bCheck){ STYLEMINUS(dwStyle,0x0000200L/*DFCS_PUSHED*/); }
else {
int i;
WND *p=0;
for(i = 0; i < m_nm_ControlArraySize; i++){
p =GetWindow(i);
if(i != hWnd && p->nType == 4/*DFC_BUTTON*/ && p->dwStyle &0x0000002L/*DFCS_BUTTONRADIO*/ && p->nID == pWnd->nID){
// collections ...
if(p->dwStyle & 0x0000200L/*DFCS_PUSHED*/){
STYLEMINUS(p->dwStyle,0x0000200L/*DFCS_PUSHED*/);
Invalidate(i);
}
}
}
dwStyle|=0x0000200L/*DFCS_PUSHED*/;
}
}
else if(dwStyle & 0x0000001L/*DFCS_BUTTONCHECK*/){
if(bCheck)dwStyle|=0x0000200L/*DFCS_PUSHED*/;
else STYLEMINUS(dwStyle,0x0000200L/*DFCS_PUSHED*/);
}
Invalidate(hWnd);
pWnd->dwStyle = dwStyle;
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void WndProc(unsigned hWnd,unsigned nMessage, long lParam, long wParam)
-s--WndProc ■ 4 -2 -24 3
WndProc
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
WND* pWnd = GetWindow(hWnd);
long dwStyle = pWnd->dwStyle;
int nType = pWnd->nType;
RECT Rect;
CopyRect(&Rect,&pWnd->Rect);
long bMouseOver = (dwStyle & 0x00100000L/*WS_MOUSEOVER*/);
long bClientEdge = (dwStyle & 0x00200000L/*WS_CLIENTEDGE*/);
switch(hWnd){
case 0:
switch(nMessage){
case 13/* WM_TIMER */:
if(lParam == 0/*IDT_CARETTIMER*/){
DrawCaret();
}
break;
case 10/*WM_CLOSE*/:
m_LastedMessage = 1;
break;
}
break;
case 3 /*IDC_POPUPMENU */:
switch(nMessage){
case 5/* WM_MOUSEENTER*/:
break;
case 7/*WM_LBUTTONUP*/:
m_bMouseMenuFirstTime=0;
int pg = PopUpMenuHitTest(MouseEvent.X,MouseEvent.Y);
if(bMouseOver && m_POPUPMENU_STRINGS[pg] != "-" && m_POPUPMENU_ENABLE[pg] == 1 ){
int x=m_POPUPMENU_selitem;
m_POPUPMENU_FROMMENU = m_POPUPMENU_TOMENU;
StopTrackingPopUpMenu();
SendMessage(0,9 /*WM_COMMAND*/,1 /*BN_CLICK*/,m_POPUPMENU_IDS[x]);
m_POPUPMENU_FROMMENU = 0;
}
break;
case 3/* WM_MOUSEMOVE*/:
if(bMouseOver){
int i,g = PopUpMenuHitTest(MouseEvent.X,MouseEvent.Y);
#ifdef _XP_THEME
if(g !=m_POPUPMENU_selitem )
#else
if(g !=m_POPUPMENU_selitem && m_POPUPMENU_STRINGS[g] != "-")
#endif
{
i=m_POPUPMENU_selitem;
#ifdef _XP_THEME
m_POPUPMENU_selitem=-1;
if(m_POPUPMENU_STRINGS[g] != "-" && m_POPUPMENU_ENABLE[g] != 0) {
m_POPUPMENU_selitem=g;
}
if(i != -1)SendMessage(3 /* IDC_POPUPMENU */,8/*WM_PAINT*/ ,i,-1);
if(m_POPUPMENU_selitem != -1 && m_POPUPMENU_ENABLE[m_POPUPMENU_selitem]!= 0)SendMessage(3 /* IDC_POPUPMENU */,8/*WM_PAINT*/ ,m_POPUPMENU_selitem,-1);
#else
m_POPUPMENU_selitem=g;
if(i != -1)SendMessage(3 /* IDC_POPUPMENU */,8/*WM_PAINT*/ ,i,-1);
if(g != -1)SendMessage(3 /* IDC_POPUPMENU */,8/*WM_PAINT*/ ,g,-1);
#endif
}
}
else if(m_POPUPMENU_selitem !=-1){
int i =m_POPUPMENU_selitem;
m_POPUPMENU_selitem=-1;
if(i != -1)SendMessage(3 /* IDC_POPUPMENU */,8/*WM_PAINT*/ ,i,-1);
}
break;
case 8/*WM_PAINT*/ :
DrawPopUpMenu(hWnd,lParam,-1);
break;
}
break;
case 1 /* IDC_MENU */:
switch(nMessage){
case 8/*WM_PAINT*/ :
if(lParam == -2){
int i = 0;
for(i = 0;i < 5; i++){
SendMessage(1 /* IDC_MENU */,8/*WM_PAINT*/ ,i,-1);
}
return;
}
if(lParam == -1){
lParam = IDC_MENU_OVER;
if(lParam == -1)return;
}
Rect.right = Rect.left + IDC_MENU_RECT[lParam];
Rect.left += (lParam != 0)?IDC_MENU_RECT[lParam-1]+1:0;
DrawFrameControl(&Rect,2/*DFC_MENU*/,(((((MouseEvent.TlaĒtka == 1 && bMouseOver) || m_POPUPMENU_TOMENU) && wParam == -1 ) && lParam == IDC_MENU_OVER)?
0x0000001L/*DFCS_MENUCHECKED*/ : 0)|((bMouseOver &&
lParam == IDC_MENU_OVER)? 0x00100000L/*WS_MOUSEOVER*/ : 0 ),IDC_MENU_HORITEM[lParam],0);
break;
case 1/*WM_LBUTTONDOWN*/:
m_bMouseMenuFirstTime=1;
SetCapture(1 /* IDC_MENU */);
m_POPUPMENU_TOMENU=1;
Invalidate(1 /* IDC_MENU */);
int x = (IDC_MENU_OVER > 0)?IDC_MENU_RECT[IDC_MENU_OVER-1]+1:0;
x+=Rect.left;
SetMainMenu(IDC_MENU_OVER);
TrackPopUpMenu(x,Rect.bottom+1);
break;
case 7/*WM_LBUTTONUP*/:
m_bMouseMenuFirstTime=0;
ReleaseCapture();
Invalidate(1 /* IDC_MENU */);
break;
case 5/* WM_MOUSEENTER*/:
IDC_MENU_OVER = MenuHitTest(1 /* IDC_MENU */);
Invalidate(hWnd);
break;
case 4/*WM_MOUSELEAVE*/:
if(m_POPUPMENU_TOMENU!=1){
SendMessage(1 /* IDC_MENU */,8/*WM_PAINT*/ ,IDC_MENU_OVER,-1);
Invalidate(hWnd);
IDC_MENU_OVER = -1;
}
break;
case 3/* WM_MOUSEMOVE*/:
int q,i = MenuHitTest(1 /* IDC_MENU */);
q=IDC_MENU_OVER;
if(IDC_MENU_OVER != i){
IDC_MENU_OVER = i;int gg =m_POPUPMENU_TOMENU;
if(gg) StopTrackingPopUpMenu();
SendMessage(1 /* IDC_MENU */,8/*WM_PAINT*/ ,q,-1);
if(gg) m_POPUPMENU_TOMENU=1;
Invalidate(1 /* IDC_MENU */);
if(gg){
int x = (IDC_MENU_OVER > 0)?IDC_MENU_RECT[IDC_MENU_OVER-1]+1:0;
x+=Rect.left;
SetMainMenu(IDC_MENU_OVER);
TrackPopUpMenu(x,Rect.bottom+1);
}
}
break;
default:
break;
}
break;
default:
if(nType > 12){
if(nMessage == 8/*WM_PAINT*/)
DrawFrameControl(&Rect,nType,dwStyle|((m_ObjectWithFocus == hWnd) ?0x00400000L/*WS_FOCUS*/:0),pWnd->szText,pWnd->hFont);
}
else if(nType == 4/*DFC_BUTTON*/){
switch(nMessage){
case 4/*WM_MOUSELEAVE*/:
case 5/* WM_MOUSEENTER*/:
Invalidate(hWnd);
break;
case 7/*WM_LBUTTONUP*/:
ReleaseCapture();
if(dwStyle & 0x0000001L/*DFCS_BUTTONCHECK*/ || dwStyle & 0x0000002L/*DFCS_BUTTONRADIO*/){
if(bMouseOver && (((dwStyle & 0x0000002L) && !(dwStyle & 0x0000200L))||dwStyle & 0x0000001L)){
Button__SetCheck(hWnd,!(dwStyle & 0x0000200L/*DFCS_PUSHED*/));
}
Invalidate(hWnd);
}
else {
STYLEMINUS(pWnd->dwStyle,0x00100000/*DFCS_PUSHED*/);
Invalidate(hWnd);
STYLEMINUS(pWnd->dwStyle,0x0000200L/*DFCS_PUSHED*/);
if(bMouseOver)pWnd->dwStyle|=0x00100000;
if(bMouseOver)SendMessage(0,9 /*WM_COMMAND*/,1 /*BN_CLICK*/,pWnd->nID);
}
break;
case 1/*WM_LBUTTONDOWN*/:
SetCapture(hWnd);
if(!(dwStyle & 0x0000001L/*DFCS_BUTTONCHECK*/ || dwStyle & 0x0000002L/*DFCS_BUTTONRADIO*/)){pWnd->dwStyle|=0x0000200L/*DFCS_PUSHED*/;}
Invalidate(hWnd);
break;
case 16 /* WM_SHOWWINDOW */:
if(lParam == 1 && dwStyle & 0x0000004L){
HideMouse();
#ifdef _XP_THEME
FillSolidRect(&Rect,5);
#else
FillSolidRect(&Rect,0);
#endif
ShowMouse();
}
break;
case 8/*WM_PAINT*/ :
DrawFrameControl(&Rect,nType,dwStyle,pWnd->szText,pWnd->hBitmap);
break;
}
}
else if(nType == 7/*DFC_EDIT*/){
Edit__WndProc(hWnd,nMessage,lParam,wParam);
}
else if(nType == 8/*DFC_COMBOBOX*/){
switch(nMessage){
case 8/*WM_PAINT*/ :
DrawFrameControl(&Rect,nType,dwStyle|((GetWindow(8/*IDC_LISTBOX1*/)->dwStyle & 0x00020000L/*WS_VISIBLE*/)?0x00100000L/*WS_MOUSEOVER*/:0),pWnd->szText,pWnd->hFont);
break;
case 5/* WM_MOUSEENTER*/:
case 4/*WM_MOUSELEAVE*/:
Invalidate(hWnd);
break;
case 7/*WM_LBUTTONUP*/:
ReleaseCapture();
STYLEMINUS(pWnd->dwStyle,0x0000200L/*DFCS_PUSHED*/);
if(bMouseOver && !(GetWindow(8/*IDC_LISTBOX1*/)->dwStyle & 0x00020000L/*WS_VISIBLE*/)){
ShowWindow(8/*IDC_LISTBOX1*/,1);
SetFocus(8/*IDC_LISTBOX1*/);
Invalidate(8/*IDC_LISTBOX1*/);
}
else {Invalidate(hWnd);}
break;
case 1/*WM_LBUTTONDOWN*/:
SetCapture(hWnd);
pWnd->dwStyle |=0x0000200L/*DFCS_PUSHED*/;
Invalidate(hWnd);
break;
case 3/* WM_MOUSEMOVE*/:
break;
case 12 /*WM_KILLFOCUS*/:
if(lParam != 8/*IDC_LISTBOX1*/)ShowWindow(8/*IDC_LISTBOX1*/,0);
case 11/*WM_SETFOCUS*/:
Invalidate(hWnd);
break;
}
}
else if(nType == 12/*DFC_DIALOG*/){
Dialog__WndProc(hWnd,nMessage,lParam,wParam);
}
else if(nType == 9/*DFC_LISTBOX*/){
switch(nMessage){
case 8/*WM_PAINT*/ :
if(wParam != -2)DrawFrameControl(&Rect,nType,pWnd->dwStyle|((m_ObjectWithFocus == hWnd) ?0x00400000L/*WS_FOCUS*/:0),pWnd->szText,pWnd->hFont);
//ListBox__DrawItems(hWnd,-1);
if(pWnd->misc < 0)pWnd->misc=0;
int ig,ia=(Rect.bottom- Rect.top-2)/15;
for(ig = 0; ig < ia && ig < pWnd->lParam;ig++){
ListBox__DrawItems(hWnd,ig);
}
break;
case 7/*WM_LBUTTONUP*/:
if(dwStyle & 0x00000001L /*SC_CAPTURE_TOP*/ || dwStyle & 0x00000002L /*SC_CAPTURE_BOTTOM*/ || dwStyle & 0x00000004L/*SC_CAPTURE_MIDDLE*/){
if(dwStyle &0x00000008L /*SC_MOUSEOVER*/){
RECT sl;sl.left = Rect.right - 18;sl.right = Rect.right-2;
char bRedraw = 0;
if(dwStyle & 0x00000001L /*SC_CAPTURE_TOP*/){
if(pWnd->misc > 0){pWnd->misc--;bRedraw=1;}
sl.top = Rect.top+2;sl.bottom=Rect.top+19;
DrawFrameControl(&sl,3/*DFC_SCROLL*/,0x0000010L/*DFCS_SCROLLUP*/|0x00100000L/*WS_MOUSEOVER*/,0,0);
}
else if(dwStyle & 0x00000002L /*SC_CAPTURE_BOTTOM*/){
if((pWnd->misc+((Rect.bottom- Rect.top-2)/15)) < pWnd->lParam){pWnd->misc++;bRedraw=1;}
sl.top = Rect.bottom-19;sl.bottom=Rect.bottom-2;
DrawFrameControl(&sl,3/*DFC_SCROLL*/,0x0000020L/*DFCS_SCROLLDOWN*/|0x00100000L/*WS_MOUSEOVER*/,0,0);
}
if(bRedraw)SendMessage(hWnd,8/*WM_PAINT*/ ,-1,-2);
}
STYLEMINUS(pWnd->dwStyle,0x00000001L /*SC_CAPTURE_TOP*/);
STYLEMINUS(pWnd->dwStyle,0x00000002L /*SC_CAPTURE_BOTTOM*/);
STYLEMINUS(pWnd->dwStyle,0x00000004L/*SC_CAPTURE_MIDDLE*/);
}
STYLEMINUS(pWnd->dwStyle,0x00000008L /*SC_MOUSEOVER*/);
ReleaseCapture();
break;
case 1/*WM_LBUTTONDOWN*/:
if(MouseEvent.X > Rect.right - 19 || MouseEvent.Y > Rect.bottom-2 ){
RECT scrollrect;scrollrect.left = Rect.right - 18;scrollrect.right = Rect.right-2;
if(MouseEvent.Y < Rect.top+20){pWnd->dwStyle|= 0x00000001L /*SC_CAPTURE_TOP*/|0x00000008L /*SC_MOUSEOVER*/;
scrollrect.top = Rect.top+2;scrollrect.bottom=Rect.top+19;
DrawFrameControl(&scrollrect,3/*DFC_SCROLL*/,0x0000010L/*DFCS_SCROLLUP*/|0x0000200L/*DFCS_PUSHED*/|0x00100000L/*WS_MOUSEOVER*/,0,0);
}
else if(MouseEvent.Y > Rect.bottom-20){pWnd->dwStyle|= 0x00000002L /*SC_CAPTURE_BOTTOM*/|0x00000008L /*SC_MOUSEOVER*/;
scrollrect.top = Rect.bottom-19;scrollrect.bottom=Rect.bottom-2;
DrawFrameControl(&scrollrect,3/*DFC_SCROLL*/,0x0000020L/*DFCS_SCROLLDOWN*/|0x0000200L/*DFCS_PUSHED*/|0x00100000L/*WS_MOUSEOVER*/,0,0);
}
else {pWnd->dwStyle|= 0x00000004L/*SC_CAPTURE_MIDDLE*/;}
}
else {
int nTop= MouseEvent.Y- Rect.top-2;
int nLeft = MouseEvent.X - Rect.left;
nTop = nTop / 15;
if(!(pWnd->lParam <= nTop)){
if(pWnd->misc2 != nTop){
int mistmp = pWnd->misc2;
if(pWnd->lParam <= nTop)nTop=-1;
pWnd->misc2 = nTop;
if(mistmp > -1)ListBox__DrawItems(hWnd,mistmp);
if(nTop > -1)ListBox__DrawItems(hWnd,nTop);
}
if(GetWindow(hWnd-1)->nType == 8/*DFC_COMBOBOX*/ && dwStyle & 0x00000400L /*LV_AUTOSELECT*/){
ShowWindow(hWnd,0);
SetWindowText(hWnd-1,Diagram__GetCell(ListBox__GetCurSel(hWnd))->ClassName);
}
SendMessage(0,9 /*WM_COMMAND*/,201/*LV_ITEMCLICK*/,hWnd);
if(GetWindow(hWnd-1)->nType == 8/*DFC_COMBOBOX*/ && dwStyle & 0x00000400L /*LV_AUTOSELECT*/){
pWnd->misc2=-1;
}
break;
}
}
SetCapture(hWnd);
break;
case 12 /*WM_KILLFOCUS*/:
if(GetWindow(hWnd-1)->nType == 8/*DFC_COMBOBOX*/ && dwStyle & 0x00000400L /*LV_AUTOSELECT*/ && lParam != hWnd-1 )ShowWindow(hWnd,0);
break;
case 4/*WM_MOUSELEAVE*/:
if(!(dwStyle & 0x00000400L /*LV_AUTOSELECT*/))break;
int hh = pWnd->misc2;pWnd->misc2=-1;
if(hh > -1){ListBox__DrawItems(hWnd,hh);}
if(GetWindow(hWnd-1)->nType == 8/*DFC_COMBOBOX*/ && dwStyle & 0x00000400L /*LV_AUTOSELECT*/ )Invalidate(7/*IDC_COMBOBOX1*/);
break;
case 3/* WM_MOUSEMOVE*/:
if(dwStyle & 0x00000001L /*SC_CAPTURE_TOP*/ || dwStyle & 0x00000002L /*SC_CAPTURE_BOTTOM*/ || dwStyle & 0x00000004L/*SC_CAPTURE_MIDDLE*/){
RECT nrect;
long nState = 0x0000200L/*DFCS_PUSHED*/;
nrect.left = Rect.right - 18;nrect.right = Rect.right-2;
if(dwStyle & 0x00000001L /*SC_CAPTURE_TOP*/){
nrect.top = Rect.top+2;nrect.bottom=Rect.top+19;
nState|=0x0000010L/*DFCS_SCROLLUP*/;
}
if(dwStyle & 0x00000002L /*SC_CAPTURE_BOTTOM*/){
nrect.top = Rect.bottom-19;nrect.bottom=Rect.bottom-2;
nState|=0x0000020L/*DFCS_SCROLLDOWN*/;
}
if(PtInRect(MouseEvent.X,MouseEvent.Y,&nrect)){
if(!(dwStyle & 0x00000008L /*SC_MOUSEOVER*/)){
pWnd->dwStyle|=0x00000008L /*SC_MOUSEOVER*/;
nState|=0x00100000L/*WS_MOUSEOVER*/;
DrawFrameControl(&nrect,3/*DFC_SCROLL*/,nState,0,0);
}
}
else if(dwStyle & 0x00000008L /*SC_MOUSEOVER*/){
STYLEMINUS(pWnd->dwStyle,0x00000008L /*SC_MOUSEOVER*/);
DrawFrameControl(&nrect,3/*DFC_SCROLL*/,nState,0,0);
}
}
if((dwStyle & 0x00000400L /*LV_AUTOSELECT*/)){
if(MouseEvent.X > Rect.right - 19 || MouseEvent.Y > Rect.bottom-2){
int hh = pWnd->misc2;pWnd->misc2=-1;
if(hh != -1){ListBox__DrawItems(hWnd,hh);}
break;
}
int nTop= MouseEvent.Y- Rect.top-2;
int nLeft = MouseEvent.X - Rect.left;
nTop = nTop / 15;
if(pWnd->misc2 != nTop){
int mistmp = pWnd->misc2;
if(pWnd->lParam <= nTop)nTop=-1;
pWnd->misc2 = nTop;
if(mistmp > -1)ListBox__DrawItems(hWnd,mistmp);
if(nTop > -1)ListBox__DrawItems(hWnd,nTop);
}
}
break;
case 16 /* WM_SHOWWINDOW */:
if(GetWindow(hWnd-1)->nType == 8/*DFC_COMBOBOX*/ && dwStyle & 0x00000400L /*LV_AUTOSELECT*/){
if(lParam == 0){
GrKresliP²edm╪ty(16001,0,Rect.left,Rect.top,7,9);
ListBox__DeleteAll(hWnd);
Invalidate(hWnd-1);
}
else {
GrNastavObrazP²edm╪tà(16001,Rect.left,Rect.top,7,9,1);
int iCell = 0;
for(; iCell < m_nm_DiagramCellsSize;iCell++){
ListBox__AddItem(hWnd,iCell,Diagram__GetCell(iCell)->ClassName);
}
if(pWnd->misc < 0)pWnd->misc=0;
if(pWnd->misc >= pWnd->lParam)pWnd->misc=0;
}
}
}
}
}
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
;-h---------------------------------------------------------------------------
void main( void )
-s--DESINGER_MAIN_FUNCTION ■ 4 -2 -35 3
DESIGNER
1!
-o1----------------------SEZNAM OPERAC╓------------TENTO ⁿ╡DEK NEM╖NIT!-------
1
#ifndef _DEBUG
EscPlus();
#endif
NoXP = (DOSArgument(1) == "-noxp");
UnderXP = DOSVerze() == 5;
_UNDER_WINDOWS_2k=( UnderXP && !NoXP);
if(GrNastavMód((_UNDER_WINDOWS_2k)?2:3)==-1){KERNELSTOP(2);return;}
#ifndef _DEBUG
GrNaƒtiPaletu("*\\designer.dir\\common\\bitmap\\splash.pal");
GrNastavV∞stup(2);
MyτZaƒátekObsluhy();
AnimNastavGrV∞stup(2);
MouseObject = AnimP²edm╪tVytvo²(85,1,0,1);
if( _UNDER_WINDOWS_2k)
GrKresliP²edm╪ty(20001,0,110,80,11,10);
else
GrKresliP²edm╪ty(20001,0,196,155,11,10);
#else
GrNastavV∞stup(2);
MyτZaƒátekObsluhy();
AnimNastavGrV∞stup(2);
MouseObject = AnimP²edm╪tVytvo²(85,1,0,1);
#endif
// check atributes
if(SouborAtributy("*\\DESIGN.B17") &0x01 || SouborAtributy("*\\DESIGN.B16") &0x01) {
SouborNastavAtributy("*\\DESIGN.B17",0x20);
SouborNastavAtributy("*\\DESIGN.B16",0x20);
if (DOSChyba()){
KERNELSTOP(1);
}
}
// fonts ...
//tahoma 8
LoadFont("*\\DESIGNER.DIR\\GDI\\ta.bin",m_Tahoma8Height);
LoadFont("*\\DESIGNER.DIR\\GDI\\tait.bin",m_TahomaItalic8Height);
LoadFont("*\\DESIGNER.DIR\\GDI\\tabo.bin",m_TahomaBold8Height);
LoadFont("*\\DESIGNER.DIR\\GDI\\taboit.bin",m_TahomaBoldItalic8Height);
// arial 10
LoadFont("*\\DESIGNER.DIR\\GDI\\arbo.bin",m_ArialBold10Height);
LoadFont("*\\DESIGNER.DIR\\GDI\\arboit.bin",m_ArialBoldItalic10Height);
InitCell(&m_MEMORY_CELL);
SetPoint((POINT*)&m_StartDrag,-10,-10);
InitControl();
InitMenu();
#ifdef _XP_THEME
GrNastavBarvuPalety(1,55,54,53);
FillSolidRect2(0,0,GrMaxX(),32,1);
#else
GrNastavBarvuPalety(0,53,52,50);
FillSolidRect2(0,0,GrMaxX(),32,0);
#endif
GrNastavBarvuPalety(5,63,63,63);
FillSolidRect2(0,32,GrMaxX(),GrMaxY(),5);
if(!m_LastedMessage){
if(UnderXP && NoXP)
MyτNastavPozici(320,100);
else
MyτNastavPozici(GrMaxX()/2,GrMaxY()/2);
AnimMouse();
ApplyLayout();
#ifdef _DEBUG
strOpenFile="*\\designer.umd";
SendMessage(DESKTOP,WM_COMMAND,1/*BN_CLICK*/,/*IDC_FILE_OPENING*/ 208);
#else
if(DOSPoƒetArgumentà() >= 1)
strOpenFile=DOSArgument(1);
SendMessage(DESKTOP,WM_COMMAND,1/*BN_CLICK*/,/*IDC_FILE_OPENING*/ 208);
#endif
while(!m_LastedMessage){
KERNEL(); // KERNEL function
}
}
else {KERNELSTOP(1);}
-c1----------------------SEZNAM PODM╓NEK-----------TENTO ⁿ╡DEK NEM╖NIT!-------
=SP---------------------------------------------------------------------------
// Konec souboru
/*DESIGNER.SGP ===== End =====================*/