Commit 073e533a authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

Finally landed the new GimpConfig based gimprc parser. It's not finished

2002-11-18  Sven Neumann  <sven@gimp.org>

	Finally landed the new GimpConfig based gimprc parser. It's not
	finished yet but we need to start somewhere. This release removes
	the old gimprc.[ch] files. The gimprc format changes slightly, but
	the changes are minimal. The Preferences dialog is temporarily
	disabled since it still needs to be ported. If you are are afraid,
	stay away from CVS for a few days ;-)

	* app/Makefile.am
	* app/gimprc.[ch]: removed the old gimprc system.

	* app/base/Makefile.am
	* app/base/base-config.[ch]: removed these files in favor of
	config/gimpbaseconfig.[ch].

	* app/core/Makefile.am
	* app/core/gimpcoreconfig.[ch]: removed these files in favor of
	config/gimpcoreconfig.[ch].

	* app/config/Makefile.am
	* app/config/config-types.h: moved typedefs into this new file.

	* app/config/gimpbaseconfig.[ch]
	* app/config/gimpcoreconfig.[ch]
	* app/config/gimpdisplayconfig.[ch]
	* app/config/gimpguiconfig.[ch]
	* app/config/gimprc.[ch]
	* app/config/test-config.c: brought into shape for real use.

	* app/base/base-types.h: include config/config-types.h here. Added
	a global GimpBaseConfig *base_config variable to ease migration.

	* app/gui/Makefile.am: temporarily disabled the preferences dialog.

	* app/app_procs.c
	* app/undo.c
	* app/undo_history.c
	* app/base/base.[ch]
	* app/base/gimphistogram.c
	* app/base/pixel-processor.c
	* app/base/temp-buf.c
	* app/base/tile-cache.c
	* app/core/core-types.h
	* app/core/gimp-documents.c
	* app/core/gimp.c
	* app/core/gimpbrush.c
	* app/core/gimpbrushgenerated.c
	* app/core/gimpcontext.c
	* app/core/gimpdrawable-transform.c
	* app/core/gimpimage-new.c
	* app/core/gimpimage.c
	* app/core/gimpimagefile.c
	* app/core/gimpmodules.c
	* app/core/gimppattern.c
	* app/display/Makefile.am
	* app/display/gimpdisplay-handlers.c
	* app/display/gimpdisplay.[ch]
	* app/display/gimpdisplayshell-callbacks.c
	* app/display/gimpdisplayshell-handlers.c
	* app/display/gimpdisplayshell-layer-select.c
	* app/display/gimpdisplayshell-render.c
	* app/display/gimpdisplayshell-scale.c
	* app/display/gimpdisplayshell-scroll.c
	* app/display/gimpdisplayshell-selection.c
	* app/display/gimpdisplayshell.[ch]
	* app/display/gimpnavigationview.c
	* app/file/file-save.c
	* app/gui/device-status-dialog.c
	* app/gui/dialogs-constructors.c
	* app/gui/file-commands.c
	* app/gui/file-new-dialog.c
	* app/gui/file-open-dialog.c
	* app/gui/file-save-dialog.c
	* app/gui/gui.c
	* app/gui/menus.c
	* app/gui/paths-dialog.c
	* app/gui/resize-dialog.c
	* app/gui/session.c
	* app/gui/test-commands.c
	* app/gui/tips-dialog.c
	* app/gui/tips-dialog.h
	* app/gui/user-install-dialog.c
	* app/gui/view-commands.c
	* app/paint/gimppaintcore.c
	* app/plug-in/plug-in.c
	* app/plug-in/plug-ins.c
	* app/tools/gimpbezierselecttool.c
	* app/tools/gimpbucketfilltool.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpfuzzyselecttool.c
	* app/tools/gimpinktool.c
	* app/tools/gimpmagnifytool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimppainttool.c
	* app/tools/gimppathtool.c
	* app/tools/gimptexttool.[ch]
	* app/tools/selection_options.c
	* app/tools/tools.c
	* app/tools/transform_options.c
	* app/widgets/gimphelp.c
	* app/widgets/gimpitemfactory.c
	* app/widgets/gimpselectioneditor.c
	* app/xcf/xcf-load.c
	* tools/pdbgen/pdb/fileops.pdb
	* tools/pdbgen/pdb/gimprc.pdb
	* tools/pdbgen/pdb/image.pdb
	* tools/pdbgen/pdb/layer.pdb
	* tools/pdbgen/pdb/transform_tools.pdb: use the new config system
	instead of the old gimprc stuff.

	* etc/gimprc.in
	* etc/gimprc_user.in: adapted to the new gimprc format. Will update
	the man-page later...

	* app/pdb/fileops_cmds.c
	* app/pdb/gimprc_cmds.c
	* app/pdb/image_cmds.c
	* app/pdb/layer_cmds.c
	* app/pdb/transform_tools_cmds.c
	* libgimp/gimpgimprc_pdb.c: regenerated.
parent 6e5f6a0b
2002-11-18 Sven Neumann <neo@wintermute>
2002-11-18 Sven Neumann <sven@gimp.org>
Finally landed the new GimpConfig based gimprc parser. It's not
finished yet but we need to start somewhere. This release removes
the old gimprc.[ch] files. The gimprc format changes slightly, but
the changes are minimal. The Preferences dialog is temporarily
disabled since it still needs to be ported. If you are are afraid,
stay away from CVS for a few days ;-)
* app/Makefile.am
* app/gimprc.[ch]: removed the old gimprc system.
* app/base/Makefile.am
* app/base/base-config.[ch]: removed these files in favor of
config/gimpbaseconfig.[ch].
* app/core/Makefile.am
* app/core/gimpcoreconfig.[ch]: removed these files in favor of
config/gimpcoreconfig.[ch].
* app/config/Makefile.am
* app/config/config-types.h: moved typedefs into this new file.
* app/config/gimpbaseconfig.[ch]
* app/config/gimpcoreconfig.[ch]
* app/config/gimpdisplayconfig.[ch]
* app/config/gimpguiconfig.[ch]
* app/config/gimprc.[ch]
* app/config/test-config.c: brought into shape for real use.
* app/base/base-types.h: include config/config-types.h here. Added
a global GimpBaseConfig *base_config variable to ease migration.
* app/gui/Makefile.am: temporarily disabled the preferences dialog.
* app/app_procs.c
* app/undo.c
* app/undo_history.c
* app/base/base.[ch]
* app/base/gimphistogram.c
* app/base/pixel-processor.c
* app/base/temp-buf.c
* app/base/tile-cache.c
* app/core/core-types.h
* app/core/gimp-documents.c
* app/core/gimp.c
* app/core/gimpbrush.c
* app/core/gimpbrushgenerated.c
* app/core/gimpcontext.c
* app/core/gimpdrawable-transform.c
* app/core/gimpimage-new.c
* app/core/gimpimage.c
* app/core/gimpimagefile.c
* app/core/gimpmodules.c
* app/core/gimppattern.c
* app/display/Makefile.am
* app/display/gimpdisplay-handlers.c
* app/display/gimpdisplay.[ch]
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-handlers.c
* app/display/gimpdisplayshell-layer-select.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/display/gimpdisplayshell-selection.c
* app/display/gimpdisplayshell.[ch]
* app/display/gimpnavigationview.c
* app/file/file-save.c
* app/gui/device-status-dialog.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.c
* app/gui/file-save-dialog.c
* app/gui/gui.c
* app/gui/menus.c
* app/gui/paths-dialog.c
* app/gui/resize-dialog.c
* app/gui/session.c
* app/gui/test-commands.c
* app/gui/tips-dialog.c
* app/gui/tips-dialog.h
* app/gui/user-install-dialog.c
* app/gui/view-commands.c
* app/paint/gimppaintcore.c
* app/plug-in/plug-in.c
* app/plug-in/plug-ins.c
* app/tools/gimpbezierselecttool.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpcroptool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimpinktool.c
* app/tools/gimpmagnifytool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimppainttool.c
* app/tools/gimppathtool.c
* app/tools/gimptexttool.[ch]
* app/tools/selection_options.c
* app/tools/tools.c
* app/tools/transform_options.c
* app/widgets/gimphelp.c
* app/widgets/gimpitemfactory.c
* app/widgets/gimpselectioneditor.c
* app/xcf/xcf-load.c
* tools/pdbgen/pdb/fileops.pdb
* tools/pdbgen/pdb/gimprc.pdb
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/layer.pdb
* tools/pdbgen/pdb/transform_tools.pdb: use the new config system
instead of the old gimprc stuff.
* etc/gimprc.in
* etc/gimprc_user.in: adapted to the new gimprc format. Will update
the man-page later...
* app/pdb/fileops_cmds.c
* app/pdb/gimprc_cmds.c
* app/pdb/image_cmds.c
* app/pdb/layer_cmds.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpgimprc_pdb.c: regenerated.
2002-11-18 Sven Neumann <sven@gimp.org>
* app/config/gimpconfig-deserialize.c
(gimp_config_deserialize_properties): improved error message for
......
......@@ -33,8 +33,6 @@ gui_sources = \
bye_sources = \
general.c \
general.h \
gimprc.c \
gimprc.h \
ops_buttons.c \
ops_buttons.h \
path.c \
......
......@@ -24,6 +24,8 @@
#include "gui-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
......@@ -44,7 +46,6 @@
#include "file-save-dialog.h"
#include "app_procs.h"
#include "gimprc.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
......@@ -156,7 +157,8 @@ file_save_cmd_callback (GtkWidget *widget,
return;
/* Only save if the gimage has been modified */
if (! gimprc.trust_dirty_flag || gdisp->gimage->dirty != 0)
if (gdisp->gimage->dirty ||
! GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->trust_dirty_flag)
{
const gchar *uri;
......
......@@ -24,6 +24,8 @@
#include "gui-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
......@@ -41,8 +43,6 @@
#include "info-window.h"
#include "view-commands.h"
#include "gimprc.h"
#define return_if_no_display(gdisp, data) \
gdisp = gimp_context_get_display (gimp_get_user_context (GIMP (data))); \
......@@ -112,7 +112,7 @@ view_info_window_cmd_callback (GtkWidget *widget,
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (! gimprc.info_window_follows_mouse)
if (GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->info_window_per_display)
{
if (! shell->info_dialog)
shell->info_dialog = info_window_create (gdisp);
......
......@@ -38,6 +38,8 @@
#include "base/base.h"
#include "config/gimprc.h"
#include "core/gimp.h"
#include "core/gimpdatafactory.h"
#include "core/gimpunits.h"
......@@ -58,7 +60,6 @@
#include "appenv.h"
#include "app_procs.h"
#include "batch.h"
#include "gimprc.h"
#include "undo.h"
#include "libgimp/gimpintl.h"
......@@ -71,6 +72,10 @@ static void app_init_update_status (const gchar *text1,
gdouble percentage);
static void app_exit_finish (void);
/* gimprc debugging code, to be removed */
static void gimprc_notify_callback (GObject *object,
GParamSpec *pspec);
/* global variables */
......@@ -117,20 +122,22 @@ app_init (gint gimp_argc,
}
}
/* The user_install dialog may have parsed unitrc and gimprc, so
* check gimprc_init()'s return value
*/
if (gimprc_init (the_gimp))
{
/* this needs to be done before gimprc loading */
gimp_unitrc_load (the_gimp);
/* this needs to be done before gimprc loading */
gimp_unitrc_load (the_gimp);
/* parse the local GIMP configuration file */
gimprc_parse (the_gimp, alternate_system_gimprc, alternate_gimprc);
}
the_gimp->config = GIMP_CORE_CONFIG (gimp_rc_new ());
/* solely for debugging */
g_signal_connect (G_OBJECT (the_gimp->config), "notify",
G_CALLBACK (gimprc_notify_callback),
NULL);
/* parse the local GIMP configuration file */
/* FIXME: add back support for alternate_system_gimprc and alternate_gimprc */
gimp_rc_load (GIMP_RC (the_gimp->config));
/* initialize lowlevel stuff */
base_init ();
base_init (GIMP_BASE_CONFIG (the_gimp->config));
if (! no_interface)
{
......@@ -269,3 +276,33 @@ app_exit_finish (void)
*/
exit (0);
}
/* gimprc debugging code, to be removed */
static void
gimprc_notify_callback (GObject *object,
GParamSpec *pspec)
{
GString *str;
GValue value = { 0, };
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
g_value_init (&value, pspec->value_type);
g_object_get_property (object, pspec->name, &value);
str = g_string_new (NULL);
if (gimp_config_serialize_value (&value, str, TRUE))
{
g_print (" %s -> %s\n", pspec->name, str->str);
}
else
{
g_print (" %s changed but we failed to serialize its value!\n",
pspec->name);
}
g_string_free (str, TRUE);
g_value_unset (&value);
}
......@@ -14,8 +14,6 @@ libappbase_a_SOURCES = \
base-enums.c \
base-enums.h \
base-types.h \
base-config.c \
base-config.h \
boundary.c \
boundary.h \
brush-scale.c \
......
/* The GIMP -- an 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib-object.h>
#include "base-types.h"
#include "base-config.h"
#ifdef __GNUC__
#define INIT_MEMBER(m,v) .m = v
#else
/* declaration order required ! */
#define INIT_MEMBER(m,v) v
#endif
static GimpBaseConfig static_base_config =
{
INIT_MEMBER(temp_path , NULL),
INIT_MEMBER(swap_path , NULL),
INIT_MEMBER(tile_cache_size , 1 << 25),
INIT_MEMBER(stingy_memory_use, FALSE),
INIT_MEMBER(num_processors , 1)
};
#undef INIT_MEMBER
GimpBaseConfig *base_config = &static_base_config;
......@@ -26,6 +26,8 @@
#include "base/base-enums.h"
#include "config/config-types.h"
/* magic constants */
/* FIXME: Remove magic constants! */
......@@ -41,6 +43,10 @@
#define ALPHA_I_PIX 1
/* global config variable (temporary) */
GimpBaseConfig *base_config;
/* types */
typedef struct _BoundSeg BoundSeg;
......
......@@ -35,10 +35,11 @@
#include "base-types.h"
#include "config/gimpbaseconfig.h"
#include "paint-funcs/paint-funcs.h"
#include "base.h"
#include "base-config.h"
#include "detect-mmx.h"
#include "temp-buf.h"
#include "tile-swap.h"
......@@ -46,17 +47,25 @@
#include "appenv.h"
GimpBaseConfig *base_config = NULL;
static void toast_old_temp_files (void);
/* public functions */
void
base_init (void)
base_init (GimpBaseConfig *config)
{
gchar *swapfile;
gchar *path;
g_return_if_fail (GIMP_IS_BASE_CONFIG (config));
g_return_if_fail (base_config == NULL);
base_config = config;
#ifdef ENABLE_MMX
#ifdef HAVE_ASM_MMX
use_mmx = use_mmx && (intel_cpu_features() & (1 << 23)) ? 1 : 0;
......@@ -66,9 +75,9 @@ base_init (void)
toast_old_temp_files ();
/* Add the swap file */
if (base_config->swap_path == NULL)
base_config->swap_path = g_strdup (g_get_tmp_dir ());
/* Add the swap file */
if (!base_config->swap_path)
g_object_set (G_OBJECT (base_config), "swap_path", g_get_tmp_dir ());
swapfile = g_strdup_printf ("gimpswap.%lu", (unsigned long) getpid ());
......@@ -89,6 +98,8 @@ base_exit (void)
swapping_free ();
paint_funcs_free ();
tile_swap_exit ();
base_config = NULL;
}
......
......@@ -19,8 +19,7 @@
#ifndef __BASE_H__
#define __BASE_H__
void base_init (void);
void base_init (GimpBaseConfig *config);
void base_exit (void);
......
......@@ -30,7 +30,8 @@
#include "base-types.h"
#include "base-config.h"
#include "config/gimpbaseconfig.h"
#include "gimphistogram.h"
#include "pixel-processor.h"
#include "pixel-region.h"
......
......@@ -31,7 +31,8 @@
#include "base-types.h"
#include "base-config.h"
#include "config/gimpbaseconfig.h"
#include "pixel-processor.h"
#include "pixel-region.h"
......
......@@ -36,7 +36,8 @@
#include "base-types.h"
#include "base-config.h"
#include "config/gimpbaseconfig.h"
#include "pixel-region.h"
#include "temp-buf.h"
......
......@@ -26,7 +26,8 @@
#include "base-types.h"
#include "base-config.h"
#include "config/gimpbaseconfig.h"
#include "tile.h"
#include "tile-cache.h"
#include "tile-swap.h"
......
......@@ -3,6 +3,7 @@
noinst_LIBRARIES = libappconfig.a
libappconfig_a_SOURCES = \
config-types.h \
gimpconfig.c \
gimpconfig.h \
gimpconfig-deserialize.c \
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpConfig typedefs
* Copyright (C) 2001-2002 Sven Neumann <sven@gimp.org>
*
* 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 2 of the License, or
......@@ -16,23 +19,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __BASE_CONFIG_H__
#define __BASE_CONFIG_H__
typedef struct _GimpBaseConfig GimpBaseConfig;
struct _GimpBaseConfig
{
gchar *temp_path;
gchar *swap_path;
gulong tile_cache_size;
gboolean stingy_memory_use;
gint num_processors;
};
#ifndef __CONFIG_TYPES_H__
#define __CONFIG_TYPES_H__
extern GimpBaseConfig *base_config;
typedef struct _GimpBaseConfig GimpBaseConfig;
typedef struct _GimpCoreConfig GimpCoreConfig;
typedef struct _GimpDisplayConfig GimpDisplayConfig;
typedef struct _GimpGuiConfig GimpGuiConfig;
typedef struct _GimpRc GimpRc;
#endif /* __BASE_CONFIG_H__ */
#endif /* __CONFIG_TYPES_H__ */
......@@ -25,6 +25,8 @@
#include "libgimpbase/gimpbase.h"
#include "config-types.h"
#include "gimpconfig-params.h"
#include "gimpconfig-types.h"
......
......@@ -32,7 +32,6 @@
#define GIMP_IS_BASE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BASE_CONFIG))
typedef struct _GimpBaseConfig GimpBaseConfig;
typedef struct _GimpBaseConfigClass GimpBaseConfigClass;
struct _GimpBaseConfig
......
......@@ -25,6 +25,8 @@
#include "libgimpbase/gimpbase.h"
#include "config-types.h"
#include "gimpconfig-params.h"
#include "gimpconfig-types.h"
#include "gimpconfig-utils.h"
......
......@@ -34,7 +34,6 @@
#define GIMP_IS_CORE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CORE_CONFIG))
typedef struct _GimpCoreConfig GimpCoreConfig;
typedef struct _GimpCoreConfigClass GimpCoreConfigClass;
struct _GimpCoreConfig
......
......@@ -25,6 +25,8 @@
#include "libgimpbase/gimpbase.h"
#include "config-types.h"
#include "gimpconfig-params.h"
#include "gimpconfig-types.h"
#include "gimpconfig-utils.h"
......@@ -55,6 +57,7 @@ enum
PROP_RESIZE_WINDOWS_ON_ZOOM,
PROP_RESIZE_WINDOWS_ON_RESIZE,
PROP_DEFAULT_DOT_FOR_DOT,
PROP_PERFECT_MOUSE,
PROP_CURSOR_MODE,
PROP_CURSOR_UPDATING,
PROP_IMAGE_TITLE_FORMAT,
......@@ -126,6 +129,9 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DEFAULT_DOT_FOR_DOT,
"default-dot-for-dot",
TRUE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PERFECT_MOUSE,
"perfect-mouse",
FALSE);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_CURSOR_MODE,