Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenstyle.c
Go to the documentation of this file.
00001 /* 00002 * RichEdit style management functions 00003 * 00004 * Copyright 2004 by Krzysztof Foltman 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #include "editor.h" 00022 00023 WINE_DEFAULT_DEBUG_CHANNEL(richedit); 00024 WINE_DECLARE_DEBUG_CHANNEL(richedit_style); 00025 00026 static int all_refs = 0; 00027 00028 /* the following routines assume that: 00029 * - char2[AW] extends char[AW] by adding fields at the end of the charA form) 00030 * - szFaceName is the last field of char[AW] form, and wWeight the first of 2[AW] 00031 * - the difference between A and W form is the szFaceName as Ansi vs Unicode string 00032 * - because of alignment, offset of wWeight field in 2[AW] structure *IS NOT* 00033 * sizeof(char[AW]) 00034 */ 00035 00036 CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from) 00037 { 00038 if (from->cbSize == sizeof(CHARFORMATA)) 00039 { 00040 CHARFORMATA *f = (CHARFORMATA *)from; 00041 CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName)); 00042 to->cbSize = sizeof(CHARFORMAT2W); 00043 if (f->dwMask & CFM_FACE) { 00044 MultiByteToWideChar(0, 0, f->szFaceName, -1, to->szFaceName, sizeof(to->szFaceName)/sizeof(WCHAR)); 00045 } 00046 return to; 00047 } 00048 if (from->cbSize == sizeof(CHARFORMATW)) 00049 { 00050 CHARFORMATW *f = (CHARFORMATW *)from; 00051 CopyMemory(to, f, sizeof(*f)); 00052 /* theoretically, we don't need to zero the remaining memory */ 00053 ZeroMemory(&to->wWeight, sizeof(CHARFORMAT2W)-FIELD_OFFSET(CHARFORMAT2W, wWeight)); 00054 to->cbSize = sizeof(CHARFORMAT2W); 00055 return to; 00056 } 00057 if (from->cbSize == sizeof(CHARFORMAT2A)) 00058 { 00059 CHARFORMAT2A *f = (CHARFORMAT2A *)from; 00060 /* copy the A structure without face name */ 00061 CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName)); 00062 /* convert face name */ 00063 if (f->dwMask & CFM_FACE) 00064 MultiByteToWideChar(0, 0, f->szFaceName, -1, to->szFaceName, sizeof(to->szFaceName)/sizeof(WCHAR)); 00065 /* copy the rest of the 2A structure to 2W */ 00066 CopyMemory(&to->wWeight, &f->wWeight, sizeof(CHARFORMAT2A)-FIELD_OFFSET(CHARFORMAT2A, wWeight)); 00067 to->cbSize = sizeof(CHARFORMAT2W); 00068 return to; 00069 } 00070 00071 return (from->cbSize >= sizeof(CHARFORMAT2W)) ? from : NULL; 00072 } 00073 00074 static CHARFORMAT2W *ME_ToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from) 00075 { 00076 assert(from->cbSize == sizeof(CHARFORMAT2W)); 00077 if (to->cbSize == sizeof(CHARFORMATA)) 00078 { 00079 CHARFORMATA *t = (CHARFORMATA *)to; 00080 CopyMemory(t, from, FIELD_OFFSET(CHARFORMATA, szFaceName)); 00081 WideCharToMultiByte(0, 0, from->szFaceName, -1, t->szFaceName, sizeof(t->szFaceName), 0, 0); 00082 if (from->dwMask & CFM_UNDERLINETYPE) 00083 { 00084 switch (from->bUnderlineType) 00085 { 00086 case CFU_CF1UNDERLINE: 00087 to->dwMask |= CFM_UNDERLINE; 00088 to->dwEffects |= CFE_UNDERLINE; 00089 break; 00090 case CFU_UNDERLINENONE: 00091 to->dwMask |= CFM_UNDERLINE; 00092 to->dwEffects &= ~CFE_UNDERLINE; 00093 break; 00094 } 00095 } 00096 t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */ 00097 return to; 00098 } 00099 if (to->cbSize == sizeof(CHARFORMATW)) 00100 { 00101 CHARFORMATW *t = (CHARFORMATW *)to; 00102 CopyMemory(t, from, sizeof(*t)); 00103 if (from->dwMask & CFM_UNDERLINETYPE) 00104 { 00105 switch (from->bUnderlineType) 00106 { 00107 case CFU_CF1UNDERLINE: 00108 to->dwMask |= CFM_UNDERLINE; 00109 to->dwEffects |= CFE_UNDERLINE; 00110 break; 00111 case CFU_UNDERLINENONE: 00112 to->dwMask |= CFM_UNDERLINE; 00113 to->dwEffects &= ~CFE_UNDERLINE; 00114 break; 00115 } 00116 } 00117 t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */ 00118 return to; 00119 } 00120 if (to->cbSize == sizeof(CHARFORMAT2A)) 00121 { 00122 CHARFORMAT2A *t = (CHARFORMAT2A *)to; 00123 /* copy the A structure without face name */ 00124 CopyMemory(t, from, FIELD_OFFSET(CHARFORMATA, szFaceName)); 00125 /* convert face name */ 00126 WideCharToMultiByte(0, 0, from->szFaceName, -1, t->szFaceName, sizeof(t->szFaceName), 0, 0); 00127 /* copy the rest of the 2A structure to 2W */ 00128 CopyMemory(&t->wWeight, &from->wWeight, sizeof(CHARFORMAT2W)-FIELD_OFFSET(CHARFORMAT2W,wWeight)); 00129 t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */ 00130 return to; 00131 } 00132 assert(to->cbSize >= sizeof(CHARFORMAT2W)); 00133 return from; 00134 } 00135 00136 void ME_CopyToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from) 00137 { 00138 if (ME_ToCFAny(to, from) == from) 00139 CopyMemory(to, from, to->cbSize); 00140 } 00141 00142 ME_Style *ME_MakeStyle(CHARFORMAT2W *style) 00143 { 00144 ME_Style *s = ALLOC_OBJ(ME_Style); 00145 00146 assert(style->cbSize == sizeof(CHARFORMAT2W)); 00147 s->fmt = *style; 00148 s->nSequence = -2; 00149 s->nRefs = 1; 00150 s->hFont = NULL; 00151 memset(&s->tm, 0, sizeof(s->tm)); 00152 s->tm.tmAscent = -1; 00153 all_refs++; 00154 TRACE_(richedit_style)("ME_MakeStyle %p, total refs=%d\n", s, all_refs); 00155 return s; 00156 } 00157 00158 #define COPY_STYLE_ITEM(mask, member) \ 00159 if (style->dwMask & mask) { \ 00160 s->fmt.dwMask |= mask;\ 00161 s->fmt.member = style->member;\ 00162 } 00163 00164 #define COPY_STYLE_ITEM_MEMCPY(mask, member) \ 00165 if (style->dwMask & mask) { \ 00166 s->fmt.dwMask |= mask;\ 00167 CopyMemory(s->fmt.member, style->member, sizeof(style->member));\ 00168 } 00169 00170 void ME_InitCharFormat2W(CHARFORMAT2W *pFmt) 00171 { 00172 ZeroMemory(pFmt, sizeof(CHARFORMAT2W)); 00173 pFmt->cbSize = sizeof(CHARFORMAT2W); 00174 } 00175 00176 ME_Style *ME_ApplyStyle(ME_Style *sSrc, CHARFORMAT2W *style) 00177 { 00178 ME_Style *s = ME_MakeStyle(&sSrc->fmt); 00179 assert(style->cbSize == sizeof(CHARFORMAT2W)); 00180 COPY_STYLE_ITEM(CFM_ANIMATION, bAnimation); 00181 COPY_STYLE_ITEM(CFM_BACKCOLOR, crBackColor); 00182 COPY_STYLE_ITEM(CFM_CHARSET, bCharSet); 00183 COPY_STYLE_ITEM(CFM_COLOR, crTextColor); 00184 COPY_STYLE_ITEM_MEMCPY(CFM_FACE, szFaceName); 00185 COPY_STYLE_ITEM(CFM_KERNING, wKerning); 00186 COPY_STYLE_ITEM(CFM_LCID, lcid); 00187 COPY_STYLE_ITEM(CFM_OFFSET, yOffset); 00188 COPY_STYLE_ITEM(CFM_REVAUTHOR, bRevAuthor); 00189 if (style->dwMask & CFM_SIZE) { 00190 s->fmt.dwMask |= CFM_SIZE; 00191 s->fmt.yHeight = min(style->yHeight, yHeightCharPtsMost * 20); 00192 } 00193 COPY_STYLE_ITEM(CFM_SPACING, sSpacing); 00194 COPY_STYLE_ITEM(CFM_STYLE, sStyle); 00195 COPY_STYLE_ITEM(CFM_UNDERLINETYPE, bUnderlineType); 00196 COPY_STYLE_ITEM(CFM_WEIGHT, wWeight); 00197 /* FIXME: this is not documented this way, but that's the more logical */ 00198 COPY_STYLE_ITEM(CFM_FACE, bPitchAndFamily); 00199 00200 s->fmt.dwEffects &= ~(style->dwMask); 00201 s->fmt.dwEffects |= style->dwEffects & style->dwMask; 00202 s->fmt.dwMask |= style->dwMask; 00203 if (style->dwMask & CFM_COLOR) 00204 { 00205 if (style->dwEffects & CFE_AUTOCOLOR) 00206 s->fmt.dwEffects |= CFE_AUTOCOLOR; 00207 else 00208 s->fmt.dwEffects &= ~CFE_AUTOCOLOR; 00209 } 00210 if (style->dwMask & CFM_UNDERLINE) 00211 { 00212 s->fmt.dwMask |= CFM_UNDERLINETYPE; 00213 s->fmt.bUnderlineType = (style->dwEffects & CFM_UNDERLINE) ? 00214 CFU_CF1UNDERLINE : CFU_UNDERLINENONE; 00215 } 00216 if (style->dwMask & CFM_BOLD && !(style->dwMask & CFM_WEIGHT)) 00217 { 00218 s->fmt.wWeight = (style->dwEffects & CFE_BOLD) ? FW_BOLD : FW_NORMAL; 00219 } else if (style->dwMask & CFM_WEIGHT && !(style->dwMask & CFM_BOLD)) { 00220 if (style->wWeight > FW_NORMAL) 00221 s->fmt.dwEffects |= CFE_BOLD; 00222 else 00223 s->fmt.dwEffects &= ~CFE_BOLD; 00224 } 00225 return s; 00226 } 00227 00228 void ME_CopyCharFormat(CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc) 00229 { 00230 /* using this with non-2W structs is forbidden */ 00231 assert(pSrc->cbSize == sizeof(CHARFORMAT2W)); 00232 assert(pDest->cbSize == sizeof(CHARFORMAT2W)); 00233 *pDest = *pSrc; 00234 } 00235 00236 static void ME_DumpStyleEffect(char **p, const char *name, const CHARFORMAT2W *fmt, int mask) 00237 { 00238 *p += sprintf(*p, "%-22s%s\n", name, (fmt->dwMask & mask) ? ((fmt->dwEffects & mask) ? "YES" : "no") : "N/A"); 00239 } 00240 00241 void ME_DumpStyle(ME_Style *s) 00242 { 00243 char buf[2048]; 00244 ME_DumpStyleToBuf(&s->fmt, buf); 00245 TRACE_(richedit_style)("%s\n", buf); 00246 } 00247 00248 void ME_DumpStyleToBuf(CHARFORMAT2W *pFmt, char buf[2048]) 00249 { 00250 /* FIXME only CHARFORMAT styles implemented */ 00251 /* this function sucks, doesn't check for buffer overruns but it's "good enough" as for debug code */ 00252 char *p; 00253 p = buf; 00254 p += sprintf(p, "Font face: "); 00255 if (pFmt->dwMask & CFM_FACE) { 00256 WCHAR *q = pFmt->szFaceName; 00257 while(*q) { 00258 *p++ = (*q > 255) ? '?' : *q; 00259 q++; 00260 } 00261 } else 00262 p += sprintf(p, "N/A"); 00263 00264 if (pFmt->dwMask & CFM_SIZE) 00265 p += sprintf(p, "\nFont size: %d\n", pFmt->yHeight); 00266 else 00267 p += sprintf(p, "\nFont size: N/A\n"); 00268 00269 if (pFmt->dwMask & CFM_OFFSET) 00270 p += sprintf(p, "Char offset: %d\n", pFmt->yOffset); 00271 else 00272 p += sprintf(p, "Char offset: N/A\n"); 00273 00274 if (pFmt->dwMask & CFM_CHARSET) 00275 p += sprintf(p, "Font charset: %d\n", (int)pFmt->bCharSet); 00276 else 00277 p += sprintf(p, "Font charset: N/A\n"); 00278 00279 /* I'm assuming CFM_xxx and CFE_xxx are the same values, fortunately it IS true wrt used flags*/ 00280 ME_DumpStyleEffect(&p, "Font bold:", pFmt, CFM_BOLD); 00281 ME_DumpStyleEffect(&p, "Font italic:", pFmt, CFM_ITALIC); 00282 ME_DumpStyleEffect(&p, "Font underline:", pFmt, CFM_UNDERLINE); 00283 ME_DumpStyleEffect(&p, "Font strikeout:", pFmt, CFM_STRIKEOUT); 00284 ME_DumpStyleEffect(&p, "Hidden text:", pFmt, CFM_HIDDEN); 00285 p += sprintf(p, "Text color: "); 00286 if (pFmt->dwMask & CFM_COLOR) 00287 { 00288 if (pFmt->dwEffects & CFE_AUTOCOLOR) 00289 p += sprintf(p, "auto\n"); 00290 else 00291 p += sprintf(p, "%06x\n", (int)pFmt->crTextColor); 00292 } 00293 else 00294 p += sprintf(p, "N/A\n"); 00295 ME_DumpStyleEffect(&p, "Text protected:", pFmt, CFM_PROTECTED); 00296 } 00297 00298 00299 static void 00300 ME_LogFontFromStyle(ME_Context* c, LOGFONTW *lf, const ME_Style *s) 00301 { 00302 ZeroMemory(lf, sizeof(LOGFONTW)); 00303 lstrcpyW(lf->lfFaceName, s->fmt.szFaceName); 00304 00305 lf->lfHeight = ME_twips2pointsY(c, -s->fmt.yHeight); 00306 00307 lf->lfWeight = FW_NORMAL; 00308 if (s->fmt.dwEffects & s->fmt.dwMask & CFM_BOLD) 00309 lf->lfWeight = FW_BOLD; 00310 if (s->fmt.dwMask & CFM_WEIGHT) 00311 lf->lfWeight = s->fmt.wWeight; 00312 if (s->fmt.dwEffects & s->fmt.dwMask & CFM_ITALIC) 00313 lf->lfItalic = 1; 00314 if (s->fmt.dwEffects & s->fmt.dwMask & (CFM_UNDERLINE | CFE_LINK)) 00315 lf->lfUnderline = 1; 00316 if (s->fmt.dwMask & CFM_UNDERLINETYPE && s->fmt.bUnderlineType == CFU_CF1UNDERLINE) 00317 lf->lfUnderline = 1; 00318 if (s->fmt.dwEffects & s->fmt.dwMask & CFM_STRIKEOUT) 00319 lf->lfStrikeOut = 1; 00320 if (s->fmt.dwEffects & s->fmt.dwMask & (CFM_SUBSCRIPT|CFM_SUPERSCRIPT)) 00321 lf->lfHeight = (lf->lfHeight*2)/3; 00322 /*lf.lfQuality = PROOF_QUALITY; */ 00323 if (s->fmt.dwMask & CFM_FACE) 00324 lf->lfPitchAndFamily = s->fmt.bPitchAndFamily; 00325 if (s->fmt.dwMask & CFM_CHARSET) 00326 lf->lfCharSet = s->fmt.bCharSet; 00327 } 00328 00329 void ME_CharFormatFromLogFont(HDC hDC, const LOGFONTW *lf, CHARFORMAT2W *fmt) 00330 { 00331 int ry; 00332 00333 ME_InitCharFormat2W(fmt); 00334 ry = GetDeviceCaps(hDC, LOGPIXELSY); 00335 lstrcpyW(fmt->szFaceName, lf->lfFaceName); 00336 fmt->dwEffects = 0; 00337 fmt->dwMask = CFM_WEIGHT|CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE|CFM_STRIKEOUT|CFM_SIZE|CFM_FACE|CFM_CHARSET; 00338 fmt->wWeight = lf->lfWeight; 00339 fmt->yHeight = -lf->lfHeight*1440/ry; 00340 if (lf->lfWeight > FW_NORMAL) fmt->dwEffects |= CFM_BOLD; 00341 if (lf->lfItalic) fmt->dwEffects |= CFM_ITALIC; 00342 if (lf->lfUnderline) fmt->dwEffects |= CFM_UNDERLINE; 00343 /* notice that if a logfont was created with underline due to CFM_LINK, this 00344 would add an erroneous CFM_UNDERLINE. This isn't currently ever a problem. */ 00345 if (lf->lfStrikeOut) fmt->dwEffects |= CFM_STRIKEOUT; 00346 fmt->bPitchAndFamily = lf->lfPitchAndFamily; 00347 fmt->bCharSet = lf->lfCharSet; 00348 } 00349 00350 static BOOL ME_IsFontEqual(const LOGFONTW *p1, const LOGFONTW *p2) 00351 { 00352 if (memcmp(p1, p2, sizeof(LOGFONTW)-sizeof(p1->lfFaceName))) 00353 return FALSE; 00354 if (lstrcmpW(p1->lfFaceName, p2->lfFaceName)) 00355 return FALSE; 00356 return TRUE; 00357 } 00358 00359 HFONT ME_SelectStyleFont(ME_Context *c, ME_Style *s) 00360 { 00361 HFONT hOldFont; 00362 LOGFONTW lf; 00363 int i, nEmpty, nAge = 0x7FFFFFFF; 00364 ME_FontCacheItem *item; 00365 assert(s); 00366 00367 ME_LogFontFromStyle(c, &lf, s); 00368 00369 for (i=0; i<HFONT_CACHE_SIZE; i++) 00370 c->editor->pFontCache[i].nAge++; 00371 for (i=0, nEmpty=-1, nAge=0; i<HFONT_CACHE_SIZE; i++) 00372 { 00373 item = &c->editor->pFontCache[i]; 00374 if (!item->nRefs) 00375 { 00376 if (item->nAge > nAge) 00377 nEmpty = i, nAge = item->nAge; 00378 } 00379 if (item->hFont && ME_IsFontEqual(&item->lfSpecs, &lf)) 00380 break; 00381 } 00382 if (i < HFONT_CACHE_SIZE) /* found */ 00383 { 00384 item = &c->editor->pFontCache[i]; 00385 TRACE_(richedit_style)("font reused %d\n", i); 00386 00387 s->hFont = item->hFont; 00388 item->nRefs++; 00389 } 00390 else 00391 { 00392 item = &c->editor->pFontCache[nEmpty]; /* this legal even when nEmpty == -1, as we don't dereference it */ 00393 00394 assert(nEmpty != -1); /* otherwise we leak cache entries or get too many fonts at once*/ 00395 if (item->hFont) { 00396 TRACE_(richedit_style)("font deleted %d\n", nEmpty); 00397 DeleteObject(item->hFont); 00398 item->hFont = NULL; 00399 } 00400 s->hFont = CreateFontIndirectW(&lf); 00401 assert(s->hFont); 00402 TRACE_(richedit_style)("font created %d\n", nEmpty); 00403 item->hFont = s->hFont; 00404 item->nRefs = 1; 00405 item->lfSpecs = lf; 00406 } 00407 hOldFont = SelectObject(c->hDC, s->hFont); 00408 /* should be cached too, maybe ? */ 00409 GetTextMetricsW(c->hDC, &s->tm); 00410 return hOldFont; 00411 } 00412 00413 void ME_UnselectStyleFont(ME_Context *c, ME_Style *s, HFONT hOldFont) 00414 { 00415 int i; 00416 00417 assert(s); 00418 SelectObject(c->hDC, hOldFont); 00419 for (i=0; i<HFONT_CACHE_SIZE; i++) 00420 { 00421 ME_FontCacheItem *pItem = &c->editor->pFontCache[i]; 00422 if (pItem->hFont == s->hFont && pItem->nRefs > 0) 00423 { 00424 pItem->nRefs--; 00425 pItem->nAge = 0; 00426 s->hFont = NULL; 00427 return; 00428 } 00429 } 00430 assert(0 == "UnselectStyleFont without SelectStyleFont"); 00431 } 00432 00433 static void ME_DestroyStyle(ME_Style *s) { 00434 if (s->hFont) 00435 { 00436 DeleteObject(s->hFont); 00437 s->hFont = NULL; 00438 } 00439 FREE_OBJ(s); 00440 } 00441 00442 void ME_AddRefStyle(ME_Style *s) 00443 { 00444 assert(s->nRefs>0); /* style with 0 references isn't supposed to exist */ 00445 s->nRefs++; 00446 all_refs++; 00447 TRACE_(richedit_style)("ME_AddRefStyle %p, new refs=%d, total refs=%d\n", s, s->nRefs, all_refs); 00448 } 00449 00450 void ME_ReleaseStyle(ME_Style *s) 00451 { 00452 s->nRefs--; 00453 all_refs--; 00454 if (s->nRefs==0) 00455 TRACE_(richedit_style)("destroy style %p, total refs=%d\n", s, all_refs); 00456 else 00457 TRACE_(richedit_style)("release style %p, new refs=%d, total refs=%d\n", s, s->nRefs, all_refs); 00458 if (!all_refs) TRACE("all style references freed (good!)\n"); 00459 assert(s->nRefs>=0); 00460 if (!s->nRefs) 00461 ME_DestroyStyle(s); 00462 } 00463 00464 ME_Style *ME_GetInsertStyle(ME_TextEditor *editor, int nCursor) 00465 { 00466 if (ME_IsSelection(editor)) 00467 { 00468 ME_Cursor *from, *to; 00469 00470 ME_GetSelection(editor, &from, &to); 00471 ME_AddRefStyle(from->pRun->member.run.style); 00472 return from->pRun->member.run.style; 00473 } 00474 if (editor->pBuffer->pCharStyle) { 00475 ME_AddRefStyle(editor->pBuffer->pCharStyle); 00476 return editor->pBuffer->pCharStyle; 00477 } 00478 else 00479 { 00480 ME_Cursor *pCursor = &editor->pCursors[nCursor]; 00481 ME_DisplayItem *pRunItem = pCursor->pRun; 00482 ME_DisplayItem *pPrevItem = NULL; 00483 if (pCursor->nOffset) { 00484 ME_Run *pRun = &pRunItem->member.run; 00485 ME_AddRefStyle(pRun->style); 00486 return pRun->style; 00487 } 00488 pPrevItem = ME_FindItemBack(pRunItem, diRunOrParagraph); 00489 if (pPrevItem->type == diRun) 00490 { 00491 ME_AddRefStyle(pPrevItem->member.run.style); 00492 return pPrevItem->member.run.style; 00493 } 00494 else 00495 { 00496 ME_AddRefStyle(pRunItem->member.run.style); 00497 return pRunItem->member.run.style; 00498 } 00499 } 00500 } 00501 00502 void ME_SaveTempStyle(ME_TextEditor *editor) 00503 { 00504 ME_Style *old_style = editor->pBuffer->pCharStyle; 00505 editor->pBuffer->pCharStyle = ME_GetInsertStyle(editor, 0); 00506 if (old_style) 00507 ME_ReleaseStyle(old_style); 00508 } 00509 00510 void ME_ClearTempStyle(ME_TextEditor *editor) 00511 { 00512 if (!editor->pBuffer->pCharStyle) return; 00513 ME_ReleaseStyle(editor->pBuffer->pCharStyle); 00514 editor->pBuffer->pCharStyle = NULL; 00515 } Generated on Sun May 27 2012 04:25:59 for ReactOS by
1.7.6.1
|