GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 22371de3 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added a note about apptype.h and about not including headers in headers.

2001-02-14  Michael Natterer  <mitch@gimp.org>

	* HACKING: added a note about apptype.h and about not including
	headers in headers.

	* app/apptypes.h: added GimpTool and BitmapCursor.

	* app/cursorutil.h
	* app/devices.h
	* app/draw_core.h
	* app/tools/color_picker.h
	* app/tools/tool.h
	* app/tools/tool_options.h
	* app/gimpcontext.h: removed includes of "tools/tool.h"

	* app/gimprc.[ch]: indentadion cleanup, added
	"module_db_load_inhibit".

	* app/module_db.c: removed the above variable here.

	* app/gimpdata.[ch]: added a vitrual "duplicate" method.

	* app/gimpbrush.[ch]
	* app/gimpbrushgenerated.[ch]
	* app/gimpbrushpipe.[ch]
	* app/gimpgradient.[ch]
	* app/gimppalette.[ch]
	* app/gimppattern.[ch]: all "load", "new" and "get_standard"
	functions return a GimpData pointer now.

	* app/gimpdatafactory.[ch]: made some stuff const.

	* app/gimpdatafactoryview.c: activate the "duplicate" button and
	set the initial button sensitivity correctly.

	* app/brush_select.c
	* app/gradient_select.c
	* app/pattern_select.c: use the new GimpDataFactoryView.

	* libgimp/Makefile.am: grouped the file to sort out what _may_
	go to subdirs or separate libs.

	* libgimp/gimpenv.[ch]: added many "const".

	* app/app_procs.c
	* app/brush_edit.c
	* app/gimpcontext.c
	* app/gimpdnd.c
	* app/gradient_editor.c
	* app/palette.c
	* app/palette_import.c
	* app/user_install.c: many related changes.

	* libgimpmath/gimpmathtypes.h
	* libgimpmath/gimpvector.[ch]: minor cleanups.

	* plug-ins/script-fu/script-fu.c: gimp_data_directory() is const now.
parent d234db54
2001-02-14 Michael Natterer <mitch@gimp.org>
* HACKING: added a note about apptype.h and about not including
headers in headers.
* app/apptypes.h: added GimpTool and BitmapCursor.
* app/cursorutil.h
* app/devices.h
* app/draw_core.h
* app/tools/color_picker.h
* app/tools/tool.h
* app/tools/tool_options.h
* app/gimpcontext.h: removed includes of "tools/tool.h"
* app/gimprc.[ch]: indentadion cleanup, added
"module_db_load_inhibit".
* app/module_db.c: removed the above variable here.
* app/gimpdata.[ch]: added a vitrual "duplicate" method.
* app/gimpbrush.[ch]
* app/gimpbrushgenerated.[ch]
* app/gimpbrushpipe.[ch]
* app/gimpgradient.[ch]
* app/gimppalette.[ch]
* app/gimppattern.[ch]: all "load", "new" and "get_standard"
functions return a GimpData pointer now.
* app/gimpdatafactory.[ch]: made some stuff const.
* app/gimpdatafactoryview.c: activate the "duplicate" button and
set the initial button sensitivity correctly.
* app/brush_select.c
* app/gradient_select.c
* app/pattern_select.c: use the new GimpDataFactoryView.
* libgimp/Makefile.am: grouped the file to sort out what _may_
go to subdirs or separate libs.
* libgimp/gimpenv.[ch]: added many "const".
* app/app_procs.c
* app/brush_edit.c
* app/gimpcontext.c
* app/gimpdnd.c
* app/gradient_editor.c
* app/palette.c
* app/palette_import.c
* app/user_install.c: many related changes.
* libgimpmath/gimpmathtypes.h
* libgimpmath/gimpvector.[ch]: minor cleanups.
* plug-ins/script-fu/script-fu.c: gimp_data_directory() is const now.
2001-02-13 Nathan Summers <rock@gimp.org>
* configure.in
* plug-ins/plugin-helper/*: prototype for an extension that allows
gmodules as plugins. Known bug: crashes on gmodules with a static "query" function
* plug-ins/plugin-helper/*: prototype for an extension that allows
gmodules as plugins. Known bug: crashes on gmodules with a static
"query" function
* app/tools/tool.c
* app/tools/tool.h: created new GimpTool object. Did away with ToolInfo.
Most tools still need to be ported over to the new api.
* app/tools/tool.h: created new GimpTool object. Did away with
ToolInfo. Most tools still need to be ported over to the new api.
* app/tools/tools.c: now contains the initialization function to register
the tools with the Gimp
* app/tools/tools.c: now contains the initialization function to
register the tools with the Gimp
* app/tools/tools.h: renamed to tool.h
......@@ -50,7 +109,8 @@
* libgimp/gimp.c
* plug-ins/Makefile.am: changed acordingly
* plug-ins/script-fu/script-fu-scripts.c: fixed typo in comment. Pathetic, huh?
* plug-ins/script-fu/script-fu-scripts.c: fixed typo in comment.
Pathetic, huh?
2001-02-14 Michael Natterer <mitch@gimp.org>
......
......@@ -77,7 +77,7 @@ For the core components (application and libs) this coding style is enforced.
The GIMP coding style is defined as follows:
Function names are lowercase, words separated by underscores.
Macros and enums are all uppercase, words seperated by underscores.
Macros and enums are all uppercase, words seperated by underscores.
Types are all words capitalized, no separators between words.
All functions in header files need to be prototyped.
......@@ -95,6 +95,9 @@ Try to make use of GTK's object system as much as possible. Do not create
wrappers around functions of parent classes. If you end up duplicating code,
try to create a common parent class and implement the common methods there.
Don't include headers in headers except where unavoidable (e.g. for
deriving objects). Opaque typedefs go to app/apptypes.h
One goal of the 1.3 development branch is to make the GIMP code more readable
and understandable. Please help us to achieve this goal by cleaning up the
present code and make sure that all new code follows the coding guidelines.
......@@ -489,16 +489,17 @@ app_init_update_status (gchar *label1val,
void
app_init (void)
{
gchar *filename;
gchar *path;
const gchar *gtkrc;
gchar *filename;
gchar *path;
/* parse the systemwide gtkrc */
filename = gimp_gtkrc ();
gtkrc = gimp_gtkrc ();
if (be_verbose)
g_print (_("parsing \"%s\"\n"), filename);
g_print (_("parsing \"%s\"\n"), gtkrc);
gtk_rc_parse (filename);
gtk_rc_parse (gtkrc);
/* parse the user gtkrc */
filename = gimp_personal_rc_file ("gtkrc");
......
......@@ -73,6 +73,11 @@ typedef struct _GimpPattern GimpPattern;
typedef struct _GimpPalette GimpPalette;
/* tools */
typedef struct _GimpTool GimpTool;
/* widgets */
typedef struct _GimpPreview GimpPreview;
......@@ -97,6 +102,8 @@ typedef struct _Argument Argument;
typedef struct _BezierPoint BezierPoint;
typedef struct _BezierSelect BezierSelect;
typedef struct _BitmapCursor BitmapCursor;
typedef struct _BoundSeg BoundSeg;
typedef struct _ColorNotebook ColorNotebook;
......
......@@ -39,7 +39,7 @@
static void brush_edit_close_callback (GtkWidget *widget,
gpointer data);
static gint brush_edit_preview_resize (GtkWidget *widget,
GdkEvent *event,
GtkAllocation *allocation,
BrushEditGeneratedWindow *begw);
......@@ -343,7 +343,7 @@ brush_edit_generated_new (void)
static gint
brush_edit_preview_resize (GtkWidget *widget,
GdkEvent *event,
GtkAllocation *allocation,
BrushEditGeneratedWindow *begw)
{
gtk_preview_size (GTK_PREVIEW (begw->preview),
......@@ -356,7 +356,7 @@ brush_edit_preview_resize (GtkWidget *widget,
return FALSE;
}
static void
brush_edit_close_callback (GtkWidget *widget,
gpointer data)
......
......@@ -33,7 +33,7 @@
#include "dialog_handler.h"
#include "gimpbrushgenerated.h"
#include "gimpcontainer.h"
#include "gimpcontainergridview.h"
#include "gimpdatafactoryview.h"
#include "gimpcontext.h"
#include "gimpdata.h"
#include "gimpdatafactory.h"
......@@ -70,9 +70,6 @@ static void brush_select_opacity_changed (GimpContext *context,
static void brush_select_paint_mode_changed (GimpContext *context,
LayerModeEffects paint_mode,
BrushSelect *bsp);
static void brush_select_select (BrushSelect *bsp,
GimpBrush *brush);
static void brush_select_brush_renamed_callback (GimpBrush *brush,
BrushSelect *bsp);
......@@ -87,14 +84,7 @@ static void spacing_scale_update (GtkAdjustment *adj,
static void brush_select_close_callback (GtkWidget *widget,
gpointer data);
static void brush_select_refresh_callback (GtkWidget *widget,
gpointer data);
static void brush_select_new_brush_callback (GtkWidget *widget,
gpointer data);
static void brush_select_edit_brush_callback (GtkWidget *widget,
gpointer data);
static void brush_select_delete_brush_callback (GtkWidget *widget,
gpointer data);
static void brush_select_edit_brush (GimpData *data);
/* The main brush selection dialog */
......@@ -161,7 +151,6 @@ brush_select_new (gchar *title,
GtkWidget *table;
GtkWidget *util_box;
GtkWidget *slider;
GtkWidget *button;
GimpBrush *active = NULL;
......@@ -177,13 +166,15 @@ brush_select_new (gchar *title,
title ? GTK_WIN_POS_MOUSE : GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
_("Refresh"), brush_select_refresh_callback,
bsp, NULL, NULL, FALSE, FALSE,
_("Close"), brush_select_close_callback,
"_delete_event_", brush_select_close_callback,
bsp, NULL, NULL, TRUE, TRUE,
NULL);
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (bsp->shell)->vbox)), 0)));
gtk_widget_hide (GTK_DIALOG (bsp->shell)->action_area);
if (title)
{
bsp->context = gimp_context_new (title, NULL);
......@@ -242,11 +233,13 @@ brush_select_new (gchar *title,
gtk_container_add (GTK_CONTAINER (bsp->left_box), bsp->brush_selection_box);
/* The Brush Grid */
bsp->view = gimp_container_grid_view_new (global_brush_factory->container,
bsp->context,
MIN_CELL_SIZE,
STD_BRUSH_COLUMNS,
STD_BRUSH_ROWS);
bsp->view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
global_brush_factory,
brush_select_edit_brush,
bsp->context,
MIN_CELL_SIZE,
STD_BRUSH_COLUMNS,
STD_BRUSH_ROWS);
gtk_box_pack_start (GTK_BOX (bsp->brush_selection_box), bsp->view,
TRUE, TRUE, 0);
gtk_widget_show (bsp->view);
......@@ -327,33 +320,6 @@ brush_select_new (gchar *title,
gtk_widget_show (bsp->paint_options_box);
gtk_widget_show (bsp->right_box);
/* Create the edit/new buttons */
util_box = gtk_hbox_new (FALSE, 0);
gtk_box_pack_end (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 4);
button = gtk_button_new_with_label (_("New"));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (brush_select_new_brush_callback),
bsp);
gtk_box_pack_start (GTK_BOX (util_box), button, TRUE, TRUE, 6);
bsp->edit_button = gtk_button_new_with_label (_("Edit"));
gtk_signal_connect (GTK_OBJECT (bsp->edit_button), "clicked",
GTK_SIGNAL_FUNC (brush_select_edit_brush_callback),
bsp);
gtk_box_pack_start (GTK_BOX (util_box), bsp->edit_button, TRUE, TRUE, 5);
bsp->delete_button = gtk_button_new_with_label (_("Delete"));
gtk_signal_connect (GTK_OBJECT (bsp->delete_button), "clicked",
GTK_SIGNAL_FUNC (brush_select_delete_brush_callback),
bsp);
gtk_box_pack_start (GTK_BOX (util_box), bsp->delete_button, TRUE, TRUE, 5);
gtk_widget_show (bsp->edit_button);
gtk_widget_show (button);
gtk_widget_show (bsp->delete_button);
gtk_widget_show (util_box);
/* Create the spacing scale widget */
table = gtk_table_new (1, 2, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
......@@ -410,7 +376,7 @@ brush_select_new (gchar *title,
bsp);
if (active)
brush_select_select (bsp, active);
brush_select_update_active_brush_field (bsp);
/* Add to active brush dialogs list */
brush_active_dialogs = g_slist_append (brush_active_dialogs, bsp);
......@@ -586,7 +552,7 @@ brush_select_brush_changed (GimpContext *context,
{
if (brush)
{
brush_select_select (bsp, brush);
brush_select_update_active_brush_field (bsp);
if (bsp->callback_name)
brush_select_change_callbacks (bsp, FALSE);
......@@ -619,27 +585,6 @@ brush_select_paint_mode_changed (GimpContext *context,
brush_select_change_callbacks (bsp, FALSE);
}
static void
brush_select_select (BrushSelect *bsp,
GimpBrush *brush)
{
if (! gimp_container_have (global_brush_factory->container,
GIMP_OBJECT (brush)));
if (GIMP_IS_BRUSH_GENERATED (brush))
{
gtk_widget_set_sensitive (bsp->edit_button, TRUE);
gtk_widget_set_sensitive (bsp->delete_button, TRUE);
}
else
{
gtk_widget_set_sensitive (bsp->edit_button, FALSE);
gtk_widget_set_sensitive (bsp->delete_button, FALSE);
}
brush_select_update_active_brush_field (bsp);
}
static void
brush_select_brush_renamed_callback (GimpBrush *brush,
BrushSelect *bsp)
......@@ -741,43 +686,11 @@ brush_select_close_callback (GtkWidget *widget,
}
static void
brush_select_refresh_callback (GtkWidget *widget,
gpointer data)
{
gimp_data_factory_data_init (global_brush_factory, FALSE);
}
static void
brush_select_new_brush_callback (GtkWidget *widget,
gpointer data)
brush_select_edit_brush (GimpData *data)
{
BrushSelect *bsp;
GimpBrush *brush;
bsp = (BrushSelect *) data;
brush = gimp_brush_generated_new (10, .5, 0.0, 1.0);
gimp_container_add (global_brush_factory->container,
GIMP_OBJECT (brush));
gimp_context_set_brush (bsp->context, brush);
if (brush_edit_generated_dialog)
brush_edit_generated_set_brush (brush_edit_generated_dialog, brush);
brush_select_edit_brush_callback (widget, data);
}
static void
brush_select_edit_brush_callback (GtkWidget *widget,
gpointer data)
{
BrushSelect *bsp;
GimpBrush *brush;
GimpBrush *brush;
bsp = (BrushSelect *) data;
brush = gimp_context_get_brush (bsp->context);
brush = GIMP_BRUSH (data);
if (GIMP_IS_BRUSH_GENERATED (brush))
{
......@@ -797,32 +710,6 @@ brush_select_edit_brush_callback (GtkWidget *widget,
}
else
{
/* this should never happen */
g_message (_("Sorry, this brush can't be edited."));
}
}
static void
brush_select_delete_brush_callback (GtkWidget *widget,
gpointer data)
{
BrushSelect *bsp;
GimpBrush *brush;
bsp = (BrushSelect *) data;
brush = gimp_context_get_brush (bsp->context);
if (GIMP_IS_BRUSH_GENERATED (brush))
{
if (GIMP_DATA (brush)->filename)
gimp_data_delete_from_disk (GIMP_DATA (brush));
gimp_container_remove (global_brush_factory->container,
GIMP_OBJECT (brush));
}
else
{
/* this should never happen */
g_message (_("Sorry, this brush can't be deleted."));
}
}
......@@ -261,7 +261,7 @@ gimp_brush_get_extension (GimpData *data)
return GIMP_BRUSH_FILE_EXTENSION;
}
GimpBrush *
GimpData *
gimp_brush_new (const gchar *name)
{
GimpBrush *brush;
......@@ -272,10 +272,10 @@ gimp_brush_new (const gchar *name)
gimp_object_set_name (GIMP_OBJECT (brush), name);
return brush;
return GIMP_DATA (brush);
}
GimpBrush *
GimpData *
gimp_brush_get_standard (void)
{
static GimpBrush *standard_brush = NULL;
......@@ -293,10 +293,10 @@ gimp_brush_get_standard (void)
gtk_object_sink (GTK_OBJECT (standard_brush));
}
return standard_brush;
return GIMP_DATA (standard_brush);
}
GimpBrush *
GimpData *
gimp_brush_load (const gchar *filename)
{
GimpBrush *brush;
......@@ -326,7 +326,7 @@ gimp_brush_load (const gchar *filename)
temp_buf_swap (brush->pixmap);
}
return brush;
return GIMP_DATA (brush);
}
static GimpBrush *
......
......@@ -261,7 +261,7 @@ gimp_brush_get_extension (GimpData *data)
return GIMP_BRUSH_FILE_EXTENSION;
}
GimpBrush *
GimpData *
gimp_brush_new (const gchar *name)
{
GimpBrush *brush;
......@@ -272,10 +272,10 @@ gimp_brush_new (const gchar *name)
gimp_object_set_name (GIMP_OBJECT (brush), name);
return brush;
return GIMP_DATA (brush);
}
GimpBrush *
GimpData *
gimp_brush_get_standard (void)
{
static GimpBrush *standard_brush = NULL;
......@@ -293,10 +293,10 @@ gimp_brush_get_standard (void)
gtk_object_sink (GTK_OBJECT (standard_brush));
}
return standard_brush;
return GIMP_DATA (standard_brush);
}
GimpBrush *
GimpData *
gimp_brush_load (const gchar *filename)
{
GimpBrush *brush;
......@@ -326,7 +326,7 @@ gimp_brush_load (const gchar *filename)
temp_buf_swap (brush->pixmap);
}
return brush;
return GIMP_DATA (brush);
}
static GimpBrush *
......
......@@ -59,11 +59,10 @@ struct _GimpBrushClass
GtkType gimp_brush_get_type (void);
GimpBrush * gimp_brush_new (const gchar *name);
GimpBrush * gimp_brush_get_standard (void);
GimpBrush * gimp_brush_load (const gchar *filename);
GimpData * gimp_brush_new (const gchar *name);
GimpData * gimp_brush_get_standard (void);
GimpData * gimp_brush_load (const gchar *filename);
GimpBrush * gimp_brush_load_brush (gint fd,
const gchar *filename);
......
......@@ -313,11 +313,9 @@ gimp_brush_generated_dirty (GimpData *data)
if (GIMP_DATA_CLASS (parent_class)->dirty)
GIMP_DATA_CLASS (parent_class)->dirty (data);
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (brush));
}
GimpBrush *
GimpData *
gimp_brush_generated_new (gfloat radius,
gfloat hardness,
gfloat angle,
......@@ -341,17 +339,17 @@ gimp_brush_generated_new (gfloat radius,
/* render brush mask */
gimp_data_dirty (GIMP_DATA (brush));
return GIMP_BRUSH (brush);
return GIMP_DATA (brush);
}
GimpBrush *
GimpData *
gimp_brush_generated_load (const gchar *filename)
{
GimpBrushGenerated *brush;
FILE *fp;
gchar string[256];
gfloat fl;
gfloat version;
FILE *fp;
gchar string[256];
gfloat fl;
gfloat version;
if ((fp = fopen (filename, "rb")) == NULL)
return NULL;
......@@ -361,7 +359,7 @@ gimp_brush_generated_load (const gchar *filename)
if (strncmp (string, "GIMP-VBR", 8) != 0)
return NULL;
/* make sure we are reading a compatible version */
fgets (string, 255, fp);
sscanf (string, "%f", &version);
......@@ -409,7 +407,7 @@ gimp_brush_generated_load (const gchar *filename)
if (stingy_memory_use)
temp_buf_swap (GIMP_BRUSH (brush)->mask);
return GIMP_BRUSH (brush);
return GIMP_DATA (brush);
}
void
......
......@@ -313,11 +313,9 @@ gimp_brush_generated_dirty (GimpData *data)
if (GIMP_DATA_CLASS (parent_class)->dirty)
GIMP_DATA_CLASS (parent_class)->dirty (data);
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (brush));
}
GimpBrush *
GimpData *
gimp_brush_generated_new (gfloat radius,
gfloat hardness,
gfloat angle,
......@@ -341,17 +339,17 @@ gimp_brush_generated_new (gfloat radius,
/* render brush mask */
gimp_data_dirty (GIMP_DATA (brush));
return GIMP_BRUSH (brush);
return GIMP_DATA (brush);
}
GimpBrush *
GimpData *
gimp_brush_generated_load (const gchar *filename)
{
GimpBrushGenerated *brush;
FILE *fp;
gchar string[256];
gfloat fl;
gfloat version;
FILE *fp;
gchar string[256];
gfloat fl;
gfloat version;
if ((fp = fopen (filename, "rb")) == NULL)
return NULL;
......@@ -361,7 +359,7 @@ gimp_brush_generated_load (const gchar *filename)
if (strncmp (string, "GIMP-VBR", 8) != 0)
return NULL;
/* make sure we are reading a compatible version */
fgets (string, 255, fp);
sscanf (string, "%f", &version);
......@@ -409,7 +407,7 @@ gimp_brush_generated_load (const gchar *filename)
if (stingy_memory_use)
temp_buf_swap (GIMP_BRUSH (brush)->mask);
return GIMP_BRUSH (brush);
return GIMP_DATA (brush);
}
void
......
......@@ -313,11 +313,9 @@ gimp_brush_generated_dirty (GimpData *data)
if (GIMP_DATA_CLASS (parent_class)->dirty)
GIMP_DATA_CLASS (parent_class)->dirty (data);
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (brush));
}
GimpBrush *
GimpData *
gimp_brush_generated_new (gfloat radius,
gfloat hardness,
gfloat angle,
......@@ -341,17 +339,17 @@ gimp_brush_generated_new (gfloat radius,
/* render brush mask */
gimp_data_dirty (GIMP_DATA (brush));
return GIMP_BRUSH (brush);
return GIMP_DATA (brush);
}
GimpBrush *
GimpData *
gimp_brush_generated_load (const gchar *filename)
{
GimpBrushGenerated *brush;
FILE *fp;
gchar string[256];
gfloat fl;
gfloat version;
FILE *fp;
gchar string[256];
gfloat fl;
gfloat version;
if ((fp = fopen (filename, "rb")) == NULL)
return NULL;
......@@ -361,7 +359,7 @@ gimp_brush_generated_load (const gchar *filename)
if (strncmp (string, "GIMP-VBR", 8) != 0)
return NULL;
/* make sure we are reading a compatible version */
fgets (string, 255, fp);
sscanf (string, "%f", &version);
......@@ -409,7 +407,7 @@ gimp_brush_generated_load (const gchar *filename)