#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# This is the main file of btn4ws.
#
# Copyright (c) 1999-2007 Jan Dittberner <jan@dittberner.info>
#
# This file is part of btn4ws.
#
# btn4ws 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.
#
# btn4ws 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 btn4ws; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#
# version: $Id$
#

"""
Gimp script to generate button images for websites. This script is a
port of the older gimp-perl version to python.

(c) 2007 Jan Dittberner <jan@dittberner.info>
"""
import logging, sys
from gimpfu import *

btn4ws_version = "0.7.0"

logging.basicConfig(level=logging.INFO,
                    format='$(asctime)s %(levelname)s %(message)s',
                    stream=sys.stderr)

def python_btn4ws(filename, outdir, font, strcolor, transparency, bgcolor,
                  glow, glowcolor, usepattern, pattern, buttoncolor,
                  roundradius, padding, glowsize, bevelwidth, nova,
                  novasparkles, novaradius, novacolor, writexcf, makeinactive,
                  makeactive, makepressed, makejscript):
    """
    This function controls the creation of the buttons and is registered as
    gimp plugin.
    """
    pass

register(
    "python_fu_btn4ws", "Buttons for website",
    "Creates buttons for a website. Which have the same size, layout, effects on it. It's possible to create JavaScript code, CSS and XHTML examples for MouseOver effects also.",
    "Jan Dittberner",
    "Jan Dittberner <jan@dittberner.info>",
    "%s, %s" % (btn4ws_version,
                "$Date$"),
    "<Toolbox>/Xtns/Render/Buttons for website ...",
    "",
    [(PF_FILE, "string_filename", "File containing the strings", ""),
     (PF_FILE, "output_directory", "Directory for the output files", ""),
     (PF_FONT, "font", "Font for the strings", "Sans 18"),
     (PF_COLOR, "string_color", "Color of the strings", (255, 255, 0)),
     (PF_TOGGLE, "transparent_background",
      "Keep the background transparent (This doesn't work in MS Internet Explorer <= 6.0)", 0),
     (PF_COLOR, "background_color", "Color of the background", (7, 135, 255)),
     (PF_TOGGLE, "apply_glow", "Enable glow effect", 1),
     (PF_COLOR, "glow_color", "Color of the Glow effect", (255, 180, 0)),
     (PF_TOGGLE, "use_pattern", "Use a pattern for the button", 1),
     (PF_PATTERN, "button_pattern", "Fill pattern of the button", "Rain"),
     (PF_COLOR, "button_color",
      "Button color (if you don't use a pattern)", (0, 0, 255)),
     (PF_INT32, "round_radius", "Radius of the round corners", 20),
     (PF_INT32, "padding", "Space around the text", 3),
     (PF_INT32, "glow_size", "Size of the Glow effect", 10),
     (PF_INT32, "bevel_width", "Width of the bevel", 5),
     (PF_TOGGLE, "apply_nova", "Nova or not Nova?", 1),
     (PF_INT32, "nova_sparkles", "Sparkles of the Nova", 5),
     (PF_INT32, "nova_radius", "Radius of the Nova", 2),
     (PF_COLOR, "nova_color", "Color of the Nova effect", (255, 238, 0)),
     (PF_TOGGLE, "write_xcf", "Write a GIMP xcf file", 0),
     (PF_TOGGLE, "create_inactive", "Create Inactive Button", 1),
     (PF_TOGGLE, "create_active", "Create Active Button", 1),
     (PF_TOGGLE, "create_pressed", "Create Pressed Button", 1),
     (PF_TOGGLE, "create_jscript", "Create JavaScript, HTML and CSS", 1)
     ],
    [],
    python_btn4ws)

main()