00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #include "mitkInteractionDebugger.h" 00019 #include <itkMacro.h> 00020 00021 const char* mitk::InteractionDebugger::m_CurrentSender = ""; 00022 bool mitk::InteractionDebugger::m_Active = false; 00023 00024 mitk::InteractionDebugger::InteractionDebugger() 00025 {} 00026 00027 void mitk::InteractionDebugger::Activate() 00028 { 00029 m_Active = true; 00030 } 00031 00032 void mitk::InteractionDebugger::Deactivate() 00033 { 00034 m_Active = false; 00035 } 00036 mitk::InteractionDebugger::~InteractionDebugger() 00037 {} 00038 00039 void mitk::InteractionDebugger::Set(const char* sender, const char* text) 00040 { 00041 if (m_Active) 00042 { 00043 itk::OStringStream itkmsg; 00044 if (! itk::Object::GetGlobalWarningDisplay()) 00045 return; 00046 00047 if (sender != m_CurrentSender) 00048 { 00049 itkmsg << sender <<" :\n"<<text<<"\n"; 00050 m_CurrentSender = sender; 00051 } 00052 else 00053 itkmsg<<text<<"\n"; 00054 00055 itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); 00056 } 00057 } 00058