From a6b36fb0b0a3dd8421d9aea3da8f5904219504a5 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sat, 8 May 2010 14:53:50 -0600 Subject: [PATCH] fix indenting. --- gui/Player.cpp | 16 +++- gui/gnash.cpp | 5 +- gui/gui.cpp | 268 ++++++++++++++++++++++++++++----------------------------- 3 files changed, 147 insertions(+), 142 deletions(-) diff --git a/gui/Player.cpp b/gui/Player.cpp index 5cc675b9f..497250d5e 100644 --- a/gui/Player.cpp +++ b/gui/Player.cpp @@ -307,11 +307,12 @@ Player::load_movie() return md; } -/* \brief Run, used to open a new flash file. Using previous initialization */ +/// \brief Run, used to open a new flash file. Using previous initialization int Player::run(int argc, char* argv[], const std::string& infile, const std::string& url) { + printf("FIXME: %d\n", __LINE__); // Call this at run() time, so the caller has // a cache of setting some parameter before calling us... @@ -325,6 +326,8 @@ Player::run(int argc, char* argv[], const std::string& infile, _infile = infile; + printf("FIXME: %d\n", __LINE__); + // Work out base url if (_baseurl.empty()) { if (!url.empty()) _baseurl = url; @@ -363,6 +366,8 @@ Player::run(int argc, char* argv[], const std::string& infile, // Set the Renderer resource, opengl, agg, or cairo _runResources->setRenderBackend(_renderer); + printf("FIXME: %d\n", __LINE__); + init_gui(); // Initialize gui (we need argc/argv for this) @@ -393,6 +398,8 @@ Player::run(int argc, char* argv[], const std::string& infile, setScriptableVar(fv->first, fv->second); } } + + printf("FIXME: %d\n", __LINE__); // Load the actual movie. _movieDef = load_movie(); @@ -436,15 +443,16 @@ Player::run(int argc, char* argv[], const std::string& infile, // Register Player to receive FsCommand events from the core. root.registerFSCommandCallback(_callbacksHandler.get()); + gnash::log_debug("Player Host FD #%d, Player Control FD #%d", + _hostfd, _controlfd); + // Set host requests fd (if any) if ( _hostfd != -1 ) { root.setHostFD(_hostfd); } - if (_controlfd != -1) { - // root.setControlFD(_controlfd); - + root.setControlFD(_controlfd); _gui->setFDCallback(_controlfd, boost::bind(&Gui::quit, boost::ref(_gui))); } diff --git a/gui/gnash.cpp b/gui/gnash.cpp index ca8d77805..2c5fced83 100644 --- a/gui/gnash.cpp +++ b/gui/gnash.cpp @@ -338,11 +338,10 @@ parseCommandLine(int argc, char* argv[], gnash::Player& player) } player.setHostFD (hostfd); - if (controlfd < 1) { + if (controlfd < 0) { cerr << boost::format(_("Invalid control communication " "filedescriptor %d\n")) % controlfd << endl; -// exit(EXIT_FAILURE); - controlfd = hostfd + 1; + exit(EXIT_FAILURE); } player.setControlFD (controlfd); } diff --git a/gui/gui.cpp b/gui/gui.cpp index c459e3c82..9f2fa7bbe 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -562,133 +562,129 @@ Gui::notify_key_event(gnash::key::code k, int modifier, bool pressed) { /* Handle GUI shortcuts */ - if (pressed) - { - if (k == gnash::key::ESCAPE) { - if (isFullscreen()) { - _stage->setStageDisplayState(movie_root::DISPLAYSTATE_NORMAL); - } - } - - if (modifier & gnash::key::GNASH_MOD_CONTROL) { - switch (k) - { - case gnash::key::o: - case gnash::key::O: - takeScreenShot(); - break; - case gnash::key::r: - case gnash::key::R: - restart(); - break; - case gnash::key::p: - case gnash::key::P: - pause(); - break; - case gnash::key::l: - case gnash::key::L: - refreshView(); - break; - case gnash::key::q: - case gnash::key::Q: - case gnash::key::w: - case gnash::key::W: - quit(); - break; - case gnash::key::f: - case gnash::key::F: - toggleFullscreen(); - break; - case gnash::key::h: - case gnash::key::H: - showUpdatedRegions(!showUpdatedRegions()); - break; - case gnash::key::MINUS: - { - // Max interval allowed: 1 second (1FPS) - const size_t ni = std::min(_interval + 2, 1000u); - setInterval(ni); - break; - } - case gnash::key::PLUS: - { - // Min interval allowed: 1/100 second (100FPS) - const size_t ni = std::max(_interval - 2, 10u); - setInterval(ni); - break; - } - case gnash::key::EQUALS: - { - if (_stage) { - const float fps = _stage->frameRate(); - // Min interval allowed: 1/100 second (100FPS) - const size_t ni = 1000.0/fps; - setInterval(ni); - } - break; - } - default: - break; - } - + if (pressed) { + if (k == gnash::key::ESCAPE) { + if (isFullscreen()) { + _stage->setStageDisplayState(movie_root::DISPLAYSTATE_NORMAL); + } + } + + if (modifier & gnash::key::GNASH_MOD_CONTROL) { + switch (k) { + case gnash::key::o: + case gnash::key::O: + takeScreenShot(); + break; + case gnash::key::r: + case gnash::key::R: + restart(); + break; + case gnash::key::p: + case gnash::key::P: + pause(); + break; + case gnash::key::l: + case gnash::key::L: + refreshView(); + break; + case gnash::key::q: + case gnash::key::Q: + case gnash::key::w: + case gnash::key::W: + quit(); + break; + case gnash::key::f: + case gnash::key::F: + toggleFullscreen(); + break; + case gnash::key::h: + case gnash::key::H: + showUpdatedRegions(!showUpdatedRegions()); + break; + case gnash::key::MINUS: + { + // Max interval allowed: 1 second (1FPS) + const size_t ni = std::min(_interval + 2, 1000u); + setInterval(ni); + break; + } + case gnash::key::PLUS: + { + // Min interval allowed: 1/100 second (100FPS) + const size_t ni = std::max(_interval - 2, 10u); + setInterval(ni); + break; + } + case gnash::key::EQUALS: + { + if (_stage) { + const float fps = _stage->frameRate(); + // Min interval allowed: 1/100 second (100FPS) + const size_t ni = 1000.0/fps; + setInterval(ni); + } + break; + } + default: + break; + } + #ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS - if ( _keyboardMouseMovements ) - { - int step = _keyboardMouseMovementsStep; + if ( _keyboardMouseMovements ) { + int step = _keyboardMouseMovementsStep; // x5 if SHIFT is pressed - if (modifier & gnash::key::GNASH_MOD_SHIFT) step *= 5; - switch (k) - { - case gnash::key::UP: - { - int newx = _xpointer; - int newy = _ypointer-step; - if ( newy < 0 ) newy=0; - notify_mouse_moved(newx, newy); - break; - } - case gnash::key::DOWN: - { - int newx = _xpointer; - int newy = _ypointer+step; - if ( newy >= _height ) newy = _height-1; - notify_mouse_moved(newx, newy); - break; - } - case gnash::key::LEFT: - { - int newx = _xpointer-step; - int newy = _ypointer; - if ( newx < 0 ) newx = 0; - notify_mouse_moved(newx, newy); - break; - } - case gnash::key::RIGHT: - { - const int newy = _ypointer; - int newx = _xpointer + step; - if ( newx >= _width ) newx = _width-1; - notify_mouse_moved(newx, newy); - break; - } - default: - break; - } - } + if (modifier & gnash::key::GNASH_MOD_SHIFT) step *= 5; + switch (k) { + case gnash::key::UP: + { + int newx = _xpointer; + int newy = _ypointer-step; + if ( newy < 0 ) newy=0; + notify_mouse_moved(newx, newy); + break; + } + case gnash::key::DOWN: + { + int newx = _xpointer; + int newy = _ypointer+step; + if ( newy >= _height ) newy = _height-1; + notify_mouse_moved(newx, newy); + break; + } + case gnash::key::LEFT: + { + int newx = _xpointer-step; + int newy = _ypointer; + if ( newx < 0 ) newx = 0; + notify_mouse_moved(newx, newy); + break; + } + case gnash::key::RIGHT: + { + const int newy = _ypointer; + int newx = _xpointer + step; + if ( newx >= _width ) newx = _width-1; + notify_mouse_moved(newx, newy); + break; + } + default: + break; + } + } #endif // ENABLE_KEYBOARD_MOUSE_MOVEMENTS - } - } - + } + } + if (!_started) return; - + if (_stopped) return; - - if (_stage->notify_key_event(k, pressed)) { - // any action triggered by the - // event required screen refresh - display(_stage); - } - + + if (_stage->notify_key_event(k, pressed)) { + // any action triggered by the + // event required screen refresh + display(_stage); + } + } bool @@ -1148,28 +1144,28 @@ Gui::getMovieInfo() const const DisplayObject* ch; ch = stage.getActiveEntityUnderPointer(); if (ch) { - std::stringstream ss; - ss << ch->getTarget() << " (" + typeName(*ch) - << " - depth:" << ch->get_depth() - << " - useHandCursor:" << ch->allowHandCursor() - << ")"; + std::stringstream ss; + ss << ch->getTarget() << " (" + typeName(*ch) + << " - depth:" << ch->get_depth() + << " - useHandCursor:" << ch->allowHandCursor() + << ")"; firstLevelIter = tr->append_child(topIter, StringPair("Active entity under mouse pointer", ss.str())); } ch = stage.getEntityUnderPointer(); if (ch) { - std::stringstream ss; - ss << ch->getTarget() << " (" + typeName(*ch) - << " - depth:" << ch->get_depth() - << ")"; + std::stringstream ss; + ss << ch->getTarget() << " (" + typeName(*ch) + << " - depth:" << ch->get_depth() + << ")"; firstLevelIter = tr->append_child(topIter, StringPair("Topmost entity under mouse pointer", ss.str())); } - + ch = stage.getDraggingCharacter(); if (ch) { - std::stringstream ss; - ss << ch->getTarget() << " (" + typeName(*ch) - << " - depth:" << ch->get_depth() << ")"; + std::stringstream ss; + ss << ch->getTarget() << " (" + typeName(*ch) + << " - depth:" << ch->get_depth() << ")"; firstLevelIter = tr->append_child(topIter, StringPair("Dragging character: ", ss.str())); } @@ -1333,6 +1329,8 @@ Gui::getQuality() const void Gui::setFDCallback(int fd, boost::function callback) { + log_debug("Setting callback for fd #%d", fd); + _fd_callbacks[fd] = callback; watchFD(fd); -- 2.11.4.GIT