Commit 6cafb205 authored by plgruener's avatar plgruener

adjust window size and scrolling

parent 3b3b7a2a
......@@ -13,18 +13,6 @@
#include "compute.hpp"
class ScrollBox : public Fl_Box {
Fl_Scroll *scroll;
public:
void SetScroll(Fl_Scroll *val) {
scroll = val;
}
ScrollBox(int x,int y,int w,int h,const char*l=0) : Fl_Box(x,y,w,h,l) {
color(FL_BLUE);
box(FL_FLAT_BOX);
}
};
class SimpleWindow : public Fl_Window {
public:
......@@ -32,7 +20,9 @@ class SimpleWindow : public Fl_Window {
~SimpleWindow();
Fl_Scroll* scroll;
ScrollBox* scrollbox;
Fl_Box* imagebox;
Fl_Group* group;
Fl_PNG_Image* image;
......@@ -57,7 +47,7 @@ class SimpleWindow : public Fl_Window {
};
int main() {
SimpleWindow win(800,600,"Dynamic Systems");
SimpleWindow win(600,500,"Dynamic Systems");
return Fl::run();
}
......@@ -66,25 +56,28 @@ SimpleWindow::SimpleWindow(int w, int h, const char* title):Fl_Window(w,h,title)
// between begin...end comes what to show in window
this->begin(); // this-> is implicit
// Top: ScrollBox containing the picture
// Top: scrolling box containing the picture
image = new Fl_PNG_Image("picture.png");
scroll = new Fl_Scroll(0,0,800,400);
scroll->begin();
scrollbox = new ScrollBox(0,0,800,400);
scrollbox->SetScroll(scroll);
scrollbox->image(image);
int scrollheight = 400;
int scrollwidth = 600;
scroll = new Fl_Scroll(0,0,600,400);
scroll->begin();
imagebox = new Fl_Box(0,0,image->w(),image->h());
imagebox->image(image);
scroll->end();
// Bottom: inputboxes and button
int boxwidth = 80; // width input boxes
int boxheight = 20; // height input boxes
int firstrow = 450;
int secondrow = 550;
int firstrow = scrollheight+1*boxheight;
int secondrow = firstrow+2*boxheight;
int padding = 100;
group = new Fl_Group(0,scrollheight,6*padding,100);
group->begin();
in_alphamin = new Fl_Value_Input(0*padding,firstrow,boxwidth,boxheight,"alpha_min");
in_alphamin->align(FL_ALIGN_TOP);
in_alphamin->value(0.0);
......@@ -97,6 +90,19 @@ SimpleWindow::SimpleWindow(int w, int h, const char* title):Fl_Window(w,h,title)
in_alpha_num_intervals->align(FL_ALIGN_TOP);
in_alpha_num_intervals->value(400);
in_num_iterations = new Fl_Value_Input(3*padding,firstrow,boxwidth,boxheight,"iterations");
in_num_iterations->align(FL_ALIGN_TOP);
in_num_iterations->value(100);
in_threshold = new Fl_Value_Input(4*padding,firstrow,boxwidth,boxheight,"threshold");
in_threshold->align(FL_ALIGN_TOP);
in_threshold->value(1);
button_compute = new Fl_Button(5*padding,firstrow,boxwidth,boxheight,"compute");
button_compute->type(FL_NORMAL_BUTTON);
button_compute->color(FL_RED);
button_compute->callback(callback_compute,this);
in_betamin = new Fl_Value_Input(0*padding,secondrow,boxwidth,boxheight,"beta_min");
in_betamin->align(FL_ALIGN_TOP);
in_betamin->value(0.0);
......@@ -109,30 +115,21 @@ SimpleWindow::SimpleWindow(int w, int h, const char* title):Fl_Window(w,h,title)
in_beta_num_intervals->align(FL_ALIGN_TOP);
in_beta_num_intervals->value(400);
in_num_iterations = new Fl_Value_Input(3*padding,firstrow,boxwidth,boxheight,"iterations");
in_num_iterations->align(FL_ALIGN_TOP);
in_num_iterations->value(100);
in_threshold = new Fl_Value_Input(4*padding,firstrow,boxwidth,boxheight,"threshold");
in_threshold->align(FL_ALIGN_TOP);
in_threshold->value(1);
in_num_seedpoints = new Fl_Value_Input(3*padding,secondrow,boxwidth,boxheight,"#seedpoints");
in_num_seedpoints = new Fl_Value_Input(3*padding,secondrow,boxwidth,boxheight,"# seedpoints");
in_num_seedpoints->align(FL_ALIGN_TOP);
in_num_seedpoints->value(8);
button_compute = new Fl_Button(5*padding,firstrow,boxwidth,boxheight,"compute");
button_compute->type(FL_NORMAL_BUTTON);
button_compute->color(FL_RED);
button_compute->callback(callback_compute,this);
in_special_seedpoint = new Fl_Value_Input(4*padding,secondrow,boxwidth,boxheight,"special seed");
in_special_seedpoint->align(FL_ALIGN_TOP);
in_special_seedpoint->value(0);
in_output_csv = new Fl_Check_Button(5*padding,secondrow,boxwidth,boxheight,"csv output");
group->end();
this->end();
resizable(this);
this->resizable(scroll);
this->show();
}
......@@ -166,8 +163,8 @@ void SimpleWindow::callback_compute_il() {
);
image = new Fl_PNG_Image("picture.png");
scrollbox->image(image);
scrollbox->resize(0,0,image->w(),image->h());
imagebox->image(image);
imagebox->resize(0,0,image->w(),image->h());
redraw();
std::cout << "finished computation." << std::endl;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment