コード例 #1
0
ファイル: layerstest.c プロジェクト: michalsc/AROS
void DemoC()
{
  int i;
  printf("Generating a few layers\n");
  GenerateLayers2();
  if (layers[1])
  {
    printf("Moving layer 1...\n");
    Delay(30);
    i = 50;
    while (i>0 && (TRUE == MoveLayer(0, layers[1], 1,1)))
        i--;
  }
  if (layers[2])
  {
    printf("Moving layer 2...\n");
    Delay(30);
    i = 50;
    while (i>0 && (TRUE == MoveLayer(0, layers[2], 2, -1)))
      i--;
  }  
  if (layers[3])
  {
    printf("Moving layer 3...\n");
    Delay(30);
    i = 50;
    while (i>0 && TRUE == MoveLayer(0, layers[3], 1, 3))
      i--;
  }
  if (layers[0])
  {
    printf("Moving layer 0...\n");
    Delay(30);
    i = 150;
    while (i>0 && TRUE == MoveLayer(0, layers[0], 0 ,1))
      i--;
  }
  printf("Deleting all visible layers!\n");
  i = 0;
  while (i < 10)
  {
    if (layers[i])
      DeleteLayer(0, layers[i]);
    layers[i] = NULL;
    i++;
  }    
}
コード例 #2
0
void ParticleEmitter::AddLayer(ParticleLayer * layer, ParticleLayer * layerToMoveAbove)
{
    AddLayer(layer);
    if (layerToMoveAbove)
    {
        MoveLayer(layer, layerToMoveAbove);
    }
}
コード例 #3
0
ファイル: move.c プロジェクト: fruoff/pcb-fruoff
int
MoveLayerAction (int argc, char **argv, Coord x, Coord y)
{
  int old_index, new_index;
  int new_top = -1;

  if (argc != 2)
    {
      Message ("Usage; MoveLayer(old,new)");
      return 1;
    }

  if (strcmp (argv[0], "c") == 0)
    old_index = INDEXOFCURRENT;
  else
    old_index = atoi (argv[0]);

  if (strcmp (argv[1], "c") == 0)
    {
      new_index = INDEXOFCURRENT;
      if (new_index < 0)
	new_index = 0;
    }
  else if (strcmp (argv[1], "up") == 0)
    {
      new_index = INDEXOFCURRENT - 1;
      if (new_index < 0)
	return 1;
      new_top = new_index;
    }
  else if (strcmp (argv[1], "down") == 0)
    {
      new_index = INDEXOFCURRENT + 1;
      if (new_index >= max_copper_layer)
	return 1;
      new_top = new_index;
    }
  else
    new_index = atoi (argv[1]);

  if (MoveLayer (old_index, new_index))
    return 1;

  if (new_index == -1)
    {
      new_top = old_index;
      if (new_top >= max_copper_layer)
	new_top--;
      new_index = new_top;
    }
  if (old_index == -1)
    new_top = new_index;

  if (new_top != -1)
    ChangeGroupVisibility (new_index, 1, 1);

  return 0;
}
コード例 #4
0
ファイル: layerstest.c プロジェクト: michalsc/AROS
void movelayer(void)
{
  int i,dx,dy;
  printf("Move layer with id: ");
  scanf("%d",&i);
  printf("delta x: ");
  scanf("%d",&dx);
  printf("delta y: ");
  scanf("%d",&dy);
  if (layers[i])
  {
    MoveLayer(0, layers[i], dx, dy);
    printf("Moved layer with id %d to new position.\n",i);
  }
  else
  {
    printf("No layer with id %d\n",i);
  }
}
コード例 #5
0
ファイル: layerstest.c プロジェクト: michalsc/AROS
void motion(void)
{
  int i,dx,dy,iter;
  printf("Move layer with id: ");
  scanf("%d",&i);
  printf("delta x: ");
  scanf("%d",&dx);
  printf("delta y: ");
  scanf("%d",&dy);
  printf("iterations: ");
  scanf("%d",&iter);
  if (layers[i])
  {
    while (iter > 0 && (TRUE == MoveLayer(0, layers[i],dx,dy)))
      iter--;
    printf("Moved layer with id %d to new position.\n",i);
  }
  else
  {
    printf("No layer with id %d\n",i);
  }
}
コード例 #6
0
ファイル: fontmode.c プロジェクト: majenkotech/pcb
static int
FontEdit (int argc, char **argv, Coord Ux, Coord Uy) {
    FontType *font;
    SymbolType *symbol;
    LayerType *lfont, *lorig, *lwidth, *lgrid;
    int s, l;

    if (hid_actionl ("New", "Font", 0)) {
        return 1;
    }

    Settings.grid_unit = get_unit_struct("mil");
    Settings.Bloat = PCB->Bloat = 1;
    Settings.Shrink = PCB->Shrink = 1;
    Settings.minWid = PCB->minWid = 1;
    Settings.minSlk = PCB->minSlk = 1;
    MoveLayerToGroup (max_copper_layer + TOP_SILK_LAYER, 0);
    MoveLayerToGroup (max_copper_layer + BOTTOM_SILK_LAYER, 1);

    while (PCB->Data->LayerN > 4) {
        MoveLayer (4, -1);
    }

    for (l = 0; l < 4; l++) {
        MoveLayerToGroup (l, l);
    }

    PCB->MaxWidth = CELL_SIZE * 18;
    PCB->MaxHeight = CELL_SIZE * ((MAX_FONTPOSITION + 15) / 16 + 2);
    PCB->Grid = MIL_TO_COORD (5);
    PCB->Data->Layer[0].Name = strdup ("Font");
    PCB->Data->Layer[1].Name = strdup ("OrigFont");
    PCB->Data->Layer[2].Name = strdup ("Width");
    PCB->Data->Layer[3].Name = strdup ("Grid");
    hid_action ("PCBChanged");
    hid_action ("LayersChanged");
    lfont = PCB->Data->Layer + 0;
    lorig = PCB->Data->Layer + 1;
    lwidth = PCB->Data->Layer + 2;
    lgrid = PCB->Data->Layer + 3;
    font = &PCB->Font;

    for (s = 0; s <= MAX_FONTPOSITION; s++) {
        Coord ox = (s % 16 + 1) * CELL_SIZE;
        Coord oy = (s / 16 + 1) * CELL_SIZE;
        Coord w, miny, maxy, maxx = 0;
        symbol = &font->Symbol[s];
        miny = MIL_TO_COORD (5);
        maxy = font->MaxHeight;

        for (l = 0; l < symbol->LineN; l++) {
            CreateDrawnLineOnLayer (lfont,
                                    symbol->Line[l].Point1.X + ox,
                                    symbol->Line[l].Point1.Y + oy,
                                    symbol->Line[l].Point2.X + ox,
                                    symbol->Line[l].Point2.Y + oy,
                                    symbol->Line[l].Thickness,
                                    symbol->Line[l].Thickness, NoFlags ());
            CreateDrawnLineOnLayer (lorig, symbol->Line[l].Point1.X + ox,
                                    symbol->Line[l].Point1.Y + oy,
                                    symbol->Line[l].Point2.X + ox,
                                    symbol->Line[l].Point2.Y + oy,
                                    symbol->Line[l].Thickness,
                                    symbol->Line[l].Thickness, NoFlags ());

            if (maxx < symbol->Line[l].Point1.X) {
                maxx = symbol->Line[l].Point1.X;
            }

            if (maxx < symbol->Line[l].Point2.X) {
                maxx = symbol->Line[l].Point2.X;
            }
        }

        w = maxx + symbol->Delta + ox;
        CreateDrawnLineOnLayer (lwidth,
                                w, miny + oy,
                                w, maxy + oy, MIL_TO_COORD (1), MIL_TO_COORD (1), NoFlags ());
    }

    for (l = 0; l < 16; l++) {
        int x = (l + 1) * CELL_SIZE;
        CreateDrawnLineOnLayer (lgrid, x, 0, x, PCB->MaxHeight, MIL_TO_COORD (1),
                                MIL_TO_COORD (1), NoFlags ());
    }

    for (l = 0; l <= MAX_FONTPOSITION / 16 + 1; l++) {
        int y = (l + 1) * CELL_SIZE;
        CreateDrawnLineOnLayer (lgrid, 0, y, PCB->MaxWidth, y, MIL_TO_COORD (1),
                                MIL_TO_COORD (1), NoFlags ());
    }

    return 0;
}
コード例 #7
0
ファイル: fontmode.c プロジェクト: bert/pcb-update
static int
FontEdit (int argc, char **argv, int Ux, int Uy)
{
  FontType *font;
  SymbolType *symbol;
  LayerTypePtr lfont, lorig, lwidth, lgrid;
  int s, l;

  if (hid_actionl ("New", "Font", 0))
    return 1;

  while (PCB->Data->LayerN > 4)
    MoveLayer (4, -1);
  for (l = 0; l < 4; l++)
    {
      MoveLayerToGroup (l, l);
    }
  PCB->MaxWidth = CELL_SIZE * 18;
  PCB->MaxHeight = CELL_SIZE * ((MAX_FONTPOSITION + 15) / 16 + 2);
  PCB->Grid = 500.0;
  PCB->Data->Layer[0].Name = MyStrdup ("Font", "FontEdit");
  PCB->Data->Layer[1].Name = MyStrdup ("OrigFont", "FontEdit");
  PCB->Data->Layer[2].Name = MyStrdup ("Width", "FontEdit");
  PCB->Data->Layer[3].Name = MyStrdup ("Grid", "FontEdit");
  hid_action ("PCBChanged");
  hid_action ("LayersChanged");

  lfont = PCB->Data->Layer + 0;
  lorig = PCB->Data->Layer + 1;
  lwidth = PCB->Data->Layer + 2;
  lgrid = PCB->Data->Layer + 3;

  font = &PCB->Font;
  for (s = 0; s <= MAX_FONTPOSITION; s++)
    {
      int ox = (s % 16 + 1) * CELL_SIZE;
      int oy = (s / 16 + 1) * CELL_SIZE;
      int w, miny, maxy, maxx = 0;

      symbol = &font->Symbol[s];

      miny = 500;
      maxy = font->MaxHeight;

      for (l = 0; l < symbol->LineN; l++)
	{
	  CreateDrawnLineOnLayer (lfont,
				  symbol->Line[l].Point1.X + ox,
				  symbol->Line[l].Point1.Y + oy,
				  symbol->Line[l].Point2.X + ox,
				  symbol->Line[l].Point2.Y + oy,
				  symbol->Line[l].Thickness,
				  symbol->Line[l].Thickness, NoFlags ());
	  CreateDrawnLineOnLayer (lorig, symbol->Line[l].Point1.X + ox,
				  symbol->Line[l].Point1.Y + oy,
				  symbol->Line[l].Point2.X + ox,
				  symbol->Line[l].Point2.Y + oy,
				  symbol->Line[l].Thickness,
				  symbol->Line[l].Thickness, NoFlags ());
	  if (maxx < symbol->Line[l].Point1.X)
	    maxx = symbol->Line[l].Point1.X;
	  if (maxx < symbol->Line[l].Point2.X)
	    maxx = symbol->Line[l].Point2.X;
	}
      w = maxx + symbol->Delta + ox;
      CreateDrawnLineOnLayer (lwidth,
			      w, miny + oy,
			      w, maxy + oy, 100, 100, NoFlags ());
    }

  for (l = 0; l < 16; l++)
    {
      int x = (l + 1) * CELL_SIZE;
      CreateDrawnLineOnLayer (lgrid, x, 0, x, PCB->MaxHeight, 100, 100,
			      NoFlags ());
    }
  for (l = 0; l <= MAX_FONTPOSITION / 16 + 1; l++)
    {
      int y = (l + 1) * CELL_SIZE;
      CreateDrawnLineOnLayer (lgrid, 0, y, PCB->MaxWidth, y, 100, 100,
			      NoFlags ());
    }
  return 0;
}
コード例 #8
0
ファイル: layerstest.c プロジェクト: michalsc/AROS
void DemoD()
{
  int i;
  int c;
  struct BitMap * sb;
  printf("Deleting all previously generated layers...\n");
  for (i = 0; i < 10; i++) 
  {
    if (layers[i])
    {
      DeleteLayer(0, layers[i]);
      layers[i] = NULL;
    }
  }
  i = 0;

  printf("Creating 4 superbitmap layers\n");

  sb = AllocBitMap(91,91,1,BMF_CLEAR,NULL);

  layers[0] = CreateUpfrontLayer(&screen->LayerInfo, 
                                 screen->RastPort.BitMap,
                                 10,
                                 10,
                                 100,
                                 100,
                                 LAYERSMART|LAYERSUPER,
                                 sb);
  
  frame(layers[0]);

  sb = AllocBitMap(71,71,1,BMF_CLEAR,NULL);
  layers[1] = CreateUpfrontLayer(&screen->LayerInfo, 
                                 screen->RastPort.BitMap,
                                 50,
                                 50,
                                 120,
                                 120,
                                 LAYERSMART|LAYERSUPER,
                                 sb);

  frame(layers[1]);

  sb = AllocBitMap(71,61,1,BMF_CLEAR,NULL);
  layers[2] = CreateUpfrontLayer(&screen->LayerInfo, 
                                 screen->RastPort.BitMap,
                                 70,
                                 30,
                                 140,
                                 90,
                                 LAYERSMART|LAYERSUPER,
                                 sb);
  frame(layers[2]);

  sb = AllocBitMap(131,41,1,BMF_CLEAR,NULL);
  layers[3] = CreateUpfrontLayer(&screen->LayerInfo,
                                 screen->RastPort.BitMap,
                                 20,
                                 20,
                                 150,
                                 60,
                                 LAYERSMART|LAYERSUPER,
                                 sb);

  frame(layers[3]);

  printf("Resizing layer 4\n");
  Delay(30);
  SizeLayer(0, layers[3], -80, -10);
  /* this leaves width = 51, height = 31 */
  printf("Scrolling layer 4\n");
  Delay(30);
  c = 0;
  while (c < 80)
  {
    c++;
    Delay(5);
    ScrollLayer(0, layers[3], 1, 0);
  }
  
  c = 0;
  while (c < 10)
  {
    c++;
    Delay(5);
    ScrollLayer(0, layers[3], 0 ,1);
  }

  c = 0;
  while (c < 10)
  {
    c++;
    Delay(5);
    ScrollLayer(0, layers[3], -8 ,-1);
  }
  
  printf("Resizing layer 4 to its full size\n");
  Delay(30);
  SizeLayer(0, layers[3], 80, 10);
  
  printf("Resizing layer 1\n");
  SizeLayer(0, layers[0], -50, -50);

  /* this leaves width = 41, height = 41 */
  printf("Scrolling layer 1\n");
  Delay(30);
  c = 0;
  while (c < 41)
  {
    c++;
    Delay(5);
    ScrollLayer(0, layers[0], 1, 0);
  }
  
  c = 0;
  while (c < 41)
  {
    c++;
    Delay(5);
    ScrollLayer(0, layers[0], 0 ,1);
  }
  
  c = 0;
  while (c < 41)
  {
    c++;
    Delay(5);
    ScrollLayer(0, layers[0], -1 ,-1);
  }

  printf("Resizing layer 1 to its full size\n");
  Delay(30);
  SizeLayer(0, layers[0], 50, 50);

  printf("Shuffling layers...\n");
  UpfrontLayer(0, layers[0]);
  Delay(20);
  UpfrontLayer(0, layers[1]);
  Delay(20);
  UpfrontLayer(0, layers[2]);
  Delay(20);
  UpfrontLayer(0, layers[3]);
  Delay(20);
  BehindLayer(0, layers[2]);
  Delay(20);
  BehindLayer(0,layers[1]);
  Delay(20);
  BehindLayer(0,layers[0]);
  printf("Inviting a few smart friends...\n");
  GenerateLayers3();
  printf("Moving the layers...\n");
  c = 0;
  while (c < 40)
  {
    MoveLayer(0, layers[4], -1, -1);
    MoveLayer(0, layers[0], 1,2);
    MoveLayer(0, layers[2], 2,1);
    MoveLayer(0, layers[5], -2, 0);
    c++;
  }

  c = 0;
  while (c < 30)
  {
    MoveLayer(0, layers[4], -1, -1);
    MoveLayer(0, layers[5], -1, 0);
    MoveLayer(0, layers[3], 3, 2);
    MoveSizeLayer(layers[2], 2, -1, -1, -1);
    c++;
  }

  c = 0;
  while (c < 30)
  {
    MoveSizeLayer(layers[2], -2, 1, 1 ,1);
    MoveSizeLayer(layers[1],  2, 0, -1 ,-1);
    MoveLayer(0, layers[5], 2, 1);
    c++;
  }

  c = 0;
  while (c < 30)
  {
    MoveSizeLayer(layers[1], -1, -1 ,1 , 1);
    c++;
  }
  
  printf("Deleting the layers...\n");
  i = 0;
  while (i < 8)
  {
    while ((layers[i]->bounds.MaxX - layers[i]->bounds.MinX) >= 1 &&
           (layers[i]->bounds.MaxY - layers[i]->bounds.MinY) >= 1)
    {
      MoveSizeLayer(layers[i], 2, 0, -1, -1);
    }
    DeleteLayer(0, layers[i]);
    layers[i] = NULL;
    i++;
  }  
}