00001
00041 #include <stdio.h>
00042 #include <math.h>
00043
00044 #include "global.h"
00045 #include "data.h"
00046 #include "hid.h"
00047 #include "misc.h"
00048 #include "create.h"
00049 #include "rtree.h"
00050 #include "undo.h"
00051 #include "set.h"
00052 #include "error.h"
00053
00060 static int
00061 find_element (int argc, char **argv, int x, int y)
00062 {
00063 if (argc == 0 || strcasecmp (argv[0], "") == 0)
00064 {
00065 Message ("WARNING: in FindElement the argument should be a non-empty string value.\n");
00066 return 0;
00067 }
00068 else
00069 {
00070 SET_FLAG (NAMEONPCBFLAG, PCB);
00071 ELEMENT_LOOP(PCB->Data);
00072 {
00073 if (NAMEONPCB_NAME(element)
00074 && strcmp (argv[0], NAMEONPCB_NAME(element)) == 0)
00075 {
00076 gui->set_crosshair
00077 (
00078 element->MarkX,
00079 element->MarkY,
00080 HID_SC_PAN_VIEWPORT
00081 );
00082 }
00083 }
00084 END_LOOP;
00085 gui->invalidate_all ();
00086 IncrementUndoSerialNumber ();
00087 return 0;
00088 };
00089 }
00090
00091
00092 static HID_Action findelement_action_list[] =
00093 {
00094 {"FindElement", NULL, find_element, "Find the specified element", NULL},
00095 {"FE", NULL, find_element, "Find the specified element", NULL}
00096 };
00097
00098
00099 REGISTER_ACTIONS (findelement_action_list)
00100
00101
00102 void
00103 pcb_plugin_init()
00104 {
00105 register_findelement_action_list();
00106 }
00107
00108