Commit 8b8442e9 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/gui/dialogs-constructors.[ch] app/gui/dialogs.c made the tool options

2002-03-10  Michael Natterer  <mitch@gimp.org>

	* app/gui/dialogs-constructors.[ch]
	* app/gui/dialogs.c
	* app/gui/tool-options-dialog.[ch]: made the tool options dialog
	dockable. Create a fancy tab for it which looks like the old
	dialog header.

	* app/gui/gui.c
	* app/gui/menus.c
	* app/gui/toolbox.c: changed accordingly.

	* app/tools/gimpbucketfilltool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimperasertool.c: moved the tool toggling widgets to
	the top.

	* app/tools/paint_options.c: show the paint mode menu for all
	paint tools but set it insensitive where it makes no sense.
	Reduces flickering and makes the tools' similarity more obvious.

	* app/widgets/gimpdataeditor.c: fixed segfault in
	gimp_data_editor_set_data() (data may be NULL), don't pass NULL to
	gtk_entry_set_text(), make the name entry insensitive if data ==
	NULL.

	* app/widgets/gimpdialogfactory.c: fixed longstanding bug which
	made newly created docks steal the first session entry with a NULL
	widget instead of the first _dock_ session entry with a NULL
	widget. Added even more debugging output. Cleanup.

	* app/widgets/gimpdockbook.c: made the tab/menu widget code more
	general to cover the tool options tab.
parent 218e11fd
2002-03-10 Michael Natterer <mitch@gimp.org>
* app/gui/dialogs-constructors.[ch]
* app/gui/dialogs.c
* app/gui/tool-options-dialog.[ch]: made the tool options dialog
dockable. Create a fancy tab for it which looks like the old
dialog header.
* app/gui/gui.c
* app/gui/menus.c
* app/gui/toolbox.c: changed accordingly.
* app/tools/gimpbucketfilltool.c
* app/tools/gimpcroptool.c
* app/tools/gimperasertool.c: moved the tool toggling widgets to
the top.
* app/tools/paint_options.c: show the paint mode menu for all
paint tools but set it insensitive where it makes no sense.
Reduces flickering and makes the tools' similarity more obvious.
* app/widgets/gimpdataeditor.c: fixed segfault in
gimp_data_editor_set_data() (data may be NULL), don't pass NULL to
gtk_entry_set_text(), make the name entry insensitive if data ==
NULL.
* app/widgets/gimpdialogfactory.c: fixed longstanding bug which
made newly created docks steal the first session entry with a NULL
widget instead of the first _dock_ session entry with a NULL
widget. Added even more debugging output. Cleanup.
* app/widgets/gimpdockbook.c: made the tab/menu widget code more
general to cover the tool options tab.
2002-03-09 Sven Neumann <sven@gimp.org>
 
* Made 1.3.4 release.
......
......@@ -115,6 +115,9 @@ static GtkWidget * dialogs_palette_tab_func (GimpDockable *dockable,
static GtkWidget * dialogs_tool_tab_func (GimpDockable *dockable,
GimpDockbook *dockbook,
gint size);
static GtkWidget * dialogs_tool_options_tab_func (GimpDockable *dockable,
GimpDockbook *dockbook,
gint size);
static void dialogs_set_view_context_func (GimpDockable *dockable,
GimpContext *context);
......@@ -144,7 +147,9 @@ static void dialogs_indexed_palette_image_changed (GimpContext *context,
GimpColormapDialog *ipal);
/* public functions */
/**********************/
/* toplevel dialogs */
/**********************/
GtkWidget *
dialogs_toolbox_get (GimpDialogFactory *factory,
......@@ -154,14 +159,6 @@ dialogs_toolbox_get (GimpDialogFactory *factory,
return toolbox_create (context->gimp);
}
GtkWidget *
dialogs_tool_options_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
return tool_options_dialog_create (context->gimp);
}
GtkWidget *
dialogs_device_status_get (GimpDialogFactory *factory,
GimpContext *context,
......@@ -282,7 +279,9 @@ dialogs_about_get (GimpDialogFactory *factory,
}
/***********/
/* docks */
/***********/
GtkWidget *
dialogs_dock_new (GimpDialogFactory *factory,
......@@ -293,7 +292,52 @@ dialogs_dock_new (GimpDialogFactory *factory,
}
/* list views */
/***************/
/* dockables */
/***************/
GtkWidget *
dialogs_tool_options_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
static GtkWidget *view = NULL;
if (view)
return NULL;
view = tool_options_dialog_create (context->gimp);
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
return dialogs_dockable_new (view,
"Tool Options", "Tool Options",
dialogs_tool_options_tab_func,
NULL);
}
GtkWidget *
dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
static GtkWidget *view = NULL;
if (view)
return NULL;
view = error_console_create (context->gimp);
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
return dialogs_dockable_new (view,
"Error Console", "Errors",
NULL,
NULL);
}
/***** list views *****/
GtkWidget *
dialogs_image_list_view_new (GimpDialogFactory *factory,
......@@ -439,7 +483,7 @@ dialogs_buffer_list_view_new (GimpDialogFactory *factory,
}
/* grid views */
/***** grid views *****/
GtkWidget *
dialogs_image_grid_view_new (GimpDialogFactory *factory,
......@@ -585,7 +629,7 @@ dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
}
/* image related dialogs */
/***** image related dialogs *****/
GtkWidget *
dialogs_layer_list_view_new (GimpDialogFactory *factory,
......@@ -774,7 +818,30 @@ dialogs_indexed_palette_new (GimpDialogFactory *factory,
}
/* editors */
/***** misc dockables *****/
GtkWidget *
dialogs_document_history_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_document_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->documents,
context,
preview_size,
5, 3,
gimp_item_factory_from_path ("<Documents>"));
return dialogs_dockable_new (view,
"Document History", "History",
NULL,
dialogs_set_editor_context_func);
}
/***** editors *****/
/* the brush editor */
......@@ -857,53 +924,6 @@ dialogs_edit_palette_func (GimpData *data)
}
/* misc dockables */
GtkWidget *
dialogs_document_history_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_document_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->documents,
context,
preview_size,
5, 3,
gimp_item_factory_from_path ("<Documents>"));
return dialogs_dockable_new (view,
"Document History", "History",
NULL,
dialogs_set_editor_context_func);
}
GtkWidget *
dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
static GtkWidget *view = NULL;
GtkWidget *dockable;
if (view)
return NULL;
view = error_console_create (context->gimp);
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
dockable = dialogs_dockable_new (view,
"Error Console", "Errors",
NULL,
NULL);
return dockable;
}
/* private functions */
static void
......@@ -1041,7 +1061,7 @@ dialogs_tool_tab_func (GimpDockable *dockable,
preview =
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_tool (context)),
size, size, 1,
MIN (size, 22), MIN (size, 22), 1,
FALSE, FALSE, FALSE);
g_signal_connect_object (G_OBJECT (context), "tool_changed",
......@@ -1052,6 +1072,70 @@ dialogs_tool_tab_func (GimpDockable *dockable,
return preview;
}
static void
dialogs_tool_options_tool_changed (GimpContext *context,
GimpToolInfo *tool_info,
GtkLabel *label)
{
gchar *text;
text = g_strdup_printf (_("%s Options"), tool_info->blurb);
gtk_label_set_text (label, text);
g_free (text);
gimp_help_set_help_data (GTK_WIDGET (label)->parent->parent,
tool_info->help,
tool_info->help_data);
}
static GtkWidget *
dialogs_tool_options_tab_func (GimpDockable *dockable,
GimpDockbook *dockbook,
gint size)
{
GimpContext *context;
GimpToolInfo *tool_info;
GtkWidget *hbox;
GtkWidget *preview;
GtkWidget *label;
gchar *text;
context = dockbook->dock->context;
tool_info = gimp_context_get_tool (context);
hbox = gtk_hbox_new (FALSE, 2);
preview = gimp_preview_new_full (GIMP_VIEWABLE (tool_info),
MIN (size, 22), MIN (size, 22), 0,
FALSE, FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), preview, FALSE, FALSE, 0);
gtk_widget_show (preview);
g_signal_connect_object (G_OBJECT (context), "tool_changed",
G_CALLBACK (gimp_preview_set_viewable),
G_OBJECT (preview),
G_CONNECT_SWAPPED);
text = g_strdup_printf (_("%s Options"), tool_info->blurb);
label = gtk_label_new (text);
g_free (text);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
g_signal_connect_object (G_OBJECT (context), "tool_changed",
G_CALLBACK (dialogs_tool_options_tool_changed),
G_OBJECT (label),
0);
return hbox;
}
static void
dialogs_set_view_context_func (GimpDockable *dockable,
GimpContext *context)
......
......@@ -25,9 +25,6 @@
GtkWidget * dialogs_toolbox_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_tool_options_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_device_status_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
......@@ -69,6 +66,13 @@ GtkWidget * dialogs_dock_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_tool_options_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_image_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
......@@ -148,9 +152,5 @@ GtkWidget * dialogs_palette_editor_get (GimpDialogFactory *factory,
gint preview_size);
void dialogs_edit_palette_func (GimpData *data);
GtkWidget * dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
#endif /* __DIALOGS_CONSTRUCTORS_H__ */
......@@ -39,7 +39,6 @@ GimpDialogFactory *global_dock_factory = NULL;
static const GimpDialogFactoryEntry toplevel_entries[] =
{
{ "gimp:toolbox", dialogs_toolbox_get, 32, TRUE, TRUE, TRUE, TRUE },
{ "gimp:tool-options-dialog", dialogs_tool_options_get, 32, TRUE, TRUE, FALSE, TRUE },
{ "gimp:device-status-dialog", dialogs_device_status_get, 32, TRUE, TRUE, FALSE, TRUE },
{ "gimp:brush-select-dialog", dialogs_brush_select_get, 32, TRUE, TRUE, FALSE, TRUE },
{ "gimp:pattern-select-dialog", dialogs_pattern_select_get, 32, TRUE, TRUE, FALSE, TRUE },
......@@ -55,6 +54,9 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
static const GimpDialogFactoryEntry dock_entries[] =
{
{ "gimp:tool-options", dialogs_tool_options_get, 0, TRUE, FALSE, FALSE, TRUE },
{ "gimp:error-console", dialogs_error_console_get, 0, TRUE, FALSE, FALSE, TRUE },
{ "gimp:image-list", dialogs_image_list_view_new, 32, FALSE, FALSE, FALSE, TRUE },
{ "gimp:brush-list", dialogs_brush_list_view_new, 32, FALSE, FALSE, FALSE, TRUE },
{ "gimp:pattern-list", dialogs_pattern_list_view_new, 32, FALSE, FALSE, FALSE, TRUE },
......@@ -81,9 +83,7 @@ static const GimpDialogFactoryEntry dock_entries[] =
{ "gimp:brush-editor", dialogs_brush_editor_get, 0, TRUE, FALSE, FALSE, TRUE },
{ "gimp:gradient-editor", dialogs_gradient_editor_get, 0, TRUE, FALSE, FALSE, TRUE },
{ "gimp:palette-editor", dialogs_palette_editor_get, 0, TRUE, FALSE, FALSE, TRUE },
{ "gimp:error-console", dialogs_error_console_get, 0, TRUE, FALSE, FALSE, TRUE }
{ "gimp:palette-editor", dialogs_palette_editor_get, 0, TRUE, FALSE, FALSE, TRUE }
};
......
......@@ -115,6 +115,9 @@ static GtkWidget * dialogs_palette_tab_func (GimpDockable *dockable,
static GtkWidget * dialogs_tool_tab_func (GimpDockable *dockable,
GimpDockbook *dockbook,
gint size);
static GtkWidget * dialogs_tool_options_tab_func (GimpDockable *dockable,
GimpDockbook *dockbook,
gint size);
static void dialogs_set_view_context_func (GimpDockable *dockable,
GimpContext *context);
......@@ -144,7 +147,9 @@ static void dialogs_indexed_palette_image_changed (GimpContext *context,
GimpColormapDialog *ipal);
/* public functions */
/**********************/
/* toplevel dialogs */
/**********************/
GtkWidget *
dialogs_toolbox_get (GimpDialogFactory *factory,
......@@ -154,14 +159,6 @@ dialogs_toolbox_get (GimpDialogFactory *factory,
return toolbox_create (context->gimp);
}
GtkWidget *
dialogs_tool_options_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
return tool_options_dialog_create (context->gimp);
}
GtkWidget *
dialogs_device_status_get (GimpDialogFactory *factory,
GimpContext *context,
......@@ -282,7 +279,9 @@ dialogs_about_get (GimpDialogFactory *factory,
}
/***********/
/* docks */
/***********/
GtkWidget *
dialogs_dock_new (GimpDialogFactory *factory,
......@@ -293,7 +292,52 @@ dialogs_dock_new (GimpDialogFactory *factory,
}
/* list views */
/***************/
/* dockables */
/***************/
GtkWidget *
dialogs_tool_options_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
static GtkWidget *view = NULL;
if (view)
return NULL;
view = tool_options_dialog_create (context->gimp);
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
return dialogs_dockable_new (view,
"Tool Options", "Tool Options",
dialogs_tool_options_tab_func,
NULL);
}
GtkWidget *
dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
static GtkWidget *view = NULL;
if (view)
return NULL;
view = error_console_create (context->gimp);
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
return dialogs_dockable_new (view,
"Error Console", "Errors",
NULL,
NULL);
}
/***** list views *****/
GtkWidget *
dialogs_image_list_view_new (GimpDialogFactory *factory,
......@@ -439,7 +483,7 @@ dialogs_buffer_list_view_new (GimpDialogFactory *factory,
}
/* grid views */
/***** grid views *****/
GtkWidget *
dialogs_image_grid_view_new (GimpDialogFactory *factory,
......@@ -585,7 +629,7 @@ dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
}
/* image related dialogs */
/***** image related dialogs *****/
GtkWidget *
dialogs_layer_list_view_new (GimpDialogFactory *factory,
......@@ -774,7 +818,30 @@ dialogs_indexed_palette_new (GimpDialogFactory *factory,
}
/* editors */
/***** misc dockables *****/
GtkWidget *
dialogs_document_history_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_document_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->documents,
context,
preview_size,
5, 3,
gimp_item_factory_from_path ("<Documents>"));
return dialogs_dockable_new (view,
"Document History", "History",
NULL,
dialogs_set_editor_context_func);
}
/***** editors *****/
/* the brush editor */
......@@ -857,53 +924,6 @@ dialogs_edit_palette_func (GimpData *data)
}
/* misc dockables */
GtkWidget *
dialogs_document_history_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_document_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->documents,
context,
preview_size,
5, 3,
gimp_item_factory_from_path ("<Documents>"));
return dialogs_dockable_new (view,
"Document History", "History",
NULL,
dialogs_set_editor_context_func);
}
GtkWidget *
dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
static GtkWidget *view = NULL;
GtkWidget *dockable;
if (view)
return NULL;
view = error_console_create (context->gimp);
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
dockable = dialogs_dockable_new (view,
"Error Console", "Errors",
NULL,
NULL);
return dockable;
}
/* private functions */
static void
......@@ -1041,7 +1061,7 @@ dialogs_tool_tab_func (GimpDockable *dockable,
preview =
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_tool (context)),
size, size, 1,
MIN (size, 22), MIN (size, 22), 1,
FALSE, FALSE, FALSE);
g_signal_connect_object (G_OBJECT (context), "tool_changed",
......@@ -1052,6 +1072,70 @@ dialogs_tool_tab_func (GimpDockable *dockable,
return preview;
}
static void
dialogs_tool_options_tool_changed (GimpContext *context,
GimpToolInfo *tool_info,
GtkLabel *label)
{
gchar *text;
text = g_strdup_printf (_("%s Options"), tool_info->blurb);
gtk_label_set_text (label, text);
g_free (text);
gimp_help_set_help_data (GTK_WIDGET (label)->parent->parent,
tool_info->help,
tool_info->help_data);
}
static GtkWidget *
dialogs_tool_options_tab_func (GimpDockable *dockable,
GimpDockbook *dockbook,
gint size)
{
GimpContext *context;
GimpToolInfo *tool_info;
GtkWidget *hbox;
GtkWidget *preview;
GtkWidget *label;
gchar *text;
context = dockbook->dock->context;
tool_info = gimp_context_get_tool (context);
hbox = gtk_hbox_new (FALSE, 2);