findrat.c

00001 /* FindRat plug-in for PCB
00002    http://www.delorie.com/pcb/findrat.c
00003 
00004    Copyright (C) 2008 DJ Delorie <dj@delorie.com>
00005 
00006    Licensed under the terms of the GNU General Public License, version
00007    2 or later.
00008 
00009    Compile like this:
00010 
00011    gcc -I$HOME/geda/pcb-cvs/src -I$HOME/geda/pcb-cvs -O2 -shared findrat.c -o findrat.so
00012 
00013    The resulting findrat.so goes in $HOME/.pcb/plugins/findrat.so.
00014 
00015    Usage: FindRat()
00016 
00017    The cursor scrolls to one of the rats on the board.
00018 */
00019 
00020 #include <stdio.h>
00021 #include <math.h>
00022 
00023 #include "global.h"
00024 #include "data.h"
00025 #include "hid.h"
00026 #include "error.h"
00027 
00028 static int
00029 findrat (int argc, char **argv, int x, int y)
00030 {
00031   RatType *r;
00032 
00033   if (PCB->Data->RatN == 0)
00034     {
00035       Message("No Rats");
00036       return 0;
00037     }
00038 
00039   r = & (PCB->Data->Rat[0]);
00040   gui->set_crosshair (r->Point1.X, r->Point1.Y, HID_SC_PAN_VIEWPORT);
00041   return 0;
00042 }
00043 
00044 static HID_Action findrat_action_list[] = {
00045   {"FindRat", NULL, findrat,
00046    NULL, NULL}
00047 };
00048 
00049 REGISTER_ACTIONS (findrat_action_list)
00050 
00051 void
00052 pcb_plugin_init()
00053 {
00054   register_findrat_action_list();
00055 }

Generated on Tue Aug 17 15:28:04 2010 for pcb-plugins by  doxygen 1.4.6-NO