First batch of changes to merge the Win32 version. This will be

done in pieces, don't expect to be able to compile on Win32 from
these sources yet.  Ans of course, the official version of GTk+
doesn't include the Win32 stuff yet.
This commit is contained in:
Tor Lillqvist 1999-02-20 23:20:54 +00:00
parent f67bef8c61
commit a27cedc001
90 changed files with 663 additions and 147 deletions

View File

@ -15,14 +15,25 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/types.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef _MSC_VER
#include <process.h> /* For _getpid() */
#endif
#include <gtk/gtk.h>
@ -73,8 +84,6 @@
#include "color_notebook.h"
#include "color_select.h"
#include "config.h"
#include "libgimp/gimpintl.h"
#define LOGO_WIDTH_MIN 300
@ -169,21 +178,22 @@ splash_logo_load_size (GtkWidget *window)
if (logo_pixmap)
return TRUE;
g_snprintf (buf, sizeof(buf), "%s/gimp1_1_splash.ppm", DATADIR);
g_snprintf (buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "gimp1_1_splash.ppm",
DATADIR);
fp = fopen (buf, "rb");
if (!fp)
return 0;
fgets (buf, 1024, fp);
fgets (buf, sizeof (buf), fp);
if (strcmp (buf, "P6\n") != 0)
{
fclose (fp);
return 0;
}
fgets (buf, 1024, fp);
fgets (buf, 1024, fp);
fgets (buf, sizeof (buf), fp);
fgets (buf, sizeof (buf), fp);
sscanf (buf, "%d %d", &logo_width, &logo_height);
fclose (fp);
@ -204,24 +214,25 @@ splash_logo_load (GtkWidget *window)
if (logo_pixmap)
return TRUE;
g_snprintf (buf, sizeof(buf), "%s/gimp1_1_splash.ppm", DATADIR);
g_snprintf (buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "gimp1_1_splash.ppm",
DATADIR);
fp = fopen (buf, "rb");
if (!fp)
return 0;
fgets (buf, 1024, fp);
fgets (buf, sizeof (buf), fp);
if (strcmp (buf, "P6\n") != 0)
{
fclose (fp);
return 0;
}
fgets (buf, 1024, fp);
fgets (buf, 1024, fp);
fgets (buf, sizeof (buf), fp);
fgets (buf, sizeof (buf), fp);
sscanf (buf, "%d %d", &logo_width, &logo_height);
fgets (buf, 1024, fp);
fgets (buf, sizeof (buf), fp);
if (strcmp (buf, "255\n") != 0)
{
fclose (fp);
@ -273,6 +284,7 @@ splash_text_draw (GtkWidget *widget)
((logo_area_width - gdk_string_width (font, NAME)) / 2),
(0.25 * logo_area_height),
NAME);
gdk_font_unref (font);
font = gdk_font_load ("-Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-*");
gdk_draw_string (widget->window,
@ -293,6 +305,7 @@ splash_text_draw (GtkWidget *widget)
((logo_area_width - gdk_string_width (font, AUTHORS)) / 2),
(0.80 * logo_area_height),
AUTHORS);
gdk_font_unref (font);
}
static void
@ -424,7 +437,7 @@ app_init_update_status(char *label1val,
{
while ( strlen (label2val) > max_label_length )
{
temp = strchr (label2val, '/');
temp = strchr (label2val, G_DIR_SEPARATOR);
if (temp == NULL) /* for sanity */
break;
temp++;
@ -462,7 +475,7 @@ app_init (void)
gimp_dir = gimp_directory ();
if (gimp_dir[0] != '\000')
{
g_snprintf (filename, MAXPATHLEN, "%s/gtkrc", gimp_dir);
g_snprintf (filename, MAXPATHLEN, "%s" G_DIR_SEPARATOR_S "gtkrc", gimp_dir);
if ((be_verbose == TRUE) || (no_splash == TRUE))
g_print (_("parsing \"%s\"\n"), filename);
@ -539,7 +552,8 @@ app_init (void)
if (swap_path == NULL)
swap_path = "/tmp";
toast_old_temp_files ();
path = g_strdup_printf ("%s/gimpswap.%ld", swap_path, (long)getpid ());
path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "gimpswap.%ld",
swap_path, (long)getpid ());
tile_swap_add (path, NULL, NULL);
g_free (path);
@ -759,9 +773,17 @@ toast_old_temp_files (void)
*/
int pid = atoi (entry->d_name + 9);
#ifndef NATIVE_WIN32
if (kill (pid, 0))
#else
/* On Windows, you can't remove open files anyhow,
* so no harm trying.
*/
#endif
{
g_string_sprintf (filename, "%s/%s", swap_path, entry->d_name);
g_string_sprintf (filename, "%s" G_DIR_SEPARATOR_S "%s",
swap_path, entry->d_name);
unlink (filename->str);
}
}

View File

@ -19,11 +19,23 @@
#define __APPENV_H__
#include "glib.h"
/* The GIMP shouldn't need to know much about X11 (or Windows), so
* I'll remove this inclusion of gdkx.h. This will speed up compilations
* a bit, too. If some source file needs gdkx.h, it can include it.
*/
#if 0
#include "gdk/gdkx.h"
#endif
#include "gtk/gtk.h"
#include "gimpsetF.h"
#include "colormap_dialog.t.h"
/* Without gdkx.h no GDK_DISPLAY() */
#if 0
#define DISPLAY ((Display *) GDK_DISPLAY())
#endif
/* important macros - we reuse the ones from glib */
#define BOUNDS(a,x,y) CLAMP(a,x,y)

View File

@ -30,6 +30,7 @@
#include <math.h>
#include <stdlib.h>
#include "appenv.h"
#include "asupsample.h"

View File

@ -15,12 +15,22 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <sys/stat.h>
#ifdef _MSC_VER
#include <process.h> /* For _getpid() */
#endif
#include "appenv.h"
#include "drawable.h"
#include "errors.h"
@ -416,7 +426,8 @@ generate_unique_filename (void)
{
pid_t pid;
pid = getpid ();
return g_strdup_printf ("%s/gimp%d.%d", temp_path, (int) pid, swap_index++);
return g_strdup_printf ("%s" G_DIR_SEPARATOR_S "gimp%d.%d",
temp_path, (int) pid, swap_index++);
}

View File

@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <string.h>
#include "tile_cache.h"
#include "tile_manager.h"
#include "tile_swap.h"

View File

@ -1,13 +1,21 @@
#include "config.h"
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef USE_PTHREADS
#include <pthread.h>
#endif
#ifdef _MSC_VER
#include <io.h>
#endif
#include "libgimp/gimpintl.h"
#define MAX_OPEN_SWAP_FILES 16
@ -352,7 +360,11 @@ tile_swap_open (SwapFile *swap_file)
nopen_swap_files -= 1;
}
#ifndef NATIVE_WIN32
swap_file->fd = open (swap_file->filename, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR);
#else
swap_file->fd = open (swap_file->filename, O_CREAT|O_RDWR|_O_BINARY, _S_IREAD|_S_IWRITE);
#endif
if (swap_file->fd == -1)
{
g_message (_("unable to open swap file...BAD THINGS WILL HAPPEN SOON"));

View File

@ -1,9 +1,13 @@
#include "config.h"
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "appenv.h"
#include "app_procs.h"
@ -43,10 +47,14 @@ batch_init ()
{
if (!read_from_stdin)
{
#ifndef NATIVE_WIN32 /* for now */
g_print (_("reading batch commands from stdin\n"));
gdk_input_add (STDIN_FILENO, GDK_INPUT_READ, batch_read, NULL);
read_from_stdin = TRUE;
}
#else
g_error ("Batch mode from standard input not implemented on Win32");
#endif
}
else
{

View File

@ -31,6 +31,10 @@
#define ROUND(A) floor((A)+0.5)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
static Blob *
blob_new (int y, int height)
{

View File

@ -235,7 +235,7 @@ clone_paint_func (PaintCore *paint_core,
y2 = paint_core->lasty;
/* If the control key is down, move the src target and return */
if (paint_core->state & ControlMask)
if (paint_core->state & GDK_CONTROL_MASK)
{
src_x = x1;
src_y = y1;
@ -269,7 +269,7 @@ clone_paint_func (PaintCore *paint_core,
break;
case INIT_PAINT :
if (paint_core->state & ControlMask)
if (paint_core->state & GDK_CONTROL_MASK)
{
the_src_gdisp = gdisp;
clone_set_src_drawable(drawable);

View File

@ -17,6 +17,7 @@
*/
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "color_area.h"
#include "color_notebook.h"

View File

@ -17,6 +17,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "color_select.h"

View File

@ -429,9 +429,11 @@ ipal_clear (GimpColormapDialog* ipal)
palette = GTK_WIDGET(ipal->palette);
width = palette->allocation.width;
height = palette->allocation.height;
row = g_new(guchar, width * 3);
/* Watch out for negative values (at least on Win32) */
width = (int) (gint16) palette->allocation.width;
height = (int) (gint16) palette->allocation.height;
if (width > 0)
row = g_new(guchar, width * 3);
gtk_preview_size(ipal->palette, width, height);
@ -448,7 +450,8 @@ ipal_clear (GimpColormapDialog* ipal)
for (j = 0; j < 4 && i+j < height; j++)
gtk_preview_draw_row (ipal->palette, row, 0, i + j, width);
}
g_free (row);
if (width > 0)
g_free (row);
gtk_widget_draw (palette, NULL);
}

View File

@ -18,12 +18,24 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "appenv.h"
#include "gimpbrushgenerated.h"
#include "paint_core.h"
#include "gimprc.h"
#include <math.h>
#include <stdio.h>
#define OVERSAMPLING 5
@ -228,7 +240,7 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
register double exponent;
register guchar a;
register int length;
register char *lookup;
register guchar *lookup;
double buffer[OVERSAMPLING];
register double sum, c, s, tx, ty;
int width, height;

View File

@ -18,12 +18,24 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "appenv.h"
#include "gimpbrushgenerated.h"
#include "paint_core.h"
#include "gimprc.h"
#include <math.h>
#include <stdio.h>
#define OVERSAMPLING 5
@ -228,7 +240,7 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
register double exponent;
register guchar a;
register int length;
register char *lookup;
register guchar *lookup;
double buffer[OVERSAMPLING];
register double sum, c, s, tx, ty;
int width, height;

View File

@ -18,12 +18,24 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "appenv.h"
#include "gimpbrushgenerated.h"
#include "paint_core.h"
#include "gimprc.h"
#include <math.h>
#include <stdio.h>
#define OVERSAMPLING 5
@ -228,7 +240,7 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
register double exponent;
register guchar a;
register int length;
register char *lookup;
register guchar *lookup;
double buffer[OVERSAMPLING];
register double sum, c, s, tx, ty;
int width, height;

View File

@ -18,15 +18,29 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef _MSC_VER
#ifndef S_ISDIR
#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#endif
#ifndef S_IXUSR
#define S_IXUSR _S_IEXEC
#endif
#endif
#include <glib.h>
#include "datafiles.h"
@ -70,7 +84,7 @@ datafiles_read_directories (char *path_str,
next_token = local_path;
token = xstrsep(&next_token, ":");
token = xstrsep(&next_token, G_SEARCHPATH_SEPARATOR_S);
while (token)
{
@ -90,8 +104,8 @@ datafiles_read_directories (char *path_str,
if (!err && S_ISDIR(filestat.st_mode))
{
if (path[strlen(path) - 1] != '/')
strcat(path, "/");
if (path[strlen(path) - 1] != G_DIR_SEPARATOR)
strcat(path, G_DIR_SEPARATOR_S);
/* Open directory */
dir = opendir(path);
@ -124,7 +138,7 @@ datafiles_read_directories (char *path_str,
g_free(path);
token = xstrsep(&next_token, ":");
token = xstrsep(&next_token, G_SEARCHPATH_SEPARATOR_S);
} /* while */
g_free(local_path);

View File

@ -19,7 +19,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <strings.h>
#include <string.h>
#include "gimpdrawableP.h"
#include "gimpsignal.h"
#include "gimage.h"

View File

@ -15,6 +15,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <string.h>
#include "gimpobjectP.h"
#include "gimpobject.h"
#include "gimpsignal.h"

View File

@ -17,6 +17,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "buildmenu.h"
#include "channels_dialog.h"

View File

@ -18,15 +18,29 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef _MSC_VER
#ifndef S_ISDIR
#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#endif
#ifndef S_IXUSR
#define S_IXUSR _S_IEXEC
#endif
#endif
#include <glib.h>
#include "datafiles.h"
@ -70,7 +84,7 @@ datafiles_read_directories (char *path_str,
next_token = local_path;
token = xstrsep(&next_token, ":");
token = xstrsep(&next_token, G_SEARCHPATH_SEPARATOR_S);
while (token)
{
@ -90,8 +104,8 @@ datafiles_read_directories (char *path_str,
if (!err && S_ISDIR(filestat.st_mode))
{
if (path[strlen(path) - 1] != '/')
strcat(path, "/");
if (path[strlen(path) - 1] != G_DIR_SEPARATOR)
strcat(path, G_DIR_SEPARATOR_S);
/* Open directory */
dir = opendir(path);
@ -124,7 +138,7 @@ datafiles_read_directories (char *path_str,
g_free(path);
token = xstrsep(&next_token, ":");
token = xstrsep(&next_token, G_SEARCHPATH_SEPARATOR_S);
} /* while */
g_free(local_path);

View File

@ -18,10 +18,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <time.h>
#include "appenv.h"
#include "module_db.h"
@ -335,16 +340,14 @@ module_info_free (module_info *mod)
/* helper functions */
/* name must be of the form lib*.so */
/* TODO: need support for WIN32-style dll names. Maybe this function
* should live in libgmodule? */
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
static gboolean
valid_module_name (const char *filename)
{
const char *basename;
int len;
basename = strrchr (filename, '/');
basename = strrchr (filename, G_DIR_SEPARATOR);
if (basename)
basename++;
else
@ -352,6 +355,7 @@ valid_module_name (const char *filename)
len = strlen (basename);
#ifndef WIN32
if (len < 3 + 1 + 3)
return FALSE;
@ -360,6 +364,10 @@ valid_module_name (const char *filename)
if (strcmp (basename + len - 3, ".so"))
return FALSE;
#else
if (g_strcasecmp (basename + len - 4, ".dll"))
return FALSE;
#endif
return TRUE;
}

View File

@ -1,5 +1,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "appenv.h"
#include "about_dialog.h"
#include "actionarea.h"

View File

@ -45,9 +45,11 @@ tips_dialog_create ()
if (tips_count == 0)
{
if ((gimp_data_dir = getenv ("GIMP_DATADIR")) != NULL)
temp = (char *) g_strdup_printf ("%s/%s", gimp_data_dir, TIPS_FILE_NAME);
temp = (char *) g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
gimp_data_dir, TIPS_FILE_NAME);
else
temp = (char *) g_strdup_printf ("%s/%s", DATADIR, TIPS_FILE_NAME);
temp = (char *) g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
DATADIR, TIPS_FILE_NAME);
read_tips_file ((char *)temp);
g_free (temp);
}
@ -219,7 +221,7 @@ read_tips_file (char *filename)
char *tip = NULL;
char *str = NULL;
fp = fopen (filename, "rb");
fp = fopen (filename, "r");
if (!fp)
{
store_tip (_("Your GIMP tips file appears to be missing!\n"

View File

@ -329,7 +329,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
/* if the first mouse button is down, check for automatic
* scrolling...
*/
if ((mevent->state & Button1Mask) && !active_tool->scroll_lock)
if ((mevent->state & GDK_BUTTON1_MASK) && !active_tool->scroll_lock)
{
if (mevent->x < 0 || mevent->y < 0 ||
mevent->x > gdisp->disp_width ||

View File

@ -329,7 +329,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
/* if the first mouse button is down, check for automatic
* scrolling...
*/
if ((mevent->state & Button1Mask) && !active_tool->scroll_lock)
if ((mevent->state & GDK_BUTTON1_MASK) && !active_tool->scroll_lock)
{
if (mevent->x < 0 || mevent->y < 0 ||
mevent->x > gdisp->disp_width ||

View File

@ -17,6 +17,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "buildmenu.h"
#include "channels_dialog.h"

View File

@ -329,7 +329,7 @@ gdisplay_canvas_events (GtkWidget *canvas,
/* if the first mouse button is down, check for automatic
* scrolling...
*/
if ((mevent->state & Button1Mask) && !active_tool->scroll_lock)
if ((mevent->state & GDK_BUTTON1_MASK) && !active_tool->scroll_lock)
{
if (mevent->x < 0 || mevent->y < 0 ||
mevent->x > gdisp->disp_width ||

View File

@ -13,14 +13,15 @@
* GNU General Public License for more details.
*/
#include "docindexif.h"
#include "docindex.h"
#include <gtk/gtk.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "docindexif.h"
#include "docindex.h"
idea_manager *ideas = NULL;
static GList *idea_list = NULL; /* of gchar *. */
static gint x = 0, y = 0, width = 0, height = 0;

View File

@ -18,7 +18,6 @@
#include <ctype.h>
#include <gdk/gdkprivate.h>
#include <stdio.h>
#include "libgimp/gimpintl.h"

View File

@ -19,15 +19,32 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include "gtk/gtk.h"
#ifdef _MSC_VER
#include <io.h>
#ifndef S_IRUSR
#define S_IRUSR _S_IREAD
#endif
#ifndef S_IWUSR
#define S_IWUSR _S_IWRITE
#endif
#endif
#include <gtk/gtk.h>
#include "commands.h"
#include "session.h"

View File

@ -15,14 +15,24 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
#include <sys/types.h>
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include "appenv.h"

View File

@ -16,16 +16,29 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#ifdef _MSC_VER
#include <process.h> /* For _getpid() */
#include <direct.h> /* For _mkdir() */
#define mkdir(path,mode) _mkdir(path)
#endif
#include "appenv.h"
#include "actionarea.h"
#include "cursorutil.h"
@ -534,7 +547,8 @@ file_open_callback (GtkWidget *w,
if (GTK_WIDGET_VISIBLE (fileload))
return;
gtk_file_selection_set_filename (GTK_FILE_SELECTION(fileload), "./");
gtk_file_selection_set_filename (GTK_FILE_SELECTION(fileload),
"." G_DIR_SEPARATOR_S);
gtk_window_set_title (GTK_WINDOW (fileload), _("Load Image"));
}
@ -707,7 +721,8 @@ file_save_as_callback (GtkWidget *w,
if (GTK_WIDGET_VISIBLE (filesave))
return;
gtk_file_selection_set_filename (GTK_FILE_SELECTION(filesave), "./");
gtk_file_selection_set_filename (GTK_FILE_SELECTION(filesave),
"." G_DIR_SEPARATOR_S);
gtk_window_set_title (GTK_WINDOW (filesave), _("Save Image"));
}
@ -1386,9 +1401,9 @@ file_open_ok_callback (GtkWidget *w,
if (err == 0 && (buf.st_mode & S_IFDIR))
{
GString *s = g_string_new (filename);
if (s->str[s->len - 1] != '/')
if (s->str[s->len - 1] != G_DIR_SEPARATOR)
{
g_string_append_c (s, '/');
g_string_append_c (s, G_DIR_SEPARATOR);
}
gtk_file_selection_set_filename (fs, s->str);
g_string_free (s, TRUE);
@ -1549,7 +1564,7 @@ file_save_ok_callback (GtkWidget *w,
if (buf.st_mode & S_IFDIR)
{
GString *s = g_string_new (filename);
g_string_append_c (s, '/');
g_string_append_c (s, G_DIR_SEPARATOR);
gtk_file_selection_set_filename (fs, s->str);
g_string_free (s, TRUE);
return;
@ -2106,7 +2121,8 @@ file_temp_name_invoker (Argument *args)
if (id == 0)
pid = getpid();
g_string_sprintf (s, "%s/gimp_temp.%d%d.%s", temp_path, pid, id++, (char*)args[0].value.pdb_pointer);
g_string_sprintf (s, "%s" G_DIR_SEPARATOR_S "gimp_temp.%d%d.%s",
temp_path, pid, id++, (char*)args[0].value.pdb_pointer);
return_args = procedural_db_return_args (&file_temp_name_proc, TRUE);

View File

@ -17,6 +17,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "buildmenu.h"
#include "channels_dialog.h"

View File

@ -22,6 +22,13 @@
#include <sys/stat.h>
#include <time.h>
#include <glib.h>
#ifdef _MSC_VER
#ifndef S_ISREG
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#endif
#endif
#include "general.h"
char*
@ -34,14 +41,14 @@ search_in_path (char *search_path,
int err;
local_path = g_strdup (search_path);
token = strtok (local_path, ":");
token = strtok (local_path, G_SEARCHPATH_SEPARATOR_S);
while (token)
{
sprintf (path, "%s", token);
if (token[strlen (token) - 1] != '/')
strcat (path, "/");
if (token[strlen (token) - 1] != G_DIR_SEPARATOR)
strcat (path, G_DIR_SEPARATOR_S);
strcat (path, filename);
err = stat (path, &buf);
@ -51,7 +58,7 @@ search_in_path (char *search_path,
break;
}
token = strtok (NULL, ":");
token = strtok (NULL, G_SEARCHPATH_SEPARATOR_S);
}
g_free (local_path);

View File

@ -18,12 +18,24 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "appenv.h"
#include "gimpbrushgenerated.h"
#include "paint_core.h"
#include "gimprc.h"
#include <math.h>
#include <stdio.h>
#define OVERSAMPLING 5
@ -228,7 +240,7 @@ gimp_brush_generated_generate(GimpBrushGenerated *brush)
register double exponent;
register guchar a;
register int length;
register char *lookup;
register guchar *lookup;
double buffer[OVERSAMPLING];
register double sum, c, s, tx, ty;
int width, height;

View File

@ -15,14 +15,22 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include <math.h>
#include "appenv.h"
#include "gimpbrushgenerated.h"
#include "brush_header.h"

View File

@ -19,7 +19,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <strings.h>
#include <string.h>
#include "gimpdrawableP.h"
#include "gimpsignal.h"
#include "gimage.h"

View File

@ -148,12 +148,15 @@
* - Add a Gradient brush mode (color changes as you move it).
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "appenv.h"
#include "colormaps.h"
@ -168,7 +171,6 @@
#include "session.h"
#include "gradient_header.h"
#include "config.h"
#include "libgimp/gimpintl.h"
/***** Magic numbers *****/
@ -5970,17 +5972,20 @@ build_user_filename(char *name, char *path_str)
home = g_get_home_dir ();
local_path = g_strdup(path_str);
first_token = local_path;
token = xstrsep(&first_token, ":");
token = xstrsep(&first_token, G_SEARCHPATH_SEPARATOR_S);
filename = NULL;
if (token) {
if (*token == '~') {
if (!home)
return NULL;
path = g_strdup_printf("%s%s", home, token + 1);
} else {
path = g_strdup(token);
} /* else */
filename = g_strdup_printf("%s/%s", path, name);
filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
path, name);
g_free(path);
} /* if */

View File

@ -148,12 +148,15 @@
* - Add a Gradient brush mode (color changes as you move it).
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "appenv.h"
#include "colormaps.h"
@ -168,7 +171,6 @@
#include "session.h"
#include "gradient_header.h"
#include "config.h"
#include "libgimp/gimpintl.h"
/***** Magic numbers *****/
@ -5970,17 +5972,20 @@ build_user_filename(char *name, char *path_str)
home = g_get_home_dir ();
local_path = g_strdup(path_str);
first_token = local_path;
token = xstrsep(&first_token, ":");
token = xstrsep(&first_token, G_SEARCHPATH_SEPARATOR_S);
filename = NULL;
if (token) {
if (*token == '~') {
if (!home)
return NULL;
path = g_strdup_printf("%s%s", home, token + 1);
} else {
path = g_strdup(token);
} /* else */
filename = g_strdup_printf("%s/%s", path, name);
filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
path, name);
g_free(path);
} /* if */

View File

@ -34,11 +34,15 @@
* the structures so we can find which one we are taking about.
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "appenv.h"
#include "colormaps.h"

View File

@ -17,6 +17,7 @@
*/
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "color_area.h"
#include "color_notebook.h"

View File

@ -17,6 +17,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "color_select.h"

View File

@ -148,12 +148,15 @@
* - Add a Gradient brush mode (color changes as you move it).
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "appenv.h"
#include "colormaps.h"
@ -168,7 +171,6 @@
#include "session.h"
#include "gradient_header.h"
#include "config.h"
#include "libgimp/gimpintl.h"
/***** Magic numbers *****/
@ -5970,17 +5972,20 @@ build_user_filename(char *name, char *path_str)
home = g_get_home_dir ();
local_path = g_strdup(path_str);
first_token = local_path;
token = xstrsep(&first_token, ":");
token = xstrsep(&first_token, G_SEARCHPATH_SEPARATOR_S);
filename = NULL;
if (token) {
if (*token == '~') {
if (!home)
return NULL;
path = g_strdup_printf("%s%s", home, token + 1);
} else {
path = g_strdup(token);
} /* else */
filename = g_strdup_printf("%s/%s", path, name);
filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
path, name);
g_free(path);
} /* if */

View File

@ -34,11 +34,15 @@
* the structures so we can find which one we are taking about.
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "appenv.h"
#include "colormaps.h"

View File

@ -18,10 +18,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <time.h>
#include "appenv.h"
#include "module_db.h"
@ -335,16 +340,14 @@ module_info_free (module_info *mod)
/* helper functions */
/* name must be of the form lib*.so */
/* TODO: need support for WIN32-style dll names. Maybe this function
* should live in libgmodule? */
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
static gboolean
valid_module_name (const char *filename)
{
const char *basename;
int len;
basename = strrchr (filename, '/');
basename = strrchr (filename, G_DIR_SEPARATOR);
if (basename)
basename++;
else
@ -352,6 +355,7 @@ valid_module_name (const char *filename)
len = strlen (basename);
#ifndef WIN32
if (len < 3 + 1 + 3)
return FALSE;
@ -360,6 +364,10 @@ valid_module_name (const char *filename)
if (strcmp (basename + len - 3, ".so"))
return FALSE;
#else
if (g_strcasecmp (basename + len - 4, ".dll"))
return FALSE;
#endif
return TRUE;
}

View File

@ -15,11 +15,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include "appenv.h"
@ -1257,20 +1264,25 @@ palette_create_entries(gpointer client_data,
home = g_get_home_dir ();
local_path = g_strdup (palette_path);
first_token = local_path;
token = xstrsep(&first_token, ":");
token = xstrsep(&first_token, G_SEARCHPATH_SEPARATOR_S);
if (token)
{
if (*token == '~')
{
path = g_strdup_printf("%s%s", home, token + 1);
if (home)
path = g_strdup_printf("%s%s", home, token + 1);
else
/* Just ignore the ~ if no HOME ??? */
path = g_strdup(token + 1);
}
else
{
path = g_strdup(token);
}
entries->filename = g_strdup_printf ("%s/%s", path, palette_name);
entries->filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
path, palette_name);
g_free (path);
}

View File

@ -17,13 +17,17 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#include <dirent.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include "appenv.h"
#include "actionarea.h"
#include "buildmenu.h"

View File

@ -1,5 +1,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "appenv.h"
#include "about_dialog.h"
#include "actionarea.h"

View File

@ -45,9 +45,11 @@ tips_dialog_create ()
if (tips_count == 0)
{
if ((gimp_data_dir = getenv ("GIMP_DATADIR")) != NULL)
temp = (char *) g_strdup_printf ("%s/%s", gimp_data_dir, TIPS_FILE_NAME);
temp = (char *) g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
gimp_data_dir, TIPS_FILE_NAME);
else
temp = (char *) g_strdup_printf ("%s/%s", DATADIR, TIPS_FILE_NAME);
temp = (char *) g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
DATADIR, TIPS_FILE_NAME);
read_tips_file ((char *)temp);
g_free (temp);
}
@ -219,7 +221,7 @@ read_tips_file (char *filename)
char *tip = NULL;
char *str = NULL;
fp = fopen (filename, "rb");
fp = fopen (filename, "r");
if (!fp)
{
store_tip (_("Your GIMP tips file appears to be missing!\n"

View File

@ -22,8 +22,13 @@
#include <signal.h>
#include <string.h>
#include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "libgimp/gserialize.h"
#ifndef WAIT_ANY
@ -40,7 +45,9 @@
#include "libgimp/gimpintl.h"
static RETSIGTYPE on_signal (int);
#ifdef SIGCHLD
static RETSIGTYPE on_sig_child (int);
#endif
static void init (void);
static void test_gserialize();
static void on_error (const gchar* domain,
@ -137,7 +144,7 @@ main (int argc, char **argv)
no_data = FALSE;
no_splash = FALSE;
no_splash_image = FALSE;
#ifdef HAVE_SHM_H
#if defined (HAVE_SHM_H) || defined (NATIVE_WIN32)
use_shm = TRUE;
#else
use_shm = FALSE;
@ -274,7 +281,7 @@ main (int argc, char **argv)
if (show_help)
{
g_print (_("\007Usage: %s [option ...] [files ...]\n"), argv[0]);
g_print (_("Usage: %s [option ...] [files ...]\n"), argv[0]);
g_print (_("Valid options are:\n"));
g_print (_(" -h --help Output this help.\n"));
g_print (_(" -v --version Output version info.\n"));
@ -300,18 +307,38 @@ main (int argc, char **argv)
g_set_message_handler ((GPrintFunc) message_func);
/* Handle some signals */
#ifdef SIGHUP
signal (SIGHUP, on_signal);
#endif
#ifdef SIGINT
signal (SIGINT, on_signal);
#endif
#ifdef SIGQUIT
signal (SIGQUIT, on_signal);
#endif
#ifdef SIGABRT
signal (SIGABRT, on_signal);
#endif
#ifdef SIGBUS
signal (SIGBUS, on_signal);
#endif
#ifdef SIGSEGV
signal (SIGSEGV, on_signal);
#endif
#ifdef SIGPIPE
signal (SIGPIPE, on_signal);
#endif
#ifdef SIGTERM
signal (SIGTERM, on_signal);
#endif
#ifdef SIGFPE
signal (SIGFPE, on_signal);
#endif
#ifdef SIGCHLD
/* Handle child exits */
signal (SIGCHLD, on_sig_child);
#endif
g_log_set_handler(NULL,
G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL,
@ -332,6 +359,18 @@ main (int argc, char **argv)
return 0;
}
#ifdef NATIVE_WIN32
/* In case we build this as a windowed application */
int _stdcall
WinMain (int hInstance, int hPrevInstance, char *lpszCmdLine, int nCmdShow)
{
return main (__argc, __argv);
}
#endif
static void
init ()
{
@ -356,45 +395,67 @@ static RETSIGTYPE
on_signal (int sig_num)
{
if (caught_fatal_sig)
/* raise (sig_num);*/
#ifdef NATIVE_WIN32
raise (sig_num);
#else
kill (getpid (), sig_num);
#endif
caught_fatal_sig = 1;
switch (sig_num)
{
#ifdef SIGHUP
case SIGHUP:
terminate (_("sighup caught"));
break;
#endif
#ifdef SIGINT
case SIGINT:
terminate (_("sigint caught"));
break;
#endif
#ifdef SIGQUIT
case SIGQUIT:
terminate (_("sigquit caught"));
break;
#endif
#ifdef SIGABRT
case SIGABRT:
terminate (_("sigabrt caught"));
break;
#endif
#ifdef SIGBUS
case SIGBUS:
fatal_error (_("sigbus caught"));
break;
#endif
#ifdef SIGSEGV
case SIGSEGV:
fatal_error (_("sigsegv caught"));
break;
#endif
#ifdef SIGPIPE
case SIGPIPE:
terminate (_("sigpipe caught"));
break;
#endif
#ifdef SIGTERM
case SIGTERM:
terminate (_("sigterm caught"));
break;
#endif
#ifdef SIGFPE
case SIGFPE:
fatal_error (_("sigfpe caught"));
break;
#endif
default:
fatal_error (_("unknown signal"));
break;
}
}
#ifdef SIGCHLD
static RETSIGTYPE
on_sig_child (int sig_num)
{
@ -408,6 +469,7 @@ on_sig_child (int sig_num)
break;
}
}
#endif
typedef struct
{

View File

@ -18,10 +18,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <time.h>
#include "appenv.h"
#include "module_db.h"
@ -335,16 +340,14 @@ module_info_free (module_info *mod)
/* helper functions */
/* name must be of the form lib*.so */
/* TODO: need support for WIN32-style dll names. Maybe this function
* should live in libgmodule? */
/* name must be of the form lib*.so (Unix) or *.dll (Win32) */
static gboolean
valid_module_name (const char *filename)
{
const char *basename;
int len;
basename = strrchr (filename, '/');
basename = strrchr (filename, G_DIR_SEPARATOR);
if (basename)
basename++;
else
@ -352,6 +355,7 @@ valid_module_name (const char *filename)
len = strlen (basename);
#ifndef WIN32
if (len < 3 + 1 + 3)
return FALSE;
@ -360,6 +364,10 @@ valid_module_name (const char *filename)
if (strcmp (basename + len - 3, ".so"))
return FALSE;
#else
if (g_strcasecmp (basename + len - 4, ".dll"))
return FALSE;
#endif
return TRUE;
}

View File

@ -15,10 +15,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "appenv.h"
#include "gimprc.h"
#include "paint_funcs.h"

View File

@ -235,7 +235,7 @@ clone_paint_func (PaintCore *paint_core,
y2 = paint_core->lasty;
/* If the control key is down, move the src target and return */
if (paint_core->state & ControlMask)
if (paint_core->state & GDK_CONTROL_MASK)
{
src_x = x1;
src_y = y1;
@ -269,7 +269,7 @@ clone_paint_func (PaintCore *paint_core,
break;
case INIT_PAINT :
if (paint_core->state & ControlMask)
if (paint_core->state & GDK_CONTROL_MASK)
{
the_src_gdisp = gdisp;
clone_set_src_drawable(drawable);

View File

@ -31,6 +31,10 @@
#define ROUND(A) floor((A)+0.5)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
static Blob *
blob_new (int y, int height)
{

View File

@ -235,7 +235,7 @@ clone_paint_func (PaintCore *paint_core,
y2 = paint_core->lasty;
/* If the control key is down, move the src target and return */
if (paint_core->state & ControlMask)
if (paint_core->state & GDK_CONTROL_MASK)
{
src_x = x1;
src_y = y1;
@ -269,7 +269,7 @@ clone_paint_func (PaintCore *paint_core,
break;
case INIT_PAINT :
if (paint_core->state & ControlMask)
if (paint_core->state & GDK_CONTROL_MASK)
{
the_src_gdisp = gdisp;
clone_set_src_drawable(drawable);

View File

@ -15,10 +15,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "appenv.h"
#include "gimprc.h"
#include "paint_funcs.h"

View File

@ -15,11 +15,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include "appenv.h"
@ -1257,20 +1264,25 @@ palette_create_entries(gpointer client_data,
home = g_get_home_dir ();
local_path = g_strdup (palette_path);
first_token = local_path;
token = xstrsep(&first_token, ":");
token = xstrsep(&first_token, G_SEARCHPATH_SEPARATOR_S);
if (token)
{
if (*token == '~')
{
path = g_strdup_printf("%s%s", home, token + 1);
if (home)
path = g_strdup_printf("%s%s", home, token + 1);
else
/* Just ignore the ~ if no HOME ??? */
path = g_strdup(token + 1);
}
else
{
path = g_strdup(token);
}
entries->filename = g_strdup_printf ("%s/%s", path, palette_name);
entries->filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
path, palette_name);
g_free (path);
}

View File

@ -17,13 +17,17 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#include <dirent.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include "appenv.h"
#include "actionarea.h"
#include "buildmenu.h"

View File

@ -15,6 +15,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <string.h>
#include "gimpobjectP.h"
#include "gimpobject.h"
#include "gimpsignal.h"

View File

@ -15,13 +15,21 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include "appenv.h"
#include "colormaps.h"
#include "datafiles.h"

View File

@ -15,9 +15,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "appenv.h"
#include "actionarea.h"
#include "drawable.h"

View File

@ -1,5 +1,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "appenv.h"
#include "about_dialog.h"
#include "actionarea.h"

View File

@ -854,7 +854,7 @@ procedural_db_dump (Argument *args)
if (filename)
{
if (! (procedural_db_out = fopen (filename, "wb")))
if (! (procedural_db_out = fopen (filename, "w")))
success = FALSE;
}
else

View File

@ -319,7 +319,7 @@ rotate_tool_motion (tool, gdisp_ptr)
/* constrain the angle to 15-degree multiples if ctrl is held down */
if (transform_core->state & ControlMask)
if (transform_core->state & GDK_CONTROL_MASK)
transform_core->trans_info[ANGLE] = FIFTEEN_DEG * (int) ((transform_core->trans_info[REAL_ANGLE] +
FIFTEEN_DEG / 2.0) /
FIFTEEN_DEG);

View File

@ -310,10 +310,10 @@ scale_tool_motion (tool, gdisp_ptr)
}
/* if just the control key is down, affect only the height */
if (transform_core->state & ControlMask && ! (transform_core->state & ShiftMask))
if (transform_core->state & GDK_CONTROL_MASK && ! (transform_core->state & GDK_SHIFT_MASK))
diff_x = 0;
/* if just the shift key is down, affect only the width */
else if (transform_core->state & ShiftMask && ! (transform_core->state & ControlMask))
else if (transform_core->state & GDK_SHIFT_MASK && ! (transform_core->state & GDK_CONTROL_MASK))
diff_y = 0;
*x1 += diff_x;

View File

@ -15,12 +15,22 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <sys/stat.h>
#ifdef _MSC_VER
#include <process.h> /* For _getpid() */
#endif
#include "appenv.h"
#include "drawable.h"
#include "errors.h"
@ -416,7 +426,8 @@ generate_unique_filename (void)
{
pid_t pid;
pid = getpid ();
return g_strdup_printf ("%s/gimp%d.%d", temp_path, (int) pid, swap_index++);
return g_strdup_printf ("%s" G_DIR_SEPARATOR_S "gimp%d.%d",
temp_path, (int) pid, swap_index++);
}

View File

@ -447,6 +447,7 @@ text_gdk_image_to_region (GdkImage *image,
int scale,
PixelRegion *textPR)
{
GdkColor black;
int black_pixel;
int pixel;
int value;
@ -457,7 +458,9 @@ text_gdk_image_to_region (GdkImage *image,
unsigned char * data;
scale2 = scale * scale;
black_pixel = BlackPixel (DISPLAY, DefaultScreen (DISPLAY));
black.red = black.green = black.blue = 0;
gdk_colormap_alloc_color (gdk_colormap_get_system (), &black, FALSE, TRUE);
black_pixel = black.pixel;
data = textPR->data;
for (y = 0, scaley = 0; y < textPR->h; y++, scaley += scale)
@ -587,8 +590,10 @@ text_render (GImage *gimage,
gdk_gc_set_font (gc, font);
/* get black and white pixels for this gdisplay */
black.pixel = BlackPixel (DISPLAY, DefaultScreen (DISPLAY));
white.pixel = WhitePixel (DISPLAY, DefaultScreen (DISPLAY));
black.red = black.green = black.blue = 0;
gdk_colormap_alloc_color (gdk_colormap_get_system (), &black, FALSE, TRUE);
white.red = white.green = white.blue = 65535;
gdk_colormap_alloc_color (gdk_colormap_get_system (), &white, FALSE, TRUE);
/* Render the text into the pixmap.
* Since the pixmap may not fully bound the text (because we limit its size)

View File

@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <string.h>
#include "tile_cache.h"
#include "tile_manager.h"
#include "tile_swap.h"

View File

@ -1,13 +1,21 @@
#include "config.h"
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef USE_PTHREADS
#include <pthread.h>
#endif
#ifdef _MSC_VER
#include <io.h>
#endif
#include "libgimp/gimpintl.h"
#define MAX_OPEN_SWAP_FILES 16
@ -352,7 +360,11 @@ tile_swap_open (SwapFile *swap_file)
nopen_swap_files -= 1;
}
#ifndef NATIVE_WIN32
swap_file->fd = open (swap_file->filename, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR);
#else
swap_file->fd = open (swap_file->filename, O_CREAT|O_RDWR|_O_BINARY, _S_IREAD|_S_IWRITE);
#endif
if (swap_file->fd == -1)
{
g_message (_("unable to open swap file...BAD THINGS WILL HAPPEN SOON"));

View File

@ -45,9 +45,11 @@ tips_dialog_create ()
if (tips_count == 0)
{
if ((gimp_data_dir = getenv ("GIMP_DATADIR")) != NULL)
temp = (char *) g_strdup_printf ("%s/%s", gimp_data_dir, TIPS_FILE_NAME);
temp = (char *) g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
gimp_data_dir, TIPS_FILE_NAME);
else
temp = (char *) g_strdup_printf ("%s/%s", DATADIR, TIPS_FILE_NAME);
temp = (char *) g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
DATADIR, TIPS_FILE_NAME);
read_tips_file ((char *)temp);
g_free (temp);
}
@ -219,7 +221,7 @@ read_tips_file (char *filename)
char *tip = NULL;
char *str = NULL;
fp = fopen (filename, "rb");
fp = fopen (filename, "r");
if (!fp)
{
store_tip (_("Your GIMP tips file appears to be missing!\n"

View File

@ -31,6 +31,10 @@
#define ROUND(A) floor((A)+0.5)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
static Blob *
blob_new (int y, int height)
{

View File

@ -235,7 +235,7 @@ clone_paint_func (PaintCore *paint_core,
y2 = paint_core->lasty;
/* If the control key is down, move the src target and return */
if (paint_core->state & ControlMask)
if (paint_core->state & GDK_CONTROL_MASK)
{
src_x = x1;
src_y = y1;
@ -269,7 +269,7 @@ clone_paint_func (PaintCore *paint_core,
break;
case INIT_PAINT :
if (paint_core->state & ControlMask)
if (paint_core->state & GDK_CONTROL_MASK)
{
the_src_gdisp = gdisp;
clone_set_src_drawable(drawable);

View File

@ -235,7 +235,7 @@ clone_paint_func (PaintCore *paint_core,
y2 = paint_core->lasty;
/* If the control key is down, move the src target and return */
if (paint_core->state & ControlMask)
if (paint_core->state & GDK_CONTROL_MASK)
{
src_x = x1;
src_y = y1;
@ -269,7 +269,7 @@ clone_paint_func (PaintCore *paint_core,
break;
case INIT_PAINT :
if (paint_core->state & ControlMask)
if (paint_core->state & GDK_CONTROL_MASK)
{
the_src_gdisp = gdisp;
clone_set_src_drawable(drawable);

View File

@ -31,6 +31,10 @@
#define ROUND(A) floor((A)+0.5)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
static Blob *
blob_new (int y, int height)
{

View File

@ -15,9 +15,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "appenv.h"
#include "actionarea.h"
#include "drawable.h"

View File

@ -319,7 +319,7 @@ rotate_tool_motion (tool, gdisp_ptr)
/* constrain the angle to 15-degree multiples if ctrl is held down */
if (transform_core->state & ControlMask)
if (transform_core->state & GDK_CONTROL_MASK)
transform_core->trans_info[ANGLE] = FIFTEEN_DEG * (int) ((transform_core->trans_info[REAL_ANGLE] +
FIFTEEN_DEG / 2.0) /
FIFTEEN_DEG);

View File

@ -310,10 +310,10 @@ scale_tool_motion (tool, gdisp_ptr)
}
/* if just the control key is down, affect only the height */
if (transform_core->state & ControlMask && ! (transform_core->state & ShiftMask))
if (transform_core->state & GDK_CONTROL_MASK && ! (transform_core->state & GDK_SHIFT_MASK))
diff_x = 0;
/* if just the shift key is down, affect only the width */
else if (transform_core->state & ShiftMask && ! (transform_core->state & ControlMask))
else if (transform_core->state & GDK_SHIFT_MASK && ! (transform_core->state & GDK_CONTROL_MASK))
diff_y = 0;
*x1 += diff_x;

View File

@ -235,7 +235,7 @@ clone_paint_func (PaintCore *paint_core,
y2 = paint_core->lasty;
/* If the control key is down, move the src target and return */
if (paint_core->state & ControlMask)
if (paint_core->state & GDK_CONTROL_MASK)
{
src_x = x1;
src_y = y1;
@ -269,7 +269,7 @@ clone_paint_func (PaintCore *paint_core,
break;
case INIT_PAINT :
if (paint_core->state & ControlMask)
if (paint_core->state & GDK_CONTROL_MASK)
{
the_src_gdisp = gdisp;
clone_set_src_drawable(drawable);

View File

@ -447,6 +447,7 @@ text_gdk_image_to_region (GdkImage *image,
int scale,
PixelRegion *textPR)
{
GdkColor black;
int black_pixel;
int pixel;
int value;
@ -457,7 +458,9 @@ text_gdk_image_to_region (GdkImage *image,
unsigned char * data;
scale2 = scale * scale;
black_pixel = BlackPixel (DISPLAY, DefaultScreen (DISPLAY));
black.red = black.green = black.blue = 0;
gdk_colormap_alloc_color (gdk_colormap_get_system (), &black, FALSE, TRUE);
black_pixel = black.pixel;
data = textPR->data;
for (y = 0, scaley = 0; y < textPR->h; y++, scaley += scale)
@ -587,8 +590,10 @@ text_render (GImage *gimage,
gdk_gc_set_font (gc, font);
/* get black and white pixels for this gdisplay */
black.pixel = BlackPixel (DISPLAY, DefaultScreen (DISPLAY));
white.pixel = WhitePixel (DISPLAY, DefaultScreen (DISPLAY));
black.red = black.green = black.blue = 0;
gdk_colormap_alloc_color (gdk_colormap_get_system (), &black, FALSE, TRUE);
white.red = white.green = white.blue = 65535;
gdk_colormap_alloc_color (gdk_colormap_get_system (), &white, FALSE, TRUE);
/* Render the text into the pixmap.
* Since the pixmap may not fully bound the text (because we limit its size)

View File

@ -15,9 +15,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "appenv.h"
#include "actionarea.h"
#include "drawable.h"

View File

@ -319,7 +319,7 @@ rotate_tool_motion (tool, gdisp_ptr)
/* constrain the angle to 15-degree multiples if ctrl is held down */
if (transform_core->state & ControlMask)
if (transform_core->state & GDK_CONTROL_MASK)
transform_core->trans_info[ANGLE] = FIFTEEN_DEG * (int) ((transform_core->trans_info[REAL_ANGLE] +
FIFTEEN_DEG / 2.0) /
FIFTEEN_DEG);

View File

@ -310,10 +310,10 @@ scale_tool_motion (tool, gdisp_ptr)
}
/* if just the control key is down, affect only the height */
if (transform_core->state & ControlMask && ! (transform_core->state & ShiftMask))
if (transform_core->state & GDK_CONTROL_MASK && ! (transform_core->state & GDK_SHIFT_MASK))
diff_x = 0;
/* if just the shift key is down, affect only the width */
else if (transform_core->state & ShiftMask && ! (transform_core->state & ControlMask))
else if (transform_core->state & GDK_SHIFT_MASK && ! (transform_core->state & GDK_CONTROL_MASK))
diff_y = 0;
*x1 += diff_x;

View File

@ -447,6 +447,7 @@ text_gdk_image_to_region (GdkImage *image,
int scale,
PixelRegion *textPR)
{
GdkColor black;
int black_pixel;
int pixel;
int value;
@ -457,7 +458,9 @@ text_gdk_image_to_region (GdkImage *image,
unsigned char * data;
scale2 = scale * scale;
black_pixel = BlackPixel (DISPLAY, DefaultScreen (DISPLAY));
black.red = black.green = black.blue = 0;
gdk_colormap_alloc_color (gdk_colormap_get_system (), &black, FALSE, TRUE);
black_pixel = black.pixel;
data = textPR->data;
for (y = 0, scaley = 0; y < textPR->h; y++, scaley += scale)
@ -587,8 +590,10 @@ text_render (GImage *gimage,
gdk_gc_set_font (gc, font);
/* get black and white pixels for this gdisplay */
black.pixel = BlackPixel (DISPLAY, DefaultScreen (DISPLAY));
white.pixel = WhitePixel (DISPLAY, DefaultScreen (DISPLAY));
black.red = black.green = black.blue = 0;
gdk_colormap_alloc_color (gdk_colormap_get_system (), &black, FALSE, TRUE);
white.red = white.green = white.blue = 65535;
gdk_colormap_alloc_color (gdk_colormap_get_system (), &white, FALSE, TRUE);
/* Render the text into the pixmap.
* Since the pixmap may not fully bound the text (because we limit its size)

View File

@ -148,12 +148,15 @@
* - Add a Gradient brush mode (color changes as you move it).
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "appenv.h"
#include "colormaps.h"
@ -168,7 +171,6 @@
#include "session.h"
#include "gradient_header.h"
#include "config.h"
#include "libgimp/gimpintl.h"
/***** Magic numbers *****/
@ -5970,17 +5972,20 @@ build_user_filename(char *name, char *path_str)
home = g_get_home_dir ();
local_path = g_strdup(path_str);
first_token = local_path;
token = xstrsep(&first_token, ":");
token = xstrsep(&first_token, G_SEARCHPATH_SEPARATOR_S);
filename = NULL;
if (token) {
if (*token == '~') {
if (!home)
return NULL;
path = g_strdup_printf("%s%s", home, token + 1);
} else {
path = g_strdup(token);
} /* else */
filename = g_strdup_printf("%s/%s", path, name);
filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
path, name);
g_free(path);
} /* if */

View File

@ -15,11 +15,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include "appenv.h"
@ -1257,20 +1264,25 @@ palette_create_entries(gpointer client_data,
home = g_get_home_dir ();
local_path = g_strdup (palette_path);
first_token = local_path;
token = xstrsep(&first_token, ":");
token = xstrsep(&first_token, G_SEARCHPATH_SEPARATOR_S);
if (token)
{
if (*token == '~')
{
path = g_strdup_printf("%s%s", home, token + 1);
if (home)
path = g_strdup_printf("%s%s", home, token + 1);
else
/* Just ignore the ~ if no HOME ??? */
path = g_strdup(token + 1);
}
else
{
path = g_strdup(token);
}
entries->filename = g_strdup_printf ("%s/%s", path, palette_name);
entries->filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
path, palette_name);
g_free (path);
}

View File

@ -17,6 +17,7 @@
*/
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "color_area.h"
#include "color_notebook.h"

View File

@ -1,11 +1,17 @@
#include "config.h"
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#include <glib.h>

View File

@ -1,11 +1,17 @@
#include "config.h"
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#include <glib.h>

View File

@ -18,15 +18,29 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef _MSC_VER
#ifndef S_ISDIR
#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#endif
#ifndef S_IXUSR
#define S_IXUSR _S_IEXEC
#endif
#endif
#include <glib.h>
#include "datafiles.h"
@ -70,7 +84,7 @@ datafiles_read_directories (char *path_str,
next_token = local_path;
token = xstrsep(&next_token, ":");
token = xstrsep(&next_token, G_SEARCHPATH_SEPARATOR_S);
while (token)
{
@ -90,8 +104,8 @@ datafiles_read_directories (char *path_str,
if (!err && S_ISDIR(filestat.st_mode))
{
if (path[strlen(path) - 1] != '/')
strcat(path, "/");
if (path[strlen(path) - 1] != G_DIR_SEPARATOR)
strcat(path, G_DIR_SEPARATOR_S);
/* Open directory */
dir = opendir(path);
@ -124,7 +138,7 @@ datafiles_read_directories (char *path_str,
g_free(path);
token = xstrsep(&next_token, ":");
token = xstrsep(&next_token, G_SEARCHPATH_SEPARATOR_S);
} /* while */
g_free(local_path);

View File

@ -17,6 +17,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appenv.h"
#include "actionarea.h"
#include "color_select.h"