home *** CD-ROM | disk | FTP | other *** search
/ Enter 1998 December / ENTER12_1.iso / Dema / Cad_Proj.ekt / Mega48t / CC / SELLOOP.C_ / SELLOOP.C
Encoding:
C/C++ Source or Header  |  1997-11-06  |  1.6 KB  |  52 lines

  1. /**********************************************************************/
  2. #include "std.h"
  3. #include "megatyp.h"
  4. #include "megacad.h"
  5. #define MAXPIDS 500
  6. /**********************************************************************/
  7. char edta[32000];// Puffer für variable Daten
  8. ulong pids[MAXPIDS]; // Platz für 500 Element ID's
  9. ushort pidnum;  // Zähler für die Anzahl der Elemet ID's
  10. /**********************************************************************/
  11. short SelPid(
  12.         void *argptr )
  13. {
  14.     t_entity  *ent;
  15.  
  16.     ent = argptr;
  17.     pids[pidnum] = ent->id;
  18.     pidnum++;
  19.     if(pidnum == MAXPIDS)
  20.         return(BREAK_LOOP);
  21.     else
  22.         return(CONTINUE_LOOP);
  23. }
  24. /**********************************************************************/
  25. short DoDraw(
  26.         void *ptr )
  27. {
  28.     DrawEntities(pids,pidnum);
  29. }
  30. /**********************************************************************/
  31. short main(
  32.         char *filename,
  33.         char *args )
  34. {
  35.     t_entity ent;
  36.  
  37.     // Anzahl auf 0 vorinitialisieren
  38.     pidnum = 0;
  39.     SetFuncText("Farbe invertieren");
  40.     MouseHelp("Element wählen","zurück",HLP_INV(0,0,0));
  41.     // Selektionskriterium -> alle Elemente erlaubt
  42.     // ( (1<<E_LINE) || (1<<E_POINT) ) selektiert nur Linien und Punkte
  43.     SelectInit(0xffffffff);
  44.     // Selektionsschleife bei jedem gefundenen Element wird SelPid aufgerufen
  45.     // aber nicht die gesperrten Elemente
  46.     SelectLoop(SelPid,&ent,edta,sizeof(edta),FALSE);
  47.     // alle Elemente, deren ID jetzt in pids steht, invertieren
  48.     Blink(DoDraw,NULL);
  49.     return(0);
  50. }
  51. /**********************************************************************/
  52.