Changeset 212 for trunk/dll/arccnrs.c
- Timestamp:
- Jun 18, 2005, 5:50:20 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/arccnrs.c
r172 r212 15 15 25 May 05 SHL Rename comnam to szCommonName and fix typo 16 16 25 May 05 SHL Use ULONGLONG and CommaFmtULL 17 05 Jun 05 SHL Drop obsolete, localize 18 05 Jun 05 SHL Correct last sort logic 19 05 Jun 05 SHL Use QWL_USER 17 20 18 21 ***********************************************************************/ … … 46 49 #pragma alloc_text(STARTUP,StartArcCnr) 47 50 48 INT arcsortFlags = 0; 49 50 51 MRESULT EXPENTRY ArcErrProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 51 static INT DefArcSortFlags; 52 53 static MRESULT EXPENTRY ArcErrProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 52 54 { 53 55 ARCDUMP *ad; … … 138 140 139 141 140 SHORT APIENTRY ArcSort (PMINIRECORDCORE p1,PMINIRECORDCORE p2,PVOID pStorage)142 static SHORT APIENTRY ArcSort (PMINIRECORDCORE pmrc1,PMINIRECORDCORE pmrc2,PVOID pStorage) 141 143 { 142 PARCITEM p = (PARCITEM)p1,pp = (PARCITEM)p2; 143 DIRCNRDATA *dcd = (DIRCNRDATA *)pStorage; 144 PARCITEM pai1 = (PARCITEM)pmrc2; 145 PARCITEM pai2 = (PARCITEM)pmrc2; 146 DIRCNRDATA *pdcd = (DIRCNRDATA *)pStorage; 144 147 SHORT ret = 0; 145 148 CHAR *pext,*ppext; 146 147 if(dcd) 148 arcsortFlags = dcd->sortFlags; 149 if(arcsortFlags) { 150 switch(arcsortFlags & (~SORT_REVERSE)) { 149 INT sortFlags; 150 151 if (!pdcd) 152 { 153 HWND hwndCnr = pai1->hwndCnr; 154 pdcd = (DIRCNRDATA *)WinQueryWindowPtr(hwndCnr,QWL_USER); 155 // fixme debug 156 if (!pdcd) 157 { 158 saymsg(0,NULLHANDLE,"*Debug*","dcd NULL %s %u",__FILE__, __LINE__); 159 return ret; 160 } 161 } 162 163 sortFlags = pdcd->sortFlags; // Optimize 164 165 if(sortFlags) { 166 switch(sortFlags & (~SORT_REVERSE)) { 151 167 case SORT_FIRSTEXTENSION: 152 pext = strchr(p ->szFileName,'.');153 ppext = strchr(p p->szFileName,'.');168 pext = strchr(pai1->szFileName,'.'); 169 ppext = strchr(pai2->szFileName,'.'); 154 170 if(!pext) 155 171 pext = NullStr; … … 160 176 161 177 case SORT_LASTEXTENSION: 162 pext = strrchr(p ->szFileName,'.');163 ppext = strrchr(p p->szFileName,'.');178 pext = strrchr(pai1->szFileName,'.'); 179 ppext = strrchr(pai2->szFileName,'.'); 164 180 if(!pext) 165 181 pext = NullStr; … … 170 186 171 187 case SORT_LWDATE: 172 ret = (p ->date.year < pp->date.year) ? 1 :173 (p ->date.year > pp->date.year) ? -1 :174 (p ->date.month < pp->date.month) ? 1 :175 (p ->date.month > pp->date.month) ? -1 :176 (p ->date.day < pp->date.day) ? 1 :177 (p ->date.day > pp->date.day) ? -1 :178 (p ->time.hours < pp->time.hours) ? 1 :179 (p ->time.hours > pp->time.hours) ? -1 :180 (p ->time.minutes < pp->time.minutes) ? 1 :181 (p ->time.minutes > pp->time.minutes) ? -1 :182 (p ->time.seconds < pp->time.seconds) ? 1 :183 (p ->time.seconds > pp->time.seconds) ? -1 : 0;188 ret = (pai1->date.year < pai2->date.year) ? 1 : 189 (pai1->date.year > pai2->date.year) ? -1 : 190 (pai1->date.month < pai2->date.month) ? 1 : 191 (pai1->date.month > pai2->date.month) ? -1 : 192 (pai1->date.day < pai2->date.day) ? 1 : 193 (pai1->date.day > pai2->date.day) ? -1 : 194 (pai1->time.hours < pai2->time.hours) ? 1 : 195 (pai1->time.hours > pai2->time.hours) ? -1 : 196 (pai1->time.minutes < pai2->time.minutes) ? 1 : 197 (pai1->time.minutes > pai2->time.minutes) ? -1 : 198 (pai1->time.seconds < pai2->time.seconds) ? 1 : 199 (pai1->time.seconds > pai2->time.seconds) ? -1 : 0; 184 200 break; 185 201 186 202 case SORT_SIZE: 187 ret = (p ->cbFile < pp->cbFile) ? 1 : (p->cbFile == pp->cbFile) ?203 ret = (pai1->cbFile < pai2->cbFile) ? 1 : (pai1->cbFile == pai2->cbFile) ? 188 204 0 : -1; 189 205 if(!ret) 190 ret = (p ->cbComp < pp->cbComp) ? 1 : (p->cbComp == pp->cbComp) ?206 ret = (pai1->cbComp < pai2->cbComp) ? 1 : (pai1->cbComp == pai2->cbComp) ? 191 207 0 : -1; 192 208 break; 193 209 194 210 case SORT_EASIZE: 195 ret = (p ->cbComp < pp->cbComp) ? 1 : (p->cbComp == pp->cbComp) ?211 ret = (pai1->cbComp < pai2->cbComp) ? 1 : (pai1->cbComp == pai2->cbComp) ? 196 212 0 : -1; 197 213 if(!ret) 198 ret = (p ->cbFile < pp->cbFile) ? 1 : (p->cbFile == pp->cbFile) ?214 ret = (pai1->cbFile < pai2->cbFile) ? 1 : (pai1->cbFile == pai2->cbFile) ? 199 215 0 : -1; 200 216 break; 201 217 } 202 218 if(!ret) 203 ret = (SHORT)stricmp(p ->szFileName,pp->szFileName);204 if(ret && ( arcsortFlags & SORT_REVERSE))219 ret = (SHORT)stricmp(pai1->szFileName,pai2->szFileName); 220 if(ret && (sortFlags & SORT_REVERSE)) 205 221 ret = (ret > 0) ? -1 : 1; 206 222 return ret; 207 223 } 208 return (SHORT)stricmp(p ->szFileName,pp->szFileName);224 return (SHORT)stricmp(pai1->szFileName,pai2->szFileName); 209 225 } 210 226 211 227 212 INT APIENTRY ArcFilter (PMINIRECORDCORE rmini,PVOID arg)228 static INT APIENTRY ArcFilter (PMINIRECORDCORE rmini,PVOID arg) 213 229 { 214 230 DIRCNRDATA *dcd = (DIRCNRDATA *)arg; … … 246 262 247 263 248 MRESULT EXPENTRY ArcFrameWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)264 static MRESULT EXPENTRY ArcFrameWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 249 265 { 250 266 return CommonFrameWndProc(ARC_CNR,hwnd,msg,mp1,mp2); … … 252 268 253 269 254 BOOL IsArcThere (HWND hwnd, CHAR *arcname)270 static BOOL IsArcThere (HWND hwnd, CHAR *arcname) 255 271 { 256 272 if(arcname) { … … 695 711 dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd, 696 712 QW_PARENT), 697 ARC_CNR),698 0);713 ARC_CNR), 714 QWL_USER); 699 715 if(id == DIR_SORT) { 700 716 if(dcd) … … 1139 1155 1140 1156 switch(msg) { 1141 case WM_CREATE:1142 break;1143 1144 1157 case DM_PRINTOBJECT: 1145 1158 case DM_DISCARDOBJECT: … … 1993 2006 1994 2007 1995 MRESULT EXPENTRY ArcCnrWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)2008 static MRESULT EXPENTRY ArcCnrWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 1996 2009 { 1997 2010 DIRCNRDATA *dcd = WinQueryWindowPtr(hwnd,QWL_USER); … … 2433 2446 dcd->sortFlags, 2434 2447 TRUE); 2448 DefArcSortFlags = dcd->sortFlags; // Remember for new windows 2435 2449 } 2436 2450 } … … 2887 2901 dcd->sortFlags, 2888 2902 TRUE); 2903 DefArcSortFlags = dcd->sortFlags; // Remember for new windows 2889 2904 break; 2890 2905 … … 3510 3525 3511 3526 HWND StartArcCnr (HWND hwndParent,HWND hwndCaller,CHAR *arcname,INT flags, 3512 ARC_TYPE *sinfo) {3513 3527 ARC_TYPE *sinfo) 3528 { 3514 3529 /* 3515 3530 * bitmapped flags: … … 3625 3640 dcd->dontclose = ((flags & 4) != 0); 3626 3641 dcd->info = info; 3642 dcd->sortFlags = DefArcSortFlags; 3627 3643 { 3628 3644 PFNWP oldproc; … … 3631 3647 (PFNWP)ArcFrameWndProc); 3632 3648 WinSetWindowPtr(hwndFrame, 3633 0,3649 QWL_USER, 3634 3650 (PVOID)oldproc); 3635 3651 } … … 3651 3667 if(dcd->hwndCnr) { 3652 3668 WinSetWindowPtr(dcd->hwndCnr, 3653 0,3669 QWL_USER, 3654 3670 (PVOID)dcd); 3655 3671 { … … 3790 3806 return hwndFrame; 3791 3807 } 3792
Note:
See TracChangeset
for help on using the changeset viewer.