diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1d5cb7216335..35e0aa0cf123 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -124,7 +124,6 @@ FILE(GLOB SOURCE_FILES "dtgtk/drawingarea.c" "dtgtk/expander.c" "dtgtk/gradientslider.c" - "dtgtk/icon.c" "dtgtk/paint.c" "dtgtk/range.c" "dtgtk/resetlabel.c" diff --git a/src/develop/imageop.c b/src/develop/imageop.c index c2302f584acc..8eefc4f6f6ba 100644 --- a/src/develop/imageop.c +++ b/src/develop/imageop.c @@ -39,7 +39,6 @@ #include "dtgtk/button.h" #include "dtgtk/expander.h" #include "dtgtk/gradientslider.h" -#include "dtgtk/icon.h" #include "gui/accelerators.h" #include "gui/color_picker_proxy.h" #include "gui/drag_and_drop.h" diff --git a/src/dtgtk/icon.c b/src/dtgtk/icon.c deleted file mode 100644 index 049cbd34a892..000000000000 --- a/src/dtgtk/icon.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - This file is part of darktable, - Copyright (C) 2011-2020 darktable developers. - - darktable 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 3 of the License, or - (at your option) any later version. - - darktable 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 darktable. If not, see . -*/ -#include "icon.h" -#include "gui/gtk.h" -#include - -G_DEFINE_TYPE(GtkDarktableIcon, dtgtk_icon, GTK_TYPE_EVENT_BOX); - -static gboolean _icon_draw(GtkWidget *widget, cairo_t *cr); - -static void dtgtk_icon_class_init(GtkDarktableIconClass *klass) -{ - GtkWidgetClass *widget_class = (GtkWidgetClass *)klass; - widget_class->draw = _icon_draw; -} - -static void dtgtk_icon_init(GtkDarktableIcon *icon) -{ -} - -static gboolean _icon_draw(GtkWidget *widget, cairo_t *cr) -{ - g_return_val_if_fail(widget != NULL, FALSE); - g_return_val_if_fail(DTGTK_IS_ICON(widget), FALSE); - - /* begin cairo drawing */ - GtkAllocation allocation; - gtk_widget_get_allocation(widget, &allocation); - - GtkStateFlags state = gtk_widget_get_state_flags(widget); - - GdkRGBA fg_color; - GtkStyleContext *context = gtk_widget_get_style_context(widget); - gtk_style_context_get_color(context, state, &fg_color); - - gdk_cairo_set_source_rgba(cr, &fg_color); - - /* draw icon */ - if(DTGTK_ICON(widget)->icon) - DTGTK_ICON(widget)->icon(cr, 0, 0, allocation.width, allocation.height, DTGTK_ICON(widget)->icon_flags, - DTGTK_ICON(widget)->icon_data); - - return FALSE; -} - -// Public functions -GtkWidget *dtgtk_icon_new(DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata) -{ - GtkDarktableIcon *icon; - icon = g_object_new(dtgtk_icon_get_type(), NULL); - gtk_event_box_set_visible_window(GTK_EVENT_BOX(icon), FALSE); - icon->icon = paint; - icon->icon_flags = paintflags; - icon->icon_data = paintdata; - gtk_widget_set_name(GTK_WIDGET(icon), "dt-icon"); - return (GtkWidget *)icon; -} - -void dtgtk_icon_set_paint(GtkWidget *icon, DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata) -{ - g_return_if_fail(icon != NULL); - DTGTK_ICON(icon)->icon = paint; - DTGTK_ICON(icon)->icon_flags = paintflags; - DTGTK_ICON(icon)->icon_data = paintdata; - gtk_widget_queue_draw(icon); -} - -// clang-format off -// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py -// vim: shiftwidth=2 expandtab tabstop=2 cindent -// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified; -// clang-format on - diff --git a/src/dtgtk/icon.h b/src/dtgtk/icon.h deleted file mode 100644 index 3922c5d9149d..000000000000 --- a/src/dtgtk/icon.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - This file is part of darktable, - Copyright (C) 2011-2020 darktable developers. - - darktable 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 3 of the License, or - (at your option) any later version. - - darktable 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 darktable. If not, see . -*/ - -#pragma once - -#include "paint.h" -#include - -G_BEGIN_DECLS - -#define DTGTK_TYPE_ICON dtgtk_icon_get_type() -G_DECLARE_FINAL_TYPE(GtkDarktableIcon, dtgtk_icon, DTGTK, ICON, GtkEventBox) - -struct _GtkDarktableIcon -{ - GtkEventBox widget; - DTGTKCairoPaintIconFunc icon; - gint icon_flags; - void *icon_data; -}; - -/** instantiate a new darktable icon control passing paint function as content */ -GtkWidget *dtgtk_icon_new(DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata); - -/** set the paint function for a icon */ -void dtgtk_icon_set_paint(GtkWidget *icon, DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata); - -G_END_DECLS - -// clang-format off -// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py -// vim: shiftwidth=2 expandtab tabstop=2 cindent -// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified; -// clang-format on - diff --git a/src/dtgtk/thumbnail.c b/src/dtgtk/thumbnail.c index b41c0a2f0a11..9a36cf6de1f5 100644 --- a/src/dtgtk/thumbnail.c +++ b/src/dtgtk/thumbnail.c @@ -33,7 +33,6 @@ #include "common/variables.h" #include "control/control.h" #include "dtgtk/button.h" -#include "dtgtk/icon.h" #include "dtgtk/thumbnail_btn.h" #include "gui/drag_and_drop.h" #include "gui/accelerators.h" diff --git a/src/libs/lib.c b/src/libs/lib.c index 13ef8619b42b..70954b40b37f 100644 --- a/src/libs/lib.c +++ b/src/libs/lib.c @@ -23,7 +23,6 @@ #include "control/control.h" #include "dtgtk/button.h" #include "dtgtk/expander.h" -#include "dtgtk/icon.h" #include "gui/accelerators.h" #include "gui/drag_and_drop.h" #include "gui/gtk.h" diff --git a/src/libs/location.c b/src/libs/location.c index 0c5126be21ba..be6d38985adc 100644 --- a/src/libs/location.c +++ b/src/libs/location.c @@ -22,7 +22,6 @@ #include "control/conf.h" #include "control/control.h" #include "control/jobs.h" -#include "dtgtk/icon.h" #include "gui/gtk.h" #include "libs/lib.h" #include "libs/lib_api.h" diff --git a/src/libs/modulegroups.c b/src/libs/modulegroups.c index f05d47b295ce..bd2a1cba9944 100644 --- a/src/libs/modulegroups.c +++ b/src/libs/modulegroups.c @@ -25,7 +25,6 @@ #include "control/control.h" #include "develop/develop.h" #include "dtgtk/button.h" -#include "dtgtk/icon.h" #include "gui/accelerators.h" #include "gui/gtk.h" #include "gui/presets.h"