Exemple #1
0
  void NoteAddin::on_note_opened_event(Note & )
  {
    on_note_opened();
    NoteWindow * window = get_window();

    for(std::list<Gtk::MenuItem*>::const_iterator iter = m_text_menu_items.begin();
        iter != m_text_menu_items.end(); ++iter) {
      Gtk::Widget *item = *iter;
      if ((item->get_parent() == NULL) ||
          (item->get_parent() != window->text_menu())) {
        window->text_menu()->add (*item);
        window->text_menu()->reorder_child(*(Gtk::MenuItem*)item, 7);
      }
    }
      
    for(ToolItemMap::const_iterator iter = m_toolbar_items.begin();
        iter != m_toolbar_items.end(); ++iter) {
      if ((iter->first->get_parent() == NULL) ||
          (iter->first->get_parent() != window->embeddable_toolbar())) {
        Gtk::Grid *grid = window->embeddable_toolbar();
        grid->insert_column(iter->second);
        grid->attach(*iter->first, iter->second, 0, 1, 1);
      }
    }
  }
  void NotebookNoteAddin::initialize_tool_button()
  {
    gint icon_size = 16;
    gtk_icon_size_lookup(GTK_ICON_SIZE_SMALL_TOOLBAR, &icon_size, NULL);

    Gtk::Grid *grid = manage(new Gtk::Grid);
    grid->attach(*manage(new Gtk::Image(
      IconManager::obj().get_icon(IconManager::NOTEBOOK, icon_size))),
                 0, 0, 1, 1);
    m_label_widget = manage(new Gtk::Label);
    m_label_widget->set_vexpand(true);
    m_label_widget->set_valign(Gtk::ALIGN_CENTER);
    grid->attach(*m_label_widget, 1, 0, 1, 1);
    m_toolButton = Gtk::manage(new gnote::utils::ToolMenuButton(*grid, m_menu));
    m_toolButton->set_tooltip_text(_("Place this note into a notebook"));

    m_show_menu_cid = m_menu->signal_show()
      .connect(sigc::mem_fun(*this, &NotebookNoteAddin::on_menu_shown));
    m_toolButton->show_all();
    add_tool_item(m_toolButton, -1);
    update_notebook_button_label();
    
    m_note_added_cid = NotebookManager::obj().signal_note_added_to_notebook()
      .connect(sigc::mem_fun(*this, &NotebookNoteAddin::on_note_added_to_notebook));
    m_note_removed_cid = NotebookManager::obj().signal_note_removed_from_notebook()
      .connect(sigc::mem_fun(*this, &NotebookNoteAddin::on_note_removed_from_notebook));

    get_note()->signal_tag_added()
      .connect(sigc::mem_fun(*this, &NotebookNoteAddin::on_note_tag_added));

    // TODO: Make sure this is handled in NotebookNoteAddin, too
    get_note()->signal_tag_removed()
      .connect(sigc::mem_fun(*this, &NotebookNoteAddin::on_note_tag_removed));
  }
void dialog::operate4(Image imag,std::string filename)
{
    set_default_size(300, 50);
    set_border_width(10);
    set_position(Gtk::WIN_POS_CENTER);
    set_resizable(false);

    Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
    add(*vbox);

    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    vbox->add(*grid);

    Gtk::Label *label = Gtk::manage(new Gtk::Label("File Name :"));
    grid->attach(*label,0,0,1,1);
    Gtk::Entry *bvalue = Gtk::manage(new Gtk::Entry());
    grid->attach(*bvalue, 1, 0, 1, 1);
    Gtk::Label *label2 = Gtk::manage(new Gtk::Label(".bmp"));
    grid->attach(*label2,2,0,1,1);

    set_title("Save As");
    bvalue->set_text("Untitled");
    bvalue->set_max_length(50);

    Gtk::Button *bok = Gtk::manage(new Gtk::Button("OK"));
    bok->signal_clicked().connect(sigc::bind<Gtk::Entry*>(sigc::mem_fun(*this, &dialog::on_bok4_click), bvalue,imag,filename));
    grid->attach(*bok, 2, 2, 1, 1);
    show_all_children();
}
    Gtk::Grid * SmartChessWindow::createOptionsArea() {
        const int OPTIONS_ROWS = 4;
        Gtk::Grid* options = Gtk::manage(new Gtk::Grid());
        options->set_vexpand();
        options->set_hexpand(false);
        options->insert_column(0);

        for(auto i : IntRange(OPTIONS_ROWS))
            options->insert_row(i);

        Gtk::Button* b = Gtk::manage(new Gtk::Button("Start"));
        b->set_hexpand(false);
        b->signal_clicked().connect(sigc::mem_fun(this, &SmartChessWindow::onStartGame));
        options->attach(*b, 0, 0, 1, 1);

        b = Gtk::manage(new Gtk::Button("End"));
        b->set_hexpand(false);
        b->signal_clicked().connect(sigc::mem_fun(this, &SmartChessWindow::onEndGame));
        options->attach(*b, 0, 1, 1, 1);

        b = Gtk::manage(new Gtk::Button("Reset"));
        b->set_hexpand(false);
        b->signal_clicked().connect(sigc::mem_fun(this, &SmartChessWindow::onResetGame));
        options->attach(*b, 0, 2, 1, 1);

        auto suboptions = createSuboptionsArea();
        options->attach(*suboptions, 0, 3, 1, 1);

        return options;
    }
Exemple #5
0
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;
}
Exemple #6
0
int main(int argc, char *argv[])
{

    // make window
    Glib::RefPtr<Gtk::Application> app =
        Gtk::Application::create(argc, argv,
                                 "tutorial2");

    Gtk::Window window;

    window.set_default_size(400,200);
    window.set_title("Tutorial 2");

    // This creates a vertical box container with 0 padding
    Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
    window.add(*vbox);

    // creates menu bar
    Gtk::MenuBar *menubar = Gtk::manage(new Gtk::MenuBar());
    vbox->pack_start(*menubar, Gtk::PACK_SHRINK, 0);

    // create menu items
    Gtk::MenuItem *menuitem_file = Gtk::manage(new Gtk::MenuItem("_File", true));
    menubar->append(*menuitem_file);
    Gtk::Menu *filemenu = Gtk::manage(new Gtk::Menu());
    menuitem_file->set_submenu(*filemenu);
    Gtk::MenuItem *menuitem_quit = Gtk::manage(new Gtk::MenuItem("_Quit", true));
    filemenu->append(*menuitem_quit);

    // create grid container with border width 10
    // and add it to the new cell of the vertical box
    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    grid->set_border_width(10);
    vbox->add(*grid);

    // create button
    Gtk::Button *b1 = Gtk::manage(new Gtk::Button("Button 1"));
    b1->set_hexpand(true);		//  take up all unused space horizontally
    b1->set_vexpand(true);		//  take up all unused space vertically
    // possition 0(x), 0(y), span 1 cell wide and 2 cells down
    grid->attach(*b1, 0, 0, 1, 2);

    Gtk::Button *b2 = Gtk::manage(new Gtk::Button("Button 2"));
    grid->attach(*b2, 1, 0, 1, 1);

    Gtk::Button *b3 = Gtk::manage(new Gtk::Button("Button 3"));
    grid->attach(*b3, 1, 1, 1, 1);

    vbox->show_all();

    return app->run(window);
}
Exemple #7
0
 void NoteAddin::add_tool_item (Gtk::ToolItem *item, int position)
 {
   if (is_disposing())
     throw sharp::Exception(_("Plugin is disposing already"));
       
   m_toolbar_items [item] = position;
     
   if (m_note->is_opened()) {
     Gtk::Grid *grid = get_window()->embeddable_toolbar();
     grid->insert_column(position);
     grid->attach(*item, position, 0, 1, 1);
   }
 }
myWindow::myWindow()
{
	set_default_size(400, 200);
	set_title("Tutorial 3");

	Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
	add(*vbox);

	Gtk::MenuBar *menubar = Gtk::manage(new Gtk::MenuBar());
	vbox->pack_start(*menubar, Gtk::PACK_SHRINK, 0);

	Gtk::MenuItem *menuitem_file = Gtk::manage(new Gtk::MenuItem("_File", true));
	menubar->append(*menuitem_file);
	Gtk::Menu *filemenu = Gtk::manage(new Gtk::Menu());
	menuitem_file->set_submenu(*filemenu);
	Gtk::MenuItem *menuitem_quit = Gtk::manage(new Gtk::MenuItem("_Quit", true));
	menuitem_quit->signal_activate().connect(sigc::mem_fun(*this, &myWindow::on_quit_click));
	filemenu->append(*menuitem_quit);

	Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
	grid->set_border_width(10);
	vbox->add(*grid);

	Gtk::Button *b1 = Gtk::manage(new Gtk::Button("Big Button 1"));
    b1->set_hexpand(true);
    b1->set_vexpand(true);
    b1->signal_clicked().connect(sigc::mem_fun(*this, &myWindow::on_big_button1_click));
    grid->attach(*b1, 0, 0, 1, 2);

    Gtk::Button *b2 = Gtk::manage(new Gtk::Button("Button 2"));
    b2->signal_clicked().connect(sigc::mem_fun(*this, &myWindow::on_button2_click));
    grid->attach(*b2, 1, 0, 1, 1);

    Gtk::Button *b3 = Gtk::manage(new Gtk::Button("Button 3"));
    b3->signal_clicked().connect(sigc::mem_fun(*this, &myWindow::on_button3_click));
    grid->attach(*b3, 1, 1, 1, 1);

    vbox->show_all();
}
    Gtk::Grid * SmartChessWindow::createMainGrid() const {
        Gtk::Grid* grid = Gtk::manage(new Gtk::Grid());
        grid->set_row_homogeneous(false);
        grid->set_column_homogeneous(false);
        grid->set_vexpand();
        grid->set_hexpand();

        for(auto i : IntRange(ROW_COUNT))
            grid->insert_row(i);

        for(auto i : IntRange(COLUMN_COUNT))
            grid->insert_column(i);

        return grid;
    }
void dialog::operate(Image* imag,int i,Gtk::Image *m_image1,int imagestatus1,Gtk::Label* pixlabel)
{
    label=pixlabel;
    im=imag;
    imagestatus=imagestatus1;
    if(imagestatus)
    {
        m_image=m_image1;
    }
    set_default_size(500, 50);
    set_border_width(10);
    set_position(Gtk::WIN_POS_CENTER);
    set_resizable(false);

    Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
    add(*vbox);

    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    vbox->add(*grid);

    Gtk::Label *label = Gtk::manage(new Gtk::Label());
    grid->attach(*label,0,0,2,1);
    Gtk::Entry *bvalue = Gtk::manage(new Gtk::Entry());
    grid->attach(*bvalue, 2, 0, 2, 1);

    Gtk::Button *rotatec = Gtk::manage(new Gtk::Button("Rotate Clockwise 90"));
    Gtk::Button *rotatea = Gtk::manage(new Gtk::Button("Rotate AntiClockwise 90"));
    rotatec->signal_clicked().connect(sigc::mem_fun(*this,&dialog::on_click_rotatec_button));
    rotatea->signal_clicked().connect(sigc::mem_fun(*this,&dialog::on_click_rotatea_button));

    switch(i)
    {
        case 1: set_title("Give Brightness Value between -255 and 255");
                label->set_text("Brightness Value Change By : ");
                bvalue->set_text("10");
                bvalue->set_max_length(4);
                break;
        case 2: set_title("Give index value for blur between 1 and 20");
                label->set_text("Index value of blur :                    ");
                bvalue->set_text("10");
                bvalue->set_max_length(2);
                break;
        case 3: set_title("Give Rotation Angle Value between -360 and 360");
                label->set_text("Rotate Image By (in degrees) :                                   ");
                bvalue->set_text("30");
                bvalue->set_max_length(9);
                grid->attach(*rotatec, 1 ,1, 1, 1);
                grid->attach(*rotatea, 0 ,1, 1, 1);
                break;
        case 4: set_title("Give number of colours between 4 and 16");
                label->set_text("No. of colours in poster :          ");
                bvalue->set_text("4");
                bvalue->set_max_length(2);
                break;
    }
    Gtk::Button *bok = Gtk::manage(new Gtk::Button("OK"));
    bok->signal_clicked().connect(sigc::bind<Gtk::Entry*>(sigc::mem_fun(*this, &dialog::on_bok_click), bvalue,i));
    grid->attach(*bok, 2, 2, 1, 1);

    show_all_children();
}
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);
}
Exemple #12
0
    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();
    }
Exemple #13
0
    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();

    }
Exemple #14
0
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;
}
Exemple #15
0
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;
}
Exemple #16
0
Gobby::StatusBar::MessageHandle
Gobby::StatusBar::add_message(Gobby::StatusBar::MessageType type,
                              const Glib::ustring& message,
                              const Glib::ustring& dialog_message,
                              unsigned int timeout)
{
	if(m_visible_messages >= 12)
	{
		for(MessageHandle iter = m_list.begin();
		    iter != m_list.end();
		    ++iter)
		{
			if(*iter)
			{
				if((*iter)->is_error())
					remove_message(iter);
				else
					// only hide message because whoever
					// installed it is expecting to be
					// able to call remove_message on it
					hide_message(iter);
				break;
			}
		}
	}

	Gtk::Grid* grid = Gtk::manage(new Gtk::Grid());
	grid->set_column_spacing(6);
	grid->set_margin_start(2);
	grid->set_margin_end(2);

	Gtk::Image* image = Gtk::manage(new Gtk::Image);
	image->set_from_icon_name(message_type_to_icon_name(type),
	                          Gtk::ICON_SIZE_MENU);
	grid->attach(*image, 0, 0, 1, 1);
	image->show();

	Gtk::Label* label = Gtk::manage(
		new Gtk::Label(message, Gtk::ALIGN_START));
	label->set_ellipsize(Pango::ELLIPSIZE_END);

	// If we set halign instead, the label will not behave correctly
	// when ellipsized, because then it has always all space around it
	// allocated, and the alignment "jumps" around whin resizing the
	// window due to new characters appearing or disappearing as a result
	// of the ellipsization.
#if GTK_CHECK_VERSION(3, 16, 0)
	gtk_label_set_xalign(label->gobj(), 0.0);
#else
	label->set_alignment(0.0, 0.0);
#endif
	label->show();
	grid->attach(*label, 1, 0, 1, 1);

	Gtk::Frame* frame = Gtk::manage(new Gtk::Frame);

	m_list.push_back(0);
	Gobby::StatusBar::MessageHandle iter(--m_list.end());
	sigc::connection timeout_conn;
	if(timeout)
	{
		timeout_conn = Glib::signal_timeout().connect_seconds(
			sigc::bind(
				sigc::bind_return(
					sigc::mem_fun(
						*this,
						&StatusBar::remove_message),
					false),
				iter),
			timeout);
	}
	*iter = new Message(frame, message, dialog_message, timeout_conn);
	++m_visible_messages;

	if(dialog_message.empty())
	{
		frame->add(*grid);
	}
	else
	{
		Gtk::EventBox *eventbox = Gtk::manage(new Gtk::EventBox);
		frame->add(*eventbox);
		eventbox->add(*grid);
		eventbox->signal_button_press_event().connect(
			sigc::bind_return(sigc::bind(
				sigc::mem_fun(
					*this,
					&StatusBar::on_message_clicked),
				iter), false));

		eventbox->show();
	}

	grid->show();

	// Insert at front
	gtk_grid_attach_next_to(
		gobj(), GTK_WIDGET(frame->gobj()),
		NULL, GTK_POS_LEFT, 1, 1);

	frame->set_halign(Gtk::ALIGN_START);
	frame->set_hexpand(false);
	frame->set_shadow_type(Gtk::SHADOW_NONE);
	frame->show();

	return iter;
}
void dialog::operate3(Image* imag,Gtk::Image *m_image1,int imagestatus1,Gtk::Label* pixlabel)
{
    label =pixlabel;
    im=imag;
    imagestatus=imagestatus1;
    if(imagestatus)
    {
        m_image=m_image1;
    }
    set_default_size(300, 50);
    set_border_width(10);
    set_position(Gtk::WIN_POS_CENTER);
    set_resizable(false);

    Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
    add(*vbox);

    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    vbox->add(*grid);

    set_title("Coordinates of bounding rectangle");
    Gtk::Label *label1 = Gtk::manage(new Gtk::Label("Enter coordinates of initial point  "));
    grid->attach(*label1,0,0,1,1);
    Gtk::Label *label2 = Gtk::manage(new Gtk::Label("Enter coordinates of final point  "));
    grid->attach(*label2,0,1,1,1);
    Gtk::Label *lx1 = Gtk::manage(new Gtk::Label("x:"));
    grid->attach(*lx1,1,0,1,1);
    Gtk::Label *lx2 = Gtk::manage(new Gtk::Label("x:"));
    grid->attach(*lx2,1,1,1,1);
    Gtk::Label *ly1 = Gtk::manage(new Gtk::Label("y:"));
    grid->attach(*ly1,3,0,1,1);
    Gtk::Label *ly2 = Gtk::manage(new Gtk::Label("y:"));
    grid->attach(*ly2,3,1,1,1);

    Gtk::Entry *bx1 = Gtk::manage(new Gtk::Entry());
    grid->attach(*bx1, 2, 0, 1, 1);
    bx1->set_max_length(5);
    bx1->set_text("0");
    Gtk::Entry *bx2 = Gtk::manage(new Gtk::Entry());
    grid->attach(*bx2, 2, 1, 1, 1);
    bx2->set_max_length(5);
    Gtk::Entry *by1 = Gtk::manage(new Gtk::Entry());
    grid->attach(*by1, 4, 0, 1, 1);
    by1->set_max_length(5);
    by1->set_text("0");
    Gtk::Entry *by2 = Gtk::manage(new Gtk::Entry());
    grid->attach(*by2, 4, 1, 1, 1);
    by2->set_max_length(5);

    char c[10];
    sprintf(c,"%d",im->width);
    Glib::ustring s(c);
    bx2->set_text(s);
    sprintf(c,"%d",im->height);
    s=c;
    by2->set_text(s);

    Gtk::Button *bok = Gtk::manage(new Gtk::Button("OK"));
    bok->signal_clicked().connect(sigc::bind<Gtk::Entry*, Gtk::Entry*,Gtk::Entry*,Gtk::Entry*>(sigc::mem_fun(*this, &dialog::on_bok3_click), bx1,bx2,by1,by2));
    grid->attach(*bok, 4, 2, 1, 1);

    show_all_children();
}