// ObjectPluginHighlight Interface
void
dmz::ObjectPluginHighlight::_init (Config &local) {

   _highlightAttr = activate_object_attribute (
      ObjectAttributeHighlightName,
      ObjectFlagMask);

   _convert.set_handle (
      config_to_string ("data-convert-handle.name", local, "handle"),
      get_plugin_runtime_context ());

   _mouseMoveMsg = config_create_message (
      "mouse-move-message.name",
      local,
      "Mouse_Move_Message",
      get_plugin_runtime_context ());

   _deactivateMsg = config_create_message (
      "deactivate-message.name",
      local,
      "Object_Highlight_Deactivate_Message",
      get_plugin_runtime_context ());

   subscribe_to_message (_mouseMoveMsg);
   subscribe_to_message (_deactivateMsg);
}
void
dmz::QtPluginIconPalletTool::_init (Config &local) {

   RuntimeContext *context (get_plugin_runtime_context ());

   _showMsg = config_create_message (
      "show.name",
      local,
      "DMZ_Show_Icon_Pallet_Tool",
      context);

   subscribe_to_message (_showMsg);

   _useSession = config_to_boolean ("use-session.value", local, _useSession);

   if (_useSession && context) {

      Config session (get_session_config (get_plugin_name (), context));

      QByteArray geometry (config_to_qbytearray ("geometry", session, saveGeometry ()));
      restoreGeometry (geometry);

      if (config_to_boolean ("window.visible", session, False)) { show (); }
   }

   _ui.iconView->setModel (&_model);

   _add_type (Definitions (context).get_root_object_type ());
}
void
dmz::MBRAPluginArchiveSupport::_init (Config &local) {

    RuntimeContext *context = get_plugin_runtime_context ();

    init_archive (local);

    _defaultAttrHandle = activate_default_object_attribute (ObjectCreateMask);

    _ecAttrHandle = activate_object_attribute (
                        config_to_string ("elimination-cost.name", local, "NA_Node_Elimination_Cost"),
                        ObjectScalarMask);

    _typeSet = config_to_object_type_set ("object-type-list", local, context);

    if (_typeSet.get_count () == 0) {

        _typeSet.add_object_type ("na_node", context);
    }

    _toggleMapMessage = config_create_message (
                            "message.toggle-map.name",
                            local,
                            "ToggleMapMessage",
                            context,
                            &_log);

    _threatAttrHandle = config_to_named_handle (
                            "threat.name",
                            local,
                            "NA_Node_Threat",
                            context);

    _vulAttrHandle = config_to_named_handle (
                         "vulnerability.name",
                         local,
                         "NA_Node_Vulnerability",
                         context);

    _pcAttrHandle = config_to_named_handle (
                        "prevention-cost.name",
                        local,
                        "NA_Node_Prevention_Cost",
                        context);


    _toggleHandle = config_to_named_handle ("toggle.name", local, "toggle", context);

    _toggleTargetHandle = config_to_named_handle (
                              "toggle-target.name",
                              local,
                              "dmzQtPluginMapProperties",
                              context);
}
Exemple #4
0
void
dmz::PluginUndo::_init (Config &local) {

   RuntimeContext *context (get_plugin_runtime_context ());

   _undoMessage = config_create_message (
      "undo.name",
      local,
      "Plugin_Undo_Message",
      context);

   _redoMessage = config_create_message (
      "redo.name",
      local,
      "Plugin_Redo_Message",
      context);

   subscribe_to_message (_undoMessage);
   subscribe_to_message (_redoMessage);
}
void
dmz::ForgePluginScreenCaptureMulti::_init (Config &local) {

   RuntimeContext *context = get_plugin_runtime_context ();

   Definitions defs (context, &_log);

   _defaultAttrHandle = defs.create_named_handle (ObjectAttributeDefaultName);

   _attachMsg = config_create_message (
      "attach-message.name",
      local,
      "DMZ_Entity_Attach_Message",
      context);

   subscribe_to_message (_attachMsg);

   _startCaptureMsg = config_create_message (
      "start-screen-capture-message.name",
      local,
      "Start_Screen_Capture_Message",
      context);

   subscribe_to_message (_startCaptureMsg);

   _doCaptureMsg = config_create_message (
      "screen-capture-message.name",
      local,
      "Capture_Render_Screen_Message",
      context);

   _finishedCaptureMsg = config_create_message (
      "finished-screen-capture-message.name",
      local,
      "Finished_Screen_Capture_Message",
      context);

   _maxFiles = config_to_int32 ("max-files.value", local, _maxFiles);
   _maxLength = String::number (_maxFiles).get_length ();
}
void
dmz::EntityPluginDetach::_init (Config &local) {

   _attachMsg = config_create_message (
      "attach-message.name",
      local,
      EntityMessageAttachName,
      get_plugin_runtime_context ());

   subscribe_to_message (_attachMsg);

   activate_default_object_attribute (ObjectDestroyMask);
}
/*!

\brief Creates a monostate dmz::Message from dmz::Config.
\details Defined in dmzRuntimeMessaging.h.
This function converts the named attribute to a dmz::Message. It is assumed that the
last part of the \a Name variable specifies the attribute name. If the String
"type.name" is passed in as \a Name, it will try to find a  config context called
"type" and the attribute "name" stored in the "type" config context. If the named
Message does not exist, it is created.
\code
dmz::Message type = dmz::config_create_monostate_message ("dmz.type.name", global, "DefaultMessage", get_plugin_runtime_context (), &_log);
\endcode
\param[in] Name String containing name of the attribute in the config context to convert.
\param[in] Source Config containing config context to convert.
\param[in] DefaultValue String containing default name of Message to use if not found
int the Config.
\param[in] context Pointer to the runtime context.
\param[in] log Pointer to the dmz::Log to use for log reporting.
\return Returns dmz::Message containing the message type. Returns an empty
dmz::Message if no message name is specified in either the Config or the \a DefaultValue.

*/
dmz::Message
dmz::config_create_monostate_message (
      const String &Name,
      const Config &Source,
      const String &DefaultValue,
      RuntimeContext *context,
      Log *log) {

   Message result = config_create_message (Name, Source, DefaultValue, context, log);

   if (result) { result.set_monostate_mode (MessageMonostateOn); }

   return result;
}
void
dmz::BorderWebInterface::_init (Config &local) {

   RuntimeContext *context = get_plugin_runtime_context ();

   _uiV8Name = config_to_string ("module.js.name", local, "dmzJsModuleUiV8QtBasic");
   _jsWindowObjectName = config_to_string ("module.js.windowObject.name", local, "dmz");
   _mainWindowName = config_to_string ("module.main-window.name", local, "dmzQtModuleMainWindowBasic");
   _frameName = config_to_string ("webframe.name", local, "DystopiaWebFrame");

   _pinIDHandle = config_to_string ("pin-handles.id.name", local);
   _pinPositionHandle = config_to_string ("pin-handles.position.name", local);
   _pinTitleHandle = config_to_string ("pin-handles.title.name", local);
   _pinDescHandle = config_to_string ("pin-handles.description.name", local);

   _addPinMessage = config_create_message (
      "message-names.add",
      local,
      "AddPinMessage",
      context,
      &_log);

   _pinAddedMessage = config_create_message (
      "message-names.add-confirm",
      local,
      "PinAddedMessage",
      context,
      &_log);

   _removePinMessage = config_create_message (
      "message-names.remove",
      local,
      "RemovePinMessage",
      context,
      &_log);

   _pinRemovedMessage = config_create_message (
      "message-names.remove-confirm",
      local,
      "PinRemovedMessage",
      context,
      &_log);

   _pinMovedMessage = config_create_message (
      "message-names.moved",
      local,
      "PinMovedMessage",
      context,
      &_log);

   _setFrameMessage = config_create_message (
      "message-names.set-interface",
      local,
      "SetInterfaceWebFrameMessage",
      context,
      &_log);
}
// ObjectPluginSelect Interface
void
dmz::ObjectPluginSelect::_init (Config &local) {

   _selectMsg = config_create_message (
      "select-message.name",
      local,
      "Object_Select_Message",
      get_plugin_runtime_context ());

   subscribe_to_message (_selectMsg);

   _convert.set_handle (
      config_to_string ("data-convert-handle.name", local, "handle"),
      get_plugin_runtime_context ());

   _key = config_to_key_value ("add-to-selection-key.name", local, KeyShift, &_log);

   init_input_channels (local, InputEventKeyMask, &_log);
}