This commit is contained in:
kervala 2011-06-07 16:41:08 +02:00
commit 5d08c164d2
358 changed files with 4945 additions and 1655 deletions

View file

@ -130,6 +130,7 @@ IF(WITH_STATIC)
IF(APPLE)
FIND_PACKAGE(Iconv REQUIRED)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
ENDIF(APPLE)
ENDIF(WITH_STATIC)

View file

@ -52,13 +52,23 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
LIST(APPEND ${_out_compile_flags} " ${_PCH_include_prefix}\"${item}\"")
ENDFOREACH(item)
# Required for CMake 2.6
SET(GLOBAL_DEFINITIONS "")
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS -D${item})
ENDFOREACH(item)
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
GET_DIRECTORY_PROPERTY(_global_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
LIST(APPEND ${_out_compile_flags} ${GLOBAL_DEFINITIONS})
LIST(APPEND ${_out_compile_flags} ${_directory_flags})
LIST(APPEND ${_out_compile_flags} ${_global_definitions})
LIST(APPEND ${_out_compile_flags} ${_directory_definitions})
LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS})
# Format definitions and remove duplicates
SEPARATE_ARGUMENTS(${_out_compile_flags})
LIST(REMOVE_DUPLICATES ${_out_compile_flags})
ENDMACRO(_PCH_GET_COMPILE_FLAGS)
MACRO(_PCH_GET_PDB_FILENAME out_filename _target)
@ -134,7 +144,9 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use )
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags})
SET_TARGET_PROPERTIES(${_targetName}_pch_dephelp PROPERTIES COMPILE_FLAGS ${_target_cflags})
IF(oldProps)
SET_TARGET_PROPERTIES(${_targetName}_pch_dephelp PROPERTIES COMPILE_FLAGS ${oldProps})
ENDIF(oldProps)
ADD_CUSTOM_TARGET(pch_Generate_${_targetName} DEPENDS ${_pch_output_to_use})
ADD_DEPENDENCIES(${_targetName} pch_Generate_${_targetName})
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET)

View file

@ -107,7 +107,7 @@ public:
bool Visible;
/// Precomputed Lighting.
// If true (false by default), then the instance don't cast shadow (used by ig_lighter.exe).
// If true (false by default), then the instance don't cast shadow (used by ig_lighter).
bool DontCastShadow;
// If true (false by default), then the instance's lighting will not be precomputed.
bool AvoidStaticLightPreCompute;
@ -120,7 +120,7 @@ public:
* If 0xFF => take Ambient of the sun.
*/
uint8 LocalAmbientId;
/** if true (false by default), the instance don't cast shadow, but ONLY FOR ig_lighter.exe (ig_lighter_lib)
/** if true (false by default), the instance don't cast shadow, but ONLY FOR ig_lighter (ig_lighter_lib)
* (zone_lighter and zone_ig_lighter ignore it).
* This is a special trick for the "Matis Serre" where the exterior mesh cast shadow in the interior, but
* is not visible in the interior in realTime because of cluster clipping.... omg :(

View file

@ -697,6 +697,7 @@ public:
virtual bool addLinearFloatKey(const UKeyLinearFloat &key)
{
CKeyFloat k;
k.OODeltaTime= 0.f;
k.Value= key.Value;
addKey(k, key.Time);
return true;

View file

@ -142,11 +142,14 @@ namespace CEGUI
void captureCursor(bool capture) {
m_Captured=capture;
if(capture) {
if(capture)
{
m_Driver->setCapture(true);
m_Driver->showCursor(false);
m_InputDriver.activateMouse();
} else {
}
else
{
m_Driver->setCapture(false);
m_Driver->showCursor(true);
m_InputDriver.deactivateMouse();
@ -178,7 +181,8 @@ namespace CEGUI
class NeLInputDriver : public NLMISC::IEventListener
{
public:
NeLInputDriver() {
NeLInputDriver()
{
m_MouseX=0.5f;
m_MouseY=0.5f;
m_Active=false;
@ -189,7 +193,8 @@ namespace CEGUI
}
virtual ~NeLInputDriver() { ; }
void addToServer(NLMISC::CEventServer& server) {
void addToServer(NLMISC::CEventServer& server)
{
server.addListener(NLMISC::EventMouseMoveId, this);
server.addListener(NLMISC::EventMouseDownId, this);
server.addListener(NLMISC::EventMouseUpId, this);
@ -200,7 +205,8 @@ namespace CEGUI
m_AsyncListener.addToServer(server);
}
void removeFromServer(NLMISC::CEventServer& server) {
void removeFromServer(NLMISC::CEventServer& server)
{
server.removeListener(NLMISC::EventMouseMoveId, this);
server.removeListener(NLMISC::EventMouseDownId, this);
server.removeListener(NLMISC::EventMouseUpId, this);
@ -226,9 +232,11 @@ namespace CEGUI
*
* \param event An event, probably a CEventMouse or CEventKey/Char.
*/
virtual void operator ()(const NLMISC::CEvent& event) {
virtual void operator ()(const NLMISC::CEvent& event)
{
// don't process any input if we're inactive.
if(m_Active==false) {
if(m_Active==false)
{
return; // not processing ANY input
}
@ -236,36 +244,51 @@ namespace CEGUI
{
// otherwise, on with the festivities.
// catch ALL mouse event, just in case.
if(event==NLMISC::EventMouseDownId||event==NLMISC::EventMouseUpId||event==NLMISC::EventMouseMoveId||event==NLMISC::EventMouseDblClkId||event==NLMISC::EventMouseWheelId) {
if(!m_MouseActive) {
if(event==NLMISC::EventMouseDownId||event==NLMISC::EventMouseUpId||event==NLMISC::EventMouseMoveId||event==NLMISC::EventMouseDblClkId||event==NLMISC::EventMouseWheelId)
{
if(!m_MouseActive)
{
// we're not processing any mouse activity. The cursor isn't captured maybe?
return;
}
NLMISC::CEventMouse *mouseEvent=(NLMISC::CEventMouse *)&event;
// a mouse button was pressed.
if(event == NLMISC::EventMouseDownId) {
if(event == NLMISC::EventMouseDownId)
{
// it was the left button...
if (mouseEvent->Button & NLMISC::leftButton) {
if (mouseEvent->Button & NLMISC::leftButton)
{
CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);
// it was the right button...
} else if (mouseEvent->Button & NLMISC::rightButton) {
}
else if (mouseEvent->Button & NLMISC::rightButton)
{
CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);
} else if (mouseEvent->Button & NLMISC::middleButton) {
}
else if (mouseEvent->Button & NLMISC::middleButton)
{
CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);
}
// a mouse button was released
} else if (event == NLMISC::EventMouseUpId) {
}
else if (event == NLMISC::EventMouseUpId)
{
// it was the left button...
if(mouseEvent->Button & NLMISC::leftButton) {
if(mouseEvent->Button & NLMISC::leftButton)
{
CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);
// it was the right button...
} else if (mouseEvent->Button & NLMISC::rightButton) {
}
else if (mouseEvent->Button & NLMISC::rightButton)
{
CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);
} else if (mouseEvent->Button & NLMISC::middleButton) {
CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);
}
} else if (event == NLMISC::EventMouseMoveId) {
}
else if (event == NLMISC::EventMouseMoveId)
{
// convert into screen coordinates.
float delta_x=(float)(mouseEvent->X - m_MouseX)*m_Width;
float delta_y=(float)((1.0f-mouseEvent->Y) - m_MouseY)*m_Height;
@ -276,18 +299,26 @@ namespace CEGUI
// and save for delta.
m_MouseX=mouseEvent->X;
m_MouseY=1.0f-mouseEvent->Y;
} else if (event == NLMISC::EventMouseWheelId) {
}
else if (event == NLMISC::EventMouseWheelId)
{
NLMISC::CEventMouseWheel *ev=(NLMISC::CEventMouseWheel *)&event;
float dir=0.0f;
if(ev->Direction) dir=0.5f;
else dir=-0.5f;
CEGUI::System::getSingleton().injectMouseWheelChange(dir);
}
} else { // assume otherwise that it's a character.
if(event==NLMISC::EventCharId) {
}
else
{
// assume otherwise that it's a character.
if(event==NLMISC::EventCharId)
{
unsigned char c = (char)((NLMISC::CEventChar&)event).Char;
CEGUI::System::getSingleton().injectChar((CEGUI::utf32)c);
} else if(event==NLMISC::EventKeyDownId) {
}
else if(event==NLMISC::EventKeyDownId)
{
NLMISC::CEventKeyDown *keyvent=(NLMISC::CEventKeyDown *)&event;
CEGUI::System::getSingleton().injectKeyDown(m_KeyMap[keyvent->Key]);
}
@ -296,7 +327,8 @@ namespace CEGUI
catch (CEGUI::Exception) { }
}
void initKeyMap() {
void initKeyMap()
{
m_KeyMap[NLMISC::Key0 ]=CEGUI::Key::Zero;
m_KeyMap[NLMISC::Key1 ]=CEGUI::Key::One;
m_KeyMap[NLMISC::Key2 ]=CEGUI::Key::Two;

View file

@ -201,7 +201,7 @@ void loadForm (const std::vector<std::string> &sheetFilters, const std::string &
ifile.serialCont (container);
ifile.close ();
}
catch (NLMISC::Exception &e)
catch (const NLMISC::Exception &e)
{
// clear the container because it can contains partially loaded sheet so we must clean it before continue
container.clear ();
@ -456,7 +456,7 @@ void loadForm (const std::vector<std::string> &sheetFilters, const std::string &
ofile.close ();
}
}
catch (NLMISC::Exception &e)
catch (const NLMISC::Exception &e)
{
nlinfo ("loadForm(): Exception during saving the packed file, it will be recreated next launch (%s)", e.what());
}
@ -564,7 +564,7 @@ void loadForm2(const std::vector<std::string> &sheetFilters, const std::string &
ifile.serialPtrCont (container);
ifile.close ();
}
catch (NLMISC::Exception &e)
catch (const NLMISC::Exception &e)
{
// clear the container because it can contains partially loaded sheet so we must clean it before continue
container.clear ();
@ -819,7 +819,7 @@ void loadForm2(const std::vector<std::string> &sheetFilters, const std::string &
ofile.close ();
}
}
catch (NLMISC::Exception &e)
catch (const NLMISC::Exception &e)
{
nlinfo ("loadForm(): Exception during saving the packed file, it will be recreated next launch (%s)", e.what());
}
@ -925,7 +925,7 @@ void loadForm (const std::vector<std::string> &sheetFilters, const std::string &
ifile.serialCont (container);
ifile.close ();
}
catch (NLMISC::Exception &e)
catch (const NLMISC::Exception &e)
{
// clear the container because it can contains partially loaded sheet so we must clean it before continue
container.clear ();
@ -1183,7 +1183,7 @@ void loadForm (const std::vector<std::string> &sheetFilters, const std::string &
ofile.close ();
}
}
catch (NLMISC::Exception &e)
catch (const NLMISC::Exception &e)
{
nlinfo ("loadForm(): Exception during saving the packed file, it will be recreated next launch (%s)", e.what());
}

View file

@ -261,7 +261,7 @@ inline bool loadXmlPrimitiveFile(CPrimitives &primDoc, const std::string &fileNa
// Read it
return primDoc.read (xmlIn.getRootNode (), NLMISC::CFile::getFilename(fileName).c_str(), ligoConfig);
}
catch(NLMISC::Exception e)
catch(const NLMISC::Exception &e)
{
nlwarning("Error reading input file '%s': '%s'", fileName.c_str(), e.what());
return false;
@ -294,7 +294,7 @@ inline bool saveXmlPrimitiveFile(CPrimitives &primDoc, const std::string &fileNa
// return xmlSaveFile(fileName.c_str(), xmlDoc) != -1;
}
catch(NLMISC::Exception e)
catch(const NLMISC::Exception &e)
{
nlwarning("Error writing output file '%s': '%s'", fileName.c_str(), e.what());
return false;

View file

@ -63,7 +63,7 @@ namespace NLMISC
* printf ("%d ", bar.asInt (i));
* printf("\n");
* }
* catch (EConfigFile &e)
* catch (const EConfigFile &e)
* {
* // Something goes wrong... catch that
* printf ("%s\n", e.what ());

View file

@ -238,11 +238,11 @@ namespace STRING_MANAGER
return false;
}
bool findCol(ucstring colName, uint &colIndex)
bool findCol(const ucstring &colName, uint &colIndex)
{
if (Data.empty())
return false;
TWorksheet::TRow::iterator it = std::find(Data[0].begin(), Data[0].end(), ucstring(colName));
TWorksheet::TRow::iterator it = std::find(Data[0].begin(), Data[0].end(), colName);
if (it == Data[0].end())
return false;

View file

@ -71,7 +71,7 @@ struct EXmlParsingError : public EStream
// File not found
}
}
catch (Exception &e)
catch (const Exception &e)
{
// Something wrong appends
}

View file

@ -64,7 +64,7 @@ namespace NLMISC {
// Close the file
file.close ();
}
catch (Exception &e)
catch (const Exception &e)
{
}
\endcode

View file

@ -524,7 +524,7 @@ namespace NLNET
// run the module task command control to module task method
(_Module->*_TaskMethod)();
}
catch (NLMISC::Exception e)
catch (const NLMISC::Exception &e)
{
nlwarning("In module task '%s', exception '%e' thrown", typeid(this).name(), e.what());
}

View file

@ -94,7 +94,7 @@ CInstanceGroup* LoadInstanceGroup(const char* sFilename)
newIG->serial (file);
// All is good
}
catch (Exception &)
catch (const Exception &)
{
// Cannot save the file
delete newIG;

View file

@ -116,7 +116,7 @@ int main (int /* argc */, char ** /* argv */)
int val = cf.getVar ("unknown_variable").asInt();
nlinfo("unknown_variable = %d", val);
}
catch (EConfigFile &e)
catch (const EConfigFile &e)
{
nlinfo("something goes wrong with configfile: %s", e.what());
}

View file

@ -63,7 +63,7 @@ int main (int /* argc */, char ** /* argv */)
{
nlerror ("nlerror() %d", 4);
}
catch(EFatalError &)
catch(const EFatalError &)
{
// just continue...
nlinfo ("nlerror() generated an EFatalError exception, just ignore it");

View file

@ -109,7 +109,7 @@ int main (int argc, char **argv)
CInetAddress addr(LSHost+":3333");
Client->connect(addr);
}
catch(ESocket &e)
catch(const ESocket &e)
{
printf("%s\n", e.what());
return 0;

View file

@ -101,7 +101,7 @@ public:
{
fsPort = IService::ConfigFile.getVar("FSPort").asInt();
}
catch ( EUnknownVar& )
catch (const EUnknownVar&)
{
}
_FServer.init(fsPort);
@ -148,7 +148,7 @@ public:
{
fesPort = IService5::ConfigFile.getVar("FESPort").asInt();
}
catch ( EUnknownVar& )
catch (const EUnknownVar&)
{
}

View file

@ -190,7 +190,7 @@ void cbInit (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
return;
}
}
catch (Exception &)
catch (const Exception &)
{
// bad client version, disconnect it
CallbackServer->disconnect (from);
@ -530,7 +530,7 @@ void handleReceivedPong (CClient *client, sint64 pongTime)
// init the UDP connection
if (client == NULL)
{
uint32 session;
uint32 session = 0;
msgin.serial (session);
// Find a new udp connection, find the linked
@ -568,13 +568,13 @@ void handleReceivedPong (CClient *client, sint64 pongTime)
}
// Read the message
sint64 pingTime;
sint64 pingTime = 0;
msgin.serial(pingTime);
uint32 pongNumber;
uint32 pongNumber = 0;
msgin.serial(pongNumber);
uint32 blockNumber;
uint32 blockNumber = 0;
msgin.serial(blockNumber);
// nlinfo ("receive a pong from %s pongnb %d %"NL_I64"d", CurrentInMsg->AddrFrom.asString().c_str(), pongNumber, pongTime - pingTime);
@ -611,7 +611,7 @@ void sendPing ()
// send the new ping to the client
ReceiveTask->DataSock->sendTo (msgout.buffer(), size, GETCLIENTA(it)->Address);
}
catch (Exception &e)
catch (const Exception &e)
{
nlwarning ("Can't send UDP packet to '%s' (%s)", GETCLIENTA(it)->Address.asString().c_str(), e.what());
}
@ -734,7 +734,7 @@ public:
updateStat ();
}
}
catch (Exception &e)
catch (const Exception &e)
{
nlerrornoex ("Exception not catched: '%s'", e.what());
}

View file

@ -232,7 +232,7 @@ void cbInit (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
{
UdpSock->connect( CInetAddress (ServerAddr, UDPPort) );
}
catch ( Exception& e )
catch (const Exception &e)
{
InfoLog->displayRawNL ("Cannot connect to remote UDP host '%s': %s", ServerAddr.c_str(), e.what() );
exit ("");
@ -291,7 +291,7 @@ int main( int argc, char **argv )
InfoLog->displayRawNL ("Waiting the server answer...");
}
catch(Exception &e)
catch(const Exception &e)
{
InfoLog->displayRawNL ("Can't connect to %s:%d (%s)\n", ServerAddr.c_str(), TCPPort, e.what());
exit ("");

View file

@ -108,7 +108,7 @@ void CReceiveTask::run()
DataSock->receivedFrom( _ReceivedMessage.userDataW(), _DatagramLength, _ReceivedMessage.AddrFrom );
d = CTime::getLocalTime ();
}
catch ( ESocket& )
catch (const ESocket&)
{
// Remove the client corresponding to the address
_ReceivedMessage.setTypeEvent( TReceivedMessage::RemoveClient );

View file

@ -371,7 +371,7 @@ int main ()
// Remove mouse listener
pDriver->delete3dMouseListener (plistener);
}
catch (Exception& e)
catch (const Exception& e)
{
#ifdef NL_OS_WINDOWS
::MessageBox (NULL, e.what(), "Test collision move", MB_OK|MB_ICONEXCLAMATION);

View file

@ -85,7 +85,7 @@ void Init()
AudioMixer->getListener()->setOrientation( frontvec, upvec );
}
catch( Exception& e )
catch(const Exception &e)
{
nlerror( "Error: %s", e.what() );
}

View file

@ -227,7 +227,7 @@ bool CAnimationSet::loadFromFiles(const std::string &path, bool recurse /* = tru
iFile.close();
}
catch (NLMISC::EStream &e)
catch (const NLMISC::EStream &e)
{
if (wantWarningMessage)
{

View file

@ -338,7 +338,7 @@ void CAsyncFileManager3D::CMeshLoad::run()
// Finally affect the pointer (Trans-Thread operation -> this operation must be atomic)
*_ppShp = mesh.getShapePointer();
}
catch(EPathNotFound &)
catch(const EPathNotFound &)
{
nlwarning ("Couldn't load '%s'", MeshName.c_str());
*_ppShp = (IShape*)-1;
@ -382,7 +382,7 @@ void CAsyncFileManager3D::CIGLoad::run (void)
*_ppIG = pIG;
}
catch(EPathNotFound &)
catch(const EPathNotFound &)
{
nlwarning ("Couldn't load '%s'", _IGName.c_str());
*_ppIG = (CInstanceGroup*)-1;
@ -429,7 +429,7 @@ void CAsyncFileManager3D::CIGLoadUser::run (void)
return;
}
}
catch(EPathNotFound &)
catch(const EPathNotFound &)
{
nlwarning ("Couldn't load '%s'", _IGName.c_str());
delete pIG;

View file

@ -1600,7 +1600,7 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
_EventEmitter.addEmitter(diee, true);
}
}
catch(EDirectInput &e)
catch(const EDirectInput &e)
{
nlinfo(e.what());
}

View file

@ -485,7 +485,7 @@ NLMISC::IMouseDevice* CDriverD3D::enableLowLevelMouse(bool enable, bool exclusiv
if (diee)
res = diee->getMouseDevice(exclusive);
}
catch (EDirectInput &)
catch (const EDirectInput &)
{
}
}
@ -517,7 +517,7 @@ NLMISC::IKeyboardDevice* CDriverD3D::enableLowLevelKeyboard(bool enable)
if (diee)
res = diee->getKeyboardDevice();
}
catch (EDirectInput &)
catch (const EDirectInput &)
{
}
}
@ -561,7 +561,7 @@ uint CDriverD3D::getDoubleClickDelay(bool hardwareMouse)
{
md = diee->getMouseDevice(hardwareMouse);
}
catch (EDirectInput &)
catch (const EDirectInput &)
{
// could not get device ..
}

View file

@ -684,7 +684,7 @@ NLMISC::IMouseDevice* CDriverGL::enableLowLevelMouse(bool enable, bool exclusive
if (diee)
res = diee->getMouseDevice(exclusive);
}
catch (EDirectInput &)
catch (const EDirectInput &)
{
}
}
@ -722,7 +722,7 @@ NLMISC::IKeyboardDevice* CDriverGL::enableLowLevelKeyboard(bool enable)
if (diee)
res = diee->getKeyboardDevice();
}
catch (EDirectInput &)
catch (const EDirectInput &)
{
}
}
@ -778,7 +778,7 @@ uint CDriverGL::getDoubleClickDelay(bool hardwareMouse)
{
md = diee->getMouseDevice(hardwareMouse);
}
catch (EDirectInput &)
catch (const EDirectInput &)
{
// could not get device ..
}

View file

@ -819,7 +819,7 @@ void CDriverGL::setupLightMapPass(uint pass)
// fallBack if extension MulAdd not found. just mul factor with (Ambient+Diffuse)
if(_LightMapNoMulAddFallBack)
{
// do not use consant color to blend lightmap, but incoming diffuse color, for stage0 only.
// do not use constant color to blend lightmap, but incoming diffuse color, for stage0 only.
GLfloat glcol[4];
convColor(lmapFactor, glcol);
_DriverGLStates.setEmissive(lmapFactor.getPacked(), glcol);
@ -2191,7 +2191,7 @@ static const float IdentityTexMat[4] = { 1.f, 0.f, 0.f, 1.f };
// ***************************************************************************
void CDriverGL::setupWaterPassNV20(const CMaterial &mat)
{
H_AUTO_OGL(CDriverGL_setupWaterPassNV20)
H_AUTO_OGL(CDriverGL_setupWaterPassNV20);
#ifndef USE_OPENGLES
static bool setupDone = false;

View file

@ -201,7 +201,7 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex)
break;
#endif
default:
nlwarning("Framebuffer incomplete\n");
nlwarning("Framebuffer incomplete status %d", (sint)status);
//nlassert(0);
}
@ -505,7 +505,7 @@ static inline GLenum translateMinFilterToGl(CTextureDrvInfosGL *glText)
// ***************************************************************************
static inline bool sameDXTCFormat(ITexture &tex, GLint glfmt)
{
H_AUTO_OGL(sameDXTCFormat)
H_AUTO_OGL(sameDXTCFormat);
if(glfmt==GL_COMPRESSED_RGB_S3TC_DXT1_EXT && tex.PixelFormat==CBitmap::DXTC1)
return true;
if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT1_EXT && tex.PixelFormat==CBitmap::DXTC1Alpha)
@ -521,7 +521,7 @@ static inline bool sameDXTCFormat(ITexture &tex, GLint glfmt)
// ***************************************************************************
static inline bool isDXTCFormat(GLint glfmt)
{
H_AUTO_OGL(isDXTCFormat)
H_AUTO_OGL(isDXTCFormat);
if(glfmt==GL_COMPRESSED_RGB_S3TC_DXT1_EXT)
return true;
if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)

View file

@ -309,7 +309,7 @@ static uint convInputRegisterToVBFlag(uint index)
// For debugging with swizzling
static void doSwizzle(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW)
{
H_AUTO_OGL(doSwizzle)
H_AUTO_OGL(doSwizzle);
nglSwizzleEXT(res, in, outX, outY, outZ, outW);
#ifdef DEBUG_SETUP_EXT_VERTEX_SHADER
std::string swzStr = "Swizzle : ";
@ -359,7 +359,7 @@ static void doSwizzle(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum ou
// Perform write mask and output de bug information
static void doWriteMask(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW)
{
H_AUTO_OGL(doWriteMask)
H_AUTO_OGL(doWriteMask);
nglWriteMaskEXT(res, in, outX, outY, outZ, outW);
#ifdef DEBUG_SETUP_EXT_VERTEX_SHADER
nlinfo("3D: Write Mask : %c%c%c%c",
@ -376,7 +376,7 @@ static void doWriteMask(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum
*/
bool CDriverGL::setupEXTVertexShader(const CVPParser::TProgram &program, GLuint id, uint variants[EVSNumVariants], uint16 &usedInputRegisters)
{
H_AUTO_OGL(CDriverGL_setupEXTVertexShader)
H_AUTO_OGL(CDriverGL_setupEXTVertexShader);
// counter to see what is generated
uint numOp = 0;
uint numOpIndex = 0;
@ -1440,6 +1440,14 @@ bool CDriverGL::setupARBVertexProgram (const CVPParser::TProgram &inParsedProgra
nlassert(0);
return false;
}
#ifdef NL_OS_MAC
// Wait for GPU to finish program upload, else draw comands might crash.
// Happened to CVegetableBlendLayerModel (glDrawElements()).
// For more information, see http://dev.ryzom.com/issues/1006
glFinish();
#endif
return true;
}

View file

@ -374,18 +374,25 @@ bool CDriverGL::init (uint windowIcon, emptyProc exitFunc)
}
#endif // HAVE_XRENDER
// list all supported extensions
sint nextensions = 0;
char **extensions = XListExtensions(_dpy, &nextensions);
nldebug("3D: Available X Extensions:");
std::string exts;
if (DebugLog)
{
// list all supported extensions
sint nextensions = 0;
char **extensions = XListExtensions(_dpy, &nextensions);
for(sint i = 0; i < nextensions; ++i)
exts += NLMISC::toString(" %s", extensions[i]);
for(sint i = 0; i < nextensions; ++i)
{
if(i%5==0) DebugLog->displayRaw("3D: ");
DebugLog->displayRaw(NLMISC::toString("%s ", extensions[i]).c_str());
if(i%5==4) DebugLog->displayRaw("\n");
}
XFreeExtensionList(extensions);
DebugLog->displayRaw("\n");
nlinfo("X Extensions:%s", exts.c_str());
XFreeExtensionList(extensions);
}
// set default X errors handler
XSetErrorHandler(nelXErrorsHandler);
@ -906,7 +913,6 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
_hRC=wglCreateContext(_hDC);
wglMakeCurrent(_hDC,_hRC);
}
/// release old emitter
@ -929,7 +935,7 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
_EventEmitter.addEmitter(diee, true);
}
}
catch(EDirectInput &e)
catch(const EDirectInput &e)
{
nlinfo(e.what());
}
@ -1577,7 +1583,7 @@ bool CDriverGL::destroyWindow()
#elif defined(NL_OS_MAC)
if(_DestroyWindow)
if (_DestroyWindow)
{
[[containerView() window] release];
[containerView() release];
@ -2297,7 +2303,7 @@ emptyProc CDriverGL::getWindowProc()
// --------------------------------------------------
bool CDriverGL::activate()
{
H_AUTO_OGL(CDriverGL_activate)
H_AUTO_OGL(CDriverGL_activate);
if (_win == EmptyWindow)
return false;

View file

@ -359,7 +359,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
// push the key press event to the event server
server->postEvent(new NLMISC::CEventKeyDown(
virtualKeycodeToNelKey([event keyCode]),
modifierFlagsToNelKeyButton([event modifierFlags]),
modifiers,
[event isARepeat] == NO, this));
// if this was a text event
@ -372,7 +372,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
// push the text event to event server as well
server->postEvent(new NLMISC::CEventChar(
ucstr[0], NLMISC::noKeyButton, this));
ucstr[0], modifiers, this));
}
break;
}
@ -381,7 +381,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
// push the key release event to the event server
server->postEvent(new NLMISC::CEventKeyUp(
virtualKeycodeToNelKey([event keyCode]),
modifierFlagsToNelKeyButton([event modifierFlags]), this));
modifiers, this));
break;
}
case NSFlagsChanged:break;

View file

@ -1746,7 +1746,7 @@ void CDriverUser::loadHLSBank(const std::string &fileName)
throw EPathNotFound(path);
fIn.serial(*hlsBank);
}
catch(Exception &)
catch(const Exception &)
{
delete hlsBank;
throw;

View file

@ -121,7 +121,7 @@ bool CInstanceGroupUser::init (const std::string &instanceGroup, bool async)
// Read the class
_InstanceGroup.serial (file);
}
catch (EStream& e)
catch (const EStream& e)
{
// Avoid visual warning
EStream ee=e;

View file

@ -283,7 +283,7 @@ void CLandscapeUser::refreshZonesAround(const CVector &pos, float radius, std::s
{
_Landscape->Landscape.checkBinds(Work.Zone->getZoneId());
}
catch (EBadBind &e)
catch (const EBadBind &e)
{
nlwarning ("Bind error : %s", e.what());
nlstopex(("Zone Data Bind Error. Please send a report. You may continue but it should crash!"));

View file

@ -1291,7 +1291,7 @@ bool CPSConstraintMesh::update(std::vector<sint> *numVertsVect /*= NULL*/)
{
_ModelBank->load(_MeshShapeFileName[k]);
}
catch (NLMISC::EPathNotFound &)
catch (const NLMISC::EPathNotFound &)
{
nlwarning("mesh not found : %s; used as a constraint mesh particle", _MeshShapeFileName[k].c_str());
// shape not found, so not present in the shape bank -> we create a dummy shape

View file

@ -93,7 +93,7 @@ bool CShader::loadShaderFile (const char *filename)
nlwarning ("Can't open the file %s for reading", _filename.c_str());
}
}
catch (Exception &e)
catch (const Exception &e)
{
nlwarning ("Error while reading %s : %s", _filename.c_str(), e.what());
}

View file

@ -50,12 +50,12 @@ static inline void GetTextureSize(ITexture *tex, uint &width, uint &height)
width = srcWidth;
height = srcHeight;
}
catch (NLMISC::EPathNotFound &e)
catch (const NLMISC::EPathNotFound &e)
{
nlinfo("%s", e.what());
width = height = 0;
}
catch (NLMISC::EStream &e)
catch (const NLMISC::EStream &e)
{
nlinfo("unable to load size from a bitmap ! name = %s", tf->getFileName().c_str());
nlinfo("reason = %s", e.what());

View file

@ -1573,7 +1573,7 @@ void CTileSet::loadTileVegetableDesc()
// load the TileVegetableDesc
f.serial(_TileVegetableDesc);
}
catch(Exception &e)
catch(const Exception &e)
{
nlinfo("Error loading TileVegetableDesc: %s", e.what());
}

View file

@ -816,7 +816,7 @@ CVegetableShape *CVegetableManager::getVegetableShape(const std::string &shap
ret = NULL;
}
}
catch (Exception &e)
catch (const Exception &e)
{
// Warning
nlwarning ("CVegetableManager::getVegetableShape error while loading shape file '%s' : '%s'", shape.c_str (), e.what ());

View file

@ -844,7 +844,7 @@ void SaveZBuffer (CZoneLighter::CZBuffer &zbuffer, const char *filename)
// Save it
bitmap.writeJPG (outputZFile, 128);
}
catch (Exception& except)
catch (const Exception& except)
{
// Error message
nlwarning ("ERROR writing %s: %s\n", filename, except.what());
@ -3080,13 +3080,13 @@ void CZoneLighter::lightWater(CWaterShape &ws, const CMatrix &MT, const CLightDe
diffuseTex->writeTGA(of, 24);
of.close();
}
catch (NLMISC::Exception &)
catch (const NLMISC::Exception &)
{
nlwarning("Zone lighter : while lighting a water shape, writing %s failed! ", texFileName.c_str());
}
}
}
catch(NLMISC::Exception &e)
catch(const NLMISC::Exception &e)
{
nlwarning("Water shape lighting failed !");
nlwarning(e.what());

View file

@ -105,7 +105,7 @@ CType *CFormLoader::loadType (const char *filename)
type = NULL;
}
}
catch (Exception &e)
catch (const Exception &e)
{
// Output error
warning (false, "loadType", "Error while loading the form (%s): %s", filename, e.what());
@ -179,7 +179,7 @@ CFormDfn *CFormLoader::loadFormDfn (const char *filename, bool forceLoad)
_MapFormDfn.erase (lowerStr);
}
}
catch (Exception &e)
catch (const Exception &e)
{
// Output error
warning (false, "loadFormDfn", "Error while loading the form (%s): %s", filename, e.what());
@ -276,7 +276,7 @@ UForm *CFormLoader::loadForm (const char *filename)
_MapForm.erase (lowerStr);
}
}
catch (Exception &e)
catch (const Exception &e)
{
// Output error
warning (false, "loadForm", "Error while loading the form (%s): %s", filename, e.what());

View file

@ -220,7 +220,7 @@ bool CLigoConfig::readPrimitiveClass (const char *_fileName, bool parsePrimitive
syntaxError (filename.c_str(), root, "Wrong root node, should be NEL_LIGO_PRIMITIVE_CLASS");
}
}
catch (Exception &e)
catch (const Exception &e)
{
errorMessage ("File read error (%s):%s", filename.c_str(), e.what ());
}

View file

@ -146,7 +146,7 @@ void CZoneBank::debugSaveInit (CZoneBankElement &zbeTmp, const string &fileName)
output.init (&fileOut);
zbeTmp.serial (output);
}
catch (Exception& /*e*/)
catch (const Exception& /*e*/)
{
}
@ -541,7 +541,7 @@ bool CZoneBank::addElement (const std::string &elementName, std::string &error)
error = "Can't open file " + elementName;
}
}
catch (Exception& e)
catch (const Exception& e)
{
error = "Error while loading ligozone "+elementName+" : "+e.what();
}

View file

@ -188,7 +188,7 @@ bool ICommand::execute (const std::string &commandWithArgs, CLog &log, bool quie
{
return CCommandRegistry::getInstance().execute(commandWithArgs, log, quiet, human);
}
catch(exception e)
catch(const exception &e)
{
log.displayNL("Command '%s' thrown an exception :", commandWithArgs.c_str());
log.displayNL(e.what());

View file

@ -27,7 +27,10 @@ using namespace NLMISC;
#define YY_NEVER_INTERACTIVE 1
#ifdef WIN32
#define YY_NO_UNISTD_H 1
#include <io.h>
#define read _read
#define isatty _isatty
#endif
/* Types */
@ -122,6 +125,12 @@ string \"[^\"\n]*\"
if (!cf_Ignore)
{
cflval.Val.Type = T_STRING;
if (strlen(yytext+1) >= sizeof(cflval.Val.String))
{
strcpy (cflval.Val.String, "");
DEBUG_PRINTF("lex: string '%s' exceeds max length\n", yytext);
return STRING;
}
strcpy (cflval.Val.String, yytext+1);
cflval.Val.String[strlen(cflval.Val.String)-1] = '\0';
DEBUG_PRINTF("lex: string '%s' '%s'\n", yytext, cflval.Val.String);
@ -133,6 +142,12 @@ string \"[^\"\n]*\"
if (!cf_Ignore)
{
cflval.Val.Type = T_STRING;
if (strlen(yytext+1) >= sizeof(cflval.Val.String))
{
strcpy (cflval.Val.String, "");
DEBUG_PRINTF("lex: string '%s' exceeds max length\n", yytext);
return VARIABLE;
}
strcpy (cflval.Val.String, yytext);
DEBUG_PRINTF("lex: variable '%s' '%s'\n", yytext, cflval.Val.String);
return VARIABLE;

View file

@ -832,7 +832,7 @@ void CConfigFile::checkConfigFiles ()
{
(*it)->reparse ();
}
catch (EConfigFile &e)
catch (const EConfigFile &e)
{
nlwarning ("CF: Exception will re-read modified config file '%s': %s", (*it)->getFilename().c_str(), e.what ());
}

View file

@ -1016,7 +1016,7 @@ void getCallStack(std::string &result, sint skipNFirst)
array[0] = skipNFirst;
RaiseException (0xACE0ACE, 0, 1, array);
}
catch (EDebug &e)
catch (const EDebug &e)
{
result += e.what();
}
@ -1051,7 +1051,7 @@ void getCallStackAndLog (string &result, sint /* skipNFirst */)
// array[0] = skipNFirst;
// RaiseException (0xACE0ACE, 0, 1, array);
// }
// catch (EDebug &e)
// catch (const EDebug &e)
// {
// result += e.what();
// }

View file

@ -84,7 +84,7 @@ bool loadStringFile(const std::string filename, vector<TStringInfo> &stringInfos
buffer = new uint8[size];
fp.serialBuffer(buffer, size);
}
catch(Exception &e)
catch(const Exception &e)
{
nlinfo("Can't open file [%s] (%s)\n", filename.c_str(), e.what());
return true;

View file

@ -120,7 +120,7 @@ void IDisplayer::display ( const CLog::TDisplayInfo& args, const char *message )
{
doDisplay( args, message );
}
catch (Exception &)
catch (const Exception &)
{
// silence
}

View file

@ -365,7 +365,7 @@ void CIFile::getline (char *buffer, uint32 bufferSize)
// read one byte
serialBuffer ((uint8 *)buffer, 1);
}
catch (EFile &)
catch (const EFile &)
{
*buffer = '\0';
return;

View file

@ -419,7 +419,7 @@ namespace NLMISC
}
}
}
catch(EStream &)
catch(const EStream &)
{
nlwarning("CInterWindowMsgQueue : Bad message format in inter window communication");
}

View file

@ -66,15 +66,20 @@ namespace NLMISC {
vector<string> splitted;
explode(string(buffer), string("\n"), splitted, true);
std::string value;
for(uint32 i = 0; i < splitted.size(); i++)
{
vector<string> sline;
explode(splitted[i], string(":"), sline, true);
if(sline.size() == 2 && trim(sline[0]) == colname)
{
return trim(sline[1]);
value = sline[1];
}
}
if (!value.empty())
return trim(value);
}
nlwarning ("SI: Can't find the colname '%s' in /proc/cpuinfo", colname.c_str());
return "";
@ -549,7 +554,7 @@ string CSystemInfo::getOS()
{
OSString += " Professional";
}
else
else
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
OSString += " Datacenter Server";
@ -805,6 +810,9 @@ string CSystemInfo::getProc ()
#elif defined NL_OS_UNIX
uint processors = 0;
if (fromString(getCpuInfo("processor"), processors)) ++processors;
ProcString = getCpuInfo("model name");
ProcString += " / ?";
ProcString += " Family " + getCpuInfo("cpu family");
@ -815,7 +823,7 @@ string CSystemInfo::getProc ()
ProcString += " / ";
ProcString += getCpuInfo("cpu MHz")+"MHz";
ProcString += " / ";
ProcString += "? Processors found";
ProcString += toString("%u Processors found", processors);
#endif

View file

@ -55,7 +55,7 @@ bool CWordsDictionary::init( const string& configFileName )
cf.load( configFileName );
cfFound = true;
}
catch ( EConfigFile& e )
catch (const EConfigFile &e)
{
nlwarning( "WD: %s", e.what() );
}

View file

@ -451,7 +451,7 @@ void CClientReceiveTask::run()
NbLoop++;
}
catch ( ESocket& )
catch (const ESocket&)
{
LNETL1_DEBUG( "LNETL1: Client connection %s broken", sockId()->asString().c_str() );
sockId()->Sock->disconnect();

View file

@ -829,7 +829,7 @@ void CListenTask::run()
NbLoop++;
}
catch ( ESocket& e )
catch (const ESocket &e)
{
LNETL1_INFO( "LNETL1: Exception in listen thread: %s", e.what() );
// It can occur when too many sockets are open (e.g. 885 connections)
@ -1131,12 +1131,12 @@ void CServerReceiveTask::run()
*/
}
}
// catch ( ESocketConnectionClosed& )
// catch (const ESocketConnectionClosed&)
// {
// LNETL1_DEBUG( "LNETL1: Connection %s closed", serverbufsock->asString().c_str() );
// // The socket went to _Connected=false when throwing the exception
// }
catch ( ESocket& )
catch (const ESocket&)
{
LNETL1_DEBUG( "LNETL1: Connection %s broken", serverbufsock->asString().c_str() );
(*ic)->Sock->disconnect();

View file

@ -280,7 +280,7 @@ void CCallbackClient::connect( const CInetAddress& addr )
_MR_Recorder.recordNext( _MR_UpdateCounter, Connecting, _BufSock, addrmsg );
}
}
catch ( ESocketConnectionFailed& )
catch (const ESocketConnectionFailed&)
{
if ( _MR_RecordingState == Record )
{

View file

@ -155,7 +155,7 @@ void CCallbackNetBase::processOneMessage ()
{
receive (msgin, &tsid);
}
catch (Exception &e)
catch (const Exception &e)
{
nlwarning(e.what());
return;

View file

@ -330,7 +330,7 @@ bool sendEmail (const string &smtpServer, const string &from, const string &to,
ok = true;
}
}
catch (Exception &e)
catch (const Exception &e)
{
nlwarning ("EMAIL: Can't send email: %s", e.what());
goto end;

View file

@ -146,7 +146,7 @@ string CLoginClient::authenticateBegin(const string &loginServiceAddr, const ucs
_LSCallbackClient->disconnect();
_LSCallbackClient->connect (CInetAddress(addr));
}
catch (ESocket &e)
catch (const ESocket &e)
{
delete _LSCallbackClient;
_LSCallbackClient = 0;
@ -226,7 +226,7 @@ string CLoginClient::connectToShard(CLoginCookie &lc, const std::string &addr, C
// have we received the answer?
if (!ShardValidate) return "FES disconnect me";
}
catch (ESocket &e)
catch (const ESocket &e)
{
return string("FES refused the connection (") + e.what () + ")";
}
@ -250,7 +250,7 @@ string CLoginClient::connectToShard (const std::string &addr, CUdpSock &cnx)
//
cnx.connect (CInetAddress(addr));
}
catch (ESocket &e)
catch (const ESocket &e)
{
return string("FES refused the connection (") + e.what () + ")";
}
@ -272,7 +272,7 @@ string CLoginClient::connectToShard (const std::string &addr, CUdpSimSock &cnx)
//
cnx.connect (CInetAddress(addr));
}
catch (ESocket &e)
catch (const ESocket &e)
{
return string("FES refused the connection (") + e.what () + ")";
}

View file

@ -349,17 +349,17 @@ void CLoginServer::init (const string &listenAddress)
try {
cfcbDefaultUserPriv(IService::getInstance()->ConfigFile.getVar("DefaultUserPriv"));
IService::getInstance()->ConfigFile.setCallback("DefaultUserPriv", cfcbDefaultUserPriv);
} catch(Exception &) { }
} catch(const Exception &) { }
try {
cfcbAcceptInvalidCookie (IService::getInstance()->ConfigFile.getVar("AcceptInvalidCookie"));
IService::getInstance()->ConfigFile.setCallback("AcceptInvalidCookie", cfcbAcceptInvalidCookie);
} catch(Exception &) { }
} catch(const Exception &) { }
try {
cfcbTimeBeforeEraseCookie (IService::getInstance()->ConfigFile.getVar("TimeBeforeEraseCookie"));
IService::getInstance()->ConfigFile.setCallback("TimeBeforeEraseCookie", cfcbTimeBeforeEraseCookie);
} catch(Exception &) { }
} catch(const Exception &) { }
// setup the listen address

View file

@ -330,7 +330,7 @@ namespace NLNET
_onProcessModuleMessage(currentSender, currentMessage);
_CurrentMessageFailed = false;
}
catch (NLMISC::Exception e)
catch (const NLMISC::Exception &e)
{
nlwarning("In module task '%s' (cotask message receiver), exception '%e' thrown", typeid(this).name(), e.what());
// an exception have been thrown

View file

@ -109,7 +109,7 @@ namespace NLNET
sd->serial(s);
}
}
catch(EStreamOverflow e)
catch(const EStreamOverflow &)
{
// FAILED to read the security block, rewind to old pos and serial as unknow
nlwarning("Error while reading stream for security data type %u", dataTag);

View file

@ -684,7 +684,7 @@ namespace NLNET
route->CallbackClient.connect(addr);
nldebug("CGatewayL3ClientTransport : Connected to %s with connId %u", addr.asString().c_str(), connId);
}
catch (ESocketConnectionFailed e)
catch (const ESocketConnectionFailed &)
{
nlinfo("CGatewayL3ClientTransport : Failed to connect to server %s, retrying in %u seconds", addr.asString().c_str(), _RetryInterval);
}

View file

@ -502,7 +502,7 @@ bool CNamingClient::lookupAndConnect (const std::string &name, CCallbackClient &
// connection succeeded
return true;
}
catch (ESocketConnectionFailed &e)
catch (const ESocketConnectionFailed &e)
{
nldebug( "NC: Connection to %s failed: %s, tring another service if available", servaddr.asString().c_str(), e.what() );

View file

@ -79,7 +79,7 @@ void CNetDisplayer::setLogServer (const CInetAddress& logServerAddr)
{
_Server->connect (_ServerAddr);
}
catch( ESocket& )
catch(const ESocket&)
{
// Silence
}
@ -153,7 +153,7 @@ void CNetDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess
msg.serial( s );
_Server->send (msg, 0, false);
}
catch( NLMISC::Exception& )
catch(const NLMISC::Exception& )
{
// Silence
}

View file

@ -914,7 +914,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
// Get the localhost name
localhost = CInetAddress::localHost().hostName();
}
catch (NLNET::ESocket &)
catch (const NLNET::ESocket &)
{
localhost = "<UnknownHost>";
}
@ -1091,7 +1091,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
return 10;
}
}
catch (ESocketConnectionFailed &)
catch (const ESocketConnectionFailed &)
{
nlinfo ("SERVICE: Could not connect to the Naming Service (%s). Retrying in a few seconds...", loc.asString().c_str());
nlSleep (5000);
@ -1495,13 +1495,13 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
MyTAT.deactivate();
}
}
catch (EFatalError &)
catch (const EFatalError &)
{
// Somebody call nlerror, so we have to quit now, the message already display
// so we don't have to to anything
setExitStatus (EXIT_FAILURE);
}
catch (ESocket &e)
catch (const ESocket &e)
{
// Catch NeL network exception to release the system cleanly setExitStatus (EXIT_FAILURE);
ErrorLog->displayNL( "NeL Exception in \"%s\": %s", _ShortName.c_str(), e.what() );
@ -1560,7 +1560,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
nlinfo ("SERVICE: Service released successfully");
}
catch (EFatalError &)
catch (const EFatalError &)
{
// Somebody call nlerror, so we have to quit now, the message already display
// so we don't have to to anything

View file

@ -419,7 +419,7 @@ void getNameOfMessageOrTransportClass( NLNET::CMessage& msgin, std::string& msgN
msgin.seek( msgin.getHeaderSize(), NLMISC::IStream::begin );
msgin.serial( msgName );
}
catch ( EStreamOverflow& )
catch (const EStreamOverflow&)
{
msgName = "<Name not found>";
}

View file

@ -481,7 +481,7 @@ void CAliveCheck::run()
CheckList[i].AddressValid = true;
cbc.disconnect();
}
catch (ESocketConnectionFailed &e)
catch (const ESocketConnectionFailed &e)
{
#if FINAL_VERSION
nlinfo ("HNETL5: can't connect to %s-%hu now (%s)", CheckList[i].ServiceName.c_str(), CheckList[i].ServiceId.get(), e.what ());
@ -587,7 +587,7 @@ bool CUnifiedNetwork::init(const CInetAddress *addr, CCallbackNetBase::TRecordin
{
_CbServer->init(port);
}
catch (ESocket &)
catch (const ESocket &)
{
nlwarning("Failed to init the listen socket on port %u, is the service already running ?", port);
// wait a little before retrying
@ -866,7 +866,7 @@ void CUnifiedNetwork::addService(const string &name, const vector<CInetAddress>
cbc->connect(addr[i]);
connectSuccess = true;
}
catch (ESocketConnectionFailed &e)
catch (const ESocketConnectionFailed &e)
{
nlwarning ("HNETL5: can't connect to %s (sid %u) now (%s) '%s'", name.c_str(), sid.get(), e.what (), addr[i].asString ().c_str());
connectSuccess = false;
@ -1010,7 +1010,7 @@ void CUnifiedNetwork::update(TTime timeout)
laddr[i].setPort(_ServerPort);
CNamingClient::resendRegisteration (_Name, laddr, _SId);
}
catch (ESocketConnectionFailed &)
catch (const ESocketConnectionFailed &)
{
nlwarning ("HNETL5: Could not connect to the Naming Service (%s). Retrying in a few seconds...", _NamingServiceAddr.asString().c_str());
}
@ -1209,7 +1209,7 @@ void CUnifiedNetwork::autoReconnect( CUnifiedConnection &uc, uint connectionInde
// call the user callback
callServiceUpCallback (uc.ServiceName, uc.ServiceId);
}
catch (ESocketConnectionFailed &e)
catch (const ESocketConnectionFailed &e)
{
#if FINAL_VERSION
nlinfo ("HNETL5: can't connect to %s-%hu now (%s)", uc.ServiceName.c_str(), uc.ServiceId.get(), e.what ());

View file

@ -387,7 +387,7 @@ void NLPACS::CGlobalRetriever::makeLinks(uint n)
instance.link(neighbor, _RetrieverBank->getRetrievers());
neighbor.link(instance, _RetrieverBank->getRetrievers());
}
catch (Exception &e)
catch (const Exception &e)
{
nlwarning("in NLPACS::CGlobalRetriever::makeLinks()");
nlwarning("caught an exception during linkage of %d and %d: %s", instance.getInstanceId(), neighbor.getInstanceId(), e.what());

View file

@ -150,7 +150,7 @@ public:
{
f.serial(_Retrievers[i]);
}
catch (NLMISC::Exception &e)
catch (const NLMISC::Exception &e)
{
nlwarning("Couldn't load retriever file '%s', %s", fname.c_str(), e.what());
_Retrievers[i].clear();

View file

@ -370,7 +370,7 @@ void CAudioMixerUser::initDriver(const std::string &driverName)
_SoundDriver = ISoundDriver::createDriver(this, driverType);
nlassert(_SoundDriver);
}
catch (ESoundDriver &e)
catch (const ESoundDriver &e)
{
nlwarning(e.what());
delete _SoundDriver; _SoundDriver = NULL;
@ -458,7 +458,7 @@ void CAudioMixerUser::initDevice(const std::string &deviceName, const CInitInfo
manualRolloff = false; // not really needed, but set anyway in case this is still used later in this function
}
}
catch (ESoundDriver &e)
catch (const ESoundDriver &e)
{
nlwarning(e.what());
delete _SoundDriver; _SoundDriver = NULL;
@ -883,7 +883,7 @@ void CAudioMixerUser::buildSampleBankList()
}
}
}
catch(Exception e)
catch(const Exception &)
{
upToDate = false;
}
@ -2100,7 +2100,7 @@ uint32 CAudioMixerUser::loadSampleBank(bool async, const std::string &name, st
{
bank->load(async);
}
catch (Exception& e)
catch (const Exception& e)
{
if (notfoundfiles)
{
@ -2489,7 +2489,7 @@ void CAudioMixerUser::changeMaxTrack(uint maxTrack)
_FreeTracks.insert(_FreeTracks.begin(), _Tracks[i]);
}
}
catch ( ESoundDriver & )
catch (const ESoundDriver &)
{
delete _Tracks[i];
// If the source generation failed, keep only the generated number of sources

View file

@ -605,7 +605,7 @@ void CSoundDriverDSound::initDevice(const std::string &device, ISoundDriver::TSo
_SourceCount++;
}
}
catch (ESoundDriver& e)
catch (const ESoundDriver& e)
{
// Okay, here's the situation: I'm listening to WinAmp while debugging.
// The caps told me there were 31 buffers available. In reality, there were

View file

@ -892,12 +892,22 @@ void CSourceAL::setStreamingBuffersMax(uint buffers)
for(uint i = 0; i < _BuffersMax; ++i)
{
// create a new buffer
CBufferAL *buffer = static_cast<CBufferAL*>(_SoundDriver->createBuffer());
// use StorageSoftware because buffers will be reused
// deleting and recreating them is a waste of time
buffer->setStorageMode(IBuffer::StorageSoftware);
_Buffers[buffer->bufferName()] = buffer;
try
{
// create a new buffer
CBufferAL *buffer = static_cast<CBufferAL*>(_SoundDriver->createBuffer());
// use StorageSoftware because buffers will be reused
// deleting and recreating them is a waste of time
buffer->setStorageMode(IBuffer::StorageSoftware);
_Buffers[buffer->bufferName()] = buffer;
}
catch(const ESoundDriverGenBuf &e)
{
nlwarning("Cannot create %d buffers. openal fails after %d buffers", buffers, i);
_BuffersMax = i;
_BuffersName.resize(i);
break;
}
}
}

View file

@ -213,7 +213,7 @@ void CSampleBank::load(bool async)
_SampleBankManager->m_LoadedSize += _ByteSize;
}
catch(Exception &e)
catch(const Exception &e)
{
// loading failed !
nlwarning("Exception %s during loading of sample bank %s", e.what(), filename.c_str());
@ -281,7 +281,7 @@ void CSampleBank::load(bool async)
// Warn the sound bank that the sample are available.
CSoundBank::instance()->bufferLoaded(sampleName, ibuffer);
}
catch (ESoundDriver &e)
catch (const ESoundDriver &e)
{
if (ibuffer != NULL) {
delete ibuffer;

View file

@ -36,7 +36,7 @@ using namespace NLMISC;
namespace NLSOUND {
CSampleBankManager::CSampleBankManager(CAudioMixerUser *audioMixer) : m_AudioMixer(audioMixer), m_LoadedSize(NULL)
CSampleBankManager::CSampleBankManager(CAudioMixerUser *audioMixer) : m_AudioMixer(audioMixer), m_LoadedSize(0)
{
}

View file

@ -103,7 +103,7 @@ int main(int argc, char* argv[])
animationOptimizer.addLowPrecisionTrack(anim_low_precision_tracks.asString(lpt));
}
}
catch(EUnknownVar &)
catch(const EUnknownVar &)
{
nlwarning("\"anim_low_precision_tracks\" not found in the parameter file. Add \"Finger\" and \"Ponytail\" by default");
animationOptimizer.addLowPrecisionTrack("Finger");
@ -126,7 +126,7 @@ int main(int argc, char* argv[])
animationOptimizer.setSampleFrameRate(sr);
}
}
catch(EUnknownVar &)
catch(const EUnknownVar &)
{
nlwarning("\"anim_sample_rate\" not found in the parameter file. Use Default of 30 fps.");
animationOptimizer.setSampleFrameRate(30);
@ -198,7 +198,7 @@ int main(int argc, char* argv[])
nlinfo("Anim skipped: %4d", numSkipped);
}
catch (Exception& except)
catch (const Exception& except)
{
// Error message
nlwarning ("ERROR %s\n", except.what());

View file

@ -124,7 +124,7 @@ int main(int argc, char* argv[])
return -1;
}
}
catch (Exception& e)
catch (const Exception& e)
{
// Error message
fprintf (stderr, "Error: %s\n", e.what());

View file

@ -173,7 +173,7 @@ int main(int argc, char *argv[])
// NB: the key name here is the entire file, with the .anim, for easier georges editing.
lodBuilder.addAnim(animFileName.c_str(), anim, bakeFrameRate);
}
catch(EPathNotFound &)
catch(const EPathNotFound &)
{
printf("ERROR anim not found %s\n", animFileName.c_str());
delete anim;
@ -186,7 +186,7 @@ int main(int argc, char *argv[])
uint32 shapeId= lodShapeBank.addShape();
*lodShapeBank.getShapeFullAcces(shapeId)= lodBuilder.getLodShape();
}
catch(EUnknownVar &evar)
catch(const EUnknownVar &evar)
{
nlwarning(evar.what());
// Any other exception will make the program quit.
@ -205,7 +205,7 @@ int main(int argc, char *argv[])
oFile.serial(lodShapeBank);
oFile.close();
}
catch (Exception& except)
catch (const Exception& except)
{
// Error message
printf ("ERROR %s.\n Aborting.\n", except.what());

View file

@ -100,7 +100,7 @@ bool computeOneShape(const char *lodFile, const char *shapeIn, const char *shape
COFile dbgF("testDBG.tga");
dbg.writeTGA(dbgF, 32);*/
}
catch(Exception &e)
catch(const Exception &e)
{
nlwarning("ERROR: %s", e.what());
return false;
@ -179,7 +179,7 @@ int main(int argc, char *argv[])
LodFilters[i]= var.asString(i*2+1);
}
}
catch(Exception &e)
catch(const Exception &e)
{
// It is not an error to have a bad config file: files will be copied
nlwarning(e.what());

View file

@ -255,12 +255,12 @@ int main(int argc, char* argv[])
nlwarning ("WARNING no coarse mesh to compute, abort.\n");
}
}
catch (EConfigFile &e)
catch (const EConfigFile &e)
{
// Something goes wrong... catch that
nlwarning ("ERROR %s\n", e.what ());
}
catch (Exception &e)
catch (const Exception &e)
{
// Something goes wrong... catch that
nlwarning ("ERROR %s\n", e.what ());

View file

@ -120,7 +120,7 @@ bool fillTileFar (uint tile, const char* sName, CTileFarBank::TFarType type, CTi
// Ok.
return true;
}
catch (Exception& except)
catch (const Exception& except)
{
nlwarning ("ERROR %s\n", except.what());
}
@ -409,7 +409,7 @@ int main (int argc, char **argv)
nlwarning ("ERROR Can't open file %s for writing\n", argv[2]);
}
}
catch (Exception& except)
catch (const Exception& except)
{
nlwarning ("ERROR %s\n", except.what());
}

View file

@ -267,7 +267,7 @@ int main(int nNbArg, char **ppArgs)
pBtmp->load(inFile);
AllMaps[i] = pBtmp;
}
catch (NLMISC::Exception &e)
catch (const NLMISC::Exception &e)
{
outString (string("ERROR :") + e.what());
return -1;

View file

@ -70,7 +70,7 @@ int main(int argc, char* argv[])
}
}
catch (Exception& e)
catch (const Exception& e)
{
// Error
nlwarning ("ERROR fatal error: %s", e.what());

View file

@ -94,7 +94,7 @@ CInstanceGroup* LoadInstanceGroup(const char* sFilename)
newIG->serial (file);
// All is good
}
catch (Exception &)
catch (const Exception &)
{
// Cannot save the file
delete newIG;

View file

@ -331,9 +331,9 @@ void displayInfoFileInStream(FILE *logStream, const char *fileName, const set<st
fprintf(logStream, " 'StaticLight Not Computed' means the instance has a ASP flag or the ig is not yet lighted\n");
fprintf(logStream, " If lighted, for each instance, the format is 'SunContribution(8Bit) - idLight0;idLight1 (or NOLIGHT) - LocalAmbientId (or GLOBAL_AMBIENT)' \n");
fprintf(logStream, " DCS means the instance don't cast shadow (used in the lighter)\n");
fprintf(logStream, " DCSINT Same but very special for ig_lighter.exe only\n");
fprintf(logStream, " DCSEXT Same but very special for zone_lighter and zone_ig_lighter.exe only\n");
fprintf(logStream, " ASP means the instance AvoidStaticLightPreCompute (used in the lighter.exe)\n");
fprintf(logStream, " DCSINT Same but very special for ig_lighter only\n");
fprintf(logStream, " DCSEXT Same but very special for zone_lighter and zone_ig_lighter only\n");
fprintf(logStream, " ASP means the instance AvoidStaticLightPreCompute (used in the lighter)\n");
fprintf(logStream, " -------------------------------------------------------------\n");
uint k;
for(k = 0; k < ig._InstancesInfos.size(); ++k)

View file

@ -125,7 +125,7 @@ int main(int argc, char *argv[])
f.serial(textInfo);
addTextToBank(textInfo, textBank);
}
catch(Exception &e)
catch(const Exception &e)
{
nlwarning("ERROR: Unable to process %s. Reason: %s. Processing next", hlsInfofiles[k].c_str(), e.what());
}
@ -143,7 +143,7 @@ int main(int argc, char *argv[])
fOut.serial(textBank);
fOut.close();
}
catch(Exception &e)
catch(const Exception &e)
{
nlwarning("ERROR: Unable to write HLS Bank %s: %s", argv[2], e.what());
exit(-1);

View file

@ -37,7 +37,7 @@ CInstanceGroup* LoadInstanceGroup (const char* sFilename)
{
newIG->serial (file);
}
catch (Exception &)
catch (const Exception &)
{
delete newIG;
return NULL;
@ -62,7 +62,7 @@ bool SaveInstanceGroup (const char* sFilename, CInstanceGroup *pIG)
{
pIG->serial (file);
}
catch (Exception &)
catch (const Exception &)
{
return false;
}

View file

@ -106,7 +106,7 @@ struct SExportOptions
CConfigFile::CVar &cvLandFile = cf.getVar("LandFile");
LandFile = cvLandFile.asString();
}
catch (EConfigFile &e)
catch (const EConfigFile &e)
{
string sTmp = string("ERROR : Error in config file : ") + e.what() + "\n";
outString (sTmp);
@ -173,7 +173,7 @@ CZoneRegion *loadLand (const string &filename)
outString (sTmp);
}
}
catch (Exception& e)
catch (const Exception& e)
{
string sTmp = string("Error in land file : ") + e.what();
outString (sTmp);
@ -194,7 +194,7 @@ CInstanceGroup* LoadInstanceGroup (const char* sFilename)
{
newIG->serial (file);
}
catch (Exception &)
catch (const Exception &)
{
// Cannot save the file
delete newIG;
@ -220,7 +220,7 @@ void SaveInstanceGroup (const char* sFilename, CInstanceGroup *pIG)
{
pIG->serial (file);
}
catch (Exception &e)
catch (const Exception &e)
{
outString(string(e.what()));
}
@ -339,7 +339,7 @@ int main(int nNbArg, char**ppArgs)
HeightMap1 = NULL;
}
}
catch (Exception &e)
catch (const Exception &e)
{
string sTmp = string("Cant load height map : ") + options.HeightMapFile1 + " : " + e.what();
outString (sTmp);
@ -365,7 +365,7 @@ int main(int nNbArg, char**ppArgs)
HeightMap2 = NULL;
}
}
catch (Exception &e)
catch (const Exception &e)
{
string sTmp = string("Cant load height map : ") + options.HeightMapFile2 + " : " + e.what() + "\n";
outString (sTmp);

View file

@ -83,7 +83,7 @@ int main(int argc, char **argv)
printf("TotalCells: %d\n", totalCells);
}
catch (std::exception &e)
catch (const std::exception &e)
{
printf("%s\n", e.what());
}

View file

@ -344,7 +344,7 @@ int main(int argc, char* argv[])
}
}
catch (Exception& except)
catch (const Exception& except)
{
// Error message
nlwarning ("ERROR %s\n", except.what());

View file

@ -365,7 +365,7 @@ int main(int nNbArg, char **ppArgs)
CMeshBase *pMB = dynamic_cast<CMeshBase*>(mesh.getShapePointer());
AllShapes.push_back (pMB);
}
catch (NLMISC::EPathNotFound &e)
catch (const NLMISC::EPathNotFound &e)
{
outString(string("ERROR: shape not found ")+AllShapeNames[nShp]+" - "+e.what());
return -1;
@ -529,7 +529,7 @@ int main(int nNbArg, char **ppArgs)
inFile.open(sTmp2);
CBitmap::loadSize(inFile, wRef, hRef);
}
catch (NLMISC::Exception &e)
catch (const NLMISC::Exception &e)
{
outString (string("ERROR :") + e.what());
return -1;
@ -546,7 +546,7 @@ int main(int nNbArg, char **ppArgs)
inFile.open(sTmp3);
CBitmap::loadSize(inFile, wCur, hCur);
}
catch (NLMISC::Exception &)
catch (const NLMISC::Exception &)
{
}
@ -595,7 +595,7 @@ int main(int nNbArg, char **ppArgs)
pBtmp->load(inFile);
AllLightmaps[i] = pBtmp;
}
catch (NLMISC::Exception &e)
catch (const NLMISC::Exception &e)
{
outString (string("ERROR :") + e.what());
return -1;
@ -671,7 +671,7 @@ int main(int nNbArg, char **ppArgs)
BitmapJ.load (inFile);
inFile.close ();
}
catch (NLMISC::Exception &e)
catch (const NLMISC::Exception &e)
{
outString (string("ERROR :") + e.what());
return -1;
@ -883,7 +883,7 @@ int main(int nNbArg, char **ppArgs)
meshfile.close ();
}
}
catch (NLMISC::EPathNotFound &e)
catch (const NLMISC::EPathNotFound &e)
{
outString(string("ERROR: cannot save shape ")+AllShapeNames[k]+" - "+e.what());
return -1;

View file

@ -23,10 +23,10 @@ namespace Core
namespace Constants
{
const char * const OVQT_VERSION_LONG = "0.0.1";
const char * const OVQT_VERSION_LONG = "0.1";
const char * const OVQT_VENDOR = "Ryzom Core";
const char * const OVQT_YEAR = "2010, 2011";
const char * const OVQT_CORE_PLUGIN = "Core";
const char * const OVQT_CORE_PLUGIN = "Core";
//mainwindow
const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow";
@ -43,12 +43,26 @@ const char * const M_TOOLS = "ObjectViewerQt.Menu.Tools";
const char * const M_WINDOW = "ObjectViewerQt.Menu.Window";
const char * const M_HELP = "ObjectViewerQt.Menu.Help";
const char * const M_FILE_RECENTFILES = "ObjectViewerQt.Menu.File.RecentFiles";
const char * const M_SHEET = "ObjectViewerQt.Menu.Sheet";
//actions
const char * const NEW = "ObjectViewerQt.New";
const char * const OPEN = "ObjectViewerQt.Open";
const char * const EXIT = "ObjectViewerQt.Exit";
const char * const OPEN = "ObjectViewerQt.Open";
const char * const SAVE = "ObjectViewerQt.Save";
const char * const SAVE_AS = "ObjectViewerQt.SaveAs";
const char * const SAVE_ALL = "ObjectViewerQt.SaveAll";
const char * const EXIT = "ObjectViewerQt.Exit";
const char * const UNDO = "ObjectViewerQt.Undo";
const char * const REDO = "ObjectViewerQt.Redo";
const char * const CUT = "ObjectViewerQt.Cut";
const char * const COPY = "ObjectViewerQt.Copy";
const char * const PASTE = "ObjectViewerQt.Paste";
const char * const DEL = "ObjectViewerQt.Del";
const char * const FIND = "ObjectViewerQt.Find";
const char * const SELECT_ALL = "ObjectViewerQt.SelectAll";
const char * const GOTO_POS = "ObjectViewerQt.Goto";
const char * const SETTINGS = "ObjectViewerQt.Settings";
const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen";

View file

@ -57,8 +57,15 @@ MainWindow::MainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *
m_settings = m_pluginManager->settings();
m_coreImpl = new CoreImpl(this);
#ifdef Q_WS_MAC
m_menuBar = new QMenuBar(0);
#else
m_menuBar = new QMenuBar(this);
setMenuBar(m_menuBar);
#endif
m_menuManager = new MenuManager(this);
m_menuManager->setMenuBar(menuBar());
m_menuManager->setMenuBar(m_menuBar);
m_tabWidget = new QTabWidget(this);
m_tabWidget->setTabPosition(QTabWidget::South);
@ -98,11 +105,11 @@ bool MainWindow::initialize(QString *errorString)
void MainWindow::extensionsInitialized()
{
readSettings();
connect(m_contextManager, SIGNAL(currentContextChanged(Core::IContext*)),
this, SLOT(updateContext(Core::IContext*)));
if (m_contextManager->currentContext() != NULL)
updateContext(m_contextManager->currentContext());
readSettings();
connect(m_contextManager, SIGNAL(currentContextChanged(Core::IContext*)),
this, SLOT(updateContext(Core::IContext*)));
if (m_contextManager->currentContext() != NULL)
updateContext(m_contextManager->currentContext());
show();
}
@ -141,6 +148,56 @@ void MainWindow::open()
m_contextManager->currentContext()->open();
}
void MainWindow::newFile()
{
}
void MainWindow::save()
{
}
void MainWindow::saveAs()
{
}
void MainWindow::saveAll()
{
}
void MainWindow::cut()
{
}
void MainWindow::copy()
{
}
void MainWindow::paste()
{
}
void MainWindow::del()
{
}
void MainWindow::find()
{
}
void MainWindow::gotoPos()
{
}
void MainWindow::setFullScreen(bool enabled)
{
if (bool(windowState() & Qt::WindowFullScreen) == enabled)
return;
if (enabled)
setWindowState(windowState() | Qt::WindowFullScreen);
else
setWindowState(windowState() & ~Qt::WindowFullScreen);
}
bool MainWindow::showOptionsDialog(const QString &group,
const QString &page,
QWidget *parent)
@ -186,6 +243,13 @@ void MainWindow::closeEvent(QCloseEvent *event)
void MainWindow::createActions()
{
m_newAction = new QAction(tr("&New"), this);
m_newAction->setIcon(QIcon(Constants::ICON_NEW));
m_newAction->setShortcut(QKeySequence::New);
menuManager()->registerAction(m_newAction, Constants::NEW);
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
m_newAction->setEnabled(false);
m_openAction = new QAction(tr("&Open..."), this);
m_openAction->setIcon(QIcon(Constants::ICON_OPEN));
m_openAction->setShortcut(QKeySequence::Open);
@ -193,12 +257,80 @@ void MainWindow::createActions()
menuManager()->registerAction(m_openAction, Constants::OPEN);
connect(m_openAction, SIGNAL(triggered()), this, SLOT(open()));
m_saveAction = new QAction(tr("&Save"), this);
m_saveAction->setIcon(QIcon(Constants::ICON_SAVE));
m_saveAction->setShortcut(QKeySequence::Save);
menuManager()->registerAction(m_saveAction, Constants::SAVE);
connect(m_saveAction, SIGNAL(triggered()), this, SLOT(save()));
m_saveAction->setEnabled(false);
m_saveAsAction = new QAction(tr("Save &As..."), this);
m_saveAsAction->setIcon(QIcon(Constants::ICON_SAVE_AS));
m_saveAsAction->setShortcut(QKeySequence::SaveAs);
menuManager()->registerAction(m_saveAsAction, Constants::SAVE_AS);
connect(m_saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()));
m_saveAsAction->setEnabled(false);
m_saveAllAction = new QAction(tr("&Save A&ll"), this);
m_saveAllAction->setShortcut(QKeySequence::SelectAll);
menuManager()->registerAction(m_saveAllAction, Constants::SAVE_ALL);
connect(m_saveAllAction, SIGNAL(triggered()), this, SLOT(saveAll()));
m_saveAllAction->setEnabled(false);
m_exitAction = new QAction(tr("E&xit"), this);
m_exitAction->setShortcut(QKeySequence(tr("Ctrl+Q")));
m_exitAction->setStatusTip(tr("Exit the application"));
menuManager()->registerAction(m_exitAction, Constants::EXIT);
connect(m_exitAction, SIGNAL(triggered()), this, SLOT(close()));
m_cutAction = new QAction(tr("Cu&t"), this);
m_cutAction->setShortcut(QKeySequence::Cut);
menuManager()->registerAction(m_cutAction, Constants::CUT);
connect(m_cutAction, SIGNAL(triggered()), this, SLOT(cut()));
m_cutAction->setEnabled(false);
m_copyAction = new QAction(tr("&Copy"), this);
m_copyAction->setShortcut(QKeySequence::Copy);
menuManager()->registerAction(m_copyAction, Constants::COPY);
connect(m_copyAction, SIGNAL(triggered()), this, SLOT(copy()));
m_copyAction->setEnabled(false);
m_pasteAction = new QAction(tr("&Paste"), this);
m_pasteAction->setShortcut(QKeySequence::Paste);
menuManager()->registerAction(m_pasteAction, Constants::PASTE);
connect(m_pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
m_pasteAction->setEnabled(false);
m_delAction = new QAction(tr("&Delete"), this);
m_delAction->setShortcut(QKeySequence::Delete);
menuManager()->registerAction(m_delAction, Constants::DEL);
connect(m_delAction, SIGNAL(triggered()), this, SLOT(del()));
m_delAction->setEnabled(false);
m_selectAllAction = new QAction(tr("Select &All"), this);
m_selectAllAction->setShortcut(QKeySequence::SelectAll);
menuManager()->registerAction(m_selectAllAction, Constants::SELECT_ALL);
connect(m_selectAllAction, SIGNAL(triggered()), this, SLOT(selectAll()));
m_selectAllAction->setEnabled(false);
m_findAction = new QAction(tr("&Find"), this);
m_findAction->setShortcut(QKeySequence::Find);
menuManager()->registerAction(m_findAction, Constants::FIND);
connect(m_findAction, SIGNAL(triggered()), this, SLOT(find()));
m_findAction->setEnabled(false);
m_gotoAction = new QAction(tr("&Go To.."), this);
m_gotoAction->setShortcut(QKeySequence(tr("Ctrl+G")));
menuManager()->registerAction(m_gotoAction, Constants::GOTO_POS);
connect(m_gotoAction, SIGNAL(triggered()), this, SLOT(gotoPos()));
m_gotoAction->setEnabled(false);
m_fullscreenAction = new QAction(tr("Fullscreen"), this);
m_fullscreenAction->setCheckable(true);
m_fullscreenAction->setShortcut(QKeySequence(tr("Ctrl+Shift+F11")));
menuManager()->registerAction(m_fullscreenAction, Constants::TOGGLE_FULLSCREEN);
connect(m_fullscreenAction, SIGNAL(triggered(bool)), this, SLOT(setFullScreen(bool)));
m_settingsAction = new QAction(tr("&Settings"), this);
m_settingsAction->setIcon(QIcon(":/images/preferences.png"));
m_settingsAction->setShortcut(QKeySequence::Preferences);
@ -232,22 +364,43 @@ void MainWindow::createActions()
void MainWindow::createMenus()
{
m_fileMenu = menuBar()->addMenu(tr("&File"));
m_fileMenu = m_menuBar->addMenu(tr("&File"));
menuManager()->registerMenu(m_fileMenu, Constants::M_FILE);
m_fileMenu->addAction(m_newAction);
m_fileMenu->addAction(m_openAction);
m_fileMenu->addSeparator();
m_fileMenu->addAction(m_saveAction);
m_fileMenu->addAction(m_saveAsAction);
m_fileMenu->addAction(m_saveAllAction);
m_fileMenu->addSeparator();
m_recentFilesMenu = m_fileMenu->addMenu(tr("Recent &Files"));
m_recentFilesMenu->setEnabled(false);
menuManager()->registerMenu(m_recentFilesMenu, Constants::M_FILE_RECENTFILES);
m_fileMenu->addSeparator();
m_fileMenu->addAction(m_exitAction);
m_editMenu = menuBar()->addMenu(tr("&Edit"));
m_editMenu = m_menuBar->addMenu(tr("&Edit"));
m_editMenu->addAction(m_undoGroup->createUndoAction(this));
m_editMenu->addAction(m_undoGroup->createRedoAction(this));
m_editMenu->addSeparator();
m_editMenu->addAction(m_cutAction);
m_editMenu->addAction(m_copyAction);
m_editMenu->addAction(m_pasteAction);
m_editMenu->addAction(m_delAction);
m_editMenu->addSeparator();
m_editMenu->addAction(m_selectAllAction);
m_editMenu->addSeparator();
m_editMenu->addAction(m_findAction);
m_editMenu->addAction(m_gotoAction);
menuManager()->registerMenu(m_editMenu, Constants::M_EDIT);
m_viewMenu = menuBar()->addMenu(tr("&View"));
m_viewMenu = m_menuBar->addMenu(tr("&View"));
m_viewMenu->addAction(m_fullscreenAction);
menuManager()->registerMenu(m_viewMenu, Constants::M_VIEW);
m_toolsMenu = menuBar()->addMenu(tr("&Tools"));
m_toolsMenu = m_menuBar->addMenu(tr("&Tools"));
menuManager()->registerMenu(m_toolsMenu, Constants::M_TOOLS);
m_sheetMenu = m_toolsMenu->addMenu(tr("&Sheet"));
@ -257,9 +410,9 @@ void MainWindow::createMenus()
m_toolsMenu->addAction(m_settingsAction);
menuBar()->addSeparator();
m_menuBar->addSeparator();
m_helpMenu = menuBar()->addMenu(tr("&Help"));
m_helpMenu = m_menuBar->addMenu(tr("&Help"));
menuManager()->registerMenu(m_helpMenu, Constants::M_HELP);
m_helpMenu->addAction(m_aboutAction);
m_helpMenu->addAction(m_aboutQtAction);

View file

@ -66,6 +66,17 @@ public Q_SLOTS:
private Q_SLOTS:
void open();
void newFile();
void save();
void saveAs();
void saveAll();
void cut();
void copy();
void paste();
void del();
void find();
void gotoPos();
void setFullScreen(bool enabled);
void about();
void updateContext(Core::IContext *context);
@ -99,15 +110,28 @@ private:
QTabWidget *m_tabWidget;
QMenu *m_fileMenu;
QMenu *m_recentFilesMenu;
QMenu *m_editMenu;
QMenu *m_viewMenu;
QMenu *m_toolsMenu;
QMenu *m_helpMenu;
QMenuBar *m_menuBar;
QMenu *m_sheetMenu;
QAction *m_newAction;
QAction *m_openAction;
QAction *m_saveAction;
QAction *m_saveAsAction;
QAction *m_saveAllAction;
QAction *m_exitAction;
QAction *m_cutAction;
QAction *m_copyAction;
QAction *m_pasteAction;
QAction *m_delAction;
QAction *m_selectAllAction;
QAction *m_findAction;
QAction *m_gotoAction;
QAction *m_fullscreenAction;
QAction *m_settingsAction;
QAction *m_pluginViewAction;
QAction *m_aboutAction;

View file

@ -90,7 +90,6 @@ QStringList MyPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
list.append("ObjectViewer");
return list;
}

View file

@ -239,12 +239,6 @@ void CMainWindow::updateStatusBar()
void CMainWindow::createActions()
{
_openAction = new QAction(tr("&Open..."), this);
_openAction->setIcon(QIcon(Core::Constants::ICON_OPEN));
_openAction->setShortcut(QKeySequence::Open);
_openAction->setStatusTip(tr("Open an existing file"));
connect(_openAction, SIGNAL(triggered()), this, SLOT(open()));
_setBackColorAction = _GraphicsViewport->createSetBackgroundColor(this);
_setBackColorAction->setText(tr("Set &background color"));
_setBackColorAction->setIcon(QIcon(Constants::ICON_BGCOLOR));
@ -259,7 +253,7 @@ void CMainWindow::createActions()
connect(_reloadTexturesAction, SIGNAL(triggered()), this, SLOT(reloadTextures()));
_saveScreenshotAction = _GraphicsViewport->createSaveScreenshotAction(this);
_saveScreenshotAction->setText(tr("Save &Screenshot"));
_saveScreenshotAction->setText(tr("Save Screenshot"));
_saveScreenshotAction->setStatusTip(tr("Make a screenshot of the current viewport and save"));
}
@ -267,14 +261,7 @@ void CMainWindow::createMenus()
{
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager();
// register actions for file menu
menuManager->registerAction(_openAction, "ObjectViewer.File.Open");
// add actions in file menu
QMenu *fileMenu = menuManager->menu(Core::Constants::M_FILE);
QAction *exitAction = menuManager->action(Core::Constants::EXIT);
//fileMenu->insertAction(exitAction, _openAction);
//fileMenu->insertSeparator(exitAction);
_openAction = menuManager->action(Core::Constants::OPEN);
// register actions for view menu
menuManager->registerAction(_setBackColorAction, "ObjectViewer.View.SetBackgroundColor");

View file

@ -140,7 +140,7 @@ int main(int argc, char* argv[])
NLMISC::CPath::addSearchPath(NLMISC::CPath::standardizePath(additionnal_paths.asString(k)),true, false);
}
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
}
@ -149,7 +149,7 @@ int main(int argc, char* argv[])
{
_Path_Input_TexBases = NLMISC::CPath::standardizePath(cf.getVar ("input_path_texbase").asString());
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
}
@ -158,7 +158,7 @@ int main(int argc, char* argv[])
{
_Path_Input_Masks = NLMISC::CPath::standardizePath(cf.getVar ("input_path_mask").asString());
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
}
@ -167,7 +167,7 @@ int main(int argc, char* argv[])
{
_Path_Output_MaksOptimized = NLMISC::CPath::standardizePath(cf.getVar ("output_path_mask_optimized").asString());
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
}
@ -176,7 +176,7 @@ int main(int argc, char* argv[])
{
_Path_Output_Cgi = NLMISC::CPath::standardizePath(cf.getVar ("output_path_cgi").asString());
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
}
@ -185,12 +185,12 @@ int main(int argc, char* argv[])
{
_Path_Output_Gtm = NLMISC::CPath::standardizePath(cf.getVar ("output_path_gtm").asString());
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
}
}
catch (std::exception &e)
catch (const std::exception &e)
{
nlwarning("Panoply building failed.");
nlwarning(e.what());
@ -256,7 +256,7 @@ int main(int argc, char* argv[])
NLMISC::CPath::addSearchPath(NLMISC::CPath::standardizePath(additionnal_paths.asString(k)));
}
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
}
@ -265,7 +265,7 @@ int main(int argc, char* argv[])
{
bi.InputPath = NLMISC::CPath::standardizePath(cf.getVar ("input_path").asString());
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
}
@ -274,7 +274,7 @@ int main(int argc, char* argv[])
{
bi.OutputPath = NLMISC::CPath::standardizePath(cf.getVar ("output_path").asString());
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
}
@ -283,7 +283,7 @@ int main(int argc, char* argv[])
{
bi.HlsInfoPath = NLMISC::CPath::standardizePath(cf.getVar("hls_info_path").asString());
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
bi.HlsInfoPath = "hlsInfo/";
}
@ -293,7 +293,7 @@ int main(int argc, char* argv[])
{
bi.CachePath = NLMISC::CPath::standardizePath(cf.getVar ("cache_path").asString());
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
}
@ -302,7 +302,7 @@ int main(int argc, char* argv[])
{
bi.OutputFormat = "." + cf.getVar ("output_format").asString();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
bi.OutputFormat = ".tga";
}
@ -312,7 +312,7 @@ int main(int argc, char* argv[])
{
bi.DefaultSeparator = cf.getVar ("default_separator").asString();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
bi.DefaultSeparator = '_';
}
@ -330,7 +330,7 @@ int main(int argc, char* argv[])
}
}
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
bi.BitmapExtensions[0].resize(1);
bi.BitmapExtensions[0] = bi.OutputFormat;
@ -340,14 +340,14 @@ int main(int argc, char* argv[])
{
bi.LowDefShift = cf.getVar ("low_def_shift").asInt();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
// tranform 512*512 to 64*64 by default
bi.LowDefShift= 3;
}
}
catch (std::exception &e)
catch (const std::exception &e)
{
nlwarning("Panoply building failed.");
nlwarning(e.what());
@ -361,7 +361,7 @@ int main(int argc, char* argv[])
{
BuildColoredVersions(bi);
}
catch (std::exception &e)
catch (const std::exception &e)
{
nlwarning("Something went wrong while building bitmap : %s", e.what());
return -1;
@ -389,7 +389,7 @@ static void validateCgiInfo()
f.serialCont(temp);
}
catch(std::exception &e)
catch(const std::exception &e)
{
nlwarning("Panoply building failed.");
}
@ -491,7 +491,7 @@ static void BuildColoredVersions(const CBuildInfo &bi)
//nlwarning(("No need to rebuild " + NLMISC::CFile::getFilename(files[k])).c_str());
}
}
catch (std::exception &e)
catch (const std::exception &e)
{
nlwarning("Processing of %s failed : %s \n", files[k].c_str(), e.what());
}
@ -662,7 +662,7 @@ static void BuildColoredVersionForOneBitmap(const CBuildInfo &bi, const std::str
return;
}
}
catch (NLMISC::Exception &)
catch (const NLMISC::Exception &)
{
nlwarning("File or format error with : %s. Processing next...", fileNameWithExtension.c_str());
return;
@ -743,7 +743,7 @@ static void BuildColoredVersionForOneBitmap(const CBuildInfo &bi, const std::str
return;
}
}
catch (std::exception &e)
catch (const std::exception &e)
{
nlwarning("Error with : %s : %s. Aborting this bitmap processing", maskFileName.c_str(), e.what());
return;
@ -827,7 +827,7 @@ static void BuildColoredVersionForOneBitmap(const CBuildInfo &bi, const std::str
nlwarning(("Couldn't open " + bi.OutputPath + outputFileName + bi.OutputFormat + " for writing").c_str());
}
}
catch(NLMISC::EStream &e)
catch(const NLMISC::EStream &e)
{
nlwarning(("Couldn't write " + bi.OutputPath + outputFileName + bi.OutputFormat + " : " + e.what()).c_str());
}

View file

@ -578,13 +578,16 @@ class PaintPatchData : public LocalModData {
LocalModData *Clone() { return new PaintPatchData(*this); }
void SetFlag(DWORD f,BOOL on)
{
if ( on ) {
{
if ( on )
{
flags|=f;
} else {
flags&=~f;
}
}
else
{
flags&=~f;
}
}
DWORD GetFlag(DWORD f) { return flags&f; }
EPTempData *TempData(PaintPatchMod *mod);

View file

@ -99,7 +99,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
// load the config file
cf.load(filename);
}
catch(exception &e)
catch(const exception &e)
{
nlwarning("can't parse config file : %s", filename.c_str());
nlwarning(e.what());
@ -111,7 +111,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.input_path = CPath::standardizePath(cf.getVar("input_path").asString());
}
catch (EUnknownVar &)
catch (const EUnknownVar &)
{
}
@ -120,7 +120,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.output_path = CPath::standardizePath(cf.getVar("output_path").asString());
}
catch (EUnknownVar &)
catch (const EUnknownVar &)
{
}
@ -129,7 +129,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.output_format = cf.getVar("output_format").asString();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
settings.output_format = "jpg";
}
@ -141,7 +141,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
for (uint i=0; i < (uint)search_pathes.size(); ++i)
CPath::addSearchPath(CPath::standardizePath(search_pathes.asString(i)));
}
catch(EUnknownVar &)
catch(const EUnknownVar &)
{
}
@ -152,7 +152,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
for (uint i=0; i< (uint)recursive_search_pathes.size(); ++i)
CPath::addSearchPath(CPath::standardizePath(recursive_search_pathes.asString(i)), true, false);
}
catch(EUnknownVar &)
catch(const EUnknownVar &)
{
}
@ -171,7 +171,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
CPath::remapExtension(extensions_remapping.asString(i), extensions_remapping.asString(i+1), true);
}
}
catch (EUnknownVar &)
catch (const EUnknownVar &)
{
}
@ -180,7 +180,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.preview_format = cf.getVar("preview_format").asString();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
settings.preview_format = "jpg";
}
@ -190,7 +190,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.preview_width = cf.getVar("preview_width").asInt();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
settings.preview_width = 256;
}
@ -200,7 +200,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.preview_height = cf.getVar("preview_height").asInt();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
settings.preview_height = 256;
}
@ -210,7 +210,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.preview_quality = (uint8)cf.getVar("preview_quality").asInt();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
settings.preview_quality = 90;
}
@ -223,7 +223,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
settings.output_background.G = (uint8)var.asInt(1);
settings.output_background.B = (uint8)var.asInt(2);
}
catch (EUnknownVar &)
catch (const EUnknownVar &)
{
settings.output_background = CRGBA::Black;
}
@ -236,7 +236,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
settings.light_ambiant.G = (uint8)var.asInt(1);
settings.light_ambiant.B = (uint8)var.asInt(2);
}
catch (EUnknownVar &)
catch (const EUnknownVar &)
{
settings.light_ambiant = CRGBA::White;
}
@ -249,7 +249,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
settings.light_diffuse.G = (uint8)var.asInt(1);
settings.light_diffuse.B = (uint8)var.asInt(2);
}
catch (EUnknownVar &)
catch (const EUnknownVar &)
{
settings.light_diffuse = CRGBA::White;
}
@ -262,7 +262,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
settings.light_specular.G = (uint8)var.asInt(1);
settings.light_specular.B = (uint8)var.asInt(2);
}
catch (EUnknownVar &)
catch (const EUnknownVar &)
{
settings.light_specular = CRGBA::White;
}
@ -273,7 +273,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
CConfigFile::CVar &var = cf.getVar("light_direction");
settings.light_direction = CVector(var.asFloat(0), var.asFloat(1), var.asFloat(2));
}
catch (EUnknownVar &)
catch (const EUnknownVar &)
{
settings.light_direction = CVector(0.f, 1.f, 0.f);
}
@ -283,7 +283,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.output_steps_z = cf.getVar("output_steps_z").asInt();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
settings.output_steps_z = 10;
}
@ -293,7 +293,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.output_steps_x = cf.getVar("output_steps_x").asInt();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
settings.output_steps_x = 10;
}
@ -303,7 +303,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.output_width = cf.getVar("output_width").asInt();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
settings.output_width = 256;
}
@ -313,7 +313,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.output_height = cf.getVar("output_height").asInt();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
settings.output_height = 256;
}
@ -323,7 +323,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.output_antialiasing = (uint8)cf.getVar("output_antialiasing").asInt();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
settings.output_antialiasing = 2;
}
@ -333,7 +333,7 @@ bool ShapesExporter::parseConfigFile(const string &filename)
{
settings.output_quality = (uint8)cf.getVar("output_quality").asInt();
}
catch (NLMISC::EUnknownVar &)
catch (const NLMISC::EUnknownVar &)
{
settings.output_quality = 90;
}

Some files were not shown because too many files have changed in this diff Show more