Пример #1
0
void UIContext::setActiveView(DocumentView* docView)
{
  if (m_lastSelectedView == docView)    // Do nothing case
    return;

  setActiveDocument(docView ? docView->getDocument(): NULL);

  if (docView != NULL) {
    App::instance()->getMainWindow()->getTabsBar()->selectTab(docView);

    if (App::instance()->getMainWindow()->getWorkspace()->activeView() != docView)
      App::instance()->getMainWindow()->getWorkspace()->setActiveView(docView);
  }

  current_editor = (docView ? docView->getEditor(): NULL);

  if (current_editor)
    current_editor->requestFocus();

  App::instance()->getMainWindow()->getMiniEditor()->updateUsingEditor(current_editor);
  App::instance()->getMainWindow()->getTimeline()->updateUsingEditor(current_editor);

  // Change the image-type of color bar.
  ColorBar::instance()->setPixelFormat(app_get_current_pixel_format());

  // Restore the palette of the selected document.
  app_refresh_screen();

  // Change the main frame title.
  App::instance()->updateDisplayTitleBar();

  m_lastSelectedView = docView;
}
Пример #2
0
bool GfxMode::setGfxMode() const
{
  // Try change the new graphics mode
  set_color_depth(m_depth);
  set_screen_scaling(m_scaling);

  // Set the mode
  if (set_gfx_mode(m_card, m_width, m_height, 0, 0) < 0) {
    // Error setting the new mode
    return false;
  }

  gui_setup_screen(true);

  // Set to a black palette
  set_black_palette();

  // Restore palette all screen stuff
  app_refresh_screen();

  // Redraw top window
  MainWindow* mainWindow = App::instance()->getMainWindow();
  if (mainWindow) {
    mainWindow->remapWindow();
    ui::Manager::getDefault()->invalidate();
  }

  return true;
}
Пример #3
0
void UIContext::setActiveView(DocumentView* docView)
{
  MainWindow* mainWin = App::instance()->getMainWindow();

  // Prioritize workspace for user input.
  App::instance()->inputChain().prioritize(mainWin->getWorkspace());

  // Do nothing cases: 1) the view is already selected, or 2) the view
  // is the a preview.
  if (m_lastSelectedView == docView ||
      (docView && docView->isPreview()))
    return;

  if (docView) {
    mainWin->getTabsBar()->selectTab(docView);

    if (mainWin->getWorkspace()->activeView() != docView)
      mainWin->getWorkspace()->setActiveView(docView);
  }

  current_editor = (docView ? docView->getEditor(): NULL);

  if (current_editor)
    current_editor->requestFocus();

  mainWin->getPreviewEditor()->updateUsingEditor(current_editor);
  mainWin->getTimeline()->updateUsingEditor(current_editor);

  // Change the image-type of color bar.
  ColorBar::instance()->setPixelFormat(app_get_current_pixel_format());

  // Restore the palette of the selected document.
  app_refresh_screen();

  // Change the main frame title.
  App::instance()->updateDisplayTitleBar();

  m_lastSelectedView = docView;

  // TODO all the calls to functions like updateUsingEditor(),
  // setPixelFormat(), app_refresh_screen(), updateDisplayTitleBar()
  // Can be replaced with a ContextObserver listening to the
  // onActiveSiteChange() event.
  notifyActiveSiteChanged();
}
Пример #4
0
void RefreshCommand::onExecute(Context* context)
{
  ui::CurrentTheme::get()->regenerate();

  app_refresh_screen();

  // Print memory information
#if defined _WIN32 && defined _DEBUG
  {
    PROCESS_MEMORY_COUNTERS pmc;
    if (::GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
      StatusBar::instance()
        ->showTip(1000,
                  "Current memory: %.16g KB (%lu)\n"
                  "Peak of memory: %.16g KB (%lu)",
                  pmc.WorkingSetSize / 1024.0, pmc.WorkingSetSize,
                  pmc.PeakWorkingSetSize / 1024.0, pmc.PeakWorkingSetSize);
    }
  }
#endif
}