# include "Ximage.h"

// define the section, but do not create a graph or image 
int DefineSection (int sock) {
  
  int N, MoveSection;
  char name[128];
  double x, y, dx, dy;
  Section *section;

  KiiScanMessage (sock, "%s %lf %lf %lf %lf", name, &x, &y, &dx, &dy);

  MoveSection = FALSE;

  N = GetSectionByName (name);
  if (N < 0) {
    section = AddSection (name, x, y, dx, dy);
    MoveSection = TRUE;
  } else {
    section = GetSectionByNumber (N);
    SetActiveSectionByNumber (N);

    if (section[0].x != x)   MoveSection = TRUE;
    if (section[0].y != y)   MoveSection = TRUE;
    if (section[0].dx != dx) MoveSection = TRUE;
    if (section[0].dy != dy) MoveSection = TRUE;

    section[0].x = x;
    section[0].y = y;
    section[0].dx = dx;
    section[0].dy = dy;
  }

  if (MoveSection) {
    SetSectionSizes (section);
    Refresh ();
  }

  return (TRUE);
}
