Commit 68e7843c authored by Manish Singh's avatar Manish Singh

Initial commit of the webbrowser plugin. I'm not sure whether to make this

optional or not, so I took the easy way out in the configure script and made
everything link with -lXmu. Ugh.

-Yosh
parent 2f5ec071
Wed Feb 25 02:46:28 PST 1998 Manish Singh <yosh@gimp.org>
* added webbrowser plugin for gimp help
Tue Feb 24 22:14:06 PST 1998 Manish Singh <yosh@gimp.org>
* plug-ins/xpm/xpm.c: update. Hopefully this fixes all
......
......@@ -63,6 +63,11 @@ AC_DEFUN(AC_GIMP_CHECK,
x_libs="-lXext $x_libs", ,
$x_libs)
dnl FIXME: I have to think of a better way
AC_CHECK_LIB(Xmu, XmuClientWindow,
x_libs="-lXmu $x_libs", ,
$x_libs)
X_LIBS="$X_LIBS -lgtk -lgdk -lglib $x_libs -lm"
LDFLAGS="$saved_ldflags $X_LDFLAGS $X_LIBS"
......@@ -375,6 +380,7 @@ plug-ins/illusion/Makefile
plug-ins/fractaltrace/Makefile
plug-ins/fs/Makefile
plug-ins/flarefx/Makefile
plug-ins/webbrowser/Makefile
app/Makefile
docs/Makefile
)
......@@ -112,6 +112,7 @@ SUBDIRS = \
vinvert \
vpropagate \
waves \
webbrowser \
whirlpinch \
xwd \
zealouscrop
......
......@@ -326,18 +326,19 @@ script_fu_add_script (LISP a)
/* Check the supplied number of arguments */
script->num_args = nlength (a) / 3;
args = g_new (GParamDef, script->num_args + 1);
args[0].type = PARAM_INT32;
args[0].name = "run_mode";
args[0].description = "Interactive, non-interactive";
script->args_widgets = NULL;
script->arg_types = g_new (SFArgType, script->num_args);
script->arg_labels = g_new (char *, script->num_args);
script->arg_defaults = g_new (SFArgValue, script->num_args);
script->arg_values = g_new (SFArgValue, script->num_args);
if (script->num_args > 0)
{
script->args_widgets = NULL;
script->arg_types = g_new (SFArgType, script->num_args);
script->arg_labels = g_new (char *, script->num_args);
script->arg_defaults = g_new (SFArgValue, script->num_args);
script->arg_values = g_new (SFArgValue, script->num_args);
args = g_new (GParamDef, script->num_args + 1);
args[0].type = PARAM_INT32;
args[0].name = "run_mode";
args[0].description = "Interactive, non-interactive";
for (i = 0; i < script->num_args; i++)
{
if (a != NIL)
......@@ -516,6 +517,9 @@ script_fu_script_proc (char *name,
status = STATUS_CALLING_ERROR;
else
{
if (script->num_args == 0)
run_mode = RUN_NONINTERACTIVE;
switch (run_mode)
{
case RUN_INTERACTIVE:
......@@ -577,6 +581,8 @@ script_fu_script_proc (char *name,
c = command = g_new (char, length);
if (script->num_args)
{
sprintf (command, "(%s ", script->script_name);
c += strlen (script->script_name) + 2;
for (i = 0; i < script->num_args; i++)
......@@ -614,6 +620,9 @@ script_fu_script_proc (char *name,
sprintf (c, "%s ", text);
c += strlen (text) + 1;
}
}
else
sprintf (command, "(%s)", script->script_name);
/* run the command through the interpreter */
err_msg = (repl_c_string (command, 0, 0, 1) != 0) ? TRUE : FALSE;
......
......@@ -326,18 +326,19 @@ script_fu_add_script (LISP a)
/* Check the supplied number of arguments */
script->num_args = nlength (a) / 3;
args = g_new (GParamDef, script->num_args + 1);
args[0].type = PARAM_INT32;
args[0].name = "run_mode";
args[0].description = "Interactive, non-interactive";
script->args_widgets = NULL;
script->arg_types = g_new (SFArgType, script->num_args);
script->arg_labels = g_new (char *, script->num_args);
script->arg_defaults = g_new (SFArgValue, script->num_args);
script->arg_values = g_new (SFArgValue, script->num_args);
if (script->num_args > 0)
{
script->args_widgets = NULL;
script->arg_types = g_new (SFArgType, script->num_args);
script->arg_labels = g_new (char *, script->num_args);
script->arg_defaults = g_new (SFArgValue, script->num_args);
script->arg_values = g_new (SFArgValue, script->num_args);
args = g_new (GParamDef, script->num_args + 1);
args[0].type = PARAM_INT32;
args[0].name = "run_mode";
args[0].description = "Interactive, non-interactive";
for (i = 0; i < script->num_args; i++)
{
if (a != NIL)
......@@ -516,6 +517,9 @@ script_fu_script_proc (char *name,
status = STATUS_CALLING_ERROR;
else
{
if (script->num_args == 0)
run_mode = RUN_NONINTERACTIVE;
switch (run_mode)
{
case RUN_INTERACTIVE:
......@@ -577,6 +581,8 @@ script_fu_script_proc (char *name,
c = command = g_new (char, length);
if (script->num_args)
{
sprintf (command, "(%s ", script->script_name);
c += strlen (script->script_name) + 2;
for (i = 0; i < script->num_args; i++)
......@@ -614,6 +620,9 @@ script_fu_script_proc (char *name,
sprintf (c, "%s ", text);
c += strlen (text) + 1;
}
}
else
sprintf (command, "(%s)", script->script_name);
/* run the command through the interpreter */
err_msg = (repl_c_string (command, 0, 0, 1) != 0) ? TRUE : FALSE;
......
......@@ -79,6 +79,7 @@ scriptdata_DATA = \
truchet.scm \
waves-anim.scm \
weave.scm \
web-browser.scm \
xach-effect.scm
EXTRA_DATA =
......
; web-browser.scm -- install bookmarks
; Copyright (c) 1997 Misha Dynin <misha@xcf.berkeley.edu>
; Note: script-fu must be able to handle zero argument procedures to
; process this file!
;
; For more information see webbrowser.readme or
; http://www.xcf.berkeley.edu/~misha/gimp/
;
; 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., 675 Mass Ave, Cambridge, MA 02139, USA.
(set! web-browser-new-window 0)
(define (script-fu-bookmark url)
(extension-web-browser 1 url web-browser-new-window))
(define (bookmark-register proc menu help)
(script-fu-register proc menu help
"Misha Dynin <misha@xcf.berkeley.edu>"
"Misha Dynin"
"1997"
""))
(define (script-fu-bookmark-1)
(script-fu-bookmark "http://www.gimp.org/the_gimp.html"))
(bookmark-register "script-fu-bookmark-1"
"<Toolbox>/Xtns/Web Browser/GIMP.ORG/The GIMP"
"Link to http://www.gimp.org/the_gimp.html")
(define (script-fu-bookmark-2)
(script-fu-bookmark "http://www.gimp.org/docs.html"))
(bookmark-register "script-fu-bookmark-2"
"<Toolbox>/Xtns/Web Browser/GIMP.ORG/Documenation"
"Link to http://www.gimp.org/docs.html")
(define (script-fu-bookmark-3)
(script-fu-bookmark "http://www.gimp.org/mailing_list.html"))
(bookmark-register "script-fu-bookmark-3"
"<Toolbox>/Xtns/Web Browser/GIMP.ORG/Mailing Lists"
"Link to http://www.gimp.org/mailing_list.html")
(define (script-fu-bookmark-4)
(script-fu-bookmark "http://www.gimp.org/data.html"))
(bookmark-register "script-fu-bookmark-4"
"<Toolbox>/Xtns/Web Browser/GIMP.ORG/Resources"
"Link to http://www.gimp.org/data.html")
(define (script-fu-bookmark-5)
(script-fu-bookmark "http://www.gimp.org/download.html"))
(bookmark-register "script-fu-bookmark-5"
"<Toolbox>/Xtns/Web Browser/GIMP.ORG/Download"
"Link to http://www.gimp.org/download.html")
(define (script-fu-bookmark-6)
(script-fu-bookmark "http://www.gimp.org/art.html"))
(bookmark-register "script-fu-bookmark-6"
"<Toolbox>/Xtns/Web Browser/GIMP.ORG/GIMP Art"
"Link to http://www.gimp.org/art.html")
(define (script-fu-bookmark-7)
(script-fu-bookmark "http://www.gimp.org/links.html"))
(bookmark-register "script-fu-bookmark-7"
"<Toolbox>/Xtns/Web Browser/GIMP.ORG/Links"
"Link to http://www.gimp.org/links.html")
(define (script-fu-bookmark-8)
(script-fu-bookmark "http://www.gimp.org/gtk/"))
(bookmark-register "script-fu-bookmark-8"
"<Toolbox>/Xtns/Web Browser/GIMP.ORG/GTK"
"Link to http://www.gimp.org/gtk/")
(define (script-fu-bookmark-10)
(script-fu-bookmark "http://xach.dorknet.com/gimp/news/"))
(bookmark-register "script-fu-bookmark-10"
"<Toolbox>/Xtns/Web Browser/GIMP News"
"Link to http://xach.dorknet.com/gimp/news/")
(define (script-fu-bookmark-11)
(script-fu-bookmark "http://gimp.foebud.org/registry/"))
(bookmark-register "script-fu-bookmark-11"
"<Toolbox>/Xtns/Web Browser/Plug-In Registry"
"Link to http://gimp.foebud.org/registry/")
(define (script-fu-bookmark-12)
(script-fu-bookmark "http://www.rru.com/~meo/gimp/faq-user.html"))
(bookmark-register "script-fu-bookmark-12"
"<Toolbox>/Xtns/Web Browser/User FAQ"
"Link to http://www.rru.com/~meo/gimp/faq-user.html")
(define (script-fu-bookmark-13)
(script-fu-bookmark "http://www.rru.com/~meo/gimp/faq-dev.html"))
(bookmark-register "script-fu-bookmark-13"
"<Toolbox>/Xtns/Web Browser/Developer FAQ"
"Link to http://www.rru.com/~meo/gimp/faq-dev.html")
(define (script-fu-bookmark-14)
(script-fu-bookmark "http://www.frozenriver.ale.se/"))
(bookmark-register "script-fu-bookmark-14"
"<Toolbox>/Xtns/Web Browser/GIMP Manual"
"Link to http://www.frozenriver.ale.se/")
(define (script-fu-bookmark-15)
(script-fu-bookmark "http://abattoir.cc.ndsu.nodak.edu/~nem/gimp/tuts/"))
(bookmark-register "script-fu-bookmark-15"
"<Toolbox>/Xtns/Web Browser/GIMP Tutorials"
"Link to http://abattoir.cc.ndsu.nodak.edu/~nem/gimp/tuts/")
(define (script-fu-bookmark-16)
(script-fu-bookmark "http://www.ecn.ou.edu/~sjburges/bugs.html"))
(bookmark-register "script-fu-bookmark-16"
"<Toolbox>/Xtns/Web Browser/GIMP Bugs"
"Link to http://www.ecn.ou.edu/~sjburges/bugs.html")
Makefile.in
Makefile
.deps
_libs
.libs
webbrowser
## Process this file with automake to produce Makefile.in
pluginlibdir = $(gimpplugindir)/plug-ins
pluginlib_PROGRAMS = webbrowser
webbrowser_SOURCES = \
webbrowser.c
INCLUDES = \
$(X_CFLAGS) \
-I$(top_srcdir) \
-I$(includedir)
LDADD = \
$(top_builddir)/libgimp/libgimpui.la \
$(top_builddir)/libgimp/libgimp.la \
$(X_LIBS) \
\
-lc
DEPS = \
$(top_builddir)/libgimp/libgimpui.la \
$(top_builddir)/libgimp/libgimp.la
webbrowser_DEPENDENCIES = $(DEPS)
.PHONY: files
files:
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
echo $$p; \
done
@for subdir in $(SUBDIRS); do \
files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
for file in $$files; do \
echo $$subdir/$$file; \
done; \
done
Web Browser GIMP Extension v0.3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
by Misha Dynin <misha@xcf.berkeley.edu>
Introduction
~~~~~~~~~~~~
Web Browser GIMP extension is not an HTML browser (at least, not yet ;-);
it's just an interface to an external web browser that allows GIMP, using
a PDB call, to instruct a browser to open a URL.
Currently, it works with Netscape, version 1.1 or above, using a protocol
described in detail on http://home.netscape.com/newsref/std/x-remote.html.
If Netscape is not running already, the extension starts it, with a URL
as a command-line argument.
Possible uses of this extension:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Providing a set of bookmarks, accessible from the GIMP.
This is implemented -- web-browser.scm, included in a distribution,
builds a menu of frequently accessed GIMP websites. It's cool.
* Implementing GIMP online help.
This is the most promising use of the extension. GIMP plugins and
main application can provide "Help" and "About" buttons, which,
when pressed, cause a corresponding page to be opened in Netscape.
This is doable now; the only problem is to design a standard way
to do that. It would be great to be able to access the documentation
either from the web site or, if installed, from local disk.
(add gimp-path to .gimprc; use as prefix in gimp-help() function?)
I request input of experienced GIMP developers on this.
* Providing a preview in a web browser.
Large percentage of the graphics designed in GIMP ends up on the WWW.
With this extension, you can write a script that automatically
launches a web browser and displays the image as it will be viewed.
Imagine: have a set of scripts defining page style, change one attribute,
and have GIMP not only recompute all the images, but also automagically
open the redesigned page design in a browser window!
How to use the extension:
~~~~~~~~~~~~~~~~~~~~~~~~
* Interactively:
select Xtns -> Web Browser -> Open URL, type in the URL, press Ok;
* Non-interactively:
use procedure extension-web-browser (url, new-window), which takes
as the first argument a URL of a page to open, and second argument
is a boolean which specifies whether you want the browser to open
a new window with a document (new-window == TRUE) or use current
window (new-window == FALSE). If the browser is not already running,
new-window value is ignored.
I didn't provide a more detailed API on purpose -- making it more
detailed would make it more Netscape-specific, and I want to be able
to add support for other browsers. If someone has a convincing argument
for adding more functions (i.e. to check whether browser is running, etc.),
email me.
Status:
~~~~~~
Netscape support is stable. I haven't tested it on many platforms,
but I don't expect any problems. What other browsers, if any, do we
need to support?
Included "web-browser.scm" has links to the most popular (IMHO)
GIMP pages. I hope that the extension will get incorporated into
the main source tree, and I will not have to maintain the bookmarks
list.
Need help system design based on the web browser extension.
If some GIMP guru (petm? spencer?) tells me what's the right way to do it,
I can implement the help system.
I didn't write a proof-of-concept implementation of the preview
script mainly because I am lazy. If someone writes such a script --
please email it to me.
Building Web Browser Extension
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling it should be fairly easy. I've included Makefile diff's (for
the Makefile in plug-ins directory). webbrowser requires libXmu;
it should be linked with -lXmu.
Enclosed script, web-browser.scm, creates a bookmarks menu in
Xnts/Web Browser/*. Note that there is a bug in script-fu
(at least as of version 0.99.15) which prevents it from handling
scripts with zero arguments. Enclosed patch to
plug-ins/script-fu/script-fu-scripts.c fixes that bug. Without
this patch, web-browser.scm won't work.
Where To Find This Extension
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The extension can be downloaded from
ftp://ftp.xcf.berkeley.edu/pub/misha/webbrowser.tar.gz
For the up-to-date information about this extension, check out
http://www.xcf.berkeley.edu/~misha/gimp/
Author
~~~~~~
This extension is written by Misha Dynin <misha@xcf.berkeley.edu>.
I used the code from GUMP plugin, by Adrian Likins <aklikins@eos.ncsu.edu>.
Netscape interface code copyright:
* Copyright © 1996 Netscape Communications Corporation, all rights reserved.
* Created: Jamie Zawinski <jwz@netscape.com>, 24-Dec-94.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. No representations are made about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment