Skip to content

Commit

Permalink
WRaster: Create header for i18n helper functions
Browse files Browse the repository at this point in the history
This patch is just adding a single header, but because it also modifies
all the C files to add the #include, it was made as a patch on its own to
ease review.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
  • Loading branch information
Christophe CURIS authored and crmafra committed May 18, 2021
1 parent aadd694 commit 19202fd
Show file tree
Hide file tree
Showing 28 changed files with 88 additions and 0 deletions.
1 change: 1 addition & 0 deletions wrlib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ libwraster_la_SOURCES = \
flip.c \
convolve.c \
save_xpm.c \
wr_i18n.h \
xutil.c \
xutil.h \
load_ppm.c
Expand Down
4 changes: 4 additions & 0 deletions wrlib/alpha_combine.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
* MA 02110-1301, USA.
*/

#include "config.h"

#include "wraster.h"
#include "wr_i18n.h"


void RCombineAlpha(unsigned char *d, unsigned char *s, int s_has_alpha,
int width, int height, int dwi, int swi, int opacity) {
Expand Down
2 changes: 2 additions & 0 deletions wrlib/color.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <assert.h>

#include "wraster.h"
#include "wr_i18n.h"


#define MIN(a,b) ((a)<(b) ? (a) : (b))
#define MAX(a,b) ((a)>(b) ? (a) : (b))
Expand Down
1 change: 1 addition & 0 deletions wrlib/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#include "wraster.h"
#include "scale.h"
#include "wr_i18n.h"


#ifndef HAVE_FLOAT_MATHFUNC
Expand Down
1 change: 1 addition & 0 deletions wrlib/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "wraster.h"
#include "convert.h"
#include "xutil.h"
#include "wr_i18n.h"


#define NFREE(n) if (n) free(n)
Expand Down
3 changes: 3 additions & 0 deletions wrlib/convolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>

#include "wraster.h"
#include "wr_i18n.h"


/*
*----------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions wrlib/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <assert.h>

#include "wraster.h"
#include "wr_i18n.h"


#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
Expand Down
1 change: 1 addition & 0 deletions wrlib/flip.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include "wraster.h"
#include "rotate.h"
#include "wr_i18n.h"


static RImage *r_flip_vertically(RImage *source);
Expand Down
2 changes: 2 additions & 0 deletions wrlib/gradient.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <assert.h>

#include "wraster.h"
#include "wr_i18n.h"


static RImage *renderHGradient(unsigned width, unsigned height, int r0, int g0, int b0, int rf, int gf, int bf);
static RImage *renderVGradient(unsigned width, unsigned height, int r0, int g0, int b0, int rf, int gf, int bf);
Expand Down
1 change: 1 addition & 0 deletions wrlib/load.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include "wraster.h"
#include "imgformat.h"
#include "wr_i18n.h"


typedef struct RCachedImage {
Expand Down
2 changes: 2 additions & 0 deletions wrlib/load_gif.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

#include "wraster.h"
#include "imgformat.h"
#include "wr_i18n.h"


static int InterlacedOffset[] = { 0, 4, 2, 1 };
static int InterlacedJumps[] = { 8, 8, 4, 2 };
Expand Down
2 changes: 2 additions & 0 deletions wrlib/load_jpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

#include "wraster.h"
#include "imgformat.h"
#include "wr_i18n.h"


/*
* <setjmp.h> is used for the optional error recovery mechanism shown in
Expand Down
1 change: 1 addition & 0 deletions wrlib/load_magick.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "wraster.h"
#include "imgformat.h"
#include "wr_i18n.h"


static int RInitMagickIfNeeded(void);
Expand Down
2 changes: 2 additions & 0 deletions wrlib/load_png.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

#include "wraster.h"
#include "imgformat.h"
#include "wr_i18n.h"


RImage *RLoadPNG(RContext *context, const char *file)
{
Expand Down
2 changes: 2 additions & 0 deletions wrlib/load_ppm.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#include "wraster.h"
#include "imgformat.h"
#include "wr_i18n.h"


/*
* fileio.c - routines to read elements based on Netpbm
Expand Down
2 changes: 2 additions & 0 deletions wrlib/load_tiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#include "wraster.h"
#include "imgformat.h"
#include "wr_i18n.h"


RImage *RLoadTIFF(const char *file, int index)
{
Expand Down
1 change: 1 addition & 0 deletions wrlib/load_webp.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include "wraster.h"
#include "imgformat.h"
#include "wr_i18n.h"


RImage *RLoadWEBP(const char *file_name)
Expand Down
2 changes: 2 additions & 0 deletions wrlib/load_xpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#include "wraster.h"
#include "imgformat.h"
#include "wr_i18n.h"


static RImage *create_rimage_from_xpm(RContext *context, XpmImage xpm)
{
Expand Down
2 changes: 2 additions & 0 deletions wrlib/load_xpm_normalized.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

#include "wraster.h"
#include "imgformat.h"
#include "wr_i18n.h"


/*
* Restricted support for XPM images.
Expand Down
1 change: 1 addition & 0 deletions wrlib/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "wraster.h"
#include "imgformat.h"
#include "convert.h"
#include "wr_i18n.h"


void RBevelImage(RImage * image, int bevel_type)
Expand Down
2 changes: 2 additions & 0 deletions wrlib/raster.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>

#include "wraster.h"
#include "wr_i18n.h"

#include <assert.h>

Expand Down
1 change: 1 addition & 0 deletions wrlib/rotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include "wraster.h"
#include "rotate.h"
#include "wr_i18n.h"

#include <math.h>

Expand Down
1 change: 1 addition & 0 deletions wrlib/save.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "wraster.h"
#include "imgformat.h"
#include "wr_i18n.h"


Bool RSaveImage(RImage * image, const char *filename, const char *format)
Expand Down
2 changes: 2 additions & 0 deletions wrlib/save_xpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

#include "wraster.h"
#include "imgformat.h"
#include "wr_i18n.h"


/*
* Restricted support for XPM images.
Expand Down
2 changes: 2 additions & 0 deletions wrlib/scale.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#include "wraster.h"
#include "scale.h"
#include "wr_i18n.h"


/*
*----------------------------------------------------------------------
Expand Down
41 changes: 41 additions & 0 deletions wrlib/wr_i18n.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Window Maker window manager
*
* Copyright (c) 2021 Window Maker Team
*
* 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 2 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, see the file COPYING.
*/

/*
* This file defines the basic stuff for WRaster's message
* internationalization in the code
*/

#ifndef WRASTER_I18N_H
#define WRASTER_I18N_H

#if defined(HAVE_LIBINTL_H) && defined(I18N)
# include <libintl.h>
# define _(text) dgettext("WRaster", (text))
#else
# define _(text) (text)
#endif

/*
* the N_ macro is used for initializers, it will make xgettext pick the
* string for translation when generating PO files
*/
#define N_(text) (text)

#endif
2 changes: 2 additions & 0 deletions wrlib/xpixmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <assert.h>

#include "wraster.h"
#include "wr_i18n.h"


static int get_shifts(unsigned long mask)
{
Expand Down
2 changes: 2 additions & 0 deletions wrlib/xutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

#include "wraster.h"
#include "xutil.h"
#include "wr_i18n.h"


#ifdef USE_XSHM

Expand Down

0 comments on commit 19202fd

Please sign in to comment.