[Dda-cvs] ntdda/src/win32gui blockdialog.c, NONE, 1.1 arcdialog.c, 1.1, 1.2 drawdialog.c, 1.10, 1.1
Status: Beta
Brought to you by:
doolin
From: Roozbeh <rgr...@us...> - 2006-12-10 16:29:57
|
Update of /cvsroot/dda/ntdda/src/win32gui In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv23216 Modified Files: arcdialog.c drawdialog.c jointdialog.c tunneldialog.c Added Files: blockdialog.c Log Message: Arc subroutine is added into separated file Index: jointdialog.c =================================================================== RCS file: /cvsroot/dda/ntdda/src/win32gui/jointdialog.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** jointdialog.c 25 Nov 2006 17:11:28 -0000 1.2 --- jointdialog.c 10 Dec 2006 16:29:50 -0000 1.3 *************** *** 1,10 **** #define STRICT #include<windows.h> #include"resource.h" #include "drawdialog.h" - //#include "joint.h" #include"math.h" - //#include "winmain.h" #ifdef __cplusplus --- 1,9 ---- + // Added by Roozbeh #define STRICT #include<windows.h> #include"resource.h" #include "drawdialog.h" #include"math.h" #ifdef __cplusplus *************** *** 18,22 **** extern addJoint (hDlg); - // Added by Roozbeh to Draw a Joint using dialog box BOOL CALLBACK JointDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) --- 17,20 ---- Index: tunneldialog.c =================================================================== RCS file: /cvsroot/dda/ntdda/src/win32gui/tunneldialog.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tunneldialog.c 1 Aug 2006 06:16:28 -0000 1.1 --- tunneldialog.c 10 Dec 2006 16:29:50 -0000 1.2 *************** *** 1,5 **** ! /** ! * Refactor tunnel dialog code here. ! */ \ No newline at end of file --- 1,91 ---- + // Added by Roozbeh + #define STRICT + #include<windows.h> + #include"resource.h" + #include "drawdialog.h" + #include"math.h" ! #ifdef __cplusplus ! extern "C" { ! #endif ! #if 0 ! } ! #endif ! ! extern addJoint (hDlg); ! ! BOOL CALLBACK ! TunnelDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) ! { ! double r0, u, v, x1, x2, x3, y1, y2, y3, x0, y0, deg; ! double xc, yc, rad; ! int i, se = 20; ! ! extern POINT ptBegin, ptNew, ptOld; ! extern int type; ! extern double ScaleX, ScaleY; ! extern int maxSize; ! extern JOINTLIST *jointlist; ! ! switch (message) { ! case WM_INITDIALOG: ! ! SetDlgItemInt (hDlg, IDC_XC, 0, FALSE); ! SetDlgItemInt (hDlg, IDC_YC, 0, FALSE); ! SetDlgItemInt (hDlg, IDC_SEG, 20, FALSE); ! SetDlgItemInt (hDlg, IDC_RAD, 10, FALSE); ! SetDlgItemInt (hDlg, IDC_TYPE, 1, FALSE); ! ! return TRUE; ! ! case WM_COMMAND: ! switch (LOWORD (wParam)) { ! case IDOK: ! ! deg = 360; ! r0 = ((3.1415926535) * deg) / (se * 180); ! xc = GetDlgItemInt (hDlg, IDC_XC, NULL, TRUE); ! yc = GetDlgItemInt (hDlg, IDC_YC, NULL, TRUE); ! se = GetDlgItemInt (hDlg, IDC_SEG, NULL, TRUE); ! rad = GetDlgItemInt (hDlg, IDC_RAD, NULL, TRUE); ! type = GetDlgItemInt (hDlg, IDC_TYPE, NULL, TRUE); ! x1 = xc + rad; ! y1 = yc; ! x2 = xc; ! y2 = yc; ! x0 = x2; ! y0 = y2; ! x3 = x1; ! y3 = y1; ! for (i = 1; i < se; i++) { ! u = ((x1 - x0) * (cos (r0) - 1)) - ((y1 - y0) * sin (r0)); ! v = ((x1 - x0) * sin (r0)) + ((y1 - y0) * (cos (r0) - 1)); ! ! x2 = x1 + u; ! y2 = y1 + v; ! ptBegin.x = (long) floor (x1 / (ScaleX / maxSize)); ! ptBegin.y = (long) floor (y1 / (ScaleY / maxSize)); ! ptNew.x = (long) floor (x2 / (ScaleX / maxSize)); ! ptNew.y = (long) floor (y2 / (ScaleY / maxSize)); ! addJoint (hDlg); ! x1 = x2; ! y1 = y2; ! } ! x2 = x3; ! y2 = y3; ! ptBegin.x = (long) floor (x1 / (ScaleX / maxSize)); ! ptBegin.y = (long) floor (y1 / (ScaleY / maxSize)); ! ptNew.x = (long) floor (x2 / (ScaleX / maxSize)); ! ptNew.y = (long) floor (y2 / (ScaleY / maxSize)); ! addJoint (hDlg); ! ! return FALSE; ! case IDCANCEL: ! EndDialog (hDlg, 0); ! return TRUE; ! } ! break; ! } ! return FALSE; ! } \ No newline at end of file Index: arcdialog.c =================================================================== RCS file: /cvsroot/dda/ntdda/src/win32gui/arcdialog.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** arcdialog.c 1 Aug 2006 06:16:28 -0000 1.1 --- arcdialog.c 10 Dec 2006 16:29:50 -0000 1.2 *************** *** 1,5 **** ! /** ! * ! * Add arc dialog code, like message handling, here. ! */ \ No newline at end of file --- 1,104 ---- + // Added by Roozbeh + #define STRICT + #include<windows.h> + #include"resource.h" + #include "drawdialog.h" + #include"math.h" ! ! #ifdef __cplusplus ! extern "C" { ! #endif ! #if 0 ! } ! #endif ! ! ! extern addJoint (hDlg); ! ! // Added by Roozbeh to Draw a Arc using dialog box ! ! // Refactor all these messages to call functions. ! // Feel free to put them into new files. It will ! // make it easier to maintain in the future. ! BOOL CALLBACK ! ArcDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) ! { ! double r0, u, v, x1, x2, x3, y1, y2, y3, x0, y0, deg; ! double xc, yc, xs, ys, xe, ye; ! int i, se = 20; ! ! extern POINT ptBegin, ptNew, ptOld; ! extern int type; ! extern double ScaleX, ScaleY; ! extern int maxSize; ! extern JOINTLIST *jointlist; ! ! switch (message) { ! case WM_INITDIALOG: ! ! SetDlgItemInt (hDlg, IDC_XC, 0, FALSE); ! SetDlgItemInt (hDlg, IDC_YC, 0, FALSE); ! SetDlgItemInt (hDlg, IDC_XS, 0, FALSE); ! SetDlgItemInt (hDlg, IDC_YS, 0, FALSE); ! SetDlgItemInt (hDlg, IDC_XE, 0, FALSE); ! SetDlgItemInt (hDlg, IDC_YE, 0, FALSE); ! SetDlgItemInt (hDlg, IDC_SEG, 20, FALSE); ! SetDlgItemInt (hDlg, IDC_DEG, 180, FALSE); ! SetDlgItemInt (hDlg, IDC_TYPE, 1, FALSE); ! ! return TRUE; ! ! case WM_COMMAND: ! switch (LOWORD (wParam)) { ! case IDOK: ! ! xc = GetDlgItemInt (hDlg, IDC_XC, NULL, TRUE); ! yc = GetDlgItemInt (hDlg, IDC_YC, NULL, TRUE); ! xs = GetDlgItemInt (hDlg, IDC_XS, NULL, TRUE); ! ys = GetDlgItemInt (hDlg, IDC_YS, NULL, TRUE); ! xe = GetDlgItemInt (hDlg, IDC_XE, NULL, TRUE); ! ye = GetDlgItemInt (hDlg, IDC_YE, NULL, TRUE); ! se = GetDlgItemInt (hDlg, IDC_SEG, NULL, TRUE); ! deg = GetDlgItemInt (hDlg, IDC_DEG, NULL, TRUE); ! type = GetDlgItemInt (hDlg, IDC_TYPE, NULL, TRUE); ! r0 = ((3.1415926535) * deg) / (se * 180); ! x1 = xs; ! y1 = ys; ! x2 = xc; ! y2 = yc; ! x0 = x2; ! y0 = y2; ! x3 = xe; ! y3 = ye; ! for (i = 1; i < se; i++) { ! u = ((x1 - x0) * (cos (r0) - 1)) - ((y1 - y0) * sin (r0)); ! v = ((x1 - x0) * sin (r0)) + ((y1 - y0) * (cos (r0) - 1)); ! ! x2 = x1 + u; ! y2 = y1 + v; ! ptBegin.x = (long) floor (x1 / (ScaleX / maxSize)); ! ptBegin.y = (long) floor (y1 / (ScaleY / maxSize)); ! ptNew.x = (long) floor (x2 / (ScaleX / maxSize)); ! ptNew.y = (long) floor (y2 / (ScaleY / maxSize)); ! addJoint (hDlg); ! x1 = x2; ! y1 = y2; ! } ! x2 = x3; ! y2 = y3; ! ptBegin.x = (long) floor (x1 / (ScaleX / maxSize)); ! ptBegin.y = (long) floor (y1 / (ScaleY / maxSize)); ! ptNew.x = (long) floor (x2 / (ScaleX / maxSize)); ! ptNew.y = (long) floor (y2 / (ScaleY / maxSize)); ! addJoint (hDlg); ! ! return FALSE; ! case IDCANCEL: ! EndDialog (hDlg, 0); ! return TRUE; ! } ! break; ! } ! return FALSE; ! } \ No newline at end of file Index: drawdialog.c =================================================================== RCS file: /cvsroot/dda/ntdda/src/win32gui/drawdialog.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** drawdialog.c 25 Nov 2006 17:11:28 -0000 1.10 --- drawdialog.c 10 Dec 2006 16:29:50 -0000 1.11 *************** *** 1479,1696 **** } /* close handleMouseUp() */ - // Added by Roozbeh to Draw a Tuunel using dialog box - BOOL CALLBACK - TunnelDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) - { - double r0, u, v, x1, x2, x3, y1, y2, y3, x0, y0, deg; - double xc, yc, rad; - int i, se = 20; - - switch (message) { - case WM_INITDIALOG: - - SetDlgItemInt (hDlg, IDC_XC, 0, FALSE); - SetDlgItemInt (hDlg, IDC_YC, 0, FALSE); - SetDlgItemInt (hDlg, IDC_SEG, 20, FALSE); - SetDlgItemInt (hDlg, IDC_RAD, 10, FALSE); - SetDlgItemInt (hDlg, IDC_TYPE, 1, FALSE); - - return TRUE; - - case WM_COMMAND: - switch (LOWORD (wParam)) { - case IDOK: - - deg = 360; - r0 = ((3.1415926535) * deg) / (se * 180); - xc = GetDlgItemInt (hDlg, IDC_XC, NULL, TRUE); - yc = GetDlgItemInt (hDlg, IDC_YC, NULL, TRUE); - se = GetDlgItemInt (hDlg, IDC_SEG, NULL, TRUE); - rad = GetDlgItemInt (hDlg, IDC_RAD, NULL, TRUE); - type = GetDlgItemInt (hDlg, IDC_TYPE, NULL, TRUE); - x1 = xc + rad; - y1 = yc; - x2 = xc; - y2 = yc; - x0 = x2; - y0 = y2; - x3 = x1; - y3 = y1; - for (i = 1; i < se; i++) { - u = ((x1 - x0) * (cos (r0) - 1)) - ((y1 - y0) * sin (r0)); - v = ((x1 - x0) * sin (r0)) + ((y1 - y0) * (cos (r0) - 1)); - - x2 = x1 + u; - y2 = y1 + v; - ptBegin.x = (long) floor (x1 / (ScaleX / maxSize)); - ptBegin.y = (long) floor (y1 / (ScaleY / maxSize)); - ptNew.x = (long) floor (x2 / (ScaleX / maxSize)); - ptNew.y = (long) floor (y2 / (ScaleY / maxSize)); - addJoint (hDlg); - x1 = x2; - y1 = y2; - } - x2 = x3; - y2 = y3; - ptBegin.x = (long) floor (x1 / (ScaleX / maxSize)); - ptBegin.y = (long) floor (y1 / (ScaleY / maxSize)); - ptNew.x = (long) floor (x2 / (ScaleX / maxSize)); - ptNew.y = (long) floor (y2 / (ScaleY / maxSize)); - addJoint (hDlg); - - return FALSE; - case IDCANCEL: - EndDialog (hDlg, 0); - return TRUE; - } - break; - } - return FALSE; - } - - - - // Added by Roozbeh to Draw a Arc using dialog box - - // Refactor all these messages to call functions. - // Feel free to put them into new files. It will - // make it easier to maintain in the future. - BOOL CALLBACK - ArcDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) - { - double r0, u, v, x1, x2, x3, y1, y2, y3, x0, y0, deg; - double xc, yc, xs, ys, xe, ye; - int i, se = 20; - - switch (message) { - case WM_INITDIALOG: - - SetDlgItemInt (hDlg, IDC_XC, 0, FALSE); - SetDlgItemInt (hDlg, IDC_YC, 0, FALSE); - SetDlgItemInt (hDlg, IDC_XS, 0, FALSE); - SetDlgItemInt (hDlg, IDC_YS, 0, FALSE); - SetDlgItemInt (hDlg, IDC_XE, 0, FALSE); - SetDlgItemInt (hDlg, IDC_YE, 0, FALSE); - SetDlgItemInt (hDlg, IDC_SEG, 20, FALSE); - SetDlgItemInt (hDlg, IDC_DEG, 180, FALSE); - SetDlgItemInt (hDlg, IDC_TYPE, 1, FALSE); - - return TRUE; - - case WM_COMMAND: - switch (LOWORD (wParam)) { - case IDOK: - - xc = GetDlgItemInt (hDlg, IDC_XC, NULL, TRUE); - yc = GetDlgItemInt (hDlg, IDC_YC, NULL, TRUE); - xs = GetDlgItemInt (hDlg, IDC_XS, NULL, TRUE); - ys = GetDlgItemInt (hDlg, IDC_YS, NULL, TRUE); - xe = GetDlgItemInt (hDlg, IDC_XE, NULL, TRUE); - ye = GetDlgItemInt (hDlg, IDC_YE, NULL, TRUE); - se = GetDlgItemInt (hDlg, IDC_SEG, NULL, TRUE); - deg = GetDlgItemInt (hDlg, IDC_DEG, NULL, TRUE); - type = GetDlgItemInt (hDlg, IDC_TYPE, NULL, TRUE); - r0 = ((3.1415926535) * deg) / (se * 180); - x1 = xs; - y1 = ys; - x2 = xc; - y2 = yc; - x0 = x2; - y0 = y2; - x3 = xe; - y3 = ye; - for (i = 1; i < se; i++) { - u = ((x1 - x0) * (cos (r0) - 1)) - ((y1 - y0) * sin (r0)); - v = ((x1 - x0) * sin (r0)) + ((y1 - y0) * (cos (r0) - 1)); - - x2 = x1 + u; - y2 = y1 + v; - ptBegin.x = (long) floor (x1 / (ScaleX / maxSize)); - ptBegin.y = (long) floor (y1 / (ScaleY / maxSize)); - ptNew.x = (long) floor (x2 / (ScaleX / maxSize)); - ptNew.y = (long) floor (y2 / (ScaleY / maxSize)); - addJoint (hDlg); - x1 = x2; - y1 = y2; - } - x2 = x3; - y2 = y3; - ptBegin.x = (long) floor (x1 / (ScaleX / maxSize)); - ptBegin.y = (long) floor (y1 / (ScaleY / maxSize)); - ptNew.x = (long) floor (x2 / (ScaleX / maxSize)); - ptNew.y = (long) floor (y2 / (ScaleY / maxSize)); - addJoint (hDlg); - - return FALSE; - case IDCANCEL: - EndDialog (hDlg, 0); - return TRUE; - } - break; - } - return FALSE; - } - - // Added by Roozbeh to Draw a Block using dialog box - BOOL CALLBACK - BlockDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) - { - double xl, yl, xu, yu; - - switch (message) { - case WM_INITDIALOG: - - SetDlgItemInt (hDlg, IDC_XL, 0, FALSE); - SetDlgItemInt (hDlg, IDC_YL, 0, FALSE); - SetDlgItemInt (hDlg, IDC_XU, 0, FALSE); - SetDlgItemInt (hDlg, IDC_YU, 0, FALSE); - SetDlgItemInt (hDlg, IDC_TYPE, 1, FALSE); - - return TRUE; - - case WM_COMMAND: - switch (LOWORD (wParam)) { - case IDOK: - - xl = GetDlgItemInt (hDlg, IDC_XL, NULL, TRUE); - yl = GetDlgItemInt (hDlg, IDC_YL, NULL, TRUE); - xu = GetDlgItemInt (hDlg, IDC_XU, NULL, TRUE); - yu = GetDlgItemInt (hDlg, IDC_YU, NULL, TRUE); - type = GetDlgItemInt (hDlg, IDC_TYPE, NULL, TRUE); - - ptBegin.x = (long) floor (xl / (ScaleX / maxSize)); - ptBegin.y = (long) floor (yl / (ScaleY / maxSize)); - ptNew.x = (long) floor (xu / (ScaleX / maxSize)); - ptNew.y = (long) floor (yl / (ScaleY / maxSize)); - addJoint (hDlg); - - ptBegin.x = (long) floor (xu / (ScaleX / maxSize)); - ptBegin.y = (long) floor (yl / (ScaleY / maxSize)); - ptNew.x = (long) floor (xu / (ScaleX / maxSize)); - ptNew.y = (long) floor (yu / (ScaleY / maxSize)); - addJoint (hDlg); - - ptBegin.x = (long) floor (xu / (ScaleX / maxSize)); - ptBegin.y = (long) floor (yu / (ScaleY / maxSize)); - ptNew.x = (long) floor (xl / (ScaleX / maxSize)); - ptNew.y = (long) floor (yu / (ScaleY / maxSize)); - addJoint (hDlg); - - ptBegin.x = (long) floor (xl / (ScaleX / maxSize)); - ptBegin.y = (long) floor (yu / (ScaleY / maxSize)); - ptNew.x = (long) floor (xl / (ScaleX / maxSize)); - ptNew.y = (long) floor (yl / (ScaleY / maxSize)); - addJoint (hDlg); - - return FALSE; - case IDCANCEL: - EndDialog (hDlg, 0); - return TRUE; - } - break; - } - return FALSE; - } - static int handleWMCommand (HWND hDlg, UINT iMessage, LPARAM lParam, WPARAM wParam) --- 1479,1482 ---- *************** *** 1761,1777 **** //Added by Roozbeh case IDC_JOINT: ! DialogBox (hInstance, MAKEINTRESOURCE (IDD_JOINT), NULL, JointDlgProc); break; case IDC_TUNNEL: ! DialogBox (hInstance, MAKEINTRESOURCE (IDD_TUNNEL), NULL, TunnelDlgProc); break; case IDC_ARC: ! DialogBox (hInstance, MAKEINTRESOURCE (IDD_ARC), NULL, ArcDlgProc); break; case IDC_BLOCK: ! DialogBox (hInstance, MAKEINTRESOURCE (IDD_BLOCK), NULL, BlockDlgProc); break; //Added by Roozbeh --- 1547,1563 ---- //Added by Roozbeh case IDC_JOINT: ! DialogBox (hInstance, MAKEINTRESOURCE (IDD_JOINT), hDlg, JointDlgProc); break; case IDC_TUNNEL: ! DialogBox (hInstance, MAKEINTRESOURCE (IDD_TUNNEL), hDlg, TunnelDlgProc); break; case IDC_ARC: ! DialogBox (hInstance, MAKEINTRESOURCE (IDD_ARC), hDlg, ArcDlgProc); break; case IDC_BLOCK: ! DialogBox (hInstance, MAKEINTRESOURCE (IDD_BLOCK), hDlg, BlockDlgProc); break; //Added by Roozbeh --- NEW FILE: blockdialog.c --- // Added by Roozbeh #define STRICT #include<windows.h> #include"resource.h" #include "drawdialog.h" #include"math.h" #ifdef __cplusplus extern "C" { #endif #if 0 } #endif extern addJoint (hDlg); BOOL CALLBACK BlockDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { double xl, yl, xu, yu; extern POINT ptBegin, ptNew, ptOld; extern int type; extern double ScaleX, ScaleY; extern int maxSize; extern JOINTLIST *jointlist; switch (message) { case WM_INITDIALOG: SetDlgItemInt (hDlg, IDC_XL, 0, FALSE); SetDlgItemInt (hDlg, IDC_YL, 0, FALSE); SetDlgItemInt (hDlg, IDC_XU, 0, FALSE); SetDlgItemInt (hDlg, IDC_YU, 0, FALSE); SetDlgItemInt (hDlg, IDC_TYPE, 1, FALSE); return TRUE; case WM_COMMAND: switch (LOWORD (wParam)) { case IDOK: xl = GetDlgItemInt (hDlg, IDC_XL, NULL, TRUE); yl = GetDlgItemInt (hDlg, IDC_YL, NULL, TRUE); xu = GetDlgItemInt (hDlg, IDC_XU, NULL, TRUE); yu = GetDlgItemInt (hDlg, IDC_YU, NULL, TRUE); type = GetDlgItemInt (hDlg, IDC_TYPE, NULL, TRUE); ptBegin.x = (long) floor (xl / (ScaleX / maxSize)); ptBegin.y = (long) floor (yl / (ScaleY / maxSize)); ptNew.x = (long) floor (xu / (ScaleX / maxSize)); ptNew.y = (long) floor (yl / (ScaleY / maxSize)); addJoint (hDlg); ptBegin.x = (long) floor (xu / (ScaleX / maxSize)); ptBegin.y = (long) floor (yl / (ScaleY / maxSize)); ptNew.x = (long) floor (xu / (ScaleX / maxSize)); ptNew.y = (long) floor (yu / (ScaleY / maxSize)); addJoint (hDlg); ptBegin.x = (long) floor (xu / (ScaleX / maxSize)); ptBegin.y = (long) floor (yu / (ScaleY / maxSize)); ptNew.x = (long) floor (xl / (ScaleX / maxSize)); ptNew.y = (long) floor (yu / (ScaleY / maxSize)); addJoint (hDlg); ptBegin.x = (long) floor (xl / (ScaleX / maxSize)); ptBegin.y = (long) floor (yu / (ScaleY / maxSize)); ptNew.x = (long) floor (xl / (ScaleX / maxSize)); ptNew.y = (long) floor (yl / (ScaleY / maxSize)); addJoint (hDlg); return FALSE; case IDCANCEL: EndDialog (hDlg, 0); return TRUE; } break; } return FALSE; } |