henon

Unnamed repository; edit this file 'description' to name the repository.
git clone git://fqcor.com/henon.git
torsocks git clone git://fqcoretoclxwqpy3dwktkskmwywrcktgnpviesveq6vrjhqhdc6y4fid.onion/henon.git
Log | Files | Refs | README | LICENSE

commit ea3a0f3f28c88fd686bce2048576ccb81261c470
Author: mys <>
Date:   Thu, 23 Jul 2020 14:14:31 +0200

Init

Diffstat:
ALICENSE | 24++++++++++++++++++++++++
AMakefile | 10++++++++++
AREADME.md | 27+++++++++++++++++++++++++++
ARK.h | 37+++++++++++++++++++++++++++++++++++++
Aclips/chaotic.mp4 | 0
Aclips/chaotic_comparison.mp4 | 0
Aclips/normal.mp4 | 0
Aclips/selfsimilar.mp4 | 0
Ahenon.cpp | 18++++++++++++++++++
Araport.pdf | 0
Asocketwindow.h | 441+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11 files changed, 557 insertions(+), 0 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to <http://unlicense.org/> diff --git a/Makefile b/Makefile @@ -0,0 +1,10 @@ +CC = g++ +CFLAGS = -g -Wall -std=c++17 $(shell pkg-config --cflags gtkmm-3.0) +LDLIBS = $(shell pkg-config --libs gtkmm-3.0) -lboost_iostreams -lboost_system -lboost_filesystem +TARGET = henon +DEPS = gnuplot-iostream/gnuplot-iostream.h RK.h socketwindow.h +all: $(TARGET) +$(TARGET): $(TARGET).cpp $(DEPS) + $(CC) $(CFLAGS) $(LDLIBS) -o $(TARGET) $(TARGET).cpp +clean: + rm -f $(TARGET) diff --git a/README.md b/README.md @@ -0,0 +1,27 @@ +gtkmm interface for Hénon-Heiles system simulation +================================================== + +Dependencies +------------ + +* gtkmm +* boost +* gnuplot +* https://github.com/dstahlke/gnuplot-iostream + +Installation +------------ + +``` +$ git clone https://github.com/dstahlke/gnuplot-iostream +$ make +``` + +Usage +----- + +``` +$ ./henon +``` + +File raport.pdf contains a manual (in Polish, sorry) with some example initial parameters of the system. Additionally some .mp4 files of the program in action are included in clips directory. diff --git a/RK.h b/RK.h @@ -0,0 +1,37 @@ +#ifndef RK_H +#define RK_H + +bool RK_step(double state[]){ + //state={q1,q2,p1,p2} + //if open orbit step won't compute + if (state[0]>10 || state[1]>10 || state[0]<-10 || state[1]<-10){ + return false; + } + double k1[4]={0,0,0,0}; + double k2[4]={0,0,0,0}; + double l1[4]={0,0,0,0}; + double l2[4]={0,0,0,0}; + k1[0]=dt*state[2]; + k2[0]=dt*state[3]; + l1[0]=dt*(-state[0]-2*state[0]*state[1]); + l2[0]=dt*(-state[1]-state[0]*state[0]+state[1]*state[1]); + k1[1]=dt*(state[2]+l1[0]/2); + k2[1]=dt*(state[3]+l2[0]/2); + l1[1]=dt*(-(state[0]+k1[0]/2)-2*(state[0]+k1[0]/2)*(state[1]+k2[0]/2)); + l2[1]=dt*(-(state[1]+k2[0]/2)-(state[0]+k1[0]/2)*(state[0]+k1[0]/2)+(state[1]+k2[0]/2)*(state[1]+k2[0]/2)); + k1[2]=dt*(state[2]+l1[1]/2); + k2[2]=dt*(state[3]+l2[1]/2); + l1[2]=dt*(-(state[0]+k1[1]/2)-2*(state[0]+k1[1]/2)*(state[1]+k2[1]/2)); + l2[2]=dt*(-(state[1]+k2[1]/2)-(state[0]+k1[1]/2)*(state[0]+k1[1]/2)+(state[1]+k2[1]/2)*(state[1]+k2[1]/2)); + k1[3]=dt*(state[2]+l1[2]); + k2[3]=dt*(state[3]+l2[2]); + l1[3]=dt*(-(state[0]+k1[2])-2*(state[0]+k1[2])*(state[1]+k2[2])); + l2[3]=dt*(-(state[1]+k2[2])-(state[0]+k1[2])*(state[0]+k1[2])+(state[1]+k2[2])*(state[1]+k2[2])); + state[0]+=(k1[0]+2*k1[1]+2*k1[2]+k1[3])/6; + state[1]+=(k2[0]+2*k2[1]+2*k2[2]+k2[3])/6; + state[2]+=(l1[0]+2*l1[1]+2*l1[2]+l1[3])/6; + state[3]+=(l2[0]+2*l2[1]+2*l2[2]+l2[3])/6; + return true; +} + +#endif diff --git a/clips/chaotic.mp4 b/clips/chaotic.mp4 Binary files differ. diff --git a/clips/chaotic_comparison.mp4 b/clips/chaotic_comparison.mp4 Binary files differ. diff --git a/clips/normal.mp4 b/clips/normal.mp4 Binary files differ. diff --git a/clips/selfsimilar.mp4 b/clips/selfsimilar.mp4 Binary files differ. diff --git a/henon.cpp b/henon.cpp @@ -0,0 +1,18 @@ +#include <iostream> +#include <fstream> +#include <gtkmm.h> +#include "gnuplot-iostream/gnuplot-iostream.h" + +using namespace std; + +double dt=0.01; + +#include "RK.h" +#include "socketwindow.h" + +int main(int argc, char** argv){ + auto app = Gtk::Application::create(argc, argv); + SocketWindow win; + app->run(win); + return 0; +} diff --git a/raport.pdf b/raport.pdf Binary files differ. diff --git a/socketwindow.h b/socketwindow.h @@ -0,0 +1,441 @@ +#ifndef GTKMM_SOCKETWINDOW_H +#define GTKMM_SOCKETWINDOW_H +#include <deque> +#include <vector> +#include <string> +#include <cmath> +#include <cstdlib> +#include <gtkmm.h> +#include <gtkmm/socket.h> +#include "gnuplot-iostream/gnuplot-iostream.h" + +class SocketWindow : public Gtk::Window{ + double state_1[4]={-0.22,-0.2,-0.36,-0.35}; + double prev_state_1[4]={-0.22,-0.2,-0.36,-0.35}; + double state_2[4]={-0.221,-0.2,-0.36,-0.35}; + double prev_state_2[4]={-0.22,-0.2,-0.36,-0.35}; + double state_3[4]={-0.222,-0.2,-0.36,-0.35}; + double prev_state_3[4]={-0.22,-0.2,-0.36,-0.35}; + deque<pair<double, double>> pts_real_1; + vector<pair<double, double>> pts_map_1; + deque<pair<double, double>> pts_real_2; + vector<pair<double, double>> pts_map_2; + deque<pair<double, double>> pts_real_3; + vector<pair<double, double>> pts_map_3; + double closed_orbit=true; + int ID_real; + int ID_map; + bool timeout=false; + int timeout_min=50; + int timeout_max=1000; + int timeout_value=50; + double adjustment_min=0; + double adjustment_step=0.1; + double adjustment_max=11; + int steps_per_timeout=1; + bool line=true; + int n_objects=1;//1,2,3 + unsigned int trace_length=10; + Gnuplot gp_real; + Gnuplot gp_map; + sigc::connection timeout_connection; + protected: + void reconnect(){ + if (timeout){ + timeout_connection.disconnect(); + sigc::slot<bool> slot=sigc::mem_fun(*this,&SocketWindow::on_timeout); + timeout_connection=Glib::signal_timeout().connect(slot,timeout_value); + } + } + void single_simulate(double prev_state[], double state[], deque<pair<double, double>> &pts_real, vector<pair<double, double>> &pts_map){ + for(int step=0;step<steps_per_timeout && closed_orbit;step++){ + prev_state[0]=state[0]; + prev_state[1]=state[1]; + prev_state[2]=state[2]; + prev_state[3]=state[3]; + closed_orbit=RK_step(state); + if ((state[0]>0 && prev_state[0]<0)||(state[0]<0 && prev_state[0]>0)){ + pts_map.push_back(make_pair((state[1]+prev_state[1])/2,(state[3]+prev_state[3])/2)); + } + } + pts_real.push_back(make_pair(state[0],state[1])); + } + void single_clean(double prev_state[], double state[], deque<pair<double, double>> &pts_real, vector<pair<double, double>> &pts_map){ + pts_map.clear(); + while (pts_real.size()>trace_length){ + pts_real.pop_front(); + } + if (!closed_orbit){ + on_button_stop_clicked(); + m_label_warn.set_markup("<span foreground=\"#FF0000\" size=\"x-large\" weight=\"bold\"> Zatrzymano: orbita otwarta</span>"); + } + } + bool on_timeout(){ + switch (n_objects){ + case 3://simulate 3 objects + single_simulate(prev_state_3, state_3, pts_real_3, pts_map_3); + case 2://...2 + single_simulate(prev_state_2, state_2, pts_real_2, pts_map_2); + case 1://...just 1 + single_simulate(prev_state_1, state_1, pts_real_1, pts_map_1); + } + gp_reload(); + switch (n_objects){ + case 3: + single_clean(prev_state_3, state_3, pts_real_3, pts_map_3); + case 2: + single_clean(prev_state_2, state_2, pts_real_2, pts_map_2); + case 1: + single_clean(prev_state_1, state_1, pts_real_1, pts_map_1); + } + return true; + } + void on_n_objects_changed(){ + n_objects=stoi(m_combo_objects.get_active_text()); + } + void on_trace_length_changed(){ + try{ + trace_length=stoi(m_Entry_trace.get_text()); + } + catch(...){ + } + } + void on_checkbutton_toggled(){ + line=m_CheckButton_line.get_active(); + } + void on_button_random_clicked(){ + if (!timeout){ + m_Entry_q1_1.set_text(to_string(0.7*((double) rand()/RAND_MAX-0.5))); + m_Entry_q2_1.set_text(to_string(0.7*((double) rand()/RAND_MAX-0.5))); + m_Entry_p1_1.set_text(to_string(0.7*((double) rand()/RAND_MAX-0.5))); + m_Entry_p2_1.set_text(to_string(0.7*((double) rand()/RAND_MAX-0.5))); + m_Entry_q1_2.set_text(to_string(stod(m_Entry_q1_1.get_text())+0.01)); + m_Entry_q2_2.set_text(m_Entry_q2_1.get_text()); + m_Entry_p1_2.set_text(m_Entry_p1_1.get_text()); + m_Entry_p2_2.set_text(m_Entry_p2_1.get_text()); + m_Entry_q1_3.set_text(to_string(stod(m_Entry_q1_1.get_text())+0.02)); + m_Entry_q2_3.set_text(m_Entry_q2_1.get_text()); + m_Entry_p1_3.set_text(m_Entry_p1_1.get_text()); + m_Entry_p2_3.set_text(m_Entry_p2_1.get_text()); + } + } + void try_entry(double &value, Gtk::Entry &m_Entry){ + try{ + value=stod(m_Entry.get_text()); + } + catch(...){ + value=0; + m_label_warn.set_markup("<span foreground=\"#FF0000\" size=\"x-large\" weight=\"bold\"> Nieprawidłowa wartość</span>"); + on_button_stop_clicked(); + } + + } + void sensitivity_off(){ + m_Entry_q1_3.set_sensitive(false); + m_Entry_q2_3.set_sensitive(false); + m_Entry_p1_3.set_sensitive(false); + m_Entry_p2_3.set_sensitive(false); + m_Entry_q1_2.set_sensitive(false); + m_Entry_q2_2.set_sensitive(false); + m_Entry_p1_2.set_sensitive(false); + m_Entry_p2_2.set_sensitive(false); + m_Entry_q1_1.set_sensitive(false); + m_Entry_q2_1.set_sensitive(false); + m_Entry_p1_1.set_sensitive(false); + m_Entry_p2_1.set_sensitive(false); + m_combo_objects.set_sensitive(false); + } + void sensitivity_on(){ + m_Entry_q1_3.set_sensitive(true); + m_Entry_q2_3.set_sensitive(true); + m_Entry_p1_3.set_sensitive(true); + m_Entry_p2_3.set_sensitive(true); + m_Entry_q1_2.set_sensitive(true); + m_Entry_q2_2.set_sensitive(true); + m_Entry_p1_2.set_sensitive(true); + m_Entry_p2_2.set_sensitive(true); + m_Entry_q1_1.set_sensitive(true); + m_Entry_q2_1.set_sensitive(true); + m_Entry_p1_1.set_sensitive(true); + m_Entry_p2_1.set_sensitive(true); + m_combo_objects.set_sensitive(true); + } + void on_button_start_clicked(){ + closed_orbit=true; + timeout=true; + m_label_warn.set_text(""); + pts_real_1.clear(); + pts_map_1.clear(); + pts_real_2.clear(); + pts_map_2.clear(); + pts_real_3.clear(); + pts_map_3.clear(); + sensitivity_off(); + switch (n_objects){ + case 3: + try_entry(state_3[0],m_Entry_q1_3); + try_entry(state_3[1],m_Entry_q2_3); + try_entry(state_3[2],m_Entry_p1_3); + try_entry(state_3[3],m_Entry_p2_3); + case 2: + try_entry(state_2[0],m_Entry_q1_2); + try_entry(state_2[1],m_Entry_q2_2); + try_entry(state_2[2],m_Entry_p1_2); + try_entry(state_2[3],m_Entry_p2_2); + case 1: + try_entry(state_1[0],m_Entry_q1_1); + try_entry(state_1[1],m_Entry_q2_1); + try_entry(state_1[2],m_Entry_p1_1); + try_entry(state_1[3],m_Entry_p2_1); + } + gp_reset(); + reconnect(); + } + void on_button_stop_clicked(){ + timeout=false; + timeout_connection.disconnect(); + sensitivity_on(); + } + void on_reset_view(){ + gp_real<<"set xrange [-0.8:0.8]\n"; + gp_real<<"set yrange [-0.8:0.8]\n"; + gp_real<<"replot\n"; + gp_real.flush(); + gp_map<<"set xrange [-0.8:0.8]\n"; + gp_map<<"set yrange [-0.8:0.8]\n"; + gp_map<<"replot\n"; + gp_map.flush(); + } + void on_adjustment_step(){ + double x=exp(m_adjustment_step->get_value()); + double max=exp(adjustment_max); + timeout_value=(timeout_max-timeout_min)*x/max+timeout_min; + steps_per_timeout=x*timeout_value/timeout_min; + reconnect(); + } + void gp_reload(){ + if (line){ + switch (n_objects){ + case 3: + gp_real<<"plot \"<echo '0 -0.8\\n0 0.8'\" w l lw 1.5 linecolor rgb 'red',"; + gp_real<<gp_real.binFile1d(pts_real_3, "record")<<"w l lw 1.5 linecolor rgb 'blue',"; + gp_real<<gp_real.binFile1d(pts_real_2, "record")<<"w l lw 1.5 linecolor rgb 'green',"; + gp_real<<gp_real.binFile1d(pts_real_1, "record")<<"w l lw 1.5 linecolor rgb 'black'\n"; + break; + case 2: + gp_real<<"plot \"<echo '0 -0.8\\n0 0.8'\" w l lw 1.5 linecolor rgb 'red',"; + gp_real<<gp_real.binFile1d(pts_real_2, "record")<<"w l lw 1.5 linecolor rgb 'green',"; + gp_real<<gp_real.binFile1d(pts_real_1, "record")<<"w l lw 1.5 linecolor rgb 'black'\n"; + break; + case 1: + gp_real<<"plot \"<echo '0 -0.8\\n0 0.8'\" w l lw 1.5 linecolor rgb 'red',"; + gp_real<<gp_real.binFile1d(pts_real_1, "record")<<"w l lw 1.5 linecolor rgb 'black'\n"; + } + } + else{ + switch (n_objects){ + case 3: + gp_real<<"plot \"<echo '0 -0.8\\n0 0.8'\" w l lw 1.5 linecolor rgb 'red',"; + gp_real<<gp_real.binFile1d(pts_real_3, "record")<<"w p pt 7 pointsize 1.0 linecolor rgb 'blue',"; + gp_real<<gp_real.binFile1d(pts_real_2, "record")<<"w p pt 7 pointsize 1.0 linecolor rgb 'green',"; + gp_real<<gp_real.binFile1d(pts_real_1, "record")<<"w p pt 7 pointsize 1.0 linecolor rgb 'black'\n"; + break; + case 2: + gp_real<<"plot \"<echo '0 -0.8\\n0 0.8'\" w l lw 1.5 linecolor rgb 'red',"; + gp_real<<gp_real.binFile1d(pts_real_2, "record")<<"w p pt 7 pointsize 1.0 linecolor rgb 'green',"; + gp_real<<gp_real.binFile1d(pts_real_1, "record")<<"w p pt 7 pointsize 1.0 linecolor rgb 'black'\n"; + break; + case 1: + gp_real<<"plot \"<echo '0 -0.8\\n0 0.8'\" w l lw 1.5 linecolor rgb 'red',"; + gp_real<<gp_real.binFile1d(pts_real_1, "record")<<"w p pt 7 pointsize 1.0 linecolor rgb 'black'\n"; + } + } + gp_real.flush(); + switch (n_objects){ + case 3: + if (!pts_map_3.empty()){ + gp_map<<"replot "<<gp_map.binFile1d(pts_map_3, "record")<<"w p pt 7 pointsize 1.0 linecolor rgb 'blue'\n"; + } + case 2: + if (!pts_map_2.empty()){ + gp_map<<"replot "<<gp_map.binFile1d(pts_map_2, "record")<<"w p pt 7 pointsize 1.0 linecolor rgb 'green'\n"; + } + case 1: + if (!pts_map_1.empty()){ + gp_map<<"replot "<<gp_map.binFile1d(pts_map_1, "record")<<"w p pt 7 pointsize 1.0 linecolor rgb 'black'\n"; + } + } + gp_map.flush(); + } + void gp_reset(){ + gp_real<<"set term x11 window \""<<hex<<ID_real<<"\"\n"; + gp_real<<"set xrange [-0.8:0.8]\n"; + gp_real<<"set yrange [-0.8:0.8]\n"; + gp_real<<"set key off\n"; + gp_real<<"plot \"<echo '0 -0.8\\n0 0.8'\" w l lw 1.5 linecolor rgb 'red'\n"; + gp_real.flush(); + gp_map<<"set term x11 window \""<<hex<<ID_map<<"\"\n"; + gp_map<<"set xrange [-0.8:0.8]\n"; + gp_map<<"set yrange [-0.8:0.8]\n"; + gp_map<<"set key off\n"; + gp_map<<"plot 2 with lines\n"; + gp_map.flush(); + } + //Child widgets: + Gtk::Box m_box,m_box_ui,m_box_objects; + Gtk::Box m_box_q1,m_box_q2,m_box_p1,m_box_p2; + Gtk::Box m_box_plotutil; + Gtk::ComboBoxText m_combo_objects; + Gtk::Entry m_Entry_trace; + Gtk::Button m_button_random; + Gtk::Button m_button_start,m_button_stop; + Gtk::Button m_button_reset_view; + Gtk::Label m_label_warn; + Gtk::CheckButton m_CheckButton_line; + Glib::RefPtr<Gtk::Adjustment> m_adjustment_step; + Gtk::Scale m_scale_step; + Gtk::Entry m_Entry_q1_1,m_Entry_q2_1,m_Entry_p1_1,m_Entry_p2_1, + m_Entry_q1_2,m_Entry_q2_2,m_Entry_p1_2,m_Entry_p2_2, + m_Entry_q1_3,m_Entry_q2_3,m_Entry_p1_3,m_Entry_p2_3; + public: + SocketWindow(): + gp_real(), + gp_map(), + m_box(Gtk::ORIENTATION_HORIZONTAL), + m_box_ui(Gtk::ORIENTATION_VERTICAL), + m_box_q1(Gtk::ORIENTATION_HORIZONTAL), + m_box_q2(Gtk::ORIENTATION_HORIZONTAL), + m_box_p1(Gtk::ORIENTATION_HORIZONTAL), + m_box_p2(Gtk::ORIENTATION_HORIZONTAL), + m_box_plotutil(Gtk::ORIENTATION_HORIZONTAL), + m_CheckButton_line("Łącz punkty", 0), + m_adjustment_step(Gtk::Adjustment::create(0,adjustment_min,adjustment_max,adjustment_step,1,1)), + m_scale_step(m_adjustment_step, Gtk::ORIENTATION_HORIZONTAL) + { + set_title("Henon"); + add(m_box); + set_border_width(10); + m_box.set_size_request(1000,500); + + auto m_socket_real_p = Gtk::manage(new Gtk::Socket()); + m_box.pack_start(*m_socket_real_p); + + auto m_socket_map_p = Gtk::manage(new Gtk::Socket()); + m_box.pack_start(*m_socket_map_p); + + m_box.pack_start(m_box_ui,Gtk::PACK_SHRINK); + + m_box_ui.pack_start(*(new Gtk::Label{"Warunki początkowe:", 0}), Gtk::PACK_SHRINK); + + m_box_ui.pack_start(m_box_objects, Gtk::PACK_SHRINK); + m_box_objects.pack_start(*(new Gtk::Label{"Ilość obiektów:", 0}), Gtk::PACK_SHRINK); + m_combo_objects.append("1"); + m_combo_objects.append("2"); + m_combo_objects.append("3"); + m_combo_objects.set_active(0); + m_combo_objects.signal_changed().connect(sigc::mem_fun(*this,&SocketWindow::on_n_objects_changed)); + m_box_objects.pack_start(m_combo_objects, Gtk::PACK_SHRINK); + + m_button_random.add_label("Losuj"); + m_button_random.signal_clicked().connect(sigc::mem_fun(*this,&SocketWindow::on_button_random_clicked)); + m_box_ui.pack_start(m_button_random,Gtk::PACK_SHRINK); + + m_box_ui.pack_start(m_box_q1, Gtk::PACK_SHRINK); + m_box_q1.pack_start(*(new Gtk::Label{"q1:", 0}), Gtk::PACK_SHRINK); + m_Entry_q1_1.set_max_length(16); + m_Entry_q1_1.set_text(to_string(state_1[0])); + m_Entry_q1_1.select_region(0, m_Entry_q1_1.get_text_length()); + m_box_q1.pack_start(m_Entry_q1_1); + m_Entry_q1_2.set_max_length(16); + m_Entry_q1_2.set_text(to_string(state_2[0])); + m_Entry_q1_2.select_region(0, m_Entry_q1_2.get_text_length()); + m_box_q1.pack_start(m_Entry_q1_2); + m_Entry_q1_3.set_max_length(16); + m_Entry_q1_3.set_text(to_string(state_3[0])); + m_Entry_q1_3.select_region(0, m_Entry_q1_3.get_text_length()); + m_box_q1.pack_start(m_Entry_q1_3); + + m_box_ui.pack_start(m_box_q2, Gtk::PACK_SHRINK); + m_box_q2.pack_start(*(new Gtk::Label{"q2:", 0}), Gtk::PACK_SHRINK); + m_Entry_q2_1.set_max_length(16); + m_Entry_q2_1.set_text(to_string(state_1[1])); + m_Entry_q2_1.select_region(0, m_Entry_q2_1.get_text_length()); + m_box_q2.pack_start(m_Entry_q2_1); + m_Entry_q2_2.set_max_length(16); + m_Entry_q2_2.set_text(to_string(state_2[1])); + m_Entry_q2_2.select_region(0, m_Entry_q2_2.get_text_length()); + m_box_q2.pack_start(m_Entry_q2_2); + m_Entry_q2_3.set_max_length(16); + m_Entry_q2_3.set_text(to_string(state_3[1])); + m_Entry_q2_3.select_region(0, m_Entry_q2_3.get_text_length()); + m_box_q2.pack_start(m_Entry_q2_3); + + m_box_ui.pack_start(m_box_p1, Gtk::PACK_SHRINK); + m_box_p1.pack_start(*(new Gtk::Label{"p1:", 0}), Gtk::PACK_SHRINK); + m_Entry_p1_1.set_max_length(16); + m_Entry_p1_1.set_text(to_string(state_1[2])); + m_Entry_p1_1.select_region(0, m_Entry_p1_1.get_text_length()); + m_box_p1.pack_start(m_Entry_p1_1); + m_Entry_p1_2.set_max_length(16); + m_Entry_p1_2.set_text(to_string(state_2[2])); + m_Entry_p1_2.select_region(0, m_Entry_p1_2.get_text_length()); + m_box_p1.pack_start(m_Entry_p1_2); + m_Entry_p1_3.set_max_length(16); + m_Entry_p1_3.set_text(to_string(state_3[2])); + m_Entry_p1_3.select_region(0, m_Entry_p1_3.get_text_length()); + m_box_p1.pack_start(m_Entry_p1_3); + + m_box_ui.pack_start(m_box_p2, Gtk::PACK_SHRINK); + m_box_p2.pack_start(*(new Gtk::Label{"p2:", 0}), Gtk::PACK_SHRINK); + m_Entry_p2_1.set_max_length(16); + m_Entry_p2_1.set_text(to_string(state_1[3])); + m_Entry_p2_1.select_region(0, m_Entry_p2_1.get_text_length()); + m_box_p2.pack_start(m_Entry_p2_1); + m_Entry_p2_2.set_max_length(16); + m_Entry_p2_2.set_text(to_string(state_2[3])); + m_Entry_p2_2.select_region(0, m_Entry_p2_2.get_text_length()); + m_box_p2.pack_start(m_Entry_p2_2); + m_Entry_p2_3.set_max_length(16); + m_Entry_p2_3.set_text(to_string(state_3[3])); + m_Entry_p2_3.select_region(0, m_Entry_p2_3.get_text_length()); + m_box_p2.pack_start(m_Entry_p2_3); + + m_button_start.add_label("Start"); + m_button_start.signal_clicked().connect(sigc::mem_fun(*this,&SocketWindow::on_button_start_clicked)); + m_box_ui.pack_start(m_button_start,Gtk::PACK_SHRINK); + + m_button_stop.add_label("Stop"); + m_button_stop.signal_clicked().connect(sigc::mem_fun(*this,&SocketWindow::on_button_stop_clicked)); + m_box_ui.pack_start(m_button_stop,Gtk::PACK_SHRINK); + + m_box_ui.pack_start(*(new Gtk::Label{"Szybkość symulacji:", 0}), Gtk::PACK_SHRINK); + m_adjustment_step->signal_value_changed().connect(sigc::mem_fun(*this,&SocketWindow::on_adjustment_step)); + m_box_ui.pack_start(m_scale_step,Gtk::PACK_SHRINK); + + m_box_ui.pack_start(m_box_plotutil,Gtk::PACK_SHRINK); + + m_CheckButton_line.set_active(); + m_CheckButton_line.signal_toggled().connect(sigc::mem_fun(*this,&SocketWindow::on_checkbutton_toggled)); + m_box_plotutil.pack_start(m_CheckButton_line,Gtk::PACK_SHRINK); + + m_button_reset_view.add_label("Zresetuj widok"); + m_button_reset_view.signal_clicked().connect(sigc::mem_fun(*this,&SocketWindow::on_reset_view)); + m_box_plotutil.pack_start(m_button_reset_view,Gtk::PACK_SHRINK); + + m_box_plotutil.pack_start(*(new Gtk::Label{"Długość śladu:", 0}), Gtk::PACK_SHRINK); + m_Entry_trace.set_max_length(3); + m_Entry_trace.set_text(to_string(trace_length)); + m_Entry_trace.select_region(0, m_Entry_trace.get_text_length()); + m_Entry_trace.signal_changed().connect(sigc::mem_fun(*this,&SocketWindow::on_trace_length_changed)); + m_box_plotutil.pack_start(m_Entry_trace,Gtk::PACK_SHRINK); + + m_box_ui.pack_start(m_label_warn,Gtk::PACK_SHRINK); + + ID_real=m_socket_real_p->get_id(); + ID_map=m_socket_map_p->get_id(); + gp_reset(); + show_all_children(); + } +}; + +#endif