- Audited some files

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1148 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-09-14 15:10:48 +00:00
parent c78794e27d
commit 90c562006a
7 changed files with 106 additions and 43 deletions

View file

@ -18,8 +18,6 @@
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "gettext.h"
#include "jump_to_dialog.hh"
#include <sgpemv2/templates/sequences.tcc>
@ -28,6 +26,8 @@
#include <sgpemv2/simulation.hh>
#include <sgpemv2/resource.hh>
#include "gettext.h"
#include <gtkmm/button.h>
#include <gtkmm/main.h>
#include <gtkmm/messagedialog.h>
@ -81,8 +81,12 @@ JumpToDialog::start()
Simulation& sim = Simulation::get_instance();
History& h = sim.get_history();
// start listening to simulation updates
sim.attach(*this);
// remember state of notifications for History
bool reenable = h.is_notify_enabled();
try
{
if(_target_instant < h.get_size() - 1)
@ -90,6 +94,8 @@ JumpToDialog::start()
else
sim.jump_to(h.get_size() - 1);
// disable notifications since we could call
// run() a lot of times
h.set_notify_enabled(false);
while(h.get_front() <= _target_instant)
{
@ -167,9 +173,9 @@ JumpToDialog::on_delete_event(GdkEventAny* event)
void
JumpToDialog::update(const Simulation& changed_simulation)
{
unsigned int front = changed_simulation.get_history().get_front();
const unsigned int front = changed_simulation.get_history().get_front();
double percent = std::min(static_cast<double>(front) / _target_instant, 1.0);
const double percent = std::min(static_cast<double>(front) / _target_instant, 1.0);
_progress->set_fraction(percent);