Gtk::Widget * Widget_RendDesc::create_other_tab() { Gtk::Alignment *paddedPanel = manage(new Gtk::Alignment(0, 0, 1, 1)); paddedPanel->set_padding(12, 12, 12, 12); Gtk::Box *panelBox = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12)); panelBox->set_homogeneous(false); paddedPanel->add(*panelBox); Gtk::Frame *lockFrame = manage(new Gtk::Frame(_("Locks and Links"))); lockFrame->set_shadow_type(Gtk::SHADOW_NONE); ((Gtk::Label *) lockFrame->get_label_widget())->set_markup(_("<b>Locks and Links</b>")); panelBox->pack_start(*lockFrame, Gtk::PACK_SHRINK); Gtk::Alignment *lockPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); lockPadding->set_padding(6, 0, 24, 0); lockFrame->add(*lockPadding); Gtk::Grid *lockGrid = manage(new Gtk::Grid()); lockGrid->set_row_spacing(6); lockGrid->set_column_spacing(12); lockPadding->add(*lockGrid); lockGrid->attach(*toggle_im_width, 0, 0, 1, 1); toggle_im_width->set_hexpand(true); lockGrid->attach(*toggle_im_height, 1, 0, 1, 1); toggle_im_height->set_hexpand(true); lockGrid->attach(*toggle_im_aspect, 2, 0, 1, 1); toggle_im_aspect->set_hexpand(true); lockGrid->attach(*toggle_im_span, 3, 0, 1, 1); toggle_im_span->set_hexpand(true); lockGrid->attach(*toggle_px_width, 0, 1, 1, 1); lockGrid->attach(*toggle_px_height, 1, 1, 1, 1); lockGrid->attach(*toggle_px_aspect, 2, 1, 1, 1); Gtk::Frame *focusFrame = manage(new Gtk::Frame(_("Focus Point"))); focusFrame->set_shadow_type(Gtk::SHADOW_NONE); ((Gtk::Label *) focusFrame->get_label_widget())->set_markup(_("<b>Focus Point</b>")); panelBox->pack_start(*focusFrame, Gtk::PACK_SHRINK); Gtk::Alignment *focusPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); focusPadding->set_padding(6, 0, 24, 0); focusFrame->add(*focusPadding); Gtk::Box *focusBox = manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 12)); focusPadding->add(*focusBox); Gtk::Label *focusLabel = manage(new Gtk::Label(_("_Focus Point"), 0, 0.5, true)); focusLabel->set_mnemonic_widget(*entry_focus); focusBox->pack_start(*focusLabel, Gtk::PACK_SHRINK); focusBox->pack_start(*entry_focus, Gtk::PACK_EXPAND_WIDGET); paddedPanel->show_all(); return paddedPanel; }
Gtk::Widget * Widget_RendDesc::create_time_tab() { Gtk::Alignment *paddedPanel = manage(new Gtk::Alignment(0, 0, 1, 1)); paddedPanel->set_padding(12, 12, 12, 12); Gtk::Box *panelBox = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12)); // for future widgets panelBox->set_homogeneous(false); paddedPanel->add(*panelBox); time_frame = manage(new Gtk::Frame(_("Time Settings"))); time_frame->set_shadow_type(Gtk::SHADOW_NONE); ((Gtk::Label *) time_frame->get_label_widget())->set_markup(_("<b>Time Settings</b>")); panelBox->pack_start(*time_frame, Gtk::PACK_SHRINK); Gtk::Alignment *timeFramePadding = manage(new Gtk::Alignment(0, 0, 1, 1)); timeFramePadding->set_padding(6, 0, 24, 0); time_frame->add(*timeFramePadding); Gtk::Grid *timeFrameGrid = manage(new Gtk::Grid()); timeFramePadding->add(*timeFrameGrid); timeFrameGrid->set_row_spacing(6); timeFrameGrid->set_column_spacing(250); Gtk::Label *timeFPSLabel = manage(new Gtk::Label(_("_Frames per second"), 0, 0.5, true)); timeFPSLabel->set_mnemonic_widget(*entry_fps); timeFrameGrid->attach(*timeFPSLabel, 0, 0, 1, 1); entry_fps->set_hexpand(true); timeFrameGrid->attach(*entry_fps, 1, 0, 1, 1); Gtk::Label *timeStartLabel = manage(new Gtk::Label(_("_Start Time"), 0, 0.5, true)); timeStartLabel->set_mnemonic_widget(*entry_start_time); timeFrameGrid->attach(*timeStartLabel, 0, 1, 1, 1); timeFrameGrid->attach(*entry_start_time, 1, 1, 1, 1); Gtk::Label *timeEndLabel = manage(new Gtk::Label(_("_End Time"), 0, 0.5, true)); timeEndLabel->set_mnemonic_widget(*entry_end_time); timeFrameGrid->attach(*timeEndLabel, 0, 2, 1, 1); timeFrameGrid->attach(*entry_end_time, 1, 2, 1, 1); Gtk::Label *timeDurationLabel = manage(new Gtk::Label(_("_Duration"), 0, 0.5, true)); timeDurationLabel->set_mnemonic_widget(*entry_duration); timeFrameGrid->attach(*timeDurationLabel, 0, 3, 1, 1); timeFrameGrid->attach(*entry_duration, 1, 3, 1, 1); paddedPanel->show_all(); return paddedPanel; }
dialog_localsettings::dialog_localsettings() { this->set_size_request(350, -1); this->set_title("Local Settings"); this->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); this->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); Gtk::Frame *frame = Gtk::manage(new Gtk::Frame); frame->set_margin_top(5); frame->set_margin_left(5); frame->set_margin_right(5); frame->set_margin_bottom(5); frame->set_hexpand(true); frame->set_vexpand(true); Gtk::Grid *grid = Gtk::manage(new Gtk::Grid); grid->set_margin_top(15); grid->set_margin_left(15); grid->set_margin_right(15); grid->set_margin_bottom(15); grid->set_hexpand(true); grid->set_vexpand(true); grid->set_row_spacing(15); frame->add(*grid); Gtk::Label *label = Gtk::manage(new Gtk::Label("Host: ")); label->set_halign(Gtk::ALIGN_END); grid->attach(*label, 0, 0, 1, 1); eHost = Gtk::manage(new Gtk::Entry); eHost->set_hexpand(true); grid->attach(*eHost, 1, 0, 1, 1); label = Gtk::manage(new Gtk::Label("Username: "******"Password: "******"Update Interval: ")); label->set_halign(Gtk::ALIGN_END); grid->attach(*label, 0, 3, 1, 1); Gtk::Box *box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0)); grid->attach(*box, 1, 3, 1, 1); sUpdateInterval = Gtk::manage(new Gtk::SpinButton(Gtk::Adjustment::create(5.0, 1.0, 60.0, 1.0, 10.0, 0.0), 0.0, 0)); sUpdateInterval->set_hexpand(false); box->pack_start(*sUpdateInterval, Gtk::PACK_EXPAND_WIDGET, 2); label = Gtk::manage(new Gtk::Label("(seconds)")); label->set_halign(Gtk::ALIGN_END); box->pack_start(*label, Gtk::PACK_EXPAND_WIDGET, 2); frame->show_all(); this->get_content_area()->add(*frame); }
Window() : canvas(), checkbutton1("Plot 1"), checkbutton2("Plot 2"), checkbutton3("Plot 3"), label_x("X:"), label_y("Y:") { set_default_size(720, 580); Gdk::Geometry geometry; geometry.min_aspect = geometry.max_aspect = double(720)/double(580); set_geometry_hints(*this, geometry, Gdk::HINT_ASPECT); set_title("Gtkmm-PLplot test4"); canvas.set_hexpand(true); canvas.set_vexpand(true); canvas.set_background_color(Gdk::RGBA("Light Gray")); grid.set_column_homogeneous(true); checkbutton1.set_vexpand(false); checkbutton1.set_hexpand(false); checkbutton1.set_halign(Gtk::ALIGN_CENTER); checkbutton2.set_vexpand(false); checkbutton2.set_hexpand(false); checkbutton2.set_halign(Gtk::ALIGN_CENTER); checkbutton3.set_vexpand(false); checkbutton3.set_hexpand(false); checkbutton3.set_halign(Gtk::ALIGN_CENTER); std::valarray<double> x_va = Gtk::PLplot::indgen_va(1000)/50.0 - 10.0; std::valarray<double> y_va1 = sinh(x_va); std::valarray<double> y_va2 = cosh(x_va); std::valarray<double> y_va3 = tanh(x_va); //generate the data, the plot, add them to the canvas and use the return value to pass it to the checkbutton Gtk::PLplot::Plot2D *plot1 = Gtk::manage( new Gtk::PLplot::Plot2D( *Gtk::manage( new Gtk::PLplot::PlotData2D( x_va, y_va1, Gdk::RGBA("blue"), Gtk::PLplot::LineStyle::CONTINUOUS, 3.0 ) ), "X-axis", "Y-axis", "Hyperbolic sine", 0.5, 0.5, 0.0, 0.0 ) ); canvas.add_plot(*plot1); checkbutton1.connect_plot(plot1); Gtk::PLplot::Plot2D *plot2 = Gtk::manage( new Gtk::PLplot::Plot2D( *Gtk::manage( new Gtk::PLplot::PlotData2D( x_va, y_va2, Gdk::RGBA("red"), Gtk::PLplot::LineStyle::CONTINUOUS, 3.0 ) ), "X-axis", "Y-axis", "Hyperbolic cosine", 0.5, 0.5, 0.5, 0.0 ) ); canvas.add_plot(*plot2); checkbutton2.connect_plot(plot2); Gtk::PLplot::Plot2D *plot3 = Gtk::manage( new Gtk::PLplot::Plot2D( *Gtk::manage( new Gtk::PLplot::PlotData2D( x_va, y_va3, Gdk::RGBA("green"), Gtk::PLplot::LineStyle::CONTINUOUS, 3.0 ) ), "X-axis", "Y-axis", "Hyperbolic tangent", 0.4, 0.4, 0.2, 0.55 ) ); canvas.add_plot(*plot3); checkbutton3.connect_plot(plot3); checkbutton1.set_active(); checkbutton2.set_active(false); checkbutton3.set_active(); //let's make the first plot unpannable plot1->set_region_pannable(false); //let's override the background color of the second plot and hide it to make the surprise complete!! plot2->set_background_color(Gdk::RGBA("Yellow Green")); plot2->hide(); //also let's disable the region selection, for no reason whatsoever! plot2->set_region_selectable(false); //let's override the default region of this plot, this is NOT influenced by set_region_selectable()!!! plot2->set_region(-10, 10, -10, 10); //we can also change some other colors plot2->set_axes_color(Gdk::RGBA("Blue")); plot2->set_titles_color(Gdk::RGBA("Purple")); plot2->set_box_style(Gtk::PLplot::BOX_TICKS_TICK_LABELS_MAIN_AXES_MAJOR_MINOR_TICK_GRID); //lets'give the third plot a nice opaque background color plot3->set_background_color(Gdk::RGBA("White")); //but disable zooming by scrolling plot3->set_region_zoomable(false); //and give it an unusual selection box plot3->set_region_selection_color(Gdk::RGBA("Purple")); plot3->set_region_selection_width(4.0); //hook up signal_cursor_motion to the entries unsigned int plotnr = 0; while (1) { try { Gtk::PLplot::Plot2D *plot = dynamic_cast<Gtk::PLplot::Plot2D *>(canvas.get_plot(plotnr++)); plot->signal_cursor_motion().connect([this](double x, double y){ entry_x.set_text(Glib::Ascii::dtostr(x)); entry_y.set_text(Glib::Ascii::dtostr(y)); }); } catch (Gtk::PLplot::Exception &e) { break; } } grid.attach(checkbutton1, 0, 0, 1, 1); grid.attach(checkbutton2, 1, 0, 1, 1); grid.attach(checkbutton3, 2, 0, 1, 1); grid.attach(canvas, 0, 1, 3, 1); coordinates_grid.set_column_homogeneous(false); coordinates_grid.attach(label_x, 0, 0, 1, 1); coordinates_grid.attach(entry_x, 1, 0, 1, 1); coordinates_grid.attach(label_y, 2, 0, 1, 1); coordinates_grid.attach(entry_y, 3, 0, 1, 1); label_x.set_vexpand(false); label_x.set_hexpand(true); label_x.set_halign(Gtk::ALIGN_END); label_y.set_vexpand(false); label_y.set_hexpand(false); label_y.set_halign(Gtk::ALIGN_CENTER); entry_x.set_vexpand(false); entry_x.set_hexpand(false); entry_x.set_halign(Gtk::ALIGN_END); entry_y.set_vexpand(false); entry_y.set_hexpand(true); entry_y.set_halign(Gtk::ALIGN_START); coordinates_grid.set_column_spacing(5); grid.attach(coordinates_grid, 0, 2, 3, 1); grid.set_row_spacing(5); add(grid); set_border_width(10); grid.show_all(); }
Gtk::Widget * Widget_RendDesc::create_image_tab() { Gtk::Alignment *paddedPanel = manage(new Gtk::Alignment(0, 0, 1, 1)); paddedPanel->set_padding(12, 12, 12, 12); Gtk::Box *panelBox = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12)); panelBox->set_homogeneous(false); paddedPanel->add(*panelBox); Gtk::Frame *imageSizeFrame = manage(new Gtk::Frame(_("Image Size"))); imageSizeFrame->set_shadow_type(Gtk::SHADOW_NONE); ((Gtk::Label *) imageSizeFrame->get_label_widget())->set_markup(_("<b>Image Size</b>")); // panelBox->pack_start(*imageSizeFrame, false, false, 0); panelBox->pack_start(*imageSizeFrame, Gtk::PACK_SHRINK); Gtk::Alignment *tableSizePadding = manage(new Gtk::Alignment(0, 0, 1, 1)); tableSizePadding->set_padding(6, 0, 24, 0); Gtk::Grid *imageSizeGrid = manage(new Gtk::Grid()); tableSizePadding->add(*imageSizeGrid); imageSizeFrame->add(*tableSizePadding); Gtk::Label *size_width_label = manage(new Gtk::Label(_("_Width"), 0, 0.5, true)); size_width_label->set_mnemonic_widget(*entry_width); Gtk::Label *size_height_label = manage(new Gtk::Label(_("_Height"), 0, 0.5, true)); size_height_label->set_mnemonic_widget(*entry_height); Gtk::Label *size_xres_label = manage(new Gtk::Label(_("_XRes"), 0, 0.5, true)); size_xres_label->set_mnemonic_widget(*entry_xres); Gtk::Label *size_yres_label = manage(new Gtk::Label(_("_YRes"), 0, 0.5, true)); size_yres_label->set_mnemonic_widget(*entry_yres); Gtk::Label *size_physwidth_label = manage(new Gtk::Label(_("_Physical Width"), 0, 0.5, true)); size_physwidth_label->set_mnemonic_widget(*entry_phy_width); Gtk::Label *size_physheight_label = manage(new Gtk::Label(_("Phy_sical Height"), 0, 0.5, true)); size_physheight_label->set_mnemonic_widget(*entry_phy_height); imageSizeGrid->set_row_spacing(6); imageSizeGrid->attach(*size_width_label, 0, 0, 1, 1); imageSizeGrid->attach(*size_height_label, 0, 1, 1, 1); entry_width->set_hexpand(true); entry_height->set_hexpand(true); imageSizeGrid->attach(*entry_width, 1, 0, 1, 1); imageSizeGrid->attach(*entry_height, 1, 1, 1, 1); toggle_wh_ratio->set_margin_right(6); imageSizeGrid->attach(*toggle_wh_ratio, 2, 0, 1, 2); imageSizeGrid->attach(*size_xres_label, 3, 0, 1, 1); imageSizeGrid->attach(*size_yres_label, 3, 1, 1, 1); entry_xres->set_hexpand(true); entry_yres->set_hexpand(true); imageSizeGrid->attach(*entry_xres, 4, 0, 1, 1); imageSizeGrid->attach(*entry_yres, 4, 1, 1, 1); toggle_res_ratio->set_margin_right(6); imageSizeGrid->attach(*toggle_res_ratio, 5, 0, 1, 2); imageSizeGrid->attach(*size_physwidth_label, 6, 0, 1, 1); imageSizeGrid->attach(*size_physheight_label, 6, 1, 1, 1); entry_phy_width->set_hexpand(true); entry_phy_height->set_hexpand(true); imageSizeGrid->attach(*entry_phy_width, 7, 0, 1, 1); imageSizeGrid->attach(*entry_phy_height, 7, 1, 1, 1); imageSizeGrid->attach(*pixel_ratio_label, 0, 3, 3, 1); Gtk::Frame *imageAreaFrame = manage(new Gtk::Frame(_("Image Area"))); imageAreaFrame->set_shadow_type(Gtk::SHADOW_NONE); ((Gtk::Label *) imageAreaFrame->get_label_widget())->set_markup(_("<b>Image Area</b>")); //panelBox->pack_start(*imageAreaFrame, false, false, 0); panelBox->pack_start(*imageAreaFrame, Gtk::PACK_SHRINK); Gtk::Alignment *imageAreaPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); imageAreaPadding->set_padding(6, 0, 24, 0); imageAreaFrame->add(*imageAreaPadding); Gtk::Box *imageAreaBox = manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL,12)); Gtk::Box *imageAreaTlbrLabelBox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL,6)); Gtk::Box *imageAreaTlbrBox = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL,6)); Gtk::Box *imageAreaSpanBox = manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL,6)); imageAreaPadding->add(*imageAreaBox); Gtk::Label *imageAreaTopLeftLabel = manage(new Gtk::Label(_("_Top Left"), 0, 0.5, true)); imageAreaTopLeftLabel->set_mnemonic_widget(*entry_tl); Gtk::Label *imageAreaBottomRightLabel = manage(new Gtk::Label(_("_Bottom Right"), 0, 0.5, true)); imageAreaBottomRightLabel->set_mnemonic_widget(*entry_br); Gtk::Label *size_span = manage(new Gtk::Label(_("I_mage Span"), 0, 0.5, true)); size_span->set_mnemonic_widget(*entry_span); imageAreaTlbrLabelBox->pack_start(*imageAreaTopLeftLabel); imageAreaTlbrLabelBox->pack_start(*imageAreaBottomRightLabel); imageAreaTlbrBox->pack_start(*entry_tl); imageAreaTlbrBox->pack_start(*entry_br); imageAreaSpanBox->pack_start(*size_span); imageAreaSpanBox->pack_start(*entry_span); imageAreaBox->pack_start(*imageAreaTlbrLabelBox); imageAreaBox->pack_start(*imageAreaTlbrBox); imageAreaBox->pack_start(*imageAreaSpanBox); paddedPanel->show_all(); return paddedPanel; }
Window() : show_edges_label("Show edges"), show_labels_label("Show contour labels"), edge_color_label("Contour edge color"), edge_color(Gdk::RGBA("Red")), edge_width_label("Contour edge width"), edge_width_adj(Gtk::Adjustment::create(1.0, 0.1, 10.0, 0.1, 1.0, 0.0)), edge_width_spin(edge_width_adj, 0.1, 1), nlevels_label("Number of contour edges"), nlevels_adj(Gtk::Adjustment::create(7, 3, 20, 1, 5)), nlevels_spin(nlevels_adj, 1, 0), colormap_palette_label("Colormap palette"), area_fill_pattern_label("Fill pattern"), area_lines_width_label("Fill pattern width"), area_lines_width_adj(Gtk::Adjustment::create(1.0, 0.1, 10.0, 0.1, 1.0, 0.0)), area_lines_width_spin(area_lines_width_adj, 0.1, 1), colorbar_label("Show colorbar"), paned(Gtk::ORIENTATION_VERTICAL), aspect_frame(Glib::ustring(), Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER, 1.5, false) { Glib::ustring x_title = "X-axis"; Glib::ustring y_title = "Y-axis"; Glib::ustring plot_title = "Intensity vs detector position"; // general window and canvas settings set_default_size(720, 720); Gdk::Geometry geometry; geometry.min_aspect = geometry.max_aspect = double(720)/double(720); set_geometry_hints(*this, geometry, Gdk::HINT_ASPECT); set_title("Gtkmm-PLplot test8"); canvas.set_hexpand(true); canvas.set_vexpand(true); //read in our dataset std::ifstream fs; fs.exceptions(std::ifstream::failbit | std::ifstream::badbit | std::ifstream::eofbit); // 11 x 11 dataset (I know the file layout and the data dimensions already) const int nx = 11; const int ny = 11; std::vector<double> x(nx); std::vector<double> y(ny); #ifdef GTKMM_PLPLOT_BOOST_ENABLED boost::multi_array<double, 2> z(boost::extents[nx][ny]); std::cout << "Using Boost multi_array!" << std::endl; #else double **z = Gtk::PLplot::calloc_array2d(nx, ny); #endif fs.open(TEST_CSV); std::string line; std::getline(fs, line); gchar **splitted = g_strsplit(line.c_str(), ",", 0); //first line contains the x values for (int i = 1 ; i < nx + 1 ; i++) { x[i-1] = g_ascii_strtod(splitted[i], NULL); } g_strfreev(splitted); for (int i = 0 ; i < ny ; i++) { line.clear(); std::getline(fs, line); splitted = g_strsplit(line.c_str(), ",", 0); y[i] = g_ascii_strtod(splitted[0], NULL); for (int j = 1 ; j < nx + 1 ; j++) { z[j-1][i] = g_ascii_strtod(splitted[j], NULL); } g_strfreev(splitted); } //construct the plot auto plot = Gtk::manage(new Gtk::PLplot::PlotContourShades( *Gtk::manage(new Gtk::PLplot::PlotDataSurface( x, y, z )), x_title, y_title, plot_title, 7, Gtk::PLplot::ColormapPalette::BLUE_RED, edge_color.get_rgba(), 1.0 )); canvas.add_plot(*plot); plot->set_background_color(Gdk::RGBA("Yellow Green")); //now let's set up the grid grid.set_column_homogeneous(true); grid.set_column_spacing(5); grid.set_row_homogeneous(false); grid.set_row_spacing(5); int row_counter = 0; show_edges_label.set_hexpand(true); show_edges_label.set_vexpand(false); show_edges_label.set_valign(Gtk::ALIGN_CENTER); show_edges_label.set_halign(Gtk::ALIGN_END); show_edges_switch.set_hexpand(true); show_edges_switch.set_vexpand(false); show_edges_switch.set_halign(Gtk::ALIGN_START); show_edges_switch.set_valign(Gtk::ALIGN_CENTER); show_edges_switch.set_active(plot->is_showing_edges()); show_edges_switch.property_active().signal_changed().connect([this, plot](){ if (show_edges_switch.get_active()) { edge_color.set_sensitive(); edge_width_spin.set_sensitive(); show_labels_switch.set_sensitive(); plot->show_edges(); } else { edge_color.set_sensitive(false); edge_width_spin.set_sensitive(false); show_labels_switch.set_sensitive(false); plot->hide_edges(); } }); grid.attach(show_edges_label, 0, row_counter, 1, 1); grid.attach(show_edges_switch, 1, row_counter++, 1, 1); // show contour labels show_labels_label.set_hexpand(true); show_labels_label.set_vexpand(false); show_labels_label.set_valign(Gtk::ALIGN_CENTER); show_labels_label.set_halign(Gtk::ALIGN_END); show_labels_switch.set_hexpand(true); show_labels_switch.set_vexpand(false); show_labels_switch.set_halign(Gtk::ALIGN_START); show_labels_switch.set_valign(Gtk::ALIGN_CENTER); show_labels_switch.set_active(plot->is_showing_labels()); show_labels_switch.property_active().signal_changed().connect([this, plot](){ if (show_labels_switch.get_active()) { plot->show_labels(); } else { plot->hide_labels(); } }); grid.attach(show_labels_label, 0, row_counter, 1, 1); grid.attach(show_labels_switch, 1, row_counter++, 1, 1); //color button edge_color_label.set_hexpand(true); edge_color_label.set_vexpand(false); edge_color_label.set_valign(Gtk::ALIGN_CENTER); edge_color_label.set_halign(Gtk::ALIGN_END); edge_color.set_rgba(plot->get_edge_color()); edge_color.set_use_alpha(true); edge_color.set_hexpand(true); edge_color.set_vexpand(false); edge_color.set_halign(Gtk::ALIGN_START); edge_color.set_valign(Gtk::ALIGN_CENTER); edge_color.signal_color_set().connect([this, plot](){plot->set_edge_color(edge_color.get_rgba());}); grid.attach(edge_color_label, 0, row_counter, 1, 1); grid.attach(edge_color, 1, row_counter++, 1, 1); //the edge width spinbutton edge_width_label.set_hexpand(true); edge_width_label.set_vexpand(false); edge_width_label.set_valign(Gtk::ALIGN_CENTER); edge_width_label.set_halign(Gtk::ALIGN_END); edge_width_spin.set_hexpand(true); edge_width_spin.set_vexpand(false); edge_width_spin.set_halign(Gtk::ALIGN_START); edge_width_spin.set_valign(Gtk::ALIGN_CENTER); edge_width_spin.set_wrap(true); edge_width_spin.set_snap_to_ticks(true); edge_width_spin.set_numeric(true); edge_width_spin.set_value(plot->get_edge_width()); edge_width_spin.signal_value_changed().connect([this, plot](){ plot->set_edge_width(edge_width_spin.get_value()); }); grid.attach(edge_width_label, 0, row_counter, 1, 1); grid.attach(edge_width_spin, 1, row_counter++, 1, 1); //nlevels nlevels_label.set_hexpand(true); nlevels_label.set_vexpand(false); nlevels_label.set_valign(Gtk::ALIGN_CENTER); nlevels_label.set_halign(Gtk::ALIGN_END); nlevels_spin.set_hexpand(true); nlevels_spin.set_vexpand(false); nlevels_spin.set_halign(Gtk::ALIGN_START); nlevels_spin.set_valign(Gtk::ALIGN_CENTER); nlevels_spin.set_wrap(true); nlevels_spin.set_snap_to_ticks(true); nlevels_spin.set_numeric(true); nlevels_spin.set_value(plot->get_nlevels()); nlevels_spin.signal_value_changed().connect([this, plot](){ plot->set_nlevels(nlevels_spin.get_value()); }); grid.attach(nlevels_label, 0, row_counter, 1, 1); grid.attach(nlevels_spin, 1, row_counter++, 1, 1); // colormap palette colormap_palette_label.set_hexpand(true); colormap_palette_label.set_vexpand(false); colormap_palette_label.set_valign(Gtk::ALIGN_CENTER); colormap_palette_label.set_halign(Gtk::ALIGN_END); colormap_palette_combo.set_hexpand(true); colormap_palette_combo.set_vexpand(false); colormap_palette_combo.set_halign(Gtk::ALIGN_START); colormap_palette_combo.set_valign(Gtk::ALIGN_CENTER); colormap_palette_combo.append("Default"); colormap_palette_combo.append("Blue → Red"); colormap_palette_combo.append("Blue → Yellow"); colormap_palette_combo.append("Gray"); colormap_palette_combo.append("High frequencies"); colormap_palette_combo.append("Low frequencies"); colormap_palette_combo.append("Radar"); colormap_palette_combo.set_active(plot->get_colormap_palette()); colormap_palette_combo.signal_changed().connect([this, plot](){ plot->set_colormap_palette(static_cast<Gtk::PLplot::ColormapPalette>(colormap_palette_combo.get_active_row_number())); }); grid.attach(colormap_palette_label, 0, row_counter, 1, 1); grid.attach(colormap_palette_combo, 1, row_counter++, 1, 1); //area fill pattern area_fill_pattern_label.set_hexpand(true); area_fill_pattern_label.set_vexpand(false); area_fill_pattern_label.set_valign(Gtk::ALIGN_CENTER); area_fill_pattern_label.set_halign(Gtk::ALIGN_END); area_fill_pattern_combo.set_hexpand(true); area_fill_pattern_combo.set_vexpand(false); area_fill_pattern_combo.set_halign(Gtk::ALIGN_START); area_fill_pattern_combo.set_valign(Gtk::ALIGN_CENTER); area_fill_pattern_combo.append("Solid"); area_fill_pattern_combo.append("Horizontal lines"); area_fill_pattern_combo.append("Vertical lines"); area_fill_pattern_combo.append("Upward lines at 45 degrees"); area_fill_pattern_combo.append("Downward lines at 45 degrees"); area_fill_pattern_combo.append("Upward lines at 30 degrees"); area_fill_pattern_combo.append("Downward lines at 30 degrees"); area_fill_pattern_combo.append("Horizontal and vertical lines"); area_fill_pattern_combo.append("Upward and downward lines at 45 degrees"); area_fill_pattern_combo.set_active(plot->get_area_fill_pattern()); area_fill_pattern_combo.signal_changed().connect([this, plot](){ plot->set_area_fill_pattern(static_cast<Gtk::PLplot::AreaFillPattern>(area_fill_pattern_combo.get_active_row_number())); if (area_fill_pattern_combo.get_active_row_number() == 0 /* SOLID */) { area_lines_width_spin.set_sensitive(false); } else { area_lines_width_spin.set_sensitive(); } }); grid.attach(area_fill_pattern_label, 0, row_counter, 1, 1); grid.attach(area_fill_pattern_combo, 1, row_counter++, 1, 1); //the area lines width spinbutton area_lines_width_label.set_hexpand(true); area_lines_width_label.set_vexpand(false); area_lines_width_label.set_valign(Gtk::ALIGN_CENTER); area_lines_width_label.set_halign(Gtk::ALIGN_END); area_lines_width_spin.set_hexpand(true); area_lines_width_spin.set_vexpand(false); area_lines_width_spin.set_halign(Gtk::ALIGN_START); area_lines_width_spin.set_valign(Gtk::ALIGN_CENTER); area_lines_width_spin.set_wrap(true); area_lines_width_spin.set_snap_to_ticks(true); area_lines_width_spin.set_numeric(true); area_lines_width_spin.set_value(plot->get_area_lines_width()); area_lines_width_spin.signal_value_changed().connect([this, plot](){ plot->set_area_lines_width(area_lines_width_spin.get_value()); }); area_lines_width_spin.set_sensitive(false); grid.attach(area_lines_width_label, 0, row_counter, 1, 1); grid.attach(area_lines_width_spin, 1, row_counter++, 1, 1); //colorbar colorbar_label.set_hexpand(true); colorbar_label.set_vexpand(false); colorbar_label.set_valign(Gtk::ALIGN_CENTER); colorbar_label.set_halign(Gtk::ALIGN_END); colorbar_switch.set_hexpand(true); colorbar_switch.set_vexpand(false); colorbar_switch.set_halign(Gtk::ALIGN_START); colorbar_switch.set_valign(Gtk::ALIGN_CENTER); colorbar_switch.set_active(plot->is_showing_colorbar()); colorbar_switch.property_active().signal_changed().connect([this, plot](){ if (colorbar_switch.get_active()) { plot->show_colorbar(); } else { plot->hide_colorbar(); } }); grid.attach(colorbar_label, 0, row_counter, 1, 1); grid.attach(colorbar_switch, 1, row_counter++, 1, 1); paned.add1(grid); //add canvas to grid aspect_frame.add(canvas); paned.add2(aspect_frame); //finishing up add(paned); set_border_width(10); #if GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION >= 18 paned.set_wide_handle(true); #endif paned.show_all(); }