Fixed some FileView jank in the gui

This commit is contained in:
Gordon McCann 2022-05-19 15:03:11 -04:00
parent 0b00f0e422
commit 36bfd91e59
3 changed files with 23 additions and 5 deletions

View File

@ -11,6 +11,8 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
SetCleanup(kDeepCleanup); SetCleanup(kDeepCleanup);
MAIN_W = w; MAIN_H = h; MAIN_W = w; MAIN_H = h;
fInfo = new TGFileInfo();
//Organization hints //Organization hints
TGLayoutHints *fchints = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,5,5,5,5); TGLayoutHints *fchints = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,5,5,5,5);
TGLayoutHints *fhints = new TGLayoutHints(kLHintsExpandX|kLHintsCenterY,5,5,5,5); TGLayoutHints *fhints = new TGLayoutHints(kLHintsExpandX|kLHintsCenterY,5,5,5,5);
@ -131,6 +133,7 @@ EVBMainFrame::EVBMainFrame(const TGWindow* p, UInt_t w, UInt_t h) :
EVBMainFrame::~EVBMainFrame() EVBMainFrame::~EVBMainFrame()
{ {
Cleanup(); Cleanup();
delete fInfo;
delete this; delete this;
} }
@ -142,9 +145,17 @@ void EVBMainFrame::CloseWindow()
void EVBMainFrame::HandleMenuSelection(int id) void EVBMainFrame::HandleMenuSelection(int id)
{ {
if(id == M_SAVE_CONFIG) if(id == M_SAVE_CONFIG)
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, M_SAVE_CONFIG); {
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, fInfo);
if(fInfo->fFilename)
SaveConfig(fInfo->fFilename);
}
else if(id == M_LOAD_CONFIG) else if(id == M_LOAD_CONFIG)
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, M_LOAD_CONFIG); {
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, fInfo);
if(fInfo->fFilename)
LoadConfig(fInfo->fFilename);
}
else if(id == M_EXIT) else if(id == M_EXIT)
CloseWindow(); CloseWindow();
} }
@ -156,12 +167,16 @@ void EVBMainFrame::DoOpenWorkdir()
void EVBMainFrame::DoOpenSMapfile() void EVBMainFrame::DoOpenSMapfile()
{ {
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, SMAP); new TGFileDialog(gClient->GetRoot(), this, kFDOpen, fInfo);
if(fInfo->fFilename)
DisplaySMap(fInfo->fFilename);
} }
void EVBMainFrame::DoOpenScalerfile() void EVBMainFrame::DoOpenScalerfile()
{ {
new FileViewFrame(gClient->GetRoot(), this, MAIN_W*0.5, MAIN_H*0.25, this, SCALER); new TGFileDialog(gClient->GetRoot(), this, kFDOpen, fInfo);
if(fInfo->fFilename)
DisplayScaler(fInfo->fFilename);
} }
void EVBMainFrame::DoRun() void EVBMainFrame::DoRun()

View File

@ -10,6 +10,7 @@
#include <TGMenu.h> #include <TGMenu.h>
#include <TGTextViewStream.h> #include <TGTextViewStream.h>
#include <TGProgressBar.h> #include <TGProgressBar.h>
#include <TGFileDialog.h>
#include <TTimer.h> #include <TTimer.h>
#include <TGComboBox.h> #include <TGComboBox.h>
#include "../evb/EVBApp.h" #include "../evb/EVBApp.h"
@ -72,6 +73,8 @@ private:
TGPopupMenu *fFileMenu; TGPopupMenu *fFileMenu;
TGFileInfo *fInfo;
EventBuilder::EVBApp fBuilder; EventBuilder::EVBApp fBuilder;
int counter; int counter;

View File

@ -29,7 +29,7 @@ FileViewFrame::FileViewFrame(const TGWindow* p, const TGFrame* main, UInt_t w, U
/*Layout orgainization hints*/ /*Layout orgainization hints*/
TGLayoutHints *fhints = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY,5,5,5,5); TGLayoutHints *fhints = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY,5,5,5,5);
TGLayoutHints *thints = new TGLayoutHints(kLHintsExpandX|kLHintsCenterY,5,5,5,5); TGLayoutHints *thints = new TGLayoutHints(kLHintsExpandX|kLHintsBottom,5,5,5,5);
TGLayoutHints *fchints = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,5,5,5,5); TGLayoutHints *fchints = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,5,5,5,5);
TGLayoutHints *lhints = new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5); TGLayoutHints *lhints = new TGLayoutHints(kLHintsLeft|kLHintsTop,5,5,5,5);
TGLayoutHints *fbhints = new TGLayoutHints(kLHintsCenterX|kLHintsBottom,5,5,5,5); TGLayoutHints *fbhints = new TGLayoutHints(kLHintsCenterX|kLHintsBottom,5,5,5,5);