blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 5
146
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
7
| license_type
stringclasses 2
values | repo_name
stringlengths 6
79
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 4
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.07k
426M
⌀ | star_events_count
int64 0
27
| fork_events_count
int64 0
12
| gha_license_id
stringclasses 3
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 6
values | src_encoding
stringclasses 26
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 20
6.28M
| extension
stringclasses 20
values | content
stringlengths 20
6.28M
| authors
listlengths 1
16
| author_lines
listlengths 1
16
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
246dc7c8e3d8227cc4e875cc99293e6d00cb12db | 580738f96494d426d6e5973c5b3493026caf8b6a | /Include/Vcl/sysopen.h | 5dddd01e527c6e3d345764aadf3c82f18edcd25c | []
| no_license | bravesoftdz/cbuilder-vcl | 6b460b4d535d17c309560352479b437d99383d4b | 7b91ef1602681e094a6a7769ebb65ffd6f291c59 | refs/heads/master | 2021-01-10T14:21:03.726693 | 2010-01-11T11:23:45 | 2010-01-11T11:23:45 | 48,485,606 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 11,307 | h | // SYSOPEN.H: Pascal open array parameter support
// Copyright (c) 1997, 2002 Borland Software Corporation
#if !defined(SYSOPEN_H) // open arrays
#define SYSOPEN_H
#if !defined(SystemHPP)
#error Do not include this file directly. Include 'system.hpp'.
#endif
#pragma option push -w-inl -w-lvc
namespace System
{
template<class T> class OpenArray
{
public:
__fastcall OpenArray(T arg0)
{
Array = new T[Count = 1];
Array[0] = arg0;
}
__fastcall OpenArray(T arg0, T arg1)
{
Array = new T[Count = 2];
Array[0] = arg0;
Array[1] = arg1;
}
__fastcall OpenArray(T arg0, T arg1, T arg2)
{
Array = new T[Count = 3];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3)
{
Array = new T[Count = 4];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4)
{
Array = new T[Count = 5];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5)
{
Array = new T[Count = 6];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6)
{
Array = new T[Count = 7];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6,
T arg7)
{
Array = new T[Count = 8];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
Array[7] = arg7;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6,
T arg7, T arg8)
{
Array = new T[Count = 9];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
Array[7] = arg7;
Array[8] = arg8;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6,
T arg7, T arg8, T arg9)
{
Array = new T[Count = 10];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
Array[7] = arg7;
Array[8] = arg8;
Array[9] = arg9;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6,
T arg7, T arg8, T arg9, T arg10)
{
Array = new T[Count = 11];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
Array[7] = arg7;
Array[8] = arg8;
Array[9] = arg9;
Array[10] = arg10;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6,
T arg7, T arg8, T arg9, T arg10, T arg11)
{
Array = new T[Count = 12];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
Array[7] = arg7;
Array[8] = arg8;
Array[9] = arg9;
Array[10] = arg10;
Array[11] = arg11;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6,
T arg7, T arg8, T arg9, T arg10, T arg11, T arg12)
{
Array = new T[Count = 13];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
Array[7] = arg7;
Array[8] = arg8;
Array[9] = arg9;
Array[10] = arg10;
Array[11] = arg11;
Array[12] = arg12;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6,
T arg7, T arg8, T arg9, T arg10, T arg11, T arg12,
T arg13)
{
Array = new T[Count = 14];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
Array[7] = arg7;
Array[8] = arg8;
Array[9] = arg9;
Array[10] = arg10;
Array[11] = arg11;
Array[12] = arg12;
Array[13] = arg13;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6,
T arg7, T arg8, T arg9, T arg10, T arg11, T arg12,
T arg13, T arg14)
{
Array = new T[Count = 15];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
Array[7] = arg7;
Array[8] = arg8;
Array[9] = arg9;
Array[10] = arg10;
Array[11] = arg11;
Array[12] = arg12;
Array[13] = arg13;
Array[14] = arg14;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6,
T arg7, T arg8, T arg9, T arg10, T arg11, T arg12,
T arg13, T arg14, T arg15)
{
Array = new T[Count = 16];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
Array[7] = arg7;
Array[8] = arg8;
Array[9] = arg9;
Array[10] = arg10;
Array[11] = arg11;
Array[12] = arg12;
Array[13] = arg13;
Array[14] = arg14;
Array[15] = arg15;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6,
T arg7, T arg8, T arg9, T arg10, T arg11, T arg12,
T arg13, T arg14, T arg15, T arg16)
{
Array = new T[Count = 17];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
Array[7] = arg7;
Array[8] = arg8;
Array[9] = arg9;
Array[10] = arg10;
Array[11] = arg11;
Array[12] = arg12;
Array[13] = arg13;
Array[14] = arg14;
Array[15] = arg15;
Array[16] = arg16;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6,
T arg7, T arg8, T arg9, T arg10, T arg11, T arg12,
T arg13, T arg14, T arg15, T arg16, T arg17)
{
Array = new T[Count = 18];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
Array[7] = arg7;
Array[8] = arg8;
Array[9] = arg9;
Array[10] = arg10;
Array[11] = arg11;
Array[12] = arg12;
Array[13] = arg13;
Array[14] = arg14;
Array[15] = arg15;
Array[16] = arg16;
Array[17] = arg17;
}
__fastcall OpenArray(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5, T arg6,
T arg7, T arg8, T arg9, T arg10, T arg11, T arg12,
T arg13, T arg14, T arg15, T arg16, T arg17, T arg18)
{
Array = new T[Count = 19];
Array[0] = arg0;
Array[1] = arg1;
Array[2] = arg2;
Array[3] = arg3;
Array[4] = arg4;
Array[5] = arg5;
Array[6] = arg6;
Array[7] = arg7;
Array[8] = arg8;
Array[9] = arg9;
Array[10] = arg10;
Array[11] = arg11;
Array[12] = arg12;
Array[13] = arg13;
Array[14] = arg14;
Array[15] = arg15;
Array[16] = arg16;
Array[17] = arg17;
Array[18] = arg18;
}
__fastcall OpenArray(const OpenArray& src)
{
Array = new T[Count = src.Count];
for (int i = 0; i < Count; i++)
Array[i] = src.Array[i];
}
__fastcall ~OpenArray() {delete [] Array;}
OpenArray& __fastcall operator =(const OpenArray& rhs);
__fastcall operator T*() {return Array;}
int __fastcall GetHigh() {return Count - 1;}
private:
T* Array;
long Count;
};
template<class T>
OpenArray<T>& __fastcall
OpenArray<T>::operator =(const OpenArray& rhs)
{
if (this != &rhs)
{
Array = new T[Count = rhs.Count];
for (int i = 0; i < Count; i++)
Array[i] = rhs.Array[i];
}
return *this;
}
// Used with OPENARRAY macro (immediately following this template declaration)
#pragma option push -w-par
template<class T> class OpenArrayCount
{
public:
__fastcall OpenArrayCount(T arg0): Count(1) {}
__fastcall OpenArrayCount(T arg0,T arg1): Count(2) {}
__fastcall OpenArrayCount(T arg0,T arg1,T arg2): Count(3) {}
__fastcall OpenArrayCount(T arg0,T arg1,T arg2,T arg3): Count(4) {}
__fastcall OpenArrayCount(T arg0,T arg1,T arg2,T arg3,T arg4): Count(5) {}
__fastcall OpenArrayCount(T arg0,T arg1,T arg2,T arg3,T arg4, T arg5)
: Count(6) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6): Count(7) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6, T arg7): Count(8) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6, T arg7, T arg8): Count(9) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6, T arg7, T arg8, T arg9): Count(10) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6, T arg7, T arg8, T arg9, T arg10): Count(11) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6, T arg7, T arg8, T arg9, T arg10, T arg11): Count(12) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6, T arg7, T arg8, T arg9, T arg10, T arg11, T arg12): Count(13) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6, T arg7, T arg8, T arg9, T arg10, T arg11, T arg12, T arg13)
: Count(14) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6, T arg7, T arg8, T arg9, T arg10, T arg11, T arg12, T arg13,
T arg14): Count(15) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6, T arg7, T arg8, T arg9, T arg10, T arg11, T arg12, T arg13,
T arg14, T arg15): Count(16) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6, T arg7, T arg8, T arg9, T arg10, T arg11, T arg12, T arg13,
T arg14, T arg15, T arg16): Count(17) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6, T arg7, T arg8, T arg9, T arg10, T arg11, T arg12, T arg13,
T arg14, T arg15, T arg16, T arg17): Count(18) {}
__fastcall OpenArrayCount(T arg0, T arg1, T arg2, T arg3, T arg4, T arg5,
T arg6, T arg7, T arg8, T arg9, T arg10, T arg11, T arg12, T arg13,
T arg14, T arg15, T arg16, T arg17, T arg18): Count(19) {}
int __fastcall GetHigh() {return Count - 1;}
private:
long Count;
};
#pragma option pop
// OPENARRAY: construct an OpenArray<type> on the fly
#define OPENARRAY(type, values) \
OpenArray<type>values, OpenArrayCount<type>values.GetHigh()
// ARRAYOFCONST: construct an OpenArray<TVarRec> on the fly
#define ARRAYOFCONST(values) \
OpenArray<TVarRec>values, OpenArrayCount<TVarRec>values.GetHigh()
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
// EXISTINGARRAY: pass an existing array where an open array is expected
#define EXISTINGARRAY(a) (a), ((sizeof(a)/sizeof(a[0]))-1)
// SLICE: pass part of an existing array where an open array is expected
#define SLICE(a, n) (a), (n - 1)
}
#pragma option pop
#endif
| [
"bitscode@7bd08ab0-fa70-11de-930f-d36749347e7b"
]
| [
[
[
1,
400
]
]
]
|
b8ed8c7125cfcf194420c014dc503e90c74a3a22 | 27651c3f5f829bff0720d7f835cfaadf366ee8fa | /QBluetooth/ServiceDiscoverer/Impl/QBtServiceDiscoverer_stub.cpp | d0b0cd1cc92ca2afce155c8756be61d396107b41 | [
"LicenseRef-scancode-warranty-disclaimer"
]
| no_license | cpscotti/Push-Snowboarding | 8883907e7ee2ddb9a013faf97f2d9673b9d0fad5 | cc3cc940292d6d728865fe38018d34b596943153 | refs/heads/master | 2021-05-27T16:35:49.846278 | 2011-07-08T10:25:17 | 2011-07-08T10:25:17 | 1,395,155 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,389 | cpp | /*
* QBtServiceDiscoverer_stub.cpp
*
*
* Author: Ftylitakis Nikolaos
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../QBtServiceDiscoverer_stub.h"
QBtServiceDiscovererPrivate::QBtServiceDiscovererPrivate(QBtServiceDiscoverer* publicClass):
p_ptr(publicClass)
{
}
QBtServiceDiscovererPrivate::~QBtServiceDiscovererPrivate()
{
}
void QBtServiceDiscovererPrivate::DiscoverServicesOnDevice(QBtDevice* targetDevice)
{
return;
}
void QBtServiceDiscovererPrivate::DiscoverSpecificProtocol(
QBtDevice* targetDevice, QBtConstants::ServiceClass uuid)
{
return;
}
void QBtServiceDiscovererPrivate::StopDiscovery()
{
return;
}
QBtService::List QBtServiceDiscovererPrivate::GetSupportedServices()
{
return QBtService::List();
}
bool QBtServiceDiscovererPrivate::IsBusy()
{
return false;
}
| [
"cpscotti@c819a03f-852d-4de4-a68c-c3ac47756727"
]
| [
[
[
1,
56
]
]
]
|
7f251a7ead5cc5bcdde6a20fc05dbc339036fde1 | c9f274dcf30c4a1911e39bc96190a810bb4216bc | /webcrawler/include/webcrawler.h | 921772ce05b98ef719e7169ce1acd6042ebeb77f | []
| no_license | beatgammit/cs240 | e88d054b3b9c489dfabc107351ded4a692f47015 | 8acd99469259d5fdb34ad5d43c8c82c02437ac73 | refs/heads/master | 2023-08-31T06:28:02.494209 | 2011-04-12T19:42:26 | 2011-04-12T19:42:26 | 1,467,628 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,671 | h | #ifndef __WEBCRAWLER_H__
#define __WEBCRAWLER_H__
#include "string"
#include <string.h>
#include <iostream>
#include <fstream>
// my headers
#include "keywordindex.h"
#include "pagequeue.h"
#include "pagesparsed.h"
#include "bst.h"
#include "url.h"
#include "htmlparser.h"
#include "xmlprinter.h"
#include "CS240Exception.h"
#include "StringUtil.h"
using namespace std;
/*
* WebCrawler drives the application.
*
* Pages are parsed in the crawl method according to the spec.
* Words found in the stop words data structure are ignored,
* and all others are stored with a page count.
*/
class WebCrawler{
public:
/*
* Default constructor. This initializes the member variables.
*/
WebCrawler();
/*
* Loads the stop words from the given file
*
* @param pFilePath- The path to a file containing the stop words
*/
void loadStopWords(char* pFilePath);
/*
* Main function of this class. This starts the indexing process.
*
* @param pStartURL- the URL to start on
*/
void crawl(string sURL);
/*
* Turns the keyword index generated in the crawl method into XML.
* Should be called after crawl has been finished.
*
* @return XML representing a page index
*/
string toXML();
~WebCrawler();
private:
/* Contains keywords that should be ignored (e.g. of, it, an...) */
string* pStopWords;
/* The number of stopwords */
int iStopWords;
/* Queue of pages yet te be processed */
PageQueue pageQueue;
/* Set of pages that have been processed */
PagesParsed pagesParsed;
/* Set of all of the keywords that have been indexed */
KeywordIndex* pKeyIndex;
string startURL;
};
#endif
| [
"jameson@ubun64-lap.(none)",
"[email protected]"
]
| [
[
[
1,
4
],
[
10,
14
],
[
21,
25
],
[
27,
39
],
[
41,
46
],
[
48,
49
],
[
51,
54
],
[
56,
59
],
[
62,
63
],
[
68,
75
],
[
80,
80
]
],
[
[
5,
9
],
[
15,
20
],
[
26,
26
],
[
40,
40
],
[
47,
47
],
[
50,
50
],
[
55,
55
],
[
60,
61
],
[
64,
67
],
[
76,
79
]
]
]
|
26933b740ea78d737e017d6028b43a0c12411144 | be2e23022d2eadb59a3ac3932180a1d9c9dee9c2 | /NpcServer/NpcKernel/Agent.h | 4366cb72a1be6b677e749bf311dc381f188a5839 | []
| no_license | cronoszeu/revresyksgpr | 78fa60d375718ef789042c452cca1c77c8fa098e | 5a8f637e78f7d9e3e52acdd7abee63404de27e78 | refs/heads/master | 2020-04-16T17:33:10.793895 | 2010-06-16T12:52:45 | 2010-06-16T12:52:45 | 35,539,807 | 0 | 2 | null | null | null | null | GB18030 | C++ | false | false | 7,362 | h |
#pragma once
#include "define.h"
#include "I_MapData.h"
#include "I_Role.h"
#include "mycom.h"
#include "autoptr.h"
#include "timeout.h"
#include "GameObjSet.h"
#include "I_AiCenter.h"
#include "ItemPack.h"
#include "Team.h"
#include "Body.h"
#include "Sense.h"
#include "RoleMove.h"
#include "RoleFight.h"
const int AGENT_VIEW_RANGE = CELLS_PER_VIEW;
//是否自动分配点数
enum {_NOT_AUTOALLOT = 0, _AUTOALLOT = 1};
struct UserInfoStruct
{
OBJID id;
NAMESTR szName;
NAMESTR szMate;
DWORD dwLookface; //int(4) unsigned
DWORD dwHair;
DWORD dwMoney; //int(4) unsigned
UCHAR ucLevel; //tinyint(1) unsigned
int nExp; //int(4) ?? 为什么不用unsigned?
int nPotential;
USHORT usForce; //smallint(2) unsigned
USHORT usConstitution; //smallint(2) unsigned 体质
USHORT usDexterity; //
USHORT usSpeed; //smallint(2) unsigned
USHORT usHealth; //smallint(2) unsigned
USHORT usSoul; //smallint(2) unsigned
USHORT usAdditional_point; //smallint(2) unsigned
UCHAR ucAuto_allot; //tinyint(1) unsigned
USHORT usLife;
USHORT usMaxLife;
USHORT usMana; //smallint(2) unsigned
UCHAR ucProfession; //tinyint(2) unsigned
// int nDeed; //int(4)
SHORT sPk; //smallint(2)
UCHAR ucNobility; //tinyint(1) unsigned
DWORD dwMedal; //int(4) unsigned
DWORD dwMedal_select; //int(4) unsigned
UCHAR ucMetempsychosis; //tinyint(1) unsigned
// other
OBJID idSyndicate; //int(4) unsigned
// OBJID idRecordmap; //int(4)
USHORT usPosX;
USHORT usPosY; //int(4) unsigned
DWORD dwVirtue;
// 玩家临时状态
uint64 i64Effect;
USHORT usEnergy;
USHORT usMaxEnergy;
DWORD dwMonsterType; //? only use for just change mapgroup
DWORD dwMonsterSecs; //? only use for just change mapgroup
};
class Msg;
class CMsgAction;
class CMsgInteract;
class CAgent : INpc, IAiCenterOwner
{
COM_STYLE(CAgent)
protected:
CAgent();
virtual ~CAgent();
public: // interface
template<TYPENAME T>
T* QueryInterface(T** ppT) { if(ppT) *ppT = this; return this; }
virtual void* QueryInterface(int id, void** ppT) { void* p=NULL; if(id==GUID_OF(CAgent)) p=this; if(ppT) *ppT=p; return p; }
DEFINE_QI(IAiCenter, m_pAiCenter)
DEFINE_QI(CSense, m_pSense)
DEFINE_QI(CBody, m_pBody)
DEFINE_QI(CTeam, m_pTeam)
DEFINE_QI(CItemPack, m_pItemPack)
DEFINE_QI(CRoleMove, m_pMove)
DEFINE_QI(CRoleFight, m_pFight)
public: // construction
bool Create(OBJID idAgent, int nTimeOfLife);
bool AppendInfo(const UserInfoStruct& info);
// IRole //////////////////////////////////////////////
virtual IRoleAttr* QueryRoleAttr() { return static_cast<IRoleAttr*>(this); }
virtual CAutoLink<IRole>& QueryLink(const CAutoLink<IRole>&) { return m_lnkThis; }
public: // get info
virtual OBJID GetID() { return m_info.id; }
virtual OBJID GetMapID();
virtual int GetPosX() { return m_pMove->GetPosX(); }
virtual int GetPosY() { return m_pMove->GetPosY(); }
virtual int GetDir() { return m_nDir; }
virtual int GetAttackRange(int nSizeAdd) { return m_pItemPack->GetWeaponRange() + (GetSizeAdd()+nSizeAdd+1)/2; }
virtual int GetSizeAdd() { return m_nSizeAdd; }
virtual bool IsAlive() { return (m_info.i64Effect & KEEPEFFECT_DIE) == 0; }
virtual bool IsFarWeapen() { return 0; }
virtual bool IsEvil() { return (m_info.i64Effect & (KEEPEFFECT_DEEPRED|KEEPEFFECT_CRIME)) != 0; }
virtual bool IsRighteous() { return (m_info.i64Effect & KEEPEFFECT_NOT_VIRTUOUS) == 0; }
virtual bool IsLurker() { return (m_info.i64Effect & (KEEPEFFECT_LURKER | KEEPEFFECT_HIDDEN)) != 0; }
virtual bool IsWing() { return false; } //{ return (m_info.dwEffect & KEEPEFFECT_WING) != 0; }
virtual int Distance(int x, int y) { return __max(abs(x-GetPosX()), abs(y-GetPosY())); }
public: // application
virtual void SetLife(int nData);
virtual void SetPower(int nData);
virtual void SetEffect(uint64 i64Effect);
virtual void SetSizeAdd(int nData) { m_nSizeAdd = nData; }
// INpc //////////////////////////////////////////////
public: // main
virtual void OnTimer();
virtual IRole* QueryRole() { return (IRole*)this; }
public: // fight
virtual void SetDie();
virtual void BeAttack(IRole* pRole);
virtual void BeKill(IRole* pRole);
virtual void AttackOnce();
public: // move
virtual bool SynchroPos(int nSourX, int nSourY, int nTargX, int nTargY);
virtual bool KickBack(int nTargX, int nTargY);
virtual CGameMap* GetMap() { return m_pMove->GetMap(); }
virtual bool IsBlockNpc() { return (GetEffect() & KEEPEFFECT_NOT_BLOCKNPC) == 0; }
public: // others
virtual bool IsActive() { return (GetEffect() & KEEPEFFECT_FREEZE) == 0; }
virtual bool Lock(bool bLock) { m_bLocked = bLock; return true; }
virtual bool IsLocked() { return m_bLocked; }
protected:
bool m_bLocked;
// IAiCenterOwner //////////////////////////////////////////////
virtual bool CheckCondition(bool bLogicNot, int idxFactFunction, VarTypeSetRef setParam, ARGUMENT_SET* psetArgument)
{ return (bLogicNot==0) == (m_pSense->CheckCondition(idxFactFunction, setParam, psetArgument)!=0); }
virtual int Priority2Durable(int nPriority);
/////////////////////////////////////////////////////////////
public: // const
int GetDistance(int x, int y) { return m_pMove->GetDistance(x, y); }
int GetLife() { return m_info.usLife; }
LPCTSTR GetName() { return m_info.szName; }
int GetLookRange() { return AGENT_VIEW_RANGE; }
bool IsCloseTarget(IRole* pRole) { return GetDistance(pRole->GetPosX(), pRole->GetPosY()) <= pRole->GetAttackRange(GetSizeAdd()); }
bool IsLookTarget(IRole* pRole) { return GetDistance(pRole->GetPosX(), pRole->GetPosY()) <= GetLookRange(); }
protected:
int GetMaxLife();
int GetProfessionSort () { return (m_info.ucProfession % 1000) / 10; }
int GetProfessionLevel () { return m_info.ucProfession % 10; }
uint64 GetEffect() { return m_info.i64Effect; }
CTimeOutMS& QueryTime() { return m_tAction; }
public: // application
bool Login(); // send born msg to game server
void TalkToMe(LPCTSTR szSender, LPCTSTR szWords, LPCTSTR szEmotion);
void PrivateTalkToMe(LPCTSTR szSender, LPCTSTR szWords, LPCTSTR szEmotion);
bool SendMsg(Msg* pMsg);
bool SendMsg(LPCTSTR szMsg);
void LoginOK() { ASSERT(m_nStep == STEP_LOGIN); m_nStep = STEP_LOGIN_OK; }
protected:
// void SetPos(int nPosX, int nPosY);
protected:
UserInfoStruct m_info;
int m_nDir;
int m_nTimeOfLife;
CAutoLink<IRole> m_lnkThis;
int m_nSizeAdd;
protected: // obj
CJavaObj<IAiCenter> m_pAiCenter;
CJavaObj<CBody> m_pBody;
CJavaObj<CSense> m_pSense;
CJavaObj<CTeam> m_pTeam;
CJavaObj<CItemPack> m_pItemPack;
CJavaObj<CRoleMove> m_pMove;
CJavaObj<CRoleFight> m_pFight;
protected: // ctrl
enum { STEP_NONE, STEP_OFFLINE, STEP_LOGIN, STEP_LOGIN_OK };
int m_nStep;
// CTimeOut m_tAttack; // keep attack
CTimeOutMS m_tAction;
};
| [
"rpgsky.com@cc92e6ba-efcf-11de-bf31-4dec8810c1c1"
]
| [
[
[
1,
205
]
]
]
|
c9587e1c139e6b241cfbdadf58af240700d059a2 | 3276915b349aec4d26b466d48d9c8022a909ec16 | /c++/运算符重载/整型数组下标越界.cpp | 9e925c7c0b99f749e625b7069ecabdbe3cd07ff9 | []
| no_license | flyskyosg/3dvc | c10720b1a7abf9cf4fa1a66ef9fc583d23e54b82 | 0279b1a7ae097b9028cc7e4aa2dcb67025f096b9 | refs/heads/master | 2021-01-10T11:39:45.352471 | 2009-07-31T13:13:50 | 2009-07-31T13:13:50 | 48,670,844 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 500 | cpp | #include<iostream.h>
#include<stdio.h>
class xiao
{
int *p,n;
public:
xiao(int a[],int m)
{
p=new int[m];n=m;
for(int i=0;i<=9;i++)
p[i]=a[i];
}
xiao (){}
void disp()
{
for(int i=0;i<=9;i++)
cout<<p[i];cout<<endl;
}
int operator [](int m)
{
if(m>n-1)
{cout<<"ϱêÔ½½ç"<<endl;return NULL;}
else return(*(p+m));
}
};
void main()
{
int a[10]={0,1,2,3,4,5,6,7,8,9};
xiao b(a,10);
cout<<b[6]<<endl;
cout<<b[10]<<endl;
}
| [
"[email protected]"
]
| [
[
[
1,
33
]
]
]
|
bfd4adbaa16e37373fdccf0b93c56a683f895bc2 | 78d417d85d69bb498d4dc0ee6e6f24eba83166fb | /FepSetup/src/FepSetupContainer.cpp | cf30926d038c572e6fe73607b4887f6d1c157ca7 | []
| no_license | xubing/tts | 8ae98ead65d232f85bafd47451da3f160f64517c | b5babcb376e54fdb9c999775a329eb297f5d3f8b | refs/heads/master | 2020-12-29T03:30:55.026619 | 2009-09-10T09:53:09 | 2009-09-10T09:53:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,593 | cpp | /*
* ============================================================================
* Name : CFepSetupContainer from FepSetupContainer.h
* Part of : FepSetup
* Created : 06/14/2006 by Forum Nokia
* Version : 2.0
* Copyright: Forum Nokia
* ============================================================================
*/
// INCLUDE FILES
#include "FepSetupContainer.h"
#include <eiklabel.h> // for example label control
#include <f32file.h> // for TParseBase
#include <avkon.hrh>
#include <fepsetup.rsg>
#include "fepsetup.hrh"
#include <AknListQueryDialog.h> // for query dialog
#include <aknnotewrappers.h>
#include <coeutils.h> // for ConeUtils::FileExists
#ifndef __SERIES60_3X__
_LIT( KT9FepFileName, "z:\\system\\fep\\t9fep.fep" );
_LIT( KAknFepFileName, "z:\\system\\fep\\aknfep.fep" );
#else
const TUid KAknFepUid = { 0x101FD65A }; // aknfep Uid
#endif
_LIT( KFepInstalled, "%S Installed!" );
_LIT( KFepUninstalled, "%S Uninstalled!" );
_LIT( KFepAlreadyInstalled, "%S Already Installed!" );
_LIT( KSelectOptions, "Select Options to\nInstall or Uninstall\nFepExample" );
_LIT( KNoFep, "No Fep Selected" );
const TUint KFormatBufSize = 256;
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CFepSetupContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CFepSetupContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
iLabel = new (ELeave) CEikLabel;
iLabel->SetContainerWindowL( *this );
iLabel->SetTextL( KSelectOptions );
iFepSetting = CFepGenericGlobalSettings::NewL(*iEikonEnv,
TFepOnOrOffKeyData(EKeyEnter, EModifierFunc|EModifierShift, EModifierFunc),
TFepOnOrOffKeyData(EKeyEnter, EModifierFunc|EModifierShift, EModifierShift),
EFalse);
#ifndef __SERIES60_3X__ // Series60 1.x/2.x API
iFileNamesOfAvailableFeps = iEikonEnv->FileNamesOfAvailableFepsL();
// Get the number of all Feps available in the system
const TInt numberOfAvailableFeps = iFileNamesOfAvailableFeps->MdcaCount();
// Get the name, including the path, of all the Feps in the system
iNamesOfAvailableFeps = new(ELeave) CDesCArrayFlat(numberOfAvailableFeps+1);
for(TInt i=0; i<numberOfAvailableFeps; i++)
{
// Get name of fep excluding path
iNamesOfAvailableFeps->AppendL(TParsePtrC(iFileNamesOfAvailableFeps->MdcaPoint(i)).Name());
}
#else // Series60 3.x API
// Get available Fep Uids
iEikonEnv->AvailableFepsL( iFepUids, NULL );
iNamesOfAvailableFeps = new(ELeave) CDesCArrayFlat( iFepUids.Count() + 1 );
// Get Fep names also
iEikonEnv->AvailableFepsL( iFepUids, iNamesOfAvailableFeps );
for (int i = 0; i < iFepUids.Count(); ++i) {
TBuf<50> buf;
buf.AppendNum(iFepUids[i].iUid, EHex);
buf.Append(' ');
buf.Append(iNamesOfAvailableFeps->MdcaPoint(i));
RDebug::Print(buf);
}
#endif
SetRect(aRect);
ActivateL();
}
// Destructor
CFepSetupContainer::~CFepSetupContainer()
{
delete iLabel;
delete iFepSetting;
#ifndef __SERIES60_3X__
delete iFileNamesOfAvailableFeps;
#else
iFepUids.Close();
#endif
delete iNamesOfAvailableFeps;
}
// ---------------------------------------------------------
// CFepSetupContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CFepSetupContainer::SizeChanged()
{
// TODO: Add here control resize code etc.
iLabel->SetExtent( TPoint(30,50), iLabel->MinimumSize() );
}
// ---------------------------------------------------------
// CFepSetupContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CFepSetupContainer::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CFepSetupContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CFepSetupContainer::ComponentControl(TInt aIndex) const
{
switch ( aIndex )
{
case 0:
return iLabel;
default:
return NULL;
}
}
// ---------------------------------------------------------
// CFepSetupContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CFepSetupContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
// TODO: Add your drawing code here
// example code...
gc.SetPenStyle(CGraphicsContext::ENullPen);
gc.SetBrushColor(KRgbGray);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(aRect);
}
// ---------------------------------------------------------
// CFepSetupContainer::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CFepSetupContainer::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
// TODO: Add your control event handler code here
}
// ---------------------------------------------------------
// CFepSetupContainer::InstallFepL
// ---------------------------------------------------------
//
void CFepSetupContainer::InstallFepL()
{
TBuf<KFormatBufSize> formatingBuf;
TInt index( 0 );
CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &index );
dlg->PrepareLC( R_FEPSETUP_LIST_QUERY );
dlg->SetItemTextArray( iNamesOfAvailableFeps );
dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
// Execute the dialog
TInt answer = dlg->RunLD();
if( answer == EAknSoftkeyOk )
{
#ifndef __SERIES60_3X__ // Series60 1.x/2.x API
iEikonEnv->InfoMsg( TParsePtrC( iFileNamesOfAvailableFeps->MdcaPoint( index )).Name());
// The code below is to check whether the selected Fep is already installed.
HBufC* fepToInstall = iFileNamesOfAvailableFeps->MdcaPoint( index ).AllocL();
CleanupStack::PushL( fepToInstall );
TPtr fepToInstallPtr( fepToInstall->Des() );
fepToInstallPtr.LowerCase(); // remove case-sensitivity
TPtrC fepToInstallPtrC( TParsePtrC( fepToInstallPtr ).Name()); // file name parsing
HBufC* currentFep = iCoeEnv->NameOfInstalledFepL();
CleanupStack::PushL( currentFep );
TPtr currentFepPtr( currentFep->Des() );
currentFepPtr.LowerCase(); // remove case-sensitivity
TPtrC currentFepPtrC( TParsePtrC( currentFepPtr ).Name()); // file name parsing
if( fepToInstallPtrC.Compare( currentFepPtrC ) == 0) // Already installed?
{
formatingBuf.Format( KFepAlreadyInstalled, &fepToInstallPtrC );
}
else
{
// Loads the specified FEP DLL into all running applications.
// The current loaded FEP, if any, will be unloaded.
iCoeEnv->InstallFepL( iFileNamesOfAvailableFeps->MdcaPoint( index ));
formatingBuf.Format( KFepInstalled, &fepToInstallPtrC );
}
CAknConfirmationNote* confirmationDialog = new(ELeave)CAknConfirmationNote();
confirmationDialog->ExecuteLD( formatingBuf );
CleanupStack::PopAndDestroy( 2 ); // currentFep, fepToInstall;
#else // Series60 3.x API
TPtrC fepToInstallPtr( TParsePtrC( iNamesOfAvailableFeps->MdcaPoint( index )).Name()); // file name parsing
iEikonEnv->InfoMsg( fepToInstallPtr );
// The code below is to check whether the selected Fep is already installed.
TUid fepToInstallUid = iFepUids[index];
TUid currentFepUid = iEikonEnv->FepUid();
if( currentFepUid == fepToInstallUid )
{
formatingBuf.Format( KFepAlreadyInstalled, &fepToInstallPtr );
}
else
{
// Loads the specified FEP DLL into all running applications.
// The current loaded FEP, if any, will be unloaded.
iCoeEnv->InstallFepL( fepToInstallUid );
formatingBuf.Format( KFepInstalled, &fepToInstallPtr );
}
CAknConfirmationNote* confirmationDialog = new(ELeave)CAknConfirmationNote();
confirmationDialog->ExecuteLD( formatingBuf );
#endif
}
else
{
iEikonEnv->InfoMsg( KNoFep );
}
}
// ---------------------------------------------------------
// CFepSetupContainer::UnInstallFepL
// ---------------------------------------------------------
//
void CFepSetupContainer::UnInstallFepL()
{
TBuf<KFormatBufSize> formatingBuf;
#ifndef __SERIES60_3X__ // Series60 1.x/2.x API
HBufC* currentFep = iCoeEnv->NameOfInstalledFepL();
CleanupStack::PushL( currentFep );
TPtr currentFepPtr( currentFep->Des() );
currentFepPtr.LowerCase(); // remove case-sensitivity
TPtrC currentFepPtrC( TParsePtrC( currentFepPtr ).Name()); // file name parsing
if( ConeUtils::FileExists( KAknFepFileName )) // 2ndfp2 platform and newer use aknfep.fep
{
if( currentFepPtrC.Compare( TParsePtrC( KAknFepFileName ).Name() ) != 0 ) // Already installed?
{
iCoeEnv->InstallFepL( KAknFepFileName ); // Install the default Fep
formatingBuf.Format( KFepUninstalled, ¤tFepPtrC );
}
else
{
formatingBuf.Format( KFepAlreadyInstalled, ¤tFepPtrC );
}
}
else // older platforms use T9fep.fep
{
if( currentFepPtrC.Compare( TParsePtrC( KT9FepFileName ).Name() ) != 0 ) // Already installed?
{
iCoeEnv->InstallFepL( KT9FepFileName ); // Install the default Fep
formatingBuf.Format( KFepUninstalled, ¤tFepPtrC );
}
else
{
formatingBuf.Format( KFepAlreadyInstalled, ¤tFepPtrC );
}
}
CAknConfirmationNote* dialog = new(ELeave)CAknConfirmationNote();
dialog->ExecuteLD( formatingBuf );
CleanupStack::PopAndDestroy(); // currentFep
#else // Series60 3.x API
TUid currentFepUid = iEikonEnv->FepUid();
TInt defaultIndex = iFepUids.Find( KAknFepUid );
TPtrC defaultFepPtr( TParsePtrC( iNamesOfAvailableFeps->MdcaPoint( defaultIndex )).Name()); // file name parsing
if( currentFepUid == KAknFepUid ) // Already installed?
{
formatingBuf.Format( KFepAlreadyInstalled, &defaultFepPtr );
}
else
{
iCoeEnv->InstallFepL( KAknFepUid ); // Install the default Fep
formatingBuf.Format( KFepInstalled, &defaultFepPtr );
}
CAknConfirmationNote* confirmationDialog = new(ELeave)CAknConfirmationNote();
confirmationDialog->ExecuteLD( formatingBuf );
#endif
}
// End of File
| [
"[email protected]"
]
| [
[
[
1,
318
]
]
]
|
c2706f5358e483231d56177c7d89a6009986afee | b2d46af9c6152323ce240374afc998c1574db71f | /cursovideojuegos/theflostiproject/3rdParty/boost/libs/serialization/test/test_non_intrusive.cpp | 75a68696f66348a1235ff63d38529c44a4995d7a | []
| no_license | bugbit/cipsaoscar | 601b4da0f0a647e71717ed35ee5c2f2d63c8a0f4 | 52aa8b4b67d48f59e46cb43527480f8b3552e96d | refs/heads/master | 2021-01-10T21:31:18.653163 | 2011-09-28T16:39:12 | 2011-09-28T16:39:12 | 33,032,640 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,779 | cpp | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// test_non_intrursive.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// should pass compilation and execution
// this tests:
// a) non-intrusive method of implementing serialization
// b) usage of a non-default constructor
#include <fstream>
#include <cstdlib> // for rand(), remove
#include <cmath> // for fabs()
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::rand;
using ::fabs;
using ::remove;
}
#endif
#include <boost/archive/archive_exception.hpp>
#include "test_tools.hpp"
#include "throw_exception.hpp"
///////////////////////////////////////////////////////
// simple class test - using non-intrusive syntax
// illustrates the usage of the non-intrusve syntax
class A
{
public:
signed char s;
unsigned char t;
signed int u;
unsigned int v;
float w;
double x;
A();
bool operator==(const A & rhs) const;
bool operator<(const A & rhs) const;
};
A::A() :
s(std::rand()),
t(std::rand()),
u(std::rand()),
v(std::rand()),
w((float)std::rand() / std::rand()),
x((double)std::rand() / std::rand())
{
}
bool A::operator==(const A &rhs) const
{
return
s == rhs.s
&& t == rhs.t
&& u == rhs.u
&& v == rhs.v
&& std::fabs(w - rhs.w) <= std::numeric_limits<float>::round_error()
&& std::fabs(x - rhs.x) <= std::numeric_limits<float>::round_error()
;
}
bool A::operator<(const A &rhs) const
{
if(! s == rhs.s )
return s < rhs.s;
if(! t == rhs.t )
return t < rhs.t;
if(! u == rhs.u )
return t < rhs.u;
if(! v == rhs.v )
return t < rhs.v;
if(! (std::fabs(w - rhs.w) < std::numeric_limits<float>::round_error() ) )
return t < rhs.w;
if(! (std::fabs(x - rhs.x) < std::numeric_limits<float>::round_error() ) )
return t < rhs.x;
return false;
}
// note the following:
// function specializations must be defined in the appropriate
// namespace - boost::serialization
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
namespace boost { namespace serialization {
#endif
// This first set of overrides should work with all compilers.
// The last argument is int while the default versions
// defined in serialization.hpp have long as the last argument.
// This is part of the work around for compilers that don't
// support correct function template ordering. These functions
// are always called with 0 (i.e. an int) as the last argument.
// Our specialized versions also have int as the last argument
// while the default versions have a long as the last argument.
// This makes our specialized versions a better match than the
// default ones as no argument conversion is required to make a match
template<class Archive>
void serialize(
Archive & ar,
A & a,
const unsigned int /* file_version */
){
ar & boost::serialization::make_nvp("s", a.s);
ar & boost::serialization::make_nvp("t", a.t);
ar & boost::serialization::make_nvp("u", a.u);
ar & boost::serialization::make_nvp("v", a.v);
ar & boost::serialization::make_nvp("w", a.w);
ar & boost::serialization::make_nvp("x", a.x);
}
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
}} // namespace boost::serialization
#endif
void save(const char * testfile){
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os);
A a;
oa << BOOST_SERIALIZATION_NVP(a);
// save a copy pointer to this item
A *pa1 = &a;
oa << BOOST_SERIALIZATION_NVP(pa1);
// save pointer to a new object
A *pa2 = new A();
oa << BOOST_SERIALIZATION_NVP(pa2);
delete pa2;
}
void load(const char * testfile){
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is);
A a;
ia >> BOOST_SERIALIZATION_NVP(a);
A *pa1;
ia >> BOOST_SERIALIZATION_NVP(pa1);
BOOST_CHECK_MESSAGE(pa1 == &a, "Copy of pointer not correctly restored");
A *pa2;
ia >> BOOST_SERIALIZATION_NVP(pa2);
BOOST_CHECK_MESSAGE(pa2 != &a, "Pointer not correctly restored");
delete pa2;
}
int
test_main( int /* argc */, char* /* argv */[] )
{
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_REQUIRE(NULL != testfile);
save(testfile);
load(testfile);
std::remove(testfile);
return boost::exit_success;
}
// EOF
| [
"ohernandezba@71d53fa2-cca5-e1f2-4b5e-677cbd06613a"
]
| [
[
[
1,
171
]
]
]
|
ccf9c2e89f7935e6a14150ba9babc586c16db7bc | d1dc408f6b65c4e5209041b62cd32fb5083fe140 | /src/upgrade/cUpgradeBuilder.h | 71f3f84df08e795c57c839517debae6d2e078092 | []
| no_license | dmitrygerasimuk/dune2themaker-fossfriendly | 7b4bed2dfb2b42590e4b72bd34bb0f37f6c81e37 | 89a6920b216f3964241eeab7cf1a631e1e63f110 | refs/heads/master | 2020-03-12T03:23:40.821001 | 2011-02-19T12:01:30 | 2011-02-19T12:01:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 728 | h | /*
* cUpgradeBuilder.h
*
* Created on: 3-aug-2010
* Author: Stefan
*
*
* Processes upgrades
*/
#ifndef CUPGRADEBUILDER_H_
#define CUPGRADEBUILDER_H_
class cUpgradeBuilder {
public:
cUpgradeBuilder(cPlayer * thePlayer);
~cUpgradeBuilder();
bool isUpgrading(int listId);
void addUpgrade(int listId, cListUpgrade * listUpgrade);
cListUpgrade * getListUpgrade(int listId) { return upgrades[listId]; }
void processUpgrades(); // timer based method that processes upgrades
protected:
private:
// each list has a corresponding upgrade item that is being processed
cListUpgrade * upgrades[LIST_MAX];
cPlayer * player;
};
#endif /* CUPGRADEBUILDER_H_ */
| [
"stefanhen83@52bf4e17-6a1c-0410-83a1-9b5866916151"
]
| [
[
[
1,
37
]
]
]
|
5fc1d5aea3350d2cf4ecb11889728972bfdb37fc | eafa9c8d8ab765faea768c1a89bdeb586d629591 | /Multiplayer Bomberman/AStar.h | c473277f2b6255b5b26d74c9e304e97a1fdd99a9 | []
| no_license | Norcinu/Demo | 1f5ec338ae9de269eb9dbfda7c787271eddfea9c | bf8f61d194b7f1435356a67671772692144ef27c | refs/heads/master | 2020-06-04T00:21:00.729640 | 2011-07-13T20:11:38 | 2011-07-13T20:11:38 | 2,043,916 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,268 | h | #ifndef ASTAR_H
#define ASTAR_H
#include <vector>
#include "maths.h"
class Level;
struct node_t
{
int id;
int parent_id;
int h_score;
int g_score;
math::Vector2 position;
node_t() : id(0), parent_id(0), h_score(0), g_score(0), position() {}
node_t(int id_, int parent_id_, int h_, int g_, math::Vector2 pos) : id(id_),
parent_id(parent_id_), h_score(h_), g_score(g_), position(pos) {}
int FValue() const { return g_score + h_score; }
#ifdef _DEBUG
friend std::ostream& operator<<(std::ostream& os, const node_t& node)
{
return os << node.id << " " << node.parent_id << " " << node.h_score <<
" " << node.g_score << " " << node.position << std::endl;
}
#endif
};
typedef std::vector<node_t>::iterator node_itor;
class AStar
{
public:
AStar();
AStar(Level * l);
~AStar();
int CalculateH(const math::Vector2& pos, const math::Vector2 &dest);
int CalculateG(const math::Vector2& pos, const math::Vector2& parent_pos, const int parent_g);
void Search(std::vector<node_t>& path, const math::Vector2& position, const math::Vector2& goal);
private:
Level *level_copy;
std::vector<node_t> open_list;
std::vector<node_t> closed_list;
std::vector<node_t> successors;
};
#endif
| [
"[email protected]"
]
| [
[
[
1,
55
]
]
]
|
5d23b11ba6e82e0bc29d3c13ce85f09eae849745 | f8b364974573f652d7916c3a830e1d8773751277 | /emulator/allegrex/instructions/VNSIN.h | b24b2a644739bab6ec986cebe15e769729b22af8 | []
| no_license | lemmore22/pspe4all | 7a234aece25340c99f49eac280780e08e4f8ef49 | 77ad0acf0fcb7eda137fdfcb1e93a36428badfd0 | refs/heads/master | 2021-01-10T08:39:45.222505 | 2009-08-02T11:58:07 | 2009-08-02T11:58:07 | 55,047,469 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,042 | h | template< > struct AllegrexInstructionTemplate< 0xd01a0000, 0xffff0000 > : AllegrexInstructionUnknown
{
static AllegrexInstructionTemplate &self()
{
static AllegrexInstructionTemplate insn;
return insn;
}
static AllegrexInstruction *get_instance()
{
return &AllegrexInstructionTemplate::self();
}
virtual AllegrexInstruction *instruction(u32 opcode)
{
return this;
}
virtual char const *opcode_name()
{
return "VNSIN";
}
virtual void interpret(Processor &processor, u32 opcode);
virtual void disassemble(u32 address, u32 opcode, char *opcode_name, char *operands, char *comment);
protected:
AllegrexInstructionTemplate() {}
};
typedef AllegrexInstructionTemplate< 0xd01a0000, 0xffff0000 >
AllegrexInstruction_VNSIN;
namespace Allegrex
{
extern AllegrexInstruction_VNSIN &VNSIN;
}
#ifdef IMPLEMENT_INSTRUCTION
AllegrexInstruction_VNSIN &Allegrex::VNSIN =
AllegrexInstruction_VNSIN::self();
#endif
| [
"[email protected]"
]
| [
[
[
1,
41
]
]
]
|
cb0cc8f662bbf5e34a98c55874138877d6185a2a | d54914353e2234161c29c83b41c1097e3a11c0b7 | / talapatram --username ramavorray/Keyboard.h | 2b7a071eb7a33779fe5899f3a2a2e0c80f7ce7b9 | []
| no_license | ramavorray/talapatram | 0f8d81fbe90b2573bd21d030aa62eeec4c8461bc | c7631988b4ccd8a6a12261136af1985432cd38e7 | refs/heads/master | 2016-09-06T00:41:44.288127 | 2009-03-30T21:46:26 | 2009-03-30T21:46:26 | 32,348,799 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,574 | h | /*-----------------------------------
Class: Keyboard
This class is an interface class for displaying keyboard layouts. It takes font information and control variables from
CTalapatramDlg class and displays as an UI. This class holds text data of all languages in Unicode format. Encoding
used to save these files is 'Unicode-Codepage 1200'.
Added in v2.0
Written by: Rama Aravind Vorray, Oct, 2007.
-----------------------------------*/
#pragma once
#include "afxwin.h"
class Keyboard;
class DISP_BOX;
#define MYWM_NOTIFYICON (WM_USER+2)
// CTalapatramDlg dialog
class CTalapatramDlg : public CDialog
{
// Construction
public:
CTalapatramDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CTalapatramDlg();
// Dialog Data
enum { IDD = IDD_TALAPATRAM_DIALOG };
int m_curLang;
CFont m_fontBengali,
m_fontEnglish,
m_fontFarsi,
m_fontFarsi2,
m_fontGujarati,
m_fontGujarati2,
m_fontHindi,
m_fontKannada,
m_fontKannada2,
m_fontMalayalam,
m_fontMalayalam2,
m_fontMarathi,
m_fontPunjabi,
m_fontPunjabi2,
m_fontTamil,
m_fontTamil2,
m_fontTelugu,
m_fontTelugu2,
m_fontTelugu3,
m_fontUrdu,
m_supFont;
bool m_keyboard_flg;
void SetButtonsFonts(CFont *font);
void SetSupButtonsFonts();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
private:
bool m_initHlpFilePath;
CString m_hlpFilePath;
enum consts{NUMLANGS=12};
DISP_BOX *m_dispBox;
Keyboard *m_keyboard;
CString m_langIDs[NUMLANGS];
// string m_langFonts[NUMLANGS];
//CListBox m_langList;
CComboBox m_langList;
HKL m_systemDefaultLang;
HWND m_curWindow;
public:
CString m_langs[NUMLANGS+1];
CString m_langsInTheirLang[NUMLANGS];
afx_msg void OnLbnSelchangeLanglist();
afx_msg void OnEnChangeEditor();
afx_msg void OnEnUpdateEditor();
afx_msg void OnEnSetfocusEditor();
afx_msg void OnBnClickedFonthelper();
afx_msg void OnBnClickedSaveContents();
afx_msg void OnBnClickedDispKeyboard();
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnBnClickedAsterisk();
afx_msg void OnBnClickedSemicolon();
afx_msg void OnBnClickedExclaim();
afx_msg void OnBnClickedQmark();
afx_msg void OnBnClickedColon();
afx_msg void OnBnClickedSapos();
afx_msg void OnBnClickedDapos();
afx_msg void OnBnClickedAbout();
BOOL TrayMessage(DWORD dwMessage);
void PutTextInCurrentWindow(CString text);
void SetCurWindow(HWND curWindow);
CButton m_menuAsterisk;
CButton m_menuSemiColon;
CButton m_menuExclaim;
CButton m_menuQMark;
CButton m_menuColon;
CButton m_menuSApos;
CButton m_menuDApos;
HICON m_iconMenuAsterisk, m_iconMenuSemiColon, m_iconMenuExclaim, m_iconMenuQMark, m_iconMenuColon, m_iconMenuSApos, m_iconMenuDApos;
// virtual BOOL PreTranslateMessage(MSG* pMsg);
afx_msg void OnDestroy();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
protected:
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
};
// Keyboard dialog
class Keyboard : public CDialog
{
DECLARE_DYNAMIC(Keyboard)
public:
Keyboard(CTalapatramDlg *mainDlg, CWnd *pParent = NULL); // standard constructor
virtual ~Keyboard();
int m_curLang;
private:
enum { IDD = IDD_TALAPATRAM_DIALOG1 };
CTalapatramDlg *m_parent;
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
HICON m_hIcon;
// Implementation
protected:
// Generated message map functions
/*virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();*/
DECLARE_MESSAGE_MAP()
public:
void SetButtonsFonts(CFont *font);
void SetSupButtonsFonts(CFont *font);
void SetHindiText();
void SetTeluguText();
void SetEnglishText();
void SetBengaliText();
void SetFarsiText();
void SetGujaratiText();
void SetKannadaText();
void SetMalayalamText();
void SetTamilText();
void SetPunjabiText();
void SetUrduText();
void SetMarathiText();
public:
//string m_langFonts[NUMLANGS];
CButton m_bkSpc;
CButton m_tab;
CButton m_enter;
CButton m_caps;
CButton m_shift1;
CButton m_shift2;
CButton m_ctrl1;
CButton m_reserved;
CButton m_winSpec1;
CButton m_alt;
CButton m_spcBar;
CButton m_altGr;
CButton m_winSpec2;
CButton m_ctrl2;
//CListBox m_langList;
//CComboBox m_langList;
CButton m_bar4;
CButton m_bar1;
CButton m_bar2;
CButton m_bar3;
CButton m_11;
CButton m_12;
CButton m_13;
CButton m_14;
CButton m_21;
CButton m_22;
CButton m_23;
CButton m_24;
CButton m_31;
CButton m_32;
CButton m_33;
CButton m_34;
CButton m_41;
CButton m_42;
CButton m_43;
CButton m_44;
CButton m_51;
CButton m_52;
CButton m_53;
CButton m_54;
CButton m_61;
CButton m_62;
CButton m_63;
CButton m_64;
CButton m_71;
CButton m_72;
CButton m_73;
CButton m_74;
CButton m_81;
CButton m_82;
CButton m_83;
CButton m_84;
CButton m_91;
CButton m_92;
CButton m_93;
CButton m_94;
CButton m_01;
CButton m_02;
CButton m_03;
CButton m_04;
CButton m_undscr1;
CButton m_undscr2;
CButton m_undscr3;
CButton m_undscr4;
CButton m_eq1;
CButton m_eq2;
CButton m_eq3;
CButton m_eq4;
CButton m_q1;
CButton m_q2;
CButton m_q3;
CButton m_q4;
CButton m_w1;
CButton m_w2;
CButton m_w3;
CButton m_w4;
CButton m_e1;
CButton m_e2;
CButton m_e3;
CButton m_e4;
CButton m_r1;
CButton m_r2;
CButton m_r3;
CButton m_r4;
CButton m_t1;
CButton m_t2;
CButton m_t3;
CButton m_t4;
CButton m_y1;
CButton m_y2;
CButton m_y3;
CButton m_y4;
CButton m_u1;
CButton m_u2;
CButton m_u3;
CButton m_u4;
CButton m_i1;
CButton m_i2;
CButton m_i3;
CButton m_i4;
CButton m_o1;
CButton m_o2;
CButton m_o3;
CButton m_o4;
CButton m_p3;
CButton m_p1;
CButton m_p2;
CButton m_p4;
CButton m_lsqbrkt1;
CButton m_lsqbrkt2;
CButton m_lsqbrkt3;
CButton m_lsqbrkt4;
CButton m_rsqbrkt1;
CButton m_rsqbrkt2;
CButton m_rsqbrkt3;
CButton m_rsqbrkt4;
CButton m_a1;
CButton m_a2;
CButton m_a3;
CButton m_a4;
CButton m_s1;
CButton m_s2;
CButton m_s3;
CButton m_s4;
CButton m_d1;
CButton m_d2;
CButton m_d3;
CButton m_d4;
CButton m_f1;
CButton m_f2;
CButton m_f3;
CButton m_f4;
CButton m_g1;
CButton m_g2;
CButton m_g3;
CButton m_g4;
CButton m_h1;
CButton m_h2;
CButton m_h3;
CButton m_h4;
CButton m_j1;
CButton m_j2;
CButton m_j3;
CButton m_j4;
CButton m_k1;
CButton m_k2;
CButton m_k3;
CButton m_k4;
CButton m_l1;
CButton m_l2;
CButton m_l3;
CButton m_l4;
CButton m_semicolon1;
CButton m_semicolon2;
CButton m_semicolon3;
CButton m_semicolon4;
CButton m_apos1;
CButton m_apos2;
CButton m_apos3;
CButton m_apos4;
CButton m_hash1;
CButton m_hash2;
CButton m_hash3;
CButton m_hash4;
CButton m_bslash1;
CButton m_bslash2;
CButton m_bslash3;
CButton m_bslash4;
CButton m_z1;
CButton m_z2;
CButton m_z3;
CButton m_z4;
CButton m_x1;
CButton m_x2;
CButton m_x3;
CButton m_x4;
CButton m_c1;
CButton m_c2;
CButton m_c3;
CButton m_c4;
CButton m_v1;
CButton m_v2;
CButton m_v3;
CButton m_v4;
CButton m_b1;
CButton m_b2;
CButton m_b3;
CButton m_b4;
CButton m_n1;
CButton m_n2;
CButton m_n3;
CButton m_n4;
CButton m_m1;
CButton m_m2;
CButton m_m3;
CButton m_m4;
CButton m_comma1;
CButton m_comma2;
CButton m_comma3;
CButton m_comma4;
CButton m_fstop1;
CButton m_fstop2;
CButton m_fstop3;
CButton m_fstop4;
CButton m_fslash1;
CButton m_fslash2;
CButton m_fslash3;
CButton m_fslash4;
CButton m_qsup, m_wsup, m_esup, m_rsup, m_tsup, m_ysup, m_usup, m_isup, m_osup, m_psup;
CButton m_asup, m_ssup, m_dsup, m_fsup, m_gsup, m_hsup, m_jsup, m_ksup, m_lsup;
CButton m_zsup, m_xsup, m_csup, m_vsup, m_bsup, m_nsup, m_msup;
//DECLARE_MESSAGE_MAP()
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnClose();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnBnClickedSpcbar();
}; | [
"ramavorray@1e59233a-b841-0410-9934-83d5419519a6"
]
| [
[
[
1,
403
]
]
]
|
7f8d0ee713f2c03fd7746e155dbfb3a0118ee69f | 5a05acb4caae7d8eb6ab4731dcda528e2696b093 | /ThirdParty/luabind/luabind/detail/call_function.hpp | de6a9df1150c9a198b3f8ff159d59161bfdd214c | []
| no_license | andreparker/spiralengine | aea8b22491aaae4c14f1cdb20f5407a4fb725922 | 36a4942045f49a7255004ec968b188f8088758f4 | refs/heads/master | 2021-01-22T12:12:39.066832 | 2010-05-07T00:02:31 | 2010-05-07T00:02:31 | 33,547,546 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 17,298 | hpp | // Copyright (c) 2003 Daniel Wallin and Arvid Norberg
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
// OR OTHER DEALINGS IN THE SOFTWARE.
#if !BOOST_PP_IS_ITERATING
#ifndef LUABIND_CALL_FUNCTION_HPP_INCLUDED
#define LUABIND_CALL_FUNCTION_HPP_INCLUDED
#include <luabind/config.hpp>
#include <boost/mpl/if.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/mpl/or.hpp>
#include <boost/preprocessor/repeat.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <luabind/error.hpp>
#include <luabind/detail/convert_to_lua.hpp>
#include <luabind/detail/pcall.hpp>
namespace luabind
{
namespace detail
{
// if the proxy_function_caller returns non-void
template<class Ret, class Tuple>
class proxy_function_caller
{
// friend class luabind::object;
public:
typedef int( *function_t )( lua_State*, int, int );
proxy_function_caller(
lua_State* L
, int params
, function_t fun
, const Tuple args )
: m_state( L )
, m_params( params )
, m_fun( fun )
, m_args( args )
, m_called( false )
{
}
proxy_function_caller( const proxy_function_caller& rhs )
: m_state( rhs.m_state )
, m_params( rhs.m_params )
, m_fun( rhs.m_fun )
, m_args( rhs.m_args )
, m_called( rhs.m_called )
{
rhs.m_called = true;
}
~proxy_function_caller()
{
if ( m_called )
return;
m_called = true;
lua_State* L = m_state;
int top = lua_gettop( L );
push_args_from_tuple<1>::apply( L, m_args );
if ( m_fun( L, boost::tuples::length<Tuple>::value, 0 ) )
{
assert( lua_gettop( L ) == top - m_params + 1 );
#ifndef LUABIND_NO_EXCEPTIONS
throw luabind::error( L );
#else
error_callback_fun e = get_error_callback();
if ( e )
e( L );
assert( 0 && "the lua function threw an error and exceptions are disabled."
" If you want to handle the error you can use luabind::set_error_callback()" );
std::terminate();
#endif
}
// pops the return values from the function call
stack_pop pop( L, lua_gettop( L ) - top + m_params );
}
operator Ret()
{
typename mpl::apply_wrap2<default_policy, Ret, lua_to_cpp>::type converter;
m_called = true;
lua_State* L = m_state;
int top = lua_gettop( L );
push_args_from_tuple<1>::apply( L, m_args );
if ( m_fun( L, boost::tuples::length<Tuple>::value, 1 ) )
{
assert( lua_gettop( L ) == top - m_params + 1 );
#ifndef LUABIND_NO_EXCEPTIONS
throw luabind::error( L );
#else
error_callback_fun e = get_error_callback();
if ( e )
e( L );
assert( 0 && "the lua function threw an error and exceptions are disabled."
" If you want to handle the error you can use luabind::set_error_callback()" );
std::terminate();
#endif
}
// pops the return values from the function call
stack_pop pop( L, lua_gettop( L ) - top + m_params );
#ifndef LUABIND_NO_ERROR_CHECKING
if ( converter.match( L, LUABIND_DECORATE_TYPE( Ret ), -1 ) < 0 )
{
#ifndef LUABIND_NO_EXCEPTIONS
throw cast_failed( L, LUABIND_TYPEID( Ret ) );
#else
cast_failed_callback_fun e = get_cast_failed_callback();
if ( e )
e( L, LUABIND_TYPEID( Ret ) );
assert( 0 && "the lua function's return value could not be converted."
" If you want to handle the error you can use luabind::set_error_callback()" );
std::terminate();
#endif
}
#endif
return converter.apply( L, LUABIND_DECORATE_TYPE( Ret ), -1 );
}
template<class Policies>
Ret operator[]( const Policies& p )
{
typedef typename detail::find_conversion_policy<0, Policies>::type converter_policy;
typename mpl::apply_wrap2<converter_policy, Ret, lua_to_cpp>::type converter;
m_called = true;
lua_State* L = m_state;
int top = lua_gettop( L );
detail::push_args_from_tuple<1>::apply( L, m_args, p );
if ( m_fun( L, boost::tuples::length<Tuple>::value, 1 ) )
{
assert( lua_gettop( L ) == top - m_params + 1 );
#ifndef LUABIND_NO_EXCEPTIONS
throw error( L );
#else
error_callback_fun e = get_error_callback();
if ( e )
e( L );
assert( 0 && "the lua function threw an error and exceptions are disabled."
" If you want to handle the error you can use luabind::set_error_callback()" );
std::terminate();
#endif
}
// pops the return values from the function call
stack_pop pop( L, lua_gettop( L ) - top + m_params );
#ifndef LUABIND_NO_ERROR_CHECKING
if ( converter.match( L, LUABIND_DECORATE_TYPE( Ret ), -1 ) < 0 )
{
#ifndef LUABIND_NO_EXCEPTIONS
throw cast_failed( L, LUABIND_TYPEID( Ret ) );
#else
cast_failed_callback_fun e = get_cast_failed_callback();
if ( e )
e( L, LUABIND_TYPEID( Ret ) );
assert( 0 && "the lua function's return value could not be converted."
" If you want to handle the error you can use luabind::set_error_callback()" );
std::terminate();
#endif
}
#endif
return converter.apply( L, LUABIND_DECORATE_TYPE( Ret ), -1 );
}
private:
lua_State* m_state;
int m_params;
function_t m_fun;
Tuple m_args;
mutable bool m_called;
};
// if the proxy_member_caller returns void
template<class Tuple>
class proxy_function_void_caller
{
friend class luabind::object;
public:
typedef int( *function_t )( lua_State*, int, int );
proxy_function_void_caller(
lua_State* L
, int params
, function_t fun
, const Tuple args )
: m_state( L )
, m_params( params )
, m_fun( fun )
, m_args( args )
, m_called( false )
{
}
proxy_function_void_caller( const proxy_function_void_caller& rhs )
: m_state( rhs.m_state )
, m_params( rhs.m_params )
, m_fun( rhs.m_fun )
, m_args( rhs.m_args )
, m_called( rhs.m_called )
{
rhs.m_called = true;
}
~proxy_function_void_caller()
{
if ( m_called )
return;
m_called = true;
lua_State* L = m_state;
int top = lua_gettop( L );
push_args_from_tuple<1>::apply( L, m_args );
if ( m_fun( L, boost::tuples::length<Tuple>::value, 0 ) )
{
assert( lua_gettop( L ) == top - m_params + 1 );
#ifndef LUABIND_NO_EXCEPTIONS
throw luabind::error( L );
#else
error_callback_fun e = get_error_callback();
if ( e )
e( L );
assert( 0 && "the lua function threw an error and exceptions are disabled."
" If you want to handle the error you can use luabind::set_error_callback()" );
std::terminate();
#endif
}
// pops the return values from the function call
stack_pop pop( L, lua_gettop( L ) - top + m_params );
}
template<class Policies>
void operator[]( const Policies& p )
{
m_called = true;
lua_State* L = m_state;
int top = lua_gettop( L );
detail::push_args_from_tuple<1>::apply( L, m_args, p );
if ( m_fun( L, boost::tuples::length<Tuple>::value, 0 ) )
{
assert( lua_gettop( L ) == top - m_params + 1 );
#ifndef LUABIND_NO_EXCEPTIONS
throw error( L );
#else
error_callback_fun e = get_error_callback();
if ( e )
e( L );
assert( 0 && "the lua function threw an error and exceptions are disabled."
" If you want to handle the error you can use luabind::set_error_callback()" );
std::terminate();
#endif
}
// pops the return values from the function call
stack_pop pop( L, lua_gettop( L ) - top + m_params );
}
private:
lua_State* m_state;
int m_params;
function_t m_fun;
Tuple m_args;
mutable bool m_called;
};
}
#define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/detail/call_function.hpp>, 1))
#include BOOST_PP_ITERATE()
}
#endif // LUABIND_CALL_FUNCTION_HPP_INCLUDED
#elif BOOST_PP_ITERATION_FLAGS() == 1
#define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
#define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
template < class Ret BOOST_PP_COMMA_IF( BOOST_PP_ITERATION() ) BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), class A ) >
typename boost::mpl::if_ < boost::is_void<Ret>
, luabind::detail::proxy_function_void_caller < boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > >
, luabind::detail::proxy_function_caller < Ret, boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > > >::type
call_function( lua_State* L, const char* name BOOST_PP_COMMA_IF( BOOST_PP_ITERATION() ) BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _ ) )
{
assert( name && "luabind::call_function() expects a function name" );
typedef boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > tuple_t;
#if BOOST_PP_ITERATION() == 0
tuple_t args;
#else
tuple_t args( BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), &a ) );
#endif
typedef typename boost::mpl::if_ < boost::is_void<Ret>
, luabind::detail::proxy_function_void_caller < boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > >
, luabind::detail::proxy_function_caller < Ret, boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > > >::type proxy_type;
lua_pushstring( L, name );
lua_gettable( L, LUA_GLOBALSINDEX );
return proxy_type( L, 1, &detail::pcall, args );
}
template < class Ret BOOST_PP_COMMA_IF( BOOST_PP_ITERATION() ) BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), class A ) >
typename boost::mpl::if_ < boost::is_void<Ret>
, luabind::detail::proxy_function_void_caller < boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > >
, luabind::detail::proxy_function_caller < Ret, boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > > >::type
call_function( luabind::object const& obj BOOST_PP_COMMA_IF( BOOST_PP_ITERATION() ) BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _ ) )
{
typedef boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > tuple_t;
#if BOOST_PP_ITERATION() == 0
tuple_t args;
#else
tuple_t args( BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), &a ) );
#endif
typedef typename boost::mpl::if_ < boost::is_void<Ret>
, luabind::detail::proxy_function_void_caller < boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > >
, luabind::detail::proxy_function_caller < Ret, boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > > >::type proxy_type;
obj.push( obj.interpreter() );
return proxy_type( obj.interpreter(), 1, &detail::pcall, args );
}
template < class Ret BOOST_PP_COMMA_IF( BOOST_PP_ITERATION() ) BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), class A ) >
typename boost::mpl::if_ < boost::is_void<Ret>
, luabind::detail::proxy_function_void_caller < boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > >
, luabind::detail::proxy_function_caller < Ret, boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > > >::type
resume_function( lua_State* L, const char* name BOOST_PP_COMMA_IF( BOOST_PP_ITERATION() ) BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _ ) )
{
assert( name && "luabind::resume_function() expects a function name" );
typedef boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > tuple_t;
#if BOOST_PP_ITERATION() == 0
tuple_t args;
#else
tuple_t args( BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), &a ) );
#endif
typedef typename boost::mpl::if_ < boost::is_void<Ret>
, luabind::detail::proxy_function_void_caller < boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > >
, luabind::detail::proxy_function_caller < Ret, boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > > >::type proxy_type;
lua_pushstring( L, name );
lua_gettable( L, LUA_GLOBALSINDEX );
return proxy_type( L, 1, &detail::resume_impl, args );
}
template < class Ret BOOST_PP_COMMA_IF( BOOST_PP_ITERATION() ) BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), class A ) >
typename boost::mpl::if_ < boost::is_void<Ret>
, luabind::detail::proxy_function_void_caller < boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > >
, luabind::detail::proxy_function_caller < Ret, boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > > >::type
resume_function( luabind::object const& obj BOOST_PP_COMMA_IF( BOOST_PP_ITERATION() ) BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _ ) )
{
typedef boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > tuple_t;
#if BOOST_PP_ITERATION() == 0
tuple_t args;
#else
tuple_t args( BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), &a ) );
#endif
typedef typename boost::mpl::if_ < boost::is_void<Ret>
, luabind::detail::proxy_function_void_caller < boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > >
, luabind::detail::proxy_function_caller < Ret, boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > > >::type proxy_type;
obj.push( obj.interpreter() );
return proxy_type( obj.interpreter(), 1, &detail::resume_impl, args );
}
template < class Ret BOOST_PP_COMMA_IF( BOOST_PP_ITERATION() ) BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), class A ) >
typename boost::mpl::if_ < boost::is_void<Ret>
, luabind::detail::proxy_function_void_caller < boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > >
, luabind::detail::proxy_function_caller < Ret, boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > > >::type
resume( lua_State* L BOOST_PP_COMMA_IF( BOOST_PP_ITERATION() ) BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _ ) )
{
typedef boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > tuple_t;
#if BOOST_PP_ITERATION() == 0
tuple_t args;
#else
tuple_t args( BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), &a ) );
#endif
typedef typename boost::mpl::if_ < boost::is_void<Ret>
, luabind::detail::proxy_function_void_caller < boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > >
, luabind::detail::proxy_function_caller < Ret, boost::tuples::tuple < BOOST_PP_ENUM( BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _ ) > > >::type proxy_type;
return proxy_type( L, 0, &detail::resume_impl, args );
}
#undef LUABIND_OPERATOR_PARAMS
#undef LUABIND_TUPLE_PARAMS
#endif
| [
"DreLnBrown@e933ee44-1dc6-11de-9e56-bf19dc6c588e"
]
| [
[
[
1,
452
]
]
]
|
d5736edada15dc1931ddae354ba50404b76205c9 | 4b0f51aeecddecf3f57a29ffa7a184ae48f1dc61 | /CleanProject/MyGUI/include/MyGUI_ControllerPosition.h | 802577b1ec0a9beaeea0f52baa31f282385f28a5 | []
| no_license | bahao247/apeengine2 | 56560dbf6d262364fbc0f9f96ba4231e5e4ed301 | f2617b2a42bdf2907c6d56e334c0d027fb62062d | refs/heads/master | 2021-01-10T14:04:02.319337 | 2009-08-26T08:23:33 | 2009-08-26T08:23:33 | 45,979,392 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,640 | h | /*!
@file
@author Evmenov Georgiy
@date 03/2008
@module
*//*
This file is part of MyGUI.
MyGUI is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MyGUI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MYGUI_CONTROLLER_POSITION_H__
#define __MYGUI_CONTROLLER_POSITION_H__
#include "MyGUI_Prerequest.h"
#include "MyGUI_WidgetDefines.h"
#include "MyGUI_ControllerItem.h"
namespace MyGUI
{
/** This controller used for smooth changing position of widget in time */
class MYGUI_EXPORT ControllerPosition : public ControllerItem
{
public:
typedef delegates::CDelegate4<const IntCoord&, const IntCoord&, IntCoord&, float> FrameAction;
public:
typedef enum /*MYGUI_OBSOLETE_START("use : actions from MyGUI::action")*/
{
// OBSOLETE, use MyGUI::newDelegate(action::linearMoveFunction) instead
Linear, //!< Constant speed
// OBSOLETE, use MyGUI::newDelegate(action::acceleratedMoveFunction<30>) instead
Accelerated, //!< Start with zero speed, increasing all time
// OBSOLETE, use MyGUI::newDelegate(action::acceleratedMoveFunction<4>) instead
Slowed, //!< Start with maximum speed, decreasing to zero at the end
// OBSOLETE, use MyGUI::newDelegate(action::inertionalMoveFunction) instead
Inertional //!< Start with zero speed increasing half time and then decreasing to zero
} /*MYGUI_OBSOLETE_END*/ MoveMode;
/**
@param _destRect destination coordinate
@param _time seconds in which widget will reach destination coordinate
@param _mode of moving (see ControllerPosition::MoveMode)
*/
MYGUI_OBSOLETE("use : ControllerPosition(const IntCoord & _destRect, float _time, FrameAction::IDelegate * _action)")
ControllerPosition(const IntCoord & _destRect, float _time, MoveMode _mode);
//! @copydoc ControllerPosition(const IntCoord & _destRect, float _time, MoveMode _mode)
MYGUI_OBSOLETE("use : ControllerPosition(const IntSize & _destSize, float _time, FrameAction::IDelegate * _action)")
ControllerPosition(const IntSize & _destSize, float _time, MoveMode _mode);
//! @copydoc ControllerPosition(const IntCoord & _destRect, float _time, MoveMode _mode)
MYGUI_OBSOLETE("use : ControllerPosition(const IntPoint & _destPoint, float _time, FrameAction::IDelegate * _action)")
ControllerPosition(const IntPoint & _destPoint, float _time, MoveMode _mode);
/**
@param _destRect destination coordinate
@param _time seconds in which widget planned to reach destination coordinate
@param _action applied to widget every frame (see ControllerPosition::eventFrameAction)
*/
ControllerPosition(const IntCoord & _destRect, float _time, FrameAction::IDelegate * _action);
//! @copydoc ControllerPosition(const IntCoord & _destRect, FrameAction::IDelegate * _action)
ControllerPosition(const IntSize & _destSize, float _time, FrameAction::IDelegate * _action);
//! @copydoc ControllerPosition(const IntCoord & _destRect, FrameAction::IDelegate * _action)
ControllerPosition(const IntPoint & _destPoint, float _time, FrameAction::IDelegate * _action);
private:
const std::string & getType();
bool addTime(WidgetPtr _widget, float _time);
void prepareItem(WidgetPtr _widget);
float getElapsedTime() { return mElapsedTime; }
FrameAction::IDelegate * _getAction(MoveMode _mode);
IntCoord mStartRect;
IntCoord mDestRect;
float mTime;
float mElapsedTime;
// controller changing position
bool mCalcPosition;
// controller changing size
bool mCalcSize;
/** Event : Every frame action while controller exist.\n
signature : void method(const IntRect & _startRect, const IntRect & _destRect, IntRect & _result, float _current_time)\n
@param _startRect start coordinate of widget
@param _destRect destination coordinate
@param _result resultRect
@param _current_time elapsed time (_current_time is real elapsed time divided by _time(see constructor) so _current_time == 1 mean that _time seconds elapsed)
*/
FrameAction eventFrameAction;
};
}
#endif // __MYGUI_CONTROLLER_POSITION_H__
| [
"pablosn@06488772-1f9a-11de-8b5c-13accb87f508"
]
| [
[
[
1,
107
]
]
]
|
a9c5745129d3095ed30f04a58ba904c95515b78f | 3e69b159d352a57a48bc483cb8ca802b49679d65 | /trunk/include/gr_basic.h | aa7b718fd3ae545c973c75bba666b1d903441cf4 | []
| no_license | BackupTheBerlios/kicad-svn | 4b79bc0af39d6e5cb0f07556eb781a83e8a464b9 | 4c97bbde4b1b12ec5616a57c17298c77a9790398 | refs/heads/master | 2021-01-01T19:38:40.000652 | 2006-06-19T20:01:24 | 2006-06-19T20:01:24 | 40,799,911 | 0 | 0 | null | null | null | null | IBM852 | C++ | false | false | 7,297 | h | /**************/
/* gr_basic.h */
/**************/
#ifndef GR_BASIC
#define GR_BASIC
#ifndef COMMON_GLOBL
#define COMMON_GLOBL extern
#endif
#include "colors.h"
/* Constantes utiles */
#define GR_COPY 0
#define GR_OR 0x1000000
#define GR_XOR 0x2000000
#define GR_AND 0x4000000
#define GR_NXOR 0x8000000
#define GR_SURBRILL 0x80000000
#define GR_M_LEFT_DOWN 0x10000000
#define GR_M_RIGHT_DOWN 0x20000000
#define GR_M_MIDDLE_DOWN 0x40000000
#define GR_M_DCLICK 0x80000000
/* variables generales */
COMMON_GLOBL int g_XorMode // = GR_XOR ou GR_NXOR selon couleur de fond
#ifdef EDA_BASE // pour les tracÚs en mode XOR
= GR_NXOR
#endif
;
COMMON_GLOBL int g_DrawBgColor // couleur de fond de la frame de dessin
#ifdef EDA_BASE
= WHITE
#endif
;
typedef enum { /* Line styles for Get/SetLineStyle. */
GR_SOLID_LINE = 0,
GR_DOTTED_LINE = 1,
GR_DASHED_LINE = 3
} GRLineStypeType;
typedef enum { /* Line widths for Get/SetLineStyle. */
GR_NORM_WIDTH = 1,
GR_THICK_WIDTH = 3
} GRLineWidthType;
/*******************************************************/
/* Prototypage des fonctions definies dans gr_basic.cc */
/*******************************************************/
int GRMapX(int x);
int GRMapY(int y);
class WinEDA_DrawPanel;
void GRMouseWarp(WinEDA_DrawPanel * panel, const wxPoint& pos); /* positionne la souris au point de coord pos */
/* routines generales */
void GRSetDrawMode(wxDC * DC, int mode);
int GRGetDrawMode(wxDC * DC);
void GRResetPenAndBrush(wxDC * DC);
void GRSetColorPen(wxDC * DC, int Color , int width = 1);
void GRSetBrush(wxDC * DC, int Color , int fill = 0);
void GRForceBlackPen(bool flagforce );
void SetPenMinWidth(int minwidth); /* ajustage de la largeur mini de plume */
void GRLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color);
void GRMixedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color);
void GRSMixedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color);
void GRDashedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color);
void GRSDashedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color);
void GRDashedLineTo(EDA_Rect * ClipBox,wxDC * DC, int x2, int y2, int Color);
void GRSDashedLineTo(EDA_Rect * ClipBox,wxDC * DC, int x2, int y2, int Color);
void GRBusLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color);
void GRSBusLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color);
void GRSLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int Color);
void GRMoveTo(int x, int y);
void GRSMoveTo(int x, int y);
void GRLineTo(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int Color);
void GRBusLineTo(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int Color);
void GRSLineTo(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int Color);
void GRMoveRel(int x, int y);
void GRSMoveRel(int x, int y);
void GRLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int Color);
void GRSLineRel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int Color);
void GRPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Fill, int Color, int BgColor);
void GRPolyLines(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Color, int BgColor, int width);
void GRClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Fill, int Color, int BgColor);
void GRSPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Fill, int Color, int BgColor);
void GRSPolyLines(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Color, int BgColor, int width);
void GRSClosedPoly(EDA_Rect * ClipBox, wxDC * DC, int n, int *Points,
int Fill, int Color, int BgColor);
void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int Color);
void GRCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int width, int Color);
void GRFilledCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r,
int Color, int BgColor);
void GRSCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int Color);
void GRSCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r, int width, int Color);
void GRSFilledCircle(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int r,
int Color, int BgColor);
void GRArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int Color);
void GRArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int width, int Color);
void GRArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2,
int xc, int yc, int Color);
void GRArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2,
int xc, int yc, int width, int Color);
void GRSArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2,
int xc, int yc, int Color);
void GRSArc1(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2,
int xc, int yc, int width, int Color);
void GRSArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int Color);
void GRSArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int StAngle, int EndAngle, int r, int width, int Color);
void GRFilledArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y,
int StAngle, int EndAngle, int r, int Color, int BgColor);
void GRSFilledArc(EDA_Rect * ClipBox, wxDC * DC, int x, int y,
int StAngle, int EndAngle, int r, int Color, int BgColor);
void GRCSegm(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color);
void GRFillCSegm(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color);
void GRSCSegm(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color);
void GRSFillCSegm(EDA_Rect * ClipBox, wxDC * DC,
int x1, int y1, int x2, int y2, int width, int Color);
void GRSetColor(int Color);
void GRSetDefaultPalette(void);
int GRGetColor(void);
void GRPutPixel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int color);
void GRSPutPixel(EDA_Rect * ClipBox, wxDC * DC, int x, int y, int color);
int GRGetPixel(wxDC * DC, int x, int y);
void GRFilledRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1,
int x2, int y2, int Color, int BgColor);
void GRSFilledRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1,
int x2, int y2, int Color, int BgColor);
void GRSFilledRect(EDA_Rect * ClipBox,wxDC * DC, int x1, int y1, int x2, int y2,
int Color, int BgColor);
void GRRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1,
int x2, int y2, int Color);
void GRSRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1,
int x2, int y2, int Color);
/* Routines relatives a l'affichage des textes */
void GRSetFont(wxDC * DC, wxFont * Font);
void GRResetTextFgColor(wxDC * DC);
void GRSetTextFgColor(wxDC * DC, int Color);
void GRSetTextFgColor(wxDC * DC, wxFont * Font, int Color);
int GRGetTextFgColor(wxDC * DC, wxFont * Font);
void GRSetTextBgColor(wxDC * DC, int Color);
void GRSetTextBgColor(wxDC * DC, wxFont * Font, int Color);
int GRGetTextBgColor(wxDC * DC, wxFont * Font);
void GRGetTextExtent(wxDC * DC, const wxChar * Text, long * width, long * height);
#endif /* define GR_BASIC */
| [
"bokeoa@244deca0-f506-0410-ab94-f4f3571dea26"
]
| [
[
[
1,
163
]
]
]
|
53fa771ac4bead8f9157485736a84a1d6461398e | bd72991991f999ffc721e7ff51099312e10bbab3 | /StkUI/MainFrm.cpp | 1452e3655232d3f1324a28e02cc11cfea1bb903a | []
| no_license | alexfordc/my-st-king | 1c36ddc7830817ea007f81f565579a01045b4b8e | 8ffd0df93fb067013abcd808c24c23a068523ab7 | refs/heads/master | 2021-05-31T21:01:12.028462 | 2011-10-03T15:08:12 | 2011-10-03T15:08:12 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 95,912 | cpp | // MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "StkUI.h"
#include "MainFrm.h"
#include "ChildFrm.h"
#include "StaticDoc.h"
#include "View/WizardView.h"
#include "View/SimuView.h"
#include "View/SListView.h"
#include "View/RealTimeView.h"
#include "View/MultiSortView.h"
#include "View/GraphView.h"
#include "View/BaseView.h"
#include "View/InfoView.h"
#include "View/SelectorView.h"
#include "View/StrategyView.h"
#include "View/GroupView.h"
#include "View/TechsView.h"
#include "Dialog/DownloadDlg.h"
#include "Dialog/InstallPacDlg.h"
#include "Dialog/DataSrcDlg.h"
#include "Dialog/SetColumnDlg.h"
#include "Dialog/BaseIndexDlg.h"
#include "Dialog/UpgradeDlg.h"
#include "Dialog/FilterInfoDlg.h"
#include "Dialog/SetGroupDlg.h"
#include "Dialog/SelectGrpDlg.h"
#include "Dialog/SetPrpt.h"
#include "Dialog/SelectStk.h"
#include "Dialog/SetRule.h"
#include "Dialog/SetRate.h"
#include "Dialog/SimuReport.h"
#include "Dialog/SimuRealOp.h"
#include "Dialog/ExportOption.h"
#include "Dialog/ExportDest.h"
#include "Dialog/SetDrdataDlg.h"
#include "Dialog/SetColorDlg.h"
#include "Dialog/NetInfoDlg.h"
#include "Dialog/TyDataDlg.h"
#include "Dialog/SelectTraderDlg.h"
#include "Dialog/SetBaseDlg.h"
#include "Dialog/SetBasedataDlg.h"
#include "Dialog/SetKDataDlg.h"
//#include "Dialog/QuoteTipDlg.h"
//#include "Dialog/AlarmTipDlg.h"
#include "Dialog/AlarmSettingDlg.h"
#include "Dialog/AlarmResultDlg.h"
#include "ParamDlg/SetParamDlg.h"
#include <io.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
// toolbar buttons - IDs are command buttons
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_SEPARATOR, // stock indicator, and progress indicator
ID_SEPARATOR, // stock indicator
ID_SEPARATOR, // time indicator
};
extern TCHAR szRegKeyCompany[];
extern TCHAR szRegKeyApp[];
IMPLEMENT_DYNCREATE(CMainFrame, CTskMainFrame)
BEGIN_MESSAGE_MAP(CMainFrame, CTskMainFrame)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_WM_TIMER()
ON_WM_SIZE()
ON_WM_CLOSE()
ON_WM_INITMENUPOPUP()
ON_COMMAND(ID_MAINBAR_SETTING, OnMainbarSetting)
ON_COMMAND(ID_MAINBAR_VIEW, OnMainbarView)
ON_COMMAND(ID_MAINBAR_TECH, OnMainbarTech)
ON_COMMAND(ID_MAINBAR_PERIOD, OnMainbarPeriod)
ON_COMMAND(ID_SLISTBAR_GROUP, OnSlistbarGroup)
ON_COMMAND(ID_SLISTBAR_DOMAIN, OnSlistbarDomain)
ON_COMMAND(ID_SLISTBAR_CLASS, OnSlistbarClass)
ON_COMMAND(ID_SYS_CONNECTSERVER, OnSysConnectserver)
ON_UPDATE_COMMAND_UI(ID_SYS_CONNECTSERVER, OnUpdateSysConnectserver)
ON_COMMAND(ID_SYS_DISCONNECTSERVER, OnSysDisconnectserver)
ON_UPDATE_COMMAND_UI(ID_SYS_DISCONNECTSERVER, OnUpdateSysDisconnectserver)
ON_COMMAND(ID_SYS_STARTTONGSHI, OnSysStarttongshi)
ON_UPDATE_COMMAND_UI(ID_SYS_STARTTONGSHI, OnUpdateSysStarttongshi)
ON_COMMAND(ID_SYS_SETUPTONGSHI, OnSysSetuptongshi)
ON_UPDATE_COMMAND_UI(ID_SYS_SETUPTONGSHI, OnUpdateSysSetuptongshi)
ON_COMMAND(ID_SYS_STOPTONGSHI, OnSysStoptongshi)
ON_UPDATE_COMMAND_UI(ID_SYS_STOPTONGSHI, OnUpdateSysStoptongshi)
ON_COMMAND(ID_SYS_AUTOUPGRADE, OnSysAutoupgrade)
ON_COMMAND(ID_SYS_AUTOSAVE, OnSysAutosave)
ON_UPDATE_COMMAND_UI(ID_SYS_AUTOSAVE, OnUpdateSysAutosave)
ON_COMMAND(ID_SYS_NOTIFYICON, OnSysNotifyicon)
ON_UPDATE_COMMAND_UI(ID_SYS_NOTIFYICON, OnUpdateSysNotifyicon)
ON_COMMAND(ID_VIEW_MAINBARTEXT, OnViewMainbartext)
ON_UPDATE_COMMAND_UI(ID_VIEW_MAINBARTEXT, OnUpdateViewMainbartext)
ON_COMMAND(ID_VIEW_FULLSCREEN, OnViewFullscreen)
ON_UPDATE_COMMAND_UI(ID_VIEW_FULLSCREEN, OnUpdateViewFullscreen)
ON_WM_GETMINMAXINFO()
ON_COMMAND(ID_VIEW_WIZARD, OnViewWizard)
ON_UPDATE_COMMAND_UI(ID_VIEW_WIZARD, OnUpdateViewWizard)
ON_COMMAND(ID_VIEW_SIMU, OnViewSimu)
ON_UPDATE_COMMAND_UI(ID_VIEW_SIMU, OnUpdateViewSimu)
ON_COMMAND(ID_VIEW_SLIST, OnViewSlist)
ON_UPDATE_COMMAND_UI(ID_VIEW_SLIST, OnUpdateViewSlist)
ON_COMMAND(ID_VIEW_REALTIME, OnViewRealtime)
ON_UPDATE_COMMAND_UI(ID_VIEW_REALTIME, OnUpdateViewRealtime)
ON_COMMAND(ID_VIEW_MULTISORT, OnViewMultisort)
ON_UPDATE_COMMAND_UI(ID_VIEW_MULTISORT, OnUpdateViewMultisort)
ON_COMMAND(ID_VIEW_GRAPH, OnViewTechgraph)
ON_UPDATE_COMMAND_UI(ID_VIEW_GRAPH, OnUpdateViewTechgraph)
ON_COMMAND(ID_VIEW_BASE, OnViewBase)
ON_UPDATE_COMMAND_UI(ID_VIEW_BASE, OnUpdateViewBase)
ON_COMMAND(ID_VIEW_INFO, OnViewInfo)
ON_UPDATE_COMMAND_UI(ID_VIEW_INFO, OnUpdateViewInfo)
ON_COMMAND(ID_VIEW_SELECTOR, OnViewSelector)
ON_UPDATE_COMMAND_UI(ID_VIEW_SELECTOR, OnUpdateViewSelector)
ON_COMMAND(ID_VIEW_F10, OnViewF10)
ON_UPDATE_COMMAND_UI(ID_VIEW_F10, OnUpdateViewF10)
ON_COMMAND(ID_SLIST_INDEX, OnSlistIndex)
ON_COMMAND(ID_SLIST_STRATEGY, OnSlistStrategy)
ON_COMMAND(ID_SLIST_GROUP, OnSlistGroup)
ON_COMMAND(ID_SLIST_GROUPSELF, OnSlistGroupself)
ON_COMMAND(ID_SLIST_DOMAIN, OnSlistDomain)
ON_COMMAND(ID_SLIST_ALL, OnSlistAll)
ON_COMMAND(ID_SLIST_SHAA, OnSlistShaa)
ON_COMMAND(ID_SLIST_SHAB, OnSlistShab)
ON_COMMAND(ID_SLIST_SZNA, OnSlistSzna)
ON_COMMAND(ID_SLIST_SZNB, OnSlistSznb)
ON_COMMAND(ID_SLIST_SHABOND, OnSlistShabond)
ON_COMMAND(ID_SLIST_SZNBOND, OnSlistSznbond)
ON_COMMAND(ID_SLIST_SHAASORTDP, OnSlistShaasortdp)
ON_COMMAND(ID_SLIST_SHABSORTDP, OnSlistShabsortdp)
ON_COMMAND(ID_SLIST_SZNASORTDP, OnSlistSznasortdp)
ON_COMMAND(ID_SLIST_SZNBSORTDP, OnSlistSznbsortdp)
ON_COMMAND(ID_SLIST_SHABONDSORTDP, OnSlistShabondsortdp)
ON_COMMAND(ID_SLIST_SZNBONDSORTDP, OnSlistSznbondsortdp)
ON_COMMAND(ID_SLIST_SETCOLUMN, OnSlistSetcolumn)
ON_COMMAND(ID_SLIST_BASEINDEX, OnSlistBaseindex)
ON_COMMAND(ID_SLISTBAR_DATE, OnSlistbarDate)
ON_COMMAND(ID_SLISTBAR_NAME, OnSlistbarName)
ON_COMMAND(ID_VIEW_VIEWSZZS, OnViewViewszzs)
ON_COMMAND(ID_VIEW_VIEWSZYBL, OnViewViewszybl)
ON_COMMAND(ID_VIEW_VIEWSZAG, OnViewViewszag)
ON_COMMAND(ID_VIEW_VIEWSZBG, OnViewViewszbg)
ON_COMMAND(ID_VIEW_VIEWSZNCZ, OnViewViewszncz)
ON_COMMAND(ID_VIEW_VIEWSZNZZ, OnViewViewsznzz)
ON_COMMAND(ID_VIEW_VIEWSZNCFAZ, OnViewViewszncfaz)
ON_COMMAND(ID_VIEW_VIEWSZNCFBZ, OnViewViewszncfbz)
ON_COMMAND(ID_VIEW_TECHOPTION, OnViewTechoption)
ON_COMMAND(ID_VIEW_PDAY, OnViewPday)
ON_UPDATE_COMMAND_UI(ID_VIEW_PDAY, OnUpdateViewPday)
ON_COMMAND(ID_VIEW_PWEEK, OnViewPweek)
ON_UPDATE_COMMAND_UI(ID_VIEW_PWEEK, OnUpdateViewPweek)
ON_COMMAND(ID_VIEW_PMONTH, OnViewPmonth)
ON_UPDATE_COMMAND_UI(ID_VIEW_PMONTH, OnUpdateViewPmonth)
ON_COMMAND(ID_VIEW_PMIN5, OnViewPmin5)
ON_UPDATE_COMMAND_UI(ID_VIEW_PMIN5, OnUpdateViewPmin5)
ON_COMMAND(ID_VIEW_PMIN15, OnViewPmin15)
ON_UPDATE_COMMAND_UI(ID_VIEW_PMIN15, OnUpdateViewPmin15)
ON_COMMAND(ID_VIEW_PMIN30, OnViewPmin30)
ON_UPDATE_COMMAND_UI(ID_VIEW_PMIN30, OnUpdateViewPmin30)
ON_COMMAND(ID_VIEW_PMIN60, OnViewPmin60)
ON_UPDATE_COMMAND_UI(ID_VIEW_PMIN60, OnUpdateViewPmin60)
ON_COMMAND(ID_VIEW_LEFT, OnViewLeft)
ON_COMMAND(ID_VIEW_RIGHT, OnViewRight)
ON_COMMAND(ID_VIEW_PAGELEFT, OnViewPageleft)
ON_COMMAND(ID_VIEW_PAGERIGHT, OnViewPageright)
ON_COMMAND(ID_VIEW_HOME, OnViewHome)
ON_COMMAND(ID_VIEW_END, OnViewEnd)
ON_COMMAND(ID_VIEW_ZOOMIN, OnViewZoomin)
ON_COMMAND(ID_VIEW_ZOOMOUT, OnViewZoomout)
ON_COMMAND(ID_VIEW_PREV, OnViewPrev)
ON_COMMAND(ID_VIEW_NEXT, OnViewNext)
ON_COMMAND(ID_VIEW_INSERT, OnViewInsert)
//add by lc
ON_COMMAND(ID_VIEW_EXCEL_DATA, OnViewExcelData)
ON_COMMAND(ID_VIEW_NORESUMEDR, OnViewNoresumedr)
ON_UPDATE_COMMAND_UI(ID_VIEW_NORESUMEDR, OnUpdateViewNoresumedr)
ON_COMMAND(ID_VIEW_RESUMEDRUP, OnViewResumedrup)
ON_UPDATE_COMMAND_UI(ID_VIEW_RESUMEDRUP, OnUpdateViewResumedrup)
ON_COMMAND(ID_VIEW_RESUMEDRDOWN, OnViewResumedrdown)
ON_UPDATE_COMMAND_UI(ID_VIEW_RESUMEDRDOWN, OnUpdateViewResumedrdown)
ON_COMMAND(ID_VIEW_MAINDATACLOSE, OnViewMaindataclose)
ON_UPDATE_COMMAND_UI(ID_VIEW_MAINDATACLOSE, OnUpdateViewMaindataclose)
ON_COMMAND(ID_VIEW_MAINDATAOPEN, OnViewMaindataopen)
ON_UPDATE_COMMAND_UI(ID_VIEW_MAINDATAOPEN, OnUpdateViewMaindataopen)
ON_COMMAND(ID_VIEW_MAINDATAAVERAGE, OnViewMaindataaverage)
ON_UPDATE_COMMAND_UI(ID_VIEW_MAINDATAAVERAGE, OnUpdateViewMaindataaverage)
ON_COMMAND(ID_VIEW_KLINECANDLE, OnViewKlinecandle)
ON_UPDATE_COMMAND_UI(ID_VIEW_KLINECANDLE, OnUpdateViewKlinecandle)
ON_COMMAND(ID_VIEW_KLINEAMERICA, OnViewKlineamerica)
ON_UPDATE_COMMAND_UI(ID_VIEW_KLINEAMERICA, OnUpdateViewKlineamerica)
ON_COMMAND(ID_VIEW_KLINETOWER, OnViewKlinetower)
ON_UPDATE_COMMAND_UI(ID_VIEW_KLINETOWER, OnUpdateViewKlinetower)
ON_COMMAND(ID_REALTIME_VIEWSZZS, OnRealtimeViewszzs)
ON_COMMAND(ID_REALTIME_VIEWSZYBL, OnRealtimeViewszybl)
ON_COMMAND(ID_REALTIME_VIEWSZAG, OnRealtimeViewszag)
ON_COMMAND(ID_REALTIME_VIEWSZBG, OnRealtimeViewszbg)
ON_COMMAND(ID_REALTIME_VIEWSZNCZ, OnRealtimeViewszncz)
ON_COMMAND(ID_REALTIME_VIEWSZNZZ, OnRealtimeViewsznzz)
ON_COMMAND(ID_REALTIME_VIEWSZNCFAZ, OnRealtimeViewszncfaz)
ON_COMMAND(ID_REALTIME_VIEWSZNCFBZ, OnRealtimeViewszncfbz)
ON_COMMAND(ID_REALTIME_LEFT, OnRealtimeLeft)
ON_COMMAND(ID_REALTIME_RIGHT, OnRealtimeRight)
ON_COMMAND(ID_REALTIME_HOME, OnRealtimeHome)
ON_COMMAND(ID_REALTIME_END, OnRealtimeEnd)
ON_COMMAND(ID_REALTIME_PREV, OnRealtimePrev)
ON_COMMAND(ID_REALTIME_NEXT, OnRealtimeNext)
ON_COMMAND(ID_REALTIME_ONESTOCK, OnRealtimeOnestock)
ON_COMMAND(ID_REALTIME_TWOSTOCK, OnRealtimeTwostock)
ON_COMMAND(ID_REALTIME_FOURSTOCK, OnRealtimeFourstock)
ON_COMMAND(ID_REALTIME_SIXSTOCK, OnRealtimeSixstock)
ON_COMMAND(ID_REALTIME_NINESTOCK, OnRealtimeNinestock)
ON_UPDATE_COMMAND_UI(ID_REALTIME_ONESTOCK, OnUpdateRealtimeOnestock)
ON_UPDATE_COMMAND_UI(ID_REALTIME_TWOSTOCK, OnUpdateRealtimeTwostock)
ON_UPDATE_COMMAND_UI(ID_REALTIME_FOURSTOCK, OnUpdateRealtimeFourstock)
ON_UPDATE_COMMAND_UI(ID_REALTIME_SIXSTOCK, OnUpdateRealtimeSixstock)
ON_UPDATE_COMMAND_UI(ID_REALTIME_NINESTOCK, OnUpdateRealtimeNinestock)
ON_COMMAND(ID_REALTIME_PRICELINE, OnRealtimePriceline)
ON_COMMAND(ID_REALTIME_REPORTDETAIL, OnRealtimeReportdetail)
ON_COMMAND(ID_REALTIME_MINUTEDETAIL, OnRealtimeMinutedetail)
ON_COMMAND(ID_REALTIME_BIGTRADEDETAIL, OnRealtimeBigtradedetail)
ON_COMMAND(ID_REALTIME_LBDK, OnRealtimeLbdk)
ON_COMMAND(ID_REALTIME_MMLD, OnRealtimeMmld)
ON_UPDATE_COMMAND_UI(ID_REALTIME_PRICELINE, OnUpdateRealtimePriceline)
ON_UPDATE_COMMAND_UI(ID_REALTIME_REPORTDETAIL, OnUpdateRealtimeReportdetail)
ON_UPDATE_COMMAND_UI(ID_REALTIME_MINUTEDETAIL, OnUpdateRealtimeMinutedetail)
ON_UPDATE_COMMAND_UI(ID_REALTIME_BIGTRADEDETAIL, OnUpdateRealtimeBigtradedetail)
ON_UPDATE_COMMAND_UI(ID_REALTIME_LBDK, OnUpdateRealtimeLbdk)
ON_UPDATE_COMMAND_UI(ID_REALTIME_MMLD, OnUpdateRealtimeMmld)
ON_COMMAND(ID_REALTIME_MSSZAG, OnRealtimeMsszag)
ON_COMMAND(ID_REALTIME_MSSZBG, OnRealtimeMsszbg)
ON_COMMAND(ID_REALTIME_MSSZZQ, OnRealtimeMsszzq)
ON_COMMAND(ID_REALTIME_MSSZNAG, OnRealtimeMssznag)
ON_COMMAND(ID_REALTIME_MSSZNBG, OnRealtimeMssznbg)
ON_COMMAND(ID_REALTIME_MSSZNZQ, OnRealtimeMssznzq)
ON_UPDATE_COMMAND_UI(ID_REALTIME_MSSZAG, OnUpdateRealtimeMsszag)
ON_UPDATE_COMMAND_UI(ID_REALTIME_MSSZBG, OnUpdateRealtimeMsszbg)
ON_UPDATE_COMMAND_UI(ID_REALTIME_MSSZZQ, OnUpdateRealtimeMsszzq)
ON_UPDATE_COMMAND_UI(ID_REALTIME_MSSZNAG, OnUpdateRealtimeMssznag)
ON_UPDATE_COMMAND_UI(ID_REALTIME_MSSZNBG, OnUpdateRealtimeMssznbg)
ON_UPDATE_COMMAND_UI(ID_REALTIME_MSSZNZQ, OnUpdateRealtimeMssznzq)
ON_COMMAND(ID_INFO_SELF, OnInfoSelf)
ON_COMMAND(ID_INFO_F10, OnInfoF10)
ON_COMMAND(ID_INFO_STOCKSTAR, OnInfoStockstar)
ON_COMMAND(ID_INFO_SOHU, OnInfoSohu)
ON_COMMAND(ID_INFO_SINA, OnInfoSina)
ON_COMMAND(ID_INFO_163, OnInfo163)
ON_COMMAND(ID_INFO_SHSE, OnInfoShse)
ON_COMMAND(ID_INFO_SZSE, OnInfoSzse)
ON_COMMAND(ID_INFO_HKEX, OnInfoHkex)
ON_COMMAND(ID_INFO_LSE, OnInfoLse)
ON_COMMAND(ID_INFO_NYSE, OnInfoNyse)
ON_COMMAND(ID_INFO_NASDAQ, OnInfoNasdaq)
ON_COMMAND(ID_INFO_P5W, OnInfoP5w)
ON_COMMAND(ID_INFO_SSNEWS, OnInfoSsnews)
ON_COMMAND(ID_INFO_CS, OnInfoCs)
ON_UPDATE_COMMAND_UI(ID_INFO_SELF, OnUpdateInfoSelf)
ON_UPDATE_COMMAND_UI(ID_INFO_F10, OnUpdateInfoF10)
ON_UPDATE_COMMAND_UI(ID_INFO_STOCKSTAR, OnUpdateInfoStockstar)
ON_UPDATE_COMMAND_UI(ID_INFO_SOHU, OnUpdateInfoSohu)
ON_UPDATE_COMMAND_UI(ID_INFO_SINA, OnUpdateInfoSina)
ON_UPDATE_COMMAND_UI(ID_INFO_163, OnUpdateInfo163)
ON_UPDATE_COMMAND_UI(ID_INFO_SHSE, OnUpdateInfoShse)
ON_UPDATE_COMMAND_UI(ID_INFO_SZSE, OnUpdateInfoSzse)
ON_UPDATE_COMMAND_UI(ID_INFO_HKEX, OnUpdateInfoHkex)
ON_UPDATE_COMMAND_UI(ID_INFO_LSE, OnUpdateInfoLse)
ON_UPDATE_COMMAND_UI(ID_INFO_NYSE, OnUpdateInfoNyse)
ON_UPDATE_COMMAND_UI(ID_INFO_NASDAQ, OnUpdateInfoNasdaq)
ON_UPDATE_COMMAND_UI(ID_INFO_P5W, OnUpdateInfoP5w)
ON_UPDATE_COMMAND_UI(ID_INFO_SSNEWS, OnUpdateInfoSsnews)
ON_UPDATE_COMMAND_UI(ID_INFO_CS, OnUpdateInfoCs)
ON_COMMAND(ID_STRATEGY_PROPERTY, OnStrategyProperty)
ON_UPDATE_COMMAND_UI(ID_STRATEGY_PROPERTY, OnUpdateStrategyProperty)
ON_COMMAND(ID_STRATEGY_STOCKS, OnStrategyStocks)
ON_UPDATE_COMMAND_UI(ID_STRATEGY_STOCKS, OnUpdateStrategyStocks)
ON_COMMAND(ID_STRATEGY_SETRULE, OnStrategySetRule)
ON_UPDATE_COMMAND_UI(ID_STRATEGY_SETRULE, OnUpdateStrategySetRule)
ON_COMMAND(ID_STRATEGY_SETRATE, OnStrategySetRate)
ON_UPDATE_COMMAND_UI(ID_STRATEGY_SETRATE, OnUpdateStrategySetRate)
ON_COMMAND(ID_STRATEGY_SIMU, OnStrategySimu)
ON_UPDATE_COMMAND_UI(ID_STRATEGY_SIMU, OnUpdateStrategySimu)
ON_COMMAND(ID_STRATEGY_REPORT, OnStrategyReport)
ON_UPDATE_COMMAND_UI(ID_STRATEGY_REPORT, OnUpdateStrategyReport)
ON_COMMAND(ID_STRATEGY_REALOP, OnStrategyRealOp)
ON_UPDATE_COMMAND_UI(ID_STRATEGY_REALOP, OnUpdateStrategyRealOp)
ON_COMMAND(ID_DATA_DOWNLOAD, OnDataDownload)
ON_COMMAND(ID_DATA_DATASOURCE, OnDataDatasource)
ON_COMMAND(ID_DATA_MANAGE, OnDataManage)
ON_COMMAND(ID_DATA_EXPORT, OnDataExport)
ON_COMMAND(ID_DATA_RECALCULATEYIELD, OnDataRecalculateyield)
ON_COMMAND(ID_OPTION_PROXYSET, OnOptionProxyset)
ON_COMMAND(ID_OPTION_SELECTTRADER, OnOptionSelecttrader)
ON_COMMAND(ID_OPTION_COLOR, OnOptionColor)
ON_COMMAND(ID_OPTION_FONTSLIST, OnOptionFontslist)
ON_COMMAND(ID_OPTION_FONTBASE, OnOptionFontbase)
ON_COMMAND(ID_OPTION_SETGROUP, OnOptionSetgroup)
ON_COMMAND(ID_OPTION_ADDTOSTRATEGY, OnOptionAddtostrategy)
ON_UPDATE_COMMAND_UI(ID_OPTION_ADDTOSTRATEGY, OnUpdateOptionAddtostrategy)
ON_COMMAND(ID_TOOL_TRADER, OnToolTrader)
ON_COMMAND(ID_TOOL_NOTE, OnToolNote)
ON_COMMAND(ID_TOOL_CALCULATOR, OnToolCalculator)
ON_COMMAND(ID_TOOL_FILTERINFO, OnToolFilterinfo)
ON_COMMAND(ID_TOOL_ALARM, OnToolAlarm)
ON_COMMAND(ID_HELP_SHOWHELP, OnHelpShowhelp)
ON_COMMAND(ID_HELP_DECLARE, OnHelpDeclare)
//}}AFX_MSG_MAP
// Global help commands
ON_NOTIFY(TBN_DROPDOWN, IDW_MAINBAR, OnMainBarDropDown)
ON_NOTIFY(TBN_DROPDOWN, IDW_SLISTBAR, OnSlistBarDropDown)
ON_COMMAND_RANGE(ID_SLIST_DOMAIN_START, ID_SLIST_DOMAIN_END, OnSlistDomainRange)
ON_COMMAND_RANGE(ID_SLIST_GROUP_START, ID_SLIST_GROUP_END, OnSlistGroupRange)
ON_COMMAND_RANGE(ID_VIEW_TECH_START, ID_VIEW_TECH_END, OnViewTechRange)
ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_TECH_START, ID_VIEW_TECH_END, OnUpdateViewTechRange)
ON_COMMAND_RANGE(ID_OPTION_ADDTOGROUP_START, ID_OPTION_ADDTOGROUP_END, OnOptionAddtogroupRange)
ON_UPDATE_COMMAND_UI_RANGE(ID_OPTION_ADDTOGROUP_START, ID_OPTION_ADDTOGROUP_END, OnUpdateOptionAddtogroupRange)
ON_UPDATE_COMMAND_UI(IDW_MENUBAR, OnUpdateControlBarMenu)
ON_COMMAND_EX(IDW_MENUBAR, OnBarCheck)
ON_UPDATE_COMMAND_UI(IDW_MAINBAR, OnUpdateControlBarMenu)
ON_COMMAND_EX(IDW_MAINBAR, OnBarCheck)
ON_UPDATE_COMMAND_UI(IDW_VIEWBAR, OnUpdateControlBarMenu)
ON_COMMAND_EX(IDW_VIEWBAR, OnBarCheck)
ON_UPDATE_COMMAND_UI(IDW_PERIODBAR, OnUpdateControlBarMenu)
ON_COMMAND_EX(IDW_PERIODBAR, OnBarCheck)
ON_UPDATE_COMMAND_UI(IDW_SLISTBAR, OnUpdateControlBarMenu)
ON_COMMAND_EX(IDW_SLISTBAR, OnBarCheck)
ON_UPDATE_COMMAND_UI(IDW_SIMUBAR, OnUpdateControlBarMenu)
ON_COMMAND_EX(IDW_SIMUBAR, OnBarCheck)
ON_UPDATE_COMMAND_UI(IDW_WORKSPBAR, OnUpdateControlBarMenu)
ON_COMMAND(IDW_WORKSPBAR, OnToggleWorkspBar)
ON_MESSAGE(WM_USER_UPDATEBARMENU, OnUpdateBarMenu)
ON_MESSAGE(WM_USER_NIFMESSAGE, OnNifMessage)
ON_MESSAGE(WM_USER_INITDATES, OnInitDates)
ON_MESSAGE(WM_USER_UPDATESLISTVIEW, OnUpdateSlistView)
ON_MESSAGE(WM_APP_STKRECEIVER_ALARM, OnStkReceiverAlarm)
END_MESSAGE_MAP()
CMainFrame* CMainFrame::CreateNewFrame()
{
CRuntimeClass* pFrameClass = RUNTIME_CLASS(CMainFrame);
CMainFrame* pFrame = (CMainFrame*)pFrameClass->CreateObject();
if (pFrame == NULL)
{
TRACE1("Warning: Dynamic create of frame %hs failed.\n",
pFrameClass->m_lpszClassName);
return NULL;
}
ASSERT_KINDOF(CMainFrame, pFrame);
// create new from resource
if (!pFrame->LoadFrame(IDR_MAINFRAME))
{
TRACE0("Warning: Couldn't create a frame.\n");
// frame will be deleted in PostNcDestroy cleanup
return NULL;
}
// it worked !
return pFrame;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
memset(&m_fullScreen, 0, sizeof(m_fullScreen));
m_fullScreen.bFullScreen = FALSE;
::memset(&m_dataFrameWP, 0, sizeof(WINDOWPLACEMENT));
m_dataFrameWP.length = sizeof(WINDOWPLACEMENT);
m_dataFrameWP.showCmd = SW_HIDE;
}
CMainFrame::~CMainFrame()
{
}
#define FRM_SEARCH_WIDTH 180
#define FRM_SEARCH_HEIGHT 22
#define SLB_DATE_WIDTH 135
#define SLB_DATE_HEIGHT 22
BOOL CMainFrame::CreateMainBar()
{
//if (!m_wndMainBar.CreateTextToolBar(this, IDW_MAINBAR, IDR_MAINBAR, -1, -1, CTextToolBar::labelBottom))
//{
// TRACE0("Failed to create mainbar\n");
// return FALSE; // fail to create
//}
//CString strBarTitle;
//strBarTitle.LoadString(IDS_TITLE_MAINBAR);
//m_wndMainBar.SetWindowText(strBarTitle);
//m_wndMainBar.SetButtonDropDown(ID_MAINBAR_SETTING, m_wndMainBar.CommandToIndex(ID_MAINBAR_SETTING), IDR_MENU_MAINBARSETTING);
//m_wndMainBar.SetButtonDropDown(ID_MAINBAR_VIEW, m_wndMainBar.CommandToIndex(ID_MAINBAR_VIEW), IDR_MENU_MAINBARVIEW);
//m_wndMainBar.SetButtonDropDown(ID_MAINBAR_TECH, m_wndMainBar.CommandToIndex(ID_MAINBAR_TECH), IDR_MENU_MAINBARTECH);
//m_wndMainBar.SetButtonDropDown(ID_MAINBAR_PERIOD, m_wndMainBar.CommandToIndex(ID_MAINBAR_PERIOD), IDR_MENU_MAINBARPERIOD);
return TRUE;
}
BOOL CMainFrame::CreateSListBar()
{
//if (!m_wndSListBar.CreateTextToolBar(this, IDW_SLISTBAR, IDR_SLISTBAR, -1, -1, CTextToolBar::labelRight))
//{
// TRACE0("Failed to create slistbar\n");
// return FALSE; // fail to create
//}
//CString strTitle;
//strTitle.LoadString(IDS_TITLE_SLISTBAR);
//SetWindowText(strTitle);
//m_wndSListBar.SetButtonDropDown(ID_SLISTBAR_GROUP, m_wndSListBar.CommandToIndex(ID_SLISTBAR_GROUP), IDR_MENU_SLISTBARGROUP);
//m_wndSListBar.SetButtonDropDown(ID_SLISTBAR_DOMAIN, m_wndSListBar.CommandToIndex(ID_SLISTBAR_DOMAIN), IDR_MENU_SLISTBARDOMAIN);
//m_wndSListBar.SetButtonDropDown(ID_SLISTBAR_CLASS, m_wndSListBar.CommandToIndex(ID_SLISTBAR_CLASS), IDR_MENU_SLISTBARCLASS);
return TRUE;
}
BOOL CMainFrame::CreateSimuBar()
{
//if (!m_wndSimuBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
// | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0,0,0,0), IDW_SIMUBAR)
// || !m_wndSimuBar.LoadToolBar(IDR_SIMUBAR))
//{
// TRACE0("Failed to create simubar\n");
// return FALSE; // fail to create
//}
//CString strBarTitle;
//strBarTitle.LoadString(IDS_TITLE_SIMUBAR);
//m_wndSimuBar.SetWindowText(strBarTitle);
return TRUE;
}
BOOL CMainFrame::CreateStatusBar()
{
/*
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return FALSE; // fail to create
}
if (!m_wndProgressBar.Create(this, IDD_PROGRESS, CBRS_BOTTOM, IDW_PROGRESSBAR))
{
TRACE0("Failed to create progress bar\n");
return FALSE; // fail to create
}
CProgressCtrl* pPrg = (CProgressCtrl*)m_wndProgressBar.GetDlgItem(IDC_PROGRESS);
if (pPrg != NULL)
pPrg->SetRange(0, 100);
HideProgressBar();
// Set Status Bar Styles
UINT nID, nStyle;
int cxWidth;
m_wndStatusBar.GetPaneInfo(1, nID, nStyle, cxWidth);
m_wndStatusBar.SetPaneInfo(1, nID, nStyle, 200);
m_wndStatusBar.GetPaneInfo(2, nID, nStyle, cxWidth);
m_wndStatusBar.SetPaneInfo(2, nID, nStyle, 200);
m_wndStatusBar.GetPaneInfo(3, nID, nStyle, cxWidth);
m_wndStatusBar.SetPaneInfo(3, nID, nStyle, 50);
m_wndStatusBar.GetStatusBarCtrl().SetMinHeight(20);
HICON icon = AfxGetApp()->LoadIcon(IDI_INDICATOR);
m_wndStatusBar.GetStatusBarCtrl().SetIcon(0, icon);
//*/
return TRUE;
}
BOOL CMainFrame::CreateWorkspBar()
{
//CString strWorkspTitle;
//strWorkspTitle.LoadString(IDS_TITLE_WORKSPBAR);
//if (!m_wndWorkspBar.Create(strWorkspTitle, WS_CHILD | WS_VISIBLE, this, IDW_WORKSPBAR))
//{
// TRACE0("Failed to create workspbar\n");
// return -1;
//}
//m_wndWorkspBar.SetFrameWnd(this);
//// Add the views to the tab control.
//CString strViewTitle;
//strViewTitle.LoadString(IDS_TITLE_STRATEGYVIEW);
//m_wndWorkspBar.AddView(strViewTitle, RUNTIME_CLASS(CStrategyView));
//strViewTitle.LoadString(IDS_TITLE_GROUPVIEW);
//m_wndWorkspBar.AddView(strViewTitle, RUNTIME_CLASS(CGroupView));
//strViewTitle.LoadString(IDS_TITLE_TECHSVIEW);
//m_wndWorkspBar.AddView(strViewTitle, RUNTIME_CLASS(CTechsView));
//m_wndWorkspBar.SetTabImageList(IDB_WORKSP_TAB, 16, 1, RGB(0,255,0));
//// allow bar to be resized when floating
//m_wndWorkspBar.SetBarStyle(m_wndWorkspBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
return TRUE;
}
char szBarSection[] = "StockAnaBar";
char szMainBar[] = "MainBar";
char szSListBar[] = "SListBar";
char szSimuBar[] = "SimuBar";
char szWorkspBar[] = "WorkspBar";
char szViewBar[] = "ViewBar";
char szPeriodBar[] = "PeriodBar";
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CTskMainFrame::OnCreate(lpCreateStruct) == -1)
return -1;
// ******************************************
// 自定义状态栏
if (!m_wndStatusBar.Create(this)/* ||
!m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))*/)
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndStatusBar.InitStatusBar();
//*/
// Create ToolBars
if (!CreateMainBar() || !CreateSListBar() || !CreateSimuBar()/* || !CreateStatusBar()*/ || !CreateWorkspBar())
{
return -1; // failed to create
}
// Name Search ComboBox
if (!m_SearchBox.Create(WS_CHILD | CBS_DROPDOWN | CBS_SORT | CBS_AUTOHSCROLL | WS_VSCROLL | CBS_HASSTRINGS,
CRect(-FRM_SEARCH_WIDTH, -FRM_SEARCH_HEIGHT, 0, 200), this, ID_SLISTBAR_NAME))
{
TRACE0("Failed to create m_SearchBox\n");
return FALSE;
}
m_SearchBox.SetItemHeight(-1, 16);
m_SearchBox.SetAutoHide(TRUE);
SendMessage(WM_USER_UPDATEBARMENU, 0, 0);
// Enable Docking
EnableDocking(CBRS_ALIGN_ANY);
//m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
//m_wndMainBar.EnableDocking(CBRS_ALIGN_ANY);
//m_wndSListBar.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
//m_wndSimuBar.EnableDocking(CBRS_ALIGN_ANY);
//m_wndWorkspBar.EnableDocking(CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT);
//DockControlBar(&m_wndMainBar,AFX_IDW_DOCKBAR_TOP);
//DockControlBar(&m_wndSListBar,AFX_IDW_DOCKBAR_TOP);
//DockControlBarLeftOf(&m_wndSimuBar,&m_wndSListBar);
//DockControlBar(&m_wndWorkspBar, AFX_IDW_DOCKBAR_LEFT);
// Bar State and Window Placement
//ShowControlBar(&m_wndMainBar, AfxGetApp()->GetProfileInt(szBarSection,szMainBar,0), FALSE);
//ShowControlBar(&m_wndSListBar, AfxGetApp()->GetProfileInt(szBarSection,szSListBar,0), FALSE);
//ShowControlBar(&m_wndSimuBar, AfxGetApp()->GetProfileInt(szBarSection,szSimuBar,0), FALSE);
//ShowControlBar(&m_wndWorkspBar, AfxGetApp()->GetProfileInt(szBarSection,szWorkspBar,0), FALSE);
// Set Timer
SetTimer(TIMER_TIME, 1000, NULL);
SetTimer(TIMER_STOCKINDEXREFRESH, 5000, NULL);
// Create QuoteTip and AlarmTip
//CQuoteTipDlg::GetInstance();
//CAlarmTipDlg::GetInstance();
// Notify Icon
NOTIFYICONDATA nid;
memset(&nid, 0, sizeof(nid));
nid.cbSize = sizeof(nid);
nid.hWnd = GetSafeHwnd();
nid.uID = 1;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_USER_NIFMESSAGE;
nid.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
CString strName = AfxGetStockIndexReportTip();
strncpy(nid.szTip, strName, min(strName.GetLength(),sizeof(nid.szTip)-1));
Shell_NotifyIcon(NIM_ADD, &nid);
// StkReceiver Alarm
AfxGetStkReceiver().AddRcvAlarmWnd(GetSafeHwnd());
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CTskMainFrame::PreCreateWindow(cs))
return FALSE;
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
return TRUE;
}
void CMainFrame::ActivateFrame(int nCmdShow)
{
// window placement persistence
if (m_dataFrameWP.showCmd != SW_HIDE)
{
SetWindowPlacement(&m_dataFrameWP);
CFrameWnd::ActivateFrame(m_dataFrameWP.showCmd);
m_dataFrameWP.showCmd = SW_HIDE;
return;
}
CTskMainFrame::ActivateFrame(nCmdShow);
}
void CMainFrame::ShowProgressBar()
{
//m_wndStatusBar.SetWindowPos(&wndBottom, 0, 0, 0, 0,
// SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|
// SWP_NOACTIVATE|SWP_HIDEWINDOW);
//CRect rect;
//GetClientRect(&rect);
//CSize size = m_wndProgressBar.CalcFixedLayout(TRUE, TRUE);
//rect.top = rect.bottom - size.cy;
//m_wndProgressBar.SetWindowPos(&wndTop,//m_wndStatusBar,
// rect.left,
// rect.top,
// rect.right - rect.left,
// rect.bottom - rect.top,
// SWP_NOACTIVATE|SWP_SHOWWINDOW);
//m_wndProgressBar.Invalidate();
//MSG msg;
//while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE))
//{
// AfxGetApp()->PumpMessage();
//}
}
void CMainFrame::HideProgressBar()
{
//m_wndProgressBar.SetWindowPos(&wndBottom, 0, 0, 0, 0,
// SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|
// SWP_NOACTIVATE|SWP_HIDEWINDOW);
//CRect rect;
//GetClientRect(&rect);
//CSize size = m_wndStatusBar.CalcFixedLayout(TRUE, TRUE);
//rect.top = rect.bottom - size.cy;
//m_wndStatusBar.SetWindowPos(&wndTop,
// rect.left,
// rect.top,
// rect.Width(),
// rect.Height(),
// SWP_NOACTIVATE|SWP_SHOWWINDOW);
//m_wndStatusBar.Invalidate();
//MSG msg;
//while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE))
//{
// AfxGetApp()->PumpMessage();
//}
}
void CMainFrame::ShowWorkspBar(BOOL bShow)
{
//m_wndWorkspBar.ShowNormal(bShow);
}
void CMainFrame::OnToggleWorkspBar()
{
//m_wndWorkspBar.ToggleShow();
}
void CMainFrame::SetStatusMsg(LPCTSTR lpszText)
{
//if (m_wndStatusBar.IsWindowVisible())
//{
// SetMessageText(lpszText);
//}
//else if (m_wndProgressBar.IsWindowVisible())
//{
// CWnd *pWnd = m_wndProgressBar.GetDlgItem(IDC_MESSAGE);
// if (pWnd)
// pWnd->SetWindowText(lpszText);
//}
}
void CMainFrame::SetProgress(int nPercent)
{
//if (m_wndProgressBar.IsWindowVisible())
//{
// CProgressCtrl* pPrg = (CProgressCtrl*)m_wndProgressBar.GetDlgItem(IDC_PROGRESS);
// if (pPrg != NULL)
// pPrg->SetPos(nPercent);
//}
//else if (m_wndStatusBar.IsWindowVisible())
//{
// CString string;
// int maxcount = nPercent/9;
// CString strProgress;
// strProgress.LoadString(IDS_MAINFRAME_PROGRESS);
// for (int i=0; i<maxcount; i++)
// {
// string += strProgress;
// }
// if (100 == nPercent)
// string = "";
// m_wndStatusBar.SetPaneText(1,string);
//}
}
//void CMainFrame::DockControlBarLeftOf(CGuiToolBarWnd* Bar,CGuiToolBarWnd* LeftOf)
//{
// CRect rect;
// DWORD dw;
// UINT n;
//
// // get MFC to adjust the dimensions of all docked ToolBars
// // so that GetWindowRect will be accurate
// RecalcLayout();
// LeftOf->GetWindowRect(&rect);
// rect.OffsetRect(1,0);
// dw=LeftOf->GetBarStyle();
// n = 0;
// n = (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n;
// n = (dw&CBRS_ALIGN_BOTTOM && n==0) ? AFX_IDW_DOCKBAR_BOTTOM : n;
// n = (dw&CBRS_ALIGN_LEFT && n==0) ? AFX_IDW_DOCKBAR_LEFT : n;
// n = (dw&CBRS_ALIGN_RIGHT && n==0) ? AFX_IDW_DOCKBAR_RIGHT : n;
//
// // When we take the default parameters on rect, DockControlBar will dock
// // each Toolbar on a seperate line. By calculating a rectangle, we in effect
// // are simulating a Toolbar being dragged to that location and docked.
// DockControlBar(Bar,n,&rect);
//}
CPoint CMainFrame::CalcPopupMenuPoint(CToolBar * pBar, UINT nID, CMenu *pMenu)
{
ASSERT(pBar && pBar->IsKindOf(RUNTIME_CLASS(CToolBar)));
// Button rect
CRect rectButton;
pBar->GetToolBarCtrl().GetRect(nID, &rectButton);
pBar->ClientToScreen(&rectButton);
// Screen size
int cyScreen = GetSystemMetrics(SM_CYSCREEN);
// Menu height
int nMenuHeight = cyScreen/4;
if (pMenu)
{
nMenuHeight = 5;
for (UINT i=0; i<pMenu->GetMenuItemCount(); i++)
{
if (ID_SEPARATOR == pMenu->GetMenuItemID(i))
nMenuHeight += 9;
else
nMenuHeight += 19;
}
}
// Left Width
int nLeftWidth = rectButton.Height();
for (int i=0; i<pBar->GetCount(); i++)
{
if (pBar->GetButtonStyle(i) == TBSTYLE_BUTTON)
{
CRect rectItem;
pBar->GetToolBarCtrl().GetRect(i, &rectItem);
nLeftWidth = rectItem.Width();
break;
}
}
// Track Point
CPoint pt;
if (cyScreen-rectButton.bottom-2 >= nMenuHeight
|| rectButton.top-2 < nMenuHeight)
{
pt.x = rectButton.left + nLeftWidth;
pt.y = rectButton.bottom + 1;
}
else
{
pt.x = rectButton.left + nLeftWidth;
pt.y = rectButton.top - 1;
}
return pt;
}
void CMainFrame::InitMenuPopup(CMenu* pPopupMenu)
{
if (NULL == pPopupMenu || NULL == pPopupMenu->GetSafeHmenu())
return;
for (UINT nMenu=0; nMenu<pPopupMenu->GetMenuItemCount(); nMenu++)
{
if (ID_SLIST_GROUP1 == pPopupMenu->GetMenuItemID(nMenu))
{
pPopupMenu->ModifyMenu(nMenu, MF_BYPOSITION | MF_GRAYED, ID_SLIST_GROUP1, (LPCTSTR)NULL);
for (UINT k=pPopupMenu->GetMenuItemCount()-1; k>nMenu; k--)
pPopupMenu->DeleteMenu(k, MF_BYPOSITION);
AfxMenuInsertGroup(pPopupMenu, nMenu+1, ID_SLIST_GROUP_START, ID_SLIST_GROUP_END, TRUE);
break;
}
else if (ID_SLIST_DOMAIN1 == pPopupMenu->GetMenuItemID(nMenu))
{
pPopupMenu->DeleteMenu(nMenu, MF_BYPOSITION);
AfxMenuInsertDomain(pPopupMenu, nMenu, ID_SLIST_DOMAIN_START, ID_SLIST_DOMAIN_END);
break;
}
else if (ID_OPTION_ADDTOGROUP == pPopupMenu->GetMenuItemID(nMenu))
{
pPopupMenu->ModifyMenu(nMenu, MF_BYPOSITION | MF_GRAYED, ID_OPTION_ADDTOGROUP, (LPCTSTR)NULL);
for (UINT k=pPopupMenu->GetMenuItemCount()-1; k>nMenu; k--)
pPopupMenu->DeleteMenu(k, MF_BYPOSITION);
CView * pView = AfxGetStaticDoc()->GetActiveView();
AfxMenuInsertGroup(pPopupMenu, nMenu+1, ID_OPTION_ADDTOGROUP_START, ID_OPTION_ADDTOGROUP_END,
pView && (pView->IsKindOf(RUNTIME_CLASS(CSListView))||pView->IsKindOf(RUNTIME_CLASS(CGraphView))||pView->IsKindOf(RUNTIME_CLASS(CBaseView))));
break;
}
else if (ID_VIEW_TECHKLINE == pPopupMenu->GetMenuItemID(nMenu))
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
UINT nFlags = ((pView && pView->IsKindOf(RUNTIME_CLASS(CGraphView))) ? MF_BYPOSITION | MF_STRING : MF_BYPOSITION | MF_STRING | MF_GRAYED);
pPopupMenu->DeleteMenu(nMenu, MF_BYPOSITION);
for (UINT nID = STT_KLINE_MAX; nID >= STT_KLINE_MIN; nID --)
{
UINT nFlagsLocal = nFlags;
if (AfxGetProfile().IsGraphTechShow(nID)) nFlagsLocal |= MF_CHECKED;
pPopupMenu->InsertMenu(nMenu, nFlagsLocal, ID_VIEW_TECH_START+nID, AfxGetSTTFullName(nID));
}
}
else if (ID_VIEW_TECHTREND == pPopupMenu->GetMenuItemID(nMenu))
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
UINT nFlags = ((pView && pView->IsKindOf(RUNTIME_CLASS(CGraphView))) ? MF_BYPOSITION | MF_STRING : MF_BYPOSITION | MF_STRING | MF_GRAYED);
pPopupMenu->DeleteMenu(nMenu, MF_BYPOSITION);
for (UINT nID = STT_TREND_MAX; nID >= STT_TREND_MIN; nID --)
{
UINT nFlagsLocal = nFlags;
if (AfxGetProfile().IsGraphTechShow(nID)) nFlagsLocal |= MF_CHECKED;
pPopupMenu->InsertMenu(nMenu, nFlagsLocal, ID_VIEW_TECH_START+nID, AfxGetSTTFullName(nID));
}
}
else if (ID_VIEW_TECHENERGY == pPopupMenu->GetMenuItemID(nMenu))
{
pPopupMenu->DeleteMenu(nMenu, MF_BYPOSITION);
CView * pView = AfxGetStaticDoc()->GetActiveView();
UINT nFlags = ((pView && pView->IsKindOf(RUNTIME_CLASS(CGraphView))) ? MF_BYPOSITION | MF_STRING : MF_BYPOSITION | MF_STRING | MF_GRAYED);
for (UINT nID = STT_ENERGY_MAX; nID >= STT_ENERGY_MIN; nID --)
{
UINT nFlagsLocal = nFlags;
if (AfxGetProfile().IsGraphTechShow(nID)) nFlagsLocal |= MF_CHECKED;
pPopupMenu->InsertMenu(nMenu, nFlagsLocal, ID_VIEW_TECH_START+nID, AfxGetSTTFullName(nID));
}
}
else if (ID_VIEW_TECHSWING == pPopupMenu->GetMenuItemID(nMenu))
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
UINT nFlags = ((pView && pView->IsKindOf(RUNTIME_CLASS(CGraphView))) ? MF_BYPOSITION | MF_STRING : MF_BYPOSITION | MF_STRING | MF_GRAYED);
pPopupMenu->DeleteMenu(nMenu, MF_BYPOSITION);
for (UINT nID = STT_SWING_MAX; nID >= STT_SWING_MIN; nID --)
{
UINT nFlagsLocal = nFlags;
if (AfxGetProfile().IsGraphTechShow(nID)) nFlagsLocal |= MF_CHECKED;
pPopupMenu->InsertMenu(nMenu, nFlagsLocal, ID_VIEW_TECH_START+nID, AfxGetSTTFullName(nID));
}
}
else if (ID_VIEW_TECHOTHER == pPopupMenu->GetMenuItemID(nMenu))
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
UINT nFlags = ((pView && pView->IsKindOf(RUNTIME_CLASS(CGraphView))) ? MF_BYPOSITION | MF_STRING : MF_BYPOSITION | MF_STRING | MF_GRAYED);
pPopupMenu->DeleteMenu(nMenu, MF_BYPOSITION);
for (UINT nID = STT_OTHER_MAX; nID >= STT_OTHER_MIN; nID --)
{
UINT nFlagsLocal = nFlags;
if (AfxGetProfile().IsGraphTechShow(nID)) nFlagsLocal |= MF_CHECKED;
pPopupMenu->InsertMenu(nMenu, nFlagsLocal, ID_VIEW_TECH_START+nID, AfxGetSTTFullName(nID));
}
}
else if (ID_VIEW_TECHCLK == pPopupMenu->GetMenuItemID(nMenu))
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
UINT nFlags = ((pView && pView->IsKindOf(RUNTIME_CLASS(CGraphView))) ? MF_BYPOSITION | MF_STRING : MF_BYPOSITION | MF_STRING | MF_GRAYED);
pPopupMenu->DeleteMenu(nMenu, MF_BYPOSITION);
for (UINT nID = STT_CLK_MAX; nID >= STT_CLK_MIN; nID --)
{
UINT nFlagsLocal = nFlags;
if (AfxGetProfile().IsGraphTechShow(nID)) nFlagsLocal |= MF_CHECKED;
pPopupMenu->InsertMenu(nMenu, nFlagsLocal, ID_VIEW_TECH_START+nID, AfxGetSTTFullName(nID));
}
}
else if (ID_VIEW_TECHUSER == pPopupMenu->GetMenuItemID(nMenu))
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
UINT nFlags = ((pView && pView->IsKindOf(RUNTIME_CLASS(CGraphView))) ? MF_BYPOSITION | MF_STRING : MF_BYPOSITION | MF_STRING | MF_GRAYED);
pPopupMenu->DeleteMenu(nMenu, MF_BYPOSITION);
UINT nTechUserCount = CTechUser::GetTechUserCount();
UINT nIDEnd = STT_USER_MIN+nTechUserCount-1;
if (nIDEnd > STT_USER_MIN+14)
nIDEnd = STT_USER_MIN+14;
for (UINT nID = nIDEnd; nID >= STT_USER_MIN; nID --)
{
UINT nFlagsLocal = nFlags;
if (AfxGetProfile().IsGraphTechShow(nID)) nFlagsLocal |= MF_CHECKED;
pPopupMenu->InsertMenu(nMenu, nFlagsLocal, ID_VIEW_TECH_START+nID-STT_USER_MIN+1+STT_MAX, AfxGetSTTFullName(nID));
}
}
}
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CTskMainFrame::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CTskMainFrame::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnTimer(UINT nIDEvent)
{
if (TIMER_TIME == nIDEvent)
{
CSPTime time = CSPTime::GetCurrentTime();
CString string = (LPCTSTR)AfxGetTimeString(time.GetTime(), "%H:%M:%S", FALSE);
//m_wndStatusBar.SetPaneText(3, string);
}
else if (TIMER_STOCKINDEXREFRESH == nIDEvent)
{
CString strSHTipFmt, strSZTipFmt;
strSHTipFmt.LoadString(IDS_MAINFRAME_SHINDEXTIP);
strSZTipFmt.LoadString(IDS_MAINFRAME_SZINDEXTIP);
double dDevided = 100000000;
#ifdef CLKLAN_ENGLISH_US
dDevided = 1000000000;
#endif
CString string;
double dDiff = 0;
CStockInfo info;
COLORREF clrRise = AfxGetProfile().GetColor(CColorClass::clrRise);
COLORREF clrFall = AfxGetProfile().GetColor(CColorClass::clrFall);
if (AfxGetStockContainer().GetStockInfo(STKLIB_CODE_SZZS, &info))
{
info.GetDiff(&dDiff,info.m_datetech,1);
string.Format(strSHTipFmt, info.m_fClose, dDiff, info.m_fAmount/dDevided);
// m_wndStatusBar.SetPaneColor(dDiff > 0 ? clrRise : clrFall);
//m_wndStatusBar.SetPaneText(1, string);
}
if (AfxGetStockContainer().GetStockInfo(STKLIB_CODE_SZNCZ, &info))
{
info.GetDiff(&dDiff,info.m_datetech,1);
string.Format(strSZTipFmt, info.m_fClose, dDiff, info.m_fAmount/dDevided);
// m_wndStatusBar.SetPaneColor(dDiff > 0 ? clrRise : clrFall);
//m_wndStatusBar.SetPaneText(2, string);
}
PostMessage(WM_APP_STKRECEIVER_ALARM, STKRCV_ALARM_REFRESH, 0);
}
// 检测是否有新版本,自动升级
else if (TIMER_AUTOUPDATE == nIDEvent)
{
KillTimer(TIMER_AUTOUPDATE);
//CInternetSession m_cis;
//CHttpConnection* m_chc;
//m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
//m_chc = m_cis.GetHttpConnection(AfxGetProfile().GetHTTPServerDomain());
//CHttpFile* pFile = m_chc->OpenRequest(CHttpConnection::HTTP_VERB_GET, "/download/update.ini");
//if (!pFile->SendRequest())
//{
// pFile->Close();
// AfxMessageBox("SendRequest Error");
//}
//char szPath[256];
//CString strPath;
//GetModuleFileName(NULL, szPath, 256);
//strPath = szPath;
//if (strPath.ReverseFind('\\') >= 0)
// strPath = strPath.Left(strPath.ReverseFind('\\'));
//strPath += "\\update.ini";
//CStdioFile csf;
//csf.Open(strPath, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
//char buf[2048];
//int n;
//while ((n = pFile->Read(buf, 2048)) >0)
// csf.Write(buf, n);
//csf.Close();
//pFile->Close();
//char szVer[16];
//GetPrivateProfileString("TsKing", "Version", "2", szVer, 16, strPath);
//if (atof(szVer) > float(theApp.m_nVersion[3]))
//{
// int nRet = AfxMessageBox("已经有新的版本,是否需要升级?", MB_YESNO);
// if (nRet = IDOK)
// {
// // 启动升级对话框
// CUpgradeDlg* dlg = new CUpgradeDlg;
// dlg->Create(CUpgradeDlg::IDD, this);
// dlg->SetAutoDelete(TRUE);
// dlg->CenterWindow(this);
// dlg->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOSIZE);
// dlg->OnOK();
// }
//}
//else
//{
// CString strText;
// strText.Format("%s %d", szVer, theApp.m_nVersion[3]);
// AfxMessageBox(strText);
//}
}
else if (TIMER_SHOWNETINFO == nIDEvent)
{
static unsigned long countShow = 0;
countShow ++;
if (countShow == 10)
{
KillTimer(TIMER_SHOWNETINFO);
CNetInfoDlg dlg;
dlg.DoModal();
if (AfxGetProfile().HasNewVersion()
&& IDYES == AfxMessageBox(IDS_DOWNLOAD_UPGRADENOW, MB_YESNO))
{
CUpgradeDlg * dlg = new CUpgradeDlg;
dlg->Create(CUpgradeDlg::IDD, this);
dlg->SetAutoDelete(TRUE);
dlg->SetAutoRun(TRUE);
dlg->CenterWindow(this);
dlg->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOSIZE);
}
}
}
CTskMainFrame::OnTimer(nIDEvent);
}
LRESULT CMainFrame::OnUpdateBarMenu(WPARAM wParam, LPARAM lParam)
{
return 0;
}
LRESULT CMainFrame::OnNifMessage(WPARAM wParam, LPARAM lParam)
{
static BOOL g_bQuoteTipVisited = FALSE;
if (WM_LBUTTONDOWN == lParam)
{
if (!IsIconic())
{
ShowWindow(SW_MINIMIZE);
if (AfxGetProfile().GetNotifyIcon())
ShowWindow(SW_HIDE);
}
else
{
//BOOL bQuoteTipVisible = CQuoteTipDlg::GetInstance().IsWindowVisible();
//CQuoteTipDlg::GetInstance().Hide();
//SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE);
//ShowWindow(SW_RESTORE);
//UpdateWindow();
//if (!g_bQuoteTipVisited || bQuoteTipVisible)
//{
//}
g_bQuoteTipVisited = FALSE;
RecalcLayout();
}
}
else if (WM_RBUTTONDOWN == lParam)
{
// 临时刷新一下行情
CStockContainer & container = AfxGetSListStockContainer();
AfxGetStkReceiver().RequestStockData(CStock::dataReport, container.GetData(), container.GetSize(), 0, 0);
// Show Quote
//CQuoteTipDlg::GetInstance().ShowGradual();
//CQuoteTipDlg::GetInstance().SetAutoHide(5, TRUE);
g_bQuoteTipVisited = TRUE;
}
return 0;
}
LRESULT CMainFrame::OnInitDates(WPARAM wParam, LPARAM lParam)
{
return 0;
}
LRESULT CMainFrame::OnUpdateSlistView(WPARAM wParam, LPARAM lParam)
{
AfxGetSListStockContainer().ReRetrieveFromStatic(AfxGetActiveStrategy());
AfxGetStaticDoc()->UpdateAllViews(NULL, UPDATE_HINT_SLISTVIEW, NULL);
return 0;
}
LRESULT CMainFrame::OnStkReceiverAlarm(WPARAM wParam, LPARAM lParam)
{
if (STKRCV_ALARM_WARNING == wParam)
{
//CAlarmTipDlg::GetInstance().ShowGradual();
//CAlarmTipDlg::GetInstance().SetAutoHide(5, TRUE);
}
UINT nIDIcon = IDR_MAINFRAME;
if (AfxGetAlarmContainer().HasWarning())
{
nIDIcon = IDI_ALARM_WARNING;
}
else
{
CStockInfo info;
double dDiff;
if (AfxGetStockContainer().GetStockInfo(STKLIB_CODE_MAIN, &info)
&& info.GetDiff(&dDiff,info.m_datetech,1))
{
if (dDiff > 0)
nIDIcon = IDI_ALARM_INDEXRED;
if (dDiff < 0)
nIDIcon = IDI_ALARM_INDEXGREEN;
}
}
// Notify Icon
NOTIFYICONDATA nid;
memset(&nid, 0, sizeof(nid));
nid.cbSize = sizeof(nid);
nid.hWnd = GetSafeHwnd();
nid.uID = 1;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_USER_NIFMESSAGE;
nid.hIcon = AfxGetApp()->LoadIcon(nIDIcon);
CString strName = AfxGetStockIndexReportTip();
strncpy(nid.szTip, strName, min(strName.GetLength(),sizeof(nid.szTip)-1));
Shell_NotifyIcon(NIM_MODIFY, &nid);
return 0;
}
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
/* ProfUIS Using Code
if (m_wndMenuBar.TranslateMainFrameMessage(pMsg))
return TRUE;
*/
if (WM_KEYDOWN == pMsg->message)
{
int nVirtKey = (int) pMsg->wParam;
if (VK_ESCAPE == nVirtKey && m_fullScreen.bFullScreen)
OnViewFullscreen();
if (m_SearchBox.IsWantChar(pMsg->wParam))
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
if (!pView ||
(pView->IsKindOf(RUNTIME_CLASS(CWizardView))
|| pView->IsKindOf(RUNTIME_CLASS(CGraphView))
|| pView->IsKindOf(RUNTIME_CLASS(CRealTimeView))
|| pView->IsKindOf(RUNTIME_CLASS(CMultiSortView))
|| pView->IsKindOf(RUNTIME_CLASS(CSListView))
|| pView->IsKindOf(RUNTIME_CLASS(CBaseView))
|| pView->IsKindOf(RUNTIME_CLASS(CSelectorView))))
{
CRect rect;
GetClientRect(&rect);
m_SearchBox.SetWindowPos(NULL, rect.right-FRM_SEARCH_WIDTH-18, rect.bottom-FRM_SEARCH_HEIGHT-22,
0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
m_SearchBox.OnChangeStatus(pMsg->wParam, pMsg->lParam, FALSE);
}
}
else if (/*::IsWindow(m_wndWorkspBar.GetSafeHwnd())
&& */!m_SearchBox.GetDroppedState()/* && !m_wndWorkspBar.IsWindowVisible()*/)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
if (pView &&
(pView->IsKindOf(RUNTIME_CLASS(CGraphView))
|| pView->IsKindOf(RUNTIME_CLASS(CRealTimeView))
|| pView->IsKindOf(RUNTIME_CLASS(CMultiSortView))
|| pView->IsKindOf(RUNTIME_CLASS(CSListView))))
pView->SetFocus();
}
}
return CTskMainFrame::PreTranslateMessage(pMsg);
}
void CMainFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
//CTskMainFrame::OnUpdateFrameTitle(bAddToTitle);
//if (::IsWindow(m_MdiTabbed.GetSafeHwnd()))
// m_MdiTabbed.UpdateWindows();
if (bAddToTitle)
{
CString strMainFrame;
VERIFY(strMainFrame.LoadString(IDR_MAINFRAME));
CString strTitle;
if (AfxExtractSubString(strTitle,strMainFrame,
CDocTemplate::windowTitle) && !strTitle.IsEmpty())
{
//strTitle += "(";
//strTitle += AfxGetVersionString();
//strTitle += ")";
// reset title
AfxSetWindowText(m_hWnd, strTitle);
}
}
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CTskMainFrame::OnSize(nType, cx, cy);
if (SIZE_MINIMIZED == nType)
{
if (AfxGetProfile().GetNotifyIcon())
ShowWindow(SW_HIDE);
}
}
void CMainFrame::OnClose()
{
// Kill Timer
KillTimer(TIMER_TIME);
KillTimer(TIMER_STOCKINDEXREFRESH);
if (m_fullScreen.bFullScreen)
OnViewFullscreen();
BOOL bCanClose;
bCanClose = TRUE;
CSimuView * pSimuView = AfxGetSimuView();
if (pSimuView && 0 == pSimuView->SendMessage(WM_USER_CANCLOSEVIEW, NULL, (LPARAM)(&bCanClose)) && !bCanClose)
return;
bCanClose = TRUE;
CSelectorView * pSelectorView = AfxGetSelectorView();
if (pSelectorView && 0 == pSelectorView->SendMessage(WM_USER_CANCLOSEVIEW, NULL, (LPARAM)(&bCanClose)) && !bCanClose)
return;
if (IsWindowVisible())
{
// My Own Bar State and Window Placement
// SaveBarState(_T("BarState"));
//AfxGetApp()->WriteProfileInt(szBarSection, szMainBar, m_wndMainBar.IsWindowVisible());
//AfxGetApp()->WriteProfileInt(szBarSection, szSListBar, m_wndSListBar.IsWindowVisible());
//AfxGetApp()->WriteProfileInt(szBarSection, szSimuBar, m_wndSimuBar.IsWindowVisible());
//AfxGetApp()->WriteProfileInt(szBarSection, szWorkspBar, m_wndWorkspBar.IsWindowVisible());
WINDOWPLACEMENT wp;
wp.length = sizeof wp;
if (GetWindowPlacement(&wp))
{
wp.flags = 0;
if (IsZoomed())
wp.flags |= WPF_RESTORETOMAXIMIZED;
// and write it to the .INI file
AfxGetProfile().SetWindowPlacement(&wp);
}
}
// delete notify icon
NOTIFYICONDATA nid;
memset(&nid, 0, sizeof(nid));
nid.cbSize = sizeof(nid);
nid.hWnd = GetSafeHwnd();
nid.uID = 1;
nid.uFlags = 0;
Shell_NotifyIcon(NIM_DELETE, &nid);
CTskMainFrame::OnClose();
}
BOOL CMainFrame::DestroyWindow()
{
/* ProfUIS Using Code
// Prof-UIS Bar State and WindowPlacement
VERIFY(CExtControlBar::ProfileBarStateSave(this, szRegKeyCompany, szRegKeyApp));
// VERIFY(g_CmdManager->SerializeState(szRegKeyApp, szRegKeyCompany, szRegKeyApp, true));
// g_CmdManager->ProfileWndRemove(GetSafeHwnd());
*/
return CTskMainFrame::DestroyWindow();
}
void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
{
if (!bSysMenu && pPopupMenu)
{
InitMenuPopup(pPopupMenu);
}
CTskMainFrame::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
}
////////////////////////////////////////////////////////////////////////////////
// ToolBar
// 工具条下拉菜单显示
void CMainFrame::OnMainBarDropDown(NMHDR* pNMHDR, LRESULT* pResult)
{
NMTOOLBAR* pNMToolBar = (NMTOOLBAR*)pNMHDR;
BOOL bLoad = FALSE;
CMenu menu;
if (ID_MAINBAR_SETTING == pNMToolBar->iItem)
bLoad = menu.LoadMenu(IDR_MENU_MAINBARSETTING);
else if (ID_MAINBAR_VIEW == pNMToolBar->iItem)
bLoad = menu.LoadMenu(IDR_MENU_MAINBARVIEW);
else if (ID_MAINBAR_TECH == pNMToolBar->iItem)
bLoad = menu.LoadMenu(IDR_MENU_MAINBARTECH);
else if (ID_MAINBAR_PERIOD == pNMToolBar->iItem)
bLoad = menu.LoadMenu(IDR_MENU_MAINBARPERIOD);
else
ASSERT(FALSE);
//if (bLoad)
//{
// CMenu* pPopupMenu = menu.GetSubMenu(0);
// if (pPopupMenu)
// {
// CPoint pt = CalcPopupMenuPoint(&m_wndMainBar, pNMToolBar->iItem, pPopupMenu);
// pPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, this);
// }
//}
*pResult = TBDDRET_DEFAULT;
}
void CMainFrame::OnSlistBarDropDown(NMHDR* pNMHDR, LRESULT* pResult)
{
NMTOOLBAR* pNMToolBar = (NMTOOLBAR*)pNMHDR;
BOOL bLoad = FALSE;
CMenu menu;
if (ID_SLISTBAR_GROUP == pNMToolBar->iItem)
bLoad = menu.LoadMenu(IDR_MENU_SLISTBARGROUP);
else if (ID_SLISTBAR_DOMAIN == pNMToolBar->iItem)
bLoad = menu.LoadMenu(IDR_MENU_SLISTBARDOMAIN);
else if (ID_SLISTBAR_CLASS == pNMToolBar->iItem)
bLoad = menu.LoadMenu(IDR_MENU_SLISTBARCLASS);
else
ASSERT(FALSE);
//if (bLoad)
//{
// CMenu* pPopupMenu = menu.GetSubMenu(0);
// if (pPopupMenu)
// {
// CPoint pt = CalcPopupMenuPoint(&m_wndSListBar, pNMToolBar->iItem, pPopupMenu);
// pPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, this);
// }
//}
*pResult = TBDDRET_DEFAULT;
}
#define ON_DROPDOWN_MENU(wndBar, nItem) \
NMTOOLBAR nmTB; \
memset(&nmTB, 0, sizeof(nmTB)); \
nmTB.iItem = nItem; \
nmTB.hdr.hwndFrom = wndBar.GetSafeHwnd(); \
nmTB.hdr.idFrom = wndBar.GetDlgCtrlID(); \
nmTB.hdr.code = TBN_DROPDOWN; \
SendMessage(WM_NOTIFY, IDW_MAINBAR, (LPARAM)&nmTB);
void CMainFrame::OnMainbarSetting() { /*ON_DROPDOWN_MENU(m_wndMainBar,ID_MAINBAR_SETTING);*/ }
void CMainFrame::OnMainbarView() { /*ON_DROPDOWN_MENU(m_wndMainBar,ID_MAINBAR_VIEW);*/ }
void CMainFrame::OnMainbarTech() { /*ON_DROPDOWN_MENU(m_wndMainBar,ID_MAINBAR_TECH);*/ }
void CMainFrame::OnMainbarPeriod() { /*ON_DROPDOWN_MENU(m_wndMainBar,ID_MAINBAR_PERIOD);*/ }
void CMainFrame::OnSlistbarGroup() { /*ON_DROPDOWN_MENU(m_wndSListBar,ID_SLISTBAR_GROUP);*/ }
void CMainFrame::OnSlistbarDomain() { /*ON_DROPDOWN_MENU(m_wndSListBar,ID_SLISTBAR_DOMAIN);*/ }
void CMainFrame::OnSlistbarClass() { /*ON_DROPDOWN_MENU(m_wndSListBar,ID_SLISTBAR_CLASS);*/ }
////////////////////////////////////////////////////////////////////////////////
// “系统”菜单
// 实时行情接收
void CMainFrame::OnSysConnectserver()
{
// AfxGetStkReceiver().NetEngineBeginWorking();
extern BOOL CALLBACK LoadProgram(HWND hWnd, int nMinProgress, int nMaxProgress);
CStartupDlg startup;
CBitmap bmp;
bmp.LoadBitmap(IDB_DLGLEFTLOGO);
startup.SetBitmap((HBITMAP)bmp.GetSafeHandle());
startup.SetLoadProgramFunc(LoadProgram);
startup.SetDisableOffline(TRUE);
startup.DoModal();
}
void CMainFrame::OnUpdateSysConnectserver(CCmdUI* pCmdUI)
{
pCmdUI->Enable(!AfxGetStkReceiver().NetEngineIsWorking());
}
void CMainFrame::OnSysDisconnectserver()
{
AfxGetStkReceiver().NetEngineEndWorking();
}
void CMainFrame::OnUpdateSysDisconnectserver(CCmdUI* pCmdUI)
{
pCmdUI->Enable(AfxGetStkReceiver().NetEngineIsWorking());
}
void CMainFrame::OnSysStarttongshi()
{
AfxGetStkReceiver().EngineBeginWorking(TRUE);
AfxGetSListStockContainer().ReRetrieveFromStatic(AfxGetActiveStrategy());
AfxGetStaticDoc()->UpdateAllViews(NULL, UPDATE_HINT_SLISTVIEW, NULL);
}
void CMainFrame::OnUpdateSysStarttongshi(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(AfxGetStkReceiver().EngineIsWorking());
pCmdUI->Enable(TRUE);
}
void CMainFrame::OnSysSetuptongshi()
{
AfxGetStkReceiver().EngineSetup();
AfxGetSListStockContainer().ReRetrieveFromStatic(AfxGetActiveStrategy());
AfxGetStaticDoc()->UpdateAllViews(NULL, UPDATE_HINT_SLISTVIEW, NULL);
AfxGetStaticDoc()->UpdateAllViews(NULL, UPDATE_HINT_GRAPHVIEW, NULL);
}
void CMainFrame::OnUpdateSysSetuptongshi(CCmdUI* pCmdUI)
{
pCmdUI->Enable(AfxGetStkReceiver().EngineIsWorking());
}
void CMainFrame::OnSysStoptongshi()
{
AfxGetStkReceiver().EngineEndWorking();
}
void CMainFrame::OnUpdateSysStoptongshi(CCmdUI* pCmdUI)
{
pCmdUI->Enable(AfxGetStkReceiver().EngineIsWorking());
}
void CMainFrame::OnSysAutoupgrade()
{
CUpgradeDlg * dlg = new CUpgradeDlg;
dlg->Create(CUpgradeDlg::IDD, this);
dlg->SetAutoDelete(TRUE);
dlg->CenterWindow(this);
dlg->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOSIZE);
}
void CMainFrame::OnSysAutosave()
{
AfxGetProfile().SetAutoSaveKDataMin(!AfxGetProfile().GetAutoSaveKDataMin());
}
void CMainFrame::OnUpdateSysAutosave(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(AfxGetProfile().GetAutoSaveKDataMin());
pCmdUI->Enable(TRUE);
}
void CMainFrame::OnSysNotifyicon()
{
AfxGetProfile().SetNotifyIcon(!AfxGetProfile().GetNotifyIcon());
}
void CMainFrame::OnUpdateSysNotifyicon(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(AfxGetProfile().GetNotifyIcon());
pCmdUI->Enable(TRUE);
}
////////////////////////////////////////////////////////////////////////////////
// “查看”菜单
// 标准工具条文字标签显示
void CMainFrame::OnViewMainbartext()
{
//m_wndMainBar.ToggleTextLabel(CTextToolBar::labelBottom);
//m_wndSListBar.ToggleTextLabel(CTextToolBar::labelRight);
//RecalcLayout();
}
void CMainFrame::OnUpdateViewMainbartext(CCmdUI* pCmdUI)
{
//pCmdUI->SetCheck(m_wndMainBar.IsTextLabelVisible());
}
void CMainFrame::OnViewFullscreen()
{
int nHeight = 0; //GetSystemMetrics(SM_CYMENU);
if (m_fullScreen.bFullScreen)
{
m_fullScreen.bFullScreen = FALSE;
if (m_fullScreen.bMaximized)
{
MoveWindow( -GetSystemMetrics(SM_CXFRAME),
-GetSystemMetrics(SM_CYFRAME)-nHeight,
GetSystemMetrics(SM_CXSCREEN) + 2*GetSystemMetrics(SM_CXFRAME),
GetSystemMetrics(SM_CYSCREEN) + 2*GetSystemMetrics(SM_CYFRAME) + nHeight);
}
else
SendMessage(WM_SYSCOMMAND, SC_RESTORE);
//if (m_fullScreen.bMainBar && !m_wndMainBar.IsWindowVisible())
// OnBarCheck(IDW_MAINBAR);
//if (m_fullScreen.bSListBar && !m_wndSListBar.IsWindowVisible())
// OnBarCheck(IDW_SLISTBAR);
//if (m_fullScreen.bSimuBar && !m_wndSimuBar.IsWindowVisible())
// OnBarCheck(IDW_SIMUBAR);
//if (m_fullScreen.bStatusBar && !m_wndStatusBar.IsWindowVisible())
// OnBarCheck(AFX_IDW_STATUS_BAR);
//if (m_fullScreen.bWorkspBar && !m_wndWorkspBar.IsWindowVisible())
// OnToggleWorkspBar();
memset(&m_fullScreen, 0, sizeof(m_fullScreen));
}
else
{
m_fullScreen.bFullScreen = TRUE;
m_fullScreen.bMaximized = IsZoomed();
//if (m_wndStatusBar.IsWindowVisible())
//{
// m_fullScreen.bStatusBar = 1;
// OnBarCheck(AFX_IDW_STATUS_BAR);
//}
//if (m_wndWorkspBar.IsWindowVisible())
//{
// m_fullScreen.bWorkspBar = 1;
// OnToggleWorkspBar();
//}
if (!m_fullScreen.bMaximized)
SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE);
else
MoveWindow( -GetSystemMetrics(SM_CXFRAME),
-GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYCAPTION) - nHeight,
GetSystemMetrics(SM_CXSCREEN) + 2*GetSystemMetrics(SM_CXFRAME),
GetSystemMetrics(SM_CYSCREEN) + 2*GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYCAPTION) + nHeight);
}
}
void CMainFrame::OnUpdateViewFullscreen(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_fullScreen.bFullScreen);
}
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
CTskMainFrame::OnGetMinMaxInfo(lpMMI);
if (m_fullScreen.bFullScreen)
{
int nHeight = GetSystemMetrics(SM_CYMENU);
lpMMI->ptMaxPosition.y = -GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYCAPTION) - nHeight;
lpMMI->ptMaxTrackSize.y = lpMMI->ptMaxSize.y
= GetSystemMetrics(SM_CYSCREEN)
+ 2*GetSystemMetrics(SM_CYFRAME)
+ GetSystemMetrics(SM_CYCAPTION)
+ nHeight;
}
}
// 显示功能视图
void CMainFrame::OnViewWizard()
{
AfxSwitchToStaticView(RUNTIME_CLASS(CWizardView));
}
void CMainFrame::OnUpdateViewWizard(CCmdUI* pCmdUI)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
pCmdUI->SetCheck(pView && pView->IsKindOf(RUNTIME_CLASS(CWizardView)));
}
void CMainFrame::OnViewSimu()
{
AfxSwitchToStaticView(RUNTIME_CLASS(CSimuView));
}
void CMainFrame::OnUpdateViewSimu(CCmdUI* pCmdUI)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
pCmdUI->SetCheck(pView && pView->IsKindOf(RUNTIME_CLASS(CSimuView)));
}
void CMainFrame::OnViewSlist()
{
AfxSwitchToStaticView(RUNTIME_CLASS(CSListView));
}
void CMainFrame::OnUpdateViewSlist(CCmdUI* pCmdUI)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
pCmdUI->SetCheck(pView && pView->IsKindOf(RUNTIME_CLASS(CSListView)));
}
void CMainFrame::OnViewRealtime()
{
AfxSwitchToStaticView(RUNTIME_CLASS(CRealTimeView));
}
void CMainFrame::OnUpdateViewRealtime(CCmdUI* pCmdUI)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
pCmdUI->SetCheck(pView && pView->IsKindOf(RUNTIME_CLASS(CRealTimeView)));
}
void CMainFrame::OnViewMultisort()
{
AfxSwitchToStaticView(RUNTIME_CLASS(CMultiSortView));
}
void CMainFrame::OnUpdateViewMultisort(CCmdUI* pCmdUI)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
pCmdUI->SetCheck(pView && pView->IsKindOf(RUNTIME_CLASS(CMultiSortView)));
}
void CMainFrame::OnViewTechgraph()
{
AfxSwitchToStaticView(RUNTIME_CLASS(CGraphView));
}
void CMainFrame::OnUpdateViewTechgraph(CCmdUI* pCmdUI)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
pCmdUI->SetCheck(pView && pView->IsKindOf(RUNTIME_CLASS(CGraphView)));
}
void CMainFrame::OnViewBase()
{
AfxSwitchToStaticView(RUNTIME_CLASS(CBaseView));
}
void CMainFrame::OnUpdateViewBase(CCmdUI* pCmdUI)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
pCmdUI->SetCheck(pView && pView->IsKindOf(RUNTIME_CLASS(CBaseView)));
}
void CMainFrame::OnViewInfo()
{
AfxSwitchToStaticView(RUNTIME_CLASS(CInfoView));
}
void CMainFrame::OnUpdateViewInfo(CCmdUI* pCmdUI)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
pCmdUI->SetCheck(pView && pView->IsKindOf(RUNTIME_CLASS(CInfoView)));
}
void CMainFrame::OnViewSelector()
{
AfxSwitchToStaticView(RUNTIME_CLASS(CSelectorView));
}
void CMainFrame::OnUpdateViewSelector(CCmdUI* pCmdUI)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
pCmdUI->SetCheck(pView && pView->IsKindOf(RUNTIME_CLASS(CSelectorView)));
}
void CMainFrame::OnViewF10()
{
AfxSwitchToStaticView(RUNTIME_CLASS(CBaseView));
// AfxSwitchToStaticView(RUNTIME_CLASS(CInfoView));
// ::PostMessage(AfxGetInfoView()->GetSafeHwnd(), WM_COMMAND, ID_VIEW_F10, 0);
}
void CMainFrame::OnUpdateViewF10(CCmdUI* pCmdUI)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
pCmdUI->SetCheck(pView && pView->IsKindOf(RUNTIME_CLASS(CBaseView)));
// CView * pView = AfxGetStaticDoc()->GetActiveView();
// CInfoView * pInfoView = AfxGetInfoView();
// pCmdUI->SetCheck(pView && pView->IsKindOf(RUNTIME_CLASS(CInfoView))
// && pInfoView && pInfoView->IsViewF10());
}
////////////////////////////////////////////////////////////////////////////////
// “列表”菜单
// 股票列表
void CMainFrame::OnSlistIndex() { AfxShowSlist(CStockContainer::typeIndex); }
void CMainFrame::OnSlistStrategy() { AfxShowSlist(CStockContainer::typeStrategy); }
void CMainFrame::OnSlistGroup() { AfxShowSlist(CStockContainer::typeGroup); }
void CMainFrame::OnSlistGroupself()
{ CString strSelf;
strSelf.LoadString(IDS_DOMAIN_SELF);
AfxShowSlist(CStockContainer::typeGroup, strSelf); }
void CMainFrame::OnSlistDomain(){ AfxShowSlist(CStockContainer::typeDomain);}
void CMainFrame::OnSlistDomainRange(UINT nCmdID)
{
if (nCmdID < ID_SLIST_DOMAIN_START || nCmdID > ID_SLIST_DOMAIN_END)
{
ASSERT(FALSE);
return;
}
CDomainContainer &container = AfxGetDomainContainer();
int nIndex = nCmdID - ID_SLIST_DOMAIN_START;
CString strDomainName;
if (ID_SLIST_DOMAIN_END == nCmdID)
{
CSelectGrpDlg dlg;
dlg.SetMode(CSelectGrpDlg::modeDomain);
if (IDOK == dlg.DoModal())
strDomainName = dlg.GetSelectedName();
else
return;
}
else if (nIndex < container.GetSize())
{
CDomain & domain = container.ElementAt(nIndex);
strDomainName = domain.m_strName;
}
else
{
ASSERT(FALSE);
return;
}
AfxShowSlist(CStockContainer::typeDomain, strDomainName);
}
void CMainFrame::OnSlistGroupRange(UINT nCmdID)
{
if (nCmdID < ID_SLIST_GROUP_START || nCmdID > ID_SLIST_GROUP_END)
{
ASSERT(FALSE);
return;
}
CDomainContainer &container = AfxGetGroupContainer();
int nIndex = nCmdID - ID_SLIST_GROUP_START;
CString strGroupName;
if (ID_SLIST_GROUP_END == nCmdID)
{
CSelectGrpDlg dlg;
dlg.SetMode(CSelectGrpDlg::modeGroup);
if (IDOK == dlg.DoModal())
strGroupName = dlg.GetSelectedName();
else
return;
}
else if (nIndex < container.GetSize())
{
CDomain & domain = container.ElementAt(nIndex);
strGroupName = domain.m_strName;
}
else
{
ASSERT(FALSE);
return;
}
AfxShowSlist(CStockContainer::typeGroup, strGroupName);
}
// 股票列表报价
void CMainFrame::OnSlistAll() { AfxShowSlist(CStockContainer::typeAll); }
void CMainFrame::OnSlistShaa() { AfxShowSlist(CStockContainer::typeClassShaa); }
void CMainFrame::OnSlistShab() { AfxShowSlist(CStockContainer::typeClassShab); }
void CMainFrame::OnSlistSzna() { AfxShowSlist(CStockContainer::typeClassSzna); }
void CMainFrame::OnSlistSznb() { AfxShowSlist(CStockContainer::typeClassSznb); }
void CMainFrame::OnSlistShabond() { AfxShowSlist(CStockContainer::typeClassShabond); }
void CMainFrame::OnSlistSznbond() { AfxShowSlist(CStockContainer::typeClassSznbond); }
// 股票列表涨跌排名
void CMainFrame::OnSlistShaasortdp() { AfxShowSlistSortDP(CStockContainer::typeClassShaa); }
void CMainFrame::OnSlistShabsortdp() { AfxShowSlistSortDP(CStockContainer::typeClassShab); }
void CMainFrame::OnSlistSznasortdp() { AfxShowSlistSortDP(CStockContainer::typeClassSzna); }
void CMainFrame::OnSlistSznbsortdp() { AfxShowSlistSortDP(CStockContainer::typeClassSznb); }
void CMainFrame::OnSlistShabondsortdp() { AfxShowSlistSortDP(CStockContainer::typeClassShabond); }
void CMainFrame::OnSlistSznbondsortdp() { AfxShowSlistSortDP(CStockContainer::typeClassSznbond); }
void CMainFrame::OnSlistSetcolumn()
{
CSListView * pView = AfxGetSListView();
if (pView)
pView->StoreColumnOrderArray();
CSetColumnDlg dlg;
if (IDOK == dlg.DoModal())
{
// Show
CSListView * pView = AfxGetSListView();
if (pView)
pView->ResetColumns();
AfxGetStaticDoc()->UpdateAllViews(NULL, UPDATE_HINT_SLISTVIEW, NULL);
AfxGetStaticDoc()->UpdateAllViews(NULL, UPDATE_HINT_SELECTORVIEW, NULL);
}
}
void CMainFrame::OnSlistBaseindex()
{
CBaseIndexDlg dlg;
if (IDOK == dlg.DoModal() && dlg.m_bAddToList)
{
// Show
CSListView * pView = AfxGetSListView();
if (pView)
pView->ResetColumns();
AfxGetStaticDoc()->UpdateAllViews(NULL, UPDATE_HINT_SLISTVIEW, NULL);
AfxGetStaticDoc()->UpdateAllViews(NULL, UPDATE_HINT_SELECTORVIEW, NULL);
}
}
void CMainFrame::OnSlistbarDate() { }
void CMainFrame::OnSlistbarName() { }
////////////////////////////////////////////////////////////////////////////////
// “技术”菜单
// 指数日线显示
void CMainFrame::OnViewViewszzs() { AfxShowStockGraph(STKLIB_CODE_SZZS); }
void CMainFrame::OnViewViewszybl() { AfxShowStockGraph(STKLIB_CODE_SZYBL); }
void CMainFrame::OnViewViewszag() { AfxShowStockGraph(STKLIB_CODE_SZAG); }
void CMainFrame::OnViewViewszbg() { AfxShowStockGraph(STKLIB_CODE_SZBG); }
void CMainFrame::OnViewViewszncz() { AfxShowStockGraph(STKLIB_CODE_SZNCZ); }
void CMainFrame::OnViewViewsznzz() { AfxShowStockGraph(STKLIB_CODE_SZNZZ); }
void CMainFrame::OnViewViewszncfaz(){ AfxShowStockGraph(STKLIB_CODE_SZNCFAZ); }
void CMainFrame::OnViewViewszncfbz(){ AfxShowStockGraph(STKLIB_CODE_SZNCFBZ); }
void CMainFrame::OnViewTechoption()
{
CSetParamDlg dlg;
dlg.DoModal();
CGraphView * pGraphView = AfxGetGraphView();
if (pGraphView)
pGraphView->OnTechParametersChange();
AfxGetStaticDoc()->UpdateAllViews(NULL, UPDATE_HINT_GRAPHVIEW, NULL);
}
#define SWITCH_SHOW_GRAPH_COMMAND(nID, nIDLast) \
AfxSwitchToStaticView(RUNTIME_CLASS(CGraphView)); \
::PostMessage(AfxGetGraphView()->GetSafeHwnd(), WM_COMMAND, nID, nIDLast);
#define UPDATE_GRAPH_CMDUI(pCmdUI, updateFunc) \
CGraphView * pGraphView = AfxGetGraphView(); \
if (pGraphView) \
pGraphView->updateFunc(pCmdUI); \
else \
pCmdUI->Enable(TRUE);
// K线图周期
void CMainFrame::OnViewPday() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_PDAY, 0); }
void CMainFrame::OnUpdateViewPday(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewPday); }
void CMainFrame::OnViewPweek() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_PWEEK, 0); }
void CMainFrame::OnUpdateViewPweek(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewPweek); }
void CMainFrame::OnViewPmonth() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_PMONTH, 0); }
void CMainFrame::OnUpdateViewPmonth(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewPmonth); }
void CMainFrame::OnViewPmin5() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_PMIN5, 0); }
void CMainFrame::OnUpdateViewPmin5(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewPmin5); }
void CMainFrame::OnViewPmin15() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_PMIN15, 0); }
void CMainFrame::OnUpdateViewPmin15(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewPmin15); }
void CMainFrame::OnViewPmin30() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_PMIN30, 0); }
void CMainFrame::OnUpdateViewPmin30(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewPmin30); }
void CMainFrame::OnViewPmin60() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_PMIN60, 0); }
void CMainFrame::OnUpdateViewPmin60(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewPmin60); }
// K线图移动
void CMainFrame::OnViewLeft() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_LEFT, 0); }
void CMainFrame::OnViewRight() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_RIGHT, 0); }
void CMainFrame::OnViewPageleft() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_PAGELEFT, 0); }
void CMainFrame::OnViewPageright() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_PAGERIGHT, 0); }
void CMainFrame::OnViewHome() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_HOME, 0); }
void CMainFrame::OnViewEnd() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_END, 0); }
void CMainFrame::OnViewZoomin() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_ZOOMIN, 0); }
void CMainFrame::OnViewZoomout() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_ZOOMOUT, 0); }
void CMainFrame::OnViewPrev() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_PREV, 0); }
void CMainFrame::OnViewNext() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_NEXT, 0); }
void CMainFrame::OnViewInsert() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_INSERT, 0); }
//add by lc
void CMainFrame::OnViewExcelData() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_EXCEL_DATA, 0); }
void CMainFrame::OnViewTechRange(UINT nCmdID) { SWITCH_SHOW_GRAPH_COMMAND(nCmdID, 0); }
void CMainFrame::OnUpdateViewTechRange(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewTechRange); }
// K Format
void CMainFrame::OnViewNoresumedr() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_NORESUMEDR, 0); }
void CMainFrame::OnUpdateViewNoresumedr(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewNoresumedr); }
void CMainFrame::OnViewResumedrup() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_RESUMEDRUP, 0); }
void CMainFrame::OnUpdateViewResumedrup(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewResumedrup); }
void CMainFrame::OnViewResumedrdown() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_RESUMEDRDOWN, 0); }
void CMainFrame::OnUpdateViewResumedrdown(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewResumedrdown); }
// Main data Type
void CMainFrame::OnViewMaindataclose() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_MAINDATACLOSE, 0); }
void CMainFrame::OnUpdateViewMaindataclose(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewMaindataclose); }
void CMainFrame::OnViewMaindataopen() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_MAINDATAOPEN, 0); }
void CMainFrame::OnUpdateViewMaindataopen(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewMaindataopen); }
void CMainFrame::OnViewMaindataaverage(){ SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_MAINDATAAVERAGE, 0);}
void CMainFrame::OnUpdateViewMaindataaverage(CCmdUI* pCmdUI){ UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewMaindataaverage); }
// kline Mode
void CMainFrame::OnViewKlinecandle() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_KLINECANDLE, 0); }
void CMainFrame::OnUpdateViewKlinecandle(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewKlinecandle); }
void CMainFrame::OnViewKlineamerica() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_KLINEAMERICA, 0); }
void CMainFrame::OnUpdateViewKlineamerica(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewKlineamerica); }
void CMainFrame::OnViewKlinetower() { SWITCH_SHOW_GRAPH_COMMAND(ID_VIEW_KLINETOWER, 0); }
void CMainFrame::OnUpdateViewKlinetower(CCmdUI* pCmdUI) { UPDATE_GRAPH_CMDUI(pCmdUI,OnUpdateViewKlinetower); }
////////////////////////////////////////////////////////////////////////////////
// “行情”菜单
// 指数实时行情显示
void CMainFrame::OnRealtimeViewszzs() { AfxShowStockRealTime(STKLIB_CODE_SZZS); }
void CMainFrame::OnRealtimeViewszybl() { AfxShowStockRealTime(STKLIB_CODE_SZYBL); }
void CMainFrame::OnRealtimeViewszag() { AfxShowStockRealTime(STKLIB_CODE_SZAG); }
void CMainFrame::OnRealtimeViewszbg() { AfxShowStockRealTime(STKLIB_CODE_SZBG); }
void CMainFrame::OnRealtimeViewszncz() { AfxShowStockRealTime(STKLIB_CODE_SZNCZ); }
void CMainFrame::OnRealtimeViewsznzz() { AfxShowStockRealTime(STKLIB_CODE_SZNZZ); }
void CMainFrame::OnRealtimeViewszncfaz() { AfxShowStockRealTime(STKLIB_CODE_SZNCFAZ); }
void CMainFrame::OnRealtimeViewszncfbz() { AfxShowStockRealTime(STKLIB_CODE_SZNCFBZ); }
#define SWITCH_SHOW_REALTIME_COMMAND(nID, nIDLast) \
AfxSwitchToStaticView(RUNTIME_CLASS(CRealTimeView)); \
::PostMessage(AfxGetRealTimeView()->GetSafeHwnd(), WM_COMMAND, nID, nIDLast);
#define SWITCH_SHOW_REALTIME_MULTISTOCK(nMultiStockCount) \
AfxSwitchToStaticView(RUNTIME_CLASS(CRealTimeView)); \
CRealTimeView * pView = AfxGetRealTimeView(); \
if (pView) pView->ShowMultiStock(nMultiStockCount);
// 实时行情键盘响应
void CMainFrame::OnRealtimeLeft() { SWITCH_SHOW_REALTIME_COMMAND(ID_REALTIME_LEFT, 0); }
void CMainFrame::OnRealtimeRight() { SWITCH_SHOW_REALTIME_COMMAND(ID_REALTIME_RIGHT, 0); }
void CMainFrame::OnRealtimeHome() { SWITCH_SHOW_REALTIME_COMMAND(ID_REALTIME_HOME, 0); }
void CMainFrame::OnRealtimeEnd() { SWITCH_SHOW_REALTIME_COMMAND(ID_REALTIME_END, 0); }
void CMainFrame::OnRealtimePrev() { SWITCH_SHOW_REALTIME_COMMAND(ID_REALTIME_PREV, 0); }
void CMainFrame::OnRealtimeNext() { SWITCH_SHOW_REALTIME_COMMAND(ID_REALTIME_NEXT, 0); }
void CMainFrame::OnRealtimeOnestock() { SWITCH_SHOW_REALTIME_MULTISTOCK(1); }
void CMainFrame::OnRealtimeTwostock() { SWITCH_SHOW_REALTIME_MULTISTOCK(2); }
void CMainFrame::OnRealtimeFourstock() { SWITCH_SHOW_REALTIME_MULTISTOCK(4); }
void CMainFrame::OnRealtimeSixstock() { SWITCH_SHOW_REALTIME_MULTISTOCK(6); }
void CMainFrame::OnRealtimeNinestock() { SWITCH_SHOW_REALTIME_MULTISTOCK(9); }
void CMainFrame::OnUpdateRealtimeOnestock(CCmdUI* pCmdUI)
{ CRealTimeView * pView = AfxGetRealTimeView();
pCmdUI->SetCheck(pView && 1 == pView->GetShowMultiStock()); }
void CMainFrame::OnUpdateRealtimeTwostock(CCmdUI* pCmdUI)
{ CRealTimeView * pView = AfxGetRealTimeView();
pCmdUI->SetCheck(pView && 2 == pView->GetShowMultiStock()); }
void CMainFrame::OnUpdateRealtimeFourstock(CCmdUI* pCmdUI)
{ CRealTimeView * pView = AfxGetRealTimeView();
pCmdUI->SetCheck(pView && 4 == pView->GetShowMultiStock()); }
void CMainFrame::OnUpdateRealtimeSixstock(CCmdUI* pCmdUI)
{ CRealTimeView * pView = AfxGetRealTimeView();
pCmdUI->SetCheck(pView && 6 == pView->GetShowMultiStock()); }
void CMainFrame::OnUpdateRealtimeNinestock(CCmdUI* pCmdUI)
{ CRealTimeView * pView = AfxGetRealTimeView();
pCmdUI->SetCheck(pView && 9 == pView->GetShowMultiStock()); }
void CMainFrame::OnRealtimePriceline()
{ AfxSwitchToStaticView(RUNTIME_CLASS(CRealTimeView));
CRealTimeView * pView = AfxGetRealTimeView();
if (pView) pView->ChangeDrawMode(CRealTime::modePriceLine); }
void CMainFrame::OnRealtimeReportdetail()
{ AfxSwitchToStaticView(RUNTIME_CLASS(CRealTimeView));
CRealTimeView * pView = AfxGetRealTimeView();
if (pView) pView->ChangeDrawMode(CRealTime::modeReportDetail); }
void CMainFrame::OnRealtimeMinutedetail()
{ AfxSwitchToStaticView(RUNTIME_CLASS(CRealTimeView));
CRealTimeView * pView = AfxGetRealTimeView();
if (pView) pView->ChangeDrawMode(CRealTime::modeMinuteDetail); }
void CMainFrame::OnRealtimeBigtradedetail()
{ AfxSwitchToStaticView(RUNTIME_CLASS(CRealTimeView));
CRealTimeView * pView = AfxGetRealTimeView();
if (pView) pView->ChangeDrawMode(CRealTime::modeBigTradeDetail); }
void CMainFrame::OnRealtimeLbdk()
{ AfxSwitchToStaticView(RUNTIME_CLASS(CRealTimeView));
CRealTimeView * pView = AfxGetRealTimeView();
if (pView) pView->ChangeDrawMode(CRealTime::modePriceLine);
if (pView) pView->ToggleDrawTechLine(CRealTime::techLBDK); }
void CMainFrame::OnRealtimeMmld()
{ AfxSwitchToStaticView(RUNTIME_CLASS(CRealTimeView));
CRealTimeView * pView = AfxGetRealTimeView();
if (pView) pView->ChangeDrawMode(CRealTime::modePriceLine);
if (pView) pView->ToggleDrawTechLine(CRealTime::techMMLD); }
void CMainFrame::OnUpdateRealtimePriceline(CCmdUI* pCmdUI)
{ CRealTimeView * pView = AfxGetRealTimeView();
pCmdUI->SetCheck(pView && CRealTime::modePriceLine == pView->GetDrawMode()); }
void CMainFrame::OnUpdateRealtimeReportdetail(CCmdUI* pCmdUI)
{ CRealTimeView * pView = AfxGetRealTimeView();
pCmdUI->SetCheck(pView && CRealTime::modeReportDetail == pView->GetDrawMode()); }
void CMainFrame::OnUpdateRealtimeMinutedetail(CCmdUI* pCmdUI)
{ CRealTimeView * pView = AfxGetRealTimeView();
pCmdUI->SetCheck(pView && CRealTime::modeMinuteDetail == pView->GetDrawMode()); }
void CMainFrame::OnUpdateRealtimeBigtradedetail(CCmdUI* pCmdUI)
{ CRealTimeView * pView = AfxGetRealTimeView();
pCmdUI->SetCheck(pView && CRealTime::modeBigTradeDetail == pView->GetDrawMode()); }
void CMainFrame::OnUpdateRealtimeLbdk(CCmdUI* pCmdUI)
{ CRealTimeView * pView = AfxGetRealTimeView();
pCmdUI->SetCheck(pView && CRealTime::techLBDK == pView->GetDrawTechLine()); }
void CMainFrame::OnUpdateRealtimeMmld(CCmdUI* pCmdUI)
{ CRealTimeView * pView = AfxGetRealTimeView();
pCmdUI->SetCheck(pView && CRealTime::techMMLD == pView->GetDrawTechLine()); }
// 分类股票综合排序
void CMainFrame::OnRealtimeMsszag() { AfxShowMultiSort(CStock::typeshA); }
void CMainFrame::OnRealtimeMsszbg() { AfxShowMultiSort(CStock::typeshB); }
void CMainFrame::OnRealtimeMsszzq() { AfxShowMultiSort(CStock::typeshBond); }
void CMainFrame::OnRealtimeMssznag() { AfxShowMultiSort(CStock::typeszA); }
void CMainFrame::OnRealtimeMssznbg() { AfxShowMultiSort(CStock::typeszB); }
void CMainFrame::OnRealtimeMssznzq() { AfxShowMultiSort(CStock::typeszBond); }
static LONG GetMultiSortClass()
{
CMultiSortView * pMultiSortView = AfxGetMultiSortView();
if (pMultiSortView)
return pMultiSortView->GetMultiSortClass();
return CStock::typeNone;
}
void CMainFrame::OnUpdateRealtimeMsszag(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CStock::typeshA == GetMultiSortClass()); }
void CMainFrame::OnUpdateRealtimeMsszbg(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CStock::typeshB == GetMultiSortClass()); }
void CMainFrame::OnUpdateRealtimeMsszzq(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CStock::typeshBond == GetMultiSortClass()); }
void CMainFrame::OnUpdateRealtimeMssznag(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CStock::typeszA == GetMultiSortClass()); }
void CMainFrame::OnUpdateRealtimeMssznbg(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CStock::typeszB == GetMultiSortClass()); }
void CMainFrame::OnUpdateRealtimeMssznzq(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CStock::typeszBond == GetMultiSortClass()); }
// 在线资讯
void CMainFrame::OnInfoSelf() { AfxShowInfo(CInfoView::serverSelf); }
void CMainFrame::OnInfoF10() { AfxShowInfo(CInfoView::serverF10); }
void CMainFrame::OnInfoStockstar() { AfxShowInfo(CInfoView::serverStockstar); }
void CMainFrame::OnInfoSohu() { AfxShowInfo(CInfoView::serverSohu); }
void CMainFrame::OnInfoSina() { AfxShowInfo(CInfoView::serverSina); }
void CMainFrame::OnInfo163() { AfxShowInfo(CInfoView::server163); }
void CMainFrame::OnInfoShse() { AfxShowInfo(CInfoView::serverShse); }
void CMainFrame::OnInfoSzse() { AfxShowInfo(CInfoView::serverSzse); }
void CMainFrame::OnInfoHkex() { AfxShowInfo(CInfoView::serverHkex); }
void CMainFrame::OnInfoLse() { AfxShowInfo(CInfoView::serverLse); }
void CMainFrame::OnInfoNyse() { AfxShowInfo(CInfoView::serverNyse); }
void CMainFrame::OnInfoNasdaq() { AfxShowInfo(CInfoView::serverNasdaq); }
void CMainFrame::OnInfoP5w() { AfxShowInfo(CInfoView::serverP5w); }
void CMainFrame::OnInfoSsnews() { AfxShowInfo(CInfoView::serverSsnews); }
void CMainFrame::OnInfoCs() { AfxShowInfo(CInfoView::serverCs); }
static int GetInfoServer()
{
CInfoView * pInfoView = AfxGetInfoView();
if (pInfoView)
return pInfoView->GetCurrentServer();
return CInfoView::serverUnknown;
}
void CMainFrame::OnUpdateInfoSelf(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverSelf == GetInfoServer()); }
void CMainFrame::OnUpdateInfoF10(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverF10 == GetInfoServer()); }
void CMainFrame::OnUpdateInfoStockstar(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverStockstar == GetInfoServer()); }
void CMainFrame::OnUpdateInfoSohu(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverSohu == GetInfoServer()); }
void CMainFrame::OnUpdateInfoSina(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverSina == GetInfoServer()); }
void CMainFrame::OnUpdateInfo163(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::server163 == GetInfoServer()); }
void CMainFrame::OnUpdateInfoShse(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverShse == GetInfoServer()); }
void CMainFrame::OnUpdateInfoSzse(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverSzse == GetInfoServer()); }
void CMainFrame::OnUpdateInfoHkex(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverHkex == GetInfoServer()); }
void CMainFrame::OnUpdateInfoLse(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverLse == GetInfoServer()); }
void CMainFrame::OnUpdateInfoNyse(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverNyse == GetInfoServer()); }
void CMainFrame::OnUpdateInfoNasdaq(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverNasdaq == GetInfoServer()); }
void CMainFrame::OnUpdateInfoP5w(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverP5w == GetInfoServer()); }
void CMainFrame::OnUpdateInfoSsnews(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverSsnews == GetInfoServer()); }
void CMainFrame::OnUpdateInfoCs(CCmdUI* pCmdUI) { pCmdUI->SetCheck(CInfoView::serverCs == GetInfoServer()); }
////////////////////////////////////////////////////////////////////////////////
// “策略”菜单
// 策略
void CMainFrame::OnStrategyProperty()
{
CSimuView * pSimuView = AfxGetSimuView();
if (pSimuView && !pSimuView->StoreToStrategy())
return;
CStrategy * pStrategy = AfxGetActiveStrategy();
if (pStrategy)
{
CSetPrpt firstPage(NULL, IDS_STRATEGY_SETPRPT, NULL);
firstPage.SetStrategy(pStrategy);
CSelectStk selectStk(NULL, IDS_STRATEGY_SELECTSTK, NULL);
selectStk.m_dwButtonFlags = 0;
selectStk.m_domainTemp.Copy(pStrategy->GetStocks());
CSetRule setrule(NULL, IDS_STRATEGY_SETRULE, NULL);
setrule.SetTechParameters(&(pStrategy->GetTechParametersBuy()), &(pStrategy->GetSelectedTechsBuy()));
CSetRate setrate(NULL, IDS_STRATEGY_SETRATE, NULL);
setrate.SetStrategy(pStrategy);
CPropertySheetEx sht;
sht.AddPage(&firstPage);
sht.AddPage(&selectStk);
sht.AddPage(&setrule);
sht.AddPage(&setrate);
sht.SetActivePage(&firstPage);
//CBitmap bmp;
//bmp.LoadBitmap(IDB_BALANG);
//sht.SetBitmap((HBITMAP)bmp.GetSafeHandle());
sht.DoModal();
pStrategy->SetStocks(selectStk.m_domainTemp);
pStrategy->DoFileSave();
AfxOnStrategyUpdated(pStrategy, selectStk.m_bModified || setrule.m_bModified || setrate.m_bModified);
}
}
void CMainFrame::OnUpdateStrategyProperty(CCmdUI* pCmdUI)
{
CStrategy * pStrategy = AfxGetActiveStrategy();
pCmdUI->Enable(pStrategy && pStrategy->CanModifiedNow());
}
void CMainFrame::OnStrategyStocks()
{
CSimuView * pSimuView = AfxGetSimuView();
if (pSimuView && !pSimuView->StoreToStrategy())
return;
CStrategy * pStrategy = AfxGetActiveStrategy();
if (pStrategy)
{
CSetPrpt firstPage(NULL, IDS_STRATEGY_SETPRPT, NULL);
firstPage.SetStrategy(pStrategy);
CSelectStk selectStk(NULL, IDS_STRATEGY_SELECTSTK, NULL);
selectStk.m_dwButtonFlags = 0;
selectStk.m_domainTemp.Copy(pStrategy->GetStocks());
CSetRule setrule(NULL, IDS_STRATEGY_SETRULE, NULL);
setrule.SetTechParameters(&(pStrategy->GetTechParametersBuy()), &(pStrategy->GetSelectedTechsBuy()));
CSetRate setrate(NULL, IDS_STRATEGY_SETRATE, NULL);
setrate.SetStrategy(pStrategy);
CPropertySheetEx sht;
sht.AddPage(&firstPage);
sht.AddPage(&selectStk);
sht.AddPage(&setrule);
sht.AddPage(&setrate);
sht.SetActivePage(&selectStk);
CBitmap bmp;
bmp.LoadBitmap(IDB_BALANG);
//sht.SetBitmap((HBITMAP)bmp.GetSafeHandle());
sht.DoModal();
pStrategy->SetStocks(selectStk.m_domainTemp);
pStrategy->DoFileSave();
AfxOnStrategyUpdated(pStrategy, selectStk.m_bModified || setrule.m_bModified || setrate.m_bModified);
}
}
void CMainFrame::OnUpdateStrategyStocks(CCmdUI* pCmdUI)
{
CStrategy * pStrategy = AfxGetActiveStrategy();
pCmdUI->Enable(pStrategy && pStrategy->CanModifiedNow());
}
void CMainFrame::OnStrategySetRule()
{
CSimuView * pSimuView = AfxGetSimuView();
if (pSimuView && !pSimuView->StoreToStrategy())
return;
CStrategy * pStrategy = AfxGetActiveStrategy();
if (pStrategy)
{
CSetPrpt firstPage(NULL, IDS_STRATEGY_SETPRPT, NULL);
firstPage.SetStrategy(pStrategy);
CSelectStk selectStk(NULL, IDS_STRATEGY_SELECTSTK, NULL);
selectStk.m_dwButtonFlags = 0;
selectStk.m_domainTemp.Copy(pStrategy->GetStocks());
CSetRule setrule(NULL, IDS_STRATEGY_SETRULE, NULL);
setrule.SetTechParameters(&(pStrategy->GetTechParametersBuy()), &(pStrategy->GetSelectedTechsBuy()));
CSetRate setrate(NULL, IDS_STRATEGY_SETRATE, NULL);
setrate.SetStrategy(pStrategy);
CPropertySheetEx sht;
sht.AddPage(&firstPage);
sht.AddPage(&selectStk);
sht.AddPage(&setrule);
sht.AddPage(&setrate);
sht.SetActivePage(&setrule);
//CBitmap bmp;
//bmp.LoadBitmap(IDB_BALANG);
//sht.SetBitmap((HBITMAP)bmp.GetSafeHandle());
sht.DoModal();
pStrategy->SetStocks(selectStk.m_domainTemp);
pStrategy->DoFileSave();
AfxOnStrategyUpdated(pStrategy, selectStk.m_bModified || setrule.m_bModified || setrate.m_bModified);
}
}
void CMainFrame::OnUpdateStrategySetRule(CCmdUI* pCmdUI)
{
CStrategy * pStrategy = AfxGetActiveStrategy();
pCmdUI->Enable(pStrategy && pStrategy->CanModifiedNow());
}
void CMainFrame::OnStrategySetRate()
{
CSimuView * pSimuView = AfxGetSimuView();
if (pSimuView && !pSimuView->StoreToStrategy())
return;
CStrategy * pStrategy = AfxGetActiveStrategy();
if (pStrategy)
{
CSetPrpt firstPage(NULL, IDS_STRATEGY_SETPRPT, NULL);
firstPage.SetStrategy(pStrategy);
CSelectStk selectStk(NULL, IDS_STRATEGY_SELECTSTK, NULL);
selectStk.m_dwButtonFlags = 0;
selectStk.m_domainTemp.Copy(pStrategy->GetStocks());
CSetRule setrule(NULL, IDS_STRATEGY_SETRULE, NULL);
setrule.SetTechParameters(&(pStrategy->GetTechParametersBuy()), &(pStrategy->GetSelectedTechsBuy()));
CSetRate setrate(NULL, IDS_STRATEGY_SETRATE, NULL);
setrate.SetStrategy(pStrategy);
CPropertySheetEx sht;
sht.AddPage(&firstPage);
sht.AddPage(&selectStk);
sht.AddPage(&setrule);
sht.AddPage(&setrate);
sht.SetActivePage(&setrate);
//CBitmap bmp;
//bmp.LoadBitmap(IDB_BALANG);
//sht.SetBitmap((HBITMAP)bmp.GetSafeHandle());
sht.DoModal();
pStrategy->SetStocks(selectStk.m_domainTemp);
pStrategy->DoFileSave();
AfxOnStrategyUpdated(pStrategy, selectStk.m_bModified || setrule.m_bModified || setrate.m_bModified);
}
}
void CMainFrame::OnUpdateStrategySetRate(CCmdUI* pCmdUI)
{
CStrategy * pStrategy = AfxGetActiveStrategy();
pCmdUI->Enable(pStrategy && pStrategy->CanModifiedNow());
}
void CMainFrame::OnStrategySimu()
{
AfxSwitchToStaticView(RUNTIME_CLASS(CSimuView));
}
void CMainFrame::OnUpdateStrategySimu(CCmdUI* pCmdUI)
{
CStrategy * pStrategy = AfxGetActiveStrategy();
pCmdUI->Enable(NULL != pStrategy);
CView * pView = AfxGetStaticDoc()->GetActiveView();
pCmdUI->SetCheck(pView && pView->IsKindOf(RUNTIME_CLASS(CSimuView)));
}
void CMainFrame::OnStrategyReport()
{
CSimuView * pSimuView = AfxGetSimuView();
if (pSimuView && !pSimuView->StoreToStrategy())
return;
CStrategy * pStrategy = AfxGetActiveStrategy();
if (pStrategy)
{
CSimuReport report;
report.SetStrategy(pStrategy);
report.DoModal();
}
}
void CMainFrame::OnUpdateStrategyReport(CCmdUI* pCmdUI)
{
CStrategy * pStrategy = AfxGetActiveStrategy();
pCmdUI->Enable(pStrategy && pStrategy->CanModifiedNow());
}
void CMainFrame::OnStrategyRealOp()
{
CSimuView * pSimuView = AfxGetSimuView();
if (pSimuView && !pSimuView->StoreToStrategy())
return;
CStrategy * pStrategy = AfxGetActiveStrategy();
if (pStrategy)
{
{ // 运行策略实战,选定下一步操作
CWaitDlg wait(AfxGetMainWnd(), FALSE);
wait.SetProgressRange(0, STRATEGY_MAX_PROGRESS);
pStrategy->ClearCache();
pStrategy->RealRun(RealRunCallback, wait.GetSafeHwnd());
wait.DestroyWindow();
}
CSimuRealOp realop;
realop.SetStrategy(pStrategy);
realop.DoModal();
pStrategy->OnRealOpViewed();
pStrategy->DoFileSave();
AfxOnStrategyUpdated(pStrategy, realop.m_bModified);
}
}
void CMainFrame::OnUpdateStrategyRealOp(CCmdUI* pCmdUI)
{
CStrategy * pStrategy = AfxGetActiveStrategy();
pCmdUI->Enable(pStrategy && pStrategy->CanModifiedNow());
}
////////////////////////////////////////////////////////////////////////////////
// “数据”菜单
// 数据
void CMainFrame::OnDataDownload()
{
CDownloadDlg * dlg = new CDownloadDlg;
dlg->Create(CDownloadDlg::IDD, this);
dlg->SetAutoDelete(TRUE);
dlg->CenterWindow(this);
dlg->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOSIZE);
}
void CMainFrame::OnDataDatasource()
{
CDataSrcDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnDataManage()
{
CInstallPacDlg installdlg;
CTyDataDlg tydata;
CSetDrdataDlg setdr;
CSetBaseDlg setbase;
CSetBasedataDlg setbasedata;
CSetKDataDlg setkdata;
CPropertySheetEx sht;
sht.AddPage(&installdlg);
sht.AddPage(&tydata);
sht.AddPage(&setdr);
sht.AddPage(&setbase);
sht.AddPage(&setbasedata);
sht.AddPage(&setkdata);
sht.SetActivePage(&installdlg);
sht.DoModal();
}
void CMainFrame::OnDataExport()
{
CSelectStk selectStk(NULL, IDS_EXPORT_SELECTSTK, NULL);
selectStk.m_dwButtonFlags = PSWIZB_NEXT | PSWIZB_DISABLEDFINISH;
CExportOption option(NULL, IDS_EXPORT_OPTION, NULL);
option.m_dwButtonFlags = PSWIZB_BACK | PSWIZB_NEXT | PSWIZB_DISABLEDFINISH;
CExportDest dest(NULL, IDS_EXPORT_DEST, NULL);
dest.m_dwButtonFlags = PSWIZB_BACK | PSWIZB_NEXT;
CPropertySheetEx sht;
sht.AddPage(&selectStk);
sht.AddPage(&option);
sht.AddPage(&dest);
sht.SetWizardMode();
sht.m_psh.dwFlags |= (PSH_WIZARD97 | PSH_WIZARDHASFINISH /* | PSH_HEADER /*Header Bitmap*/);
//CBitmap bmp;
//bmp.LoadBitmap(IDB_BALANG);
//sht.SetBitmap((HBITMAP)bmp.GetSafeHandle());
sht.DoModal();
}
void CMainFrame::OnDataRecalculateyield()
{
AfxRecalculateYield(AfxGetProfile().GetYieldAverageDays(), TRUE);
AfxGetStockContainer().ReloadBase(&AfxGetDB());
AfxGetSListStockContainer().ReRetrieveFromStatic(AfxGetActiveStrategy());
AfxGetStaticDoc()->UpdateAllViews(NULL, UPDATE_HINT_SLISTVIEW, NULL);
AfxGetStaticDoc()->UpdateAllViews(NULL, UPDATE_HINT_SELECTORVIEW, NULL);
}
////////////////////////////////////////////////////////////////////////////////
// “选项”菜单
// 选项
void CMainFrame::OnOptionAddtogroupRange(UINT nCmdID)
{
if (nCmdID < ID_OPTION_ADDTOGROUP_START || nCmdID > ID_OPTION_ADDTOGROUP_END)
{
ASSERT(FALSE);
return;
}
CDomainContainer &container = AfxGetGroupContainer();
int nIndex = nCmdID - ID_OPTION_ADDTOGROUP_START;
CString strGroupName;
if (ID_OPTION_ADDTOGROUP_END == nCmdID)
{
CSelectGrpDlg dlg;
dlg.SetMode(CSelectGrpDlg::modeGroup);
if (IDOK == dlg.DoModal())
strGroupName = dlg.GetSelectedName();
else
return;
}
else if (nIndex < container.GetSize())
{
CDomain & domain = container.ElementAt(nIndex);
strGroupName = domain.m_strName;
}
else
{
ASSERT(FALSE);
return;
}
CSetGroupDlg dlgSetGroup;
CSPStringArray astrStocks;
CView * pView = AfxGetStaticDoc()->GetActiveView();
if (pView && pView->IsKindOf(RUNTIME_CLASS(CSListView)))
{
((CSListView *)pView)->GetSelectedStocks(astrStocks);
}
else if (pView && pView->IsKindOf(RUNTIME_CLASS(CSelectorView)))
{
((CSelectorView *)pView)->GetSelectedStocks(astrStocks);
}
else if (pView &&
(pView->IsKindOf(RUNTIME_CLASS(CGraphView))
|| pView->IsKindOf(RUNTIME_CLASS(CBaseView))
|| pView->IsKindOf(RUNTIME_CLASS(CRealTimeView))))
{
CStockInfo info;
if (AfxGetProfile().GetCurrentStock(&info))
astrStocks.Add(info.GetStockCode());
}
dlgSetGroup.SetInitialGroup(strGroupName);
dlgSetGroup.AddtoGroup(astrStocks);
dlgSetGroup.DoModal();
}
void CMainFrame::OnUpdateOptionAddtogroupRange(CCmdUI* pCmdUI)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
if (pView && pView->IsKindOf(RUNTIME_CLASS(CSListView)))
{
CSPStringArray astrStocks;
((CSListView *)pView)->GetSelectedStocks(astrStocks);
pCmdUI->Enable(astrStocks.GetSize() > 0);
}
else if (pView && pView->IsKindOf(RUNTIME_CLASS(CSelectorView)))
{
CSPStringArray astrStocks;
((CSelectorView *)pView)->GetSelectedStocks(astrStocks);
pCmdUI->Enable(astrStocks.GetSize() > 0);
}
else if (pView &&
(pView->IsKindOf(RUNTIME_CLASS(CGraphView))
|| pView->IsKindOf(RUNTIME_CLASS(CBaseView))
|| pView->IsKindOf(RUNTIME_CLASS(CRealTimeView))))
{
CStockInfo info;
pCmdUI->Enable(AfxGetProfile().GetCurrentStock(&info));
}
else
{
pCmdUI->Enable(FALSE);
}
}
void CMainFrame::OnOptionAddtostrategy()
{
CSelectGrpDlg dlg;
dlg.SetMode(CSelectGrpDlg::modeStrategy);
if (IDOK != dlg.DoModal())
return;
CStrategy * pStrategy = dlg.GetSelectedStrategy();
if (NULL == pStrategy)
return;
// Get Current Stock
CSPStringArray astrStocks;
CView * pView = AfxGetStaticDoc()->GetActiveView();
if (pView && pView->IsKindOf(RUNTIME_CLASS(CSListView)))
{
((CSListView *)pView)->GetSelectedStocks(astrStocks);
}
else if (pView && pView->IsKindOf(RUNTIME_CLASS(CSelectorView)))
{
((CSelectorView *)pView)->GetSelectedStocks(astrStocks);
}
else if (pView &&
(pView->IsKindOf(RUNTIME_CLASS(CGraphView))
|| pView->IsKindOf(RUNTIME_CLASS(CBaseView))
|| pView->IsKindOf(RUNTIME_CLASS(CRealTimeView))))
{
CStockInfo info;
if (AfxGetProfile().GetCurrentStock(&info))
astrStocks.Add(info.GetStockCode());
}
CSPStringArray astr;
astr.Copy(pStrategy->GetStocks());
astr.Append(astrStocks);
pStrategy->SetStocks(astr);
pStrategy->DoFileSave();
AfxOnStrategyUpdated(pStrategy, TRUE);
}
void CMainFrame::OnUpdateOptionAddtostrategy(CCmdUI* pCmdUI)
{
CView * pView = AfxGetStaticDoc()->GetActiveView();
if (pView && pView->IsKindOf(RUNTIME_CLASS(CSListView)))
{
CSPStringArray astrStocks;
((CSListView *)pView)->GetSelectedStocks(astrStocks);
pCmdUI->Enable(astrStocks.GetSize() > 0);
}
else if (pView && pView->IsKindOf(RUNTIME_CLASS(CSelectorView)))
{
CSPStringArray astrStocks;
((CSelectorView *)pView)->GetSelectedStocks(astrStocks);
pCmdUI->Enable(astrStocks.GetSize() > 0);
}
else if (pView &&
(pView->IsKindOf(RUNTIME_CLASS(CGraphView))
|| pView->IsKindOf(RUNTIME_CLASS(CBaseView))
|| pView->IsKindOf(RUNTIME_CLASS(CRealTimeView))))
{
CStockInfo info;
pCmdUI->Enable(AfxGetProfile().GetCurrentStock(&info));
}
else
{
pCmdUI->Enable(FALSE);
}
}
// 选项
void CMainFrame::OnOptionProxyset()
{
AfxDoProxySetting();
}
void CMainFrame::OnOptionSelecttrader()
{
CSelectTraderDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnOptionColor()
{
CSetColorDlg * dlg = new CSetColorDlg();
dlg->Create(CSetColorDlg::IDD, this);
dlg->SetAutoDelete(TRUE);
dlg->CenterWindow(this);
dlg->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOSIZE);
}
void CMainFrame::OnOptionFontslist()
{
LOGFONT lf;
memset(&lf, 0, sizeof(lf));
AfxGetProfile().GetFontSListView(&lf);
CFontDialog dlg(&lf, CF_SCREENFONTS);
if (IDOK == dlg.DoModal())
{
AfxGetProfile().SetFontSListView(&lf);
CSListView * pSListView = AfxGetSListView();
if (pSListView)
pSListView->SetFont(&lf);
}
}
void CMainFrame::OnOptionFontbase()
{
LOGFONT lf;
memset(&lf, 0, sizeof(lf));
AfxGetProfile().GetFontBaseView(&lf);
CFontDialog dlg(&lf, CF_SCREENFONTS);
if (IDOK == dlg.DoModal())
{
AfxGetProfile().SetFontBaseView(&lf);
CBaseView * pBaseView = AfxGetBaseView();
if (pBaseView)
pBaseView->SetFont(&lf);
}
}
void CMainFrame::OnOptionSetgroup()
{
CSetGroupDlg dlg;
dlg.DoModal();
}
////////////////////////////////////////////////////////////////////////////////
// “工具”菜单
// 工具
void CMainFrame::OnToolTrader()
{
CString strFile = AfxGetProfile().GetTrader();
if (0 == access(strFile,0))
ShellExecute(NULL, "open", strFile, NULL, NULL, SW_SHOW);
else
OnOptionSelecttrader();
}
void CMainFrame::OnToolNote()
{
ShellExecute(NULL, "open", "notepad.exe",
NULL, AfxGetProfile().GetWorkDirectory(), SW_SHOW);
}
void CMainFrame::OnToolCalculator()
{
ShellExecute(NULL, "open", "calc.exe",
NULL, AfxGetProfile().GetWorkDirectory(), SW_SHOW);
}
void CMainFrame::OnToolFilterinfo()
{
CFilterInfoDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnToolAlarm()
{
CAlarmSettingDlg alarmsetting;
CAlarmResultDlg alarmresult;
CPropertySheetEx sht;
sht.AddPage(&alarmsetting);
sht.AddPage(&alarmresult);
sht.DoModal();
}
////////////////////////////////////////////////////////////////////////////////
// “帮助”菜单
void CMainFrame::OnHelpShowhelp()
{
//::HtmlHelp(NULL, "tsking.chm::/htm/index.htm", HH_DISPLAY_TOPIC, 0);
}
void CMainFrame::OnHelpDeclare()
{
/*
CBitmap bmp;
bmp.LoadBitmap(IDB_DLGLEFTLOGO);
CString sText;
HGLOBAL hRead = NULL;
HRSRC hReSrc = ::FindResource(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_TEXT_DECLARE), _T("Text"));
if (hReSrc)
hRead = ::LoadResource(AfxGetResourceHandle(), hReSrc);
if (hRead)
{
LPCTSTR lpText = (LPCTSTR)::LockResource(hRead);
if (lpText)
sText = lpText;
::UnlockResource(hRead);
}
CDeclareDlg dlg;
dlg.SetBitmap((HBITMAP)bmp.GetSafeHandle());
dlg.SetDeclareText(sText);
dlg.DoModal();
//*/
}
| [
"[email protected]"
]
| [
[
[
1,
2749
]
]
]
|
dd8b20c67494592b0e7d134d5be980140e4323f4 | 0cdfb75efb63fdfb1cd1bb2cc1e6d5db7a8f9213 | /AMFICOM/v2/mcm/dadara/NeuroNet.cpp | df1b0f54f9faf8d6ff45616f9e59a5b298f26a2c | []
| no_license | syrus-ru/amficom | b230bd554b8c056c9ca1b3236f4c6ac0dc4bf0b5 | 1d1f0c89f05ad224cb7a111bbb36ed14416ab2fc | refs/heads/master | 2023-04-10T17:21:00.091946 | 2006-07-05T02:23:17 | 2006-07-05T02:23:17 | 361,810,067 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,514 | cpp | // NeuroNet.cpp: implementation of the NeuroNet class.
//
//////////////////////////////////////////////////////////////////////
#include "NeuroNet.h"
#include <stdio.h>
//#include <process.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
NeuroNet::NeuroNet(int ENTERSIGNALDIMENSION)
{
enterSignalDimension = ENTERSIGNALDIMENSION;
enterSignal = new double[ENTERSIGNALDIMENSION];
layers = new Vector();
dispatcher = new Dispatcher();
lastLayerDimension = 0;
firstLayerDimension = 0;
allWeightsLength = 0;
allShiftsLength = 0;
teachingQuality = 0.;
}
NeuroNet::~NeuroNet()
{
// printf("Deleting...");
Neuron **n;
int i;
int j;
for(i=0; i<layers->getSize(); i++)
{
n = (Neuron **)layers->get(i);
for(j=0; j<layersDimension[i]; j++)
{
delete n[j];
}
delete []n;
}
delete layers;
delete []exitSignal;
delete dispatcher;
delete []enterSignal;
if(allWeightsLength != 0)
{
delete []allWeights;
}
if(allShiftsLength != 0)
{
delete []allShifts;
}
}
void NeuroNet::addLayer(int neuronsNumber)
{
Neuron **n = new Neuron*[neuronsNumber];
int i;
int j;
if(layers->isEmpty())
{
for(i=0; i<neuronsNumber; i++)
{
n[i] = new Neuron(1, i+1, enterSignalDimension, dispatcher);
}
firstLayerDimension = neuronsNumber;
}
else
{
for(i=0; i<neuronsNumber; i++)
{
n[i] = new Neuron(layers->getSize()+1, i+1, dispatcher);
}
Neuron **parents = (Neuron **)(layers->lastElement());
// Adding of the children to the parent.
for(i=0; i<lastLayerDimension; i++)
{
for(j=0; j<neuronsNumber; j++)
{
parents[i]->addChild(n[j]);
}
}
}
layers->add(n);
lastLayerDimension = neuronsNumber;
layersDimension[layers->getSize()-1] = lastLayerDimension;
}
void NeuroNet::buildNet()
{
dispatcher->notify(-10); // command to inicialize all weights
exitSignal = new double[lastLayerDimension];
}
double * NeuroNet::getExitSignal()
{
int layer;
int i;
for(i=0; i<layers->getSize(); i++)
{
layer = i+1;
dispatcher->notify(layer); // command to calculate exit signal
}
Neuron **lastLayerNeurons = (Neuron **)(layers->lastElement());
for(i=0; i<lastLayerDimension; i++)
{
exitSignal[i] = lastLayerNeurons[i]->getExitSignal();
}
return exitSignal;
}
void NeuroNet::setEnterSignal(double *ENTERSIGNAL)
{
int i;
for(i=0; i<enterSignalDimension; i++)
{
enterSignal[i] = ENTERSIGNAL[i];
}
Neuron **firstLayerNeurons = (Neuron **)(layers->get(0));
for(i=0; i<firstLayerDimension; i++)
{
firstLayerNeurons[i]->setActivateSignals(enterSignal);
}
}
double *NeuroNet::getExitSignal(double *ENTERSIGNAL)
{
setEnterSignal(ENTERSIGNAL);
return getExitSignal();
}
void NeuroNet::correctWeights()
{
int layer;
for(int i=layers->getSize()-1; i>=0; i--)
{
layer = i+1;
dispatcher->notify(layer+10000); // command to correct weights
}
return;
}
void NeuroNet::setNeededExitSignal(double *neededExitSignal)
{
Neuron **lastLayerNeurons = (Neuron**)(layers->lastElement());
for(int i=0; i<lastLayerDimension; i++)
{
lastLayerNeurons[i]->setNeededExitValue(neededExitSignal[i]);
}
}
void NeuroNet::teachTheNetwork()
{
// To be defined by user.
}
/////////////////////////////////////////////////////////////////////////////
double *NeuroNet::getAllWeights()
{
int l=0;
int i;
int j;
int k;
Neuron** layerNeuron;
for(i=0; i<layers->getSize(); i++)
{
layerNeuron = (Neuron **)(layers->get(i));
for(j=0; j<layersDimension[i]; j++)
{
l+=layerNeuron[j]->nEnterSinals;
}
}
allWeights = new double[l];
allWeightsLength = l;
double *tmp;
l=0;
for(i=0; i<layers->getSize(); i++)
{
layerNeuron = (Neuron **)(layers->get(i));
for(j=0; j<layersDimension[i]; j++)
{
tmp = layerNeuron[j]->getWeights();
for(k=0; k<layerNeuron[j]->nEnterSinals; k++)
{
allWeights[l] = tmp[k];
l++;
}
}
}
return allWeights;
}
double *NeuroNet::getAllShifts()
{
int l=0;
int i;
int j;
Neuron **layerNeuron;
for(i=0; i<layers->getSize(); i++)
{
l+=layersDimension[i];
}
allShifts = new double[l];
allShiftsLength = l;
l=0;
for(i=0; i<layers->getSize(); i++)
{
layerNeuron = (Neuron **)(layers->get(i));
for(j=0; j<layersDimension[i]; j++)
{
allShifts[l] = layerNeuron[j]->getShift();
l++;
}
}
return allShifts;
}
void NeuroNet::writeWeightsAndShiftsInSingleFile(const char *fileName)
{
getAllShifts();
getAllWeights();
int i;
FILE *f = fopen(fileName, "w+");
//Writing of weights;
fprintf(f, "%i\n", allWeightsLength);
for(i=0; i<allWeightsLength; i++)
{
fprintf(f, "%f\n", allWeights[i]);
}
fprintf(f, "%i\n", allShiftsLength);
for(i=0; i<allShiftsLength; i++)
{
fprintf(f, "%f\n", allShifts[i]);
}
fprintf(f, "The quality of the teaching is %f\n", teachingQuality);
fclose(f);
}
bool NeuroNet::readWeightsAndShiftsFromSingleFile(const char* fileName)
{
FILE *f = fopen(fileName, "r");
int i;
float tmp;
if(f == NULL)
{
printf("File with weights does not exist.\n");
return false;
}
fseek(f, 0L, SEEK_SET);
fscanf(f, "%i", &allWeightsLength);
allWeights = new double[allWeightsLength];
for(i=0; i<allWeightsLength; i++)
{
fscanf(f, "%f", &tmp);
allWeights[i] = tmp;
}
fscanf(f, "%i", &allShiftsLength);
allShifts = new double[allShiftsLength];
for(i=0; i<allShiftsLength; i++)
{
fscanf(f, "%f", &tmp);
allShifts[i] = tmp;
}
fclose(f);
if(!setAllWeights(allWeights)) return false;
if(!setAllShifts(allShifts)) return false;
return true;
}
bool NeuroNet::setAllWeights(double *allWeights)
{
double *tmp;
Neuron **layerNeuron;
int l=0;
int i, j, k;
for(i=0; i<layers->getSize(); i++)
{
layerNeuron = (Neuron**)(layers->get(i));
for(j=0; j<layersDimension[i]; j++)
{
tmp = new double[layerNeuron[j]->nEnterSinals];
for(k=0; k<layerNeuron[j]->nEnterSinals; k++)
{
if(l>allWeightsLength-1)
{
printf("Error setting weights. Check the dimension's length'.\n");
return false;
}
tmp[k] = allWeights[l];
l++;
}
layerNeuron[j]->setWeights(tmp);
delete []tmp;
}
}
// printf("All weights are set succesfully\n");
return true;
}
bool NeuroNet::setAllShifts(double *allShifts)
{
Neuron **layerNeuron;
int l=0;
int i;
for(i=0; i<layers->getSize(); i++)
{
layerNeuron = (Neuron **)(layers->get(i));
for(int j=0; j<layersDimension[i]; j++)
{
if(l>allShiftsLength-1)
{
printf("Error setting shifts. Check the dimension's length'.\n");
return false;
}
layerNeuron[j]->setShift(allShifts[l]);
l++;
}
}
// printf("All shifts are set succesfully\n");
return true;
}
void NeuroNet::setStudyingCoeff(double coeff)
{
int i, j;
Neuron **layerNeuron;
for(i=0; i<layers->getSize(); i++)
{
layerNeuron = (Neuron**)(layers->get(i));
for(j=0; j<layersDimension[i]; j++)
{
layerNeuron[j]->setStudyingCoeff(coeff);
}
}
}
void NeuroNet::setInerciaCoeff(double coeff)
{
int i, j;
Neuron **layerNeuron;
for(i=0; i<layers->getSize(); i++)
{
layerNeuron = (Neuron**)(layers->get(i));
for(j=0; j<layersDimension[i]; j++)
{
layerNeuron[j]->setInerciaCoeff(coeff);
}
}
}
| [
"[email protected]"
]
| [
[
[
1,
425
]
]
]
|
ed48502b2ec08836b6fc4f0005e448eea292236b | 205069c97095da8f15e45cede1525f384ba6efd2 | /Casino/Code/Server/Tool/ServerMonitor/ServerMonitorDlg.cpp | a4944e1ff5790663151485b89191de0b7802a781 | []
| no_license | m0o0m/01technology | 1a3a5a48a88bec57f6a2d2b5a54a3ce2508de5ea | 5e04cbfa79b7e3cf6d07121273b3272f441c2a99 | refs/heads/master | 2021-01-17T22:12:26.467196 | 2010-01-05T06:39:11 | 2010-01-05T06:39:11 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 15,992 | cpp | // ServerMonitorDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "ServerMonitor.h"
#include "ServerMonitorDlg.h"
#include ".\servermonitordlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#define IDC_GRIDGAMESERVICE 1001
CString inline GetMyAppPath()
{
TCHAR szFolder[512];
GetModuleFileName(NULL, szFolder, 512);
CString strPath(szFolder);
int pos = strPath.ReverseFind('\\');
if(pos != -1)
return strPath.Left(pos) + "\\" ;
return strPath + "\\";
}
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// 对话框数据
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
// CServerMonitorDlg 对话框
CServerMonitorDlg::CServerMonitorDlg(CWnd* pParent /*=NULL*/)
: CDialog(CServerMonitorDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_bRunning = FALSE;
}
void CServerMonitorDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CServerMonitorDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDOK, OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
ON_BN_CLICKED(IDC_BUTTON_ADD, OnBnClickedButtonAdd)
ON_BN_CLICKED(IDC_BUTTON_DEL, OnBnClickedButtonDel)
ON_BN_CLICKED(IDC_BUTTON_RUN, OnBnClickedButtonRun)
ON_BN_CLICKED(IDC_BUTTON_STOP, OnBnClickedButtonStop)
ON_BN_CLICKED(IDC_BUTTON_CLOSE, OnBnClickedButtonClose)
ON_MESSAGE(WM_MSG_STATUS, OnMsgStatus)
END_MESSAGE_MAP()
// CServerMonitorDlg 消息处理程序
BOOL CServerMonitorDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 将\“关于...\”菜单项添加到系统菜单中。
// IDM_ABOUTBOX 必须在系统命令范围内。
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
// 执行此操作
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
CRect rc;
GetClientRect(&rc);
rc.InflateRect(-5, -80,-5,-5);
m_gridServerMonitor.Create(CRect(rc), this, IDC_GRIDGAMESERVICE);
m_gridServerMonitor.SetEditable(FALSE);
m_gridServerMonitor.SetSingleRowSelection(TRUE);
m_gridServerMonitor.SetFixedRowSelection(FALSE);
m_gridServerMonitor.SetListMode(TRUE);
m_BtnDataBase.SetGrid( &m_gridServerMonitor);
try
{
m_gridServerMonitor.SetRowCount(1);
m_gridServerMonitor.SetColumnCount(6);
m_gridServerMonitor.SetFixedRowCount(1);
m_gridServerMonitor.SetFixedColumnCount(0);
}
catch (CMemoryException* e)
{
e->ReportError();
e->Delete();
return FALSE;
}
int c = 0;
m_gridServerMonitor.SetItemText(0, c, TEXT("名称"));
m_gridServerMonitor.SetItemFormat(0, c, DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX);
m_gridServerMonitor.SetColumnWidth(c, 120);
c ++;
m_gridServerMonitor.SetItemText(0, c, TEXT("网络地址"));
m_gridServerMonitor.SetItemFormat(0, c, DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX);
m_gridServerMonitor.SetColumnWidth(c, 110);
c ++;
m_gridServerMonitor.SetItemText(0, c, TEXT("IP地址"));
m_gridServerMonitor.SetItemFormat(0, c, DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX);
m_gridServerMonitor.SetColumnWidth(c, 120);
c ++;
m_gridServerMonitor.SetItemText(0, c, TEXT("链接状态"));
m_gridServerMonitor.SetItemFormat(0, c, DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX);
m_gridServerMonitor.SetColumnWidth(c, 70);
c ++;
m_gridServerMonitor.SetItemText(0, c, TEXT("网络速度"));
m_gridServerMonitor.SetItemFormat(0, c, DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX);
m_gridServerMonitor.SetColumnWidth(c, 220);
c ++;
m_gridServerMonitor.SetItemText(0, c, TEXT("信息"));
m_gridServerMonitor.SetItemFormat(0, c, DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX);
m_gridServerMonitor.SetColumnWidth(c, 80);
c ++;
m_gridServerMonitor.SetRowHeight(0, 30);
m_gridServerMonitor.SetDefCellHeight(26);
CString strSerName,strSerAddr;
strSerName = AfxGetApp()->GetProfileString(TEXT("ServerMonitor"), TEXT("SerName"), TEXT("服务器-1"));
strSerAddr = AfxGetApp()->GetProfileString(TEXT("ServerMonitor"), TEXT("SerAddr"), TEXT("127.0.0.1"));
SetDlgItemText(IDC_EDIT_SERNAME, strSerName);
SetDlgItemText(IDC_EDIT_SERADDR, strSerAddr);
CString strFilePath = GetMyAppPath() + TEXT("MonitorItem.xml");
LoadMonitorItem((LPCSTR)strFilePath);
SetDlgItemInt(IDC_EDIT_SENDPERIOD, 5);
return TRUE; // 除非设置了控件的焦点,否则返回 TRUE
}
void CServerMonitorDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// 如果向对话框添加最小化按钮,则需要下面的代码
// 来绘制该图标。对于使用文档/视图模型的 MFC 应用程序,
// 这将由框架自动完成。
void CServerMonitorDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 用于绘制的设备上下文
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// 使图标在工作矩形中居中
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// 绘制图标
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
//当用户拖动最小化窗口时系统调用此函数取得光标显示。
HCURSOR CServerMonitorDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CServerMonitorDlg::OnBnClickedOk()
{
// TODO: 在此添加控件通知处理程序代码
OnOK();
}
void CServerMonitorDlg::OnBnClickedCancel()
{
CString strFilePath = GetMyAppPath() + TEXT("MonitorItem.xml");
SaveMonitorItem((LPCSTR)strFilePath);
int r = m_gridServerMonitor.GetRowCount();
for(int i = 1; i < r; i ++)
{
tagMonitorData *pMonitorData =
(tagMonitorData*)m_gridServerMonitor.GetItemData(i, 0);
if(pMonitorData)
{
delete pMonitorData;
}
}
CString strSerName;
GetDlgItemText(IDC_EDIT_SERNAME, strSerName);
CString strSerAddr;
GetDlgItemText(IDC_EDIT_SERADDR, strSerAddr);
AfxGetApp()->WriteProfileString(TEXT("ServerMonitor"), TEXT("SerName"), strSerName);
AfxGetApp()->WriteProfileString(TEXT("ServerMonitor"), TEXT("SerAddr"), strSerAddr);
OnCancel();
}
void CServerMonitorDlg::OnBnClickedButtonAdd()
{
CString strSerName;
GetDlgItemText(IDC_EDIT_SERNAME, strSerName);
CString strSerAddr;
GetDlgItemText(IDC_EDIT_SERADDR, strSerAddr);
if(strSerName.GetLength() == 0 ||
strSerAddr.GetLength() == 0)
return;
tagMonitorData *pMonitorData = new tagMonitorData;
pMonitorData->strSerName = strSerName;
pMonitorData->strSerAddr = strSerAddr;
pMonitorData->strNetAddr = "未知";
pMonitorData->bNetPassFlag = FALSE;
pMonitorData->nNetDelayValueIndex = 0;
memset(pMonitorData->nNetDelayValue,0, sizeof(pMonitorData->nNetDelayValue)/sizeof(pMonitorData->nNetDelayValue[0]) * sizeof(int));
AddMonitorItem(pMonitorData);
}
void CServerMonitorDlg::OnBnClickedButtonDel()
{
if(m_bRunning == TRUE)
{
AfxMessageBox(TEXT("监测进行中,不能删除"));
return;
}
CCellRange cell = m_gridServerMonitor.GetSelectedCellRange();
if(cell.GetMinRow() != -1 && cell.GetMinRow() != 0)
{
CString strMessage=TEXT("确实要删除该ServerMonitor吗?");
int iRetCode=AfxMessageBox(strMessage,MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2);
if (iRetCode!=IDYES) return;
tagMonitorData *pMonitorData =
(tagMonitorData*)m_gridServerMonitor.GetItemData(cell.GetMinRow(), 0);
if(pMonitorData)
{
delete pMonitorData;
}
m_gridServerMonitor.DeleteRow(cell.GetMinRow());
m_gridServerMonitor.Refresh();
}
}
void CServerMonitorDlg::OnBnClickedButtonRun()
{
if(m_bRunning)
return;
m_bRunning = TRUE;
m_PingThread.InitPing(this->m_hWnd, &m_bRunning);
int r = m_gridServerMonitor.GetRowCount();
for(int i = 1; i < r; i ++)
{
tagMonitorData *pMonitorData =
(tagMonitorData*)m_gridServerMonitor.GetItemData(i, 0);
if(pMonitorData )
{
pMonitorData->strNetAddr = "未知";
pMonitorData->bNetPassFlag = FALSE;
pMonitorData->nNetDelayValueIndex = 0;
memset(pMonitorData->nNetDelayValue,0, sizeof(pMonitorData->nNetDelayValue)/sizeof(pMonitorData->nNetDelayValue[0]) * sizeof(int)/sizeof(pMonitorData->nNetDelayValue[0]) * sizeof(int));
m_gridServerMonitor.SetItemText(i, 3, pMonitorData->bNetPassFlag ? TEXT("链通"):TEXT("阻塞"));
CString strTmp;
strTmp.Format("%d - %d - %d - %d - %d", pMonitorData->nNetDelayValue[0],
pMonitorData->nNetDelayValue[1],
pMonitorData->nNetDelayValue[2],
pMonitorData->nNetDelayValue[3],
pMonitorData->nNetDelayValue[4]);
m_gridServerMonitor.SetItemText(i, 4, strTmp);
m_gridServerMonitor.SetItemText(i, 5, TEXT("无"));
for(int c = 0; c < m_gridServerMonitor.GetColumnCount(); c ++)
m_gridServerMonitor.SetItemBkColour(i, c, RGB(200,10,10));
m_PingThread.AddTask(pMonitorData->strSerAddr, i);
}
}
m_gridServerMonitor.Refresh();
GetDlgItem(IDC_BUTTON_RUN)->EnableWindow(FALSE);
GetDlgItem(IDC_BUTTON_STOP)->EnableWindow(TRUE);
m_PingThread.StartThead();
}
void CServerMonitorDlg::OnBnClickedButtonStop()
{
if(!m_bRunning)
return;
m_bRunning = FALSE;
m_PingThread.StopThread();
GetDlgItem(IDC_BUTTON_RUN)->EnableWindow(TRUE);
GetDlgItem(IDC_BUTTON_STOP)->EnableWindow(FALSE);
}
void CServerMonitorDlg::OnBnClickedButtonClose()
{
OnBnClickedButtonStop();
OnBnClickedCancel();
}
void CServerMonitorDlg::AddMonitorItem(tagMonitorData *pMonitorData)
{
int r = m_gridServerMonitor.GetRowCount();
m_gridServerMonitor.SetRowCount(r + 1);
m_gridServerMonitor.SetItemText(r, 0, pMonitorData->strSerName);
m_gridServerMonitor.SetItemText(r, 1, pMonitorData->strSerAddr);
m_gridServerMonitor.SetItemText(r, 2, pMonitorData->strNetAddr);
m_gridServerMonitor.SetItemText(r, 3, pMonitorData->bNetPassFlag ? TEXT("链通"):TEXT("阻塞"));
CString strTmp;
strTmp.Format("%d - %d - %d - %d - %d", pMonitorData->nNetDelayValue[0],
pMonitorData->nNetDelayValue[1],
pMonitorData->nNetDelayValue[2],
pMonitorData->nNetDelayValue[3],
pMonitorData->nNetDelayValue[4]);
m_gridServerMonitor.SetItemText(r, 4, strTmp);
m_gridServerMonitor.SetItemText(r, 5, "无");
m_gridServerMonitor.SetItemData(r, 0, (LPARAM)pMonitorData);
for(int c = 0; c < m_gridServerMonitor.GetColumnCount(); c ++)
m_gridServerMonitor.SetItemBkColour(r, c, RGB(200,10,10));
if(m_bRunning)
{
m_PingThread.AddTask(pMonitorData->strSerAddr, r);
}
}
bool CServerMonitorDlg::LoadMonitorItem(const char* szFileName)
{
CMarkupSTL xml;
xml.Load(szFileName);
while ( xml.FindElem("MonitorItem") )
{
tagMonitorData *pMonitorData = new tagMonitorData;
xml.FindChildElem( "ServerName");
pMonitorData->strSerName = xml.GetChildData().c_str();
xml.FindChildElem( "ServerAddr");
pMonitorData->strSerAddr = xml.GetChildData().c_str();
pMonitorData->strNetAddr = "未知";
pMonitorData->bNetPassFlag = FALSE;
pMonitorData->nNetDelayValueIndex = 0;
memset(pMonitorData->nNetDelayValue,0, sizeof(pMonitorData->nNetDelayValue)/sizeof(pMonitorData->nNetDelayValue[0]) * sizeof(int));
AddMonitorItem(pMonitorData);
}
return true;
}
bool CServerMonitorDlg::SaveMonitorItem(const char* szFileName)
{
CMarkupSTL xml;
int r = m_gridServerMonitor.GetRowCount();
for(int i = 1; i < r; i ++)
{
tagMonitorData *pMonitorData =
(tagMonitorData*)m_gridServerMonitor.GetItemData(i, 0);
if(pMonitorData)
{
xml.AddElem("MonitorItem");
xml.IntoElem();
xml.AddElem("ServerName", (LPCSTR)pMonitorData->strSerName);
xml.AddElem("ServerAddr", (LPCSTR)pMonitorData->strSerAddr);
xml.OutOfElem();
}
}
return xml.Save(szFileName);
}
LRESULT CServerMonitorDlg::OnMsgStatus(WPARAM wParam, LPARAM lParam)
{
ASSERT(wParam >= sizeof(tagNoticeHeader));
tagNoticeHeader *pHeader = (tagNoticeHeader*)lParam;
ASSERT(pHeader->dwContext > 0 && pHeader->dwContext < m_gridServerMonitor.GetRowCount());
switch(pHeader->wNoticeCode)
{
case wNoticeCode_Error:
{
tagNoticeError* pNotice = (tagNoticeError*)lParam;
m_gridServerMonitor.SetItemText(pHeader->dwContext, 5, pNotice->szError);
tagMonitorData *pMonitorData =
(tagMonitorData*)m_gridServerMonitor.GetItemData(pHeader->dwContext, 0);
if(pMonitorData->bNetPassFlag == TRUE)
{
pMonitorData->bNetPassFlag = FALSE;
m_gridServerMonitor.SetItemText(pHeader->dwContext, 3, pMonitorData->bNetPassFlag ? TEXT("链通"):TEXT("阻塞"));
delete pNotice;
for(int c = 0; c < m_gridServerMonitor.GetColumnCount(); c ++)
m_gridServerMonitor.SetItemBkColour(pHeader->dwContext, c, RGB(200,10,10));
}
delete pNotice;
}
break;
case wNoticeCode_UpdateNetAddr:
{
tagNoticeUpdateNetAddr* pNotice = (tagNoticeUpdateNetAddr*)lParam;
m_gridServerMonitor.SetItemText(pHeader->dwContext, 2, pNotice->szNetAddr);
delete pNotice;
}
break;
case wNoticeCode_RequestTimedOut:
{
tagNoticeUpdateNetDelay* pNotice = (tagNoticeUpdateNetDelay*)lParam;
tagMonitorData *pMonitorData =
(tagMonitorData*)m_gridServerMonitor.GetItemData(pHeader->dwContext, 0);
if(pMonitorData->bNetPassFlag == TRUE)
{
pMonitorData->bNetPassFlag = FALSE;
m_gridServerMonitor.SetItemText(pHeader->dwContext, 3, pMonitorData->bNetPassFlag ? TEXT("链通"):TEXT("阻塞"));
for(int c = 0; c < m_gridServerMonitor.GetColumnCount(); c ++)
m_gridServerMonitor.SetItemBkColour(pHeader->dwContext, c, RGB(200,10,10));
}
delete pNotice;
}
break;
case wNoticeCode_UpdateNetDelay:
{
tagNoticeUpdateNetDelay* pNotice = (tagNoticeUpdateNetDelay*)lParam;
tagMonitorData *pMonitorData =
(tagMonitorData*)m_gridServerMonitor.GetItemData(pHeader->dwContext, 0);
pMonitorData->nNetDelayValue[pMonitorData->nNetDelayValueIndex++] = pNotice->dwElapsed;
pMonitorData->nNetDelayValueIndex = pMonitorData->nNetDelayValueIndex % 5;
CString strTmp;
strTmp.Format("%d - %d - %d - %d - %d", pMonitorData->nNetDelayValue[0],
pMonitorData->nNetDelayValue[1],
pMonitorData->nNetDelayValue[2],
pMonitorData->nNetDelayValue[3],
pMonitorData->nNetDelayValue[4]);
m_gridServerMonitor.SetItemText(pHeader->dwContext, 4, strTmp);
if(pMonitorData->bNetPassFlag == FALSE)
{
pMonitorData->bNetPassFlag = TRUE;
m_gridServerMonitor.SetItemText(pHeader->dwContext, 3, pMonitorData->bNetPassFlag ? TEXT("链通"):TEXT("阻塞"));
for(int c = 0; c < m_gridServerMonitor.GetColumnCount(); c ++)
m_gridServerMonitor.SetItemBkColour(pHeader->dwContext, c);
}
delete pNotice;
}
break;
default:
break;
}
m_gridServerMonitor.Refresh();
return 1;
} | [
"[email protected]"
]
| [
[
[
1,
517
]
]
]
|
17aea88def31b89a93c4aebc11d71a774653cf32 | 740ed7e8d98fc0af56ee8e0832e3bd28f08cf362 | /src/game/captain_badass/InputHandler.h | d4631fa3f21f311a0d1a56050c58d0f6e1792269 | []
| no_license | fgervais/armconsoledemogame | 420c53f926728b30fe1723733de2f32961a6a6d9 | 9158c0e684db16c4327b51aec45d1e4eed96b2d4 | refs/heads/master | 2021-01-10T11:27:43.912609 | 2010-07-29T18:53:06 | 2010-07-29T18:53:06 | 44,270,121 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 361 | h | /*
* InputHandler.h
*
* Created on: 2010-06-14
* Author: Emile
*/
#ifndef INPUTHANDLER_H_
#define INPUTHANDLER_H_
#include "Environment.h"
#include "SDL.h"
class InputHandler {
public:
InputHandler();
virtual ~InputHandler();
uint8_t handleInput(Environment*);
private:
SDL_Event event;
};
#endif /* INPUTHANDLER_H_ */
| [
"fournierseb2@051cbfc0-75b8-dce1-6088-688cefeb9347"
]
| [
[
[
1,
23
]
]
]
|
1c79ad5853956c401e821063d7ca4eb29863a67b | bdb1e38df8bf74ac0df4209a77ddea841045349e | /CapsuleSortor/Version 1.0 -2.0/CapsuleSortor-10-11-09/ToolSrc/TAllocTmpl.h | d9a3bb0db3d27d560b1d431955ebfc218734324b | []
| no_license | Strongc/my001project | e0754f23c7818df964289dc07890e29144393432 | 07d6e31b9d4708d2ef691d9bedccbb818ea6b121 | refs/heads/master | 2021-01-19T07:02:29.673281 | 2010-12-17T03:10:52 | 2010-12-17T03:10:52 | 49,062,858 | 0 | 1 | null | 2016-01-05T11:53:07 | 2016-01-05T11:53:07 | null | UTF-8 | C++ | false | false | 5,413 | h | // TAllocTemp.h : Interface and Implement of the TAlloc class
//
// Copyright (c) 2006 PACS Group Zibo Creative Computor CO.,LTD
//////////////////////////////////////////////////////////////////////////
// Module : Common Tool
// Create Date : 2006.12.13
//
// A tool to allocate huge memery;
#ifndef TALLOCTEMP_H
#define TALLOCTEMP_H
#include "TCritSect.h"
#define NEEDS_UINTPTR_T
#ifdef NEEDS_UINTPTR_T
typedef unsigned int uintptr_t;
#endif
typedef enum {
eNoAlign = 0,
e2ByteAlign = 2,
e4ByteAlign = 4,
e8ByteAlign = 8,
e16ByteAlign = 16
} eAlignment;
template <class T>
class TAlloc
{
public:
public:
TAlloc();
explicit TAlloc(size_t size, eAlignment align = eNoAlign);
~TAlloc();
TAlloc (const TAlloc& src);
TAlloc& operator= (const TAlloc& src);
static TAlloc& NullObject();
public:
size_t Size () const;
size_t Ref () const;
bool IsNull () const;
const T* Base () const;
T* Base ();
const T& operator[](size_t index) const;
T& operator[](size_t index);
TAlloc<T> Duplicate() const;
void SetZero ();
private:
TCritSect& LockObject() const;
private:
class TAllocRef;
TAllocRef* Clone() const; //
TAllocRef* m_pMem; // pointer to our allocated memory
static TAlloc* m_sNull; // our null object
private:
class TAllocRef
{
public:
TAllocRef(size_t size, eAlignment align)
: m_pRaw(0), m_pData(0), m_size(size), m_ref(0), m_align(align)
{
Allocate();
AddRef();
}
~TAllocRef()
{
DeAllocate();
}
operator T* () { return m_pData; }
operator const T* () const { return m_pData; }
TCritSect& LockObject() const { return m_locker; }
size_t Size () const { return m_size; }
size_t Ref () const { return m_ref; }
eAlignment Align () const { return m_align;}
void AddRef()
{
TLocker lock( LockObject() );
m_ref++;
}
void SubRef()
{
{
TLocker lock( LockObject() );
--m_ref;
}
if( m_ref == 0)
delete this;
}
void Allocate()
{
if(0 == m_size)
{
m_pData = new T [1];
m_pRaw = 0;
return;
}
if(m_align < 2)
{
m_pData = new T [m_size];
m_pRaw = 0;
}
else
{
m_pRaw = new char [sizeof(T) * m_size + (m_align -1)];
m_pData = AlignPointer (m_pRaw);
}
}
void DeAllocate()
{
if(m_pRaw)
delete [] m_pRaw;
else
delete [] m_pData;
m_pRaw = 0;
m_pData = 0;
}
private:
TAllocRef (const TAllocRef &src);
TAllocRef& operator= (const TAllocRef &src);
T* AlignPointer(void *raw)
{
T* p = reinterpret_cast<T*> (
(reinterpret_cast<uintptr_t>(raw) + m_align -1) & ~(m_align -1) );
return p;
}
private:
char* m_pRaw;
T* m_pData;
size_t m_size;
size_t m_ref;
eAlignment m_align;
mutable TCritSect m_locker;
};
};
template <class T>
TAlloc<T>* TAlloc<T>::m_sNull = 0;
template <class T>
TAlloc<T>& TAlloc<T>::NullObject()
{
if (!m_sNull)
m_sNull = new TAlloc (0);
return *m_sNull;
}
template<class T>
TAlloc<T>::TAlloc() : m_pMem(0)
{
// Point ourself to sNull.
m_pMem = NullObject().m_pMem;
m_pMem->AddRef();
}
template <class T>
TAlloc<T>::TAlloc (size_t size, eAlignment align)
: m_pMem(0)
{
m_pMem = new TAlloc::TAllocRef(size, align);
}
template <class T>
TAlloc<T>::~TAlloc ()
{
m_pMem->SubRef();
}
template<class T>
TAlloc<T>::TAlloc (const TAlloc& src)
{
TLocker lock (src.LockObject() );
m_pMem = src.m_pMem;
m_pMem ->AddRef();
}
template<class T>
TAlloc<T>& TAlloc<T>::operator= (const TAlloc& src)
{
// Make sure we don't copy ourself!
if (m_pMem == src.m_pMem)
return *this;
// Remove reference from existing object.
m_pMem ->SubRef ();
{
TLocker lock (src.LockObject() );
m_pMem = src.m_pMem;
m_pMem ->AddRef ();
}
return *this;
}
template <class T>
typename TAlloc<T>::TAllocRef* TAlloc<T>::Clone() const
{
size_t size = m_pMem->Size();
TAllocRef* copy = new TAllocRef(size, m_pMem->Align() );
// Shallow copy
T* src = *m_pMem;
T* dst = *copy;
memcpy(dst, src, size * sizeof(T) );
return copy;
}
template<class T>
TAlloc<T> TAlloc<T>::Duplicate() const
{
TAlloc<T> dup;
if(!IsNull())
{
// Duplicate our existing memory
TAllocRef* copy = Clone();
dup.m_pMem = copy;
}
return dup;
}
template<class T>
void TAlloc<T>::SetZero()
{
T* pBase = Base();
memset(pBase, 0, sizeof(T)*Size());
}
template <class T>
inline unsigned int TAlloc<T>::Size () const { return m_pMem -> Size(); }
template <class T>
inline unsigned int TAlloc<T>::Ref () const { return m_pMem -> Ref(); }
template <class T>
inline bool TAlloc<T>::IsNull() const { return (m_pMem == NullObject().m_pMem); }
template <class T>
inline const T* TAlloc<T>::Base() const { return *m_pMem; }
template <class T>
inline T* TAlloc<T>::Base() { return *m_pMem; }
template <class T>
inline const T& TAlloc<T>::operator[](size_t index) const
{
return *(Base() + index);
}
template <class T>
inline T& TAlloc<T>::operator[](size_t index)
{
return *(Base() +index);
}
template <class T>
inline TCritSect& TAlloc<T>::LockObject() const
{
return m_pMem->LockObject();
}
#endif //TALLOCTEMP_H | [
"vincen.cn@66f52ff4-a261-11de-b161-9f508301ba8e"
]
| [
[
[
1,
290
]
]
]
|
3d5dbc5dddfbd76566034348df218f9a2d6cf787 | d76a67033e3abf492ff2f22d38fb80de804c4269 | /src/sdlkeyboard/love_sdlkeyboard.h | 26ab31ee1ac9d2581ede3e9c54044bc08c48acb1 | [
"Zlib"
]
| permissive | truthwzl/lov8 | 869a6be317b7d963600f2f88edaefdf9b5996f2d | 579163941593bae481212148041e0db78270c21d | refs/heads/master | 2021-01-10T01:58:59.103256 | 2009-12-16T16:00:09 | 2009-12-16T16:00:09 | 36,340,451 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 839 | h | /*
* LOVE: Totally Awesome 2D Gaming.
* Website: http://love.sourceforge.net
* Licence: ZLIB/libpng
* Copyright (c) 2006-2008 LOVE Development Team
*
* An interface to the keyboard device via SDL.
*
* @author Anders Ruud
* @date 2008-03-16
*/
#ifndef LOVE_MOD_SDLKEYBOARD_H
#define LOVE_MOD_SDLKEYBOARD_H
// LOVE
#include <love/mod.h>
// Creating a separate namespace to avoid conflicts
// with standard library functions.
namespace love_sdlkeyboard
{
// Standard module functions.
bool module_init(int argc, char ** argv, love::Core * core);
bool module_quit();
bool module_open(void * vm);
bool module_open_v8(void * vm);
/**
* Checks whether a certain key is down or not.
* @param key A key identifier.
**/
bool isDown(int key);
} // love_sdlkeyboard
#endif // LOVE_MOD_SDLKEYBOARD_H
| [
"m4rvin2005@8b5f54a0-8722-11de-9e21-49812d2d8162"
]
| [
[
[
1,
36
]
]
]
|
54920efbc91b87e56cbe1557b8359299ee204e04 | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /Common/Models/BASIC1/Leaks.CPP | 1afb379d9e35133889b6a946234fdccf0be4d08f | []
| no_license | abcweizhuo/Test3 | 0f3379e528a543c0d43aad09489b2444a2e0f86d | 128a4edcf9a93d36a45e5585b70dee75e4502db4 | refs/heads/master | 2021-01-17T01:59:39.357645 | 2008-08-20T00:00:29 | 2008-08-20T00:00:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,605 | cpp | //================== SysCAD - Copyright Kenwalt (Pty) Ltd ===================
// $Nokeywords: $
//===========================================================================
// SysCAD Copyright Kenwalt (Pty) Ltd 1992
#include "stdafx.h"
#define __LEAKS_CPP
#include "leaks.h"
#include "m_xfer.h"
//#include "optoff.h"
//==========================================================================
//
//
//
//==========================================================================
XID xidHConst = MdlBsXID(17001);
XID xidKFact = MdlBsXID(17000);
XID xidPDiam = MdlBsXID(17002);
XID xidVDiam = MdlBsXID(17003);
//==========================================================================
//
//
//
//==========================================================================
IMPLEMENT_FLWEQN(LE_EquivDiam, Leak2AreaGroup.Name(), "LE_EquivDiam", "", TOC_SYSTEM,
"Equivalent Diameter",
"Orifice");
LE_EquivDiam::LE_EquivDiam(pTagObjClass pClass_, pchar pTag, pTaggedObject pAttach, TagObjAttachment eAttach) :
CFlwEqn(pClass_, pTag, pAttach, eAttach)
{
m_dEquivDiam=0.001;//1mm
m_dDP=0.0;
m_dVelSonicMeas=0;
// K for Pipe Entry + Exit
double K=1.0+0.5;
m_PhD.KFact.SetVal(K, this);
}
//--------------------------------------------------------------------------
LE_EquivDiam::~LE_EquivDiam()
{
}
//--------------------------------------------------------------------------
void LE_EquivDiam::BuildDataDefn(DataDefnBlk & DDB)
{
DDB.Double ("Equivalent_Diameter","EquivDiam", DC_L, "mm", &m_dEquivDiam, this, isParm);
m_PhD.KFact.BuildDataDefn(DDB, "ResistCoeff", "K", DC_, "", xidKFact, NULL, "Calculated", "Required");
DDB.Double ("Density", "Rho", DC_Rho, "kg/m^3", &m_dDensMeas, NULL, isResult);
DDB.Double ("Velocity", "Vel", DC_Ldt, "m/s", &m_dVelMeas, NULL, isResult);
DDB.Double ("SonicVelocity", "VelSonic", DC_Ldt, "m/s", &m_dVelSonicMeas, NULL, isResult);
DDB.Double ("PressDrop", "DP", DC_DP, "kPa", &m_dDP, NULL, isResult);
}
// --------------------------------------------------------------------------
flag LE_EquivDiam::DataXchg(DataChangeBlk & DCB)
{
if (m_PhD.KFact.DataXchg(DCB, xidKFact, this))
return 1;
return CFlwEqn::DataXchg(DCB);
}
//--------------------------------------------------------------------------
//void LE_EquivDiam::StartSolution(rFlwBlkBase FE)
// {
//
// };
//--------------------------------------------------------------------------
flag LE_EquivDiam::EvaluateFlwEqn(eScdFlwEqnTasks Task, CSpPropInfo *pProps, CFlwBlkBase & FE, bool On, double Regulation, CFBPhysData *pPhD0, CFBPhysData *pPhD1)
{
double DensMeas=Min_FE_Rho(FE.MeanRho(pProps));
double EquivArea=Diam2Area(m_dEquivDiam);
Regulation=Range(0.0, Regulation, 1.0);
if (On && (Regulation > MinValveOpening))
{
FE.SetQmFree();
// K for Pipe Entry + Exit
double K=1.0+0.5;
m_PhD.KFact.SetVal(K, this);
FE.SetVelMeasRange(DensMeas, EquivArea*Regulation, 0.001);
double Qm0=FE.QmMeas();
double Qm1=FE.QmMeas(1.001);
double Vel0=FE.VelMeas();
double Vel1=FE.VelMeas(1.001);
FE.SetVelocity(Vel0);
m_dVelMeas=Vel0;
double DP0, DP1;
if (FE.Linearised())
{
DP0=FE.LinearisedDP(Qm0, Regulation);
DP1=FE.LinearisedDP(Qm1, Regulation);
}
else
{
DP0=PressDropKFact(Vel0, DensMeas, m_PhD.KFact());
DP1=PressDropKFact(Vel1, DensMeas, m_PhD.KFact());
}
FE.SetDPq(DP0, (DP1-DP0)/FE.DQmMeas(1.001));
FE.SetDPb(0.0, 0.0);
m_dDP=DP0;
double P=FE.FlngPB().P;
if (Valid(P) && P>1.0)
m_dVelSonicMeas=Sqrt(1.4*P*1000/GTZ(FE.MeanRhoV(pProps, P)));
else
m_dVelSonicMeas=0;
/*
//double dPipeArea=Diam2Area(m_dDiamPipe);
//if (pPhD0 && pPhD0->IsPipe())
// dPipeArea=pPhD0->Area();
//else if (pPhD1 && pPhD1->IsPipe())
// dPipeArea=pPhD1->Area();
//else
// {};
//m_dDiamPipe=dPipeArea=Area2Diam(dPipeArea);
FE.SetQmMeasRange(0.0001);
double m_dDiamPipe=0.1;
//double aQm = fabs(FE.Qm);
//int sQm = Sign(FE.Qm);
double Rho = FE.MeanRho(pProps);
//double Rho=
//m_dEquivDiam = Range(0.2*m_dDiamPipe, m_dEquivDiam, 0.8*m_dDiamPipe);
m_dEquivDiam = Range(0.001*m_dDiamPipe, m_dEquivDiam, 0.8*m_dDiamPipe);
double DR = m_dEquivDiam/GTZ(m_dDiamPipe);//diameter ratio
double DRpowFour = Pow(DR,4.0);//diameter ratio raised to power of 4
double DRexpr = 1.0-DRpowFour;//1-(diam ratio to power of 4)
double E = Pow(DRexpr,-0.5);//Velocity_of_Approach factor
double DC = 0.5959+0.0312*Pow(DR,2.1)-0.184*Pow(DR,8.0)+0.039
*DRpowFour*Pow(DRexpr,-1.0)-0.01584*Pow(DR,3.0);//Discharge coefficient
m_dDP=Sqr((4000.0*FE.QmMeas())/(DC*E*PI*m_dEquivDiam*Rho))/(2.0*Rho);
double DPDQ=(FE.QmMeas()/Rho)*Sqr(4000.0/(DC*E*PI*m_dEquivDiam*Rho));
m_dDensMeas=Max(0.001, FE.MeanRho(pProps));
m_dVelMeas=FE.VelMeas();
FE.SetDPb(0.0, 0.0);
FE.SetDPq(-FE.QmSign()*m_dDP, -FE.QmSign()*DPDQ);
FE.SetVelocity(m_dVelMeas);
*/
}
else
FE.SetQmReqd(0.0);
return True;
}
//==========================================================================
//
//
//
//==========================================================================
//IMPLEMENT_FLWEQN(LE_KFact, Leak2AreaGroup.Name(), "LE_KFact", "", TOC_SYSTEM,
// "K Factor",
// "K Factor - Darcy");
//
//LE_KFact::LE_KFact(pTagObjClass pClass_, pchar pTag, pTaggedObject pAttach, TagObjAttachment eAttach) :
//CFlwEqn(pClass_, pTag, pAttach, eAttach)
// {
// m_PhD.KFact.SetVal(1000, this);
// //KFactOp=0.5;
// //m_dDP=0;
// }
//
////--------------------------------------------------------------------------
//
//LE_KFact::~LE_KFact()
// {
// }
//
////--------------------------------------------------------------------------
//
//void LE_KFact::BuildDataDefn(DataDefnBlk & DDB)
// {
// DDB.Double ("Density", "", DC_Rho, "kg/m^3", &m_dDensMeas, NULL, isResult);
// DDB.Double ("Velocity", "Vel", DC_Ldt, "m/s", &m_dVelMeas, NULL, isResult);
// KFact().BuildDataDefn(DDB, "K", "", DC_, "", xidFlwEqnKFact, NULL, "Calculated", "Required");
// DDB.Double ("PressDrop", "DP", DC_DP, "kPa", &m_dDP, NULL, isResult);
// //DDB.Double ("MassFlow", "Qm", DC_Qm, "g/s", &m_dQm, NULL, isResult);
//
// BuildDataDefnOveride(DDB);
// };
//
//// --------------------------------------------------------------------------
//
//flag LE_KFact::DataXchg(DataChangeBlk & DCB)
// {
// if (m_PhD.KFact.DataXchg(DCB, xidKFact, this))
// return 1;
// return CFlwEqn::DataXchg(DCB);
// }
//
//// --------------------------------------------------------------------------
//
//flag LE_KFact::ValidateData(ValidateDataBlk & VDB)
// {
// m_PhD.KFact.SetVal(ValidateRange(VDB, "K", 0.0, m_PhD.KFact.Val(), 1.0E6), this);
// return True;
// }
//
////--------------------------------------------------------------------------
//
//flag LE_KFact::EvaluateFlwEqn(eScdFlwEqnTasks Task, CSpPropInfo *pProps, CFlwBlkBase & FE, bool On, double Regulation, CFBPhysData *pPhD0, CFBPhysData *pPhD1)
// {
// Regulation=Range(0.0, Regulation, 1.0);
// if (Regulation > MinValveOpening)
// {
// FE.SetQmFree();
// const double DqScl=1.001;
//
// m_dDensMeas=Max(0.001, FE.MeanRho(pProps));
//
// m_dVelMeas=FE.SetVelMeasRange(m_dDensMeas*FE.Area(), 0.001);
// m_dVelMeas=Min(m_dVelMeas, 1000.0); // Abs Max Velocity - a bit ridiculous
//
// // flow into tank K = 1
// m_PhD.KFact.SetVal(FE.QmSign()>=0? 1.0 : 0.5, this);
//
// double dPq2, dPq1;
// if (FE.Linearised())
// {
// double Qm1 = FE.QmMeas();
// double dQm = FE.DQmMeas(DqScl);
// double Qm2 = FE.QmMeas(DqScl);;
// dPq2=FE.LinearisedDP(Qm2, Regulation);
// dPq1=FE.LinearisedDP(Qm1, Regulation);
// FE.SetDPq(-FE.QmSign() * dPq1, -FE.QmSign() * (dPq2 - dPq1)/dQm);
// }
// else
// {
// double Vel1 = FE.VelMeas();
// double dQm = FE.DQmMeas(DqScl);
// double Vel2 = FE.VelMeas(DqScl);;
// dPq1=PressDropKFact(Vel1, m_dDensMeas, m_PhD.KFact(), 1.0);
// dPq2=PressDropKFact(Vel2, m_dDensMeas, m_PhD.KFact(), 1.0);
//
// FE.SetDPq(-FE.QmSign()*dPq1, -FE.QmSign()*(dPq2-dPq1)/dQm);
// }
//
// double OnePhDPZ=-0.001*9.81*FE.Rise()*m_dDensMeas;
//
// FE.SetQmFree();
// FE.SetVelocity(FE.QmSign()*m_dVelMeas);
// FE.SetDPa(0.0, 0.0);
// FE.SetSlipRatio();
// FE.SetVoidFraction();
// FE.SetOnePhPart();
// FE.SetTempOut(4);
//
// FE.SetDPz(OnePhDPZ);
//
// m_dDP=dPq1;
//
// ASSERT_ALWAYS(Valid(FE.DPq()) && _finite(FE.DPq()), "Bad Friction Value", __FILE__, __LINE__);;
// }
// else
// FE.SetQmReqd(0.0);
// return True;
// };
//==========================================================================
//
//
//
//==========================================================================
IMPLEMENT_FLWEQN(LE_VolFlow, Leak2AreaGroup.Name(), "LE_VolFlw", "", TOC_SYSTEM,
"Simple Volumetric Flow",
"Simple Volumetric Flow");
//
LE_VolFlow::LE_VolFlow(pTagObjClass pClass_, pchar pTag, pTaggedObject pAttach, TagObjAttachment eAttach) :
CFlwEqn(pClass_, pTag, pAttach, eAttach)
{
//Diam=0.1;
m_PwrLaw=2.0;
m_OpDP=100.0;
m_OpVol=dNAN;
m_OpNVol=0.001;
m_dDP=0;
}
//--------------------------------------------------------------------------
LE_VolFlow::~LE_VolFlow()
{
}
//--------------------------------------------------------------------------
void LE_VolFlow::BuildDataDefn(DataDefnBlk & DDB)
{
// DDB.Double ("Diam", "", DC_L, "mm", &Diam , NULL, isParm);
DDB.Double ("PowerLaw", "", DC_, "", &m_PwrLaw, NULL, isParm);
DDB.Double ("Oper_DP", "", DC_DP, "kPa", &m_OpDP , NULL, isParm);
DDB.Double ("Oper_Vol", "", DC_Qv, "mL/s", &m_OpVol, NULL, isParm|NAN_OK);
DDB.Double ("Oper_NVol", "", DC_NQv, "NmL/s", &m_OpNVol, NULL, isParm|NAN_OK);
DDB.Double ("PressDrop", "DP", DC_DP, "kPa", &m_dDP, NULL, isResult);
//DDB.Double ("MassFlow", "Qm", DC_Qm, "g/s", &m_dQm, NULL, isResult);
BuildDataDefnOveride(DDB);
};
//--------------------------------------------------------------------------
flag LE_VolFlow::ValidateData(ValidateDataBlk & VDB)
{
if (Valid(m_OpVol))
m_OpNVol=dNAN;
else if (!Valid(m_OpNVol))
m_OpNVol=10.0;
return True;
}
//--------------------------------------------------------------------------
flag LE_VolFlow::EvaluateFlwEqn(eScdFlwEqnTasks Task, CSpPropInfo *pProps, CFlwBlkBase & FE, bool On, double Regulation, CFBPhysData *pPhD0, CFBPhysData *pPhD1)
{
Regulation=Range(0.0, Regulation, 1.0);
if (On && (Regulation > MinValveOpening))
{
FE.SetQmFree();
double dPq1, dPq2;
if (Valid(m_OpVol))
{
double Rho=Max(0.1, FE.MeanRho(pProps));
double K=fabs(m_OpDP)/Pow(fabs(m_OpVol*Regulation), m_PwrLaw);
double Vol1 = FE.SetQvMeasRange(Rho, 0.01);
double dQm = FE.DQmMeas(1.001);
double Vol2 = FE.QvMeas(1.001);
dPq1 = -FE.QmSign()*K*Pow(Vol1,m_PwrLaw);
dPq2 = -FE.QmSign()*K*Pow(Vol2,m_PwrLaw);
FE.SetDPq(dPq1, (dPq2 - dPq1)/dQm);
}
else
{
double NRho=Max(0.1, FE.MeanRho(pProps)*Norm_P/GTZ(FE.MeanPress())*FE.MeanTemp(pProps)/Norm_T);
double K=fabs(m_OpDP)/Pow(fabs(m_OpNVol), m_PwrLaw);
double NVol1 = FE.SetQvMeasRange(NRho, 0.01);
double dQm = FE.DQmMeas(1.001);
double NVol2 = FE.QvMeas(1.001);
dPq1 = -FE.QmSign()*K*Pow(NVol1,m_PwrLaw);
dPq2 = -FE.QmSign()*K*Pow(NVol2,m_PwrLaw);
FE.SetDPq(dPq1, (dPq2 - dPq1)/dQm);
}
m_dDP=fabs(dPq1);
}
else
FE.SetQmReqd(0.0);
m_dDP=0;
FE.SetFunctOfPress();
return True;
};
//==========================================================================
//
//
//
//==========================================================================
IMPLEMENT_FLWEQN(LE_MassFlow, Leak2AreaGroup.Name(), "LE_MassFlw", "", TOC_SYSTEM,
"Simple Mass Flow",
"Simple Mass Flow");
//
LE_MassFlow::LE_MassFlow(pTagObjClass pClass_, pchar pTag, pTaggedObject pAttach, TagObjAttachment eAttach) :
CFlwEqn(pClass_, pTag, pAttach, eAttach)
{
//Diam=0.1;
m_PwrLaw=2.0;
m_OpDP=100.0;
m_OpQm=0.001;
m_dDP=0;
}
//--------------------------------------------------------------------------
LE_MassFlow::~LE_MassFlow()
{
}
//--------------------------------------------------------------------------
void LE_MassFlow::BuildDataDefn(DataDefnBlk & DDB)
{
// DDB.Double ("Diam", "", DC_L, "mm", &Diam , NULL, isParm);
DDB.Double ("PowerLaw", "", DC_, "", &m_PwrLaw, NULL, isParm);
DDB.Double ("Oper_DP", "", DC_DP, "kPa", &m_OpDP , NULL, isParm);
DDB.Double ("Oper_Qm", "", DC_Qm, "g/s", &m_OpQm , NULL, isParm);
DDB.Double ("PressDrop", "DP", DC_DP, "kPa", &m_dDP, NULL, isResult);
//DDB.Double ("MassFlow", "Qm", DC_Qm, "g/s", &m_dQm, NULL, isResult);
BuildDataDefnOveride(DDB);
};
//--------------------------------------------------------------------------
flag LE_MassFlow::ValidateData(ValidateDataBlk & VDB)
{
m_OpDP=GEZ(m_OpDP);
m_OpQm=GEZ(m_OpQm);
return True;
}
//--------------------------------------------------------------------------
flag LE_MassFlow::EvaluateFlwEqn(eScdFlwEqnTasks Task, CSpPropInfo *pProps, CFlwBlkBase & FE, bool On, double Regulation, CFBPhysData *pPhD0, CFBPhysData *pPhD1)
{
Regulation=Range(0.0, Regulation, 1.0);
if (On && (Regulation > MinValveOpening))
{
FE.SetQmFree();
double dPq1, dPq2;
double Rho=Max(0.1, FE.MeanRho(pProps));
double K=fabs(m_OpDP)/Pow(fabs(m_OpQm), m_PwrLaw);
double Qm1 = FE.SetQmMeasRange(Max(0.001, FE.MeanRho(pProps)), 0.001);
double dQm = FE.DQmMeas(1.001);
double Qm2 = FE.QmMeas(1.001);
dPq1 = -FE.QmSign()*K*Pow(Qm1,m_PwrLaw);
dPq2 = -FE.QmSign()*K*Pow(Qm2,m_PwrLaw);
FE.SetDPq(dPq1, (dPq2 - dPq1)/dQm);
m_dDP=fabs(FE.DPq());
//m_dQm=FE.QmSign()*FE.QmMeas();
}
else
FE.SetQmReqd(0.0);
return True;
};
//==========================================================================
//
//
//
//==========================================================================
static IOAreaRec CPipeLeakIOAreaList[] =
{{"Input", "In", 0, LIO_In0, nc_MLnk, 1, 1, IOOptsHide|IOPipeJoin|IOGRP(1)},
{"Output", "Out", 1, LIO_Out0, nc_MLnk, 1, 1, IOOptsHide|IOPipeJoin|IOGRP(1)},
LEAKS2AREA("Leak", IOId_XferLeak),
//{"Leak", "Leak", IOId_XferLeak, LIO_Out, nc_MLnk, 0, 1, IOOptsHide|IOEqnsHide|IOPipeJoin|IOHidden},
{NULL}};
double Drw_CLeak[] = { DD_Poly, -3,-1, 3,-1,
DD_Poly, 0,-1, -1,0,
DD_Poly, 0,-1, 0,1,
DD_Poly, 0,-1, 1,0,
DD_TagPos, 0, -4.5,
DD_End };
//--------------------------------------------------------------------------
IMPLEMENT_MODELUNIT(CPipeLeak, "Leak", "1", Drw_CLeak, "Pipe Leak", "L", TOC_ALL|TOC_DYNAMICFLOW|TOC_GRP_GENERAL|TOC_STD_KENWALT,
"Process:Piping:Pipe Leak(1)",
"Unit for inserting Leak in a Pipe")
CPipeLeak::CPipeLeak(pTagObjClass pClass_, pchar TagIn, pTaggedObject pAttach, TagObjAttachment eAttach) :
MN_Xfer(pClass_, TagIn, pAttach, eAttach)//,
{
AttachIOAreas(CPipeLeakIOAreaList, &NullFlwGroup);
Joins.SetSize(1); // PreInit to Allow access to Leak Information
m_Leak.UsrEnable=true;
RegisterMacroMdlNode(CMMFlashTrain::MMIOs, &typeid(CPipeLeak), 0, mmio_CONNECT, &typeid(CFT_Mixer));
};
// -------------------------------------------------------------------------
/*#F:This provides access to the variables of the model.*/
void CPipeLeak::BuildDataDefn(DataDefnBlk & DDB)
{
DDB.BeginStruct(this);
DDB.Text ("");
DDB.Double ("Pressure", "P", DC_P, "kPag", xidPMean, this, isResult|0);
DDB.Visibility(NM_Dynamic|SM_All|HM_All);
DDB.Double ("PressureEst", "PEst", DC_P, "kPag", xidPEstMean, this, isResult|0);
BuildDataDefnElevation(DDB);
DDB.Visibility(SM_Buffered|HM_All);
m_Leak.Add_OnOff(DDB,0,101);
DDB.Text("");
BuildDataDefnShowIOs(DDB);
BuildDataDefnIOOpts(DDB);
if (m_Leak.Enabled)
{
DDB.Page("Leaks", DDB_RqdPage);
m_Leak.BuildDataDefn(DDB, tt_Struct, NULL, DDB_NoPage, 101, DFIO_ShowQm);
}
DDB.EndStruct();
};
// -------------------------------------------------------------------------
flag CPipeLeak::DataXchg(DataChangeBlk & DCB)
{
// for (int i=0; i<NoFlwIOs(); i++)
// if (DCB.dwUserInfo==i+1 && IOFB(i,0)->DataXchg(DCB))
// return 1;
if (MN_Xfer::DataXchg(DCB))
return 1;
if (DCB.dwUserInfo==101 && m_Leak.DataXchg(DCB))
return 1;
return 0;
}
// -------------------------------------------------------------------------
void CPipeLeak::PostConnect(int IONo)
{
MN_Xfer::PostConnect(IONo);
if (IOId_Self(IONo)!=IOId_XferLeak)
return;
IOConduit(IONo)->AttachMeToObj(this, TOA_Embedded);
IOFB(IONo,0)->AssignFlwEqnGroup(Leak2AreaGroup, Leak2AreaGroup.Default(), this);
// IOFB(IONo,0)->ParentFlwEqn(&m_FEP);
//_asm int 3;
IOFB(IONo,0)->SetIsPipe(true);
IOFB(IONo,0)->SetFBScales(1.0,1.0);
IOFB(IONo,0)->SetFlowModeSrc(this, false);
};
// -------------------------------------------------------------------------
void CPipeLeak::ConfigureJoins()
{
MN_Xfer::ConfigureJoins();
};
//==========================================================================
//
//
//
//==========================================================================
| [
"[email protected]",
"[email protected]",
"[email protected]"
]
| [
[
[
1,
81
],
[
83,
86
],
[
159,
162
],
[
167,
225
],
[
227,
276
],
[
278,
338
],
[
340,
341
],
[
343,
430
],
[
432,
433
],
[
435,
468
],
[
474,
499
],
[
501,
503
],
[
505,
513
],
[
515,
550
],
[
553,
554
],
[
562,
566
]
],
[
[
82,
82
],
[
87,
158
],
[
163,
166
],
[
226,
226
],
[
277,
277
],
[
339,
339
],
[
342,
342
],
[
431,
431
],
[
434,
434
],
[
500,
500
],
[
504,
504
],
[
514,
514
],
[
551,
552
],
[
555,
561
]
],
[
[
469,
473
]
]
]
|
6aa64e2fa5864783c076508fc1e942262dba0650 | e88830a2981a792c91776bf1188c7d15edc6dea0 | /Options.cpp | 3e512514b4e1b50e59dc242bdaf039b983779622 | []
| no_license | Wu-Lab/HMC | 9d848582cddae4a2d6cbb5f492bca51fde923918 | 5f5c0e22fcbc007e2dae2eb2dfe53e1b78a964ef | refs/heads/master | 2020-07-09T08:55:22.057596 | 2010-12-29T21:48:38 | 2010-12-29T21:48:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,042 | cpp |
#include <iomanip>
#include "Options.h"
void DisplayOption::operator()(const pair<string, po::variable_value> &opt) const
{
if (((flag == DisplayOption::defaulted) && !opt.second.defaulted()) ||
((flag == DisplayOption::specified) && opt.second.defaulted())) return;
os << " " << opt.first << " = ";
if (!opt.second.empty()) {
const std::type_info &type = opt.second.value().type();
if (type == typeid(int)) {
os << opt.second.as<int>();
}
else if (type == typeid(double)) {
os << opt.second.as<double>();
}
else if (type == typeid(bool)) {
os << (opt.second.as<bool>() ? "TRUE" : "FALSE");
}
else if (type == typeid(string)) {
os << opt.second.as<string>();
}
else if (type == typeid(vector<string>)) {
os << opt.second.as<vector<string> >();
}
else {
os << " <unknown type> ";
}
}
else {
os << " <empty> ";
}
os << endl;
}
void print_options(po::variables_map &vm, ostream &os, int specified)
{
for_each(vm.begin(), vm.end(), DisplayOption(os, specified));
}
/* Function used to check that 'opt1' and 'opt2' are not specified
at the same time. */
void conflicting_options(const po::variables_map& vm,
const char* opt1, const char* opt2)
{
if (vm.count(opt1) && !vm[opt1].defaulted()
&& vm.count(opt2) && !vm[opt2].defaulted())
throw logic_error(string("Conflicting options '")
+ opt1 + "' and '" + opt2 + "'.");
}
/* Function used to check that of 'for_what' is specified, then
'required_option' is specified too. */
void option_dependency(const po::variables_map& vm,
const char* for_what, const char* required_option)
{
if (vm.count(for_what) && !vm[for_what].defaulted())
if (vm.count(required_option) == 0 || vm[required_option].defaulted())
throw logic_error(string("Option '") + for_what
+ "' requires option '" + required_option + "'.");
}
| [
"wulingyun@localhost"
]
| [
[
[
1,
67
]
]
]
|
04f2d4356ef775d24b06a22ccc48fccd2e25c915 | 2957c5a47105deb75f2af0a78feaf6f01bebd0f5 | /InvadedSpace/userinterface.cpp | 6ba3c74f4c6b6797d695f5ecdf65ae4016d97965 | []
| no_license | akidarsa/ak-pu-school | a20e7f742a262a37011a60e8f20866f4d4b2a704 | fbe72462db4b0fe08e06674249c61eb7ead0641a | refs/heads/master | 2021-01-15T17:29:33.472717 | 2009-12-07T20:50:32 | 2009-12-07T20:50:32 | 32,253,320 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,479 | cpp | #include "userinterface.h"
#include "playarena.h"
#include "constant.h"
#include <iostream>
using namespace std;
UserInterface::UserInterface() {
createMenuBar();
main = new QWidget;
QVBoxLayout * layout = new QVBoxLayout;
arena = new PlayArena;
main -> setLayout(layout);
layout -> setMenuBar(bar);
layout -> addWidget(arena);
setCentralWidget(main);
setWindowTitle(tr("Invaders From Space!"));
timer = new QTimer;
timer -> setInterval(Db_updateDelay);
timer -> setSingleShot(false);
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
start();
}
void UserInterface::createMenuBar() {
bar = new QMenuBar;
file = new QMenu(tr("&File"), this);
reset = file->addAction(tr("&Reset"));
clearScore = file->addAction(tr("&Clear High Score"));
exit = file->addAction(tr("&Exit"));
bar->addMenu(file);
connect(reset, SIGNAL(triggered()), this, SLOT(resetarena()));
connect(clearScore, SIGNAL(triggered()), this, SLOT(clearHiScore()));
connect(exit, SIGNAL(triggered()), this, SLOT(exitarena()));
}
void UserInterface::clearHiScore() {
arena->clearHiScore();
}
void UserInterface::update() {
arena -> update();
arena -> updateHiScore();
}
void UserInterface::start() {
timer -> start();
}
void UserInterface::exitarena() {
close();
}
void UserInterface::resetarena() {
arena->resetGame();
}
| [
"akidarsa@a8046f88-d622-11de-89a3-7d4a0ca7bf7e"
]
| [
[
[
1,
62
]
]
]
|
b7731158c0b00728249b959a5f29c05ae7f6f82e | 4d5ee0b6f7be0c3841c050ed1dda88ec128ae7b4 | /src/nvimage/NormalMipmap.cpp | cb7e93f4f2fa16dee3beb88eff3a7e83e496bf36 | []
| no_license | saggita/nvidia-mesh-tools | 9df27d41b65b9742a9d45dc67af5f6835709f0c2 | a9b7fdd808e6719be88520e14bc60d58ea57e0bd | refs/heads/master | 2020-12-24T21:37:11.053752 | 2010-09-03T01:39:02 | 2010-09-03T01:39:02 | 56,893,300 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,177 | cpp | // This code is in the public domain -- [email protected]
#include <nvimage/NormalMipmap.h>
#include <nvimage/FloatImage.h>
#include <nvmath/Montecarlo.h>
#include <nvmath/SphericalHarmonic.h>
#include <nvcore/Ptr.h>
using namespace nv;
FloatImage * nv::createNormalMipmapMap(const FloatImage * img)
{
nvDebugCheck(img != NULL);
uint w = img->width();
uint h = img->height();
uint hw = w / 2;
uint hh = h / 2;
FloatImage dotImg;
dotImg.allocate(1, w, h);
FloatImage shImg;
shImg.allocate(9, hw, hh);
SampleDistribution distribution(256);
const uint sampleCount = distribution.sampleCount();
for (uint d = 0; d < sampleCount; d++)
{
const float * xChannel = img->channel(0);
const float * yChannel = img->channel(1);
const float * zChannel = img->channel(2);
Vector3 dir = distribution.sampleDir(d);
Sh2 basis;
basis.eval(dir);
for(uint i = 0; i < w*h; i++)
{
Vector3 normal(xChannel[i], yChannel[i], zChannel[i]);
normal = normalizeSafe(normal, Vector3(zero), 0.0f);
dotImg.setPixel(dot(dir, normal), d);
}
// @@ It would be nice to have a fastDownSample that took an existing image as an argument, to avoid allocations.
AutoPtr<FloatImage> dotMip(dotImg.fastDownSample());
for(uint p = 0; p < hw*hh; p++)
{
float f = dotMip->pixel(p);
// Project irradiance to sh basis and accumulate.
for (uint i = 0; i < 9; i++)
{
float & sum = shImg.channel(i)[p];
sum += f * basis.elemAt(i);
}
}
}
FloatImage * normalMipmap = new FloatImage;
normalMipmap->allocate(4, hw, hh);
// Precompute the clamped cosine radiance transfer.
Sh2 prt;
prt.cosineTransfer();
// Allocate outside the loop.
Sh2 sh;
for(uint p = 0; p < hw*hh; p++)
{
for (uint i = 0; i < 9; i++)
{
sh.elemAt(i) = shImg.channel(i)[p];
}
// Convolve sh irradiance by radiance transfer.
sh *= prt;
// Now sh(0) is the ambient occlusion.
// and sh(1) is the normal direction.
// Should we use SVD to fit only the normals to the SH?
}
return normalMipmap;
}
| [
"castano@0f2971b0-9fc2-11dd-b4aa-53559073bf4c"
]
| [
[
[
1,
99
]
]
]
|
90d74137a034e5a196997d0c341c0e1f1309e959 | e2e49023f5a82922cb9b134e93ae926ed69675a1 | /tools/aoslcpp/include/aosl/properties_stream_object.hpp | 68bb819280cf8579f62ac1a03471f9cbf6f46e65 | []
| no_license | invy/mjklaim-freewindows | c93c867e93f0e2fe1d33f207306c0b9538ac61d6 | 30de8e3dfcde4e81a57e9059dfaf54c98cc1135b | refs/heads/master | 2021-01-10T10:21:51.579762 | 2011-12-12T18:56:43 | 2011-12-12T18:56:43 | 54,794,395 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,224 | hpp | // Copyright (C) 2005-2010 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema
// to C++ data binding compiler, in the Proprietary License mode.
// You should have received a proprietary license from Code Synthesis
// Tools CC prior to generating this code. See the license text for
// conditions.
//
/**
* @file
* @brief Generated from properties_stream_object.xsd.
*/
#ifndef AOSLCPP_AOSL__PROPERTIES_STREAM_OBJECT_HPP
#define AOSLCPP_AOSL__PROPERTIES_STREAM_OBJECT_HPP
// Begin prologue.
//
#include <aoslcpp/common.hpp>
//
// End prologue.
#include <xsd/cxx/config.hxx>
#if (XSD_INT_VERSION != 3030000L)
#error XSD runtime version mismatch
#endif
#include <xsd/cxx/pre.hxx>
#include "aosl/properties_stream_object_forward.hpp"
#include <memory> // std::auto_ptr
#include <limits> // std::numeric_limits
#include <algorithm> // std::binary_search
#include <xsd/cxx/xml/char-utf8.hxx>
#include <xsd/cxx/tree/exceptions.hxx>
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/containers.hxx>
#include <xsd/cxx/tree/list.hxx>
#include <xsd/cxx/xml/dom/parsing-header.hxx>
#include <xsd/cxx/tree/containers-wildcard.hxx>
#ifndef XSD_DONT_INCLUDE_INLINE
#define XSD_DONT_INCLUDE_INLINE
#include "aosl/unit_stream_forward.hpp"
#include "aosl/controller_forward.hpp"
#include "aosl/activation_forward.hpp"
#undef XSD_DONT_INCLUDE_INLINE
#else
#include "aosl/unit_stream_forward.hpp"
#include "aosl/controller_forward.hpp"
#include "aosl/activation_forward.hpp"
#endif // XSD_DONT_INCLUDE_INLINE
/**
* @brief C++ namespace for the %artofsequence.org/aosl/1.0
* schema namespace.
*/
namespace aosl
{
/**
* @brief Class corresponding to the %properties_stream_object schema type.
*
* Stream Object representation. Properties for objects with streaming
* behaviour.
*
* @nosubgrouping
*/
class Properties_stream_object: public ::xml_schema::Type
{
public:
/**
* @name begin
*
* @brief Accessor and modifier functions for the %begin
* optional attribute with a default value.
*
* Begin position in the stream source.
*/
//@{
/**
* @brief Attribute type.
*/
typedef ::aosl::Unit_stream BeginType;
/**
* @brief Attribute traits type.
*/
typedef ::xsd::cxx::tree::traits< BeginType, char > BeginTraits;
/**
* @brief Return a read-only (constant) reference to the attribute.
*
* @return A constant reference to the attribute.
*/
const BeginType&
begin () const;
/**
* @brief Return a read-write reference to the attribute.
*
* @return A reference to the attribute.
*/
BeginType&
begin ();
/**
* @brief Set the attribute value.
*
* @param x A new value to set.
*
* This function makes a copy of its argument and sets it as
* the new value of the attribute.
*/
void
begin (const BeginType& x);
/**
* @brief Set the attribute value without copying.
*
* @param p A new value to use.
*
* This function will try to use the passed value directly
* instead of making a copy.
*/
void
begin (::std::auto_ptr< BeginType > p);
/**
* @brief Detach the attribute value from the object model.
*
* @return A pointer to the attribute value.
*
* Note that this function leaves the required attribute in
* the original object model uninitialized.
*/
::std::auto_ptr< BeginType >
detach_begin ();
/**
* @brief Return the default value for the attribute.
*
* @return A read-only (constant) reference to the attribute's
* default value.
*/
static const BeginType&
begin_default_value ();
//@}
/**
* @name end
*
* @brief Accessor and modifier functions for the %end
* optional attribute with a default value.
*
* End position in the stream source.
*/
//@{
/**
* @brief Attribute type.
*/
typedef ::aosl::Unit_stream EndType;
/**
* @brief Attribute traits type.
*/
typedef ::xsd::cxx::tree::traits< EndType, char > EndTraits;
/**
* @brief Return a read-only (constant) reference to the attribute.
*
* @return A constant reference to the attribute.
*/
const EndType&
end () const;
/**
* @brief Return a read-write reference to the attribute.
*
* @return A reference to the attribute.
*/
EndType&
end ();
/**
* @brief Set the attribute value.
*
* @param x A new value to set.
*
* This function makes a copy of its argument and sets it as
* the new value of the attribute.
*/
void
end (const EndType& x);
/**
* @brief Set the attribute value without copying.
*
* @param p A new value to use.
*
* This function will try to use the passed value directly
* instead of making a copy.
*/
void
end (::std::auto_ptr< EndType > p);
/**
* @brief Detach the attribute value from the object model.
*
* @return A pointer to the attribute value.
*
* Note that this function leaves the required attribute in
* the original object model uninitialized.
*/
::std::auto_ptr< EndType >
detach_end ();
/**
* @brief Return the default value for the attribute.
*
* @return A read-only (constant) reference to the attribute's
* default value.
*/
static const EndType&
end_default_value ();
//@}
/**
* @name loop
*
* @brief Accessor and modifier functions for the %loop
* optional attribute with a default value.
*
* True if the stream have to loop, false to stop once the end is
reached. */
//@{
/**
* @brief Attribute type.
*/
typedef ::xml_schema::Boolean LoopType;
/**
* @brief Attribute traits type.
*/
typedef ::xsd::cxx::tree::traits< LoopType, char > LoopTraits;
/**
* @brief Return a read-only (constant) reference to the attribute.
*
* @return A constant reference to the attribute.
*/
const LoopType&
loop () const;
/**
* @brief Return a read-write reference to the attribute.
*
* @return A reference to the attribute.
*/
LoopType&
loop ();
/**
* @brief Set the attribute value.
*
* @param x A new value to set.
*
* This function makes a copy of its argument and sets it as
* the new value of the attribute.
*/
void
loop (const LoopType& x);
/**
* @brief Return the default value for the attribute.
*
* @return The attribute's default value.
*/
static LoopType
loop_default_value ();
//@}
/**
* @name controller
*
* @brief Accessor and modifier functions for the %controller
* optional attribute with a default value.
*
* Tells if the stream should be controllable by the user,
* involving some kind of player-defined interface if required.
*/
//@{
/**
* @brief Attribute type.
*/
typedef ::aosl::Controller ControllerType;
/**
* @brief Attribute traits type.
*/
typedef ::xsd::cxx::tree::traits< ControllerType, char > ControllerTraits;
/**
* @brief Return a read-only (constant) reference to the attribute.
*
* @return A constant reference to the attribute.
*/
const ControllerType&
controller () const;
/**
* @brief Return a read-write reference to the attribute.
*
* @return A reference to the attribute.
*/
ControllerType&
controller ();
/**
* @brief Set the attribute value.
*
* @param x A new value to set.
*
* This function makes a copy of its argument and sets it as
* the new value of the attribute.
*/
void
controller (const ControllerType& x);
/**
* @brief Set the attribute value without copying.
*
* @param p A new value to use.
*
* This function will try to use the passed value directly
* instead of making a copy.
*/
void
controller (::std::auto_ptr< ControllerType > p);
/**
* @brief Detach the attribute value from the object model.
*
* @return A pointer to the attribute value.
*
* Note that this function leaves the required attribute in
* the original object model uninitialized.
*/
::std::auto_ptr< ControllerType >
detach_controller ();
/**
* @brief Return the default value for the attribute.
*
* @return A read-only (constant) reference to the attribute's
* default value.
*/
static const ControllerType&
controller_default_value ();
//@}
/**
* @name activation
*
* @brief Accessor and modifier functions for the %activation
* optional attribute with a default value.
*
* Tells if the stream will be reset at each activation,
* or will just continue where it was when it was deactivated.
*/
//@{
/**
* @brief Attribute type.
*/
typedef ::aosl::Activation ActivationType;
/**
* @brief Attribute traits type.
*/
typedef ::xsd::cxx::tree::traits< ActivationType, char > ActivationTraits;
/**
* @brief Return a read-only (constant) reference to the attribute.
*
* @return A constant reference to the attribute.
*/
const ActivationType&
activation () const;
/**
* @brief Return a read-write reference to the attribute.
*
* @return A reference to the attribute.
*/
ActivationType&
activation ();
/**
* @brief Set the attribute value.
*
* @param x A new value to set.
*
* This function makes a copy of its argument and sets it as
* the new value of the attribute.
*/
void
activation (const ActivationType& x);
/**
* @brief Set the attribute value without copying.
*
* @param p A new value to use.
*
* This function will try to use the passed value directly
* instead of making a copy.
*/
void
activation (::std::auto_ptr< ActivationType > p);
/**
* @brief Detach the attribute value from the object model.
*
* @return A pointer to the attribute value.
*
* Note that this function leaves the required attribute in
* the original object model uninitialized.
*/
::std::auto_ptr< ActivationType >
detach_activation ();
/**
* @brief Return the default value for the attribute.
*
* @return A read-only (constant) reference to the attribute's
* default value.
*/
static const ActivationType&
activation_default_value ();
//@}
/**
* @name Constructors
*/
//@{
/**
* @brief Create an instance from the ultimate base and
* initializers for required elements and attributes.
*/
Properties_stream_object ();
/**
* @brief Create an instance from a DOM element.
*
* @param e A DOM element to extract the data from.
* @param f Flags to create the new instance with.
* @param c A pointer to the object that will contain the new
* instance.
*/
Properties_stream_object (const ::xercesc::DOMElement& e,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
/**
* @brief Copy constructor.
*
* @param x An instance to make a copy of.
* @param f Flags to create the copy with.
* @param c A pointer to the object that will contain the copy.
*
* For polymorphic object models use the @c _clone function instead.
*/
Properties_stream_object (const Properties_stream_object& x,
::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0);
/**
* @brief Copy the instance polymorphically.
*
* @param f Flags to create the copy with.
* @param c A pointer to the object that will contain the copy.
* @return A pointer to the dynamically allocated copy.
*
* This function ensures that the dynamic type of the instance is
* used for copying and should be used for polymorphic object
* models instead of the copy constructor.
*/
virtual Properties_stream_object*
_clone (::xml_schema::Flags f = 0,
::xml_schema::Container* c = 0) const;
//@}
/**
* @brief Destructor.
*/
virtual
~Properties_stream_object ();
// Implementation.
//
//@cond
protected:
void
parse (::xsd::cxx::xml::dom::parser< char >&,
::xml_schema::Flags);
protected:
::xsd::cxx::tree::one< BeginType > begin_;
static const BeginType begin_default_value_;
::xsd::cxx::tree::one< EndType > end_;
static const EndType end_default_value_;
::xsd::cxx::tree::one< LoopType > loop_;
::xsd::cxx::tree::one< ControllerType > controller_;
static const ControllerType controller_default_value_;
::xsd::cxx::tree::one< ActivationType > activation_;
static const ActivationType activation_default_value_;
//@endcond
};
bool
operator== (const Properties_stream_object&, const Properties_stream_object&);
bool
operator!= (const Properties_stream_object&, const Properties_stream_object&);
}
#ifndef XSD_DONT_INCLUDE_INLINE
#include "aosl/unit_stream.hpp"
#include "aosl/unit_stream.inl"
#include "aosl/controller.hpp"
#include "aosl/controller.inl"
#include "aosl/activation.hpp"
#include "aosl/activation.inl"
#endif // XSD_DONT_INCLUDE_INLINE
#include <iosfwd>
namespace aosl
{
::std::ostream&
operator<< (::std::ostream&, const Properties_stream_object&);
}
#include <iosfwd>
#include <xercesc/sax/InputSource.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMErrorHandler.hpp>
namespace aosl
{
}
#include <iosfwd>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMErrorHandler.hpp>
#include <xercesc/framework/XMLFormatter.hpp>
#include <xsd/cxx/xml/dom/auto-ptr.hxx>
namespace aosl
{
void
operator<< (::xercesc::DOMElement&, const Properties_stream_object&);
}
#ifndef XSD_DONT_INCLUDE_INLINE
#include "aosl/properties_stream_object.inl"
#endif // XSD_DONT_INCLUDE_INLINE
#include <xsd/cxx/post.hxx>
// Begin epilogue.
//
//
// End epilogue.
#endif // AOSLCPP_AOSL__PROPERTIES_STREAM_OBJECT_HPP
| [
"klaim@localhost"
]
| [
[
[
1,
613
]
]
]
|
547da3decec50c4cab5f535341fbbb5bd3a920ec | 36bf908bb8423598bda91bd63c4bcbc02db67a9d | /Include/CComboToolBar.h | 86e7b4d51bce5deb088c8d5356b0f599b9099ca6 | []
| no_license | code4bones/crawlpaper | edbae18a8b099814a1eed5453607a2d66142b496 | f218be1947a9791b2438b438362bc66c0a505f99 | refs/heads/master | 2021-01-10T13:11:23.176481 | 2011-04-14T11:04:17 | 2011-04-14T11:04:17 | 44,686,513 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,039 | h | /*
CComboToolBar.h
Classe per il combo nella toolbar (MFC).
Nel file delle risorse bisogna definire l'id relativo al combo (IDC_COMBO_ON_TOOLBAR),
in caso contrario produce un errore in compilazione.
Luca Piergentili, 16/09/00
[email protected]
*/
#ifndef _CCOMBOTOOLBAR_H
#define _CCOMBOTOOLBAR_H 1
#include "window.h"
#include "resource.h"
#ifndef IDC_COMBO_ON_TOOLBAR
#error IDC_COMBO_ON_TOOLBAR not defined
#endif
/*
CComboToolBar
*/
class CComboToolBar : public CToolBar
{
public:
CComboToolBar();
virtual ~CComboToolBar() {}
inline void SetMessage (HWND hWnd,UINT nMessage) {m_hWnd = hWnd; m_nMessage = nMessage;}
inline void SetCommand (HWND hWnd,UINT nCommand) {m_hWnd = hWnd; m_nCommand = nCommand;}
void OnComboSelEndOk (void);
void OnComboSelChange (void);
CComboBox m_wndCombo;
private:
int m_nComboIndex;
char m_szComboText[256];
HWND m_hWnd;
UINT m_nMessage;
UINT m_nCommand;
DECLARE_MESSAGE_MAP()
};
#endif // _CCOMBOTOOLBAR_H
| [
"[email protected]"
]
| [
[
[
1,
45
]
]
]
|
e2d67dfe70dbabce09bbd6c9e714f61fa8d85910 | e6abea92f59a1031d94bbcb3cee828da264c04cf | /NppPluginIface/src/NppPluginIface_ExtLexer_SciCommon.h | 91cbc4082c70acbe5cb83e35b48c2f554d59c12e | []
| no_license | bruderstein/nppifacelib_mob | 5b0ad8d47a19a14a9815f6b480fd3a56fe2c5a39 | a34ff8b5a64e237372b939106463989b227aa3b7 | refs/heads/master | 2021-01-15T18:59:12.300763 | 2009-08-13T19:57:24 | 2009-08-13T19:57:24 | 285,922 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,930 | h | /* NppPluginIface_ExtLexer_SciCommon.h
*
* This file is part of the Notepad++ Plugin Interface Lib.
* Copyright 2008 - 2009 Thell Fowler ([email protected])
*
* This program is free software; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Notepad++ Plugin Common Include file providing all the Scintilla includes required for a
* plugin to implement Scintilla External Lexers within a Notepad++ plugin.
*
* No additional helper functions are providing with the inclusion of this file! Those are
* available using the NppPluginIface_ExtLexer file, and this file is NOT required for the
* NppPluginIface_ExtLexer file to be included in a plugin.
*
*/
#ifndef NPP_PLUGININTERFACE_EXTLEXER_SCICOMMON_H
#define NPP_PLUGININTERFACE_EXTLEXER_SCICOMMON_H
#define WIN32_LEAN_AND_MEAN
///////////////////////////////////////////////////////////////////////////////////////////////
// Common includes that each added language will need
// for use with Notepad++ External Lexers Plugin
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
// Required includes needed for Lexer plugin definitions.
/*
* See the lower part of this document for includes that are not required but are included
* because they add functionality that benefits lexers.
*
*/
//---------------------------------------------------------------------------------------------
// Standard library includes, using C++ headers instead of C.
#include <cstdlib>
/*
* Standard Lib
* Included here to met requirements for PropSet.h
*
*/
//---------------------------------------------------------------------------------------------
// Scintilla specific includes.
#include "Accessor.h"
/*
* Defines the interface for document buffer access.
* No additional includes come from this file.
*
*/
#include "PropSet.h"
/*
* Scintilla class definitions
* Includes:
* # "SString.h" -> String container/buffer access.
*
* Required for Window Accessor
*
*/
#include "WindowAccessor.h" /*
* Scintilla Accessor derived class
* Required for External Lexer
* No additional includes come from this file.
*
*/
#include "KeyWords.h"
/*
* Scintilla definitions enabling LexerModule
* Required for ExternalLexer
* No additional includes come from this file.
*
*/
#include "ExternalLexer.h"
/*
* Scintilla External Lexer classes
* Required for external lexer control and access
* No additional includes come from this file.
*/
#include "StyleContext.h"
/*
* Scintilla Styling
* Not really required but all the newer lexers use
* the style context accessor interface.
* No additional includes come from this file.
*
*/
///////////////////////////////////////////////////////////////////////////////////////////////
// Additional Includes
#include "CharacterSet.h"
/*
* Scintilla CharacterSet Class
* Encapsulates a set of characters.
* Used to test if a character is within a set.
*
*/
///////////////////////////////////////////////////////////////////////////////////////////////
// Common Namespace Aliases
// Having these included at this level is not good but there are already lexers setup to use
// these conventions so consider it deprecated, and instead define them in the source.
namespace pIface = npp_plugin; // The base plugin interface.
namespace lIface = npp_plugin::external_lexer; // The external lexer extension to the base interface.
namespace plugin = npp_plugin; // The plugin where this lexer was initialized.
#endif // NPPEXTLEXER_COMMON_H
| [
"T B Fowler@2fa2a738-4fc5-9a49-b7e4-8bd4648edc6b"
]
| [
[
[
1,
136
]
]
]
|
3b87a0243c0ac1221dd676a15b59cfcdecf4c840 | dd5c8920aa0ea96607f2498701c81bb1af2b3c96 | /stlplus/source/matrix.hpp | 486ee422c87b6e34836de65b39c8c9ad64409a5f | []
| no_license | BackupTheBerlios/multicrew-svn | 913279401e9cf886476a3c912ecd3d2b8d28344c | 5087f07a100f82c37d2b85134ccc9125342c58d1 | refs/heads/master | 2021-01-23T13:36:03.990862 | 2005-06-10T16:52:32 | 2005-06-10T16:52:32 | 40,747,367 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,533 | hpp | #ifndef MATRIX_HPP
#define MATRIX_HPP
/*----------------------------------------------------------------------------
Author: Andy Rushton
Copyright: (c) Andy Rushton, 2004
License: BSD License, see ../docs/license.html
General-purpose 2D matrix data structure
------------------------------------------------------------------------------*/
#include "os_fixes.hpp"
#include "textio.hpp"
#include "persistent.hpp"
////////////////////////////////////////////////////////////////////////////////
template<typename T> class matrix
{
public:
matrix(unsigned rows = 0, unsigned cols = 0, const T& fill = T());
~matrix(void);
matrix(const matrix&);
matrix& operator =(const matrix&);
void resize(unsigned rows, unsigned cols, const T& fill = T());
unsigned rows(void) const;
unsigned columns(void) const;
void erase(const T& fill = T());
void erase(unsigned row, unsigned col, const T& fill = T());
void insert(unsigned row, unsigned col, const T&);
const T& item(unsigned row, unsigned col) const;
T& item(unsigned row, unsigned col);
const T& operator()(unsigned row, unsigned col) const;
T& operator()(unsigned row, unsigned col);
void fill(const T& item = T());
void fill_column(unsigned col, const T& item = T());
void fill_row(unsigned row, const T& item = T());
void fill_leading_diagonal(const T& item = T());
void fill_trailing_diagonal(const T& item = T());
void make_identity(const T& one, const T& zero = T());
void transpose(void);
// persistence routines
void dump(dump_context&) const throw(persistent_dump_failed);
void restore(restore_context&) throw(persistent_restore_failed);
private:
unsigned m_rows;
unsigned m_cols;
T** m_data;
};
////////////////////////////////////////////////////////////////////////////////
template<typename T> otext& print(otext& str, const matrix<T>& mat, unsigned indent = 0);
template<typename T> otext& operator << (otext& str, const matrix<T>& mat);
////////////////////////////////////////////////////////////////////////////////
// non-member versions of the persistence functions
template<typename T>
void dump_matrix(dump_context& str, const matrix<T>& data) throw(persistent_dump_failed);
template<typename T>
void restore_matrix(restore_context& str, matrix<T>& data) throw(persistent_restore_failed);
////////////////////////////////////////////////////////////////////////////////
#include "matrix.tpp"
#endif
| [
"schimmi@cb9ff89a-abed-0310-8fc6-a4cabe7d48c9"
]
| [
[
[
1,
77
]
]
]
|
26b04f6592b64c3442272ddec56e5cad192101e4 | 20cafbe3f5e43b5f2da1a95e415c688c3e9843cc | /ns2hdf/Hdf_export.cpp | 8eb0cf51661f9d3b497f291e668b4a7e29501f5e | []
| no_license | G-Node/ns2hdf | b4273db5b99df56bd575b40307e1fd96ba55621d | d7528c78e582f3ed4ac69cc23c5da0792c70e15d | refs/heads/master | 2016-09-11T06:47:35.399793 | 2011-08-03T20:36:24 | 2011-08-03T20:36:24 | 2,150,825 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 24,430 | cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2010 G-NODE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// A copy of the GNU Lesser General Public License can be obtained by writing to:
// Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330,
// Boston, MA 02111-1307
// USA
//
// Our software uses PowerNap libraries which are included into ns2hdf,
// they are also distributed under the LGPL. PowerNap is available at:
// http://neuroshare.sourceforge.net/download.shtml
//
// Contact information:
//
// - Cristian Tatarau
// [email protected]
// [email protected]
//
// - Thomas Wachtler, German Neuroinformatics Node
// - Biozentrum
// Ludwig-Maximilians-Universitaet Muenchen
// Grosshaderner Strasse 2
// 82152 Martinsried-Planegg
// Germany
// - [email protected]
// - Homepage: http://www.neuroinf.de
//
//
// All other copyrights on this material are replaced by this license agreeement.
//
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "Hdf_export.h"
CHdf_export::CHdf_export()
{
}
CHdf_export::~CHdf_export(void)
{
}
void CHdf_export::closeFile(void)
{
H5Fclose(this->file_id);
}
/// Creates a HDF5 file with the specified path.
/// This function also saves the pathes to the source and target data
/// files into the appropriate private variables.
/// - parameters:
/// - sourceFile: full path tot the source data file
/// - hdfFile: full path to the target HDF5 file
int CHdf_export::createFile(CString sourceFile, CString hdfFile)
{
CHdf_export::path_source= sourceFile;
CHdf_export::path_hdf= hdfFile;
/* Create a new file using default properties. */
this->file_id = H5Fcreate(path_hdf, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
return(hOK);
}
/// Creates HDF5 groups for the 5 basic entity types:
/// analog, segment, event, neural, unknown data.
/// - parameters:
/// - t as entityType: the entity type for which you want to create the group
/// returns:
/// - herr_t
herr_t CHdf_export::create_root_groups(entityType t)
{
hid_t g;
herr_t status;
switch (t)
{
case entityType::Unknown_Entity:
g = H5Gcreate(this->file_id, "/Unknown", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
break;
case entityType::Analog:
g = H5Gcreate(this->file_id, "/Analog", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
break;
case entityType::Event:
g = H5Gcreate(this->file_id, "/Event", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
break;
case entityType::Segment:
g = H5Gcreate(this->file_id, "/Segment", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
break;
case entityType::Neural:
g = H5Gcreate(this->file_id, "/Neural", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
}
status = H5Gclose (g);
return(status);
}
/// Creates a data set containing the file info as specified in the neuroshare file.
/// - parameters:
/// - fi as ns_FILEINFO*: neuroshare file info
/// return:
/// - int: Returns a non-negative value if successful; otherwise returns a negative value.
int CHdf_export::write_fileInfo(ns_FILEINFO *fi)
{
hid_t s1_tid; //, dataset, space; /* File datatype identifier */
hid_t string_type32, string_type64, string_type256;
hsize_t dim[] = {1}; /* Dataspace dimensions */
/* Initialize the field field_type */
string_type32 = H5Tcopy( H5T_C_S1 );
string_type64 = H5Tcopy( H5T_C_S1 );
string_type256 = H5Tcopy( H5T_C_S1 );
H5Tset_size( string_type32, 32 );
H5Tset_size( string_type64, 64 );
H5Tset_size( string_type256, 256 );
// Create the memory data type.
s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(ns_FILEINFO));
H5Tinsert(s1_tid, "szFileType", HOFFSET(ns_FILEINFO, szFileType), string_type32);
H5Tinsert(s1_tid, "dwEntityCount", HOFFSET(ns_FILEINFO, dwEntityCount), H5T_NATIVE_UINT32);
H5Tinsert(s1_tid, "dTimeStampResolution", HOFFSET(ns_FILEINFO, dTimeStampResolution), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "dTimeSpan", HOFFSET(ns_FILEINFO, dTimeSpan), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "szAppName", HOFFSET(ns_FILEINFO, szAppName), string_type64);
H5Tinsert(s1_tid, "dwTime_Year", HOFFSET(ns_FILEINFO, dwTime_Year), H5T_NATIVE_UINT32);
H5Tinsert(s1_tid, "dwTime_Month", HOFFSET(ns_FILEINFO, dwTime_Month), H5T_NATIVE_UINT32);
H5Tinsert(s1_tid, "dwTime_DayofWeek", HOFFSET(ns_FILEINFO, dwTime_DayofWeek), H5T_NATIVE_UINT32);
H5Tinsert(s1_tid, "dwTime_Day", HOFFSET(ns_FILEINFO, dwTime_Day), H5T_NATIVE_UINT32);
H5Tinsert(s1_tid, "dwTime_Hour", HOFFSET(ns_FILEINFO, dwTime_Hour), H5T_NATIVE_UINT32);
H5Tinsert(s1_tid, "dwTime_Min", HOFFSET(ns_FILEINFO, dwTime_Min), H5T_NATIVE_UINT32);
H5Tinsert(s1_tid, "dwTime_Sec", HOFFSET(ns_FILEINFO, dwTime_Sec), H5T_NATIVE_UINT32);
H5Tinsert(s1_tid, "dwTime_MilliSec", HOFFSET(ns_FILEINFO, dwTime_MilliSec), H5T_NATIVE_UINT32);
H5Tinsert(s1_tid, "szFileComment", HOFFSET(ns_FILEINFO, szFileComment), string_type256);
hOK = H5LTmake_dataset(file_id,"/File_Info",1,dim,s1_tid, fi);
H5Tclose(s1_tid);
return(hOK);
}
/// This function writes one analog entity into the hdf5 file.
/// - parameters:
/// - d as double*: pointer to analog data
/// - n as UINT: total number of values, needed to set the correct size of the dataset
/// - index as DWORD: global index of the current analog entity
/// - ai as ns_ANALOGINFO: neuroshare analog info
int CHdf_export::write_analog(double* d, UINT n, DWORD index, ns_ANALOGINFO ai)
{
hid_t hSpace, hSet;
hsize_t dim[1] ={n}; // dim= n;
char name[32];
sprintf_s(name, "/Analog/Analog%i", index);
if(n==0)
hSpace = H5Screate(H5S_NULL) ;
else
hSpace = H5Screate_simple(1, dim, NULL);
/* Create the dataset. */
hSet = H5Dcreate(this->file_id, name, H5T_NATIVE_DOUBLE, hSpace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write the first dataset. */
hOK = H5Dwrite(hSet, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
d);
write_analog_info(hSet, ai);
/* Terminate access to the data space. */
hOK = H5Dclose(hSet);
hOK = H5Sclose(hSpace);
return(hOK);
}
/// Writes event data and the event attribute into the hdf5 file
/// The data type has to be specified, if it is a hdf5 compound type, you have to
/// build it first and pass the hdf5 compound type handle to this function.
/// - parameters:
/// - data: pointer to your data structures. It is a (void*) as we use different datatypes
/// - name: element name
/// - hDataType: handle of the hdf5 data type
/// - n: number of items
/// - ai: neuroshare event info for the attribute
int CHdf_export::write_event(void *data, char name[], hid_t hDataType,
UINT n, ns_EVENTINFO ai)
{
hid_t hSpace, hSet; /* Memory datatype handle */
hsize_t dim[1] ={n}; // dim[2]= {n, 1};
// hSpace = H5Screate_simple(1, dim, NULL);
if(n==0)
hSpace = H5Screate(H5S_NULL) ;
else
hSpace = H5Screate_simple(1, dim, NULL);
/* Create the dataset. */
hSet = H5Dcreate(this->file_id, name, hDataType, hSpace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write the first dataset. */
hOK = H5Dwrite(hSet, hDataType, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data);
write_event_info(hSet, ai);
/* Terminate access to the data space. */
hOK = H5Dclose(hSet);
hOK = H5Sclose(hSpace);
return(hOK);
}
/// Writes one event entity which contains byte sized data.
/// - parameters:
/// - data: pointer to the data
/// - n as UINT: total number of values, needed to set the correct size of the dataset
/// - index as DWORD: global index of the current analog entity
/// - ai as ns_EVENTINFO: neuroshare analog info
int CHdf_export::write_event_byte(eventByte *data,
UINT n, DWORD index, ns_EVENTINFO ai)
{
hid_t hDataType; /* Memory datatype handle */
char name[32];
sprintf_s(name, "/Event/Event%i", index);
// Create the memory data type.
hDataType = H5Tcreate (H5T_COMPOUND, sizeof(eventByte));
H5Tinsert(hDataType, "timeStamp", HOFFSET(eventByte, dTimeStamp), H5T_NATIVE_DOUBLE);
H5Tinsert(hDataType, "data", HOFFSET(eventByte, usData), H5T_NATIVE_UINT8);
hOK= write_event(data, name, hDataType, n, ai);
return(hOK);
}
/// Writes one event entity which contains double word sized data.
/// - parameters:
/// - data: pointer to the data
/// - n as UINT: total number of values, needed to set the correct size of the dataset
/// - index as DWORD: global index of the current analog entity
/// - ai as ns_EVENTINFO: neuroshare analog info
int CHdf_export::write_event_dword(eventDword *data,
UINT n, DWORD index, ns_EVENTINFO ai)
{
hid_t hDataType; /* Memory datatype handle */
char name[32];
sprintf_s(name, "/Event/Event%i", index);
// Create the memory data type.
hDataType = H5Tcreate (H5T_COMPOUND, sizeof(eventDword));
H5Tinsert(hDataType, "timeStamp", HOFFSET(eventDword, dTimeStamp), H5T_NATIVE_DOUBLE);
H5Tinsert(hDataType, "data", HOFFSET(eventDword, usData), H5T_NATIVE_UINT32);
hOK= write_event(data, name, hDataType, n, ai);
return(hOK);
}
/// Writes one event entity which contains word sized data.
/// - parameters:
/// - data: pointer to the data
/// - n as UINT: total number of values, needed to set the correct size of the dataset
/// - index as DWORD: global index of the current analog entity
/// - ai as ns_EVENTINFO: neuroshare analog info
int CHdf_export::write_event_word(eventWord *data,
UINT n, DWORD index, ns_EVENTINFO ai)
{
hid_t hDataType; /* Memory datatype handle */
char name[32];
sprintf_s(name, "/Event/Event%i", index);
// Create the memory data type.
hDataType = H5Tcreate (H5T_COMPOUND, sizeof(eventWord));
H5Tinsert(hDataType, "timeStamp", HOFFSET(eventWord, dTimeStamp), H5T_NATIVE_DOUBLE);
H5Tinsert(hDataType, "data", HOFFSET(eventWord, usData), H5T_NATIVE_UINT16);
hOK= write_event(data, name, hDataType, n, ai);
return(hOK);
}
/// Returns a hdf5 string type
/// - parameters:
/// - len as UINT: length of the string in bytes
/// return:
/// - string type as hid_t
hid_t CHdf_export::get_string_type(UINT len)
{
hid_t string_type;
/* Initialize the field field_type */
string_type = H5Tcopy( H5T_C_S1 );
H5Tset_size( string_type, len );
return(string_type);
}
/// Writes one event entity which contains text or csv items.
/// - parameters:
/// - data as BYTE*: pointer to data array
/// - n as UINT: total number of values, needed to set the correct size of the dataset
/// - index as DWORD: global index of the current analog entity
/// - ai as ns_EVENTINFO: neuroshare analog info
int CHdf_export::write_event_text(BYTE *data,
UINT n, DWORD index, ns_EVENTINFO ai)
{
hid_t hDataType, string_type, hSpace, hSet; /* Memory datatype handle */
hsize_t dim[2]= {n, 1};
char name[32];
sprintf_s(name, "/Event/Event%i", index);
string_type= get_string_type(ai.dwMaxDataLength );
// Create the memory data type.
hDataType = H5Tcreate (H5T_COMPOUND, (sizeof(double)+ai.dwMaxDataLength) ); // sizeof(data[0])
H5Tinsert(hDataType, "timeStamp", 0, H5T_NATIVE_DOUBLE);
H5Tinsert(hDataType, "data", sizeof(double), string_type);
hSpace = H5Screate_simple(1, dim, NULL);
/* Create the dataset. */
hSet = H5Dcreate(this->file_id, name, hDataType, hSpace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write the first dataset. */
hOK = H5Dwrite(hSet, hDataType, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data);
write_event_info(hSet, ai);
// hOK = H5LTmake_dataset(file_id,name ,1,dim,hDataType,data);
/* Terminate access to the data space. */
hOK = H5Dclose(hSet);
hOK = H5Sclose(hSpace);
return(hOK);
}
/// Creates a group for one single segment entity.
///
/// This segment entity will
/// contain distinct groups for each data item and for each source info.
/// Each data item contains on his part two data sets: one for the time stamp and
/// one for the multi-channel data
///
/// - parameters:
/// - index as DWORD: global index of the current analog entity
/// - info as ns_SEGMENTINFO: neuroshare segment info
/// - info_source as ns_SEGSOURCEINFO: neuroshare segment source info
int CHdf_export::create_single_segment_group(DWORD index, ns_SEGMENTINFO info, ns_SEGSOURCEINFO *info_source)
{
hid_t h;
char name[32];
sprintf_s(name, "/Segment/Segment%i", index);
h= H5Gcreate(this->file_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
write_segment_info(h, info);
sprintf_s(name, "/Segment/Source_Info%i", index);
write_segment_sourceInfo(h, name, info_source, info.dwSourceCount);
return(h);
}
/// Creates one single segment data item.
/// Each data item contains on his part two data sets: one for the time stamp and
/// one for the multi-channel data
///
/// - parameters:
/// - t as double: time stamp
/// - data as double*: pointer to data
/// - index as DWORD: global index of the current analog entity
/// - item as UINT: current item number
int CHdf_export::write_segment_item(double t, double *data, DWORD index, UINT item,
UINT sourceCount, UINT maxSampleCount)
{
hid_t hSpace, hSet; /* Memory datatype handle */
hsize_t dim[1]= {1};
hsize_t dimData[2]= {maxSampleCount, sourceCount};
char name[128];
sprintf_s(name, "/Segment/Segment%i/DataItem%i", index, item);
H5Gcreate(this->file_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf_s(name, "/Segment/Segment%i/DataItem%i/Time_Stamp", index, item);
hOK = H5LTmake_dataset(this->file_id,name,1,dim,H5T_NATIVE_DOUBLE,&t);
hSpace = H5Screate_simple(2, dimData, NULL);
sprintf_s(name, "/Segment/Segment%i/DataItem%i/Data", index, item);
/* Create the dataset. */
hSet = H5Dcreate(this->file_id, name, H5T_NATIVE_DOUBLE, hSpace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write the first dataset. */
hOK = H5Dwrite(hSet, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
(void*)data);
////write_event_info(hSet, ai);
////// hOK = H5LTmake_dataset(file_id,name ,1,dim,hDataType,data);
/* Terminate access to the data space. */
hOK = H5Dclose(hSet);
hOK = H5Sclose(hSpace);
return(hOK);
}
/// Writes the neuroshare event info and anchors it
/// to the specified handle.
/// - parameters:
/// - h: handle of the element to tag
/// - info: neuroshare event info
herr_t CHdf_export::write_event_info(hid_t h, ns_EVENTINFO info)
{
hid_t s;
herr_t ioOK;
/* Initialize the string field */
s = H5Tcopy( H5T_C_S1 );
H5Tset_size( s, 128 );
ioOK= write_single_attribute(h, "dwEventType", H5T_NATIVE_UINT, (void*)&info.dwEventType);
ioOK= write_single_attribute(h, "dwMinDataLength", H5T_NATIVE_UINT, (void*)&info.dwMinDataLength);
ioOK= write_single_attribute(h, "dwMaxDataLength", H5T_NATIVE_UINT, (void*)&info.dwMaxDataLength);
ioOK= write_single_attribute(h, "szCSVDesc", s, (void*)&info.szCSVDesc);
return(ioOK);
}
/// Writes the neuroshare segment info and anchors it
/// to the specified handle.
/// - parameters:
/// - h: handle of the element to tag
/// - info: neuroshare segment info
herr_t CHdf_export::write_segment_info(hid_t h, ns_SEGMENTINFO info)
{
hid_t s;
herr_t ioOK;
/* Initialize the string field */
s = H5Tcopy( H5T_C_S1 );
H5Tset_size( s, 32 );
ioOK= write_single_attribute(h, "dwSourceCount", H5T_NATIVE_UINT, (void*)&info.dwSourceCount);
ioOK= write_single_attribute(h, "dwMinSampleCount", H5T_NATIVE_UINT, (void*)&info.dwMinSampleCount);
ioOK= write_single_attribute(h, "dwMaxSampleCount", H5T_NATIVE_UINT, (void*)&info.dwMaxSampleCount);
ioOK= write_single_attribute(h, "dSampleRate", H5T_NATIVE_DOUBLE, (void*)&info.dSampleRate);
ioOK= write_single_attribute(h, "szUnits", s, (void*)&info.szUnits);
return(ioOK);
}
/// Creates a data set containing the neuroshare segment source info.
/// - parameters:
/// - h: handle of the element to tag
/// - name[]: name of the tag
/// - info: opinter to the segment source info
herr_t CHdf_export::write_segment_sourceInfo(hid_t h, char name[], ns_SEGSOURCEINFO *info,
UINT number_of_sources)
{
hid_t s1_tid; //, dataset, space; /* File datatype identifier */
hid_t s16, s128;
hsize_t dim[1] = {number_of_sources}; /* Dataspace dimensions */
//hsize_t dim[number_of_sources] = {1}; /* Dataspace dimensions */
/* Initialize the field field_type */
s16 = H5Tcopy( H5T_C_S1 );
s128 = H5Tcopy( H5T_C_S1 );
H5Tset_size( s16, 16 );
H5Tset_size( s128, 128 );
// Create the memory data type.
s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(ns_SEGSOURCEINFO));
H5Tinsert(s1_tid, "dMinVal", HOFFSET(ns_SEGSOURCEINFO, dMinVal), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "dMaxVal", HOFFSET(ns_SEGSOURCEINFO, dMaxVal), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "dResolution", HOFFSET(ns_SEGSOURCEINFO, dResolution), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "dSubSampleShift", HOFFSET(ns_SEGSOURCEINFO, dSubSampleShift), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "dLocationX", HOFFSET(ns_SEGSOURCEINFO, dLocationX), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "dLocationY", HOFFSET(ns_SEGSOURCEINFO, dLocationY), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "dLocationZ", HOFFSET(ns_SEGSOURCEINFO, dLocationZ), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "dLocationUser", HOFFSET(ns_SEGSOURCEINFO, dLocationUser), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "dHighFreqCorner", HOFFSET(ns_SEGSOURCEINFO, dHighFreqCorner), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "dwHighFreqOrder", HOFFSET(ns_SEGSOURCEINFO, dwHighFreqOrder), H5T_NATIVE_INT32);
H5Tinsert(s1_tid, "szHighFilterType", HOFFSET(ns_SEGSOURCEINFO, szHighFilterType), s16);
H5Tinsert(s1_tid, "dLowFreqCorner", HOFFSET(ns_SEGSOURCEINFO, dLowFreqCorner), H5T_NATIVE_DOUBLE);
H5Tinsert(s1_tid, "dwLowFreqOrder", HOFFSET(ns_SEGSOURCEINFO, dwLowFreqOrder), H5T_NATIVE_INT32);
H5Tinsert(s1_tid, "szLowFilterType", HOFFSET(ns_SEGSOURCEINFO, szLowFilterType), s16);
H5Tinsert(s1_tid, "szProbeInfo", HOFFSET(ns_SEGSOURCEINFO, szProbeInfo), s128);
hOK = H5LTmake_dataset(this->file_id,name,1,dim,s1_tid, info);
H5Tclose(s1_tid);
return(hOK);
}
/// Writes the neuroshare neural info and anchors it
/// to the specified handle.
/// - parameters:
/// - h: handle of the element to tag
/// - info: neuroshare neural info
herr_t CHdf_export::write_neural_info(hid_t h, ns_NEURALINFO info)
{
hid_t s;
herr_t ioOK;
/* Initialize the string field */
s = H5Tcopy( H5T_C_S1 );
H5Tset_size( s, 128 );
ioOK= write_single_attribute(h, "dwSourceEntityID", H5T_NATIVE_UINT, (void*)&info.dwSourceEntityID);
ioOK= write_single_attribute(h, "dwSourceUnitID", H5T_NATIVE_UINT, (void*)&info.dwSourceUnitID);
ioOK= write_single_attribute(h, "szProbeInfo", s, (void*)&info.szProbeInfo);
return(ioOK);
}
/// Creates an attribute and anchors it to the specified element
/// - parameters:
/// - h: handle where to anchor the tag
/// - szName[]: name of the tag
/// - hdfType: data type in hdf5 notation
/// - data: pointer to the data
herr_t CHdf_export::write_single_attribute(hid_t h, char szName[], int hdfType, void* data)
{
hid_t hSpace, hAttribute;
hsize_t dims;
herr_t status;
/* Create the data hSpace for the attribute. */
dims = 1;
hSpace = H5Screate_simple(1, &dims, NULL);
/* Create a dataset attribute. */
hAttribute = H5Acreate (h, szName, hdfType, hSpace,
H5P_DEFAULT, H5P_DEFAULT);
/* Write the attribute data. */
status = H5Awrite(hAttribute, hdfType, data);
/* Close the attribute. */
status = H5Aclose(hAttribute);
/* Close the datahSpace. */
status = H5Sclose(hSpace);
return(status);
}
/// Writes the neuroshare analog info and anchors it
/// to the specified handle.
/// - parameters:
/// - h: handle of the element to tag
/// - info: neuroshare analog info
herr_t CHdf_export::write_analog_info(hid_t h, ns_ANALOGINFO info)
{
hid_t s16, s128;
herr_t ioOK;
/* Initialize the string field */
s16 = H5Tcopy( H5T_C_S1 );
H5Tset_size( s16, 16 );
s128 = H5Tcopy( H5T_C_S1 );
H5Tset_size( s128, 128 );
write_single_attribute(h, "dSampleRate", H5T_NATIVE_DOUBLE, (void*)&info.dSampleRate);
write_single_attribute(h, "dMinVal", H5T_NATIVE_DOUBLE, (void*)&info.dMinVal);
write_single_attribute(h, "dMaxVal", H5T_NATIVE_DOUBLE, (void*)&info.dMaxVal);
write_single_attribute(h, "szUnits", s16, (void*)&info.szUnits);
write_single_attribute(h, "dResolution", H5T_NATIVE_DOUBLE, (void*)&info.dResolution);
write_single_attribute(h, "dLocationX", H5T_NATIVE_DOUBLE, (void*)&info.dLocationX);
write_single_attribute(h, "dLocationY", H5T_NATIVE_DOUBLE, (void*)&info.dLocationY);
write_single_attribute(h, "dLocationZ", H5T_NATIVE_DOUBLE, (void*)&info.dLocationZ);
write_single_attribute(h, "dLocationUser", H5T_NATIVE_DOUBLE, (void*)&info.dLocationUser);
write_single_attribute(h, "dHighFreqCorner", H5T_NATIVE_DOUBLE, (void*)&info.dHighFreqCorner);
write_single_attribute(h, "dwHighFreqOrder", H5T_NATIVE_INT, (void*)&info.dwHighFreqOrder);
write_single_attribute(h, "szHighFilterType", s16, (void*)&info.szHighFilterType);
write_single_attribute(h, "dLowFreqCorner", H5T_NATIVE_DOUBLE, (void*)&info.dLowFreqCorner);
write_single_attribute(h, "dwLowFreqOrder", H5T_NATIVE_INT, (void*)&info.dwLowFreqOrder);
write_single_attribute(h, "szLowFilterType", s16, (void*)&info.szLowFilterType);
ioOK= write_single_attribute(h, "szProbeInfo", s128, (char*)&info.szProbeInfo);
return(ioOK);
}
/// This function writes one analog entity into the hdf5 file.
/// - parameters:
/// - data: pointer to analog data
/// - info: neuroshare neural info
/// - size: data size counted in elements (not bytes)
/// - index: current item index
int CHdf_export::write_neural(double *data, ns_NEURALINFO info, UINT size, UINT index)
{
hid_t hSpace, hSet;
hsize_t dim[1]= {size};
char name[128];
sprintf_s(name, "/Neural/Neural%i", index);
hSpace = H5Screate_simple(1, dim, NULL);
/* Create the dataset. */
hSet = H5Dcreate(this->file_id, name, H5T_NATIVE_DOUBLE, hSpace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write the first dataset. */
hOK = H5Dwrite(hSet, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data);
write_neural_info(hSet, info);
/* Terminate access to the data space. */
hOK = H5Dclose(hSet);
hOK = H5Sclose(hSpace);
return(hOK);
}
| [
"[email protected]"
]
| [
[
[
1,
596
]
]
]
|
30947794925247c0328fe04bf769ce7715d4d553 | 2e6bb5ab6f8ad09f30785c386ce5ac66258df252 | /project/HappyHunter/Core/StaticMesh.cpp | fe3e23f7f769425dc4420c4122a9984ba29608bc | []
| no_license | linfuqing/happyhunter | 961061f84947a91256980708357b583c6ad2c492 | df38d8a0872b3fd2ea0e1545de3ed98434c12c5e | refs/heads/master | 2016-09-06T04:00:30.779303 | 2010-08-26T15:41:09 | 2010-08-26T15:41:09 | 34,051,578 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,532 | cpp | #include "StdAfx.h"
#include "basicutils.h"
#include "RenderQueue.h"
#include "StaticMesh.h"
#include "Camera.h"
using namespace zerO;
CStaticMesh::CStaticMesh() :
m_strEffectFile(TEXT("")),
m_pMesh(NULL),
m_pShadow(NULL),
m_bIsCreated(false),
m_bIsVisibleShadow(true),
m_bIsCulled(false)
{
}
CStaticMesh::~CStaticMesh()
{
Destroy();
}
bool CStaticMesh::Create(const PBASICCHAR meshFile)
{
//创建效果
if( !m_RenderMethod.LoadEffect( (PBASICCHAR)m_strEffectFile.c_str() ) )
return false;
DEBUG_NEW(m_pMesh, CMesh);
if( !m_pMesh->Load(meshFile) )
return false;
DEBUG_NEW(m_pShadow, CShadowVolume);
if( !m_pShadow->Create(*m_pMesh->GetMesh(), *this) )
return false;
m_LocalRect = m_pMesh->GetRectangle();
m_bIsCreated = true;
return true;
}
bool CStaticMesh::Destroy()
{
if(m_bIsCreated)
DEBUG_DELETE(m_pMesh);
DEBUG_DELETE(m_pShadow);
return true;
}
void CStaticMesh::Clone(CStaticMesh& StaticMesh)const
{
CSprite::Clone(StaticMesh);
m_RenderMethod.Clone(StaticMesh.m_RenderMethod);
StaticMesh.m_pMesh = m_pMesh;
}
bool CStaticMesh::ApplyForRender()
{
if(m_bIsCulled)
return true;
CEffect* pEffect = m_RenderMethod.GetEffect();
if(pEffect)
{
UINT uTotalPass = pEffect->GetTechniqueDesc().Passes, i, j;
for(i = 0; i < m_pMesh->GetSurfacesNumber(); i ++)
{
for (j = 0; j < uTotalPass; j ++)
{
//锁定整个队列
zerO::CRenderQueue::LPRENDERENTRY pRenderEntry = GAMEHOST.GetRenderQueue().LockRenderEntry();
//将信息需求传送到优化队列
pRenderEntry->hEffect = m_RenderMethod.GetEffect()->GetHandle();
pRenderEntry->uModelType = zerO::CRenderQueue::RENDERENTRY::MODEL_TYPE;
pRenderEntry->hModel = m_pMesh->GetHandle();
pRenderEntry->uModelParamB = (zerO::UINT16)i;
pRenderEntry->uRenderPass = (zerO::UINT8)j;
pRenderEntry->hSurface = m_pMesh->GetSurfaces()[i].GetHandle();
pRenderEntry->pParent = this;
//解锁
GAMEHOST.GetRenderQueue().UnLockRenderEntry(pRenderEntry);
}
}
return true;
}
return false;
}
void CStaticMesh::Update()
{
CSprite::Update();
m_bIsCulled = !CAMERA.GetFrustum().TestHit(m_WorldRect);
}
void CStaticMesh::Render(zerO::CRenderQueue::LPRENDERENTRY pEntry, zerO::UINT32 uFlag)
{
if( TEST_BIT(uFlag, zerO::CRenderQueue::EFFECT) )
{
D3DXVECTOR4 vecEyePos = D3DXVECTOR4(CAMERA.GetWorldPosition(), 0.0f);
m_RenderMethod.GetEffect()->GetEffect()->SetVector("vecEye", &vecEyePos);
const D3DLIGHT9* pLight = LIGHTMANAGER.GetLight(0);
D3DXVECTOR4 LightDirection(pLight->Direction, 1.0f);
m_RenderMethod.GetEffect()->GetEffect()->SetVector("vecLightDir", &LightDirection);
}
//依照更新标志进行更新
if( TEST_BIT(uFlag, zerO::CRenderQueue::PARENT) )
{
m_RenderMethod.GetEffect()->SetMatrix( CEffect::WORLD , m_WorldMatrix );
m_RenderMethod.GetEffect()->SetMatrix( CEffect::WORLD_VIEW_PROJECTION, m_WorldMatrix * CAMERA.GetViewProjectionMatrix() );
}
if( TEST_BIT(uFlag, zerO::CRenderQueue::MODEL_PARAMB) )
m_RenderMethod.GetEffect()->SetSurface(&m_pMesh->GetSurfaces()[pEntry->uModelParamB]);
m_RenderMethod.GetEffect()->GetEffect()->CommitChanges();
//绘制
if (m_pMesh && m_pMesh->GetMesh() != NULL)
m_pMesh->GetMesh()->DrawSubset(pEntry->uModelParamB);
if(m_pShadow)
m_pShadow->SetVisible(m_bIsVisibleShadow);
} | [
"linfuqing0@c6a4b443-94a6-74e8-d042-0855a5ab0aac"
]
| [
[
[
1,
142
]
]
]
|
315bc3e29d2e905c04faf27cb3253ac471efe0f7 | 465943c5ffac075cd5a617c47fd25adfe496b8b4 | /ALTCMND.H | 022adc2878eb3335a43c26adee75e52b280d4b4c | []
| no_license | paulanthonywilson/airtrafficcontrol | 7467f9eb577b24b77306709d7b2bad77f1b231b7 | 6c579362f30ed5f81cabda27033f06e219796427 | refs/heads/master | 2016-08-08T00:43:32.006519 | 2009-04-09T21:33:22 | 2009-04-09T21:33:22 | 172,292 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 442 | h | /* Altitude command class
version 0.1
Nick Papa 23/04/96.
*/
# ifndef _ALTCMND_H
# define _ALTCMND_H
# include "planecmn.h"
# define MAXALT 9
class AltCmnd : public PlaneCmnd {
protected:
int Altitude_c;
AltCmnd (Plane *pl)
:PlaneCmnd (pl) {}
public :
void Execute (void) { p_c ->AlterTargAlt (Altitude_c) ;}
CmndType Type () {
return Alt;
}
};
# endif _ALTCMND_H
| [
"[email protected]"
]
| [
[
[
1,
32
]
]
]
|
632d8884ec0ced58a94a185616dc7e814447261e | d115cf7a1b374d857f6b094d4b4ccd8e9b1ac189 | /gccxml_bin/v09/win32/share/gccxml-0.9/Vc8/Include/crtdbg.h | cec4f5f8b5c37843035278fd0c7f6342b5435e47 | []
| no_license | gatoatigrado/pyplusplusclone | 30af9065fb6ac3dcce527c79ed5151aade6a742f | a64dc9aeeb718b2f30bd6a5ff8dcd8bfb1cd2ede | refs/heads/master | 2016-09-05T23:32:08.595261 | 2010-05-16T10:53:45 | 2010-05-16T10:53:45 | 700,369 | 4 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 38,427 | h | /***
*crtdbg.h - Supports debugging features of the C runtime library.
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* Support CRT debugging features.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#include <crtdefs.h>
#ifndef _INC_CRTDBG
#define _INC_CRTDBG
#ifdef _MSC_VER
#pragma pack(push,_CRT_PACKING)
#endif /* _MSC_VER */
/* Define NULL here since we depend on it and for back-compat
*/
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************
*
* Debug Reporting
*
***************************************************************************/
typedef void *_HFILE; /* file handle pointer */
#define _CRT_WARN 0
#define _CRT_ERROR 1
#define _CRT_ASSERT 2
#define _CRT_ERRCNT 3
#define _CRTDBG_MODE_FILE 0x1
#define _CRTDBG_MODE_DEBUG 0x2
#define _CRTDBG_MODE_WNDW 0x4
#define _CRTDBG_REPORT_MODE -1
#define _CRTDBG_INVALID_HFILE ((_HFILE)-1)
#define _CRTDBG_HFILE_ERROR ((_HFILE)-2)
#define _CRTDBG_FILE_STDOUT ((_HFILE)-4)
#define _CRTDBG_FILE_STDERR ((_HFILE)-5)
#define _CRTDBG_REPORT_FILE ((_HFILE)-6)
#if !defined(_M_CEE_PURE)
typedef int (__cdecl * _CRT_REPORT_HOOK)(int, char *, int *);
typedef int (__cdecl * _CRT_REPORT_HOOKW)(int, wchar_t *, int *);
#else
typedef int (__clrcall * _CRT_REPORT_HOOK)(int, char *, int *);
typedef int (__clrcall * _CRT_REPORT_HOOKW)(int, wchar_t *, int *);
#endif
#if defined(_M_CEE)
typedef int (__clrcall *_CRT_REPORT_HOOK_M)(int, char *, int *);
typedef int (__clrcall *_CRT_REPORT_HOOKW_M)(int, wchar_t *, int *);
#endif
#define _CRT_RPTHOOK_INSTALL 0
#define _CRT_RPTHOOK_REMOVE 1
/****************************************************************************
*
* Heap
*
***************************************************************************/
/****************************************************************************
*
* Client-defined allocation hook
*
***************************************************************************/
#define _HOOK_ALLOC 1
#define _HOOK_REALLOC 2
#define _HOOK_FREE 3
#if !defined(_M_CEE_PURE)
typedef int (__cdecl * _CRT_ALLOC_HOOK)(int, void *, size_t, int, long, const unsigned char *, int);
#else
typedef int (__clrcall * _CRT_ALLOC_HOOK)(int, void *, size_t, int, long, const unsigned char *, int);
#endif
#if defined(_M_CEE)
typedef int (__clrcall * _CRT_ALLOC_HOOK_M)(int, void *, size_t, int, long, const unsigned char *, int);
#endif
/****************************************************************************
*
* Memory management
*
***************************************************************************/
/*
* Bit values for _crtDbgFlag flag:
*
* These bitflags control debug heap behavior.
*/
#define _CRTDBG_ALLOC_MEM_DF 0x01 /* Turn on debug allocation */
#define _CRTDBG_DELAY_FREE_MEM_DF 0x02 /* Don't actually free memory */
#define _CRTDBG_CHECK_ALWAYS_DF 0x04 /* Check heap every alloc/dealloc */
#define _CRTDBG_RESERVED_DF 0x08 /* Reserved - do not use */
#define _CRTDBG_CHECK_CRT_DF 0x10 /* Leak check/diff CRT blocks */
#define _CRTDBG_LEAK_CHECK_DF 0x20 /* Leak check at program exit */
/*
* Some bit values for _crtDbgFlag which correspond to frequencies for checking
* the the heap.
*/
#define _CRTDBG_CHECK_EVERY_16_DF 0x00100000 /* check heap every 16 heap ops */
#define _CRTDBG_CHECK_EVERY_128_DF 0x00800000 /* check heap every 128 heap ops */
#define _CRTDBG_CHECK_EVERY_1024_DF 0x04000000 /* check heap every 1024 heap ops */
/*
We do not check the heap by default at this point because the cost was too high
for some applications. You can still turn this feature on manually.
*/
#define _CRTDBG_CHECK_DEFAULT_DF 0
#define _CRTDBG_REPORT_FLAG -1 /* Query bitflag status */
#define _BLOCK_TYPE(block) (block & 0xFFFF)
#define _BLOCK_SUBTYPE(block) (block >> 16 & 0xFFFF)
/****************************************************************************
*
* Memory state
*
***************************************************************************/
/* Memory block identification */
#define _FREE_BLOCK 0
#define _NORMAL_BLOCK 1
#define _CRT_BLOCK 2
#define _IGNORE_BLOCK 3
#define _CLIENT_BLOCK 4
#define _MAX_BLOCKS 5
#if !defined(_M_CEE_PURE)
typedef void (__cdecl * _CRT_DUMP_CLIENT)(void *, size_t);
#else
typedef void (__clrcall * _CRT_DUMP_CLIENT)(void *, size_t);
#endif
#if defined(_M_CEE)
typedef void (__clrcall * _CRT_DUMP_CLIENT_M)(void *, size_t);
#endif
struct _CrtMemBlockHeader;
typedef struct _CrtMemState
{
struct _CrtMemBlockHeader * pBlockHeader;
size_t lCounts[_MAX_BLOCKS];
size_t lSizes[_MAX_BLOCKS];
size_t lHighWaterCount;
size_t lTotalCount;
} _CrtMemState;
/****************************************************************************
*
* Declarations, prototype and function-like macros
*
***************************************************************************/
/* _STATIC_ASSERT is for enforcing boolean/integral conditions at compile time.
Since it is purely a compile-time mechanism that generates no code, the check
is left in even if _DEBUG is not defined. */
#ifndef _STATIC_ASSERT
#define _STATIC_ASSERT(expr) typedef char __static_assert_t[ (expr) ]
#endif
#ifndef _DEBUG
/****************************************************************************
*
* Debug OFF
* Debug OFF
* Debug OFF
*
***************************************************************************/
/* We allow our basic _ASSERT macros to be overridden by pre-existing definitions.
This is not the ideal mechanism, but is helpful in some scenarios and helps avoid
multiple definition problems */
#ifndef _ASSERT
#define _ASSERT(expr) ((void)0)
#endif
#ifndef _ASSERTE
#define _ASSERTE(expr) ((void)0)
#endif
#ifndef _ASSERT_EXPR
#define _ASSERT_EXPR(expr, expr_str) ((void)0)
#endif
#ifndef _ASSERT_BASE
#define _ASSERT_BASE _ASSERT_EXPR
#endif
#define _RPT0(rptno, msg)
#define _RPTW0(rptno, msg)
#define _RPT1(rptno, msg, arg1)
#define _RPTW1(rptno, msg, arg1)
#define _RPT2(rptno, msg, arg1, arg2)
#define _RPTW2(rptno, msg, arg1, arg2)
#define _RPT3(rptno, msg, arg1, arg2, arg3)
#define _RPTW3(rptno, msg, arg1, arg2, arg3)
#define _RPT4(rptno, msg, arg1, arg2, arg3, arg4)
#define _RPTW4(rptno, msg, arg1, arg2, arg3, arg4)
#define _RPT5(rptno, msg, arg1, arg2, arg3, arg4, arg5)
#define _RPTW5(rptno, msg, arg1, arg2, arg3, arg4, arg5)
#define _RPTF0(rptno, msg)
#define _RPTFW0(rptno, msg)
#define _RPTF1(rptno, msg, arg1)
#define _RPTFW1(rptno, msg, arg1)
#define _RPTF2(rptno, msg, arg1, arg2)
#define _RPTFW2(rptno, msg, arg1, arg2)
#define _RPTF3(rptno, msg, arg1, arg2, arg3)
#define _RPTFW3(rptno, msg, arg1, arg2, arg3)
#define _RPTF4(rptno, msg, arg1, arg2, arg3, arg4)
#define _RPTFW4(rptno, msg, arg1, arg2, arg3, arg4)
#define _RPTF5(rptno, msg, arg1, arg2, arg3, arg4, arg5)
#define _RPTFW5(rptno, msg, arg1, arg2, arg3, arg4, arg5)
#define _malloc_dbg(s, t, f, l) malloc(s)
#define _calloc_dbg(c, s, t, f, l) calloc(c, s)
#define _realloc_dbg(p, s, t, f, l) realloc(p, s)
#define _recalloc_dbg(p, c, s, t, f, l) _recalloc(p, c, s)
#define _expand_dbg(p, s, t, f, l) _expand(p, s)
#define _free_dbg(p, t) free(p)
#define _msize_dbg(p, t) _msize(p)
#define _aligned_msize_dbg(p, a, o) _aligned_msize(p, a, o)
#define _aligned_malloc_dbg(s, a, f, l) _aligned_malloc(s, a)
#define _aligned_realloc_dbg(p, s, a, f, l) _aligned_realloc(p, s, a)
#define _aligned_recalloc_dbg(p, c, s, a, f, l) _aligned_recalloc(p, c, s, a)
#define _aligned_free_dbg(p) _aligned_free(p)
#define _aligned_offset_malloc_dbg(s, a, o, f, l) _aligned_offset_malloc(s, a, o)
#define _aligned_offset_realloc_dbg(p, s, a, o, f, l) _aligned_offset_realloc(p, s, a, o)
#define _aligned_offset_recalloc_dbg(p, c, s, a, o, f, l) _aligned_offset_recalloc(p, c, s, a, o)
#define _malloca_dbg(s, t, f, l) _malloca(s)
#define _freea_dbg(p, t) _freea(p)
#define _strdup_dbg(s, t, f, l) _strdup(s)
#define _wcsdup_dbg(s, t, f, l) _wcsdup(s)
#define _mbsdup_dbg(s, t, f, l) _mbsdup(s)
#define _tempnam_dbg(s1, s2, t, f, l) _tempnam(s1, s2)
#define _wtempnam_dbg(s1, s2, t, f, l) _wtempnam(s1, s2)
#define _fullpath_dbg(s1, s2, le, t, f, l) _fullpath(s1, s2, le)
#define _wfullpath_dbg(s1, s2, le, t, f, l) _wfullpath(s1, s2, le)
#define _getcwd_dbg(s, le, t, f, l) _getcwd(s, le)
#define _wgetcwd_dbg(s, le, t, f, l) _wgetcwd(s, le)
#define _getdcwd_dbg(d, s, le, t, f, l) _getdcwd(d, s, le)
#define _wgetdcwd_dbg(d, s, le, t, f, l) _wgetdcwd(d, s, le)
#define _getdcwd_lk_dbg(d, s, le, t, f, l) _getdcwd_nolock(d, s, le)
#define _wgetdcwd_lk_dbg(d, s, le, t, f, l) _wgetdcwd_nolock(d, s, le)
#define _dupenv_s_dbg(ps1, size, s2, t, f, l) _dupenv_s(ps1, size, s2)
#define _wdupenv_s_dbg(ps1, size, s2, t, f, l) _wdupenv_s(ps1, size, s2)
#define _CrtSetReportHook(f) ((_CRT_REPORT_HOOK)0)
#define _CrtGetReportHook() ((_CRT_REPORT_HOOK)0)
#define _CrtSetReportHook2(t, f) ((int)0)
#define _CrtSetReportHookW2(t, f) ((int)0)
#define _CrtSetReportMode(t, f) ((int)0)
#define _CrtSetReportFile(t, f) ((_HFILE)0)
#define _CrtDbgBreak() ((void)0)
#define _CrtSetBreakAlloc(a) ((long)0)
#define _CrtSetAllocHook(f) ((_CRT_ALLOC_HOOK)0)
#define _CrtGetAllocHook() ((_CRT_ALLOC_HOOK)0)
#define _CrtCheckMemory() ((int)1)
#define _CrtSetDbgFlag(f) ((int)0)
#define _CrtDoForAllClientObjects(f, c) ((void)0)
#define _CrtIsValidPointer(p, n, r) ((int)1)
#define _CrtIsValidHeapPointer(p) ((int)1)
#define _CrtIsMemoryBlock(p, t, r, f, l) ((int)1)
#define _CrtReportBlockType(p) ((int)-1)
#define _CrtSetDumpClient(f) ((_CRT_DUMP_CLIENT)0)
#define _CrtGetDumpClient() ((_CRT_DUMP_CLIENT)0)
#define _CrtMemCheckpoint(s) ((void)0)
#define _CrtMemDifference(s1, s2, s3) ((int)0)
#define _CrtMemDumpAllObjectsSince(s) ((void)0)
#define _CrtMemDumpStatistics(s) ((void)0)
#define _CrtDumpMemoryLeaks() ((int)0)
#define _CrtSetDebugFillThreshold(t) ((size_t)0)
#define _CrtSetCheckCount(f) ((int)0)
#define _CrtGetCheckCount() ((int)0)
#else /* _DEBUG */
/****************************************************************************
*
* Debug ON
* Debug ON
* Debug ON
*
***************************************************************************/
/* Define _MRTIMP */
#ifndef _MRTIMP
#define _MRTIMP __declspec(dllimport)
#endif /* _MRTIMP */
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/****************************************************************************
*
* Debug Reporting
*
***************************************************************************/
#if !defined(_M_CEE_PURE)
_CRTIMP extern long _crtAssertBusy;
#endif /* !defined(_M_CEE_PURE) */
#if !defined(_M_CEE_PURE)
_CRTIMP _CRT_REPORT_HOOK __cdecl _CrtGetReportHook(
void
);
#endif
/* _CrtSetReportHook[[W]2]:
* For IJW, we need 2 versions: 1 for clrcall and one for cdecl.
* For pure and native, we just need clrcall and cdecl, respectively.
*/
#if !defined(_M_CEE_PURE)
_CRTIMP _CRT_REPORT_HOOK __cdecl _CrtSetReportHook(
__in_opt _CRT_REPORT_HOOK _PFnNewHook
);
_CRTIMP int __cdecl _CrtSetReportHook2(
__in int _Mode,
__in_opt _CRT_REPORT_HOOK _PFnNewHook
);
_CRTIMP int __cdecl _CrtSetReportHookW2(
__in int _Mode,
__in_opt _CRT_REPORT_HOOKW _PFnNewHook
);
#else
extern "C++"
{
_MRTIMP _CRT_REPORT_HOOK __cdecl _CrtSetReportHook(
__in_opt _CRT_REPORT_HOOK _PFnNewHook
);
_MRTIMP int __cdecl _CrtSetReportHook2(
__in int _Mode,
__in_opt _CRT_REPORT_HOOK _PFnNewHook
);
_MRTIMP int __cdecl _CrtSetReportHookW2(
__in int _Mode,
__in_opt _CRT_REPORT_HOOKW _PFnNewHook
);
}
#endif
#if defined(_M_CEE_MIXED)
extern "C++"
{
_MRTIMP _CRT_REPORT_HOOK_M __cdecl _CrtSetReportHook(
__in_opt _CRT_REPORT_HOOK_M _PFnNewHook
);
_MRTIMP int __cdecl _CrtSetReportHook2(
__in int _Mode,
__in_opt _CRT_REPORT_HOOK_M _PFnNewHook
);
_MRTIMP int __cdecl _CrtSetReportHookW2(
__in int _Mode,
__in_opt _CRT_REPORT_HOOKW_M _PFnNewHook
);
/*
This overload allows NULL to be passed unambiguously in the mixed case
*/
_MRTIMP _CRT_REPORT_HOOK __cdecl _CrtSetReportHook(
__in int _PFnNewHook
);
}
#endif
_CRTIMP int __cdecl _CrtSetReportMode(
__in int _ReportType,
__in_opt int _ReportMode
);
_CRTIMP _HFILE __cdecl _CrtSetReportFile(
__in int _ReportType,
__in_opt _HFILE _ReportFile
);
_CRTIMP int __cdecl _CrtDbgReport(
__in int _ReportType,
__in_z_opt const char * _Filename,
__in int _Linenumber,
__in_z_opt const char * _ModuleName,
__in_z_opt const char * _Format,
...);
_CRTIMP size_t __cdecl _CrtSetDebugFillThreshold(
__in size_t _NewDebugFillThreshold
);
#if !defined(_NATIVE_WCHAR_T_DEFINED) && defined(_M_CEE_PURE)
extern "C++"
#endif
_CRTIMP int __cdecl _CrtDbgReportW(
__in int _ReportType,
__in_z_opt const wchar_t * _Filename,
__in int _LineNumber,
__in_z_opt const wchar_t * _ModuleName,
__in_z_opt const wchar_t * _Format,
...);
/* Asserts */
/* We use !! below to ensure that any overloaded operators used to evaluate expr do not end up at operator || */
#define _ASSERT_EXPR(expr, msg) \
(void) ((!!(expr)) || \
(1 != _CrtDbgReportW(_CRT_ASSERT, _CRT_WIDE(__FILE__), __LINE__, NULL, msg)) || \
(_CrtDbgBreak(), 0))
#ifndef _ASSERT
#define _ASSERT(expr) _ASSERT_EXPR((expr), NULL)
#endif
#ifndef _ASSERTE
#define _ASSERTE(expr) _ASSERT_EXPR((expr), _CRT_WIDE(#expr))
#endif
/*
We retain _ASSERT_BASE solely for backwards compatibility with those who used it even though they
should not have done so since it was not documented.
*/
#ifndef _ASSERT_BASE
#define _ASSERT_BASE _ASSERT_EXPR
#endif
/* Reports with no file/line info */
#if _MSC_VER >= 1300 || !defined(_M_IX86) || defined(_CRT_PORTABLE)
#define _RPT_BASE(args) \
(void) ((1 != _CrtDbgReport args) || \
(_CrtDbgBreak(), 0))
#define _RPT_BASE_W(args) \
(void) ((1 != _CrtDbgReportW args) || \
(_CrtDbgBreak(), 0))
#else
#define _RPT_BASE(args) \
do { if ((1 == _CrtDbgReport args)) \
_CrtDbgBreak(); } while (0)
#define _RPT_BASE_W(args) \
do { if ((1 == _CrtDbgReportW args)) \
_CrtDbgBreak(); } while (0)
#endif
#define _RPT0(rptno, msg) \
_RPT_BASE((rptno, NULL, 0, NULL, "%s", msg))
#define _RPTW0(rptno, msg) \
_RPT_BASE_W((rptno, NULL, 0, NULL, L"%s", msg))
#define _RPT1(rptno, msg, arg1) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1))
#define _RPTW1(rptno, msg, arg1) \
_RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1))
#define _RPT2(rptno, msg, arg1, arg2) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2))
#define _RPTW2(rptno, msg, arg1, arg2) \
_RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1, arg2))
#define _RPT3(rptno, msg, arg1, arg2, arg3) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3))
#define _RPTW3(rptno, msg, arg1, arg2, arg3) \
_RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3))
#define _RPT4(rptno, msg, arg1, arg2, arg3, arg4) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4))
#define _RPTW4(rptno, msg, arg1, arg2, arg3, arg4) \
_RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4))
#define _RPT5(rptno, msg, arg1, arg2, arg3, arg4, arg5) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4, arg5))
#define _RPTW5(rptno, msg, arg1, arg2, arg3, arg4, arg5) \
_RPT_BASE_W((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4, arg5))
/* Reports with file/line info */
#define _RPTF0(rptno, msg) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, "%s", msg))
#define _RPTFW0(rptno, msg) \
_RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, L"%s", msg))
#define _RPTF1(rptno, msg, arg1) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1))
#define _RPTFW1(rptno, msg, arg1) \
_RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1))
#define _RPTF2(rptno, msg, arg1, arg2) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2))
#define _RPTFW2(rptno, msg, arg1, arg2) \
_RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1, arg2))
#define _RPTF3(rptno, msg, arg1, arg2, arg3) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3))
#define _RPTFW3(rptno, msg, arg1, arg2, arg3) \
_RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1, arg2, arg3))
#define _RPTF4(rptno, msg, arg1, arg2, arg3, arg4) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3, arg4))
#define _RPTFW4(rptno, msg, arg1, arg2, arg3, arg4) \
_RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1, arg2, arg3, arg4))
#define _RPTF5(rptno, msg, arg1, arg2, arg3, arg4, arg5) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3, arg4, arg5))
#define _RPTFW5(rptno, msg, arg1, arg2, arg3, arg4, arg5) \
_RPT_BASE_W((rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, arg1, arg2, arg3, arg4, arg5))
#if _MSC_VER >= 1300 && !defined(_CRT_PORTABLE)
#define _CrtDbgBreak() __debugbreak()
extern void __cdecl __debugbreak(void);
#elif defined(_M_IX86) && !defined(_CRT_PORTABLE)
#define _CrtDbgBreak() __asm { int 3 }
#elif defined(_M_IA64) && !defined(_CRT_PORTABLE)
void __break(int);
#pragma intrinsic (__break)
#define _CrtDbgBreak() __break(0x80016)
#else
_CRTIMP void __cdecl _CrtDbgBreak(
void
);
#endif
/****************************************************************************
*
* Heap routines
*
***************************************************************************/
#ifdef _CRTDBG_MAP_ALLOC
#define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define calloc(c, s) _calloc_dbg(c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define realloc(p, s) _realloc_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _recalloc(p, c, s) _recalloc_dbg(p, c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _expand(p, s) _expand_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define free(p) _free_dbg(p, _NORMAL_BLOCK)
#define _msize(p) _msize_dbg(p, _NORMAL_BLOCK)
#define _aligned_msize(p, a, o) _aligned_msize_dbg(p, a, o)
#define _aligned_malloc(s, a) _aligned_malloc_dbg(s, a, __FILE__, __LINE__)
#define _aligned_realloc(p, s, a) _aligned_realloc_dbg(p, s, a, __FILE__, __LINE__)
#define _aligned_recalloc(p, c, s, a) _aligned_recalloc_dbg(p, c, s, a, __FILE__, __LINE__)
#define _aligned_offset_malloc(s, a, o) _aligned_offset_malloc_dbg(s, a, o, __FILE__, __LINE__)
#define _aligned_offset_realloc(p, s, a, o) _aligned_offset_realloc_dbg(p, s, a, o, __FILE__, __LINE__)
#define _aligned_offset_recalloc(p, c, s, a, o) _aligned_offset_recalloc_dbg(p, c, s, a, o, __FILE__, __LINE__)
#define _aligned_free(p) _aligned_free_dbg(p)
#define _malloca(s) _malloca_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _freea(p) _freea_dbg(p, _NORMAL_BLOCK)
#define _strdup(s) _strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wcsdup(s) _wcsdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _mbsdup(s) _strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _tempnam(s1, s2) _tempnam_dbg(s1, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wtempnam(s1, s2) _wtempnam_dbg(s1, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _fullpath(s1, s2, le) _fullpath_dbg(s1, s2, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wfullpath(s1, s2, le) _wfullpath_dbg(s1, s2, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _getcwd(s, le) _getcwd_dbg(s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wgetcwd(s, le) _wgetcwd_dbg(s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _getdcwd(d, s, le) _getdcwd_dbg(d, s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wgetdcwd(d, s, le) _wgetdcwd_dbg(d, s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _getdcwd_nolock(d, s, le) _getdcwd_lk_dbg(d, s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wgetdcwd_nolock(d, s, le) _wgetdcwd_lk_dbg(d, s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _dupenv_s(ps1, size, s2) _dupenv_s_dbg(ps1, size, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _wdupenv_s(ps1, size, s2) _wdupenv_s_dbg(ps1, size, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
#if !__STDC__
#define strdup(s) _strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define wcsdup(s) _wcsdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define tempnam(s1, s2) _tempnam_dbg(s1, s2, _NORMAL_BLOCK, __FILE__, __LINE__)
#define getcwd(s, le) _getcwd_dbg(s, le, _NORMAL_BLOCK, __FILE__, __LINE__)
#endif
#endif /* _CRTDBG_MAP_ALLOC */
#if !defined(_M_CEE_PURE)
_CRTIMP extern long _crtBreakAlloc; /* Break on this allocation */
#endif /* !defined(_M_CEE_PURE) */
_CRTIMP long __cdecl _CrtSetBreakAlloc(
__in long _BreakAlloc
);
/*
* Prototypes for malloc, free, realloc, etc are in malloc.h
*/
_CRTIMP __checkReturn __bcount_opt(_Size) void * __cdecl _malloc_dbg(
__in size_t _Size,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __bcount_opt(_NumOfElements*_SizeOfElements) void * __cdecl _calloc_dbg(
__in size_t _NumOfElements,
__in size_t _SizeOfElements,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __bcount_opt(_NewSize) void * __cdecl _realloc_dbg(
__inout_opt void * _Memory,
__in size_t _NewSize,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __bcount_opt(_NewSize) void * __cdecl _recalloc_dbg
(
__inout_opt void * _Memory,
__in size_t _NumOfElements,
__in size_t _SizeOfElements,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __bcount_opt(_NewSize) void * __cdecl _expand_dbg(
__inout_opt void * _Memory,
__in size_t _NewSize,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP void __cdecl _free_dbg(
__inout_opt void * _Memory,
__in int _BlockType
);
_CRTIMP size_t __cdecl _msize_dbg (
__in void * _Memory,
__in int _BlockType
);
_CRTIMP size_t __cdecl _aligned_msize_dbg (
__in void * _Memory,
__in size_t _Alignment,
__in size_t _Offset
);
_CRTIMP __checkReturn __bcount_opt(_Size) void * __cdecl _aligned_malloc_dbg(
__in size_t _Size,
__in size_t _Alignment,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __bcount_opt(_Size) void * __cdecl _aligned_realloc_dbg(
__inout_opt void * _Memory,
__in size_t _Size,
__in size_t _Alignment,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __bcount_opt(_Size) void * __cdecl _aligned_recalloc_dbg
(
__inout_opt void * _Memory,
__in size_t _NumOfElements,
__in size_t _SizeOfElements,
__in size_t _Alignment,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __bcount_opt(_Size) void * __cdecl _aligned_offset_malloc_dbg(
__in size_t _Size,
__in size_t _Alignment,
__in size_t _Offset,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __bcount_opt(_Size) void * __cdecl _aligned_offset_realloc_dbg(
__inout_opt void * _Memory,
__in size_t _Size,
__in size_t _Alignment,
__in size_t _Offset,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __bcount_opt(_Size) void * __cdecl _aligned_offset_recalloc_dbg
(
__inout_opt void * _Memory,
__in size_t _NumOfElements,
__in size_t _SizeOfElements,
__in size_t _Alignment,
__in size_t _Offset,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP void __cdecl _aligned_free_dbg(
__inout_opt void * _Memory
);
_CRTIMP __checkReturn __out_z_opt char * __cdecl _strdup_dbg(
__in_z_opt const char * _Str,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __out_z_opt wchar_t * __cdecl _wcsdup_dbg(
__in_z_opt const wchar_t * _Str,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __out_z_opt char * __cdecl _tempnam_dbg(
__in_z_opt const char * _DirName,
__in_z_opt const char * _FilePrefix,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __out_z_opt wchar_t * __cdecl _wtempnam_dbg(
__in_z_opt const wchar_t * _DirName,
__in_z_opt const wchar_t * _FilePrefix,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __out_z_opt char * __cdecl _fullpath_dbg(
__out_ecount_z_opt(_SizeInBytes) char * _FullPath,
__in_z const char * _Path,
__in size_t _SizeInBytes,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __out_z_opt wchar_t * __cdecl _wfullpath_dbg(
__out_ecount_z_opt(_SizeInWords) wchar_t * _FullPath,
__in_z const wchar_t * _Path,
__in size_t _SizeInWords,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __out_z_opt char * __cdecl _getcwd_dbg(
__out_ecount_z_opt(_SizeInBytes) char * _DstBuf,
__in int _SizeInBytes,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __out_z_opt wchar_t * __cdecl _wgetcwd_dbg(
__out_ecount_z_opt(_SizeInWords) wchar_t * _DstBuf,
__in int _SizeInWords,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __out_z_opt char * __cdecl _getdcwd_dbg(
__in int _Drive,
__out_ecount_z_opt(_SizeInBytes) char * _DstBuf,
__in int _SizeInBytes,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn __out_z_opt wchar_t * __cdecl _wgetdcwd_dbg(
__in int _Drive,
__out_ecount_z_opt(_SizeInWords) wchar_t * _DstBuf,
__in int _SizeInWords,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
__checkReturn __out_z_opt char * __cdecl _getdcwd_lk_dbg(
__in int _Drive,
__out_ecount_z_opt(_SizeInBytes) char * _DstBuf,
__in int _SizeInBytes,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
__checkReturn __out_z_opt wchar_t * __cdecl _wgetdcwd_lk_dbg(
__in int _Drive,
__out_ecount_z_opt(_SizeInWords) wchar_t * _DstBuf,
__in int _SizeInWords,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn_wat errno_t __cdecl _dupenv_s_dbg(
__deref_out_ecount_z_opt(*_PBufferSizeInBytes) char ** _PBuffer,
__out_opt size_t * _PBufferSizeInBytes,
__in_z const char * _VarName,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
_CRTIMP __checkReturn_wat errno_t __cdecl _wdupenv_s_dbg(
__deref_out_ecount_z_opt(*_PBufferSizeInWords) wchar_t ** _PBuffer,
__out_opt size_t * _PBufferSizeInWords,
__in_z const wchar_t * _VarName,
__in int _BlockType,
__in_z_opt const char * _Filename,
__in int _LineNumber
);
#define _malloca_dbg(s, t, f, l) _malloc_dbg(s, t, f, l)
#define _freea_dbg(p, t) _free_dbg(p, t)
#if defined(__cplusplus) && defined(_CRTDBG_MAP_ALLOC)
namespace std
{
using ::_calloc_dbg; using ::_free_dbg; using ::_malloc_dbg; using ::_realloc_dbg;
}
#endif
/****************************************************************************
*
* Client-defined allocation hook
*
***************************************************************************/
#if !defined(_M_CEE_PURE)
_CRTIMP _CRT_ALLOC_HOOK __cdecl _CrtGetAllocHook
(
void
);
#endif
/* _CrtSetAllocHook:
* For IJW, we need 2 versions: 1 for clrcall and one for cdecl.
* For pure and native, we just need clrcall and cdecl, respectively.
*/
#if !defined(_M_CEE_PURE)
_CRTIMP _CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook
(
__in_opt _CRT_ALLOC_HOOK _PfnNewHook
);
#else
extern "C++"
{
_MRTIMP _CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook
(
__in_opt _CRT_ALLOC_HOOK _PfnNewHook
);
}
#endif
#if defined (_M_CEE_MIXED)
extern "C++"
{
_MRTIMP _CRT_ALLOC_HOOK_M __cdecl _CrtSetAllocHook
(
__in_opt _CRT_ALLOC_HOOK_M _PfnNewHook
);
}
/* If we have both versions, then we need an int overload to disambiguate for the NULL case */
extern "C++"
{
_MRTIMP _CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook
(
__in int _PfnNewHook
);
}
#endif
/****************************************************************************
*
* Memory management
*
***************************************************************************/
/*
* Bitfield flag that controls CRT heap behavior
* Default setting is _CRTDBG_ALLOC_MEM_DF
*/
#if !defined(_M_CEE_PURE)
_CRTIMP extern int _crtDbgFlag;
#endif /* !defined(_M_CEE_PURE) */
_CRTIMP int __cdecl _CrtCheckMemory(
void
);
_CRTIMP int __cdecl _CrtSetDbgFlag(
__in int _NewFlag
);
_CRTIMP void __cdecl _CrtDoForAllClientObjects(
__in void (__cdecl *_PFn)(void *, void *),
void * _Context
);
#if defined(_M_CEE)
extern "C++"
{
_MRTIMP void __cdecl _CrtDoForAllClientObjects(
__in void (__clrcall * _PFn)(void *, void *),
void * _Context
);
}
#endif
_CRTIMP __checkReturn int __cdecl _CrtIsValidPointer(
__in_opt const void * _Ptr,
__in unsigned int _Bytes,
__in int _ReadWrite
);
_CRTIMP __checkReturn int __cdecl _CrtIsValidHeapPointer(
__in_opt const void * _HeapPtr
);
_CRTIMP int __cdecl _CrtIsMemoryBlock(
__in_opt const void * _Memory,
__in unsigned int _Bytes,
__out_opt long * _RequestNumber,
__out_opt char ** _Filename,
__out_opt int * _LineNumber
);
_CRTIMP __checkReturn int __cdecl _CrtReportBlockType(
__in_opt const void * _Memory
);
/****************************************************************************
*
* Memory state
*
***************************************************************************/
#if !defined(_M_CEE_PURE)
_CRTIMP _CRT_DUMP_CLIENT __cdecl _CrtGetDumpClient
(
void
);
#endif
/* _CrtSetDumpClient:
* For IJW, we need 2 versions: 1 for clrcall and one for cdecl.
* For pure and native, we just need clrcall and cdecl, respectively.
*/
#if !defined(_M_CEE_PURE)
_CRTIMP _CRT_DUMP_CLIENT __cdecl _CrtSetDumpClient
(
__in_opt _CRT_DUMP_CLIENT _PFnNewDump
);
#else
extern "C++"
{
_MRTIMP _CRT_DUMP_CLIENT __cdecl _CrtSetDumpClient
(
__in_opt _CRT_DUMP_CLIENT _PFnNewDump
);
}
#endif
#if defined (_M_CEE_MIXED)
extern "C++"
{
_MRTIMP _CRT_DUMP_CLIENT_M __cdecl _CrtSetDumpClient
(
__in_opt _CRT_DUMP_CLIENT_M _PFnNewDump
);
/* If we have both versions, then we need an int overload to disambiguate for the NULL case */
_MRTIMP _CRT_DUMP_CLIENT __cdecl _CrtSetDumpClient
(
__in_opt int _PFnNewDump
);
}
#endif
_CRTIMP _CRT_MANAGED_HEAP_DEPRECATE void __cdecl _CrtMemCheckpoint(
__out _CrtMemState * _State
);
_CRTIMP _CRT_MANAGED_HEAP_DEPRECATE int __cdecl _CrtMemDifference(
__out _CrtMemState * _State,
__in const _CrtMemState * _OldState,
__in const _CrtMemState * _NewState
);
_CRTIMP void __cdecl _CrtMemDumpAllObjectsSince(
__in_opt const _CrtMemState * _State
);
_CRTIMP void __cdecl _CrtMemDumpStatistics(
__in const _CrtMemState * _State
);
_CRTIMP int __cdecl _CrtDumpMemoryLeaks(
void
);
_CRTIMP int __cdecl _CrtSetCheckCount(
__in int _CheckCount
);
_CRTIMP int __cdecl _CrtGetCheckCount(
void
);
#endif /* _DEBUG */
#ifdef __cplusplus
}
#ifndef _MFC_OVERRIDES_NEW
extern "C++" {
#ifndef _DEBUG
/****************************************************************************
*
* Debug OFF
* Debug OFF
* Debug OFF
*
***************************************************************************/
__bcount(_Size) void * __CRTDECL operator new[](size_t _Size);
#if !defined(_M_CEE_PURE)
__bcount(_Size) void * __CRTDECL operator new(
size_t _Size,
int,
const char *,
int
);
__bcount(_Size) void * __CRTDECL operator new[](
size_t _Size,
int,
const char *,
int
);
#if _MSC_VER >= 1200
void __CRTDECL operator delete[](void *);
inline void __CRTDECL operator delete(void * _P, int, const char *, int)
{ ::operator delete(_P); }
inline void __CRTDECL operator delete[](void * _P, int, const char *, int)
{ ::operator delete[](_P); }
#endif
#endif
#else /* _DEBUG */
/****************************************************************************
*
* Debug ON
* Debug ON
* Debug ON
*
***************************************************************************/
__bcount(_Size) void * __CRTDECL operator new[](size_t _Size);
__bcount(_Size) void * __CRTDECL operator new(
size_t _Size,
int,
const char *,
int
);
__bcount(_Size) void * __CRTDECL operator new[](
size_t _Size,
int,
const char *,
int
);
#if _MSC_VER >= 1200
void __CRTDECL operator delete[](void *);
inline void __CRTDECL operator delete(void * _P, int, const char *, int)
{ ::operator delete(_P); }
inline void __CRTDECL operator delete[](void * _P, int, const char *, int)
{ ::operator delete[](_P); }
#endif
#if defined(_CRTDBG_MAP_ALLOC) && defined(_CRTDBG_MAP_ALLOC_NEW)
/* We keep these inlines for back compatibility only;
* the operator new defined in the debug libraries already calls _malloc_dbg,
* thus enabling the debug heap allocation functionalities.
*
* These inlines do not add any information, due that __FILE__ is expanded
* to "crtdbg.h", which is not very helpful to the user.
*
* The user will need to define _CRTDBG_MAP_ALLOC_NEW in addition to
* _CRTDBG_MAP_ALLOC to enable these inlines.
*/
inline __bcount(_Size) void * __CRTDECL operator new(size_t _Size)
{ return ::operator new(_Size, _NORMAL_BLOCK, __FILE__, __LINE__); }
inline __bcount(_Size) void* __CRTDECL operator new[](size_t _Size)
{ return ::operator new[](_Size, _NORMAL_BLOCK, __FILE__, __LINE__); }
#endif /* _CRTDBG_MAP_ALLOC && _CRTDBG_MAP_ALLOC_NEW */
#endif /* _DEBUG */
}
#endif /* _MFC_OVERRIDES_NEW */
#endif /* __cplusplus */
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_CRTDBG */
| [
"roman_yakovenko@dc5859f9-2512-0410-ae5c-dd123cda1f76"
]
| [
[
[
1,
1219
]
]
]
|
adb5f36e6d1b028a7839ed032bbc806478508a98 | 478570cde911b8e8e39046de62d3b5966b850384 | /apicompatanamdw/bcdrivers/os/lbs/LocAcquisition/src/testpositionInfo.cpp | 2c37868d4039d834fa3b94fe8c4ef084fa5bd422 | []
| no_license | SymbianSource/oss.FCL.sftools.ana.compatanamdw | a6a8abf9ef7ad71021d43b7f2b2076b504d4445e | 1169475bbf82ebb763de36686d144336fcf9d93b | refs/heads/master | 2020-12-24T12:29:44.646072 | 2010-11-11T14:03:20 | 2010-11-11T14:03:20 | 72,994,432 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,060 | cpp | /*
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: Test Class For TPositionInfo
*
*/
// System Includes
// User Includes
#include "testpositionInfo.h"
// Constant Declarations
// ======== MEMBER FUNCTIONS ========
// ---------------------------------------------------------------------------
// C++ Default Constructor
// ---------------------------------------------------------------------------
//
CTestPositionInfo::CTestPositionInfo(CStifLogger* aLog)
:iLog(aLog)
{
}
// ---------------------------------------------------------------------------
// C++ Destructor
// ---------------------------------------------------------------------------
//
CTestPositionInfo::~CTestPositionInfo()
{
}
// ---------------------------------------------------------
// CTestPositionInfo::CheckModuleId
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
TInt CTestPositionInfo::CheckModuleIdL( CStifItemParser& aItem )
{
TUint PsyUidInInt;
TUid PsyUid;
TPositionModuleId retrieveId;
//Get the PSYUid from the Stif framework
User::LeaveIfError(aItem.GetNextInt(PsyUidInInt, EHex));
//lex.Val(PsyUidInInt,EHex);
PsyUid.iUid = PsyUidInInt;
iPositionInfo.SetModuleId(PsyUid);
retrieveId=iPositionInfo.ModuleId();
if( PsyUid == retrieveId )
{
iLog->Log(_L("CheckModuleId - Passed"));
return KErrNone;
}
else
{
iLog->Log(_L("CheckModuleId - Failed"));
return KErrGeneral;
}
}
// ---------------------------------------------------------
// CTestPositionInfo::CheckUpdateType
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
TInt CTestPositionInfo::CheckUpdateTypeL( CStifItemParser& aItem )
{
TInt aUpdateType;
User::LeaveIfError(aItem.GetNextInt(aUpdateType));
TInt err;
switch(aUpdateType)
{
case 0:
iPositionInfo.SetUpdateType(EPositionUpdateUnknown);
if( EPositionUpdateUnknown == iPositionInfo.UpdateType() )
{
iLog->Log(_L("CheckModuleId - Passed"));
err = KErrNone;
}
else
{
iLog->Log(_L("CheckModuleId - Failed"));
err = KErrGeneral;
}
break;
default:
iPositionInfo.SetUpdateType(EPositionUpdateGeneral);
if( EPositionUpdateGeneral == iPositionInfo.UpdateType() )
{
iLog->Log(_L("CheckModuleId - Passed"));
err = KErrNone;
}
else
{
iLog->Log(_L("CheckModuleId - Failed"));
err = KErrGeneral;
}
}
return err;
}
// ---------------------------------------------------------
// CTestPositionInfo::CheckPosition
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
TInt CTestPositionInfo::CheckPosition( )
{
TPosition iPosition1;
TPosition iPosition2;
iPositionInfo.SetPosition(iPosition1);
iPositionInfo.GetPosition(iPosition2);
TInt some1 = iPosition1.Latitude();
TInt some2 = iPosition2.Latitude();
some1 = iPosition1.Longitude();
some2 = iPosition2.Longitude();
some1 = iPosition1.Altitude();
some2 = iPosition2.Altitude();
TBool some3 = (iPosition1.Time() == iPosition2.Time());
if( Math::IsNaN(iPosition2.Latitude()) &&
Math::IsNaN(iPosition2.Longitude()) &&
Math::IsNaN(iPosition2.Altitude()) &&
iPosition1.Time() == iPosition2.Time() )
{
iLog->Log(_L("CheckPosition - Passed"));
return KErrNone;
}
else
{
iLog->Log(_L("CheckPosition - Failed"));
return KErrGeneral;
}
}
| [
"none@none"
]
| [
[
[
1,
165
]
]
]
|
3ba02f8f31ab7993823057febc7ade56d85a1db1 | a36d7a42310a8351aa0d427fe38b4c6eece305ea | /render_win32/SurfaceLockedRectDX9Imp.cpp | 45187b95feadc146a1db9fb39bd8c0e6d16802ba | []
| no_license | newpolaris/mybilliard01 | ca92888373c97606033c16c84a423de54146386a | dc3b21c63b5bfc762d6b1741b550021b347432e8 | refs/heads/master | 2020-04-21T06:08:04.412207 | 2009-09-21T15:18:27 | 2009-09-21T15:18:27 | 39,947,400 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 401 | cpp | #include "DXUT.h"
#include "my_render_win32_dx9_imp.h"
namespace my_render_win32_dx9_imp {
SurfaceLockedRectDX9Imp::SurfaceLockedRectDX9Imp( const D3DLOCKED_RECT & dxLockedRect )
: dxLockedRect_( dxLockedRect )
{
}
int SurfaceLockedRectDX9Imp::getPitch() {
return dxLockedRect_.Pitch;
}
void * SurfaceLockedRectDX9Imp::getBitPointer() {
return dxLockedRect_.pBits;
}
} | [
"wrice127@af801a76-7f76-11de-8b9f-9be6f49bd635"
]
| [
[
[
1,
20
]
]
]
|
9cd90d75a8873906ae26908c5f800f1964d7713a | 3977ae61b891f7e8ae7d75b8e22bcb63dedc3c1c | /Base/Gui/Source/Exception/GuiException.h | 762e2061d7196966d1451b9e1be9089a440bc4ff | []
| no_license | jayrulez/ourprs | 9734915b69207e7c3382412ca8647b051a787bb1 | 9d10f7a6edb06483015ed11dcfc9785f63b7204b | refs/heads/master | 2020-05-17T11:40:55.001049 | 2010-03-25T05:20:04 | 2010-03-25T05:20:04 | 40,554,502 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 586 | h | /*
@Group: BSC2D
@Group Members:
<ul>
<li>Robert Campbell: 0701334</li>
<li>Audley Gordon: 0802218</li>
<li>Dale McFarlane: 0801042</li>
<li>Dyonne Duberry: 0802189</li>
</ul>
@
*/
#ifndef GUIEXCEPTION_H
#define GUIEXCEPTION_H
#ifdef _WIN32
#include "../../Win32/Core/Console.h"
#endif
#include "../Screen/Screen.h"
#include "../tools/Line.h"
#include "../tools/Frame.h"
#include "../menu/Item.h"
#include "../menu/MenuController.h"
class GuiException
{
public:
GuiException();
~GuiException();
void CatchAllGuiExecptions();
};
#endif
| [
"portmore.representa@c48e7a12-1f02-11df-8982-67e453f37615"
]
| [
[
[
1,
31
]
]
]
|
579e82a1d3afbd2aee14e702ee1362839eb2e359 | 9756190964e5121271a44aba29a5649b6f95f506 | /SimpleParam/Param/src/Numerical/MatrixConverter.h | d29ea73715edfa538dbd8d99502cf9da2bd017ef | []
| no_license | feengg/Parameterization | 40f71bedd1adc7d2ccbbc45cc0c3bf0e1d0b1103 | f8d2f26ff83d6f53ac8a6abb4c38d9b59db1d507 | refs/heads/master | 2020-03-23T05:18:25.675256 | 2011-01-21T15:19:08 | 2011-01-21T15:19:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 728 | h | #ifndef MATRIX_CONVERTER_2_H
#define MATRIX_CONVERTER_2_H
#include "MeshSparseMatrix.h"
#include "matrix.h"
#ifdef WIN32
#include <hj_3rd/hjlib/sparse_old/sparse.h>
#else
#include <hj_3rd/hjlib/sparse/sparse.h>
#endif
using namespace zjucad::matrix;
class CMatrixConverter
{
public:
CMatrixConverter();
~CMatrixConverter();
public:
static void CSparseMatrix2hjMatrix(matrix<double>& hjMatrix, CMeshSparseMatrix& csMatrix);
static void HjMatrix2CMatrix(matrix<double>& hjMatrix, CMatrix& cMatrix);
static void CSparseMatrix2hjCscMatrix(hj::sparse::spm_csc<double>& hjcscMatrix, CMeshSparseMatrix& cMatrix);
static void CMatrix2hjMatrix(matrix<double>& hjMatrix, CMatrix& cMatrix);
};
#endif
| [
"[email protected]"
]
| [
[
[
1,
27
]
]
]
|
f18f38c9a4f7a24c99b3f5503e192434816b2979 | 0e25e68e96c9883edcc85cbee6d24fdfd49cf8e5 | /source/BlockList.h | 0aa5bcbf18e67ad564f1c066200650567f2a672a | []
| no_license | dpembo/tetwiis | ff334a52ce2b41e79790c37fbe6630d26b1eb2b7 | 207692026d767b1a3aa9909ba9c6297cfd78fae0 | refs/heads/master | 2021-08-17T10:36:38.264831 | 2011-08-03T11:25:21 | 2011-08-03T11:25:21 | 32,199,080 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 945 | h | /**
*
* Tetwiis
* (C)2009 http://www.pembo.co.uk
*
**/
//------------------------------------------------------------------------------
// Headers
//------------------------------------------------------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <gccore.h>
#include <mxml.h>
#include "Block.h"
#include "Point.h"
#include "Offset.h"
#include <vector>
#include "mtrand.h"
#ifndef BLOCKLIST_HPP
#define BLOCKLIST_HPP
class BlockList
{
public:
BlockList();
~BlockList();
std::vector<int> nextBlocks;
void initialiseQueue();
int nextQueueItem();
void drawBlocks();
int holdBlock(int blockType);
Block* block1;
Block* block2;
Block* block3;
Block* block4;
Block* block5;
Block* block6;
Block* heldBlock;
int heldBlockType;
private:
MTRand_int32 mtRand;
int randomNumber();
};
#endif
| [
"[email protected]@d3020fdf-8559-019b-6164-6b32d0407fe0"
]
| [
[
[
1,
60
]
]
]
|
e108ce911d2c82d8e653631885a6eb80294db618 | 823afcea9ac0705f6262ccffdff65d687822fe93 | /RayTracing/Src/OGLRenderSystem.cpp | 254e42fe80115a00470735f0115a6a9f0a2d9226 | []
| no_license | shourav9884/raytracing99999 | 02b405759edf7eb5021496f87af8fa8157e972be | 19c5e3a236dc1356f6b4ec38efcc05827acb9e04 | refs/heads/master | 2016-09-10T03:30:54.820034 | 2006-10-15T21:49:19 | 2006-10-15T21:49:19 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 11,203 | cpp |
#include "OGLRenderSystem.h"
#include "ColorRGBf.h"
#include "ColorRGBAf.h"
#include "CoCBorderSet.h"
#include "glut.h"
#include <cstdlib> // Devido ao NULL
#include <cstdio>
OGLRenderSystem *OGLRenderSystem::singleton;
OGLRenderSystem::OGLRenderSystem()
: width(300),
height(300),
xScale(1.0),
yScale(1.0),
SBTextureSize(32)
{
}
void OGLRenderSystem::init( int aWidth, int aHeight )
{
// Inicializa atributos
this->width = aWidth;
this->height = aHeight;
// Inicializa OpenGL
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity( );
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClearAccum(0.0f, 0.0f, 0.0f, 0.0f);
glMatrixMode( GL_PROJECTION );
glLoadIdentity( );
// Reshape de canvas
glMatrixMode( GL_PROJECTION );
glLoadIdentity( );
glOrtho( 0.0, aWidth, aHeight, 0.0, 1.0, -1.0);
glRasterPos2i(0,aHeight);
// Cria texturas que serão utilizadas para os efeitos de pos-processamento
glGenTextures(2, this->posProcTexIDs);
glBindTexture(GL_TEXTURE_2D, this->posProcTexIDs[0]);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
// Inicializa a textura que será utilizada para fazer o efeito de Specular Bloom
//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, this->width, this->height, 0, GL_RGB, GL_FLOAT, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, this->SBTextureSize, this->SBTextureSize, 0, GL_RGB, GL_FLOAT, NULL);
glBindTexture(GL_TEXTURE_2D, this->posProcTexIDs[1]);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
// Inicializa a textura que será utilizada para fazer o efeito de Specular Bloom
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this->width, this->height, 0, GL_RGBA, GL_FLOAT, NULL);
}
OGLRenderSystem *OGLRenderSystem::getSingletonPtr( )
{
if( singleton != NULL )
{
return OGLRenderSystem::singleton ;
}
else
{
singleton = new OGLRenderSystem( );
return OGLRenderSystem::singleton;
}
}
OGLRenderSystem &OGLRenderSystem::getSingleton( )
{
if( singleton != NULL )
return *OGLRenderSystem::singleton ;
else
{
singleton = new OGLRenderSystem( );
return *OGLRenderSystem::singleton;
}
}
// ----------------
// |(0,0) |(width,0)
// | |
// | |
// | |
// | |
// y |(0,Height) |(width,height)
// | ----------------
// - x
void OGLRenderSystem::drawPixels( void *aData )
{
glClear( GL_COLOR_BUFFER_BIT );
// Reseta cursor para o inicio da tela
glRasterPos2i(0,this->height);
// Desenha pixels
glDrawPixels( this->width, this->height, GL_RGB, GL_FLOAT, aData );
glFlush(); // Garante que a operacao de pintar seja completada
}
void OGLRenderSystem::reshapeCanvas( int aWidth, int aHeight )
{
float xFactor = aWidth/(float)this->width;
float yFactor = aHeight/(float)this->height;
glPixelZoom( xFactor, yFactor );
}
void OGLRenderSystem::drawPixelsOverBufferSB( void *aData, bool aFullScreen, float aMaxSpreadFactor, float aIntensity, int aSamples )
{
// glClear( GL_ACCUM_BUFFER_BIT );
// glAccum(GL_ACCUM, 1.0);
const GLubyte *temp = glGetString(GL_VENDOR);
temp = glGetString(GL_RENDERER);
temp = glGetString(GL_EXTENSIONS);
temp = glGetString(GL_VERSION);
GLint tempInt = -10;
glGetIntegerv(GL_RED_BITS, &tempInt);
glGetIntegerv(GL_STENCIL_BITS, &tempInt);
glGetIntegerv(GL_ALPHA_BITS, &tempInt);
glGetIntegerv(GL_ACCUM_BLUE_BITS, &tempInt);
int leftVertexsOffset = 0;
if( !aFullScreen )
{
leftVertexsOffset = this->width/2;
}
// int specularBloomSamples = 11;
// float maxSpreadFactor = 0.05;
// float specularBloomIntensity = 2.0;
glBindTexture(GL_TEXTURE_2D, this->posProcTexIDs[0]);
// Habilita a texturiazacao
glEnable( GL_TEXTURE_2D );
// Habilita blending do poligo com o frame-buffer
glEnable( GL_BLEND );
// Faz com que a cor da textura substitua a cor do objeto (não faz blending)
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
float tempSpecularBloomFactor = ((float)aIntensity/(aSamples*aSamples));
ColorRGBf *tempImageDataPointer = reinterpret_cast<ColorRGBf *>(aData);
for( int i = 0; i < (this->width*this->height); i++ )
{
tempImageDataPointer[i] = tempImageDataPointer[i] * tempSpecularBloomFactor;
}
gluScaleImage(GL_RGB,this->width,this->height,GL_FLOAT,aData,this->SBTextureSize,this->SBTextureSize,GL_FLOAT, aData);
//glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, this->width, this->height, GL_RGB, GL_FLOAT, aData);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, this->SBTextureSize, this->SBTextureSize, GL_RGB, GL_FLOAT, aData);
//glBlendFunc( GL_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA );
glBlendFunc( GL_ONE, GL_ONE );
//glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_COLOR );
// Quando a coordenada da textura deve mudar a cada camanda desenhada
float textureUVOffset = (2*aMaxSpreadFactor)/(aSamples-1);
for( int x = 0; x < aSamples; x++ )
{
for( int y = 0; y < aSamples; y++ )
{
// Limpa o color buffer para desenhar uma nova camanda nele
//glClear( GL_COLOR_BUFFER_BIT );
if( pow((double)aMaxSpreadFactor-(textureUVOffset*x),2.0) + pow((double)aMaxSpreadFactor-(textureUVOffset*y),2.0) < pow((double)aMaxSpreadFactor,2.0))
{
// Desenha camada (cada camada é um plano colado com plano de projeção)
glBegin( GL_QUADS );
glTexCoord2d( (0+aMaxSpreadFactor)-(textureUVOffset*x) + (double)leftVertexsOffset/this->width, (1+aMaxSpreadFactor)-(textureUVOffset*y));
glVertex2f( 0 + leftVertexsOffset, 0 );
glTexCoord2d( (1+aMaxSpreadFactor)-(textureUVOffset*x), (1+aMaxSpreadFactor)-(textureUVOffset*y));
glVertex2f( this->width, 0 );
glTexCoord2d( (1+aMaxSpreadFactor)-(textureUVOffset*x), (0+aMaxSpreadFactor)-(textureUVOffset*y) );
glVertex2f( this->width, this->height );
glTexCoord2d( (0+aMaxSpreadFactor)-(textureUVOffset*x) + (double)leftVertexsOffset/this->width, (0+aMaxSpreadFactor)-(textureUVOffset*y) );
glVertex2f( 0 + leftVertexsOffset, this->height );
glEnd();
}
// Adiciona camada ao accumulation buffer
//glAccum(GL_ACCUM, specularBloomIntensity/(specularBloomSamples*specularBloomSamples));
}
}
// Retorna imagem final que estava armazenada no accumulatio buffer para o color buffer
//glAccum (GL_RETURN, 1.0);
glFlush();
}
void OGLRenderSystem::drawPixelsOverBufferDoF( FrameBuffer *aFrameBuffer, bool aFullScreen, float aFocusPlaneDistance )
{
glClear(GL_COLOR_BUFFER_BIT);
int leftVertexsOffset = 0;
if( aFullScreen )
{
leftVertexsOffset = this->width/2;
}
// Habilita alpha teste que será utilizado para saber se um pixel pertence a um CoC
glEnable(GL_ALPHA_TEST);
// Habilita texturizacao
glEnable( GL_TEXTURE_2D );
// Habilita blending do poligo com o frame-buffer
glEnable( GL_BLEND );
// Faz com que a cor da textura substitua a cor do objeto (não faz blending)
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
// Ativa a seguna textura criada na inicializacao
glBindTexture(GL_TEXTURE_2D, this->posProcTexIDs[1]);
ColorRGBf *tempImageDataPointer = reinterpret_cast<ColorRGBf *>(aFrameBuffer->colorBuffer);
ColorRGBAf *tempImageDataPointerFinal = new ColorRGBAf[this->width*this->height];
float E = 10.0;
static float df = 5.0;
//df += 0.01;
float dr = 1.0;
float f = 1.0/(1.0/df + 1.0/dr);
float Vf = (f*df)/(df-f);
float maxCoCDiameter = (Vf/(f*f/E)) - (E);
for( int i = 0; i < (this->width*this->height); i++ )
{
//float d = aFrameBuffer->zBuffer[i];
float d = 20;
float Vd = (f*d)/(d-f);
//float CoCDiameter = abs(a*(s*(1.0/f - 1.0/depth) - 1.0));
//float CoCDiameter = (abs(Vd - Vf) * E/Vd)*1.0;
float CoCDiameter = (Vf - Vd) * E/Vd;
// [0.5,1.0] pixel está atras do plano de foco
// [0.5,0.0] pixel está na frente do plano de foco
float CoCDiameterMapped = (CoCDiameter/maxCoCDiameter)/2 + 0.5;
//tempImageDataPointerFinal[i] = ColorRGBAf( tempImageDataPointer[i] * (1 - (abs(CoCDiameterMapped-0.5)*2))*0.1, CoCDiameterMapped );
tempImageDataPointerFinal[i] = ColorRGBAf( tempImageDataPointer[i] * 0.1, CoCDiameterMapped );
//printf("CoC = %f\n", CoCDiameter);
}
// Atualiza textura
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, this->width, this->height, GL_RGBA, GL_FLOAT, tempImageDataPointerFinal);
int directionFactor = 1;
CoCBorderSet tempCoCBorderSet;
for( int CoCSize = 2; CoCSize < 3; CoCSize -= directionFactor )
//for( int CoCSize = 0; CoCSize < 3; CoCSize++ )
{
// A borda de um CoC de tamanho CoCSize
CoCBorder tempCoCBorder = tempCoCBorderSet.getCoCBorder( CoCSize );
if(directionFactor == 1)
{
glAlphaFunc(GL_GEQUAL, (CoCSize/maxCoCDiameter)/2 + 0.5);
//glBlendFunc( GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA );
}
else
{
glAlphaFunc(GL_LEQUAL, (CoCSize/maxCoCDiameter)/2 + 0.5);
//glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
// Função de blending
glBlendFunc( GL_ONE, GL_ONE );
// Varre todos os pixels da borda do CoC anterior
for( PixelPosition *CoCPixel = tempCoCBorder.next(); CoCPixel != NULL; CoCPixel = tempCoCBorder.next() )
{
// Quanto a coordenada da textura deve mudar a cada camanda desenhada
float UOffset = 2* static_cast<float>(CoCPixel->x)/this->width;
float VOffset = 2* static_cast<float>(CoCPixel->y)/this->height;
// Desenha camada (cada camada é um plano colado com plano de projeção)
glBegin( GL_QUADS );
glTexCoord2d( 0 + UOffset + (double)leftVertexsOffset/this->width, 1 + VOffset);
glVertex2f( 0 + leftVertexsOffset, 0 );
glTexCoord2d( 1 + UOffset, 1 + VOffset );
glVertex2f( this->width, 0 );
glTexCoord2d( 1 + UOffset, 0 + VOffset );
glVertex2f( this->width, this->height );
glTexCoord2d( 0 + UOffset + (double)leftVertexsOffset/this->width, 0 + VOffset );
glVertex2f( 0 + leftVertexsOffset, this->height );
glEnd();
}
// Se ja fez todos os CoC que estão atras do plano de foco entao faz agora os CoC que estão a frente
if( CoCSize == 0 )
{
directionFactor = -1;
break;
}
}
glFlush();
glDisable(GL_ALPHA_TEST);
}
void OGLRenderSystem::setSBTextureResolution( int aSBTextureSize )
{
this->SBTextureSize = aSBTextureSize;
} | [
"saulopessoa@34b68867-b01b-0410-ab61-0f167d00cb52"
]
| [
[
[
1,
344
]
]
]
|
12f3e331d887d302259beaaf70972568bd81e3b7 | 94c1c7459eb5b2826e81ad2750019939f334afc8 | /source/Sysface.cpp | 6e69ac38eb3c3d4151563f5f2501998b71d028f5 | []
| no_license | wgwang/yinhustock | 1c57275b4bca093e344a430eeef59386e7439d15 | 382ed2c324a0a657ddef269ebfcd84634bd03c3a | refs/heads/master | 2021-01-15T17:07:15.833611 | 2010-11-27T07:06:40 | 2010-11-27T07:06:40 | 37,531,026 | 1 | 3 | null | null | null | null | GB18030 | C++ | false | false | 12,955 | cpp | // Sysface.cpp : implementation file
//
#include "stdafx.h"
#include "CTaiShanApp.h"
#include "Sysface.h"
#include "CTaiShanDoc.h"
#include "MainFrm.h"
#define WM_SYSFACEITEMCHANGE (WM_USER+12345)
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE(CSYSFACE, CPropertyPage)
CSYSFACE::CSYSFACE() : CPropertyPage(CSYSFACE::IDD)
{
pDoc = CMainFrame::m_taiShanDoc;
}
CSYSFACE::~CSYSFACE()
{
}
void CSYSFACE::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSYSFACE)
DDX_Control(pDX, IDC_SETCOLOR, m_setcolor);
DDX_Control(pDX, IDC_SETFONT, m_setfont);
DDX_Control(pDX, IDC_COMBO1, m_sheetwgcom1);
DDX_Control(pDX, IDC_LIST1, m_sheetwglist1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSYSFACE, CPropertyPage)
//{{AFX_MSG_MAP(CSYSFACE)
ON_WM_PAINT()
ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
ON_BN_CLICKED(IDC_SETFONT, OnSetfont)
ON_BN_CLICKED(IDC_SETCOLOR, OnSetcolor)
ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1)
ON_WM_HELPINFO()
//}}AFX_MSG_MAP
ON_MESSAGE(WM_SYSFACEITEMCHANGE,OnSysfaceItemChange)
END_MESSAGE_MAP()
LRESULT CSYSFACE::OnSysfaceItemChange(WPARAM wParam,LPARAM lParam)
{
int nItem = (int)wParam;
cr[nItem]=~cr[nItem];
InvalidateRect(&m_rectsample);
return 0;
}
BOOL CSYSFACE::OnInitDialog() //子窗口框架
{
CPropertyPage::OnInitDialog();
iLastComItem=0;
CString liststring[systemcolorlength]={"背景","图形文字 ","坐标","阳线",
"阴线","美国线","趋势线","指标线1","指标线2",
"指标线3","指标线4","指标线5","指标线6",
"显示牌上涨字","显示牌平盘字","显示牌下跌字",
"显示牌高亮条","显示牌框线","显示牌背景","历史回忆背景"};
for (int i=0; i<20;i++)
{ m_sheetwglist1.AddString((LPCTSTR) liststring[i]);
}
m_sheetwglist1.SetCurSel(0);
CString combstring[comblength]={"自定义","红黑","白黑","蓝白","绿白",
"黑白","海蓝","青绿","浅灰"
};
for (int i=0;i<comblength;i++)
{
m_sheetwgcom1.AddString((LPCTSTR)combstring[i]);
}
m_sheetwgcom1.SetCurSel(0);
GetDlgItem(IDC_STATICYL)->GetWindowRect(&m_rectsample);
ScreenToClient(&m_rectsample);
m_rectsample.top+=8;
fontdefault=pDoc->m_fontdefault;
m_logfont=pDoc->m_fontdefault;
for(int i=0;i<systemcolorlength;i++)
cr[i]=pDoc->m_colorArray[i];
for(int i=0;i<fontstructlength;i++)
fr[i]=pDoc->m_fontstr[i];
return TRUE;
}
void CSYSFACE::OnPaint()
{
CPaintDC dc(this);
CBrush brush;
CBrush *poldbrush;
brush.CreateSolidBrush(cr[0]);
poldbrush=dc.SelectObject(&brush);
dc.FillRect(&m_rectsample,&brush);
dc.SelectObject(poldbrush);
brush.DeleteObject();
CPen pen;
CPen *poldpen;
pen.CreatePen(PS_SOLID,1,cr[2]);
poldpen=dc.SelectObject(&pen);
int m_rect_middle=(m_rectsample.left+m_rectsample.right)/2;
dc.MoveTo(m_rectsample.left+40,m_rectsample.top+5);
dc.LineTo(m_rectsample.left+40,m_rectsample.bottom-5);
dc.MoveTo(m_rectsample.left+35,m_rectsample.top+30);
dc.LineTo(m_rect_middle+50,m_rectsample.top+30);
dc.MoveTo(m_rectsample.left+35,m_rectsample.top+60);
dc.LineTo(m_rect_middle+50,m_rectsample.top+60);
dc.MoveTo(m_rectsample.left+35,m_rectsample.top+90);
dc.LineTo(m_rect_middle+50,m_rectsample.top+90);
dc.SelectObject(poldpen);
pen.DeleteObject();
CFont font;
CFont *ptrOldFont;
font.CreateFontIndirect(&fr[0]);
ptrOldFont=dc.SelectObject(&font);
COLORREF oldcolor;
oldcolor=dc.SetTextColor(cr[2]);
dc.SetBkMode(TRANSPARENT);
TEXTMETRIC tm;
dc.GetTextMetrics(&tm);
int y=m_rectsample.top+30-tm.tmHeight/2;
int x=m_rectsample.left+((30-tm.tmAveCharWidth*4)<0?0:30-tm.tmAveCharWidth*4);
dc.TextOut(x,y,"70.0");
dc.TextOut(x,y+30,"50.0");
dc.TextOut(x,y+60,"30.0");
oldcolor=dc.SetTextColor(cr[1]);
dc.TextOut(m_rectsample.left+80,m_rectsample.top+5,"1234.56");
dc.SelectObject(ptrOldFont);
font.DeleteObject();
CPen pennew;
pennew.CreatePen(PS_SOLID,1,cr[6]);
poldpen=dc.SelectObject(&pennew);
dc.MoveTo(m_rectsample.left+40,m_rectsample.bottom-20);
dc.LineTo(m_rectsample.left+m_rectsample.top+40,m_rectsample.top);
dc.SelectObject(poldpen);
pennew.DeleteObject();
int beep=(m_rect_middle-m_rectsample.left+10)/5;
int lx=m_rectsample.left+40;
int ly=m_rectsample.top+60;
for(int i=0;i<6;i++)
{
CPen pennow;
pennow.CreatePen(PS_SOLID,1,cr[7+i]);
poldpen=dc.SelectObject(&pennow);
dc.MoveTo(lx,ly+i*8);
dc.LineTo(lx+beep,ly+8+i*8);
dc.LineTo(lx+2*beep,ly-8+i*8);
dc.LineTo(lx+3*beep,ly+8+i*8);
dc.LineTo(lx+4*beep,ly-8+i*8);
dc.LineTo(lx+5*beep,ly+8+i*8);
dc.SelectObject(poldpen);
pennow.DeleteObject();
}
CPen penaline;
penaline.CreatePen(PS_SOLID,2,cr[5]);
poldpen=dc.SelectObject(&penaline);
dc.MoveTo(lx+10,ly-40);
dc.LineTo(lx+10,ly-10);
dc.MoveTo(lx+30,ly-35);
dc.LineTo(lx+30,ly-5);
dc.SelectObject(poldpen);
penaline.DeleteObject();
CPen penaline2;
penaline2.CreatePen(PS_SOLID,1,cr[5]);
poldpen=dc.SelectObject(&penaline2);
dc.MoveTo(lx+4,ly-35);
dc.LineTo(lx+10,ly-35);
dc.MoveTo(lx+10,ly-20);
dc.LineTo(lx+16,ly-20);
dc.MoveTo(lx+24,ly-25);
dc.LineTo(lx+30,ly-25);
dc.MoveTo(lx+30,ly-15);
dc.LineTo(lx+36,ly-15);
dc.SelectObject(poldpen);
penaline2.DeleteObject();
CBrush brushupline;
brushupline.CreateSolidBrush(cr[3]);
poldbrush=dc.SelectObject(&brushupline);
RECT upkline;
upkline.left=lx+120;
upkline.right=lx+130;
upkline.top=ly-35;
upkline.bottom=ly-5;
dc.FillRect(&upkline,&brushupline);
dc.SelectObject(poldbrush);
brushupline.DeleteObject();
CPen penupkline;
penupkline.CreatePen(PS_SOLID,1,cr[3]);
poldpen=dc.SelectObject(&penupkline);
dc.MoveTo(lx+125,ly-40);
dc.LineTo(lx+125,ly+5);
dc.SelectObject(poldpen);
penupkline.DeleteObject();
CBrush brushdownline;
brushdownline.CreateSolidBrush(cr[4]);
poldbrush=dc.SelectObject(&brushdownline);
RECT downkline;
downkline.left=lx+140;
downkline.right=lx+150;
downkline.top=ly-45;
downkline.bottom=ly-15;
dc.FillRect(&downkline,&brushdownline);
dc.SelectObject(poldbrush);
brushdownline.DeleteObject();
CPen pendownkline;
pendownkline.CreatePen(PS_SOLID,1,cr[4]);
poldpen=dc.SelectObject(&pendownkline);
dc.MoveTo(lx+145,ly-50);
dc.LineTo(lx+145,ly-5);
dc.SelectObject(poldpen);
pendownkline.DeleteObject();
CBrush brushshowbar;
brushshowbar.CreateSolidBrush(cr[18]);
poldbrush=dc.SelectObject(&brushshowbar);
RECT showbar;
showbar.left=m_rect_middle+50;
showbar.right=m_rectsample.right-7;
showbar.top=m_rectsample.top+5;
showbar.bottom=m_rectsample.top+105;
dc.FillRect(&showbar,&brushshowbar);
dc.SelectObject(poldbrush);
brushshowbar.DeleteObject();
CBrush brushshinebar;
brushshinebar.CreateSolidBrush(cr[16]);//子窗口框架
poldbrush=dc.SelectObject(&brushshinebar);
RECT shinebar;
shinebar.left=m_rect_middle+50;
shinebar.right=m_rectsample.right-7;
shinebar.top=m_rectsample.top+5;
shinebar.bottom=m_rectsample.top+25;
dc.FillRect(&shinebar,&brushshinebar);
dc.SelectObject(poldbrush);
brushshinebar.DeleteObject();
CBrush brushbackcolor;
brushbackcolor.CreateSolidBrush(cr[19]);
poldbrush=dc.SelectObject(&brushbackcolor);
RECT backcolorbar;
backcolorbar.left=m_rect_middle+50;
backcolorbar.right=m_rectsample.right-7;
backcolorbar.top=m_rectsample.top+25;
backcolorbar.bottom=m_rectsample.top+45;
dc.FillRect(&backcolorbar,&brushbackcolor);
dc.SelectObject(poldbrush);
brushbackcolor.DeleteObject();
CFont fdefault;
CFont *polddefault;
fdefault.CreateFontIndirect(&fontdefault);
polddefault=dc.SelectObject(&fdefault);
oldcolor=dc.SetTextColor(cr[13]);
dc.TextOut(m_rect_middle+55,m_rectsample.top+8,"上涨");
oldcolor=dc.SetTextColor(cr[14]);
dc.TextOut(m_rect_middle+102,m_rectsample.top+8,"平盘");
oldcolor=dc.SetTextColor(cr[15]);
dc.TextOut(m_rect_middle+148,m_rectsample.top+8,"下跌");
dc.SelectObject(polddefault);
fdefault.DeleteObject();
CFont fontrise;
CFont *priseold;
fontrise.CreateFontIndirect(&fr[1]);
priseold=dc.SelectObject(&fontrise);
oldcolor=dc.SetTextColor(cr[13]);
dc.TextOut(m_rect_middle+55,m_rectsample.top+27,"1234");
dc.TextOut(m_rect_middle+55,m_rectsample.top+47,"2345");
dc.TextOut(m_rect_middle+55,m_rectsample.top+67,"3456");
dc.TextOut(m_rect_middle+55,m_rectsample.top+87,"6789");
dc.SelectObject(priseold);
fontrise.DeleteObject();
CFont fontequal;
CFont *equalold;
fontequal.CreateFontIndirect(&fr[1]);
equalold=dc.SelectObject(&fontequal);
oldcolor=dc.SetTextColor(cr[14]);
dc.TextOut(m_rect_middle+102,m_rectsample.top+27,"1234");
dc.TextOut(m_rect_middle+102,m_rectsample.top+47,"2345");
dc.TextOut(m_rect_middle+102,m_rectsample.top+67,"3456");
dc.TextOut(m_rect_middle+102,m_rectsample.top+87,"6789");
dc.SelectObject(equalold);
fontequal.DeleteObject();
CFont fontdown;
CFont *downold;
fontdown.CreateFontIndirect(&fr[1]);//子窗口框架
downold=dc.SelectObject(&fontdown);
oldcolor=dc.SetTextColor(cr[15]);
dc.TextOut(m_rect_middle+149,m_rectsample.top+27,"1234");
dc.TextOut(m_rect_middle+149,m_rectsample.top+47,"2345");
dc.TextOut(m_rect_middle+149,m_rectsample.top+67,"3456");
dc.TextOut(m_rect_middle+149,m_rectsample.top+87,"6789");
dc.SelectObject(downold);
fontdown.DeleteObject();
CPen pentableline;
pentableline.CreatePen(PS_SOLID,1,cr[17]);
poldpen=dc.SelectObject(&pentableline);
for(int i=0;i<6;i++)
{
dc.MoveTo(m_rect_middle+50,m_rectsample.top+i*20+5);
dc.LineTo(m_rectsample.right-7,m_rectsample.top+i*20+5);
}
for(int i=0;i<5;i++)
{
dc.MoveTo(m_rect_middle+50+i*47,m_rectsample.top+5);
dc.LineTo(m_rect_middle+50+i*47,m_rectsample.top+105);
}
dc.SelectObject(poldpen);
pentableline.DeleteObject();
}
void CSYSFACE::OnSelchangeCombo1()
{
int index=m_sheetwgcom1.GetCurSel();
if(iLastComItem==0)
{
for(int i=0;i<systemcolorlength;i++)
crbak[i]=cr[i];
for(int i=0;i<fontstructlength;i++)
frbak[i]=fr[i];
}
if(index>0)
{
for(int i=0;i<systemcolorlength;i++)
cr[i]=pDoc->m_colorArrayDefault[index-1][i];//子窗口框架
for(int i=0;i<2;i++)
fr[i]=pDoc->m_fontstr[i];
InvalidateRect(&m_rectsample);
UpdateWindow();
}
else if(index==0)
{
for(int i=0;i<systemcolorlength;i++)
cr[i]=crbak[i];
for(int i=0;i<fontstructlength;i++)
fr[i]=frbak[i];
InvalidateRect(&m_rectsample);
UpdateWindow();
}
iLastComItem=index;
}
void CSYSFACE::OnSetfont()
{
LOGFONT fFontDefault;
switch(m_sheetwglist1.GetCurSel())
{
case 1:
fFontDefault=fr[0];
break;
case 13:
fFontDefault=fr[1];
break;
}
CFontDialog m_fontdia(&fFontDefault);
if(m_fontdia.DoModal())
{
switch(m_sheetwglist1.GetCurSel())
{
case 1:
m_fontdia.GetCurrentFont(&fr[0]);
InvalidateRect(&m_rectsample);
UpdateWindow();
break;
case 13:
m_fontdia.GetCurrentFont(&fr[1]);
InvalidateRect(&m_rectsample);
UpdateWindow();
break;
}
}
}
void CSYSFACE::OnSetcolor()
{
CColorDialog m_colordia(cr[m_sheetwglist1.GetCurSel()],CC_RGBINIT,this);
if(m_colordia.DoModal())
{
cr[m_sheetwglist1.GetCurSel()]=m_colordia.GetColor();
InvalidateRect(&m_rectsample);
UpdateWindow();
}
}
void CSYSFACE::OnSelchangeList1()
{
int curselnum;
curselnum=m_sheetwglist1.GetCurSel();
switch(curselnum)
{
case 1:
case 13:
if(!m_setfont.IsWindowEnabled())
{
m_setfont.EnableWindow(true);
}
break;
default:
if(m_setfont.IsWindowEnabled())
m_setfont.EnableWindow(false);
}
PSYSFACESTRUCT pSf = new SYSFACESTRUCT;
pSf->hWnd=m_hWnd;
pSf->nItem=curselnum;
}
UINT SysfacePreviewThread(LPVOID pParam)
{
PSYSFACESTRUCT pSf=(PSYSFACESTRUCT)pParam;
::SendMessage(pSf->hWnd,WM_SYSFACEITEMCHANGE,pSf->nItem,0);
Sleep(500);
SendMessage(pSf->hWnd,WM_SYSFACEITEMCHANGE,pSf->nItem,0);
Sleep(500);
SendMessage(pSf->hWnd,WM_SYSFACEITEMCHANGE,pSf->nItem,0);
Sleep(500);
SendMessage(pSf->hWnd,WM_SYSFACEITEMCHANGE,pSf->nItem,0);
delete pSf;
return 0;
}
BOOL CSYSFACE::OnHelpInfo(HELPINFO* pHelpInfo)
{
DoHtmlHelp(this);return TRUE;
}
| [
"[email protected]"
]
| [
[
[
1,
496
]
]
]
|
c33e27afa87e16bbbd4cb0d7b1b1fd5447747499 | 9eb4d50f6f499d091c036b5745dd17173693b8bf | /src/wii/wii_vb.cpp | bff9b8e8a60d71c5bfd08f5251996d63e6829fd6 | []
| no_license | MathewWi/wiirtual-boy | 53efab60de238134c43e00502186c1cfe39245ec | 4f4a2b75a721e42e036a91956ca32a549ec0a8ff | refs/heads/master | 2021-01-01T17:00:37.708274 | 2011-06-27T15:22:53 | 2011-06-27T15:22:53 | 32,204,974 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,910 | cpp | /*
WiirtualBoy : Wii port of the Mednafen Virtual Boy emulator
Copyright (C) 2011
raz0red and Arikado
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include "wii_app.h"
#include "wii_config.h"
#include "wii_input.h"
#include "wii_sdl.h"
#include "wii_vb.h"
#include "wii_vb_main.h"
#include "wii_vb_menu.h"
#include "FreeTypeGX.h"
#include "font_ttf.h"
extern "C" {
void WII_VideoStop();
}
// The last cartridge hash
char wii_cartridge_hash[33];
// The cartridge hash with header (may be the same)
char wii_cartridge_hash_with_header[33];
// The database entry for current game
VbDbEntry wii_vb_db_entry;
// Whether to display debug info (FPS, etc.)
BOOL wii_debug = FALSE;
// Auto save state?
BOOL wii_auto_save_state = FALSE;
// Auto load state?
BOOL wii_auto_load_state = TRUE;
// The screen X size
int wii_screen_x = DEFAULT_SCREEN_X;
// The screen Y size
int wii_screen_y = DEFAULT_SCREEN_Y;
// The curent controller (for mapping buttons, etc.)
int wii_current_controller = 0;
// The custom anaglyph colors
RGBA wii_custom_colors[2];
// Whether parallax is enabled
BOOL wii_custom_colors_parallax = TRUE;
// Patch ROM
BOOL wii_patch_rom = TRUE;
// Whether the current rom is patched
BOOL wii_current_rom_patched = FALSE;
#define CUSTOM_MODE_KEY "custom"
// The list of available 3d modes
Vb3dMode wii_vb_modes[] =
{
{ "red_black", "(2d) Red/black", 0xFF0000, 0x000000, false },
{ "white_black", "(2d) White/black", 0xFFFFFF, 0x000000, false },
{ "red_blue", "(3d) Red/blue", 0xFF0000, 0x0000FF, true },
{ "red_cyan", "(3d) Red/cyan", 0xFF0000, 0x00B7EB, true },
{ "red_ecyan", "(3d) Red/electric cyan", 0xFF0000, 0x00FFFF, true },
{ "red_green", "(3d) Red/green", 0xFF0000, 0x00FF00, true },
{ "green_red", "(3d) Green/red", 0x00FF00, 0xFF0000, true },
{ "yellow_blue", "(3d) Yellow/blue", 0xFFFF00, 0x0000FF, true },
{ CUSTOM_MODE_KEY, "(custom)", 0x0, 0x0, true }
};
int wii_vb_mode_count = sizeof( wii_vb_modes ) / sizeof( Vb3dMode );
// The current 3d mode
char wii_vb_mode_key[255] = DEFAULT_VB_MODE_KEY;
/*
* Whether custom colors are available
*
* return Whether custom colors are available
*/
BOOL wii_has_custom_colors()
{
return
Util_rgbatovalue( &wii_custom_colors[0], FALSE ) != 0 ||
Util_rgbatovalue( &wii_custom_colors[1], FALSE ) != 0;
}
/*
* Whether the specified mode is the custom mode
*
* mode The mode
* return Whether the mode is the custom mode
*/
extern BOOL wii_is_custom_mode( const Vb3dMode* mode )
{
return !strcmp( mode->key, CUSTOM_MODE_KEY );
}
/*
* Returns the index of the specified 3d mode key
*
* key The 3d mode key
* return The index of the 3d mode (or -1 if not found)
*/
int wii_get_vb_mode_index( const char* key )
{
for( int i = 0; i < wii_vb_mode_count; i++ )
{
Vb3dMode mode = wii_vb_modes[i];
if( !strcmp( mode.key, key ) )
{
return i;
}
}
return -1;
}
/*
* Returns the current 3d mode index
*
* return The current 3d mode index
*/
int wii_get_vb_mode_index()
{
int index = wii_get_vb_mode_index( wii_vb_mode_key );
if( index == -1 )
{
index = wii_get_vb_mode_index( DEFAULT_VB_MODE_KEY );
}
return index;
}
/*
* Returns the current 3d mode
*
* return The current 3d mode
*/
Vb3dMode wii_get_vb_mode()
{
return wii_vb_modes[wii_get_vb_mode_index()];
}
/*
* Returns the render rate
*
* return The render rate (or -1 if we are rendering at 100%)
*/
int wii_get_render_rate()
{
return
wii_vb_db_entry.frameSkip &&
( wii_vb_db_entry.renderRate >= MIN_RENDER_RATE &&
wii_vb_db_entry.renderRate <= MAX_RENDER_RATE ) ?
wii_vb_db_entry.renderRate : - 1;
}
/*
* Initializes the application
*/
void wii_handle_init()
{
// Initialize the custom colors
memset( wii_custom_colors, sizeof( wii_custom_colors ), 0x0 );
// Read the config values
wii_read_config();
// Reset color choice if custom is selected and it shouldn't be allowed
Vb3dMode mode = wii_get_vb_mode();
if( wii_is_custom_mode( &mode ) && !wii_has_custom_colors() )
{
strcpy( wii_vb_mode_key, DEFAULT_VB_MODE_KEY );
}
// Startup the SDL
if( !wii_sdl_init() )
{
fprintf( stderr, "FAILED : Unable to init SDL: %s\n", SDL_GetError() );
exit( EXIT_FAILURE );
}
// FreeTypeGX
InitFreeType( (uint8_t*)font_ttf, (FT_Long)font_ttf_size );
// Initializes the menu
wii_vb_menu_init();
// Initializes emulator
wii_vb_init();
}
/*
* Frees resources prior to the application exiting
*/
void wii_handle_free_resources()
{
// We be done, write the config settings, free resources and exit
wii_write_config();
// Free resources from the emulator
wii_vb_free();
wii_sdl_free_resources();
SDL_Quit();
}
/*
* Runs the application (main loop)
*/
void wii_handle_run()
{
WII_VideoStop();
// Show the menu
wii_menu_show();
}
// The roms dir
static char roms_dir[WII_MAX_PATH] = "";
/*
* Returns the roms directory
*
* return The roms directory
*/
char* wii_get_roms_dir()
{
if( roms_dir[0] == '\0' )
{
snprintf(
roms_dir, WII_MAX_PATH, "%s%s", wii_get_fs_prefix(), WII_ROMS_DIR );
}
return roms_dir;
}
// The saves dir
static char saves_dir[WII_MAX_PATH] = "";
/*
* Returns the saves directory
*
* return The saves directory
*/
char* wii_get_saves_dir()
{
if( saves_dir[0] == '\0' )
{
snprintf(
saves_dir, WII_MAX_PATH, "%s%s", wii_get_fs_prefix(), WII_SAVES_DIR );
}
return saves_dir;
}
// The base dir
static char base_dir[WII_MAX_PATH] = "";
/*
* Returns the base directory
*
* return The bae directory
*/
char* wii_get_base_dir()
{
if( base_dir[0] == '\0' )
{
snprintf(
base_dir, WII_MAX_PATH, "%s%s", wii_get_fs_prefix(), WII_FILES_DIR );
base_dir[strlen(base_dir)-1]='\0'; // Remove the trailing slash
}
return base_dir;
}
| [
"[email protected]@00a74ce0-9458-8d50-ee98-3d1c5c732d48"
]
| [
[
[
1,
293
]
]
]
|
4fc872d68b39fc8dd109b3d867af369331bba9f9 | f71e82b7ed19200280b7164a2e959310d9bfa210 | /ExampleAIModule/ExampleAIModule/GrupoAntiaereo.h | 8915b6c7d915843bbc4eb0fd933362e1861ef7c9 | []
| no_license | albertouri/manolobot | 05cf4ee217e85f1332e0e063fcc209da4b71c7b5 | 44e7fee46abcf4f1efa6d292ea8ec7cdc57eb7c8 | refs/heads/master | 2021-01-02T08:32:48.281836 | 2011-02-03T23:28:08 | 2011-02-03T23:28:08 | 39,591,406 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,109 | h | #pragma once
#include <BWAPI.h>
#include <BWTA.h>
#include "Utilidades.h"
#include "AnalizadorTerreno.h"
#include "Graficos.h"
using namespace BWAPI;
using namespace BWTA;
class GrupoAntiaereo
{
public:
// la region pasada como parametro es la region a defender
GrupoAntiaereo(Region *r);
~GrupoAntiaereo(void);
void onFrame();
bool faltanMisileTurrets();
void agregarUnidad(Unit *u);
// devuelve el tilePosition donde debera ubicarse el proximo misileTurret (borrar el objeto retornado por
// este metodo despues de utilizarlo)
TilePosition* getPosicionMisileTurret();
int cantMaximaTurrets();
void onUnitShow(Unit *u);
private:
int cantidadNecesariaTurrets;
Unit *objetivoActual;
static const int IZQUIERDA = 0;
static const int DERECHA = 1;
static const int ARRIBA = 2;
static const int ABAJO = 3;
std::list<std::pair<TilePosition*, Unit*>> listMisileTurrets;
bool puedoConstruir(TilePosition t, UnitType tipo);
TilePosition *encontrarPosicion(int orientacion, Position posCentral);
int getCantMisileTurrets();
};
| [
"marianomoreno3@82b963ee-1e64-6eb5-a9c5-6632919fd137"
]
| [
[
[
1,
50
]
]
]
|
6d1a1ab56071a9e239eed9e4a8cbf325af84c0dd | e806f8c3e255de9db42c39e09f27c1fc8727437a | /Main.cpp | d99255ed68fff1f23a959879995833dc0d142158 | []
| no_license | gitpan/mojprogram | 44f4844cb1fcf0fe3d35aa7e9ead6b56e20f12ef | aa031a46890908734cde1a600bd5c2539b29bd1f | refs/heads/master | 2020-09-12T14:01:31.767804 | 2003-05-17T13:31:35 | 2014-10-26T18:24:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,984 | cpp |
#include <iostream.h>
#include <fstream.h>
#include "ABook.h"
#include "Contact.h"
#include "CGroup.h"
class UserInterface {
public:
static UserInterface* Instance ();
~UserInterface () { delete myABook; }
void run ();
enum Status { ERR, OK, RET };
protected:
UserInterface () : myABook(AddressBook::create()), myIs(cin), myOs(cout) {}
Status mainMenu ();
// Options of the main menu:
Status optEnterContact ();
Status optEnterCGroup ();
Status optPrintEntries ();
Status optSearchEntry ();
Status optRemoveEntry ();
Status optPrintEmails ();
Status optLoad ();
Status optSave ();
// Helper functions:
void writeMainMenu ();
ABItem* inputEntry ();
string inputFileName ();
private:
istream& myIs;
ostream& myOs;
AddressBook* myABook;
};
UserInterface* UserInterface::Instance () {
static UserInterface instance;
return &instance;
}
void UserInterface::run () {
Status ret = OK;
while (ret!=RET) {
ret = mainMenu();
if (ret==ERR) myOs<< "\nError!\n\n";
}
}
void UserInterface::writeMainMenu () {
myOs<< "\n\nAddress Book Example\n\n";
myOs<< "Main menu:\n\n";
myOs<< "[1] Exit\n";
myOs<< "[2] Print Entries\n";
myOs<< "[3] Search Entry\n";
myOs<< "[4] Remove Entry\n";
myOs<< "[5] Add Contact\n";
myOs<< "[6] Add Contact Group\n";
myOs<< "[7] Print Email(s)\n";
myOs<< "[8] Save address book to a file\n";
myOs<< "[9] Load address book from a file\n";
myOs<< "\nSelect an option 1-9: ";
}
UserInterface::Status UserInterface::mainMenu () {
int opt = 0;
do {
writeMainMenu();
myIs>>opt;
myIs.ignore(1000,'\n'); // Clear the '\n' character from cin
} while (opt<1 || opt>9);
switch (opt) {
case 1: return RET;
case 2: return optPrintEntries();
case 3: return optSearchEntry();
case 4: return optRemoveEntry();
case 5: return optEnterContact();
case 6: return optEnterCGroup();
case 7: return optPrintEmails();
case 8: return optSave();
case 9: return optLoad();
default: return ERR;
}
}
UserInterface::Status UserInterface::optEnterContact () {
myOs<< "Option Enter Contact:\n";
Contact* newCont = Contact::create();
if (newCont==0 || myABook==0) return ERR;
myABook->addItem(newCont);
myOs<< "Enter Contact data in the following format:\n firstName\n lastName\n email\n phoneNumber\n>\n";
myIs>> *newCont;
return OK;
}
UserInterface::Status UserInterface::optEnterCGroup () {
myOs<< "Option Enter Contact Group:\n";
if (myABook==0) return ERR;
ContactGroup* newCont = ContactGroup::create(myABook);
if (newCont==0) return ERR;
myABook->addItem(newCont);
myOs<< "Enter Contact Group data in the following format:";
myOs<< "\n {\n groupName\n elementName\n elementName\n ...\n }\n>\n";
myIs>> *newCont;
return OK;
}
UserInterface::Status UserInterface::optPrintEntries () {
myOs<< "Option Print Entries:\n";
if (myABook==0) return ERR;
myABook->write(myOs);
return OK;
}
ABItem* UserInterface::inputEntry () {
myOs<< "Enter entry name: ";
static const int MAXLEN=100;
char buff[MAXLEN];
myIs.getline(buff,MAXLEN);
string name=buff;
if (myABook==0) return 0;
ABItem* item = myABook->getItem(name);
if (item==0) myOs<< "Entry \"" << name << "\" not found.\n";
return item;
}
UserInterface::Status UserInterface::optSearchEntry () {
myOs<< "Option Search Entry:\n";
ABItem* item = inputEntry();
if (item!=0) myOs<< *item;
return OK;
}
UserInterface::Status UserInterface::optRemoveEntry () {
myOs<< "Option Remove Entry:\n";
ABItem* item = inputEntry();
if (item && myABook) myABook->removeItem(item);
return OK;
}
UserInterface::Status UserInterface::optPrintEmails () {
myOs<< "Option Print Email(s):\n";
ABItem* item = inputEntry();
if (item!=0) item->writeEmail(myOs);
myOs<<"\n";
return OK;
}
string UserInterface::inputFileName () {
myOs<< "Enter filename: ";
static const int MAXLEN=100;
char buff[MAXLEN];
myIs.getline(buff,MAXLEN);
return buff;
}
UserInterface::Status UserInterface::optSave () {
myOs<< "Option Save current address book to a file:\n";
string fname = inputFileName();
ofstream file(fname);
if (file.bad()) return ERR;
if (myABook) myABook->write(file);
if (file.bad()) return ERR;
return OK;
}
UserInterface::Status UserInterface::optLoad () {
myOs<< "Option Load current address book from a file:\n";
string fname = inputFileName();
ifstream file(fname);
if (file.bad()) return ERR;
delete myABook;
myABook = AddressBook::create();
if (myABook==0) return ERR;
myABook->read(file);
if (file.bad()) return ERR;
return OK;
}
void main () {
UserInterface::Instance()->run();
}
| [
"[email protected]"
]
| [
[
[
1,
223
]
]
]
|
878694d1710356e3f5313faca14ad822cde6f9a2 | c2153dcfa8bcf5b6d7f187e5a337b904ad9f91ac | /depends/ClanLib/src/Core/Text/console_logger.cpp | d767c64300a306a7329f92d5023512c5bfe68cfd | []
| no_license | ptrefall/smn6200fluidmechanics | 841541a26023f72aa53d214fe4787ed7f5db88e1 | 77e5f919982116a6cdee59f58ca929313dfbb3f7 | refs/heads/master | 2020-08-09T17:03:59.726027 | 2011-01-13T22:39:03 | 2011-01-13T22:39:03 | 32,448,422 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,299 | cpp | /*
** ClanLib SDK
** Copyright (c) 1997-2010 The ClanLib Team
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any damages
** arising from the use of this software.
**
** Permission is granted to anyone to use this software for any purpose,
** including commercial applications, and to alter it and redistribute it
** freely, subject to the following restrictions:
**
** 1. The origin of this software must not be misrepresented; you must not
** claim that you wrote the original software. If you use this software
** in a product, an acknowledgment in the product documentation would be
** appreciated but is not required.
** 2. Altered source versions must be plainly marked as such, and must not be
** misrepresented as being the original software.
** 3. This notice may not be removed or altered from any source distribution.
**
** Note: Some of the libraries ClanLib may link to may have additional
** requirements or restrictions.
**
** File Author(s):
**
** Magnus Norddahl
*/
#include "precomp.h"
#include "API/Core/Text/console_logger.h"
#include "API/Core/IOData/file.h"
#include "API/Core/Text/string_help.h"
#include "API/Core/Text/string_format.h"
#include "API/Core/System/datetime.h"
/////////////////////////////////////////////////////////////////////////////
// CL_ConsoleLogger Construction:
CL_ConsoleLogger::CL_ConsoleLogger()
{
#ifdef WIN32
AllocConsole();
#endif
}
CL_ConsoleLogger::~CL_ConsoleLogger()
{
}
/////////////////////////////////////////////////////////////////////////////
// CL_ConsoleLogger Attributes:
/////////////////////////////////////////////////////////////////////////////
// CL_ConsoleLogger Operations:
void CL_ConsoleLogger::log(const CL_StringRef &type, const CL_StringRef &text)
{
CL_StringRef months[] =
{
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
};
CL_StringRef days[] =
{
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
};
// Tue Nov 16 11:34:15 2004 UTC
CL_DateTime cur_time = CL_DateTime::get_current_utc_time();
#ifdef WIN32
CL_StringFormat format("%1 %2 %3 %4:%5:%6 %7 UTC [%8] %9\r\n");
#else
CL_StringFormat format("%1 %2 %3 %4:%5:%6 %7 UTC [%8] %9\n");
#endif
format.set_arg(1, days[cur_time.get_day_of_week()]);
format.set_arg(2, months[cur_time.get_month() - 1]);
format.set_arg(3, cur_time.get_day());
format.set_arg(4, cur_time.get_hour(), 2);
format.set_arg(5, cur_time.get_minutes(), 2);
format.set_arg(6, cur_time.get_seconds(), 2);
format.set_arg(7, cur_time.get_year());
format.set_arg(8, type);
format.set_arg(9, text);
#ifdef WIN32
CL_String16 log_line = CL_StringHelp::utf8_to_ucs2(format.get_result());
DWORD bytesWritten = 0;
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), log_line.data(), log_line.size(), &bytesWritten, 0);
#else
CL_String8 log_line = CL_StringHelp::text_to_local8(format.get_result());
write(1, log_line.data(), log_line.length());
#endif
}
/////////////////////////////////////////////////////////////////////////////
// CL_FileLogger Implementation:
| [
"[email protected]@c628178a-a759-096a-d0f3-7c7507b30227"
]
| [
[
[
1,
116
]
]
]
|
61fc32651aebe6d60dcc6ad959f5e34af121b0d1 | 29c5bc6757634a26ac5103f87ed068292e418d74 | /externallibs/ogre/include/OgreHardwarePixelBuffer.h | 4270a770902323c40dfecc16568f330aaf53f45d | []
| no_license | drivehappy/tlapi | d10bb75f47773e381e3ba59206ff50889de7e66a | 56607a0243bd9d2f0d6fb853cddc4fce3e7e0eb9 | refs/heads/master | 2021-03-19T07:10:57.343889 | 2011-04-18T22:58:29 | 2011-04-18T22:58:29 | 32,191,364 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,063 | h | /*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2006 Torus Knot Software Ltd
Also see acknowledgements in Readme.html
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/copyleft/lesser.txt.
You may alternatively use this source under the terms of a specific version of
the OGRE Unrestricted License provided you have obtained such a license from
Torus Knot Software Ltd.
-----------------------------------------------------------------------------
*/
#ifndef __HardwarePixelBuffer__
#define __HardwarePixelBuffer__
// Precompiler options
#include "OgrePrerequisites.h"
#include "OgreHardwareBuffer.h"
#include "OgreSharedPtr.h"
#include "OgrePixelFormat.h"
#include "OgreImage.h"
namespace Ogre {
/** Specialisation of HardwareBuffer for a pixel buffer. The
HardwarePixelbuffer abstracts an 1D, 2D or 3D quantity of pixels
stored by the rendering API. The buffer can be located on the card
or in main memory depending on its usage. One mipmap level of a
texture is an example of a HardwarePixelBuffer.
*/
class _OgreExport HardwarePixelBuffer : public HardwareBuffer
{
protected:
// Extents
size_t mWidth, mHeight, mDepth;
// Pitches (offsets between rows and slices)
size_t mRowPitch, mSlicePitch;
// Internal format
PixelFormat mFormat;
// Currently locked region (local coords)
PixelBox mCurrentLock;
// The current locked box of this surface (entire surface coords)
Image::Box mLockedBox;
/// Internal implementation of lock(), must be overridden in subclasses
virtual PixelBox lockImpl(const Image::Box lockBox, LockOptions options) = 0;
/// Internal implementation of lock(), do not OVERRIDE or CALL this
/// for HardwarePixelBuffer implementations, but override the previous method
virtual void* lockImpl(size_t offset, size_t length, LockOptions options);
/// Internal implementation of unlock(), must be overridden in subclasses
// virtual void unlockImpl(void) = 0;
/** Notify TextureBuffer of destruction of render target.
Called by RenderTexture when destroyed.
*/
virtual void _clearSliceRTT(size_t zoffset);
friend class RenderTexture;
public:
/// Should be called by HardwareBufferManager
HardwarePixelBuffer(size_t mWidth, size_t mHeight, size_t mDepth,
PixelFormat mFormat,
HardwareBuffer::Usage usage, bool useSystemMemory, bool useShadowBuffer);
~HardwarePixelBuffer();
/** make every lock method from HardwareBuffer available.
See http://www.research.att.com/~bs/bs_faq2.html#overloadderived
*/
using HardwareBuffer::lock;
/** Lock the buffer for (potentially) reading / writing.
@param lockBox Region of the buffer to lock
@param options Locking options
@returns PixelBox containing the locked region, the pitches and
the pixel format
*/
virtual const PixelBox& lock(const Image::Box& lockBox, LockOptions options);
/// @copydoc HardwareBuffer::lock
virtual void* lock(size_t offset, size_t length, LockOptions options);
/** Get the current locked region. This is the same value as returned
by lock(const Image::Box, LockOptions)
@returns PixelBox containing the locked region
*/
const PixelBox& getCurrentLock();
/// @copydoc HardwareBuffer::readData
virtual void readData(size_t offset, size_t length, void* pDest);
/// @copydoc HardwareBuffer::writeData
virtual void writeData(size_t offset, size_t length, const void* pSource,
bool discardWholeBuffer = false);
/** Copies a box from another PixelBuffer to a region of the
this PixelBuffer.
@param dst Source pixel buffer
@param srcBox Image::Box describing the source region in src
@param dstBox Image::Box describing the destination region in this buffer
@remarks The source and destination regions dimensions don't have to match, in which
case scaling is done. This scaling is generally done using a bilinear filter in hardware,
but it is faster to pass the source image in the right dimensions.
@note Only call this function when both buffers are unlocked.
*/
virtual void blit(const HardwarePixelBufferSharedPtr &src, const Image::Box &srcBox, const Image::Box &dstBox);
/** Convenience function that blits the entire source pixel buffer to this buffer.
If source and destination dimensions don't match, scaling is done.
@param src PixelBox containing the source pixels and format in memory
@note Only call this function when the buffer is unlocked.
*/
void blit(const HardwarePixelBufferSharedPtr &src);
/** Copies a region from normal memory to a region of this pixelbuffer. The source
image can be in any pixel format supported by OGRE, and in any size.
@param src PixelBox containing the source pixels and format in memory
@param dstBox Image::Box describing the destination region in this buffer
@remarks The source and destination regions dimensions don't have to match, in which
case scaling is done. This scaling is generally done using a bilinear filter in hardware,
but it is faster to pass the source image in the right dimensions.
@note Only call this function when the buffer is unlocked.
*/
virtual void blitFromMemory(const PixelBox &src, const Image::Box &dstBox) = 0;
/** Convenience function that blits a pixelbox from memory to the entire
buffer. The source image is scaled as needed.
@param src PixelBox containing the source pixels and format in memory
@note Only call this function when the buffer is unlocked.
*/
void blitFromMemory(const PixelBox &src)
{
blitFromMemory(src, Box(0,0,0,mWidth,mHeight,mDepth));
}
/** Copies a region of this pixelbuffer to normal memory.
@param srcBox Image::Box describing the source region of this buffer
@param dst PixelBox describing the destination pixels and format in memory
@remarks The source and destination regions don't have to match, in which
case scaling is done.
@note Only call this function when the buffer is unlocked.
*/
virtual void blitToMemory(const Image::Box &srcBox, const PixelBox &dst) = 0;
/** Convience function that blits this entire buffer to a pixelbox.
The image is scaled as needed.
@param src PixelBox containing the source pixels and format in memory
@note Only call this function when the buffer is unlocked.
*/
void blitToMemory(const PixelBox &dst)
{
blitToMemory(Box(0,0,0,mWidth,mHeight,mDepth), dst);
}
/** Get a render target for this PixelBuffer, or a slice of it. The texture this
was acquired from must have TU_RENDERTARGET set, otherwise it is possible to
render to it and this method will throw an ERR_RENDERSYSTEM exception.
@param slice Which slice
@returns A pointer to the render target. This pointer has the lifespan of this
PixelBuffer.
*/
virtual RenderTexture *getRenderTarget(size_t slice=0);
/// Gets the width of this buffer
size_t getWidth() const { return mWidth; }
/// Gets the height of this buffer
size_t getHeight() const { return mHeight; }
/// Gets the depth of this buffer
size_t getDepth() const { return mDepth; }
/// Gets the native pixel format of this buffer
PixelFormat getFormat() const { return mFormat; }
};
/** Shared pointer implementation used to share pixel buffers. */
class _OgreExport HardwarePixelBufferSharedPtr : public SharedPtr<HardwarePixelBuffer>
{
public:
HardwarePixelBufferSharedPtr() : SharedPtr<HardwarePixelBuffer>() {}
explicit HardwarePixelBufferSharedPtr(HardwarePixelBuffer* buf);
};
}
#endif
| [
"drivehappy@53ea644a-42e2-1498-a4e7-6aa81ae25522"
]
| [
[
[
1,
200
]
]
]
|
5cf70c5505411eff72cd0ca55b7b1365ccb439bf | 5ac13fa1746046451f1989b5b8734f40d6445322 | /minimangalore/Nebula2/code/nebula2/src/scene/ntextureanimator_cmds.cc | cc0a87f2725a6fd1f1b21f6457630c7aafb66c1e | []
| no_license | moltenguy1/minimangalore | 9f2edf7901e7392490cc22486a7cf13c1790008d | 4d849672a6f25d8e441245d374b6bde4b59cbd48 | refs/heads/master | 2020-04-23T08:57:16.492734 | 2009-08-01T09:13:33 | 2009-08-01T09:13:33 | 35,933,330 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,539 | cc | //------------------------------------------------------------------------------
// ntextureanimator_cmds.cc
// (C) 2004 Rafael Van Daele-Hunt
//------------------------------------------------------------------------------
#include "scene/ntextureanimator.h"
#include "kernel/npersistserver.h"
#include "gfx2/ntexture2.h"
static void n_addtexture(void* slf, nCmd* cmd);
static void n_setshaderparam(void* slf, nCmd* cmd);
//------------------------------------------------------------------------------
/**
@scriptclass
ntextureanimator
@cppclass
nTextureAnimator
@superclass
nanimator
@classinfo
Switch between different textures based on an nRenderContext variable.
*/
void
n_initcmds(nClass* cl)
{
cl->BeginCmds();
cl->AddCmd("v_addtexture_s", 'ATEX', n_addtexture);
cl->AddCmd("v_setshaderparam_s", 'SHAD', n_setshaderparam);
cl->EndCmds();
}
//------------------------------------------------------------------------------
/**
@cmd
addtexture
@input
s(Texture path)
@output
v
@info
Add a texture to the array (with index number equal to the number of textures added thus far).
*/
static void
n_addtexture(void* slf, nCmd* cmd)
{
nTextureAnimator* self = (nTextureAnimator*) slf;
self->AddTexture(cmd->In()->GetS());
}
//------------------------------------------------------------------------------
/**
@cmd
setshaderparam
@input
s(Texture path)
@output
v
@info
Sets the shader state parameter that will be passed to nAbstractShaderNode::SetTexture.
*/
static void
n_setshaderparam(void* slf, nCmd* cmd)
{
nTextureAnimator* self = (nTextureAnimator*) slf;
self->SetShaderParam(cmd->In()->GetS());
}
//------------------------------------------------------------------------------
/**
*/
bool
nTextureAnimator::SaveCmds(nPersistServer* ps)
{
if (nAnimator::SaveCmds(ps))
{
nCmd* cmd;
//--- addtexture ---
const int numKeys = this->GetNumTextures();
for (int curKey = 0; curKey < numKeys; ++curKey)
{
cmd = ps->GetCmd(this, 'ATEX');
cmd->In()->SetS(this->GetTextureAt(curKey)->GetName());
ps->PutCmd(cmd);
}
//--- setshaderparam ---
cmd = ps->GetCmd(this, 'SHAD');
cmd->In()->SetS(this->GetShaderParam());
ps->PutCmd(cmd);
return true;
}
return false;
}
| [
"BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c"
]
| [
[
[
1,
97
]
]
]
|
5d9ebbc75d79406b6871a9e6568a79ddcc04ec9d | 2a3952c00a7835e6cb61b9cb371ce4fb6e78dc83 | /BasicOgreFramework/PhysxSDK/Samples/SampleCommonCode/src/BmpLoader.cpp | b8d92b4ecfd68b9ad69118d82b8b25a5f2b7a4fd | []
| no_license | mgq812/simengines-g2-code | 5908d397ef2186e1988b1d14fa8b73f4674f96ea | 699cb29145742c1768857945dc59ef283810d511 | refs/heads/master | 2016-09-01T22:57:54.845817 | 2010-01-11T19:26:51 | 2010-01-11T19:26:51 | 32,267,377 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,358 | cpp | #include <stdio.h>
#include <stdlib.h>
#include "BmpLoader.h"
#include "MediaPath.h"
static bool isBigEndian() { int i = 1; return *((char*)&i)==0; }
static unsigned short endianSwap(unsigned short nValue)
{
return (((nValue>> 8)) | (nValue << 8));
}
static unsigned int endianSwap(unsigned int i)
{
unsigned char b1, b2, b3, b4;
b1 = i & 255;
b2 = ( i >> 8 ) & 255;
b3 = ( i>>16 ) & 255;
b4 = ( i>>24 ) & 255;
return ((unsigned int)b1 << 24) + ((unsigned int)b2 << 16) + ((unsigned int)b3 << 8) + b4;
}
// -------------------------------------------------------------------
#pragma pack(1)
struct BMPHEADER {
unsigned short Type;
unsigned int Size;
unsigned short Reserved1;
unsigned short Reserved2;
unsigned int OffBits;
};
// Only Win3.0 BMPINFO (see later for OS/2)
struct BMPINFO {
unsigned int Size;
unsigned int Width;
unsigned int Height;
unsigned short Planes;
unsigned short BitCount;
unsigned int Compression;
unsigned int SizeImage;
unsigned int XPelsPerMeter;
unsigned int YPelsPerMeter;
unsigned int ClrUsed;
unsigned int ClrImportant;
};
#pragma pack()
// Compression Type
#define BI_RGB 0L
#define BI_RLE8 1L
#define BI_RLE4 2L
// -------------------------------------------------------------------
BmpLoader::BmpLoader()
{
mWidth = 0;
mHeight = 0;
mRGB = NULL;
}
// -------------------------------------------------------------------
BmpLoader::~BmpLoader()
{
if (mRGB) free(mRGB);
}
// -------------------------------------------------------------------
bool BmpLoader::loadBmp(const char *filename)
{
if (mRGB) {
free(mRGB);
mRGB = NULL;
}
mWidth = 0;
mHeight = 0;
char buff[512];
FILE *f = fopen(FindMediaFile(filename,buff), "rb");
if (!f) return false;
size_t num;
BMPHEADER header;
num = fread(&header, sizeof(BMPHEADER), 1, f);
if(isBigEndian()) header.Type = endianSwap(header.Type);
if (num != 1) { fclose(f); return false; }
if (header.Type != 'MB') { fclose(f); return false; }
BMPINFO info;
num = fread(&info, sizeof(BMPINFO), 1, f);
if (num != 1) { fclose(f); return false; }
if(isBigEndian()) info.Size = endianSwap(info.Size);
if(isBigEndian()) info.BitCount = endianSwap(info.BitCount);
if(isBigEndian()) info.Compression = endianSwap(info.Compression);
if(isBigEndian()) info.Width = endianSwap(info.Width);
if(isBigEndian()) info.Height = endianSwap(info.Height);
if (info.Size != sizeof(BMPINFO)) { fclose(f); return false; }
if (info.BitCount != 24) { fclose(f); return false; }
if (info.Compression != BI_RGB) { fclose(f); return false; }
mWidth = info.Width;
mHeight = info.Height;
mRGB = (unsigned char*)malloc(mWidth * mHeight * 3);
int lineLen = (((info.Width * (info.BitCount>>3)) + 3)>>2)<<2;
unsigned char *line = (unsigned char *)malloc(lineLen);
for(int i = info.Height-1; i >= 0; i--) {
num = fread(line, lineLen, 1, f);
if (num != 1) { fclose(f); return false; }
unsigned char *src = line;
unsigned char *dest = mRGB + i*info.Width*3;
for(unsigned int j = 0; j < info.Width; j++) {
unsigned char r,g,b;
b = *src++; g = *src++; r = *src++;
*dest++ = r; *dest++ = g; *dest++ = b;
}
}
free(line);
fclose(f);
return true;
}
| [
"erucarno@789472dc-e1c3-11de-81d3-db62269da9c1"
]
| [
[
[
1,
135
]
]
]
|
f27c1d84e9ccaf5cbff1b5757f3bdd657dc795fa | f89e32cc183d64db5fc4eb17c47644a15c99e104 | /pcsx2-rr/pcsx2/gui/SysState.cpp | fd506d200a3066739e15a5a6c7f0531e53438308 | []
| no_license | mauzus/progenitor | f99b882a48eb47a1cdbfacd2f38505e4c87480b4 | 7b4f30eb1f022b08e6da7eaafa5d2e77634d7bae | refs/heads/master | 2021-01-10T07:24:00.383776 | 2011-04-28T11:03:43 | 2011-04-28T11:03:43 | 45,171,114 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,435 | cpp | /* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2010 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of te License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "PrecompiledHeader.h"
#include "App.h"
#include "System/SysThreads.h"
#include "SaveState.h"
#include "ZipTools/ThreadedZipTools.h"
// Used to hold the current state backup (fullcopy of PS2 memory and plugin states).
//static VmStateBuffer state_buffer( L"Public Savestate Buffer" );
static const char SavestateIdentString[] = "PCSX2 Savestate";
static const uint SavestateIdentLen = sizeof(SavestateIdentString);
static void SaveStateFile_WriteHeader( IStreamWriter& thr )
{
thr.Write( SavestateIdentString );
thr.Write( g_SaveVersion );
}
static void SaveStateFile_ReadHeader( IStreamReader& thr )
{
char ident[SavestateIdentLen] = {0};
thr.Read( ident );
if( strcmp(SavestateIdentString, ident) )
throw Exception::SaveStateLoadError( thr.GetStreamName() )
.SetDiagMsg(wxsFormat( L"Unrecognized file signature while loading savestate."))
.SetUserMsg(_("This is not a valid PCSX2 savestate, or is from an older unsupported version of PCSX2."));
u32 savever;
thr.Read( savever );
// Major version mismatch. Means we can't load this savestate at all. Support for it
// was removed entirely.
if( savever > g_SaveVersion )
throw Exception::SaveStateLoadError( thr.GetStreamName() )
.SetDiagMsg(wxsFormat( L"Savestate uses an unsupported or unknown savestate version.\n(PCSX2 ver=%x, state ver=%x)", g_SaveVersion, savever ))
.SetUserMsg(_("Cannot load this savestate. The state is from an incompatible edition of PCSX2 that is either newer than this version, or is no longer supported."));
// check for a "minor" version incompatibility; which happens if the savestate being loaded is a newer version
// than the emulator recognizes. 99% chance that trying to load it will just corrupt emulation or crash.
if( (savever >> 16) != (g_SaveVersion >> 16) )
throw Exception::SaveStateLoadError( thr.GetStreamName() )
.SetDiagMsg(wxsFormat( L"Savestate uses an unknown (future?!) savestate version.\n(PCSX2 ver=%x, state ver=%x)", g_SaveVersion, savever ))
.SetUserMsg(_("Cannot load this savestate. The state is an unsupported version, likely created by a newer edition of PCSX2."));
};
class gzError : public Exception::BadStream
{
DEFINE_STREAM_EXCEPTION( gzError, BadStream, wxLt("Invalid or corrupted gzip archive") )
};
class gzReadError : public gzError
{
};
class gzWriteError : public gzError
{
};
// --------------------------------------------------------------------------------------
// gzipReader
// --------------------------------------------------------------------------------------
// Interface for reading data from a gzip stream.
//
class gzipReader : public IStreamReader
{
DeclareNoncopyableObject(gzipReader);
protected:
wxString m_filename;
gzFile m_gzfp;
public:
gzipReader( const wxString& filename )
: m_filename( filename )
{
if( NULL == (m_gzfp = gzopen( m_filename.ToUTF8(), "rb" )) )
throw Exception::CannotCreateStream( m_filename ).SetDiagMsg(L"Cannot open file for reading.");
#if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1240)
gzbuffer(m_gzfp, 0x100000); // 1mb buffer for zlib internal operations
#endif
}
virtual ~gzipReader() throw ()
{
if( m_gzfp ) gzclose( m_gzfp );
}
wxString GetStreamName() const { return m_filename; }
void Read( void* dest, size_t size )
{
int result = gzread( m_gzfp, dest, size );
if( result == -1)
//throw Exception::gzError( m_filename );
throw Exception::BadStream( m_filename ).SetBothMsgs(wxLt("Data read failed: Invalid or corrupted gzip archive."));
if( (size_t)result < size )
throw Exception::EndOfStream( m_filename );
}
};
//static bool IsSavingOrLoading = false;
// --------------------------------------------------------------------------------------
// SysExecEvent_DownloadState
// --------------------------------------------------------------------------------------
// Pauses core emulation and downloads the savestate into the state_buffer.
//
class SysExecEvent_DownloadState : public SysExecEvent
{
protected:
VmStateBuffer* m_dest_buffer;
public:
wxString GetEventName() const { return L"VM_Download"; }
virtual ~SysExecEvent_DownloadState() throw() {}
SysExecEvent_DownloadState* Clone() const { return new SysExecEvent_DownloadState( *this ); }
SysExecEvent_DownloadState( VmStateBuffer* dest=NULL )
{
m_dest_buffer = dest;
}
bool IsCriticalEvent() const { return true; }
bool AllowCancelOnExit() const { return false; }
protected:
void InvokeEvent()
{
ScopedCoreThreadPause paused_core;
if( !SysHasValidState() )
throw Exception::RuntimeError()
.SetDiagMsg(L"SysExecEvent_DownloadState: Cannot freeze/download an invalid VM state!")
.SetUserMsg(L"There is no active virtual machine state to download or save." );
memSavingState(m_dest_buffer).FreezeAll();
UI_EnableStateActions();
paused_core.AllowResume();
}
};
// It's bad mojo to have savestates trying to read and write from the same file at the
// same time. To prevent that we use this mutex lock, which is used by both the
// CompressThread and the UnzipFromDisk events. (note that CompressThread locks the
// mutex during OnStartInThread, which ensures that the ZipToDisk event blocks; preventing
// the SysExecutor's Idle Event from re-enabing savestates and slots.)
//
static Mutex mtx_CompressToDisk;
// --------------------------------------------------------------------------------------
// CompressThread_VmState
// --------------------------------------------------------------------------------------
class VmStateZipThread : public CompressThread_gzip
{
typedef CompressThread_gzip _parent;
protected:
ScopedLock m_lock_Compress;
public:
VmStateZipThread( const wxString& file, VmStateBuffer* srcdata )
: _parent( file, srcdata, SaveStateFile_WriteHeader )
{
m_lock_Compress.Assign(mtx_CompressToDisk);
}
VmStateZipThread( const wxString& file, ScopedPtr<VmStateBuffer>& srcdata )
: _parent( file, srcdata, SaveStateFile_WriteHeader )
{
m_lock_Compress.Assign(mtx_CompressToDisk);
}
virtual ~VmStateZipThread() throw()
{
}
protected:
void OnStartInThread()
{
_parent::OnStartInThread();
m_lock_Compress.Acquire();
}
void OnCleanupInThread()
{
m_lock_Compress.Release();
_parent::OnCleanupInThread();
}
};
// --------------------------------------------------------------------------------------
// SysExecEvent_ZipToDisk
// --------------------------------------------------------------------------------------
class SysExecEvent_ZipToDisk : public SysExecEvent
{
protected:
VmStateBuffer* m_src_buffer;
wxString m_filename;
public:
wxString GetEventName() const { return L"VM_ZipToDisk"; }
virtual ~SysExecEvent_ZipToDisk() throw()
{
delete m_src_buffer;
}
SysExecEvent_ZipToDisk* Clone() const { return new SysExecEvent_ZipToDisk( *this ); }
SysExecEvent_ZipToDisk( ScopedPtr<VmStateBuffer>& src, const wxString& filename )
: m_filename( filename )
{
m_src_buffer = src.DetachPtr();
}
SysExecEvent_ZipToDisk( VmStateBuffer* src, const wxString& filename )
: m_filename( filename )
{
m_src_buffer = src;
}
bool IsCriticalEvent() const { return true; }
bool AllowCancelOnExit() const { return false; }
protected:
void InvokeEvent()
{
(new VmStateZipThread( m_filename, m_src_buffer ))->Start();
m_src_buffer = NULL;
}
};
// --------------------------------------------------------------------------------------
// SysExecEvent_UnzipFromDisk
// --------------------------------------------------------------------------------------
// Note: Unzipping always goes directly into the SysCoreThread's static VM state, and is
// always a blocking action on the SysExecutor thread (the system cannot execute other
// commands while states are unzipping or uploading into the system).
//
class SysExecEvent_UnzipFromDisk : public SysExecEvent
{
protected:
wxString m_filename;
public:
wxString GetEventName() const { return L"VM_UnzipFromDisk"; }
virtual ~SysExecEvent_UnzipFromDisk() throw() {}
SysExecEvent_UnzipFromDisk* Clone() const { return new SysExecEvent_UnzipFromDisk( *this ); }
SysExecEvent_UnzipFromDisk( const wxString& filename )
: m_filename( filename )
{
}
wxString GetStreamName() const { return m_filename; }
protected:
void InvokeEvent()
{
ScopedLock lock( mtx_CompressToDisk );
gzipReader m_gzreader(m_filename );
SaveStateFile_ReadHeader( m_gzreader );
// We use direct Suspend/Resume control here, since it's desirable that emulation
// *ALWAYS* start execution after the new savestate is loaded.
GetCoreThread().Pause();
// fixme: should start initially with the file size, and then grow from there.
static const int BlockSize = 0x100000;
VmStateBuffer buffer( 0x800000, L"StateBuffer_UnzipFromDisk" ); // start with an 8 meg buffer to avoid frequent reallocation.
int curidx = 0;
try {
while(true) {
buffer.MakeRoomFor( curidx+BlockSize );
m_gzreader.Read( buffer.GetPtr(curidx), BlockSize );
curidx += BlockSize;
Threading::pxTestCancel();
}
}
catch( Exception::EndOfStream& )
{
// This exception actually means success! Any others we let get sent
// to the main event handler/thread for handling.
}
// Optional shutdown of plugins when loading states? I'm not implementing it yet because some
// things, like the SPU2-recovery trick, rely on not resetting the plugins prior to loading
// the new savestate data.
//if( ShutdownOnStateLoad ) GetCoreThread().Cancel();
GetCoreThread().UploadStateCopy( buffer );
GetCoreThread().Resume(); // force resume regardless of emulation state earlier.
}
};
// =====================================================================================================
// StateCopy Public Interface
// =====================================================================================================
void StateCopy_SaveToFile( const wxString& file )
{
UI_DisableStateActions();
ScopedPtr<VmStateBuffer> zipbuf(new VmStateBuffer( L"Zippable Savestate" ));
GetSysExecutorThread().PostEvent(new SysExecEvent_DownloadState( zipbuf ));
GetSysExecutorThread().PostEvent(new SysExecEvent_ZipToDisk( zipbuf, file ));
}
void StateCopy_LoadFromFile( const wxString& file )
{
UI_DisableSysActions();
GetSysExecutorThread().PostEvent(new SysExecEvent_UnzipFromDisk( file ));
}
// Saves recovery state info to the given saveslot, or saves the active emulation state
// (if one exists) and no recovery data was found. This is needed because when a recovery
// state is made, the emulation state is usually reset so the only persisting state is
// the one in the memory save. :)
void StateCopy_SaveToSlot( uint num )
{
const wxString file( SaveStateBase::GetFilename( num ) );
Console.WriteLn( Color_StrongGreen, "Saving savestate to slot %d...", num );
Console.Indent().WriteLn( Color_StrongGreen, L"filename: %s", file.c_str() );
StateCopy_SaveToFile( file );
}
void StateCopy_LoadFromSlot( uint slot )
{
wxString file( SaveStateBase::GetFilename( slot ) );
if( !wxFileExists( file ) )
{
Console.Warning( "Savestate slot %d is empty.", slot );
return;
}
Console.WriteLn( Color_StrongGreen, "Loading savestate from slot %d...", slot );
Console.Indent().WriteLn( Color_StrongGreen, L"filename: %s", file.c_str() );
StateCopy_LoadFromFile( file );
}
| [
"koeiprogenitor@bfa1b011-20a7-a6e3-c617-88e5d26e11c5"
]
| [
[
[
1,
374
]
]
]
|
50c5e1a93720860aa5b369a8616f1b8b79a7f417 | 9a6a9d17dde3e8888d8183618a02863e46f072f1 | /DialogFinal.h | 7de8b7ffee7d499416b8c9b6888bafec99a7967c | []
| no_license | pritykovskaya/max-visualization | 34266c449fb2c03bed6fd695e0b54f144d78e123 | a3c0879a8030970bb1fee95d2bfc6ccf689972ea | refs/heads/master | 2021-01-21T12:23:01.436525 | 2011-07-06T18:23:38 | 2011-07-06T18:23:38 | 2,006,225 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,361 | h | #pragma once
#include "afxwin.h"
// DialogFinal dialog
class DialogFinal : public CDialog
{
DECLARE_DYNAMIC(DialogFinal)
public:
DialogFinal(CWnd* pParent = NULL); // standard constructor
virtual ~DialogFinal();
// Dialog Data
enum { IDD = IDD_DIALOG2 };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
double m_min_x;
public:
afx_msg void OnEnChangeEdit1();
public:
double m_max_x;
public:
double m_min_y;
public:
double m_max_y;
public:
int m_func;
public:
afx_msg void OnBnClickedRadio1();
public:
afx_msg void OnBnClickedRadio2();
public:
int m_meth;
public:
afx_msg void OnEnChangeEdit9();
public:
double m_steps;
public:
double m_start_x;
public:
double m_start_y;
public:
double m_rand_eps;
public:
double m_p;
public:
int m_fail_steps;
public:
double m_eps_point_change;
public:
afx_msg void OnEnChangeEdit10();
public:
double m_x_second_start_point;
public:
double m_y_second_start_point;
public:
CEdit control_rand_eps;
public:
CEdit control_p;
public:
CEdit control_fail_steps;
public:
CEdit control_gorge_eps;
public:
CEdit control_gorge_x;
public:
CEdit control_gorge_y;
public:
afx_msg void OnEnChangeEdit11();
public:
afx_msg void OnCbnSelchangeCombo1();
};
| [
"[email protected]"
]
| [
[
[
1,
79
]
]
]
|
7835f10b07fb46dacce9f4534d7d10b3feccc967 | a473bf3be1f1cda62b1d0dc23292fbf7ec00dcee | /src/htmlcontrol.cpp | ef66ba2cee9d2a75210014c7ce3bd9d8114beb6d | []
| no_license | SymbiSoft/htmlcontrol-for-symbian | 23821e9daa50707b1d030960e1c2dcf59633a335 | 504ca3cb3cf4baea3adc5c5b44e8037e0d73c3bb | refs/heads/master | 2021-01-10T15:04:51.760462 | 2009-08-14T05:40:14 | 2009-08-14T05:40:14 | 48,186,784 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,464 | cpp | #include <eikenv.h>
#include "htmlcontrol.hrh"
#ifdef __SERIES60__
#include <aknutils.h>
#endif
#include "htmlcontrol.h"
#include "controlimpl.h"
#include "elementimpl.h"
#include "htmlctlenv.h"
#include "htmlctlevent.h"
#include "htmlparser.h"
#include "scrollbar.h"
#include "style.h"
#include "imagepool.h"
#include "transimpl.h"
#include "element_body.h"
CHtmlControl* CHtmlControl::NewL(CCoeControl* aParent)
{
CHtmlControl* self = new (ELeave)CHtmlControl();
CleanupStack::PushL(self);
self->ConstructL(aParent);
CleanupStack::Pop();
return self;
}
CHtmlControl::CHtmlControl()
{
}
CHtmlControl::~CHtmlControl()
{
delete iImpl;
}
void CHtmlControl::ConstructL(CCoeControl* aParent)
{
if(aParent)
{
SetContainerWindowL(*aParent);
#ifdef __SYMBIAN_9_ONWARDS__
SetParent(aParent);
#endif
SetMopParent(aParent);
}
else
CreateWindowL();
SetFocusing(ETrue);
EnableDragEvents();
DrawableWindow()->SetPointerGrab(ETrue);
iImpl = CHtmlControlImpl::NewL(this);
iImpl->CreateBodyL();
}
CHtmlElement* CHtmlControl::Body() const
{
return (CHtmlElement*)iImpl->Body();
}
void CHtmlControl::SetEventObserver(MHtmlCtlEventObserver* aObserver)
{
iImpl->SetEventObserver(aObserver);
}
void CHtmlControl::ScrollToView(CHtmlElement* aElement)
{
iImpl->ScrollToView((CHtmlElementImpl*)aElement);
}
CHtmlElement* CHtmlControl::InsertContentL(CHtmlElement* aTarget, TInsertPosition aPosition, const TDesC& aSource, TInt aFlags)
{
return iImpl->InsertContentL((CHtmlElementImpl*)aTarget, aPosition, aSource, aFlags);
}
CHtmlElement* CHtmlControl::AppendContentL(const TDesC& aSource, TInt aFlags)
{
return InsertContentL(Body(), EBeforeEnd, aSource, aFlags);
}
void CHtmlControl::ClearContent()
{
iImpl->Body()->SetProperty(KHStrInnerHtml, KNullDesC);
}
void CHtmlControl::RefreshAndDraw()
{
Refresh();
//DrawNow();
this->Window().Invalidate(Rect());
}
CHtmlElement* CHtmlControl::Element(const TDesC& aId, TInt aIndex) const
{
return iImpl->Body()->Element(aId, aIndex);
}
CHtmlElement* CHtmlControl::ElementByTag(const TDesC& aTagName, TInt aIndex) const
{
return iImpl->Body()->ElementByTag(aTagName, aIndex);
}
CHtmlElement* CHtmlControl::FocusedElement() const
{
return iImpl->FocusedElement();
}
void CHtmlControl::SetFocusTo(CHtmlElement* aElement)
{
iImpl->SetFocusTo((CHtmlElementImpl*)aElement);
}
TInt CHtmlControl::CountComponentControls() const
{
return iImpl->CountComponentControls();
}
CCoeControl* CHtmlControl::ComponentControl(TInt aIndex) const
{
return iImpl->ComponentControl(aIndex);
}
void CHtmlControl::RemoveElement(CHtmlElement* aElement)
{
iImpl->RemoveElement((CHtmlElementImpl*)aElement);
}
void CHtmlControl::AddStyleSheetL(const TDesC& aSource)
{
iImpl->AddStyleSheetL(aSource);
}
void CHtmlControl::RemoveStyleClass(const TDesC& aSelectorStr)
{
iImpl->RemoveStyleClass(aSelectorStr);
}
void CHtmlControl::ClearStyleSheet()
{
iImpl->ClearStyleSheet();
}
void CHtmlControl::Refresh()
{
iImpl->Refresh();
}
void CHtmlControl::Draw(const TRect& aRect) const
{
iImpl->Draw(aRect);
}
TKeyResponse CHtmlControl::OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)
{
return iImpl->OfferKeyEventL(aKeyEvent, aType);
}
void CHtmlControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
{
CCoeControl::HandlePointerEventL(aPointerEvent);
iImpl->HandlePointerEventL(aPointerEvent);
}
void CHtmlControl::HandleResourceChange(TInt aType)
{
if(aType==KUidValueCoeColorSchemeChangeEvent
#ifdef __SYMBIAN_9_ONWARDS__
|| aType==KUidValueCoeFontChangeEvent
#endif
#ifdef __SERIES60_3_ONWARDS__
|| aType==KAknsMessageSkinChange || aType==KEikDynamicLayoutVariantSwitch
#endif
)
{
iImpl->iState.Set(EHCSNeedRedraw);
}
}
MTransition* CHtmlControl::Transition() const
{
return static_cast<MTransition*>(iImpl->Transition());
}
const CFbsBitmap* CHtmlControl::OffScreenBitmap() const
{
return (const CFbsBitmap*)iImpl->OffScreenBitmap();
}
void HtmlCtlLib::AddSearchPathL(const TDesC& aPath)
{
CHtmlCtlEnv::Static()->AddSearchPathL(aPath);
}
TBool HtmlCtlLib::ResolvePath(TDes& aPath)
{
return CHtmlCtlEnv::Static()->ResolvePath(aPath);
}
void HtmlCtlLib::AddGlobalStyleSheetL(const TDesC& aSource)
{
HtmlParser::ParseStyleSheetL(aSource, CHtmlCtlEnv::Static()->DefaultStyleSheet());
}
void HtmlCtlLib::ReportResourceChange(TInt aType)
{
if(aType==KUidValueCoeColorSchemeChangeEvent
#ifdef __SYMBIAN_9_ONWARDS__
|| aType==KUidValueCoeFontChangeEvent
#endif
#ifdef __SERIES60_3_ONWARDS__
|| aType==KAknsMessageSkinChange || aType==KEikDynamicLayoutVariantSwitch
#endif
)
{
CHtmlCtlEnv::Static()->ImagePool().RefreshAll(ESystemResourceChanged);
#ifdef __SERIES60_3_ONWARDS__
if(aType!=KEikDynamicLayoutVariantSwitch)
#endif
CHtmlCtlEnv::Static()->ScrollbarDrawer().HandleResourceChange();
}
}
void HtmlCtlLib::CreateCustomScrollbarL(const TDesC& aDefinition)
{
CHtmlCtlEnv::Static()->ScrollbarDrawer().SetCustomImagesL(aDefinition);
}
void HtmlCtlLib::AddObjectFactory(NewHtmlObjectL aFactory)
{
CHtmlCtlEnv::Static()->AddObjectFactory(aFactory);
}
TBool HtmlCtlLib::RefreshImagePool()
{
return CHtmlCtlEnv::Static()->ImagePool().RefreshAll(ELocalResourceChanged);
}
| [
"gzytom@0e8b9480-e87f-11dd-80ed-bda8ba2650cd"
]
| [
[
[
1,
246
]
]
]
|
a29bd2f06c119d64ce9c4a8a6f242e547eee52a3 | 1e3964623d0f90069bc963bb878069ce70ddd52f | /source/scene/lensflare/CLensFlareSceneNode.cpp | 7106b6daa1dcc172f72e0ec035068ffd8eebd7d4 | []
| no_license | randomMesh/katastrophe | fbe7f608cc115d517656a53bdb9cdbc66a728b56 | 2131afc50ee5fd7a15aae6149061ef81c356b74b | refs/heads/master | 2020-04-19T19:19:17.553317 | 2009-12-03T19:05:25 | 2009-12-03T19:05:25 | 168,385,525 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,880 | cpp | // This file is part of the "Flocking boids" demo.
// For conditions of distribution and use, see copyright notice in main.cpp
// Original code and artwork by Paulo Oliveira (ProSoft, http://br.geocities.com/paulo_cmv/)
// The code is Public Domain.
// With updates from gammaray and torleif
#include "CLensFlareSceneNode.h"
#include "ISceneManager.h"
#include "IVideoDriver.h"
#include "ISceneCollisionManager.h"
#include "ICameraSceneNode.h"
namespace irr
{
namespace scene
{
/* Creates a Lens Flare node
\param parent, the node to extend (can be null)
\param mgr the scene manager to call functions from
\param id this scenes ID
\param position starting position
*/
CLensFlareSceneNode::CLensFlareSceneNode(
ISceneNode* parent, ISceneManager* mgr, s32 id, const core::vector3df& position) :
ILensFlareSceneNode(parent, mgr, id, position), StartPosition(position)
{
AutomaticCullingState = EAC_BOX;
indices[0] = 0;
indices[1] = 2;
indices[2] = 1;
indices[3] = 0;
indices[4] = 3;
indices[5] = 2;
vertices[0].TCoords.set(0.0f, 1.0f);
vertices[0].Color = 0xffffffff;
vertices[1].TCoords.set(0.0f, 0.0f);
vertices[1].Color = 0xffffffff;
vertices[2].TCoords.set(1.0f, 0.0f);
vertices[2].Color = 0xffffffff;
vertices[3].TCoords.set(1.0f, 1.0f);
vertices[3].Color = 0xffffffff;
Screensize = SceneManager->getVideoDriver()->getScreenSize();
Material.Lighting = false;
Material.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
Material.ZBuffer = false;
Material.ZWriteEnable = false;
BBox.MinEdge = core::vector3df(-2.0f, -2.0f, -2.0f);
BBox.MaxEdge = core::vector3df(2.0f, 2.0f, 2.0f);
this->collmgr = mgr->getSceneCollisionManager();
}
void CLensFlareSceneNode::OnRegisterSceneNode()
{
if(IsVisible)
{
if(core::rect<s32>(core::position2d<s32>(0, 0), Screensize).isPointInside(
this->collmgr->getScreenCoordinatesFrom3DPosition(
this->AbsoluteTransformation.getTranslation(), SceneManager->getActiveCamera())))
{
SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT);
ISceneNode::OnRegisterSceneNode();
}
}
}
/* Every time it gets drawn, this function gets called */
void CLensFlareSceneNode::render()
{
video::IVideoDriver* const driver = SceneManager->getVideoDriver();
ICameraSceneNode* const camera = SceneManager->getActiveCamera();
const core::vector3df& campos = camera->getAbsolutePosition();
const core::dimension2du& sz = driver->getScreenSize();
const core::vector2df& mid = core::vector2df((f32)sz.Width, (f32)sz.Height)*0.5f;
const core::position2di& lp = this->collmgr->getScreenCoordinatesFrom3DPosition(getAbsolutePosition(), camera);
const core::vector2df& lightpos = core::vector2df((f32)lp.X, (f32)lp.Y);
const u32 nframes = Material.getTexture(0)->getOriginalSize().Width/Material.getTexture(0)->getOriginalSize().Height;
int texw = 8;
const irr::f32 texp = 1.0f/nframes;
const core::vector3df& target = camera->getTarget();
const core::vector3df& up = camera->getUpVector();
core::vector3df view = target - campos;
view.normalize();
core::vector3df horizontal = up.crossProduct(view);
horizontal.normalize();
core::vector3df vertical;
vertical = horizontal.crossProduct(view);
vertical.normalize();
view *= -1.0f;
for (u32 i = 0; i < 4; ++i)
vertices[i].Normal = view;
driver->setTransform(video::ETS_WORLD, core::matrix4());
driver->setMaterial(Material);
core::vector3df pos;
for (u32 ax = 0; ax < nframes; ++ax)
{
if (ax == 0 )
{
pos = this->AbsoluteTransformation.getTranslation();
texw = Material.getTexture(0)->getSize().Height;
}
else
{
const core::vector2df& ipos = mid.getInterpolated(lightpos, (2.0f/nframes)*ax);
pos = this->collmgr->getRayFromScreenCoordinates(core::position2d<s32>(int(ipos.X ), int(ipos.Y ) ), camera).end;
core::vector3df dir = core::vector3df(campos - pos).normalize();
pos = campos + (dir * -10.0f);
texw = 4;
}
vertices[0].TCoords.set(ax*texp, 1.0f);
vertices[1].TCoords.set(ax*texp, 0.0f);
vertices[2].TCoords.set((ax+1)*texp, 0.0f);
vertices[3].TCoords.set((ax+1)*texp, 1.0f);
const core::vector3df hor = horizontal*(0.5f*texw);
const core::vector3df ver = vertical*(0.5f*texw);
vertices[0].Pos = pos + hor + ver;
vertices[1].Pos = pos + hor - ver;
vertices[2].Pos = pos - hor - ver;
vertices[3].Pos = pos - hor + ver;
driver->drawIndexedTriangleList(vertices, 4, indices, 2);
}
}
// returns a 'bounding box' of this node
const core::aabbox3df& CLensFlareSceneNode::getBoundingBox() const
{
return BBox;
}
// resets the screen size
void CLensFlareSceneNode::setScreenSize(const core::dimension2d<s32>& newSize)
{
Screensize = newSize;
}
}// end irr namespace
}// end scene namespace
| [
"randomMesh@5fd19fba-185a-4fba-8bb7-5f051f5e5bbc"
]
| [
[
[
1,
162
]
]
]
|
18f307004a3c5bf8226e7d6efe20a045903e5823 | cd0987589d3815de1dea8529a7705caac479e7e9 | /webkit/WebKitTools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp | 834d420f3698fc21c01dfca9f10ea97aafb98dc9 | []
| no_license | azrul2202/WebKit-Smartphone | 0aab1ff641d74f15c0623f00c56806dbc9b59fc1 | 023d6fe819445369134dee793b69de36748e71d7 | refs/heads/master | 2021-01-15T09:24:31.288774 | 2011-07-11T11:12:44 | 2011-07-11T11:12:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 26,564 | cpp | /*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "WebThemeEngineDRT.h"
#include "WebThemeControlDRT.h"
#include "public/WebRect.h"
#include "third_party/skia/include/core/SkRect.h"
// Although all this code is generic, we include these headers
// to pull in the Windows #defines for the parts and states of
// the controls.
#include <vsstyle.h>
#include <windows.h>
#include <wtf/Assertions.h>
using namespace WebKit;
// We define this for clarity, although there really should be a DFCS_NORMAL in winuser.h.
static const int dfcsNormal = 0x0000;
static SkIRect webRectToSkIRect(const WebRect& webRect)
{
SkIRect irect;
irect.set(webRect.x, webRect.y, webRect.x + webRect.width, webRect.y + webRect.height);
return irect;
}
static void drawControl(WebCanvas* canvas,
const WebRect& rect,
WebThemeControlDRT::Type ctype,
WebThemeControlDRT::State cstate)
{
WebThemeControlDRT control(canvas, webRectToSkIRect(rect), ctype, cstate);
control.draw();
}
static void drawTextField(WebCanvas* canvas,
const WebRect& rect,
WebThemeControlDRT::Type ctype,
WebThemeControlDRT::State cstate,
bool drawEdges,
bool fillContentArea,
WebColor color)
{
WebThemeControlDRT control(canvas, webRectToSkIRect(rect), ctype, cstate);
control.drawTextField(drawEdges, fillContentArea, color);
}
static void drawProgressBar(WebCanvas* canvas,
WebThemeControlDRT::Type ctype,
WebThemeControlDRT::State cstate,
const WebRect& barRect,
const WebRect& fillRect)
{
WebThemeControlDRT control(canvas, webRectToSkIRect(barRect), ctype, cstate);
control.drawProgressBar(webRectToSkIRect(fillRect));
}
// WebThemeEngineDRT
void WebThemeEngineDRT::paintButton(WebCanvas* canvas,
int part,
int state,
int classicState,
const WebRect& rect)
{
WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
if (part == BP_CHECKBOX) {
switch (state) {
case CBS_UNCHECKEDNORMAL:
ASSERT(classicState == dfcsNormal);
ctype = WebThemeControlDRT::UncheckedBoxType;
cstate = WebThemeControlDRT::NormalState;
break;
case CBS_UNCHECKEDHOT:
ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT));
ctype = WebThemeControlDRT::UncheckedBoxType;
cstate = WebThemeControlDRT::HotState;
break;
case CBS_UNCHECKEDPRESSED:
ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED));
ctype = WebThemeControlDRT::UncheckedBoxType;
cstate = WebThemeControlDRT::PressedState;
break;
case CBS_UNCHECKEDDISABLED:
ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE));
ctype = WebThemeControlDRT::UncheckedBoxType;
cstate = WebThemeControlDRT::DisabledState;
break;
case CBS_CHECKEDNORMAL:
ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED));
ctype = WebThemeControlDRT::CheckedBoxType;
cstate = WebThemeControlDRT::NormalState;
break;
case CBS_CHECKEDHOT:
ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_HOT));
ctype = WebThemeControlDRT::CheckedBoxType;
cstate = WebThemeControlDRT::HotState;
break;
case CBS_CHECKEDPRESSED:
ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_PUSHED));
ctype = WebThemeControlDRT::CheckedBoxType;
cstate = WebThemeControlDRT::PressedState;
break;
case CBS_CHECKEDDISABLED:
ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_INACTIVE));
ctype = WebThemeControlDRT::CheckedBoxType;
cstate = WebThemeControlDRT::DisabledState;
break;
case CBS_MIXEDNORMAL:
// Classic theme can't represent mixed state checkbox. We assume
// it's equivalent to unchecked.
ASSERT(classicState == DFCS_BUTTONCHECK);
ctype = WebThemeControlDRT::IndeterminateCheckboxType;
cstate = WebThemeControlDRT::NormalState;
break;
case CBS_MIXEDHOT:
ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT));
ctype = WebThemeControlDRT::IndeterminateCheckboxType;
cstate = WebThemeControlDRT::HotState;
break;
case CBS_MIXEDPRESSED:
ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED));
ctype = WebThemeControlDRT::IndeterminateCheckboxType;
cstate = WebThemeControlDRT::PressedState;
break;
case CBS_MIXEDDISABLED:
ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE));
ctype = WebThemeControlDRT::IndeterminateCheckboxType;
cstate = WebThemeControlDRT::DisabledState;
break;
default:
ASSERT_NOT_REACHED();
break;
}
} else if (BP_RADIOBUTTON == part) {
switch (state) {
case RBS_UNCHECKEDNORMAL:
ASSERT(classicState == DFCS_BUTTONRADIO);
ctype = WebThemeControlDRT::UncheckedRadioType;
cstate = WebThemeControlDRT::NormalState;
break;
case RBS_UNCHECKEDHOT:
ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_HOT));
ctype = WebThemeControlDRT::UncheckedRadioType;
cstate = WebThemeControlDRT::HotState;
break;
case RBS_UNCHECKEDPRESSED:
ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_PUSHED));
ctype = WebThemeControlDRT::UncheckedRadioType;
cstate = WebThemeControlDRT::PressedState;
break;
case RBS_UNCHECKEDDISABLED:
ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_INACTIVE));
ctype = WebThemeControlDRT::UncheckedRadioType;
cstate = WebThemeControlDRT::DisabledState;
break;
case RBS_CHECKEDNORMAL:
ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED));
ctype = WebThemeControlDRT::CheckedRadioType;
cstate = WebThemeControlDRT::NormalState;
break;
case RBS_CHECKEDHOT:
ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_HOT));
ctype = WebThemeControlDRT::CheckedRadioType;
cstate = WebThemeControlDRT::HotState;
break;
case RBS_CHECKEDPRESSED:
ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_PUSHED));
ctype = WebThemeControlDRT::CheckedRadioType;
cstate = WebThemeControlDRT::PressedState;
break;
case RBS_CHECKEDDISABLED:
ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_INACTIVE));
ctype = WebThemeControlDRT::CheckedRadioType;
cstate = WebThemeControlDRT::DisabledState;
break;
default:
ASSERT_NOT_REACHED();
break;
}
} else if (BP_PUSHBUTTON == part) {
switch (state) {
case PBS_NORMAL:
ASSERT(classicState == DFCS_BUTTONPUSH);
ctype = WebThemeControlDRT::PushButtonType;
cstate = WebThemeControlDRT::NormalState;
break;
case PBS_HOT:
ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_HOT));
ctype = WebThemeControlDRT::PushButtonType;
cstate = WebThemeControlDRT::HotState;
break;
case PBS_PRESSED:
ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_PUSHED));
ctype = WebThemeControlDRT::PushButtonType;
cstate = WebThemeControlDRT::PressedState;
break;
case PBS_DISABLED:
ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_INACTIVE));
ctype = WebThemeControlDRT::PushButtonType;
cstate = WebThemeControlDRT::DisabledState;
break;
case PBS_DEFAULTED:
ASSERT(classicState == DFCS_BUTTONPUSH);
ctype = WebThemeControlDRT::PushButtonType;
cstate = WebThemeControlDRT::FocusedState;
break;
default:
ASSERT_NOT_REACHED();
break;
}
} else {
ASSERT_NOT_REACHED();
}
drawControl(canvas, rect, ctype, cstate);
}
void WebThemeEngineDRT::paintMenuList(WebCanvas* canvas,
int part,
int state,
int classicState,
const WebRect& rect)
{
WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
if (CP_DROPDOWNBUTTON == part) {
ctype = WebThemeControlDRT::DropDownButtonType;
switch (state) {
case CBXS_NORMAL:
ASSERT(classicState == DFCS_MENUARROW);
cstate = WebThemeControlDRT::NormalState;
break;
case CBXS_HOT:
ASSERT(classicState == (DFCS_MENUARROW | DFCS_HOT));
cstate = WebThemeControlDRT::HoverState;
break;
case CBXS_PRESSED:
ASSERT(classicState == (DFCS_MENUARROW | DFCS_PUSHED));
cstate = WebThemeControlDRT::PressedState;
break;
case CBXS_DISABLED:
ASSERT(classicState == (DFCS_MENUARROW | DFCS_INACTIVE));
cstate = WebThemeControlDRT::DisabledState;
break;
default:
CRASH();
break;
}
} else {
CRASH();
}
drawControl(canvas, rect, ctype, cstate);
}
void WebThemeEngineDRT::paintScrollbarArrow(WebCanvas* canvas,
int state,
int classicState,
const WebRect& rect)
{
WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
switch (state) {
case ABS_UPNORMAL:
ASSERT(classicState == DFCS_SCROLLUP);
ctype = WebThemeControlDRT::UpArrowType;
cstate = WebThemeControlDRT::NormalState;
break;
case ABS_DOWNNORMAL:
ASSERT(classicState == DFCS_SCROLLDOWN);
ctype = WebThemeControlDRT::DownArrowType;
cstate = WebThemeControlDRT::NormalState;
break;
case ABS_LEFTNORMAL:
ASSERT(classicState == DFCS_SCROLLLEFT);
ctype = WebThemeControlDRT::LeftArrowType;
cstate = WebThemeControlDRT::NormalState;
break;
case ABS_RIGHTNORMAL:
ASSERT(classicState == DFCS_SCROLLRIGHT);
ctype = WebThemeControlDRT::RightArrowType;
cstate = WebThemeControlDRT::NormalState;
break;
case ABS_UPHOT:
ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT));
ctype = WebThemeControlDRT::UpArrowType;
cstate = WebThemeControlDRT::HotState;
break;
case ABS_DOWNHOT:
ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT));
ctype = WebThemeControlDRT::DownArrowType;
cstate = WebThemeControlDRT::HotState;
break;
case ABS_LEFTHOT:
ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_HOT));
ctype = WebThemeControlDRT::LeftArrowType;
cstate = WebThemeControlDRT::HotState;
break;
case ABS_RIGHTHOT:
ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_HOT));
ctype = WebThemeControlDRT::RightArrowType;
cstate = WebThemeControlDRT::HotState;
break;
case ABS_UPHOVER:
ASSERT(classicState == DFCS_SCROLLUP);
ctype = WebThemeControlDRT::UpArrowType;
cstate = WebThemeControlDRT::HoverState;
break;
case ABS_DOWNHOVER:
ASSERT(classicState == DFCS_SCROLLDOWN);
ctype = WebThemeControlDRT::DownArrowType;
cstate = WebThemeControlDRT::HoverState;
break;
case ABS_LEFTHOVER:
ASSERT(classicState == DFCS_SCROLLLEFT);
ctype = WebThemeControlDRT::LeftArrowType;
cstate = WebThemeControlDRT::HoverState;
break;
case ABS_RIGHTHOVER:
ASSERT(classicState == DFCS_SCROLLRIGHT);
ctype = WebThemeControlDRT::RightArrowType;
cstate = WebThemeControlDRT::HoverState;
break;
case ABS_UPPRESSED:
ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED | DFCS_FLAT));
ctype = WebThemeControlDRT::UpArrowType;
cstate = WebThemeControlDRT::PressedState;
break;
case ABS_DOWNPRESSED:
ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED | DFCS_FLAT));
ctype = WebThemeControlDRT::DownArrowType;
cstate = WebThemeControlDRT::PressedState;
break;
case ABS_LEFTPRESSED:
ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_PUSHED | DFCS_FLAT));
ctype = WebThemeControlDRT::LeftArrowType;
cstate = WebThemeControlDRT::PressedState;
break;
case ABS_RIGHTPRESSED:
ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_PUSHED | DFCS_FLAT));
ctype = WebThemeControlDRT::RightArrowType;
cstate = WebThemeControlDRT::PressedState;
break;
case ABS_UPDISABLED:
ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE));
ctype = WebThemeControlDRT::UpArrowType;
cstate = WebThemeControlDRT::DisabledState;
break;
case ABS_DOWNDISABLED:
ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE));
ctype = WebThemeControlDRT::DownArrowType;
cstate = WebThemeControlDRT::DisabledState;
break;
case ABS_LEFTDISABLED:
ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_INACTIVE));
ctype = WebThemeControlDRT::LeftArrowType;
cstate = WebThemeControlDRT::DisabledState;
break;
case ABS_RIGHTDISABLED:
ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_INACTIVE));
ctype = WebThemeControlDRT::RightArrowType;
cstate = WebThemeControlDRT::DisabledState;
break;
default:
ASSERT_NOT_REACHED();
break;
}
drawControl(canvas, rect, ctype, cstate);
}
void WebThemeEngineDRT::paintScrollbarThumb(WebCanvas* canvas,
int part,
int state,
int classicState,
const WebRect& rect)
{
WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
switch (part) {
case SBP_THUMBBTNHORZ:
ctype = WebThemeControlDRT::HorizontalScrollThumbType;
break;
case SBP_THUMBBTNVERT:
ctype = WebThemeControlDRT::VerticalScrollThumbType;
break;
case SBP_GRIPPERHORZ:
ctype = WebThemeControlDRT::HorizontalScrollGripType;
break;
case SBP_GRIPPERVERT:
ctype = WebThemeControlDRT::VerticalScrollGripType;
break;
default:
ASSERT_NOT_REACHED();
break;
}
switch (state) {
case SCRBS_NORMAL:
ASSERT(classicState == dfcsNormal);
cstate = WebThemeControlDRT::NormalState;
break;
case SCRBS_HOT:
ASSERT(classicState == DFCS_HOT);
cstate = WebThemeControlDRT::HotState;
break;
case SCRBS_HOVER:
ASSERT(classicState == dfcsNormal);
cstate = WebThemeControlDRT::HoverState;
break;
case SCRBS_PRESSED:
ASSERT(classicState == dfcsNormal);
cstate = WebThemeControlDRT::PressedState;
break;
case SCRBS_DISABLED:
ASSERT_NOT_REACHED(); // This should never happen in practice.
break;
default:
ASSERT_NOT_REACHED();
break;
}
drawControl(canvas, rect, ctype, cstate);
}
void WebThemeEngineDRT::paintScrollbarTrack(WebCanvas* canvas,
int part,
int state,
int classicState,
const WebRect& rect,
const WebRect& alignRect)
{
WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
switch (part) {
case SBP_UPPERTRACKHORZ:
ctype = WebThemeControlDRT::HorizontalScrollTrackBackType;
break;
case SBP_LOWERTRACKHORZ:
ctype = WebThemeControlDRT::HorizontalScrollTrackForwardType;
break;
case SBP_UPPERTRACKVERT:
ctype = WebThemeControlDRT::VerticalScrollTrackBackType;
break;
case SBP_LOWERTRACKVERT:
ctype = WebThemeControlDRT::VerticalScrollTrackForwardType;
break;
default:
ASSERT_NOT_REACHED();
break;
}
switch (state) {
case SCRBS_NORMAL:
ASSERT(classicState == dfcsNormal);
cstate = WebThemeControlDRT::NormalState;
break;
case SCRBS_HOT:
ASSERT_NOT_REACHED(); // This should never happen in practice.
break;
case SCRBS_HOVER:
ASSERT(classicState == dfcsNormal);
cstate = WebThemeControlDRT::HoverState;
break;
case SCRBS_PRESSED:
ASSERT_NOT_REACHED(); // This should never happen in practice.
break;
case SCRBS_DISABLED:
ASSERT(classicState == DFCS_INACTIVE);
cstate = WebThemeControlDRT::DisabledState;
break;
default:
CRASH();
break;
}
drawControl(canvas, rect, ctype, cstate);
}
void WebThemeEngineDRT::paintSpinButton(WebCanvas* canvas,
int part,
int state,
int classicState,
const WebRect& rect)
{
WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
if (part == SPNP_UP) {
ctype = WebThemeControlDRT::UpArrowType;
switch (state) {
case UPS_NORMAL:
ASSERT(classicState == DFCS_SCROLLUP);
cstate = WebThemeControlDRT::NormalState;
break;
case UPS_DISABLED:
ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE));
cstate = WebThemeControlDRT::DisabledState;
break;
case UPS_PRESSED:
ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED));
cstate = WebThemeControlDRT::PressedState;
break;
case UPS_HOT:
ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT));
cstate = WebThemeControlDRT::HoverState;
break;
default:
ASSERT_NOT_REACHED();
}
} else if (part == SPNP_DOWN) {
ctype = WebThemeControlDRT::DownArrowType;
switch (state) {
case DNS_NORMAL:
ASSERT(classicState == DFCS_SCROLLDOWN);
cstate = WebThemeControlDRT::NormalState;
break;
case DNS_DISABLED:
ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE));
cstate = WebThemeControlDRT::DisabledState;
break;
case DNS_PRESSED:
ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED));
cstate = WebThemeControlDRT::PressedState;
break;
case DNS_HOT:
ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT));
cstate = WebThemeControlDRT::HoverState;
break;
default:
ASSERT_NOT_REACHED();
}
} else
ASSERT_NOT_REACHED();
drawControl(canvas, rect, ctype, cstate);
}
void WebThemeEngineDRT::paintTextField(WebCanvas* canvas,
int part,
int state,
int classicState,
const WebRect& rect,
WebColor color,
bool fillContentArea,
bool drawEdges)
{
WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
ASSERT(EP_EDITTEXT == part);
ctype = WebThemeControlDRT::TextFieldType;
switch (state) {
case ETS_NORMAL:
ASSERT(classicState == dfcsNormal);
cstate = WebThemeControlDRT::NormalState;
break;
case ETS_HOT:
ASSERT(classicState == DFCS_HOT);
cstate = WebThemeControlDRT::HotState;
break;
case ETS_DISABLED:
ASSERT(classicState == DFCS_INACTIVE);
cstate = WebThemeControlDRT::DisabledState;
break;
case ETS_SELECTED:
ASSERT(classicState == DFCS_PUSHED);
cstate = WebThemeControlDRT::PressedState;
break;
case ETS_FOCUSED:
ASSERT(classicState == dfcsNormal);
cstate = WebThemeControlDRT::FocusedState;
break;
case ETS_READONLY:
ASSERT(classicState == dfcsNormal);
cstate = WebThemeControlDRT::ReadOnlyState;
break;
default:
ASSERT_NOT_REACHED();
break;
}
drawTextField(canvas, rect, ctype, cstate, drawEdges, fillContentArea, color);
}
void WebThemeEngineDRT::paintTrackbar(WebCanvas* canvas,
int part,
int state,
int classicState,
const WebRect& rect)
{
WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
if (TKP_THUMBBOTTOM == part) {
ctype = WebThemeControlDRT::HorizontalSliderThumbType;
switch (state) {
case TUS_NORMAL:
ASSERT(classicState == dfcsNormal);
cstate = WebThemeControlDRT::NormalState;
break;
case TUS_HOT:
ASSERT(classicState == DFCS_HOT);
cstate = WebThemeControlDRT::HotState;
break;
case TUS_DISABLED:
ASSERT(classicState == DFCS_INACTIVE);
cstate = WebThemeControlDRT::DisabledState;
break;
case TUS_PRESSED:
ASSERT(classicState == DFCS_PUSHED);
cstate = WebThemeControlDRT::PressedState;
break;
default:
ASSERT_NOT_REACHED();
break;
}
} else if (TKP_TRACK == part) {
ctype = WebThemeControlDRT::HorizontalSliderTrackType;
ASSERT(part == TUS_NORMAL);
ASSERT(classicState == dfcsNormal);
cstate = WebThemeControlDRT::NormalState;
} else {
ASSERT_NOT_REACHED();
}
drawControl(canvas, rect, ctype, cstate);
}
void WebThemeEngineDRT::paintProgressBar(WebKit::WebCanvas* canvas,
const WebKit::WebRect& barRect,
const WebKit::WebRect& valueRect,
bool determinate,
double)
{
WebThemeControlDRT::Type ctype = WebThemeControlDRT::ProgressBarType;
WebThemeControlDRT::State cstate = determinate ? WebThemeControlDRT::NormalState
: WebThemeControlDRT::IndeterminateState;
drawProgressBar(canvas, ctype, cstate, barRect, valueRect);
}
| [
"[email protected]"
]
| [
[
[
1,
758
]
]
]
|
c83ce428c1f93e1435817c5a1a3a8040dd19949e | 989aa92c9dab9a90373c8f28aa996c7714a758eb | /HydraIRC/Plugins/Default/sysinfo.cpp | b85db619c3609903c751aef41afb3b41575b8eaf | []
| no_license | john-peterson/hydrairc | 5139ce002e2537d4bd8fbdcebfec6853168f23bc | f04b7f4abf0de0d2536aef93bd32bea5c4764445 | refs/heads/master | 2021-01-16T20:14:03.793977 | 2010-04-03T02:10:39 | 2010-04-03T02:10:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,786 | cpp | // sysinfo-console.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "sysinfo.h"
#include <windows.h>
char *osversion()
{
char buf[256];
strcpy(buf, "");
OSVERSIONINFOEX osvi;
BOOL bOsVersionInfoEx;
// Try calling GetVersionEx using the OSVERSIONINFOEX structure.
// If that fails, try using the OSVERSIONINFO structure.
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
{
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) )
return _strdup(buf);
}
switch (osvi.dwPlatformId)
{
// Test for the Windows NT product family.
case VER_PLATFORM_WIN32_NT:
// Test for the specific product family.
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
sprintf (buf+strlen(buf), "Microsoft Windows Server 2003 family, ");
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
sprintf (buf+strlen(buf), "Microsoft Windows XP ");
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
sprintf (buf+strlen(buf), "Microsoft Windows 2000 ");
if ( osvi.dwMajorVersion <= 4 )
sprintf (buf+strlen(buf), "Microsoft Windows NT ");
// Test for specific product on Windows NT 4.0 SP6 and later.
if( bOsVersionInfoEx )
{
// Test for the workstation type.
if ( osvi.wProductType == VER_NT_WORKSTATION )
{
if( osvi.dwMajorVersion == 4 )
sprintf (buf+strlen(buf), "Workstation 4.0 " );
else if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
sprintf (buf+strlen(buf), "Home Edition " );
else
sprintf (buf+strlen(buf), "Professional " );
}
// Test for the server type.
else if ( osvi.wProductType == VER_NT_SERVER )
{
if( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
sprintf (buf+strlen(buf), "Datacenter Edition " );
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
sprintf (buf+strlen(buf), "Enterprise Edition " );
else if ( osvi.wSuiteMask == VER_SUITE_BLADE )
sprintf (buf+strlen(buf), "Web Edition " );
else
sprintf (buf+strlen(buf), "Standard Edition " );
}
else if( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
sprintf (buf+strlen(buf), "Datacenter Server " );
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
sprintf (buf+strlen(buf), "Advanced Server " );
else
sprintf (buf+strlen(buf), "Server " );
}
else // Windows NT 4.0
{
if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
sprintf (buf+strlen(buf), "Server 4.0, Enterprise Edition " );
else
sprintf (buf+strlen(buf), "Server 4.0 " );
}
}
}
else // Test for specific product on Windows NT 4.0 SP5 and earlier
{
HKEY hKey;
char szProductType[BUFSIZE];
DWORD dwBufLen=BUFSIZE;
LONG lRet;
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
0, KEY_QUERY_VALUE, &hKey );
if( lRet != ERROR_SUCCESS )
return _strdup(buf);
lRet = RegQueryValueEx( hKey, "ProductType", NULL, NULL,
(LPBYTE) szProductType, &dwBufLen);
if( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE) )
return _strdup(buf);
RegCloseKey( hKey );
if ( lstrcmpi( "WINNT", szProductType) == 0 )
sprintf (buf+strlen(buf), "Workstation " );
if ( lstrcmpi( "LANMANNT", szProductType) == 0 )
sprintf (buf+strlen(buf), "Server " );
if ( lstrcmpi( "SERVERNT", szProductType) == 0 )
sprintf (buf+strlen(buf), "Advanced Server " );
printf( "%d.%d ", osvi.dwMajorVersion, osvi.dwMinorVersion );
}
// Display service pack (if any) and build number.
if( osvi.dwMajorVersion == 4 &&
lstrcmpi( osvi.szCSDVersion, "Service Pack 6" ) == 0 )
{
HKEY hKey;
LONG lRet;
// Test for SP6 versus SP6a.
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009",
0, KEY_QUERY_VALUE, &hKey );
if( lRet == ERROR_SUCCESS )
sprintf (buf+strlen(buf), "Service Pack 6a (Build %d)", osvi.dwBuildNumber & 0xFFFF );
else // Windows NT 4.0 prior to SP6a
{
sprintf (buf+strlen(buf), "%s (Build %d)",
osvi.szCSDVersion,
osvi.dwBuildNumber & 0xFFFF);
}
RegCloseKey( hKey );
}
else // Windows NT 3.51 and earlier or Windows 2000 and later
{
sprintf (buf+strlen(buf), "%s (Build %d)",
osvi.szCSDVersion,
osvi.dwBuildNumber & 0xFFFF);
}
break;
// Test for the Windows 95 product family.
case VER_PLATFORM_WIN32_WINDOWS:
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
{
sprintf (buf+strlen(buf), "Microsoft Windows 95 ");
if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' )
sprintf (buf+strlen(buf), "OSR2 " );
}
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
{
sprintf (buf+strlen(buf), "Microsoft Windows 98 ");
if ( osvi.szCSDVersion[1] == 'A' )
sprintf (buf+strlen(buf), "SE " );
}
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
{
sprintf (buf+strlen(buf), "Microsoft Windows Millennium Edition");
}
break;
case VER_PLATFORM_WIN32s:
sprintf (buf+strlen(buf), "Microsoft Win32s");
break;
}
return _strdup(buf);
}
char *cpuinfo()
{
char buf[256];
HKEY hKey;
LONG lRet;
DWORD dwBufLen = 256;
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
"Hardware\\Description\\System\\CentralProcessor\\0",
0, KEY_QUERY_VALUE, &hKey );
if( lRet == ERROR_SUCCESS ) {
lRet = RegQueryValueEx( hKey, "ProcessorNameString", NULL, NULL,
(LPBYTE)buf, &dwBufLen);
} else { // Windows NT 4.0 prior to SP6a
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
sprintf(buf, "%d%d", sysinfo.dwProcessorType, sysinfo.dwNumberOfProcessors);
}
RegCloseKey( hKey );
return _strdup(buf);
}
char *meminfo()
{
char buf[256];
MEMORYSTATUS memstatus;
GlobalMemoryStatus(&memstatus);
sprintf(buf, "Memory: %d/%d MB", (memstatus.dwTotalPhys-memstatus.dwAvailPhys)/(1024*1024), memstatus.dwTotalPhys/(1024*1024));
return _strdup(buf);
} | [
"hydra@b2473a34-e2c4-0310-847b-bd686bddb4b0"
]
| [
[
[
1,
221
]
]
]
|
3554687d6bf22cdd252857b9fdd3c02195f9affa | cf98fd401c09dffdd1e7b1aaa91615e9fe64961f | /tags/0.0.0/inc/util/comptr.h | d621b76c81deeb333268ea7df8848dd15cdb5251 | []
| no_license | BackupTheBerlios/bvr20983-svn | 77f4fcc640bd092c3aa85311fecfbea1a3b7677e | 4d177c13f6ec110626d26d9a2c2db8af7cb1869d | refs/heads/master | 2021-01-21T13:36:43.379562 | 2009-10-22T00:25:39 | 2009-10-22T00:25:39 | 40,663,412 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,144 | h | /*
* $Id$
*
* Copyright (C) 2008 Dorothea Wachmann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
#if !defined(COMPTR_H)
#define COMPTR_H
#include "os.h"
#include "util/comptrbase.h"
#include "exception/comexception.h"
namespace bvr20983
{
template <class ICom>
class GCOMPtr;
template <class ICom>
class COMPtr
{
public:
COMPtr(ICom* pIUnk=NULL) : m_pIUnk(NULL)
{ Init(pIUnk); }
COMPtr(REFIID clsId,REFIID riid,DWORD dwClsContext=CLSCTX_INPROC_SERVER,LPUNKNOWN pOutUnknown=NULL) : m_pIUnk(NULL)
{ ICom* pIUnk = NULL;
THROW_COMEXCEPTION( ::CoCreateInstance(clsId,pOutUnknown,dwClsContext,riid,(LPVOID*)&pIUnk) );
Init(pIUnk);
RELEASE_INTERFACE(pIUnk);
}
COMPtr(const GCOMPtr<ICom>& gCOMPtr) : m_pIUnk(NULL)
{ Init(gCOMPtr.GetPtr()); }
COMPtr(const COMPtr<ICom>& pIUnk) : m_pIUnk(NULL)
{ Init(pIUnk.m_pIUnk); }
~COMPtr()
{ Release(); }
void Release()
{
RELEASE_INTERFACE(m_pIUnk);
}
COMPtr<ICom>& operator=(const GCOMPtr<ICom>& gCOMPtr)
{ Init(gCOMPtr.GetPtr());
return *this;
}
COMPtr<ICom>& operator=(ICom* pIUnk)
{ Init(pIUnk);
return *this;
}
bool IsNULL() const
{ return m_pIUnk==NULL; }
operator ICom*()
{ return GetPtr(); }
ICom* operator->() const
{ ICom* result = GetPtr();
assert( NULL!=result );
return result;
}
ICom& operator*() const
{ ICom* result = GetPtr();
assert( NULL!=result );
return *result;
}
ICom** operator&()
{ Release();
return &m_pIUnk;
}
ICom* GetPtr() const
{ return m_pIUnk; }
bool operator==(const COMPtr<ICom>& rhs) const
{ return (this.m_pIUnk==NULL && rhs.m_pIUnk==NULL) || this.m_pIUnk==rhs.m_pIUnk; }
bool operator<(const COMPtr<ICom>& rhs) const
{ return (this.m_pIUnk==NULL && rhs.m_pIUnk!=NULL) || this.m_pIUnk<rhs.m_pIUnk; }
COMPtr<ICom>& operator=(const COMPtr<ICom>& pIUnk)
{ Init(pIUnk.m_pIUnk);
return *this;
}
private:
void Init(ICom* pIUnk)
{ ADDREF_INTERFACE( pIUnk );
Release();
m_pIUnk = pIUnk;
} // of Init()
ICom* m_pIUnk;
}; // of class COMPtr
template <class ICom>
class GCOMPtr : public GCOMPtrBase
{
public:
GCOMPtr(REFIID riid=IID_NULL) : m_iid(riid),m_cookie(0)
{ }
~GCOMPtr()
{ Release(); }
void Release()
{ if( m_cookie>0 )
{ assert( NULL!=m_gpGIT );
m_gpGIT->RevokeInterfaceFromGlobal(m_cookie);
} // of if
m_cookie = 0;
}
GCOMPtr<ICom>& operator=(const GCOMPtr<ICom>& pIUnk)
{ Init(pIUnk.m_cookie,pIUnk.m_iid);
return *this;
}
GCOMPtr<ICom>& operator=(ICom* pIUnk)
{ Init(pIUnk,m_iid);
return *this;
}
bool operator==(const GCOMPtr<ICom>& rhs) const
{ return this.m_cookie==rhs.m_cookie; }
bool operator<(const GCOMPtr<ICom>& rhs) const
{ return this.m_cookie<rhs.m_cookie; }
bool IsNULL() const
{ return m_cookie==0; }
DWORD GetCookie() const
{ return m_cookie; }
void SetIID(REFIID riid)
{ m_iid = riid; }
friend class COMPtr<ICom>;
private:
ICom* GetPtr() const
{ assert( NULL!=m_gpGIT && m_iid!=IID_NULL );
ICom* result = NULL;
if( m_cookie>0 )
THROW_COMEXCEPTION( m_gpGIT->GetInterfaceFromGlobal(m_cookie,m_iid,(LPVOID*)&result) );
return result;
} // of GetPtr();
void Init(ICom* pIUnk,REFIID riid)
{ if( NULL!=pIUnk && m_iid!=IID_NULL )
{ DWORD cookie = 0;
THROW_COMEXCEPTION( m_gpGIT->RegisterInterfaceInGlobal(pIUnk,riid,&cookie) );
Release();
m_iid = riid;
m_cookie = cookie;
} // of if
} // of Init()
void Init(DWORD cookie,REFIID riid)
{ Release();
m_cookie = cookie;
m_iid = riid;
} // of Init()
DWORD m_cookie;
IID m_iid;
}; // of class GCOMPtr
} // of namespace bvr20983
#endif // COMPTR_H
//=================================END-OF-FILE==============================
| [
"dwachmann@01137330-e44e-0410-aa50-acf51430b3d2"
]
| [
[
[
1,
215
]
]
]
|
7665b7c6e5ed261b302df5723126c599363be259 | 0468c65f767387da526efe03b37e1d6e8ddd1815 | /source/drivers/caanoo/config.cpp | 277e366b6a4abf845d0057898b72c2b81e44b92e | []
| no_license | arntsonl/fc2x | aadc4e1a6c4e1d5bfcc76a3815f1f033b2d7e2fd | 57ffbf6bcdf0c0b1d1e583663e4466adba80081b | refs/heads/master | 2021-01-13T02:22:19.536144 | 2011-01-11T22:48:58 | 2011-01-11T22:48:58 | 32,103,729 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,096 | cpp | #include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include "main.h"
//#include "throttle.h"
#include "config.h"
#include "../common/cheat.h"
#include "../../types.h"
#include "input.h"
#include "dface.h"
/*
#include "sdl.h"
#include "sdl-video.h"
#include "unix-netplay.h"
*/
/**
* Read a custom pallete from a file and load it into the core.
*/
int
LoadCPalette(const std::string &file)
{
uint8 tmpp[192];
FILE *fp;
if(!(fp = FCEUD_UTF8fopen(file.c_str(), "rb"))) {
printf(" Error loading custom palette from file: %s\n", file.c_str());
return 0;
}
size_t result = fread(tmpp, 1, 192, fp);
if(result != 192) {
printf(" Error reading custom palette from file: %s\n", file.c_str());
return 0;
}
FCEUI_SetPaletteArray(tmpp);
fclose(fp);
return 1;
}
/**
* Creates the subdirectories used for saving snapshots, movies, game
* saves, etc. Hopefully obsolete with new configuration system.
*/
static void
CreateDirs(const std::string &dir)
{
char *subs[7]={"fcs","snaps","gameinfo","sav","cheats","movies"};
std::string subdir;
int x;
mkdir(dir.c_str(), S_IRWXU);
for(x = 0; x < 6; x++) {
subdir = dir + PSS + subs[x];
mkdir(subdir.c_str(), S_IRWXU);
}
}
/**
* Attempts to locate FCEU's application directory. This will
* hopefully become obsolete once the new configuration system is in
* place.
*/
static void
GetBaseDirectory(std::string &dir)
{
char *home = getenv("HOME");
if(home) {
dir = std::string(home) + "/.fceux";
} else {
dir = "";
}
}
Config * InitConfig()
{
std::string dir, prefix;
Config *config;
GetBaseDirectory(dir);
FCEUI_SetBaseDirectory(dir.c_str());
CreateDirs(dir);
config = new Config(dir);
// sound options
config->addOption('s', "sound", "Caanoo.Sound", 1);
config->addOption("volume", "Caanoo.Sound.Volume", 150);
config->addOption("trianglevol", "Caanoo.Sound.TriangleVolume", 256);
config->addOption("square1vol", "Caanoo.Sound.Square1Volume", 256);
config->addOption("square2vol", "Caanoo.Sound.Square2Volume", 256);
config->addOption("noisevol", "Caanoo.Sound.NoiseVolume", 256);
config->addOption("pcmvol", "Caanoo.Sound.PCMVolume", 256);
config->addOption("soundrate", "Caanoo.Sound.Rate", 44100);
config->addOption("soundq", "Caanoo.Sound.Quality", 1);
config->addOption("soundrecord", "Caanoo.Sound.RecordFile", "");
config->addOption("soundbufsize", "Caanoo.Sound.BufSize", 128);
config->addOption("lowpass", "Caanoo.Sound.LowPass", 0);
config->addOption('g', "gamegenie", "Caanoo.GameGenie", 0);
config->addOption("pal", "Caanoo.PAL", 0);
config->addOption("frameskip", "Caanoo.Frameskip", 0);
config->addOption("clipsides", "Caanoo.ClipSides", 0);
config->addOption("nospritelim", "Caanoo.DisableSpriteLimit", 1);
// color control
config->addOption('p', "palette", "Caanoo.Palette", "");
config->addOption("tint", "Caanoo.Tint", 56);
config->addOption("hue", "Caanoo.Hue", 72);
config->addOption("ntsccolor", "Caanoo.NTSCpalette", 0);
// scanline settings
config->addOption("slstart", "Caanoo.ScanLineStart", 0);
config->addOption("slend", "Caanoo.ScanLineEnd", 239);
// video controls
config->addOption('x', "xres", "Caanoo.XResolution", 512);
config->addOption('y', "yres", "Caanoo.YResolution", 448);
config->addOption('f', "fullscreen", "Caanoo.Fullscreen", 0);
config->addOption('b', "bpp", "Caanoo.BitsPerPixel", 32);
config->addOption("doublebuf", "Caanoo.DoubleBuffering", 0);
config->addOption("autoscale", "Caanoo.AutoScale", 1);
config->addOption("keepratio", "Caanoo.KeepRatio", 1);
config->addOption("xscale", "Caanoo.XScale", 1.0);
config->addOption("yscale", "Caanoo.YScale", 1.0);
config->addOption("xstretch", "Caanoo.XStretch", 0);
config->addOption("ystretch", "Caanoo.YStretch", 0);
config->addOption("noframe", "Caanoo.NoFrame", 0);
config->addOption("special", "Caanoo.SpecialFilter", 0);
/*
// network play options - netplay is broken
config->addOption("server", "SDL.NetworkIsServer", 0);
config->addOption('n', "net", "SDL.NetworkIP", "");
config->addOption('u', "user", "SDL.NetworkUsername", "");
config->addOption('w', "pass", "SDL.NetworkPassword", "");
config->addOption('k', "netkey", "SDL.NetworkGameKey", "");
config->addOption("port", "SDL.NetworkPort", 4046);
config->addOption("players", "SDL.NetworkPlayers", 1);
*/
// input configuration options
config->addOption("input1", "Caanoo.Input.0", "GamePad.0");
config->addOption("input2", "Caanoo.Input.1", "GamePad.1");
config->addOption("input3", "Caanoo.Input.2", "Gamepad.2");
config->addOption("input4", "Caanoo.Input.3", "Gamepad.3");
// allow for input configuration
config->addOption('i', "inputcfg", "Caanoo.InputCfg", InputCfg);
// display input
config->addOption("inputdisplay", "Caanoo.InputDisplay", 0);
// pause movie playback at frame x
config->addOption("pauseframe", "Caanoo.PauseFrame", 0);
config->addOption("moviemsg", "Caanoo.MovieMsg", 1);
// overwrite the config file?
config->addOption("no-config", "Caanoo.NoConfig", 0);
// video playback
config->addOption("playmov", "Caanoo.Movie", "");
config->addOption("subtitles", "Caanoo.SubtitleDisplay", 1);
config->addOption("fourscore", "Caanoo.FourScore", 0);
// fcm -> fm2 conversion
config->addOption("fcmconvert", "Caanoo.FCMConvert", "");
// fm2 -> srt conversion
config->addOption("ripsubs", "Caanoo.RipSubs", "");
// enable new PPU core
config->addOption("newppu", "Caanoo.NewPPU", 0);
// GamePad 0 - 3
for(unsigned int i = 0; i < GAMEPAD_NUM_DEVICES; i++) {
char buf[64];
snprintf(buf, 20, "Caanoo.Input.GamePad.%d.", i);
prefix = buf;
config->addOption(prefix + "DeviceType", DefaultGamePadDevice[i]);
config->addOption(prefix + "DeviceNum", 0);
for(unsigned int j = 0; j < GAMEPAD_NUM_BUTTONS; j++) {
config->addOption(prefix + GamePadNames[j], DefaultGamePad[i][j]);
}
}
// PowerPad 0 - 1
for(unsigned int i = 0; i < POWERPAD_NUM_DEVICES; i++) {
char buf[64];
snprintf(buf, 20, "Caanoo.Input.PowerPad.%d.", i);
prefix = buf;
config->addOption(prefix + "DeviceType", DefaultPowerPadDevice[i]);
config->addOption(prefix + "DeviceNum", 0);
for(unsigned int j = 0; j < POWERPAD_NUM_BUTTONS; j++) {
config->addOption(prefix +PowerPadNames[j], DefaultPowerPad[i][j]);
}
}
// QuizKing
prefix = "Caanoo.Input.QuizKing.";
config->addOption(prefix + "DeviceType", DefaultQuizKingDevice);
config->addOption(prefix + "DeviceNum", 0);
for(unsigned int j = 0; j < QUIZKING_NUM_BUTTONS; j++) {
config->addOption(prefix + QuizKingNames[j], DefaultQuizKing[j]);
}
// HyperShot
prefix = "Caanoo.Input.HyperShot.";
config->addOption(prefix + "DeviceType", DefaultHyperShotDevice);
config->addOption(prefix + "DeviceNum", 0);
for(unsigned int j = 0; j < HYPERSHOT_NUM_BUTTONS; j++) {
config->addOption(prefix + HyperShotNames[j], DefaultHyperShot[j]);
}
// Mahjong
prefix = "Caanoo.Input.Mahjong.";
config->addOption(prefix + "DeviceType", DefaultMahjongDevice);
config->addOption(prefix + "DeviceNum", 0);
for(unsigned int j = 0; j < MAHJONG_NUM_BUTTONS; j++) {
config->addOption(prefix + MahjongNames[j], DefaultMahjong[j]);
}
// TopRider
prefix = "Caanoo.Input.TopRider.";
config->addOption(prefix + "DeviceType", DefaultTopRiderDevice);
config->addOption(prefix + "DeviceNum", 0);
for(unsigned int j = 0; j < TOPRIDER_NUM_BUTTONS; j++) {
config->addOption(prefix + TopRiderNames[j], DefaultTopRider[j]);
}
// FTrainer
prefix = "Caanoo.Input.FTrainer.";
config->addOption(prefix + "DeviceType", DefaultFTrainerDevice);
config->addOption(prefix + "DeviceNum", 0);
for(unsigned int j = 0; j < FTRAINER_NUM_BUTTONS; j++) {
config->addOption(prefix + FTrainerNames[j], DefaultFTrainer[j]);
}
// FamilyKeyBoard
prefix = "Caanoo.Input.FamilyKeyBoard.";
config->addOption(prefix + "DeviceType", DefaultFamilyKeyBoardDevice);
config->addOption(prefix + "DeviceNum", 0);
for(unsigned int j = 0; j < FAMILYKEYBOARD_NUM_BUTTONS; j++) {
config->addOption(prefix + FamilyKeyBoardNames[j],
DefaultFamilyKeyBoard[j]);
}
// for FAMICOM microphone in pad 2 pad 1 didn't have it
// Takeshi no Chousenjou uses it for example.
prefix = "Caanoo.Input.FamicomPad2.";
config->addOption("rp2mic", prefix + "EnableMic", 0);
/*
const int Hotkeys[HK_MAX] = {
SDLK_F1, // cheat menu
SDLK_F2, // bind state
SDLK_F3, // load lua
SDLK_F4, // toggleBG
SDLK_F5, // save state
SDLK_F6, // fds select
SDLK_F7, // load state
SDLK_F8, // fds eject
SDLK_F6, // VS insert coin
SDLK_F8, // VS toggle dipswitch
SDLK_PERIOD, // toggle frame display
SDLK_F10, // toggle subtitle
SDLK_F11, // reset
SDLK_F12, // screenshot
SDLK_PAUSE, // pause
SDLK_MINUS, // speed++
SDLK_EQUALS, // speed--
SDLK_BACKSLASH, //frame advnace
SDLK_TAB, // turbo
SDLK_COMMA, // toggle input display
SDLK_q, // toggle movie RW
SDLK_QUOTE, // toggle mute capture
0, // quit
SDLK_DELETE, // frame advance lag skip
SDLK_SLASH, // lag counter display
SDLK_0, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5,
SDLK_6, SDLK_7, SDLK_8, SDLK_9};
prefix = "SDL.Hotkeys.";
for(int i=0; i < HK_MAX; i++)
config->addOption(prefix + HotkeyStrings[i], Hotkeys[i]);
*/
// All mouse devices
config->addOption("Caanoo.OekaKids.0.DeviceType", "Mouse");
config->addOption("Caanoo.OekaKids.0.DeviceNum", 0);
config->addOption("Caanoo.Arkanoid.0.DeviceType", "Mouse");
config->addOption("Caanoo.Arkanoid.0.DeviceNum", 0);
config->addOption("Caanoo.Shadow.0.DeviceType", "Mouse");
config->addOption("Caanoo.Shadow.0.DeviceNum", 0);
config->addOption("Caanoo.Zapper.0.DeviceType", "Mouse");
config->addOption("Caanoo.Zapper.0.DeviceNum", 0);
return config;
}
void UpdateEMUCore(Config *config)
{
FCEUI_SetNTSCTH(0, 56, 72);
FCEUI_SetVidSystem(0); // NTSC = 0, PAL = 1
FCEUI_SetGameGenie(0);
FCEUI_SetLowPass(0);
FCEUI_DisableSpriteLimitation(1);
FCEUI_SetRenderedLines(8, 231, 0, 239);
}
| [
"Cthulhu32@e9098629-9c10-95be-0fa9-336bad66c20b"
]
| [
[
[
1,
327
]
]
]
|
f311c12a01a2ddff86379e02c4b3178cb99146f6 | 1d693dd1b12b23c72dd0bb12a3fc29ed88a7e2d5 | /src/nbpflcompiler/optconstprop.cpp | 12f81537bf2a14d909bab985309668a27ad16225 | []
| no_license | rrdenicol/Netbee | 8765ebc2db4ba9bd27c2263483741b409da8300a | 38edb4ffa78b8fb7a4167a5d04f40f8f4466be3e | refs/heads/master | 2021-01-16T18:42:17.961177 | 2011-12-26T20:27:03 | 2011-12-26T20:27:03 | 3,053,086 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,855 | cpp | /*****************************************************************************/
/* */
/* Copyright notice: please read file license.txt in the NetBee root folder. */
/* */
/*****************************************************************************/
#include "optconstprop.h"
#include "dump.h"
bool operator==(const DefPoint &left, const DefPoint &right)
{
if (left.Def != right.Def)
return false;
if (left.BB != right.BB)
return false;
if (left.Value != right.Value)
return false;
return true;
}
bool operator<(const DefPoint &left, const DefPoint &right)
{
if (left.Def >= right.Def)
return false;
if (left.BB >= right.BB)
return false;
if (left.Value >= right.Value)
return false;
return true;
}
OptConstantPropagation::OptConstantPropagation(CFG &cfg, IRCodeGen &codegen, uint32 nvars)
:m_CFG(cfg), m_NVars(nvars), m_CodeGen(codegen), m_Changed(0), m_TreeOpt(codegen)
{
uint32 numBB = cfg.GetBBCount();
m_BBDefsInfo = new BBInfo[numBB];
if (m_BBDefsInfo == NULL)
throw ErrorInfo(ERR_FATAL_ERROR, "MEMORY ALLOCATION FAILURE");
for (uint32 i=0; i < numBB; i++)
m_BBDefsInfo[i].Init(nvars);
}
void OptConstantPropagation::Apply(void)
{
CFGVisitor visitor(*this);
m_Changed = 0;
visitor.VisitRevPostOrder(m_CFG);
}
void OptConstantPropagation::MergeBBInfoIn(BBInfo &dst, BBInfo &src)
{
(*dst.Reach) |= (*src.Reach);
for(uint32 i = 0; i < m_NVars; i++)
{
dst.Defs[i].merge(src.Defs[i]);
}
}
void OptConstantPropagation::VisitBasicBlock(BasicBlock *bb, BasicBlock *comingFrom)
{
//cout << "Visiting bb " << bb->StartLabel->Name << endl;
list<BasicBlock*> pred;
m_CFG.GetPredecessors(bb, pred);
m_BBDefsInfo[bb->ID].Reset();
list<BasicBlock*>::iterator i = pred.begin();
for (i; i != pred.end(); i++)
{
MergeBBInfoIn(m_BBDefsInfo[bb->ID], m_BBDefsInfo[(*i)->ID]);
}
//cout << "Vars that are constants: " << m_BBDefsInfo[bb->ID].Reach->ToString() << endl;
StmtBase *stmt = bb->Code.Front();
CodeWriter cw(cout);
while (stmt)
{
uint32 defvar = 0;
if (!(stmt->Flags & STMT_FL_DEAD))
{
/*
printf("Stmt before: ");
cw.DumpStatement(stmt);
cout<<endl;
cout.flush();
*/
GetStmtDef(stmt, m_BBDefsInfo[bb->ID]);
/*
printf("Stmt after: ");
cw.DumpStatement(stmt);
cout << endl<<endl;
cout.flush();
*/
}
stmt = stmt->Next;
}
}
bool OptConstantPropagation::GetStmtDef(StmtBase *stmt, BBInfo &bbinfo)
{
CodeWriter cw(cout);
uint32 var = 0;
if (stmt->Forest == NULL)
return false;
m_TreeOpt.OptimizeTree(stmt->Forest);
/*
printf(" Stmt after tree optimizations: ");
cw.DumpStatement(stmt);
cout << endl;
cout.flush();
*/
GetStmtRefs(stmt, bbinfo);
/*
printf(" Stmt after const prop: ");
cw.DumpStatement(stmt);
cout << endl;
cout.flush();
*/
if (stmt->Forest != NULL)
m_TreeOpt.OptimizeTree(stmt->Forest);
/*
printf(" Stmt after tree optimizations: ");
cw.DumpStatement(stmt);
cout << endl;
cout.flush();
*/
if (stmt->Forest->Op == LOCST)
{
Node *node = stmt->Forest->GetLeftChild();
nbASSERT(node != NULL, "node should not be null");
var = ((SymbolTemp*)stmt->Forest->Sym)->Temp;
if (node->IsConst())
{
bbinfo.GenDef(var, node->Value, stmt);
return true;
}
bbinfo.KillDef(var);
return false;
}
return false;
}
void OptConstantPropagation::GetStmtRefs(StmtBase *stmt, BBInfo &bbinfo)
{
if (stmt->Forest)
stmt->Forest = GetTreeRefs(stmt->Forest, bbinfo);
}
Node *OptConstantPropagation::GetTreeRefs(Node *node, BBInfo &bbinfo)
{
Node *leftnode = node->GetLeftChild();
if (leftnode)
node->SetLeftChild(GetTreeRefs(leftnode, bbinfo));
Node *rightnode = node->GetRightChild();
if (rightnode)
node->SetRightChild(GetTreeRefs(rightnode, bbinfo));
if (node->Op == LOCLD)
{
uint32 var = ((SymbolTemp*)node->Sym)->Temp;
if (bbinfo.Reach->Test(var) && bbinfo.Defs[var].size() == 1)
{
//the variable is a constant!!!
DefPoint &defpt = bbinfo.Defs[var].front();
Node *newNode = m_CodeGen.TermNode(PUSH, defpt.Value);
if (newNode == NULL)
throw ErrorInfo(ERR_FATAL_ERROR, "MEMORY ALLOCATION FAILURE");
/*
TODO [OM] (FIXME) the following is not always correct
We should eliminate the original statement only if the variable that is constant is not
live-out of the current statement!!!
*/
//defpt.Def->Flags = STMT_FL_DEAD;
m_Changed = true;
delete node;
return newNode;
}
}
return node;
}
void OptConstantPropagation::VisitBBEdge(BasicBlock *from, BasicBlock *to)
{
}
| [
"[email protected]"
]
| [
[
[
1,
200
]
]
]
|
2cdadbe4726bf8ca89c729de990e08b2b0c7f8c9 | 6c8c4728e608a4badd88de181910a294be56953a | /EnvironmentModule/Water.cpp | 7959d049698bfbcf7e9235ccf10e903c1abaeff2 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | caocao/naali | 29c544e121703221fe9c90b5c20b3480442875ef | 67c5aa85fa357f7aae9869215f840af4b0e58897 | refs/heads/master | 2021-01-21T00:25:27.447991 | 2010-03-22T15:04:19 | 2010-03-22T15:04:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,818 | cpp | // For conditions of distribution and use, see copyright notice in license.txt
/// @file Water.cpp
/// @brief Manages Water-related Rex logic.
#include "StableHeaders.h"
#include "Water.h"
#include "EnvironmentModule.h"
// Ogre renderer -specific.
#include <OgreManualObject.h>
#include <OgreSceneManager.h>
#include <OgreMaterialManager.h>
#include <OgreTextureManager.h>
#include <OgreIteratorWrappers.h>
#include <OgreTechnique.h>
#include "EC_OgrePlaceable.h"
#include "Renderer.h"
#include "OgreTextureResource.h"
#include "OgreMaterialUtils.h"
#include "SceneManager.h"
#include "EC_Water.h"
namespace Environment
{
Water::Water(EnvironmentModule *owner) :
owner_(owner), activeWaterComponent_(0)
{
}
Water::~Water()
{
// Does not own.
activeWaterEntity_.reset();
activeWaterComponent_ = 0;
owner_ = 0;
}
Scene::EntityWeakPtr Water::GetActiveWater()
{
Scene::ScenePtr scene = owner_->GetFramework()->GetDefaultWorldScene();
// Check that is current water entity still valid.
if ( !activeWaterEntity_.expired() )
if(scene->GetEntity(activeWaterEntity_.lock()->GetId()).get() != 0)
return activeWaterEntity_;
// Current is not valid so search new, takes first entity which has water
for(Scene::SceneManager::iterator iter = scene->begin();
iter != scene->end(); ++iter)
{
Scene::Entity &entity = **iter;
activeWaterComponent_ = entity.GetComponent<EC_Water>().get();
if (activeWaterComponent_ != 0)
{
activeWaterEntity_ = scene->GetEntity(entity.GetId());
if ( !activeWaterEntity_.expired())
return activeWaterEntity_;
}
}
// There was any water entity so reset it to null state.
activeWaterEntity_.reset();
activeWaterComponent_ = 0;
return Scene::EntityWeakPtr();
}
Scene::EntityWeakPtr Water::GetWaterEntity()
{
// Find currently active water entity
return GetActiveWater();
}
void Water::CreateWaterGeometry(float height)
{
// Here we assume that there is only one water in one scene (and it is ocean).
if ( !GetActiveWater().expired())
RemoveWaterGeometry();
Scene::ScenePtr active_scene = owner_->GetFramework()->GetDefaultWorldScene();
Scene::EntityPtr entity = active_scene->CreateEntity(active_scene->GetNextFreeId());
entity->AddComponent(owner_->GetFramework()->GetComponentManager()->CreateComponent(EC_Water::NameStatic()));
activeWaterComponent_ = entity->GetComponent<EC_Water>().get();
activeWaterComponent_->SetWaterHeight(height);
activeWaterEntity_ = entity;
emit WaterCreated();
}
void Water::RemoveWaterGeometry()
{
// Adjust that we are removing correct water
if( GetActiveWater().expired())
return;
// Remove component
if ( activeWaterComponent_ != 0)
{
Scene::EntityPtr entity = activeWaterEntity_.lock();
entity->RemoveComponent(entity->GetComponent(EC_Water::NameStatic()));
activeWaterComponent_ = 0;
}
// Remove entity from scene
Scene::ScenePtr active_scene = owner_->GetFramework()->GetDefaultWorldScene();
active_scene->RemoveEntity(activeWaterEntity_.lock()->GetId());
activeWaterEntity_.reset();
emit WaterRemoved();
}
void Water::SetWaterHeight(float height)
{
if (activeWaterComponent_ != 0)
{
activeWaterComponent_->SetWaterHeight(height);
emit HeightChanged(static_cast<double>(height));
}
}
float Water::GetWaterHeight() const
{
float height = 0.0;
if (activeWaterComponent_ != 0)
height = activeWaterComponent_->GetWaterHeight();
return height;
}
}
| [
"jaakkoallander@5b2332b8-efa3-11de-8684-7d64432d61a3",
"jjj@5b2332b8-efa3-11de-8684-7d64432d61a3",
"cadaver@5b2332b8-efa3-11de-8684-7d64432d61a3",
"cmayhem@5b2332b8-efa3-11de-8684-7d64432d61a3",
"tuoki@5b2332b8-efa3-11de-8684-7d64432d61a3",
"joosuav@5b2332b8-efa3-11de-8684-7d64432d61a3",
"loorni@5b2332b8-efa3-11de-8684-7d64432d61a3"
]
| [
[
[
1,
2
],
[
7,
8
],
[
28,
28
],
[
120,
120
],
[
137,
137
]
],
[
[
3,
6
],
[
9,
17
],
[
26,
27
],
[
30,
34
],
[
39,
40
],
[
42,
42
],
[
54,
55
],
[
72,
75
],
[
78,
79
],
[
81,
81
],
[
83,
83
],
[
88,
88
],
[
115,
115
],
[
117,
118
]
],
[
[
18,
21
]
],
[
[
22,
22
],
[
53,
53
],
[
56,
56
]
],
[
[
23,
24
],
[
29,
29
],
[
35,
38
],
[
41,
41
],
[
44,
52
],
[
58,
71
],
[
76,
77
],
[
80,
80
],
[
82,
82
],
[
84,
87
],
[
91,
106
],
[
108,
114
],
[
116,
116
],
[
119,
119
],
[
121,
136
]
],
[
[
25,
25
],
[
43,
43
]
],
[
[
57,
57
],
[
89,
90
],
[
107,
107
]
]
]
|
028ac333d95d4ba9df9c72aa57ca58460874e311 | 01c394a7798fbb5f5033f5e0d40924e5ecdc894c | /srcMisc/verb.h | 4c94d53fe87f5803bd78a8b1bb2883d5fab785db | []
| no_license | padenot/redverb | 977d30331aefbf5c4d6bc6b34aeb4bae3c5bdbd9 | 41ab90c5f5ac20e76fd49150d31c8a9f1b3af486 | refs/heads/master | 2016-09-06T04:41:03.966969 | 2010-05-07T14:22:24 | 2010-05-07T14:22:24 | 655,066 | 16 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,146 | h | #ifndef __VERB__H
#define __VERB__H
#include "public.sdk/source/vst2.x/audioeffectx.h"
const char* progName = "Verb";
class Verb : public AudioEffectX
{
public:
Verb (audioMasterCallback audioMaster);
~Verb ();
// Processing
virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
// Program
virtual void setProgramName (char* name);
virtual void getProgramName (char* name);
// Parameters
virtual void setParameter (VstInt32 index, float value);
virtual float getParameter (VstInt32 index);
virtual void getParameterLabel (VstInt32 index, char* label);
virtual void getParameterDisplay (VstInt32 index, char* text);
virtual void getParameterName (VstInt32 index, char* text);
virtual bool getEffectName (char* name);
virtual bool getVendorString (char* text);
virtual bool getProductString (char* text);
virtual VstInt32 getVendorVersion ();
protected:
std::vector<Impulse> impulses;
float fGain;
char programName[kVstMaxProgNameLen + 1];
};
#endif
| [
"3voker@6d733ef2-e500-11de-8dea-4d08a2fd72f5"
]
| [
[
[
1,
39
]
]
]
|
c10bdac0254d20b9f95fbaac823ed4b08270efbc | 6477cf9ac119fe17d2c410ff3d8da60656179e3b | /Projects/openredalert/src/game/MissionMapsClass.h | f31b1d8f37414b1b80caf3334f70adba3a7560aa | []
| no_license | crutchwalkfactory/motocakerteam | 1cce9f850d2c84faebfc87d0adbfdd23472d9f08 | 0747624a575fb41db53506379692973e5998f8fe | refs/heads/master | 2021-01-10T12:41:59.321840 | 2010-12-13T18:19:27 | 2010-12-13T18:19:27 | 46,494,539 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,317 | h | // MissionMapsClass.h
// 1.2
// This file is part of OpenRedAlert.
//
// OpenRedAlert is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2 of the License.
//
// OpenRedAlert is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with OpenRedAlert. If not, see <http://www.gnu.org/licenses/>.
#ifndef MISSIONMAPSCLASS_H
#define MISSIONMAPSCLASS_H
#include <string>
#include <vector>
#include "SDL/SDL_types.h"
using std::string;
using std::vector;
/**
* Mission map class
*/
class MissionMapsClass {
public:
MissionMapsClass();
string getGdiMissionMap(Uint32 missionNumber);
string getNodMissionMap(Uint32 missionNumber);
private:
void readMissionData();
vector<string> Mapdata;
vector<string> NodMissionMaps;
vector<string> GdiMissionMaps;
vector<string> MissionBriefing;
vector<string> MultiPlayerMapNames;
};
#endif //MISSIONMAPSCLASS_H
| [
"[email protected]"
]
| [
[
[
1,
49
]
]
]
|
4d994401a891db02edf3890b32bfecb3d921405c | 27651c3f5f829bff0720d7f835cfaadf366ee8fa | /QBluetooth/Connection/ObjectExchange/Server/Impl/QBtObjectExchangeServer_stub.cpp | c27fddd0e5136a221db9a2f7a210692c197243c8 | [
"LicenseRef-scancode-warranty-disclaimer"
]
| no_license | cpscotti/Push-Snowboarding | 8883907e7ee2ddb9a013faf97f2d9673b9d0fad5 | cc3cc940292d6d728865fe38018d34b596943153 | refs/heads/master | 2021-05-27T16:35:49.846278 | 2011-07-08T10:25:17 | 2011-07-08T10:25:17 | 1,395,155 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,135 | cpp | /*
* QBtObjectExchangeServer_stub.cpp
*
*
* Author: Ftylitakis Nikolaos
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../QBtObjectExchangeServer_stub.h"
QBtObjectExchangeServerPrivate::QBtObjectExchangeServerPrivate(
QBtObjectExchangeServer* publicClass) : p_ptr(publicClass)
{
}
QBtObjectExchangeServerPrivate::~QBtObjectExchangeServerPrivate()
{
}
bool QBtObjectExchangeServerPrivate::StartServer()
{
return false;
}
void QBtObjectExchangeServerPrivate::Disconnect()
{
}
bool QBtObjectExchangeServerPrivate::IsConnected()
{
return false;
}
| [
"cpscotti@c819a03f-852d-4de4-a68c-c3ac47756727"
]
| [
[
[
1,
43
]
]
]
|
33de79e62ace80a7f564a90e4fd31d4b90df5714 | b816fdbc7bb0da01eb39346b9b787c028791afec | /Project Panda/src/mechanics/temperature/TemperatureMechanics.cpp | 132baadab56c9ef7be75f0fdf855ee9e622f6301 | []
| no_license | martinpinto/Project-Panda | 0537feac43574ae3453d0228638fed7015a44116 | f1db30b885a7557e59974323035e3a411072f060 | refs/heads/master | 2021-01-25T12:19:27.325670 | 2011-11-19T17:54:12 | 2011-11-19T17:54:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 370 | cpp | /*
* TemperatureMechanics.cpp
*
* Created on: 24.10.2011
* Author: Martin Pinto-Bazurco
*
*/
#include <iostream>
#include <vector>
#include "TemperatureMechanics.h"
TemperatureMechanics::TemperatureMechanics() {
}
TemperatureMechanics::TemperatureMechanics(Character character) {
}
TemperatureMechanics::~TemperatureMechanics() {
}
| [
"[email protected]"
]
| [
[
[
1,
24
]
]
]
|
eb787b037566d5fb6f9478ee35c7744d6e71da7f | 5e2b72b494c5eec0cc74e26e89619089014f097a | /dynamicObject.cpp | b483636b4a736b6bbd00634b76f9d3a26ceead0e | []
| no_license | capaca/Destroyer3D | caeb57f05ff0857a630eb2cd94983e4fa81cae24 | 72a66594c696b502dc0aaf7fb8444ebde709a7b8 | refs/heads/master | 2021-01-18T18:17:48.943523 | 2009-06-16T20:47:08 | 2009-06-16T20:47:08 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 16,677 | cpp | //===========================================================================
/*
\author: <http://www.chai3d.org>
\author: Remis Balaniuk
\version 1.1
\date 10/2005
*/
//===========================================================================
//---------------------------------------------------------------------------
#pragma hdrstop
#include "dynamicObject.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
cVector3d global2LocalPosition(cVector3d globalPosition, cMatrix3d rot, cVector3d pos);
cVector3d localtoGlobalPosition(cVector3d localPosition, cMatrix3d rot, cVector3d pos);
cVector3d computeNormal(cTriangle *tri) {
cVector3d verts[3];
verts[0]=tri->getVertex0()->getGlobalPos();
verts[1]=tri->getVertex1()->getGlobalPos();
verts[2]=tri->getVertex2()->getGlobalPos();
// compute normal vector
cVector3d normal, v01, v02;
verts[1].subr(verts[0], v01);
verts[2].subr(verts[0], v02);
v01.crossr(v02, normal);
if(normal.length()>0)
normal.normalize();
return normal;
}
dynamicObject::dynamicObject(dynamicWorld *world, double imass, bool irigid):
cMesh(world) {
myworld = world;
mass = imass;
rigid=irigid;
inertiaMatrix.identity();
inertiaMatrixInv.identity();
force.zero();
torque.zero();
acceleration.zero();
angAcceleration.zero();
velocity.zero();
angularVelocity.zero();
testPoints.clear();
clear();
restitution = 0;
noGravityStep = false;
collisionDetectionUseVertices = true;
}
// init should be called by the subclass constructor once the mesh was created
void dynamicObject::init() {
centerOfMass = getCenterOfMass();
computeBoundaryBox(true);
computeAllNormals(true);
createSphereTreeCollisionDetector(true,true);
// compute the collision test points
computeTestPoints();
}
void dynamicObject::computeTestPoints() {
double radius = cDistance(getBoundaryMax(),getBoundaryMin())/2.0;
double angle1,angle2,steps=TESTCOLLISIONSLICES/2.0;
int i,j,quadrante;
cVector3d direction;
for(i=0;i<steps;i++) {
quadrante=0;
angle1=i*0.5*3.1416/steps;
direction.x=sin(angle1)*radius;
for(j=0;j<(steps-i)*4;j++) {
angle2=j*0.5*3.1416/(steps-i);
direction.z=sin(angle2)*cos(angle1)*radius;
direction.y=cos(angle2)*cos(angle1)*radius;
createTestPoint(direction);
if(i>0) {
// repeat for the other hemisphere
cVector3d inverso = direction;
inverso.x*=-1.0;
createTestPoint(inverso);
}
}
}
}
void dynamicObject:: createTestPoint(cVector3d direction) {
cVector3d colPoint,segmA = cAdd(centerOfMass,direction);
cGenericObject *obj;
cTriangle *tri;
double dist=BIGNUMBER;
// projects a point on the object surface following a direction
// from the center passed as input
computeCollisionDetection(segmA,centerOfMass, obj, tri, colPoint,dist, true, -1);
testPoints.push_back(colPoint);
}
bool dynamicObject::testCollision(cMesh *otherOne, cVector3d& contactNormal, cVector3d& contactPoint, double& penetration,cGenericObject **touched) {
int i,cont=0;
cVector3d test,myNormal,myContactMax,myContactMin,contact;
cGenericObject *obj;
cTriangle *tri;
double dist=BIGNUMBER,mypene=0;
myContactMax=cVector3d(-BIGNUMBER,-BIGNUMBER,-BIGNUMBER);
myContactMin=cVector3d(BIGNUMBER,BIGNUMBER,BIGNUMBER);
myNormal.zero();
for(i=0;i<getNumVertices()+testPoints.size();i++) {
if(i<getNumVertices())
//test collision between a vertex and the other mesh
test = getVertex(i)->getGlobalPos();
else
//test collision between a test point and the other mesh
test = local2GlobalPosition(testPoints[i-getNumVertices()]);
// dist must be set to a high value ...
if(otherOne->computeCollisionDetection(centerOfMass,test,
obj, tri, contact,dist, true, -1)) {
cont++;
mypene += dist;
*touched = obj;
myContactMax = cVector3d(myContactMax.x>contact.x?myContactMax.x:contact.x,
myContactMax.y>contact.y?myContactMax.y:contact.y,
myContactMax.z>contact.z?myContactMax.z:contact.z);
myContactMin = cVector3d(myContactMin.x<contact.x?myContactMin.x:contact.x,
myContactMin.y<contact.y?myContactMin.y:contact.y,
myContactMin.z<contact.z?myContactMin.z:contact.z);
myNormal = cAdd(myNormal,computeNormal(tri));
}
}
if(cont) {
contactPoint = cMul(1/2.0,cAdd(myContactMax,myContactMin));
contactNormal = cNormalize(myNormal);
penetration = mypene/(double)cont;
}
return cont;
}
// test collisions between vertices and test points of this mesh and a given mesh
int dynamicObject::testCollision(cMesh *otherOne,
std::vector<cVector3d> *contactNormal,
std::vector<cVector3d> *contactPoint,
std::vector<double> *penetration,
std::vector<cGenericObject *>*touched) {
int i,j,cont=0;
cVector3d test,contact;
std::vector<cTriangle*> tris;
std::vector<bool> frontContact;
contactNormal->clear();
contactPoint->clear();
penetration->clear();
touched->clear();
tris.clear();
frontContact.clear();
cGenericObject *obj;
cTriangle *tri;
double dist=BIGNUMBER;
int tests = testPoints.size(),testVertices=0;
cMesh *esse = this;
if(collisionDetectionUseVertices) {
testVertices = getNumVertices();
if(testVertices==0) { // 3ds loaded from file
if(esse=dynamic_cast<cMesh*>(getChild(0)))
testVertices = esse->getNumVertices();
else
esse = this;
}
tests += testVertices;
}
for(i=0;i<tests;i++) {
if(i<testVertices)
//test collision between a vertex and the other mesh
test = esse->getVertex(i)->getGlobalPos();
else
//test collision between a test point and the other mesh
test = local2GlobalPosition(testPoints[i-testVertices]);
// dist must be set to a high value ...
dist=BIGNUMBER;
//cVector3d testLastPosition = cMul(cTrans(lastRotation),cAdd(test,cMul(-lastDt,velocity)));
cVector3d testLastPosition = cAdd(centerOfMass,cMul(-lastDt,velocity));
if(otherOne->computeCollisionDetection(centerOfMass,test,
obj, tri, contact,dist, false, -1)) {
int pos=-1;
cVector3d trinormal = computeNormal(tri);
double pe = cDot(cSub(test,contact),trinormal);
for(j=0;j<touched->size();j++) {
// test if this object was already tested for contact
if((*touched)[j]==obj)
pos=j;
}
if(pos<0) {
// new contact
pos=cont;
cont++;
tris.push_back(tri);
penetration->push_back(pe);
contactNormal->push_back(trinormal);
contactPoint->push_back(contact);
touched->push_back(obj);
frontContact.push_back(false);
if(i<testVertices) // vertex face collision
// stop collision detection
i=tests;
}
if((i<tests)&&(!frontContact[pos])) {
// test if this contact is better
if(pe<(*penetration)[pos]) {
(*penetration)[pos] = pe;
(*contactNormal)[pos] = trinormal;
(*contactPoint)[pos] = contact;
tris[pos] = tri;
}
// test if this is a frontal collision:
// if the angle between the collision normal and the test direction is less than the
// angle between 2 succesive tests then the collision can be frontal
// try the collision straight inside the triangle (would be the deepest penetration)
cVector3d testDirection = cNormalize(cSub(centerOfMass,test));
double ang = 2*(0.5*cDistance(testDirection,trinormal));
if(ang<0.5*3.1416/TESTCOLLISIONSLICES) {
cVector3d end = cAdd(centerOfMass,
cMul(-1*cDistance(centerOfMass,test),trinormal));
cVector3d lp1 = global2LocalPosition(centerOfMass,obj->getGlobalRot(), obj->getGlobalPos()),
lp2 = global2LocalPosition(cAdd(centerOfMass,cMul(-1,trinormal)),obj->getGlobalRot(), obj->getGlobalPos());
dist=BIGNUMBER;
if(tri->computeCollision(lp1,cSub(lp2,lp1),obj,tri, contact,dist)) {
(*penetration)[pos]=-cDistance(end,contact);
(*contactPoint)[pos]=localtoGlobalPosition(contact,obj->getGlobalRot(),obj->getGlobalPos());
frontContact[pos] = true;
tris[pos] = tri;
// stop collision detection (???)
//i=tests;
}
}
}
}
}
return cont;
}
void dynamicObject::reposition(cVector3d newpos,cVector3d newvelo,cVector3d newangvelo) {
centerOfMass = newpos;
setPos(centerOfMass);
cMatrix3d m;
m.identity();
setRot(m);
computeGlobalPositions(false);
computeAllNormals();
force.zero();
torque.zero();
acceleration.zero();
angAcceleration.zero();
velocity=newvelo;
angularVelocity=newangvelo;
}
void dynamicObject::integrateVelocity(double dt) {
velocity0 = velocity;
velocity = cAdd(velocity,cMul(dt,acceleration));
// using some damping to dissipate energy (??)
velocity.sub(cMul(DISSIPATION,velocity));
}
void dynamicObject::integratePosition(double dt) {
centerOfMass0 = centerOfMass;
centerOfMass = cAdd(centerOfMass,cMul(dt,velocity));
setPos(centerOfMass);
}
void dynamicObject::calcAcceleration(double dt) {
acceleration = cMul(1/mass,force);
if(myworld->getGravity()&&(!noGravityStep))
acceleration = cAdd(acceleration,cVector3d(0,-9.8,0));
noGravityStep=false;
}
void dynamicObject::applyForce(cVector3d iforce, cVector3d posiforce) {
// compute force e torque
cVector3d r = cSub(posiforce,centerOfMass);
if((r.length()>0)&&(iforce.length()>0)) {
// F* = -||r||.(F • ||r||)
force = cAdd(force,cMul(-1*cDot(iforce,cNormalize(r)),cNormalize(r)));
// T = F × r
torque = cAdd(torque,cCross(iforce,r));
}
}
void dynamicObject::applyCenterOfMassForce(cVector3d iforce) {
force = cAdd(force,iforce);
}
void dynamicObject::rollBackIntegration(double dt) {
force = force0;
torque = torque0;
velocity = velocity0;
angularVelocity = angularVelocity0;
centerOfMass = centerOfMass0;
setRot(lastRotMatrix);
integrate(dt);
}
void dynamicObject::integrate(double dt) {
// calculate accelerations
calcAcceleration(dt);
calcAngularAcceleration(dt);
// integrate velocity (linear e angular)
integrateVelocity(dt);
integrateAngularVelocity(dt);
// integrate position (linear e angular)
integratePosition(dt);
integrateOrientation(dt);
updateGlobalPositions(false);
computeAllNormals();
// reset forces
torque0 = torque;
force0 = force;
torque.zero();
force.zero();
lastDt = dt;
}
void dynamicObject::integrateOrientation(double dt) {
lastGiro = cMul(dt,angularVelocity);
lastRotMatrix = getRot();
// rotate
if(lastGiro.length()>0) {
//rotate(cNormalize(igiro),igiro.length());
rotate(cVector3d(1,0,0),lastGiro.x);
rotate(cVector3d(0,1,0),lastGiro.y);
rotate(cVector3d(0,0,1),lastGiro.z);
}
}
void dynamicObject::integrateAngularVelocity(double dt) {
angularVelocity0 = angularVelocity;
angularVelocity = cAdd(angularVelocity,cMul(dt,angAcceleration));
// using some damping to dissipate energy (??)
angularVelocity.sub(cMul(DISSIPATION,angularVelocity));
}
void dynamicObject::calcAngularAcceleration(double dt) {
angAcceleration = cMul(inertiaMatrixInv,torque);
}
cVector3d dynamicObject::local2GlobalPosition(cVector3d localPosition) {
cVector3d globalPosition;
getRot().mulr(localPosition, globalPosition);
globalPosition.add(getPos());
return globalPosition;
}
cVector3d localtoGlobalPosition(cVector3d localPosition, cMatrix3d rot, cVector3d pos) {
cVector3d globalPosition;
rot.mulr(localPosition, globalPosition);
globalPosition.add(pos);
return globalPosition;
}
cVector3d global2LocalPosition(cVector3d globalPosition, cMatrix3d rot, cVector3d pos) {
cVector3d localPosition;
globalPosition.sub(pos);
rot.trans();
rot.mulr(globalPosition,localPosition);
return localPosition;
}
cMatrix3d dynamicObject::getInertiaMatrix(bool transform2Global) {
if(transform2Global) {
cMatrix3d rotrans = getRot();
rotrans.trans();
cMatrix3d ret = cMul(cMul(rotrans,inertiaMatrix),getRot());
return ret;
}
else
return inertiaMatrix;
}
void dynamicObject::setInertiaMatrix(cMatrix3d matrix) {
inertiaMatrix = inertiaMatrixInv = matrix;
inertiaMatrixInv.invert();
}
| [
"[email protected]"
]
| [
[
[
1,
505
]
]
]
|
95479d4d73733cb6d8153a1d218886e65ecacb80 | e8d9619e262531453688550db22d0e78f1b51dab | /nohtml/conv.cpp | 10b382d7d0df11a5866bdedfff026596ebad4704 | []
| no_license | sje397/sje-miranda-plugins | e9c562f402daef2cfbe333ce9a8a888cd81c9573 | effb7ea736feeab1c68db34a86da8a2be2b78626 | refs/heads/master | 2016-09-05T16:42:34.162442 | 2011-05-22T14:48:15 | 2011-05-22T14:48:15 | 1,784,020 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 20,210 | cpp | #include "common.h"
#include "conv.h"
#include "strl.h"
#if _MSC_VER
#pragma warning( disable: 4706 )
#endif
char* strip_html(char *src)
{
int size = MultiByteToWideChar(CP_ACP, 0, src, -1, 0, 0);
wchar_t* buf=new wchar_t[size];
MultiByteToWideChar(CP_ACP, 0, src, -1,buf,size);
wchar_t* stripped_buf=strip_html(buf);
delete[] buf;
size = WideCharToMultiByte( CP_ACP, 0, stripped_buf, -1, 0, 0, NULL, NULL );
char* dest=new char[size];
WideCharToMultiByte( CP_ACP, 0, stripped_buf, -1, dest, size, NULL, NULL );
delete[] stripped_buf;
return dest;
}
wchar_t* strip_html(wchar_t *src)
{
wchar_t *ptr;
wchar_t *ptrl;
wchar_t *rptr;
wchar_t* dest=wcsldup(src,wcslen(src));
while ((ptr = wcsstr(dest,L"<P>")) != NULL || (ptr = wcsstr(dest, L"<p>")) != NULL) {
dest=renew(dest,wcslen(dest)+1,1);
memmove(ptr + 4, ptr + 3, wcslen(ptr + 3)*2 + 2);
*ptr = '\r';
*(ptr + 1) = '\n';
*(ptr + 2) = '\r';
*(ptr + 3) = '\n';
}
while ((ptr = wcsstr(dest,L"</P>")) != NULL || (ptr = wcsstr(dest, L"</p>")) != NULL) {
dest=renew(dest,wcslen(dest)+1,1);
*ptr = L'\r';
*(ptr + 1) = L'\n';
*(ptr + 2) = L'\r';
*(ptr + 3) = L'\n';
}
while ((ptr = wcsstr(dest, L"<BR>")) != NULL || (ptr = wcsstr(dest, L"<br>")) != NULL) {
*ptr = L'\r';
*(ptr + 1) = L'\n';
memmove(ptr + 2, ptr + 4, wcslen(ptr + 4)*2 + 2);
}
while ((ptr = wcsstr(dest, L"<HR>")) != NULL || (ptr = wcsstr(dest, L"<hr>")) != NULL) {
*ptr = L'\r';
*(ptr + 1) = L'\n';
memmove(ptr + 2, ptr + 4, wcslen(ptr + 4)*2 + 2);
}
rptr = dest;
/*while (ptr = wcsstr(rptr, L"<A HREF=\""))
{
int addr=ptr-rptr;
dest=renew(dest,wcslen(dest)*2+2,7);
rptr=dest;
ptr=rptr+addr;
memcpy(ptr,L"[link: ",7*2);
ptrl=ptr+7;
memmove(ptrl, ptrl + 2, wcslen(ptrl + 2)*2 + 2);
if ((ptrl = wcsstr(ptr, L"\">")))
{
memmove(ptrl+7,ptrl+1,wcslen(ptrl+1)*2+2);
memcpy(ptrl,L" title: ",8*2);
wchar_t* s1 = wcsstr(ptrl,L"</A");
wchar_t* s2 = wcsstr(rptr,L"<A HREF");
if (s1&&s1<s2||s1&&!s2)
{
ptr=s1;
*ptr=L' ';
ptr[1]=L']';
memmove(ptr+2, ptr + 4, wcslen(ptr + 4)*2 + 2);
}
else if(s2&&s2<s1||s2&&!s1)
{
ptr=s2;
memmove(ptr+2, ptr, wcslen(ptr)*2 + 2);
*ptr=L' ';
ptr[1]=L']';
}
else
{
ptr=dest;
memcpy(&ptr[wcslen(ptr)],L" ]",3*2);
}
}
else
rptr++;
}
rptr = dest;
while (ptr = wcsstr(rptr, L"<a href=\""))
{
int addr=ptr-rptr;
dest=renew(dest,wcslen(dest)*2+2,7*2);
rptr=dest;
ptr=rptr+addr;
memcpy(ptr,L"[link: ",7*2);
ptrl=ptr+7;
memmove(ptrl, ptrl + 2, wcslen(ptrl + 2)*2 + 2);
if ((ptrl = wcsstr(ptr, L"\">")))
{
memmove(ptrl+7,ptrl+1,wcslen(ptrl+1)*2+2);
memcpy(ptrl,L" title: ",8*2);
wchar_t* s1 = wcsstr(ptrl,L"</a href");
wchar_t* s2 = wcsstr(rptr,L"<a href");
if (s1&&s1<s2||s1&&!s2)
{
ptr=s1;
*ptr=L' ';
ptr[1]=L']';
memmove(ptr+2, ptr + 4, wcslen(ptr + 4)*2 + 2);
}
else if(s2&&s2<s1||s2&&!s1)
{
ptr=s2;
memmove(ptr+2, ptr, wcslen(ptr)*2 + 2);
*ptr=L' ';
ptr[1]=L']';
}
else
{
ptr=dest;
memcpy(&ptr[wcslen(ptr)],L" ]",3*2);
}
}
else
rptr++;
}*/
rptr = dest;
while ((ptr = wcsstr(rptr, L"<"))) {
ptrl = ptr + 1;
if ((ptrl = wcsstr(ptrl, L">"))) {
memmove(ptr, ptrl + 1, wcslen(ptrl + 1)*2 + 2);
}
else
break;
}
ptrl = NULL;
while ((ptr = wcsstr(dest, L""")) != NULL && (ptrl == NULL || ptr > ptrl)) {
*ptr = L'"';
memmove(ptr + 1, ptr + 6, wcslen(ptr + 6)*2 + 2);
ptrl = ptr;
}
ptrl = NULL;
while ((ptr = wcsstr(dest, L"<")) != NULL && (ptrl == NULL || ptr > ptrl)) {
*ptr = L'<';
memmove(ptr + 1, ptr + 4, wcslen(ptr + 4)*2 + 2);
ptrl = ptr;
}
ptrl = NULL;
while ((ptr = wcsstr(dest, L">")) != NULL && (ptrl == NULL || ptr > ptrl)) {
*ptr = L'>';
memmove(ptr + 1, ptr + 4, wcslen(ptr + 4)*2 + 2);
ptrl = ptr;
}
ptrl = NULL;
while ((ptr = wcsstr(dest, L"'")) != NULL && (ptrl == NULL || ptr > ptrl)) {
*ptr = L'\'';
memmove(ptr + 1, ptr + 6, wcslen(ptr + 6)*2 + 2);
ptrl = ptr;
}
ptrl = NULL;
while ((ptr = wcsstr(dest, L"&")) != NULL && (ptrl == NULL || ptr > ptrl)) {
*ptr = L'&';
memmove(ptr + 1, ptr + 5, wcslen(ptr + 5)*2 + 2);
ptrl = ptr;
}
return dest;
}
char* strip_carrots(char *src)// EAT!!!!!!!!!!!!!
{
int size = MultiByteToWideChar(codepage, 0, src, -1, 0, 0);
wchar_t* buf=new wchar_t[size];
MultiByteToWideChar(codepage, 0, src, -1, buf, size);
wchar_t* stripped_buf=strip_carrots(buf);
delete[] buf;
size = WideCharToMultiByte( codepage, 0, stripped_buf, -1, 0, 0, NULL, NULL );
char* dest=new char[size];
WideCharToMultiByte( codepage, 0, stripped_buf, -1, dest, size, NULL, NULL );
delete[] stripped_buf;
return dest;
}
wchar_t* strip_carrots(wchar_t *src)// EAT!!!!!!!!!!!!!
{
wchar_t *ptr;
wchar_t* dest=wcsldup(src,wcslen(src));
while ((ptr = wcsstr(dest, L"<")) != NULL)
{
int addr=ptr-dest;
dest=renew(dest,wcslen(dest)+2,7);
ptr=dest+addr;
memmove(ptr + 4, ptr + 1, wcslen(ptr + 1)*2 + 8);
memcpy(ptr,L"<",8);
}
while ((ptr = wcsstr(dest, L">")) != NULL)
{
int addr=ptr-dest;
dest=renew(dest,wcslen(dest)+2,7);
ptr=dest+addr;
memmove(ptr + 4, ptr + 1, wcslen(ptr + 1)*2 + 8);
memcpy(ptr,L">",8);
}
dest[wcslen(dest)]='\0';
return dest;
}
char* strip_linebreaks(char *src)
{
char* dest=strldup(src,lstrlen(src));
char *ptr;
while ((ptr = strstr(dest, "\r")) != NULL)
{
memmove(ptr, ptr + 1, lstrlen(ptr + 1)+1);
}
while ((ptr = strstr(dest, "\n")) != NULL)
{
int addr=ptr-dest;
dest=renew(dest,lstrlen(dest)+1,7);
ptr=dest+addr;
memmove(ptr + 4, ptr + 1, lstrlen(ptr + 1) + 4);
memcpy(ptr,"<br>",4);
}
dest[lstrlen(dest)]='\0';
return dest;
}
char* html_to_bbcodes(char *src)
{
int size = MultiByteToWideChar(codepage, 0, src, -1, 0, 0);
wchar_t* buf=new wchar_t[size];
MultiByteToWideChar(codepage, 0, src, -1, 0, 0);
wchar_t* stripped_buf=html_to_bbcodes(buf);
delete[] buf;
size = WideCharToMultiByte( codepage, 0, stripped_buf, -1, 0, 0, NULL, NULL );
char* dest=new char[size];
WideCharToMultiByte( codepage, 0, stripped_buf, -1, dest, size, NULL, NULL );
delete[] stripped_buf;
return dest;
}
wchar_t* html_to_bbcodes(wchar_t *src)
{
wchar_t *ptr;
wchar_t *ptrl;
wchar_t *rptr;
wchar_t* dest=wcsldup(src,wcslen(src));
while ((ptr = wcsstr(dest, L"<B>")) != NULL || (ptr = wcsstr(dest, L"<b>")) != NULL)
{
*ptr = L'[';
*(ptr+1) = L'b';
*(ptr+2) = L']';
if((ptr = wcsstr(dest, L"</B>")) != NULL || (ptr = wcsstr(dest, L"</b>")) != NULL)
{
*ptr = L'[';
*(ptr+2) = L'b';
*(ptr+3) = L']';
}
else
{
dest=renew(dest,wcslen(dest)*2+2,5*2);
memcpy(&dest[wcslen(dest)],L"[/b]",5*2);
}
}
while ((ptr = wcsstr(dest, L"<I>")) != NULL || (ptr = wcsstr(dest, L"<i>")) != NULL)
{
*ptr = L'[';
*(ptr+1) = L'i';
*(ptr+2) = L']';
if((ptr = wcsstr(dest, L"</I>")) != NULL || (ptr = wcsstr(dest, L"</i>")) != NULL)
{
*ptr = L'[';
*(ptr+2) = L'i';
*(ptr+3) = L']';
}
else
{
dest=renew(dest,wcslen(dest)*2+2,5*2);
memcpy(&dest[wcslen(dest)],L"[/i]",5*2);
}
}
while ((ptr = wcsstr(dest, L"<U>")) != NULL || (ptr = wcsstr(dest, L"<u>")) != NULL)
{
*ptr = L'[';
*(ptr+1) = L'u';
*(ptr+2) = L']';
if((ptr = wcsstr(dest, L"</U>")) != NULL || (ptr = wcsstr(dest, L"</u>")) != NULL)
{
*ptr = L'[';
*(ptr+2) = L'u';
*(ptr+3) = L']';
}
else
{
dest=renew(dest,wcslen(dest)*2+2,5*2);
memcpy(&dest[wcslen(dest)],L"[/u]",5*2);
}
}
rptr = dest;
while (ptr = wcsstr(rptr,L"<A HREF"))
{
wchar_t* begin=ptr;
ptrl = ptr + 4;
memcpy(ptrl,L"[url=",5*2);
memmove(ptr, ptrl, wcslen(ptrl)*2 + 2);
if ((ptr = wcsstr(ptrl,L">")))
{
ptr-=1;
memmove(ptr, ptr+1, wcslen(ptr+1)*2 + 2);
*(ptr)=L']';
ptrl-=1;
wchar_t* s1 = wcsstr(ptrl,L"</A");
wchar_t* s2 = wcsstr(rptr,L"<A HREF");
if (s1&&s1<s2||s1&&!s2)
{
ptr=s1;
ptr=strip_tag_within(begin,ptr);
memmove(ptr+2, ptr, wcslen(ptr)*2 + 2);
memcpy(ptr,L"[/url]",6*2);
}
else if(s2&&s2<s1||s2&&!s1)
{
ptr=s2;
ptr=strip_tag_within(begin,ptr);
int addr=ptr-rptr;
dest=renew(dest,wcslen(dest)*2+2,7*2);
rptr=dest;
ptr=rptr+addr;
memmove(ptr+6, ptr, wcslen(ptr)*2 + 2);
memcpy(ptr,L"[/url]",6*2);
}
else
{
strip_tag_within(begin,&dest[wcslen(dest)]);
//int addr=ptr-rptr;
dest=renew(dest,wcslen(dest)*2+2,7*2);
rptr=dest;
ptr=dest;
memcpy(&ptr[wcslen(ptr)],L"[/url]",7*2);
}
}
else
rptr++;
}
rptr = dest;
while (ptr = wcsstr(rptr,L"<a href"))
{
wchar_t* begin=ptr;
ptrl = ptr + 4;
memcpy(ptrl,L"[url=",5*2);
memmove(ptr, ptrl, wcslen(ptrl)*2 + 2);
if ((ptr = wcsstr(ptrl,L">")))
{
ptr-=1;
memmove(ptr, ptr+1, wcslen(ptr+1)*2 + 2);
*(ptr)=L']';
ptrl-=1;
wchar_t* s1 = wcsstr(ptrl,L"</a");
wchar_t* s2 = wcsstr(ptrl,L"<a href");
if (s1&&s1<s2||s1&&!s2)
{
ptr=s1;
ptr=strip_tag_within(begin,ptr);
memmove(ptr+2, ptr, wcslen(ptr)*2 + 2);
memcpy(ptr,L"[/url]",6*2);
}
else if(s2&&s2<s1||s2&&!s1)
{
ptr=s2;
ptr=strip_tag_within(begin,ptr);
int addr=ptr-rptr;
dest=renew(dest,wcslen(dest)*2+2,7*2);
rptr=dest;
ptr=rptr+addr;
memmove(ptr+6, ptr, wcslen(ptr)*2 + 2);
memcpy(ptr,L"[/url]",6*2);
}
else
{
strip_tag_within(begin,&dest[wcslen(dest)]);
//int addr=ptr-rptr;
dest=renew(dest,wcslen(dest)*2+2,7*2);
rptr=dest;
ptr=dest;
memcpy(&ptr[wcslen(ptr)],L"[/url]",7*2);
}
}
else
rptr++;
}
rptr = dest;
while (ptr = wcsstr(rptr, L"<FONT COLOR=\""))
{
int addr=ptr-rptr;
dest=renew(dest,wcslen(dest)*2+2,7*2);
rptr=dest;
ptr=rptr+addr;
ptrl = ptr + 6;
memcpy(ptrl,L"[color=",7*2);
memmove(ptr, ptrl, wcslen(ptrl)*2 + 2);
if ((ptr = wcsstr(ptrl, L">")))
{
memmove(ptrl+7,ptr,wcslen(ptr)*2+2);
*(ptrl+7)=L']';
ptr=ptrl+7;
wchar_t* s1 = wcsstr(ptr,L"</FONT");
wchar_t* s2 = wcsstr(ptr,L"<FONT COLOR=\"");
if (s1&&s1<s2||s1&&!s2)
{
ptr=s1;
memmove(ptr+1, ptr, wcslen(ptr)*2 + 2);
memcpy(ptr,L"[/color]",8*2);
}
else if(s2&&s2<s1||s2&&!s1)
{
ptr=s2;
memmove(ptr+8, ptr, wcslen(ptr)*2 + 2);
memcpy(ptr,L"[/color]",8*2);
}
else
{
ptr=dest;
memcpy(&ptr[wcslen(ptr)],L"[/color]",9*2);
}
}
else
rptr++;
}
rptr = dest;
while (ptr = wcsstr(rptr, L"<font color=\""))
{
int addr=ptr-rptr;
dest=renew(dest,wcslen(dest)*2+2,7*2);
rptr=dest;
ptr=rptr+addr;
ptrl = ptr + 6;
memcpy(ptrl,L"[color=",7*2);
memmove(ptr, ptrl, wcslen(ptrl)*2 + 2);
if ((ptr = wcsstr(ptrl, L">")))
{
memmove(ptrl+7,ptr,wcslen(ptr)*2+2);
*(ptrl+7)=L']';
ptr=ptrl+7;
wchar_t* s1 = wcsstr(ptr,L"</font");
wchar_t* s2 = wcsstr(ptr,L"<font color=\"");
if (s1&&s1<s2||s1&&!s2)
{
ptr=s1;
memmove(ptr+1, ptr, wcslen(ptr)*2 + 2);
memcpy(ptr,L"[/color]",8*2);
}
else if(s2&&s2<s1||s2&&!s1)
{
ptr=s2;
memmove(ptr+8, ptr, wcslen(ptr)*2 + 2);
memcpy(ptr,L"[/color]",8*2);
}
else
{
ptr=dest;
memcpy(&ptr[wcslen(ptr)],L"[/color]",9*2);
}
}
else
rptr++;
}
rptr = dest;
while ((ptr = wcsstr(rptr, L"<FONT COLOR=")) || (ptr = wcsstr(rptr, L"<font color=")))
{
int addr=ptr-rptr;
dest=renew(dest,wcslen(dest)*2+2,7*2);
rptr=dest;
ptr=rptr+addr;
ptrl = ptr + 5;
memcpy(ptrl,L"[color=",7*2);
memmove(ptr, ptrl, wcslen(ptrl)*2 + 2);
if ((ptr = wcsstr(ptrl, L">")))
{
*(ptr)=L']';
if ((ptrl = wcsstr(ptr, L"</FONT")) || (ptrl = wcsstr(ptr, L"</font")))
{
memmove(ptrl+1, ptrl, wcslen(ptrl)*2 + 2);
memcpy(ptrl,L"[/color]",8*2);
}
else
{
memcpy(&dest[wcslen(dest)],L"[/color]",9*2);
}
}
else
rptr++;
}
return dest;
}
char* bbcodes_to_html(const char *src)
{
wchar_t* buf=new wchar_t[strlen(src)+1];
MultiByteToWideChar(CP_ACP, 0, src, -1,buf,(strlen(src)+1)*2);
wchar_t* stripped_buf=bbcodes_to_html(buf);
delete[] buf;
char* dest=new char[wcslen(stripped_buf)+1];
WideCharToMultiByte( CP_ACP, 0, stripped_buf, -1,dest,wcslen(stripped_buf)+1, NULL, NULL );
delete[] stripped_buf;
return dest;
}
wchar_t* bbcodes_to_html(const wchar_t *src)
{
wchar_t *ptr;
wchar_t *rptr;
wchar_t* dest=wcsldup(src,wcslen(src));
while ((ptr = wcsstr(dest, L"[b]")) != NULL) {
*ptr = L'<';
*(ptr+1) = L'b';
*(ptr+2) = L'>';
}
while ((ptr = wcsstr(dest, L"[/b]")) != NULL) {
*ptr = L'<';
*(ptr+2) = L'b';
*(ptr+3) = L'>';
}
while ((ptr = wcsstr(dest, L"[i]")) != NULL) {
*ptr = L'<';
*(ptr+1) = L'i';
*(ptr+2) = L'>';
}
while ((ptr = wcsstr(dest, L"[/i]")) != NULL) {
*ptr = L'<';
*(ptr+2) = L'i';
*(ptr+3) = L'>';
}
while ((ptr = wcsstr(dest, L"[u]")) != NULL) {
*ptr = L'<';
*(ptr+1) = L'u';
*(ptr+2) = L'>';
}
while ((ptr = wcsstr(dest, L"[/u]")) != NULL) {
*ptr = L'<';
*(ptr+2) = L'u';
*(ptr+3) = L'>';
}
rptr = dest;
while ((ptr = wcsstr(rptr, L"[color=")))
{
int addr=ptr-rptr;
dest=renew(dest,wcslen(dest)+2,7);
rptr=dest;
ptr=rptr+addr;
memmove(ptr+5, ptr, wcslen(ptr)*sizeof(wchar_t) + 2);
memcpy(ptr,L"<font ",6*sizeof(wchar_t));
if ((ptr = wcsstr(ptr,L"]")))
{
*(ptr)=L'>';
if ((ptr = wcsstr(ptr,L"[/color]")))
{
memcpy(ptr,L"</font>",7*sizeof(wchar_t));
memmove(ptr+7,ptr+8,wcslen(ptr+8)*sizeof(wchar_t)+2);
}
}
else
rptr++;
}
while ((ptr = wcsstr(rptr, L"[url=")))
{
int addr=ptr-rptr;
dest=renew(dest,wcslen(dest)+2,7);
rptr=dest;
ptr=rptr+addr;
memmove(ptr+3, ptr, wcslen(ptr)+2);
memcpy(ptr,L"<a href",7);
if ((ptr = wcsstr(ptr, L"]")))
{
*(ptr)=L'>';
if ((ptr = wcsstr(ptr, L"[/url]")))
{
memcpy(ptr,L"</a>",4*sizeof(wchar_t));
memmove(ptr+4,ptr+6,wcslen(ptr+6)*sizeof(wchar_t)+2);
}
}
else
rptr++;
}
return dest;
}
void strip_tag(char* begin, char* end)
{
memmove(begin,end+1,lstrlen(end+1)+1);
}
void strip_tag(wchar_t* begin, wchar_t* end)
{
memmove(begin,end+1,wcslen(end+1)+2);
}
//strip a tag within a string
char* strip_tag_within(char* begin, char* end)
{
while(char* sub_begin=strstr(begin,"<"))
{
if(sub_begin<end)//less than the original ending
{
char* sub_end=strstr(begin,">");
strip_tag(sub_begin,sub_end);
end=end-(sub_end-sub_begin)-1;
}
else
break;
}
return end;
}
//strip a tag within a string
wchar_t* strip_tag_within(wchar_t* begin, wchar_t* end)
{
while(wchar_t* sub_begin=wcsstr(begin,L"<"))
{
if(sub_begin<end)//less than the original ending
{
wchar_t* sub_end=wcsstr(begin,L">");
strip_tag(sub_begin,sub_end);
end=end-(sub_end-sub_begin)-1;
}
else
break;
}
return end;
}
char* rtf_to_html(HWND hwndDlg,int DlgItem)
{
char* buf=new char[4024];
int pos=0;
int start=0;
int end=1;
BOOL Bold=false;
BOOL Italic=false;
BOOL Underline=false;
char Face[32]="\0";
COLORREF Color;
COLORREF BackColor;
int Size=0;
GETTEXTLENGTHEX tl;
tl.flags=GTL_DEFAULT;
tl.codepage=CP_ACP;
int length=SendDlgItemMessage(hwndDlg, DlgItem, EM_GETTEXTLENGTHEX,(WPARAM)&tl,0);
while(start<length)
{
SendDlgItemMessage(hwndDlg, DlgItem, EM_SETSEL, start, end);
CHARFORMAT2 cfOld;
cfOld.cbSize = sizeof(CHARFORMAT2);
cfOld.dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE|CFM_SIZE|CFM_COLOR|CFM_BACKCOLOR|CFM_FACE;
SendDlgItemMessage(hwndDlg, DlgItem, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld);
BOOL isBold = (cfOld.dwEffects & CFE_BOLD) && (cfOld.dwMask & CFM_BOLD);
BOOL isItalic = (cfOld.dwEffects & CFE_ITALIC) && (cfOld.dwMask & CFM_ITALIC);
BOOL isUnderline = (cfOld.dwEffects & CFE_UNDERLINE) && (cfOld.dwMask & CFM_UNDERLINE);
COLORREF isColor=cfOld.crTextColor;
COLORREF isBackColor=cfOld.crBackColor;
int isSize;
if(cfOld.yHeight==38*20)
isSize=7;
else if(cfOld.yHeight==24*20)
isSize=6;
else if(cfOld.yHeight==18*20)
isSize=5;
else if(cfOld.yHeight==14*20)
isSize=4;
else if(cfOld.yHeight==12*20)
isSize=3;
else if(cfOld.yHeight==10*20)
isSize=2;
else if(cfOld.yHeight==8*20)
isSize=1;
else
isSize=3;
char text[2];
SendDlgItemMessage(hwndDlg, DlgItem, EM_GETSELTEXT, 0, (LPARAM)&text);
if(Bold!=isBold)
{
Bold=isBold;
if(isBold)
{
strlcpy(&buf[pos],"<b>",4);
pos+=3;
}
else
{
if(start!=0)
{
strlcpy(&buf[pos],"</b>",5);
pos+=4;
}
}
}
if(Italic!=isItalic)
{
Italic=isItalic;
if(isItalic)
{
strlcpy(&buf[pos],"<i>",4);
pos+=3;
}
else
{
if(start!=0)
{
strlcpy(&buf[pos],"</i>",5);
pos+=4;
}
}
}
if(Underline!=isUnderline)
{
Underline=isUnderline;
if(isUnderline)
{
strlcpy(&buf[pos],"<u>",4);
pos+=3;
}
else
{
if(start!=0)
{
strlcpy(&buf[pos],"</u>",5);
pos+=4;
}
}
}
if(Size!=isSize||Color!=isColor||BackColor!=isBackColor||strcmp(Face,cfOld.szFaceName))
{
Size=isSize;
Color=isColor;
BackColor=isBackColor;
strlcpy(Face,cfOld.szFaceName,strlen(cfOld.szFaceName)+1);
if(start!=0)
{
strlcpy(&buf[pos],"</font>",8);
pos+=7;
}
strlcpy(&buf[pos],"<font",6);
pos+=5;
strlcpy(&buf[pos]," face=\"",8);
pos+=7;
strlcpy(&buf[pos],Face,strlen(Face)+1);
pos+=strlen(Face);
strlcpy(&buf[pos],"\"",2);
pos++;
if(!(cfOld.dwEffects & CFE_AUTOBACKCOLOR))
{
strlcpy(&buf[pos]," back=#",7);
pos+=6;
char chBackColor[7];
_itoa((_htonl(BackColor)>>8),chBackColor,16);
int len=strlen(chBackColor);
if(len<6)
{
memmove(chBackColor+(6-len),chBackColor,len+1);
for(int i=0;i<6;i++)
chBackColor[i]='0';
}
strlcpy(&buf[pos],chBackColor,7);
pos+=6;
}
if(!(cfOld.dwEffects & CFE_AUTOCOLOR))
{
strlcpy(&buf[pos]," color=#",9);
pos+=8;
char chColor[7];
_itoa((_htonl(Color)>>8),chColor,16);
int len=strlen(chColor);
if(len<6)
{
memmove(chColor+(6-len),chColor,len+1);
for(int i=0;i<6;i++)
chColor[i]='0';
}
strlcpy(&buf[pos],chColor,7);
pos+=6;
}
strlcpy(&buf[pos]," size=",7);
pos+=6;
char chSize[2];
_itoa(Size,chSize,10);
strlcpy(&buf[pos],chSize,2);
pos++;
strlcpy(&buf[pos],">",2);
pos++;
}
if(text[0]=='\r')
{
strlcpy(&buf[pos],"<br>",5);
pos+=4;
}
else
{
strlcpy(&buf[pos],text,2);
pos++;
}
start++;
end++;
}
if(Bold)
{
strlcpy(&buf[pos],"</b>",5);
pos+=4;
}
if(Italic)
{
strlcpy(&buf[pos],"</i>",5);
pos+=4;
}
if(Underline)
{
strlcpy(&buf[pos],"</u>",5);
pos+=4;
}
strlcpy(&buf[pos],"</font>",8);
pos+=7;
return buf;
}
#if _MSC_VER
#pragma warning( default: 4706 )
#endif
| [
"[email protected]"
]
| [
[
[
1,
817
]
]
]
|
23ae3546a847ecc385c2f08bca3a47d7e40f62d4 | d425cf21f2066a0cce2d6e804bf3efbf6dd00c00 | /Laptop/IMP Character and Disability Entrance.cpp | d73a4698fe209177ec6782608252dc8660a11918 | []
| no_license | infernuslord/ja2 | d5ac783931044e9b9311fc61629eb671f376d064 | 91f88d470e48e60ebfdb584c23cc9814f620ccee | refs/heads/master | 2021-01-02T23:07:58.941216 | 2011-10-18T09:22:53 | 2011-10-18T09:22:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,210 | cpp | #ifdef PRECOMPILEDHEADERS
#include "Laptop All.h"
#else
#include "CharProfile.h"
#include "IMP Character and Disability Entrance.h"
#include "IMP MainPage.h"
#include "IMP HomePage.h"
#include "IMPVideoObjects.h"
#include "Utilities.h"
#include "WCheck.h"
#include "Debug.h"
#include "WordWrap.h"
#include "Render Dirty.h"
#include "Encrypted File.h"
#include "cursors.h"
#include "laptop.h"
#include "IMP Text System.h"
#include "text.h"
#endif
// IMP personality entrance buttons
INT32 giIMPCharacterAndDisabilityEntranceButton[1];
INT32 giIMPCharacterAndDisabilityEntranceButtonImage[1];
// function definitions
void CreateIMPCharacterAndDisabilityEntranceButtons( void );
void BtnIMPCharacterAndDisabilityEntranceDoneCallback(GUI_BUTTON *btn,INT32 reason);
void WriteIMPCharacterAndDisabilityEntranceText( void );
void EnterIMPCharacterAndDisabilityEntrance( void )
{
// create buttons needed
CreateIMPCharacterAndDisabilityEntranceButtons( );
return;
}
void RenderIMPCharacterAndDisabilityEntrance( void )
{
// the background
RenderProfileBackGround( );
// the IMP symbol
//RenderIMPSymbol( 112, 30 );
// indent
RenderAvgMercIndentFrame(90, 40 );
return;
}
void ExitIMPCharacterAndDisabilityEntrance( void )
{
// destroy buttons needed
RemoveButton(giIMPCharacterAndDisabilityEntranceButton[0] );
UnloadButtonImage(giIMPCharacterAndDisabilityEntranceButtonImage[0] );
return;
}
void HandleIMPCharacterAndDisabilityEntrance( void )
{
// Show the text
WriteIMPCharacterAndDisabilityEntranceText( );
return;
}
void CreateIMPCharacterAndDisabilityEntranceButtons( void )
{
// this function will create the buttons needed for the IMP personality Page
// ths begin button
giIMPCharacterAndDisabilityEntranceButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 );
/*giIMPCharacterAndDisabilityEntranceButton[0] = QuickCreateButton( giIMPCharacterAndDisabilityEntranceButtonImage[0], LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ),
BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1,
BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPCharacterAndDisabilityEntranceDoneCallback);
*/
giIMPCharacterAndDisabilityEntranceButton[0] = CreateIconAndTextButton( giIMPCharacterAndDisabilityEntranceButtonImage[0], pImpButtonText[ 1 ], FONT12ARIAL,
FONT_WHITE, DEFAULT_SHADOW,
FONT_WHITE, DEFAULT_SHADOW,
TEXT_CJUSTIFIED,
LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPCharacterAndDisabilityEntranceDoneCallback);
SetButtonCursor(giIMPCharacterAndDisabilityEntranceButton[0], CURSOR_WWW);
return;
}
void WriteIMPCharacterAndDisabilityEntranceText( void )
{
//Display the title
DrawTextToScreen( pCharacterTraitBeginIMPStrings[ 0 ], LAPTOP_SCREEN_UL_X - 111, iScreenHeightOffset + 53, ( LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X ), FONT14ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
// The personality part
DisplayWrappedString( LAPTOP_SCREEN_UL_X + 106, LAPTOP_SCREEN_WEB_UL_Y + 63, ( 400 - 100 ), 2, FONT12ARIAL, FONT_WHITE, pCharacterTraitBeginIMPStrings[ 1 ],FONT_BLACK,FALSE,CENTER_JUSTIFIED);
// The disability part
DisplayWrappedString( LAPTOP_SCREEN_UL_X + 106, LAPTOP_SCREEN_WEB_UL_Y + 148, ( 400 - 100 ), 2, FONT12ARIAL, FONT_WHITE, pCharacterTraitBeginIMPStrings[ 2 ],FONT_BLACK,FALSE,CENTER_JUSTIFIED);
return;
}
void BtnIMPCharacterAndDisabilityEntranceDoneCallback(GUI_BUTTON *btn,INT32 reason)
{
// btn callback for IMP Begin Screen done button
if (!(btn->uiFlags & BUTTON_ENABLED))
return;
if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
btn->uiFlags|=(BUTTON_CLICKED_ON);
}
else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// done with begin screen, next screen
iCurrentImpPage = IMP_CHARACTER_PAGE;
fButtonPendingFlag = TRUE;
}
}
}
| [
"jazz_ja@b41f55df-6250-4c49-8e33-4aa727ad62a1"
]
| [
[
[
1,
133
]
]
]
|
d00b46bfa40e10f38549bc0489d749211973e574 | 74c8da5b29163992a08a376c7819785998afb588 | /NetAnimal/Game/wheel/WheelAnimalController/include/ui/UIAnimation2.h | 49107a58d86da4ef0d9dcdfbc21e9fa6e755d60f | []
| no_license | dbabox/aomi | dbfb46c1c9417a8078ec9a516cc9c90fe3773b78 | 4cffc8e59368e82aed997fe0f4dcbd7df626d1d0 | refs/heads/master | 2021-01-13T14:05:10.813348 | 2011-06-07T09:36:41 | 2011-06-07T09:36:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,137 | h | #ifndef __Orz_UIAnimation2__
#define __Orz_UIAnimation2__
#include <boost/multi_array.hpp>
#include <iostream>
#include <CEGUI/cegui.h>
namespace Orz
{
class UIAnimation2
{
public:
UIAnimation2(void):_window(NULL),_time(0.f)
{
_curWindow = _windows.begin();
}
~UIAnimation2(void)
{
}
void push_back(CEGUI::Window * window, TimeType i)
{
window->hide();
_windows.push_back(std::make_pair(window,i));
_curWindow = _windows.begin();
}
bool update(TimeType i)
{
_time += i;
if(_time >= _curWindow->second)
{
_time -= _curWindow->second;
_curWindow->first->hide();
++_curWindow;
if(_curWindow == _windows.end())
{
return false;
}
else
_curWindow->first->show();
}
return true;
}
void reset(void)
{
_curWindow = _windows.begin();
_curWindow->first->show();
}
private:
CEGUI::Window * _window;
typedef std::vector<std::pair<CEGUI::Window * , TimeType > > WindowListType;
WindowListType _windows;
WindowListType::iterator _curWindow;
TimeType _time;
};
}
#endif | [
"[email protected]"
]
| [
[
[
1,
61
]
]
]
|
6cb1ddfc72475d3b803bdf83f148403d920bbfb7 | fb71c08b1c1e7ea4d7abc82e65b36272069993e1 | /src/CAnimator.cpp | f45c98bda89d1203d4a8422368b31eee9a53e2fb | []
| no_license | cezarygerard/fpteacher | 1bb4ea61bc86cbadcf47a810c8bb441f598d278a | 7bdfcf7c047caa9382e22a9d26a2d381ce2d9166 | refs/heads/master | 2021-01-23T03:47:54.994165 | 2010-03-25T01:12:04 | 2010-03-25T01:12:04 | 39,897,391 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,391 | cpp | /** @file CAnimator.cpp
* @author Sebastian luczak
* @date 2010.01.08
* @version 0.6
* @brief Klasa animatora, czyli minisystemu zarzadzajacego sekwencja animacji
* Dzialanie animatora w trybie ONCE - wyswietlany jest jednorazowo caly wektor animset'ow
w trybie LOOP - sekwencja animset'ow jest powtarzana
w trybie RANDOM - sekwencja animset'ow jest odtwarzana losowo, w trybie ciaglym
w trybie NONE - animacja nie jest wykonywana
*/
#include "CAnimator.hpp"
using namespace logging;
using namespace utils;
CAnimator::CAnimator() : animState_(STOP), currentAnimSet_(0), currentFrame_(0), prioritySum_(0), lastFrameTime_(SDL_GetTicks()), animMode_(ANIM_LOOP), soundChannel_(0)
{
CLog::getInstance()->sss << "CAnimator::CAnimator: Konstruktor CAnimator" << endl;
logs(CLog::getInstance()->sss.str(), INFO);
}
CAnimator::~CAnimator()
{
// Wyczysc kontener z zestawami animacji
clearCAnimator();
CLog::getInstance()->sss << "CAnimator::~CAnimator: Destruktor CAnimator" << endl;
logs(CLog::getInstance()->sss.str(), INFO);
}
//
// metoda otwierajaca plik i pobierajaca z niej animacje
bool CAnimator::openFile(const string filename, int type)
{
// lista zawierajaca nazwy zestawow animacji
list< tuple_sai > anim_sets;
string s;
string anim_filename_prefix;
if(CLogic::getInstance()->getIsTeacher())
anim_filename_prefix = PATH_SPRITES_STUDENT_FRONT;
else
anim_filename_prefix = PATH_SPRITES_STUDENT_REAR;
if(type == 1)
anim_filename_prefix = PATH_SPRITES_MINIGAMES;
if(type == 2)
anim_filename_prefix = PATH_CURSORS;
{
ifstream in(filename.c_str());
if(!in) {
refillCAnimatorDefault();
setAnimMode(ANIM_NONE);
CLog::getInstance()->sss << "CAnimator::openFile: Bledna sekwencja animacji. Zaladowano obrazek domyslny!" << endl;
logs(CLog::getInstance()->sss.str(), WARNING);
return true;
}
// proste pobieranie danych ze strumienia oparte na poszukiwaniu znacznikow
while( getline(in, s) ) {
istringstream data(s);
string token;
// pobierz ze strumienia pierwsza dana, ktora powinna byc token'em
data >> token;
//cout << token << endl;
if( token == "ANIMMODE") {
data.ignore(20, '=');
data >> animMode_;
//cout << animMode_ << endl;
}
else if( token == "ANIMSET") {
string anim_name, sound_name, temp;
int priority = 0;
data.ignore(20, '=');
data >> temp;
anim_name = anim_filename_prefix;
// i nazwe animacji
anim_name.append(temp);
data >> temp;
sound_name = PATH_SOUNDS_ACTIONS;
// i nazwe dzwieku
if(temp != "NULL")
sound_name.append(temp);
else
sound_name = "NULL";
data >> skipws >> priority;
anim_sets.push_back(boost::make_tuple(anim_name, sound_name, priority));
//cout << anim_name << endl;
//cout << sound_name << endl;
//cout << priority << endl;
}
}
}
refillCAnimator(anim_sets);
return true;
}
void CAnimator::refillCAnimator( const list< tuple_sai > anim_names )
{
// Wyczysc kontener z zestawami animacji
clearCAnimator();
// Dla kazdej pary wywolaj dodanie animacji (para uchwyt + priorytet)
BOOST_FOREACH( tuple_sai t, anim_names )
{
addAnimation(t.get<0>(), t.get<1>(), t.get<2>());
}
CLog::getInstance()->sss << "CAnimation::refillCAnimator: CAnimator zostal wypelniony" << endl;
logs(CLog::getInstance()->sss.str(), INFO);
}
void CAnimator::refillCAnimator( const list< tuple_sai > anim_names, const utils::AnimMode& mode )
{
animMode_ = mode;
refillCAnimator(anim_names);
}
// uzywane przy default
void CAnimator::refillCAnimatorDefault()
{
clearCAnimator();
addAnimation( "default", "NULL", 1);
CLog::getInstance()->sss << "CAnimation::refillCAnimator: CAnimator zostal wypelniony" << endl;
logs(CLog::getInstance()->sss.str(), INFO);
}
void CAnimator::addAnimation(const string filename, const string audioname, const int priority)
{
CSound sound;
if( audioname != "NULL" )
sound.openFile(audioname, audioname);
// dodaj wartosc do sumy priorytetow
prioritySum_ += priority;
// dodaj uchwyt z priorytetem do wektora
animSetHandles_.push_back(boost::make_tuple(CAnimationMgr::getInstance()->getCAnimation(filename), audioname, priority) );
CLog::getInstance()->sss << "CAnimator::addAnimation: Dodano animacje o nazwie " << filename << " dzwieku " << audioname << " i priorytecie " << priority << endl;
logs(CLog::getInstance()->sss.str(), INFO);
}
void CAnimator::clearCAnimator()
{
// wyczysc wektor uchwytow i priorytetow
animSetHandles_.erase(animSetHandles_.begin(), animSetHandles_.end());
animSetHandles_.clear();
}
void CAnimator::setAnimMode(const utils::AnimMode& mode )
{
animMode_ = mode;
}
void CAnimator::resetCAnimator()
{
animState_ = STOP;
currentFrame_ = 0;
}
void CAnimator::pauseAnimation()
{
animState_ = STOP;
if(soundChannel_ != -1)
CAudioSystem::getInstance()->stop_sound(soundChannel_);
}
void CAnimator::playAnimation()
{
int i = 0;
// jesli animacja ma tryb ciagly
if( animMode_ != ANIM_NONE ) {
//jesli jest losowa
if( animMode_ == ANIM_RANDOM )
{
int random_nr, curr_prior_sum = 0;
static boost::mt19937 rng(static_cast<unsigned int>(std::time(0)));
boost::uniform_int<> distrib(0,prioritySum_);
boost::variate_generator<boost::mt19937&, boost::uniform_int<> > probability(rng, distrib);
random_nr = probability();
// na bazie priorytetow wybierz odpowiedni zestaw animacji
while( curr_prior_sum < random_nr && i <= static_cast<int>( animSetHandles_.size() ) )
{
curr_prior_sum += animSetHandles_[i].get<2>();
currentAnimSet_ = i;
i++;
}
}
animState_ = FORWARD;
if( animSetHandles_[currentAnimSet_].get<1>() != "NULL")
soundChannel_ = CAudioSystem::getInstance()->play_sound(animSetHandles_[currentAnimSet_].get<1>(), location_, volume_);
else
soundChannel_ = -1;
// ustaw czas ostatniej klatki
lastFrameTime_ = SDL_GetTicks();
}
// w przeciwnym wypadku zatrzymaj animacje
else
{
animState_ = STOP;
if( soundChannel_ != -1)
CAudioSystem::getInstance()->stop_sound(soundChannel_);
}
}
// opakowanie dlugiego zapytania w krotszej formie
CAnimation* CAnimator::accessAnimation(const HCAnimation animation_handle) const
{
return CAnimationMgr::getInstance()->getCAnimationPtr(animation_handle);
}
void CAnimator::setAudioParam(const int position, const int distance)
{
location_ = position;
volume_ = distance;
}
void CAnimator::animate(const float x, const float y)
{
// Rysuj klatke animacji
CVideoSystem::getInstance()->drawCSprite(x, y, CSpriteMgr::getInstance()->getCSpritePtr(accessAnimation(animSetHandles_[currentAnimSet_].get<0>())->getAnimSet()[currentFrame_].first));
// Jesli jest juz czas na zmiane na nastepna klatke i animacja jest odtwarzana
if( animState_ == FORWARD && ( accessAnimation(animSetHandles_[currentAnimSet_].get<0>())->getDelayOf(currentFrame_) * 1000) < (SDL_GetTicks() - lastFrameTime_) )
{
// zmien klatke
currentFrame_ += animState_;
//cout << "CAnimator::animate: Obecnie wyswietlana jest klatka: " << currentFrame_ << endl;
// sprawdz, czy animacja wyswietlila sie juz cala
if( currentFrame_ >= accessAnimation(animSetHandles_[currentAnimSet_].get<0>())->getNoOfAnimationFrames() )
{
// jesli tak, to sprawdz, czy nalezy odtwarzac dalej
switch(animMode_)
{
// jesli sekwencja ma byc odtworzona tylko jednokrotnie
case utils::ANIM_ONCE:
// sprawdz, czy numer obecnie odtwarzanej podsekwencji jest maksymalnym (co oznacza, ze sekwencja zostala odegrana w calosci)
if( currentAnimSet_ + 1 >= static_cast<int>( animSetHandles_.size() ) )
{
// jesli tak, to zakoncz odtwarzanie
currentAnimSet_ = 0;
pauseAnimation();
}
else
{
currentAnimSet_++;
playAnimation();
}
break;
// jesli sekwencja ma byc zapetlana
case utils::ANIM_LOOP:
// gdy zostanie osiagniety koniec sekwencji
if( currentAnimSet_ + 1 >= static_cast<int>( animSetHandles_.size() ) )
// zacznij od poczatku
currentAnimSet_ = 0;
else
// w innym wypadku przejdz do nastepnej sekwencji
currentAnimSet_++;
playAnimation();
break;
// jesli sekwencja ma byc odtwarzana w sposob losowy
case utils::ANIM_RANDOM:
// przejdz do metody w ktorej jest losowana nastepna podsekwencja
playAnimation();
break;
// jesli sekwencja jest statyczna (nie jest animacja)
case utils::ANIM_NONE:
default:
// wstrzymaj ja
pauseAnimation();
CLog::getInstance()->sss << "CAnimator::animate: Nieznany tryb animacji!" << endl;
logs(CLog::getInstance()->sss.str(), ERR);
break;
}
// zacznij od zerowej klatki
currentFrame_ = 0;
}
// oblicz czas do nastepnej zmiany klatki
lastFrameTime_ = SDL_GetTicks();
// cout << "CAnimator::animate: Czas obecnej klatki: " << lastFrameTime_ << endl;
}
}
//~~CAnimator.cpp
| [
"fester3000@8e29c490-c8d6-11de-b6dc-25c59a28ecba",
"r.malinowski88@8e29c490-c8d6-11de-b6dc-25c59a28ecba"
]
| [
[
[
1,
5
],
[
7,
302
]
],
[
[
6,
6
]
]
]
|
efac82ace358263b903a623a19b13ee94ba5adc2 | 74d531abb9fda8dc621c5d8376eb10ec4ef19568 | /src/player.h | a6039a12a6eb16425e80be00b5aec6a9015b87e1 | []
| no_license | aljosaosep/xsoko | e207d6ec8de3196029e569e7765424a399a50f04 | c52440ecee65dc2f3f38d996936e65b3ff3b8b5e | refs/heads/master | 2021-01-10T14:27:04.644013 | 2009-09-02T20:39:53 | 2009-09-02T20:39:53 | 49,592,571 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,899 | h | /*
* codename: xSoko
* Copyright (C) Aljosa Osep, Jernej Skrabec, Jernej Halozan 2008 <[email protected], [email protected], [email protected]>
*
* xSoko project is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* xSoko project is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* File: player.h
* Author: jernej
* Desc: Includes player class definition
*
* Created on Ponedeljek, 14 julij 2008, 18:56
* Modified: aljosa on Torek, 15 julij 2008, 12:25 (conflict resloving)
* aljosa on Petek, 18 julij 2008, 11:48; score moved to game session class(session.h)
*/
#ifndef __PLAYER_H
#define __PLAYER_H
#include <iostream>
#include "levelbox.h"
using namespace std;
using namespace PacGame::GameClasses;
using namespace PacGame::Aliases;
namespace PacGame
{
namespace GameClasses
{
namespace GameObjects
{
/**********************************************************
* PPlayer
*
* Represents player entity
* --------------------------------------------------------
* Aljosa 2008
* ********************************************************/
class PPlayer : public PLevelObject
{
private:
// int score;
unsigned bombs;
float curFrame;
int firstFrame, lastFrame;
public:
// constructors
PPlayer(PCore *core);
PPlayer(int i, int j, PCore *core);
// setters
void setBombs(unsigned _bombs);
// getters
unsigned short getBombs();
// increase +1
void incBombs();
// decrease -1
void decBombs();
// to override
void draw();
void print();
// movement and animation
bool animate(double time);
short isPlayerMovePossible(int direction);
};
}
}
}
#endif /* _PLAYER_H */
| [
"aljosa.osep@d77d96cf-bc4d-0410-95e8-7f58e8f99bdb",
"jernej.halozan@d77d96cf-bc4d-0410-95e8-7f58e8f99bdb",
"Martin.Savc@d77d96cf-bc4d-0410-95e8-7f58e8f99bdb"
]
| [
[
[
1,
19
],
[
22,
22
],
[
25,
26
],
[
30,
31
],
[
33,
34
],
[
38,
38
],
[
42,
57
],
[
61,
80
],
[
84,
84
],
[
87,
89
]
],
[
[
20,
21
],
[
23,
24
],
[
27,
29
],
[
32,
32
],
[
35,
37
],
[
39,
41
],
[
90,
93
]
],
[
[
58,
60
],
[
81,
83
],
[
85,
86
]
]
]
|
70b59fb246d351a7f927a07d40e97449da83b485 | c143870b3ecebf7f32953c78cee27a75266524dc | /DBGR.inc | 35eff64785963b2851cdceb1022d39a0de42f4b5 | []
| no_license | xx7y7xx/lsacpi | 898990a3d4500c595d753e47f17b980dce911278 | cf90040a9bac4863d5d3352db18f39496310b3dd | refs/heads/master | 2021-05-30T12:54:51.617075 | 2009-07-11T12:56:21 | 2009-07-11T12:56:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,335 | inc | ;*******************************************************************************
; Filename: PrtTab.asm
; Description: This runtine is involved by lsACPI.asm
; Print RSDP, RSDT ... tables.
;*******************************************************************************
assume cs:code
code segment
;*******************************************************************************
; Procedure: PrintDebugCode
;
; Description: Print Debug_Code.
;
; Input: None.
;
; Output: None.
;
; Change: .
;
;*******************************************************************************
PrintDebugCode proc near
push bx
push dx
call PrintEnter
mov bl, ds:Debug_Code
call PrintBLByBit
call PrintEnter
mov dx, offset ds:Debug_Code_BIT0
call PrintString
mov dx, offset ds:Debug_Code_BIT1
call PrintString
mov dx, offset ds:Debug_Code_BIT2
call PrintString
pop dx
pop bx
ret
PrintDebugCode endp
;===============================================================================
;/*
; * Debug, set a break,
; * press ESC to quit of the routine,
; * press enter to jmp to the routine
; */
;debug proc near
; int key;
; while(1)
; {
; key = bioskey(0);
; if(key==0x011b)
; exit(0);
; else if(key==0x1c0d)
; break;
; else
; continue;
; }
;debug endp
code ends | [
"xiaomao101@cb825533-65dd-2cb6-bd03-7ec4aa741891"
]
| [
[
[
1,
64
]
]
]
|
abf2f0801e6266ceb5fb5e009140c87c97d4e244 | 904b92806d75601317f0158eb142d3565c0b0aba | /vstParameterContainer.cpp | 2a63d275d84b679faf0ff14901bfacf9d2678409 | []
| no_license | alessandrostone/bitmangler | 604735d457f9ef68004caf664695005c087d1b79 | 830e6e473a7aa0795385152cd4066c6d46e84cfd | refs/heads/master | 2016-08-12T06:43:35.508327 | 2008-07-25T18:23:50 | 2008-07-25T18:23:50 | 45,255,449 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 488 | cpp | // vstParameterContainer.cpp: implementation of the vstParameterContainer class.
//
//////////////////////////////////////////////////////////////////////
#include "vstParameterContainer.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
vstParameterContainer::vstParameterContainer()
{
}
vstParameterContainer::~vstParameterContainer()
{
}
| [
"kubiak.roman@a8fb966b-8e52-0410-b8b9-d5648befe747"
]
| [
[
[
1,
19
]
]
]
|
0b87af887a52dc034ec7de1987574568ae232eee | e354a51eef332858855eac4c369024a7af5ff804 | /bench.h | 50b4fbad428af7e1e69b16c7d33532662a5ca2be | []
| no_license | cjus/msgCourierLite | 0f9c1e05b71abf820c55f74a913555eec2267bb4 | 9efc1d54737ba47620a03686707b31b1eeb61586 | refs/heads/master | 2020-04-05T22:41:39.141740 | 2010-09-05T18:43:12 | 2010-09-05T18:43:12 | 887,172 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,403 | h | /* bench.h
Copyright (C) 2004 Carlos Justiniano
[email protected], [email protected], [email protected]
bench.h is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
bench.h was developed by Carlos Justiniano for use on the
msgCourier project and the ChessBrain Project and is now distributed in
the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License
along with bench.h; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
@file bench.h
@brief Benchmark component
@author Carlos Justiniano
@attention Copyright (C) 2004 Carlos Justiniano, GNU GPL Licence (see source file header)
bench header class.
*/
#ifndef BENCH_H
#define BENCH_H
#ifdef _PLATFORM_WIN32
#include <windows.h>
#endif //_PLATFORM_WIN32
#ifndef _PLATFORM_WIN32
#include <unistd.h>
#include <sys/time.h>
#endif //not _PLATFORM_WIN32
#include <time.h>
#include "log.h"
#include <string>
#include <sstream>
class cBench
{
public:
cBench();
~cBench();
cBench(char *pFile, char *pLabel, int iLine);
cBench &operator =(const cBench&);
double GetTimeStamp();
void Start();
void Stop();
double Elapsed();
double ElapsedMicroSeconds();
void LogElapsedTime();
#ifdef _PLATFORM_WIN32
void SetStart(LARGE_INTEGER &start);
#endif
#ifndef _PLATFORM_WIN32
void SetStart(timeval &m_tvalStart);
#endif
private:
std::string m_sLabel;
#ifdef _PLATFORM_WIN32
int m_once;
LARGE_INTEGER m_start;
LARGE_INTEGER m_stop;
LARGE_INTEGER m_freq;
#endif //_PLATFORM_WIN32
#ifndef _PLATFORM_WIN32
timeval m_tvalStart;
timeval m_tvalStop;
#endif //not _PLATFORM_WIN32
};
#ifdef NDEBUG
#define ST(LABEL) ((void)0)
#define ST_BEGIN(LABEL) ((void)0)
#define ST_END() ((void)0)
#else
#define ST(LABEL) cBench _scopebench(__FILE__,LABEL,__LINE__);
#define ST_BEGIN(LABEL) { cBench _scopebench(__FILE__,LABEL,__LINE__);
#define ST_END() }
#endif//NDEBUG
#endif // BENCH_H
| [
"[email protected]"
]
| [
[
[
1,
96
]
]
]
|
a3425be7fd472b5ce39d01acc1acd3e10e6ca423 | 3472e587cd1dff88c7a75ae2d5e1b1a353962d78 | /TestPThread/main.cpp | 0f18bb75e28845f79ebdcd08eecb84173bd158a7 | []
| no_license | yewberry/yewtic | 9624d05d65e71c78ddfb7bd586845e107b9a1126 | 2468669485b9f049d7498470c33a096e6accc540 | refs/heads/master | 2021-01-01T05:40:57.757112 | 2011-09-14T12:32:15 | 2011-09-14T12:32:15 | 32,363,059 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 863 | cpp | #include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define NUM_THREADS 5
void *TaskCode(void *argument) {
int tid;
tid = *((int *) argument);
printf("Hello World! It's me, thread %d!\n", tid);
/* optionally: insert more useful stuff here */
return NULL;
}
int main(int argc, char *argv[]) {
pthread_t threads[NUM_THREADS];
int thread_args[NUM_THREADS];
int rc, i;
/* create all threads */
for (i = 0; i < NUM_THREADS; ++i) {
thread_args[i] = i;
printf("In main: creating thread %d\n", i);
rc = pthread_create(&threads[i], NULL, TaskCode,
(void *) &thread_args[i]);
assert(0 == rc);
}
/* wait for all threads to complete */
for (i = 0; i < NUM_THREADS; ++i) {
rc = pthread_join(threads[i], NULL);
assert(0 == rc);
}
getchar();
exit(EXIT_SUCCESS);
}
| [
"[email protected]@5ddc4e96-dffd-11de-b4b3-6d349e4f6f86"
]
| [
[
[
1,
41
]
]
]
|
3abe8702e2bb7e05249020fed7ad8064554bc898 | 016774685beb74919bb4245d4d626708228e745e | /lib/Collide/ozcollide/ellipsoid.h | d77f0039ab31214a8427934164f70c7c4c1f305b | []
| no_license | sutuglon/Motor | 10ec08954d45565675c9b53f642f52f404cb5d4d | 16f667b181b1516dc83adc0710f8f5a63b00cc75 | refs/heads/master | 2020-12-24T16:59:23.348677 | 2011-12-20T20:44:19 | 2011-12-20T20:44:19 | 1,925,770 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,098 | h | /*
OZCollide - Collision Detection Library
Copyright (C) 2006 Igor Kravtchenko
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Contact the author: [email protected]
*/
#ifndef OZCOLLIDE_ELLIPSOID_H
#define OZCOLLIDE_ELLIPSOID_H
#ifndef OZCOLLIDE_PCH
#include <ozcollide/ozcollide.h>
#endif
#include <ozcollide/vec3f.h>
ENTER_NAMESPACE_OZCOLLIDE
class Ellipsoid {
public:
ozinline Ellipsoid() : center_(Vec3f(0, 0, 0)), radii_(Vec3f(0, 0, 0)) { };
ozinline Ellipsoid(Vec3f _c, Vec3f _r) : center_(_c), radii_(_r) { };
ozinline const Vec3f& getCenter() const { return center_; }
ozinline void setCenter(const Vec3f ¢er) { center_ = center; }
ozinline const Vec3f& getRadii() const { return radii_; }
ozinline void setRadii(const Vec3f &_radii)
{
radii_ = _radii;
invRadii_.x = 1.0f / _radii.x;
invRadii_.y = 1.0f / _radii.y;
invRadii_.z = 1.0f / _radii.z;
}
// Get the inverse radii. The result is cached from the last setRadii()'s call.
ozinline const Vec3f& getInvRadii() const { return invRadii_; }
// Get the support ellipsoid's point of a point
// (a support point is a point located on the volume perimeter)
ozinline Vec3f support(const Vec3f &_pt)
{
Vec3f p = (_pt - center_) * invRadii_;
p.normalize();
return p * radii_ + center_;
}
protected:
Vec3f center_;
Vec3f radii_;
Vec3f invRadii_;
};
LEAVE_NAMESPACE
#endif
| [
"[email protected]"
]
| [
[
[
1,
70
]
]
]
|
f6d2c05b39b23359bf49b65e3e3d86d9cde67b31 | c5534a6df16a89e0ae8f53bcd49a6417e8d44409 | /trunk/Dependencies/Xerces/include/xercesc/framework/psvi/XSWildcard.hpp | 54923df623f760f73d623fe3d17f653fce4209b3 | []
| no_license | svn2github/ngene | b2cddacf7ec035aa681d5b8989feab3383dac012 | 61850134a354816161859fe86c2907c8e73dc113 | refs/heads/master | 2023-09-03T12:34:18.944872 | 2011-07-27T19:26:04 | 2011-07-27T19:26:04 | 78,163,390 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,508 | hpp | /*
* Copyright 2003,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: XSWildcard.hpp 191054 2005-06-17 02:56:35Z jberry $
*/
#if !defined(XSWILDCARD_HPP)
#define XSWILDCARD_HPP
#include <xercesc/framework/psvi/XSObject.hpp>
XERCES_CPP_NAMESPACE_BEGIN
/**
* This class describes all properties of a Schema Wildcard
* component.
* This is *always* owned by the validator /parser object from which
* it is obtained.
*/
// forward declarations
class XSAnnotation;
class SchemaAttDef;
class ContentSpecNode;
class XMLPARSER_EXPORT XSWildcard : public XSObject
{
public:
// Namespace Constraint
enum NAMESPACE_CONSTRAINT {
/**
* Namespace Constraint: any namespace is allowed.
*/
NSCONSTRAINT_ANY = 1,
/**
* Namespace Constraint: namespaces in the list are not allowed.
*/
NSCONSTRAINT_NOT = 2,
/**
* Namespace Constraint: namespaces in the list are allowed.
*/
NSCONSTRAINT_DERIVATION_LIST = 3
};
// Process contents
enum PROCESS_CONTENTS {
/**
* There must be a top-level declaration for the item available, or the
* item must have an xsi:type, and the item must be valid as appropriate.
*/
PC_STRICT = 1,
/**
* No constraints at all: the item must simply be well-formed XML.
*/
PC_SKIP = 2,
/**
* If the item, or any items among its [children] is an element
* information item, has a uniquely determined declaration available, it
* must be valid with respect to that definition, that is, validate
* where you can, don't worry when you can't.
*/
PC_LAX = 3
};
// Constructors and Destructor
// -----------------------------------------------------------------------
/** @name Constructors */
//@{
/**
* The default constructor
*
* @param attWildCard
* @param annot
* @param xsModel
* @param manager The configurable memory manager
*/
XSWildcard
(
SchemaAttDef* const attWildCard
, XSAnnotation* const annot
, XSModel* const xsModel
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
XSWildcard
(
const ContentSpecNode* const elmWildCard
, XSAnnotation* const annot
, XSModel* const xsModel
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
//@}
/** @name Destructor */
//@{
~XSWildcard();
//@}
//---------------------
/** @name XSWildcard methods */
//@{
/**
* Namespace constraint: A constraint type: any, not, list.
*/
NAMESPACE_CONSTRAINT getConstraintType() const;
/**
* Namespace constraint. For <code>constraintType</code>
* <code>NSCONSTRAINT_DERIVATION_LIST</code>, the list contains allowed namespaces.
* For <code>constraintType</code> <code>NSCONSTRAINT_NOT</code>, the
* list contains disallowed namespaces.
*/
StringList *getNsConstraintList();
/**
* [process contents]: one of skip, lax or strict. Valid constants values
* are: <code>PC_SKIP, PC_LAX, PC_STRICT</code>.
*/
PROCESS_CONTENTS getProcessContents() const;
/**
* Optional. An [annotation].
*/
XSAnnotation *getAnnotation() const;
//@}
//----------------------------------
/** methods needed by implementation */
//@{
//@}
private:
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
XSWildcard(const XSWildcard&);
XSWildcard & operator=(const XSWildcard &);
/**
* Build namespace list
*/
void buildNamespaceList(const ContentSpecNode* const rootNode);
protected:
// -----------------------------------------------------------------------
// data members
// -----------------------------------------------------------------------
NAMESPACE_CONSTRAINT fConstraintType;
PROCESS_CONTENTS fProcessContents;
StringList* fNsConstraintList;
XSAnnotation* fAnnotation;
};
inline XSAnnotation *XSWildcard::getAnnotation() const
{
return fAnnotation;
}
inline XSWildcard::PROCESS_CONTENTS XSWildcard::getProcessContents() const
{
return fProcessContents;
}
inline StringList* XSWildcard::getNsConstraintList()
{
return fNsConstraintList;
}
inline XSWildcard::NAMESPACE_CONSTRAINT XSWildcard::getConstraintType() const
{
return fConstraintType;
}
XERCES_CPP_NAMESPACE_END
#endif
| [
"Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57"
]
| [
[
[
1,
200
]
]
]
|
dd5e9f4e1ec1c5a87d75ec53b105d8512c705bf1 | cd61c8405fae2fa91760ef796a5f7963fa7dbd37 | /Sauron/Vision/ColorProfile.h | 08ad5f50828ad51a2f2630d4f7fb8a85e0dab9ed | []
| no_license | rafaelhdr/tccsauron | b61ec89bc9266601140114a37d024376a0366d38 | 027ecc2ab3579db1214d8a404d7d5fa6b1a64439 | refs/heads/master | 2016-09-05T23:05:57.117805 | 2009-12-14T09:41:58 | 2009-12-14T09:41:58 | 32,693,544 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 881 | h | #ifndef __COLOR_PROFILE_H__
#define __COLOR_PROFILE_H__
#include "BaseTypes.h"
#include "Image.h"
#include "DiscretizedLine.h"
namespace sauron
{
class ColorProfile
{
public:
ColorProfile( const Image &im, const DiscretizedLine &line, uint size );
ColorProfile( const ColorProfile &other );
~ColorProfile();
float compare( const ColorProfile &other ) const;
static void persist( const ColorProfile &colorProfile, std::ostream &stream );
static ColorProfile restore( std::istream &stream );
private:
ColorProfile();
void calculate( const Image &im, const DiscretizedLine &line, uint size );
private:
byte m_left[3];
byte m_right[3];
byte m_meanLeft;
byte m_meanRight;
};
} // namespace sauron
#endif // __COLOR_PROFILE_H__ | [
"fggodoy@8373e73c-ebb0-11dd-9ba5-89a75009fd5d"
]
| [
[
[
1,
38
]
]
]
|
a748a2af5d97cf2ed3dd9c5e2f289b4bf26edceb | c10e9d0d2654ac9b229c37dd0316f5265b0295e4 | /flamelet/bcCheck.cc | f88350fe39938cd2bce57527f3888b5b7db4e997 | []
| no_license | hanshaoqiang/locistream-fsi-coupling | 600cf51c490604fd19f3d335ff06abcc0e1506fe | 610a5b50933333bf6f43bc0b0ec19cc849dcb543 | refs/heads/master | 2021-05-30T07:07:50.266714 | 2010-08-06T20:37:11 | 2010-08-06T20:37:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,556 | cc | // Loci includes.
#include <Loci.h>
// StreamUns includes.
#include "gridReader/readGrid.h"
#include "sciTypes.h"
namespace streamUns {
// Checks incompressible inlet boundaries.
class FlameletCheckIncompressibleInlet : public BC_Check {
private:
string errorMessage ;
public:
FlameletCheckIncompressibleInlet() : errorMessage("") {}
public:
string BoundaryConditions() { return "incompressibleInlet" ; }
bool CheckOptions(const options_list& bc_options,fact_db &facts) {
param<string> flowRegime=facts.get_fact("flowRegime") ;
if(*flowRegime!="turbulent"){
errorMessage="flowRegime must be turbulent for flamelet model." ;
return false ;
}
if(!bc_options.optionExists("Z")) {
errorMessage="Must specify 'Z'." ;
return false ;
}
if(!bc_options.optionExists("Zvar")) {
errorMessage="Must specify 'Zvar'." ;
return false ;
}
return true ;
}
ostream &ErrorMessage(std::ostream &s) {
s << errorMessage << endl ; return s ;
}
string VariablesChecked(fact_db &facts) {
string s="Z,Zvar" ;
return s ;
}
} ;
register_BC<FlameletCheckIncompressibleInlet> registerFlameletCheckIncompressibleInlet ;
} | [
"kang.changkwon@df672642-8131-7598-9fc3-e82a97abac7c"
]
| [
[
[
1,
49
]
]
]
|
f609e16053138999586afd449b7fce8f5e98d441 | eb7a57e7cf69b4f4f3ee1ecc46b12b24f8b094f8 | /Kickapoo/Input.cpp | f4b65cbaf093f3d1544f816a5d43a39f11ba3b5d | []
| no_license | gosuwachu/polidea-igk-2011 | 93df514d4d3f2a89d23746e60b4011a3e7be9c01 | 03ec935846d106004288e13de77995a54eae5272 | refs/heads/master | 2021-01-23T11:49:59.847960 | 2011-03-27T20:30:51 | 2011-03-27T20:30:51 | 32,650,639 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,583 | cpp | #include "Common.h"
#include "Input.h"
#define check(a) a
void Input::init(HINSTANCE appInstance, bool isExclusive)
{
if ( FAILED( DirectInput8Create(appInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&pDI, NULL) ) )
{
return;
}
// init myszki
check( pDI->CreateDevice(GUID_SysMouse, &pDIDev, NULL) );
check( pDIDev->SetDataFormat(&c_dfDIMouse) );
DWORD flags;
if (isExclusive)
flags = DISCL_FOREGROUND | DISCL_EXCLUSIVE | DISCL_NOWINKEY;
else
flags = DISCL_FOREGROUND | DISCL_NONEXCLUSIVE;
check( pDIDev->SetCooperativeLevel(g_Window()->getHWND(), flags ));
check( pDIDev->Acquire() );
check( pDIDev->GetDeviceState(sizeof(DIMOUSESTATE), &state) );
// wyczyszczenie stanu klawiszy
for(int i = 0; i < 256; i++) {
keys[i] = tempKeys[i] = false;
}
}
void Input::release()
{
unacquire();
if (pDIDev)
{
pDIDev->Unacquire();
pDIDev->Release();
}
if ( FAILED( pDI->Release() ) )
return;
}
bool Input::acquire()
{
return !FAILED( pDIDev->Acquire() );
}
bool Input::unacquire()
{
return !FAILED( pDIDev->Unacquire() );
}
void Input::update()
{
// update klawiszy
for (int i = 0; i < 256; i++)
{
bool state = static_cast<bool>(GetAsyncKeyState(i));
tempKeys[i] = (state != keys[i]);
keys[i] = state;
}
// update myszki
if ( FAILED( pDIDev->GetDeviceState(sizeof(DIMOUSESTATE), &state) ) )
{
if ( FAILED( pDIDev->Acquire() ) )
return;
if ( FAILED( pDIDev->GetDeviceState(sizeof(DIMOUSESTATE), &state) ) )
return;
}
}
| [
"[email protected]@6b609280-a7e5-20d7-3a34-d6fd9d7be190"
]
| [
[
[
1,
76
]
]
]
|
8902028dc1178af05f5c525735a815a49923fee4 | 1c9f99b2b2e3835038aba7ec0abc3a228e24a558 | /Projects/elastix/elastix_sources_v4/src/Common/Transforms/itkBSplineInterpolationSecondOrderDerivativeWeightFunction.h | 6f203b6dd2644db3a885a61d1e8ddb1a64677fe5 | []
| no_license | mijc/Diploma | 95fa1b04801ba9afb6493b24b53383d0fbd00b33 | bae131ed74f1b344b219c0ffe0fffcd90306aeb8 | refs/heads/master | 2021-01-18T13:57:42.223466 | 2011-02-15T14:19:49 | 2011-02-15T14:19:49 | 1,369,569 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,256 | h | /*======================================================================
This file is part of the elastix software.
Copyright (c) University Medical Center Utrecht. All rights reserved.
See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
======================================================================*/
#ifndef __itkBSplineInterpolationSecondOrderDerivativeWeightFunction_h
#define __itkBSplineInterpolationSecondOrderDerivativeWeightFunction_h
#include "itkBSplineInterpolationWeightFunctionBase.h"
#include "vnl/vnl_vector_fixed.h"
namespace itk
{
/** \class BSplineInterpolationSecondOrderDerivativeWeightFunction
* \brief Returns the weights over the support region used for B-spline
* interpolation/reconstruction.
*
* Computes/evaluate the B-spline interpolation weights over the
* support region of the B-spline.
*
* This class is templated over the coordinate representation type,
* the space dimension and the spline order.
*
* \sa Point
* \sa Index
* \sa ContinuousIndex
*
* \ingroup Functions ImageInterpolators
*/
template < class TCoordRep = float,
unsigned int VSpaceDimension = 2,
unsigned int VSplineOrder = 3 >
class ITK_EXPORT BSplineInterpolationSecondOrderDerivativeWeightFunction :
public BSplineInterpolationWeightFunctionBase<
TCoordRep, VSpaceDimension, VSplineOrder >
{
public:
/** Standard class typedefs. */
typedef BSplineInterpolationSecondOrderDerivativeWeightFunction Self;
typedef BSplineInterpolationWeightFunctionBase<
TCoordRep, VSpaceDimension, VSplineOrder > Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** New macro for creation of through the object factory. */
itkNewMacro( Self );
/** Run-time type information (and related methods). */
itkTypeMacro( BSplineInterpolationSecondOrderDerivativeWeightFunction,
BSplineInterpolationWeightFunctionBase );
/** Space dimension. */
itkStaticConstMacro( SpaceDimension, unsigned int, VSpaceDimension );
/** Spline order. */
itkStaticConstMacro( SplineOrder, unsigned int, VSplineOrder );
/** Typedefs from Superclass. */
typedef typename Superclass::WeightsType WeightsType;
typedef typename Superclass::IndexType IndexType;
typedef typename Superclass::SizeType SizeType;
typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
/** Set the second order derivative directions. */
virtual void SetDerivativeDirections( unsigned int dir0, unsigned int dir1 );
protected:
BSplineInterpolationSecondOrderDerivativeWeightFunction();
~BSplineInterpolationSecondOrderDerivativeWeightFunction() {}
/** Interpolation kernel types. */
typedef typename Superclass::KernelType KernelType;
typedef typename Superclass::DerivativeKernelType DerivativeKernelType;
typedef typename Superclass
::SecondOrderDerivativeKernelType SecondOrderDerivativeKernelType;
typedef typename Superclass::TableType TableType;
typedef typename Superclass::OneDWeightsType OneDWeightsType;
/** Compute the 1D weights, which are:
* \f[ \beta( x[i] - startIndex[i] ), \beta( x[i] - startIndex[i] - 1 ),
* \beta( x[i] - startIndex[i] - 2 ), \beta( x[i] - startIndex[i] - 3 ), \f]
* with \f$\beta( x ) = \beta^2( x + 1/2 ) - \beta^2( x - 1/2 )\f$,
* in case of non-equal derivative directions,
* with \f$\beta( x ) = \beta^1( x + 1 ) - 2 * \beta^1( x ) + \beta^1( x - 1 ),\f$
* in case of equal derivative directions,
* with \f$\beta(x) = \beta^3(x)\f$ for the non-derivative directions.
*/
virtual void Compute1DWeights(
const ContinuousIndexType & index,
const IndexType & startIndex,
OneDWeightsType & weights1D ) const;
/** Print the member variables. */
virtual void PrintSelf( std::ostream & os, Indent indent ) const;
private:
BSplineInterpolationSecondOrderDerivativeWeightFunction(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
vnl_vector_fixed< double, 2 > m_DerivativeDirections;
bool m_EqualDerivativeDirections;
};
} // end namespace itk
// Define instantiation macro for this template.
#define ITK_TEMPLATE_BSplineInterpolationSecondOrderDerivativeWeightFunction(_, EXPORT, x, y) namespace itk { \
_(3(class EXPORT BSplineInterpolationSecondOrderDerivativeWeightFunction< ITK_TEMPLATE_3 x >)) \
namespace Templates { typedef BSplineInterpolationSecondOrderDerivativeWeightFunction< ITK_TEMPLATE_3 x > BSplineInterpolationSecondOrderDerivativeWeightFunction##y; } \
}
#if ITK_TEMPLATE_EXPLICIT
# include "Templates/itkBSplineInterpolationSecondOrderDerivativeWeightFunction+-.h"
#endif
#if ITK_TEMPLATE_TXX
# include "itkBSplineInterpolationSecondOrderDerivativeWeightFunction.txx"
#endif
#endif
| [
"[email protected]"
]
| [
[
[
1,
132
]
]
]
|
b4c3a19511b9af3f7e5cbacf13da43941356872f | 29f0a6c56e3c4528f64c3a1ad18fc5f074ae1146 | /Praktikum Info2/Aufgabenblock_2/Losfahren.cpp | be33decb95de076f3fcfa009bb1e7b0270aaa0f6 | []
| no_license | JohN-D/Info-2-Praktikum | 8ccb0348bedf38a619a39b17b0425d6b4c16a72d | c11a274e9c4469a31f40d0abec2365545344b534 | refs/heads/master | 2021-01-01T18:34:31.347062 | 2011-10-19T20:18:47 | 2011-10-19T20:18:47 | 2,608,736 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 416 | cpp | #include "Losfahren.h"
#include <iostream>
#include "Fahrzeug.h"
#include "Weg.h"
using namespace std;
Losfahren::Losfahren(void)
{
}
Losfahren::~Losfahren(void)
{
}
void Losfahren::vBearbeiten(void)
{
cout << "LOSFAHREN: " << endl << (*p_pFahrzeug) << endl << (*p_pWeg) << endl << endl;
p_pFahrzeug->vNeueStrecke(p_pWeg);
p_pWeg->vAbgabe(p_pFahrzeug);
p_pWeg->vAnnahme(p_pFahrzeug);
} | [
"[email protected]"
]
| [
[
[
1,
23
]
]
]
|
d84db32e0efccbe20a01550d4645142fdbcf9817 | 33f59b1ba6b12c2dd3080b24830331c37bba9fe2 | /Depend/Foundation/Interpolation/Wm4IntpAkima1.cpp | 877c5f9de3c5314b37fe54694b15573d31405bd3 | []
| no_license | daleaddink/flagship3d | 4835c223fe1b6429c12e325770c14679c42ae3c6 | 6cce5b1ff7e7a2d5d0df7aa0594a70d795c7979a | refs/heads/master | 2021-01-15T16:29:12.196094 | 2009-11-01T10:18:11 | 2009-11-01T10:18:11 | 37,734,654 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,002 | cpp | // Geometric Tools, Inc.
// http://www.geometrictools.com
// Copyright (c) 1998-2006. All Rights Reserved
//
// The Wild Magic Version 4 Foundation Library source code is supplied
// under the terms of the license agreement
// http://www.geometrictools.com/License/Wm4FoundationLicense.pdf
// and may not be copied or disclosed except in accordance with the terms
// of that agreement.
#include "Wm4FoundationPCH.h"
#include "Wm4IntpAkima1.h"
#include "Wm4Math.h"
namespace Wm4
{
//----------------------------------------------------------------------------
template <class Real>
IntpAkima1<Real>::IntpAkima1 (int iQuantity, Real* afF)
{
// At least three data points are needed to construct the estimates of
// the boundary derivatives.
assert(iQuantity >= 3 && afF);
m_iQuantity = iQuantity;
m_afF = afF;
m_akPoly = WM4_NEW Polynomial[iQuantity-1];
}
//----------------------------------------------------------------------------
template <class Real>
IntpAkima1<Real>::~IntpAkima1 ()
{
WM4_DELETE[] m_akPoly;
}
//----------------------------------------------------------------------------
template <class Real>
int IntpAkima1<Real>::GetQuantity () const
{
return m_iQuantity;
}
//----------------------------------------------------------------------------
template <class Real>
const Real* IntpAkima1<Real>::GetF () const
{
return m_afF;
}
//----------------------------------------------------------------------------
template <class Real>
const typename IntpAkima1<Real>::Polynomial*
IntpAkima1<Real>::GetPolynomials () const
{
return m_akPoly;
}
//----------------------------------------------------------------------------
template <class Real>
const typename IntpAkima1<Real>::Polynomial&
IntpAkima1<Real>::GetPolynomial (int i) const
{
assert(0 <= i && i < m_iQuantity-1);
return m_akPoly[i];
}
//----------------------------------------------------------------------------
template <class Real>
Real IntpAkima1<Real>::ComputeDerivative (Real* afSlope) const
{
if (afSlope[1] != afSlope[2])
{
if (afSlope[0] != afSlope[1])
{
if (afSlope[2] != afSlope[3])
{
Real fAD0 = Math<Real>::FAbs(afSlope[3] - afSlope[2]);
Real fAD1 = Math<Real>::FAbs(afSlope[0] - afSlope[1]);
return (fAD0*afSlope[1]+fAD1*afSlope[2])/(fAD0+fAD1);
}
else
{
return afSlope[2];
}
}
else
{
if (afSlope[2] != afSlope[3])
{
return afSlope[1];
}
else
{
return ((Real)0.5)*(afSlope[1]+afSlope[2]);
}
}
}
else
{
return afSlope[1];
}
}
//----------------------------------------------------------------------------
template <class Real>
Real IntpAkima1<Real>::operator() (Real fX) const
{
int iIndex;
Real fDX;
if (Lookup(fX,iIndex,fDX))
{
return m_akPoly[iIndex](fDX);
}
return Math<Real>::MAX_REAL;
}
//----------------------------------------------------------------------------
template <class Real>
Real IntpAkima1<Real>::operator() (int iOrder, Real fX) const
{
int iIndex;
Real fDX;
if (Lookup(fX,iIndex,fDX))
{
return m_akPoly[iIndex](iOrder,fDX);
}
return Math<Real>::MAX_REAL;
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// explicit instantiation
//----------------------------------------------------------------------------
template WM4_FOUNDATION_ITEM
class IntpAkima1<float>;
template WM4_FOUNDATION_ITEM
class IntpAkima1<double>;
//----------------------------------------------------------------------------
}
| [
"yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa"
]
| [
[
[
1,
137
]
]
]
|
341c8ce5beef5a06c1995897eb2a7cbdb5fc27ac | 3c4f5bd6d7ac3878c181fb05ab41c1d755ddf343 | /XLogFont.h | 886b320d26a610676abb6680059074561dcbf368 | []
| no_license | imcooder/public | 1078df18c1459e67afd1200346dd971ea3b71933 | be947923c6e2fbd9c993a41115ace3e32dad74bf | refs/heads/master | 2021-05-28T08:43:00.027020 | 2010-07-24T07:39:51 | 2010-07-24T07:39:51 | 32,301,120 | 2 | 1 | null | null | null | null | GB18030 | C++ | false | false | 785 | h |
/********************************************************************
Copyright (c) 2002-2003 汉王科技有限公司. 版权所有.
文件名称: XLogFont.h
文件内容:
版本历史: 1.0
作者: xuejuntao [email protected] 2008/08/18
*********************************************************************/
#ifndef HWX_LOGFONT_H
#define HWX_LOGFONT_H
class CXLogFont : public LOGFONT
{
public:
CXLogFont();
CXLogFont(const LOGFONT& logfont); //<combine CXLogFont::CXLogFont>
const CXLogFont& operator=(const CXLogFont&);
const CXLogFont& operator =(const LOGFONT&);
public:
void operator=(LOGFONT& logfont);
BOOL operator<(const CXLogFont&);
public:
DWORD dwType; // Used to hold the font type, i.e. TT_FONT, DEVICE_FONT.
};
#endif | [
"jtxuee@716a2f10-c84c-11dd-bf7c-81814f527a11"
]
| [
[
[
1,
26
]
]
]
|
d1c61ebd40b2c6473730859e77cdac30373c0343 | 5fb9b06a4bf002fc851502717a020362b7d9d042 | /developertools/GumpEditor/DiagramPropertySheet.cpp | 470d77c8cf3762e7a4a4032293a3ecda914b5f38 | []
| no_license | bravesoftdz/iris-svn | 8f30b28773cf55ecf8951b982370854536d78870 | c03438fcf59d9c788f6cb66b6cb9cf7235fbcbd4 | refs/heads/master | 2021-12-05T18:32:54.525624 | 2006-08-21T13:10:54 | 2006-08-21T13:10:54 | null | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 2,752 | cpp | // DiagramSheet.cpp : 구현 파일입니다.
//
#include "stdafx.h"
#include "GumpEditor.h"
#include ".\diagrampropertypage.h"
#include ".\diagrampropertysheet.h"
// CDiagramPropertySheet
IMPLEMENT_DYNAMIC(CDiagramPropertySheet, CPropertySheet)
CDiagramPropertySheet::CDiagramPropertySheet() :CPropertySheet("Control Properties", NULL, 0)
{
}
CDiagramPropertySheet::~CDiagramPropertySheet()
{
}
#define IDC_APPLY_BUTTON 100
#define IDC_RESET_BUTTON 101
BEGIN_MESSAGE_MAP(CDiagramPropertySheet, CPropertySheet)
ON_COMMAND(IDC_APPLY_BUTTON, OnApply)
ON_COMMAND(IDC_RESET_BUTTON, OnReset)
END_MESSAGE_MAP()
BOOL CDiagramPropertySheet::OnInitDialog()
{
CPropertySheet::OnInitDialog();
ShowWindow(SW_HIDE);
RECT rc;
GetWindowRect (&rc);
// Increase the height of the CPropertySheet by 30
rc.bottom += 30;
// Resize the CPropertySheet
MoveWindow (rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top);
// Convert to client coordinates
ScreenToClient (&rc);
// m_Button is of type CButton and is a member of CMySheet
m_btnApply.Create ("&Apply", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
CRect (rc.right-60, rc.bottom-30, rc.right-10, rc.bottom-8),
this, IDC_APPLY_BUTTON);
m_btnApply.SetFont(GetFont());
m_btnReset.Create ("&Reset", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
CRect (rc.right-120, rc.bottom-30, rc.right-70, rc.bottom-8),
this, IDC_RESET_BUTTON);
m_btnReset.SetFont(GetFont());
for (int i =GetPageCount()-1; i >=0 ; i--) {
CDiagramPropertyPage* page = (CDiagramPropertyPage*)GetPage(i);
page->SetRedrawWnd(GetParent());
SetActivePage(page);
}
ShowWindow(SW_SHOW);
return TRUE;
}
void CDiagramPropertySheet::SetValues(void)
{
for (int i =GetPageCount()-1; i >=0 ; i--) {
CDiagramPropertyPage* page = (CDiagramPropertyPage*)GetPage(i);
page->SetValues();
}
}
void CDiagramPropertySheet::ApplyValues()
{
for (int i =GetPageCount()-1; i >=0 ; i--) {
CDiagramPropertyPage* page = (CDiagramPropertyPage*)GetPage(i);
page->ApplyValues();
}
}
void CDiagramPropertySheet::ResetValues()
{
for (int i =GetPageCount()-1; i >=0 ; i--) {
CDiagramPropertyPage* page = (CDiagramPropertyPage*)GetPage(i);
page->ResetValues();
}
}
void CDiagramPropertySheet::OnApply()
{
ApplyValues();
}
void CDiagramPropertySheet::OnReset()
{
ResetValues();
}
BOOL CDiagramPropertySheet::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) {
ShowWindow(SW_HIDE);
return TRUE;
}
return CPropertySheet::PreTranslateMessage(pMsg);
}
| [
"sience@a725d9c3-d2eb-0310-b856-fa980ef11a19"
]
| [
[
[
1,
110
]
]
]
|
29189b9d113d8e25d1ff9d58a9a4d624739c53ed | 6253ab92ce2e85b4db9393aa630bde24655bd9b4 | /Common/fusion/SynchronizedEventQueue.h | 5fe16401d00fd6ffe1f4b9f81eceb216acb047ec | []
| no_license | Aand1/cornell-urban-challenge | 94fd4df18fd4b6cc6e12d30ed8eed280826d4aed | 779daae8703fe68e7c6256932883de32a309a119 | refs/heads/master | 2021-01-18T11:57:48.267384 | 2008-10-01T06:43:18 | 2008-10-01T06:43:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,302 | h | #ifndef SYNCHRONIZEDEVENTQUEUE_H
#define SYNCHRONIZEDEVENTQUEUE_H
#include "Event.h"
#include "EventCodes.h"
#include <FLOAT.H>
#include <WINDOWS.H>
#ifdef __cplusplus_cli
#pragma managed(push,off)
#endif
//maximum number of bad events tolerated before a reset
#define SEQ_NUMEVENTSB4RESET 100
class SynchronizedEventQueue
{
//The synchronized event queue class. Stores synchronized data to incorporate
//into an estimator in the proper order.
private:
//the critical section used to lock the queue for pushing / pulling events
CRITICAL_SECTION mQueueLock;
//the head of the queue (oldest element added)
Event *mQueueHead;
//the tail of the queue (most recent element added)
Event *mQueueTail;
//the oldest and newest event times (sec.)
double mQueueOldestTime;
double mQueueNewestTime;
//the time to wait before signaling the queue (sec.)
double mQueueDelayTime;
//whether the event queue has been initialized with a valid time
bool mIsInitialized;
//whether the event queue is shutting down or not
bool mIsShuttingDown;
//number of elements in the queue
int mNumEvents;
//number of bad events received in the queue
int mNumBadEvents;
//resets the queue
void ResetQueue();
//sets the oldest and newest queue times
void SetQueueTimes();
public:
//handle to the event that triggers when the queue has data
HANDLE mQueueDataEventHandle;
SynchronizedEventQueue(double iQueueDelayTime);
~SynchronizedEventQueue();
//empties the entire queue of all events
void EmptyQueue();
//whether the queue has ever received a valid timestamp or not
bool IsInitialized();
//whether the queue is shutting down or not
bool IsShuttingDown();
//returns the time of the oldest event in the queue
double LeastRecentQueueTime();
//returns the time of the newest event in the queue
double MostRecentQueueTime();
//return the number of events in the queue
int NumEvents();
//returns whether the queue has events ready to be processed
bool QueueHasEventsReady();
//pushes a new event to the queue
bool PushEvent(Event *NewEvent);
//pulls the next event from the queue
Event* PullEvent();
};
#ifdef __cplusplus_cli
#pragma managed(pop)
#endif
#endif //SYNCHRONIZEDEVENTQUEUE_H
| [
"anathan@5031bdca-8e6f-11dd-8a4e-8714b3728bc5"
]
| [
[
[
1,
86
]
]
]
|
855e3eb61c178c9ae9482ea2461b7821d07a001d | 4c49943d28c7acb2c54c46c1b9c90b83edce8383 | /HTML5i/stdafx.cpp | 18b021404b08d8b067292359e314e36ef1a683af | []
| no_license | flier/HTML5i | 68f4bcec7093f330b159f64976250ca5f974bca7 | 980ad8c112761471665c8acfc5064d1a87a8f32a | refs/heads/master | 2020-03-27T05:08:04.843399 | 2011-03-26T18:02:38 | 2011-03-26T18:02:38 | 1,498,619 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 202 | cpp | // stdafx.cpp : source file that includes just the standard includes
// HTML5i.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
| [
"[email protected]"
]
| [
[
[
1,
5
]
]
]
|
049c9d32fbba6d84f0c0b86a211c03250485dfd1 | 3d1a754998553b9064eec08e191047406bb57365 | /taxobot/TaxoBot.cpp | 4fc5e233e5a386a7067721223d7b055ae8019996 | []
| no_license | TequilaLime/starcraft-bots | 16abb824dc5eb76f607ef527b3f9a9d4b4456291 | a56171c50fff364309de951f10dacd884e656af2 | refs/heads/master | 2021-01-17T09:19:42.584929 | 2011-04-26T20:33:21 | 2011-04-26T20:33:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,599 | cpp | #include "TaxoBot.h"
using namespace std;
using namespace BWAPI;
void TaxoBot::onStart()
{
Broodwar->printf("TaxoBot");
Broodwar->setLocalSpeed(FB_LOCAL_SPEED/5);
// Find the centre of the map.
mapCentre = Position(Broodwar->mapWidth() * TILE_SIZE / 2,
Broodwar->mapHeight() * TILE_SIZE / 2);
// We don't have a target until we've scouted one out.
target = NULL;
/* Find the unit type */
UnitType type = (*Broodwar->self()->getUnits().begin())->getType();
if (type == UnitTypes::Protoss_Dragoon){
Broodwar->sendText("We're no strangers to loveeeee");
currentUnit = DRAGOON;
}
else if (type == UnitTypes::Protoss_Zealot){
currentUnit = ZEALOT;
}
else{
currentUnit = MUTALISK;
Broodwar->sendText("We're no strangers to loveeeee");
}
/* Store the initial positions of each unit */
int i =0;
set<Unit *> units = Broodwar->self()->getUnits();
for (set<Unit *>::iterator unit = units.begin(); unit!=units.end();unit++){
unitStartPositions[i] = (*unit)->getInitialPosition();
unitStartPositions[i].x() = unitStartPositions[i].x() * TILE_SIZE/(i+1);
unitStartPositions[i].y() = unitStartPositions[i].y() * TILE_SIZE/(i+1);
if (!unitStartPositions[i].isValid())
unitStartPositions[i].makeValid();
i++;
}
/* An array of positions for units to move to later on */
int rand =1;
for (i = 0;i<MAX_BOTS;i++){
randomPositions[i] = Position(Broodwar->mapWidth() * TILE_SIZE / rand,
Broodwar->mapHeight() * TILE_SIZE / rand);
if (!randomPositions[i].isValid())
randomPositions[i].makeValid();
rand++;
}
// initialise frame count
frame = 0;
}
void TaxoBot::onFrame()
{
/* If we haven't got a target or our target has been destroyed,
* try to aquire a new target. If a new target cannot be found,
* start scouting again.
*/
static const int FPS = Broodwar->getFPS();
static int count = 1;
set<Unit *> units = Broodwar->self()->getUnits();
Unit *temp;
if (!(units.empty())){
temp = (*units.begin());
if (target == NULL || !target->exists())
for (set<Unit *>::iterator unit = units.begin(); unit!=units.end();unit++){
if ((*unit)->isInWeaponRange(target)){
if ((*unit)->getGroundWeaponCooldown() == 0)
(*unit)->attackUnit(target);
else (*unit)->move(randomPositions[count%MAX_BOTS]);
}
else
if (tryAcquireTarget())
(*unit)->attackUnit(target);
else
if (currentUnit == ZEALOT)
movePosition(*unit,temp->getPosition().makeValid());
else if (currentUnit == DRAGOON)
if (temp->isInWeaponRange(target))
movePosition(*unit,temp->getPosition().makeValid());
else movePosition(*unit,randomPositions[count%MAX_BOTS].makeValid());
else if (currentUnit == MUTALISK){
static int j = 0;
movePosition(*unit, randomPositions[j%MAX_BOTS].makeValid());
j++;
}
if ((*unit)->exists())
temp = (*unit);
}
}
count++;
drawMarkings();
}
/**
* Target the enemy that causes our units to travel the least to
* attack. If no enemies are visible, do nothing.
*/
Unit *TaxoBot::tryAcquireTarget()
{
// All the enemy units we can see.
set<Unit *> enemies = Broodwar->enemy()->getUnits();
// If we can't see any enemies, there is no closest enemy.
if (enemies.empty())
return NULL;
// All of our units.
set<Unit *> units = Broodwar->self()->getUnits();
// The closest enemy found so far.
Unit *closestEnemy;
/* The shortest total distance our units will have travel to
* attack an enemy unit.
*/
double leastTotalTravelDistance = numeric_limits<double>::max();
for (set<Unit *>::iterator enemy = enemies.begin(); enemy != enemies.end(); enemy++)
{
// The total distance our units will have travel to attack enemy.
double totalTraveldistance = 0.0;
int i = 0;
for (set<Unit *>::iterator unit = units.begin(); unit != units.end(); unit++)
{
/* The distance our unit has to travel to attack 'enemy'.
* If less than zero, our unit can attack from its
* current position.
*/
UnitType unit_type = (*unit)->getType();
double travelDistance;
if (unit_type == UnitTypes::Zerg_Mutalisk)
travelDistance = (*unit)->getDistance(*enemy) - FB_MUTALISK_WEAPON_RANGE;
else if (unit_type == UnitTypes::Zerg_Scourge)
travelDistance = (*unit)->getDistance(*enemy) - FB_SCOURGE_WEAPON_RANGE;
else if (unit_type == UnitTypes::Protoss_Dragoon)
travelDistance = (*unit)->getDistance(*enemy) - FB_DRAGOON_WEAPON_RANGE;
else if (unit_type == UnitTypes::Protoss_Zealot)
travelDistance = (*unit)->getDistance(*enemy) - FB_ZEALOT_WEAPON_RANGE;
if (travelDistance > 0)
totalTraveldistance += travelDistance;
}
/* Would attacking 'enemy' cause our units to travel less than all
* other enemies so far?
*/
if (totalTraveldistance <= leastTotalTravelDistance)
{
closestEnemy = *enemy;
leastTotalTravelDistance = totalTraveldistance;
}
}
return target = closestEnemy;
}
/* Move a given unit to a specified point */
void TaxoBot::movePosition(Unit *unit, Position p){ unit->move(p);}
void TaxoBot::drawMarkings()
{
if (target != NULL && target->exists())
{
// Mark target on map.
Position p = target->getPosition();
Broodwar->drawBoxMap(p.x() - 2, p.y() - 2, p.x() + 2, p.y() + 2, Colors::Red, true);
}
}
void TaxoBot::onUnitDestroy(Unit* unit) {
/* Run to a random position when a unit is destroyed */
set<Unit *> units = Broodwar->self()->getUnits();
static int count=0;
for (set<Unit *>::iterator unitw = units.begin(); unitw != units.end(); unitw++)
(*unitw)->attackMove(randomPositions[count%MAX_BOTS]);
count++;
static int textID = 1;
static int loop = 0;
if (checkEnemy(unit)){
switch (textID) {
case 1:
Broodwar->sendText("You know the rules and so do I!"); break;
case 2:
Broodwar->sendText("A full commitment's what I'm thinking of"); break;
case 3:
Broodwar->sendText("You wouldn't get this from any other guy!");break;
case 4:
Broodwar->sendText("I ...just want to tell you how I'm feeling");break;
case 5:
Broodwar->sendText("Gotta make you understand");break;
case 6:
Broodwar->sendText("NEVER GONNNA GIVE YOU UP"); break;
case 7:
Broodwar->sendText("NEVER GONNA LET YOU DOWN"); break;
case 8:
Broodwar->sendText("NEVER GONNA TURN AROUND AND...DESERT YOU"); break;
case 9:
Broodwar->sendText("NEVER GONNA MAKE YOU CRYYY!");break;
case 10:
Broodwar->sendText("NEVER GONNA SAY GOOOODBYEEEE"); break;
case 11:
Broodwar->sendText("NEVER GONNA TELL A LIE AND HURT YOU"); break;
case 12:
if (currentUnit == DRAGOON || loop == 1){ loop = 0; break;}
Broodwar->sendText("We've known each other for so long");break;
case 13:
Broodwar->sendText("Your heart's been aching but you're too shy to say it.");break;
case 14:
Broodwar->sendText("Inside we both know what's been going on,");break;
case 15:
Broodwar->sendText("We know the game and we're gonna play it.");break;
case 16:
Broodwar->sendText("Annnnnd if you ask me how I'm feeling,");break;
case 17:
Broodwar->sendText("Don't tell me you're too blind to see");
textID=5;
loop = 1; break;
default:
textID=1; break;
}
textID++;
}
}
void TaxoBot::onEnd(bool isWinner) {
if (isWinner)
Broodwar->sendText("I'M THE JUGGERNAUT B17CH");
else
Broodwar->sendText("LET ME FINISH MY SONG!");
}
/* Check if a unit is an enemy */
bool TaxoBot::checkEnemy(Unit *unit){
Player *player = unit->getPlayer();
return Broodwar->self()->isEnemy(player);
}
void TaxoBot:: onUnitDiscover(Unit *discoveredUnit){
if (checkEnemy(discoveredUnit))
target = discoveredUnit;
}
// Callback stubs
void TaxoBot::onNukeDetect(Position target) {}
void TaxoBot::onPlayerLeft(Player* player) {}
void TaxoBot::onReceiveText(Player* player, string text) {}
void TaxoBot::onSaveGame(string gameName) {}
void TaxoBot::onSendText(string text) {}
void TaxoBot::onUnitCreate(Unit* unit) {}
void TaxoBot::onUnitEvade(Unit* unit) {}
void TaxoBot::onUnitHide(Unit* unit) {}
void TaxoBot::onUnitMorph(Unit* unit) {}
void TaxoBot::onUnitRenegade(Unit* unit) {}
void TaxoBot::onUnitShow(Unit* unit) {} | [
"[email protected]"
]
| [
[
[
1,
259
]
]
]
|
2611511035db4d79a6076a59e41fafc1cc0eb5a5 | a84b013cd995870071589cefe0ab060ff3105f35 | /webdriver/branches/chrome_extension/third_party/gecko-1.9.0.11/win32/include/nsIDOMCSSPrimitiveValue.h | c27abd52960a1c928df216b5958184fb914b46e4 | [
"Apache-2.0"
]
| permissive | vdt/selenium | 137bcad58b7184690b8785859d77da0cd9f745a0 | 30e5e122b068aadf31bcd010d00a58afd8075217 | refs/heads/master | 2020-12-27T21:35:06.461381 | 2009-08-18T15:56:32 | 2009-08-18T15:56:32 | 13,650,409 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,893 | h | /*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/xr19rel/WINNT_5.2_Depend/mozilla/dom/public/idl/css/nsIDOMCSSPrimitiveValue.idl
*/
#ifndef __gen_nsIDOMCSSPrimitiveValue_h__
#define __gen_nsIDOMCSSPrimitiveValue_h__
#ifndef __gen_nsIDOMCSSValue_h__
#include "nsIDOMCSSValue.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMCSSPrimitiveValue */
#define NS_IDOMCSSPRIMITIVEVALUE_IID_STR "e249031f-8df9-4e7a-b644-18946dce0019"
#define NS_IDOMCSSPRIMITIVEVALUE_IID \
{0xe249031f, 0x8df9, 0x4e7a, \
{ 0xb6, 0x44, 0x18, 0x94, 0x6d, 0xce, 0x00, 0x19 }}
class NS_NO_VTABLE NS_SCRIPTABLE nsIDOMCSSPrimitiveValue : public nsIDOMCSSValue {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMCSSPRIMITIVEVALUE_IID)
/**
* The nsIDOMCSSPrimitiveValue interface is a datatype for a primitive
* CSS value in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Style
*
* @status FROZEN
*/
enum { CSS_UNKNOWN = 0U };
enum { CSS_NUMBER = 1U };
enum { CSS_PERCENTAGE = 2U };
enum { CSS_EMS = 3U };
enum { CSS_EXS = 4U };
enum { CSS_PX = 5U };
enum { CSS_CM = 6U };
enum { CSS_MM = 7U };
enum { CSS_IN = 8U };
enum { CSS_PT = 9U };
enum { CSS_PC = 10U };
enum { CSS_DEG = 11U };
enum { CSS_RAD = 12U };
enum { CSS_GRAD = 13U };
enum { CSS_MS = 14U };
enum { CSS_S = 15U };
enum { CSS_HZ = 16U };
enum { CSS_KHZ = 17U };
enum { CSS_DIMENSION = 18U };
enum { CSS_STRING = 19U };
enum { CSS_URI = 20U };
enum { CSS_IDENT = 21U };
enum { CSS_ATTR = 22U };
enum { CSS_COUNTER = 23U };
enum { CSS_RECT = 24U };
enum { CSS_RGBCOLOR = 25U };
/* readonly attribute unsigned short primitiveType; */
NS_SCRIPTABLE NS_IMETHOD GetPrimitiveType(PRUint16 *aPrimitiveType) = 0;
/* void setFloatValue (in unsigned short unitType, in float floatValue) raises (DOMException); */
NS_SCRIPTABLE NS_IMETHOD SetFloatValue(PRUint16 unitType, float floatValue) = 0;
/* float getFloatValue (in unsigned short unitType) raises (DOMException); */
NS_SCRIPTABLE NS_IMETHOD GetFloatValue(PRUint16 unitType, float *_retval) = 0;
/* void setStringValue (in unsigned short stringType, in DOMString stringValue) raises (DOMException); */
NS_SCRIPTABLE NS_IMETHOD SetStringValue(PRUint16 stringType, const nsAString & stringValue) = 0;
/* DOMString getStringValue () raises (DOMException); */
NS_SCRIPTABLE NS_IMETHOD GetStringValue(nsAString & _retval) = 0;
/* nsIDOMCounter getCounterValue () raises (DOMException); */
NS_SCRIPTABLE NS_IMETHOD GetCounterValue(nsIDOMCounter **_retval) = 0;
/* nsIDOMRect getRectValue () raises (DOMException); */
NS_SCRIPTABLE NS_IMETHOD GetRectValue(nsIDOMRect **_retval) = 0;
/* nsIDOMRGBColor getRGBColorValue () raises (DOMException); */
NS_SCRIPTABLE NS_IMETHOD GetRGBColorValue(nsIDOMRGBColor **_retval) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMCSSPrimitiveValue, NS_IDOMCSSPRIMITIVEVALUE_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMCSSPRIMITIVEVALUE \
NS_SCRIPTABLE NS_IMETHOD GetPrimitiveType(PRUint16 *aPrimitiveType); \
NS_SCRIPTABLE NS_IMETHOD SetFloatValue(PRUint16 unitType, float floatValue); \
NS_SCRIPTABLE NS_IMETHOD GetFloatValue(PRUint16 unitType, float *_retval); \
NS_SCRIPTABLE NS_IMETHOD SetStringValue(PRUint16 stringType, const nsAString & stringValue); \
NS_SCRIPTABLE NS_IMETHOD GetStringValue(nsAString & _retval); \
NS_SCRIPTABLE NS_IMETHOD GetCounterValue(nsIDOMCounter **_retval); \
NS_SCRIPTABLE NS_IMETHOD GetRectValue(nsIDOMRect **_retval); \
NS_SCRIPTABLE NS_IMETHOD GetRGBColorValue(nsIDOMRGBColor **_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMCSSPRIMITIVEVALUE(_to) \
NS_SCRIPTABLE NS_IMETHOD GetPrimitiveType(PRUint16 *aPrimitiveType) { return _to GetPrimitiveType(aPrimitiveType); } \
NS_SCRIPTABLE NS_IMETHOD SetFloatValue(PRUint16 unitType, float floatValue) { return _to SetFloatValue(unitType, floatValue); } \
NS_SCRIPTABLE NS_IMETHOD GetFloatValue(PRUint16 unitType, float *_retval) { return _to GetFloatValue(unitType, _retval); } \
NS_SCRIPTABLE NS_IMETHOD SetStringValue(PRUint16 stringType, const nsAString & stringValue) { return _to SetStringValue(stringType, stringValue); } \
NS_SCRIPTABLE NS_IMETHOD GetStringValue(nsAString & _retval) { return _to GetStringValue(_retval); } \
NS_SCRIPTABLE NS_IMETHOD GetCounterValue(nsIDOMCounter **_retval) { return _to GetCounterValue(_retval); } \
NS_SCRIPTABLE NS_IMETHOD GetRectValue(nsIDOMRect **_retval) { return _to GetRectValue(_retval); } \
NS_SCRIPTABLE NS_IMETHOD GetRGBColorValue(nsIDOMRGBColor **_retval) { return _to GetRGBColorValue(_retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMCSSPRIMITIVEVALUE(_to) \
NS_SCRIPTABLE NS_IMETHOD GetPrimitiveType(PRUint16 *aPrimitiveType) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPrimitiveType(aPrimitiveType); } \
NS_SCRIPTABLE NS_IMETHOD SetFloatValue(PRUint16 unitType, float floatValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetFloatValue(unitType, floatValue); } \
NS_SCRIPTABLE NS_IMETHOD GetFloatValue(PRUint16 unitType, float *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFloatValue(unitType, _retval); } \
NS_SCRIPTABLE NS_IMETHOD SetStringValue(PRUint16 stringType, const nsAString & stringValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetStringValue(stringType, stringValue); } \
NS_SCRIPTABLE NS_IMETHOD GetStringValue(nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetStringValue(_retval); } \
NS_SCRIPTABLE NS_IMETHOD GetCounterValue(nsIDOMCounter **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCounterValue(_retval); } \
NS_SCRIPTABLE NS_IMETHOD GetRectValue(nsIDOMRect **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRectValue(_retval); } \
NS_SCRIPTABLE NS_IMETHOD GetRGBColorValue(nsIDOMRGBColor **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRGBColorValue(_retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMCSSPrimitiveValue : public nsIDOMCSSPrimitiveValue
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCSSPRIMITIVEVALUE
nsDOMCSSPrimitiveValue();
private:
~nsDOMCSSPrimitiveValue();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMCSSPrimitiveValue, nsIDOMCSSPrimitiveValue)
nsDOMCSSPrimitiveValue::nsDOMCSSPrimitiveValue()
{
/* member initializers and constructor code */
}
nsDOMCSSPrimitiveValue::~nsDOMCSSPrimitiveValue()
{
/* destructor code */
}
/* readonly attribute unsigned short primitiveType; */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::GetPrimitiveType(PRUint16 *aPrimitiveType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setFloatValue (in unsigned short unitType, in float floatValue) raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::SetFloatValue(PRUint16 unitType, float floatValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* float getFloatValue (in unsigned short unitType) raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::GetFloatValue(PRUint16 unitType, float *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setStringValue (in unsigned short stringType, in DOMString stringValue) raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::SetStringValue(PRUint16 stringType, const nsAString & stringValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString getStringValue () raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::GetStringValue(nsAString & _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMCounter getCounterValue () raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::GetCounterValue(nsIDOMCounter **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMRect getRectValue () raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::GetRectValue(nsIDOMRect **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMRGBColor getRGBColorValue () raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::GetRGBColorValue(nsIDOMRGBColor **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMCSSPrimitiveValue_h__ */
| [
"simon.m.stewart@07704840-8298-11de-bf8c-fd130f914ac9"
]
| [
[
[
1,
236
]
]
]
|
732a4b7fad765de5d34732670a099d7bb86dfb42 | 353bd39ba7ae46ed521936753176ed17ea8546b5 | /src/layer1_system/events/src/axev_create_event.cpp | a46ee5690a3c6009b742c2ae936d98136f1ef086 | []
| no_license | d0n3val/axe-engine | 1a13e8eee0da667ac40ac4d92b6a084ab8a910e8 | 320b08df3a1a5254b776c81775b28fa7004861dc | refs/heads/master | 2021-01-01T19:46:39.641648 | 2007-12-10T18:26:22 | 2007-12-10T18:26:22 | 32,251,179 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,594 | cpp | /**
* @file
* Cretae and configure events
* @author Ricard Pillosu <d0n3val\@gmail.com>
* @date 25 Jul 2004
*/
#include "axev_stdafx.h"
/**
* Create a new event
*/
AXEV_API AXE_ID axev_create_event( AXE_ID channel_id ) {
AXE_ASSERT( state.channels.exist(channel_id) );
event my_event;
event* p_event = &my_event;
int found = -1;
for( register int i = 0; i < state.events.last_item; ++i ) {
if( true == state.events[i].destroyed ) {
p_event = &state.events[i];
found = i;
break;
}
}
p_event->channel_id = channel_id;
p_event->active = true;
p_event->destroyed = false;
if( found >= 0 ) {
return( found );
}
state.events.push( *p_event );
return( state.events.last_item-1 );
}
/**
* Destroy existing event
*/
AXEV_API int axev_destroy_event( AXE_ID event_id ) {
AXE_ASSERT( state.events.exist(event_id) );
AXE_ASSERT( false == state.events[event_id].destroyed );
state.events[event_id].destroyed = true;
return( AXE_TRUE );
}
/**
* Add a callback funtion to an event
*/
AXEV_API int axev_add_event_callback( AXE_ID event_id, void (*event_callback) (AXE_ID, void *, void *) ) {
AXE_ASSERT( state.events.exist(event_id) );
AXE_ASSERT( false == state.events[event_id].destroyed );
AXE_ASSERT( NULL != event_callback );
bool found = false;
for( register int i = 0; i < state.events[event_id].callbacks.size; ++i ) {
if( NULL == state.events[event_id].callbacks[i] ) {
found = true;
state.events[event_id].callbacks[i] = event_callback;
break;
}
}
AXE_ASSERT( found ); // check max callback reached
return( AXE_TRUE );
}
/**
* Add a new event that will be called if this event ocurrs (event chaining)
*/
AXEV_API int axev_add_event_post( AXE_ID event_id, AXE_ID post_event_id ) {
AXE_ASSERT( state.events.exist(event_id) );
AXE_ASSERT( state.events.exist(post_event_id) );
AXE_ASSERT( false == state.events[event_id].destroyed );
bool found = false;
for( register int i = 0; i < state.events[event_id].post_events.size; ++i ) {
if( 0 == state.events[event_id].post_events[i] ) {
found = true;
state.events[event_id].post_events[i] = post_event_id;
break;
}
}
AXE_ASSERT( found ); // check max callback reached
return( AXE_TRUE );
}
/**
* Standar delay when this event is called
*/
AXEV_API int axev_set_event_delay( AXE_ID event_id, float seconds ) {
AXE_ASSERT( state.events.exist(event_id) );
AXE_ASSERT( false == state.events[event_id].destroyed );
AXE_ASSERT( seconds >= 0.0f );
state.events[event_id].delay = seconds;
return( AXE_TRUE );
}
/**
* Activates / Desactivates an event
*/
AXEV_API int axev_set_event_active( AXE_ID event_id, int active ) {
AXE_ASSERT( state.events.exist(event_id) );
AXE_ASSERT( false == state.events[event_id].destroyed );
state.events[event_id].active = AXE_TO_BOOL( active );
return( AXE_TRUE );
}
/**
* Set event user data that will sent in each defined callback
*/
AXEV_API int axev_set_event_userdata( AXE_ID event_id, const void* data, size_t data_size ) {
AXE_ASSERT( state.events.exist(event_id) );
AXE_FREE(state.events[event_id].user_data);
if ( NULL == data ) {
return(AXE_TRUE);
}
state.events[event_id].user_data = malloc(data_size);
memcpy(state.events[event_id].user_data, data, data_size);
return(AXE_TRUE);
}
/* $Id: axev_create_event.cpp,v 1.2 2004/09/20 21:28:09 doneval Exp $ */
| [
"d0n3val@2cff7946-3f3c-0410-b79f-f9b517ddbf54"
]
| [
[
[
1,
136
]
]
]
|
0de215129867bd98f16e7f12fb806c15f2151d88 | c5534a6df16a89e0ae8f53bcd49a6417e8d44409 | /trunk/Samples/VFS/App.h | 42df99596b1eba2ef957d7b3ea8f548e842a2d8a | []
| no_license | svn2github/ngene | b2cddacf7ec035aa681d5b8989feab3383dac012 | 61850134a354816161859fe86c2907c8e73dc113 | refs/heads/master | 2023-09-03T12:34:18.944872 | 2011-07-27T19:26:04 | 2011-07-27T19:26:04 | 78,163,390 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 773 | h | /*
---------------------------------------------------------------------------
This source file is part of nGENE Tech.
Copyright (c) 2006- Wojciech Toman
This program is free software.
File: App.h
Version: 0.01
---------------------------------------------------------------------------
*/
#pragma once
#include "FrameworkWin32.h"
#include "ScenePartitionerQuadTree.h"
#include "MyInputListener.h"
using namespace nGENE::Application;
class App: public FrameworkWin32
{
private:
MyInputListener* m_pInputListener;
CameraThirdPerson* m_pCamera;
public:
App() {}
~App() {}
void createApplication();
// This function will load materials and stuff like that.
void loadResources();
CameraThirdPerson* getCamera() const;
}; | [
"Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57"
]
| [
[
[
1,
37
]
]
]
|
25e0c9944f739522c3125f343a9fa4702ce8274f | bfcc0f6ef5b3ec68365971fd2e7d32f4abd054ed | /datahandle.h | d9ad8e26dbbd829f9816d9c2252a66d106312ace | []
| no_license | cnsuhao/kgui-1 | d0a7d1e11cc5c15d098114051fabf6218f26fb96 | ea304953c7f5579487769258b55f34a1c680e3ed | refs/heads/master | 2021-05-28T22:52:18.733717 | 2011-03-10T03:10:47 | 2011-03-10T03:10:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,511 | h | #ifndef __DATAHANDLE__
#define __DATAHANDLE__
/**********************************************************************************/
/* kGUI - datahandle.h */
/* */
/* Programmed by Kevin Pickell */
/* */
/* http://code.google.com/p/kgui/ */
/* */
/* kGUI is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU Lesser General Public License as published by */
/* the Free Software Foundation; version 2. */
/* */
/* kGUI is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* http://www.gnu.org/licenses/lgpl.txt */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with kGUI; if not, write to the Free Software */
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* */
/**********************************************************************************/
/* this is a virtual class for adding bigfiles and zipfiles to the load path */
class ContainerEntry
{
public:
virtual ~ContainerEntry() {}
virtual kGUIString *GetName(void)=0;
};
//this is used as a common base class for BigFiles and Zipfiles
class ContainerFile
{
public:
virtual ~ContainerFile() {}
virtual void LoadDirectory(void)=0;
virtual unsigned int GetNumEntries(void)=0;
virtual ContainerEntry *LocateEntry(const char *f)=0;
virtual ContainerEntry *GetEntry(unsigned int n)=0;
virtual void CopyEntry(ContainerEntry *cfe,class DataHandle *dest)=0;
};
/*! @file datahandle.h
@brief DataHandle class definitions. A DataHandle is the class that is used for
loading and or saving data. A datahandle can directly reference a file, or a chunk
of memory, or a file within a bigfile. A DataHandle can also reference encrypted
data using the attached kGUIProt class. All of the internal functions in kGUI that
reference files use the DataHandle class for input so for example the movie player
can play a movie that is encrypted and inside of a bigfile. */
enum
{
DATATYPE_FILE,
DATATYPE_MEMORY,
DATATYPE_UNDEFINED
};
/* these are interal structures used for the read-caching system */
typedef struct
{
unsigned long long m_startindex;
unsigned long long m_endindex;
char *m_data;
struct s_DataSection *m_datasection;
unsigned int m_priority;
}StreamBlock;
typedef struct s_DataSection
{
unsigned long long m_startindex;
unsigned long long m_endindex;
StreamBlock *m_streamblock;
}DataSection;
/*! @class DataHandle
@brief This is the DataHandle class. It is used as a container class for all objects
that read / write files. It can reference a disk file, memory, or a file inside of a
bigfile. Also DataHandles can be encrypted by simply attaching a kGUIProt class */
class DataHandle
{
public:
DataHandle();
virtual ~DataHandle();
void SetFilename(const char *fn,ContainerFile *cf=0);
void SetFilename(kGUIString *fn,ContainerFile *cf=0) {SetFilename(fn->GetString(),cf);}
void SetMemory(void); /* write first, then can read from */
void SetMemory(const void *memory,unsigned long filesize);
//called whenever the SetFilename or SetMemory is called
virtual void HandleChanged(void) {}
void SetOpenLock(bool lock) {m_lock=lock;} /* if set then don't allow open */
kGUIString *GetFilename(void) {return &m_ufn;}
void CopyHandle(DataHandle *from);
int GetDataType(void) {return m_type;}
/* initialize a new datahandle for the sub-area of this one at the dest class */
void CopyArea(DataHandle *dest,unsigned long offset, unsigned long size,long time);
/* copy from a different datahandle to memory */
void Copy(DataHandle *from);
unsigned long long GetSize(void) {return m_filesize;}
/* if larger than 'loadable' then assert */
unsigned long GetLoadableSize(void);
long GetTime(void) {return m_filetime;}
bool Open(void);
bool GetOpen(void) {return (m_open || m_wopen);}
unsigned long Read(void *dest,unsigned long numbytes); /* returns number of bytes read */
unsigned long Read(kGUIString *s,unsigned long numbytes); /* returns number of bytes read */
void Read(kGUIString *s); /* reads null terminated string */
/* these are there to stop the warnings */
unsigned long Read(void *dest,unsigned long long numbytes) {return(Read(dest,(unsigned long)numbytes));}
unsigned long Read(kGUIString *s,unsigned long long numbytes) {return(Read(s,(unsigned long)numbytes));}
void ReadLine(kGUIString *line);
void ReadHtmlString(kGUIString *s);
inline unsigned char PeekChar(void) {char c;Read(&c,(unsigned long)1);Seek(m_offset-1);return c;}
inline unsigned char ReadChar(void) {char c;Read(&c,(unsigned long)1);return c;}
inline void Skip(long numbytes) {Seek(m_offset+numbytes);} /* pos or neg */
bool Seek(const char *string);
void Seek(unsigned long long index);
unsigned long long GetOffset(void) {return m_offset;}
bool Eof(void) {return (m_offset==m_filesize);}
FILE *GetHandle(void); /* only valid for filesystem based data */
void CheckWrite(void);
bool OpenWrite(const char *wtype,unsigned long defbufsize=65536); /* write mode string "wb" or "rb+" etc */
void Sprintf(const char *fmt,...);
void Write(const void *buf,long numbytes);
bool Close(bool error=false);
void *GetBufferPtr(void) {return m_writebuffer.GetArrayPtr();}
void SetEncryption(class kGUIProt *p);
/* static functions */
static void InitStatic(void);
static void PurgeStatic(void);
/* add bigfile to global scan list */
static void AddContainer(class ContainerFile *cf);
/* remove bigfile to global scan list */
static void RemoveContainer(class ContainerFile *cf);
/* calc crc for file */
long CRC(void);
/* new caching system init */
void InitReadStream(unsigned int blocksizebits,unsigned int numblocks);
char StreamCmp(const void *cmpstring,unsigned long numbytes,long offset=0,bool cs=true);
inline unsigned char StreamPeekChar(void) {unsigned long blockoff;StreamBlock *cb;cb=LoadStreamBlock(m_offset,&blockoff,true);return cb->m_data[blockoff];}
inline unsigned char StreamReadChar(void) {unsigned long blockoff;StreamBlock *cb;cb=LoadStreamBlock(m_offset,&blockoff,true);++m_offset;return cb->m_data[blockoff];}
inline void StreamSkip(long numbytes) {m_offset+=numbytes;} /* pos or neg */
private:
StreamBlock *LoadStreamBlock(unsigned long long index,unsigned long *poffset,bool setcurrent);
void ReadStreamBlock(StreamBlock *cb);
void StreamRead(void *dest,unsigned long numbytes);
void StreamRead(kGUIString *s,unsigned long numbytes);
void PurgeReadStream(void);
kGUIMutex m_openmutex; /* open mutex */
int m_type; /* handle or memory based */
long m_filetime; /* filetime */
bool m_lock; /* open enable/disable */
bool m_open; /* read open */
bool m_wopen; /* write open? */
FILE *m_handle; /* handle of file, only valid for a file with a associated handle */
kGUIString m_fn; /* filename (or bigfilename if in bigfile) */
kGUIString m_ufn; /* unique filename */
const unsigned char *m_memory; /* address of file, only valid for a memory based file */
unsigned long long m_filesize; /* size of file */
unsigned long long m_startoffset; /* start offset into file, used for bigfiles */
unsigned long long m_offset; /* current offset into file */
class kGUIProt *m_prot; /* encryption */
unsigned long long m_writebufferlen;
Array<unsigned char>m_writebuffer;
static int m_numcontainerfiles; /* number of registered containerfiles */
static Array<class ContainerFile *>m_containerfiles; /* array of pointers to containerfiles */
/* new caching system */
bool m_readstream; /* true=read Stream enabled */
unsigned int m_nextstreampriority;
/* section data */
unsigned int m_numdatasections;
Array<DataSection>m_datasections;
/* Streamblock data */
StreamBlock *m_currentstreamblock;
unsigned long long m_currentstreamstartindex;
unsigned long long m_currentstreamendindex;
unsigned long long m_currentseekindex;
Array<StreamBlock>m_streamblocks;
unsigned long m_streamblockshift; /* shift index by this to convert to a block# */
unsigned long m_streamblockmask; /* mask index by this to convert to an offset into the block */
unsigned long m_streamblocksize;
unsigned long m_numstreamblocks;
};
#endif
| [
"[email protected]@4b35e2fd-144d-0410-91a6-811dcd9ab31d"
]
| [
[
[
1,
215
]
]
]
|
30085d4fc7d431a52ca9113594e78240a30dbff9 | fc7828cdb69f4c0fbd137d989607e6c4972406de | /learning/c++/templates/example3/main.cpp | 4222720e8cf28ad5f13f358175be4b2d560c95fe | []
| no_license | KWMalik/organization | 398167eb7b641df1bbc7f8c07d873baf77728440 | 977dcf68f9f07a36dd1cfbdeb907594b75a58ce4 | refs/heads/master | 2021-01-13T01:55:26.651655 | 2010-02-26T20:19:05 | 2010-02-26T20:19:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,551 | cpp |
#include <iostream>
using namespace std;
template<typename T>
const T& Maximum(const T& x, const T& y)
{
if(y < x)
{
return x;
}
return y;
}
#if 0
struct MyStruct
{
MyStruct(int _a, int _b) : a(_a), b(_b) {}
int a;
int b;
};
#else
struct MyStruct
{
MyStruct(int _a, int _b) : a(_a), b(_b) {}
//Necessary operator to compile this class
bool operator<(const MyStruct &that) const
{
return a < that.a;
}
int a;
int b;
};
#endif
ostream& operator<<(ostream & stm, const MyStruct &my)
{
stm << "MyStruct(a = " << my.a << ", " << my.b << ")";
}
int main(int argc, char **argv)
{
int a = 5;
int b = 10;
char c = 5;
char d = 5;
//Note that this compiles to a seperate function in the exe.
int result1 = Maximum(a, b);
cout << "The result of Maximum(" << a << ", " << b << ") is " << result1 << endl;
//Note that this compiles to a seperate function in the exe.
int result2 = Maximum(c, d);
cout << "The result of Maximum(" << c << ", " << d << ") is " << result2 << endl;
//Note that this compiles to a seperate function in the exe.
float floatresult = Maximum<float>(a, b);
cout << "The result of Maximum(" << a << ", " << b << ") is " << floatresult << endl;
//The following will only work with MyStruct::operator< being defined.
MyStruct str_a(5, 10);
MyStruct str_b(8, 16);
MyStruct str_result = Maximum(str_a, str_b);
cout << "The result of Maximum(" << str_a << ", " << str_b << ") is " << str_result << endl;
return 0;
}
| [
"="
]
| [
[
[
1,
74
]
]
]
|
0c6dde3d8c7cd46984aeb810a9d4f522cf139cec | 54cacc105d6bacdcfc37b10d57016bdd67067383 | /trunk/source/io/util/DirectoryFinder.h | 8dc476b71d782e24cbf9934bc685326066cb628e | []
| no_license | galek/hesperus | 4eb10e05945c6134901cc677c991b74ce6c8ac1e | dabe7ce1bb65ac5aaad144933d0b395556c1adc4 | refs/heads/master | 2020-12-31T05:40:04.121180 | 2009-12-06T17:38:49 | 2009-12-06T17:38:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,326 | h | /***
* hesperus: DirectoryFinder.h
* Copyright Stuart Golodetz, 2009. All rights reserved.
***/
#ifndef H_HESP_DIRECTORYFINDER
#define H_HESP_DIRECTORYFINDER
#include <boost/filesystem/operations.hpp>
namespace hesp {
/**
Determines the location of the game's base directory. Note that how this is done
varies depending on whether we're trying to determine the location from within
the game or from within one of its tools. It should thus be implemented separately
within each project to call the appropriate location determination function.
*/
boost::filesystem::path determine_base_directory();
boost::filesystem::path determine_audio_directory();
boost::filesystem::path determine_base_directory_from_game();
boost::filesystem::path determine_base_directory_from_tool();
boost::filesystem::path determine_executable_location();
boost::filesystem::path determine_images_directory();
boost::filesystem::path determine_levels_directory();
boost::filesystem::path determine_models_directory();
boost::filesystem::path determine_profiles_directory();
boost::filesystem::path determine_scripts_directory();
boost::filesystem::path determine_settings_directory();
boost::filesystem::path determine_sprites_directory();
boost::filesystem::path determine_textures_directory();
}
#endif
| [
"[email protected]"
]
| [
[
[
1,
36
]
]
]
|
48c2040ac9621fd4053af1bd2b2cd6baf78042f8 | 13d4ffd16d80e339a34b4e826c293331983ca6c6 | /concurrent_full.cpp | 510e2b16661798df1e62498ba75605af01af730e | []
| no_license | AlexeyMz/Hopscotch-Hashing | c1a1b2be216c80c65083409e3534a667953c3b15 | a8c8407426a5e2dc70761ace5cee31e3ed5bdf74 | refs/heads/master | 2020-12-25T11:58:32.070580 | 2011-05-07T16:57:08 | 2011-05-07T16:57:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,124 | cpp | #include<iostream>
#include "hopscotch.cpp"
#include <pthread.h>
using namespace std;
Hopscotch *obj;
int key[5];
int val[5];
int iKey[32];
int iVal[32];
void *run(void* x){
int index = (int)x;
obj->add(&key[index],&val[index]);
obj->trial();
pthread_exit(NULL);
}
int main()
{
cout << "FULL NEIGHBORHOOD, 5 threads" << endl;
obj = new Hopscotch;
cout << "FILLING UP THE NEIGHBORHOOR, Main Thread" << endl;
for(int i=0; i<32; i++){
iKey[i] = i * 1024;
iVal[i] = i * 100;
obj->add(&iKey[i],&iVal[i]);
}
obj->trial();
cout << "FINISHED FILLING UP THE NEIGHBORHOOR, Main Thread" << endl;
int NUM_THREADS = 5;
pthread_t threads[NUM_THREADS];
int rc;
for(int i=0; i<5; i++){
key[i] = 1024 * (32 + i);
}
for(int t=0; t<NUM_THREADS; t++){
rc = pthread_create(&threads[t], NULL, run, (void *)(t));
if (rc){
printf("ERROR; return code from pthread_create() is %d\n", rc);
}
}
for(int t=0; t<NUM_THREADS; t++){
pthread_join(threads[t], NULL);
}
return 0;
}
| [
"[email protected]"
]
| [
[
[
1,
61
]
]
]
|
56dd6b55bfaf62e42483e1fb5ebf2c5a4f905d5f | daef491056b6a9e227eef3e3b820e7ee7b0af6b6 | /Tags/0.1.4/code/lib/platform/x11/x11_window.cpp | 0d5601e9ba8bbfde35bc9b17a1dc3aa205242610 | [
"BSD-3-Clause"
]
| permissive | BackupTheBerlios/gut-svn | de9952b8b3e62cedbcfeb7ccba0b4d267771dd95 | 0981d3b37ccfc1ff36cd79000f6c6be481ea4546 | refs/heads/master | 2021-03-12T22:40:32.685049 | 2006-07-07T02:18:38 | 2006-07-07T02:18:38 | 40,725,529 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,384 | cpp | /**********************************************************************
* GameGut - x11_window.cpp
* Copyright (c) 1999-2005 Jason Perkins.
* All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the BSD-style license that is
* included with this library in the file LICENSE.txt.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* files LICENSE.txt for more details.
**********************************************************************/
#include "core/core.h"
#include "x11_platform.h"
utWindow utxCreateWindow(const char* title, int width, int height)
{
int screen = DefaultScreen(utx_display);
/* Create the window */
XSetWindowAttributes attributes;
attributes.background_pixel = BlackPixel(utx_display, screen);
attributes.border_pixel = 0;
attributes.colormap = XDefaultColormap(utx_display, screen);
attributes.event_mask = StructureNotifyMask | ExposureMask |
VisibilityChangeMask | FocusChangeMask |
ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | ButtonMotionMask |
KeyPressMask | KeyReleaseMask |
EnterWindowMask | LeaveWindowMask;
Window window = XCreateWindow(utx_display, RootWindow(utx_display, screen),
32, 32, width, height, 0,
CopyFromParent, InputOutput, CopyFromParent,
CWBackPixel | CWBorderPixel | CWColormap | CWEventMask,
&attributes);
if (!window)
{
utxReportX11Error("XCreateWindow");
return NULL;
}
/* Set the window caption */
int argc = 0;
char* argv = "\0";
XSetStandardProperties(utx_display, window, title, title, 0, &argv, argc, NULL);
/* Show the window */
XSetWMProtocols(utx_display, window, &utx_wmDeleteAtom, 1);
XMapWindow(utx_display, window);
utWindow result = utALLOCT(utxWindow);
result->screen = screen;
result->handle = (void*)window;
result->window = window;
return result;
}
int utxDestroyWindow(utWindow window)
{
if (window != NULL)
{
XDestroyWindow(utx_display, window->window);
utFREE(window);
}
return true;
}
| [
"starkos@5eb1f239-c603-0410-9f17-9cbfe04d0a06"
]
| [
[
[
1,
71
]
]
]
|
c1ea7e6f51a5dbd836f467c57c49fa8cef1ac3ae | d425cf21f2066a0cce2d6e804bf3efbf6dd00c00 | /Tactical/Structure Wrap.cpp | db384fd758bee0b5d3168042bc198275902d51e3 | []
| no_license | infernuslord/ja2 | d5ac783931044e9b9311fc61629eb671f376d064 | 91f88d470e48e60ebfdb584c23cc9814f620ccee | refs/heads/master | 2021-01-02T23:07:58.941216 | 2011-10-18T09:22:53 | 2011-10-18T09:22:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,842 | cpp | #ifdef PRECOMPILEDHEADERS
#include "Tactical All.h"
#else
#include <stdio.h>
#include "debug.h"
#include "wcheck.h"
#include "worlddef.h"
#include "worldman.h"
#include "structure wrap.h"
#include "isometric utils.h"
#include "worldman.h"
#include "overhead.h"
#include "renderworld.h"
#include "strategicmap.h"
#include "rotting corpses.h"
#endif
extern BOOLEAN DoesSAMExistHere( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, INT32 sGridNo );
//----------------legion by Jazz
BOOLEAN IsJumpableWindowPresentAtGridNo( INT32 sGridNo, INT8 direction2 )
{
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_WALLNWINDOW );
if ( pStructure )
{
if ( ( direction2 == SOUTH || direction2 == NORTH ) && (pStructure->ubWallOrientation == OUTSIDE_TOP_LEFT || pStructure->ubWallOrientation == INSIDE_TOP_LEFT ) && pStructure->fFlags & STRUCTURE_WALLNWINDOW && !(pStructure->fFlags & STRUCTURE_SPECIAL) && ( pStructure->fFlags & STRUCTURE_OPEN ) )
{
return( TRUE );
}
if ( ( direction2 == EAST || direction2 == WEST ) && ( pStructure->ubWallOrientation == OUTSIDE_TOP_RIGHT || pStructure->ubWallOrientation == INSIDE_TOP_RIGHT ) && pStructure->fFlags & STRUCTURE_WALLNWINDOW && !(pStructure->fFlags & STRUCTURE_SPECIAL) && ( pStructure->fFlags & STRUCTURE_OPEN ) )
{
return( TRUE );
}
}
return( FALSE );
}
BOOLEAN IsOknoFencePresentAtGridno( INT32 sGridNo )
{
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_WALLNWINDOW );
if ( pStructure )
{
if ( pStructure->fFlags & STRUCTURE_WALLNWINDOW && !(pStructure->fFlags & STRUCTURE_SPECIAL) && ( pStructure->fFlags & STRUCTURE_OPEN ) )
{
return( TRUE );
}
}
/* STRUCTURE * pStructure;
STRUCTURE * pStructure2;
pStructure = FindStructure( sGridNo, STRUCTURE_WALLNWINDOW );
if ( pStructure )
{
// pStructure2 = FindStructure( sGridNo, STRUCTURE_WALL );
// if ( !pStructure2 )
// {
if ( pStructure->fFlags & STRUCTURE_WALLNWINDOW && !(pStructure->fFlags & STRUCTURE_SPECIAL) && ( pStructure->fFlags & STRUCTURE_OPEN ))
{
return( TRUE );
}
// }
}
*/
return( FALSE );
}
BOOLEAN IsLegionWallPresentAtGridno( INT32 sGridNo )
{
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_FENCE );
if ( pStructure )
{
if ( pStructure->fFlags & STRUCTURE_FENCE && pStructure->fFlags & STRUCTURE_SPECIAL && pStructure->fFlags & STRUCTURE_WALL )
{
return( TRUE );
}
}
return( FALSE );
}
//-------------------------------------------------------------------------------------
BOOLEAN IsFencePresentAtGridNo( INT32 sGridNo )
{
if ( FindStructure( sGridNo, STRUCTURE_ANYFENCE ) != NULL )
{
return( TRUE );
}
return( FALSE );
}
BOOLEAN IsRoofPresentAtGridNo( INT32 sGridNo )
{
if ( FindStructure( sGridNo, STRUCTURE_ROOF ) != NULL )
{
return( TRUE );
}
return( FALSE );
}
BOOLEAN IsJumpableFencePresentAtGridNo( INT32 sGridNo )
{
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_OBSTACLE );
if ( pStructure )
{
if ( pStructure->fFlags & STRUCTURE_FENCE && !(pStructure->fFlags & STRUCTURE_SPECIAL) )
{
return( TRUE );
}
if ( pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_SANDBAG && StructureHeight( pStructure ) < 2 )
{
return( TRUE );
}
}
return( FALSE );
}
BOOLEAN IsDoorPresentAtGridNo( INT32 sGridNo )
{
if ( FindStructure( sGridNo, STRUCTURE_ANYDOOR ) != NULL )
{
return( TRUE );
}
return( FALSE );
}
BOOLEAN IsTreePresentAtGridNo( INT32 sGridNo )
{
if ( FindStructure( sGridNo, STRUCTURE_TREE ) != NULL )
{
return( TRUE );
}
return( FALSE );
}
LEVELNODE *IsWallPresentAtGridNo( INT32 sGridNo )
{
LEVELNODE *pNode = NULL;
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_WALLSTUFF );
if ( pStructure != NULL )
{
pNode = FindLevelNodeBasedOnStructure( sGridNo, pStructure );
}
return( pNode );
}
LEVELNODE *GetWallLevelNodeOfSameOrientationAtGridNo( INT32 sGridNo, INT8 ubOrientation )
{
LEVELNODE *pNode = NULL;
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_WALLSTUFF );
while ( pStructure != NULL )
{
// Check orientation
if ( pStructure->ubWallOrientation == ubOrientation )
{
pNode = FindLevelNodeBasedOnStructure( sGridNo, pStructure );
return( pNode );
}
pStructure = FindNextStructure( pStructure, STRUCTURE_WALLSTUFF );
}
return( NULL );
}
LEVELNODE *GetWallLevelNodeAndStructOfSameOrientationAtGridNo( INT32 sGridNo, INT8 ubOrientation, STRUCTURE **ppStructure )
{
LEVELNODE *pNode = NULL;
STRUCTURE * pStructure, * pBaseStructure;
(*ppStructure) = NULL;
pStructure = FindStructure( sGridNo, STRUCTURE_WALLSTUFF );
while ( pStructure != NULL )
{
// Check orientation
if ( pStructure->ubWallOrientation == ubOrientation )
{
pBaseStructure = FindBaseStructure( pStructure );
if (pBaseStructure)
{
pNode = FindLevelNodeBasedOnStructure( pBaseStructure->sGridNo, pBaseStructure );
(*ppStructure) = pBaseStructure;
return( pNode );
}
}
pStructure = FindNextStructure( pStructure, STRUCTURE_WALLSTUFF );
}
return( NULL );
}
BOOLEAN IsDoorVisibleAtGridNo( INT32 sGridNo )
{
STRUCTURE * pStructure;
INT32 sNewGridNo;
pStructure = FindStructure( sGridNo, STRUCTURE_ANYDOOR );
if ( pStructure != NULL )
{
// Check around based on orientation
switch( pStructure->ubWallOrientation )
{
case INSIDE_TOP_LEFT:
case OUTSIDE_TOP_LEFT:
// Here, check north direction
sNewGridNo = NewGridNo( sGridNo, DirectionInc( NORTH ) );
if ( IsRoofVisible2( sNewGridNo ) )
{
// OK, now check south, if true, she's not visible
sNewGridNo = NewGridNo( sGridNo, DirectionInc( SOUTH ) );
if ( IsRoofVisible2( sNewGridNo ) )
{
return( FALSE );
}
}
break;
case INSIDE_TOP_RIGHT:
case OUTSIDE_TOP_RIGHT:
// Here, check west direction
sNewGridNo = NewGridNo( sGridNo, DirectionInc( WEST ) );
if ( IsRoofVisible2( sNewGridNo ) )
{
// OK, now check south, if true, she's not visible
sNewGridNo = NewGridNo( sGridNo, DirectionInc( EAST ) );
if ( IsRoofVisible2( sNewGridNo ) )
{
return( FALSE );
}
}
break;
}
}
// Return true here, even if she does not exist
return( TRUE );
}
BOOLEAN DoesGridNoContainHiddenStruct( INT32 sGridNo, BOOLEAN *pfVisible )
{
// ATE: These are ignored now - always return false
//STRUCTURE *pStructure;
//pStructure = FindStructure( sGridNo, STRUCTURE_HIDDEN );
//if ( pStructure != NULL )
//{
// if ( !(gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) )
// {
// *pfVisible = FALSE;
// }
// else
// {
// *pfVisible = TRUE;
// }//
//
// return( TRUE );
//}
return( FALSE );
}
BOOLEAN IsHiddenStructureVisible( INT32 sGridNo, UINT16 usIndex )
{
// Check if it's a hidden struct and we have not revealed anything!
if ( gTileDatabase[ usIndex ].uiFlags & HIDDEN_TILE )
{
if ( !(gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) )
{
// Return false
return( FALSE );
}
}
return( TRUE );
}
BOOLEAN WallExistsOfTopLeftOrientation( INT32 sGridNo )
{
// CJC: changing to search only for normal walls, July 16, 1998
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_WALL );
while ( pStructure != NULL )
{
// Check orientation
if ( pStructure->ubWallOrientation == INSIDE_TOP_LEFT || pStructure->ubWallOrientation == OUTSIDE_TOP_LEFT )
{
return( TRUE );
}
pStructure = FindNextStructure( pStructure, STRUCTURE_WALL );
}
return( FALSE );
}
BOOLEAN WallExistsOfTopRightOrientation( INT32 sGridNo )
{
// CJC: changing to search only for normal walls, July 16, 1998
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_WALL );
while ( pStructure != NULL )
{
// Check orientation
if ( pStructure->ubWallOrientation == INSIDE_TOP_RIGHT || pStructure->ubWallOrientation == OUTSIDE_TOP_RIGHT )
{
return( TRUE );
}
pStructure = FindNextStructure( pStructure, STRUCTURE_WALL );
}
return( FALSE );
}
BOOLEAN WallOrClosedDoorExistsOfTopLeftOrientation( INT32 sGridNo )
{
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_WALLSTUFF );
while ( pStructure != NULL )
{
// skip it if it's an open door
if ( ! ( ( pStructure->fFlags & STRUCTURE_ANYDOOR ) && ( pStructure->fFlags & STRUCTURE_OPEN ) ) )
{
// Check orientation
if ( pStructure->ubWallOrientation == INSIDE_TOP_LEFT || pStructure->ubWallOrientation == OUTSIDE_TOP_LEFT )
{
return( TRUE );
}
}
pStructure = FindNextStructure( pStructure, STRUCTURE_WALLSTUFF );
}
return( FALSE );
}
BOOLEAN WallOrClosedDoorExistsOfTopRightOrientation( INT32 sGridNo )
{
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_WALLSTUFF );
while ( pStructure != NULL )
{
// skip it if it's an open door
if ( ! ( ( pStructure->fFlags & STRUCTURE_ANYDOOR ) && ( pStructure->fFlags & STRUCTURE_OPEN ) ) )
{
// Check orientation
if ( pStructure->ubWallOrientation == INSIDE_TOP_RIGHT || pStructure->ubWallOrientation == OUTSIDE_TOP_RIGHT )
{
return( TRUE );
}
}
pStructure = FindNextStructure( pStructure, STRUCTURE_WALLSTUFF );
}
return( FALSE );
}
BOOLEAN OpenRightOrientedDoorWithDoorOnRightOfEdgeExists( INT32 sGridNo )
{
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_ANYDOOR );
while ( pStructure != NULL && (pStructure->fFlags & STRUCTURE_OPEN) )
{
// Check orientation
if ( pStructure->ubWallOrientation == INSIDE_TOP_RIGHT || pStructure->ubWallOrientation == OUTSIDE_TOP_RIGHT )
{
if ( (pStructure->fFlags & STRUCTURE_DOOR) || (pStructure->fFlags & STRUCTURE_DDOOR_RIGHT) )
{
return( TRUE );
}
}
pStructure = FindNextStructure( pStructure, STRUCTURE_ANYDOOR );
}
return( FALSE );
}
BOOLEAN OpenLeftOrientedDoorWithDoorOnLeftOfEdgeExists( INT32 sGridNo )
{
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_ANYDOOR );
while ( pStructure != NULL && (pStructure->fFlags & STRUCTURE_OPEN) )
{
// Check orientation
if ( pStructure->ubWallOrientation == INSIDE_TOP_LEFT || pStructure->ubWallOrientation == OUTSIDE_TOP_LEFT )
{
if ( (pStructure->fFlags & STRUCTURE_DOOR) || (pStructure->fFlags & STRUCTURE_DDOOR_LEFT) )
{
return( TRUE );
}
}
pStructure = FindNextStructure( pStructure, STRUCTURE_ANYDOOR );
}
return( FALSE );
}
STRUCTURE * FindCuttableWireFenceAtGridNo( INT32 sGridNo )
{
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_WIREFENCE );
if (pStructure != NULL && pStructure->ubWallOrientation != NO_ORIENTATION && !(pStructure->fFlags & STRUCTURE_OPEN) )
{
return( pStructure );
}
return( NULL );
}
BOOLEAN CutWireFence( INT32 sGridNo )
{
STRUCTURE * pStructure;
pStructure = FindCuttableWireFenceAtGridNo( sGridNo );
if (pStructure)
{
pStructure = SwapStructureForPartnerAndStoreChangeInMap( sGridNo, pStructure );
if (pStructure)
{
RecompileLocalMovementCosts( sGridNo );
SetRenderFlags( RENDER_FLAG_FULL );
return( TRUE );
}
}
return( FALSE );
}
BOOLEAN IsCuttableWireFenceAtGridNo( INT32 sGridNo )
{
return( FindCuttableWireFenceAtGridNo( sGridNo ) != NULL );
}
BOOLEAN IsRepairableStructAtGridNo( INT32 sGridNo, UINT8 *pubID )
{
UINT8 ubMerc;
// OK, first look for a vehicle....
ubMerc = WhoIsThere2( sGridNo, 0 );
if ( pubID != NULL )
{
(*pubID) = ubMerc;
}
if ( ubMerc != NOBODY )
{
if ( MercPtrs[ ubMerc ]->flags.uiStatusFlags & SOLDIER_VEHICLE )
{
return( 2 );
}
}
// Then for over a robot....
// then for SAM site....
if ( DoesSAMExistHere( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, sGridNo ) )
{
return( 3 );
}
return( FALSE );
}
BOOLEAN IsRefuelableStructAtGridNo( INT32 sGridNo, UINT8 *pubID )
{
UINT8 ubMerc;
// OK, first look for a vehicle....
ubMerc = WhoIsThere2( sGridNo, 0 );
if ( pubID != NULL )
{
(*pubID) = ubMerc;
}
if ( ubMerc != NOBODY )
{
if ( MercPtrs[ ubMerc ]->flags.uiStatusFlags & SOLDIER_VEHICLE )
{
return( TRUE );
}
}
return( FALSE );
}
BOOLEAN IsCutWireFenceAtGridNo( INT32 sGridNo )
{
STRUCTURE * pStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_WIREFENCE );
if (pStructure != NULL && (pStructure->ubWallOrientation != NO_ORIENTATION) && (pStructure->fFlags & STRUCTURE_OPEN) )
{
return( TRUE );
}
return( FALSE );
}
INT32 FindDoorAtGridNoOrAdjacent( INT32 sGridNo )
{
STRUCTURE * pStructure;
STRUCTURE * pBaseStructure;
INT32 sTestGridNo;
sTestGridNo = sGridNo;
pStructure = FindStructure( sTestGridNo, STRUCTURE_ANYDOOR );
if (pStructure)
{
pBaseStructure = FindBaseStructure( pStructure );
return( pBaseStructure->sGridNo );
}
sTestGridNo = sGridNo + DirectionInc( NORTH );
pStructure = FindStructure( sTestGridNo, STRUCTURE_ANYDOOR );
if (pStructure)
{
pBaseStructure = FindBaseStructure( pStructure );
return( pBaseStructure->sGridNo );
}
sTestGridNo = sGridNo + DirectionInc( WEST );
pStructure = FindStructure( sTestGridNo, STRUCTURE_ANYDOOR );
if (pStructure)
{
pBaseStructure = FindBaseStructure( pStructure );
return( pBaseStructure->sGridNo );
}
return( NOWHERE );
}
BOOLEAN IsCorpseAtGridNo( INT32 sGridNo, UINT8 ubLevel )
{
if ( GetCorpseAtGridNo( sGridNo , ubLevel ) != NULL )
{
return( TRUE );
}
else
{
return( FALSE );
}
}
BOOLEAN SetOpenableStructureToClosed( INT32 sGridNo, UINT8 ubLevel )
{
STRUCTURE * pStructure;
STRUCTURE * pNewStructure;
pStructure = FindStructure( sGridNo, STRUCTURE_OPENABLE );
if ( !pStructure )
{
return( FALSE );
}
if ( pStructure->fFlags & STRUCTURE_OPEN )
{
pNewStructure = SwapStructureForPartner( sGridNo, pStructure );
if ( pNewStructure != NULL)
{
RecompileLocalMovementCosts( sGridNo );
SetRenderFlags( RENDER_FLAG_FULL );
}
}
// else leave it as is!
return( TRUE );
} | [
"jazz_ja@b41f55df-6250-4c49-8e33-4aa727ad62a1"
]
| [
[
[
1,
652
]
]
]
|
b9874679e0a71a8e9ec61175db5447854e92cbbc | 74c8da5b29163992a08a376c7819785998afb588 | /NetAnimal/Game/wheel/WheelGobal/include/ThirdParty/Ofusion/IOSMSceneCallbacks.h | 2c5faad54627ddfaf63fd6dfb2c44cc3fde11076 | []
| no_license | dbabox/aomi | dbfb46c1c9417a8078ec9a516cc9c90fe3773b78 | 4cffc8e59368e82aed997fe0f4dcbd7df626d1d0 | refs/heads/master | 2021-01-13T14:05:10.813348 | 2011-06-07T09:36:41 | 2011-06-07T09:36:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,071 | h | /**********************************************************************
*<
oFusion Scene Loader Pro (see License.txt)
FILE: ogreAnimationCompiler.h
DESCRIPTION: OE_XMLScene callbacks interface
IMPLEMENTED BY: Andres Carrera
HISTORY:
Original implementation by Lasse Tassing (Channex)
2005 ITE ApS, Lasse Tassing
*> Copyright (c) 2006, All Rights Reserved.
**********************************************************************/
#ifndef _IOSMSCENECALLBACKS_H_
#define _IOSMSCENECALLBACKS_H_
typedef std::deque<Ogre::SceneNode*> NodeList;
class oPassAnimation {
public:
oPassAnimation() : index(0), alphaLength(0) {}
unsigned int index;
// Alpha animation
typedef std::map<float, float> AlphaKeyFramesList;
AlphaKeyFramesList alphaKeyFrames;
float alphaLength;
};
class oMaterialAnimation {
public:
oMaterialAnimation() : techniqueIndex(0) {}
std::string materialName;
std::string animationName;
unsigned int techniqueIndex;
typedef std::deque<oPassAnimation> oPassAnimatorList;
oPassAnimatorList passAnims;
};
// Callback interface. Use this if you want to set special properties on the
// objects during creation (and/or read custom attribute values).
class OSMSceneCallbacks
{
public:
virtual ~OSMSceneCallbacks() {};
// Called when a node has been created
virtual void OnNodeCreate(Ogre::SceneNode *pNode, rapidxml::xml_node<> * pNodeDesc) {};
// Called when an entity has been created
virtual void OnEntityCreate(Ogre::Entity *pEntity, rapidxml::xml_node<> * pEntityDesc) {};
// Called when a camera has been created
virtual void OnCameraCreate(Ogre::Camera *pCamera, rapidxml::xml_node<> * pCameraDesc) {};
// Called when a light has been created
virtual void OnLightCreate(Ogre::Light *pLight, rapidxml::xml_node<> * pLightDesc) {};
// Called when a helper has been created
virtual void OnHelperCreated(Ogre::SceneNode* pHelper, rapidxml::xml_node<> * pHelperDesc) {};
// Called when a shape has been loaded
virtual void OnShapeLoaded(const Ogre::SimpleSpline& spline,
const Ogre::Vector3& position,
const Ogre::Quaternion& rotation,
const Ogre::Vector3& scale) {
// The client should copy and store the "spline" contents in order to use it
// Dont store a pointer to it, the "spline" object is destroyed at function return
};
// Called when a render to texture has been created
virtual void OnRenderTextureCreate(Ogre::RenderTexture* pRenderTex, rapidxml::xml_node<> * pRenderTexDesc) {};
// Called when a static geometry has been created
virtual bool OnStaticGeometryCreated(Ogre::StaticGeometry* pStatic, const NodeList& nodeList)
{
// Return true to keep the added nodes (will be hidden)
// Return false to delete the added nodes from the scene manager
return false;
}
// Called when a Material animator has been loaded
virtual void OnMaterialAnimatorLoaded(const oMaterialAnimation& materialAnim) {}
};
#endif // _IOSMSCENECALLBACKS_H_ | [
"[email protected]"
]
| [
[
[
1,
100
]
]
]
|
4a58b8be6d0b05a11cc3b1394c22280507529923 | c95a83e1a741b8c0eb810dd018d91060e5872dd8 | /libs/STLPort-4.0/stlport/stl/_ios_base.h | 53b8718649bb39f0c674c58d3adacefdb723c6f3 | [
"LicenseRef-scancode-stlport-4.5"
]
| permissive | rickyharis39/nolf2 | ba0b56e2abb076e60d97fc7a2a8ee7be4394266c | 0da0603dc961e73ac734ff365bfbfb8abb9b9b04 | refs/heads/master | 2021-01-01T17:21:00.678517 | 2011-07-23T12:11:19 | 2011-07-23T12:11:19 | 38,495,312 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,512 | h | /*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef __SGI_STL_IOS_BASE_H
#define __SGI_STL_IOS_BASE_H
#include <stl/_config.h>
#include <stdexcept>
#include <utility>
#include <iosfwd>
#include <stl/_locale.h>
__STL_BEGIN_NAMESPACE
// ----------------------------------------------------------------------
// Class ios_base. This is the base class of the ios hierarchy, which
// includes basic_istream and basic_ostream. Classes in the ios
// hierarchy are actually quite simple: they are just glorified
// wrapper classes. They delegate buffering and physical character
// manipulation to the streambuf classes, and they delegate most
// formatting tasks to a locale.
class __STL_CLASS_DECLSPEC ios_base {
public:
class __STL_CLASS_DECLSPEC failure : public __Named_exception {
public:
explicit failure(const string&);
virtual ~failure() __STL_NOTHROW_INHERENTLY;
};
typedef unsigned int fmtflags;
// Formatting flags.
# if defined ( __STL_STATIC_CONST_INIT_BUG) || defined (__STL_USE_DECLSPEC) || defined(__MRC__) || defined(__SC__)
enum fmt_flags {
# else
// somebody relies on that
typedef unsigned int fmt_flags;
static const fmtflags
# endif
left = 0x0001,
right = 0x0002,
internal = 0x0004,
dec = 0x0008,
hex = 0x0010,
oct = 0x0020,
fixed = 0x0040,
scientific = 0x0080,
boolalpha = 0x0100,
showbase = 0x0200,
showpoint = 0x0400,
showpos = 0x0800,
skipws = 0x1000,
unitbuf = 0x2000,
uppercase = 0x4000,
adjustfield = left | right | internal,
basefield = dec | hex | oct,
floatfield = scientific | fixed
# if defined ( __STL_STATIC_CONST_INIT_BUG) || defined (__STL_USE_DECLSPEC) || defined(__MRC__) || defined(__SC__)
}
# endif
;
typedef unsigned char iostate;
// State flags.
# if defined ( __STL_STATIC_CONST_INIT_BUG) || defined (__STL_USE_DECLSPEC) || defined(__MRC__) || defined(__SC__)
enum io_state_ {
# else
static const iostate
# endif
goodbit = 0x00,
badbit = 0x01,
eofbit = 0x02,
failbit = 0x04
# if defined ( __STL_STATIC_CONST_INIT_BUG) || defined (__STL_USE_DECLSPEC) || defined(__MRC__) || defined(__SC__)
}
# endif
;
// Openmode flags.
typedef unsigned short openmode;
# if defined ( __STL_STATIC_CONST_INIT_BUG) || defined (__STL_USE_DECLSPEC) || defined(__MRC__) || defined(__SC__)
enum __open_mode {
# else
static const openmode
# endif
__default_mode = 0x0, /* implementation detail */
app = 0x01,
ate = 0x02,
binary = 0x04,
in = 0x08,
out = 0x10,
trunc = 0x20
# if defined ( __STL_STATIC_CONST_INIT_BUG) || defined (__STL_USE_DECLSPEC)|| defined(__MRC__) || defined(__SC__)
}
# endif
;
typedef unsigned char seekdir;
// Seekdir flags
# if defined ( __STL_STATIC_CONST_INIT_BUG) || defined (__STL_USE_DECLSPEC) || defined(__MRC__) || defined(__SC__)
enum __seek_dir {
# else
static const seekdir
# endif
beg = 0x01,
cur = 0x02,
end = 0x04
# if defined ( __STL_STATIC_CONST_INIT_BUG) || defined (__STL_USE_DECLSPEC) || defined(__MRC__) || defined(__SC__)
}
# endif
;
public: // Flag-manipulation functions.
fmtflags flags() const { return _M_fmtflags; }
fmtflags flags(fmtflags __flags) {
fmtflags __tmp = _M_fmtflags;
_M_fmtflags = __flags;
return __tmp;
}
fmtflags setf(fmtflags __flag) {
fmtflags __tmp = _M_fmtflags;
_M_fmtflags |= __flag;
return __tmp;
}
fmtflags setf(fmtflags __flag, fmtflags __mask) {
fmtflags __tmp = _M_fmtflags;
_M_fmtflags &= ~__mask;
_M_fmtflags |= __flag & __mask;
return __tmp;
}
void unsetf(fmtflags __mask) { _M_fmtflags &= ~__mask; }
streamsize precision() const { return _M_precision; }
streamsize precision(streamsize __newprecision) {
streamsize __tmp = _M_precision;
_M_precision = __newprecision;
return __tmp;
}
streamsize width() const { return _M_width; }
streamsize width(streamsize __newwidth) {
streamsize __tmp = _M_width;
_M_width = __newwidth;
return __tmp;
}
#if defined(__MRC__) || defined(__SC__)
//*TY 02/24/2000 - added workaround for MPW compilers; ref.[ file iomanip; line 139 ]
streamsize _PRECISION(streamsize __newprecision) {return precision(__newprecision);}
//*TY 03/05/2000 - mpw compilers have difficulty resolving overloaded function when assigning a pointer to function
streamsize _WIDTH(streamsize __newwidth) {return width(__newwidth);}
#endif
public: // Locales
locale imbue(const locale&);
locale getloc() const { return _M_locale; }
public: // Auxiliary storage.
static int __STL_CALL xalloc();
long& iword(int __index);
void*& pword(int __index);
public: // Destructor.
virtual ~ios_base();
public: // Callbacks.
enum event { erase_event, imbue_event, copyfmt_event };
typedef void (*event_callback)(event, ios_base&, int __index);
void register_callback(event_callback __fn, int __index);
public: // This member function affects only
// the eight predefined ios objects:
// cin, cout, etc.
static bool __STL_CALL sync_with_stdio(bool __sync = true);
public: // The C++ standard requires only that these
// member functions be defined in basic_ios.
// We define them in the non-template
// base class to avoid code duplication.
operator void*() const { return !fail() ? (void*) __CONST_CAST(ios_base*,this) : (void*) 0; }
bool operator!() const { return fail(); }
iostate rdstate() const { return _M_iostate; }
bool good() const { return _M_iostate == 0; }
bool eof() const { return (_M_iostate & eofbit) != 0; }
bool fail() const { return (_M_iostate & (failbit | badbit)) != 0; }
bool bad() const { return (_M_iostate & badbit) != 0; }
protected: // The functional protected interface.
// Copies the state of __x to *this. This member function makes it
// possible to implement basic_ios::copyfmt without having to expose
// ios_base's private data members. Does not copy _M_exception_mask
// or _M_iostate.
void _M_copy_state(const ios_base& __x);
void _M_setstate_nothrow(iostate __state) { _M_iostate |= __state; }
void _M_clear_nothrow(iostate __state) { _M_iostate = __state; }
iostate _M_get_exception_mask() const { return _M_exception_mask; }
void _M_set_exception_mask(iostate __mask) { _M_exception_mask = __mask; }
void _M_check_exception_mask()
{ if (_M_iostate & _M_exception_mask) _M_throw_failure(); }
void _M_invoke_callbacks(event __event);
void _M_throw_failure();
ios_base(); // Default constructor.
protected: // Initialization of the I/O system
static void __STL_CALL _S_initialize();
static void __STL_CALL _S_uninitialize();
private: // Invalidate the copy constructor and
// assignment operator.
ios_base(const ios_base&);
void operator=(const ios_base&);
private: // Data members.
fmtflags _M_fmtflags; // Flags
iostate _M_iostate;
openmode _M_openmode;
seekdir _M_seekdir;
iostate _M_exception_mask;
streamsize _M_precision;
streamsize _M_width;
locale _M_locale;
pair<event_callback, int>* _M_callbacks;
size_t _M_num_callbacks; // Size of the callback array.
size_t _M_callback_index; // Index of the next available callback;
// initially zero.
long* _M_iwords; // Auxiliary storage. The count is zero
size_t _M_num_iwords; // if and only if the pointer is null.
void** _M_pwords;
size_t _M_num_pwords;
static int _S_index;
public:
// ----------------------------------------------------------------------
// Nested initializer class. This is an implementation detail, but it's
// prescribed by the standard. The static initializer object (on
// implementations where such a thing is required) is declared in
// <iostream>
class __STL_CLASS_DECLSPEC Init {
public:
Init();
~Init();
private:
static long _S_count;
};
friend class Init;
public:
# ifndef __STL_NO_ANACHRONISMS
// 31.6 Old iostreams members [depr.ios.members]
typedef iostate io_state;
typedef openmode open_mode;
typedef seekdir seek_dir;
typedef __STLPORT_STD::streamoff streamoff;
typedef __STLPORT_STD::streampos streampos;
# endif
};
// ----------------------------------------------------------------------
// ios_base manipulator functions, from section 27.4.5 of the C++ standard.
// All of them are trivial one-line wrapper functions.
// fmtflag manipulators, section 27.4.5.1
inline ios_base& __STL_CALL boolalpha(ios_base& __s)
{ __s.setf(ios_base::boolalpha); return __s;}
inline ios_base& __STL_CALL noboolalpha(ios_base& __s)
{ __s.unsetf(ios_base::boolalpha); return __s;}
inline ios_base& __STL_CALL showbase(ios_base& __s)
{ __s.setf(ios_base::showbase); return __s;}
inline ios_base& __STL_CALL noshowbase(ios_base& __s)
{ __s.unsetf(ios_base::showbase); return __s;}
inline ios_base& __STL_CALL showpoint(ios_base& __s)
{ __s.setf(ios_base::showpoint); return __s;}
inline ios_base& __STL_CALL noshowpoint(ios_base& __s)
{ __s.unsetf(ios_base::showpoint); return __s;}
inline ios_base& __STL_CALL showpos(ios_base& __s)
{ __s.setf(ios_base::showpos); return __s;}
inline ios_base& __STL_CALL noshowpos(ios_base& __s)
{ __s.unsetf(ios_base::showpos); return __s;}
inline ios_base& __STL_CALL skipws(ios_base& __s)
{ __s.setf(ios_base::skipws); return __s;}
inline ios_base& __STL_CALL noskipws(ios_base& __s)
{ __s.unsetf(ios_base::skipws); return __s;}
inline ios_base& __STL_CALL uppercase(ios_base& __s)
{ __s.setf(ios_base::uppercase); return __s;}
inline ios_base& __STL_CALL nouppercase(ios_base& __s)
{ __s.unsetf(ios_base::uppercase); return __s;}
inline ios_base& __STL_CALL unitbuf(ios_base& __s)
{ __s.setf(ios_base::unitbuf); return __s;}
inline ios_base& __STL_CALL nounitbuf(ios_base& __s)
{ __s.unsetf(ios_base::unitbuf); return __s;}
// adjustfield manipulators, section 27.4.5.2
inline ios_base& __STL_CALL internal(ios_base& __s)
{ __s.setf(ios_base::internal, ios_base::adjustfield); return __s; }
inline ios_base& __STL_CALL left(ios_base& __s)
{ __s.setf(ios_base::left, ios_base::adjustfield); return __s; }
inline ios_base& __STL_CALL right(ios_base& __s)
{ __s.setf(ios_base::right, ios_base::adjustfield); return __s; }
// basefield manipulators, section 27.4.5.3
inline ios_base& __STL_CALL dec(ios_base& __s)
{ __s.setf(ios_base::dec, ios_base::basefield); return __s; }
inline ios_base& __STL_CALL hex(ios_base& __s)
{ __s.setf(ios_base::hex, ios_base::basefield); return __s; }
inline ios_base& __STL_CALL oct(ios_base& __s)
{ __s.setf(ios_base::oct, ios_base::basefield); return __s; }
// floatfield manipulators, section 27.4.5.3
inline ios_base& __STL_CALL fixed(ios_base& __s)
{ __s.setf(ios_base::fixed, ios_base::floatfield); return __s; }
inline ios_base& __STL_CALL scientific(ios_base& __s)
{ __s.setf(ios_base::scientific, ios_base::floatfield); return __s; }
__STL_END_NAMESPACE
#endif /* __SGI_STL_IOS_BASE */
// Local Variables:
// mode:C++
// End:
| [
"[email protected]"
]
| [
[
[
1,
373
]
]
]
|
92b1a1363a49c1070154cce8fca273a2983652e4 | 74c8da5b29163992a08a376c7819785998afb588 | /NetAnimal/QtApp/UnitTest/include/JsComponentUT.h | f8bb83f16ea375765ac9a2eea7760ee1de151c03 | []
| no_license | dbabox/aomi | dbfb46c1c9417a8078ec9a516cc9c90fe3773b78 | 4cffc8e59368e82aed997fe0f4dcbd7df626d1d0 | refs/heads/master | 2021-01-13T14:05:10.813348 | 2011-06-07T09:36:41 | 2011-06-07T09:36:41 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 2,788 | h | #ifndef __Orz_UnitTest_JsComponentUT__
#define __Orz_UnitTest_JsComponentUT__
#include "UnitTestConfig.h"
#include "JsInterface.h"
#include "GameInterface.h"
namespace UnitTest
{
class MyJs
{
public:
void enableButton(bool enable)
{
std::cout<<"enableButton"<<std::endl;
}
void setTime(int time)
{
std::cout<<"setTime"<<time<<std::endl;
}
void askPanelData(void)
{
std::cout<<"askPanelData"<<std::endl;
}
void addProfit(int profit)
{
std::cout<<"addProfit"<<std::endl;
}
void setProfit(int profit)
{
std::cout<<"setProfit"<<std::endl;
}
void rollProfit(void)
{
std::cout<<"rollProfit"<<std::endl;
}
void setWinner(JsInterface::ButtonId id, int profit)
{
std::cout<<"setWinner"<<std::endl;
}
void setState(JsInterface::State state)
{
std::cout<<"setState"<<std::endl;
}
};
class MyGame
{
public:
void postPanelData(JsInterface::ButtonId id, size_t num)
{
std::cout<<"postPanelData"<<std::endl;
}
};
}
BOOST_AUTO_TEST_CASE(JsComponentUT)
{
using namespace UnitTest;
using namespace Orz;
MyJs myJs;
MyGame myGame;
//typedef boost::function<boost::signals2::connection (const SignalType::slot_type &subscriber)> ResetSubscribeFunction;
Orz::ComponentPtr jsComp = Orz::ComponentFactories::getInstance().create("Js");
GameInterface<0> * game = jsComp->queryInterface<GameInterface<0> >();
assert(game);
JsInterface * js = jsComp->queryInterface<JsInterface>();
assert(js);
//js->subscribeEnableButton(boost::bind(&MyJs::enableButton, &myJs, _1));
//js->subscribeSetTime(boost::bind(&MyJs::setTime, &myJs, _1));
js->subscribeAskPanelData(boost::bind(&MyJs::askPanelData, &myJs));
game->setButtonEnable(true);
game->setTime(123);
game->askPanelData();
game->subscribePostPanelData(boost::bind(&MyGame::postPanelData, &myGame, _1, _2));
js->postPanelData(JsInterface::ButtonId(0), 123);
js->subscribeAddProfit(boost::bind(&MyJs::addProfit, &myJs, _1));
js->subscribeSetProfit(boost::bind(&MyJs::setProfit, &myJs, _1));
js->subscribeRollProfit(boost::bind(&MyJs::rollProfit, &myJs));
js->subscribeSetState(boost::bind(&MyJs::setState, &myJs, _1));
game->addProfit(123);
game->setProfit(0);
game->rollProfit();
game->setState(JsInterface::Start);
js->subscribeSetWinner(boost::bind(&MyJs::setWinner, &myJs, _1, _2));
game->setWinner(JsInterface::ButtonId(0), 123);
}
#endif
//作家研習營。拋開你的生活,就此消失。將你生命中的一小段時間賭在可以創造一個全新未來的機會上。及時行動,過你夢想中的生活,名額極其有限。有興趣者請來電:1-800-滾你媽的蛋 | [
"[email protected]"
]
| [
[
[
1,
114
]
]
]
|
bd9a0d8e63450f403466d90af2bebdf94cbb6111 | 9f00cc73bdc643215425e6bc43ea9c6ef3094d39 | /OOP/ex1/Itriangle.h | 50ec4936188b8b49cca666e134a6ee12bf6cccbf | []
| no_license | AndreyShamis/oopos | c0700e1d9d889655a52ad2bc58731934e968b1dd | 0114233944c4724f242fd38ac443a925faf81762 | refs/heads/master | 2021-01-25T04:01:48.005423 | 2011-07-16T14:23:12 | 2011-07-16T14:23:12 | 32,789,875 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 703 | h | //
// @ Project : Paint
// @ File Name : bar.h
// @ Date : 3/3/2011
// @ Author : Andrey Shamis Ilia Gaysinski
// @ Description : A class that reprisen "Itrriangle" shape at glut window
//
#pragma once
#include "shape.h"
#define DEFAULT_HEIGHT 0.3 // define default size of the Itrriangle heigh
#define DEFAULT_BASE 0.2 // define default size of the Itrriangle base
// side
class Itriangle :public Shape // class Itrriangle inherits from class Shape
{
public:
// Constractor of class Itrriangle, get color and coordinat of start point
// to creat the shape.
Itriangle(float x, float y,const RgbColor &color);
void Draw(); // Drow the shape: Itrriangle
};
| [
"[email protected]@c8aee422-7d7c-7b79-c2f1-0e09d0793d10"
]
| [
[
[
1,
22
]
]
]
|
879b62685ea3f49312fd66a4e39d06d1d907f4b5 | 6ea2685ec9aa4be984ea0febb7eefc2f3bc544c9 | /FramePointsConstructor.cpp | c041ae13a13c2ae2cda2eb0de713901fc142eb1c | []
| no_license | vpatrinica/pernute | f047445a373f79209f0e32c1bf810d90c3d6289f | e2c0bf4161ccb4e768e7b64ecd2a021e51319383 | refs/heads/master | 2021-01-02T22:31:07.174479 | 2010-05-13T21:13:34 | 2010-05-13T21:13:34 | 39,997,926 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,108 | cpp | #include "FramePointsConstructor.h"
#include "dbobjptr.h"
#include "LineFrameBuilder.h"
#include "dbents.h"
#include "PLine2DFrameBuilder.h"
#include "PLineFrameBuilder.h"
#include "PLine3DFrameBuilder.h"
#include "ArcFrameBuilder.h"
#include "SplineFrameBuilder.h"
#include <vector>
#include <cmath>
bool static isEqualPoint(AcGePoint3d& pA, AcGePoint3d& pB)
{
if ( abs(pA.x - pB.x) + abs(pA.y - pB.y) + abs(pA.z - pB.z) <0.001 ) return true;
else return false;
}
int FramePointsConstructor::getNumberOfPoints()
{
return _lengthPointArray;
}
void FramePointsConstructor::getLinearArrayFramePoints(AcArray<AcGePoint3d>& linArrayFrame, AcArray<int>& linArrayFrameLengths)
{
int i = 0;
int j;
bool next;
//acutPrintf(_T("This is the list of the frame points%d\n"), _lengthPointArray);
//acutPrintf(_T("Here 000 %d \n"), _lengthPointArray);
linArrayFrame.append(_pointArray[0]);
linArrayFrameLengths.append(_pointArray[0].length());
//acutPrintf(_T("Here 000 %d \n"), _pointArray->length());
std::vector<int> marksV = std::vector<int>(_lengthPointArray, 0);
marksV[0] = 1;
std::vector<int>::iterator it;
//_pointArray[0].removeFirst();
//_pointArray[0].removeLast();
//acutPrintf(_T("Here 000 %d \n"), _pointArray->length());
while (i < _lengthPointArray-1)
{
//acutPrintf(_T("The number of prcessed:%d, %d\n"), i, marksV.size());
//for (it = marksV.begin(); it!=marksV.end(); it++) acutPrintf(_T("%d"), *it);
next = true;
j = 0;
//acutPrintf(_T("Here 0\n"));
while ((j < _lengthPointArray) && (next))
{
//acutPrintf(_T("The number of point:%d, %f, %f, %f\n"), j, _pointArray[j].first().x, _pointArray[j].first().y, _pointArray[j].first().z);
//acutPrintf(_T("The number of point:%d, %f, %f, %f\n"), j, _pointArray[j].last().x, _pointArray[j].last().y, _pointArray[j].last().z);
//acutPrintf(_T("The value of j: %d\n"), j);
if ((isEqualPoint(_pointArray[j].first(), linArrayFrame.last())) && (marksV[j] == 0))
{
//_pointArray[j].removeFirst();
linArrayFrame.append(_pointArray[j]);
next = false;
linArrayFrameLengths.append(_pointArray[j].length());
marksV[j] = 1;
//_pointArray[j].removeFirst();
//_pointArray[j].removeLast();
//acutPrintf(_T("Here 1\n"));
}
else if ((isEqualPoint(_pointArray[j].last(), linArrayFrame.last())) && (marksV[j] == 0))
{
//_pointArray[j].removeLast();
linArrayFrame.append(_pointArray[j].reverse());
next = false;
linArrayFrameLengths.append(_pointArray[j].length());
marksV[j] = 1;
//_pointArray[j].removeFirst();
//_pointArray[j].removeLast();
//acutPrintf(_T("Here 2\n"));
}
else
{
//acutPrintf(_T("The number of point:%d, %f, %f, %f\n"), j, linArrayFrame.last().x, linArrayFrame.last().y, linArrayFrame.last().z);
//acutPrintf(_T("\n The point i = %d doesnot match point j = %d , marked: %d are equal: %d\n"), i, j, marksV[j], isEqualPoint(_pointArray[j].last(), linArrayFrame.last()));
}
//acutPrintf(_T("Here 4\n"));
j++;
}
//acutPrintf(_T("Here 3\n"));
i++;
//for (it = marksV.begin(); it!=marksV.end(); it++) acutPrintf(_T("%d"), *it);
}
//while (i < _lengthPointArray)
//{
// linArrayFrameLengths.append(_pointArray[i].length());
// //TODO: Consistency assumed.
//
// int j = 0;
// if (i == 0)
// {
// while (j < _pointArray[i].length())
// {
// /*acutPrintf(_T("Printing the data of the point i: %d , j: %d ... \n"), i, j);
// */acutPrintf(_T("Printing the data of the point x: %f , y: %f z: %f ... \n"), _pointArray[i][j].x, _pointArray[i][j].y, _pointArray[i][j].z);
// linArrayFrame.append(_pointArray[i][j]);
// j++;
// }
// }
// else if (isEqualPoint(linArrayFrame.last(), _pointArray[i][j]))
// {
// /*acutPrintf(_T("Printing the data of first the point i: %d , j: %d ... \n"), i, j);
// acutPrintf(_T("Printing the data of first the point x: %f , y: %f z: %f ... \n"), _pointArray[i][j].x, _pointArray[i][j].y, _pointArray[i][j].z);
// acutPrintf(_T("Printing the data of second the point i: %d , j: %d ... \n"), i, j);
// acutPrintf(_T("Printing the data of second the point x: %f , y: %f z: %f ... \n"), linArrayFrame.last().x, linArrayFrame.last().y, linArrayFrame.last().z);
// */
//
// j++;
// /*acutPrintf(_T("The vertices are equal, the j is now: %d\n"), j);
// */while (j < _pointArray[i].length())
// {
// /*acutPrintf(_T("Printing the data of the point i: %d , j: %d ... \n"), i, j);
// */acutPrintf(_T("Printing the data of the point x: %f , y: %f z: %f ... \n"), _pointArray[i][j].x, _pointArray[i][j].y, _pointArray[i][j].z);
// linArrayFrame.append(_pointArray[i][j]);
// j++;
// }
// }
// else
// {
// /*acutPrintf(_T("Printing the data of first the point i: %d , j: %d ... \n"), i, j);
// acutPrintf(_T("Printing the data of first the point x: %f , y: %f z: %f ... \n"), _pointArray[i][j].x, _pointArray[i][j].y, _pointArray[i][j].z);
// acutPrintf(_T("Printing the data of second the point i: %d , j: %d ... \n"), i, j);
// acutPrintf(_T("Printing the data of second the point x: %f , y: %f z: %f ... \n"), linArrayFrame.last().x, linArrayFrame.last().y, linArrayFrame.last().z);
//
// acutPrintf(_T("The vertices are not equal"));
// */j++;
// while (j < _pointArray[i].length())
// {
// /*acutPrintf(_T("Printing the data of the point i: %d , j: %d ... \n"), i, j);
// */acutPrintf(_T("Printing the data of the point x: %f , y: %f z: %f ... \n"), _pointArray[i][j].x, _pointArray[i][j].y, _pointArray[i][j].z);
// linArrayFrame.append(_pointArray[i][_pointArray[i].length()- j - 1]);
// j++;
// }
// }
// i++;
//}
//closing the loop
linArrayFrame.remove(linArrayFrame.last());
/*for (i = 0; i<linArrayFrame.length(); i++)
{
acutPrintf(_T("Printing the data of point: %f , y: %f z: %f ... \n"), linArrayFrame[i].x, linArrayFrame[i].y, linArrayFrame[i].z);
}
acutPrintf(_T("The length of the contour: %d\n"), linArrayFrame.length());*/
}
FramePointsConstructor::FramePointsConstructor()
{
acutPrintf(_T("Constructor of the FramePointsConstructor called... \n"));
_lengthPointArray = 0;
_pointArray = NULL;
}
FramePointsConstructor::FramePointsConstructor(AcDbObjectIdArray* selSetIds)
{
acutPrintf(_T("Constructor of the FramePointsConstructor called... \n"));
_obArrayId = selSetIds;
_lengthPointArray = 0;
_pointArray = NULL;
}
FramePointsConstructor::~FramePointsConstructor()
{
acutPrintf(_T("Destructor of the FramePointsConstructor called... \n"));
if (_pointArray) delete [] _pointArray;
}
void FramePointsConstructor::setSetIds(AcDbObjectIdArray* selSetIds)
{
_obArrayId = selSetIds;
}
void FramePointsConstructor::getConstructedPointsAsArray()
{
}
void FramePointsConstructor::printConstructedPoints()
{
int i = 0;
while (i < _lengthPointArray)
{
int j = 0;
while (j < _pointArray[i].length())
{
acutPrintf(_T("Printing the data of the point i: %d , j: %d ... \n"), i, j);
acutPrintf(_T("Printing the data of the point x: %f , y: %f z: %f ... \n"), _pointArray[i][j].x, _pointArray[i][j].y, _pointArray[i][j].z);
j++;
}
i++;
}
}
Acad::ErrorStatus FramePointsConstructor::constructFramePoints(int granularity)
{
_pointArray = new AcArray<AcGePoint3d>[_obArrayId->length()];
LineFrameBuilder * _lineBuilder = new LineFrameBuilder();
PLine2DFrameBuilder * _pline2dBuilder = new PLine2DFrameBuilder();
PLine3DFrameBuilder * _pline3dBuilder = new PLine3DFrameBuilder();
PLineFrameBuilder * _plineBuilder = new PLineFrameBuilder();
SplineFrameBuilder * _splineBuilder = new SplineFrameBuilder();
ArcFrameBuilder * _arcBuilder = new ArcFrameBuilder();
while (_obArrayId->isEmpty()!=Adesk::kTrue)
{
acutPrintf(_T("Accessing the object... \n"));
AcDbObjectPointer<AcDbEntity> pEnt(_obArrayId->first(), AcDb::kForRead);
if (pEnt.openStatus() != Acad::eOk)
{
acutPrintf(_T("The object was not properly openned ... \n"));
return Acad::eObjectIsReferenced;
}
acutPrintf(_T("Registering a corresponding frame points builder... \n"));
if(pEnt->isA() == AcDbLine::desc())
{
AcDbLine *pLine = AcDbLine::cast(pEnt);
if(pLine)
{
_lengthPointArray++;
setBuilder(_lineBuilder);
}
}
else if(pEnt->isA() == AcDb2dPolyline::desc())
{
AcDb2dPolyline *p2dPLine = AcDb2dPolyline::cast(pEnt);
if(p2dPLine)
{
_lengthPointArray++;
setBuilder(_pline2dBuilder);
}
}
else if(pEnt->isA() == AcDb3dPolyline::desc())
{
AcDb3dPolyline *p3dPLine = AcDb3dPolyline::cast(pEnt);
if(p3dPLine)
{
_lengthPointArray++;
setBuilder(_pline3dBuilder);
}
}
else if (pEnt->isA() == AcDbPolyline::desc())
{
AcDbPolyline *pPLine = AcDbPolyline::cast(pEnt);
if(pPLine)
{
_lengthPointArray++;
setBuilder(_plineBuilder);
}
}
else if (pEnt->isA() == AcDbSpline::desc())
{
AcDbSpline *pSpline = AcDbSpline::cast(pEnt);
if(pSpline)
{
_lengthPointArray++;
setBuilder(_splineBuilder);
}
}
else if (pEnt->isA() == AcDbSpline::desc())
{
AcDbArc *pArc = AcDbArc::cast(pEnt);
if(pArc)
{
_lengthPointArray++;
setBuilder(_arcBuilder);
}
}
else break;
_builder->buildFramePoints(_pointArray[_lengthPointArray-1], pEnt, granularity);
_obArrayId->remove(_obArrayId->first());
pEnt->close();
//pEnt->release();
}
delete _lineBuilder;
return Acad::eOk;
}
void FramePointsConstructor::getFramePoints(AcArray<AcGePoint3d> * _arrayPoints)
{
_builder->getFramePoints(_arrayPoints);
}
void FramePointsConstructor::setBuilder(FramePointsBuilder *b)
{
_builder = b;
} | [
"v.patrinica@4687759a-75b2-d36a-a905-7d4f9b7d90e1"
]
| [
[
[
1,
341
]
]
]
|
bb0fba914f37a9dac32c951224d77963c168187e | 74c8da5b29163992a08a376c7819785998afb588 | /NetAnimal/Game/wheel/NewWheelController/include/AutoEngineDecorator.h | 86d8ec436ce1957cbdd73613dda0ecc864358e9c | []
| no_license | dbabox/aomi | dbfb46c1c9417a8078ec9a516cc9c90fe3773b78 | 4cffc8e59368e82aed997fe0f4dcbd7df626d1d0 | refs/heads/master | 2021-01-13T14:05:10.813348 | 2011-06-07T09:36:41 | 2011-06-07T09:36:41 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,171 | h | #ifndef __Orz_AutoEngineDecorator_h__
#define __Orz_AutoEngineDecorator_h__
#include "WheelControllerConfig.h"
#include "WheelEngineInterface.h"
namespace Orz
{
class _OrzNewWheelControlleExport AutoEngineDecorator:public WheelEngineInterface, public EventHandler//, public KeyListener
{
public:
AutoEngineDecorator(WheelEngineInterfacePtr engine);
~AutoEngineDecorator(void);
private:
///重载,被用于处理消息调用
virtual void doExecute(Event * evt);
///重载,被用于进入消息管理调用
virtual void doEnable(void);
///重载,被用于离开消息管理调用
virtual void doDisable(void);
///重载,被用于更新调用
virtual void doFrame(unsigned int step);
WheelEngineInterfacePtr _engine;
private:
virtual void startGame(size_t time);
virtual void pushRate(void);
virtual void runGame(void);
virtual void findSC(void);
TimeType _currTime;
void sendMsg(const Orz::MsgBuffer & head, const Orz::MsgBuffer & msg);
};
typedef boost::shared_ptr<AutoEngineDecorator> AutoEngineDecoratorPtr;
}
#endif
| [
"[email protected]"
]
| [
[
[
1,
58
]
]
]
|
6cdb6a3d2464abdccfd084202eca869a918675a1 | 2112057af069a78e75adfd244a3f5b224fbab321 | /branches/refactor/src_root/include/common/file/fs.h | 4fe0d677076ed896cb339beea06160f0ea14c7c5 | []
| no_license | blockspacer/ireon | 120bde79e39fb107c961697985a1fe4cb309bd81 | a89fa30b369a0b21661c992da2c4ec1087aac312 | refs/heads/master | 2023-04-15T00:22:02.905112 | 2010-01-07T20:31:07 | 2010-01-07T20:31:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,418 | h | /* Copyright (C) 2005 ireon.org developers council
* portions (C) Radon Labs GmbH, www.nebuladevice.org
* $Id: fs.h 207 2005-11-15 14:07:51Z llyeli $
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
/**
* @file fs.h
* CFile System (or CFile Server :)
*/
#ifndef _CFS_H
#define _CFS_H
class CDirectory;
class IRawFile;
class CFile;
class CFS
{
protected:
friend class CClientApp;
/// constructor
CFS();
// init
static void init();
public:
/// destructor
virtual ~CFS();
/// get instance pointer
static CFS* instance();
/// sets a path alias
bool addAlias(const char* assignName, const char* pathName);
String getAlias(const char* path) const;
String realPath(const char* path) const;
/// makes a path
bool makePath(const char* path) const;
/// copy a file
bool copyFile(const char* from, const char* to);
/// delete a file
bool deleteFile(const char* filename);
/// delete an empty directory
bool deleteDirectory(const char* dirName);
/// compute the Crc checksum for a file
bool checksum(const char* filename, uint& crc);
/// set read only status of a file
void setFileReadOnly(const char* filename, bool readOnly);
/// get read only status of a file
bool isFileReadOnly(const char* filename);
/// creates a new nCFile object
FilePtr newFileObject() const;
/// check if file exists
bool fileExists(const char* pathName) const;
/// check if directory exists
bool directoryExists(const char* pathName) const;
/// reset statistics
void resetStatistics();
/// add read bytes
void addBytesRead(int b);
/// add written bytes
void addBytesWritten(int b);
/// add seek operation to stats
void addSeek();
/// get bytes read since last reset
int getBytesRead() const;
/// get bytes written since last reset
int getBytesWritten() const;
/// get number of seeks
int getNumSeeks() const;
private:
static CFS* m_singleton;
std::map<String, String> m_mapPath;
int m_bytesRead;
int m_bytesWritten;
int m_numSeeks;
};
inline CFS* CFS::instance()
{
if( !m_singleton )
m_singleton = new CFS;
return m_singleton;
}
inline void CFS::resetStatistics()
{
this->m_bytesRead = 0;
this->m_bytesWritten = 0;
this->m_numSeeks = 0;
}
inline void CFS::addBytesRead(int b)
{
this->m_bytesRead += b;
}
inline void CFS::addBytesWritten(int b)
{
this->m_bytesWritten += b;
}
inline void CFS::addSeek()
{
this->m_numSeeks++;
}
inline int CFS::getBytesRead() const
{
return this->m_bytesRead;
}
inline int CFS::getBytesWritten() const
{
return this->m_bytesWritten;
}
inline int CFS::getNumSeeks() const
{
return this->m_numSeeks;
}
#endif
| [
"[email protected]"
]
| [
[
[
1,
146
]
]
]
|
9e794ddc459526ce3bf3166163fa37867ad7f102 | 877bad5999a3eeab5d6d20b5b69a273b730c5fd8 | /TestKhoaLuan/DirectShowTVSample/Chapter-8/DVDPlayer/DVDPlayer.cpp | 2b84d848c3542f9539fdb4d64c8ac483662e6dc6 | []
| no_license | eaglezhao/tracnghiemweb | ebdca23cb820769303d27204156a2999b8381e03 | aaae7bb7b9393a8000d395c1d98dcfc389e3c4ed | refs/heads/master | 2021-01-10T12:26:27.694468 | 2010-10-06T01:15:35 | 2010-10-06T01:15:35 | 45,880,587 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,014 | cpp | // DVDPlayer.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <dshow.h>
int main(int argc, char* argv[])
{
IDvdGraphBuilder *m_pIDvdGB;
IMediaControl * m_pIMC;
IGraphBuilder* m_pGraph;
CoInitialize (NULL);
// Create an instance of the DVD Graph Builder object.
HRESULT hr;
hr = CoCreateInstance(CLSID_DvdGraphBuilder,
NULL,
CLSCTX_INPROC_SERVER,
IID_IDvdGraphBuilder,
(void**)&m_pIDvdGB);
// Build the DVD filter graph.
AM_DVD_RENDERSTATUS buildStatus;
hr = m_pIDvdGB->RenderDvdVideoVolume(NULL, AM_DVD_HWDEC_PREFER , &buildStatus);
// Get a pointer to the filter graph manager.
hr = m_pIDvdGB->GetFiltergraph(&m_pGraph) ;
hr = m_pGraph->QueryInterface(IID_IMediaControl, (void**)&m_pIMC);
m_pIMC->Run ();
MessageBox (NULL, "stop playback", NULL, NULL);
return 0;
}
| [
"[email protected]"
]
| [
[
[
1,
38
]
]
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.