/*! \brief modify one point of a pin object * \par Function Description * This function modifies one point of a pin \a object. The point * is specified by the \a whichone variable and the new coordinate * is (\a x, \a y). * * \param toplevel The TOPLEVEL object * \param object The pin OBJECT to modify * \param x new x-coord of the pin point * \param y new y-coord of the pin point * \param whichone pin point to modify * */ void o_pin_modify(TOPLEVEL *toplevel, OBJECT *object, int x, int y, int whichone) { object->line->x[whichone] = x; object->line->y[whichone] = y; o_pin_recalc (toplevel, object); s_tile_update_object(toplevel, object); }
/*! \brief Recalculate position of the given object. * \par Function Description * This function will take an object and recalculate its * position on the screen. * * \param [in] toplevel The TOPLEVEL object. * \param [in,out] o_current OBJECT to recalculate. * */ void o_recalc_single_object(TOPLEVEL *toplevel, OBJECT *o_current) { if (o_current != NULL) { switch(o_current->type) { case(OBJ_LINE): o_line_recalc(toplevel, o_current); break; case(OBJ_NET): o_net_recalc(toplevel, o_current); break; case(OBJ_BUS): o_bus_recalc(toplevel, o_current); break; case(OBJ_BOX): o_box_recalc(toplevel, o_current); break; case(OBJ_PATH): o_path_recalc(toplevel, o_current); break; case(OBJ_PICTURE): o_picture_recalc(toplevel, o_current); break; case(OBJ_CIRCLE): o_circle_recalc(toplevel, o_current); break; case(OBJ_COMPLEX): case(OBJ_PLACEHOLDER): o_complex_recalc(toplevel, o_current); break; case(OBJ_PIN): o_pin_recalc(toplevel, o_current); break; case(OBJ_ARC): o_arc_recalc(toplevel, o_current); break; case(OBJ_TEXT): o_text_recalc(toplevel, o_current); break; } } }
/*! \brief move a pin object * \par Function Description * This function changes the position of a pin \a object. * * \param [in] toplevel The TOPLEVEL object * \param [in] dx The x-distance to move the object * \param [in] dy The y-distance to move the object * \param [in] object The pin OBJECT to be moved */ void o_pin_translate_world(TOPLEVEL *toplevel, int dx, int dy, OBJECT *object) { /* Update world coords */ object->line->x[0] = object->line->x[0] + dx; object->line->y[0] = object->line->y[0] + dy; object->line->x[1] = object->line->x[1] + dx; object->line->y[1] = object->line->y[1] + dy; /* Update bounding box */ o_pin_recalc (toplevel, object); s_tile_update_object(toplevel, object); }
/*! \brief create a new pin object * \par Function Description * This function creates and returns a new pin object. * * \param [in] toplevel The TOPLEVEL object. * \param [in] type The OBJECT type (usually OBJ_PIN) * \param [in] color The color of the pin * \param [in] x1 x-coord of the first point * \param [in] y1 y-coord of the first point * \param [in] x2 x-coord of the second point * \param [in] y2 y-coord of the second point * \param [in] pin_type type of pin (PIN_TYPE_NET or PIN_TYPE_BUS) * \param [in] whichend The connectable end of the pin * \return A new pin OBJECT */ OBJECT *o_pin_new(TOPLEVEL *toplevel, char type, int color, int x1, int y1, int x2, int y2, int pin_type, int whichend) { OBJECT *new_node; new_node = s_basic_new_object(type, "pin"); new_node->color = color; new_node->line = (LINE *) g_malloc(sizeof(LINE)); new_node->line->x[0] = x1; new_node->line->y[0] = y1; new_node->line->x[1] = x2; new_node->line->y[1] = y2; o_pin_set_type (toplevel, new_node, pin_type); o_pin_recalc (toplevel, new_node); new_node->whichend = whichend; return new_node; }