本文整理汇总了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();
}
}