[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9735: Simplify gui interface.
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9735: Simplify gui interface. |
Date: |
Sun, 14 Sep 2008 14:05:48 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9735
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Sun 2008-09-14 14:05:48 +0200
message:
Simplify gui interface.
Use C++ for conversion.
modified:
gui/Player.cpp
gui/gui.h
libbase/rc.cpp
libcore/vm/ActionExec.cpp
------------------------------------------------------------
revno: 9733.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Sun 2008-09-14 12:58:19 +0200
message:
Drop commented-out snprintf.
modified:
libcore/vm/ActionExec.cpp
------------------------------------------------------------
revno: 9733.1.4
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Sun 2008-09-14 13:21:42 +0200
message:
Use stringstreams for conversion.
modified:
libbase/rc.cpp
------------------------------------------------------------
revno: 9733.1.5
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Sun 2008-09-14 13:22:11 +0200
message:
Indentation.
modified:
gui/Player.cpp
------------------------------------------------------------
revno: 9733.1.6
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Sun 2008-09-14 13:24:32 +0200
message:
Remove createMenu and setupEvents from the abstract GUI class, as they
are gtk-specific and only called from there. GUIs should be free to
implement their own setup methods in the necessary order.
modified:
gui/gui.h
=== modified file 'gui/Player.cpp'
--- a/gui/Player.cpp 2008-09-12 21:18:45 +0000
+++ b/gui/Player.cpp 2008-09-14 11:22:11 +0000
@@ -191,7 +191,7 @@
Player::init_media()
{
#ifdef SOUND_SDL
- _mediaHandler.reset( new gnash::media::MediaHandlerFfmpeg() );
+ _mediaHandler.reset( new gnash::media::MediaHandlerFfmpeg() );
#elif defined(SOUND_GST)
_mediaHandler.reset( new gnash::media::MediaHandlerGst() );
#else
@@ -454,65 +454,65 @@
{
if (event == "Mouse.hide")
{
- return _gui->showMouse(false) ? "true" : "false";
+ return _gui->showMouse(false) ? "true" : "false";
}
if (event == "Mouse.show")
{
- return _gui->showMouse(true) ? "true" : "false";
+ return _gui->showMouse(true) ? "true" : "false";
}
if (event == "Stage.displayState")
{
- if (arg == "fullScreen") _gui->setFullscreen();
- else if (arg == "normal") _gui->unsetFullscreen();
- return "";
+ if (arg == "fullScreen") _gui->setFullscreen();
+ else if (arg == "normal") _gui->unsetFullscreen();
+ return "";
}
if (event == "Stage.scaleMode" || event == "Stage.align" )
{
- _gui->updateStageMatrix();
- return "";
+ _gui->updateStageMatrix();
+ return "";
}
if (event == "System.capabilities.screenResolutionX")
{
- std::ostringstream ss;
- ss << _gui->getScreenResX();
- return ss.str();
+ std::ostringstream ss;
+ ss << _gui->getScreenResX();
+ return ss.str();
}
if (event == "System.capabilities.screenResolutionY")
{
- std::ostringstream ss;
- ss << _gui->getScreenResY();
- return ss.str();
+ std::ostringstream ss;
+ ss << _gui->getScreenResY();
+ return ss.str();
}
if (event == "System.capabilities.pixelAspectRatio")
{
- std::ostringstream ss;
- // Whether the pp actively limits the precision or simply
- // gets a slightly different result isn't clear.
- ss << std::setprecision(7) << _gui->getPixelAspectRatio();
- return ss.str();
+ std::ostringstream ss;
+ // Whether the pp actively limits the precision or simply
+ // gets a slightly different result isn't clear.
+ ss << std::setprecision(7) << _gui->getPixelAspectRatio();
+ return ss.str();
}
if (event == "System.capabilities.screenDPI")
{
- std::ostringstream ss;
- ss << _gui->getScreenDPI();
- return ss.str();
+ std::ostringstream ss;
+ ss << _gui->getScreenDPI();
+ return ss.str();
}
if (event == "System.capabilities.screenColor")
{
- return _gui->getScreenColor();
+ return _gui->getScreenColor();
}
if (event == "System.capabilities.playerType")
{
- return _gui->isPlugin() ? "PlugIn" : "StandAlone";
+ return _gui->isPlugin() ? "PlugIn" : "StandAlone";
}
log_error(_("Unhandled callback %s with arguments %s"), event, arg);
@@ -616,13 +616,13 @@
// FSCommand allowscale
if (noCaseCompare(command, "allowscale"))
{
- //log_debug("allowscale: %s", args);
+ //log_debug("allowscale: %s", args);
if (noCaseCompare(args, "true")) _gui->allowScale(true);
else
- {
- if (strtol(args.c_str(), NULL, 0)) _gui->allowScale(true);
- else _gui->allowScale(false);
- }
+ {
+ if (strtol(args.c_str(), NULL, 0)) _gui->allowScale(true);
+ else _gui->allowScale(false);
+ }
return;
}
@@ -684,6 +684,6 @@
{
if (_movieDef.get())
{
- log_debug("~Player - _movieDef refcount: %d (1 will be dropped now)",
_movieDef->get_ref_count());
+ log_debug("~Player - _movieDef refcount: %d (1 will be dropped
now)", _movieDef->get_ref_count());
}
}
=== modified file 'gui/gui.h'
--- a/gui/gui.h 2008-08-04 07:57:53 +0000
+++ b/gui/gui.h 2008-09-14 11:24:32 +0000
@@ -122,14 +122,7 @@
///
virtual void quit() { exit(0); }
- /// Create a menu and attach it to our window.
- virtual bool createMenu() = 0;
-
- /// Register event handlers.
- virtual bool setupEvents() = 0;
-
/// Render the current buffer.
-
/// For OpenGL, this means that the front and back buffers are swapped.
virtual void renderBuffer() = 0;
@@ -323,7 +316,6 @@
void menu_quit();
void menu_about();
void menu_play();
- void menu_refresh_view();
void menu_pause();
void menu_stop();
void menu_step_forward();
=== modified file 'libbase/rc.cpp'
--- a/libbase/rc.cpp 2008-09-12 16:20:20 +0000
+++ b/libbase/rc.cpp 2008-09-14 11:21:42 +0000
@@ -183,19 +183,20 @@
}
bool
-RcInitFile::extractNumber(boost::uint32_t &num, const std::string &pattern,
- const std::string &variable, const std::string
&value)
+RcInitFile::extractNumber(boost::uint32_t& num, const std::string& pattern,
+ const std::string& variable, const std::string&
value)
{
-// GNASH_REPORT_FUNCTION;
StringNoCaseEqual noCaseCompare;
if ( noCaseCompare(variable, pattern) ) {
- num = strtoul(value.c_str(), NULL, 0);
- if (static_cast<long>(num) == std::numeric_limits<long>::max()) {
- long long foo = strtoll(value.c_str(), NULL, 0);
- cerr << "RcInitFile::extractNumber: conversion overflow!: " << foo
<< endl;
- }
+ std::istringstream in(value);
+ if (in >> num) return true;
+
+ // If conversion fails, set value to 0 rather than leaving
+ // it as the default.
+ cerr << _("Conversion overflow in extractNumber: ") << value << endl;
+ num = 0;
return true;
}
@@ -242,7 +243,11 @@
StringNoCaseEqual noCaseCompare;
if ( noCaseCompare(variable, pattern) ) {
- out = strtod(value.c_str(), 0);
+ std::istringstream in(value);
+ if (in >> out) return true;
+
+ // If the assignment fails, set the double to 0.
+ out = 0;
return true;
}
=== modified file 'libcore/vm/ActionExec.cpp'
--- a/libcore/vm/ActionExec.cpp 2008-09-01 19:29:50 +0000
+++ b/libcore/vm/ActionExec.cpp 2008-09-14 10:58:19 +0000
@@ -326,9 +326,7 @@
// WARNING: if the movie is stopped, the wall clock continues to
run !
if ( timeLimit && timer.elapsed() > timeLimit )
{
- char buf[256];
- snprintf(buf, 255, _("Script exceeded time limit of %u
milliseconds."), timeLimit);
- throw ActionLimitException(buf);
+ throw ActionLimitException("Script exceeded time limit");
}
#else
if ( pc <= oldPc )
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9735: Simplify gui interface.,
Benjamin Wolsey <=