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();
}
Beispiel #2
0
void CircuitWidget::edit_line_label (uint32_t line)
{
    if(!circuit) {
        return;
    }
    Gtk::Dialog enterLabel("Enter Label");
    enterLabel.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    enterLabel.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
    enterLabel.set_default_response(Gtk::RESPONSE_OK);
    Gtk::Entry labelEntry;
    labelEntry.set_activates_default();
    labelEntry.set_max_length(5000);
    labelEntry.show();
    enterLabel.get_vbox()->pack_start(labelEntry,Gtk::PACK_SHRINK);
    int result = enterLabel.run();
    if (result == Gtk::RESPONSE_OK
            && std::string(labelEntry.get_text()) != "") {
        if(line >= circuit->numLines()) {
            Line & l = circuit->getLineModify(line - circuit->numLines());
            l.outLabel = labelEntry.get_text();
        } else {
            Line & l = circuit->getLineModify(line);
            l.lineName = labelEntry.get_text();
            l.constant = false;
        }
        size_changed = true;
        force_redraw();
    }
}
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();
}