home *** CD-ROM | disk | FTP | other *** search
- //lRegen_FileHeading
- //lRegen_FileHeading
-
- /********************************************************************
- *
- * Source File: travel.c
- * Author: RC
- * Module: Source for travel application
- * Program Desc:
- * Date: Fri Apr 05 12:07:04 1996
- * Language: ANSI C
- *
- ********************************************************************/
-
- #include ".\travel.h"
-
- #include "ctl3d.h"
- //lRegen_Variables
-
- HWND hIDO;
- LPLINE_CLASS_STRUCT lpLine;
-
- static char miles[15+1];
- static char city[15+1];
-
- //lRegen_Variables
-
- HINSTANCE hInstance;
- char szAppName[30];
-
- BOOL CALLBACK EXPORT MainWndProc(HWND, UINT, WPARAM, LPARAM);
- HACCEL hAccel;
-
- int PASCAL WinMain(HINSTANCE hInst, // Application Instance Handle
- HINSTANCE hPrevInstance, // Previous Instance Handle
- LPSTR lpszCmdLine, // Pointer to Command Line
- int nCmdShow) // Show Window Option
- {
- //lRegen_BeginFunction
- //lRegen_BeginFunction
-
- MSG msg;
- HWND hWndMain;
-
- WNDCLASS wndclass;
- hInstance = hInst;
- lstrcpy(szAppName, "travel");
- hAccel = LoadAccelerators(hInstance, "travel");
-
-
- Ctl3dRegister(hInstance);
- Ctl3dAutoSubclass(hInstance);
- //lRegen_InitView
- //lRegen_InitView
-
- if(NULL == (hWndMain = CreateDialog(hInstance,
- MAKEINTRESOURCE(master),
- NULL,
- MainWndProc)))
- {
- MessageBox(NULL, "Unable to display main dialog", "System Error", MB_OK);
- return FALSE;
- }
-
- SetMenu(hWndMain, LoadMenu(hInstance, "travel"));
-
- //lRegen_MainWnd
- //lRegen_MainWnd
-
- ShowWindow(hWndMain, nCmdShow);
- UpdateWindow(hWndMain);
-
- //lRegen_MainEnd
- //lRegen_MainEnd
-
- while(GetMessage(&msg, NULL, 0, 0))
- if(!IsDialogMessage(hWndMain, &msg))
- if(!TranslateAccelerator(hWndMain, hAccel, &msg))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
-
- //Regen_AppTerm
- //Regen_AppTerm
-
- return msg.wParam;
- }
-
- BOOL CALLBACK EXPORT MainWndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
- {
- WORD CtlId;
- WORD Notify;
- HWND CtlWnd;
-
- //lRegen_WindowProcVariables
- //lRegen_WindowProcVariables
-
- switch(uMessage)
- {
- //lRegen_WndProc
-
- case IDOM_NOTIFY_BEFOREHIDETOOLSPALETTE :
- idoCancelAction(GetDlgItem(hWnd, IDC_IDO));
- break;
-
-
- case IDOM_NOTIFY_RELATIONADDREQUEST :
-
- lpLine = (LPLINE_CLASS_STRUCT)lParam;
- // save the distance of the new relation in static var: miles
- if(!fnnewpath(hWnd, 0, (LPVOID)(LPSTR)miles))
- {
- // the user has canceled the addition of the new relation
- idoCancelAction(GetDlgItem(hWnd, IDC_IDO));
- }
-
- break;
-
-
- case IDOM_NOTIFY_RELATIONADDED :
- {
-
- LPRELATION lpRelation;
-
-
- lpRelation = (LPRELATION)lParam;
- idoRelationSetText(lpRelation, miles);
- idoRelationRepaint(lpRelation);
-
- }
- break;
-
-
- case IDOM_NOTIFY_ENTITYADDREQUEST :
- {
-
- LPENTITY lpEntity;
-
-
- if(!fnnewcity(hWnd, 0, (LPVOID)(LPSTR)city))
- {
- // the user has canceled the addition of the new city
- idoCancelAction(GetDlgItem(hWnd, IDC_IDO));
- return TRUE;
- }
-
- lpEntity = (LPENTITY)lParam;
- lstrcpy(lpEntity->name, city);
- lstrcpy(lpEntity->text, city);
-
- }
- break;
-
- //lRegen_WndProc
-
- case WM_INITDIALOG :
- //Regen_WM_INITDIALOG
- {
- long lStyle = WS_VISIBLE | WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_TABSTOP;
- RECT rect;
-
- GetClientRect(hWnd, &rect);
-
- #ifdef WIN32
- hIDO = CreateWindow("pvIDO32", "", lStyle,
- 0, 0, rect.right, rect.bottom,
- hWnd, (HMENU)IDC_IDO, hInstance, NULL);
- #else
- hIDO = CreateWindow("pvIDO", "", lStyle,
- 0, 0, rect.right, rect.bottom,
- hWnd, (HMENU)IDC_IDO, hInstance, NULL);
- #endif
-
- idoSetEditMode(hIDO, TRUE);
- idoSetToolsPalette(hIDO, TRUE);
- idoSetRulesEnforced(hIDO, FALSE);
- idoReadDiagram(hIDO, "travel.ido");
-
- }
- //Regen_WM_INITDIALOG
- return TRUE;
-
- case WM_SIZE :
- //Regen_WM_SIZE
- {
- RECT rect;
-
- GetClientRect(hWnd, &rect);
-
- SetWindowPos(GetDlgItem(hWnd, IDC_IDO), NULL, 0, 0,
- rect.right, rect.bottom,
- SWP_NOZORDER);
- }
- //Regen_WM_SIZE
- break;
-
- 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
- if(!CtlWnd)
- { // Process Menu Commands
- //Regen_CustomMenuItems
- //Regen_CustomMenuItems
- switch(CtlId) // Determine which Menu ID
- {
- case IDM_SHORTESTDISTANCE :
- //lRegen_Start_IDM_SHORTESTDISTANCE
- //lRegen_Start_IDM_SHORTESTDISTANCE
- if(fndistance(hWnd, 0, NULL))
- {
- }
- //Regen_End_IDM_SHORTESTDISTANCE
- //Regen_End_IDM_SHORTESTDISTANCE
- break;
- case IDM_FILE_PRINT :
- //lRegen_Start_IDM_FILE_PRINT
- idoPrintDiagram(GetDlgItem(hWnd, IDC_IDO));
- //lRegen_Start_IDM_FILE_PRINT
- //Regen_End_IDM_FILE_PRINT
- //Regen_End_IDM_FILE_PRINT
- break;
- case IDM_APP_EXIT :
- //lRegen_Start_IDM_APP_EXIT
- //lRegen_Start_IDM_APP_EXIT
- //Regen_End_IDM_APP_EXIT
- //Regen_End_IDM_APP_EXIT
- SendMessage (hWnd, WM_CLOSE, 0, 0L);
- return 0;
-
- case IDM_ABOUT :
- //lRegen_Start_IDM_ABOUT
- //lRegen_Start_IDM_ABOUT
- if(fnAbouttravel(hWnd, 0, NULL))
- {
- }
- //Regen_End_IDM_ABOUT
- //Regen_End_IDM_ABOUT
- break;
- }
- }
- else
- {
- //Regen_CustomCommand
- //Regen_CustomCommand
-
- switch(CtlId)
- {
- }
- }
- break;
-
- case WM_CLOSE :
-
- //lRegen_WM_Close
- //lRegen_WM_Close
-
- DestroyWindow(hWnd);
-
- return TRUE;
-
- case WM_DESTROY :
-
- //lRegen_WM_DESTROY
- DestroyWindow(GetDlgItem(hWnd, IDC_IDO));
- //lRegen_WM_DESTROY
-
- PostQuitMessage(0);
- break;
-
- default :
- return FALSE;
- }
- return FALSE;
- }
-
- //Regen_CustomCode
- //Regen_CustomCode
-