[2] | 1 | #define INCL_WIN
|
---|
| 2 |
|
---|
| 3 | #include <os2.h>
|
---|
| 4 | #include <stdarg.h>
|
---|
| 5 | #include <stdio.h>
|
---|
| 6 | #include <stdlib.h>
|
---|
| 7 | #include <string.h>
|
---|
| 8 | #include "fm3dll.h"
|
---|
| 9 |
|
---|
| 10 | #pragma alloc_text(FINDREC,FindCnrRecord,FindParentRecord,ShowCnrRecord)
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 | PCNRITEM FindCnrRecord (HWND hwndCnr,CHAR *filename,PCNRITEM pciParent,
|
---|
| 14 | BOOL partial,BOOL partmatch,BOOL noenv) {
|
---|
| 15 |
|
---|
| 16 | SEARCHSTRING srch;
|
---|
| 17 | PCNRITEM pci;
|
---|
| 18 | register CHAR *file,*p;
|
---|
| 19 |
|
---|
| 20 | if(partial) {
|
---|
| 21 | if(strlen(filename) > 3) {
|
---|
| 22 | file = strrchr(filename,'\\');
|
---|
| 23 | if(!file) {
|
---|
| 24 | file = strrchr(filename,':');
|
---|
| 25 | if(file)
|
---|
| 26 | file++;
|
---|
| 27 | else
|
---|
| 28 | file = filename;
|
---|
| 29 | }
|
---|
| 30 | else
|
---|
| 31 | file++;
|
---|
| 32 | }
|
---|
| 33 | else
|
---|
| 34 | file = filename;
|
---|
| 35 | }
|
---|
| 36 | else
|
---|
| 37 | file = filename;
|
---|
| 38 | memset(&srch,
|
---|
| 39 | 0,
|
---|
| 40 | sizeof(SEARCHSTRING));
|
---|
| 41 | srch.cb = (ULONG)sizeof(SEARCHSTRING);
|
---|
| 42 | srch.pszSearch = (PSZ)file;
|
---|
| 43 | srch.fsPrefix = FALSE;
|
---|
| 44 | srch.fsCaseSensitive = FALSE;
|
---|
| 45 | srch.usView = CV_TREE; /* | CV_EXACTMATCH; */
|
---|
| 46 | if(!pciParent)
|
---|
| 47 | pciParent = (PCNRITEM)CMA_FIRST;
|
---|
| 48 | pci = WinSendMsg(hwndCnr,
|
---|
| 49 | CM_SEARCHSTRING,
|
---|
| 50 | MPFROMP(&srch),
|
---|
| 51 | MPFROMP(pciParent));
|
---|
| 52 | while(pci &&
|
---|
| 53 | (INT)pci != -1) {
|
---|
| 54 | if(!noenv ||
|
---|
| 55 | (pci->flags & (RECFLAGS_ENV | RECFLAGS_UNDERENV)) == 0) {
|
---|
| 56 | if(!partmatch) { /* full name must match full name */
|
---|
| 57 | if(!stricmp(pci->szFileName,filename))
|
---|
| 58 | return pci; /* success */
|
---|
| 59 | }
|
---|
| 60 | else { /* only root name must match */
|
---|
| 61 | if(strlen(pci->szFileName) > 3) {
|
---|
| 62 | p = strrchr(pci->szFileName,'\\');
|
---|
| 63 | if(!p) {
|
---|
| 64 | p = strrchr(pci->szFileName,':');
|
---|
| 65 | if(p)
|
---|
| 66 | p++;
|
---|
| 67 | else
|
---|
| 68 | p = pci->szFileName;
|
---|
| 69 | }
|
---|
| 70 | else
|
---|
| 71 | p++;
|
---|
| 72 | }
|
---|
| 73 | else
|
---|
| 74 | p = pci->szFileName;
|
---|
| 75 | if(!stricmp(p,file))
|
---|
| 76 | return pci; /* success */
|
---|
| 77 | }
|
---|
| 78 | }
|
---|
| 79 | pci = WinSendMsg(hwndCnr,
|
---|
| 80 | CM_SEARCHSTRING,
|
---|
| 81 | MPFROMP(&srch),
|
---|
| 82 | MPFROMP(pci));
|
---|
| 83 | }
|
---|
| 84 | Abort:
|
---|
| 85 | return NULL; /* failure */
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 |
|
---|
| 89 | PCNRITEM FindParentRecord (HWND hwndCnr,PCNRITEM pciC) {
|
---|
| 90 |
|
---|
| 91 | PCNRITEM pciP = (PCNRITEM)NULL,pci = pciC;
|
---|
| 92 |
|
---|
| 93 | if(pci) {
|
---|
| 94 | for(;;) {
|
---|
| 95 | pciP = WinSendMsg(hwndCnr,
|
---|
| 96 | CM_QUERYRECORD,
|
---|
| 97 | MPFROMP(pci),
|
---|
| 98 | MPFROM2SHORT(CMA_PARENT,
|
---|
| 99 | CMA_ITEMORDER));
|
---|
| 100 | if(pciP &&
|
---|
| 101 | (INT)pciP != -1)
|
---|
| 102 | pci = pciP;
|
---|
| 103 | else
|
---|
| 104 | break;
|
---|
| 105 | }
|
---|
| 106 | }
|
---|
| 107 | return pci;
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 |
|
---|
| 111 | VOID ShowCnrRecord (HWND hwndCnr,PMINIRECORDCORE pmi) {
|
---|
| 112 |
|
---|
| 113 | QUERYRECORDRECT qrecrct ;
|
---|
| 114 | RECTL rcl ;
|
---|
| 115 | RECTL rclViewport ;
|
---|
| 116 |
|
---|
| 117 | memset(&qrecrct,
|
---|
| 118 | 0,
|
---|
| 119 | sizeof(QUERYRECORDRECT));
|
---|
| 120 | qrecrct.cb = sizeof(QUERYRECORDRECT);
|
---|
| 121 | qrecrct.pRecord = (PRECORDCORE)pmi;
|
---|
| 122 | qrecrct.fsExtent = (CMA_ICON | CMA_TEXT | CMA_TREEICON);
|
---|
| 123 | if(!WinSendMsg(hwndCnr,
|
---|
| 124 | CM_QUERYRECORDRECT,
|
---|
| 125 | MPFROMP(&rcl),
|
---|
| 126 | MPFROMP(&qrecrct))) {
|
---|
| 127 | qrecrct.fsExtent = CMA_TEXT | CMA_TREEICON;
|
---|
| 128 | WinSendMsg(hwndCnr,
|
---|
| 129 | CM_QUERYRECORDRECT,
|
---|
| 130 | MPFROMP(&rcl),
|
---|
| 131 | MPFROMP(&qrecrct));
|
---|
| 132 | }
|
---|
| 133 | WinSendMsg(hwndCnr,
|
---|
| 134 | CM_QUERYVIEWPORTRECT,
|
---|
| 135 | MPFROMP(&rclViewport),
|
---|
| 136 | MPFROM2SHORT(CMA_WINDOW,FALSE));
|
---|
| 137 | WinSendMsg(hwndCnr,
|
---|
| 138 | CM_SCROLLWINDOW,
|
---|
| 139 | MPFROMSHORT(CMA_VERTICAL),
|
---|
| 140 | MPFROMLONG((rclViewport.yTop - rcl.yTop) - 4));
|
---|
| 141 | WinSendMsg(hwndCnr,
|
---|
| 142 | CM_SCROLLWINDOW,
|
---|
| 143 | MPFROMSHORT(CMA_HORIZONTAL),
|
---|
| 144 | MPFROMLONG(rcl.xLeft - 4));
|
---|
| 145 | }
|
---|