[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 |
|
---|
[551] | 12 | PCNRITEM FindCnrRecord(HWND hwndCnr, CHAR * filename, PCNRITEM pciParent,
|
---|
| 13 | BOOL partial, BOOL partmatch, BOOL noenv)
|
---|
| 14 | {
|
---|
[2] | 15 |
|
---|
[551] | 16 | SEARCHSTRING srch;
|
---|
| 17 | PCNRITEM pci;
|
---|
| 18 | register CHAR *file, *p;
|
---|
[2] | 19 |
|
---|
[551] | 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;
|
---|
[2] | 29 | }
|
---|
| 30 | else
|
---|
[551] | 31 | file++;
|
---|
[2] | 32 | }
|
---|
| 33 | else
|
---|
| 34 | file = filename;
|
---|
| 35 | }
|
---|
| 36 | else
|
---|
| 37 | file = filename;
|
---|
[551] | 38 | memset(&srch, 0, sizeof(SEARCHSTRING));
|
---|
| 39 | srch.cb = (ULONG) sizeof(SEARCHSTRING);
|
---|
| 40 | srch.pszSearch = (PSZ) file;
|
---|
[2] | 41 | srch.fsPrefix = FALSE;
|
---|
| 42 | srch.fsCaseSensitive = FALSE;
|
---|
[551] | 43 | srch.usView = CV_TREE; /* | CV_EXACTMATCH; */
|
---|
| 44 | if (!pciParent)
|
---|
| 45 | pciParent = (PCNRITEM) CMA_FIRST;
|
---|
[2] | 46 | pci = WinSendMsg(hwndCnr,
|
---|
[551] | 47 | CM_SEARCHSTRING, MPFROMP(&srch), MPFROMP(pciParent));
|
---|
| 48 | while (pci && (INT) pci != -1) {
|
---|
| 49 | if (!noenv || (pci->flags & (RECFLAGS_ENV | RECFLAGS_UNDERENV)) == 0) {
|
---|
| 50 | if (!partmatch) { /* full name must match full name */
|
---|
[730] | 51 | if (!stricmp(pci->pszFileName, filename))
|
---|
[551] | 52 | return pci; /* success */
|
---|
[2] | 53 | }
|
---|
[551] | 54 | else { /* only root name must match */
|
---|
[730] | 55 | if (strlen(pci->pszFileName) > 3) {
|
---|
| 56 | p = strrchr(pci->pszFileName, '\\');
|
---|
[551] | 57 | if (!p) {
|
---|
[730] | 58 | p = strrchr(pci->pszFileName, ':');
|
---|
[551] | 59 | if (p)
|
---|
| 60 | p++;
|
---|
| 61 | else
|
---|
[730] | 62 | p = pci->pszFileName;
|
---|
[551] | 63 | }
|
---|
| 64 | else
|
---|
| 65 | p++;
|
---|
| 66 | }
|
---|
| 67 | else
|
---|
[730] | 68 | p = pci->pszFileName;
|
---|
[551] | 69 | if (!stricmp(p, file))
|
---|
| 70 | return pci; /* success */
|
---|
[2] | 71 | }
|
---|
| 72 | }
|
---|
[551] | 73 | pci = WinSendMsg(hwndCnr, CM_SEARCHSTRING, MPFROMP(&srch), MPFROMP(pci));
|
---|
[2] | 74 | }
|
---|
[689] | 75 |
|
---|
[551] | 76 | return NULL; /* failure */
|
---|
[2] | 77 | }
|
---|
| 78 |
|
---|
[551] | 79 | PCNRITEM FindParentRecord(HWND hwndCnr, PCNRITEM pciC)
|
---|
| 80 | {
|
---|
[2] | 81 |
|
---|
[551] | 82 | PCNRITEM pciP = (PCNRITEM) NULL, pci = pciC;
|
---|
[2] | 83 |
|
---|
[551] | 84 | if (pci) {
|
---|
| 85 | for (;;) {
|
---|
[2] | 86 | pciP = WinSendMsg(hwndCnr,
|
---|
[551] | 87 | CM_QUERYRECORD,
|
---|
| 88 | MPFROMP(pci),
|
---|
| 89 | MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER));
|
---|
| 90 | if (pciP && (INT) pciP != -1)
|
---|
| 91 | pci = pciP;
|
---|
[2] | 92 | else
|
---|
[551] | 93 | break;
|
---|
[2] | 94 | }
|
---|
| 95 | }
|
---|
| 96 | return pci;
|
---|
| 97 | }
|
---|
| 98 |
|
---|
[551] | 99 | VOID ShowCnrRecord(HWND hwndCnr, PMINIRECORDCORE pmi)
|
---|
| 100 | {
|
---|
[2] | 101 |
|
---|
[551] | 102 | QUERYRECORDRECT qrecrct;
|
---|
| 103 | RECTL rcl;
|
---|
| 104 | RECTL rclViewport;
|
---|
[2] | 105 |
|
---|
[551] | 106 | memset(&qrecrct, 0, sizeof(QUERYRECORDRECT));
|
---|
[2] | 107 | qrecrct.cb = sizeof(QUERYRECORDRECT);
|
---|
[551] | 108 | qrecrct.pRecord = (PRECORDCORE) pmi;
|
---|
[2] | 109 | qrecrct.fsExtent = (CMA_ICON | CMA_TEXT | CMA_TREEICON);
|
---|
[551] | 110 | if (!WinSendMsg(hwndCnr,
|
---|
| 111 | CM_QUERYRECORDRECT, MPFROMP(&rcl), MPFROMP(&qrecrct))) {
|
---|
[2] | 112 | qrecrct.fsExtent = CMA_TEXT | CMA_TREEICON;
|
---|
[551] | 113 | WinSendMsg(hwndCnr, CM_QUERYRECORDRECT, MPFROMP(&rcl), MPFROMP(&qrecrct));
|
---|
[2] | 114 | }
|
---|
| 115 | WinSendMsg(hwndCnr,
|
---|
[551] | 116 | CM_QUERYVIEWPORTRECT,
|
---|
| 117 | MPFROMP(&rclViewport), MPFROM2SHORT(CMA_WINDOW, FALSE));
|
---|
[2] | 118 | WinSendMsg(hwndCnr,
|
---|
[551] | 119 | CM_SCROLLWINDOW,
|
---|
| 120 | MPFROMSHORT(CMA_VERTICAL),
|
---|
| 121 | MPFROMLONG((rclViewport.yTop - rcl.yTop) - 4));
|
---|
[2] | 122 | WinSendMsg(hwndCnr,
|
---|
[551] | 123 | CM_SCROLLWINDOW,
|
---|
| 124 | MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(rcl.xLeft - 4));
|
---|
[2] | 125 | }
|
---|