Ejemplo n.º 1
0
bool try_load_config(const string& fname) {
	// FIXME: script as parameter to avoid repeated construction?
	GLERC<GLEScript> script = new GLEScript();
	script->getLocation()->fromFileNameCrDir(fname);
	if (script->getSource()->tryLoad()) {
		GLEGlobalConfig* conf = GLEGetInterfacePointer()->getConfig();
		conf->setAllowConfigBlocks(true);
		g_select_device(GLE_DEVICE_DUMMY);
		g_message_first_newline(false);
		GLEFileLocation output;
		output.createIllegal();
		DrawIt(script.get(), &output, NULL, true);
		conf->setAllowConfigBlocks(false);
		return true;
	} else {
		return false;
	}
}
Ejemplo n.º 2
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();
}
Ejemplo n.º 3
0
void drawScaleFactors()
{
  MakeOutputDirectory("pdf");
  MakeOutputDirectory("png");

  DrawIt("MuSF_2012",  "h2inverted", "MuonSF", "muon SF (8 TeV)");
  DrawIt("EleSF_2012", "h2inverted", "ElecSF", "electron SF (8 TeV)");

  DrawIt("MuPR_Moriond13_2012",  "h2inverted", "MuonPR", "muon PR (8 TeV)");
  DrawIt("ElePR_Moriond13_2012", "h2inverted", "ElecPR", "electron PR (8 TeV)");

  DrawIt("MuFR_Moriond13_jet10_EWKcorr",  "FR_pT_eta_EWKcorr", "MuonFR_Jet10", "muon FR jet10 (8 TeV)");
  DrawIt("MuFR_Moriond13_jet20_EWKcorr",  "FR_pT_eta_EWKcorr", "MuonFR_Jet20", "muon FR jet20 (8 TeV)");
  DrawIt("MuFR_Moriond13_jet30_EWKcorr",  "FR_pT_eta_EWKcorr", "MuonFR_Jet30", "muon FR jet30 (8 TeV)");
  
  DrawIt("EleFR_Moriond13_jet15_EWKcorr", "fakeElH2", "ElecFR_Jet15", "electron FR jet15 (8 TeV)");
  DrawIt("EleFR_Moriond13_jet35_EWKcorr", "fakeElH2", "ElecFR_Jet35", "electron FR jet35 (8 TeV)");
  DrawIt("EleFR_Moriond13_jet50_EWKcorr", "fakeElH2", "ElecFR_Jet50", "electron FR jet50 (8 TeV)");
  
  DrawIt("triggerEfficiencies", "DoubleElLead",  "DoubleElLead",  "leading electron trigger efficiency (8 TeV)");
  DrawIt("triggerEfficiencies", "DoubleMuLead",  "DoubleMuLead",  "leading muon trigger efficiency (8 TeV)");
  DrawIt("triggerEfficiencies", "DoubleElTrail", "DoubleElTrail", "trailing electron trigger efficiency (8 TeV)");
  DrawIt("triggerEfficiencies", "DoubleMuTrail", "DoubleMuTrail", "trailing muon trigger efficiency (8 TeV)");
}
Ejemplo n.º 4
0
void CGdiSetOrigin::TheTest(const TRect &aRect, TInt)
	{
	iGdi->SetOrigin(aRect.iTl);
	DrawIt(TPoint(0,0));
	}
Ejemplo n.º 5
0
void CGdiSetOrigin::BaseTest(const TRect &aRect, TInt)
	{
	DrawIt(aRect.iTl);
	}
Ejemplo n.º 6
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();
}