Mercurial > mm7
diff mm7_3.cpp @ 166:71b13d70f5a6
Слияние
author | Ritor1 |
---|---|
date | Thu, 14 Feb 2013 14:48:54 +0600 |
parents | 572d821561f3 933e2655c33d |
children | 90521fb9766c |
line wrap: on
line diff
--- a/mm7_3.cpp Thu Feb 14 14:48:43 2013 +0600 +++ b/mm7_3.cpp Thu Feb 14 14:48:54 2013 +0600 @@ -19826,147 +19826,95 @@ //----- (0044C768) -------------------------------------------------------- char *__fastcall FitTextInAWindow(const char *pInString, GUIFont *pFont, GUIWindow *pWindow, unsigned int uX, int a5) { - const char *v5; // edi@1 - GUIFont *v6; // esi@1 unsigned int v8; // eax@3 - int v9; // edi@3 unsigned __int8 v10; // cl@4 - int v11; // edx@10 GUICharMetric *v12; // ecx@10 - int v13; // edx@11 - int v14; // edx@12 - int v15; // edx@13 unsigned int v16; // esi@15 unsigned int v17; // edx@15 unsigned int v18; // ecx@15 - int v19; // ebx@16 - unsigned __int8 v20; // zf@16 - char v21; // sf@16 - unsigned __int8 v22; // of@16 - int v23; // edi@16 unsigned __int8 v24; // dl@17 int v25; // edi@39 int v26; // eax@42 std::string v27; // [sp-18h] [bp-40h]@2 const char *v28; // [sp-8h] [bp-30h]@2 int v29; // [sp-4h] [bp-2Ch]@2 - const char *v30; // [sp+Ch] [bp-1Ch]@1 char Str[3]; // [sp+10h] [bp-18h]@42 char v32; // [sp+13h] [bp-15h]@42 - size_t v33; // [sp+14h] [bp-14h]@3 - unsigned int v34; // [sp+18h] [bp-10h]@3 - GUIFont *v35; // [sp+1Ch] [bp-Ch]@1 + int v33; // [sp+14h] [bp-14h]@3 int v36; // [sp+20h] [bp-8h]@3 - int v37; // [sp+24h] [bp-4h]@3 - - v5 = pInString; - v6 = pFont; - v30 = pInString; - v35 = pFont; + if ( !pInString ) { MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:445", 0); return 0; } v33 = strlen(pInString); - strcpy(pTmpBuf3, v5); + strcpy(pTmpBuf3, pInString); v8 = uX; - v9 = 0; v36 = 0; - v34 = uX; - v37 = 0; - if ( (signed int)v33 > 0 ) - { - while ( 1 ) - { - v10 = pTmpBuf3[v9]; - if ((v10 < v6->cFirstChar || v10 > v6->cLastChar) - && v10 != '\f' && v10 != '\r' && v10 != '\t' && v10 != '\n' ) - goto LABEL_34; - v11 = v10 - 9; - v12 = &v6->pMetrics[v10]; - if ( !v11 ) - { - strncpy(Str, &pTmpBuf3[v9 + 1], 3u); - v32 = 0; - v26 = atoi(Str); - v8 = uX + v26; - v25 = v9 + 3; - v34 = v8; - goto LABEL_43; - } - v13 = v11 - 1; - if ( !v13 ) - break; - v14 = v13 - 2; - if ( !v14 ) - { - v25 = v9 + 5; -LABEL_43: - v37 = v25; - goto LABEL_34; - } - v15 = v14 - 1; - if ( v15 ) - { - if ( v15 != 19 ) - { - v16 = v12->uRightSpacing; - v17 = v12->uWidth; - v18 = v12->uLeftSpacing; - if ( v8 + v16 + v18 + v17 < pWindow->uFrameWidth ) - { - if ( v37 > v36 ) - v8 += v18; - v8 += v17; - if ( v37 < (signed int)v33 ) - v8 += v16; - v6 = v35; - } - else - { - v19 = v36; - v8 = v34; - v22 = v36 > v37; - v20 = v36 == v37; - v21 = v36 - v37 < 0; - v6 = v35; - pTmpBuf3[v36] = 10; - v23 = v19; - if ( (unsigned __int8)(v21 ^ v22) | v20 ) - { - do - { - v24 = pTmpBuf3[v23]; - if ( v24 >= v6->cFirstChar && v24 <= v6->cLastChar || v24 == 12 || v24 == 13 || v24 == 9 || v24 == 10 ) - { - if ( v23 > v19 ) - v8 += v6->pMetrics[v24].uLeftSpacing; - v8 += *((int *)&v6->cFirstChar + 3 * v24 + 9); - if ( v23 < v37 ) - v8 += v6->pMetrics[v24].uRightSpacing; - } - ++v23; - } - while ( v23 <= v37 ); - } - } - goto LABEL_34; - } - v8 += v12->uWidth; - goto LABEL_41; - } - if ( !a5 ) - return (char *)v30; -LABEL_34: - v9 = v37++ + 1; - if ( v37 >= (signed int)v33 ) - return pTmpBuf3; - } - v8 = v34; -LABEL_41: - v36 = v9; - goto LABEL_34; + for(int i=0;i<v33;i++) + { + v10 = pTmpBuf3[i]; + if(!(v10 < pFont->cFirstChar || v10 > pFont->cLastChar) || v10 == '\f' || v10 == '\r' || v10 == '\t' || v10 == '\n' ) + { + v12 = &pFont->pMetrics[v10]; + if ( v10 == '\t' ) + { + strncpy(Str, &pTmpBuf3[i + 1], 3u); + v32 = 0; + v26 = atoi(Str); + v8 = uX + v26; + i+=3; + } + else if ( v10 == '\n' ) + { + v36 = i; + } + else if ( v10 == '\f' ) + { + i+=5; + } + else if ( v10 == '\r' && !a5) + return (char *)pInString; + else if ( v10 == ' ' ) + { + v8 += v12->uWidth; + v36 = i; + } + else + { + v16 = v12->uRightSpacing; + v17 = v12->uWidth; + v18 = v12->uLeftSpacing; + if ( v8 + v16 + v18 + v17 < pWindow->uFrameWidth ) + { + if ( i > v36 ) + v8 += v18; + v8 += v17; + if ( i < v33 ) + v8 += v16; + } + else + { + pTmpBuf3[v36] = 10; + if ( v36 == i )//(unsigned __int8)(v21 ^ v22) | v20 ) + { + for(int j=v36;j<=i;j++) + { + v24 = pTmpBuf3[j]; + if ( v24 >= pFont->cFirstChar && v24 <= pFont->cLastChar || v24 == '\f' || v24 == '\r' || v24 == '\t' || v24 == '\n' ) + { + if ( j > v36 ) + v8 += pFont->pMetrics[v24].uLeftSpacing; + v8 += pFont->pMetrics[v24].uWidth;//*((int *)&pFont->cFirstChar + 3 * v24 + 9); + if ( j < i ) + v8 += pFont->pMetrics[v24].uRightSpacing; + } + } + } + } + } + } } return pTmpBuf3; }