From 449d1cadad0ef1f93bf2c552a5b2d51498a220be Mon Sep 17 00:00:00 2001 From: tchernobog Date: Sun, 17 Sep 2006 13:21:21 +0000 Subject: [PATCH] - Let the user jump to instant 0 - Fix adjustment for jumpto in the XML file by hand, since glade3 has a nasty bug about spinbox values git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1226 3ecf2c5c-341e-0410-92b4-d18e462d057c --- glade/main-window.glade | 2 +- src/gui_builder.cc | 2 +- src/jump_to_dialog.cc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glade/main-window.glade b/glade/main-window.glade index d4f9732..5ea3f33 100644 --- a/glade/main-window.glade +++ b/glade/main-window.glade @@ -442,7 +442,7 @@ True True - 0 1 0 1 10 10 + 0 0 inf 1 10 10 1 diff --git a/src/gui_builder.cc b/src/gui_builder.cc index 4fe2f57..d598b98 100644 --- a/src/gui_builder.cc +++ b/src/gui_builder.cc @@ -90,7 +90,7 @@ GuiBuilder::on_simulation_jump_to_clicked() Gtk::SpinButton* jump_to_spin; _refXml->get_widget("BottomHBox.JumpToSpin", jump_to_spin); int target_instant = jump_to_spin->get_value_as_int(); - assert(target_instant > 0); + assert(target_instant >= 0); Glib::RefPtr jump_to_dialog_glade = Xml::create(GLADEDIR "/jump-to-dialog.glade"); JumpToDialog* jump_to_dialog = NULL; diff --git a/src/jump_to_dialog.cc b/src/jump_to_dialog.cc index 6f111d5..62e7a42 100644 --- a/src/jump_to_dialog.cc +++ b/src/jump_to_dialog.cc @@ -76,7 +76,7 @@ JumpToDialog::start() show(); _progress->set_fraction(0.0); - assert(_target_instant > 0); + assert(_target_instant >= 0); Simulation& sim = Simulation::get_instance(); History& h = sim.get_history(); @@ -171,7 +171,7 @@ JumpToDialog::update(const Simulation& changed_simulation) { const unsigned int front = changed_simulation.get_history().get_front(); - const double percent = std::min(static_cast(front) / _target_instant, 1.0); + const double percent = _target_instant == 0 ? 0 : std::min(static_cast(front) / _target_instant, 1.0); _progress->set_fraction(percent);