~ubuntu-branches/debian/sid/ember/sid

« back to all changes in this revision

Viewing changes to src/components/ogre/widgets/Widget.cpp

  • Committer: Package Import Robot
  • Author(s): Olek Wojnar, Stephen M. Webb, Olek Wojnar
  • Date: 2016-08-06 18:39:19 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20160806183919-4g72j3flj7xe2stj
Tags: 0.7.2+dfsg-1
[ Stephen M. Webb ]
* debian/control: updated build-depends to newer minimum versions
  (closes: #704786)
* debian/control: updated Standards-Version to 3.9.4 (updated VCS-* fields)
* debian/patches/0001-ember.in-test-expr.patch: removed (fixed upstream)
* debian/patches/0002-add-update_lua_bindings.patch: removed (fixed upstream)
* debian/patches/0003-add-atlas-pkg.patch: removed (fixed upstream)
* debian/patches/0004-domain-bindings-lua-makefile.patch: refreshed
* debian/patches/0005-ember.in-prefix.patch: removed (fixed upstream)
* debian/patches/0006-spellcheck-similiar.patch: removed (fixed upstream)
* debian/patches/0007-revert-libwfut-version.patch: refreshed
* debian/patches/0008-replace-fastdeletegate-with-sigc++.patch: removed
 (fixed upstream)
* debian/patches/0009-spelling-bach.patch: removed (fixed upstream)
* debian/patches/0010-fix-ember-script-args.patch: removed (fixed upstream)
* debian/patches/0011-qualify-template-functions.patch: removed (fixed
  upstream)
* debian/patches/0012-fix-osdir-headers.patch: removed (fixed upstream)
* debian/patches/0013-remove-invalid-linker-flags.patch: removed (fixed
  upstream)
* debian/patches/0014-add-missing-ogrelodstrategy.patch: new
* debian/control: fixed Vcs-Browser URL
* debian/patches/0015-verbose-configure-errors.patch: new
* debian/patches/0016-boost-1.53.patch: new
* debian/control: bump boost build dependeny to 1.53

[ Olek Wojnar ]
* New upstream release (Closes: #799748)
* Add myself as new uploader
  - Remove Stephen Webb per his request
  - Thanks for all the contributions, Stephen!
* d/patches/0007-revert-libwfut-version.patch: removed (unnecessary)
* d/control
  - Remove pre-dependency on dpkg
  - Update standards to 3.9.8 (no changes)
  - Update Vcs lines for secure URIs
* Import patch from the wfmath package to replace MersenneTwister.h
  -- Avoids problems from ambiguous copyright of the original file
* Update dependencies for version 0.7.2
* Enable all hardening options
* Add three lintian overrides
  -- Ignore install into usr/bin (binary)
  -- Ignore .rc files needed for WIN32 build (source)
  -- Ignore false positive of spelling error (binary)
* d/copyright: Update contributors and dates
* d/rules
  -- Do not remove "sounddefinitions" directory
  -- Enable parallel build
  -- Do not install into games directories
  -- Remove dh_builddeb override since xz is now the default
* d/watch: update file extensions
* Remove three patches, add eight patches, update remaining patches
  -- 0004-domain-bindings-lua-makefile.patch (implemented upstream)
  -- 0014-add-missing-ogrelodstrategy.patch (implemented upstream)
  -- 0016-boost-1.53.patch (patch target file removed upstream)
  -- 0018-enable-subdir-objects.patch (Fix automake 1.14 warnings)
  -- 0019-update-boost-m4.patch (Fix invalid boost_major_version)
  -- 0020-remove-obsolete-includes.patch (Fix obsolete includes)
  -- 0021-GraphicalChangeAdapter-fix-for-newer-compilers.patch (Added)
  -- 0022-fix-typos.patch (Fix typos identified by lintian)
  -- 0023-add-keywords-to-desktop-file.patch (Add Keywords to .desktop file)
  -- 0024-fix-icon-location (Make icon location Icon Theme Spec-compliant)
  -- 0025-fix-duplicate-script-install.patch (Was causing build failures)

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "Widget.h"
29
29
 
30
30
#include "../GUIManager.h"
 
31
#include "../EmberOgre.h"
 
32
 
31
33
#include "services/input/Input.h"
32
 
#include "../EmberOgre.h"
33
34
#include "framework/Exception.h"
34
 
 
35
 
#include <CEGUIWindow.h>
36
 
#include <CEGUIExceptions.h>
37
 
#include <CEGUIWindowManager.h>
38
 
#include <elements/CEGUIFrameWindow.h>
39
 
#include <elements/CEGUIPushButton.h>
40
 
 
41
35
#include "framework/ConsoleBackend.h"
42
36
 
 
37
#include <CEGUI/Window.h>
 
38
#include <CEGUI/Exceptions.h>
 
39
#include <CEGUI/WindowManager.h>
 
40
#include <CEGUI/widgets/FrameWindow.h>
 
41
#include <CEGUI/widgets/PushButton.h>
 
42
 
 
43
 
43
44
using namespace CEGUI;
44
45
namespace Ember {
45
46
namespace OgreView {
47
48
 
48
49
        const std::string Widget::DEFAULT_TAB_GROUP("default");
49
50
 
50
 
        Widget::Widget() : mCommandSuffix(""), mMainWindow(0), mActiveWindowIsOpaque(true), mFirstTabWindow(0), mLastTabWindow(0), mWindowHasBeenShown(false)
 
51
        Widget::Widget() : mCommandSuffix(""), mMainWindow(0), mGuiManager(0), mWindowManager(0), mOriginalWindowAlpha(1.0f), mActiveWindowIsOpaque(true), mFirstTabWindow(0), mLastTabWindow(0), mWindowHasBeenShown(false)
51
52
        {
52
53
        }
53
54
 
83
84
                return mGuiManager->getMainSheet();
84
85
        }
85
86
 
86
 
 
87
87
        CEGUI::Window* Widget::loadMainSheet(const std::string& filename, const std::string& prefix) {
88
88
                assert(mWindowManager && "You must call init() before you can call any other methods.");
89
89
                mPrefix = prefix;
90
90
                std::string finalFileName(mGuiManager->getLayoutDir() + filename);
91
91
                try {
92
 
                        mMainWindow = mWindowManager->loadWindowLayout(finalFileName, prefix);
 
92
                        mMainWindow = mWindowManager->loadLayoutFromFile(finalFileName);
93
93
                } catch (const std::exception& ex) {
94
94
                        S_LOG_FAILURE("Error when loading from " << filename << "." << ex);
 
95
                        throw ex;
95
96
                } catch (...) {
96
97
                        S_LOG_FAILURE("Unknown error when loading from " << filename << ".");
97
 
                }
98
 
                if (mMainWindow) {
99
 
                        mOriginalWindowAlpha = mMainWindow->getAlpha();
100
 
                        getMainSheet()->addChildWindow(mMainWindow);
101
 
                        BIND_CEGUI_EVENT(mMainWindow, CEGUI::FrameWindow::EventActivated, Widget::MainWindow_Activated);
102
 
                        BIND_CEGUI_EVENT(mMainWindow, CEGUI::FrameWindow::EventDeactivated, Widget::MainWindow_Deactivated);
103
 
                        //we want to catch all click events, so we'll listen for the mouse button down event
104
 
                        BIND_CEGUI_EVENT(mMainWindow, CEGUI::Window::EventMouseButtonDown, Widget::MainWindow_MouseButtonDown);
105
 
                        if (mMainWindow->isVisible()) {
106
 
                                onEventFirstTimeShown();
107
 
                        } else {
108
 
                                //Set it up to listen for the first time the window is shown.
109
 
                                BIND_CEGUI_EVENT(mMainWindow, CEGUI::Window::EventShown, Widget::MainWindow_Shown);
110
 
                        }
 
98
                        throw;
 
99
                }
 
100
                mMainWindow->setName(prefix);
 
101
                mOriginalWindowAlpha = mMainWindow->getAlpha();
 
102
                getMainSheet()->addChild(mMainWindow);
 
103
                BIND_CEGUI_EVENT(mMainWindow, CEGUI::FrameWindow::EventActivated, Widget::MainWindow_Activated);
 
104
                BIND_CEGUI_EVENT(mMainWindow, CEGUI::FrameWindow::EventDeactivated, Widget::MainWindow_Deactivated);
 
105
                //we want to catch all click events, so we'll listen for the mouse button down event
 
106
                BIND_CEGUI_EVENT(mMainWindow, CEGUI::Window::EventMouseButtonDown, Widget::MainWindow_MouseButtonDown);
 
107
                if (mMainWindow->isVisible()) {
 
108
                        onEventFirstTimeShown();
 
109
                } else {
 
110
                        //Set it up to listen for the first time the window is shown.
 
111
                        BIND_CEGUI_EVENT(mMainWindow, CEGUI::Window::EventShown, Widget::MainWindow_Shown);
 
112
                }
111
113
 
112
 
                }
113
114
                return mMainWindow;
114
115
        }
115
116
 
128
129
                                return 0;
129
130
                        }
130
131
                        assert(mMainWindow && "You must call loadMainSheet(...) before you can call this method.");
131
 
                        CEGUI::Window* window = mWindowManager->getWindow(mPrefix + windowName);
 
132
                        CEGUI::Window* window = mMainWindow->getChildRecursive(windowName);
132
133
                        if (!window) {
133
 
                                S_LOG_WARNING("The window with id " << mPrefix << windowName << " does not exist.");
 
134
                                S_LOG_WARNING("The window with id " << windowName << ", located under widget " << mPrefix << " does not exist.");
134
135
                        }
135
136
                        return window;
136
137
                } catch (const CEGUI::Exception&) {
219
220
        {
220
221
                //removing and attaching the window is probably more efficient when it's hidden (i.e. it won't get any events at all and so on)
221
222
                if (mMainWindow) {
222
 
                        getMainSheet()->addChildWindow(mMainWindow);
 
223
                        getMainSheet()->addChild(mMainWindow);
223
224
                        mMainWindow->setVisible(true);
224
225
                }
225
226
        }
228
229
        {
229
230
                //see comment in show()
230
231
                if (mMainWindow) {
231
 
                        getMainSheet()->removeChildWindow(mMainWindow);
 
232
                        getMainSheet()->removeChild(mMainWindow);
232
233
                        mMainWindow->setVisible(false);
233
234
                }
234
235
        }