Changeset 551 for trunk/dll/defview.c
- Timestamp:
- Feb 28, 2007, 2:33:51 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/defview.c
r347 r551 33 33 #pragma alloc_text(DEFVIEW,DefaultView,ShowMultimedia,DefaultViewKeys) 34 34 35 36 BOOL ShowMultimedia (CHAR *filename) 35 BOOL ShowMultimedia(CHAR * filename) 37 36 { 38 37 39 static BOOL 40 BOOL 41 CHAR 42 HMODULE 38 static BOOL no_mmos2 = FALSE; 39 BOOL played = FALSE; 40 CHAR loaderror[CCHMAXPATH]; 41 HMODULE MMIOModHandle = NULLHANDLE; 43 42 PMMIOIDENTIFYFILE pMMIOIdentifyFile = NULL; 44 FOURCC fccStorageSystem = 0; 45 MMFORMATINFO mmFormatInfo; 46 APIRET rc; 47 48 if (no_mmos2 || 49 !filename || 50 !*filename) 43 FOURCC fccStorageSystem = 0; 44 MMFORMATINFO mmFormatInfo; 45 APIRET rc; 46 47 if (no_mmos2 || !filename || !*filename) 51 48 return played; 52 49 53 50 /* load MMPM/2, if available. */ 54 51 *loaderror = 0; 55 rc = DosLoadModule(loaderror, 56 sizeof(loaderror), 57 "MMIO", 58 &MMIOModHandle); 52 rc = DosLoadModule(loaderror, sizeof(loaderror), "MMIO", &MMIOModHandle); 59 53 if (rc) { 60 54 no_mmos2 = TRUE; … … 63 57 else { 64 58 if (DosQueryProcAddr(MMIOModHandle, 65 0, 66 "mmioIdentifyFile", 67 (PFN *)&pMMIOIdentifyFile)) { 59 0, 60 "mmioIdentifyFile", (PFN *) & pMMIOIdentifyFile)) { 68 61 DosFreeModule(MMIOModHandle); 69 62 no_mmos2 = TRUE; … … 73 66 74 67 /* attempt to identify the file using MMPM/2 */ 75 memset(&mmFormatInfo, 0,sizeof(MMFORMATINFO));68 memset(&mmFormatInfo, 0, sizeof(MMFORMATINFO)); 76 69 mmFormatInfo.ulStructLen = sizeof(MMFORMATINFO); 77 70 rc = pMMIOIdentifyFile(filename, 78 71 0L, 79 72 &mmFormatInfo, 80 &fccStorageSystem, 81 0L, 82 MMIO_FORCE_IDENTIFY_FF); 73 &fccStorageSystem, 0L, MMIO_FORCE_IDENTIFY_FF); 83 74 /* free module handle */ 84 75 DosFreeModule(MMIOModHandle); 85 76 86 77 /* if identified and not FOURCC_DOS */ 87 if (!rc && 88 mmFormatInfo.fccIOProc != FOURCC_DOS) { 78 if (!rc && mmFormatInfo.fccIOProc != FOURCC_DOS) { 89 79 if (mmFormatInfo.ulMediaType == MMIO_MEDIATYPE_IMAGE && 90 80 (mmFormatInfo.ulFlags & MMIO_CANREADTRANSLATED)) { 91 81 /* is an image that can be translated */ 92 82 runemf2(SEPARATE | WINDOWED, … … 95 85 NULL, 96 86 "%sIMAGE.EXE \"%s\"", 97 (fAddUtils) ? "UTILS\\" : NullStr, 98 filename); 87 (fAddUtils) ? "UTILS\\" : NullStr, filename); 99 88 played = TRUE; 100 89 } … … 106 95 NULL, 107 96 "%sFM2PLAY.EXE \"%s\"", 108 (fAddUtils) ? "UTILS\\" : NullStr, 109 filename); 97 (fAddUtils) ? "UTILS\\" : NullStr, filename); 110 98 played = TRUE; 111 99 } … … 115 103 } 116 104 117 118 VOID DefaultViewKeys (HWND hwnd,HWND hwndFrame,HWND hwndParent, 119 SWP *swp,CHAR *filename) 105 VOID DefaultViewKeys(HWND hwnd, HWND hwndFrame, HWND hwndParent, 106 SWP * swp, CHAR * filename) 120 107 { 121 if((shiftstate & (KC_CTRL | KC_SHIFT)) == 122 (KC_CTRL | KC_SHIFT)) 123 DefaultView(hwnd, 124 hwndFrame, 125 hwndParent, 126 swp, 127 4, 128 filename); 129 else if(shiftstate & KC_CTRL) 130 DefaultView(hwnd, 131 hwndFrame, 132 hwndParent, 133 swp, 134 2, 135 filename); 136 else if(shiftstate & KC_SHIFT) 137 DefaultView(hwnd, 138 hwndFrame, 139 hwndParent, 140 swp, 141 1, 142 filename); 108 if ((shiftstate & (KC_CTRL | KC_SHIFT)) == (KC_CTRL | KC_SHIFT)) 109 DefaultView(hwnd, hwndFrame, hwndParent, swp, 4, filename); 110 else if (shiftstate & KC_CTRL) 111 DefaultView(hwnd, hwndFrame, hwndParent, swp, 2, filename); 112 else if (shiftstate & KC_SHIFT) 113 DefaultView(hwnd, hwndFrame, hwndParent, swp, 1, filename); 143 114 else 144 DefaultView(hwnd, 145 hwndFrame, 146 hwndParent, 147 swp, 148 0, 149 filename); 115 DefaultView(hwnd, hwndFrame, hwndParent, swp, 0, filename); 150 116 } 151 117 152 153 VOID DefaultView (HWND hwnd,HWND hwndFrame,HWND hwndParent,SWP *swp, 154 ULONG flags,CHAR *filename) 118 VOID DefaultView(HWND hwnd, HWND hwndFrame, HWND hwndParent, SWP * swp, 119 ULONG flags, CHAR * filename) 155 120 { 156 121 /* … … 165 130 */ 166 131 167 HWND hwndArc = (HWND)0;168 char *p, *dummy[3];169 170 if (!hwndParent)132 HWND hwndArc = (HWND) 0; 133 char *p, *dummy[3]; 134 135 if (!hwndParent) 171 136 hwndParent = HWND_DESKTOP; 172 137 173 if (flags & 32) {138 if (flags & 32) { 174 139 flags &= (~16); 175 if (!IsFile(filename)) {140 if (!IsFile(filename)) { 176 141 Runtime_Error(pszSrcFile, __LINE__, "%s not found", filename); 177 142 return; … … 179 144 } 180 145 181 if (flags & 1)/* directly view the file */146 if (flags & 1) /* directly view the file */ 182 147 goto ViewIt; 183 148 184 if(flags & 2) { /* open default WPS view of file */ 185 OpenObject(filename, 186 Default, 187 hwnd); 188 return; 189 } 190 191 if(flags & 4) { /* open WPS settings notebook for file */ 192 OpenObject(filename, 193 Settings, 194 hwnd); 195 return; 196 } 197 198 if((flags & 16) || 199 !IsFile(filename)) { /* open info for directories */ 149 if (flags & 2) { /* open default WPS view of file */ 150 OpenObject(filename, Default, hwnd); 151 return; 152 } 153 154 if (flags & 4) { /* open WPS settings notebook for file */ 155 OpenObject(filename, Settings, hwnd); 156 return; 157 } 158 159 if ((flags & 16) || !IsFile(filename)) { /* open info for directories */ 200 160 201 161 char fullname[CCHMAXPATH]; 202 162 203 if(!IsFullName(filename)) { 204 if(!DosQueryPathInfo(filename, 205 FIL_QUERYFULLNAME, 206 fullname, 207 sizeof(fullname))) 163 if (!IsFullName(filename)) { 164 if (!DosQueryPathInfo(filename, 165 FIL_QUERYFULLNAME, fullname, sizeof(fullname))) 208 166 filename = fullname; 209 167 } 210 if (IsFullName(filename) &&211 212 if (!IsRoot(filename)) {168 if (IsFullName(filename) && 169 !(driveflags[toupper(*filename) - 'A'] & DRIVE_INVALID)) { 170 if (!IsRoot(filename)) { 213 171 dummy[0] = filename; 214 172 dummy[1] = NULL; 215 173 WinDlgBox(HWND_DESKTOP, 216 174 HWND_DESKTOP, 217 FileInfoProc, 218 FM3ModHandle, 219 FLE_FRAME, 220 (PVOID)dummy); 175 FileInfoProc, FM3ModHandle, FLE_FRAME, (PVOID) dummy); 221 176 } 222 177 else 223 178 WinDlgBox(HWND_DESKTOP, 224 179 HWND_DESKTOP, 225 DrvInfoProc, 226 FM3ModHandle, 227 INFO_FRAME, 228 (PVOID)filename); 229 } 230 return; 231 } 232 233 if(flags & 8) { /* edit file */ 180 DrvInfoProc, FM3ModHandle, INFO_FRAME, (PVOID) filename); 181 } 182 return; 183 } 184 185 if (flags & 8) { /* edit file */ 234 186 235 187 ULONG type = IDM_EDITTEXT; … … 237 189 dummy[0] = filename; 238 190 dummy[1] = NULL; 239 if (TestBinary(filename))191 if (TestBinary(filename)) 240 192 type = IDM_EDITBINARY; 241 switch(type) { 242 case IDM_EDITBINARY: 243 if(*bined) { 244 ExecOnList((HWND)0, 245 bined, 246 WINDOWED | SEPARATE, 247 NULL, 248 dummy, 249 NULL); 250 break; 251 } 193 switch (type) { 194 case IDM_EDITBINARY: 195 if (*bined) { 196 ExecOnList((HWND) 0, bined, WINDOWED | SEPARATE, NULL, dummy, NULL); 197 break; 198 } 252 199 /* else intentional fallthru */ 253 case IDM_EDITTEXT: 254 if(*editor) 255 ExecOnList((HWND)0, 256 editor, 257 WINDOWED | SEPARATE, 258 NULL, 259 dummy, 260 NULL); 261 else { 262 type = (type == IDM_EDITTEXT) ? 8 : 263 (type == IDM_EDITBINARY) ? 16 : 264 0; 265 type |= 4; 266 StartMLEEditor(hwndParent, 267 type, 268 filename, 269 hwndFrame); 270 } 271 break; 272 } 273 return; 274 } 275 276 if(ExecAssociation(hwnd, 277 filename) == -1) { 200 case IDM_EDITTEXT: 201 if (*editor) 202 ExecOnList((HWND) 0, editor, WINDOWED | SEPARATE, NULL, dummy, NULL); 203 else { 204 type = (type == IDM_EDITTEXT) ? 8 : (type == IDM_EDITBINARY) ? 16 : 0; 205 type |= 4; 206 StartMLEEditor(hwndParent, type, filename, hwndFrame); 207 } 208 break; 209 } 210 return; 211 } 212 213 if (ExecAssociation(hwnd, filename) == -1) { 278 214 hwndArc = StartArcCnr((fExternalArcboxes || !swp || 279 strcmp(realappname, FM3Str)) ?215 strcmp(realappname, FM3Str)) ? 280 216 HWND_DESKTOP : 281 hwndParent, 282 hwndFrame, 283 filename, 284 4, 285 NULL); 286 if(!hwndArc) { 287 if(!fCheckMM || 288 !ShowMultimedia(filename)) { 289 if(!IsExecutable(filename) || 290 !ExecFile(hwnd,filename)) { 291 p = strrchr(filename,'.'); 292 if(!p) 217 hwndParent, hwndFrame, filename, 4, NULL); 218 if (!hwndArc) { 219 if (!fCheckMM || !ShowMultimedia(filename)) { 220 if (!IsExecutable(filename) || !ExecFile(hwnd, filename)) { 221 p = strrchr(filename, '.'); 222 if (!p) 293 223 p = "."; 294 if(stricmp(p,".INI") || 295 !StartIniEditor(hwndParent, 296 filename, 297 4)) { 298 if(stricmp(p,".HLP") || 299 !ViewHelp(filename)) { 300 ViewIt: 301 if(*viewer) { 224 if (stricmp(p, ".INI") || !StartIniEditor(hwndParent, filename, 4)) { 225 if (stricmp(p, ".HLP") || !ViewHelp(filename)) { 226 ViewIt: 227 if (*viewer) { 302 228 dummy[0] = filename; 303 229 dummy[1] = NULL; … … 305 231 viewer, 306 232 WINDOWED | SEPARATE | 307 ((fViewChild) ? CHILD : 0), 308 NULL, 309 dummy, 310 NULL); 233 ((fViewChild) ? CHILD : 0), NULL, dummy, NULL); 311 234 } 312 235 else 313 StartMLEEditor(hwndParent, 314 5, 315 filename, 316 hwndFrame); 236 StartMLEEditor(hwndParent, 5, filename, hwndFrame); 317 237 } 318 238 } … … 321 241 } 322 242 else { 323 if ((swp &&324 !fExternalArcboxes &&325 !strcmp(realappname,FM3Str)) &&326 !ParentIsDesktop(hwnd,hwndParent))243 if ((swp && 244 !fExternalArcboxes && 245 !strcmp(realappname, FM3Str)) && 246 !ParentIsDesktop(hwnd, hwndParent)) 327 247 WinSetWindowPos(hwndArc, 328 248 HWND_TOP, … … 331 251 swp->cx, 332 252 swp->cy, 333 SWP_MOVE | SWP_SIZE| SWP_SHOW |253 SWP_MOVE | SWP_SIZE | SWP_SHOW | 334 254 SWP_ZORDER | SWP_ACTIVATE); 335 255 } 336 256 } 337 257 } 338
Note:
See TracChangeset
for help on using the changeset viewer.