index e5d326efe9a87e1c051bbc5beb0ab056138ad1d0..17215ac00a772f5e45be5d7111111a6218780a00 100644 (file)
#include "ui/dialog/transformation.h"
#include "ui/dialog/undo-history.h"
#include "ui/dialog/xml-editor.h"
+#include "ui/dialog/panel-dialog.h"
#include "dialogs/layers-panel.h"
#include "dialogs/tiledialog.h"
namespace {
+using namespace Behavior;
+
template <typename T, typename B>
-inline Dialog *create() { return T::create(&B::create); }
+inline Dialog *create() { return PanelDialog<B>::template create<T>(); }
}
registerFactory("Memory", &create<Memory, FloatingBehavior>);
registerFactory("Messages", &create<Messages, FloatingBehavior>);
registerFactory("Script", &create<ScriptDialog, FloatingBehavior>);
+ registerFactory("Swatches", &create<SwatchesPanel, FloatingBehavior>);
registerFactory("TextProperties", &create<TextProperties, FloatingBehavior>);
registerFactory("TileDialog", &create<TileDialog, FloatingBehavior>);
registerFactory("Trace", &create<TraceDialog, FloatingBehavior>);
registerFactory("Memory", &create<Memory, DockBehavior>);
registerFactory("Messages", &create<Messages, DockBehavior>);
registerFactory("Script", &create<ScriptDialog, DockBehavior>);
+ registerFactory("Swatches", &create<SwatchesPanel, DockBehavior>);
registerFactory("TextProperties", &create<TextProperties, DockBehavior>);
registerFactory("TileDialog", &create<TileDialog, DockBehavior>);
registerFactory("Trace", &create<TraceDialog, DockBehavior>);
// Appears to cause a segfault if we do
}
+
+DialogManager &DialogManager::getInstance()
+{
+ int dialogs_type = prefs_get_int_attribute_limited ("options.dialogtype", "value", DOCK, 0, 1);
+
+ /* 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.
*/