Skip to content

Commit

Permalink
Issue #12 starting to learn FLTK with new test.fld UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Stuart committed Aug 24, 2016
1 parent f987f1d commit 866caa4
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 21,954 deletions.
2 changes: 2 additions & 0 deletions config_file.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Viewer settings
runfile quadtest
21,803 changes: 0 additions & 21,803 deletions gui.cxx

This file was deleted.

136 changes: 0 additions & 136 deletions gui.h

This file was deleted.

7 changes: 5 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <time.h>
#include <string>
#include "gui.h"
#include "test.h"
#include <iostream>
#include "tds.hh"

Expand Down Expand Up @@ -202,7 +202,8 @@ int main(int nArg, char** vArg){
//std::cout<<"start at file "<<start_from<<" up to "<<end_at<<std::endl;
return 0;
} else if (v >= 0) {
UI = new UserInterface(); UI->show();
UI = new UserInterface();
UI->show();
tds = new tds_display(UI);
int err=Fl::run();
return err;
Expand All @@ -212,6 +213,8 @@ int main(int nArg, char** vArg){
}
delete tds;
delete tds_b;
delete tds_t;
delete tds_r;
};

void show_preamble() {
Expand Down
26 changes: 14 additions & 12 deletions tds.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1246,14 +1246,16 @@ void tds_run::interrupt_post_simulation() {


tds_display::tds_display(UserInterface *gui):GUI_(gui){
GUI_->RootfileComment->buffer(FRootfileComments);
GUI_->TimelineComment->buffer(TimelineComment);
GUI_->RootfileName->buffer(FRootfileName);
FRootfileComments.text("\n \n \t Choose a file");
GUI_->txdsp_run_file_name->buffer(FRunFileName);
// GUI_->RootfileComment->buffer(FRootfileComments);
// GUI_->TimelineComment->buffer(TimelineComment);
// GUI_->RootfileName->buffer(FRootfileName);
FRunFileName.text("default.run");
// FRootfileComments.text("\n \n \t Choose a file");
}

tds_display::~tds_display(){
GUI_->plotH->clear();
// GUI_->plotH->clear();
}

void tds_display::dialog_open(){
Expand All @@ -1267,19 +1269,19 @@ void tds_display::dialog_open(){
}

void tds_display::load_event(){
int e_number = int(GUI_->event->value()), c_number = int(GUI_->channel->value());
std::cout<<"event to load = "<<e_number<<std::endl;
// int e_number = int(GUI_->event->value()), c_number = int(GUI_->channel->value());
// std::cout<<"event to load = "<<e_number<<std::endl;
}

void tds_display::load_section(int chnum){
int c_number = int(GUI_->channel->value());
std::cout<<"loading a section"<<std::endl;
load_section(c_number,chnum);
// int c_number = int(GUI_->channel->value());
// std::cout<<"loading a section"<<std::endl;
// load_section(c_number,chnum);
}

void tds_display::load_section(unsigned int ch_n, int chnum){
std::cout<<"load section"<<std::endl;
FRootfileComments.text(display_tl_info().c_str());
// std::cout<<"load section"<<std::endl;
// FRootfileComments.text(display_tl_info().c_str());
}

void tds_display::resize_plot(int c){
Expand Down
3 changes: 2 additions & 1 deletion tds.hh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <list>
#include <iostream>
#include "utilities.hh"
#include "gui.h"
#include "test.h"
#include <stdio.h>
#include <math.h>
#include <sstream>
Expand Down Expand Up @@ -265,6 +265,7 @@ private:
std::vector<double> X_, Y_;//for the timelines
std::vector<std::string> text_;
const char *filename_;
Fl_Text_Buffer FRunFileName;
Fl_Text_Buffer FRootfileComments;
Fl_Text_Buffer FRootfileName;
Fl_Text_Buffer TimelineComment;
Expand Down
29 changes: 29 additions & 0 deletions test.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0303

#include "test.h"
void userAction(Fl_Widget* target);
void userAction(selection sel, Ca_Canvas* sender);
void reduce_all();

Fl_Double_Window* UserInterface::make_window() {
{ main_window = new Fl_Double_Window(900, 510, "Tritium Diffusion Software - v0.1 - Chris Stuart");
main_window->user_data((void*)(this));
{ grp_run_file = new Fl_Group(25, 102, 366, 326);
grp_run_file->box(FL_THIN_UP_BOX);
{ txdsp_run_file_name = new Fl_Text_Display(30, 126, 351, 45, "Current run file:");
txdsp_run_file_name->box(FL_THIN_UP_FRAME);
txdsp_run_file_name->align(Fl_Align(FL_ALIGN_CENTER));
} // Fl_Text_Display* txdsp_run_file_name
grp_run_file->end();
} // Fl_Group* grp_run_file
main_window->size_range(900, 510, 900, 510);
main_window->end();
} // Fl_Double_Window* main_window
return main_window;
}

void UserInterface::show() {
make_window();
//ChnButton[0]=Chn0;
main_window->show();
}
53 changes: 53 additions & 0 deletions test.fld
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0303
header_name {.h}
code_name {.cxx}
decl {\#include <FL/Fl_File_Chooser.H>} {public local
}

decl {\#include <FL/Fl_Pixmap.H>} {public local
}

decl {\#include <FL/Fl_Bitmap.H>} {public local
}

decl {\#include <FL/Fl_GIF_Image.H>} {public local
}

decl {\#include "Cartesian.h"} {public local
}

decl {void userAction(Fl_Widget* target);} {public local
}

decl {void userAction(selection sel, Ca_Canvas* sender);} {public local
}

decl {void reduce_all();} {public local
}

class UserInterface {open
} {
Function {make_window()} {open
} {
Fl_Window main_window {
label {Tritium Diffusion Software - v0.1 - Chris Stuart} open
xywh {1018 385 900 510} type Double size_range {900 510 900 510} visible
} {
Fl_Group grp_run_file {open
xywh {25 102 366 326} box THIN_UP_BOX
} {
Fl_Text_Display txdsp_run_file_name {
label {Current run file:} selected
xywh {30 126 351 45} align 0
}
}
}
}
Function {show()} {open
} {
code {make_window();
//ChnButton[0]=Chn0;
main_window->show();} {}
}
}
26 changes: 26 additions & 0 deletions test.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0303

#ifndef test_h
#define test_h
#include <FL/Fl.H>
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_Bitmap.H>
#include <FL/Fl_GIF_Image.H>
#include "Cartesian.h"
extern void userAction(Fl_Widget* target);
extern void userAction(selection sel, Ca_Canvas* sender);
extern void reduce_all();
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Text_Display.H>

class UserInterface {
public:
Fl_Double_Window* make_window();
Fl_Double_Window *main_window;
Fl_Group *grp_run_file;
Fl_Text_Display *txdsp_run_file_name;
void show();
};
#endif

0 comments on commit 866caa4

Please sign in to comment.