Changeset 1438 for trunk/dll/mainwnd.c


Ignore:
Timestamp:
Jun 28, 2009, 10:47:00 PM (16 years ago)
Author:
Gregg Young
Message:

Improved drivebar changes; Added AddBackslashToPath() to remove repeatative code. replaced "
" with PCSZ variable; ANY_OBJ added the DosAlloc... (experimental)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/mainwnd.c

    r1436 r1438  
    18911891    {
    18921892      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
     1893      POINTL aptl[4] = {0, 0, DRIVE_BUTTON_WIDTH - 1, DRIVE_BUTTON_HEIGHT - 1,
     1894      0, 0, DRIVE_BUTTON_WIDTH - 1, DRIVE_BUTTON_HEIGHT - 1};
     1895      //The last 2 numbers should be the width and height of the bitmap
    18951896      HBITMAP hbm;
     1897      PBITMAPINFOHEADER    pbmpData;
    18961898      POINTL ptlStart;
    18971899      ULONG x, iconid;
     
    19201922        }
    19211923        else
    1922           iconid = FLOPPY_ICON;
     1924          iconid = FLOPPY_ICON;
    19231925      hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
    19241926      if (hps) {
    19251927        hbm = GpiLoadBitmap(hps, 0, iconid, 0, 0);
    1926         if (hbm)
     1928        if (hbm) {
     1929          pbmpData = xmallocz(sizeof(PBITMAPINFOHEADER), pszSrcFile, __LINE__);
     1930          if (pbmpData) {
     1931            GpiQueryBitmapParameters(hbm, pbmpData);
     1932            aptl[1].x = pbmpData->cx;
     1933            aptl[1].y = pbmpData->cy;
     1934            aptl[3].x = pbmpData->cx;
     1935            aptl[3].y = pbmpData->cy;
     1936            free(pbmpData);
     1937          }
    19271938          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);
     1939        }
     1940        memset(&fat, 0, sizeof(fat));
     1941        fat.usRecordLength = sizeof(FATTRS);
     1942        fat.fsSelection = FATTR_SEL_BOLD ;
     1943        fat.usCodePage = 850;
     1944        fat.fsFontUse = FATTR_FONTUSE_NOMIX;
     1945        strcpy(fat.szFacename , FNT_HELVETICA);
    19341946        x = GpiCreateLogFont(hps, NULL, DRIVEBAR_FONT_LCID, &fat);
    19351947        if (x != GPI_ERROR) {
     
    19401952          GpiSetColor(hps, iconid == RAMDISK_ICON ? CLR_YELLOW : CLR_DARKBLUE);
    19411953          ptlStart.x = 1L;  //Char box position
    1942           ptlStart.y = 7L;
     1954          ptlStart.y = 8L;
    19431955          GpiCharStringAt(hps, &ptlStart, strlen(szDrv), szDrv);
    19441956          GpiDeleteSetId(hps, DRIVEBAR_FONT_LCID);
     
    19892001        UINT iDrv;
    19902002
    1991         strcat(szDrv, "\\");
     2003        strcat(szDrv, PCSZ_BACKSLASH);
    19922004        MakeValidDir(szDrv);
    19932005        // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c
     
    20362048    strcpy(szDrv + 1, ":");
    20372049    if (isalpha(*szDrv)) {
    2038       strcat(szDrv, "\\");
     2050      strcat(szDrv, PCSZ_BACKSLASH);
    20392051      if (!FindDirCnrByName(szDrv, TRUE))
    20402052        OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv);
     
    20512063    strcpy(szDrv + 1, ":");
    20522064    if (isalpha(*szDrv)) {
    2053       strcat(szDrv, "\\");
     2065      strcat(szDrv, PCSZ_BACKSLASH);
    20542066      CommonDriveCmd(hwnd, szDrv, SHORT1FROMMP(mp1));
    20552067    }
     
    21202132      if (li) {
    21212133        strcpy(li->targetpath, szDrv);
    2122         strcat(li->targetpath, "\\");
     2134        strcat(li->targetpath, PCSZ_BACKSLASH);
    21232135        if (li->list && li->list[0] && IsRoot(li->list[0]))
    21242136          li->type = DO_LINK;
     
    22822294                                0,
    22832295                                DRIVE_BUTTON_WIDTH,
    2284                                 DRIVE_BUTTON_HEIGTH,
     2296                                DRIVE_BUTTON_HEIGHT,
    22852297                                hwndT, HWND_TOP, x + IDM_DRIVEA, NULL, NULL);
    22862298        if (!hwndB)
     
    22992311VOID ResizeDrives(HWND hwndT, long xwidth)
    23002312{
    2301   register ULONG ctrlxpos = 2, ctrlypos = 0, ctrlxsize;
     2313  register ULONG ctrlxpos = 1, ctrlypos = 0, ctrlxsize;
    23022314  HENUM henum;
    23032315  HWND hwndB;
     
    23102322    WinQueryWindowRect(hwndT, &rcl);
    23112323    xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP,
    2312                                              SV_CYSIZEBORDER) * 2) + 2);
     2324                                             SV_CYSIZEBORDER) * 2) + 1);
    23132325  }
    23142326  henum = WinBeginEnumWindows(hwndT);
     
    23172329    WinSetWindowPos(hwndB,
    23182330                    HWND_TOP,
    2319                     ctrlxpos, ctrlypos, ctrlxsize, DRIVE_BUTTON_HEIGTH, SWP_MOVE | SWP_SHOW);
     2331                    ctrlxpos, ctrlypos, ctrlxsize, DRIVE_BUTTON_HEIGHT, SWP_MOVE | SWP_SHOW);
    23202332    ctrlxpos += (ctrlxsize + 2);
    2321     if (ctrlxpos + (DRIVE_BUTTON_WIDTH + 4 + ((fShowTarget && DriveLines == 0) ?
     2333    if (ctrlxpos + (DRIVE_BUTTON_WIDTH + 2 + ((fShowTarget && DriveLines == 0) ?
    23222334                          256 : 0)) > xwidth) {
    2323       ctrlxpos = 2;
    2324       ctrlypos += DRIVE_BUTTON_HEIGTH;
     2335      ctrlxpos = 1;
     2336      ctrlypos += DRIVE_BUTTON_HEIGHT;
    23252337      DriveLines++;
    23262338    }
     
    39984010                           (WinQuerySysValue(HWND_DESKTOP,
    39994011                                             SV_CYSIZEBORDER) * 2)) - 4));
    4000             prectl->yTop -= (16 * (DriveLines * DRIVE_BUTTON_HEIGTH));
     4012            prectl->yTop -= (16 * (DriveLines * DRIVE_BUTTON_HEIGHT));
    40014013          }
    40024014          if (fUserComboBox) {
     
    40274039      PSWP pswp, pswpClient, pswpNew;
    40284040      SWP swpClient;
    4029       LONG theight = 48L, dheight = DRIVE_BUTTON_HEIGTH + 2, width, sheight = 20, bheight = 20;
     4041      LONG theight = 48L, dheight = DRIVE_BUTTON_HEIGHT, width, sheight = 20, bheight = 20;
    40304042
    40314043      sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2);
     
    41364148        pswpNew->hwndInsertBehind = HWND_BOTTOM;
    41374149        pswpNew->x = swpClient.x + 2;
    4138         dheight += ((dheight - 2) * DriveLines);
    4139         pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
     4150        dheight += ((dheight) * DriveLines);
     4151        pswpNew->y = (swpClient.y + swpClient.cy) - (dheight);
    41404152        if (fToolbar)
    41414153          pswpNew->y -= theight;
    41424154        pswpNew->cx = swpClient.cx - 4;
    4143         pswpNew->cy = dheight - 4;
     4155        pswpNew->cy = dheight;
    41444156        pswpClient->cy -= dheight;
    41454157        sCount++;
Note: See TracChangeset for help on using the changeset viewer.