void CompilerGCC::OnJobEnd(size_t procIndex, int exitCode)
{
// Manager::Get()->GetMessageManager()->Log(m_PageIndex, _T("JobDone: index=%u, exitCode=%d"), procIndex, exitCode));
m_timerIdleWakeUp.Stop();
m_Pid[procIndex] = 0;
m_Processes[procIndex] = 0;
m_LastExitCode = exitCode;
if (exitCode == 0 && !m_ProcessOutputFiles[procIndex].IsEmpty())
{
#if wxCHECK_VERSION(2, 9, 0)
wxFFile f(m_ProcessOutputFiles[procIndex].wx_str(), _T("r"));
#else
wxFFile f(m_ProcessOutputFiles[procIndex].c_str(), _T("r"));
#endif
if (f.IsOpened())
{
size_t size = f.Length();
f.Close();
float displaySize;
wxString units;
if (size < 1024)
{
displaySize = (float)size;
units = _("bytes");
}
else if (size < 1048576)
{
displaySize = (float)size / 1024.0f;
units = _("KB");
}
else
{
displaySize = (float)size / 1048576.0f;
units = _("MB");
}
wxString msg;
#if wxCHECK_VERSION(2, 9, 0)
msg.Printf(_("Output size is %.2f %s"), displaySize, units.wx_str());
#else
msg.Printf(_("Output size is %.2f %s"), displaySize, units.c_str());
#endif
LogMessage(msg, cltNormal);
}
}
if (m_CommandQueue.GetCount() != 0 && exitCode == 0)
{
// continue running commands while last exit code was 0.
DoRunQueue();
}
else
{
if (exitCode == 0)
{
if (IsProcessRunning())
{
DoRunQueue();
return;
}
while (1)
{
BuildStateManagement();
if (m_CommandQueue.GetCount())
{
DoRunQueue();
return;
}
if (m_BuildState == bsNone && m_NextBuildState == bsNone)
break;
}
}
m_CommandQueue.Clear();
ResetBuildState();
// clear any remaining jobs (e.g. in case of build errors)
while (!m_BuildJobTargetsList.empty())
m_BuildJobTargetsList.pop();
// long int elapsed = wxGetElapsedTime() / 1000;
wxLongLong localTime = wxGetLocalTimeMillis();
wxLongLong duration = localTime - m_StartTimer;
long int elapsed = duration.ToLong();
elapsed /= 1000;
int mins = elapsed / 60;
int secs = (elapsed % 60);
wxString msg = wxString::Format(_("Process terminated with status %d (%d minutes, %d seconds)"), exitCode, mins, secs);
LogMessage(msg, exitCode == 0 ? cltWarning : cltError, ltAll, exitCode != 0);
if (!m_CommandQueue.LastCommandWasRun())
{
wxString msg = wxString::Format(_("%d errors, %d warnings"), m_Errors.GetCount(cltError), m_Errors.GetCount(cltWarning));
LogMessage(msg, exitCode == 0 ? cltWarning : cltError, ltAll, exitCode != 0);
#if wxCHECK_VERSION(2, 9, 0)
LogWarningOrError(cltNormal, 0, wxEmptyString, wxEmptyString, wxString::Format(_("=== Build finished: %s ==="), msg.wx_str()));
#else
LogWarningOrError(cltNormal, 0, wxEmptyString, wxEmptyString, wxString::Format(_("=== Build finished: %s ==="), msg.c_str()));
#endif
SaveBuildLog();
}
else
{
// last command was "Run"
// force exit code to zero (0) or else debugger will think build failed if last run returned non-zero...
// TODO (mandrav##): Maybe create and use GetLastRunExitCode()? Is it needed?
m_LastExitCode = 0;
}
Manager::Get()->GetLogManager()->Log(_T(" "), m_PageIndex); // blank line
NotifyJobDone();
if (!Manager::IsBatchBuild() && m_Errors.GetCount(cltError))
{
if (Manager::Get()->GetConfigManager(_T("message_manager"))->ReadBool(_T("/auto_show_build_errors"), true))
{
CodeBlocksLogEvent evtShow(cbEVT_SHOW_LOG_MANAGER);
Manager::Get()->ProcessEvent(evtShow);
}
CodeBlocksLogEvent evtSwitch(cbEVT_SWITCH_TO_LOG_WINDOW, m_pListLog);
Manager::Get()->ProcessEvent(evtSwitch);
m_pListLog->FocusError(m_Errors.GetFirstError());
// Build is not completed, so clear the progress bar
if (m_Log->progress)
m_Log->progress->SetValue(0);
}
else
{
if (m_RunAfterCompile)
{
m_RunAfterCompile = false;
if (Run() == 0)
DoRunQueue();
}
else if (!Manager::IsBatchBuild())
{
// don't close the message manager (if auto-hiding), if warnings are required to keep it open
if (m_Errors.GetCount(cltWarning) &&
Manager::Get()->GetConfigManager(_T("message_manager"))->ReadBool(_T("/auto_show_build_warnings"), true))
{
CodeBlocksLogEvent evtShow(cbEVT_SHOW_LOG_MANAGER);
Manager::Get()->ProcessEvent(evtShow);
CodeBlocksLogEvent evtSwitch(cbEVT_SWITCH_TO_LOG_WINDOW, m_pListLog);
Manager::Get()->ProcessEvent(evtSwitch);
}
else // if message manager is auto-hiding, unlock it (i.e. close it)
{
CodeBlocksLogEvent evtShow(cbEVT_HIDE_LOG_MANAGER);
Manager::Get()->ProcessEvent(evtShow);
}
}
}
m_RunAfterCompile = false;
// no matter what happened with the build, return the focus to the active editor
cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinEditor(Manager::Get()->GetEditorManager()->GetActiveEditor());
if (ed)
ed->GetControl()->SetFocus();
}
}
So, this is the best time to call auto_size column.
I can't use "thread search" in "compilergcc.cpp", a message box shows this file can't be opened. When I translate the encoding from "UTF8 without BOM" to "ANSI" (using NotePad++), then thread search can work now. but this time, Gcc( mingw) will complain "legal character near line 3483
wxString Quoted = message;
Quoted.Replace(_T("‘"), _T("\""), true);
Quoted.Replace(_T("’"), _T("\""), true);
m_BuildLogContents << Quoted;