- 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
This commit is contained in:
tchernobog 2006-09-17 13:21:21 +00:00
parent 76b33d4269
commit 449d1cadad
3 changed files with 4 additions and 4 deletions

View File

@ -442,7 +442,7 @@
<widget class="GtkSpinButton" id="BottomHBox.JumpToSpin"> <widget class="GtkSpinButton" id="BottomHBox.JumpToSpin">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="adjustment">0 1 0 1 10 10</property> <property name="adjustment">0 0 inf 1 10 10</property>
<property name="climb_rate">1</property> <property name="climb_rate">1</property>
</widget> </widget>
<packing> <packing>

View File

@ -90,7 +90,7 @@ GuiBuilder::on_simulation_jump_to_clicked()
Gtk::SpinButton* jump_to_spin; Gtk::SpinButton* jump_to_spin;
_refXml->get_widget("BottomHBox.JumpToSpin", jump_to_spin); _refXml->get_widget("BottomHBox.JumpToSpin", jump_to_spin);
int target_instant = jump_to_spin->get_value_as_int(); int target_instant = jump_to_spin->get_value_as_int();
assert(target_instant > 0); assert(target_instant >= 0);
Glib::RefPtr<Xml> jump_to_dialog_glade = Xml::create(GLADEDIR "/jump-to-dialog.glade"); Glib::RefPtr<Xml> jump_to_dialog_glade = Xml::create(GLADEDIR "/jump-to-dialog.glade");
JumpToDialog* jump_to_dialog = NULL; JumpToDialog* jump_to_dialog = NULL;

View File

@ -76,7 +76,7 @@ JumpToDialog::start()
show(); show();
_progress->set_fraction(0.0); _progress->set_fraction(0.0);
assert(_target_instant > 0); assert(_target_instant >= 0);
Simulation& sim = Simulation::get_instance(); Simulation& sim = Simulation::get_instance();
History& h = sim.get_history(); 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 unsigned int front = changed_simulation.get_history().get_front();
const double percent = std::min(static_cast<double>(front) / _target_instant, 1.0); const double percent = _target_instant == 0 ? 0 : std::min(static_cast<double>(front) / _target_instant, 1.0);
_progress->set_fraction(percent); _progress->set_fraction(percent);