Beispiel #1
0
void gossipGUI::BuildLoadFrame()
{
	if(getenv("GOSSIP_DEBUG")!=0 && strncmp(getenv("GOSSIP_DEBUG"),"1",1)==0) cout << "gossipGUI::BuildLoadFrame()" << endl;

	loadFrame = new TGMainFrame(gClient->GetRoot(), 100, 100, kTempFrame | kVerticalFrame);

	//Cancel Button
	TGTextButton *buttonCancel = new TGTextButton(loadFrame,"&Cancel");
	loadFrame->AddFrame(buttonCancel, new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 2, 10, 2));
	buttonCancel->Connect("Clicked()", "gossipGUI", this, "onCancelButtonClicked()");

	//Progress Bar
	progressBar = new TGHProgressBar(loadFrame,kLHintsExpandX);
	progressBar->SetMin(0);
	progressBar->SetMax(100);
	progressBar->SetBarColor("lightblue");
	progressBar->ShowPosition();
	progressBar->Resize(TGDimension(200,200));
	loadFrame->AddFrame(progressBar, new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 5, 5, 10, 5));
	daq->Connect("Progress(int)", "gossipGUI", this, "SetProgress(int)");

	loadFrame->SetWindowName("Generating...");
	loadFrame->SetIconName("Generating...");
	loadFrame->MapSubwindows();
	loadFrame->Resize(loadFrame->GetDefaultSize());
}
Beispiel #2
0
void control()
{
  int ButtWidth  = 150;
  int ButtHeight = 22;

  // main frame
  //
  TGMainFrame *fMainFrame = new TGMainFrame(gClient->GetRoot(),10,10,kMainFrame | kVerticalFrame);
  fMainFrame->SetName("fMainFrame");
  fMainFrame->SetLayoutBroken(kTRUE);

  // vertical frame
  TGVerticalFrame *fVerFr_StaSto = new TGVerticalFrame(fMainFrame,486,96,kVerticalFrame);
  fVerFr_StaSto->SetName("fVerFr_StaSto");

  // "fGroupFrame671" group frame
  TGGroupFrame *topGroupFrame = new TGGroupFrame(fVerFr_StaSto,"Start Stop Control");

  TGTextButton *Start = new TGTextButton(topGroupFrame,"Start/Stop");
  Start->SetTextJustify(36);
  Start->SetMargins(0,0,0,0);
  Start->SetWrapLength(-1);
  Start->Resize(ButtWidth,ButtHeight);
  topGroupFrame->AddFrame(Start, new TGLayoutHints(kLHintsLeft | kLHintsTop,10,0,10,0));

//   TGTextButton *Stop = new TGTextButton(topGroupFrame,"Stop");
//   Stop->SetTextJustify(36);
//   Stop->SetMargins(0,0,0,0);
//   Stop->SetWrapLength(-1);
//   Stop->Resize(ButtWidth,ButtHeight);

//   topGroupFrame->AddFrame(Stop, new TGLayoutHints(kLHintsLeft | kLHintsTop ,2,2,2,2));

  topGroupFrame->SetLayoutManager(new TGVerticalLayout(topGroupFrame));
  topGroupFrame->Resize(482,92);
  fVerFr_StaSto->AddFrame(topGroupFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2));

  fMainFrame->AddFrame(fVerFr_StaSto, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,2,2,2,2));
  //  fVerFr_StaSto->MoveResize(2,2,486,96);

  fMainFrame->SetMWMHints(kMWMDecorAll,
			  kMWMFuncAll,
			  kMWMInputModeless);
  fMainFrame->MapSubwindows();

  fMainFrame->Resize(fMainFrame->GetDefaultSize());
  fMainFrame->MapWindow();
  fMainFrame->MoveResize(1000, 700, 600,400);
}  
Beispiel #3
0
void gossipGUI::BuildMainFrame()
{
	if(getenv("GOSSIP_DEBUG")!=0 && strncmp(getenv("GOSSIP_DEBUG"),"1",1)==0) cout << "gossipGUI::BuildMainFrame()" << endl;

	BuildLoadFrame();

	mainFrame = new TGMainFrame(gClient->GetRoot(), 100, 100, kMainFrame | kVerticalFrame);

	//Tabs
	tab = new TGTab(mainFrame, 300, 300);

	tab->AddTab("SiPM");
	BuildSiPMFrame(tab->GetTabContainer("SiPM"));
	tab->GetTabContainer("SiPM")->AddFrame(sipmFrame);

	tab->AddTab("Light Source");
	BuildLightSourceFrame(tab->GetTabContainer("Light Source"));
	tab->GetTabContainer("Light Source")->AddFrame(lightSourceFrame);

	tab->AddTab("DAQ");
	BuildDAQFrame(tab->GetTabContainer("DAQ"));
	tab->GetTabContainer("DAQ")->AddFrame(daqFrame);
	SelectMeasurement(1);

	tab->Connect("Selected(int)", "gossipGUI", this, "onTabSwitch(int)");

	//Run Button
	TGTextButton *buttonRun = new TGTextButton(mainFrame,"     Run     ");
	mainFrame->AddFrame(buttonRun, new TGLayoutHints(kLHintsCenterX | kLHintsBottom, 2, 2, 5, 5));
	buttonRun->Connect("Clicked()", "gossipGUI", this, "onRunButtonClicked()");

	//Main Frame
	mainFrame->AddFrame(tab, new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 2, 2, 5, 1));

	mainFrame->SetWindowName("GosSiP");
	mainFrame->SetIconName("GosSiP 1.20");

	mainFrame->SetMWMHints(kMWMDecorAll, kMWMFuncAll, kMWMInputModeless);
	mainFrame->MapSubwindows();
	mainFrame->Resize(mainFrame->GetDefaultSize());
	mainFrame->MapWindow();
}
Beispiel #4
0
Int_t THaScalerGui::InitPlots() {
// Initialize plots (xscaler style)
  if (!scaler) {
    cout << "THaScalerGui::ERROR: no scaler defined... cannot init."<<endl;
    return -1;
  }
 
  InitPages();
  yboxsize = new Int_t[SCAL_NUMBANK];
  occupied = new Int_t[SCAL_NUMBANK];
  memset(occupied, 0, SCAL_NUMBANK*sizeof(Int_t));
  fDataBuff  = new TGTextBuffer[SCAL_NUMBANK*SCAL_NUMCHAN];
  pair<Int_t, TGTextEntry *> txtpair;
  pair<Int_t, TNtuple *> ntupair;
  char string_ntup[]="UpdateNum:Count:Rate:RateI";
  iloop = 0;  lastsize = YBOXSMALL;
  showselect = SHOWRATE;
  TGTab *fTab = new TGTab(this, 600, 800);
  TGLayoutHints *fLayout = new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 10, 10, 10, 10);
  TGLayoutHints *fLayout2 = new TGLayoutHints(kLHintsNormal ,10, 10, 10, 10);
  if (!scaler->GetDataBase()) {
    cout << "THaScalerGui::WARNING: no database.  Will use defaults..."<<endl;
  }
  Int_t crate = scaler->GetCrate();
  std::string sdirect;
  for (Int_t ipage = 0; ipage < npages; ipage++) {
    Int_t slot = slotmap[ipage];
    char cpage[100]; sprintf(cpage,"%d",ipage);
    std::string spage = cpage;
    sdirect = "none";
    if (scaler->GetDataBase()) 
      sdirect = scaler->GetDataBase()->GetStringDirectives(crate, "xscaler-tabs", spage.c_str());
    if (sdirect != "none") spage = sdirect;
    TGCompositeFrame *tgcf = fTab->AddTab(spage.c_str());
    std::string slayout = "none";
    if (scaler->GetDataBase()) 
      slayout = scaler->GetDataBase()->GetStringDirectives(crate, "xscaler-layout", (std::string)cpage);
    UInt_t pos = slayout.find("x");
    int nrow = 8;  int ncol = 4;  // defaults
    if (pos != std::string::npos) {
      nrow = atoi(slayout.substr(0,pos).c_str());
      ncol = atoi(slayout.substr(pos+1,slayout.length()).c_str());
    }
    yboxsize[ipage] = YBOXSMALL;
    if (nrow * ncol > 16) yboxsize[ipage] = YBOXBIG;
    GCValues_t gval;
    gval.fMask = kGCForeground;
    gClient->GetColorByName("black", gval.fForeground);
    GContext_t labelgc = gVirtualX->CreateGC(gClient->GetRoot()->GetId(), &gval);
    TGLabel *fLpage;
    std::string pagename = "none";
    if (scaler->GetDataBase()) 
      pagename = scaler->GetDataBase()->GetStringDirectives(crate, "xscaler-pagename", (std::string)cpage);
    if (pagename == "none") pagename = spage;
    fLpage = new TGLabel(tgcf, new TGString(pagename.c_str()),labelgc);
    tgcf->AddFrame(fLpage,fLayout);
    occupied[ipage] = nrow;
    Int_t chan = 0;
    for (int row = 0; row < nrow; row++) { // rows 
       TGCompositeFrame *fr; 
       fr = new TGCompositeFrame(tgcf, 50, 0, kHorizontalFrame);
       TGHorizontalLayout *fLhorz;
       fLhorz =  new TGHorizontalLayout(fr);
       fr->SetLayoutManager(fLhorz);
       for (int col = 0; col < ncol; col++) {  // columns
          int index = ipage*SCAL_NUMCHAN + ncol*row+col;
          ntupair.first = index;
          char nname[10];  sprintf(nname,"%d",index);
          ntupair.second = new TNtuple(nname,"scaler",string_ntup); 
          fDataHistory.insert(ntupair);
          TGTextButton *fButton1;
          char cbutton[100];
	  std::string buttonname = "none";
          if (scaler->GetDataBase()) { 
            std::vector<std::string> strb = 
               scaler->GetDataBase()->GetShortNames(crate,slot,chan);
  	    buttonname = strb[0];
	  }
          if (buttonname == "none") {
            sprintf(cbutton,"%d ==>",ncol*row+col+1);
          } else {
            sprintf(cbutton,buttonname.c_str());
	  }
          fButton1 = new TGTextButton(fr,new TGHotString(cbutton),
                   SCAL_NUMBANK*SCAL_NUMCHAN + OFFSET_HIST + index);
          fr->AddFrame(fButton1, fLayout);
          fButton1->Associate(this);
          txtpair.first = index;
          txtpair.second = new TGTextEntry(fr,&fDataBuff[index]);
          fDataEntry.insert(txtpair);
	  fr->AddFrame(fDataEntry[index],fLayout);             
 	  chan++;
       }
       tgcf->AddFrame(fr,fLayout);
     }       
  }

  AddFrame(fTab,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,0,0,0,0));
  TGGroupFrame *fGb = 
     new TGGroupFrame(this, new TGString("Click channel button for history plot.  Click ``Show Rates'' or ``Show Counts, etc''"));
  TGCompositeFrame *fGCb = new TGCompositeFrame(fGb, 10, 0, kHorizontalFrame);
  TGHorizontalLayout *fLhorzb =  new TGHorizontalLayout(fGCb);
  fGCb->SetLayoutManager(fLhorzb);
  TGHotString *fLabel = new TGHotString("HELP");
  TGTextButton *fHelp = new TGTextButton(fGCb,fLabel,SCAL_NUMBANK*SCAL_NUMCHAN+OFFSET_HELP);
  fGCb->AddFrame(fHelp, fLayout2);
  fHelp->Associate(this);
  fLabel = new TGHotString("QUIT");
  TGTextButton *fQuit = new TGTextButton(fGCb,fLabel,SCAL_NUMBANK*SCAL_NUMCHAN+OFFSET_QUIT);
  fGCb->AddFrame(fQuit, fLayout2);
  fQuit->Associate(this);
  TGLabel *fGlabel2 = new TGLabel(fGCb, new TGString("                                                    "));
  fGCb->AddFrame(fGlabel2, fLayout);
  TGHotString *fHString1 = new TGHotString("Show Rates"); 
  fRateSelect = new TGCheckButton(fGCb,fHString1,SCAL_NUMBANK*SCAL_NUMCHAN+OFFSET_RATE);
  fGCb->AddFrame(fRateSelect, fLayout);
  fRateSelect->Associate(this);
  fRateSelect->SetState(kButtonDown);
  TGHotString *fHString2 = new TGHotString("Show Counts"); 
  fCountSelect = new TGCheckButton(fGCb, fHString2,SCAL_NUMBANK*SCAL_NUMCHAN+OFFSET_COUNT);
  fGCb->AddFrame(fCountSelect, fLayout);
  fCountSelect->Associate(this);
  fCountSelect->SetState(kButtonUp);
  TGHotString *fHString3 = new TGHotString("Norm-by-Current"); 
  fNormISelect = new TGCheckButton(fGCb,fHString3,SCAL_NUMBANK*SCAL_NUMCHAN+OFFSET_NORMI);
  fGCb->AddFrame(fNormISelect, fLayout);
  fNormISelect->Associate(this);
  fNormISelect->SetState(kButtonUp);
  fGb->AddFrame(fGCb,fLayout2);
  TGLayoutHints *fL1 = new TGLayoutHints(kLHintsNormal | kLHintsExpandX , 10, 10, 10, 10);
  AddFrame(fGb, fL1);
  MapSubwindows();
  Layout();
  SetWindowName("HALL  A   SCALER   DATA");
  SetIconName("Scalers");
  MapWindow(); 
  Resize(900,yboxsize[0]);
  lastsize = yboxsize[0];
  return 0;
};
Beispiel #5
0
MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h, 
  TH1F* histogram[10], TH1F* histogram_store[10], TH2F* map[10],
  TGraphErrors* graph_fit[10], TGraphErrors* graph_threshold[10],
  TGraphErrors* graph_detected[10], TGraphErrors* graph_neutrons[10],
  TFile* file)
{
  for (int i = 0; i < 10; i++) {
	  fHistogram[i] = histogram[i];
	  fHistogram_store[i] = histogram_store[i];
	  fMap[i] = map[i];
    fGraph_fit[i] = graph_fit[i];
	  fGraph_threshold[i] = graph_threshold[i];
	  fGraph_detected[i] = graph_detected[i];
	  fGraph_neutrons[i] = graph_neutrons[i];
	  fFile = file;

	  fGraph_fit[i]->SetPoint(0, 0, 0);
	  fGraph_fit[i]->SetPointError(0, 0, 0);
	  fGraph_threshold[i]->SetPoint(0, 0, 0);
	  fGraph_threshold[i]->SetPointError(0, 0, 0);
	  fGraph_detected[i]->SetPoint(0, 0, 0);
	  fGraph_detected[i]->SetPointError(0, 0, 0);
	  fGraph_neutrons[i]->SetPoint(0, 0, 0);
	  fGraph_neutrons[i]->SetPointError(0, 0, 0);

    fGraph_fit[i]->SetMarkerColor(kRed);
    fGraph_fit[i]->SetMarkerStyle(20);
    fGraph_fit[i]->SetLineColor(kRed);
    fGraph_fit[i]->SetLineWidth(1);

    fGraph_threshold[i]->SetMarkerColor(kBlack);
    fGraph_threshold[i]->SetMarkerStyle(20);
    fGraph_threshold[i]->SetLineColor(kRed);
    fGraph_threshold[i]->SetLineWidth(1);

    fGraph_detected[i]->SetMarkerColor(kRed);
    fGraph_detected[i]->SetMarkerStyle(20);
    fGraph_detected[i]->SetLineColor(kRed);
    fGraph_detected[i]->SetLineWidth(1);

    fGraph_neutrons[i]->SetMarkerColor(kBlue);
    fGraph_neutrons[i]->SetMarkerStyle(20);
    fGraph_neutrons[i]->SetLineColor(kRed);
    fGraph_neutrons[i]->SetLineWidth(1);

    fHistogram_store[i]->SetLineColor(kYellow);
    fHistogram_store[i]->SetFillColor(kYellow);
    fHistogram[i]->SetAxisRange(0, 5000, "Y");
    fHistogram_store[i]->SetAxisRange(0, 5000, "Y");
  }

  /////////////////////////////////////////////////////////////////////////////
	// Create the main frame
	fMain = new TGMainFrame(p, w, h);

  /////////////////////////////////////////////////////////////////////////////
  // Create a frame for combo box 1
  TGHorizontalFrame *frame1 = new TGHorizontalFrame(fMain, 1000, 20);

  // Create combo box 1
  TGComboBox *selectionCombo1 = new TGComboBox(frame1, 98);
  Int_t initialSelection1 = 0;
  Int_t firstEntry = 0;
  Int_t lastEntry = 9;
  for (int i = firstEntry; i <= lastEntry; i++) {
    char tmp[20];
    sprintf(tmp, "Channel %i", i);
    selectionCombo1->AddEntry(tmp, i);
  }
  selectionCombo1->Connect("Selected(Int_t)", "MyMainFrame", this, "do_selection1(Int_t)");
  selectionCombo1->Resize(100, 20);
  frame1->AddFrame(selectionCombo1, new TGLayoutHints(kLHintsLeft, 5, 5, 3, 4));

  // Add the frame for combo box 1 to the main frame
  fMain->AddFrame(frame1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));

  // Create embedded canvas 1 and add it to the main frame
  fEcanvas1 = new TRootEmbeddedCanvas("Ecanvas1", fMain, 1000, 220);
  fMain->AddFrame(fEcanvas1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 10, 10, 1));

  /////////////////////////////////////////////////////////////////////////////
  // Create a frame for combo box 2
  TGHorizontalFrame *frame2 = new TGHorizontalFrame(fMain, 1000, 20);

  // Create combo box 2
  TGComboBox *selectionCombo2 = new TGComboBox(frame2, 99);
  Int_t initialSelection2 = 1;
  for (int i = firstEntry; i <= lastEntry; i++) {
    char tmp[20];
    sprintf(tmp, "Channel %i", i);
    selectionCombo2->AddEntry(tmp, i);
  }
  selectionCombo2->Connect("Selected(Int_t)", "MyMainFrame", this, "do_selection2(Int_t)");
  selectionCombo2->Resize(100, 20);
  frame2->AddFrame(selectionCombo2, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));

  // Add the frame for combo box 2 to the main frame
  fMain->AddFrame(frame2, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));

  // Create embedded canvas 2 and add it to the main frame
  fEcanvas2 = new TRootEmbeddedCanvas("Ecanvas2", fMain, 1000, 220);
  fMain->AddFrame(fEcanvas2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 10, 10, 1));

  /////////////////////////////////////////////////////////////////////////////
  // Frame for Draw and Exit buttons
  TGHorizontalFrame *frame3 = new TGHorizontalFrame(fMain, 1000, 20);

  // Create a draw button
  TGTextButton *drawButton = new TGTextButton(frame3, "&Draw");
  drawButton->Connect("Clicked()", "MyMainFrame", this, "do_drawing()");
  frame3->AddFrame(drawButton, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));

  // Create an exit button
  TGTextButton *exitButton = new TGTextButton(frame3, "&Exit");
  exitButton->Connect("Clicked()", "MyMainFrame", this, "do_exiting()");
  frame3->AddFrame(exitButton, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));

  fMain->AddFrame(frame3, new TGLayoutHints(kLHintsCenterX, 2, 2, 2, 2));

  /////////////////////////////////////////////////////////////////////////////
	// Refresh Timer
	TTimer *timer = new TTimer();
	timer->Connect("Timeout()", "MyMainFrame", this, "do_drawing()");

	// Set a name to the main frame
	fMain->SetWindowName("GRAPH VIEWER");

	// Map all subwindows of main frame
	fMain->MapSubwindows();

	// Initialize the layout algorithm via Resize()
	fMain->Resize(fMain->GetDefaultSize());

	// Map main frame
	fMain->MapWindow();

	// Display setting for the first canvas
  fEcanvas1->GetCanvas()->cd();
	pad1[0] = new TPad("Pad10", "Pad10", 0.000, 0.0, 0.333, 1.0);
	pad1[1] = new TPad("Pad11", "Pad11", 0.333, 0.0, 0.666, 1.0);
	pad1[2] = new TPad("Pad12", "Pad12", 0.666, 0.0, 0.999, 1.0);

	for (int i = 0; i < 3; i++) {
		pad1[i]->SetGrid();
		pad1[i]->Draw();
	}

  for (int i = 0; i < 10; i++) {
    string name;
    ostringstream number;
    number << i;
    name = "Frame" + number.str();
	  //dummyHistogram[i] = new TH1F(name.c_str(), "Number of Neutrons;Time[msec];Rate[Hz]", 100, 0, 100000);
	  //dummyHistogram[i]->SetAxisRange(0, 6000, "Y");
  }

	pad1[0]->cd();
	fMap[initialSelection1]->Draw("Color");
	fGraph_fit[initialSelection1]->Draw("P");
	fGraph_threshold[initialSelection1]->Draw("P");

	pad1[1]->cd();
  pad1[1]->SetFillColor(0);
  pad1[1]->SetGrid();
	//dummyHistogram[initialSelection1]->Draw();
	fGraph_detected[initialSelection1]->Draw("ALP");
	fGraph_neutrons[initialSelection1]->Draw("ALP");

	pad1[2]->cd();
	fHistogram_store[initialSelection1]->Draw();
	fHistogram[initialSelection1]->Draw("same");

  selectionCombo1->Select(initialSelection1);
  currentSelection1 = initialSelection1;

  // Display setting for the second canvas
  fEcanvas2->GetCanvas()->cd();
  pad2[0] = new TPad("Pad20", "Pad20", 0.000, 0.0, 0.333, 1.0);
  pad2[1] = new TPad("Pad21", "Pad21", 0.333, 0.0, 0.666, 1.0);
  pad2[2] = new TPad("Pad22", "Pad22", 0.666, 0.0, 0.999, 1.0);

  for (int i = 0; i < 3; i++) {
    pad2[i]->SetGrid();
    pad2[i]->Draw();
  }

  pad2[0]->cd();
  fMap[initialSelection2]->Draw("Color");
  fGraph_fit[initialSelection2]->Draw("P");
  fGraph_threshold[initialSelection2]->Draw("P");

  pad2[1]->cd();
  //dummyHistogram[initialSelection2]->Draw();
  fGraph_detected[initialSelection2]->Draw("ALP");
  fGraph_neutrons[initialSelection2]->Draw("ALP");

  pad2[2]->cd();
  fHistogram_store[initialSelection2]->Draw();
  fHistogram[initialSelection2]->Draw("same");

  selectionCombo2->Select(initialSelection2);
  currentSelection2 = initialSelection2;

  timer->Start(100, kFALSE);
}
Beispiel #6
0
MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) :
  TGMainFrame(p, w, h)
{
   // Create horizontal splitter
   TGVerticalFrame *fVf = new TGVerticalFrame(this, 10, 10);

   TGHorizontalFrame *fH1 = new TGHorizontalFrame(fVf, 10, 50, kFixedHeight);
   TGHorizontalFrame *fH2 = new TGHorizontalFrame(fVf, 10, 10);
   TGCompositeFrame *fFtop = new TGCompositeFrame(fH1, 10, 10, kSunkenFrame);
   TGCompositeFrame *fFbottom = new TGCompositeFrame(fH2, 10, 10, kSunkenFrame);

   TGLabel *fLtop = new TGLabel(fFtop, "Top Frame");
   TGLabel *fLbottom = new TGLabel(fFbottom, "Bottom Frame");

   fFtop->AddFrame(fLtop, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,
                                            3, 0, 0, 0));
   fFbottom->AddFrame(fLbottom, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,
                                                  3, 0, 0, 0));

   fH1->AddFrame(fFtop, new TGLayoutHints(kLHintsTop | kLHintsExpandY | 
                                          kLHintsExpandX, 0, 0, 1, 2));
   fH2->AddFrame(fFbottom, new TGLayoutHints(kLHintsTop | kLHintsExpandY | 
                                             kLHintsExpandX, 0, 0, 1, 2));

   fH1->Resize(fFtop->GetDefaultWidth(), fH1->GetDefaultHeight()+20);
   fH2->Resize(fFbottom->GetDefaultWidth(), fH2->GetDefaultHeight()+20);
   fVf->AddFrame(fH1, new TGLayoutHints(kLHintsTop | kLHintsExpandX));

   TGHSplitter *hsplitter = new TGHSplitter(fVf,2,2);
   hsplitter->SetFrame(fH1, kTRUE);
   fVf->AddFrame(hsplitter, new TGLayoutHints(kLHintsTop | kLHintsExpandX));

   fVf->AddFrame(fH2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));   
   
   // button frame
   TGVerticalFrame *hframe = new TGVerticalFrame(this, 10, 10);
   TGCompositeFrame *cframe2 = new TGCompositeFrame(hframe, 170, 50, 
                                             kHorizontalFrame | kFixedWidth);
   TGTextButton *save = new TGTextButton(cframe2, "&Save");
   cframe2->AddFrame(save, new TGLayoutHints(kLHintsTop | kLHintsExpandX,
                                             3, 2, 2, 2));
   save->Connect("Clicked()", "MyMainFrame", this, "DoSave()");
   save->SetToolTipText("Click on the button to save the application as C++ macro");
   
   TGTextButton *exit = new TGTextButton(cframe2, "&Exit ","gApplication->Terminate(0)");
   cframe2->AddFrame(exit, new TGLayoutHints(kLHintsTop | kLHintsExpandX,
                                             2, 0, 2, 2));
   hframe->AddFrame(cframe2, new TGLayoutHints(kLHintsExpandX, 2, 2, 5, 1));
   
   AddFrame(fVf, new TGLayoutHints(kLHintsRight | kLHintsExpandX | kLHintsExpandY));
   AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 2, 2, 5, 1));
   
   // What to clean up in dtor
   SetCleanup(kDeepCleanup);
     
   // Set a name to the main frame   
   SetWindowName("Horizontal Splitter");
   SetWMSizeHints(300, 250, 600, 600, 0, 0);
   MapSubwindows();
   Resize(GetDefaultSize());
   MapWindow();
}