Commit ed2d178d authored by Martin Nordholts's avatar Martin Nordholts
Browse files

app: Get rid of config -> display module dependency

In order to make a clear separation between the core modules and the
UI modules, move the necessary enums from display-enums.h and
widgets-enums.h to config-enums.h and the files
gimpdisplayoptions.[ch] from the display to the config module. This
removes the config -> display dependency.

This change has three main benefits
 * It lets us remove includes of display files from the config module
 * We don't have to link gimp-console and test-config with a subset of
   object files from the display module
 * It is reflected in devel-docs/gimp-module-dependencies.svg that the
   application is made up of core modules and UI modules and that no
   core module depends on any UI module
parent fda5e405
......@@ -142,9 +142,6 @@ AM_LDFLAGS = \
$(workaround_that_file_depends_on_plug_in)
gimpconsoleldadd = \
display/gimpdisplayoptions.o \
display/display-enums.o \
widgets/widgets-enums.o \
xcf/libappxcf.a \
pdb/libappinternal-procs.a \
pdb/libapppdb.a \
......
......@@ -26,6 +26,7 @@
#include "actions-types.h"
#include "config/gimpdisplayoptions.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
......@@ -39,7 +40,6 @@
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayoptions.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-appearance.h"
#include "display/gimpdisplayshell-scale.h"
......
......@@ -25,6 +25,7 @@
#include "actions-types.h"
#include "config/gimpdisplayoptions.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
......@@ -35,7 +36,6 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplayoptions.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-appearance.h"
#include "display/gimpdisplayshell-filter-dialog.h"
......
......@@ -21,7 +21,8 @@ INCLUDES = \
noinst_LIBRARIES = libappconfig.a
libappconfig_a_SOURCES = \
libappconfig_a_sources = \
config-enums.h \
config-types.h \
gimpconfig-dump.c \
gimpconfig-dump.h \
......@@ -35,6 +36,8 @@ libappconfig_a_SOURCES = \
gimpcoreconfig.h \
gimpdisplayconfig.c \
gimpdisplayconfig.h \
gimpdisplayoptions.c \
gimpdisplayoptions.h \
gimpguiconfig.c \
gimpguiconfig.h \
gimppluginconfig.c \
......@@ -51,6 +54,14 @@ libappconfig_a_SOURCES = \
gimpxmlparser.c \
gimpxmlparser.h
libappconfig_a_built_sources = \
config-enums.c
libappconfig_a_SOURCES = \
$(libappconfig_a_built_sources) \
$(libappconfig_a_sources)
EXTRA_PROGRAMS = test-config
EXTRA_DIST = makefile.msc
......@@ -77,9 +88,6 @@ test_config_LDFLAGS = \
-u $(SYMPREFIX)gimp_image_map_config_get_type
test_config_LDADD = \
../display/gimpdisplayoptions.o \
../display/display-enums.o \
../widgets/widgets-enums.o \
../xcf/libappxcf.a \
../pdb/libappinternal-procs.a \
../pdb/libapppdb.a \
......@@ -107,3 +115,25 @@ test_config_LDADD = \
$(GLIB_LIBS)
CLEANFILES = $(EXTRA_PROGRAMS) foorc
#
# rules to generate built sources
#
# setup autogeneration dependencies
gen_sources = xgen-dec
CLEANFILES += $(gen_sources)
config-enums.c: $(srcdir)/config-enums.h $(GIMP_MKENUMS)
$(GIMP_MKENUMS) \
--fhead "#include \"config.h\"\n#include <glib-object.h>\n#include \"libgimpbase/gimpbase.h\"\n#include \"config-enums.h\"\n#include\"gimp-intl.h\"" \
--fprod "\n/* enumerations from \"@filename@\" */" \
--vhead "GType\n@enum_name@_get_type (void)\n{\n static const G@Type@Value values[] =\n {" \
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n };\n" \
--dhead " static const Gimp@Type@Desc descs[] =\n {" \
--dprod " { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
--dtail " { 0, NULL, NULL }\n };\n\n static GType type = 0;\n\n if (G_UNLIKELY (! type))\n {\n type = g_@type@_register_static (\"@EnumName@\", values);\n gimp_type_set_translation_context (type, \"@enumnick@\");\n gimp_@type@_set_value_descriptions (type, descs);\n }\n\n return type;\n}\n" \
$(srcdir)/config-enums.h > xgen-dec \
&& cp xgen-dec $(@F) \
&& rm -f xgen-dec
/* Generated data (by gimp-mkenums) */
#include "config.h"
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "config-enums.h"
#include"gimp-intl.h"
/* enumerations from "./config-enums.h" */
GType
gimp_cursor_mode_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_CURSOR_MODE_TOOL_ICON, "GIMP_CURSOR_MODE_TOOL_ICON", "tool-icon" },
{ GIMP_CURSOR_MODE_TOOL_CROSSHAIR, "GIMP_CURSOR_MODE_TOOL_CROSSHAIR", "tool-crosshair" },
{ GIMP_CURSOR_MODE_CROSSHAIR, "GIMP_CURSOR_MODE_CROSSHAIR", "crosshair" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_CURSOR_MODE_TOOL_ICON, NC_("cursor-mode", "Tool icon"), NULL },
{ GIMP_CURSOR_MODE_TOOL_CROSSHAIR, NC_("cursor-mode", "Tool icon with crosshair"), NULL },
{ GIMP_CURSOR_MODE_CROSSHAIR, NC_("cursor-mode", "Crosshair only"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpCursorMode", values);
gimp_type_set_translation_context (type, "cursor-mode");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_canvas_padding_mode_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_CANVAS_PADDING_MODE_DEFAULT, "GIMP_CANVAS_PADDING_MODE_DEFAULT", "default" },
{ GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, "GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK", "light-check" },
{ GIMP_CANVAS_PADDING_MODE_DARK_CHECK, "GIMP_CANVAS_PADDING_MODE_DARK_CHECK", "dark-check" },
{ GIMP_CANVAS_PADDING_MODE_CUSTOM, "GIMP_CANVAS_PADDING_MODE_CUSTOM", "custom" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_CANVAS_PADDING_MODE_DEFAULT, NC_("canvas-padding-mode", "From theme"), NULL },
{ GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, NC_("canvas-padding-mode", "Light check color"), NULL },
{ GIMP_CANVAS_PADDING_MODE_DARK_CHECK, NC_("canvas-padding-mode", "Dark check color"), NULL },
{ GIMP_CANVAS_PADDING_MODE_CUSTOM, NC_("canvas-padding-mode", "Custom color"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpCanvasPaddingMode", values);
gimp_type_set_translation_context (type, "canvas-padding-mode");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_space_bar_action_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_SPACE_BAR_ACTION_NONE, "GIMP_SPACE_BAR_ACTION_NONE", "none" },
{ GIMP_SPACE_BAR_ACTION_PAN, "GIMP_SPACE_BAR_ACTION_PAN", "pan" },
{ GIMP_SPACE_BAR_ACTION_MOVE, "GIMP_SPACE_BAR_ACTION_MOVE", "move" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_SPACE_BAR_ACTION_NONE, NC_("space-bar-action", "No action"), NULL },
{ GIMP_SPACE_BAR_ACTION_PAN, NC_("space-bar-action", "Pan view"), NULL },
{ GIMP_SPACE_BAR_ACTION_MOVE, NC_("space-bar-action", "Switch to Move tool"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpSpaceBarAction", values);
gimp_type_set_translation_context (type, "space-bar-action");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_zoom_quality_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_ZOOM_QUALITY_LOW, "GIMP_ZOOM_QUALITY_LOW", "low" },
{ GIMP_ZOOM_QUALITY_HIGH, "GIMP_ZOOM_QUALITY_HIGH", "high" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_ZOOM_QUALITY_LOW, NC_("zoom-quality", "Low"), NULL },
{ GIMP_ZOOM_QUALITY_HIGH, NC_("zoom-quality", "High"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpZoomQuality", values);
gimp_type_set_translation_context (type, "zoom-quality");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_help_browser_type_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_HELP_BROWSER_GIMP, "GIMP_HELP_BROWSER_GIMP", "gimp" },
{ GIMP_HELP_BROWSER_WEB_BROWSER, "GIMP_HELP_BROWSER_WEB_BROWSER", "web-browser" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_HELP_BROWSER_GIMP, NC_("help-browser-type", "GIMP help browser"), NULL },
{ GIMP_HELP_BROWSER_WEB_BROWSER, NC_("help-browser-type", "Web browser"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpHelpBrowserType", values);
gimp_type_set_translation_context (type, "help-browser-type");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_window_hint_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_WINDOW_HINT_NORMAL, "GIMP_WINDOW_HINT_NORMAL", "normal" },
{ GIMP_WINDOW_HINT_UTILITY, "GIMP_WINDOW_HINT_UTILITY", "utility" },
{ GIMP_WINDOW_HINT_KEEP_ABOVE, "GIMP_WINDOW_HINT_KEEP_ABOVE", "keep-above" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_WINDOW_HINT_NORMAL, NC_("window-hint", "Normal window"), NULL },
{ GIMP_WINDOW_HINT_UTILITY, NC_("window-hint", "Utility window"), NULL },
{ GIMP_WINDOW_HINT_KEEP_ABOVE, NC_("window-hint", "Keep above"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpWindowHint", values);
gimp_type_set_translation_context (type, "window-hint");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_cursor_format_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_CURSOR_FORMAT_BITMAP, "GIMP_CURSOR_FORMAT_BITMAP", "bitmap" },
{ GIMP_CURSOR_FORMAT_PIXBUF, "GIMP_CURSOR_FORMAT_PIXBUF", "pixbuf" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_CURSOR_FORMAT_BITMAP, NC_("cursor-format", "Black & white"), NULL },
{ GIMP_CURSOR_FORMAT_PIXBUF, NC_("cursor-format", "Fancy"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpCursorFormat", values);
gimp_type_set_translation_context (type, "cursor-format");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
/* Generated data ends here */
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CONFIG_ENUMS_H__
#define __CONFIG_ENUMS_H__
#define GIMP_TYPE_CURSOR_MODE (gimp_cursor_mode_get_type ())
GType gimp_cursor_mode_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_CURSOR_MODE_TOOL_ICON, /*< desc="Tool icon" >*/
GIMP_CURSOR_MODE_TOOL_CROSSHAIR, /*< desc="Tool icon with crosshair" >*/
GIMP_CURSOR_MODE_CROSSHAIR /*< desc="Crosshair only" >*/
} GimpCursorMode;
#define GIMP_TYPE_CANVAS_PADDING_MODE (gimp_canvas_padding_mode_get_type ())
GType gimp_canvas_padding_mode_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_CANVAS_PADDING_MODE_DEFAULT, /*< desc="From theme" >*/
GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, /*< desc="Light check color" >*/
GIMP_CANVAS_PADDING_MODE_DARK_CHECK, /*< desc="Dark check color" >*/
GIMP_CANVAS_PADDING_MODE_CUSTOM, /*< desc="Custom color" >*/
GIMP_CANVAS_PADDING_MODE_RESET = -1 /*< skip >*/
} GimpCanvasPaddingMode;
#define GIMP_TYPE_SPACE_BAR_ACTION (gimp_space_bar_action_get_type ())
GType gimp_space_bar_action_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_SPACE_BAR_ACTION_NONE, /*< desc="No action" >*/
GIMP_SPACE_BAR_ACTION_PAN, /*< desc="Pan view" >*/
GIMP_SPACE_BAR_ACTION_MOVE /*< desc="Switch to Move tool" >*/
} GimpSpaceBarAction;
#define GIMP_TYPE_ZOOM_QUALITY (gimp_zoom_quality_get_type ())
GType gimp_zoom_quality_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_ZOOM_QUALITY_LOW, /*< desc="Low" >*/
GIMP_ZOOM_QUALITY_HIGH /*< desc="High" >*/
} GimpZoomQuality;
#define GIMP_TYPE_HELP_BROWSER_TYPE (gimp_help_browser_type_get_type ())
GType gimp_help_browser_type_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_HELP_BROWSER_GIMP, /*< desc="GIMP help browser" >*/
GIMP_HELP_BROWSER_WEB_BROWSER /*< desc="Web browser" >*/
} GimpHelpBrowserType;
#define GIMP_TYPE_WINDOW_HINT (gimp_window_hint_get_type ())
GType gimp_window_hint_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_WINDOW_HINT_NORMAL, /*< desc="Normal window" >*/
GIMP_WINDOW_HINT_UTILITY, /*< desc="Utility window" >*/
GIMP_WINDOW_HINT_KEEP_ABOVE /*< desc="Keep above" >*/
} GimpWindowHint;
#define GIMP_TYPE_CURSOR_FORMAT (gimp_cursor_format_get_type ())
GType gimp_cursor_format_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_CURSOR_FORMAT_BITMAP, /*< desc="Black & white" >*/
GIMP_CURSOR_FORMAT_PIXBUF /*< desc="Fancy" >*/
} GimpCursorFormat;
#endif /* __CONFIG_ENUMS_H__ */
......@@ -24,6 +24,12 @@
#include "libgimpconfig/gimpconfigtypes.h"
#include "config/config-enums.h"
#define GIMP_OPACITY_TRANSPARENT 0.0
#define GIMP_OPACITY_OPAQUE 1.0
typedef struct _GimpBaseConfig GimpBaseConfig;
typedef struct _GimpCoreConfig GimpCoreConfig;
......@@ -34,7 +40,6 @@ typedef struct _GimpRc GimpRc;
typedef struct _GimpXmlParser GimpXmlParser;
/* should be in display/display-types.h */
typedef struct _GimpDisplayOptions GimpDisplayOptions;
/* should be in core/core-types.h */
......
......@@ -28,16 +28,9 @@
#include "config-types.h"
/* FIXME: If we can get rid of this dependency to the display module,
* we will greatly improve the module dependencies in the core, see
* devel-docs/gimp-module-dependencies.svg. In particular, we will get
* rid of the (transitive) dependency from the core to the UI code
*/
#include "display/display-enums.h"
#include "display/gimpdisplayoptions.h"
#include "gimprc-blurbs.h"
#include "gimpdisplayconfig.h"
#include "gimpdisplayoptions.h"
#include "gimp-intl.h"
......
......@@ -21,8 +21,6 @@
#ifndef __GIMP_DISPLAY_CONFIG_H__
#define __GIMP_DISPLAY_CONFIG_H__
#include "display/display-enums.h"
#include "config/gimpcoreconfig.h"
......
......@@ -27,10 +27,9 @@
#include "libgimpcolor/gimpcolor.h"
#include "libgimpconfig/gimpconfig.h"
#include "core/core-types.h"
#include "display-enums.h"
#include "config-types.h"
#include "config/gimprc-blurbs.h"
#include "gimprc-blurbs.h"
#include "gimpdisplayoptions.h"
......
......@@ -21,8 +21,6 @@
#ifndef __GIMP_GUI_CONFIG_H__
#define __GIMP_GUI_CONFIG_H__
#include "widgets/widgets-enums.h"
#include "config/gimpdisplayconfig.h"
......
......@@ -21,8 +21,6 @@
#ifndef __GIMP_PLUGIN_CONFIG_H__
#define __GIMP_PLUGIN_CONFIG_H__
#include "widgets/widgets-enums.h"
#include "config/gimpguiconfig.h"
......
......@@ -29,9 +29,6 @@
/* defines */
#define GIMP_OPACITY_TRANSPARENT 0.0
#define GIMP_OPACITY_OPAQUE 1.0
#define GIMP_COORDS_MIN_PRESSURE 0.0
#define GIMP_COORDS_MAX_PRESSURE 1.0
#define GIMP_COORDS_DEFAULT_PRESSURE 1.0
......
......@@ -23,8 +23,6 @@ libappdisplay_a_sources = \
gimpcursorview.h \
gimpdisplay.c \
gimpdisplay.h \
gimpdisplayoptions.c \
gimpdisplayoptions.h \
gimpdisplay-foreach.c \
gimpdisplay-foreach.h \
gimpdisplay-handlers.c \
......
......@@ -8,37 +8,6 @@
#include"gimp-intl.h"
/* enumerations from "./display-enums.h" */
GType
gimp_cursor_mode_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_CURSOR_MODE_TOOL_ICON, "GIMP_CURSOR_MODE_TOOL_ICON", "tool-icon" },
{ GIMP_CURSOR_MODE_TOOL_CROSSHAIR, "GIMP_CURSOR_MODE_TOOL_CROSSHAIR", "tool-crosshair" },
{ GIMP_CURSOR_MODE_CROSSHAIR, "GIMP_CURSOR_MODE_CROSSHAIR", "crosshair" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_CURSOR_MODE_TOOL_ICON, NC_("cursor-mode", "Tool icon"), NULL },
{ GIMP_CURSOR_MODE_TOOL_CROSSHAIR, NC_("cursor-mode", "Tool icon with crosshair"), NULL },
{ GIMP_CURSOR_MODE_CROSSHAIR, NC_("cursor-mode", "Crosshair only"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpCursorMode", values);
gimp_type_set_translation_context (type, "cursor-mode");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_cursor_precision_get_type (void)
{
......@@ -70,99 +39,6 @@ gimp_cursor_precision_get_type (void)
return type;
}
GType
gimp_canvas_padding_mode_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_CANVAS_PADDING_MODE_DEFAULT, "GIMP_CANVAS_PADDING_MODE_DEFAULT", "default" },
{ GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, "GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK", "light-check" },
{ GIMP_CANVAS_PADDING_MODE_DARK_CHECK, "GIMP_CANVAS_PADDING_MODE_DARK_CHECK", "dark-check" },
{ GIMP_CANVAS_PADDING_MODE_CUSTOM, "GIMP_CANVAS_PADDING_MODE_CUSTOM", "custom" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_CANVAS_PADDING_MODE_DEFAULT, NC_("canvas-padding-mode", "From theme"), NULL },
{ GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK, NC_("canvas-padding-mode", "Light check color"), NULL },
{ GIMP_CANVAS_PADDING_MODE_DARK_CHECK, NC_("canvas-padding-mode", "Dark check color"), NULL },
{ GIMP_CANVAS_PADDING_MODE_CUSTOM, NC_("canvas-padding-mode", "Custom color"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpCanvasPaddingMode", values);
gimp_type_set_translation_context (type, "canvas-padding-mode");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_space_bar_action_get_type (void)