debug.cpp revision e99ab6a36fc5743a248eb349f2de61eaaf770518
/**
* @file
* A dialog that displays log messages.
*/
/* Authors:
* Bob Jamison
* Other dudes from The Inkscape Organization
*
* Copyright (C) 2004 The Inkscape Organization
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtkmm/textview.h>
#include <gtkmm/scrolledwindow.h>
#include "debug.h"
namespace Inkscape {
namespace UI {
namespace Dialog {
/**
* A very simple dialog for displaying Inkscape messages - implementation.
*/
{
public:
~DebugDialogImpl();
void show();
void hide();
void clear();
void captureLogMessages();
void releaseLogMessages();
private:
//Handler ID's
};
void DebugDialogImpl::clear()
{
}
{
set_title(_("Messages"));
//## Add a menu for clear()
//### Set up the text widget
messageText.set_editable(false);
message("ready.");
message("enable log display by setting ");
message("dialogs.debug 'redirect' attribute to 1 in preferences.xml");
handlerDefault = 0;
handlerGlibmm = 0;
handlerAtkmm = 0;
handlerPangomm = 0;
handlerGdkmm = 0;
handlerGtkmm = 0;
}
{
return dialog;
}
{
}
void DebugDialogImpl::show()
{
//call super()
//sp_transientize((GtkWidget *)gobj()); //Make transient
raise();
}
void DebugDialogImpl::hide()
{
// call super
}
{
uMsg += '\n';
}
/* static instance, to reduce dependencies */
{
if (!debugDialogInstance) {
debugDialogInstance = new DebugDialogImpl();
}
return debugDialogInstance;
}
void DebugDialog::showInstance()
{
debugDialog->show();
// this is not a real memleak because getInstance() only creates a debug dialog once, and returns that instance for all subsequent calls
// cppcheck-suppress memleak
}
/*##### THIS IS THE IMPORTANT PART ##### */
GLogLevelFlags /*log_level*/,
const gchar *messageText,
{
}
void DebugDialogImpl::captureLogMessages()
{
/*
This might likely need more code, to capture Gtkmm
*/
if ( !handlerDefault ) {
dialogLoggingFunction, (gpointer)this);
}
if ( !handlerGlibmm ) {
dialogLoggingFunction, (gpointer)this);
}
if ( !handlerAtkmm ) {
dialogLoggingFunction, (gpointer)this);
}
if ( !handlerPangomm ) {
dialogLoggingFunction, (gpointer)this);
}
if ( !handlerGdkmm ) {
dialogLoggingFunction, (gpointer)this);
}
if ( !handlerGtkmm ) {
dialogLoggingFunction, (gpointer)this);
}
message("log capture started");
}
void DebugDialogImpl::releaseLogMessages()
{
if ( handlerDefault ) {
handlerDefault = 0;
}
if ( handlerGlibmm ) {
handlerGlibmm = 0;
}
if ( handlerAtkmm ) {
handlerAtkmm = 0;
}
if ( handlerPangomm ) {
handlerPangomm = 0;
}
if ( handlerGdkmm ) {
handlerGdkmm = 0;
}
if ( handlerGtkmm ) {
handlerGtkmm = 0;
}
message("log capture discontinued");
}
} //namespace Dialogs
} //namespace UI
} //namespace Inkscape
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :