mirror of
https://gitlab.gnome.org/GNOME/eog
synced 2024-10-18 22:14:48 +00:00
Initial revision
This commit is contained in:
commit
948a56b383
340
COPYING
Normal file
340
COPYING
Normal file
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
4
ChangeLog
Normal file
4
ChangeLog
Normal file
|
@ -0,0 +1,4 @@
|
|||
1999-09-15 Federico Mena Quintero <federico@redhat.com>
|
||||
|
||||
* Started the ChangeLog.
|
||||
|
182
INSTALL
Normal file
182
INSTALL
Normal file
|
@ -0,0 +1,182 @@
|
|||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
1
MAINTAINERS
Normal file
1
MAINTAINERS
Normal file
|
@ -0,0 +1 @@
|
|||
Email: federico@gimp.org
|
1
Makefile.am
Normal file
1
Makefile.am
Normal file
|
@ -0,0 +1 @@
|
|||
SUBDIRS = intl macros po src
|
53
README
Normal file
53
README
Normal file
|
@ -0,0 +1,53 @@
|
|||
Eye of Gnome: an image viewer
|
||||
-----------------------------
|
||||
|
||||
|
||||
Perfect vision soup:
|
||||
|
||||
- 1 cauldron of raven broth
|
||||
- 2 vampire's ears
|
||||
- 4 legs of tarantula
|
||||
- 1 eye of gnome
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
|
||||
This is the Eye of Gnome, an image viewer program. It is meant to be
|
||||
a fast and functional image viewer as well as an image cataloging
|
||||
program.
|
||||
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
This package requires the basic gnome-libs package and the gdk-pixbuf
|
||||
library.
|
||||
|
||||
|
||||
Availability
|
||||
------------
|
||||
|
||||
The latest version of this package is available from the GNOME CVS
|
||||
repository at cvs.gnome.org or the FTP site at ftp.gnome.org.
|
||||
|
||||
|
||||
Reporting bugs
|
||||
--------------
|
||||
|
||||
Please use the GNOME bug tracking system to report bugs. You can
|
||||
reach it at http://bugs.gnome.org.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
This program is released under the terms of the GNU General Public
|
||||
License. Please see the file COPYING for details.
|
||||
|
||||
|
||||
Author
|
||||
------
|
||||
|
||||
Federico Mena-Quintero (federico@gimp.org)
|
9
acconfig.h
Normal file
9
acconfig.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#undef PACKAGE
|
||||
#undef VERSION
|
||||
#undef HAVE_LIBSM
|
||||
#undef HAVE_CATGETS
|
||||
#undef HAVE_GETTEXT
|
||||
#undef HAVE_LC_MESSAGES
|
||||
#undef HAVE_STPCPY
|
||||
#undef ENABLE_NLS
|
||||
|
17
autogen.sh
Executable file
17
autogen.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
PKG_NAME="Eye of Gnome image viewer"
|
||||
|
||||
(test -f $srcdir/configure.in \
|
||||
&& test -d $srcdir/src \
|
||||
&& test -f $srcdir/src/render.c) || {
|
||||
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
|
||||
echo " top-level $PKG_NAME directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
. $srcdir/macros/autogen.sh
|
41
configure.in
Normal file
41
configure.in
Normal file
|
@ -0,0 +1,41 @@
|
|||
dnl Configure script for the Eye of Gnome image viewer
|
||||
|
||||
AC_INIT(src/render.c)
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AM_INIT_AUTOMAKE(eog, 0.1)
|
||||
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AM_ACLOCAL_INCLUDE(macros)
|
||||
|
||||
GNOME_INIT
|
||||
|
||||
AC_PROG_CC
|
||||
AC_ISC_POSIX
|
||||
AC_HEADER_STDC
|
||||
AC_ARG_PROGRAM
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
GNOME_COMPILE_WARNINGS
|
||||
|
||||
ALL_LINGUAS=""
|
||||
AM_GNU_GETTEXT
|
||||
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(CPPFLAGS)
|
||||
AC_SUBST(LDFLAGS)
|
||||
|
||||
EXTRA_GNOME_CFLAGS=`gnome-config --cflags gnomeui gdk_pixbuf`
|
||||
EXTRA_GNOME_LIBS=`gnome-config --libs gnomeui gdk_pixbuf`
|
||||
AC_SUBST(EXTRA_GNOME_CFLAGS)
|
||||
AC_SUBST(EXTRA_GNOME_LIBS)
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
intl/Makefile
|
||||
macros/Makefile
|
||||
po/Makefile.in
|
||||
src/Makefile
|
||||
])
|
1210
libeog/gtkscrollframe.c
Normal file
1210
libeog/gtkscrollframe.c
Normal file
File diff suppressed because it is too large
Load diff
93
libeog/gtkscrollframe.h
Normal file
93
libeog/gtkscrollframe.h
Normal file
|
@ -0,0 +1,93 @@
|
|||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_SCROLL_FRAME_H__
|
||||
#define __GTK_SCROLL_FRAME_H__
|
||||
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkbin.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define GTK_TYPE_SCROLL_FRAME (gtk_scroll_frame_get_type ())
|
||||
#define GTK_SCROLL_FRAME(obj) (GTK_CHECK_CAST ((obj), \
|
||||
GTK_TYPE_SCROLL_FRAME, GtkScrollFrame))
|
||||
#define GTK_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \
|
||||
GTK_TYPE_SCROLL_FRAME, GtkScrollFrameClass))
|
||||
#define GTK_IS_SCROLL_FRAME(obj) (GTK_CHECK_TYPE ((obj), \
|
||||
GTK_TYPE_SCROLL_FRAME))
|
||||
#define GTK_IS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \
|
||||
GTK_TYPE_SCROLL_FRAME))
|
||||
|
||||
|
||||
typedef struct _GtkScrollFrame GtkScrollFrame;
|
||||
typedef struct _GtkScrollFrameClass GtkScrollFrameClass;
|
||||
|
||||
struct _GtkScrollFrame
|
||||
{
|
||||
GtkBin bin;
|
||||
|
||||
/* Private data */
|
||||
gpointer priv;
|
||||
};
|
||||
|
||||
struct _GtkScrollFrameClass
|
||||
{
|
||||
GtkBinClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType gtk_scroll_frame_get_type (void);
|
||||
GtkWidget *gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj);
|
||||
|
||||
void gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj);
|
||||
void gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj);
|
||||
|
||||
GtkAdjustment *gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf);
|
||||
GtkAdjustment *gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf);
|
||||
|
||||
void gtk_scroll_frame_set_policy (GtkScrollFrame *sf,
|
||||
GtkPolicyType hsb_policy,
|
||||
GtkPolicyType vsb_policy);
|
||||
|
||||
void gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placement);
|
||||
void gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type);
|
||||
void gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing);
|
||||
|
||||
void gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GTK_SCROLL_FRAME_H__ */
|
18
libeog/image.h
Normal file
18
libeog/image.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef IMAGE_H
|
||||
#define IMAGE_H
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
|
||||
|
||||
/* The main image structure */
|
||||
typedef struct {
|
||||
/* Buffer with original image data */
|
||||
GdkPixBuf *buf;
|
||||
|
||||
/* Color substitution tables */
|
||||
guchar *r_lut, *g_lut, *b_lut;
|
||||
} Image;
|
||||
|
||||
|
||||
#endif
|
108
libeog/ui-image.c
Normal file
108
libeog/ui-image.c
Normal file
|
@ -0,0 +1,108 @@
|
|||
#include "ui-image.h"
|
||||
|
||||
|
||||
static void ui_image_class_init (UIImageClass *class);
|
||||
static void ui_image_init (UIImage *ui);
|
||||
static void ui_image_destroy (GtkObject *object);
|
||||
|
||||
static GtkTableClass *parent_class;
|
||||
|
||||
/**
|
||||
* ui_image_get_type:
|
||||
* @void:
|
||||
*
|
||||
* Registers the &UIImage class if necessary, and returns the type ID associated
|
||||
* to it.
|
||||
*
|
||||
* Return value: the type ID of the &UIImage class.
|
||||
**/
|
||||
GtkType
|
||||
ui_image_get_type (void)
|
||||
{
|
||||
static GtkType ui_image_type = 0;
|
||||
|
||||
if (!ui_image_type) {
|
||||
static const ui_image_info = {
|
||||
"UIImage",
|
||||
sizeof (UIImage),
|
||||
sizeof (UIImageClass),
|
||||
(GtkClassInitFunc) ui_image_class_init,
|
||||
(GtkObjectInitfunc) ui_image_init,
|
||||
NULL, /* reserved_1 */
|
||||
NULL, /* reserved_2 */
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
ui_image_type = gtk_type_unique (gtk_table_get_type (), &ui_image_info);
|
||||
}
|
||||
|
||||
return ui_image_type;
|
||||
}
|
||||
|
||||
/* Class initialization function for an image's user interface */
|
||||
static void
|
||||
ui_image_class_init (UIImageClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_table_get_type ());
|
||||
|
||||
object_class->destroy = ui_image_destroy;
|
||||
}
|
||||
|
||||
/* Object initialization function for an image's user interface */
|
||||
static void
|
||||
ui_image_init (UIImage *ui)
|
||||
{
|
||||
GtkTable *table;
|
||||
|
||||
table = GTK_TABLE (ui);
|
||||
gtk_table_resize (table, 2, 2);
|
||||
|
||||
/* Create the image area */
|
||||
ui->view = view_new ();
|
||||
gtk_table_attach (table, ui->view,
|
||||
0, 1, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
|
||||
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
|
||||
0, 0);
|
||||
gtk_widget_show (ui->view);
|
||||
|
||||
/* Create the adjustments and scrollbars */
|
||||
|
||||
ui->vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
||||
ui->hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
||||
|
||||
ui->vsb = gtk_vscrollbar_new (ui->vadj);
|
||||
ui->hsb = gtk_hscrollbar_new (ui->hadj);
|
||||
|
||||
gtk_table_attach (table, ui->vsb,
|
||||
1, 2, 0, 1,
|
||||
0,
|
||||
GTK_EXPAND | GTK_FILL,
|
||||
0, 0);
|
||||
gtk_table_attach (table, ui->hsb,
|
||||
0, 1, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL,
|
||||
0,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
/* Destroy handler for an image's user interface */
|
||||
static void
|
||||
ui_image_destroy (GtkObject *object)
|
||||
{
|
||||
UIImage *ui;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (IS_WINDOW (object));
|
||||
|
||||
ui = UI_IMAGE (object);
|
||||
|
||||
/* FIXME */
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
50
libeog/ui-image.h
Normal file
50
libeog/ui-image.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
#ifndef UI_IMAGE_H
|
||||
#define UI_IMAGE_H
|
||||
|
||||
#include <libgnome/gnome-defs.h>
|
||||
#include <gtk/gtktable.h>
|
||||
#include "image.h"
|
||||
|
||||
BEGIN_GNOME_DECLS
|
||||
|
||||
|
||||
#define TYPE_UI_IMAGE (ui_image_get_type ())
|
||||
#define UI_IMAGE(obj) (GTK_CHECK_CAST (obj), TYPE_UI_IMAGE, UIImage)
|
||||
#define UI_IMAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_UI_IMAGE, UIImageClass))
|
||||
#define IS_UI_IMAGE(obj) (GTK_CHECK_TYPE ((obj), TYPE_UI_IMAGE))
|
||||
#define IS_UI_IMAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_UI_IMAGE))
|
||||
|
||||
typedef struct _UIImage UIImage;
|
||||
typedef struct _UIImageClass UIImageClass;
|
||||
|
||||
struct _UIImage {
|
||||
GtkTable table;
|
||||
|
||||
/* Image we are displaying */
|
||||
Image *image;
|
||||
|
||||
/* Image view area */
|
||||
GtkWidget *view;
|
||||
|
||||
/* Vertical and horizontal adjustments */
|
||||
GtkAdjustment *vadj;
|
||||
GtkAdjustment *hadj;
|
||||
|
||||
/* Vertical and horizontal scrollbars */
|
||||
GtkWidget *vsb;
|
||||
GtkWidget *hsb;
|
||||
};
|
||||
|
||||
struct _UIImageClass {
|
||||
GtkTableClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType ui_image_get_type (void);
|
||||
UIImage *ui_image_new (void);
|
||||
void ui_image_set_image (UIImage *ui, Image *image);
|
||||
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
#endif
|
4
po/ChangeLog
Normal file
4
po/ChangeLog
Normal file
|
@ -0,0 +1,4 @@
|
|||
1999-09-15 Federico Mena Quintero <federico@redhat.com>
|
||||
|
||||
* Started the ChangeLog.
|
||||
|
1
po/POTFILES.in
Normal file
1
po/POTFILES.in
Normal file
|
@ -0,0 +1 @@
|
|||
src/window.c
|
4
src/ChangeLog
Normal file
4
src/ChangeLog
Normal file
|
@ -0,0 +1,4 @@
|
|||
1999-09-15 Federico Mena Quintero <federico@redhat.com>
|
||||
|
||||
* Started the ChangeLog.
|
||||
|
23
src/Makefile.am
Normal file
23
src/Makefile.am
Normal file
|
@ -0,0 +1,23 @@
|
|||
INCLUDES = \
|
||||
-I$(includedir) \
|
||||
$(EXTRA_GNOME_CFLAGS) \
|
||||
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
|
||||
-DG_LOG_DOMAIN=\"eog\"
|
||||
|
||||
eog_SOURCES = \
|
||||
gtkscrollframe.c \
|
||||
gtkscrollframe.h \
|
||||
image.h \
|
||||
image-item.c \
|
||||
image-item.h \
|
||||
main.c \
|
||||
render.c \
|
||||
render.h \
|
||||
window.c \
|
||||
window.h
|
||||
|
||||
eog_LDADD = \
|
||||
$(EXTRA_GNOME_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
||||
bin_PROGRAMS = eog
|
390
src/Makefile.in
Normal file
390
src/Makefile.in
Normal file
|
@ -0,0 +1,390 @@
|
|||
# Makefile.in generated automatically by automake 1.4a from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_FLAG =
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AS = @AS@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EXTRA_GNOME_CFLAGS = @EXTRA_GNOME_CFLAGS@
|
||||
EXTRA_GNOME_LIBS = @EXTRA_GNOME_LIBS@
|
||||
GENCAT = @GENCAT@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GNOMEGNORBA_LIBS = @GNOMEGNORBA_LIBS@
|
||||
GNOMEUI_LIBS = @GNOMEUI_LIBS@
|
||||
GNOME_APPLETS_LIBS = @GNOME_APPLETS_LIBS@
|
||||
GNOME_CAPPLET_LIBS = @GNOME_CAPPLET_LIBS@
|
||||
GNOME_CONFIG = @GNOME_CONFIG@
|
||||
GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@
|
||||
GNOME_LIBDIR = @GNOME_LIBDIR@
|
||||
GNOME_LIBS = @GNOME_LIBS@
|
||||
GNORBA_CFLAGS = @GNORBA_CFLAGS@
|
||||
GNORBA_LIBS = @GNORBA_LIBS@
|
||||
GTKXMHTML_LIBS = @GTKXMHTML_LIBS@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
NM = @NM@
|
||||
ORBIT_CFLAGS = @ORBIT_CFLAGS@
|
||||
ORBIT_CONFIG = @ORBIT_CONFIG@
|
||||
ORBIT_IDL = @ORBIT_IDL@
|
||||
ORBIT_LIBS = @ORBIT_LIBS@
|
||||
PACKAGE = @PACKAGE@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@
|
||||
VERSION = @VERSION@
|
||||
ZVT_LIBS = @ZVT_LIBS@
|
||||
cflags_set = @cflags_set@
|
||||
cxxflags_set = @cxxflags_set@
|
||||
l = @l@
|
||||
|
||||
INCLUDES = -I$(includedir) $(EXTRA_GNOME_CFLAGS) -DGNOMELOCALEDIR=\""$(datadir)/locale"\" -DG_LOG_DOMAIN=\"eog\"
|
||||
|
||||
|
||||
eog_SOURCES = gtkscrollframe.c gtkscrollframe.h image.h image-item.c image-item.h main.c render.c render.h window.c window.h
|
||||
|
||||
|
||||
eog_LDADD = $(EXTRA_GNOME_LIBS) $(INTLLIBS)
|
||||
|
||||
|
||||
bin_PROGRAMS = eog
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
LIBS = @LIBS@
|
||||
eog_OBJECTS = gtkscrollframe.o image-item.o main.o render.o window.o
|
||||
eog_DEPENDENCIES =
|
||||
eog_LDFLAGS =
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = ChangeLog Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/gtkscrollframe.P .deps/image-item.P .deps/main.P \
|
||||
.deps/render.P .deps/window.P
|
||||
SOURCES = $(eog_SOURCES)
|
||||
OBJECTS = $(eog_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .s
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-binPROGRAMS:
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
|
||||
distclean-binPROGRAMS:
|
||||
|
||||
maintainer-clean-binPROGRAMS:
|
||||
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
done
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
eog: $(eog_OBJECTS) $(eog_DEPENDENCIES)
|
||||
@rm -f eog
|
||||
$(LINK) $(eog_LDFLAGS) $(eog_OBJECTS) $(eog_LDADD) $(LIBS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = src
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am: install-binPROGRAMS
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-binPROGRAMS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-compile clean-libtool clean-tags \
|
||||
clean-depend clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-binPROGRAMS distclean-compile distclean-libtool \
|
||||
distclean-tags distclean-depend distclean-generic \
|
||||
clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-binPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-tags maintainer-clean-depend \
|
||||
maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
|
||||
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
|
||||
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir \
|
||||
mostlyclean-depend distclean-depend clean-depend \
|
||||
maintainer-clean-depend info-am info dvi-am dvi check check-am \
|
||||
installcheck-am installcheck install-exec-am install-exec \
|
||||
install-data-am install-data install-am install uninstall-am uninstall \
|
||||
all-redirect all-am all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
1210
src/gtkscrollframe.c
Normal file
1210
src/gtkscrollframe.c
Normal file
File diff suppressed because it is too large
Load diff
93
src/gtkscrollframe.h
Normal file
93
src/gtkscrollframe.h
Normal file
|
@ -0,0 +1,93 @@
|
|||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_SCROLL_FRAME_H__
|
||||
#define __GTK_SCROLL_FRAME_H__
|
||||
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkbin.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define GTK_TYPE_SCROLL_FRAME (gtk_scroll_frame_get_type ())
|
||||
#define GTK_SCROLL_FRAME(obj) (GTK_CHECK_CAST ((obj), \
|
||||
GTK_TYPE_SCROLL_FRAME, GtkScrollFrame))
|
||||
#define GTK_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \
|
||||
GTK_TYPE_SCROLL_FRAME, GtkScrollFrameClass))
|
||||
#define GTK_IS_SCROLL_FRAME(obj) (GTK_CHECK_TYPE ((obj), \
|
||||
GTK_TYPE_SCROLL_FRAME))
|
||||
#define GTK_IS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \
|
||||
GTK_TYPE_SCROLL_FRAME))
|
||||
|
||||
|
||||
typedef struct _GtkScrollFrame GtkScrollFrame;
|
||||
typedef struct _GtkScrollFrameClass GtkScrollFrameClass;
|
||||
|
||||
struct _GtkScrollFrame
|
||||
{
|
||||
GtkBin bin;
|
||||
|
||||
/* Private data */
|
||||
gpointer priv;
|
||||
};
|
||||
|
||||
struct _GtkScrollFrameClass
|
||||
{
|
||||
GtkBinClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType gtk_scroll_frame_get_type (void);
|
||||
GtkWidget *gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj);
|
||||
|
||||
void gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj);
|
||||
void gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj);
|
||||
|
||||
GtkAdjustment *gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf);
|
||||
GtkAdjustment *gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf);
|
||||
|
||||
void gtk_scroll_frame_set_policy (GtkScrollFrame *sf,
|
||||
GtkPolicyType hsb_policy,
|
||||
GtkPolicyType vsb_policy);
|
||||
|
||||
void gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placement);
|
||||
void gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type);
|
||||
void gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing);
|
||||
|
||||
void gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GTK_SCROLL_FRAME_H__ */
|
376
src/image-item.c
Normal file
376
src/image-item.c
Normal file
|
@ -0,0 +1,376 @@
|
|||
#include <config.h>
|
||||
#include <math.h>
|
||||
#include "image-item.h"
|
||||
#include "render.h"
|
||||
|
||||
|
||||
|
||||
/* Check values */
|
||||
#define DARK_CHECK 0x55
|
||||
#define LIGHT_CHECK 0xaa
|
||||
|
||||
|
||||
|
||||
/* Private part of the ImageItem structure */
|
||||
typedef struct {
|
||||
/* Image being displayed */
|
||||
Image *image;
|
||||
|
||||
/* Zoom factor */
|
||||
double zoom;
|
||||
|
||||
/* Size of the image after zooming */
|
||||
int width, height;
|
||||
|
||||
/* Whether the image has changed */
|
||||
guint need_image_update : 1;
|
||||
|
||||
/* Whether the zoom has changed */
|
||||
guint need_zoom_update : 1;
|
||||
} ImageItemPrivate;
|
||||
|
||||
|
||||
|
||||
/* Object argument IDs */
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_IMAGE,
|
||||
ARG_ZOOM,
|
||||
};
|
||||
|
||||
static void image_item_class_init (ImageItemClass *class);
|
||||
static void image_item_init (ImageItem *ii);
|
||||
static void image_item_destroy (GtkObject *object);
|
||||
static void image_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
|
||||
static void image_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
|
||||
|
||||
static void image_item_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags);
|
||||
static void image_item_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
int x, int y, int width, int height);
|
||||
static double image_item_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
|
||||
GnomeCanvasItem **actual_item);
|
||||
static void image_item_bounds (GnomeCanvasItem *item,
|
||||
double *x1, double *y1, double *x2, double *y2);
|
||||
|
||||
|
||||
static GnomeCanvasItemClass *parent_class;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* image_item_get_type:
|
||||
* @void:
|
||||
*
|
||||
* Registers the &ImageItem class if necessary, and returns the type ID
|
||||
* associated to it.
|
||||
*
|
||||
* Return value: The type ID of the &ImageItem class.
|
||||
**/
|
||||
GtkType
|
||||
image_item_get_type (void)
|
||||
{
|
||||
static GtkType image_item_type = 0;
|
||||
|
||||
if (!image_item_type) {
|
||||
static const GtkTypeInfo image_item_info = {
|
||||
"ImageItem",
|
||||
sizeof (ImageItem),
|
||||
sizeof (ImageItemClass),
|
||||
(GtkClassInitFunc) image_item_class_init,
|
||||
(GtkObjectInitFunc) image_item_init,
|
||||
NULL, /* reserved_1 */
|
||||
NULL, /* reserved_2 */
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
image_item_type = gtk_type_unique (gnome_canvas_item_get_type (), &image_item_info);
|
||||
}
|
||||
|
||||
return image_item_type;
|
||||
}
|
||||
|
||||
/* Class initialization function for the image item */
|
||||
static void
|
||||
image_item_class_init (ImageItemClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GnomeCanvasItemClass *item_class;
|
||||
|
||||
object_class = (GtkObjectClass *) class;
|
||||
item_class = (GnomeCanvasItemClass *) class;
|
||||
|
||||
parent_class = gtk_type_class (gnome_canvas_item_get_type ());
|
||||
|
||||
gtk_object_add_arg_type ("ImageItem::image",
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_IMAGE);
|
||||
gtk_object_add_arg_type ("ImageItem::zoom",
|
||||
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_ZOOM);
|
||||
|
||||
object_class->destroy = image_item_destroy;
|
||||
object_class->set_arg = image_item_set_arg;
|
||||
object_class->get_arg = image_item_get_arg;
|
||||
|
||||
item_class->update = image_item_update;
|
||||
item_class->draw = image_item_draw;
|
||||
item_class->point = image_item_point;
|
||||
item_class->bounds = image_item_bounds;
|
||||
}
|
||||
|
||||
/* Object initialization function for the image item */
|
||||
static void
|
||||
image_item_init (ImageItem *ii)
|
||||
{
|
||||
ImageItemPrivate *priv;
|
||||
|
||||
priv = g_new0 (ImageItemPrivate, 1);
|
||||
ii->priv = priv;
|
||||
|
||||
priv->zoom = 1.0;
|
||||
}
|
||||
|
||||
/* Destroy handler for the image item */
|
||||
static void
|
||||
image_item_destroy (GtkObject *object)
|
||||
{
|
||||
GnomeCanvasItem *item;
|
||||
ImageItem *ii;
|
||||
ImageItemPrivate *priv;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (IS_IMAGE_ITEM (object));
|
||||
|
||||
item = GNOME_CANVAS_ITEM (object);
|
||||
ii = IMAGE_ITEM (object);
|
||||
priv = ii->priv;
|
||||
|
||||
gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
|
||||
|
||||
g_free (ii->priv);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
||||
|
||||
/* Set_arg handler for the image item */
|
||||
static void
|
||||
image_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
||||
{
|
||||
GnomeCanvasItem *item;
|
||||
ImageItem *ii;
|
||||
ImageItemPrivate *priv;
|
||||
|
||||
item = GNOME_CANVAS_ITEM (object);
|
||||
ii = IMAGE_ITEM (object);
|
||||
priv = ii->priv;
|
||||
|
||||
switch (arg_id) {
|
||||
case ARG_IMAGE:
|
||||
priv->image = GTK_VALUE_POINTER (*arg);
|
||||
priv->need_image_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
case ARG_ZOOM:
|
||||
priv->zoom = fabs (GTK_VALUE_DOUBLE (*arg));
|
||||
priv->need_zoom_update = TRUE;
|
||||
gnome_canvas_item_request_update (item);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get_arg handler for the image item */
|
||||
static void
|
||||
image_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
||||
{
|
||||
ImageItem *ii;
|
||||
ImageItemPrivate *priv;
|
||||
|
||||
ii = IMAGE_ITEM (object);
|
||||
priv = ii->priv;
|
||||
|
||||
switch (arg_id) {
|
||||
case ARG_IMAGE:
|
||||
GTK_VALUE_POINTER (*arg) = priv->image;
|
||||
break;
|
||||
|
||||
case ARG_ZOOM:
|
||||
GTK_VALUE_DOUBLE (*arg) = priv->zoom;
|
||||
break;
|
||||
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Recomputes the bounding box of an image item */
|
||||
static void
|
||||
recompute_bounding_box (ImageItem *ii)
|
||||
{
|
||||
GnomeCanvasItem *item;
|
||||
ImageItemPrivate *priv;
|
||||
ArtPixBuf *pixbuf;
|
||||
double i2c[6];
|
||||
ArtPoint i, c;
|
||||
|
||||
item = GNOME_CANVAS_ITEM (ii);
|
||||
priv = ii->priv;
|
||||
|
||||
if (priv->image) {
|
||||
pixbuf = priv->image->buf->art_pixbuf;
|
||||
|
||||
priv->width = floor (pixbuf->width * item->canvas->pixels_per_unit * priv->zoom
|
||||
+ 0.5);
|
||||
priv->height = floor (pixbuf->height * item->canvas->pixels_per_unit * priv->zoom
|
||||
+ 0.5);
|
||||
} else
|
||||
priv->width = priv->height = 0;
|
||||
|
||||
gnome_canvas_item_i2c_affine (item, i2c);
|
||||
|
||||
i.x = 0.0;
|
||||
i.y = 0.0;
|
||||
art_affine_point (&c, &i, i2c);
|
||||
|
||||
item->x1 = c.x;
|
||||
item->y1 = c.y;
|
||||
item->x2 = item->x1 + priv->width;
|
||||
item->y2 = item->y1 + priv->height;
|
||||
}
|
||||
|
||||
/* Update handler for the image item */
|
||||
static void
|
||||
image_item_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
|
||||
{
|
||||
ImageItem *ii;
|
||||
ImageItemPrivate *priv;
|
||||
|
||||
ii = IMAGE_ITEM (item);
|
||||
priv = ii->priv;
|
||||
|
||||
if (parent_class->update)
|
||||
(* parent_class->update) (item, affine, clip_path, flags);
|
||||
|
||||
if (((flags & GNOME_CANVAS_UPDATE_VISIBILITY)
|
||||
&& !(GTK_OBJECT_FLAGS (ii) & GNOME_CANVAS_ITEM_VISIBLE))
|
||||
|| (flags & GNOME_CANVAS_UPDATE_AFFINE)
|
||||
|| priv->need_image_update
|
||||
|| priv->need_zoom_update)
|
||||
gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
|
||||
|
||||
/* If we need an image update, or if the item changed visibility to
|
||||
* shown, recompute the bounding box.
|
||||
*/
|
||||
if (priv->need_image_update
|
||||
|| priv->need_zoom_update
|
||||
|| ((flags & GNOME_CANVAS_UPDATE_VISIBILITY)
|
||||
&& (GTK_OBJECT_FLAGS (ii) & GNOME_CANVAS_ITEM_VISIBLE))
|
||||
|| (flags & GNOME_CANVAS_UPDATE_AFFINE)) {
|
||||
recompute_bounding_box (ii);
|
||||
gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
|
||||
priv->need_image_update = FALSE;
|
||||
priv->need_zoom_update = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw handler for the image item */
|
||||
static void
|
||||
image_item_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
|
||||
{
|
||||
ImageItem *ii;
|
||||
ImageItemPrivate *priv;
|
||||
ArtIRect i, d, dest;
|
||||
int w, h;
|
||||
guchar *buf;
|
||||
|
||||
ii = IMAGE_ITEM (item);
|
||||
priv = ii->priv;
|
||||
|
||||
i.x0 = item->x1;
|
||||
i.y0 = item->y1;
|
||||
i.x1 = item->x2;
|
||||
i.y1 = item->y2;
|
||||
|
||||
d.x0 = x;
|
||||
d.y0 = y;
|
||||
d.x1 = x + width;
|
||||
d.y1 = y + height;
|
||||
|
||||
art_irect_intersect (&dest, &i, &d);
|
||||
|
||||
if (art_irect_empty (&dest))
|
||||
return;
|
||||
|
||||
w = dest.x1 - dest.x0;
|
||||
h = dest.y1 - dest.y0;
|
||||
|
||||
buf = g_new (guchar, w * h * 3);
|
||||
render_image (priv->image, buf,
|
||||
w, h, w * 3,
|
||||
priv->zoom * item->canvas->pixels_per_unit,
|
||||
dest.x0 - item->x1, dest.y0 - item->y1,
|
||||
priv->image->r_lut, priv->image->g_lut, priv->image->b_lut,
|
||||
DARK_CHECK, LIGHT_CHECK);
|
||||
|
||||
gdk_draw_rgb_image_dithalign (drawable, GTK_WIDGET (item->canvas)->style->black_gc,
|
||||
dest.x0 - x, dest.y0 - y,
|
||||
w, h,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
buf, w * 3,
|
||||
x, y);
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
/* Point handler for the image item */
|
||||
static double
|
||||
image_item_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
|
||||
GnomeCanvasItem **actual_item)
|
||||
{
|
||||
ImageItem *ii;
|
||||
ImageItemPrivate *priv;
|
||||
double w, h;
|
||||
double dx, dy;
|
||||
|
||||
ii = IMAGE_ITEM (item);
|
||||
priv = ii->priv;
|
||||
|
||||
*actual_item = item;
|
||||
|
||||
w = priv->width / item->canvas->pixels_per_unit;
|
||||
h = priv->height / item->canvas->pixels_per_unit;
|
||||
|
||||
if (x < 0.0)
|
||||
dx = -x;
|
||||
else if (x > w)
|
||||
dx = x - w;
|
||||
else
|
||||
dx = 0.0;
|
||||
|
||||
if (y < 0.0)
|
||||
dy = -y;
|
||||
else if (y > h)
|
||||
dy = y - h;
|
||||
else
|
||||
dy = 0.0;
|
||||
|
||||
return sqrt (dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
/* Bounds handler for the image item */
|
||||
static void
|
||||
image_item_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2)
|
||||
{
|
||||
ImageItem *ii;
|
||||
ImageItemPrivate *priv;
|
||||
|
||||
ii = IMAGE_ITEM (item);
|
||||
priv = ii->priv;
|
||||
|
||||
*x1 = 0.0;
|
||||
*y1 = 0.0;
|
||||
*x2 = priv->width / item->canvas->pixels_per_unit;
|
||||
*y2 = priv->height / item->canvas->pixels_per_unit;
|
||||
}
|
40
src/image-item.h
Normal file
40
src/image-item.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
#ifndef IMAGE_ITEM_H
|
||||
#define IMAGE_ITEM_H
|
||||
|
||||
#include <libgnome/gnome-defs.h>
|
||||
#include <libgnomeui/gnome-canvas.h>
|
||||
|
||||
BEGIN_GNOME_DECLS
|
||||
|
||||
|
||||
|
||||
#define TYPE_IMAGE_ITEM (image_item_get_type ())
|
||||
#define IMAGE_ITEM(obj) (GTK_CHECK_CAST ((obj), TYPE_IMAGE_ITEM, ImageItem))
|
||||
#define IMAGE_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_IMAGE_ITEM, ImageItemClass))
|
||||
#define IS_IMAGE_ITEM(obj) (GTK_CHECK_TYPE ((obj), TYPE_IMAGE_ITEM))
|
||||
#define IS_IMAGE_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_IMAGE_ITEM))
|
||||
|
||||
|
||||
typedef struct _ImageItem ImageItem;
|
||||
typedef struct _ImageItemClass ImageItemClass;
|
||||
|
||||
|
||||
struct _ImageItem {
|
||||
GnomeCanvasItem item;
|
||||
|
||||
/* Private data */
|
||||
gpointer priv;
|
||||
};
|
||||
|
||||
struct _ImageItemClass {
|
||||
GnomeCanvasItemClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType image_item_get_type (void);
|
||||
|
||||
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
#endif
|
18
src/image.h
Normal file
18
src/image.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef IMAGE_H
|
||||
#define IMAGE_H
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
|
||||
|
||||
/* The main image structure */
|
||||
typedef struct {
|
||||
/* Buffer with original image data */
|
||||
GdkPixBuf *buf;
|
||||
|
||||
/* Color substitution tables */
|
||||
guchar *r_lut, *g_lut, *b_lut;
|
||||
} Image;
|
||||
|
||||
|
||||
#endif
|
171
src/main.c
Normal file
171
src/main.c
Normal file
|
@ -0,0 +1,171 @@
|
|||
#include <config.h>
|
||||
#include <math.h>
|
||||
#include <gnome.h>
|
||||
#include "image.h"
|
||||
#include "image-item.h"
|
||||
#include "gtkscrollframe.h"
|
||||
|
||||
|
||||
static GnomeCanvas *canvas;
|
||||
|
||||
|
||||
static void
|
||||
realize (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window, NULL, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
zoom_changed (GtkAdjustment *adj, gpointer data)
|
||||
{
|
||||
gnome_canvas_set_pixels_per_unit (canvas, adj->value);
|
||||
}
|
||||
|
||||
static void
|
||||
sb_spacing_changed (GtkAdjustment *adj, gpointer data)
|
||||
{
|
||||
gtk_scroll_frame_set_scrollbar_spacing (GTK_SCROLL_FRAME (data), (int) adj->value);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_sb_spacing (GtkWidget *sf)
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *w;
|
||||
GtkAdjustment *adj;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
|
||||
|
||||
w = gtk_label_new ("Scrollbar spacing");
|
||||
gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
|
||||
|
||||
adj = GTK_ADJUSTMENT (gtk_adjustment_new (3.0, 0.0, 50.0, 1.0, 1.0, 1.0));
|
||||
w = gtk_spin_button_new (adj, 0.0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (sb_spacing_changed),
|
||||
sf);
|
||||
|
||||
return hbox;
|
||||
}
|
||||
|
||||
static void
|
||||
shadow_type_changed (GtkAdjustment *adj, gpointer data)
|
||||
{
|
||||
gtk_scroll_frame_set_shadow_type (GTK_SCROLL_FRAME (data), (int) adj->value);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_shadow_type (GtkWidget *sf)
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *w;
|
||||
GtkAdjustment *adj;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
|
||||
|
||||
w = gtk_label_new ("Shadow type");
|
||||
gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
|
||||
|
||||
adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 4.0, 1.0, 1.0, 1.0));
|
||||
w = gtk_spin_button_new (adj, 0.0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (shadow_type_changed),
|
||||
sf);
|
||||
|
||||
return hbox;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *sf;
|
||||
GtkWidget *w;
|
||||
GtkAdjustment *adj;
|
||||
Image *image;
|
||||
int i;
|
||||
GnomeCanvasItem *item;
|
||||
poptContext ctx;
|
||||
|
||||
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
gnome_init_with_popt_table (PACKAGE, VERSION, argc, argv,
|
||||
NULL, 0, &ctx);
|
||||
gdk_rgb_init ();
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
sf = gtk_scroll_frame_new (NULL, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), sf, TRUE, TRUE, 0);
|
||||
gtk_scroll_frame_set_policy (GTK_SCROLL_FRAME (sf),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
gtk_widget_push_visual (gdk_rgb_get_visual ());
|
||||
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
|
||||
canvas = GNOME_CANVAS (gnome_canvas_new ());
|
||||
gtk_container_add (GTK_CONTAINER (sf), GTK_WIDGET (canvas));
|
||||
gtk_widget_pop_colormap ();
|
||||
gtk_widget_pop_visual ();
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (canvas), "realize",
|
||||
GTK_SIGNAL_FUNC (realize),
|
||||
NULL);
|
||||
|
||||
image = g_new (Image, 1);
|
||||
image->buf = gdk_pixbuf_load_image (poptGetArg (ctx));
|
||||
g_assert (image->buf != NULL);
|
||||
poptFreeContext (ctx);
|
||||
|
||||
image->r_lut = g_new (guchar, 256);
|
||||
image->g_lut = g_new (guchar, 256);
|
||||
image->b_lut = g_new (guchar, 256);
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
image->r_lut[i] = i;
|
||||
image->g_lut[i] = i;
|
||||
image->b_lut[i] = i;
|
||||
}
|
||||
|
||||
item = gnome_canvas_item_new (gnome_canvas_root (canvas),
|
||||
image_item_get_type (),
|
||||
"image", image,
|
||||
"zoom", 1.0,
|
||||
NULL);
|
||||
|
||||
gnome_canvas_set_scroll_region (canvas,
|
||||
0.0,
|
||||
0.0,
|
||||
image->buf->art_pixbuf->width,
|
||||
image->buf->art_pixbuf->height);
|
||||
|
||||
adj = GTK_ADJUSTMENT (gtk_adjustment_new (1.0, 0.01, 5.0, 0.01, 0.01, 0.01));
|
||||
w = gtk_hscale_new (adj);
|
||||
gtk_scale_set_digits (GTK_SCALE (w), 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
|
||||
GTK_SIGNAL_FUNC (zoom_changed),
|
||||
item);
|
||||
|
||||
w = create_sb_spacing (sf);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
|
||||
|
||||
w = create_shadow_type (sf);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
199
src/render.c
Normal file
199
src/render.c
Normal file
|
@ -0,0 +1,199 @@
|
|||
#include <config.h>
|
||||
#include <math.h>
|
||||
#include "render.h"
|
||||
|
||||
|
||||
|
||||
/* Size of checks */
|
||||
#define CHECK_MASK (1 << 4)
|
||||
|
||||
|
||||
|
||||
/* Computes a lookup table of offsets for rendering based on the zoom factor */
|
||||
static int *
|
||||
compute_coord_lut (guint size, double zoom, guint ofs)
|
||||
{
|
||||
int *lut;
|
||||
int i;
|
||||
|
||||
lut = g_new (int, size);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
lut[i] = floor ((ofs + i + 0.5) / zoom);
|
||||
|
||||
return lut;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Renders a portion of an RGB image to a buffer */
|
||||
static void
|
||||
render_rgb (ArtPixBuf *pixbuf, guchar *dest,
|
||||
guint dest_width, guint dest_height, guint dest_rowstride,
|
||||
int *xlut, int *ylut,
|
||||
guchar *r_lut, guchar *g_lut, guchar *b_lut)
|
||||
{
|
||||
int x, y;
|
||||
guchar *src_row, *s;
|
||||
guchar *p;
|
||||
|
||||
g_assert (pixbuf->format == ART_PIX_RGB);
|
||||
g_assert (pixbuf->n_channels == 3);
|
||||
g_assert (!pixbuf->has_alpha);
|
||||
g_assert (pixbuf->bits_per_sample == 8);
|
||||
|
||||
for (y = 0; y < dest_height; y++) {
|
||||
src_row = pixbuf->pixels + ylut[y];
|
||||
p = dest + y * dest_rowstride;
|
||||
|
||||
for (x = 0; x < dest_width; x++) {
|
||||
s = src_row + xlut[x];
|
||||
|
||||
*p++ = r_lut[*s++];
|
||||
*p++ = g_lut[*s++];
|
||||
*p++ = b_lut[*s];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Renders a portion of an RGBA image to a buffer */
|
||||
static void
|
||||
render_rgba (ArtPixBuf *pixbuf, guchar *dest,
|
||||
guint dest_width, guint dest_height, guint dest_rowstride,
|
||||
guint xofs, guint yofs, int *xlut, int *ylut,
|
||||
guchar *r_lut, guchar *g_lut, guchar *b_lut,
|
||||
guchar dark_check, guchar light_check)
|
||||
{
|
||||
int x, y;
|
||||
guchar *src_row, *s;
|
||||
guchar *p;
|
||||
int dark_x, dark_y;
|
||||
int alpha;
|
||||
guchar check;
|
||||
|
||||
g_assert (pixbuf->format == ART_PIX_RGB);
|
||||
g_assert (pixbuf->n_channels == 4);
|
||||
g_assert (pixbuf->has_alpha);
|
||||
g_assert (pixbuf->bits_per_sample == 8);
|
||||
|
||||
for (y = 0; y < dest_height; y++) {
|
||||
src_row = pixbuf->pixels + ylut[y];
|
||||
p = dest + y * dest_rowstride;
|
||||
dark_y = ((y + yofs) & CHECK_MASK) != 0;
|
||||
|
||||
for (x = 0; x < dest_width; x++) {
|
||||
s = src_row + xlut[x];
|
||||
dark_x = ((x + xofs) & CHECK_MASK) != 0;
|
||||
|
||||
if (dark_x ^ dark_y)
|
||||
check = dark_check;
|
||||
else
|
||||
check = light_check;
|
||||
|
||||
alpha = s[3];
|
||||
|
||||
if (alpha == 0) {
|
||||
*p++ = check;
|
||||
*p++ = check;
|
||||
*p++ = check;
|
||||
} else if (alpha == 255) {
|
||||
*p++ = *s++;
|
||||
*p++ = *s++;
|
||||
*p++ = *s;
|
||||
} else {
|
||||
*p++ = check + (((r_lut[*s++] - check) * alpha + 0x80) >> 8);
|
||||
*p++ = check + (((g_lut[*s++] - check) * alpha + 0x80) >> 8);
|
||||
*p++ = check + (((b_lut[*s] - check) * alpha + 0x80) >> 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* render_image:
|
||||
* @image: An image.
|
||||
* @dest: Destination RGB buffer.
|
||||
* @dest_width: Width of destination.
|
||||
* @dest_height: Height of destination.
|
||||
* @dest_rowstride: Rowstride of destination.
|
||||
* @zoom: Zoom factor for rendering.
|
||||
* @xofs: Horizontal rendering offset.
|
||||
* @yofs: Vertical rendering offset.
|
||||
* @r_lut: Color lookup table for the red channel.
|
||||
* @g_lut: Color lookup table for the green channel.
|
||||
* @b_lut: Color lookup table for the blue channel.
|
||||
* @dark_check: Intensity of dark checks.
|
||||
* @light_check: Intensity of light checks.
|
||||
*
|
||||
* Renders the specified @image to the specified @dest buffer. The specified
|
||||
* offsets and dimensions must define a rectangle that fit inside the image when
|
||||
* zoomed.
|
||||
**/
|
||||
void
|
||||
render_image (Image *image, guchar *dest,
|
||||
guint dest_width, guint dest_height, guint dest_rowstride,
|
||||
double zoom, guint xofs, guint yofs,
|
||||
guchar *r_lut, guchar *g_lut, guchar *b_lut,
|
||||
guchar dark_check, guchar light_check)
|
||||
{
|
||||
ArtPixBuf *pixbuf;
|
||||
int xzoom_size, yzoom_size;
|
||||
double xzoom_adj, yzoom_adj;
|
||||
int *xlut, *ylut;
|
||||
int i;
|
||||
|
||||
pixbuf = image->buf->art_pixbuf;
|
||||
|
||||
/* Sanity checks */
|
||||
|
||||
g_return_if_fail (image != NULL);
|
||||
g_return_if_fail (pixbuf->format == ART_PIX_RGB);
|
||||
g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
|
||||
g_return_if_fail (pixbuf->bits_per_sample == 8);
|
||||
|
||||
g_return_if_fail (dest != NULL);
|
||||
g_return_if_fail (dest_width > 0);
|
||||
g_return_if_fail (dest_height > 0);
|
||||
g_return_if_fail (dest_rowstride > 0);
|
||||
g_return_if_fail (zoom > 0.0);
|
||||
|
||||
xzoom_size = floor (pixbuf->width * zoom + 0.5);
|
||||
yzoom_size = floor (pixbuf->height * zoom + 0.5);
|
||||
g_return_if_fail (xofs < xzoom_size);
|
||||
g_return_if_fail (yofs < yzoom_size);
|
||||
g_return_if_fail (xofs + dest_width <= xzoom_size);
|
||||
g_return_if_fail (yofs + dest_height <= yzoom_size);
|
||||
|
||||
g_return_if_fail (r_lut != NULL);
|
||||
g_return_if_fail (g_lut != NULL);
|
||||
g_return_if_fail (b_lut != NULL);
|
||||
|
||||
/* Build rendering coordinate LUTs */
|
||||
|
||||
xzoom_adj = (double) xzoom_size / pixbuf->width;
|
||||
xlut = compute_coord_lut (dest_width, xzoom_adj, xofs);
|
||||
for (i = 0; i < dest_width; i++)
|
||||
xlut[i] *= pixbuf->n_channels;
|
||||
|
||||
yzoom_adj = (double) yzoom_size / pixbuf->height;
|
||||
ylut = compute_coord_lut (dest_height, yzoom_adj, yofs);
|
||||
for (i = 0; i < dest_height; i++)
|
||||
ylut[i] *= pixbuf->rowstride;
|
||||
|
||||
/* Render! */
|
||||
|
||||
if (pixbuf->has_alpha)
|
||||
render_rgba (pixbuf, dest, dest_width, dest_height, dest_rowstride,
|
||||
xofs, yofs, xlut, ylut,
|
||||
r_lut, g_lut, b_lut,
|
||||
dark_check, light_check);
|
||||
else
|
||||
render_rgb (pixbuf, dest, dest_width, dest_height, dest_rowstride,
|
||||
xlut, ylut,
|
||||
r_lut, g_lut, b_lut);
|
||||
|
||||
g_free (xlut);
|
||||
g_free (ylut);
|
||||
}
|
16
src/render.h
Normal file
16
src/render.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef RENDER_H
|
||||
#define RENDER_H
|
||||
|
||||
#include "image.h"
|
||||
|
||||
|
||||
|
||||
void render_image (Image *image, guchar *dest,
|
||||
guint dest_width, guint dest_height, guint dest_rowstride,
|
||||
double zoom, guint xofs, guint yofs,
|
||||
guchar *r_lut, guchar *g_lut, guchar *b_lut,
|
||||
guchar dark_check, guchar light_check);
|
||||
|
||||
|
||||
|
||||
#endif
|
108
src/ui-image.c
Normal file
108
src/ui-image.c
Normal file
|
@ -0,0 +1,108 @@
|
|||
#include "ui-image.h"
|
||||
|
||||
|
||||
static void ui_image_class_init (UIImageClass *class);
|
||||
static void ui_image_init (UIImage *ui);
|
||||
static void ui_image_destroy (GtkObject *object);
|
||||
|
||||
static GtkTableClass *parent_class;
|
||||
|
||||
/**
|
||||
* ui_image_get_type:
|
||||
* @void:
|
||||
*
|
||||
* Registers the &UIImage class if necessary, and returns the type ID associated
|
||||
* to it.
|
||||
*
|
||||
* Return value: the type ID of the &UIImage class.
|
||||
**/
|
||||
GtkType
|
||||
ui_image_get_type (void)
|
||||
{
|
||||
static GtkType ui_image_type = 0;
|
||||
|
||||
if (!ui_image_type) {
|
||||
static const ui_image_info = {
|
||||
"UIImage",
|
||||
sizeof (UIImage),
|
||||
sizeof (UIImageClass),
|
||||
(GtkClassInitFunc) ui_image_class_init,
|
||||
(GtkObjectInitfunc) ui_image_init,
|
||||
NULL, /* reserved_1 */
|
||||
NULL, /* reserved_2 */
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
ui_image_type = gtk_type_unique (gtk_table_get_type (), &ui_image_info);
|
||||
}
|
||||
|
||||
return ui_image_type;
|
||||
}
|
||||
|
||||
/* Class initialization function for an image's user interface */
|
||||
static void
|
||||
ui_image_class_init (UIImageClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_table_get_type ());
|
||||
|
||||
object_class->destroy = ui_image_destroy;
|
||||
}
|
||||
|
||||
/* Object initialization function for an image's user interface */
|
||||
static void
|
||||
ui_image_init (UIImage *ui)
|
||||
{
|
||||
GtkTable *table;
|
||||
|
||||
table = GTK_TABLE (ui);
|
||||
gtk_table_resize (table, 2, 2);
|
||||
|
||||
/* Create the image area */
|
||||
ui->view = view_new ();
|
||||
gtk_table_attach (table, ui->view,
|
||||
0, 1, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
|
||||
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
|
||||
0, 0);
|
||||
gtk_widget_show (ui->view);
|
||||
|
||||
/* Create the adjustments and scrollbars */
|
||||
|
||||
ui->vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
||||
ui->hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
||||
|
||||
ui->vsb = gtk_vscrollbar_new (ui->vadj);
|
||||
ui->hsb = gtk_hscrollbar_new (ui->hadj);
|
||||
|
||||
gtk_table_attach (table, ui->vsb,
|
||||
1, 2, 0, 1,
|
||||
0,
|
||||
GTK_EXPAND | GTK_FILL,
|
||||
0, 0);
|
||||
gtk_table_attach (table, ui->hsb,
|
||||
0, 1, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL,
|
||||
0,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
/* Destroy handler for an image's user interface */
|
||||
static void
|
||||
ui_image_destroy (GtkObject *object)
|
||||
{
|
||||
UIImage *ui;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (IS_WINDOW (object));
|
||||
|
||||
ui = UI_IMAGE (object);
|
||||
|
||||
/* FIXME */
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
50
src/ui-image.h
Normal file
50
src/ui-image.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
#ifndef UI_IMAGE_H
|
||||
#define UI_IMAGE_H
|
||||
|
||||
#include <libgnome/gnome-defs.h>
|
||||
#include <gtk/gtktable.h>
|
||||
#include "image.h"
|
||||
|
||||
BEGIN_GNOME_DECLS
|
||||
|
||||
|
||||
#define TYPE_UI_IMAGE (ui_image_get_type ())
|
||||
#define UI_IMAGE(obj) (GTK_CHECK_CAST (obj), TYPE_UI_IMAGE, UIImage)
|
||||
#define UI_IMAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_UI_IMAGE, UIImageClass))
|
||||
#define IS_UI_IMAGE(obj) (GTK_CHECK_TYPE ((obj), TYPE_UI_IMAGE))
|
||||
#define IS_UI_IMAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_UI_IMAGE))
|
||||
|
||||
typedef struct _UIImage UIImage;
|
||||
typedef struct _UIImageClass UIImageClass;
|
||||
|
||||
struct _UIImage {
|
||||
GtkTable table;
|
||||
|
||||
/* Image we are displaying */
|
||||
Image *image;
|
||||
|
||||
/* Image view area */
|
||||
GtkWidget *view;
|
||||
|
||||
/* Vertical and horizontal adjustments */
|
||||
GtkAdjustment *vadj;
|
||||
GtkAdjustment *hadj;
|
||||
|
||||
/* Vertical and horizontal scrollbars */
|
||||
GtkWidget *vsb;
|
||||
GtkWidget *hsb;
|
||||
};
|
||||
|
||||
struct _UIImageClass {
|
||||
GtkTableClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType ui_image_get_type (void);
|
||||
UIImage *ui_image_new (void);
|
||||
void ui_image_set_image (UIImage *ui, Image *image);
|
||||
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
#endif
|
211
src/window.c
Normal file
211
src/window.c
Normal file
|
@ -0,0 +1,211 @@
|
|||
#include <config.h>
|
||||
#include <gnome.h>
|
||||
#include "window.h"
|
||||
|
||||
|
||||
|
||||
/* What a window is displaying */
|
||||
typedef enum {
|
||||
WINDOW_MODE_NONE,
|
||||
WINDOW_MODE_IMAGE,
|
||||
WINDOW_MODE_COLLECTION
|
||||
} WindowMode;
|
||||
|
||||
/* Private part of the Window structure */
|
||||
typedef struct {
|
||||
/* What we are displaying */
|
||||
WindowMode mode;
|
||||
|
||||
/* Our contents, which may change depending on the mode */
|
||||
GtkWidget *content;
|
||||
} WindowPrivate;
|
||||
|
||||
|
||||
|
||||
static void window_class_init (WindowClass *class);
|
||||
static void window_init (Window *window);
|
||||
static void window_destroy (GtkObject *object);
|
||||
|
||||
static gint window_delete (GtkWidget *widget, GdkEventAny *event);
|
||||
|
||||
|
||||
static GnomeAppClass *parent_class;
|
||||
|
||||
|
||||
|
||||
/* Menu callbacks */
|
||||
|
||||
/* File/Open callback */
|
||||
static void
|
||||
open_cmd (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
/* FIXME */
|
||||
}
|
||||
|
||||
/* File/Close callback */
|
||||
static void
|
||||
close_cmd (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
/* FIXME */
|
||||
}
|
||||
|
||||
/* File/Exit callback */
|
||||
static void
|
||||
exit_cmd (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
/* FIXME */
|
||||
}
|
||||
|
||||
static void
|
||||
meept (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
fprintf (stderr, "meept!\n");
|
||||
}
|
||||
|
||||
/* Help/About callback */
|
||||
static void
|
||||
about_cmd (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
static GtkWidget *about;
|
||||
static const char *authors[] = {
|
||||
"Federico Mena-Quintero (federico@gimp.org)",
|
||||
NULL
|
||||
};
|
||||
|
||||
if (!about) {
|
||||
about = gnome_about_new (_("Retina"),
|
||||
VERSION,
|
||||
_("Copyright (C) 1999 The Free Software Foundation"),
|
||||
authors,
|
||||
_("The GNOME image viewer and cataloging program"),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (about), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&about);
|
||||
gtk_signal_connect (GTK_OBJECT (about), "destroy",
|
||||
GTK_SIGNAL_FUNC (meept),
|
||||
&about);
|
||||
}
|
||||
|
||||
gtk_widget_show (about);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Main menu */
|
||||
|
||||
static GnomeUIInfo file_menu[] = {
|
||||
GNOMEUIINFO_ITEM_STOCK (N_("_Open Image..."),
|
||||
N_("Open an image file"),
|
||||
open_cmd, GNOME_STOCK_MENU_OPEN),
|
||||
GNOMEUIINFO_SEPARATOR,
|
||||
GNOMEUIINFO_MENU_CLOSE_ITEM (close_cmd, NULL),
|
||||
GNOMEUIINFO_MENU_EXIT_ITEM (exit_cmd, NULL),
|
||||
GNOMEUIINFO_END
|
||||
};
|
||||
|
||||
static GnomeUIInfo help_menu[] = {
|
||||
GNOMEUIINFO_MENU_ABOUT_ITEM (about_cmd, NULL),
|
||||
GNOMEUIINFO_END
|
||||
};
|
||||
|
||||
static GnomeUIInfo main_menu[] = {
|
||||
GNOMEUIINFO_MENU_FILE_TREE (file_menu),
|
||||
GNOMEUIINFO_MENU_HELP_TREE (help_menu),
|
||||
GNOMEUIINFO_END
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* window_get_type:
|
||||
* @void:
|
||||
*
|
||||
* Registers the &Window class if necessary, and returns the type ID associated
|
||||
* to it.
|
||||
*
|
||||
* Return value: the type ID of the &Window class.
|
||||
**/
|
||||
GtkType
|
||||
window_get_type (void)
|
||||
{
|
||||
static GtkType window_type = 0;
|
||||
|
||||
if (!window_type) {
|
||||
static const GtkTypeInfo window_info = {
|
||||
"Window",
|
||||
sizeof (Window),
|
||||
sizeof (WindowClass),
|
||||
(GtkClassInitFunc) window_class_init,
|
||||
(GtkObjectInitFunc) window_init,
|
||||
NULL, /* reserved_1 */
|
||||
NULL, /* reserved_2 */
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
window_type = gtk_type_unique (gnome_app_get_type (), &window_info);
|
||||
}
|
||||
|
||||
return window_type;
|
||||
}
|
||||
|
||||
/* Class initialization function for windows */
|
||||
static void
|
||||
window_class_init (WindowClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
object_class = (GtkObjectClass *) class;
|
||||
widget_class = (GtkWidgetClass *) class;
|
||||
|
||||
parent_class = gtk_type_class (gnome_app_get_type ());
|
||||
|
||||
object_class->destroy = window_destroy;
|
||||
|
||||
widget_class->delete_event = window_delete;
|
||||
}
|
||||
|
||||
/* Object initialization function for windows */
|
||||
static void
|
||||
window_init (Window *window)
|
||||
{
|
||||
WindowPrivate *priv;
|
||||
|
||||
priv = g_new0 (WindowPrivate, 1);
|
||||
window->priv = priv;
|
||||
#if 0
|
||||
gnome_app_create_menus_with_data (
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Destroy handler for windows */
|
||||
static void
|
||||
window_destroy (GtkObject *object)
|
||||
{
|
||||
Window *window;
|
||||
WindowPrivate *priv;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (IS_WINDOW (object));
|
||||
|
||||
window = WINDOW (object);
|
||||
priv = window->priv;
|
||||
|
||||
/* FIXME: destroy the rest */
|
||||
|
||||
g_free (priv);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||
}
|
||||
|
||||
/* delete_event handler for windows. We prompt the user if he has an unsaved
|
||||
* image collection and exit the program if this was the last open window.
|
||||
*/
|
||||
static gint
|
||||
window_delete (GtkWidget *widget, GdkEventAny *event)
|
||||
{
|
||||
/* FIXME */
|
||||
return FALSE;
|
||||
}
|
40
src/window.h
Normal file
40
src/window.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
#ifndef WINDOW_H
|
||||
#define WINDOW_H
|
||||
|
||||
#include <libgnome/gnome-defs.h>
|
||||
#include <libgnomeui/gnome-app.h>
|
||||
|
||||
BEGIN_GNOME_DECLS
|
||||
|
||||
|
||||
|
||||
#define TYPE_WINDOW (window_get_type ())
|
||||
#define WINDOW(obj) (GTK_CHECK_CAST ((obj), TYPE_WINDOW, Window))
|
||||
#define WINDOW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_WINDOW, WindowClass))
|
||||
#define IS_WINDOW(obj) (GTK_CHECK_TYPE ((obj), TYPE_WINDOW))
|
||||
#define IS_WINDOW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_WINDOW))
|
||||
|
||||
|
||||
typedef struct _Window Window;
|
||||
typedef struct _WindowClass WindowClass;
|
||||
|
||||
|
||||
struct _Window {
|
||||
GnomeApp app;
|
||||
|
||||
/* Private data */
|
||||
gpointer priv;
|
||||
};
|
||||
|
||||
struct _WindowClass {
|
||||
GnomeAppClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType window_get_type (void);
|
||||
|
||||
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue