#include "Main.h" #include "dl.h" #include #include ClassImp(Dsplist) Dsplist::Dsplist() { } extern short int dsplist[]; extern char Software16wd[]; extern short int moduleNr; //the module nr we are looking at extern short int channelNr;//the channel nr we are looking at Dsplist::Dsplist(const TGWindow *p,UInt_t w,UInt_t h,UInt_t li) : TGMainFrame(p,w=1400,h=800) { p1 = p; list_no = li; cout << "I am in Dsplist constructor" << "\n"; cout << "before dsplist[" << list_no << "] = " << dsplist[list_no] << "\n" ; dsplist[list_no]++; cout << "after dsplist[" << list_no << "] = " << dsplist[list_no] << "\n" ; rowsdisplayed = 26; rows = rowsdisplayed; addr0min = 0 ; // minimum address 0 possible addr0max = 200; // maximum address 0 possible addr1min = 500; // minimum address 1 possible addr1max = 700; // maximum address 1 possible addr0indexrow = 0; addr1indexrow = 500; long int range0 = addr0max - addr0min + 1; long int range1 = addr1max - addr1min + 1; int pagesize = rowsdisplayed ; list0hexadec = kFALSE; list1hexadec = kFALSE; // main frame fMainFrame1578 = new TGCompositeFrame(this,10,10, kVerticalFrame); fMainFrame1578->SetName("fMainFrame1578"); fMainFrame1578->SetLayoutBroken(kFALSE); // horizontal frame fHorizontalFrame560 = new TGHorizontalFrame(fMainFrame1578,728,536,kHorizontalFrame); fHorizontalFrame560->SetName("fHorizontalFrame560"); fHorizontalFrame560->SetLayoutBroken(kFALSE); fVScrollBar592 = new TGVScrollBar(fHorizontalFrame560,10,535,kVerticalFrame | kOwnBackground); fVScrollBar592->SetName("fVScrollBar592"); if ( list_no == 0) { fVScrollBar592->SetRange(range0,pagesize); fVScrollBar592->SetPosition(0); } else { fVScrollBar592->SetRange(range1,pagesize); fVScrollBar592->SetPosition(0); } fVScrollBar592->Associate(this); fHorizontalFrame560->AddFrame(fVScrollBar592, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,5,2)); fMainFrame1578->AddFrame(fHorizontalFrame560, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fHorizontalFrame560->MoveResize(16,16,728,536); TGFont *ufont; // will reflect user font changes ufont = gClient->GetFont("-*-courier-bold-r-*-*-14-*-*-*-*-*-*-*"); TGGC *uGC; // will reflect user GC changes // horizontal frame fHorizontalFrame567 = new TGHorizontalFrame(fMainFrame1578,736,112,kHorizontalFrame); fHorizontalFrame567->SetName("fHorizontalFrame567"); fHorizontalFrame567->SetLayoutBroken(kTRUE); ufont = gClient->GetFont("-*-courier-bold-r-*-*-14-*-*-*-*-*-*-*"); // graphics context changes GCValues_t valButton683; valButton683.fMask = kGCForeground | kGCBackground | kGCFillStyle | kGCFont | kGCGraphicsExposures; gClient->GetColorByName("#000000",valButton683.fForeground); gClient->GetColorByName("#e0e0e0",valButton683.fBackground); valButton683.fFillStyle = kFillSolid; valButton683.fFont = ufont->GetFontHandle(); valButton683.fGraphicsExposures = kFALSE; uGC = gClient->GetGC(&valButton683, kTRUE); //777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 //777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 //999999999999999999999999999999999999999999999999999999999999999999999999999 ////0000000000000000000000000000000000000000000000000000000000000000000000 //=========================================================================================================== columns = 3; rows = 26; height = 20 + (20 * rows) + 15 ; // 535 for rows=25 width = 180 + 200 + 180 + 40 ; // 600 Column = new TGVerticalFrame *[columns]; for (int i = 0; i < columns; i++) { // Column[i] = new TGVerticalFrame (mn, 200, 300); Column[i] = new TGVerticalFrame (fHorizontalFrame560, 200, 300); // mn->AddFrame (Column[i], // new TGLayoutHints (kLHintsTop | kLHintsLeft, 0, 0, 0, 0)); fHorizontalFrame560->AddFrame (Column[i], new TGLayoutHints (kLHintsTop | kLHintsLeft, 0, 0, 0, 0)); } //////////////////labels column/////////////////////////////////////////// cl0 = new TGTextEntry(Column[0], new TGTextBuffer(50),-1,uGC->GetGC(), ufont->GetFontStruct(),kRaisedFrame | kDoubleBorder | kOwnBackground); /* new TGTextEntry (Column[0], new TGTextBuffer (100), 10000, uGC->GetGC(),ufont->GetFontStruct(), kRaisedFrame | kDoubleBorder, GetWhitePixel ()); */ cl0->SetFont ("-adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-iso8859-1", false); cl0->SetText ("Address"); cl0->SetAlignment(kTextCenterX); cl0->Resize (180, 20); cl0->SetEnabled (kFALSE); cl0->SetFrameDrawn (kTRUE); Column[0]->AddFrame (cl0, new TGLayoutHints (kLHintsCenterX, 0, 0 , 0, 0)); // TGTextEntry **Labels; //labels in the left most column Labels = new TGTextEntry *[rows]; for (int i = 0; i < rows; i++) { Labels[i] = new TGTextEntry (Column[0], new TGTextBuffer (100), -1, uGC->GetGC(),ufont->GetFontStruct(), kSunkenFrame | kDoubleBorder ); // | kOwnBackground Labels[i]->SetFont ("-adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-iso8859-1", false); Labels[i]->SetAlignment(kTextRight); Labels[i]->Resize (180, 20); Labels[i]->SetEnabled (kFALSE); Labels[i]->SetFrameDrawn (kTRUE); Column[0]->AddFrame (Labels[i], new TGLayoutHints (kLHintsCenterX, 0, 0, 0, 0)); } ///////////////////////////////////////////////// CLabel = new TGTextEntry *[columns - 1]; for (int i = 0; i < columns - 1; i++) { CLabel[i] = new TGTextEntry (Column[i + 1], new TGTextBuffer (100), -1, uGC->GetGC(),ufont->GetFontStruct(), kRaisedFrame | kDoubleBorder); CLabel[i]->SetFont ("-adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-iso8859-1", false); int kkl = (i==0) ? 200 : 180 ; CLabel[i]->Resize (kkl, 20); CLabel[i]->SetEnabled (kFALSE); CLabel[i]->SetFrameDrawn (kTRUE); Column[i + 1]->AddFrame (CLabel[i], new TGLayoutHints (kLHintsCenterX, 0, 0, 0, 0)); } CLabel[0]->SetText ("COLUMN-0"); CLabel[0]->SetAlignment(kTextCenterX); CLabel[1]->SetText ("COLUMN-1"); CLabel[1]->SetAlignment(kTextCenterX); ///////////////////////////////////////////////// ////444444444444444444444444444444444444444444444444444444444444444444444444 TaxtEntry = new TGTextEntry **[1]; // TaxtEntry is variable name for column 1 --text entry column for (int i = 1; i < columns-1; i++) TaxtEntry[i] = new TGTextEntry *[rows]; for (int i = 1; i < columns-1; i++) { for (int j = 0; j < rows; j++) { TaxtEntry[i][j] = new TGTextEntry (Column[i], new TGTextBuffer (100), -1, uGC->GetGC(),ufont->GetFontStruct(), kSunkenFrame | kDoubleBorder ); TaxtEntry[i][j]->SetFont ("-adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-iso8859-1", false); int kkj = 200 ; TaxtEntry[i][j]->SetAlignment(kTextRight); TaxtEntry[i][j]->Resize (kkj , 20); TaxtEntry[i][j]->SetEnabled (kFALSE); TaxtEntry[i][j]->SetFrameDrawn (kTRUE); // TaxtEntry[i][j]->Associate (this); Column[i]-> AddFrame (TaxtEntry[i][j], new TGLayoutHints (kLHintsCenterX, 0, 0, 0, 0)); } } ////444444444444444444444444444444444444444444444444444444444444444444444444 ////555555555555555555555555555555555555555555555555555555555555555555555555555 NumEntry = new TGNumberEntryField **[columns]; for (int i = 2; i < columns; i++) NumEntry[i] = new TGNumberEntryField *[rows]; for (int i = 2; i < columns; i++) { for (int j = 0; j < rows; j++) { NumEntry[i][j] = new TGNumberEntryField (Column[i], i, 0, TGNumberFormat::kNESInteger); NumEntry[i][j]->SetFont ("-adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-iso8859-1", false); int kkm = 180 ; NumEntry[i][j]->Resize (kkm , 20); // NumEntry[i][j]->Associate (this); Column[i]-> AddFrame (NumEntry[i][j], new TGLayoutHints (kLHintsCenterX, 0, 0, 0, 0)); } } //22222222222222222222222222222222222222222222222222222222222222222222222222222 if (list_no == 0) { dltablefile = "tempfile0.txt"; } else { dltablefile = "tempfile1.txt"; } if (getcwd(cwd02, sizeof(cwd02)) != NULL) fprintf(stdout, "Current working dir: %s\n", cwd02); else perror("getcwd() error"); chdir(Software16wd); ofstream tablefileo; char *temp222 = new char[80]; tablefileo.open (dltablefile, ios::out); if (tablefileo.fail ()) { cout << "can't open the temporary table file on disk !" << dltablefile << "\n"; } if (list_no == 0) { jll = addr0min ; rangefileno = range0; } else { jll = addr1min ; rangefileno = range1; } for (int j = 0 ; j < rangefileno ; j++ ) { sprintf(n,"0x%08X",jll + j ); tablefileo << n << "\t" ; // here data for the table can be gathered and stored in a file sprintf (text2233, "%i", j); tablefileo << text2233 << "\t" ; sprintf (text2233, "%i", j); tablefileo << text2233 << "\n" ; } tablefileo.close(); tablefileo.clear(); //22222222222222222222222222222222222222222222222222222222222222222222222222222 ////555555555555555555555555555555555555555555555555555555555555555555555555555 ifstream tablefilei; tablefilei.open (dltablefile, ios::in); sprintf(n,""); for(int i=0; i < rows ;i++) { tablefilei.getline (temp222, 80); cout << temp222 ; std::string s2 (temp222); unsigned found = s2.find_last_of("\t"); std::string s3 (s2.substr(found+1)); cout << " s3 = " << s3 << "\n"; // third column number /* long int s3344; sscanf(s3,"%i",s3344); sprintf (text2233, "%i", j); */ const char *s33 = s3.c_str(); NumEntry[2][i]->SetText (s33); NumEntry[2][i]->SetState(kFALSE); unsigned found1 = s2.find_first_of("\t"); std::string s4 (s2.substr(found1+1, found-found1-1)); // s4 : second column string cout << " s4 = " << s4 << "\n"; const char *s55 = s4.c_str(); TaxtEntry[1][i]->SetText (s55); TaxtEntry[1][i]->SetState(kFALSE); std::string s5 (s2.substr(0,found1)); // s5 : first column string cout << " s5 = " << s5 << "\n"; const char *s77 = s5.c_str(); Labels[i]->SetText(s77); Labels[i]->SetState(kFALSE); } tablefilei.close(); tablefilei.clear(); //=========================================================================================================== ////0000000000000000000000000000000000000000000000000000000000000000000000 //999999999999999999999999999999999999999999999999999999999999999999999999999 ULong_t ucolor; // will reflect user color changes gClient->GetColorByName("#00ff00",ucolor); fTextButton683 = new TGTextButton(fHorizontalFrame567,"Refresh",REFRESHDL,uGC->GetGC(),ufont->GetFontStruct()); fTextButton683->SetTextJustify(36); fTextButton683->SetMargins(0,0,0,0); fTextButton683->SetWrapLength(-1); fTextButton683->Resize(92,32); fTextButton683->ChangeBackground(ucolor); fTextButton683->Associate(this); fHorizontalFrame567->AddFrame(fTextButton683, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTextButton683->MoveResize(424,72,92,32); ufont = gClient->GetFont("-*-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*"); // graphics context changes GCValues_t vall684; vall684.fMask = kGCForeground | kGCBackground | kGCFillStyle | kGCFont | kGCGraphicsExposures; gClient->GetColorByName("#000000",vall684.fForeground); gClient->GetColorByName("#e0e0e0",vall684.fBackground); vall684.fFillStyle = kFillSolid; vall684.fFont = ufont->GetFontHandle(); vall684.fGraphicsExposures = kFALSE; uGC = gClient->GetGC(&vall684, kTRUE); gClient->GetColorByName("#ff00ff",ucolor); fLabel684 = new TGLabel(fHorizontalFrame567,"Module Number",uGC->GetGC(),ufont->GetFontStruct(),kChildFrame,ucolor); fLabel684->SetTextJustify(36); fLabel684->SetMargins(0,0,0,0); fLabel684->SetWrapLength(-1); fHorizontalFrame567->AddFrame(fLabel684, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fLabel684->MoveResize(8,72,112,34); // Address row0 hex : fNumberEntry693 fNumberEntry693 = new TGNumberEntry(fHorizontalFrame567, (Long_t) 0X0U,19, ADDR_ROW0DL,(TGNumberFormat::EStyle) 12,(TGNumberFormat::EAttribute) 1); fNumberEntry693->SetName("fNumberEntry693"); fNumberEntry693->SetButtonToNum (0); fNumberEntry693->IsEditable(); fNumberEntry693->Associate(this); fHorizontalFrame567->AddFrame(fNumberEntry693, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fNumberEntry693->MoveResize(104,24,152,22); ufont = gClient->GetFont("-*-courier-bold-r-*-*-14-*-*-*-*-*-*-*"); // graphics context changes GCValues_t vall689; vall689.fMask = kGCForeground | kGCBackground | kGCFillStyle | kGCFont | kGCGraphicsExposures; gClient->GetColorByName("#000000",vall689.fForeground); gClient->GetColorByName("#e0e0e0",vall689.fBackground); vall689.fFillStyle = kFillSolid; vall689.fFont = ufont->GetFontHandle(); vall689.fGraphicsExposures = kFALSE; uGC = gClient->GetGC(&vall689, kTRUE); gClient->GetColorByName("#ffff00",ucolor); fLabel689 = new TGLabel(fHorizontalFrame567,"Address 0x",uGC->GetGC(),ufont->GetFontStruct(),kChildFrame,ucolor); fLabel689->SetTextJustify(36); fLabel689->SetMargins(0,0,0,0); fLabel689->SetWrapLength(-1); fHorizontalFrame567->AddFrame(fLabel689, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fLabel689->MoveResize(10,16,92,32); ufont = gClient->GetFont("-*-courier-bold-r-*-*-14-*-*-*-*-*-*-*"); // graphics context changes GCValues_t valButton690; valButton690.fMask = kGCForeground | kGCBackground | kGCFillStyle | kGCFont | kGCGraphicsExposures; gClient->GetColorByName("#000000",valButton690.fForeground); gClient->GetColorByName("#e0e0e0",valButton690.fBackground); valButton690.fFillStyle = kFillSolid; valButton690.fFont = ufont->GetFontHandle(); valButton690.fGraphicsExposures = kFALSE; uGC = gClient->GetGC(&valButton690, kTRUE); gClient->GetColorByName("#ff0000",ucolor); fTextButton690 = new TGTextButton(fHorizontalFrame567,"Close",CLOSEDL,uGC->GetGC(),ufont->GetFontStruct()); fTextButton690->SetTextJustify(36); fTextButton690->SetMargins(0,0,0,0); fTextButton690->SetWrapLength(-1); fTextButton690->Resize(99,32); fTextButton690->ChangeBackground(ucolor); fTextButton690->Associate(this); fHorizontalFrame567->AddFrame(fTextButton690, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTextButton690->MoveResize(544,72,99,32); ufont = gClient->GetFont("-*-courier-bold-r-*-*-14-*-*-*-*-*-*-*"); // graphics context changes GCValues_t valButton691; valButton691.fMask = kGCForeground | kGCBackground | kGCFillStyle | kGCFont | kGCGraphicsExposures; gClient->GetColorByName("#000000",valButton691.fForeground); gClient->GetColorByName("#e0e0e0",valButton691.fBackground); valButton691.fFillStyle = kFillSolid; valButton691.fFont = ufont->GetFontHandle(); valButton691.fGraphicsExposures = kFALSE; uGC = gClient->GetGC(&valButton691, kTRUE); gClient->GetColorByName("#ffcc00",ucolor); fTextButton691 = new TGTextButton(fHorizontalFrame567,"Page Up",PAGEUPDL,uGC->GetGC(),ufont->GetFontStruct()); fTextButton691->SetTextJustify(36); fTextButton691->SetMargins(0,0,0,0); fTextButton691->SetWrapLength(-1); fTextButton691->Resize(99,24); fTextButton691->ChangeBackground(ucolor); fTextButton691->Associate(this); fHorizontalFrame567->AddFrame(fTextButton691, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTextButton691->MoveResize(288,24,99,24); ufont = gClient->GetFont("-*-courier-bold-r-*-*-14-*-*-*-*-*-*-*"); // graphics context changes GCValues_t valButton692; valButton692.fMask = kGCForeground | kGCBackground | kGCFillStyle | kGCFont | kGCGraphicsExposures; gClient->GetColorByName("#000000",valButton692.fForeground); gClient->GetColorByName("#e0e0e0",valButton692.fBackground); valButton692.fFillStyle = kFillSolid; valButton692.fFont = ufont->GetFontHandle(); valButton692.fGraphicsExposures = kFALSE; uGC = gClient->GetGC(&valButton692, kTRUE); gClient->GetColorByName("#ffff33",ucolor); fTextButton692 = new TGTextButton(fHorizontalFrame567,"Page Down",PAGEDOWNDL,uGC->GetGC(),ufont->GetFontStruct()); fTextButton692->SetTextJustify(36); fTextButton692->SetMargins(0,0,0,0); fTextButton692->SetWrapLength(-1); fTextButton692->Resize(99,24); fTextButton692->ChangeBackground(ucolor); fTextButton692->Associate(this); fHorizontalFrame567->AddFrame(fTextButton692, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTextButton692->MoveResize(416,24,99,24); // module number : fNumberEntry707 fNumberEntry707 = new TGNumberEntry(fHorizontalFrame567,(Int_t) 0,6,MODNODL, (TGNumberFormat::EStyle) 0,(TGNumberFormat::EAttribute) 1,(TGNumberFormat::ELimit) 2,0,32); // (fHorizontalFrame567, (Long_t) 0,7,ADDR_ROW0DL,(TGNumberFormat::EStyle) 5); fNumberEntry707->SetName("fNumberEntry707"); fNumberEntry707->Associate(this); fHorizontalFrame567->AddFrame(fNumberEntry707, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fNumberEntry707->MoveResize(128,80,67,22); ufont = gClient->GetFont("-*-courier-bold-r-*-*-14-*-*-*-*-*-*-*"); // graphics context changes GCValues_t valButton697; valButton697.fMask = kGCForeground | kGCBackground | kGCFillStyle | kGCFont | kGCGraphicsExposures; gClient->GetColorByName("#000000",valButton697.fForeground); gClient->GetColorByName("#e0e0e0",valButton697.fBackground); valButton697.fFillStyle = kFillSolid; valButton697.fFont = ufont->GetFontHandle(); valButton697.fGraphicsExposures = kFALSE; uGC = gClient->GetGC(&valButton697, kTRUE); gClient->GetColorByName("#00ffff",ucolor); fTextButton697 = new TGTextButton(fHorizontalFrame567,"Hexadecimal",DLHEXDEC,uGC->GetGC(),ufont->GetFontStruct()); fTextButton697->SetTextJustify(36); fTextButton697->SetMargins(0,0,0,0); fTextButton697->SetWrapLength(-1); fTextButton697->Resize(120,32); fTextButton697->ChangeBackground(ucolor); fTextButton697->Associate(this); fHorizontalFrame567->AddFrame(fTextButton697, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fTextButton697->MoveResize(272,72,120,32); fHorizontal3DLine737 = new TGHorizontal3DLine(fMainFrame1578,700,8); fHorizontal3DLine737->SetName("fHorizontal3DLine737"); fMainFrame1578->AddFrame(fHorizontal3DLine737, new TGLayoutHints(kLHintsLeft | kLHintsTop ,2,2,2,2)); fHorizontal3DLine737->MoveResize(8,570,700,8); fMainFrame1578->AddFrame(fHorizontalFrame567, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2)); fHorizontalFrame567->MoveResize(8,568,736,112); ufont = gClient->GetFont("-*-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*"); fMainFrame1578->AddFrame(fHorizontalFrame567, new TGLayoutHints(kLHintsLeft | kLHintsBottom,2,2,2,2)); fHorizontalFrame567->MoveResize(8,560,736,136); /* fMainFrame1578->SetMWMHints(kMWMDecorAll, kMWMFuncAll, kMWMInputModeless); */ fMainFrame1578->MapSubwindows(); fMainFrame1578->Resize(fMainFrame1578->GetDefaultSize()); fMainFrame1578->MapWindow(); fMainFrame1578->Resize(650,702); chdir(cwd02); char caption01[100]; if (list_no == 0) sprintf(caption01,"Show DSP Memory Block %i (0x00049180 - 0x0004FFFF)",list_no); else sprintf(caption01,"Show DSP Memory Block %i (0x00055555 - 0x000FFFFF)",list_no); SetWindowName(caption01); MapSubwindows(); Resize(650,696); MapWindow(); } // HistWin() Dsplist::~Dsplist() { cout << "I am in Dsplist destructor" << "\n"; cout << "before dsplist[" << list_no << "] = " << dsplist[list_no] << "\n" ; dsplist[list_no] = 0 ; cout << "after dsplist[" << list_no << "] = " << dsplist[list_no] << "\n" ; if (list_no == 0) { if( remove( "tempfile0.txt" ) != 0 ) perror( "Error deleting file" ); else puts( "File successfully deleted" ); } else { if( remove( "tempfile1.txt" ) != 0 ) perror( "Error deleting file" ); else puts( "File successfully deleted" ); } Cleanup(); }// ~Dsplist() Bool_t Dsplist::ProcessMessage (Long_t msg, Long_t parm1, Long_t parm2) { switch (GET_MSG (msg)) { case kC_COMMAND: switch (GET_SUBMSG (msg)) { case kCM_BUTTON: switch (parm1) { case (ADDR_ROW0DL): { cout << "I am here : ADDR_ROW0DL Button pressed." << "\n" ; if (parm2 == 0) // up-arrow pressed { if (list_no == 0) { temp = addr0indexrow + 1 ; if (temp >= (addr0max-(rowsdisplayed-1))) { addr0indexrow = addr0max-(rowsdisplayed-1) ; } else if (temp < (addr0max-(rowsdisplayed-1))) { addr0indexrow = temp ; } if (temp < addr0min) { addr0indexrow = addr0min; } fNumberEntry693->SetIntNumber(addr0indexrow); } else if (list_no == 1) { temp = addr1indexrow + 1 ; if (temp >= (addr1max-(rowsdisplayed-1))) addr1indexrow = addr1max-(rowsdisplayed-1) ; else if (temp < (addr1max-(rowsdisplayed-1))) addr1indexrow = temp ; if (temp < addr1min) addr1indexrow = addr1min; fNumberEntry693->SetIntNumber(addr1indexrow); } } else // down arrow pressed { if (list_no == 0) { temp = addr0indexrow - 1 ; cout << " temp = " << temp << " addr0min = " << addr0min << "\n"; if (temp > addr0min) addr0indexrow = temp; else if (temp < addr0indexrow) { if (temp <= addr0min) addr0indexrow = addr0min; } if (temp > addr0max) addr0indexrow = addr0min; fNumberEntry693->SetIntNumber(addr0indexrow); } else if (list_no == 1) { temp = addr1indexrow - 1 ; if (temp > addr1min) addr1indexrow = temp; else if (temp < addr1indexrow) { if (temp <= addr1min) addr1indexrow = addr1min; } if (temp > addr1max) addr1indexrow = addr1min; fNumberEntry693->SetIntNumber(addr1indexrow); } } // load_data(); } break; // case (ADDR_ROW0DL): case (PAGEUPDL): { cout << "PAGEUPDL Button pressed." << "\n" ; if (list_no == 0) { temp = addr0indexrow - (rowsdisplayed - 1) ; if (temp > addr0min) addr0indexrow = temp; else if (temp < addr0indexrow) { if (temp <= addr0min) addr0indexrow = addr0min; } if (temp > addr0max) addr0indexrow = addr0min; fNumberEntry693->SetIntNumber(addr0indexrow); } else if (list_no == 1) { temp = addr1indexrow - (rowsdisplayed - 1) ; if (temp > addr1min) addr1indexrow = temp; else if (temp < addr1indexrow) { if (temp <= addr1min) addr1indexrow = addr1min; } if (temp > addr1max) addr1indexrow = addr1min; fNumberEntry693->SetIntNumber(addr1indexrow); } load_data(); } break; // case (PAGEUPDL): case (PAGEDOWNDL): { cout << "PAGEDOWNDL Button pressed." << "\n" ; if (list_no == 0) { temp = addr0indexrow + (rowsdisplayed - 1) ; if (temp >= (addr0max-(rowsdisplayed-1))) addr0indexrow = addr0max-(rowsdisplayed-1) ; else if (temp < (addr0max-(rowsdisplayed-1))) addr0indexrow = temp ; if (temp < addr0min) addr0indexrow = addr0min; fNumberEntry693->SetIntNumber(addr0indexrow); } else if (list_no == 1) { temp = addr1indexrow + (rowsdisplayed - 1) ; if (temp >= (addr1max-(rowsdisplayed-1))) addr1indexrow = addr1max-(rowsdisplayed-1) ; else if (temp < (addr1max-(rowsdisplayed-1))) addr1indexrow = temp ; if (temp < addr1min) addr1indexrow = addr1min; cout << "temp = " << temp << " addr1min = " << addr1min << " addr1indexrow = " << addr1indexrow << "\n"; fNumberEntry693->SetIntNumber(addr1indexrow); } load_data(); } break; // case (PAGEDOWNDL): case (DLHEXDEC): { cout << "DLHEXDEC Button pressed." << "\n" ; if (list_no == 0) { list0hexadec = !(list0hexadec) ; if (list0hexadec == kFALSE) { fTextButton697->SetText("Hexadecimal"); } else if (list0hexadec == kTRUE) { fTextButton697->SetText("Decimal"); } } else if (list_no == 1) { list1hexadec = !(list1hexadec) ; if (list1hexadec == kFALSE) { fTextButton697->SetText("Hexadecimal"); } else if (list1hexadec == kTRUE) { fTextButton697->SetText("Decimal"); } } load_data(); } break; // case (DLHEXDEC): case (REFRESHDL): // Refresh button has been pressed cout << "Refresh button has been pressed.\nLoading new data ....\n" ; load_data(); break; case CLOSEDL: /// Close Button cout << "Close button has been pressed.\nClosing window....\n" ; DeleteWindow (); break; default: break; } break; default: break; } break; case kC_TEXTENTRY: { cout << "In kC_TEXTENTRY: 999" << "\n" ; switch (GET_SUBMSG (msg)) { case kTE_TEXTCHANGED: { cout << "In kTE_TEXTCHANGED: 001" << "\n" ; switch (parm1) { cout << "In Widget id : 002" << "\n" ; case ADDR_ROW0DL: { cout << "ADDR_ROW0DL 003" << "\n" ; if (list_no == 0) { temp = fNumberEntry693->GetIntNumber(); if (temp <= addr0min) addr0indexrow = addr0min ; if (temp >= (addr0max-(rowsdisplayed-1))) addr0indexrow = addr0max-(rowsdisplayed-1) ; else if (temp < (addr0max-(rowsdisplayed-1))) addr0indexrow = temp ; fNumberEntry693->SetIntNumber(addr0indexrow); fVScrollBar592->SetPosition(addr0indexrow); } else if (list_no == 1) { temp = fNumberEntry693->GetIntNumber(); if (temp <= addr1min) { addr1indexrow = addr1min; } if (temp >= (addr1max-(rowsdisplayed-1))) addr1indexrow = addr1max-(rowsdisplayed-1) ; else if (temp < (addr1max-(rowsdisplayed-1))) addr1indexrow = temp ; fNumberEntry693->SetIntNumber(addr1indexrow); fVScrollBar592->SetPosition(addr1indexrow - addr1min); } load_data(); } break; /* case LMOD_NO: { // cout << " HMOD_NO 004" << "\n" ; moduleNr = fNumberEntry1254->GetIntNumber(); // validate and correct moduleNr if (moduleNr < 0) { moduleNr = 0 ; // cout << "Invalid module no." << "\n"; } else if ( moduleNr >= NumModulesg ) { moduleNr = NumModulesg - 1 ; // cout << "Invalid module no." << "\n"; } // fNumberEntry1254->SetIntNumber(moduleNr); fNumberEntry1363->SetIntNumber(ModuleEvents[moduleNr]); fNumberEntry1188->SetIntNumber(Eventno002); load_data(); } break; */ default: break; } } break; case kTE_ENTER: { cout << "In kTE_ENTER: 002" << "\n" ; switch (parm1) { cout << "In Widget id : 005" << "\n" ; case ADDR_ROW0DL: { cout << "ADDR_ROW0DL 006" << "\n" ; if (list_no == 0) { temp = fNumberEntry693->GetIntNumber(); if (temp <= addr0min) addr0indexrow = addr0min ; if (temp >= (addr0max-(rowsdisplayed-1))) addr0indexrow = addr0max-(rowsdisplayed-1) ; else if (temp < (addr0max-(rowsdisplayed-1))) addr0indexrow = temp ; fNumberEntry693->SetIntNumber(addr0indexrow); // fVScrollBar592->SetPosition(addr0indexrow); } else if (list_no == 1) { temp = fNumberEntry693->GetIntNumber(); if (temp <= addr1min) addr1indexrow = addr1min; if (temp >= (addr1max-(rowsdisplayed-1))) addr1indexrow = addr1max-(rowsdisplayed-1) ; else if (temp < (addr1max-(rowsdisplayed-1))) addr1indexrow = temp ; fNumberEntry693->SetIntNumber(addr1indexrow); // fVScrollBar592->SetPosition(addr1indexrow - addr1min); } // load_data(); } break; /* case LMOD_NO: { // cout << " HMOD_NO 007" << "\n" ; moduleNr = fNumberEntry1254->GetIntNumber(); // validate and correct moduleNr if (moduleNr < 0) { moduleNr = 0 ; // cout << "Invalid module no." << "\n"; } else if ( moduleNr >= NumModulesg ) { moduleNr = NumModulesg - 1 ; // cout << "Invalid module no." << "\n"; } // fNumberEntry1254->SetIntNumber(moduleNr); fNumberEntry1363->SetIntNumber(ModuleEvents[moduleNr]); fNumberEntry1363->SetState(kFALSE); Eventno002 = 0 ; fNumberEntry1188->SetIntNumber(Eventno002); load_data(); } break; */ default: break; } } break; default: break; } } break; case kC_VSCROLL: { cout << "In kC_VSCROLL: 999" << "\n" ; switch (GET_SUBMSG (msg)) { case (kSB_SLIDERPOS): cout << "In kSB_SLIDERPOS: 111" << "\n" ; cout << "parm1 = " << parm1 << "\n"; cout << "parm2 = " << parm2 << "\n"; if (list_no == 0) { addr0indexrow = parm1; fNumberEntry693->SetIntNumber(addr0indexrow); } else if (list_no == 1) { addr1indexrow = addr1min + parm1; fNumberEntry693->SetIntNumber(addr1indexrow); } // load_data(); break; case (kSB_SLIDERTRACK): cout << "In kSB_SLIDERTRACK: 333" << "\n" ; if (list_no == 0) { addr0indexrow = parm1; fNumberEntry693->SetIntNumber(addr0indexrow); } else if (list_no == 1) { addr1indexrow = addr1min + parm1; fNumberEntry693->SetIntNumber(addr1indexrow); } // load_data(); break; default: break; } } break; default: break; } return kTRUE; } // Bool_t Dsplist::ProcessMessage (Long_t msg, Long_t parm1, Long_t parm2) int Dsplist::load_data() { // data for the table is read from stored file and table is populated // data for the table is generated in the constructor, it can also be generated in some function also int retval; char temp111[80]; if (getcwd(cwd02, sizeof(cwd02)) != NULL) fprintf(stdout, "Current working dir: %s\n", cwd02); else perror("getcwd() error"); chdir(Software16wd); if ( list_no == 0 ) { ifstream tablefilei; tablefilei.open (dltablefile, ios::in); sprintf(n,""); for(int i=0; i < addr0indexrow ;i++) { tablefilei.getline (temp111, 80); cout << temp111 ; } for(int i=0; i < rows ;i++) { tablefilei.getline (temp111, 80); cout << temp111 ; std::string s2 (temp111); unsigned found = s2.find_last_of("\t"); std::string s3 (s2.substr(found+1)); cout << " s3 = " << s3 << "\n"; // third column number const char *s33 = s3.c_str(); long int s33i = atoi(s33); /* long int s3344; sscanf(s33,"%d",s3344); */ if (list0hexadec == kFALSE) { // fTextButton697->SetText("Decimal"); sprintf (text2233, "%d", s33i); cout << " text2233 = " << text2233 << "\n"; NumEntry[2][i]->SetFormat(TGNumberFormat::kNESInteger); } // if (list0hexadec == kFALSE) else if (list0hexadec == kTRUE) { // fTextButton697->SetText("Hexadecimal"); sprintf (text2233, "%X", s33i); cout << " text2233 = " << text2233 << "\n"; NumEntry[2][i]->SetFormat(TGNumberFormat::kNESHex); } // else if (list0hexadec == kTRUE) NumEntry[2][i]->SetText (text2233); NumEntry[2][i]->SetState(kFALSE); unsigned found1 = s2.find_first_of("\t"); std::string s4 (s2.substr(found1+1, found-found1-1)); // s4 : second column string cout << " s4 = " << s4 << "\n"; const char *s55 = s4.c_str(); TaxtEntry[1][i]->SetText (s55); TaxtEntry[1][i]->SetState(kFALSE); std::string s5 (s2.substr(0,found1)); // s5 : first column string cout << " s5 = " << s5 << "\n"; const char *s77 = s5.c_str(); Labels[i]->SetText(s77); Labels[i]->SetState(kFALSE); } tablefilei.close(); tablefilei.clear(); } // if ( list_no == 0 ) else if ( list_no == 1 ) { ifstream tablefilei; tablefilei.open (dltablefile, ios::in); sprintf(n,""); for(int i=addr1min; i < addr1indexrow ;i++) { tablefilei.getline (temp111, 80); cout << temp111 ; } for(int i=0; i < rows ;i++) { tablefilei.getline (temp111, 80); cout << temp111 ; std::string s2 (temp111); unsigned found = s2.find_last_of("\t"); std::string s3 (s2.substr(found+1)); cout << " s3 = " << s3 << "\n"; // third column number const char *s33 = s3.c_str(); long int s33i = atoi(s33); /* long int s3344; sscanf(s33,"%d",s3344); */ if (list1hexadec == kFALSE) { // fTextButton697->SetText("Decimal"); sprintf (text2233, "%d", s33i); cout << " text2233 = " << text2233 << "\n"; NumEntry[2][i]->SetFormat(TGNumberFormat::kNESInteger); } // if (list1hexadec == kFALSE) else if (list1hexadec == kTRUE) { // fTextButton697->SetText("Hexadecimal"); sprintf (text2233, "%X", s33i); cout << " text2233 = " << text2233 << "\n"; NumEntry[2][i]->SetFormat(TGNumberFormat::kNESHex); } // else if (list1hexadec == kTRUE) NumEntry[2][i]->SetText (text2233); NumEntry[2][i]->SetState(kFALSE); unsigned found1 = s2.find_first_of("\t"); std::string s4 (s2.substr(found1+1, found-found1-1)); // s4 : second column string cout << " s4 = " << s4 << "\n"; const char *s55 = s4.c_str(); TaxtEntry[1][i]->SetText (s55); TaxtEntry[1][i]->SetState(kFALSE); std::string s5 (s2.substr(0,found1)); // s5 : first column string cout << " s5 = " << s5 << "\n"; const char *s77 = s5.c_str(); Labels[i]->SetText(s77); Labels[i]->SetState(kFALSE); } tablefilei.close(); tablefilei.clear(); } // else if ( list_no == 1 ) chdir(cwd02); return 1; } // int Dsplist::load_data()