当前位置: 首页>>代码示例>>C++>>正文


C++ Doc::notifyGeneralUpdate方法代码示例

本文整理汇总了C++中Doc::notifyGeneralUpdate方法的典型用法代码示例。如果您正苦于以下问题:C++ Doc::notifyGeneralUpdate方法的具体用法?C++ Doc::notifyGeneralUpdate怎么用?C++ Doc::notifyGeneralUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doc的用法示例。


在下文中一共展示了Doc::notifyGeneralUpdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onExecute

void SymmetryModeCommand::onExecute(Context* ctx)
{
  auto& enabled = Preferences::instance().symmetryMode.enabled;
  // When the m_mode is NONE, it toggles the whole symmetry controls in
  // the context bar.
  if (m_mode == app::gen::SymmetryMode::NONE) {
    enabled(!enabled());
  }
  // In other case it toggles the specific document symmetry specified
  // in m_mode.
  else {
    Doc* doc = ctx->activeDocument();
    DocumentPreferences& docPref = Preferences::instance().document(doc);
    const app::gen::SymmetryMode actual = docPref.symmetry.mode();

    // If the symmetry options are hidden, we'll always show them and
    // activate the m_mode symmetry. We cannot just toggle the
    // symmetry when the options aren't visible in the context bar,
    // because if m_mode is checked, this would cause to show the
    // symmetry options in the context bar but with a unchecked m_mode
    // symmetry.
    if (!enabled()) {
      docPref.symmetry.mode(app::gen::SymmetryMode(int(m_mode) | int(actual)));
      enabled(true);
    }
    // If the symmetry options are visible, we just switch the m_mode
    // symmetry.
    else {
      docPref.symmetry.mode(app::gen::SymmetryMode(int(m_mode) ^ int(actual)));
    }

    // Redraw all editors
    //
    // TODO It looks like only the current editor shows the symmetry,
    //      so it's not necessary to invalidate all editors (only the
    //      current one).
    doc->notifyGeneralUpdate();

    // Redraw the buttons in the context bar.
    //
    // TODO Same with context bar, in the future the context bar could
    //      be listening the DocPref changes to be automatically
    //      invalidated (like it already does with symmetryMode.enabled)
    App::instance()->contextBar()->updateForActiveTool();
  }
}
开发者ID:aseprite,项目名称:aseprite,代码行数:46,代码来源:cmd_symmetry_mode.cpp


注:本文中的Doc::notifyGeneralUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。