Changeset 1436


Ignore:
Timestamp:
Jun 27, 2009, 5:26:13 PM (16 years ago)
Author:
Gregg Young
Message:

Drive letter incorporated into bitmaps for drivebar buttons. (tickets 13 & 91)

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/fm3dll2.h

    r1362 r1436  
    485485#define IDM_DRIVESMENU      3899
    486486#define IDM_DRIVEA          3900
    487 #define IDM_DRIVEATEXT      3950
     487// Drive button IDs use 3900 - 3925
    488488
    489489#define IDM_COMMANDSMENU    4000
  • trunk/dll/init.c

    r1434 r1436  
    250250HMODULE FM3DllHandle;
    251251PCSZ FM3Folder        = "<FM3_Folder>";
     252PCSZ FNT_HELVETICA        =  "Helvetica";
    252253PCSZ FNT_6HELVETICA       =  "6.Helvetica";
    253254PCSZ FNT_8HELVETICA       =  "8.Helvetica";
  • trunk/dll/init.h

    r1409 r1436  
    7979extern ULONG ulTimeFmt;
    8080extern ULONG ulDateFmt;
     81extern PCSZ FNT_HELVETICA;
    8182extern PCSZ FNT_6HELVETICA;
    8283extern PCSZ FNT_8HELVETICA;
  • trunk/dll/mainwnd.c

    r1429 r1436  
    8787                add State.version key for check
    8888  07 Jun 09 GKY Fix IDM_BLINK to not leave a DataBar? on the screen when fDataMin is TRUE.
     89  21 Jun 09 GKY Added drive letter to bitmap buttons in drive bar; Eliminate static drive
     90                letter windows; Use button ID to identify drive letter for processing.
    8991
    9092***********************************************************************/
     
    169171#include "excputil.h"                   // xbeginthread
    170172
     173#define DRIVEBAR_FONT_LCID 10
     174
    171175static BOOL CloseDirCnrChildren(HWND hwndClient);
    172176static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview);
     
    252256      id = WinQueryWindowUShort(hwndB, QWS_ID);
    253257      *dv = 0;
    254       WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB, QW_PARENT),
    255                                          id + 50), sizeof(dv), dv);
     258      *dv = id - IDM_DRIVEA + 'A';
     259      strcpy(dv + 1, ":");
    256260      d = toupper(*dv);
    257261      if (isalpha(d) && d > 'B' &&
     
    274278            (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
    275279          CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' ');
    276           sprintf(s, "%s (%lu%%) free", szQty, ulPctFree);
     280          sprintf(s, "%s %s (%lu%%) %s", dv, szQty, ulPctFree, GetPString(IDS_FREETEXT));
    277281        }
    278282        if ((!hwndBubble ||
     
    18311835      CHAR dv[4];
    18321836
    1833       *dv = 0;
    1834       WinQueryWindowText(WinWindowFromID(hwnd, SHORT1FROMMP(mp1) + 50),
    1835                          2, dv);
     1837      *dv = SHORT1FROMMP(mp1) - IDM_DRIVEA + 'A';
     1838      strcpy(dv + 1, ":\\");
    18361839      if (isalpha(*dv)) {
    18371840
     
    18851888    break;
    18861889
     1890  case WM_PAINT:
     1891    {
     1892      HPS hps;
     1893      POINTL aptl[4] = { 0, 0, DRIVE_BUTTON_WIDTH - 1, DRIVE_BUTTON_HEIGTH - 1,
     1894      0, 0, 27, 20}; //The last 2 numbers should be the width and heigth of the bitmap
     1895      HBITMAP hbm;
     1896      POINTL ptlStart;
     1897      ULONG x, iconid;
     1898      FATTRS fat;
     1899      SIZEF sizfCharBox;
     1900
     1901      id = WinQueryWindowUShort(hwnd, QWS_ID);
     1902      *szDrv = 0;
     1903      x = id - IDM_DRIVEA;
     1904      *szDrv = x + 'A';
     1905      strcpy(szDrv + 1, ":");
     1906      if (x > 1) {
     1907          if (driveflags[x] & DRIVE_CDROM)
     1908            iconid = CDROM_ICON;
     1909          else
     1910            iconid = (driveflags[x] & DRIVE_REMOVABLE) ?
     1911                      REMOVABLE_ICON :
     1912                     (driveflags[x] & DRIVE_VIRTUAL) ?
     1913                      VIRTUAL_ICON :
     1914                     (driveflags[x] & DRIVE_REMOTE) ?
     1915                      REMOTE_ICON :
     1916                     (driveflags[x] & DRIVE_RAMDISK) ?
     1917                      RAMDISK_ICON :
     1918                     (driveflags[x] & DRIVE_ZIPSTREAM) ?
     1919                      ZIPSTREAM_ICON : DRIVE_ICON;
     1920        }
     1921        else
     1922          iconid = FLOPPY_ICON;
     1923      hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
     1924      if (hps) {
     1925        hbm = GpiLoadBitmap(hps, 0, iconid, 0, 0);
     1926        if (hbm)
     1927          GpiWCBitBlt(hps, hbm, 4L, aptl, ROP_SRCCOPY, BBO_PAL_COLORS);
     1928          memset(&fat, 0, sizeof(fat));
     1929          fat.usRecordLength = sizeof(FATTRS);
     1930          fat.fsSelection = FATTR_SEL_BOLD ;
     1931          fat.usCodePage = 850;
     1932          fat.fsFontUse = FATTR_FONTUSE_NOMIX;
     1933          strcpy(fat.szFacename , FNT_HELVETICA);
     1934        x = GpiCreateLogFont(hps, NULL, DRIVEBAR_FONT_LCID, &fat);
     1935        if (x != GPI_ERROR) {
     1936          GpiSetCharSet(hps, DRIVEBAR_FONT_LCID);
     1937          sizfCharBox.cx = MAKEFIXED(10,0); //Font size
     1938          sizfCharBox.cy = MAKEFIXED(14,0);
     1939          GpiSetCharBox( hps, &sizfCharBox );
     1940          GpiSetColor(hps, iconid == RAMDISK_ICON ? CLR_YELLOW : CLR_DARKBLUE);
     1941          ptlStart.x = 1L;  //Char box position
     1942          ptlStart.y = 7L;
     1943          GpiCharStringAt(hps, &ptlStart, strlen(szDrv), szDrv);
     1944          GpiDeleteSetId(hps, DRIVEBAR_FONT_LCID);
     1945        }
     1946        WinEndPaint(hps);
     1947      }
     1948    }
     1949    break;
     1950
    18871951  case UM_SETUP6:
    18881952    if (helpid == WinQueryWindowUShort(hwnd, QWS_ID)) {
     
    19161980    hwndMenu = (HWND) 0;
    19171981    id = WinQueryWindowUShort(hwnd, QWS_ID);
    1918     *szDrv = 0;
    1919     WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    1920                                        id + 50), sizeof(szDrv), szDrv);
     1982    *szDrv = id - IDM_DRIVEA + 'A';
     1983    strcpy(szDrv + 1, ":");
    19211984    if (isalpha(*szDrv)) {
    19221985      hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MAIN_DRIVES);
     
    19261989        UINT iDrv;
    19271990
    1928         strcpy(szDrv + 2, "\\");
     1991        strcat(szDrv, "\\");
    19291992        MakeValidDir(szDrv);
    19301993        // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c
    19311994        rdy = toupper(*szDrv) == toupper(chDrv);
    1932         iDrv = toupper(*szDrv) - 'A';
     1995        iDrv = toupper(*szDrv) - 'A';
    19331996        if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE)
    19341997          WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE);
     
    19702033  case WM_BUTTON3CLICK:
    19712034    id = WinQueryWindowUShort(hwnd, QWS_ID);
    1972     *szDrv = 0;
    1973     WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    1974                                        id + 50), sizeof(szDrv), szDrv);
     2035    *szDrv = id - IDM_DRIVEA + 'A';
     2036    strcpy(szDrv + 1, ":");
    19752037    if (isalpha(*szDrv)) {
    19762038      strcat(szDrv, "\\");
     
    19862048  case UM_COMMAND:
    19872049    id = WinQueryWindowUShort(hwnd, QWS_ID);
    1988     *szDrv = 0;
    1989     WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    1990                                        id + 50), sizeof(szDrv), szDrv);
     2050    *szDrv = id - IDM_DRIVEA + 'A';
     2051    strcpy(szDrv + 1, ":");
    19912052    if (isalpha(*szDrv)) {
    19922053      strcat(szDrv, "\\");
     
    19972058  case DM_DRAGOVER:
    19982059    id = WinQueryWindowUShort(hwnd, QWS_ID);
    1999     *szDrv = 0;
    2000     WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    2001                                        id + 50), sizeof(szDrv), szDrv);
     2060    *szDrv = id - IDM_DRIVEA + 'A';
     2061    strcpy(szDrv + 1, ":");
    20022062    if (isalpha(*szDrv) &&
    20032063        !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
     
    20142074  case DM_DRAGLEAVE:
    20152075    id = WinQueryWindowUShort(hwnd, QWS_ID);
    2016     *szDrv = 0;
    2017     WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    2018                                        id + 50), sizeof(szDrv), szDrv);
     2076    *szDrv = id - IDM_DRIVEA + 'A';
     2077    strcpy(szDrv + 1, ":");
    20192078    if (isalpha(*szDrv) &&
    20202079        !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
     
    20282087  case DM_DROPHELP:
    20292088    id = WinQueryWindowUShort(hwnd, QWS_ID);
    2030     *szDrv = 0;
    2031     WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    2032                                        id + 50), sizeof(szDrv), szDrv);
     2089    *szDrv = id - IDM_DRIVEA + 'A';
     2090    strcpy(szDrv + 1, ":");
    20332091    if (isalpha(*szDrv) &&
    20342092        !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
     
    20402098  case DM_DROP:
    20412099    id = WinQueryWindowUShort(hwnd, QWS_ID);
    2042     *szDrv = 0;
    2043     WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    2044                                        id + 50), sizeof(szDrv), szDrv);
     2100    *szDrv = id - IDM_DRIVEA + 'A';
     2101    strcpy(szDrv + 1, ":");
    20452102    if (isalpha(*szDrv) &&
    20462103        !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
     
    22022259VOID BuildDriveBarButtons(HWND hwndT)
    22032260{
    2204   register ULONG x, y = 0;
    2205   ULONG ulDriveNum, ulDriveMap, iconid;
    2206   CHAR s[8];
     2261  register ULONG x;
     2262  ULONG ulDriveNum, ulDriveMap;
    22072263  HENUM henum;
    22082264  HWND hwndB;
     
    22192275    for (x = 0; x < 26; x++) {
    22202276      if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) {
    2221         if (x > 1) {
    2222           if (driveflags[x] & DRIVE_CDROM)
    2223             iconid = CDROM_ICON;
    2224           else
    2225             iconid = (driveflags[x] & DRIVE_REMOVABLE) ?
    2226               REMOVABLE_ICON :
    2227                      (driveflags[x] & DRIVE_VIRTUAL) ?
    2228                       VIRTUAL_ICON :
    2229               (driveflags[x] & DRIVE_REMOTE) ?
    2230               REMOTE_ICON :
    2231                      (driveflags[x] & DRIVE_RAMDISK) ?
    2232                       RAMDISK_ICON :
    2233                      (driveflags[x] & DRIVE_ZIPSTREAM) ?
    2234                       ZIPSTREAM_ICON :DRIVE_ICON;
    2235         }
    2236         else
    2237           iconid = FLOPPY_ICON;
    2238         sprintf(s, "#%lu", iconid);
    22392277        hwndB = WinCreateWindow(hwndT,
    22402278                                WC_DRIVEBUTTONS,
    2241                                 s,
    2242                                 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON,
     2279                                0,
     2280                                BS_NOPOINTERFOCUS | BS_USERBUTTON,
    22432281                                0,
    22442282                                0,
    2245                                 28,
    2246                                 18,
    2247                                 hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL);
     2283                                DRIVE_BUTTON_WIDTH,
     2284                                DRIVE_BUTTON_HEIGTH,
     2285                                hwndT, HWND_TOP, x + IDM_DRIVEA, NULL, NULL);
    22482286        if (!hwndB)
    22492287          Win_Error(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
    22502288                    PCSZ_WINCREATEWINDOW);
    2251         else {
     2289        else {
    22522290          WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
    2253           sprintf(s, "%c:", (CHAR) x + 'A');
    2254           hwndB = WinCreateWindow(hwndT,
    2255                                   WC_STATIC,
    2256                                   s,
    2257                                   SS_TEXT | DT_LEFT | DT_VCENTER,
    2258                                   0,
    2259                                   0,
    2260                                   10,
    2261                                   18,
    2262                                   hwndT,
    2263                                   HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL);
    2264           if (!hwndB)
    2265             Win_Error(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
    2266                       PCSZ_WINCREATEWINDOW);
    2267           else {
    2268             //fixme to allow user to change presparams 1-10-09 GKY
    2269             SetPresParams(hwndB,
    2270                           &RGBGREY,
    2271                           &RGBBLACK, &RGBGREY, FNT_6HELVETICA);
    2272             WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
    2273           }
    2274           y++;
    22752291        }
    22762292      }
     
    22982314  henum = WinBeginEnumWindows(hwndT);
    22992315  while ((hwndB = WinGetNextWindow(henum)) != NULLHANDLE) {
    2300     if (WinQueryWindowUShort(hwndB, QWS_ID) > IDM_DRIVEA + 27)
    2301       ctrlxsize = 10;
    2302     else
    2303       ctrlxsize = 28;
     2316    ctrlxsize = DRIVE_BUTTON_WIDTH;
    23042317    WinSetWindowPos(hwndB,
    23052318                    HWND_TOP,
    2306                     ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW);
     2319                    ctrlxpos, ctrlypos, ctrlxsize, DRIVE_BUTTON_HEIGTH, SWP_MOVE | SWP_SHOW);
    23072320    ctrlxpos += (ctrlxsize + 2);
    2308     if (ctrlxsize == 10) {
    2309       if (ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ?
    2310                             256 : 0)) > xwidth) {
    2311         ctrlxpos = 2;
    2312         ctrlypos += 18;
    2313         DriveLines++;
    2314       }
     2321    if (ctrlxpos + (DRIVE_BUTTON_WIDTH + 4 + ((fShowTarget && DriveLines == 0) ?
     2322                          256 : 0)) > xwidth) {
     2323      ctrlxpos = 2;
     2324      ctrlypos += DRIVE_BUTTON_HEIGTH;
     2325      DriveLines++;
    23152326    }
    23162327  }
     
    31393150    PrfQueryProfileString(fmprof, FM3Str, szKey, NULL, targetdir, sizeof(targetdir));
    31403151    PrfWriteProfileString(fmprof, FM3Str, "TargetDir", targetdir);
    3141     SetTargetDir(NULL, TRUE);
     3152    SetTargetDir(NULLHANDLE, TRUE);
    31423153  }
    31433154  size = sizeof(SWP);
     
    39873998                           (WinQuerySysValue(HWND_DESKTOP,
    39883999                                             SV_CYSIZEBORDER) * 2)) - 4));
    3989             prectl->yTop -= (16 * (DriveLines * 18));
     4000            prectl->yTop -= (16 * (DriveLines * DRIVE_BUTTON_HEIGTH));
    39904001          }
    39914002          if (fUserComboBox) {
     
    40164027      PSWP pswp, pswpClient, pswpNew;
    40174028      SWP swpClient;
    4018       LONG theight = 48L, dheight = 20L, width, sheight = 20, bheight = 20;
     4029      LONG theight = 48L, dheight = DRIVE_BUTTON_HEIGTH + 2, width, sheight = 20, bheight = 20;
    40194030
    40204031      sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
     
    41504161        pswpNew->cx = pswpClient->cx - 6;
    41514162        AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);
    4152         AutoviewHeight = max(AutoviewHeight, 36);
     4163        AutoviewHeight = max(AutoviewHeight, 40);
    41534164        pswpNew->cy = AutoviewHeight;
    41544165        pswpClient->y += (AutoviewHeight + 6);
  • trunk/dll/mainwnd.h

    r1402 r1436  
    2020
    2121#include "colors.h"             // typedef for RGB2
     22
     23#define DRIVE_BUTTON_WIDTH 28
     24#define DRIVE_BUTTON_HEIGTH 21
    2225
    2326void BubbleHelp(HWND hwnd, BOOL other, BOOL data, BOOL above, PCSZ help);
  • trunk/dll/mainwnd2.c

    r1416 r1436  
    204204                         (WinQuerySysValue(HWND_DESKTOP,
    205205                                           SV_CYSIZEBORDER) * 2)) - 4));
    206           prectl->yTop -= (16 * (DriveLines * 18));
     206          prectl->yTop -= (16 * (DriveLines * 22));
    207207          prectl->yTop -= 2;
    208208          if (fAutoView) {
    209209            AutoviewHeight = min(AutoviewHeight,
    210210                                 (prectl->yTop - prectl->yBottom) - 116);
    211             AutoviewHeight = max(AutoviewHeight, 36);
     211            AutoviewHeight = max(AutoviewHeight, 44);
    212212            prectl->yBottom += (AutoviewHeight + 6);
    213213          }
     
    222222      PSWP pswp, pswpClient, pswpNew;
    223223      SWP swpClient;
    224       ULONG theight = 48L, dheight = 20, bheight = 20, sheight = 20;
     224      ULONG theight = 48L, dheight = DRIVE_BUTTON_HEIGTH + 2, bheight = 20, sheight = 20;
    225225      LONG width, lastx;
    226226
     
    328328        pswpNew->cx = pswpClient->cx - 6;
    329329        AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);
    330         AutoviewHeight = max(AutoviewHeight, 36);
     330        AutoviewHeight = max(AutoviewHeight, 44);
    331331        pswpNew->cy = AutoviewHeight;
    332332        pswpClient->y += (AutoviewHeight + 6);
Note: See TracChangeset for help on using the changeset viewer.