Use g_object_[set|get]_qdata(), not just _data() to speed up tool manager

2003-05-25  Michael Natterer  <mitch@gimp.org>

	* app/tools/tool_manager.[ch] (tool_manager_set,get): Use
	g_object_[set|get]_qdata(), not just _data() to speed up tool
	manager access.

	Removed tool_manager_active_get_help_data() and
	tool_manager_help_func().

	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpcurvestool.c
	* app/tools/gimphistogramtool.c
	* app/tools/gimpimagemaptool.c
	* app/tools/gimplevelstool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimptransformtool.c: use gimp_standard_help_func and
	tool->tool_info->help_data instead. Don't #include "tool_manager.h".
This commit is contained in:
Michael Natterer 2003-05-25 17:16:59 +00:00 committed by Michael Natterer
parent 846a93365c
commit dd9a0a4a63
11 changed files with 52 additions and 53 deletions

View File

@ -1,3 +1,22 @@
2003-05-25 Michael Natterer <mitch@gimp.org>
* app/tools/tool_manager.[ch] (tool_manager_set,get): Use
g_object_[set|get]_qdata(), not just _data() to speed up tool
manager access.
Removed tool_manager_active_get_help_data() and
tool_manager_help_func().
* app/tools/gimpcolorpickertool.c
* app/tools/gimpcroptool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphistogramtool.c
* app/tools/gimpimagemaptool.c
* app/tools/gimplevelstool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimptransformtool.c: use gimp_standard_help_func and
tool->tool_info->help_data instead. Don't #include "tool_manager.h".
2003-05-25 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimphelpui.[ch] (_gimp_help_init): changed again

View File

@ -49,7 +49,6 @@
#include "gimpcolorpickeroptions.h"
#include "gimpcolorpickertool.h"
#include "gimptoolcontrol.h"
#include "tool_manager.h"
#include "gimp-intl.h"
@ -99,7 +98,8 @@ static gboolean gimp_color_picker_tool_pick_color (GimpImage *g
gboolean update_active,
GimpUpdateColorState update_state);
static InfoDialog * gimp_color_picker_tool_info_create (GimpDrawable *drawable);
static InfoDialog * gimp_color_picker_tool_info_create (GimpToolInfo *tool_info,
GimpDrawable *drawable);
static void gimp_color_picker_tool_info_close (GtkWidget *widget,
gpointer data);
static void gimp_color_picker_tool_info_update (GimpTool *tool,
@ -260,7 +260,9 @@ gimp_color_picker_tool_button_press (GimpTool *tool,
gimp_tool_control_activate (tool->control);
if (! gimp_color_picker_tool_info)
gimp_color_picker_tool_info = gimp_color_picker_tool_info_create (tool->drawable);
gimp_color_picker_tool_info =
gimp_color_picker_tool_info_create (tool->tool_info,
tool->drawable);
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (gimp_color_picker_tool_info->shell),
GIMP_VIEWABLE (tool->drawable));
@ -484,7 +486,8 @@ gimp_color_picker_tool_pick_color (GimpImage *gimage,
}
static InfoDialog *
gimp_color_picker_tool_info_create (GimpDrawable *drawable)
gimp_color_picker_tool_info_create (GimpToolInfo *tool_info,
GimpDrawable *drawable)
{
InfoDialog *info_dialog;
GtkWidget *hbox;
@ -495,7 +498,8 @@ gimp_color_picker_tool_info_create (GimpDrawable *drawable)
_("Color Picker"), "color_picker",
GIMP_STOCK_TOOL_COLOR_PICKER,
_("Color Picker Information"),
tool_manager_help_func, NULL);
gimp_standard_help_func,
tool_info->help_data);
gimp_dialog_create_action_area (GIMP_DIALOG (info_dialog->shell),

View File

@ -54,7 +54,6 @@
#include "gimpcropoptions.h"
#include "gimpcroptool.h"
#include "gimptoolcontrol.h"
#include "tool_manager.h"
#include "gimp-intl.h"
@ -1003,7 +1002,8 @@ crop_info_create (GimpCropTool *crop)
GIMP_OBJECT (tool->tool_info)->name,
stock_id,
_("Crop & Resize Information"),
tool_manager_help_func, NULL);
gimp_standard_help_func,
tool->tool_info->help_data);
gimp_dialog_create_action_area (GIMP_DIALOG (crop->crop_info->shell),

View File

@ -43,6 +43,7 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimagemap.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpcursor.h"
#include "widgets/gimpenummenu.h"
@ -51,7 +52,6 @@
#include "gimpcurvestool.h"
#include "gimptoolcontrol.h"
#include "tool_manager.h"
#include "gimp-intl.h"
@ -1393,7 +1393,8 @@ file_dialog_create (GimpCurvesTool *c_tool)
gtk_file_selection_set_filename (file_dlg, temp);
g_free (temp);
gimp_help_connect (c_tool->file_dialog, tool_manager_help_func, NULL);
gimp_help_connect (c_tool->file_dialog, gimp_standard_help_func,
GIMP_TOOL (c_tool)->tool_info->help_data);
}
static void

View File

@ -355,7 +355,7 @@ histogram_tool_dialog_new (GimpToolInfo *tool_info)
GIMP_OBJECT (tool_info)->name,
stock_id,
_("View Image Histogram"),
tool_manager_help_func, NULL,
gimp_standard_help_func, tool_info->help_data,
GTK_STOCK_CLOSE, histogram_tool_close_callback,
htd, NULL, NULL, TRUE, TRUE,

View File

@ -45,7 +45,6 @@
#include "gimpimagemaptool.h"
#include "gimptoolcontrol.h"
#include "tool_manager.h"
#include "gimp-intl.h"
@ -218,7 +217,8 @@ gimp_image_map_tool_initialize (GimpTool *tool,
GIMP_OBJECT (tool_info)->name,
stock_id,
image_map_tool->shell_desc,
tool_manager_help_func, NULL,
gimp_standard_help_func,
tool_info->help_data,
GIMP_STOCK_RESET,
gimp_image_map_tool_reset_clicked,

View File

@ -55,7 +55,6 @@
#include "gimplevelstool.h"
#include "gimptoolcontrol.h"
#include "tool_manager.h"
#include "gimp-intl.h"
@ -1527,7 +1526,8 @@ file_dialog_create (GimpLevelsTool *l_tool)
gtk_file_selection_set_filename (file_dlg, temp);
g_free (temp);
gimp_help_connect (l_tool->file_dialog, tool_manager_help_func, NULL);
gimp_help_connect (l_tool->file_dialog, gimp_standard_help_func,
GIMP_TOOL (l_tool)->tool_info->help_data);
}
static void

View File

@ -54,7 +54,6 @@
#include "gimpmeasureoptions.h"
#include "gimpmeasuretool.h"
#include "gimptoolcontrol.h"
#include "tool_manager.h"
#include "gimp-intl.h"
@ -386,7 +385,8 @@ gimp_measure_tool_button_press (GimpTool *tool,
GIMP_OBJECT (tool->tool_info)->name,
stock_id,
_("Measure Distances and Angles"),
tool_manager_help_func, NULL);
gimp_standard_help_func,
tool->tool_info->help_data);
info_dialog_add_label (measure_tool_info, _("Distance:"), distance_buf);
info_dialog_add_label (measure_tool_info, _("Angle:"), angle_buf);

View File

@ -61,7 +61,6 @@
#include "gimptransformoptions.h"
#include "gimptransformtool.h"
#include "gimptransformtool-undo.h"
#include "tool_manager.h"
#include "gimp-intl.h"
@ -1129,7 +1128,7 @@ gimp_transform_tool_dialog (GimpTransformTool *tr_tool)
GIMP_OBJECT (tool_info)->name,
stock_id,
tr_tool->shell_desc,
tool_manager_help_func, NULL);
gimp_standard_help_func, tool_info->help_data);
gimp_dialog_create_action_area (GIMP_DIALOG (tr_tool->info_dialog->shell),

View File

@ -657,46 +657,29 @@ tool_manager_get_info_by_type (Gimp *gimp,
return NULL;
}
const gchar *
tool_manager_active_get_help_data (Gimp *gimp)
{
GimpToolManager *tool_manager;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
tool_manager = tool_manager_get (gimp);
if (tool_manager->active_tool)
{
return tool_manager->active_tool->tool_info->help_data;
}
return NULL;
}
void
tool_manager_help_func (const gchar *help_data)
{
gimp_standard_help_func (tool_manager_active_get_help_data (the_gimp));
}
/* private functions */
#define TOOL_MANAGER_DATA_KEY "gimp-tool-manager"
static GQuark tool_manager_quark = 0;
static GimpToolManager *
tool_manager_get (Gimp *gimp)
{
return g_object_get_data (G_OBJECT (gimp), TOOL_MANAGER_DATA_KEY);
if (! tool_manager_quark)
tool_manager_quark = g_quark_from_static_string ("gimp-tool-manager");
return g_object_get_qdata (G_OBJECT (gimp), tool_manager_quark);
}
static void
tool_manager_set (Gimp *gimp,
GimpToolManager *tool_manager)
{
g_object_set_data (G_OBJECT (gimp), TOOL_MANAGER_DATA_KEY,
tool_manager);
if (! tool_manager_quark)
tool_manager_quark = g_quark_from_static_string ("gimp-tool-manager");
g_object_set_qdata (G_OBJECT (gimp), tool_manager_quark, tool_manager);
}
static void
@ -705,7 +688,7 @@ tool_manager_tool_changed (GimpContext *user_context,
gpointer data)
{
GimpToolManager *tool_manager;
GimpTool *new_tool = NULL;
GimpTool *new_tool = NULL;
if (! tool_info)
return;

View File

@ -73,10 +73,6 @@ void tool_manager_cursor_update_active (Gimp *gimp,
GdkModifierType state,
GimpDisplay *gdisp);
const gchar * tool_manager_active_get_help_data (Gimp *gimp);
void tool_manager_register_tool (GType tool_type,
GType tool_options_type,
GimpToolOptionsGUIFunc options_gui_func,
@ -95,7 +91,4 @@ GimpToolInfo * tool_manager_get_info_by_type (Gimp *gimp,
GType tool_type);
void tool_manager_help_func (const gchar *help_data);
#endif /* __TOOL_MANAGER_H__ */