home *** CD-ROM | disk | FTP | other *** search
- //lRegen_FileHeading
- //lRegen_FileHeading
-
- /********************************************************************
- *
- * Source File: addrelat.c
- * Author:
- * Module:
- * Program Desc:
- * Date: Mon Feb 19 13:11:39 1996
- * Language: ANSI C
- *
- ********************************************************************/
-
- #include ".\idoiface.h"
-
-
- //lRegen_Variables
- //lRegen_Variables
-
- VIEW hViewaddrelation;
- HWND hWndaddrelation;
- LRESULT CALLBACK EXPORT fnaddrelationWndProc(HWND, UINT, WPARAM, LPARAM);
-
- int fnaddrelation(HWND hParentWnd, UINT iData, void FAR *lpData)
- {
- int ReturnCode;
-
- //lRegen_BeginFunction
- //lRegen_BeginFunction
-
- //lRegen_InitDlg
- //lRegen_InitDlg
-
- if(NULL == (hViewaddrelation = vwCreateView(hInstance,
- MAKEINTRESOURCE(addrelation),
- hParentWnd,
- (VIEWPROC)fnaddrelationWndProc,
- NULL)))
- {
- //lRegen_Create
- //lRegen_Create
- return FALSE;
- }
- //lRegen_InitView
- //lRegen_InitView
- if((ReturnCode = vwShowModalView(hViewaddrelation)) == -1)
- {
- MessageBox(NULL, "Unable to display view", "System Error",
- MB_SYSTEMMODAL | MB_ICONHAND | MB_OK);
- return FALSE;
- }
-
- //lRegen_TermView
- //lRegen_TermView
- return(ReturnCode);
- }
-
- LRESULT CALLBACK EXPORT fnaddrelationWndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
- {
- GETVIEW;
- WORD CtlId;
- WORD Notify;
- HWND CtlWnd;
-
- //lRegen_WindowProcVariables
- //lRegen_WindowProcVariables
-
- switch(uMessage)
- {
- //lRegen_WndProc
- //lRegen_WndProc
-
- case WM_INITDIALOG :
- //lRegen_InitDialogBegin
- {
- HWND hIDO = GetActiveIDO();
- ENTITY entity;
- char szNum[20+1];
- char szClassName[100+1];
-
-
- if(IsWindow(hIDO))
- {
- if(idoIterateEntityFirst(hIDO))
- while(idoIterateEntityNext(hIDO, &entity))
- {
- wsprintf(szNum, "%d", entity.id);
- SendDlgItemMessage(hWnd, IDC_SEID, CB_ADDSTRING, 0, (LPARAM)(LPSTR)szNum);
- SendDlgItemMessage(hWnd, IDC_SENAME, CB_ADDSTRING, 0, (LPARAM)(LPSTR)entity.name);
-
- SendDlgItemMessage(hWnd, IDC_DEID, CB_ADDSTRING, 0, (LPARAM)(LPSTR)szNum);
- SendDlgItemMessage(hWnd, IDC_DENAME, CB_ADDSTRING, 0, (LPARAM)(LPSTR)entity.name);
- }
-
- if(idoIterateRelationClassFirst(hIDO))
- while(idoIterateRelationClassNext(hIDO, (LPSTR)szClassName))
- SendDlgItemMessage(hWnd, IDC_RULE, CB_ADDSTRING, 0, (LPARAM)(LPSTR)szClassName);
- }
- }
- //lRegen_InitDialogBegin
- //Regen_WM_InitDialog
- //Regen_WM_InitDialog
- return TRUE;
-
- case WM_COMMAND :
- #ifdef WIN32
- CtlId = LOWORD(wParam);
- Notify = HIWORD(wParam);
- CtlWnd = (HWND)lParam;
- #else
- CtlId = wParam;
- Notify = HIWORD(lParam);
- CtlWnd = (HWND)LOWORD(lParam);
- #endif
- switch(CtlId)
- {
- case IDOK :
- //Regen_IDOK
- {
- char szE1[50];
- char szE2[50];
- long E1;
- long E2;
- char szName[100];
- char szClass[50];
- char szText[100];
- static long Line;
- char szTemp[50];
-
- GetDlgItemText(hWnd, IDC_SENAME, szE1, 50);
- GetDlgItemText(hWnd, IDC_SEID, szTemp, 50);
- E1 = (long)atol(szTemp);
- GetDlgItemText(hWnd, IDC_DENAME, szE2, 50);
- GetDlgItemText(hWnd, IDC_DEID, szTemp, 50);
- E2 = (long)atol(szTemp);
-
- SendDlgItemMessage(hWnd, IDC_LID, VW_SCRTOAPP, 0, (LPARAM)(LPVOID)&Line);
- GetDlgItemText(hWnd, IDC_LNAME, szName, 50);
- GetDlgItemText(hWnd, IDC_LTEXT, szText, 100);
- GetDlgItemText(hWnd, IDC_RULE, szClass, 50);
-
- /*
- * Add a relation from First Item to Second Item.
- */
- idoAddRelationFromClass(GetActiveIDO(), Line, szName,
- szClass, szText,
- E1, szE1,
- E2, szE2);
-
- }
- //Regen_IDOK
- break;
-
- case IDCANCEL :
- //Regen_IDCANCEL
- //Regen_IDCANCEL
- break;
-
- case IDC_SENAME :
- switch(Notify)
- {
- case CBN_SELCHANGE :
- //Regen_IDC_SENAME_CBN_SELCHANGE
- {
- int index;
-
- index = (int)SendDlgItemMessage(hWnd, IDC_SENAME, CB_GETCURSEL, 0, 0L);
- SendDlgItemMessage(hWnd, IDC_SEID, CB_SETCURSEL, index, 0L);
- }
- //Regen_IDC_SENAME_CBN_SELCHANGE
- break;
-
- }
- break;
- case IDC_SEID :
- switch(Notify)
- {
- case CBN_SELCHANGE :
- //Regen_IDC_SEID_CBN_SELCHANGE
- {
- int index;
-
- index = (int)SendDlgItemMessage(hWnd, IDC_SEID, CB_GETCURSEL, 0, 0L);
- SendDlgItemMessage(hWnd, IDC_SENAME, CB_SETCURSEL, index, 0L);
- }
- //Regen_IDC_SEID_CBN_SELCHANGE
- break;
-
- }
- break;
- case IDC_DENAME :
- switch(Notify)
- {
- case CBN_SELCHANGE :
- //Regen_IDC_DENAME_CBN_SELCHANGE
- {
- int index;
-
- index = (int)SendDlgItemMessage(hWnd, IDC_DENAME, CB_GETCURSEL, 0, 0L);
- SendDlgItemMessage(hWnd, IDC_DEID, CB_SETCURSEL, index, 0L);
- }
- //Regen_IDC_DENAME_CBN_SELCHANGE
- break;
-
- }
- break;
- case IDC_DEID :
- switch(Notify)
- {
- case CBN_SELCHANGE :
- //Regen_IDC_DEID_CBN_SELCHANGE
- {
- int index;
-
- index = (int)SendDlgItemMessage(hWnd, IDC_DEID, CB_GETCURSEL, 0, 0L);
- SendDlgItemMessage(hWnd, IDC_DENAME, CB_SETCURSEL, index, 0L);
- }
- //Regen_IDC_DEID_CBN_SELCHANGE
- break;
-
- }
- break;
- case IDC_RULE :
- //Regen_IDC_RULE
- //Regen_IDC_RULE
- break;
-
- case IDC_LID :
- //Regen_IDC_LID
- //Regen_IDC_LID
- break;
-
- case IDC_LNAME :
- //Regen_IDC_LNAME
- //Regen_IDC_LNAME
- break;
-
- case IDC_LTEXT :
- //Regen_IDC_LTEXT
- //Regen_IDC_LTEXT
- break;
-
- //lRegen_CustomCommand
- //lRegen_CustomCommand
- }
- break;
-
- case WM_DESTROY :
- //Regen_WM_Destroy
- //Regen_WM_Destroy
- break;
- }
- return DefViewProc(hWnd, uMessage, wParam, lParam);
- }
-
- //Regen_CustomCode
- //Regen_CustomCode
-