Ejemplo n.º 1
0
/*! \todo Finish function documentation!!!
 *  \brief Change slot of selected component
 *  \par Function Description
 *
 */
void o_slot_start (GSCHEM_TOPLEVEL *w_current, OBJECT *object)
{
  OBJECT *slot_text_object;
  char *default_slot_value;
  char *slot_value;

  /* single object for now */
  if (object->type == OBJ_COMPLEX) {
    /* first see if slot attribute already exists outside
     * complex */
    slot_value = o_attrib_search_slot(object, &slot_text_object);

    if (slot_value) {
#if DEBUG
      printf("slot=%s\n", slot_value);
      printf("text string : %s\n",
             slot_text_object->text->string);
#endif
      slot_edit_dialog(w_current,
                       o_text_get_string (w_current->toplevel,
                                          slot_text_object));
      g_free(slot_value);
    } else {
      /* we didn't find an attached slot=? attribute */

      /* See if there is a default value */
      default_slot_value =
        o_attrib_search_default_slot(object);

      if (default_slot_value) {
        slot_value = g_strdup_printf ("slot=%s", default_slot_value);
      } else {
				/* no default, make something up? */
				/* for now.. this is an error
                                   condition */
        slot_value = g_strdup ("slot=1");
      }

#if DEBUG
      printf("slot value: %s\n", slot_value);
#endif

      slot_edit_dialog(w_current, slot_value);
      g_free(slot_value);
      g_free(default_slot_value);
    }
  }
}
Ejemplo n.º 2
0
/*! \todo Finish function documentation!!!
 *  \brief Change slot of selected component
 *  \par Function Description
 *
 */
void o_slot_start (GSCHEM_TOPLEVEL *w_current, OBJECT *object)
{
  char *slot_value;

  /* single object for now */
  if (object->type != OBJ_COMPLEX)
    return;

  slot_value = o_attrib_search_object_attribs_by_name (object, "slot", 0);

  if (slot_value == NULL) {
    /* we didn't find a slot=? attribute, make something up */
    /* for now.. this is an error condition */
    slot_value = g_strdup ("1");
  }

  slot_edit_dialog (w_current, slot_value);
  g_free (slot_value);
}