Changeset 787 for trunk/dll/misc.c


Ignore:
Timestamp:
Aug 19, 2007, 11:02:37 PM (18 years ago)
Author:
Steven Levine
Message:

Rework UM_FILLSETUPLIST IDM_SAVEDIRCNRSTATE and ..._setups() logic for ticket# 109 and #31
Add GetMSecTimer()
Use GetMSecTimer in DbgMsg
Tweak notebook.ipf scanning page
Move more #pragma alloc_text statements to end of files for OpenWatcom
Delete obsoletes
Revert ExpandAll() ShowTreeRec() DosSleeps to 0 - DosSleep(1) was slowing down inner loops
Drop afFilesToGet - use FilesToGet directly
Optimze ShowTreeRec() collapse logic - was really slow

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/misc.c

    r775 r787  
    3131  06 Aug 07 GKY Increase Subject EA to 1024
    3232  06 Aug 07 GKY Reduce DosSleep times (ticket 148)
    33 
     33  14 Aug 07 SHL Delete obsoletes
     34  14 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
    3435
    3536***********************************************************************/
     
    5657static PSZ pszSrcFile = __FILE__;
    5758
    58 #pragma alloc_text(MAINWND5,SetSysMenu)
    59 #pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow,IsFm2Window)
    60 #pragma alloc_text(MISC1,FixSwitchList,FindDirCnr,CurrentRecord,SetShiftState,AddToListboxBottom)
    61 #pragma alloc_text(CNR_MISC1,AdjustCnrColVis,AdjustCnrColsForFSType)
    62 #pragma alloc_text(CNR_MISC1,AdjustCnrColsForPref,SetCnrCols)
    63 #pragma alloc_text(CNR_MISC2,CnrDirectEdit,OpenEdit)
    64 #pragma alloc_text(MISC2,SetMenuCheck,disable_menuitem,SetSortChecks)
    65 #pragma alloc_text(MISC2,SetDetailsSwitches,SetViewMenu)
    66 #pragma alloc_text(MISC3,SetupCommandMenu,AdjustDetailsSwitches)
    67 #pragma alloc_text(MISC3,ViewHelp,GetCmdSpec)
    68 #pragma alloc_text(MISC3,ExecFile,SetConditionalCascade,LoadDetailsSwitches)
    69 #pragma alloc_text(MISC3,FreeMallocedMem,FcloseFile)
    70 #pragma alloc_text(MISC4,PortholeInit,CheckMenu,Broadcast,SetupWinList,SwitchCommand)
    71 #pragma alloc_text(MISC6,DrawTargetEmphasis,EmphasizeButton)
    72 #pragma alloc_text(MISC_LIBPATH,LoadLibPath)
    73 #pragma alloc_text(MISC_SAY,SayView,SaySort,SayFilter)
    74 
    7559#ifndef BEGIN_LIBPATH
    7660#define BEGIN_LIBPATH            1
     
    135119    ptl.y = 1;
    136120    GpiMove(hps, &ptl);
    137     GpiSetColor(hps, ((on) ? CLR_BLACK : CLR_PALEGRAY));
     121    GpiSetColor(hps, on ? CLR_BLACK : CLR_PALEGRAY);
    138122    ptl.x = swp.cx - 2;
    139123    ptl.y = swp.cy - 2;
     
    150134
    151135  if (hps) {
    152     BoxWindow(hwnd, hps, ((on) ? CLR_BLACK : CLR_PALEGRAY));
     136    BoxWindow(hwnd, hps, on ? CLR_BLACK : CLR_PALEGRAY);
    153137    DrgReleasePS(hps);
    154138  }
     
    214198        do {
    215199          GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
    216           if (aptl[TXTBOX_TOPRIGHT].x > (rcl.xRight - ((p != s) ? len : 0)))
     200          if (aptl[TXTBOX_TOPRIGHT].x > (rcl.xRight - (p != s ? len : 0)))
    217201            p++;
    218202          else
     
    410394    hasLongNames = FALSE;
    411395  }
    412   pBool = (dcd) ? &dcd->detailsladate : &detailsladate;
    413   AdjustCnrColVis(hwndCnr, GetPString(IDS_LADATE),
    414                   (*pBool) ? hasAccessDT : FALSE, FALSE);
    415   pBool = (dcd) ? &dcd->detailslatime : &detailslatime;
    416   AdjustCnrColVis(hwndCnr, GetPString(IDS_LATIME),
    417                   (*pBool) ? hasAccessDT : FALSE, FALSE);
    418   pBool = (dcd) ? &dcd->detailscrdate : &detailscrdate;
    419   AdjustCnrColVis(hwndCnr, GetPString(IDS_CRDATE),
    420                   (*pBool) ? hasCreateDT : FALSE, FALSE);
    421   pBool = (dcd) ? &dcd->detailscrtime : &detailscrtime;
    422   AdjustCnrColVis(hwndCnr, GetPString(IDS_CRTIME),
    423                   (*pBool) ? hasCreateDT : FALSE, FALSE);
    424   pBool = (dcd) ? &dcd->detailslongname : &detailslongname;
    425   AdjustCnrColVis(hwndCnr, GetPString(IDS_LNAME),
    426                   (*pBool) ? hasLongNames : FALSE, FALSE);
     396  pBool = dcd ? &dcd->detailsladate : &detailsladate;
     397  AdjustCnrColVis(hwndCnr,
     398                  GetPString(IDS_LADATE),
     399                  *pBool ? hasAccessDT : FALSE,
     400                  FALSE);
     401  pBool = dcd ? &dcd->detailslatime : &detailslatime;
     402  AdjustCnrColVis(hwndCnr,
     403                  GetPString(IDS_LATIME),
     404                  *pBool ? hasAccessDT : FALSE,
     405                  FALSE);
     406  pBool = dcd ? &dcd->detailscrdate : &detailscrdate;
     407  AdjustCnrColVis(hwndCnr,
     408                  GetPString(IDS_CRDATE),
     409                  *pBool ? hasCreateDT : FALSE,
     410                  FALSE);
     411  pBool = dcd ? &dcd->detailscrtime : &detailscrtime;
     412  AdjustCnrColVis(hwndCnr,
     413                  GetPString(IDS_CRTIME),
     414                  *pBool ? hasCreateDT : FALSE,
     415                  FALSE);
     416  pBool = dcd ? &dcd->detailslongname : &detailslongname;
     417  AdjustCnrColVis(hwndCnr,
     418                  GetPString(IDS_LNAME),
     419                  *pBool ? hasLongNames : FALSE,
     420                  FALSE);
    427421  WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
    428422}
     
    532526      pfi->flData |= CFA_FIREADONLY;
    533527    pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
    534     pfi->pTitleData = (isCompCnr) ? GetPString(IDS_STATUS) :
    535       GetPString(IDS_SUBJ);
     528    pfi->pTitleData = isCompCnr ? GetPString(IDS_STATUS) :
     529                                  GetPString(IDS_SUBJ);
    536530    pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject);
    537531
     
    701695          szSubject[retlen + 1] = 0;
    702696          //chop_at_crnl(szSubject);
    703           bstrip(szSubject);
    704           pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__);
     697          bstrip(szSubject);
     698          pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__);
    705699          WinSetWindowText(hwndMLE, szSubject);
    706700          len = strlen(szSubject);
     
    752746          retlen = WinQueryWindowText(hwndMLE, sizeof(longname), longname);
    753747          longname[retlen + 1] = 0;
    754           //chop_at_crnl(longname);
    755           pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__);
     748          //chop_at_crnl(longname);
     749          pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__);
    756750          WinSetWindowText(hwndMLE, longname);
    757751          pci->pszFileName = xrealloc(pci->pszFileName, retlen + 1, pszSrcFile, __LINE__);
    758752          return (MRESULT) WriteLongName(pci->pszFileName, longname);
    759753        }
    760         else {
    761           WinQueryWindowText(hwndMLE, sizeof(szData), szData);
     754        else {
     755          WinQueryWindowText(hwndMLE, sizeof(szData), szData);
    762756          if (strchr(szData, '?') ||
    763757              strchr(szData, '*') || IsRoot(pci->pszFileName))
     
    774768                return FALSE;
    775769            if (DosQueryPathInfo(pci->pszFileName,
    776                                 FIL_QUERYFULLNAME, szData, sizeof(szData))){
    777               pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__);
    778               strcpy(szData, pci->pszFileName);
    779             }
     770                                FIL_QUERYFULLNAME, szData, sizeof(szData))){
     771              pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__);
     772              strcpy(szData, pci->pszFileName);
     773            }
    780774            WinSetWindowText(hwndMLE, szData);
    781775            if (strcmp(szData, testname)) {
     
    859853{
    860854  if (toggle) {
    861     *bool = (*bool) ? FALSE : TRUE;
     855    *bool = *bool ? FALSE : TRUE;
    862856    if (savename && *savename)
    863857      PrfWriteProfileData(fmprof, appname, savename, bool, sizeof(BOOL));
     
    943937    lastflags = ex.flags;
    944938    return runemf2(ex.flags, hwnd, path,
    945                    (*ex.environment) ? ex.environment : NULL, "%s", cl) != -1;
     939                   *ex.environment ? ex.environment : NULL,
     940                   "%s", cl) != -1;
    946941  }
    947942  else if (ret != 0)
     
    10451040  }
    10461041  if (bool)
    1047     *bool = (*bool) ? FALSE : TRUE;
     1042    *bool = *bool ? FALSE : TRUE;
    10481043  if (*s && bool)
    10491044    PrfWriteProfileData(fmprof, appname, s, bool, sizeof(BOOL));
     
    11181113}
    11191114
    1120 VOID FreeMallocedMem(VOID * mem)
    1121 {
    1122   /* for use by apps that don't use the DLLs runtime library */
    1123   free(mem);
    1124 }
    1125 
    11261115VOID FcloseFile(FILE * fp)
    11271116{
     
    11671156                "%s%s%s",
    11681157                info->title,
    1169                 (x < 20) ? "\tCtrl + " : NullStr,
    1170                 (x < 20 && x > 9) ? "Shift + " : NullStr);
     1158                x < 20 ? "\tCtrl + " : NullStr,
     1159                x < 20 && x > 9 ? "Shift + " : NullStr);
    11711160        if (x < 20)
    11721161          sprintf(&s[strlen(s)], "%d",
    1173                   (((x % 10) + 1) == 10) ? 0 : (x % 10) + 1);
     1162                  ((x % 10) + 1) == 10 ? 0 : (x % 10) + 1);
    11741163        mi.id = IDM_COMMANDSTART + x;
    1175         mi.afAttribute = (((info->flags & ONCE) != 0) ?
    1176                           MIA_CHECKED : 0) |
    1177           (((info->flags & PROMPT) != 0) ? MIA_FRAMED : 0);
     1164        mi.afAttribute = (info->flags & ONCE ? MIA_CHECKED : 0) |
     1165                         (info->flags & PROMPT ? MIA_FRAMED : 0);
    11781166        mi.afStyle = MIS_TEXT;
    11791167        if (!(x % 24) && x && info->next)
     
    13781366PMINIRECORDCORE CurrentRecord(HWND hwndCnr)
    13791367{
    1380   SHORT attrib = (fSelectedAlways) ? CRA_SELECTED : CRA_CURSORED;
     1368  SHORT attrib = fSelectedAlways ? CRA_SELECTED : CRA_CURSORED;
    13811369  PMINIRECORDCORE pmi;
    13821370
     
    13901378      break;
    13911379  }
    1392   return ((INT) pmi == -1) ? NULL : pmi;
     1380  return ((INT)pmi == -1) ? NULL : pmi;
    13931381}
    13941382
     
    14821470      list[0] = filename;
    14831471      list[1] = NULL;
    1484       ExecOnList(hwnd, viewer, WINDOWED | SEPARATE |
    1485                  ((fViewChild) ? CHILD : 0), NULL, list, NULL);
     1472      ExecOnList(hwnd, viewer,
     1473                 WINDOWED | SEPARATE | (fViewChild ? CHILD : 0),
     1474                 NULL, list, NULL);
    14861475      return;
    14871476    }
     
    16081597      SetConditionalCascade(DirMenu, IDM_EDITSUBMENU, IDM_ATTRS);
    16091598      SetConditionalCascade(DirMenu, IDM_DELETESUBMENU,
    1610                             (fDefaultDeletePerm) ? IDM_PERMDELETE :
    1611                             IDM_DELETE);
     1599                            fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
    16121600      SetConditionalCascade(DirMenu, IDM_MISCSUBMENU, IDM_SIZES);
    16131601      SetConditionalCascade(DirMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW);
     
    16531641      SetConditionalCascade(FileMenu, IDM_COLLECTMENU, IDM_COLLECT);
    16541642      SetConditionalCascade(FileMenu, IDM_DELETESUBMENU,
    1655                             (fDefaultDeletePerm) ? IDM_PERMDELETE :
    1656                             IDM_DELETE);
     1643                            fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
    16571644      SetConditionalCascade(FileMenu, IDM_OPENSUBMENU, IDM_OPENDEFAULT);
    16581645      SetConditionalCascade(FileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW);
     
    16991686      SetConditionalCascade(CollectorFileMenu, IDM_EDITSUBMENU, IDM_EDIT);
    17001687      SetConditionalCascade(CollectorFileMenu, IDM_DELETESUBMENU,
    1701                             (fDefaultDeletePerm) ? IDM_PERMDELETE :
    1702                             IDM_DELETE);
     1688                            fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
    17031689      SetConditionalCascade(CollectorFileMenu, IDM_OPENSUBMENU,
    17041690                            IDM_OPENDEFAULT);
     
    17221708      SetConditionalCascade(CollectorDirMenu, IDM_EDITSUBMENU, IDM_ATTRS);
    17231709      SetConditionalCascade(CollectorDirMenu, IDM_DELETESUBMENU,
    1724                             (fDefaultDeletePerm) ? IDM_PERMDELETE :
    1725                             IDM_DELETE);
     1710                            fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
    17261711      SetConditionalCascade(CollectorDirMenu, IDM_MISCSUBMENU, IDM_SIZES);
    17271712      SetConditionalCascade(CollectorDirMenu, IDM_OPENSUBMENU,
     
    18951880  if (s) {
    18961881    sprintf(s, "S:%s%s",
    1897             (sortflags & SORT_REVERSE) ? "^" : NullStr,
    1898             (sortflags & SORT_FIRSTEXTENSION) ? GetPString(IDS_FIRSTX) :
    1899             (sortflags & SORT_LASTEXTENSION) ? GetPString(IDS_LASTX) :
    1900             (sortflags & SORT_SIZE) ? "Size" :
    1901             (sortflags & SORT_EASIZE) ? (archive ==
    1902                                          0) ? GetPString(IDS_EASIZE) :
    1903             GetPString(IDS_CSIZE) : (sortflags & SORT_LWDATE) ? (archive
    1904                                                                  ==
    1905                                                                  0) ?
    1906             GetPString(IDS_LWDATE) : GetPString(IDS_DATE) : (sortflags &
    1907                                                              SORT_LADATE)
    1908             ? GetPString(IDS_LADATE) : (sortflags & SORT_CRDATE) ?
    1909             GetPString(IDS_CRDATE) : (sortflags & SORT_PATHNAME) ?
    1910             GetPString(IDS_PATH) : (sortflags & SORT_NOSORT) ?
    1911             GetPString(IDS_NONE) : (sortflags & SORT_SUBJECT) ?
    1912             GetPString(IDS_SUBJ) : GetPString(IDS_NAME));
     1882            sortflags & SORT_REVERSE ? "^" : NullStr,
     1883            (sortflags & SORT_FIRSTEXTENSION) ?
     1884              GetPString(IDS_FIRSTX) : (sortflags & SORT_LASTEXTENSION) ?
     1885                GetPString(IDS_LASTX) : (sortflags & SORT_SIZE) ?
     1886                  "Size" : (sortflags & SORT_EASIZE) ?
     1887                    (archive == 0) ?
     1888                      GetPString(IDS_EASIZE) : GetPString(IDS_CSIZE) :
     1889                    (sortflags & SORT_LWDATE) ?
     1890                      (archive == 0) ?
     1891                        GetPString(IDS_LWDATE) : GetPString(IDS_DATE) :
     1892                        (sortflags & SORT_LADATE) ?
     1893                          GetPString(IDS_LADATE) : (sortflags & SORT_CRDATE) ?
     1894                            GetPString(IDS_CRDATE) :
     1895                            (sortflags & SORT_PATHNAME) ?
     1896                              GetPString(IDS_PATH) : (sortflags & SORT_NOSORT) ?
     1897                                GetPString(IDS_NONE) : (sortflags & SORT_SUBJECT) ?
     1898                                  GetPString(IDS_SUBJ) : GetPString(IDS_NAME));
    19131899    WinSetWindowText(hwnd, s);
    19141900    free(s);
     
    20492035    register INT i;
    20502036
    2051     hwndTopFrame = (hwndTop) ? WinQueryWindow(hwndTop, QW_PARENT) : (HWND) 0;
     2037    hwndTopFrame = hwndTop ? WinQueryWindow(hwndTop, QW_PARENT) : (HWND)0;
    20522038    /* Get the switch list information */
    20532039    x = 0;
     
    21692155  return ret;
    21702156}
     2157
     2158#pragma alloc_text(MAINWND5,SetSysMenu)
     2159#pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow,IsFm2Window)
     2160#pragma alloc_text(MISC1,FixSwitchList,FindDirCnr,CurrentRecord,SetShiftState,AddToListboxBottom)
     2161#pragma alloc_text(CNR_MISC1,AdjustCnrColVis,AdjustCnrColsForFSType)
     2162#pragma alloc_text(CNR_MISC1,AdjustCnrColsForPref,SetCnrCols)
     2163#pragma alloc_text(CNR_MISC2,CnrDirectEdit,OpenEdit)
     2164#pragma alloc_text(MISC2,SetMenuCheck,disable_menuitem,SetSortChecks)
     2165#pragma alloc_text(MISC2,SetDetailsSwitches,SetViewMenu)
     2166#pragma alloc_text(MISC3,SetupCommandMenu,AdjustDetailsSwitches)
     2167#pragma alloc_text(MISC3,ViewHelp,GetCmdSpec)
     2168#pragma alloc_text(MISC3,ExecFile,SetConditionalCascade,LoadDetailsSwitches)
     2169#pragma alloc_text(MISC4,PortholeInit,CheckMenu,Broadcast,SetupWinList,SwitchCommand)
     2170#pragma alloc_text(MISC6,DrawTargetEmphasis,EmphasizeButton)
     2171#pragma alloc_text(MISC_LIBPATH,LoadLibPath)
     2172#pragma alloc_text(MISC_SAY,SayView,SaySort,SayFilter)
     2173
Note: See TracChangeset for help on using the changeset viewer.