Changeset 942 for trunk/dll/collect.c


Ignore:
Timestamp:
Feb 10, 2008, 7:38:02 PM (18 years ago)
Author:
Gregg Young
Message:

Impliment bubble help for bitmap menu items in the collector and arc container. (Ticket #7)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/collect.c

    r917 r942  
    6767#include "strutil.h"                    // GetPString
    6868#include "errutil.h"                    // Runtime_Error
     69#include "tmrsvcs.h"                    // ITIMER_DESC
    6970#include "fm3dll.h"
    7071
     
    240241            break;
    241242          case DIR_FILTER:
    242             s = GetPString(IDS_DIRCNRFILTERHELP);
    243             break;
     243            s = GetPString(IDS_DIRCNRFILTERHELP);
     244            break;
    244245          default:
    245246            break;
     
    444445}
    445446
    446 MRESULT EXPENTRY CollectorObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
    447                                      MPARAM mp2)
     447MRESULT EXPENTRY CollectorObjWndProc(HWND hwnd, ULONG msg,
     448                                     MPARAM mp1, MPARAM mp2)
    448449{
    449450  ULONG size;
     
    498499                         COLLECTOROBJ_FRAME + (COLLECTOR_FRAME - dcd->id));
    499500      dcd->hwndObject = hwnd;
    500       if (ParentIsDesktop(hwnd, dcd->hwndParent))
    501         DosSleep(100); //05 Aug 07 GKY 250
     501      // 09 Feb 08 SHL fixme to be sure applet does not really need this
     502      // if (ParentIsDesktop(hwnd, dcd->hwndParent))
     503      //        DosSleep(100); //05 Aug 07 GKY 250
    502504    }
    503505    else
     
    558560      CHAR fullname[CCHMAXPATH];
    559561
    560       WinSetWindowText(WinWindowFromID(dcd->hwndClient, DIR_SELECTED),
    561                        GetPString(IDS_COLLECTINGTEXT));
     562      if (!hwndStatus) {
     563        WinSetWindowText(WinWindowFromID(dcd->hwndClient, DIR_SELECTED),
     564                         GetPString(IDS_COLLECTINGTEXT));
     565      }
     566      else {
     567        if (WinQueryFocus(HWND_DESKTOP) == dcd->hwndCnr)
     568          WinSetWindowText(hwndStatus, GetPString(IDS_COLLECTINGTEXT));
     569      }
     570
    562571      for (ulMaxFiles = 0; li->list[ulMaxFiles]; ulMaxFiles++) ;        // Count
    563572
     
    572581        }
    573582        else {
     583          ITIMER_DESC itdSleep = { 0 };         // 06 Feb 08 SHL
     584          InitITimer(&itdSleep, 500);           // Sleep every 500 mSec
    574585          pciFirst = pci;
    575586          // 04 Jan 08 SHL fixme like comp.c if CM_ALLOCRECORD returns unexpected record count
     
    605616            }
    606617            else {
     618              // Oops - fixme to complain?
    607619              pciT = pci;
    608620              pci = (PCNRITEM) pci->rc.preccNextRecord;
     
    612624                pciFirst = pci;
    613625              FreeCnrItem(hwnd, pciT);
    614               ulMaxFiles--;
    615             }
    616             DosSleep(0); //26 Aug 07 GKY 1
    617           }
     626              ulMaxFiles--;             // Remember gone
     627            }
     628            SleepIfNeeded(&itdSleep, 1);        // 09 Feb 08 SHL
     629            // DosSleep(0); //26 Aug 07 GKY 1   // 09 Feb 08 SHL
     630          } // for
    618631          if (ulMaxFiles) {
     632            // Some files OK
    619633            memset(&ri, 0, sizeof(RECORDINSERT));
    620634            ri.cb = sizeof(RECORDINSERT);
     
    896910
    897911      dcd->stopflag = 1;
    898       // Allow rescan logic to quiesce
    899       for (x = 0; x < 10 && dcd->amextracted; x++)
    900         DosSleep(100); //05 Aug 07 GKY 250
     912      // Allow other threads to honor stop request
     913      for (x = 0; x < 100 && dcd->amextracted; x++)
     914        DosSleep(10);
     915      if (dcd->amextracted)
     916        Runtime_Error(pszSrcFile, __LINE__, "still busy");
    901917      WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID);
    902918      FreeList(dcd->lastselection);
     
    11281144            PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
    11291145        }
    1130         if (!fMoreButtons)
    1131           sprintf(s, " %s%s%s%s", GetPString(IDS_COLLECTORTEXT),
    1132                   (*dcd->mask.szMask || dcd->mask.antiattr ||
    1133                    dcd->mask.attrFile != ALLATTRS) ? "  (" : NullStr,
    1134                   (*dcd->mask.szMask) ? dcd->mask.szMask :
    1135                   (dcd->mask.antiattr ||
    1136                    dcd->mask.attrFile != ALLATTRS) ?
    1137                   GetPString(IDS_ATTRTEXT) : NullStr,
    1138                   (*dcd->mask.szMask || dcd->mask.antiattr ||
    1139                    dcd->mask.attrFile != ALLATTRS) ? ")" : NullStr);
    1140         else
    1141           strcpy(s, GetPString(IDS_COLLECTORTEXT));
     1146        if (!fMoreButtons) {
     1147          sprintf(s, " %s%s%s%s",
     1148                  dcd->amextracted ?
     1149                    GetPString(IDS_COLLECTINGTEXT) :
     1150                    GetPString(IDS_COLLECTORTEXT),
     1151                  *dcd->mask.szMask || dcd->mask.antiattr ||
     1152                    dcd->mask.attrFile != ALLATTRS ? "  (" : NullStr,
     1153                  *dcd->mask.szMask ?
     1154                    dcd->mask.szMask :
     1155                    dcd->mask.antiattr ||
     1156                     dcd->mask.attrFile != ALLATTRS ?
     1157                      GetPString(IDS_ATTRTEXT) : NullStr,
     1158                  *dcd->mask.szMask || dcd->mask.antiattr ||
     1159                    dcd->mask.attrFile != ALLATTRS ?
     1160                    ")" : NullStr);
     1161        }
     1162        else {
     1163          strcpy(s,
     1164                dcd->amextracted ?
     1165                  GetPString(IDS_COLLECTINGTEXT) :
     1166                  GetPString(IDS_COLLECTORTEXT));
     1167        }
    11421168        WinSetWindowText(hwndStatus, s);
    11431169        if (!pci)
     
    12891315                   MPFROMLONG(CMA_XVERTSPLITBAR));
    12901316
    1291         if (_beginthread(MakeObjWin, NULL, 245760, (PVOID) dcd) == -1) {
     1317        if (_beginthread(MakeObjWin, NULL, 245760, (PVOID)dcd) == -1) {
    12921318          Runtime_Error(pszSrcFile, __LINE__,
    12931319                        GetPString(IDS_COULDNTSTARTTHREADTEXT));
     
    12961322        }
    12971323        else
    1298           DosSleep(32); //05 Aug 07 GKY 64
     1324          DosSleep(32);         // Let object window get started
    12991325      }
    13001326      SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
     
    26112637        PostMsg(hwnd, UM_FOLDUP, MPVOID, MPVOID);
    26122638      if (dcd->hwndObject) {
    2613         DosSleep(32); //05 Aug 07 GKY 64
     2639        DosSleep(32);                   // Allow UM_FOLDUP to process
    26142640        if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
    26152641          WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
     
    26372663  else
    26382664      return PFNWPCnr(hwnd, msg, mp1, mp2);
     2665}
     2666
     2667MRESULT EXPENTRY CollectorMenuProc(HWND hwnd, ULONG msg, MPARAM mp1,
     2668                                     MPARAM mp2)
     2669{
     2670  PFNWP oldMenuProc = WinQueryWindowPtr(hwnd, QWL_USER);
     2671  static short  sLastMenuitem;
     2672
     2673  switch (msg) {
     2674    case WM_MOUSEMOVE: {
     2675      if (fOtherHelp) {
     2676        RECTL rectl;
     2677        SHORT i, sCurrentMenuitem;
     2678        SHORT MenuItems = 5;
     2679        SHORT asMenuIDs[5] = {IDM_GREP,
     2680              IDM_SEEALL,
     2681              IDM_CLEARCNR,
     2682              IDM_REMOVE,
     2683              0};
     2684        char *szHelpString = NULL;
     2685
     2686
     2687        for (i=0; i<MenuItems; i++) {
     2688          sCurrentMenuitem = asMenuIDs[i];
     2689          oldMenuProc(hwnd,MM_QUERYITEMRECT,
     2690                      MPFROM2SHORT(asMenuIDs[i], FALSE),
     2691                      &rectl);
     2692
     2693        if (MOUSEMSG(&msg)->x > rectl.xLeft &&
     2694            MOUSEMSG(&msg)->x < rectl.xRight &&
     2695            MOUSEMSG(&msg)->y > rectl.yBottom &&
     2696            MOUSEMSG(&msg)->y < rectl.yTop)
     2697           break;
     2698        }                      // for
     2699
     2700
     2701         switch (sCurrentMenuitem) {
     2702         case 0:
     2703           break;
     2704         case IDM_GREP:
     2705           szHelpString = GetPString(IDS_COLMENUSEEKSCANHELP);
     2706           break;
     2707         case IDM_SEEALL:
     2708           szHelpString = GetPString(IDS_COLMENUSEEALLHELP);
     2709           break;
     2710         case IDM_CLEARCNR:
     2711           szHelpString = GetPString(IDS_COLMENUCLEARCNRHELP);
     2712           break;
     2713         case IDM_REMOVE:
     2714           szHelpString = GetPString(IDS_COLMENUREMOVECNRHELP);
     2715           break;
     2716         default:
     2717           break;
     2718         }
     2719
     2720        if (sLastMenuitem != sCurrentMenuitem && szHelpString) {
     2721          sLastMenuitem = sCurrentMenuitem;
     2722          MakeBubble(hwnd, TRUE, szHelpString);
     2723        }
     2724        else if (hwndBubble && !sCurrentMenuitem){
     2725          sLastMenuitem = sCurrentMenuitem;
     2726          WinDestroyWindow(hwndBubble);
     2727        }
     2728      }
     2729    }
     2730  }
     2731    return oldMenuProc(hwnd, msg, mp1, mp2);
    26392732}
    26402733
     
    27142807        WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
    27152808        WinSetWindowText(hwndFrame, GetPString(IDS_COLLECTORTITLETEXT));
    2716         if (FrameFlags & FCF_MENU) {
     2809        if (FrameFlags & FCF_MENU) {
     2810          PFNWP oldmenuproc;
     2811          HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
     2812
     2813          oldmenuproc = WinSubclassWindow(hwndMenu, (PFNWP) CollectorMenuProc);
     2814          WinSetWindowPtr(hwndMenu, QWL_USER, (PVOID) oldmenuproc);
    27172815          if (!fToolbar) {
    2718             HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
    2719 
    2720             if (hwndMenu) {
     2816            if (hwndMenu) {
     2817
    27212818              WinSendMsg(hwndMenu,
    27222819                         MM_DELETEITEM,
     
    27372834                                         (PFNWP) CollectorCnrWndProc);
    27382835        {
    2739           USHORT ids[] = { DIR_TOTALS, DIR_SELECTED, DIR_VIEW, DIR_SORT,
    2740             DIR_FILTER, 0
     2836          USHORT ids[] = { DIR_TOTALS,
     2837                           DIR_SELECTED,
     2838                           DIR_VIEW,
     2839                           DIR_SORT,
     2840                           DIR_FILTER,
     2841                           0
    27412842          };
    27422843
Note: See TracChangeset for help on using the changeset viewer.