Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
#include <iostream>
using namespace std;

#include "MEMultiVarPanel.hh"

#include "MusEcalGUI.hh"
#include <TSystem.h>

ClassImp(MEMultiVarPanel);

  MEMultiVarPanel::MEMultiVarPanel(const TGWindow *p, MusEcalGUI* main,
		       UInt_t w, UInt_t h)
    :  _gui( main )
{
  _type = _gui->_type;
  _color = _gui->_color;

  fMain=0;
  fVframe1=0;

  fHint1 = new TGLayoutHints( kLHintsTop | kLHintsCenterX, 5, 5, 5, 5 );
  fHint3 = new TGLayoutHints( kLHintsTop | kLHintsLeft , 0 ,0 ,0 ,0 ); // buttons in groups
  fHint2 = new TGLayoutHints( kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 0, 0);
  fHint4 = new TGLayoutHints( kLHintsTop | kLHintsLeft | kLHintsExpandX,
			      0, 0, 0, 0);
  fHint5 =  new TGLayoutHints( kLHintsCenterX, 0, 0, 0, 0 );


  fClose = kTRUE;

  fMain = new TGTransientFrame(p, main, w, h);
  fMain->Connect( "CloseWindow()", "MEMultiVarPanel", this, "DoClose()" );
  fMain->DontCallClose();
  fMain->SetCleanup(kDeepCleanup);

  fMain->ChangeOptions( (fMain->GetOptions() & ~kVerticalFrame) | kHorizontalFrame );

  fHframe1 = new TGHorizontalFrame( fMain, 0, 0, 0 );
  fMain->AddFrame( fHframe1, fHint5 );
  fVframe1 = new TGVerticalFrame( fHframe1, 0, 0, 0 );
  fHframe1->AddFrame( fVframe1, fHint5 );
  fVframe2 = new TGVerticalFrame( fHframe1, 0, 0, 0 );
  fHframe1->AddFrame( fVframe2, fHint5 );

  TGVerticalFrame* fVframe = fVframe1;

  if( _type==ME::iLaser )
    {
      f_GroupFrame.resize( MusEcal::iSizeLV, 0 );
      f_ComboBox.resize( MusEcal::iSizeLV, 0 );
      for( int jj=0; jj<MusEcal::iSizeLV; jj++ )
	{
	  if( jj>8 ) fVframe = fVframe2;
	  f_GroupFrame[jj] = new TGGroupFrame( fVframe, "", kHorizontalFrame | kRaisedFrame );
	  f_GroupFrame[jj]->SetTitle( MusEcal::historyVarName[jj] );
	  fVframe->AddFrame( f_GroupFrame[jj] );
	  f_ComboBox[jj] = new TGComboBox( f_GroupFrame[jj] , 1000+jj );
	  f_GroupFrame[jj]->AddFrame( f_ComboBox[jj], fHint4 );
      
	  int jj_Zoom = MusEcal::historyVarZoom[_type][ jj ];
	  f_ComboBox[jj]->AddEntry( "- not selected -", MusEcal::iZero );
	  for( int iZoom=0; iZoom<MusEcal::iZero; iZoom++ )
	    {
	      f_ComboBox[jj]->AddEntry( MusEcal::zoomName[iZoom], iZoom );
	      if( iZoom==jj_Zoom ) f_ComboBox[jj]->Select( iZoom );
	    }
	  if( jj_Zoom==MusEcal::iZero ) f_ComboBox[jj]->Select(MusEcal::iZero);
	  f_ComboBox[jj]->Resize(120,20);

	}
    }
  else if( _type==ME::iTestPulse )
    {
      f_GroupFrame.resize( MusEcal::iSizeTPV, 0 );
      f_ComboBox.resize( MusEcal::iSizeTPV, 0 );
      for( int jj=0; jj<MusEcal::iSizeTPV; jj++ )
	{
	  f_GroupFrame[jj] = new TGGroupFrame( fVframe, "", kHorizontalFrame | kRaisedFrame );
	  f_GroupFrame[jj]->SetTitle( MusEcal::historyTPVarName[jj] );
	  fVframe->AddFrame( f_GroupFrame[jj] );
	  f_ComboBox[jj] = new TGComboBox( f_GroupFrame[jj] , 1000+jj );
	  f_GroupFrame[jj]->AddFrame( f_ComboBox[jj], fHint4 );
      
	  int jj_Zoom = MusEcal::historyTPVarZoom[ jj ];
	  f_ComboBox[jj]->AddEntry( "- not selected -", MusEcal::iZero );
	  for( int iZoom=0; iZoom<MusEcal::iZero; iZoom++ )
	    {
	      f_ComboBox[jj]->AddEntry( MusEcal::zoomName[iZoom], iZoom );
	      if( iZoom==jj_Zoom ) f_ComboBox[jj]->Select( iZoom );
	    }
	  if( jj_Zoom==MusEcal::iZero ) f_ComboBox[jj]->Select(MusEcal::iZero);
	  f_ComboBox[jj]->Resize(120,20);
	}
    }

  f_Go_Button = new TGTextButton( fVframe, " Plot " );
  f_Go_Button->Connect("Clicked()","MEMultiVarPanel",this,"DoGo()");
  fVframe->AddFrame( f_Go_Button, fHint3 );

  TString str;
  str += ME::type[_type];
  str += "Multi-Variable Panel";
  fMain->SetWindowName(str);
  TGDimension size = fMain->GetDefaultSize();
  fMain->Resize(size);

  fMain->MapSubwindows();
  fMain->MapWindow();

}

MEMultiVarPanel::~MEMultiVarPanel()
{
  _gui->_fMultiVarPanel=0;
  fMain->DeleteWindow();   // deletes fMain
}

void 
MEMultiVarPanel::CloseWindow()
{
  // Called when window is closed via the window manager.
  delete this;
}

void 
MEMultiVarPanel::DoClose()
{
  CloseWindow();
}

void
MEMultiVarPanel::DoGo()
{
  if( _type==ME::iLaser )
    {
      for( int jj=0; jj<MusEcal::iSizeLV; jj++ )
	{
	  int iZoom = f_ComboBox[jj]->GetSelected();
	  if( iZoom==MusEcal::iZero ) 
	    {
	      MusEcal::historyVarZoom[_color][jj] = MusEcal::iZero;
	      continue;
	    }
	  else
	    {
	      MusEcal::historyVarZoom[_color][jj] = iZoom;
	    }
	}
    }
  else if( _type==ME::iTestPulse )
    {
      for( int jj=0; jj<MusEcal::iSizeTPV; jj++ )
	{
	  int iZoom = f_ComboBox[jj]->GetSelected();
	  if( iZoom==MusEcal::iZero ) 
	    {
	      MusEcal::historyTPVarZoom[jj] = MusEcal::iZero;
	      continue;
	    }
	  else
	    {
	      MusEcal::historyTPVarZoom[jj] = iZoom;
	    }
	}
    } 
  _gui->multiVarPlot(1);
}