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

« back to all changes in this revision

Viewing changes to src/components/ogre/widgets/representations/TypeManager.lua

  • 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:
1
 
TypeManager = {}
2
 
 
3
 
function TypeManager:buildWidget()
4
 
 
5
 
        self.widget = guiManager:createWidget()
6
 
 
7
 
        local setup = function()
8
 
                
9
 
                self.typeTree = tolua.cast(self.widget:getWindow("TypeList"), "CEGUI::Tree")
10
 
                self.typeTree:subscribeEvent("ItemSelectionChanged", self.TypeList_SelectionChanged, self)
11
 
        
12
 
                self.codecTypeCombobox = CEGUI.toCombobox(self.widget:getWindow("CodecType"))
13
 
                
14
 
                local item = Ember.OgreView.Gui.ColouredListItem:new("XML", 0)
15
 
                self.codecTypeCombobox:addItem(item)
16
 
                item = Ember.OgreView.Gui.ColouredListItem:new("Bach", 1)
17
 
                self.codecTypeCombobox:addItem(item)
18
 
                item = Ember.OgreView.Gui.ColouredListItem:new("Packed", 2)
19
 
                self.codecTypeCombobox:addItem(item)
20
 
                self.codecTypeCombobox:setItemSelectState(0, true)
21
 
                self.codecTypeCombobox:setSingleClickEnabled(true)
22
 
                self.codecTypeCombobox:subscribeEvent("ListSelectionChanged", self.CodecType_ListSelectionChanged, self)
23
 
        
24
 
                
25
 
                self.typeInfoText = CEGUI.toMultiLineEditbox(self.widget:getWindow("TypeInfoText"))
26
 
        
27
 
                self.typeAdapter = Ember.OgreView.Gui.Adapters.Eris.TypeTreeAdapter:new_local(emberServices:getServerService():getConnection():getTypeService(), self.typeTree)
28
 
                self.typeAdapter:initialize("root")
29
 
                
30
 
                self.widget:getWindow("SendToServerButton"):subscribeEvent("Clicked", self.SendToServerButton_Clicked, self)
31
 
                        
32
 
                self.widget:enableCloseButton()
33
 
        end
34
 
 
35
 
        connect(self.connectors, self.widget.EventFirstTimeShown, setup)
36
 
        self.widget:loadMainSheet("TypeManager.layout", "TypeManager/")
37
 
        self.widget:registerConsoleVisibilityToggleCommand("typeManager")
38
 
 
39
 
end
40
 
 
41
 
function TypeManager:CodecType_ListSelectionChanged()
42
 
        local item = self.codecTypeCombobox:getSelectedItem()
43
 
        if item ~= nil then
44
 
                local selectId = item:getID()
45
 
                if selectId == 0 then
46
 
                        self.codecClass = Atlas.Codecs.XML
47
 
                elseif selectId == 1 then
48
 
                        self.codecClass = Atlas.Codecs.Bach
49
 
                else
50
 
                        self.codecClass = Atlas.Codecs.Packed
51
 
                end
52
 
                self:printType()
53
 
        end
54
 
end
55
 
 
56
 
function TypeManager:sendTypeToServer()
57
 
        local outstream = std.stringstream:new_local(self.typeInfoText:getText())
58
 
        local decoder = Ember.OgreView.Authoring.AtlasObjectDecoder:new_local()
59
 
 
60
 
        local codec = self.codecClass:new_local(outstream, tolua.cast(decoder, "Atlas::Bridge"))
61
 
        codec:poll(true)
62
 
        
63
 
        local parsedObject = decoder:getLastObject()
64
 
        
65
 
        if parsedObject:isValid() then
66
 
                --If the type already exists, we need to send a "set" operation, else we need to send a "create" operation
67
 
                if emberServices:getServerService():getConnection():getTypeService():findTypeByName(parsedObject:get():getId()) == nil then
68
 
                        emberServices:getServerService():createTypeInfo(parsedObject)
69
 
                else
70
 
                        emberServices:getServerService():setTypeInfo(parsedObject)
71
 
                end
72
 
        end
73
 
end
74
 
 
75
 
function TypeManager:SendToServerButton_Clicked(args)
76
 
 
77
 
        self:sendTypeToServer()
78
 
        return true
79
 
end
80
 
 
81
 
function TypeManager:printType()
82
 
        local typeInfo = self.typeAdapter:getSelectedTypeInfo()
83
 
        
84
 
        if typeInfo ~= nil then
85
 
        
86
 
                local rawTypeData = self.world:getAuthoringManager():getRawTypeInfoRepository():getRawTypeData(typeInfo:getName())
87
 
        
88
 
                if rawTypeData:isValid() then
89
 
                
90
 
                        local outstream = std.stringstream:new_local()
91
 
                        local decoder = Atlas.Message.QueuedDecoder:new_local()
92
 
                
93
 
                        local codec = self.codecClass:new_local(outstream, tolua.cast(decoder, "Atlas::Bridge"))
94
 
                        local formatter = Atlas.Formatter:new_local(outstream, tolua.cast(codec, "Atlas::Bridge"))
95
 
                        local encoder = Atlas.Message.Encoder:new_local(tolua.cast(formatter, "Atlas::Bridge"))
96
 
                        local message = Atlas.Message.MapType:new_local()
97
 
                        rawTypeData:get():addToMessage(message)
98
 
                        formatter:streamBegin();
99
 
                        encoder:streamMessageElement(message);
100
 
                
101
 
                        formatter:streamEnd();
102
 
                
103
 
                        self.typeInfoText:setText(outstream:str())
104
 
                end
105
 
        end
106
 
end
107
 
 
108
 
function TypeManager:TypeList_SelectionChanged(args)
109
 
 
110
 
        self:printType()
111
 
        return true
112
 
end
113
 
 
114
 
function TypeManager:shutdown()
115
 
        disconnectAll(self.connectors)
116
 
        guiManager:destroyWidget(self.widget)
117
 
end
118
 
 
119
 
TypeManager.createdWorldConnector = createConnector(emberOgre.EventWorldCreated):connect(function(world)
120
 
                typeManager = {connectors={}, codecClass=Atlas.Codecs.XML, world=world}
121
 
                setmetatable(typeManager, {__index = TypeManager})
122
 
                
123
 
                typeManager:buildWidget()
124
 
                connect(typeManager.connectors, emberOgre.EventWorldDestroyed, function()
125
 
                                typeManager:shutdown()
126
 
                                typeManager = nil
127
 
                        end
128
 
                )
129
 
        end
130
 
)
131
 
 
132