~ubuntu-branches/ubuntu/breezy/gimp/breezy

« back to all changes in this revision

Viewing changes to tools/pdbgen/pdb/brush_select.pdb

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-10-04 19:04:46 UTC
  • Revision ID: james.westby@ubuntu.com-20051004190446-ukh32kwk56s4sjhu
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# The GIMP -- an image manipulation program
 
2
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 
 
4
# This program is free software; you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation; either version 2 of the License, or
 
7
# (at your option) any later version.
 
8
 
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
 
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program; if not, write to the Free Software
 
16
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 
 
18
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
 
19
 
 
20
sub pdb_misc {
 
21
    $author = $copyright = 'Andy Thomas';
 
22
    $date = '1998';
 
23
}
 
24
 
 
25
sub brush_args {(
 
26
    { name => 'opacity',
 
27
      type => '0 <= float <= 100',
 
28
      desc => 'The initial opacity of the brush' },
 
29
    { name => 'spacing',
 
30
      type => 'int32 <= 1000',
 
31
      desc => 'The initial spacing of the brush (if < 0 then use brush default
 
32
               spacing)' },
 
33
    { name => 'paint_mode', type => 'enum GimpLayerModeEffects',
 
34
      desc => 'The initial paint mode: { %%desc%% }'  }
 
35
)}
 
36
 
 
37
sub brushes_popup {
 
38
    $blurb = 'Invokes the Gimp brush selection.';
 
39
 
 
40
    $help = 'This procedure popups the brush selection dialog.';
 
41
 
 
42
    &pdb_misc;
 
43
 
 
44
    @inargs = (
 
45
        { name => 'brush_callback', type => 'string',
 
46
          desc => 'The callback PDB proc to call when brush selection is
 
47
                   made' },
 
48
        { name => 'popup_title', type => 'string',
 
49
          desc => 'Title to give the brush popup window' },
 
50
        { name => 'initial_brush', type => 'string',
 
51
          desc => 'The name of the brush to set as the first selected',
 
52
          null_ok => 1 },
 
53
        &brush_args
 
54
    );
 
55
 
 
56
    %invoke = (
 
57
        code => <<'CODE'
 
58
{
 
59
  if (gimp->no_interface ||
 
60
      ! procedural_db_lookup (gimp, brush_callback) ||
 
61
      ! gimp_pdb_dialog_new (gimp, context, gimp->brush_factory->container,
 
62
                             popup_title, brush_callback, initial_brush,
 
63
                             "opacity",    opacity / 100.0,
 
64
                             "paint-mode", paint_mode,
 
65
                             "spacing",    spacing,
 
66
                             NULL))
 
67
    success = FALSE;
 
68
}
 
69
CODE
 
70
    );
 
71
}
 
72
 
 
73
sub brushes_close_popup {
 
74
    $blurb = 'Popdown the Gimp brush selection.';
 
75
 
 
76
    $help = 'This procedure closes an opened brush selection dialog.';
 
77
 
 
78
    &pdb_misc;
 
79
 
 
80
    @inargs = (
 
81
        { name => 'brush_callback', type => 'string',
 
82
          desc => 'The name of the callback registered for this popup' }
 
83
    );
 
84
 
 
85
    %invoke = (
 
86
        code => <<'CODE'
 
87
{
 
88
  if (gimp->no_interface ||
 
89
      ! procedural_db_lookup (gimp, brush_callback) ||
 
90
      ! gimp_pdb_dialog_close (gimp, gimp->brush_factory->container,
 
91
                               brush_callback))
 
92
    success = FALSE;
 
93
}
 
94
CODE
 
95
    );
 
96
}
 
97
 
 
98
sub brushes_set_popup {
 
99
    $blurb = 'Sets the current brush selection in a popup.';
 
100
 
 
101
    $help = $blurb;
 
102
 
 
103
    &pdb_misc;
 
104
 
 
105
    @inargs = (
 
106
        { name => 'brush_callback', type => 'string',
 
107
          desc => 'The name of the callback registered for this popup' },
 
108
        { name => 'brush_name', type => 'string',
 
109
          desc => 'The name of the brush to set as selected' },
 
110
        &brush_args
 
111
    );
 
112
 
 
113
    %invoke = (
 
114
        code => <<'CODE'
 
115
{
 
116
  if (gimp->no_interface ||
 
117
      ! procedural_db_lookup (gimp, brush_callback) ||
 
118
      ! gimp_pdb_dialog_set (gimp, gimp->brush_factory->container,
 
119
                             brush_callback, brush_name,
 
120
                             "opacity",    opacity / 100.0,
 
121
                             "paint-mode", paint_mode,
 
122
                             "spacing",    spacing,
 
123
                             NULL))
 
124
    success = FALSE;
 
125
}
 
126
CODE
 
127
    );
 
128
}
 
129
 
 
130
@headers = qw("core/gimp.h" "core/gimpdatafactory.h");
 
131
 
 
132
@procs = qw(brushes_popup brushes_close_popup brushes_set_popup);
 
133
%exports = (app => [@procs], lib => [@procs]);
 
134
 
 
135
$desc = 'Brush UI';
 
136
 
 
137
1;