hegyi@1: #include hegyi@1: #include hegyi@1: #include hegyi@1: hegyi@1: BackgroundChooserDialog::BackgroundChooserDialog(MapStorage* ms) : hegyi@1: mapstorage(ms), hegyi@1: btnClear(Gtk::Stock::CLEAR) hegyi@1: { hegyi@1: set_has_separator(false); hegyi@1: hegyi@1: Gtk::VBox* pVBox = get_vbox(); hegyi@1: hegyi@1: lblBackground.set_text("Background image file"); hegyi@1: lblBackground.set_use_markup(); hegyi@1: lblBackground.set_alignment(Gtk::ALIGN_LEFT); hegyi@1: lblScaling.set_text("Scaling factor"); hegyi@1: lblScaling.set_use_markup(); hegyi@1: lblScaling.set_alignment(Gtk::ALIGN_LEFT); hegyi@1: fcbBackground.set_width_chars(30); hegyi@1: fcbBackground.set_action(Gtk::FILE_CHOOSER_ACTION_OPEN); hegyi@1: if (mapstorage->isBackgroundSet()) hegyi@1: { hegyi@1: fcbBackground.set_filename(mapstorage->getBackgroundFilename()); hegyi@1: } hegyi@1: hegyi@1: fcbBackground.signal_selection_changed().connect( hegyi@1: sigc::mem_fun(*this, &BackgroundChooserDialog::setBackground)); hegyi@1: hegyi@1: btnClear.signal_clicked().connect( hegyi@1: sigc::mem_fun(*this, &BackgroundChooserDialog::clearBackground)); hegyi@1: hegyi@1: pVBox->pack_start(lblBackground, Gtk::PACK_SHRINK); hegyi@1: pVBox->pack_start(box, Gtk::PACK_SHRINK); hegyi@1: box.pack_start(fcbBackground, Gtk::PACK_EXPAND_WIDGET); hegyi@1: box.pack_start(btnClear, Gtk::PACK_SHRINK); hegyi@1: pVBox->pack_start(lblScaling, Gtk::PACK_SHRINK); hegyi@1: pVBox->pack_start(sbScaling, Gtk::PACK_SHRINK); hegyi@1: hegyi@1: add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE); hegyi@1: hegyi@1: show_all_children(); hegyi@1: } hegyi@1: hegyi@1: void BackgroundChooserDialog::clearBackground() hegyi@1: { hegyi@1: fcbBackground.unselect_all(); hegyi@1: } hegyi@1: hegyi@1: void BackgroundChooserDialog::setBackground() hegyi@1: { hegyi@1: mapstorage->setBackground(fcbBackground.get_filename()); hegyi@1: }