~ubuntu-branches/debian/squeeze/stella/squeeze

« back to all changes in this revision

Viewing changes to src/gui/ProgressDialog.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Kitt
  • Date: 2010-07-12 23:49:36 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100712234936-juawrr3etzhr2qpv
Tags: 3.1.2-1
* New maintainer (closes: #532039).
* New upstream version (closes: #461121):
  - includes launcher (closes: #396058).
* Fix the reference to the X Window System in the description (closes:
  #411815).
* Move to main, DFSG-free ROMs are available (see README.Debian).
* Enhance the package description.
* Drop the libslang2-dev dependency (closes: #560274).
* Remove the Encoding entry from stella.desktop.
* Avoid ignoring errors when cleaning.
* Add ${misc:Depends} to the package dependencies.
* Provide a doc-base file to install the documentation using doc-base.
* Switch to debhelper 7 with a simplified rules file.
* Use autotools-dev to provide updated configuration files.
* Update to Standards-Version 3.9.0:
  - Move to menu section Applications/Emulators.
  - Move the homepage declaration.
* Re-write the manpage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
//  SS  SS   tt   ee      ll   ll  aa  aa
9
9
//   SSSS     ttt  eeeee llll llll  aaaaa
10
10
//
11
 
// Copyright (c) 1995-2008 by Bradford W. Mott and the Stella team
 
11
// Copyright (c) 1995-2010 by Bradford W. Mott, Stephen Anthony
 
12
// and the Stella Team
12
13
//
13
 
// See the file "license" for information on usage and redistribution of
 
14
// See the file "License.txt" for information on usage and redistribution of
14
15
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
15
16
//
16
 
// $Id: ProgressDialog.cxx,v 1.12 2008/03/14 23:52:17 stephena Exp $
 
17
// $Id: ProgressDialog.cxx 2001 2010-04-10 21:37:23Z stephena $
17
18
//
18
19
//   Based on code from ScummVM - Scumm Interpreter
19
20
//   Copyright (C) 2002-2004 The ScummVM project
30
31
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
31
32
ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
32
33
                               const string& message)
33
 
  : Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16),
 
34
  : Dialog(&boss->instance(), &boss->parent(), 0, 0, 16, 16),
34
35
    myMessage(NULL),
35
36
    mySlider(NULL),
36
37
    myStart(0),
46
47
  lwidth = font.getStringWidth(message);
47
48
  _w = lwidth + 2 * fontWidth;
48
49
  _h = lineHeight * 5;
49
 
  _x = (boss->getWidth() - _w) / 2;
50
 
  _y = (boss->getHeight() - _h) / 2;
51
50
 
52
51
  xpos = fontWidth; ypos = lineHeight;
53
52
  myMessage = new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight,
59
58
  mySlider->setMinValue(1);
60
59
  mySlider->setMaxValue(100);
61
60
 
62
 
  parent()->addDialog(this);
63
 
  instance()->frameBuffer().update();
 
61
  parent().addDialog(this);
64
62
}
65
63
 
66
64
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
69
67
}
70
68
 
71
69
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
72
 
void ProgressDialog::done()
73
 
{
74
 
  parent()->removeDialog();
75
 
}
76
 
 
77
 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
78
70
void ProgressDialog::setMessage(const string& message)
79
71
{
80
72
  myMessage->setLabel(message);
98
90
  if(progress - mySlider->getValue() > myStep)
99
91
  {
100
92
    mySlider->setValue(progress);
101
 
    instance()->frameBuffer().update();
 
93
 
 
94
    // Since this dialog is usually called in a tight loop that doesn't
 
95
    // yield, we need to manually tell the framebuffer that a redraw is
 
96
    // necessary
 
97
    // This isn't really an ideal solution, since all redrawing and
 
98
    // event handling is suspended until the dialog is closed
 
99
    instance().frameBuffer().update();
102
100
  }
103
101
}