Esempio n. 1
0
static void
/*FCN*/OnGroupNew (
  ButtoN b
){
  Int2 i;
  Char newName[64];

  GetTitle ( groupDialog, &(newName[0]), 64 );
  if ( newName[0] == 0 ) return;
  newName[63] = 0;
  for ( i=1; i<=totalGroups; i++ ){
    if ( StringCmp ( (CharPtr)Nlm_GetMuskCParamEd(MSM_GROUPS,
                      i,MSM_STRING), &(newName[0]) ) == 0 ) return;
  }
  MemMove ( &(groupAr[1]), &(groupAr[0]), totalGroups*sizeof(Int2) );
  totalGroups++;
  nHideGroups++;
  groupAr[0] = totalGroups;
  Nlm_SetMuskCParamEd(MSM_GROUPS,MSM_NOSUBCLASS,MSM_NUM,(BigScalar)totalGroups);
  Nlm_SetMuskCParamEd(MSM_GROUPS,totalGroups,MSM_STRING,(BigScalar)&(newName[0]));
  curGroupInd = 0;
  FillGroupList(TRUE);
  SetGroupValue ( curGroupInd );
  FillFeatPopup(TRUE);
  LoadFeatureArray();
  FillFeatList(TRUE);
  if ( totalFeatures == 0 ){
    curFeatureInd = -1;
  } else {
    curFeatureInd = 0;
    SetFeatValue ( curFeatureInd );
  }
  UpdateDlgControls();
  SaveGroupArray();
}
Esempio n. 2
0
CVirtualDevice_Drive::CVirtualDevice_Drive()
{
    InitErrorHandling();

    FillGroupList();
    m_strVirtualDeviceName = VIRTUAL_DEVICE_DRIVE;
}
Esempio n. 3
0
CVirtualDevice_Drive::CVirtualDevice_Drive(const CVirtualDevice_Drive& rObject):CVirtualDeviceBase(rObject)
{
    InitErrorHandling();

    FillGroupList();
    m_strVirtualDeviceName = rObject.m_strVirtualDeviceName;

    InitGroupList(m_pGateway);
    InitJournalManager(rObject.m_pJournalManager);
}
Esempio n. 4
0
static void
/*FCN*/OnGroupDelete (
  ButtoN b
){
  Int2      i,j;
  BigScalar k;
  CharPtr   name;

  name = (CharPtr)Nlm_GetMuskCParamEd(MSM_GROUPS,
         groupAr[curGroupInd],MSM_STRING);
  if ( (name == NULL) || (*name == 0) ) name = unknownName;
  if ( Message ( MSG_YN, "Delete group %s ?", name ) == ANS_YES ){
    if ( curGroupInd < nHideGroups ) nHideGroups--;
    i = groupAr[curGroupInd];
    for ( j=1; j<=MSM_TOTAL_POSITIVE; j++ ){
      k = Nlm_GetMuskCParamEd(j,MSM_FGROUP,MSM_NUM);
      if ( k > i ) {
        Nlm_SetMuskCParamEd(j,MSM_FGROUP,MSM_NUM,k-1);
      }
    }
    for ( j=i+1; j<=totalGroups; j++ ){
      k = Nlm_GetMuskCParamEd(MSM_GROUPS,j,MSM_TRUEFALSE);
      Nlm_SetMuskCParamEd(MSM_GROUPS,(Int2)(j-1),MSM_TRUEFALSE,k);
      k = Nlm_GetMuskCParamEd(MSM_GROUPS,j,MSM_STYLE);
      Nlm_SetMuskCParamEd(MSM_GROUPS,(Int2)(j-1),MSM_STYLE,k);
      k = Nlm_GetMuskCParamEd(MSM_GROUPS,j,MSM_STRING);
      Nlm_SetMuskCParamEd(MSM_GROUPS,(Int2)(j-1),MSM_STRING,k);
    }
    Nlm_SetMuskCParamEd(MSM_GROUPS,totalGroups,MSM_STRING,(BigScalar)NULL);
    for ( j=0; j<totalGroups; j++ ){
      if ( groupAr[j] > i )  groupAr[j] -= 1;
    }
    if ( curGroupInd != (totalGroups-1) ){
      MemMove ( &(groupAr[curGroupInd]), &(groupAr[curGroupInd+1]), 
                (totalGroups-curGroupInd-1)*sizeof(Int2) );
    } else curGroupInd--;
    totalGroups--;
	Nlm_SetMuskCParamEd(MSM_GROUPS,MSM_NOSUBCLASS,MSM_NUM,(BigScalar)totalGroups);
    FillGroupList(TRUE);
    SetGroupValue ( curGroupInd );
    FillFeatPopup(TRUE);
    LoadFeatureArray();
    FillFeatList(TRUE);
    if ( totalFeatures == 0 ){
      curFeatureInd = -1;
    } else {
      curFeatureInd = 0;
      SetFeatValue ( curFeatureInd );
    }
    SaveGroupArray();
    UpdateDlgControls();
  }
}
Esempio n. 5
0
static void
/*FCN*/OnGroupTop (
  ButtoN b
){
  Int2 i;

  if ( curGroupInd >= nHideGroups ) nHideGroups++;
  i = groupAr[curGroupInd];
  MemMove ( &(groupAr[1]), &(groupAr[0]), curGroupInd*sizeof(Int2) );
  groupAr[0] = i;
  curGroupInd = 0;
  FillGroupList(TRUE);
  SetGroupValue ( curGroupInd );
  SaveGroupArray();
  UpdateDlgControls();
}
Esempio n. 6
0
void CloseBBG(void)
{
   int i;
   PDIB pdib;
   HWND hList;

   if (NumBBGs == 0)
      return;

   if (BBGs[CurrentBBG].changed &&
       MessageBox(hMain, "This BBG has changed; are you sure you want to close it?",
		  "Confirm BBG close", MB_YESNO) == IDNO)
      return;

   hList = GetDlgItem(hMain, IDBBGLIST);

   // Free bitmaps
   for (i=0; i < BBGs[CurrentBBG].NumBitmaps; i++)
   {
      pdib = BBGs[CurrentBBG].Bitmaps[i].pdib;

      if (pdib != NULL)
	 DibFree(pdib);
   }

   NumBBGs--;
   for (i = CurrentBBG; i < NumBBGs; i++)
      BBGs[i] = BBGs[i + 1];

   CurrentBBG = ListBoxRemoveCurrentItem(hList);
   if (CurrentBBG == -1)
      CurrentBBG = 0;

   FillBitmapList();
   FillHotlist();
   FillGroupList();
   FillGroupiesList();

   WanderOne.BBG = -1;
   Anchor.BBG = -1;
   SetDlgItemText(hMain, ANCHORTEXT, " ");
   SetDlgItemText(hMain, WANDER1TEXT, " ");
   DrawIt();
}
Esempio n. 7
0
static void
/*FCN*/OnGroupHide (
  ButtoN b
){
  Int2 i;

  i = groupAr[curGroupInd];
  if ( curGroupInd >= nHideGroups ) return;
  MemMove ( &(groupAr[curGroupInd]), 
            &(groupAr[curGroupInd+1]), 
            (nHideGroups-curGroupInd-1)*sizeof(Int2) );
  nHideGroups--;
  groupAr[nHideGroups] = i;
  curGroupInd = nHideGroups;
  FillGroupList(TRUE);
  SetGroupValue ( curGroupInd );
  SaveGroupArray();
  UpdateDlgControls();
}
Esempio n. 8
0
static void
/*FCN*/OnGroupBottom (
  ButtoN b
){
  Int2 i;

  i = groupAr[curGroupInd];
  if ( curGroupInd >= nHideGroups ) {
    MemMove ( &(groupAr[nHideGroups+1]), 
              &(groupAr[nHideGroups]), 
              (curGroupInd-nHideGroups)*sizeof(Int2) );
    nHideGroups++;
  } else {
    MemMove ( &(groupAr[curGroupInd]), 
              &(groupAr[curGroupInd+1]), 
              (nHideGroups-curGroupInd-1)*sizeof(Int2) );
  }
  curGroupInd = nHideGroups-1;
  groupAr[curGroupInd] = i;
  FillGroupList(TRUE);
  SetGroupValue ( curGroupInd );
  SaveGroupArray();
  UpdateDlgControls();
}
Esempio n. 9
0
void OpenBBG(void)
{
   int i, j, k;
   OPENFILENAME ofn;
   FILE* fp;
   int ch;
   char szBuffer[MAX_PATH];

   if (NumBBGs == MAX_BBGS)
      return;

   BBGs[NumBBGs].FullPath[0] = '\0';
   BBGs[NumBBGs].Title[0] = '\0';
   memset( &ofn, 0, sizeof(OPENFILENAME) );
   ofn.lStructSize = sizeof(OPENFILENAME);
   ofn.hwndOwner = hMain;
   ofn.lpstrFilter = BBG_Filter;
   ofn.lpstrFile = BBGs[NumBBGs].FullPath;
   ofn.nMaxFile = MAX_PATH;
   ofn.lpstrFileTitle = BBGs[NumBBGs].Title;
   ofn.nMaxFileTitle = 50;
   ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;

   if( !GetOpenFileName(&ofn) )
   {
      MessageBeep(0);
      SetFocus(hMain);
      return;
   }
   SendDlgItemMessage(hMain, IDBBGLIST, LB_ADDSTRING, 0,
		      (LPARAM)((LPCSTR)BBGs[NumBBGs].Title));
   fp=fopen(BBGs[NumBBGs].FullPath, "r");

   if (fp == NULL)
   {
      MessageBox(hMain, "Unable to open BBG file for reading!\n", szAppName, MB_OK);
      return;
   }

   BBGs[NumBBGs].Comment[0] = '\0';
   BBGs[NumBBGs].Shrink = 1;

   // Read comments
   while ((ch = getc(fp)) == '#')
   {
      if (fgets(szBuffer, 200, fp) == NULL)
	 break;
      szBuffer[strlen(szBuffer) - 1] = 0;  // Kill newline
      strcat(BBGs[NumBBGs].Comment, szBuffer + 1);  // Skip comment character
      strcat(BBGs[NumBBGs].Comment, "\r\n");
   }
   ungetc(ch, fp);

   fscanf(fp, " ");
   fscanf(fp, "-s%d ", &BBGs[NumBBGs].Shrink);

   fscanf(fp, "%d", &BBGs[NumBBGs].NumBitmaps);
   for (i = 0; i < BBGs[NumBBGs].NumBitmaps;i++)
   {
      Bitmap *b;

      b = &BBGs[NumBBGs].Bitmaps[i];

      memset(b, 0, sizeof(Bitmap));
      fscanf(fp,"%s ",b->Title);

      for (k = 0; k < 2; k++)
      {
	 fscanf(fp,"[%d,%d] ", &b->XOffset, &b->YOffset);
	 
	 if ( fscanf(fp,":%d",&b->NumHotspots))
	    for (j = 0; j < b->NumHotspots; j++)
	       fscanf(fp,"%d [%d,%d]",&b->Hotspots[j].Lap,
		      &b->Hotspots[j].X, &b->Hotspots[j].Y);
      }
   }

   fscanf(fp,"%d",&BBGs[NumBBGs].NumGroups);

   for (i = 0; i < BBGs[NumBBGs].NumGroups; i++)
   {
      fscanf(fp,"%d",&BBGs[NumBBGs].Groups[i].Members);
      for (j = 0; j < BBGs[NumBBGs].Groups[i].Members; j++)
	 fscanf(fp,"%d",&BBGs[NumBBGs].Groups[i].Indices[j]);
   }
   fclose(fp);

   CurrentBitmap = 0;
   BBGs[CurrentBBG].CurrentBitmap = CurrentBitmap;
   CurrentBBG = NumBBGs;
   CurrentGroup = 0;
   CurrentGroupMember = 0;
   CurrentHotspot = 0;
   BBGs[CurrentBBG].CurrentHotspot = CurrentHotspot;
   BBGs[CurrentBBG].changed = FALSE;
   NumBBGs++;

   FillBitmapList();
   FillHotlist();
   FillGroupList();
   FillGroupiesList();

   SendDlgItemMessage(hMain, IDBBGLIST, LB_SETCURSEL, (LPARAM) CurrentBBG, 0L);

   DrawIt();
}
Esempio n. 10
0
GrouP 
/*FCN*/Nlm_CreateDlgGroup ( 
  GrouP gTop
){
  GrouP    g, glr, g1, g2;
  Handle   toAlign[3];

  g = HiddenGroup ( gTop, 2, 1, NULL);
  SetGroupSpacing ( g, 1, 1 );
  glr = NormalGroup ( g, 1, 2, "Groups:", systemFont, NULL );
#ifdef WIN_MOTIF
  SetGroupSpacing ( glr, 12, 12 );
  SetGroupMargins ( glr, 8, 8 );
#else
  SetGroupSpacing ( glr, 6, 6 );
  SetGroupMargins ( glr, 6, 6 );
#endif
  g1 = HiddenGroup ( glr, 2, 1, NULL );
  g2 = HiddenGroup ( g1, 1, 0, NULL );
  PushButton ( g2, "Top", OnGroupTop );
  PushButton ( g2, "Bottom", OnGroupBottom );
  groupHideButton = PushButton ( g2, "Hide", OnGroupHide );
  groupCompBox = CheckBox ( g2, "Compress", OnGroupCompress );
  groupDelButton = PushButton ( g2, "Delete", OnGroupDelete );
  groupList = SingleList ( g1, 10, 8, OnGroupList );
  curGroupInd = 0;
  LoadGroupArray();
  g2 = HiddenGroup ( glr, 3, 0, NULL );
  toAlign[2] = (Handle)PushButton ( g2, "Create", OnGroupNew );
  toAlign[0] = (Handle)StaticPrompt ( g2, "Group", 0, 0, systemFont, 'l');
#ifdef WIN_MOTIF
  groupDialog = DialogText ( g2, "", 7, OnText16 );
#else
  groupDialog = DialogText ( g2, "", 9, OnText16 );
#endif
  toAlign[1] = (Handle)groupDialog;
  AlignObjects ( ALIGN_CENTER, (HANDLE)g1, (HANDLE)g2, NULL );

  featGroup = glr = NormalGroup ( g, 1, 2, "Features:", systemFont, NULL );
#ifdef WIN_MOTIF
  SetGroupSpacing ( glr, 12, 12 );
  SetGroupMargins ( glr, 8, 8 );
#else
  SetGroupSpacing ( glr, 6, 6 );
  SetGroupMargins ( glr, 6, 6 );
#endif
  g1 = HiddenGroup ( glr, 2, 1, NULL );
  featList = SingleList ( g1, 10, 8, OnFeatureList );
  LoadFeatureArray();
  FillFeatList( FALSE );
  if ( totalFeatures == 0 ){
    curFeatureInd = -1;
  } else {
    curFeatureInd = 0;
    SetValue ( featList, 1 );
  }
  g2 = HiddenGroup ( g1, 1, 0, NULL );
  PushButton ( g2, "Top", OnFeatTop );
  PushButton ( g2, " Bottom ", OnFeatBottom );
  featHideButton = PushButton ( g2, "Hide", OnFeatHide );
  g2 = HiddenGroup ( glr, 3, 0, NULL );
#ifdef WIN_MOTIF
  SetGroupMargins ( g2, 8, 8 );
#endif
  toAlign[0] = (Handle)PushButton ( g2, "Move", OnFeatMove );
  toAlign[1] = (Handle)StaticPrompt ( g2, "To", 0, 0, systemFont, 'l');
  featPopup = PopupList ( g2, FALSE, NULL );
  toAlign[2] = (Handle)featPopup;
  FillGroupList(FALSE);
  SetGroupValue (curGroupInd);
  FillFeatPopup(FALSE);
  UpdateDlgControls ();
  return g;
}