Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GIMP
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2,027
Issues
2,027
List
Boards
Labels
Milestones
Merge Requests
22
Merge Requests
22
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
GIMP
Commits
757ca64e
Commit
757ca64e
authored
Jun 05, 2017
by
Michael Natterer
😴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app: replace the color balance tool by a generic filter action
Move the color balance GUI to a custom gimppropgui function.
parent
34d302e6
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
191 additions
and
6 deletions
+191
-6
app/actions/filters-actions.c
app/actions/filters-actions.c
+6
-0
app/tools/Makefile.am
app/tools/Makefile.am
+0
-2
app/tools/gimp-tools.c
app/tools/gimp-tools.c
+0
-2
app/widgets/Makefile.am
app/widgets/Makefile.am
+2
-0
app/widgets/gimppropgui-color-balance.c
app/widgets/gimppropgui-color-balance.c
+144
-0
app/widgets/gimppropgui-color-balance.h
app/widgets/gimppropgui-color-balance.h
+34
-0
app/widgets/gimppropgui.c
app/widgets/gimppropgui.c
+3
-0
menus/image-menu.xml.in
menus/image-menu.xml.in
+1
-1
po/POTFILES.in
po/POTFILES.in
+1
-1
No files found.
app/actions/filters-actions.c
View file @
757ca64e
...
...
@@ -208,6 +208,11 @@ static const GimpStringActionEntry filters_interactive_actions[] =
"gegl:checkerboard"
,
GIMP_HELP_FILTER_CHECKERBOARD
},
{
"filters-color-balance"
,
GIMP_ICON_TOOL_COLOR_BALANCE
,
NC_
(
"filters-action"
,
"Color _Balance..."
),
NULL
,
NULL
,
"gimp:color-balance"
,
GIMP_HELP_TOOL_COLOR_BALANCE
},
{
"filters-color-exchange"
,
GIMP_ICON_GEGL
,
NC_
(
"filters-action"
,
"_Color Exchange..."
),
NULL
,
NULL
,
"gegl:color-exchange"
,
...
...
@@ -788,6 +793,7 @@ filters_actions_update (GimpActionGroup *group,
SET_SENSITIVE
(
"filters-cartoon"
,
writable
);
SET_SENSITIVE
(
"filters-channel-mixer"
,
writable
);
SET_SENSITIVE
(
"filters-checkerboard"
,
writable
);
SET_SENSITIVE
(
"filters-color-balance"
,
writable
&&
!
gray
);
SET_SENSITIVE
(
"filters-color-enhance"
,
writable
&&
!
gray
);
SET_SENSITIVE
(
"filters-color-exchange"
,
writable
);
SET_SENSITIVE
(
"filters-colorize"
,
writable
&&
!
gray
);
...
...
app/tools/Makefile.am
View file @
757ca64e
...
...
@@ -52,8 +52,6 @@ libapptools_a_sources = \
gimpcoloroptions.h
\
gimpcolortool.c
\
gimpcolortool.h
\
gimpcolorbalancetool.c
\
gimpcolorbalancetool.h
\
gimpcolorpickeroptions.c
\
gimpcolorpickeroptions.h
\
gimpcolorpickertool.c
\
...
...
app/tools/gimp-tools.c
View file @
757ca64e
...
...
@@ -46,7 +46,6 @@
#include "gimpbycolorselecttool.h"
#include "gimpcagetool.h"
#include "gimpclonetool.h"
#include "gimpcolorbalancetool.h"
#include "gimpcolorpickertool.h"
#include "gimpconvolvetool.h"
#include "gimpcroptool.h"
...
...
@@ -176,7 +175,6 @@ gimp_tools_init (Gimp *gimp)
/* color tools */
gimp_color_balance_tool_register
,
gimp_hue_saturation_tool_register
,
gimp_brightness_contrast_tool_register
,
gimp_threshold_tool_register
,
...
...
app/widgets/Makefile.am
View file @
757ca64e
...
...
@@ -301,6 +301,8 @@ libappwidgets_a_sources = \
gimpprogressdialog.h
\
gimppropgui.c
\
gimppropgui.h
\
gimppropgui-color-balance.c
\
gimppropgui-color-balance.h
\
gimppropgui-constructors.c
\
gimppropgui-constructors.h
\
gimppropgui-eval.c
\
...
...
app/
tools/gimpcolorbalancetool
.c
→
app/
widgets/gimppropgui-color-balance
.c
View file @
757ca64e
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* gimppropgui-color-balance.c
*
* 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
...
...
@@ -17,144 +19,27 @@
#include "config.h"
#include <string.h>
#include <gegl.h>
#include <gegl-paramspecs.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "
tool
s-types.h"
#include "
widget
s-types.h"
#include "operations/gimpcolorbalanceconfig.h"
#include "core/gimpdrawable.h"
#include "core/gimperror.h"
#include "core/gimpimage.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimpspinscale.h"
#include "display/gimpdisplay.h"
#include "gimpcolorbalancetool.h"
#include "gimpfilteroptions.h"
#include "gimppropgui.h"
#include "gimppropgui-color-balance.h"
#include "gimppropwidgets.h"
#include "gimpspinscale.h"
#include "gimp-intl.h"
/* local function prototypes */
static
gboolean
gimp_color_balance_tool_initialize
(
GimpTool
*
tool
,
GimpDisplay
*
display
,
GError
**
error
);
static
gchar
*
gimp_color_balance_tool_get_operation
(
GimpFilterTool
*
filter_tool
,
gchar
**
title
,
gchar
**
description
,
gchar
**
undo_desc
,
gchar
**
icon_name
,
gchar
**
help_id
,
gboolean
*
has_settings
,
gchar
**
settings_folder
,
gchar
**
import_dialog_title
,
gchar
**
export_dialog_title
);
static
void
gimp_color_balance_tool_dialog
(
GimpFilterTool
*
filter_tool
);
static
void
gimp_color_balance_tool_reset
(
GimpFilterTool
*
filter_tool
);
static
void
color_balance_range_reset_callback
(
GtkWidget
*
widget
,
GimpFilterTool
*
filter_tool
);
G_DEFINE_TYPE
(
GimpColorBalanceTool
,
gimp_color_balance_tool
,
GIMP_TYPE_FILTER_TOOL
)
#define parent_class gimp_color_balance_tool_parent_class
void
gimp_color_balance_tool_register
(
GimpToolRegisterCallback
callback
,
gpointer
data
)
{
(
*
callback
)
(
GIMP_TYPE_COLOR_BALANCE_TOOL
,
GIMP_TYPE_FILTER_OPTIONS
,
NULL
,
0
,
"gimp-color-balance-tool"
,
_
(
"Color Balance"
),
_
(
"Color Balance Tool: Adjust color distribution"
),
N_
(
"Color _Balance..."
),
NULL
,
NULL
,
GIMP_HELP_TOOL_COLOR_BALANCE
,
GIMP_ICON_TOOL_COLOR_BALANCE
,
data
);
}
static
void
gimp_color_balance_tool_class_init
(
GimpColorBalanceToolClass
*
klass
)
{
GimpToolClass
*
tool_class
=
GIMP_TOOL_CLASS
(
klass
);
GimpFilterToolClass
*
filter_tool_class
=
GIMP_FILTER_TOOL_CLASS
(
klass
);
tool_class
->
initialize
=
gimp_color_balance_tool_initialize
;
filter_tool_class
->
get_operation
=
gimp_color_balance_tool_get_operation
;
filter_tool_class
->
dialog
=
gimp_color_balance_tool_dialog
;
filter_tool_class
->
reset
=
gimp_color_balance_tool_reset
;
}
static
void
gimp_color_balance_tool_init
(
GimpColorBalanceTool
*
cb_tool
)
{
}
static
gboolean
gimp_color_balance_tool_initialize
(
GimpTool
*
tool
,
GimpDisplay
*
display
,
GError
**
error
)
{
GimpImage
*
image
=
gimp_display_get_image
(
display
);
GimpDrawable
*
drawable
=
gimp_image_get_active_drawable
(
image
);
if
(
!
drawable
)
return
FALSE
;
if
(
!
gimp_drawable_is_rgb
(
drawable
))
{
g_set_error_literal
(
error
,
GIMP_ERROR
,
GIMP_FAILED
,
_
(
"Color Balance operates only on RGB color layers."
));
return
FALSE
;
}
return
GIMP_TOOL_CLASS
(
parent_class
)
->
initialize
(
tool
,
display
,
error
);
}
static
gchar
*
gimp_color_balance_tool_get_operation
(
GimpFilterTool
*
filter_tool
,
gchar
**
title
,
gchar
**
description
,
gchar
**
undo_desc
,
gchar
**
icon_name
,
gchar
**
help_id
,
gboolean
*
has_settings
,
gchar
**
settings_folder
,
gchar
**
import_dialog_title
,
gchar
**
export_dialog_title
)
{
*
description
=
g_strdup
(
_
(
"Adjust Color Balance"
));
*
has_settings
=
TRUE
;
*
settings_folder
=
g_strdup
(
"color-balance"
);
*
import_dialog_title
=
g_strdup
(
_
(
"Import Color Balance Settings"
));
*
export_dialog_title
=
g_strdup
(
_
(
"Export Color Balance Settings"
));
return
g_strdup
(
"gimp:color-balance"
);
}
/**************************/
/* Color Balance dialog */
/**************************/
static
void
create_levels_scale
(
GObject
*
config
,
const
gchar
*
property_name
,
...
...
@@ -186,20 +71,25 @@ create_levels_scale (GObject *config,
gtk_widget_show
(
label
);
}
static
void
gimp_color_balance_tool_dialog
(
GimpFilterTool
*
filter_tool
)
GtkWidget
*
_gimp_prop_gui_new_color_balance
(
GObject
*
config
,
GParamSpec
**
param_specs
,
guint
n_param_specs
,
GeglRectangle
*
area
,
GimpContext
*
context
,
GimpCreatePickerFunc
create_picker_func
,
gpointer
picker_creator
)
{
GimpColorBalanceTool
*
cb_tool
=
GIMP_COLOR_BALANCE_TOOL
(
filter_tool
);
GtkWidget
*
main_vbox
;
GtkWidget
*
vbox
;
GtkWidget
*
hbox
;
GtkWidget
*
table
;
GtkWidget
*
button
;
GtkWidget
*
frame
;
GtkWidget
*
main_vbox
;
GtkWidget
*
vbox
;
GtkWidget
*
hbox
;
GtkWidget
*
table
;
GtkWidget
*
button
;
GtkWidget
*
frame
;
main_vbox
=
g
imp_filter_tool_dialog_get_vbox
(
filter_tool
);
main_vbox
=
g
tk_box_new
(
GTK_ORIENTATION_VERTICAL
,
4
);
frame
=
gimp_prop_enum_radio_frame_new
(
filter_tool
->
config
,
"range"
,
frame
=
gimp_prop_enum_radio_frame_new
(
config
,
"range"
,
_
(
"Select Range to Adjust"
),
0
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
main_vbox
),
frame
,
FALSE
,
FALSE
,
0
);
...
...
@@ -220,15 +110,15 @@ gimp_color_balance_tool_dialog (GimpFilterTool *filter_tool)
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
table
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
table
);
create_levels_scale
(
filter_tool
->
config
,
"cyan-red"
,
create_levels_scale
(
config
,
"cyan-red"
,
_
(
"Cyan"
),
_
(
"Red"
),
table
,
0
);
create_levels_scale
(
filter_tool
->
config
,
"magenta-green"
,
create_levels_scale
(
config
,
"magenta-green"
,
_
(
"Magenta"
),
_
(
"Green"
),
table
,
1
);
create_levels_scale
(
filter_tool
->
config
,
"yellow-blue"
,
create_levels_scale
(
config
,
"yellow-blue"
,
_
(
"Yellow"
),
_
(
"Blue"
),
table
,
2
);
...
...
@@ -240,36 +130,15 @@ gimp_color_balance_tool_dialog (GimpFilterTool *filter_tool)
gtk_box_pack_end
(
GTK_BOX
(
hbox
),
button
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
button
);
g_signal_connect
(
button
,
"clicked"
,
G_CALLBACK
(
color_balance_range_reset_callback
),
cb_tool
);
g_signal_connect
_swapped
(
button
,
"clicked"
,
G_CALLBACK
(
gimp_color_balance_config_reset_range
),
config
);
button
=
gimp_prop_check_button_new
(
filter_tool
->
config
,
button
=
gimp_prop_check_button_new
(
config
,
"preserve-luminosity"
,
_
(
"Preserve _luminosity"
));
gtk_box_pack_end
(
GTK_BOX
(
main_vbox
),
button
,
FALSE
,
FALSE
,
0
);
gtk_widget_show
(
button
);
}
static
void
gimp_color_balance_tool_reset
(
GimpFilterTool
*
filter_tool
)
{
GimpTransferMode
range
;
g_object_get
(
filter_tool
->
config
,
"range"
,
&
range
,
NULL
);
GIMP_FILTER_TOOL_CLASS
(
parent_class
)
->
reset
(
filter_tool
);
g_object_set
(
filter_tool
->
config
,
"range"
,
range
,
NULL
);
}
static
void
color_balance_range_reset_callback
(
GtkWidget
*
widget
,
GimpFilterTool
*
filter_tool
)
{
gimp_color_balance_config_reset_range
(
GIMP_COLOR_BALANCE_CONFIG
(
filter_tool
->
config
));
return
main_vbox
;
}
app/
tools/gimpcolorbalancetool
.h
→
app/
widgets/gimppropgui-color-balance
.h
View file @
757ca64e
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* gimppropgui-color-balance.h
*
* 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
...
...
@@ -15,40 +17,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_COLOR_BALANCE_TOOL_H__
#define __GIMP_COLOR_BALANCE_TOOL_H__
#include "gimpfiltertool.h"
#define GIMP_TYPE_COLOR_BALANCE_TOOL (gimp_color_balance_tool_get_type ())
#define GIMP_COLOR_BALANCE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_BALANCE_TOOL, GimpColorBalanceTool))
#define GIMP_COLOR_BALANCE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_BALANCE_TOOL, GimpColorBalanceToolClass))
#define GIMP_IS_COLOR_BALANCE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_BALANCE_TOOL))
#define GIMP_COLOR_BALANCE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_BALANCE_TOOL, GimpColorBalanceToolClass))
#define GIMP_IS_COLOR_BALANCE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_BALANCE_TOOL))
#define GIMP_COLOR_BALANCE_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_BALANCE_TOOL, GimpColorBalanceToolClass))
typedef
struct
_GimpColorBalanceTool
GimpColorBalanceTool
;
typedef
struct
_GimpColorBalanceToolClass
GimpColorBalanceToolClass
;
struct
_GimpColorBalanceTool
{
GimpFilterTool
parent_instance
;
};
struct
_GimpColorBalanceToolClass
{
GimpFilterToolClass
parent_class
;
};
#ifndef __GIMP_PROP_GUI_COLOR_BALANCE_H__
#define __GIMP_PROP_GUI_COLOR_BALANCE_H__
void
gimp_color_balance_tool_register
(
GimpToolRegisterCallback
callback
,
gpointer
data
);
GType
gimp_color_balance_tool_get_type
(
void
)
G_GNUC_CONST
;
GtkWidget
*
_gimp_prop_gui_new_color_balance
(
GObject
*
config
,
GParamSpec
**
param_specs
,
guint
n_param_specs
,
GeglRectangle
*
area
,
GimpContext
*
context
,
GimpCreatePickerFunc
create_picker_func
,
gpointer
picker_creator
);
#endif
/* __GIMP_COLOR_BALANCE_TOOL_H__
*/
#endif
/* __GIMP_PROP_GUI_COLOR_BALANCE_H__
*/
app/widgets/gimppropgui.c
View file @
757ca64e
...
...
@@ -43,6 +43,7 @@
#include "gimpmessagebox.h"
#include "gimpspinscale.h"
#include "gimppropgui.h"
#include "gimppropgui-color-balance.h"
#include "gimppropgui-constructors.h"
#include "gimppropgui-eval.h"
#include "gimppropwidgets.h"
...
...
@@ -431,6 +432,8 @@ static const struct
gui_new_funcs
[]
=
{
{
"GimpColorBalanceConfig"
,
_gimp_prop_gui_new_color_balance
},
{
"GimpGegl-gegl-color-rotate-config"
,
_gimp_prop_gui_new_color_rotate
},
{
"GimpGegl-gegl-convolution-matrix-config"
,
...
...
menus/image-menu.xml.in
View file @
757ca64e
...
...
@@ -556,7 +556,7 @@
</menu>
<menu
action=
"colors-menu"
name=
"Colors"
>
<menuitem
action=
"
tool
s-color-balance"
/>
<menuitem
action=
"
filter
s-color-balance"
/>
<menuitem
action=
"filters-color-temperature"
/>
<menuitem
action=
"filters-hue-chroma"
/>
<menuitem
action=
"tools-hue-saturation"
/>
...
...
po/POTFILES.in
View file @
757ca64e
...
...
@@ -381,7 +381,6 @@ app/tools/gimpcageoptions.c
app/tools/gimpcagetool.c
app/tools/gimpcloneoptions-gui.c
app/tools/gimpclonetool.c
app/tools/gimpcolorbalancetool.c
app/tools/gimpcoloroptions.c
app/tools/gimpcolorpickeroptions.c
app/tools/gimpcolorpickertool.c
...
...
@@ -537,6 +536,7 @@ app/widgets/gimppdbdialog.c
app/widgets/gimppickablepopup.c
app/widgets/gimppluginview.c
app/widgets/gimpprogressdialog.c
app/widgets/gimppropgui-color-balance.c
app/widgets/gimppropgui-constructors.c
app/widgets/gimppropgui.c
app/widgets/gimppropwidgets.c
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment