|
|
1.1 ! root 1: /*==============================================================*\ ! 2: * sem_file.c - routines for handling the standard file menu * ! 3: * commands * ! 4: * Created 1990, Microsoft, IBM Corp. * ! 5: *--------------------------------------------------------------* ! 6: * * ! 7: * This module contains the code for the WM_COMMAND messages * ! 8: * posted by the standard File menu. * ! 9: * * ! 10: *--------------------------------------------------------------* ! 11: * * ! 12: * This source file contains the following functions: * ! 13: * * ! 14: * FileNew(mp2); * ! 15: * FileOpen(mp2); * ! 16: * FileSave(mp2); * ! 17: * FileSaveAs(mp2); * ! 18: * FilePrint(mp2); * ! 19: * FilePageSetup(mp2); * ! 20: * FilePrintSetup(mp2); * ! 21: * * ! 22: \*==============================================================*/ ! 23: ! 24: /*--------------------------------------------------------------*\ ! 25: * Include files, macros, defined constants, and externs * ! 26: \*--------------------------------------------------------------*/ ! 27: ! 28: #define LINT_ARGS ! 29: ! 30: #define INCL_WIN ! 31: #define INCL_GPI ! 32: #define INCL_DOSPROCESS ! 33: #include <os2.h> ! 34: #include "sem_main.h" ! 35: #include "sem_xtrn.h" ! 36: ! 37: /*--------------------------------------------------------------*\ ! 38: * Global variables * ! 39: \*--------------------------------------------------------------*/ ! 40: ! 41: /*--------------------------------------------------------------*\ ! 42: * Entry point declarations * ! 43: \*--------------------------------------------------------------*/ ! 44: ! 45: ! 46: #ifdef LATER ! 47: ! 48: /****************************************************************\ ! 49: * New file routine * ! 50: *--------------------------------------------------------------* ! 51: * * ! 52: * Name: FileNew(mp2) * ! 53: * * ! 54: * Purpose: Processes the File menu's New item * ! 55: * * ! 56: * Usage: called whenever New from the File menu is selected * ! 57: * * ! 58: * Method: * ! 59: * * ! 60: * * ! 61: * Returns: * ! 62: * * ! 63: \****************************************************************/ ! 64: VOID FileNew(mp2) ! 65: MPARAM mp2; /* second parameter of WM_COMMAND message */ ! 66: { ! 67: ! 68: /*--------------------------------------------------------------*\ ! 69: * Enter routines for creating a new file and window * ! 70: \*--------------------------------------------------------------*/ ! 71: ! 72: /* This routine currently doesn't use the mp2 parameter but *\ ! 73: * it is referenced here to prevent an 'Unreferenced Parameter' * ! 74: \* warning at compile time. */ ! 75: mp2; ! 76: ! 77: } /* FileNew() */ ! 78: ! 79: ! 80: ! 81: /****************************************************************\ ! 82: * Open file routine * ! 83: *--------------------------------------------------------------* ! 84: * * ! 85: * Name: FileOpen(mp2) * ! 86: * * ! 87: * Purpose: Processes the File menu's Open item. * ! 88: * * ! 89: * Usage: called whenever Open from the File menu is selected * ! 90: * * ! 91: * Method: calls the standard file open dialog to get the * ! 92: * file name. The file name is passed onto DosOpen * ! 93: * which returns the handle to the file. The file * ! 94: * input procedure is called and then the file handle * ! 95: * is closed. * ! 96: * * ! 97: * Returns: * ! 98: * * ! 99: \****************************************************************/ ! 100: VOID FileOpen(MPARAM mp2) ! 101: { ! 102: FILEDLG fdg; ! 103: HFILE hfIn; ! 104: USHORT usAction; ! 105: ! 106: fdg.cbSize = sizeof(FILEDLG); ! 107: fdg.pszTitle = "Open..."; ! 108: fdg.pszButton = "Open"; ! 109: fdg.henum = NULL; ! 110: fdg.lUser = 0L; ! 111: fdg.fl = FDS_HELPBUTTON | FDS_CENTER; ! 112: fdg.pfnDlgProc = NULL; ! 113: fdg.lReturn = 0L; ! 114: fdg.ffb = 0; ! 115: fdg.hmod = NULL; ! 116: fdg.idDlg = NULL; ! 117: fdg.iTopFile = 0; ! 118: fdg.x = 0; ! 119: fdg.x = 0; ! 120: ! 121: if(!WinLoadString(hab, NULL, IDS_FILEOPENEXT, MAX_FILTER, fdg.szFilter)) { ! 122: WinMessageBox(hwndMain, IDMSG_CANNOTLOADSTRING, TRUE); ! 123: return; ! 124: } ! 125: ! 126: fdg.szPath[0] = 0; /* use current directory */ ! 127: fdg.szFile[0] = 0; /* specify no default file */ ! 128: fdg.szFullFile[CCHMAXPATH]; ! 129: ! 130: /* get the file */ ! 131: if(!KitFileDlg(hwndMain, (PFILEDLG)&fdg)) ! 132: return; ! 133: ! 134: ! 135: /*--------------------------------------------------------------*\ ! 136: * Upon sucessful return of a file, open it for reading * ! 137: \*--------------------------------------------------------------*/ ! 138: ! 139: if(fdg.lReturn == ID_OK) { ! 140: if( DosOpen(fdg.szFullFile, ! 141: &hfIn, ! 142: (PUSHORT)&usAction, ! 143: 0L, ! 144: FILE_NORMAL, ! 145: FILE_OPEN, ! 146: OPEN_ACCESS_READ | OPEN_SHARE_DENYNONE, ! 147: 0L)) { ! 148: MessageBox(hwndOwner, IDMSG_CANNOTOPENINPUTFILE); ! 149: return; ! 150: } ! 151: ! 152: /*--------------------------------------------------------------*\ ! 153: * Place routine for reading the file here * ! 154: \*--------------------------------------------------------------*/ ! 155: ! 156: ! 157: DosClose(hfIn); ! 158: } ! 159: ! 160: /* This routine currently doesn't use the mp2 parameter but *\ ! 161: * it is referenced here to prevent an 'Unreferenced Parameter' * ! 162: \* warning at compile time. */ ! 163: mp2; ! 164: ! 165: } /* FileOpen() */ ! 166: ! 167: ! 168: /****************************************************************\ ! 169: * Print file routine * ! 170: *--------------------------------------------------------------* ! 171: * * ! 172: * Name: FilePrint(mp2) * ! 173: * * ! 174: * Purpose: Processes the File menu's Print item. * ! 175: * * ! 176: * Usage: called whenever Print from the File menu is * ! 177: * selected * ! 178: * * ! 179: * Method: Routine calls the application's print routine * ! 180: * * ! 181: * Returns: * ! 182: * * ! 183: \****************************************************************/ ! 184: VOID FilePrint(MPARAM mp2) ! 185: { ! 186: ! 187: Print(hwndMain); ! 188: ! 189: /* This routine currently doesn't use the mp2 parameter but *\ ! 190: * it is referenced here to prevent an 'Unreferenced Parameter' * ! 191: \* warning at compile time. */ ! 192: mp2; ! 193: ! 194: } /* FilePrint() */ ! 195: ! 196: /****************************************************************\ ! 197: * Page setup routine * ! 198: *--------------------------------------------------------------* ! 199: * * ! 200: * Name: FilePageSetup(mp2) * ! 201: * * ! 202: * Purpose: Processes the File menu's Page Setup item. * ! 203: * * ! 204: * Usage: called whenever Page Setup from the File menu is * ! 205: * selected * ! 206: * * ! 207: * Method: Routine calls the application's page setup routine * ! 208: * * ! 209: * Returns: * ! 210: * * ! 211: \****************************************************************/ ! 212: VOID FilePageSetup(MPARAM mp2) ! 213: { ! 214: ! 215: PageSetup(hwndMain); ! 216: ! 217: /* This routine currently doesn't use the mp2 parameter but *\ ! 218: * it is referenced here to prevent an 'Unreferenced Parameter' * ! 219: \* warning at compile time. */ ! 220: mp2; ! 221: ! 222: } /* FilePageSetup() */ ! 223: ! 224: /****************************************************************\ ! 225: * Print Setup routine * ! 226: *--------------------------------------------------------------* ! 227: * * ! 228: * Name: FilePageSetup(mp2) * ! 229: * * ! 230: * Purpose: Processes the File menu's Print Setup item. * ! 231: * * ! 232: * Usage: called whenever Print Setup from the File menu is * ! 233: * selected * ! 234: * * ! 235: * Method: Routine calls the application's Print Setup routine* ! 236: * * ! 237: * Returns: * ! 238: * * ! 239: \****************************************************************/ ! 240: VOID FilePrintSetup(MPARAM mp2) ! 241: { ! 242: ! 243: PrintSetup(hwndMain); ! 244: ! 245: /* This routine currently doesn't use the mp2 parameter but *\ ! 246: * it is referenced here to prevent an 'Unreferenced Parameter' * ! 247: \* warning at compile time. */ ! 248: mp2; ! 249: ! 250: } /* FilePrintSetup() */ ! 251: ! 252: #endif ! 253: ! 254: /****************************************************************\ ! 255: * Exit routine * ! 256: *--------------------------------------------------------------* ! 257: * * ! 258: * Name: FileExit(mp2) * ! 259: * * ! 260: * Purpose: Processes the File menu's Exit item. * ! 261: * * ! 262: * Usage: called whenever Exit from the file menu is * ! 263: * selected * ! 264: * * ! 265: * Method: Routine posts a WM_CLOSE message to the main * ! 266: * application window. * ! 267: * * ! 268: * Returns: * ! 269: * * ! 270: \****************************************************************/ ! 271: VOID FileExit(MPARAM mp2) ! 272: { ! 273: ! 274: WinPostMsg(hwndMain, WM_CLOSE, (MPARAM)NULL, (MPARAM)NULL); ! 275: ! 276: /* This routine currently doesn't use the mp2 parameter but *\ ! 277: * it is referenced here to prevent an 'Unreferenced Parameter' * ! 278: \* warning at compile time. */ ! 279: mp2; ! 280: ! 281: } /* FileExit() */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.