[gimp] plug-ins: port map-object to icon names too



commit d3400542f2335f2b76afbe7b5b97c02372aeb5bd
Author: Michael Natterer <mitch gimp org>
Date:   Sat Jul 20 17:32:27 2019 +0200

    plug-ins: port map-object to icon names too
    
    it uses the same icons as lighting so didn't build since the last
    commit.

 plug-ins/map-object/Makefile.am          |   4 +-
 plug-ins/map-object/map-object-icons.c   |  43 ++++++++++++
 plug-ins/map-object/map-object-icons.h   |  37 +++++++++++
 plug-ins/map-object/map-object-preview.c |  11 ++--
 plug-ins/map-object/map-object-stock.c   | 110 -------------------------------
 plug-ins/map-object/map-object-stock.h   |  37 -----------
 plug-ins/map-object/map-object-ui.c      |  42 ++++++------
 7 files changed, 109 insertions(+), 175 deletions(-)
---
diff --git a/plug-ins/map-object/Makefile.am b/plug-ins/map-object/Makefile.am
index b78b18b831..18487a3244 100644
--- a/plug-ins/map-object/Makefile.am
+++ b/plug-ins/map-object/Makefile.am
@@ -30,6 +30,8 @@ map_object_SOURCES = \
        arcball.h               \
        map-object-apply.c      \
        map-object-apply.h      \
+       map-object-icons.c      \
+       map-object-icons.h      \
        map-object-image.c      \
        map-object-image.h      \
        map-object-main.c       \
@@ -38,8 +40,6 @@ map_object_SOURCES = \
        map-object-preview.h    \
        map-object-shade.c      \
        map-object-shade.h      \
-       map-object-stock.c      \
-       map-object-stock.h      \
        map-object-ui.c         \
        map-object-ui.h
 
diff --git a/plug-ins/map-object/map-object-icons.c b/plug-ins/map-object/map-object-icons.c
new file mode 100644
index 0000000000..be2bfc64f1
--- /dev/null
+++ b/plug-ins/map-object/map-object-icons.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "map-object-icons.h"
+
+#include "../lighting/images/lighting-icon-images.h"
+#include "../lighting/images/lighting-icon-images.c"
+
+
+void
+mapobject_icons_init (void)
+{
+  static gboolean initialized = FALSE;
+
+  GtkIconTheme *icon_theme;
+
+  if (initialized)
+    return;
+
+  initialized = TRUE;
+
+  icon_theme = gtk_icon_theme_get_default ();
+
+  gtk_icon_theme_add_resource_path (icon_theme, "/org/gimp/lighting/icons");
+}
diff --git a/plug-ins/map-object/map-object-icons.h b/plug-ins/map-object/map-object-icons.h
new file mode 100644
index 0000000000..ce3f4900c1
--- /dev/null
+++ b/plug-ins/map-object/map-object-icons.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef __MAPOBJECT_ICONS_H__
+#define __MAPOBJECT_ICONS_H__
+
+
+#define MAPOBJECT_INTENSITY_AMBIENT_LOW        "lighting-intensity-ambient-low"
+#define MAPOBJECT_INTENSITY_AMBIENT_HIGH       "lighting-intensity-ambient-high"
+#define MAPOBJECT_INTENSITY_DIFFUSE_LOW        "lighting-intensity-diffuse-low"
+#define MAPOBJECT_INTENSITY_DIFFUSE_HIGH       "lighting-intensity-diffuse-high"
+#define MAPOBJECT_REFLECTIVITY_DIFFUSE_LOW     "lighting-reflectivity-diffuse-low"
+#define MAPOBJECT_REFLECTIVITY_DIFFUSE_HIGH    "lighting-reflectivity-diffuse-high"
+#define MAPOBJECT_REFLECTIVITY_SPECULAR_LOW    "lighting-reflectivity-specular-low"
+#define MAPOBJECT_REFLECTIVITY_SPECULAR_HIGH   "lighting-reflectivity-specular-high"
+#define MAPOBJECT_REFLECTIVITY_HIGHLIGHT_LOW   "lighting-reflectivity-highlight-low"
+#define MAPOBJECT_REFLECTIVITY_HIGHLIGHT_HIGH  "lighting-reflectivity-highlight-high"
+
+
+void  mapobject_icons_init (void);
+
+
+#endif /* __MAPOBJECT_ICONS_H__ */
diff --git a/plug-ins/map-object/map-object-preview.c b/plug-ins/map-object/map-object-preview.c
index 47804afd4c..cbe909435c 100644
--- a/plug-ins/map-object/map-object-preview.c
+++ b/plug-ins/map-object/map-object-preview.c
@@ -213,17 +213,18 @@ draw_light_marker (cairo_t *cr,
                    gint xpos,
                    gint ypos)
 {
-  GdkColor color;
+  GdkRGBA color;
 
   if (mapvals.lightsource.type != POINT_LIGHT)
     return;
 
   cairo_set_line_width (cr, 1.0);
 
-  color.red   = 0x0;
-  color.green = 0x4000;
-  color.blue  = 0xFFFF;
-  gdk_cairo_set_source_color (cr, &color);
+  color.red   = 0.0;
+  color.green = 0.2;
+  color.blue  = 1.0;
+  color.alpha = 1.0;
+  gdk_cairo_set_source_rgba (cr, &color);
 
   lightx = xpos;
   lighty = ypos;
diff --git a/plug-ins/map-object/map-object-ui.c b/plug-ins/map-object/map-object-ui.c
index 03221d3be8..3e3b5dbf1a 100644
--- a/plug-ins/map-object/map-object-ui.c
+++ b/plug-ins/map-object/map-object-ui.c
@@ -9,11 +9,11 @@
 
 #include "arcball.h"
 #include "map-object-ui.h"
+#include "map-object-icons.h"
 #include "map-object-image.h"
 #include "map-object-apply.h"
 #include "map-object-preview.h"
 #include "map-object-main.h"
-#include "map-object-stock.h"
 
 #include "libgimp/stdplugins-intl.h"
 
@@ -784,8 +784,8 @@ create_material_page (void)
 
   /* Ambient intensity */
 
-  image = gtk_image_new_from_stock (STOCK_INTENSITY_AMBIENT_LOW,
-                                    GTK_ICON_SIZE_BUTTON);
+  image = gtk_image_new_from_icon_name (MAPOBJECT_INTENSITY_AMBIENT_LOW,
+                                        GTK_ICON_SIZE_BUTTON);
   label = gimp_grid_attach_aligned (GTK_GRID (grid), 0, 0,
                                     _("Ambient:"), 0.0, 0.5,
                                     image, 1);
@@ -804,15 +804,15 @@ create_material_page (void)
                            _("Amount of original color to show where no "
                              "direct light falls"), NULL);
 
-  image = gtk_image_new_from_stock (STOCK_INTENSITY_AMBIENT_HIGH,
-                                    GTK_ICON_SIZE_BUTTON);
+  image = gtk_image_new_from_icon_name (MAPOBJECT_INTENSITY_AMBIENT_HIGH,
+                                        GTK_ICON_SIZE_BUTTON);
   gtk_grid_attach (GTK_GRID (grid), image, 3, 0, 1, 1);
   gtk_widget_show (image);
 
   /* Diffuse intensity */
 
-  image = gtk_image_new_from_stock (STOCK_INTENSITY_DIFFUSE_LOW,
-                                    GTK_ICON_SIZE_BUTTON);
+  image = gtk_image_new_from_icon_name (MAPOBJECT_INTENSITY_DIFFUSE_LOW,
+                                        GTK_ICON_SIZE_BUTTON);
   label = gimp_grid_attach_aligned (GTK_GRID (grid), 0, 1,
                                     _("Diffuse:"), 0.0, 0.5,
                                     image, 1);
@@ -831,8 +831,8 @@ create_material_page (void)
                            _("Intensity of original color when lit by a light "
                              "source"), NULL);
 
-  image = gtk_image_new_from_stock (STOCK_INTENSITY_DIFFUSE_HIGH,
-                                    GTK_ICON_SIZE_BUTTON);
+  image = gtk_image_new_from_icon_name (MAPOBJECT_INTENSITY_DIFFUSE_HIGH,
+                                        GTK_ICON_SIZE_BUTTON);
   gtk_grid_attach (GTK_GRID (grid), image, 3, 1, 1, 1);
   gtk_widget_show (image);
 
@@ -853,8 +853,8 @@ create_material_page (void)
 
   /* Diffuse reflection */
 
-  image = gtk_image_new_from_stock (STOCK_REFLECTIVITY_DIFFUSE_LOW,
-                                    GTK_ICON_SIZE_BUTTON);
+  image = gtk_image_new_from_icon_name (MAPOBJECT_REFLECTIVITY_DIFFUSE_LOW,
+                                        GTK_ICON_SIZE_BUTTON);
   label = gimp_grid_attach_aligned (GTK_GRID (grid), 0, 0,
                                     _("Diffuse:"), 0.0, 0.5,
                                     image, 1);
@@ -873,15 +873,15 @@ create_material_page (void)
                            _("Higher values makes the object reflect more "
                              "light (appear lighter)"), NULL);
 
-  image = gtk_image_new_from_stock (STOCK_REFLECTIVITY_DIFFUSE_HIGH,
-                                    GTK_ICON_SIZE_BUTTON);
+  image = gtk_image_new_from_icon_name (MAPOBJECT_REFLECTIVITY_DIFFUSE_HIGH,
+                                        GTK_ICON_SIZE_BUTTON);
   gtk_grid_attach (GTK_GRID (grid), image, 3, 0, 1, 1);
   gtk_widget_show (image);
 
   /* Specular reflection */
 
-  image = gtk_image_new_from_stock (STOCK_REFLECTIVITY_SPECULAR_LOW,
-                                    GTK_ICON_SIZE_BUTTON);
+  image = gtk_image_new_from_icon_name (MAPOBJECT_REFLECTIVITY_SPECULAR_LOW,
+                                        GTK_ICON_SIZE_BUTTON);
   label = gimp_grid_attach_aligned (GTK_GRID (grid), 0, 1,
                                     _("Specular:"), 0.0, 0.5,
                                     image, 1);
@@ -900,15 +900,15 @@ create_material_page (void)
                            _("Controls how intense the highlights will be"),
                            NULL);
 
-  image = gtk_image_new_from_stock (STOCK_REFLECTIVITY_SPECULAR_HIGH,
-                                    GTK_ICON_SIZE_BUTTON);
+  image = gtk_image_new_from_icon_name (MAPOBJECT_REFLECTIVITY_SPECULAR_HIGH,
+                                        GTK_ICON_SIZE_BUTTON);
   gtk_grid_attach (GTK_GRID (grid), image, 3, 1, 1, 1);
   gtk_widget_show (image);
 
   /* Highlight */
 
-  image = gtk_image_new_from_stock (STOCK_REFLECTIVITY_HIGHLIGHT_LOW,
-                                    GTK_ICON_SIZE_BUTTON);
+  image = gtk_image_new_from_icon_name (MAPOBJECT_REFLECTIVITY_HIGHLIGHT_LOW,
+                                        GTK_ICON_SIZE_BUTTON);
   label = gimp_grid_attach_aligned (GTK_GRID (grid), 0, 2,
                                     _("Highlight:"), 0.0, 0.5,
                                     image, 1);
@@ -927,8 +927,8 @@ create_material_page (void)
                            _("Higher values makes the highlights more focused"),
                            NULL);
 
-  image = gtk_image_new_from_stock (STOCK_REFLECTIVITY_HIGHLIGHT_HIGH,
-                                    GTK_ICON_SIZE_BUTTON);
+  image = gtk_image_new_from_icon_name (MAPOBJECT_REFLECTIVITY_HIGHLIGHT_HIGH,
+                                        GTK_ICON_SIZE_BUTTON);
   gtk_grid_attach (GTK_GRID (grid), image, 3, 2, 1, 1);
   gtk_widget_show (image);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]