本文整理汇总了C++中GetLineCount函数的典型用法代码示例。如果您正苦于以下问题:C++ GetLineCount函数的具体用法?C++ GetLineCount怎么用?C++ GetLineCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetLineCount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLineCount
int CxEdit::DeleteLine(int nLine, BOOL bScroll, int nCount /*= 1*/)
{
if (nCount >= 1)
{
const int linecount = GetLineCount();
const BOOL bFirstLine = (nLine == 0);
const BOOL bLastLine = (nLine == (linecount - 1));
//TRACE("%i,%i,%i\n", LineIndex(nLine - 1), LineLength(nLine - 1), LineIndex(nLine));
const int nStartChar = (bLastLine && (!bFirstLine))
? (LineIndex(nLine - 1) + LineLength(nLine - 1) + 0)
: LineIndex(nLine);
const int nEndChar = ((nLine + nCount) >= linecount)
? (LineIndex(linecount - 1) + LineLength(linecount - 1) + 0)
: LineIndex(nLine + nCount);
const BOOL bReadOnly = IsStyleReadOnly();
if (bReadOnly)
{
SetReadOnly(FALSE);
}
SetSel(nStartChar, nEndChar, !bScroll); // end of edit text
Clear(); // ..then delete
GotoEnd(bScroll);
if (bReadOnly)
{
SetReadOnly(TRUE);
}
}
return GetLineCount();
}
示例2: GetFirstVisibleLine
/*
================
CSyntaxRichEditCtrl::GetVisibleRange
================
*/
CHARRANGE CSyntaxRichEditCtrl::GetVisibleRange(void) const
{
RECT rectArea;
int firstLine, lastLine;
CHARRANGE range;
firstLine = GetFirstVisibleLine();
GetClientRect(&rectArea);
lastLine = firstLine + (rectArea.bottom / (defaultCharFormat.yHeight / 20));
if (lastLine >= GetLineCount()) {
lastLine = GetLineCount() - 1;
}
range.cpMin = LineIndex(firstLine);
if (range.cpMin < 0) {
range.cpMin = 0;
}
range.cpMax = LineIndex(lastLine);
if (range.cpMax == -1) {
range.cpMax = range.cpMin + LineLength(range.cpMin);
} else {
range.cpMax += LineLength(range.cpMax);
}
if (range.cpMax >= GetTextLength()) {
range.cpMax = GetTextLength() - 1;
}
return range;
}
示例3: BeginUndoAction
void ScintillaWrapper::forEachLine(PyObject* function)
{
if (PyCallable_Check(function))
{
BeginUndoAction();
long lineCount = GetLineCount();
for(int line = 0; line < lineCount;)
{
boost::python::object result = boost::python::call<boost::python::object>(function, GetLine(line), line, lineCount);
if (result.is_none() || !PyInt_Check(result.ptr()))
{
++line;
}
else
{
line += PyInt_AsLong(result.ptr());
}
lineCount = GetLineCount();
}
EndUndoAction();
}
}
示例4: GetLineCount
bool wxExTextFile::RunTool()
{
if (!wxTextFile::Open(m_FileName.GetFullPath()))
{
return false;
}
m_Stats.m_Elements.Set(_("Files"), 1);
if (m_Tool.IsCount())
{
m_Stats.m_Elements.Inc(_("Total Size"), m_FileName.GetStat().st_size);
m_Stats.m_Elements.Inc(_("Lines"), GetLineCount());
}
if (GetLineCount() > 0)
{
if (!Parse())
{
Close();
return false;
}
}
if (m_Tool.IsStatisticsType())
{
if (m_Tool.GetId() == ID_TOOL_REPORT_KEYWORD)
{
if (!m_FileName.GetLexer().GetKeywordsString().empty())
{
IncActionsCompleted();
}
}
ReportStatistics();
}
if (m_Modified && !m_FileName.GetStat().IsReadOnly())
{
if (!Write())
{
Close();
return false;
}
}
Close();
return true;
}
示例5: pIndexOf
int pIndexOf(const wxString& sSearch,
bool bIncludeComments = false,
int iStart = 0)
{
wxString sTest = sSearch;
sTest.MakeLower();
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for(size_t i = iStart; i < GetLineCount(); i++)
{
wxString sLine = GetLine(i);
if(bIncludeComments || ! sLine.StartsWith(wxT("#")))
{
if(sLine.StartsWith(sTest))
return (int)i;
}
}
return wxNOT_FOUND;
}
示例6: GetFont
void ZToolTip::SetBounds(void)
{
MFont* pFont = GetFont();
char szName[MWIDGET_NAME_LENGTH];
RemoveAnd(szName, m_bUseParentName==true?GetParent()->m_szName:m_szName);
int nWidth = pFont->GetWidthWithoutAmpersand(szName);
int nHeight = pFont->GetHeight();
int x, y;
GetPosAlignedWithParent(x, y, nWidth, nHeight);
// 최소사이즈 16 size bitmap 일경우.. 32x32 규정?
int w = max(nWidth+ZTOOLTIP_WIDTH_GAP*2,32);
int h = max(nHeight+ZTOOLTIP_HEIGHT_GAP*2,32);
if(w) {
// int line = (w / (ZTOOLTIP_MAX_W-20))+1;
int _max=0;
int line = GetLineCount( szName , _max );
int _max_w = MAX_TOOLTIP_LINE_STRING*(pFont->GetWidth("b"));
if(line) {
w = _max_w;
h = h + ((nHeight + ZTOOLTIP_LINE_GAP) * line);
}
// else w = min(w,_max_w);
}
MWidget::SetBounds(MRECT(x-ZTOOLTIP_WIDTH_GAP, y-ZTOOLTIP_HEIGHT_GAP,w,h));
}
示例7: DrawLines
void CPlot::DrawLines(CDC *pDC)
{
// 遍历每一条曲线
for(int i=0;i<GetLineCount();i++)
{
CLine* nLine = GetLineByIndex(i);
//
if(!nLine->IsShow || nLine->GetPointCount()<1){
continue;
}
// 动态申请临时数组
CPoint* nCPointArray = new CPoint[nLine->GetPointCount()];
// 画笔
CPen pen(nLine->LineType, nLine->LineWidth, nLine->LineColor);
CPen *oldPen = pDC->SelectObject(&pen);
// 坐标转化与处理
for(int k=0;k<nLine->GetPointCount();k++)
{
// 将浮点数Point坐标数据转为整数
int x = (int)(m_rectPlot.right-((m_axisX.GetRangeUpperLimit()-nLine->GetPointX(k))/(m_axisX.GetAxisRange())*m_rectPlot.Width()));
int y = (int)(m_rectPlot.bottom - ((nLine->GetPointY(k)-m_axisY.GetRangeLowerLimit())/(m_axisY.GetAxisRange())*m_rectPlot.Height()));
// 将转化后的值存入数组
nCPointArray[k].x = x;
nCPointArray[k].y = y;
}
// 绘制单条曲线
DrawLine(pDC,&(this->m_rectPlot),nCPointArray,nLine->GetPointCount());
// 释放数组空间
if(nCPointArray){
delete [] nCPointArray;
}
// 恢复画笔
pDC->SelectObject(oldPen);
}
}
示例8: GetSelection
void CCrystalEditView::OnEditDelete()
{
if (! QueryEditable() || m_pTextBuffer == NULL)
return;
CPoint ptSelStart, ptSelEnd;
GetSelection(ptSelStart, ptSelEnd);
if (ptSelStart == ptSelEnd)
{
if (ptSelEnd.x == GetLineLength(ptSelEnd.y))
{
if (ptSelEnd.y == GetLineCount() - 1)
return;
ptSelEnd.y ++;
ptSelEnd.x = 0;
}
else
ptSelEnd.x ++;
}
CPoint ptCursorPos = ptSelStart;
ASSERT_VALIDTEXTPOS(ptCursorPos);
SetAnchor(ptCursorPos);
SetSelection(ptCursorPos, ptCursorPos);
SetCursorPos(ptCursorPos);
EnsureVisible(ptCursorPos);
m_pTextBuffer->DeleteText(this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_DELETE); // [JRT]
}
示例9: WriteHeader
void CLog::WriteHeader(const char *str )
{
if (GetLineCount() == 0)
{
WriteLog(str);
}
}
示例10: Flush
void CLogEx::Flush()
{
char str[10240] = {""};
if (GetLineCount() == 0)
{
for (int i=0;i<(int)vecLogItem.size();i++)
{
strcat(str, vecLogItem[i].name);
strcat(str, ",");
}
strcat(str, "\n");
WriteHeader(str);
}
for (int i=0;i<(int)vecLogItem.size();i++)
{
WriteLog("%s,", vecLogItem[i].str);
}
WriteLog("\n");
}
示例11: GetLineCount
bool wxSTEditorShell::SetMaxLines(int max_lines)
{
m_max_lines = max_lines;
if (m_max_lines < 0) return false;
int total_lines = GetLineCount();
total_lines = wxMax(0, total_lines-1);
// delete lines when more than m_max_lines, you'll eventually crash otherwise
if (total_lines > m_max_lines)
{
BeginWriteable();
int marker = MarkerGet(total_lines - m_max_lines);
SetTargetStart(0);
SetTargetEnd(PositionFromLine(total_lines - m_max_lines));
ReplaceTarget(wxEmptyString);
// wipe marker that has moved up if there shouldn't be a marker
if ((marker & (1<<markerPrompt)) == 0)
MarkerDelete(0, markerPrompt);
EndWriteable();
return true;
}
return false;
}
示例12: SetLimitText
void CEditLogB::Update ()
{
//LOCK_BLOCK (_lock);
if (!_init) {
SetLimitText(_maxLine*1024);
_init = true;
}
int lineCount = GetLineCount ();
if (_maxLine < lineCount) {
LockWindowUpdate();
SetSel (0, LineIndex (lineCount - _maxLine*8/10));
ReplaceSel ("");
_textLength = GetWindowTextLength();
LineScroll(_maxLine, 0);
UnlockWindowUpdate();
}
for (int i=0, n=_logList.size (); i<n; ++i) {
string &smsg = _logList[i];
SetSel (_textLength, _textLength);
ReplaceSel (smsg.c_str ());
_textLength += smsg.length ();
}
_logList.clear ();
}
示例13: GetLine
bool CodeEditor::GetStringRange(int cursor, int& b, int &e) const
{
int cl = GetLine(cursor);
cursor -= GetPos(cl);
bool is_begin, is_end; //@@@@@@
Vector<Point> list = GetLineString(GetWLine(cl), is_begin, is_end);
int i = list.GetCount();
while(--i >= 0 && (list[i].x > cursor || list[i].y < cursor))
;
if(i < 0)
return false;
int bl = cl, bp = list[i].x;
int el = cl, ep = list[i].y;
while(is_begin && bl > 0)
{
list = GetLineString(GetWLine(bl - 1), is_begin, is_end);
if(list.IsEmpty() || !is_end)
break;
bl--;
bp = list.Top().x;
}
while(el + 1 < GetLineCount() && ep >= GetLineLength(el))
{
list = GetLineString(GetWLine(el + 1), is_begin, is_end);
if(list.IsEmpty() || !is_begin)
break;
el++;
ep = list[0].y;
}
b = GetPos(bl, bp);
e = GetPos(el, ep);
return b < e;
}
示例14: GetLineCount
BOOL WINAPI duListCtrl::DeleteLine(int nIndex, BOOL fAdjust)
{
int nLineCount = GetLineCount();
if (nIndex < 0 || nIndex >= nLineCount)
return FALSE;
duPlugin *pDelete = m_vtLines[nIndex];
if (pDelete == NULL)
return FALSE;
duRect rcDelete;
pDelete->GetRect(&rcDelete);
if (nIndex < m_nFirstLine)
m_nFLTotalHeight -= rcDelete.Height();
m_nViewCy -= rcDelete.Height();
vector<duPlugin *>::iterator iterDelete = m_vtLines.begin() + nIndex;
m_vtLines.erase(iterDelete);
UpdateScroll();
if (pDelete == m_pSel)
m_pSel = NULL;
if (pDelete == m_pHot)
m_pHot = NULL;
Plugin_Delete(pDelete);
CompleteAdjustLine();
return TRUE;
}
示例15: GetLineCount
void Edit::OnGoto(wxCommandEvent &WXUNUSED(event)) {
const wxString message = wxString::Format(_("Line number : 1 - %d"), GetLineCount());
const long line_number = wxGetNumberFromUser(wxEmptyString, message, wxT("Go To Line"), 1, 1, 100, this);
if (line_number > 0) {
GotoLine(line_number - 1);
}
}