dialog-manager.cpp revision 7b0f831743ff7831522cb74a29d869dbd845260f
/**
* @file
* Object for managing a set of dialogs, including their signals and
* construction/caching/destruction of them.
*/
/* Authors:
* Bryce W. Harrington <bryce@bryceharrington.org>
* Jon Phillips <jon@rejon.org>
* Gustav Broberg <broberg@kth.se>
*
* Copyright (C) 2004-2007 Authors
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "ui/dialog/dialog-manager.h"
#include "ui/dialog/align-and-distribute.h"
#include "ui/dialog/document-metadata.h"
#include "ui/dialog/document-properties.h"
#include "ui/dialog/extension-editor.h"
#include "ui/dialog/fill-and-stroke.h"
#include "ui/dialog/filter-effects-dialog.h"
#include "ui/dialog/inkscape-preferences.h"
#include "ui/dialog/livepatheffect-editor.h"
#include "ui/dialog/messages.h"
#include "ui/dialog/scriptdialog.h"
#include "ui/dialog/tracedialog.h"
#include "ui/dialog/transformation.h"
#include "ui/dialog/undo-history.h"
#include "ui/dialog/panel-dialog.h"
#include "ui/dialog/icon-preview.h"
#include "ui/dialog/floating-behavior.h"
#include "ui/dialog/dock-behavior.h"
//#include "ui/dialog/print-colors-preview-dialog.h"
#include "util/ege-appear-time-tracker.h"
#include "preferences.h"
#include "ui/dialog/object-attributes.h"
#include "ui/dialog/object-properties.h"
#include "ui/dialog/text-edit.h"
#ifdef ENABLE_SVG_FONTS
#include "ui/dialog/svg-fonts-dialog.h"
#endif // ENABLE_SVG_FONTS
namespace Inkscape {
namespace UI {
namespace Dialog {
namespace {
using namespace Behavior;
template <typename T, typename B>
}
/**
* This class is provided as a container for Inkscape's various
* dialogs. This allows Inkscape::Application to treat the various
* dialogs it invokes, as abstractions.
*
* DialogManager is essentially a cache of dialogs. It lets us
* initialize dialogs lazily - instead of constructing them during
* application startup, they're constructed the first time they're
* actually invoked by Inkscape::Application. The constructed
* dialog is held here after that, so future invokations of the
* dialog don't need to get re-constructed each time. The memory for
* the dialogs are then reclaimed when the DialogManager is destroyed.
*
* In addition, DialogManager also serves as a signal manager for
* dialogs. It provides a set of signals that can be sent to all
* DialogManager ensures that every dialog it handles will listen
* to these signals.
*
*/
using namespace Behavior;
if (dialogs_type == FLOATING) {
// registerFactory("PrintColorsPreviewDialog", &create<PrintColorsPreviewDialog, FloatingBehavior>);
#ifdef ENABLE_SVG_FONTS
#endif
} else {
// registerFactory("PrintColorsPreviewDialog", &create<PrintColorsPreviewDialog, DockBehavior>);
#ifdef ENABLE_SVG_FONTS
#endif
}
}
DialogManager::~DialogManager() {
// TODO: Disconnect the signals
// TODO: Do we need to explicitly delete the dialogs?
// Appears to cause a segfault if we do
}
{
/* Use singleton behavior for floating dialogs */
if (dialogs_type == FLOATING) {
static DialogManager *instance = 0;
if (!instance)
instance = new DialogManager();
return *instance;
}
return *new DialogManager();
}
/**
* Registers a dialog factory function used to create the named dialog.
*/
{
}
/**
* Registers a dialog factory function used to create the named dialog.
*/
{
}
/**
* Fetches the named dialog, creating it if it has not already been
* created (assuming a factory has been registered for it).
*/
}
/**
* Fetches the named dialog, creating it if it has not already been
* created (assuming a factory has been registered for it).
*/
} else {
}
}
return dialog;
}
/**
* Shows the named dialog, creating it if necessary.
*/
}
/**
* Shows the named dialog, creating it if necessary.
*/
GTimer *timer = (wantTiming) ? g_timer_new() : 0; // if needed, must be created/started before getDialog()
if ( dialog ) {
if ( wantTiming ) {
tracker->setAutodelete(true);
timer = 0;
}
}
if ( timer ) {
timer = 0;
}
}
} // namespace Dialog
} // 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 :