User forums > Using Code::Blocks

Batch build progres..

<< < (2/4) > >>

thomas:
The idea has one weak point, and that is that this would require OS-specific code. To my knowledge, wxWidgets offers no such thing as a task bar icon class. As far as Windows is concerned, I might even remember how to do it, but what about X? Assuming that the same code works for Gnome and KDE is probably a bit bold ;)

Except for that, it is a really good idea, though.

As an alternative, we might open an off-screen window and change its title as the build process goes on. It is not the same, but we could implement it cross-platform and with a lot less pain.

mandrav:

--- Quote from: thomas on January 24, 2006, 12:06:29 am ---The idea has one weak point, and that is that this would require OS-specific code. To my knowledge, wxWidgets offers no such thing as a task bar icon class.

--- End quote ---

Are you talking about this?
wxTaskBarIcon
:lol:

thomas:
Oh right... must have misspelled it then. I did a search in the wxWidgets docs, but it did not find it... :lol:

Well, then it should not be so hard really.

AkiraDev:
I tried this little hack inside BatchJob:


--- Code: ---int CodeBlocksApp::BatchJob()
{
  if (!m_Batch)
    return -1;

  // find compiler plugin
  PluginsArray arr = Manager::Get()->GetPluginManager()->GetCompilerOffers();
  if (arr.GetCount() == 0)
    return -2;

  cbCompilerPlugin* compiler = static_cast<cbCompilerPlugin*>(arr[0]);
  if (!compiler)
    return -3;

  wxTaskBarIcon cbTaskBarIcon;
#ifdef __WXMSW__
  cbTaskBarIcon.SetIcon(wxICON(A_MAIN_ICON),_("Now compiling ") + wxString(argv[argc-1]));
#else
  cbTaskBarIcon.SetIcon(wxIcon(app),_("Now compiling ") + wxString(argv[argc-1]));
#endif // __WXMSW__

  if (m_ReBuild)
    compiler->RebuildWorkspace(m_BatchTarget);
  else if (m_Build)
    compiler->BuildWorkspace(m_BatchTarget);

  // wait for compiler to finish
  while (compiler->IsRunning())
  {
    wxMilliSleep(10);
    Manager::Yield();
  }
  int exitCode = compiler->GetExitCode();

  cbTaskBarIcon.RemoveIcon();

  if (m_BatchNotify)
  {
    wxString msg;
    msg.Printf(_("Batch build is complete.\nProcess exited with status code %d."), exitCode);
    wxMessageBox(msg, APP_NAME, exitCode == 0 ? wxICON_INFORMATION : wxICON_WARNING);
  }
  return exitCode;
}

--- End code ---

...and it worked, at least until the compiler was done, then the application crashed.

killerbot:
I won't be surprised if this shows up tomorrow in the change logs ...  :P

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version