1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/background_chooser_dialog.cc Mon Jul 07 08:10:39 2008 -0500
1.3 @@ -0,0 +1,52 @@
1.4 +#include <background_chooser_dialog.h>
1.5 +#include <gtkmm/stock.h>
1.6 +#include <mapstorage.h>
1.7 +
1.8 +BackgroundChooserDialog::BackgroundChooserDialog(MapStorage* ms) :
1.9 + mapstorage(ms),
1.10 + btnClear(Gtk::Stock::CLEAR)
1.11 +{
1.12 + set_has_separator(false);
1.13 +
1.14 + Gtk::VBox* pVBox = get_vbox();
1.15 +
1.16 + lblBackground.set_text("<b>Background image file</b>");
1.17 + lblBackground.set_use_markup();
1.18 + lblBackground.set_alignment(Gtk::ALIGN_LEFT);
1.19 + lblScaling.set_text("<b>Scaling factor</b>");
1.20 + lblScaling.set_use_markup();
1.21 + lblScaling.set_alignment(Gtk::ALIGN_LEFT);
1.22 + fcbBackground.set_width_chars(30);
1.23 + fcbBackground.set_action(Gtk::FILE_CHOOSER_ACTION_OPEN);
1.24 + if (mapstorage->isBackgroundSet())
1.25 + {
1.26 + fcbBackground.set_filename(mapstorage->getBackgroundFilename());
1.27 + }
1.28 +
1.29 + fcbBackground.signal_selection_changed().connect(
1.30 + sigc::mem_fun(*this, &BackgroundChooserDialog::setBackground));
1.31 +
1.32 + btnClear.signal_clicked().connect(
1.33 + sigc::mem_fun(*this, &BackgroundChooserDialog::clearBackground));
1.34 +
1.35 + pVBox->pack_start(lblBackground, Gtk::PACK_SHRINK);
1.36 + pVBox->pack_start(box, Gtk::PACK_SHRINK);
1.37 + box.pack_start(fcbBackground, Gtk::PACK_EXPAND_WIDGET);
1.38 + box.pack_start(btnClear, Gtk::PACK_SHRINK);
1.39 + pVBox->pack_start(lblScaling, Gtk::PACK_SHRINK);
1.40 + pVBox->pack_start(sbScaling, Gtk::PACK_SHRINK);
1.41 +
1.42 + add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
1.43 +
1.44 + show_all_children();
1.45 +}
1.46 +
1.47 +void BackgroundChooserDialog::clearBackground()
1.48 +{
1.49 + fcbBackground.unselect_all();
1.50 +}
1.51 +
1.52 +void BackgroundChooserDialog::setBackground()
1.53 +{
1.54 + mapstorage->setBackground(fcbBackground.get_filename());
1.55 +}