Esempio n. 1
0
void FilterWorker::run()
{
  // Launch the thread to apply the effect in background
  base::thread thread(&FilterWorker::thread_proxy, this);

  // Open the alert window in foreground (this is modal, locks the main thread)
  m_alertWindow->openWindowInForeground();

  // Stop the monitoring timer.
  m_timer.stop();

  {
    scoped_lock lock(m_mutex);
    if (!m_done)
      m_cancelled = true;
  }

  // Wait the `effect_bg' thread
  thread.join();

  if (!m_error.empty()) {
    Console console;
    console.printf("A problem has occurred.\n\nDetails:\n%s", m_error.c_str());
  }
}
Esempio n. 2
0
void FilterWorker::run()
{
  // Launch the thread to apply the effect in background
  base::thread thread(&FilterWorker::thread_proxy, this);

  // Open the alert window in foreground (this is modal, locks the main thread)
  m_alertWindow->openWindowInForeground();

  // Stop the monitoring timer.
  m_timer.stop();

  {
    scoped_lock lock(m_mutex);
    if (m_done && m_filterMgr->isTransaction())
      m_filterMgr->commitTransaction();
    else
      m_cancelled = true;
  }

  // Wait the `effect_bg' thread
  thread.join();

  if (!m_error.empty()) {
    Console console;
    console.printf("A problem has occurred.\n\nDetails:\n%s", m_error.c_str());
  }
  else if (m_cancelled && !m_filterMgr->isTransaction()) {
    StatusBar::instance()
      ->showTip(2500, "No unlocked layers to apply filter");
  }
}
Esempio n. 3
0
bool PaletteEntryEditor::onProcessMessage(Message* msg)
{
    if (msg->type() == kTimerMessage &&
            static_cast<TimerMessage*>(msg)->timer() == &m_redrawTimer) {
        // Redraw all editors
        if (m_redrawAll) {
            m_redrawAll = false;
            m_implantChange = false;
            m_redrawTimer.stop();

            // Call all observers of PaletteChange event.
            m_selfPalChange = true;
            App::instance()->PaletteChange();
            m_selfPalChange = false;

            // Redraw all editors
            try {
                ContextWriter writer(UIContext::instance());
                Document* document(writer.document());
                if (document != NULL)
                    document->notifyGeneralUpdate();
            }
            catch (...) {
                // Do nothing
            }
        }
        // Redraw just the current editor
        else {
            m_redrawAll = true;
            if (current_editor != NULL)
                current_editor->updateEditor();
        }
    }
    return Window::onProcessMessage(msg);
}