本文整理匯總了C++中AppendText函數的典型用法代碼示例。如果您正苦於以下問題:C++ AppendText函數的具體用法?C++ AppendText怎麽用?C++ AppendText使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AppendText函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: AppendText
void luConsoleEdit::writeLine(const wxString& line, bool newLine)
{
AppendText(line);
//long pos = GetLastPosition();
//Replace(pos, pos, line);
if (newLine) AppendText("\n");
}
示例2: tokens
void CChatSession::AddText(const wxString& text, const wxTextAttr& style, bool newline)
{
// Split multi-line messages into individual lines
wxStringTokenizer tokens( text, wxT("\n") );
while ( tokens.HasMoreTokens() ) {
// Check if we should add a time-stamp
if ( GetNumberOfLines() > 1 ) {
// Check if the last line ended with a newline
wxString line = GetLineText( GetNumberOfLines() - 1 );
if ( line.IsEmpty() ) {
SetDefaultStyle( COLOR_BLACK );
AppendText( wxT(" [") + wxDateTime::Now().FormatISOTime() + wxT("] ") );
}
}
SetDefaultStyle(style);
AppendText( tokens.GetNextToken() );
// Only add newlines after the last line if it is desired
if ( tokens.HasMoreTokens() || newline ) {
AppendText( wxT("\n") );
}
}
}
示例3: AppendText
void SvnConsole::Stop()
{
if (m_process) {
delete m_process;
m_process = NULL;
}
AppendText(_("Aborted.\n"));
AppendText(wxT("--------\n"));
}
示例4: wxDELETE
void FindResultsTab::OnSearchMatch(wxCommandEvent& e)
{
SearchResultList* res = (SearchResultList*)e.GetClientData();
if(!res) return;
int m = m_book ? m_book->GetPageIndex(m_recv) : 0;
if(m == wxNOT_FOUND) {
wxDELETE(res);
return;
}
MatchInfo& matchInfo = GetMatchInfo(m);
for(SearchResultList::iterator iter = res->begin(); iter != res->end(); iter++) {
if(matchInfo.empty() || matchInfo.rbegin()->second.GetFileName() != iter->GetFileName()) {
if(!matchInfo.empty()) {
AppendText("\n");
}
wxFileName fn(iter->GetFileName());
fn.MakeRelativeTo();
AppendText(fn.GetFullPath() + wxT("\n"));
}
int lineno = m_recv->GetLineCount() - 1;
matchInfo.insert(std::make_pair(lineno, *iter));
wxString text = iter->GetPattern();
int delta = -text.Length();
text.Trim(false);
delta += text.Length();
text.Trim();
wxString linenum;
if(iter->GetMatchState() == CppWordScanner::STATE_CPP_COMMENT ||
iter->GetMatchState() == CppWordScanner::STATE_C_COMMENT)
linenum = wxString::Format(wxT(" %5u //"), iter->GetLineNumber());
else
linenum = wxString::Format(wxT(" %5u "), iter->GetLineNumber());
SearchData* d = GetSearchData(m_recv);
// Print the scope name
if(d->GetDisplayScope()) {
TagEntryPtr tag = TagsManagerST::Get()->FunctionFromFileLine(iter->GetFileName(), iter->GetLineNumber());
wxString scopeName(wxT("global"));
if(tag) {
scopeName = tag->GetPath();
}
linenum << wxT("[ ") << scopeName << wxT(" ] ");
iter->SetScope(scopeName);
}
delta += linenum.Length();
AppendText(linenum + text + wxT("\n"));
m_recv->IndicatorFillRange(m_sci->PositionFromLine(lineno) + iter->GetColumn() + delta, iter->GetLen());
}
wxDELETE(res);
}
示例5: sizeof
void CLogView::Log(LogFacility logType, BSTR bsSource, BSTR bsModuleID, VARIANT vtValue)
{
CHARFORMAT cf = {0};
cf.cbSize = sizeof(CHARFORMAT);
cf.dwMask = CFM_COLOR;
CString sType;
switch(logType)
{
case LT_DEBUG:
sType = _T("debug");
cf.crTextColor = LOG_COLOR_DEBUG;
break;
case LT_INFO:
sType = _T("info");
cf.crTextColor = LOG_COLOR_INFO;
break;
case LT_WARN:
sType = _T("warning");
cf.crTextColor = LOG_COLOR_WARN;
break;
case LT_ERROR:
sType = _T("error");
cf.crTextColor = LOG_COLOR_ERROR;
break;
default:
sType = _T("log");
cf.crTextColor = LOG_DEFAULTCOLOR;
break;
}
CTime ts = CTime::GetCurrentTime();
CString sDate(ts.Format(_T("%H:%M:%S")));
CComVariant vt;
vt.ChangeType(VT_BSTR, &vtValue);
if (vt.vt != VT_BSTR)
{
vt = _T("???");
}
CString s;
s.Format(_T("%s %s [%s: %s]: "), sDate, sType, bsSource, bsModuleID);
SetSelectionCharFormat(cf);
AppendText(s);
cf.dwMask |= CFM_BOLD;
cf.dwEffects = CFE_BOLD;
SetSelectionCharFormat(cf);
AppendText(vt.bstrVal);
cf.dwMask = CFM_COLOR;
cf.crTextColor = LOG_DEFAULTCOLOR;
SetSelectionCharFormat(cf);
AppendText(_T("\r\n"));
}
示例6: write_file
void write_file(JJGui *jibber_ui)
{
GError *err = NULL;
gchar *text;
gboolean result;
GtkTextBuffer *buffer;
GtkTextIter start, end;
char szFilename[35] = "";
time_t t;
struct tm *tmNow;
// make sure the gui is finished with any queued instructions before going further
while (gtk_events_pending())
gtk_main_iteration();
// get contents of buffer
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (jibber_ui->text_view));
gtk_text_buffer_get_start_iter(buffer, &start);
gtk_text_buffer_get_end_iter(buffer, &end);
text = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
gtk_text_buffer_set_modified(buffer, FALSE);
t = time(NULL);
tmNow = localtime(&t);
if (tmNow == NULL) {
// create a filename from the compile stamp
sprintf(szFilename, "jibber_%s_%s.txt", __DATE__, __TIME__);
}
else {
// create a filename from the time
strftime(szFilename, 35, "jibber_%F_%H-%M-%S.txt", tmNow);
}
result = g_file_set_contents (szFilename, text, -1, &err);
if (result == FALSE) {
// error saving file, show message to user
AppendText(jibber_ui, DIR_SYSTEM, "Couldn't save file: %s", szFilename);
AppendText(jibber_ui, DIR_SYSTEM, (err->message));
}
else
AppendText(jibber_ui, DIR_SYSTEM, "Saved file: %s", szFilename);
// free the text memory
g_free (text);
} // end of write_file
示例7: AppendText
void BuildProgressPnl::OnMustRefresh(wxCommandEvent&)
{
std::vector < CodeCompilerTask > currentTasks = CodeCompiler::Get()->GetCurrentTasks();
if (CodeCompiler::Get()->CompilationInProcess())
{
if (!currentTasks.empty())
{
if (!CodeCompiler::Get()->LastTaskFailed())
{
statusTxt->SetLabel(_("Task in progress:")+currentTasks[0].userFriendlyName);
AppendText(_("Task in progress:")+currentTasks[0].userFriendlyName+("...")+"\n");
}
else
{
statusTxt->SetLabel(_("The task ")+currentTasks[0].userFriendlyName+_("failed."));
AppendText(_("The task ")+currentTasks[0].userFriendlyName+_("failed.")+"\n");
}
}
}
else
{
if (CodeCompiler::Get()->LastTaskFailed())
{
statusTxt->SetLabel(_("Some tasks failed."));
AppendText(_("Some tasks failed.")+"\n");
}
else
{
wxString timeStr = wxString::Format(_("( %ld seconds )"), compilationTimer.Time()/1000);
if (!currentTasks.empty())
{
statusTxt->SetLabel(_("Compilation finished")+timeStr+_(", but ")+gd::String::From(currentTasks.size())+_(" task(s) are waiting."));
AppendText(_("Tasks finished ")+timeStr+_(", but ")+gd::String::From(currentTasks.size())+_(" task(s) are waiting.")+"\n");
}
else
{
statusTxt->SetLabel(_("Compilation finished."));
AppendText(_("All tasks have been completed.")+" "+timeStr+"\n");
}
}
clearOnNextTextAdding = true;
}
if (!currentTasks.empty())
progressGauge->SetValue(100.f/static_cast<float>(currentTasks.size()));
}
示例8: Freeze
void SearchWindow::SearchMessage(const wxString& message)
{
Freeze();
SetDefaultStyle(m_messageAttr);
AppendText(message + "\n");
Thaw();
}
示例9: wxCHECK_RET
void wxLuaConsole::DisplayStack(const wxLuaState& wxlState)
{
wxCHECK_RET(wxlState.Ok(), wxT("Invalid wxLuaState"));
int nIndex = 0;
lua_Debug luaDebug = INIT_LUA_DEBUG;
wxString buffer;
lua_State* L = wxlState.GetLuaState();
while (lua_getstack(L, nIndex, &luaDebug) != 0)
{
if (lua_getinfo(L, "Sln", &luaDebug))
{
wxString what (luaDebug.what ? lua2wx(luaDebug.what) : wxString(wxT("?")));
wxString nameWhat(luaDebug.namewhat ? lua2wx(luaDebug.namewhat) : wxString(wxT("?")));
wxString name (luaDebug.name ? lua2wx(luaDebug.name) : wxString(wxT("?")));
buffer += wxString::Format(wxT("[%d] %s '%s' '%s' (line %d)\n Line %d src='%s'\n"),
nIndex, what.c_str(), nameWhat.c_str(), name.c_str(), luaDebug.linedefined,
luaDebug.currentline, lua2wx(luaDebug.short_src).c_str());
}
nIndex++;
}
if (!buffer.empty())
{
AppendText(wxT("\n-----------------------------------------------------------")
wxT("\n- Backtrace")
wxT("\n-----------------------------------------------------------\n") +
buffer +
wxT("\n-----------------------------------------------------------\n\n"));
}
}
示例10: SetPreservedRow
//setting up the textarea for smooth scrolling, the first
//TEXTAREA_OUTOFTEXT callback is called automatically
void TextArea::SetupScroll(unsigned long tck)
{
SetPreservedRow(0);
smooth = ftext->maxHeight;
startrow = 0;
ticks = tck;
//clearing the textarea
Clear();
unsigned int i = (unsigned int) (Height/smooth);
while (i--) {
char *str = (char *) malloc(1);
str[0]=0;
lines.push_back(str);
lrows.push_back(0);
}
i = (unsigned int) lines.size();
Flags |= IE_GUI_TEXTAREA_SMOOTHSCROLL;
GetTime( starttime );
if (RunEventHandler( TextAreaOutOfText )) {
//event handler destructed this object?
return;
}
if (i==lines.size()) {
ResetEventHandler( TextAreaOutOfText );
return;
}
//recalculates rows
AppendText("\n",-1);
}
示例11: AppendText
int wxTextCtrlBase::overflow(int c)
{
AppendText((wxChar)c);
// return something different from EOF
return 0;
}
示例12: assert
void
CBExecOutputDocument::ReceiveRecord()
{
assert( itsRecordLink != NULL );
JString text;
const JBoolean ok = itsRecordLink->GetNextMessage(&text);
assert( ok );
// remove text that has already been printed
if (!itsLastPrompt.IsEmpty() && text.BeginsWith(itsLastPrompt))
{
text.RemoveSubstring(1, itsLastPrompt.GetLength());
}
itsLastPrompt.Clear();
const JXTEBase::DisplayState state = GetTextEditor()->SaveDisplayState();
AppendText(text);
GetTextEditor()->ClearUndo();
if (!itsReceivedDataFlag)
{
itsReceivedDataFlag = kJTrue;
if (!IsActive())
{
Activate();
}
}
GetTextEditor()->RestoreDisplayState(state);
}
示例13: wxT
void FindResultsTab::OnSearchStart(wxCommandEvent& e)
{
m_searchInProgress = true;
SearchData* data = (SearchData*)e.GetClientData();
wxString label = data ? data->GetFindString() : wxT("");
if(e.GetInt() != 0 || m_sci == NULL) {
if(m_book) {
clWindowUpdateLocker locker(this);
MySTC* sci = new MySTC(m_book);
SetStyles(sci);
sci->Connect(wxEVT_STC_STYLENEEDED, wxStyledTextEventHandler(FindResultsTab::OnStyleNeeded), NULL, this);
m_book->AddPage(sci, label, true);
#ifdef __WXMAC__
m_book->GetSizer()->Layout();
#endif
size_t where = m_book->GetPageCount() - 1;
// keep the search data used for this tab
wxWindow* tab = m_book->GetPage(where);
if(tab) {
tab->SetClientData(data);
}
m_matchInfo.push_back(MatchInfo());
m_sci = sci;
}
} else if(m_book) {
// using current tab, update the tab title and the search data
int where = m_book->GetPageIndex(m_sci);
if(where != wxNOT_FOUND) {
m_book->SetPageText(where, label);
// delete the old search data
wxWindow* tab = m_book->GetPage(where);
SearchData* oldData = (SearchData*)tab->GetClientData();
if(oldData) {
delete oldData;
}
// set the new search data
tab->SetClientData(data);
}
}
// This is needed in >=wxGTK-2.9, otherwise the 'Search' pane doesn't fully expand
SendSizeEvent(wxSEND_EVENT_POST);
m_recv = m_sci;
Clear();
if(data) {
m_searchData = *data;
wxString message;
message << _("====== Searching for: '") << data->GetFindString() << _("'; Match case: ")
<< (data->IsMatchCase() ? _("true") : _("false")) << _(" ; Match whole word: ")
<< (data->IsMatchWholeWord() ? _("true") : _("false")) << _(" ; Regular expression: ")
<< (data->IsRegularExpression() ? _("true") : _("false")) << wxT(" ======\n");
AppendText(message);
}
}
示例14: AppendText
wxTextCtrl& wxTextCtrlBase::operator<<(long i)
{
wxString str;
str.Printf(wxT("%ld"), i);
AppendText(str);
return *TEXTCTRL(this);
}
示例15: GetLastError
void CRedirect::ShowLastError(LPCTSTR szText)
{
LPVOID lpMsgBuf;
DWORD Success;
//--------------------------------------------------------------------------
// Get the system error message.
//--------------------------------------------------------------------------
Success = FormatMessage
(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //lint !e1924 (warning about C-style cast)
LPTSTR(&lpMsgBuf),
0,
NULL
);
CString Msg;
Msg = szText;
Msg += _T("\r\n");
if ( Success )
{
Msg += LPTSTR(lpMsgBuf);
}
else
{
Msg += _T("No status because FormatMessage failed.\r\n");
}
AppendText(Msg);
}