1 | /* |
---|
2 | ----------------------------------------------------------------------------- |
---|
3 | This source file is part of OGRE |
---|
4 | (Object-oriented Graphics Rendering Engine) |
---|
5 | For the latest info, see http://www.ogre3d.org/ |
---|
6 | |
---|
7 | Copyright (c) 2000-2006 Torus Knot Software Ltd |
---|
8 | Also see acknowledgements in Readme.html |
---|
9 | |
---|
10 | This program is free software; you can redistribute it and/or modify it under |
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software |
---|
12 | Foundation; either version 2 of the License, or (at your option) any later |
---|
13 | version. |
---|
14 | |
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU Lesser General Public License along with |
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
22 | http://www.gnu.org/copyleft/lesser.txt. |
---|
23 | |
---|
24 | You may alternatively use this source under the terms of a specific version of |
---|
25 | the OGRE Unrestricted License provided you have obtained such a license from |
---|
26 | Torus Knot Software Ltd. |
---|
27 | ----------------------------------------------------------------------------- |
---|
28 | */ |
---|
29 | #include "OgreXSIHelper.h" |
---|
30 | #include <fstream> |
---|
31 | |
---|
32 | namespace Ogre { |
---|
33 | |
---|
34 | //----------------------------------------------------------------------- |
---|
35 | void copyFile(const String& src, const String& dst) |
---|
36 | { |
---|
37 | std::ifstream in(src.c_str(), std::ios::in | std::ios::binary); |
---|
38 | std::ofstream out(dst.c_str(), std::ios::out | std::ios::binary | std::ios::trunc); |
---|
39 | |
---|
40 | if (!in || !out) |
---|
41 | { |
---|
42 | LogOgreAndXSI("Unable to copy texture '" + src + "' to '" + dst + "'"); |
---|
43 | return; |
---|
44 | } |
---|
45 | |
---|
46 | char tmpBuf[2048]; |
---|
47 | |
---|
48 | while (!in.eof()) |
---|
49 | { |
---|
50 | in.read(tmpBuf, 2048); |
---|
51 | |
---|
52 | std::streamsize c = in.gcount(); |
---|
53 | |
---|
54 | out.write(tmpBuf, c); |
---|
55 | |
---|
56 | } |
---|
57 | |
---|
58 | in.close(); |
---|
59 | out.close(); |
---|
60 | |
---|
61 | |
---|
62 | |
---|
63 | } |
---|
64 | //----------------------------------------------------------------------- |
---|
65 | template<> ProgressManager* Singleton<ProgressManager>::ms_Singleton = 0; |
---|
66 | ProgressManager* ProgressManager::getSingletonPtr(void) |
---|
67 | { |
---|
68 | return ms_Singleton; |
---|
69 | } |
---|
70 | ProgressManager& ProgressManager::getSingleton(void) |
---|
71 | { |
---|
72 | assert( ms_Singleton ); return ( *ms_Singleton ); |
---|
73 | } |
---|
74 | //----------------------------------------------------------------------------- |
---|
75 | ProgressManager::ProgressManager(size_t numberOfStages) |
---|
76 | :mNumberOfStages(numberOfStages), mProgress(0) |
---|
77 | { |
---|
78 | XSI::Application app; |
---|
79 | |
---|
80 | mProgressBar = app.GetUIToolkit().GetProgressBar(); |
---|
81 | mProgressBar.PutMaximum(numberOfStages); |
---|
82 | mProgressBar.PutStep(1); |
---|
83 | mProgressBar.PutVisible(true); |
---|
84 | mProgressBar.PutCaption(L"Exporting"); |
---|
85 | } |
---|
86 | //----------------------------------------------------------------------------- |
---|
87 | ProgressManager::~ProgressManager() |
---|
88 | { |
---|
89 | } |
---|
90 | //----------------------------------------------------------------------------- |
---|
91 | void ProgressManager::progress(void) |
---|
92 | { |
---|
93 | ++mProgress; |
---|
94 | mProgressBar.Increment(); |
---|
95 | |
---|
96 | } |
---|
97 | |
---|
98 | } |
---|