gimpprojection.h 6.64 KB
Newer Older
Elliot Lee's avatar
Elliot Lee committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/* The GIMP -- an image manipulation program
 * 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 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; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Elliot Lee's avatar
Elliot Lee committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
 */
#ifndef __GDISPLAY_H__
#define __GDISPLAY_H__

#include "gimage.h"
#include "info_dialog.h"
#include "selection.h"

/*
 *  Global variables
 *
 */

/*  some useful macros  */

#define  SCALESRC(g)    (g->scale & 0x00ff)
#define  SCALEDEST(g)   (g->scale >> 8)
#define  SCALE(g,x)     ((x * SCALEDEST(g)) / SCALESRC(g))
#define  UNSCALE(g,x)   ((x * SCALESRC(g)) / SCALEDEST(g))

#define LOWPASS(x) ((x>0) ? x : 0)
38
/* #define HIGHPASS(x,y) ((x>y) ? y : x) */ /* unused - == MIN */
Elliot Lee's avatar
Elliot Lee committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60


typedef enum
{
  SelectionOff,
  SelectionLayerOff,
  SelectionOn,
  SelectionPause,
  SelectionResume
} SelectionControl;

typedef struct _GDisplay GDisplay;
struct _GDisplay
{
  int ID;                         /*  unique identifier for this gdisplay     */

  GtkWidget *shell;               /*  shell widget for this gdisplay          */
  GtkWidget *canvas;              /*  canvas widget for this gdisplay         */
  GtkWidget *hsb, *vsb;           /*  widgets for scroll bars                 */
  GtkWidget *hrule, *vrule;       /*  widgets for rulers                      */
  GtkWidget *origin;              /*  widgets for rulers                      */
  GtkWidget *popup;               /*  widget for popup menu                   */
61
  GtkWidget *statusarea;          /*  hbox holding the statusbar and stuff    */ 
62 63
  GtkWidget *statusbar;           /*  widget for statusbar                    */
  GtkWidget *progressbar;         /*  widget for progressbar                  */
64
  GtkWidget *cursor_label;        /*  widget for cursor position              */
65
  GtkWidget *cancelbutton;        /*  widget for cancel button                */
66
  guint progressid;               /*  id of statusbar message for progress    */
Elliot Lee's avatar
Elliot Lee committed
67 68 69 70 71 72 73 74

  InfoDialog *window_info_dialog; /*  dialog box for image information        */

  int color_type;                 /*  is this an RGB or GRAY colormap         */

  GtkAdjustment *hsbdata;         /*  horizontal data information             */
  GtkAdjustment *vsbdata;         /*  vertical data information               */

75
  GimpImage *gimage;	          /*  pointer to the associated gimage struct */
Elliot Lee's avatar
Elliot Lee committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
  int instance;                   /*  the instance # of this gdisplay as      */
                                  /*  taken from the gimage at creation       */

  int depth;   		          /*  depth of our drawables                  */
  int disp_width;                 /*  width of drawing area in the window     */
  int disp_height;                /*  height of drawing area in the window    */
  int disp_xoffset;
  int disp_yoffset;

  int offset_x, offset_y;         /*  offset of display image into raw image  */
  int scale;        	          /*  scale factor from original raw image    */
  short draw_guides;              /*  should the guides be drawn?             */
  short snap_to_guides;           /*  should the guides be snapped to?        */

  Selection *select;              /*  Selection object                        */

92 93
  GdkGC *scroll_gc;               /*  GC for scrolling */

94 95
  GSList *update_areas;           /*  Update areas list                       */
  GSList *display_areas;          /*  Display areas list                      */
Elliot Lee's avatar
Elliot Lee committed
96 97

  GdkCursorType current_cursor;   /*  Currently installed cursor              */
98 99 100 101 102 103

  short draw_cursor;		  /* should we draw software cursor ? */
  int cursor_x;			  /* software cursor X value */
  int cursor_y;			  /* software cursor Y value */
  short proximity;		  /* is a device in proximity of gdisplay ? */
  short have_cursor;		  /* is cursor currently drawn ? */
Elliot Lee's avatar
Elliot Lee committed
104 105 106 107 108 109
};



/* member function declarations */

110
GDisplay * gdisplay_new                    (GimpImage *, unsigned int);
Elliot Lee's avatar
Elliot Lee committed
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
void       gdisplay_remove_and_delete      (GDisplay *);
int        gdisplay_mask_value             (GDisplay *, int, int);
int        gdisplay_mask_bounds            (GDisplay *, int *, int *, int *, int *);
void       gdisplay_transform_coords       (GDisplay *, int, int, int *, int *, int);
void       gdisplay_untransform_coords     (GDisplay *, int, int, int *,
					    int *, int, int);
void       gdisplay_transform_coords_f     (GDisplay *, double, double, double *,
					    double *, int);
void       gdisplay_untransform_coords_f   (GDisplay *, double, double, double *,
					    double *, int);
void       gdisplay_install_tool_cursor    (GDisplay *, GdkCursorType);
void       gdisplay_remove_tool_cursor     (GDisplay *);
void       gdisplay_set_menu_sensitivity   (GDisplay *);
void       gdisplay_expose_area            (GDisplay *, int, int, int, int);
void       gdisplay_expose_guide           (GDisplay *, Guide *);
void       gdisplay_expose_full            (GDisplay *);
void       gdisplay_flush                  (GDisplay *);
void       gdisplay_draw_guides            (GDisplay *);
void       gdisplay_draw_guide             (GDisplay *, Guide *, int);
Guide*     gdisplay_find_guide             (GDisplay *, int, int);
131
void       gdisplay_snap_point             (GDisplay *, double , double, double *, double *);
Elliot Lee's avatar
Elliot Lee committed
132
void       gdisplay_snap_rectangle         (GDisplay *, int, int, int, int, int *, int *);
133
void	   gdisplay_update_cursor	   (GDisplay *, int, int);
Elliot Lee's avatar
Elliot Lee committed
134 135 136 137 138

/*  function declarations  */

GDisplay * gdisplay_active                 (void);
GDisplay * gdisplay_get_ID                 (int);
139 140 141 142 143 144
void       gdisplays_update_title          (GimpImage*);
void       gdisplays_update_area           (GimpImage*, int, int, int, int);
void       gdisplays_expose_guides         (GimpImage*);
void       gdisplays_expose_guide          (GimpImage*, Guide *);
void       gdisplays_update_full           (GimpImage*);
void       gdisplays_shrink_wrap           (GimpImage*);
Elliot Lee's avatar
Elliot Lee committed
145
void       gdisplays_expose_full           (void);
146
void       gdisplays_selection_visibility  (GimpImage*, SelectionControl);
Elliot Lee's avatar
Elliot Lee committed
147 148 149 150 151 152
int        gdisplays_dirty                 (void);
void       gdisplays_delete                (void);
void       gdisplays_flush                 (void);


#endif /*  __GDISPLAY_H__  */