// Set desired value bool GlyphVariable::setAccessor(int i, ReturnValue& sourcerv, ReturnValue& newValue, bool hasArrayIndex, int arrayIndex) { Messenger::enter("GlyphVariable::setAccessor"); // Cast 'i' into Accessors enum value if ((i < 0) || (i >= nAccessors)) { printf("Internal Error: Accessor id %i is out of range for Glyph type.\n", i); Messenger::exit("GlyphVariable::setAccessor"); return false; } Accessors acc = (Accessors) i; // Check for correct lack/presence of array index given to original accessor, and nature of new value bool result = checkAccessorArrays(accessorData[acc], newValue, hasArrayIndex, arrayIndex); if (!result) { Messenger::exit("GlyphVariable::setAccessor"); return false; } // Get current data from ReturnValue Glyph* ptr = (Glyph*) sourcerv.asPointer(VTypes::GlyphData, result); if ((!result) || (ptr == NULL)) { Messenger::print("Invalid (NULL) %s reference encountered.", VTypes::dataType(VTypes::GlyphData)); result = false; } if (result) switch (acc) { case (GlyphVariable::Rotated): if (newValue.asInteger() == 0) ptr->resetRotation(); break; case (GlyphVariable::Rotation): ptr->setRotationElement( ((arrayIndex-1)/3)*4 + (arrayIndex-1)%3, newValue.asDouble()); break; case (GlyphVariable::Selected): ptr->setSelected(newValue.asBool()); break; case (GlyphVariable::Solid): ptr->setSolid(newValue.asBool()); break; case (GlyphVariable::Text): ptr->setText(newValue.asString()); break; case (GlyphVariable::Visible): ptr->setVisible(newValue.asBool()); break; default: printf("GlyphVariable::setAccessor doesn't know how to use member '%s'.\n", qPrintable(accessorData[acc].name)); result = false; break; } Messenger::exit("GlyphVariable::setAccessor"); return result; }
// Set desired value bool WidgetVariable::setAccessor(int i, ReturnValue& sourcerv, ReturnValue& newValue, bool hasArrayIndex, int arrayIndex) { Messenger::enter("WidgetVariable::setAccessor"); // Cast 'i' into Accessors enum value if ((i < 0) || (i >= nAccessors)) { printf("Internal Error: Accessor id %i is out of range for Aten type.\n", i); Messenger::exit("WidgetVariable::setAccessor"); return false; } Accessors acc = (Accessors) i; // Check for correct lack/presence of array index given to original accessor, and nature of new value bool result = checkAccessorArrays(accessorData[acc], newValue, hasArrayIndex, arrayIndex); if (!result) { Messenger::exit("WidgetVariable::setAccessor"); return false; } // Get current data from ReturnValue TreeGuiWidget* ptr = (TreeGuiWidget*) sourcerv.asPointer(VTypes::WidgetData, result); if ((!result) || (ptr == NULL)) { Messenger::print("Invalid (NULL) %s reference encountered.", VTypes::dataType(VTypes::WidgetData)); result = false; } switch (acc) { case (WidgetVariable::Enabled): ptr->setEnabled(newValue.asBool()); if (ptr->qtWidgetObject()) ptr->qtWidgetObject()->updateQt();; break; case (WidgetVariable::VerticalFill): if (ptr->qtWidgetObject()) ptr->qtWidgetObject()->setAutoFillVertical(newValue.asBool()); break; case (WidgetVariable::Visible): ptr->setVisible(newValue.asBool()); if (ptr->qtWidgetObject()) ptr->qtWidgetObject()->updateQt();; break; default: printf("WidgetVariable::setAccessor doesn't know how to use member '%s'.\n", qPrintable(accessorData[acc].name)); result = false; break; } Messenger::exit("WidgetVariable::setAccessor"); return result; }
void GridSetPopup::on_ViewPercentageSpin_valueChanged(double value) { if (refreshing_) return; // Run command ReturnValue rv; if (primary_) rv = CommandNode::run(Commands::GridViewPercentage, "d", ui.ViewPercentageSpin->value()); else rv = CommandNode::run(Commands::GridViewPercentageSecondary, "d", ui.ViewPercentageSpin->value()); // Set new density value (if the command was successful) if (rv.asBool()) { updateControls(); // Update display parent_.updateWidgets(AtenWindow::GridsPanelTarget); } }