本文整理汇总了C++中ME_FindItemBack函数的典型用法代码示例。如果您正苦于以下问题:C++ ME_FindItemBack函数的具体用法?C++ ME_FindItemBack怎么用?C++ ME_FindItemBack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ME_FindItemBack函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ME_MoveCursorLines
static void
ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs)
{
ME_DisplayItem *pRun = pCursor->pRun;
ME_DisplayItem *pItem;
int x = ME_GetXForArrow(editor, pCursor);
if (editor->bCaretAtEnd && !pCursor->nOffset)
pRun = ME_FindItemBack(pRun, diRun);
if (!pRun)
return;
if (nRelOfs == -1)
{
/* start of this row */
pItem = ME_FindItemBack(pRun, diStartRow);
assert(pItem);
/* start of the previous row */
pItem = ME_FindItemBack(pItem, diStartRow);
}
else
{
/* start of the next row */
pItem = ME_FindItemFwd(pRun, diStartRow);
/* FIXME If diParagraph is before diStartRow, wrap the next paragraph?
*/
}
if (!pItem)
{
/* row not found - ignore */
return;
}
pCursor->pRun = ME_FindRunInRow(editor, pItem, x, &pCursor->nOffset, &editor->bCaretAtEnd);
assert(pCursor->pRun);
assert(pCursor->pRun->type == diRun);
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:35,代码来源:caret.c
示例2: ME_EnsureVisible
void ME_EnsureVisible(ME_TextEditor *editor, ME_DisplayItem *pRun)
{
ME_DisplayItem *pRow = ME_FindItemBack(pRun, diStartRow);
ME_DisplayItem *pPara = ME_FindItemBack(pRun, diParagraph);
int y, yrel, yheight, yold;
HWND hWnd = editor->hWnd;
assert(pRow);
assert(pPara);
y = pPara->member.para.nYPos+pRow->member.row.nYPos;
yheight = pRow->member.row.nHeight;
yold = ME_GetYScrollPos(editor);
yrel = y - yold;
if (yrel < 0) {
editor->nScrollPosY = y;
SetScrollPos(hWnd, SB_VERT, y, TRUE);
if (editor->bRedraw)
{
ScrollWindow(hWnd, 0, -yrel, NULL, NULL);
UpdateWindow(hWnd);
}
} else if (yrel + yheight > editor->sizeWindow.cy) {
int newy = y+yheight-editor->sizeWindow.cy;
editor->nScrollPosY = newy;
SetScrollPos(hWnd, SB_VERT, newy, TRUE);
if (editor->bRedraw)
{
ScrollWindow(hWnd, 0, -(newy-yold), NULL, NULL);
UpdateWindow(hWnd);
}
}
}
开发者ID:howard5888,项目名称:wineT,代码行数:33,代码来源:paint.c
示例3: ME_FindPixelPos
/* Finds the run and offset from the pixel position.
*
* x & y are pixel positions in virtual coordinates into the rich edit control,
* so client coordinates must first be adjusted by the scroll position.
*
* returns TRUE if the result was exactly under the cursor, otherwise returns
* FALSE, and result is set to the closest position to the coordinates.
*/
static BOOL ME_FindPixelPos(ME_TextEditor *editor, int x, int y,
ME_Cursor *result, BOOL *is_eol)
{
ME_DisplayItem *p = editor->pBuffer->pFirst->member.para.next_para;
BOOL isExact = TRUE;
x -= editor->rcFormat.left;
y -= editor->rcFormat.top;
if (is_eol)
*is_eol = FALSE;
/* find paragraph */
for (; p != editor->pBuffer->pLast; p = p->member.para.next_para)
{
assert(p->type == diParagraph);
if (y < p->member.para.pt.y + p->member.para.nHeight)
{
if (p->member.para.nFlags & MEPF_ROWSTART)
p = ME_FindPixelPosInTableRow(x, y, p);
y -= p->member.para.pt.y;
p = ME_FindItemFwd(p, diStartRow);
break;
} else if (p->member.para.nFlags & MEPF_ROWSTART) {
p = ME_GetTableRowEnd(p);
}
}
/* find row */
for (; p != editor->pBuffer->pLast; )
{
ME_DisplayItem *pp;
assert(p->type == diStartRow);
if (y < p->member.row.pt.y + p->member.row.nHeight) break;
pp = ME_FindItemFwd(p, diStartRow);
if (!pp) break;
p = pp;
}
if (p == editor->pBuffer->pLast)
{
/* The position is below the last paragraph, so the last row will be used
* rather than the end of the text, so the x position will be used to
* determine the offset closest to the pixel position. */
isExact = FALSE;
p = ME_FindItemBack(p, diStartRow);
if (!p) p = editor->pBuffer->pLast;
}
assert( p->type == diStartRow || p == editor->pBuffer->pLast );
if( p->type == diStartRow )
return ME_FindRunInRow( editor, p, x, result, is_eol ) && isExact;
result->pRun = ME_FindItemBack(p, diRun);
result->pPara = ME_GetParagraph(result->pRun);
result->nOffset = 0;
assert(result->pRun->member.run.nFlags & MERF_ENDPARA);
return FALSE;
}
开发者ID:AmesianX,项目名称:wine,代码行数:66,代码来源:caret.c
示例4: ME_AppendTableRow
ME_DisplayItem* ME_AppendTableRow(ME_TextEditor *editor,
ME_DisplayItem *table_row)
{
WCHAR endl = '\r', tab = '\t';
ME_DisplayItem *run;
PARAFORMAT2 *pFmt;
int i;
assert(table_row);
assert(table_row->type == diParagraph);
if (!editor->bEmulateVersion10) { /* v4.1 */
ME_DisplayItem *insertedCell, *para, *cell, *prevTableEnd;
cell = ME_FindItemFwd(ME_GetTableRowStart(table_row), diCell);
prevTableEnd = ME_GetTableRowEnd(table_row);
para = prevTableEnd->member.para.next_para;
run = ME_FindItemFwd(para, diRun);
editor->pCursors[0].pPara = para;
editor->pCursors[0].pRun = run;
editor->pCursors[0].nOffset = 0;
editor->pCursors[1] = editor->pCursors[0];
para = ME_InsertTableRowStartFromCursor(editor);
insertedCell = ME_FindItemFwd(para, diCell);
/* Copy cell properties */
insertedCell->member.cell.nRightBoundary = cell->member.cell.nRightBoundary;
insertedCell->member.cell.border = cell->member.cell.border;
while (cell->member.cell.next_cell) {
cell = cell->member.cell.next_cell;
para = ME_InsertTableCellFromCursor(editor);
insertedCell = ME_FindItemBack(para, diCell);
/* Copy cell properties */
insertedCell->member.cell.nRightBoundary = cell->member.cell.nRightBoundary;
insertedCell->member.cell.border = cell->member.cell.border;
};
para = ME_InsertTableRowEndFromCursor(editor);
*para->member.para.pFmt = *prevTableEnd->member.para.pFmt;
/* return the table row start for the inserted paragraph */
return ME_FindItemFwd(cell, diParagraph)->member.para.next_para;
} else { /* v1.0 - 3.0 */
run = ME_FindItemBack(table_row->member.para.next_para, diRun);
pFmt = table_row->member.para.pFmt;
assert(pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE);
editor->pCursors[0].pPara = table_row;
editor->pCursors[0].pRun = run;
editor->pCursors[0].nOffset = 0;
editor->pCursors[1] = editor->pCursors[0];
ME_InsertTextFromCursor(editor, 0, &endl, 1, run->member.run.style);
run = editor->pCursors[0].pRun;
for (i = 0; i < pFmt->cTabCount; i++) {
ME_InsertTextFromCursor(editor, 0, &tab, 1, run->member.run.style);
}
return table_row->member.para.next_para;
}
}
开发者ID:AmesianX,项目名称:wine,代码行数:53,代码来源:table.c
示例5: ME_ExtendAnchorSelection
/* Extends the selection with a word, line, or paragraph selection type.
*
* The selection is anchored by editor->pCursors[2-3] such that the text
* between the anchors will remain selected, and one end will be extended.
*
* editor->pCursors[0] should have the position to extend the selection to
* before this function is called.
*
* Nothing will be done if editor->nSelectionType equals stPosition.
*/
static void ME_ExtendAnchorSelection(ME_TextEditor *editor)
{
ME_Cursor tmp_cursor;
int curOfs, anchorStartOfs, anchorEndOfs;
if (editor->nSelectionType == stPosition || editor->nSelectionType == stDocument)
return;
curOfs = ME_GetCursorOfs(&editor->pCursors[0]);
anchorStartOfs = ME_GetCursorOfs(&editor->pCursors[3]);
anchorEndOfs = ME_GetCursorOfs(&editor->pCursors[2]);
tmp_cursor = editor->pCursors[0];
editor->pCursors[0] = editor->pCursors[2];
editor->pCursors[1] = editor->pCursors[3];
if (curOfs < anchorStartOfs)
{
/* Extend the left side of selection */
editor->pCursors[1] = tmp_cursor;
if (editor->nSelectionType == stWord)
ME_MoveCursorWords(editor, &editor->pCursors[1], -1);
else
{
ME_DisplayItem *pItem;
ME_DIType searchType = ((editor->nSelectionType == stLine) ?
diStartRowOrParagraph:diParagraph);
pItem = ME_FindItemBack(editor->pCursors[1].pRun, searchType);
editor->pCursors[1].pRun = ME_FindItemFwd(pItem, diRun);
editor->pCursors[1].pPara = ME_GetParagraph(editor->pCursors[1].pRun);
editor->pCursors[1].nOffset = 0;
}
}
else if (curOfs >= anchorEndOfs)
{
/* Extend the right side of selection */
editor->pCursors[0] = tmp_cursor;
if (editor->nSelectionType == stWord)
ME_MoveCursorWords(editor, &editor->pCursors[0], +1);
else
{
ME_DisplayItem *pItem;
ME_DIType searchType = ((editor->nSelectionType == stLine) ?
diStartRowOrParagraphOrEnd:diParagraphOrEnd);
pItem = ME_FindItemFwd(editor->pCursors[0].pRun, searchType);
if (pItem->type == diTextEnd)
editor->pCursors[0].pRun = ME_FindItemBack(pItem, diRun);
else
editor->pCursors[0].pRun = ME_FindItemFwd(pItem, diRun);
editor->pCursors[0].pPara = ME_GetParagraph(editor->pCursors[0].pRun);
editor->pCursors[0].nOffset = 0;
}
}
}
开发者ID:AmesianX,项目名称:wine,代码行数:61,代码来源:caret.c
示例6: ME_ArrowPageUp
static void ME_ArrowPageUp(ME_TextEditor *editor, ME_Cursor *pCursor)
{
ME_DisplayItem *pRun = pCursor->pRun;
ME_DisplayItem *pLast, *p;
int x, y, ys, yd, yp, yprev;
ME_Cursor tmp_curs = *pCursor;
x = ME_GetXForArrow(editor, pCursor);
if (!pCursor->nOffset && editor->bCaretAtEnd)
pRun = ME_FindItemBack(pRun, diRun);
p = ME_FindItemBack(pRun, diStartRowOrParagraph);
assert(p->type == diStartRow);
yp = ME_FindItemBack(p, diParagraph)->member.para.nYPos;
yprev = ys = y = yp + p->member.row.nYPos;
yd = y - editor->sizeWindow.cy;
pLast = p;
do {
p = ME_FindItemBack(p, diStartRowOrParagraph);
if (!p)
break;
if (p->type == diParagraph) { /* crossing paragraphs */
if (p->member.para.prev_para == NULL)
break;
yp = p->member.para.prev_para->member.para.nYPos;
continue;
}
y = yp + p->member.row.nYPos;
if (y < yd)
break;
pLast = p;
yprev = y;
} while(1);
pCursor->pRun = ME_FindRunInRow(editor, pLast, x, &pCursor->nOffset, &editor->bCaretAtEnd);
ME_UpdateSelection(editor, &tmp_curs);
if (yprev < editor->sizeWindow.cy)
{
ME_EnsureVisible(editor, ME_FindItemFwd(editor->pBuffer->pFirst, diRun));
ME_Repaint(editor);
}
else
{
ME_ScrollUp(editor, ys-yprev);
}
assert(pCursor->pRun);
assert(pCursor->pRun->type == diRun);
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:49,代码来源:caret.c
示例7: ME_InsertRunAtCursor
/******************************************************************************
* ME_InsertRunAtCursor
*
* Inserts a new run with given style, flags and content at a given position,
* which is passed as a cursor structure (which consists of a run and
* a run-relative character offset).
*/
ME_DisplayItem *
ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
const WCHAR *str, int len, int flags)
{
ME_DisplayItem *pDI, *insert_before = cursor->pRun, *prev;
if (cursor->nOffset)
{
if (cursor->nOffset == cursor->pRun->member.run.len)
{
insert_before = ME_FindItemFwd( cursor->pRun, diRun );
if (!insert_before) insert_before = cursor->pRun; /* Always insert before the final eop run */
}
else
{
ME_SplitRunSimple( editor, cursor );
insert_before = cursor->pRun;
}
}
add_undo_delete_run( editor, insert_before->member.run.para->nCharOfs +
insert_before->member.run.nCharOfs, len );
pDI = ME_MakeRun(style, flags);
pDI->member.run.nCharOfs = insert_before->member.run.nCharOfs;
pDI->member.run.len = len;
pDI->member.run.para = insert_before->member.run.para;
ME_InsertString( pDI->member.run.para->text, pDI->member.run.nCharOfs, str, len );
ME_InsertBefore( insert_before, pDI );
TRACE("Shift length:%d\n", len);
ME_PropagateCharOffset( insert_before, len );
insert_before->member.run.para->nFlags |= MEPF_REWRAP;
/* Move any cursors that were at the end of the previous run to the end of the inserted run */
prev = ME_FindItemBack( pDI, diRun );
if (prev)
{
int i;
for (i = 0; i < editor->nCursors; i++)
{
if (editor->pCursors[i].pRun == prev &&
editor->pCursors[i].nOffset == prev->member.run.len)
{
editor->pCursors[i].pRun = pDI;
editor->pCursors[i].nOffset = len;
}
}
}
return pDI;
}
开发者ID:mstefani,项目名称:wine-stable,代码行数:59,代码来源:run.c
示例8: ME_GetOuterParagraph
ME_DisplayItem* ME_GetOuterParagraph(ME_DisplayItem *para)
{
if (para->member.para.nFlags & MEPF_ROWEND)
para = para->member.para.prev_para;
while (para->member.para.pCell)
{
para = ME_GetTableRowStart(para);
if (!para->member.para.pCell)
break;
para = ME_FindItemBack(para->member.para.pCell, diParagraph);
}
return para;
}
开发者ID:AmesianX,项目名称:wine,代码行数:13,代码来源:table.c
示例9: ME_ArrowHome
static void ME_ArrowHome(ME_TextEditor *editor, ME_Cursor *pCursor)
{
ME_DisplayItem *pRow = ME_FindItemBack(pCursor->pRun, diStartRow);
/* bCaretAtEnd doesn't make sense if the cursor isn't set at the
first character of the next row */
assert(!editor->bCaretAtEnd || !pCursor->nOffset);
ME_WrapMarkedParagraphs(editor);
if (pRow) {
ME_DisplayItem *pRun;
if (editor->bCaretAtEnd && !pCursor->nOffset) {
pRow = ME_FindItemBack(pRow, diStartRow);
if (!pRow)
return;
}
pRun = ME_FindItemFwd(pRow, diRun);
if (pRun) {
pCursor->pRun = pRun;
pCursor->nOffset = 0;
}
}
editor->bCaretAtEnd = FALSE;
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:22,代码来源:caret.c
示例10: ME_BeginRow
static void ME_BeginRow(ME_WrapContext *wc)
{
PARAFORMAT2 *pFmt;
ME_DisplayItem *para = wc->pPara;
pFmt = para->member.para.pFmt;
wc->pRowStart = NULL;
wc->bOverflown = FALSE;
wc->pLastSplittableRun = NULL;
wc->bWordWrap = wc->context->editor->bWordWrap;
if (para->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND)) {
wc->nAvailWidth = 0;
wc->bWordWrap = FALSE;
if (para->member.para.nFlags & MEPF_ROWEND)
{
ME_Cell *cell = &ME_FindItemBack(para, diCell)->member.cell;
cell->nWidth = 0;
}
} else if (para->member.para.pCell) {
ME_Cell *cell = ¶->member.para.pCell->member.cell;
int width;
width = cell->nRightBoundary;
if (cell->prev_cell)
width -= cell->prev_cell->member.cell.nRightBoundary;
if (!cell->prev_cell)
{
int rowIndent = ME_GetTableRowEnd(para)->member.para.pFmt->dxStartIndent;
width -= rowIndent;
}
cell->nWidth = max(ME_twips2pointsX(wc->context, width), 0);
wc->nAvailWidth = cell->nWidth
- (wc->nRow ? wc->nLeftMargin : wc->nFirstMargin) - wc->nRightMargin;
wc->bWordWrap = TRUE;
} else {
wc->nAvailWidth = wc->context->nAvailWidth
- (wc->nRow ? wc->nLeftMargin : wc->nFirstMargin) - wc->nRightMargin;
}
wc->pt.x = wc->context->pt.x;
if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE)
/* Shift the text down because of the border. */
wc->pt.y++;
}
开发者ID:Endle,项目名称:wine-gsoc,代码行数:45,代码来源:wrap.c
示例11: ME_ReverseFindNonWhitespaceV
static ME_DisplayItem *ME_MaximizeSplit(ME_WrapContext *wc, ME_DisplayItem *p, int i)
{
ME_DisplayItem *pp, *piter = p;
int j;
if (!i)
return NULL;
j = ME_ReverseFindNonWhitespaceV(p->member.run.strText, i);
if (j>0) {
pp = ME_SplitRun(wc, piter, j);
wc->pt.x += piter->member.run.nWidth;
return pp;
}
else
{
pp = piter;
/* omit all spaces before split point */
while(piter != wc->pRowStart)
{
piter = ME_FindItemBack(piter, diRun);
if (piter->member.run.nFlags & MERF_WHITESPACE)
{
pp = piter;
continue;
}
if (piter->member.run.nFlags & MERF_ENDWHITE)
{
i = ME_ReverseFindNonWhitespaceV(piter->member.run.strText,
piter->member.run.strText->nLen);
pp = ME_SplitRun(wc, piter, i);
wc->pt = pp->member.run.pt;
return pp;
}
/* this run is the end of spaces, so the run edge is a good point to split */
wc->pt = pp->member.run.pt;
wc->bOverflown = TRUE;
TRACE("Split point is: %s|%s\n", debugstr_w(piter->member.run.strText->szData), debugstr_w(pp->member.run.strText->szData));
return pp;
}
wc->pt = piter->member.run.pt;
return piter;
}
}
开发者ID:AmesianX,项目名称:RosWine,代码行数:42,代码来源:wrap.c
示例12: reverse_find_non_whitespace
static ME_DisplayItem *ME_MaximizeSplit(ME_WrapContext *wc, ME_DisplayItem *p, int i)
{
ME_DisplayItem *pp, *piter = p;
int j;
if (!i)
return NULL;
j = reverse_find_non_whitespace( get_text( &p->member.run, 0 ), i);
if (j>0) {
pp = split_run_extents(wc, piter, j);
wc->pt.x += piter->member.run.nWidth;
return pp;
}
else
{
pp = piter;
/* omit all spaces before split point */
while(piter != wc->pRowStart)
{
piter = ME_FindItemBack(piter, diRun);
if (piter->member.run.nFlags & MERF_WHITESPACE)
{
pp = piter;
continue;
}
if (piter->member.run.nFlags & MERF_ENDWHITE)
{
i = reverse_find_non_whitespace( get_text( &piter->member.run, 0 ),
piter->member.run.len );
pp = split_run_extents(wc, piter, i);
wc->pt = pp->member.run.pt;
return pp;
}
/* this run is the end of spaces, so the run edge is a good point to split */
wc->pt = pp->member.run.pt;
wc->bOverflown = TRUE;
TRACE("Split point is: %s|%s\n", debugstr_run( &piter->member.run ), debugstr_run( &pp->member.run ));
return pp;
}
wc->pt = piter->member.run.pt;
return piter;
}
}
开发者ID:Endle,项目名称:wine-gsoc,代码行数:42,代码来源:wrap.c
示例13: ME_DrawRun
static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Paragraph *para)
{
ME_Run *run = &rundi->member.run;
ME_DisplayItem *start = ME_FindItemBack(rundi, diStartRow);
int runofs = run->nCharOfs+para->nCharOfs;
int nSelFrom, nSelTo;
const WCHAR wszSpace[] = {' ', 0};
if (run->nFlags & MERF_HIDDEN)
return;
ME_GetSelection(c->editor, &nSelFrom, &nSelTo);
/* Draw selected end-of-paragraph mark */
if (run->nFlags & MERF_ENDPARA && runofs >= nSelFrom && runofs < nSelTo)
ME_DrawTextWithStyle(c, x, y, wszSpace, 1, run->style, NULL, 0, 1,
c->pt.y + start->member.row.nYPos,
start->member.row.nHeight);
/* you can always comment it out if you need visible paragraph marks */
if (run->nFlags & (MERF_ENDPARA | MERF_TAB | MERF_CELL))
return;
if (run->nFlags & MERF_GRAPHICS)
ME_DrawGraphics(c, x, y, run, para, (runofs >= nSelFrom) && (runofs < nSelTo));
else
{
if (c->editor->cPasswordMask)
{
ME_String *szMasked = ME_MakeStringR(c->editor->cPasswordMask,ME_StrVLen(run->strText));
ME_DrawTextWithStyle(c, x, y,
szMasked->szData, ME_StrVLen(szMasked), run->style, NULL,
nSelFrom-runofs,nSelTo-runofs, c->pt.y+start->member.row.nYPos, start->member.row.nHeight);
ME_DestroyString(szMasked);
}
else
ME_DrawTextWithStyle(c, x, y,
run->strText->szData, ME_StrVLen(run->strText), run->style, NULL,
nSelFrom-runofs,nSelTo-runofs, c->pt.y+start->member.row.nYPos, start->member.row.nHeight);
}
}
开发者ID:howard5888,项目名称:wineT,代码行数:41,代码来源:paint.c
示例14: ME_GetSelection
ME_Style *ME_GetInsertStyle(ME_TextEditor *editor, int nCursor) {
if (ME_IsSelection(editor))
{
ME_Cursor c;
int from, to;
ME_GetSelection(editor, &from, &to);
ME_CursorFromCharOfs(editor, from, &c);
ME_AddRefStyle(c.pRun->member.run.style);
return c.pRun->member.run.style;
}
if (editor->pBuffer->pCharStyle) {
ME_AddRefStyle(editor->pBuffer->pCharStyle);
return editor->pBuffer->pCharStyle;
}
else
{
ME_Cursor *pCursor = &editor->pCursors[nCursor];
ME_DisplayItem *pRunItem = pCursor->pRun;
ME_DisplayItem *pPrevItem = NULL;
if (pCursor->nOffset) {
ME_Run *pRun = &pRunItem->member.run;
ME_AddRefStyle(pRun->style);
return pRun->style;
}
pPrevItem = ME_FindItemBack(pRunItem, diRunOrParagraph);
if (pPrevItem->type == diRun)
{
ME_AddRefStyle(pPrevItem->member.run.style);
return pPrevItem->member.run.style;
}
else
{
ME_AddRefStyle(pRunItem->member.run.style);
return pRunItem->member.run.style;
}
}
}
开发者ID:howard5888,项目名称:wineT,代码行数:38,代码来源:style.c
示例15: ME_InsertTableCellFromCursor
void
ME_InsertTableCellFromCursor(ME_TextEditor *editor, int nCursor)
{
WCHAR tab = '\t';
ME_DisplayItem *p, *run;
ME_Style *pStyle = ME_GetInsertStyle(editor, nCursor);
p = ME_InternalInsertTextFromCursor(editor, nCursor, &tab, 1, pStyle,
MERF_CELL);
run = p;
while ((run = ME_FindItemBack(run, diRunOrParagraph))->type == diRun)
{
if (run->member.run.nFlags & MERF_CELL)
{
assert(run->member.run.pCell->next);
p->member.run.pCell = run->member.run.pCell->next;
return;
}
}
assert(run->type == diParagraph);
assert(run->member.para.bTable);
assert(run->member.para.pCells);
p->member.run.pCell = run->member.para.pCells;
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:24,代码来源:caret.c
示例16: ME_WrapMarkedParagraphs
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
{
ME_DisplayItem *item;
ME_Context c;
int totalWidth = 0;
ME_DisplayItem *repaint_start = NULL, *repaint_end = NULL;
ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
c.pt.x = 0;
item = editor->pBuffer->pFirst->next;
while(item != editor->pBuffer->pLast) {
BOOL bRedraw = FALSE;
assert(item->type == diParagraph);
if ((item->member.para.nFlags & MEPF_REWRAP)
|| (item->member.para.pt.y != c.pt.y))
bRedraw = TRUE;
item->member.para.pt = c.pt;
ME_WrapTextParagraph(&c, item);
if (bRedraw)
ME_MarkRepaintEnd(item, &repaint_start, &repaint_end);
if (item->member.para.nFlags & MEPF_ROWSTART)
{
ME_DisplayItem *cell = ME_FindItemFwd(item, diCell);
ME_DisplayItem *endRowPara;
int borderWidth = 0;
cell->member.cell.pt = c.pt;
/* Offset the text by the largest top border width. */
while (cell->member.cell.next_cell) {
borderWidth = max(borderWidth, cell->member.cell.border.top.width);
cell = cell->member.cell.next_cell;
}
endRowPara = ME_FindItemFwd(cell, diParagraph);
assert(endRowPara->member.para.nFlags & MEPF_ROWEND);
if (borderWidth > 0)
{
borderWidth = max(ME_twips2pointsY(&c, borderWidth), 1);
while (cell) {
cell->member.cell.yTextOffset = borderWidth;
cell = cell->member.cell.prev_cell;
}
c.pt.y += borderWidth;
}
if (endRowPara->member.para.pFmt->dxStartIndent > 0)
{
int dxStartIndent = endRowPara->member.para.pFmt->dxStartIndent;
cell = ME_FindItemFwd(item, diCell);
cell->member.cell.pt.x += ME_twips2pointsX(&c, dxStartIndent);
c.pt.x = cell->member.cell.pt.x;
}
}
else if (item->member.para.nFlags & MEPF_ROWEND)
{
/* Set all the cells to the height of the largest cell */
ME_DisplayItem *startRowPara;
int prevHeight, nHeight, bottomBorder = 0;
ME_DisplayItem *cell = ME_FindItemBack(item, diCell);
item->member.para.nWidth = cell->member.cell.pt.x + cell->member.cell.nWidth;
if (!(item->member.para.next_para->member.para.nFlags & MEPF_ROWSTART))
{
/* Last row, the bottom border is added to the height. */
cell = cell->member.cell.prev_cell;
while (cell)
{
bottomBorder = max(bottomBorder, cell->member.cell.border.bottom.width);
cell = cell->member.cell.prev_cell;
}
bottomBorder = ME_twips2pointsY(&c, bottomBorder);
cell = ME_FindItemBack(item, diCell);
}
prevHeight = cell->member.cell.nHeight;
nHeight = cell->member.cell.prev_cell->member.cell.nHeight + bottomBorder;
cell->member.cell.nHeight = nHeight;
item->member.para.nHeight = nHeight;
cell = cell->member.cell.prev_cell;
cell->member.cell.nHeight = nHeight;
while (cell->member.cell.prev_cell)
{
cell = cell->member.cell.prev_cell;
cell->member.cell.nHeight = nHeight;
}
/* Also set the height of the start row paragraph */
startRowPara = ME_FindItemBack(cell, diParagraph);
startRowPara->member.para.nHeight = nHeight;
c.pt.x = startRowPara->member.para.pt.x;
c.pt.y = cell->member.cell.pt.y + nHeight;
if (prevHeight < nHeight)
{
/* The height of the cells has grown, so invalidate the bottom of
* the cells. */
ME_MarkRepaintEnd(item, &repaint_start, &repaint_end);
cell = ME_FindItemBack(item, diCell);
while (cell) {
ME_MarkRepaintEnd(ME_FindItemBack(cell, diParagraph), &repaint_start, &repaint_end);
cell = cell->member.cell.prev_cell;
}
}
//.........这里部分代码省略.........
开发者ID:Endle,项目名称:wine-gsoc,代码行数:101,代码来源:wrap.c
注:本文中的ME_FindItemBack函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论