diff options
| author | Ted Gould <ted@gould.cx> | 2008-11-21 05:24:08 +0000 |
|---|---|---|
| committer | Ted Gould <ted@canonical.com> | 2008-11-21 05:24:08 +0000 |
| commit | 44a3a78fb6a3863c0c7f3c1193837337e68a67e4 (patch) | |
| tree | 1722ee5ec6f88c881cd4124923354b3c1311501b /src/dialogs/debugdialog.cpp | |
| parent | Merge from trunk (diff) | |
| download | inkscape-44a3a78fb6a3863c0c7f3c1193837337e68a67e4.tar.gz inkscape-44a3a78fb6a3863c0c7f3c1193837337e68a67e4.zip | |
Merge from fe-moved
(bzr r6891)
Diffstat (limited to '')
| -rw-r--r-- | src/ui/dialog/debug.cpp (renamed from src/dialogs/debugdialog.cpp) | 192 |
1 files changed, 48 insertions, 144 deletions
diff --git a/src/dialogs/debugdialog.cpp b/src/ui/dialog/debug.cpp index 42bf96050..b40796627 100644 --- a/src/dialogs/debugdialog.cpp +++ b/src/ui/dialog/debug.cpp @@ -1,14 +1,11 @@ -/* - * A very simple dialog for displaying Inkscape messages. Messages - * sent to g_log(), g_warning(), g_message(), ets, are routed here, - * in order to avoid messing with the startup console. - * - * Authors: +/** @file + * @brief 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 @@ -23,78 +20,32 @@ #include <gtkmm/menubar.h> #include <gtkmm/scrolledwindow.h> -#include "debugdialog.h" +#include "debug.h" namespace Inkscape { namespace UI { -namespace Dialogs { - - -//######################################################################### -//## I M P L E M E N T A T I O N -//######################################################################### +namespace Dialog { /** - * A dialog that displays log messages + * @brief A very simple dialog for displaying Inkscape messages - implementation */ class DebugDialogImpl : public DebugDialog, public Gtk::Dialog { - - public: - - - /** - * Constructor - */ +public: DebugDialogImpl(); - - /** - * Destructor - */ ~DebugDialogImpl(); - - /** - * Show the dialog - */ void show(); - - /** - * Do not show the dialog - */ void hide(); - - /** - * Clear all information from the dialog - */ void clear(); - - /** - * Display a message - */ void message(char const *msg); - - /** - * Redirect g_log() messages to this widget - */ void captureLogMessages(); - - /** - * Return g_log() messages to normal handling - */ void releaseLogMessages(); - - - private: - - +private: Gtk::MenuBar menuBar; - Gtk::Menu fileMenu; - Gtk::ScrolledWindow textScroll; - Gtk::TextView messageText; //Handler ID's @@ -104,32 +55,14 @@ class DebugDialogImpl : public DebugDialog, public Gtk::Dialog guint handlerPangomm; guint handlerGdkmm; guint handlerGtkmm; - }; - - - -//######################################################################### -//## E V E N T S -//######################################################################### - -/** - * Also a public method. Remove all text from the dialog - */ void DebugDialogImpl::clear() { Glib::RefPtr<Gtk::TextBuffer> buffer = messageText.get_buffer(); buffer->erase(buffer->begin(), buffer->end()); } - -//######################################################################### -//## C O N S T R U C T O R / D E S T R U C T O R -//######################################################################### -/** - * Constructor - */ DebugDialogImpl::DebugDialogImpl() { set_title(_("Messages")); @@ -168,30 +101,17 @@ DebugDialogImpl::DebugDialogImpl() handlerGtkmm = 0; } -/** - * Factory method. Use this to create a new DebugDialog - */ + DebugDialog *DebugDialog::create() { DebugDialog *dialog = new DebugDialogImpl(); return dialog; } - -/** - * Constructor - */ DebugDialogImpl::~DebugDialogImpl() { - - } - -//######################################################################### -//## M E T H O D S -//######################################################################### - void DebugDialogImpl::show() { //call super() @@ -201,16 +121,12 @@ void DebugDialogImpl::show() Gtk::Dialog::present(); } - - void DebugDialogImpl::hide() { - //call super() + // call super Gtk::Dialog::hide(); } - - void DebugDialogImpl::message(char const *msg) { Glib::RefPtr<Gtk::TextBuffer> buffer = messageText.get_buffer(); @@ -220,16 +136,14 @@ void DebugDialogImpl::message(char const *msg) buffer->insert (buffer->end(), uMsg); } - /* static instance, to reduce dependencies */ static DebugDialog *debugDialogInstance = NULL; DebugDialog *DebugDialog::getInstance() { - if ( !debugDialogInstance ) - { + if (!debugDialogInstance) { debugDialogInstance = new DebugDialogImpl(); - } + } return debugDialogInstance; } @@ -251,9 +165,7 @@ void dialogLoggingFunction(const gchar */*log_domain*/, gpointer user_data) { DebugDialogImpl *dlg = (DebugDialogImpl *)user_data; - dlg->message(messageText); - } @@ -263,74 +175,62 @@ void DebugDialogImpl::captureLogMessages() This might likely need more code, to capture Gtkmm and Glibmm warnings, or maybe just simply grab stdout/stderr */ - GLogLevelFlags flags = (GLogLevelFlags) (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | + GLogLevelFlags flags = (GLogLevelFlags) (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG); - if ( !handlerDefault ) - { + if ( !handlerDefault ) { handlerDefault = g_log_set_handler(NULL, flags, dialogLoggingFunction, (gpointer)this); - } - if ( !handlerGlibmm ) - { + } + if ( !handlerGlibmm ) { handlerGlibmm = g_log_set_handler("glibmm", flags, dialogLoggingFunction, (gpointer)this); - } - if ( !handlerAtkmm ) - { + } + if ( !handlerAtkmm ) { handlerAtkmm = g_log_set_handler("atkmm", flags, dialogLoggingFunction, (gpointer)this); - } - if ( !handlerPangomm ) - { + } + if ( !handlerPangomm ) { handlerPangomm = g_log_set_handler("pangomm", flags, dialogLoggingFunction, (gpointer)this); - } - if ( !handlerGdkmm ) - { + } + if ( !handlerGdkmm ) { handlerGdkmm = g_log_set_handler("gdkmm", flags, dialogLoggingFunction, (gpointer)this); - } - if ( !handlerGtkmm ) - { + } + if ( !handlerGtkmm ) { handlerGtkmm = g_log_set_handler("gtkmm", flags, dialogLoggingFunction, (gpointer)this); - } + } message("log capture started"); } void DebugDialogImpl::releaseLogMessages() { - if ( handlerDefault ) - { + if ( handlerDefault ) { g_log_remove_handler(NULL, handlerDefault); handlerDefault = 0; - } - if ( handlerGlibmm ) - { + } + if ( handlerGlibmm ) { g_log_remove_handler("glibmm", handlerGlibmm); handlerGlibmm = 0; - } - if ( handlerAtkmm ) - { + } + if ( handlerAtkmm ) { g_log_remove_handler("atkmm", handlerAtkmm); handlerAtkmm = 0; - } - if ( handlerPangomm ) - { + } + if ( handlerPangomm ) { g_log_remove_handler("pangomm", handlerPangomm); handlerPangomm = 0; - } - if ( handlerGdkmm ) - { + } + if ( handlerGdkmm ) { g_log_remove_handler("gdkmm", handlerGdkmm); handlerGdkmm = 0; - } - if ( handlerGtkmm ) - { + } + if ( handlerGtkmm ) { g_log_remove_handler("gtkmm", handlerGtkmm); handlerGtkmm = 0; - } + } message("log capture discontinued"); } @@ -340,9 +240,13 @@ void DebugDialogImpl::releaseLogMessages() } //namespace UI } //namespace Inkscape -//######################################################################### -//## E N D O F F I L E -//######################################################################### - - - +/* + 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:encoding=utf-8:textwidth=99 : |
