Changeset 235 for trunk/src/helpers
- Timestamp:
- Dec 12, 2002, 12:50:50 PM (23 years ago)
- Location:
- trunk/src/helpers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dialog.c
r232 r235 92 92 #include "helpers\gpih.h" 93 93 #include "helpers\linklist.h" 94 #include "helpers\nlscache.h" 94 95 #include "helpers\standards.h" 95 96 #include "helpers\stringh.h" … … 1497 1498 strhncpy0(szText2, pcszText, sizeof(szText2)); 1498 1499 1500 #ifdef DEBUG_DIALOG_WINDOWS 1499 1501 _Pmpf(("Crash creating control of class 0x%lX (%s), title 0x%lX (%s)", 1500 1502 szClass2, 1501 1503 szText2)); 1504 #endif 1505 1502 1506 arc = ERROR_PROTECTION_VIOLATION; 1503 1507 } END_CATCH(); … … 1761 1765 LONG cxWidestRowsMinBox = pOwningTable->cxMinBox; // pWidestRow->cxMinBox; 1762 1766 1767 #ifdef DEBUG_DIALOG_WINDOWS 1763 1768 _Pmpf((" pWidestRow->cxMinBox %d", pWidestRow->cxMinBox)); 1764 1769 _Pmpf((" pOwningTable->cxMinBox %d", pOwningTable->cxMinBox)); 1770 #endif 1765 1771 1766 1772 // now, since we're supposed to set our own CONTENT … … 1860 1866 strhncpy0(szTemp, pControlDef->pcszText, sizeof(szTemp)); 1861 1867 strcpy(szTemp + 35, "..."); 1868 1869 #ifdef DEBUG_DIALOG_WINDOWS 1862 1870 _PmpfF((" widest column is [%s] cxMinContent %d", 1863 1871 szTemp, 1864 1872 pCorrespondingColumn->cxMinContent)); 1873 #endif 1865 1874 } 1866 1875 } … … 2242 2251 } 2243 2252 2253 #ifdef DEBUG_DIALOG_WINDOWS 2244 2254 _Pmpf((" cxMax found is %d", cxMax)); 2255 #endif 2245 2256 2246 2257 pTableDef->cxMinBox = cxMax … … 2394 2405 * 2395 2406 *@@changed V1.0.0 (2002-08-18) [umoeller]: mostly rewritten for new algorithm 2407 *@@changed V1.0.1 (2002-12-11) [umoeller]: added interface into nlsGetString 2396 2408 */ 2397 2409 … … 2446 2458 // copy control fields 2447 2459 pColumn->pcszClass = pControlDef->pcszClass; 2448 pColumn->pcszText = pControlDef->pcszText; 2460 2461 if (pControlDef->pcszText == LOAD_STRING) 2462 pColumn->pcszText = nlsGetString(pControlDef->usID); 2463 // V1.0.1 (2002-12-11) [umoeller] 2464 else 2465 pColumn->pcszText = pControlDef->pcszText; 2466 2449 2467 pColumn->flStyle = pControlDef->flStyle; 2450 2468 pColumn->usID = pControlDef->usID; … … 2569 2587 2570 2588 if (!(pDlgData = NEW(DLGPRIVATE))) 2571 return (ERROR_NOT_ENOUGH_MEMORY);2589 return ERROR_NOT_ENOUGH_MEMORY; 2572 2590 2573 2591 ZERO(pDlgData); … … 3894 3912 } 3895 3913 3896 return (MBID_CANCEL);3914 return MBID_CANCEL; 3897 3915 } 3898 3916 … … 3966 3984 { 3967 3985 // SHOW DIALOG 3968 return (dlghProcessMessageBox(hwndDlg,3969 3970 flFlags));3986 return dlghProcessMessageBox(hwndDlg, 3987 ulAlarmFlag, 3988 flFlags); 3971 3989 } 3972 3990 … … 3979 3997 MB_CANCEL | MB_MOVEABLE); 3980 3998 3981 return (DID_CANCEL);3999 return DID_CANCEL; 3982 4000 } 3983 4001 … … 4119 4137 xstrClear(&strTitle); 4120 4138 4121 return (pszReturn);4139 return pszReturn; 4122 4140 } 4123 4141 … … 4313 4331 } 4314 4332 4315 return (hwndFound);4333 return hwndFound; 4316 4334 } 4317 4335 … … 4346 4364 (MPARAM)TRUE, // upclick 4347 4365 0); 4348 return (TRUE);4366 return TRUE; 4349 4367 } 4350 4368 } … … 4354 4372 } 4355 4373 4356 return (FALSE);4374 return FALSE; 4357 4375 } 4358 4376 -
trunk/src/helpers/nlscache.c
r222 r235 83 83 STATIC ULONG G_cEntities = 0; 84 84 85 /* 86 *@@ ReplaceEntities: 85 STATIC HMTX G_hmtxStringsCache = NULLHANDLE; 86 STATIC TREE *G_StringsCache; 87 STATIC LONG G_cStringsInCache = 0; 88 89 90 /* 91 *@@ nlsReplaceEntities: 87 92 * 88 93 *@@added V0.9.16 (2001-09-29) [umoeller] 89 94 */ 90 95 91 STATIC ULONGReplaceEntities(PXSTRING pstr)96 ULONG nlsReplaceEntities(PXSTRING pstr) 92 97 { 93 98 ULONG ul, … … 107 112 } 108 113 109 return (rc); 110 } 111 112 /* 113 *@@ LoadString: 114 * 115 *@@added V0.9.18 (2002-03-08) [umoeller] 116 */ 117 118 STATIC void LoadString(ULONG ulID, 119 PSZ *ppsz, 120 PULONG pulLength) // out: length of new string (ptr can be NULL) 114 return rc; 115 } 116 117 /* 118 *@@ nlsLoadString: 119 * 120 *@@changed V0.9.0 [umoeller]: "string not found" is now re-allocated using strdup (avoids crashes) 121 *@@changed V0.9.0 (99-11-28) [umoeller]: added more meaningful error message 122 *@@changed V0.9.2 (2000-02-26) [umoeller]: made temporary buffer larger 123 *@@changed V0.9.16 (2001-09-29) [umoeller]: added entities support 124 *@@changed V0.9.16 (2002-01-26) [umoeller]: added pulLength param 125 *@@changed V1.0.0 (2002-09-17) [umoeller]: optimized 126 *@@changed V1.0.1 (2002-12-11) [umoeller]: moved this here from XWorkplace common.c 127 */ 128 129 VOID nlsLoadString(ULONG ulID, 130 PSZ *ppsz, 131 PULONG pulLength) // out: length of new string (ptr can be NULL) 121 132 { 122 133 CHAR szBuf[500]; … … 138 149 139 150 xstrInitCopy(&str, szBuf, 0); 140 ReplaceEntities(&str);151 nlsReplaceEntities(&str); 141 152 *ppsz = str.psz; 142 153 if (pulLength) … … 144 155 // do not free string 145 156 } 146 147 STATIC HMTX G_hmtxStringsCache = NULLHANDLE;148 STATIC TREE *G_StringsCache;149 STATIC LONG G_cStringsInCache = 0;150 157 151 158 /* … … 202 209 203 210 /* 211 *@@ Unload: 212 * removes all loaded strings from memory. 213 * 214 *@@added V0.9.9 (2001-04-04) [umoeller] 215 *@@changed V1.0.1 (2002-12-11) [umoeller]: moved this here from XWorkplace common.c 216 */ 217 218 STATIC VOID Unload(VOID) 219 { 220 // to delete all nodes, build a temporary 221 // array of all string node pointers; 222 // we don't want to rebalance the tree 223 // for each node 224 LONG cNodes = G_cStringsInCache; 225 PSTRINGTREENODE *papNodes 226 = (PSTRINGTREENODE*)treeBuildArray(G_StringsCache, 227 &cNodes); 228 if (papNodes) 229 { 230 // delete all nodes in array 231 ULONG ul; 232 for (ul = 0; 233 ul < cNodes; 234 ul++) 235 { 236 free(papNodes[ul]); 237 } 238 239 free(papNodes); 240 } 241 242 // reset the tree to "empty" 243 treeInit(&G_StringsCache, 244 &G_cStringsInCache); 245 } 246 247 /* 204 248 *@@ nlsInitStrings: 205 249 * initializes the NLS strings cache. Call this … … 214 258 ULONG cEntities) // in: array item count of paEntities or 0 215 259 { 216 G_hab = hab; 217 G_hmod = hmod; 218 G_paEntities = paEntities; 219 G_cEntities = cEntities; 260 BOOL fLocked = FALSE; 261 262 TRY_LOUD(excpt1) 263 { 264 if (fLocked = LockStrings()) 265 { 266 if (G_cStringsInCache) 267 // not first call: 268 Unload(); 269 270 G_hab = hab; 271 G_hmod = hmod; 272 G_paEntities = paEntities; 273 G_cEntities = cEntities; 274 } 275 } 276 CATCH(excpt1) {} END_CATCH(); 277 278 if (fLocked) 279 UnlockStrings(); 220 280 } 221 281 … … 275 335 *@@changed V0.9.16 (2001-10-19) [umoeller]: fixed bad string count which was never set 276 336 *@@changed V0.9.16 (2002-01-26) [umoeller]: optimized heap locality 337 *@@changed V1.0.1 (2002-12-11) [umoeller]: moved this here from XWorkplace common.c 277 338 */ 278 339 … … 299 360 ULONG ulLength = 0; 300 361 301 LoadString(ulStringID,302 &psz,303 &ulLength);362 nlsLoadString(ulStringID, 363 &psz, 364 &ulLength); 304 365 305 366 if ( (!psz) … … 336 397 UnlockStrings(); 337 398 338 return (pszReturn);339 } 340 341 399 return pszReturn; 400 } 401 402 -
trunk/src/helpers/winh.c
r232 r235 345 345 } 346 346 347 /* 348 *@@ winhDestroyWindow: 349 * wrapper around WinDestroyWindow that also sets 350 * *phwnd to NULLHANDLE to avoid loose window 351 * handles lying around. 352 * 353 *@@added V1.0.1 (2002-12-11) [umoeller] 354 */ 355 356 BOOL winhDestroyWindow(HWND *phwnd) 357 { 358 if ( (*phwnd) 359 && (WinDestroyWindow(*phwnd)) 360 ) 361 { 362 *phwnd = NULLHANDLE; 363 364 return TRUE; 365 } 366 367 return FALSE; 368 } 347 369 348 370 /*
Note:
See TracChangeset
for help on using the changeset viewer.