Browse Source

Replace `NULL` with `0` everywhere

master
Krisjanis Rijnieks 10 years ago
parent
commit
f160fbd232
  1. 2
      src/MediaServer/DirectoryWatcher.cpp
  2. 10
      src/MediaServer/MediaServer.cpp
  3. 2
      src/Sources/BaseSource.cpp
  4. 12
      src/Sources/FboSource.cpp
  5. 4
      src/Sources/ImageSource.cpp
  6. 12
      src/Sources/VideoSource.cpp
  7. 4
      src/Surfaces/BaseSurface.cpp
  8. 2
      src/Surfaces/QuadSurface.cpp
  9. 22
      src/Surfaces/SurfaceManager.cpp
  10. 20
      src/Surfaces/SurfaceManagerGui.cpp
  11. 2
      src/Surfaces/TriangleSurface.cpp
  12. 20
      src/UserInterface/ProjectionEditor.cpp
  13. 24
      src/UserInterface/SourcesEditor.cpp
  14. 12
      src/UserInterface/TextureEditor.cpp

2
src/MediaServer/DirectoryWatcher.cpp

@ -32,7 +32,7 @@ DirectoryWatcher::DirectoryWatcher(std::string path, int watcherMediaType){
DirectoryWatcher::~DirectoryWatcher(){ DirectoryWatcher::~DirectoryWatcher(){
delete filter; delete filter;
filter = NULL; filter = 0;
} }
std::vector <std::string> & DirectoryWatcher::getFilePaths(){ std::vector <std::string> & DirectoryWatcher::getFilePaths(){

10
src/MediaServer/MediaServer.cpp

@ -85,11 +85,11 @@ BaseSource * MediaServer::loadMedia(string & path, int mediaType){
ofLogFatalError("MediaServer") << ss.str(); ofLogFatalError("MediaServer") << ss.str();
std::exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
} }
return NULL; return 0;
} }
BaseSource * MediaServer::loadImage(string & path){ BaseSource * MediaServer::loadImage(string & path){
ImageSource * imageSource = NULL; ImageSource * imageSource = 0;
// Check if this image is already loaded // Check if this image is already loaded
bool isImageLoaded = false; bool isImageLoaded = false;
if(loadedSources.count(path)){ if(loadedSources.count(path)){
@ -158,7 +158,7 @@ void MediaServer::unloadImage(string & path){
} }
BaseSource * MediaServer::loadVideo(string & path){ BaseSource * MediaServer::loadVideo(string & path){
VideoSource * videoSource = NULL; VideoSource * videoSource = 0;
// Check if this video is already loaded // Check if this video is already loaded
bool isVideoLoaded = false; bool isVideoLoaded = false;
if(loadedSources.count(path)){ if(loadedSources.count(path)){
@ -302,7 +302,7 @@ void MediaServer::addFboSource(ofx::piMapper::FboSource & fboSource){
BaseSource * MediaServer::loadFboSource(std::string & fboSourceName){ BaseSource * MediaServer::loadFboSource(std::string & fboSourceName){
ofLogNotice("MediaServer") << "Attempting to load FBO source with name " << fboSourceName; ofLogNotice("MediaServer") << "Attempting to load FBO source with name " << fboSourceName;
// Search for FBO source name in our storage // Search for FBO source name in our storage
FboSource * source = NULL; FboSource * source = 0;
for(int i = 0; i < fboSources.size(); i++){ for(int i = 0; i < fboSources.size(); i++){
if(fboSources[i]->getName() == fboSourceName){ if(fboSources[i]->getName() == fboSourceName){
source = fboSources[i]; source = fboSources[i];
@ -310,7 +310,7 @@ BaseSource * MediaServer::loadFboSource(std::string & fboSourceName){
} }
} }
// Panic if not in storage // Panic if not in storage
if(source == NULL){ if(source == 0){
ofLogError("MediaServer") << "Attempt to load non existing FBO source: " << fboSourceName; ofLogError("MediaServer") << "Attempt to load non existing FBO source: " << fboSourceName;
ofExit(EXIT_FAILURE); ofExit(EXIT_FAILURE);
} }

2
src/Sources/BaseSource.cpp

@ -40,7 +40,7 @@ std::string & BaseSource::getPath(){
} }
void BaseSource::init(){ void BaseSource::init(){
texture = NULL; texture = 0;
name = ""; name = "";
path = ""; path = "";
loadable = false; loadable = false;

12
src/Sources/FboSource.cpp

@ -3,7 +3,7 @@
namespace ofx { namespace ofx {
namespace piMapper { namespace piMapper {
FboSource::FboSource() : fbo(NULL){ FboSource::FboSource() : fbo(0){
name = PIMAPPER_FBO_SOURCE_DEF_NAME; name = PIMAPPER_FBO_SOURCE_DEF_NAME;
loadable = false; loadable = false;
loaded = false; loaded = false;
@ -53,7 +53,7 @@ void FboSource::onAppSetup(ofEventArgs & args){
} }
void FboSource::onAppUpdate(ofEventArgs & args){ void FboSource::onAppUpdate(ofEventArgs & args){
if(fbo == NULL || !fbo->isAllocated()){ if(fbo == 0 || !fbo->isAllocated()){
ofLogWarning("FboSource") << "FBO not allocated"; ofLogWarning("FboSource") << "FBO not allocated";
return; return;
} }
@ -61,7 +61,7 @@ void FboSource::onAppUpdate(ofEventArgs & args){
} }
void FboSource::onAppDraw(ofEventArgs & args){ void FboSource::onAppDraw(ofEventArgs & args){
if(fbo == NULL || !fbo->isAllocated()){ if(fbo == 0 || !fbo->isAllocated()){
ofLogWarning("FboSource") << "FBO not allocated"; ofLogWarning("FboSource") << "FBO not allocated";
return; return;
} }
@ -92,10 +92,10 @@ void FboSource::allocate(int width, int height){
} }
void FboSource::clear(){ void FboSource::clear(){
texture = NULL; texture = 0;
if(fbo != NULL){ if(fbo != 0){
delete fbo; delete fbo;
fbo = NULL; fbo = 0;
} }
} }

4
src/Sources/ImageSource.cpp

@ -35,10 +35,10 @@ void ImageSource::loadImage(std::string & filePath){
} }
void ImageSource::clear(){ void ImageSource::clear(){
texture = NULL; texture = 0;
image->clear(); image->clear();
delete image; delete image;
image = NULL; image = 0;
//path = ""; //path = "";
//name = ""; //name = "";
loaded = false; loaded = false;

12
src/Sources/VideoSource.cpp

@ -10,9 +10,9 @@ VideoSource::VideoSource(){
loaded = false; loaded = false;
type = SourceType::SOURCE_TYPE_VIDEO; type = SourceType::SOURCE_TYPE_VIDEO;
#ifdef TARGET_RASPBERRY_PI #ifdef TARGET_RASPBERRY_PI
omxPlayer = NULL; omxPlayer = 0;
#else #else
videoPlayer = NULL; videoPlayer = 0;
#endif #endif
} }
@ -44,24 +44,24 @@ void VideoSource::loadVideo(std::string & filePath){
} }
void VideoSource::clear(){ void VideoSource::clear(){
texture = NULL; texture = 0;
#ifdef TARGET_RASPBERRY_PI #ifdef TARGET_RASPBERRY_PI
omxPlayer->close(); omxPlayer->close();
delete omxPlayer; delete omxPlayer;
omxPlayer = NULL; omxPlayer = 0;
#else #else
ofRemoveListener(ofEvents().update, this, &VideoSource::update); ofRemoveListener(ofEvents().update, this, &VideoSource::update);
videoPlayer->stop(); videoPlayer->stop();
videoPlayer->close(); videoPlayer->close();
delete videoPlayer; delete videoPlayer;
videoPlayer = NULL; videoPlayer = 0;
#endif #endif
loaded = false; loaded = false;
} }
#ifndef TARGET_RASPBERRY_PI #ifndef TARGET_RASPBERRY_PI
void VideoSource::update(ofEventArgs & args){ void VideoSource::update(ofEventArgs & args){
if(videoPlayer != NULL){ if(videoPlayer != 0){
videoPlayer->update(); videoPlayer->update();
} }
} }

4
src/Surfaces/BaseSurface.cpp

@ -11,7 +11,7 @@ BaseSurface::BaseSurface(){
BaseSurface::~BaseSurface(){ BaseSurface::~BaseSurface(){
delete defaultSource; delete defaultSource;
defaultSource = NULL; defaultSource = 0;
defaultTexture.clear(); defaultTexture.clear();
} }
@ -52,7 +52,7 @@ void BaseSurface::createDefaultTexture(){
} }
void BaseSurface::drawTexture(ofVec2f position){ void BaseSurface::drawTexture(ofVec2f position){
if(source->getTexture() == NULL){ if(source->getTexture() == 0){
ofLogWarning("BaseSurface") << "Source texture empty. Not drawing."; ofLogWarning("BaseSurface") << "Source texture empty. Not drawing.";
return; return;
} }

2
src/Surfaces/QuadSurface.cpp

@ -70,7 +70,7 @@ void QuadSurface::setup(ofVec2f p1, ofVec2f p2, ofVec2f p3, ofVec2f p4,
} }
void QuadSurface::draw(){ void QuadSurface::draw(){
if(source->getTexture() == NULL){ if(source->getTexture() == 0){
ofLogWarning("QuadSurface") << "Source texture empty. Not drawing."; ofLogWarning("QuadSurface") << "Source texture empty. Not drawing.";
return; return;
} }

22
src/Surfaces/SurfaceManager.cpp

@ -4,8 +4,8 @@ namespace ofx {
namespace piMapper { namespace piMapper {
SurfaceManager::SurfaceManager() : SurfaceManager::SurfaceManager() :
mediaServer(NULL), mediaServer(0),
selectedSurface(NULL){} selectedSurface(0){}
SurfaceManager::~SurfaceManager(){ SurfaceManager::~SurfaceManager(){
clear(); clear();
@ -127,7 +127,7 @@ void SurfaceManager::addSurface(BaseSurface * surface){
} }
void SurfaceManager::removeSelectedSurface(){ void SurfaceManager::removeSelectedSurface(){
if(selectedSurface == NULL){ if(selectedSurface == 0){
return; return;
} }
for(int i = 0; i < surfaces.size(); i++){ for(int i = 0; i < surfaces.size(); i++){
@ -136,7 +136,7 @@ void SurfaceManager::removeSelectedSurface(){
// surface in the RemoveSurfaceCommand. // surface in the RemoveSurfaceCommand.
//delete surfaces[i]; //delete surfaces[i];
surfaces.erase(surfaces.begin() + i); surfaces.erase(surfaces.begin() + i);
selectedSurface = NULL; selectedSurface = 0;
break; break;
} }
} }
@ -160,7 +160,7 @@ void SurfaceManager::clear(){
void SurfaceManager::saveXmlSettings(string fileName){ void SurfaceManager::saveXmlSettings(string fileName){
// Exit if mediaServer not set // Exit if mediaServer not set
if(mediaServer == NULL){ if(mediaServer == 0){
ofLogFatalError("SurfaceManager") << "Media server not set"; ofLogFatalError("SurfaceManager") << "Media server not set";
std::exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
} }
@ -217,7 +217,7 @@ void SurfaceManager::saveXmlSettings(string fileName){
void SurfaceManager::loadXmlSettings(string fileName){ void SurfaceManager::loadXmlSettings(string fileName){
// Exit if there is no media server // Exit if there is no media server
if(mediaServer == NULL){ if(mediaServer == 0){
ofLogFatalError("SurfaceManager") << "Media server not set"; ofLogFatalError("SurfaceManager") << "Media server not set";
std::exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
} }
@ -239,7 +239,7 @@ void SurfaceManager::loadXmlSettings(string fileName){
xmlSettings.pushTag("source"); xmlSettings.pushTag("source");
string sourceType = xmlSettings.getValue("source-type", ""); string sourceType = xmlSettings.getValue("source-type", "");
string sourceName = xmlSettings.getValue("source-name", ""); string sourceName = xmlSettings.getValue("source-name", "");
BaseSource * source = NULL; BaseSource * source = 0;
if(sourceName != "" && sourceName != "none" && sourceType != ""){ if(sourceName != "" && sourceName != "none" && sourceType != ""){
// Load source depending on type // Load source depending on type
int typeEnum = SourceType::GetSourceTypeEnum(sourceType); int typeEnum = SourceType::GetSourceTypeEnum(sourceType);
@ -303,7 +303,7 @@ void SurfaceManager::loadXmlSettings(string fileName){
// now we have variables sourceName and sourceTexture // now we have variables sourceName and sourceTexture
// by checking those we can use one or another addSurface method // by checking those we can use one or another addSurface method
if(sourceName != "none" && source != NULL){ if(sourceName != "none" && source != 0){
addSurface(SurfaceType::TRIANGLE_SURFACE, source, vertices, addSurface(SurfaceType::TRIANGLE_SURFACE, source, vertices,
texCoords); texCoords);
}else{ }else{
@ -363,7 +363,7 @@ void SurfaceManager::loadXmlSettings(string fileName){
// now we have variables sourceName and sourceTexture // now we have variables sourceName and sourceTexture
// by checking those we can use one or another addSurface method // by checking those we can use one or another addSurface method
if(sourceName != "none" && source != NULL){ if(sourceName != "none" && source != 0){
addSurface(SurfaceType::QUAD_SURFACE, source, vertices, addSurface(SurfaceType::QUAD_SURFACE, source, vertices,
texCoords); texCoords);
}else{ }else{
@ -409,13 +409,13 @@ BaseSurface * SurfaceManager::getSelectedSurface(){
} }
void SurfaceManager::deselectSurface(){ void SurfaceManager::deselectSurface(){
selectedSurface = NULL; selectedSurface = 0;
} }
BaseSurface * SurfaceManager::getSurface(int index){ BaseSurface * SurfaceManager::getSurface(int index){
if(index >= surfaces.size()){ if(index >= surfaces.size()){
throw std::runtime_error("Surface index out of bounds."); throw std::runtime_error("Surface index out of bounds.");
return NULL; return 0;
} }
return surfaces[index]; return surfaces[index];

20
src/Surfaces/SurfaceManagerGui.cpp

@ -4,7 +4,7 @@ namespace ofx {
namespace piMapper { namespace piMapper {
SurfaceManagerGui::SurfaceManagerGui(){ SurfaceManagerGui::SurfaceManagerGui(){
surfaceManager = NULL; surfaceManager = 0;
guiMode = GuiMode::NONE; guiMode = GuiMode::NONE;
bDrag = false; bDrag = false;
registerMouseEvents(); registerMouseEvents();
@ -14,7 +14,7 @@ SurfaceManagerGui::SurfaceManagerGui(){
SurfaceManagerGui::~SurfaceManagerGui(){ SurfaceManagerGui::~SurfaceManagerGui(){
unregisterMouseEvents(); unregisterMouseEvents();
surfaceManager = NULL; surfaceManager = 0;
_cmdManager = 0; _cmdManager = 0;
} }
@ -37,7 +37,7 @@ void SurfaceManagerGui::unregisterMouseEvents(){
} }
void SurfaceManagerGui::draw(){ void SurfaceManagerGui::draw(){
if(surfaceManager == NULL){ if(surfaceManager == 0){
return; return;
} }
@ -45,7 +45,7 @@ void SurfaceManagerGui::draw(){
surfaceManager->draw(); surfaceManager->draw();
}else if(guiMode == GuiMode::TEXTURE_MAPPING){ }else if(guiMode == GuiMode::TEXTURE_MAPPING){
// draw the texture of the selected surface // draw the texture of the selected surface
if(surfaceManager->getSelectedSurface() != NULL){ if(surfaceManager->getSelectedSurface() != 0){
// Reset default color to white first // Reset default color to white first
ofSetColor(255, 255, 255, 255); ofSetColor(255, 255, 255, 255);
surfaceManager->getSelectedSurface()->drawTexture(ofVec2f(0, 0)); surfaceManager->getSelectedSurface()->drawTexture(ofVec2f(0, 0));
@ -94,7 +94,7 @@ void SurfaceManagerGui::mousePressed(ofMouseEventArgs & args){
bool bSurfaceSelected = false; bool bSurfaceSelected = false;
CircleJoint * hitJoint = CircleJoint * hitJoint =
textureEditor.hitTestJoints(ofVec2f(args.x, args.y)); textureEditor.hitTestJoints(ofVec2f(args.x, args.y));
if(hitJoint != NULL){ if(hitJoint != 0){
textureEditor.unselectAllJoints(); textureEditor.unselectAllJoints();
hitJoint->select(); hitJoint->select();
@ -117,7 +117,7 @@ void SurfaceManagerGui::mousePressed(ofMouseEventArgs & args){
textureEditor.unselectAllJoints(); textureEditor.unselectAllJoints();
} }
if(surfaceManager->getSelectedSurface() != NULL && !bSurfaceSelected){ if(surfaceManager->getSelectedSurface() != 0 && !bSurfaceSelected){
// hittest texture area to see if we are hitting the texture surface // hittest texture area to see if we are hitting the texture surface
if(surfaceManager->getSelectedSurface()->getTextureHitArea().inside( if(surfaceManager->getSelectedSurface()->getTextureHitArea().inside(
args.x, args.y)){ args.x, args.y)){
@ -138,7 +138,7 @@ void SurfaceManagerGui::mousePressed(ofMouseEventArgs & args){
CircleJoint * hitJoint = CircleJoint * hitJoint =
projectionEditor.hitTestJoints(ofVec2f(args.x, args.y)); projectionEditor.hitTestJoints(ofVec2f(args.x, args.y));
if(hitJoint != NULL){ if(hitJoint != 0){
projectionEditor.unselectAllJoints(); projectionEditor.unselectAllJoints();
hitJoint->select(); hitJoint->select();
hitJoint->startDrag(); hitJoint->startDrag();
@ -176,7 +176,7 @@ void SurfaceManagerGui::mousePressed(ofMouseEventArgs & args){
} }
} }
if(bSurfaceSelected && hitJoint == NULL){ if(bSurfaceSelected && hitJoint == 0){
// if not hitting the joints, start drag only if // if not hitting the joints, start drag only if
// we have a selected surface // we have a selected surface
@ -287,7 +287,7 @@ int SurfaceManagerGui::getMode(){
} }
void SurfaceManagerGui::drawSelectedSurfaceHighlight(){ void SurfaceManagerGui::drawSelectedSurfaceHighlight(){
if(surfaceManager->getSelectedSurface() == NULL){ if(surfaceManager->getSelectedSurface() == 0){
return; return;
} }
ofPolyline line = surfaceManager->getSelectedSurface()->getHitArea(); ofPolyline line = surfaceManager->getSelectedSurface()->getHitArea();
@ -299,7 +299,7 @@ void SurfaceManagerGui::drawSelectedSurfaceHighlight(){
} }
void SurfaceManagerGui::drawSelectedSurfaceTextureHighlight(){ void SurfaceManagerGui::drawSelectedSurfaceTextureHighlight(){
if(surfaceManager->getSelectedSurface() == NULL){ if(surfaceManager->getSelectedSurface() == 0){
return; return;
} }
ofPolyline line = surfaceManager->getSelectedSurface()->getTextureHitArea(); ofPolyline line = surfaceManager->getSelectedSurface()->getTextureHitArea();

2
src/Surfaces/TriangleSurface.cpp

@ -43,7 +43,7 @@ void TriangleSurface::setup(ofVec2f p1, ofVec2f p2, ofVec2f p3, ofVec2f t1,
} }
void TriangleSurface::draw(){ void TriangleSurface::draw(){
if(source->getTexture() == NULL){ if(source->getTexture() == 0){
ofLogWarning("TriangleSurface") << "Source texture is empty. Not drawing."; ofLogWarning("TriangleSurface") << "Source texture is empty. Not drawing.";
return; return;
} }

20
src/UserInterface/ProjectionEditor.cpp

@ -4,7 +4,7 @@ namespace ofx {
namespace piMapper { namespace piMapper {
ProjectionEditor::ProjectionEditor(){ ProjectionEditor::ProjectionEditor(){
surfaceManager = NULL; surfaceManager = 0;
bShiftKeyDown = false; bShiftKeyDown = false;
fSnapDistance = 10.0f; fSnapDistance = 10.0f;
enable(); enable();
@ -12,7 +12,7 @@ ProjectionEditor::ProjectionEditor(){
ProjectionEditor::~ProjectionEditor(){ ProjectionEditor::~ProjectionEditor(){
clearJoints(); clearJoints();
surfaceManager = NULL; surfaceManager = 0;
disable(); disable();
} }
@ -63,7 +63,7 @@ void ProjectionEditor::update(ofEventArgs & args){
// update surface if one of the joints is being dragged // update surface if one of the joints is being dragged
for(int i = 0; i < joints.size(); i++){ for(int i = 0; i < joints.size(); i++){
if(joints[i]->isDragged() || joints[i]->isSelected()){ if(joints[i]->isDragged() || joints[i]->isSelected()){
if(surfaceManager->getSelectedSurface() != NULL){ if(surfaceManager->getSelectedSurface() != 0){
// update vertex to new location // update vertex to new location
surfaceManager->getSelectedSurface()->setVertex(i, joints[i]->position); surfaceManager->getSelectedSurface()->setVertex(i, joints[i]->position);
}else{ }else{
@ -78,10 +78,10 @@ void ProjectionEditor::update(ofEventArgs & args){
} }
void ProjectionEditor::draw(){ void ProjectionEditor::draw(){
if(surfaceManager == NULL){ if(surfaceManager == 0){
return; return;
} }
if(surfaceManager->getSelectedSurface() == NULL){ if(surfaceManager->getSelectedSurface() == 0){
return; return;
} }
if(joints.size() <= 0){ if(joints.size() <= 0){
@ -185,12 +185,12 @@ void ProjectionEditor::clearJoints(){
} }
void ProjectionEditor::createJoints(){ void ProjectionEditor::createJoints(){
if(surfaceManager == NULL){ if(surfaceManager == 0){
return; return;
} }
clearJoints(); clearJoints();
if(surfaceManager->getSelectedSurface() == NULL){ if(surfaceManager->getSelectedSurface() == 0){
ofLog(OF_LOG_WARNING, "Trying to create joints while no surface selected."); ofLog(OF_LOG_WARNING, "Trying to create joints while no surface selected.");
return; return;
} }
@ -222,10 +222,10 @@ void ProjectionEditor::unselectAllJoints(){
} }
void ProjectionEditor::moveSelectedSurface(ofVec2f by){ void ProjectionEditor::moveSelectedSurface(ofVec2f by){
if(surfaceManager == NULL){ if(surfaceManager == 0){
return; return;
} }
if(surfaceManager->getSelectedSurface() == NULL){ if(surfaceManager->getSelectedSurface() == 0){
return; return;
} }
surfaceManager->getSelectedSurface()->moveBy(by); surfaceManager->getSelectedSurface()->moveBy(by);
@ -272,7 +272,7 @@ CircleJoint * ProjectionEditor::hitTestJoints(ofVec2f pos){
return joints[i]; return joints[i];
} }
} }
return NULL; return 0;
} }
vector <CircleJoint *> * ProjectionEditor::getJoints(){ vector <CircleJoint *> * ProjectionEditor::getJoints(){

24
src/UserInterface/SourcesEditor.cpp

@ -13,7 +13,7 @@ SourcesEditor::SourcesEditor(){
} }
void SourcesEditor::init(){ void SourcesEditor::init(){
mediaServer = NULL; // Pointers to NULL pointer so we can check later mediaServer = 0; // Pointers to 0 pointer so we can check later
isMediaServerExternal = false; isMediaServerExternal = false;
registerAppEvents(); registerAppEvents();
} }
@ -90,7 +90,7 @@ void SourcesEditor::setup(ofEventArgs & args){
void SourcesEditor::draw(){ void SourcesEditor::draw(){
// Don't draw if there is no source selected // Don't draw if there is no source selected
if(surfaceManager->getSelectedSurface() == NULL){ if(surfaceManager->getSelectedSurface() == 0){
//ofLogNotice("SourcesEditor") << "No surface selected"; //ofLogNotice("SourcesEditor") << "No surface selected";
return; return;
} }
@ -120,7 +120,7 @@ void SourcesEditor::disable(){
void SourcesEditor::enable(){ void SourcesEditor::enable(){
// Don't enable if there is no surface selected // Don't enable if there is no surface selected
if(surfaceManager->getSelectedSurface() == NULL){ if(surfaceManager->getSelectedSurface() == 0){
ofLogNotice("SourcesEditor") << "No surface selected. Not enabling and not showing source list."; ofLogNotice("SourcesEditor") << "No surface selected. Not enabling and not showing source list.";
return; return;
} }
@ -154,9 +154,9 @@ void SourcesEditor::setCmdManager(CmdManager * cmdManager){
void SourcesEditor::setMediaServer(MediaServer * newMediaServer){ void SourcesEditor::setMediaServer(MediaServer * newMediaServer){
// If the new media server is not valid // If the new media server is not valid
if(newMediaServer == NULL){ if(newMediaServer == 0){
// Log an error and return from the routine // Log an error and return from the routine
ofLogFatalError("SourcesEditor") << "New media server is NULL"; ofLogFatalError("SourcesEditor") << "New media server is 0";
std::exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
} }
// Attempt to clear existing media server and assign new one // Attempt to clear existing media server and assign new one
@ -204,7 +204,7 @@ void SourcesEditor::selectSourceRadioButton(std::string & sourcePath){
void SourcesEditor::addMediaServerListeners(){ void SourcesEditor::addMediaServerListeners(){
// Check if the media server is valid // Check if the media server is valid
if(mediaServer == NULL){ if(mediaServer == 0){
ofLogError("SourcesEditor::addMediaServerListeners", "Media server not set"); ofLogError("SourcesEditor::addMediaServerListeners", "Media server not set");
return; return;
} }
@ -225,7 +225,7 @@ void SourcesEditor::addMediaServerListeners(){
void SourcesEditor::removeMediaServerListeners(){ void SourcesEditor::removeMediaServerListeners(){
// Check if the media server is valid // Check if the media server is valid
if(mediaServer == NULL){ if(mediaServer == 0){
ofLogError("SourcesEditor::addMediaServerListeners", "Media server not set"); ofLogError("SourcesEditor::addMediaServerListeners", "Media server not set");
return; return;
} }
@ -255,7 +255,7 @@ void SourcesEditor::setImageSource(string & imagePath){
fboSelector->unselectAll(); fboSelector->unselectAll();
BaseSurface * surface = surfaceManager->getSelectedSurface(); BaseSurface * surface = surfaceManager->getSelectedSurface();
if(surface == NULL){ if(surface == 0){
ofLogWarning("SourcesEditor") << "No surface selected"; ofLogWarning("SourcesEditor") << "No surface selected";
return; return;
} }
@ -285,7 +285,7 @@ void SourcesEditor::setVideoSource(string & videoPath){
imageSelector->unselectAll(); imageSelector->unselectAll();
BaseSurface * surface = surfaceManager->getSelectedSurface(); BaseSurface * surface = surfaceManager->getSelectedSurface();
if(surface == NULL){ if(surface == 0){
ofLogWarning("SourcesEditor") << "No surface selected"; ofLogWarning("SourcesEditor") << "No surface selected";
return; return;
} }
@ -315,7 +315,7 @@ void SourcesEditor::setFboSource(string & fboName){
// Get selected surface // Get selected surface
BaseSurface * surface = surfaceManager->getSelectedSurface(); BaseSurface * surface = surfaceManager->getSelectedSurface();
if(surface == NULL){ if(surface == 0){
ofLogWarning("SourcesEditor") << "No surface selected"; ofLogWarning("SourcesEditor") << "No surface selected";
return; return;
} }
@ -352,9 +352,9 @@ void SourcesEditor::clearMediaServer(){
if(!isMediaServerExternal){ if(!isMediaServerExternal){
// Clear all loaded sources // Clear all loaded sources
mediaServer->clear(); mediaServer->clear();
// Destroy the pointer and set it to NULL pointer // Destroy the pointer and set it to 0 pointer
delete mediaServer; delete mediaServer;
mediaServer = NULL; mediaServer = 0;
} }
} }

12
src/UserInterface/TextureEditor.cpp

@ -43,7 +43,7 @@ void TextureEditor::disable(){
} }
void TextureEditor::update(ofEventArgs & args){ void TextureEditor::update(ofEventArgs & args){
if(surface == NULL){ if(surface == 0){
return; return;
} }
@ -121,7 +121,7 @@ void TextureEditor::keyReleased(ofKeyEventArgs & args){
} }
void TextureEditor::draw(){ void TextureEditor::draw(){
if(surface == NULL){ if(surface == 0){
return; return;
} }
@ -142,12 +142,12 @@ void TextureEditor::setSurface(BaseSurface * newSurface){
} }
void TextureEditor::clear(){ void TextureEditor::clear(){
surface = NULL; surface = 0;
clearJoints(); clearJoints();
} }
void TextureEditor::createJoints(){ void TextureEditor::createJoints(){
if(surface == NULL){ if(surface == 0){
return; return;
} }
clearJoints(); clearJoints();
@ -175,7 +175,7 @@ void TextureEditor::unselectAllJoints(){
} }
void TextureEditor::moveTexCoords(ofVec2f by){ void TextureEditor::moveTexCoords(ofVec2f by){
if(surface == NULL){ if(surface == 0){
return; return;
} }
vector <ofVec2f> & texCoords = surface->getTexCoords(); vector <ofVec2f> & texCoords = surface->getTexCoords();
@ -246,7 +246,7 @@ CircleJoint * TextureEditor::hitTestJoints(ofVec2f pos){
return joints[i]; return joints[i];
} }
} }
return NULL; return 0;
} }
vector <CircleJoint *> & TextureEditor::getJoints(){ vector <CircleJoint *> & TextureEditor::getJoints(){

Loading…
Cancel
Save