#!/usr/bin/env python
#
# 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
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

from gimpfu import *



def image_paths_brushstroke(image, drawable, visible_only):
    pdb.gimp_image_undo_group_start(image)
    num_paths, paths = pdb.gimp_path_list(image)
    for path in paths:
        if visible_only:stroke_path = pdb.gimp_path_get_visible(image, path)
        else:stroke_path = True
        if stroke_path:
            pdb.gimp_path_set_current(image, path)
            pdb.gimp_path_stroke_current(image)
    pdb.gimp_image_undo_group_end(image)
    

def image_paths_brushstroke_all(image, drawable):
    visible_only = False
    image_paths_brushstroke(image, drawable, visible_only)

register(
        "python_fu_image_paths_brushstroke",
        "Stroke all paths with the current brush.",
        "Stroke all paths with the current brush.",
        "Carol Spears",
        "Carol Spears and General Public License",
        "2005",
        "<Image>/Paths/Stroke All Paths",
	"",
        [],
        [],
        image_paths_brushstroke_all)


def image_paths_brushstroke_visible(image, drawable):
    visible_only = True
    image_paths_brushstroke(image, drawable, visible_only)

register(
        "python_fu_image_paths_brushstroke_visible",
        "Stroke all visible paths with the current brush.",
        "Stroke all visible paths with the current brush.",
        "Carol Spears",
        "Carol Spears and General Public License",
        "2005",
        "<Image>/Paths/Stroke Visible Paths",
	"",
        [],
        [],
        image_paths_brushstroke_visible)

main()
