unpack zips in src to better compression

This commit is contained in:
2022-10-20 13:28:49 +02:00
parent e25403bd5f
commit 87eb27f562
447 changed files with 55306 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
CC = m68k-atari-mint-gcc
CXX = m68k-atari-mint-g++
AR = m68k-atari-mint-ar
RANLIB = m68k-atari-mint-ranlib
STACK = m68k-atari-mint-stack
STRIP = m68k-atari-mint-strip -s
FLAGS = m68k-atari-mint-flags -r
DEBUG = # -DDEBUG
COMPRESS = upx -9
STACKSIZE = 512k
OPTIMISATION = -g -O2 -fomit-frame-pointer
#CPU = -mcpu=5475
CPU = -m68020-60
DEBUG_LIB = # -lwout
XPDF_LIBS = -Lpdf/fofi -lfofi -Lpdf/goo -lGoo -Lpdf/splash -lsplash
XPDF_INCS = -Ipdf -Ipdf/goo -Ipdf/splash
LIB = -lfreetype $(DEBUG_LIB) -lwindom1 -lldgclient -lgem -lz
CFLAGS = $(DEBUG) $(CPU) $(OPTIMISATION) $(XPDF_INCS) -Wall -Wshadow -Wno-pointer-sign
CXXFLAGS = $(CFLAGS)
FILE_OBJ = file/sort.o file/file.o file/delete.o file/rename.o file/count.o
EDIT_OBJ = zedit/char.o zedit/edit.o zedit/zedit.o
VDI_OBJ = zvdi/p2c.o zvdi/color.o zvdi/dither.o zvdi/raster.o zvdi/raster_resize.o zvdi/pixel.o zvdi/vdi.o
CATALOG_OBJ = catalog/catalog_slider.o catalog/catalog_size.o catalog/catalog_other_event.o \
catalog/catalog_keyb.o catalog/catalog_mouse.o catalog/catalog_iconify.o \
catalog/catalog_icons.o catalog/catalog_entry.o catalog/catalog_mini_entry.o \
catalog/catalog_popup.o catalog/catalog.o
PDF_OBJ = pdf/xpdf/Annot.o pdf/xpdf/Array.o pdf/xpdf/BuiltinFont.o pdf/xpdf/BuiltinFontTables.o \
pdf/xpdf/Catalog.o pdf/xpdf/CharCodeToUnicode.o pdf/xpdf/CMap.o pdf/xpdf/Decrypt.o pdf/xpdf/Dict.o pdf/xpdf/Error.o \
pdf/xpdf/FontEncodingTables.o pdf/xpdf/Function.o pdf/xpdf/Gfx.o pdf/xpdf/GfxFont.o pdf/xpdf/GfxState.o \
pdf/xpdf/GlobalParams.o pdf/xpdf/JArithmeticDecoder.o pdf/xpdf/JBIG2Stream.o pdf/xpdf/JPXStream.o \
pdf/xpdf/Lexer.o pdf/xpdf/Link.o pdf/xpdf/NameToCharCode.o pdf/xpdf/Object.o pdf/xpdf/Outline.o pdf/xpdf/OutputDev.o \
pdf/xpdf/Page.o pdf/xpdf/Parser.o pdf/xpdf/SecurityHandler.o pdf/xpdf/PDFDoc.o pdf/xpdf/PDFDocEncoding.o pdf/xpdf/PSTokenizer.o \
pdf/xpdf/SplashOutputDev.o pdf/xpdf/Stream.o pdf/xpdf/TextOutputDev.o pdf/xpdf/UnicodeMap.o \
pdf/xpdf/UnicodeTypeTable.o pdf/xpdf/XRef.o pdf/pdflib.o pdf/xpdf/OptionalContent.o
OBJ = $(PDF_OBJ) $(CATALOG_OBJ) $(FILE_OBJ) $(EDIT_OBJ) $(VDI_OBJ) \
custom_font.o infobox.o pref_dialog.o zaes.o wintimer.o av_prot.o chrono.o plugins.o mfdb.o \
txt_data.o pdf_load.o pic_load.o pic_save.o pic_resize.o resample.o save_dialog.o menu.o prefs.o full_scr.o winpdf.o winimg.o \
debug.o progress.o ztext.o close_modal.o jpg_dialog.o tiff_dialog.o main.o
PROGRAM = zview.app
all: pdf $(PROGRAM) stack strip compress
$(PROGRAM): $(OBJ)
$(CXX) $(CPU) $(OPTIMISATION) -o $@ $(OBJ) $(XPDF_LIBS) $(LIB)
XPDF_VERSION = 3.03
xpdf-${XPDF_VERSION}.tar.gz:
wget ftp://ftp.foolabs.com/pub/xpdf/xpdf-${XPDF_VERSION}.tar.gz
pdf: xpdf-${XPDF_VERSION}.tar.gz
tar xzf xpdf-${XPDF_VERSION}.tar.gz && mv xpdf-${XPDF_VERSION} pdf && \
cd $@ && \
cat ../howto_build/xpdf-${XPDF_VERSION}-zview.patch | patch -p1 && \
CFLAGS='-O2 -fomit-frame-pointer $(CPU)' CXXFLAGS='-O2 -fomit-frame-pointer $(CPU)' ./configure --with-freetype2-includes=$$HOME/gnu-tools/m68k-atari-mint/include/freetype2 --without-x --host=m68k-atari-mint && \
make && \
cd .. && touch $@
strip:
$(STRIP) $(PROGRAM)
stack:
$(STACK) -S $(STACKSIZE) $(PROGRAM)
compress:
$(COMPRESS) $(PROGRAM)
$(FLAGS) $(PROGRAM)
clean_zview:
rm -f *~ *.o *.app zvdi/*.o zedit/*.o file/*.o catalog/*.o
clean_pdf:
make -C pdf clean && rm pdf/*.o
clean:
rm -f *~ *.o *.app zvdi/*.o zedit/*.o file/*.o catalog/*.o

View File

@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. 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
them 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 prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. 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.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey 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;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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 that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
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.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
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.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
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
state 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 3 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, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program 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, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU 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 Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -0,0 +1,272 @@
XX November 2011: 1.0
=====================
News:
-----
Bug fixes:
----------
- Umlauts in PDF catalog
- Crash in IMG plugin
- A hidden memory bug, no visible effects (it seems) but better have it
fixed :)
- Long standing bugs in DSP/NF JPEG decoder fixed (no crash anymore with MP
plus the file is correctly written)
- "Show hidden files" works also with Unix hidden files (prefixed with a dot)
- Regardless of "Show common files" option, folder icons are always shown
- PDF files are treated as images (i.e. always shown)
Known bugs:
-----------
- NONE! :)
01 November 2011: BETA8
=======================
News:
-----
- First release after 6 years, Zorro seems to be away from the Atari platform :(
- Recompilation of zView + all codecs against latest libraries with the latest
gcc (everything for 68020-60), in theory you should get better compatibility,
less crashes and higher speed :)
- mem.ldg is no longer needed, it has no real meaning for zView
- The application is FireBee-ready, I've done some test builds for ACP guys and
it did run!
- updated nfjpeg.prg and jpegd.prg (maybe it helps, maybe not :))
Bugs fixes:
-----------
- Two or three crashes under FreeMiNT, bugs in LDG and Windom libraries
Know bug:
---------
- On aranym, with the DSP cookie installed, some stranges problems append
when we write a JPG (and there's a crash win memory protection)
25 December 2005: BETA7a
========================
- A version of zview compatible with MagiC OS is provided in the "MagiC"
folder.
24 December 2005: BETA7
=======================
News:
-----
- PDF:
* Huge quality improvement in the PDF font rendering (Atari specific).
* Zoom function added.
* Code upgraded to xpdf 3.01pl1( 2005-dec-01).
- Complete EXIF 2.21 support for JPEG image( now, you can see various
usefull informations like when the picture was taken, if the flash of your
camera was fired or not, the model of your cam, etc...).
- Now, zView can extract the thumbnails embedded inside JPEG images created
with a digital photo-cam.
That means than the thumbnail creation is 20 times faster if the JPEG was
created with a camera.
- News options added:
* Skip drive( it's faster to skip the check of the CD-ROM drive for
example).
* Smooth Thumbnail: now, you can smooth the thumbnails with various
method.
That is very slow and only available on true color or near true color
display but the result are perfect( specialy with the lanczos
computation).
* PDF font antialiasing ON/OFF.
* Fit the PDF to the window.
- Utilisation of an embedded font to have the same look on any computers.
- Animated interlaced Gif and animated Gif with transparency now supported.
- More zoom levels for the pictures( 25, 50, 100, 150 and 200%, previoulsy:
50, 100, and 200%).
- Some function's shortcuts added to the toolbars.
Bugs fixes:
-----------
- Many fixes in the PDF code( PDF rotated, problems with some fonts, etc..).
- Missing horizontal SLIDER computation in the PDF and image window.
- Little memory leak corrected in the multi-timer function.
- A memory block was not freed in the file_rename function.
- Some redraw fixed ( PDF bookmark, etc...).
- Others littles bugs fixed.
Know bug:
---------
- On aranym, with the DSP cookie installed, some stranges problems append
when we write a JPG.
5 August 2005: BETA6
====================
News:
-----
- For compatibility with the PDF code, zview is now under GPL licence.
- Animation support added.
The first format benefitting of that is the animated GIF( SPACE key for
pause/resume).
- PDF read support( You will need a lot of memory to read a PDF).
- Reservoir Dogs Godpaint write and read support.
- Zoom available with the window's toolbar or the '+' and '-' keys.
- Documentation and desktop icon added by Sacha Uhlig, many thanks to him !
- French translation by Cyril Lefebvre, thanks to him !
- Now, we can save from an interlaced picture.
- The scrolling in the picture's window and the redraw function are a
little bit faster.
- Custom font added for the Exif Panel to see more lines.
- 'VDI-Enhancer' from the Behne Bros provided in the "goodies" folder.
Install it if you use the standard Atari VDI without NVDI/fVDI/etc..
- Others littles changes like Control+U to close the window instead of
Control+W ( standard), menubar desactivation when we load a picture,
'out of memory' warning in full screen code, etc...
Bugs fixes:
-----------
- Remove unecessary redraws of the menu bar when we scroll the window and
in the browser window when this one is opened.
- Now, when you enter in a directory and you go back again, the old
directory remains selected. the code was there but it was wrong.
- Static MDFB struct. were freed in 'winimg' and full screen code !
- The 1 plane pictures and icon were not correctly drawn in fullscreen mode
and in the browser's toolbar.
- The progress bar was one pixel too wide and high.
- Problem with 1 bits degas picture corrected.
- Now, the background in full screen mode is always black.
- In the Gif codec, a crash occured if the picture's text data was greater
that 255 lines.
- Uncorrect translation in the GUI ( octets -> bytes, etc...).
Know bug:
---------
- On aranym, with the DSP cookie installed, some stranges problems append
when we write a JPG.
- Various animated GIF are badly rendered.
- With some rare PDF, the fonts are outlined.
- The decoding of PDF with big pictures inside is very slow ( not really a
bug but this code must be rewrote).
20 february 2005: BETA5
=======================
News:
-----
- 68000, 68020 without FPU and 68020-60 version of the codecs and binaries
available.
- Full screen mode with automatic picture resize if this one is bigger that
the screen. ( F10 shortcut)
- Another cool feature: when a window is iconified, zview show a thumbnail
of the picture inside.
- With the last Aranym from CVS, the JPG pictures are decoded natively with
the host CPU !! ( to use this feature, "nfjpeg.prg" in your 'auto' folder
before MiNT). Many thanks to Patrice Mandin for his work on Aranym !
- The DSP and the main JPG codecs are now merged in only one codec.
If the brainstorm's cookie is detected and you haven't a 68060, the JPG is
decoded with the DSP, else the CPU routine is used.
- Support of DEGAS compressed added ( PC1,PC2,PC3).
- Others littles changes like recompilation of all the codecs with the last
GCC, the possibility to move the about box with Xaaes, informations about
the licence, etc...
Bugs fixes:
-----------
- Many problems on others OS that MiNT are corrected, for exemple, the
plugins were not loaded if this ones were in the global folder
( aka "LDGPATH/codecs") under TOS and MagiC, etc etc...
- Problems with some degas images fixed.
- With the DSP, JPG pictures not multiple of 16 were badly decoded.
- In planes < 8 bits, the toolbar's icons was not shown.
- VDI's EDDI check at the start.
- Zview saves the browser's coordinates when we quit the application.
Now, this coordinates are not saved if this window is iconified ( for
prevent bad browser coordinate on next relaunch).
- Others littles bugs fixes like with the menu bar handling, error messages
not correct, etc etc...
23 december 2004: BETA4
=======================
News:
-----
- The plugins are now in "codecs" directory, this one must be installed in
"c:/gemsys/ldg/codecs" because some applications will use it.
- Read & Write codecs for TIFF added. ( almost all variants supported !!!)
- Read codecs for FAX added.
- Read codecs for Eureka RAW data added.
- Degas codecs read also Degas Elite uncompressed image now
( Thanks for the documentation Adam!).
- The encoder and decoder are now in the same plugin.
- Navigator frame scrolling optimised.
- Some internal change in picture to screen convertion.
Bugs fixes:
-----------
- Extra check for reverse pixel byte added to support 15, 16, 24 and 32 bits
mode of some weired Hades VDI driver ( for Falcon NOVA card also).
- Picture with 4 characters extention ( like "*.jpeg" or "*.tiff") are now
handled correctly.
25 november 2004: BETA3
=======================
News:
-----
- zView goes to LGPL.
- TGA read plugin added( 15, 16, 24, 32 bits normal and compressed).
- BMP read plugin added( 1, 4, 8, 24 bits non compressed).
- JPG read plugin with DSP added. ( move JPG.LDG from '/dsp'
to '/plugin/decoder' and install jpgd.prg in your auto folder).
- Option panel for the jpg encoder added... with this one, you can
set the image quality wanted, progressive and grayscale mode.
- The image viewer provides now a Info bar with basic information like
resolution, color bits and image type.
- Add delete function in the menu bar.
- MEM.LDG from dominique Bereziat is now used for memory allocation
( more safe for MagiC system).
- The dithering routine is now better for 8 and 4 bits resolution.
- Handle of multi-pages Image format; first step for the fax and PDF
reading.
- Menu "history" activated.
- the "jpe" image are now decoded with the JPG plugin.
Bugs fixes:
-----------
- Some XGEM picture from old french application with non standard data caused
a crash under MagiC.. Now the line buffer is greater to avoid overflow.
- Bugs fixe in the alpha code in PNG plugin.
- The numpad key was not usable for rename a file.
- redraw issue when the slider was used and a part of the window was outside
the screen area.
- The information dialog returned 0 colors for 24 bits img picture.
- Little bug fixe in rename function.
- When you renamed a folder, the change was not done in the tree browser.
- The use of a specific MiNT function ( Fxattr) made that the neochrome and
degas picture wasn't displayed under plain TOS.
- Fixe a little problem of allignement of the text in catalog tree when we
change the font.
- Fixe a bug that occurs when we deleted a folder in a "very depth" folder...
It was not deleted in the tree catalog.
- Fixe a bug in the infobox, the '/0' null character was not put when the
picture comes from fileselector, shame on me.
28 october 2004: BETA2
======================
- First public release.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,20 @@
VDI-Enhancer V1.00
==================
VDI-Enhancer extends the ATARI VDI with new VDI functions for managing
off-screen bitmaps and with the function vq_scrninfo().
In addition it replaces on Falcons in High-color mode (or True- color as
it is called by ATARI :-) the non-working function v_get_pixel().
Installation:
=============
To install Enhancer, you have to copy it into your AUTO folder. If you
use SPDOGDOS, Enhancer must be physically after SPDOGDOS.
Note:
=====
Enhancer shouldn't be used with NVDI because the provided functions
already exists in NVDI 2.5 and older NVDI versions do not support
monochrome bitmaps when working with color modes.

View File

@@ -0,0 +1,89 @@
VDI-Enhancer V1.00
==================
Der Enhancer erweitert das ATARI-VDI um die neuen VDI-Funktionen zur
Verwaltung von Off-Screen-Bitmaps und um die Funktion vq_scrninfo().
Au<41>erdem hat der Enhancer den angenehmen Effekt, die auf Falcons im
High-Color-Modus (bzw. True-Color, wie ATARI es zu nennen pflegt :-),
nicht funktionierende Funktion v_get_pixel() zu ersetzen.
Installation:
=============
Um den Enhancer zu installieren, m<>ssen Sie ihn nur in den AUTO-Ordner
kopieren. Er mu<6D>, falls SPDOGDOS vorhanden ist, im AUTO-Ordner
physikalisch dahinter liegen.
Hinweise:
=========
Der Enhancer sollte nicht mit NVDI zusammen benutzt werden, da die von
ihm bereitgestellten Funktionen in NVDI 2.5 schon existieren und in
<20>lteren NVDI-Versionen keine monochromen Bitmaps im Farbbetrieb
unterst<73>tzt werden.
Beschreibung:
=============
Der VDI-Enhancer erweitert in der jetzigen Form das ATARI-VDI oder dazu
kompatible Bildschirmtreiber um die Funktionen v_opnbm() (OPEN BITMAP)
und v_clsbm() (CLOSE BITMAP) zum Verwalten und Bearbeiten von
Off-Screen-Bitmaps.
Mittels dieser beiden Funktionen ist es m<>glich, Off-Screen-Bitmaps im
ger<65>teabh<62>ngigen Format mit der Farbtiefe der jeweiligen Aufl<66>sung und
beliebiger Breite und H<>he zu bearbeiten. Dadurch kann man VDI-Ausgaben
auf einem Hintergrundschirm vornehmen und anschlie<69>end dessen Inhalt
ohne Benutzung von vr_trnfm() auf den sichtbaren Bildschirm kopieren.
Bei einigen Anwendungen f<>r Off-Screen-Bitmaps ist Farbe nicht
notwendig, bzw. verbraucht unn<6E>tig viel Speicher. Daher kann man auch in
Farbaufl<66>sungen mit v_opnbm() monochrome Bitmaps anlegen.
Au<41>erdem bietet der Enhancer durch die Funktion vq_scrninfo()
Informationen <20>ber das ger<65>teabh<62>ngige Bildschirmformat. Diese Funktion
d<>rfte f<>r alle, die z.B. Farbbilder sichern, hilfreich sein.
Cookies und XBRA-Kennung:
=========================
Der Enhancer installiert ebenso wie NVDI einen Cookie mit der Kennung
'EdDI'. Das auf diese Kennung folgende Langwort ist die Adresse eines
Funktionsdispatchers, der mit der Funktionsnummer in Register d0
aufgerufen wird. Der Aufruf erfolgt nach den Pure C-Konventionen
(Register d0-d2/a0-a1 und der Stack werden zur Parameter<65>bergabe
benutzt).
Bisher existiert nur die Funktion 0, die als Funktionsresultat eine
Versionsnummer zur<75>ckliefert, anhand er man auf die unterst<73>tzten
Funktionen schlie<69>en kann.
Ab Version 1.00 ($100 wird zur<75>ckgeliefert) sind die Funktionen
v_opnbm(), v_clsbm() und vq_scrninfo() vorhanden.
Weitergabe des Enhancers und Copyright:
=======================================
Die Weitergabe des VDI-Enhancers ist unter der Bedingung, da<64> dieser
Text zusammen mit der Enhancer-Dokumentation mitgegeben wird,
grunds<64>tzlich erlaubt. Der Vertrieb des Enhancers im Zusammenhang mit
anderen Software-Produkten ist erlaubt, sofern dem Kunden dadurch keine
zus<75>tzlichen Kosten entstehen und der empfohlene Verkaufspreis dieser
Software 50 DM nicht <20>bersteigt.
Auch dabei mu<6D> dieser Text mitgeliefert werden. Der Verkauf des
VDI-Enhancers ist verboten. Er darf in PD-Sammlungen nur angeboten
werden, wenn der Diskettenpreis unter 10 DM pro Diskette liegt.
Ein Vertrieb <20>ber CHANNEL VIDEODAT oder <20>hnliche kommerzielle Systeme
ist untersagt.
** Ausnahmen bed<65>rfen einer schriftlichen Genehmigung der Autoren! **
Das Copyright verbleibt allein bei den Autoren, Sven & Wilfried Behne
E-Mail: Wilfried Behne @H
Fehlermeldungen und Verbesserungsvorschl<68>ge k<>nnen an diese Adresse
geschickt werden.
Ausschlu<EFBFBD> der Haftung:
======================
Die Haftung f<>r unmittelbare und mittelbare Sch<63>den, Folgesch<63>den und
Drittsch<63>den durch die Benutzung des VDI-Enhancers ist ausgeschlossen.

View File

@@ -0,0 +1,359 @@
Neue Funktionen in NVDI 2.50
============================
Nachfolgend werden in dieser Datei die neuen Funktionen aufgef<65>hrt, die
NVDI f<>r Bildschirmausgaben anbietet.
1. Off-Screen Bitmaps
=====================
F<>r viele Anwendungen ist es sehr n<>tzlich, wenn Zeichenfunktionen nicht
direkt auf den Bildschirm, sondern auf einen nicht sichtbaren Bildschirm
angewendet werden k<>nnen. Einen derartigen "versteckten" Bildschirm
nennt man Off-Screen-Bitmap.
Zur Erzeugung von Off-Screen-Bitmaps dient die Funktion OPEN BITMAP.
Man kann ihr entweder die Gr<47><72>e eines Bitmap angeben, die Sie allozieren
soll, oder ihr eine Bitmap <20>bergeben. Die Bitmap wird im gleichen Format
wie die des Bildschirms verwaltet, wodurch schnelles Kopieren zwischen
beiden m<>glich ist.
Die Funktion CLOSE BITMAP schlie<69>t eine mit OPEN BITMAP erzeugte Bitmap
und gibt gegebenenfalls deren Speicher zur<75>ck.
OPEN BITMAP (VDI 100, 1)
void v_opnbm( WORD *work_in, MFDB *bitmap, WORD *handle, WORD *work_out )
{
pb[1] = work_in;
pb[3] = work_out;
pb[4] = work_out + 45;
contrl[0] = 100;
contrl[1] = 0;
contrl[3] = 20;
contrl[5] = 1;
*(MFDB *)&contrl[7] = bitmap;
vdi();
*handle = contrl[6];
pb[1] = intin;
pb[3] = intout;
pb[4] = ptsout;
}
Best<73>ckung der VDI-Arrays:
Feldelement | Belegung
------------------|-------------------------------------------
contrl[0] | 100 Funktionsnummer f<>r v_opnbm()
contrl[1] | 0 Anzahl der Eintr<74>ge in ptsin
contrl[2] | 6 Anzahl der Eintr<74>ge in ptsout
contrl[3] | 20 Anzahl der Eintr<74>ge in intin
contrl[4] | 45 Anzahl der Eintr<74>ge in intout
contrl[5] | 1 Unterfunktionsnummer f<>r v_opnbm()
contrl[6] | handle
contrl[7..8] | bitmap Zeiger auf einen MFDB der Bitmap
|
intin[0..19] | work_in[0..19]
|
intout[0..44] | work_out[0..44]
|
ptsout[0..11] | work_out[45..56]
handle: graf_handle()
work_in[0..10]: wie bei v_opnwk()/v_opnvwk() definiert
work_in[0]: Getrez() + 2
work_in[11]: Breite -1 (z.B. 1279)
work_in[12]: H<>he -1 (z.B. 959)
work_in[13]: Breite eines Pixels in Mikrometern
work_in[14]: H<>he eines Pixels in Mikrometern
work_in[15..19]: reserviert, sollte 0 enthalten
Achtung: Der Eintrag work_in[11] sollte bei Addition von 1 ohne Rest
durch 16 teilbar sein. Andernfalls rundet der VDI-Treiber
auf den n<>chsth<74>heren ohne Rest teilbaren Wert.
Hinweis: Wird f<>r Pixelbreite und -H<>he 0 angegeben, so werden die
Werte des Bildschirms benutzt.
work_out[0..1]: wie bei v_opnwk()/v_opnvwk() definiert
work_out[2]: 0
work_out[3..38]: wie bei v_opnwk()/v_opnvwk() definiert
work_out[39] 0 (keine Hardware-Palette vorhanden, da Bitmap)
work_out[39..56]: wie beiv_opnwk()/v_opnvwk() definiert
bitmap: Zeiger auf einen MFDB
Falls bitmap->fd_addr gleich NULL ist, so wird anhand der Gr<47><72>en-
angaben in work_in Speicher f<>r die Bitmap angefordert (die Bitmap
wird im Gegensatz zu v_opnvwk() gel<65>scht).
Um eine Bitmap im ger<65>tespezifischen Format zu <20>ffnen, mu<6D>
bitmap->fd_nplanes eine Null oder die Ebenenanzahl des Schirms
enthalten (work_out[4] bei vq_extnd()). Ist bitmap->fd_nplanes 1,
wird eine monochrome Bitmap angelegt.
Die Eintr<74>ge des MFDB (fd_addr, fd_w, fd_h, fd_wdwidth, fd_stand,
fd_nplanes) werden vom VDI-Treiber gesetzt und an die aufrufende
Applikation zur<75>ckgegeben. Wenn nicht nicht gen<65>gend Speicher
vorhanden ist, wird der Inhalt des MFDBs nicht ver<65>ndert; ein
Null-Handle wird zur<75>ckgegeben.
Wenn bitmap->fd_addr ungleich NULL ist, wird dieser Eintrag als
Zeiger auf eine Bitmap interpretiert. Wenn die Bitmap im
Standardformat vorliegt, wird sie ins ger<65>tespezifische Format
umgewandelt. Liegt sie schon im ger<65>tespezifischen Format vor, so
wird sie nicht umgewandelt. Falls die Aufl<66>sung der Bitmap (d.h.
die Anzahl der Farben und Planes) nicht unterst<73>tzt wird, gibt
v_opnbm() ein Null-Handle zur<75>ck.
CLOSE BITMAP (VDI 101, 1)
void v_clsbm( WORD handle )
{
contrl[0] = 101;
contrl[1] = 0;
contrl[3] = 0;
contrl[5] = 1;
contrl[6] = handle;
vdi();
}
Best<73>ckung der VDI-Arrays:
Feldelement | Belegung
------------------|-------------------------------------------
contrl[0] | 101 Funktionsnummer f<>r v_clsbm()
contrl[1] | 0 Anzahl der Eintr<74>ge in ptsin
contrl[2] | 0 Anzahl der Eintr<74>ge in ptsout
contrl[3] | 0 Anzahl der Eintr<74>ge in intin
contrl[4] | 0 Anzahl der Eintr<74>ge in intout
contrl[5] | 1 Unterfunktionsnummer f<>r v_clsbm()
contrl[6] | handle
Die Funktion v_clsbm() schlie<69>t die mit handle bezeichnete Bitmap.
Wenn der Speicher beim v_opnbm() vom VDI alloziert wurde, gibt sie
diesen Speicher wieder frei.
Rasteroperationen bei Off-Screen-Bitmaps:
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Rasteroperationen zwischen Bildschirm und Off-Screen-Bitmap sollten
grunds<64>tzlich im ger<65>tespezifischen Format erfolgen.
Wenn als Ziel einer Rasteroperation eine Off-Screen-Bitmap mit ihrem
MFDB angegeben wird und wenn das zu dieser Bitmap geh<65>rende Handle
benutzt wird, so wird beim Blitten anhand der <20>ber vs_clip() auf dieser
Workstation eingestellten Koordinaten geclippt. F<>r das Kopieren eines
Rasters vom Bildschirm in eine Off-Screen-Bitmap sollte man also das
VDI-Handle dieser Bitmap benutzen.
Ist die Bitmap dagegen Quelle und der Bildschirm Ziel, so sollte man das
Handle der Bildschirm-Workstaion benutzen, da dann das Raster anhand der
Bildschirm-Koordinaten abgeclippt wird.
Wenn man das von v_opnbm() zur<75>ckgelieferte Handle einer Bitmap benutzt
und in fd_addr in einem MFDB 0 enth<74>lt, so werden die Daten der Bitmap
statt dessen benutzt.
ESCAPES
-------
Die VDI-Escape-Funktionen (VT52) k<>nnen nicht auf einer Bitmap benutzt
werden. Ihr Aufruf wid ignoriert.
vs_color()/vq_color()
---------------------
Wenn die Funktion vs_color() mit dem Handle einer Off-Screen-Bitmap
aufgerufen wird, werden die Farben nur dann gesetzt, wenn es sich um
High- oder True-Color handelt. Vq_color() ist ebenfalls nur in High-
oder True-Color sinnvoll - andernfalls ist der Parameter valid -1.
vst_point()
-----------
Die Funktion vst_point() und alle anderen Funktionen, die Texth<74>hen in
Punkten einstellen, reagieren bisher nur dann sinnvoll, wenn die Bitmap
die Ausma<6D>e des Bildschirms hat.
v_show_c()/v_hide_c()
---------------------
Beide Funktionen werden ignoriert, falls sie mit dem Handle einer
Off-Screen-Bitmap aufgerufen werden. Sie beziehen sich nur auf den
Bildschirm und sollten nur vom AES aufgerufen werden.
2. vq_scrninfo()
=================
Genauere Angaben <20>ber das Bildschirmformat liefert die Funktion INQUIRE
SCREEN INFORMATION implementiert. Im workout-Array wird angeben, wie das
ger<65>tespezifische Format aufgebaut ist.
Diese Informationen sind in erster Linie interessant f<>r Programme, die
- schnell Raster aufbauen (auch in TrueColor) und diese mit vro_cpyfm()
auf den Schirm kopieren m<>chten.
- Raster speichern (z.B. XIMGs).
- Raster anzeigen.
VQ_SCRNINFO( 102, 1 )
void vq_scrninfo( WORD handle, WORD *work_out )
{
pb[3] = work_out;
intin[0] = 2;
contrl[0] = 102;
contrl[1] = 0;
contrl[3] = 1;
contrl[5] = 1;
contrl[6] = handle;
vdi();
pb[3] = intout;
}
Best<73>ckung der VDI-Arrays:
Feldelement | Belegung
------------------|-------------------------------------------
contrl[0] | 102 Funktionsnummer von vq_scrninfo()
contrl[1] | 0 Anzahl der Eintr<74>ge in ptsin
contrl[2] | 0 Anzahl der Eintr<74>ge in ptsout
contrl[3] | 1 Anzahl der Eintr<74>ge in intin
contrl[4] | 272 Anzahl der Eintr<74>ge in intout
contrl[5] | 1 Unterfunktionsnummer von vq_scrninfo()
contrl[6] | handle
|
intin[0] | 2 erweiterte Informationen ausgeben
|
intout[0..272] | work_out[0..272]
intout[0]: Formatangabe:
0: Interleaved Planes, wortweise (ATARI Grafik)
1: Standardformat (komplette Planes)
2: Packed Pixels
-1: unbekanntes Format; nicht direkt beschreibbar
intout[1]: Verf<72>gbarkeit einer CLUT:
0: keine CLUT (z.B. TTM 194)
1: Hardware-CLUT
2: Software-CLUT (HiColor oder TrueColor)
intout[2]: Anzahl der Ebenen (Bits) pro Pixel
intout[3/4]:Farbanzahl oder 0L (mehr als 2*10^31 Farben)
intout[8]: Anzahl der Bits f<>r die Rot-Intensit<69>t
intout[9]: Anzahl der Bits f<>r die Gr<47>n-Intensit<69>t
intout[10]: Anzahl der Bits f<>r die Blau-Intensit<69>t
intout[11]: Anzahl der Bits f<>r den Alpha-Channel oder <20>hnliches
intout[12]: Anzahl der Bits f<>r Genlock
intout[13]: Anzahl der nicht benutzen Bits
Falls eine Hardware-CLUT (intout[1] == 1) vorhanden ist:
intout[16-271]: Pixelwert des zugeh<65>rigen VDI-Farbindexes
Falls HiColor, TrueColor oder <20>hnliches vorhanden ist:
intout[16..31]: Zuordnung von Bitnummer im Pixel zum Bit der Rotintensit<69>t
intout[32..47]: Zuordnung von Bitnummer im Pixel zum Bit der Gr<47>nintens.
intout[48..63]: Zuordnung von Bitnummer im Pixel zum Bit der Blauintensit<69>t
intout[64..79]: Zuordnung der Bitnummer f<>r Alpha-Channel
intout[80..95]: Zuordnung der Bitnummer f<>r Genlock
intout[96..127]: unbenutzte Bits
intout[128..271]: reserviert (0)
Beispiele:
----------
In 256 Farben auf dem Falcon w<>rden folgende Ausgaben erfolgen:
intout | Wert | Bedeutung
---------|--------|-----------------------------------------------------
0 | 0 | Interleaved Planes, wortweise
1 | 1 | Hardware-CLUT vorhanden
2 | 8 | 8 Bit pro Pixel
3/4 | 256 | 256 verschiedene Farben gleichzeitig m<>glich
8 | 6 | 6 Bits f<>r die Rot-Intensit<69>t
9 | 6 | 6 Bits f<>r die Gr<47>n-Intensit<69>t
10 | 6 | 6 Bits f<>r die Blau-Intensit<69>t
11 | 0 | kein Bit f<>r Alpha-Channel
12 | 0 | kein Bit f<>r Genlock
13 | 0 | kein unbenutzes Bit
| |
| |
16 | 0 | Pixelwert f<>r VDI-Farbindex 0
17 | 255 | Pixelwert f<>r VDI-Farbindex 1
18 | 2 | Pixelwert f<>r VDI-Farbindex 2
... | ... |
271 | 15 | Pixelwert f<>r VDI-Farbindex 255
In HiColor auf dem Falcon w<>rden folgende Ausgaben erfolgen:
intout | Wert | Bedeutung
---------|--------|-----------------------------------------------------
0 | 2 | Packed Pixels
1 | 2 | HiColor bzw. TrueColor
2 | 16 | 16 Bit pro Pixel
3/4 | 32768 | 32768 verschiedene Farben gleichzeitig m<>glich
8 | 5 | 5 Bits f<>r die Rot-Intensit<69>t
9 | 5 | 5 Bits f<>r die Gr<47>n-Intensit<69>t
10 | 5 | 5 Bits f<>r die Blau-Intensit<69>t
11 | 0 | kein Bit f<>r Alpha-Channel
12 | 1 | ein Bit f<>r Genlock
13 | 0 | kein unbenutzes Bit
| |
| |
16 | 11 | Bit 0 der Rot-Intensit<69>t (niederwertigstes Bit)
| | befindet sich in Bit 11 des Pixels
17 | 12 | Bit 1 befindet sich in Bit 12 des Pixels
18 | 13 | ...
19 | 14 | ...
20 | 15 | Bit 4 der Rot-Intensit<69>t (h<>chstwertigstes Bit)
| | befindet sich in Bit 15 des Pixels
21..31 | -1 | Bits werden nicht f<>r Rot-Intensit<69>t benutzt
| |
| |
32 | 6 | Bit 0 der Gr<47>n-Intensit<69>t (niederwertigstes Bit)
| | befindet sich in Bit 6 des Pixels
33 | 7 | Bit 1 befindet sich in Bit 7 des Pixels
34 | 8 | ...
35 | 9 | ...
36 | 10 | Bit 4 der Gr<47>n-Intensit<69>t (h<>chstwertigstes Bit)
| | befindet sich in Bit 10 des Pixels
37..37 | -1 | Bits werden nicht f<>r Gr<47>n-Intensit<69>t benutzt
| |
| |
48 | 0 | Bit 0 der Blau-Intensit<69>t (niederwertigstes Bit)
| | befindet sich in Bit 0 des Pixels
49 | 1 | Bit 1 befindet sich in Bit 1 des Pixels
50 | 2 | ...
51 | 3 | ...
52 | 4 | Bit 4 der Blau-Intensit<69>t (h<>chstwertigstes Bit)
| | befindet sich in Bit 4 des Pixels
53..63 | -1 | Bits werden nicht f<>r Blau-Intensit<69>t benutzt
| |
| |
64..79 | -1 | kein Alpha-Channel
| |
| |
80 | 5 | Bit f<>r Genlock
81..95 | -1 | nicht f<>r Genlock benutzt
| |
| |
96..127| -1 | keine unbenutzten Bits
| |
| |
3. Wie erkennt man, ob die neuen Funktionen vorhanden sind?
===========================================================
NVDI installiert (ebenso wie der nur f<>rs ATARI-VDI gedachte Enhancer)
einen Cookie mit der Kennung 'EdDI'. Das auf diese Kennung folgende
Langwort ist die Adresse eines Funktionsdispatchers, der mit der
Funktionsnummer in Register d0 aufgerufen wird. Der Aufruf erfolgt nach
den Pure C-Konventionen (Register d0-d2/a0-a1 und der Stack werden zur
Parameter<65>bergabe benutzt).
Bisher existiert nur die Funktion 0, die als Funktionsresultat eine
Versionsnummer zur<75>ckliefert, anhand er man auf die unterst<73>tzten
Funktionen schlie<69>en kann.
Ab Version 1.00 ($100 wird zur<75>ckgeliefert) sind die Funktionen
v_opnbm(), v_clsbm() und vq_scrninfo() vorhanden.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,9 @@
This is a maintainance and unofficial release fixing some crashes when running
under FreeMiNT with memory protection. You don't need to install anything,
however if you want to make new plugins usable for other applications, copy
"codecs" directory into c:\gemsys\ldg (or any other location you use for LDG
modules).
Miro Kropacek
Bratislava/Slovakia
01.11.2011

View File

@@ -0,0 +1,36 @@
#include "general.h"
#include "pic_load.h"
#include "winimg.h"
/* Prototype */
void va_start( void);
/*==================================================================================*
* void va_start: *
* Handle the VA_START message from the server. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void va_start( void)
{
char *p = *(char **) &evnt.buff[3];
if( p)
{
p = AvStrfmt( 1, p);
/* yes, I know, it's strange to reput the menubar here
but if we don't do it, on MagiC, the menubar is not active after
a VA_START :( */
MenuBar( get_tree( MENU_BAR), 1);
WindView( p);
free( p);
}
}

View File

@@ -0,0 +1,2 @@
void va_start( void);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
extern int WinCatalog( void);
extern void WinCatalog_Close( WINDOW *win);
extern void WinCatalog_Refresh( WINDOW *wind);
extern void WindMakePreview( WINDOW *win);
extern int WindMakePreview_needed( WINDOW *win);
extern void WinCatalog_filelist_redraw( void);
extern void WinCatalog_set_thumbnails_size( WINDOW *win);
extern int16 old_browser_size;
extern int16 old_preview_area_size;
extern int16 x_space;
extern int16 y_space;
extern int16 hcell;
extern int16 border_size;
extern int16 old_border_size;
extern int16 need_frame_slider;
extern int16 draw_frame_slider;
extern OBJECT *frame_slider_root;

View File

@@ -0,0 +1,91 @@
#include "../general.h"
/* Prototype */
void add_selected_entry( WINDICON *wicones, Entry *entry);
void remove_selected_entry( WINDICON *wicones, Entry *entry);
boolean check_selected_entry( WINDICON *wicones, Entry *entry);
void remove_all_selected_entry( WINDICON *wicones);
int16 return_entry_nbr( WINDICON *wicones, Entry *entry);
void add_selected_entry( WINDICON *wicones, Entry *entry)
{
Entry *ptr = wicones->first_selected;
if ( ptr == NULL)
wicones->first_selected = entry;
else
{
while( ptr->next_selected)
ptr = ptr->next_selected;
ptr->next_selected = entry;
}
}
void remove_selected_entry( WINDICON *wicones, Entry *entry)
{
Entry* ptr = wicones->first_selected;
if ( ptr == entry)
wicones->first_selected = ptr->next_selected;
else
{
while ( ptr->next_selected)
{
if ( ptr->next_selected == entry)
break;
else
ptr = ptr->next_selected;
}
if ( ptr->next_selected == entry)
ptr->next_selected = ptr->next_selected->next_selected;
}
entry->next_selected = NULL;
}
boolean check_selected_entry( WINDICON *wicones, Entry *entry)
{
Entry* ptr = wicones->first_selected;
if ( ptr == NULL)
return FALSE;
if ( ptr == entry)
return TRUE;
while ( ptr->next_selected)
{
if ( ptr->next_selected == entry)
return TRUE;
else
ptr = ptr->next_selected;
}
return FALSE;
}
void remove_all_selected_entry( WINDICON *wicones)
{
while( wicones->first_selected)
wicones->first_selected = wicones->first_selected->next_selected;
}
int16 return_entry_nbr( WINDICON *wicones, Entry *entry)
{
int16 i;
if ( entry == NULL)
return ( -1);
for ( i = 0 ; i < wicones->nbr_icons; i++)
if ( entry == &wicones->entry[i])
break;
return i;
}

View File

@@ -0,0 +1,6 @@
extern void add_selected_entry( WINDICON *wicones, Entry *entry);
extern void remove_selected_entry( WINDICON *wicones, Entry *entry);
extern boolean check_selected_entry( WINDICON *wicones, Entry *entry);
extern void remove_all_selected_entry( WINDICON *wicones);
extern int16 return_entry_nbr( WINDICON *wicones, Entry *entry);

View File

@@ -0,0 +1,38 @@
#include "../general.h"
/*==================================================================================*
* void catalog_iconify: *
* Function changes the window's name when the catalog window is iconified. *
*----------------------------------------------------------------------------------*
* input: *
* win -> the window to handle. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void catalog_iconify( WINDOW *win)
{
WindSetStr( win, WF_NAME, "Zview");
}
/*==================================================================================*
* void catalog_uniconify: *
* Function restore the window's name when the catalog window is uniconified. *
*----------------------------------------------------------------------------------*
* input: *
* win -> the window to handle. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void catalog_uniconify( WINDOW *win)
{
WINDICON *wicones = ( WINDICON *)DataSearch( win, WD_ICON);
WindSetStr( win, WF_NAME, wicones->directory);
}

View File

@@ -0,0 +1,3 @@
extern void catalog_iconify( WINDOW *win);
extern void catalog_uniconify( WINDOW *win);

View File

@@ -0,0 +1,416 @@
#include "../general.h"
#include "../ztext.h"
#include "../mfdb.h"
#include "catalog_entry.h"
#include "../plugins.h"
/* Global variable */
IMAGE icon_image;
IMAGE icon_file;
IMAGE icon_folder;
IMAGE icon_prg;
IMAGE icon_pdf;
IMAGE small_icon;
MFDB mini_hdd = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_folder = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_big = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_big_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_small = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_small_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_forward = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_forward_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_back = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_back_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_up = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_up_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_reload = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_reload_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_printer = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_printer_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_info = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_info_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_find = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_find_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_delete = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_delete_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_fullscreen = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_fullscreen_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_open = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_open_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_save = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
MFDB mini_save_on = { NULL, 16, 16, 1, 0, 1, 0, 0, 0};
/* local variable */
static uint16 initialised = 0;
/* extern variable */
extern int16 draw_frame_slider;
/* Prototype */
void icons_exit(void);
int16 icons_init( void);
void set_entry_icon( Entry *entry);
void redraw_icon( WINDOW *win, Entry *entry);
void draw_icon( int16 handle, Entry *entry, boolean selected, RECT16 *dst_rect);
boolean icon_is_visible( Entry *entry, int16 window_height);
int16 redraw_icon_border( WINDOW *win, Entry *entry, int16 selected);
/*==================================================================================*
* void icons_exit: *
* Free the memories previously allocated for the icon and pattern. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void icons_exit(void)
{
if ( initialised != 0)
{
( void)delete_mfdb( small_icon.image, small_icon.page);
( void)delete_mfdb( icon_pdf.image, icon_pdf.page);
( void)delete_mfdb( icon_prg.image, icon_prg.page);
( void)delete_mfdb( icon_file.image, icon_file.page);
( void)delete_mfdb( icon_image.image, icon_image.page);
( void)delete_mfdb( icon_folder.image, icon_folder.page);
}
initialised = 0;
}
/*==================================================================================*
* int16 icons_init: *
* Initializes default icons and pattern. *
* May be called any number of times. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* 0 if error else 1. *
*==================================================================================*/
int16 icons_init( void)
{
uint16 *small_icon_buffer_addr;
uint32 small_icon_buffer_size;
initialised += 1;
if ( initialised == 1)
{
icon_image.view_mode = full_size;
icon_file.view_mode = full_size;
icon_folder.view_mode = full_size;
icon_prg.view_mode = full_size;
icon_pdf.view_mode = full_size;
icon_image.progress_bar = 0;
icon_file.progress_bar = 0;
icon_folder.progress_bar = 0;
icon_prg.progress_bar = 0;
icon_pdf.progress_bar = 0;
small_icon.view_mode = full_size;
small_icon.progress_bar = 0;
if ( !pic_load( "icons\\folder.god","GOD", &icon_folder) ||
!pic_load( "icons\\image.god", "GOD", &icon_image) ||
!pic_load( "icons\\file.god", "GOD", &icon_file) ||
!pic_load( "icons\\prg.god", "GOD", &icon_prg) ||
!pic_load( "icons\\pdf.god", "GOD", &icon_pdf) ||
!pic_load( "icons\\small.god", "GOD", &small_icon))
{
icons_exit();
return( 0);
}
}
small_icon_buffer_addr = ( uint16*)small_icon.image[0].fd_addr;
small_icon_buffer_size = app.nplanes << 4;
mini_hdd.fd_nplanes = app.nplanes;
mini_hdd.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_folder.fd_nplanes = app.nplanes;
mini_folder.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_big.fd_nplanes = app.nplanes;
mini_big.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_big_on.fd_nplanes = app.nplanes;
mini_big_on.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_small.fd_nplanes = app.nplanes;
mini_small.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_small_on.fd_nplanes= app.nplanes;
mini_small_on.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_forward.fd_nplanes = app.nplanes;
mini_forward.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_forward_on.fd_nplanes = app.nplanes;
mini_forward_on.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_back.fd_nplanes = app.nplanes;
mini_back.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_back_on.fd_nplanes = app.nplanes;
mini_back_on.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_up.fd_nplanes = app.nplanes;
mini_up.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_up_on.fd_nplanes = app.nplanes;
mini_up_on.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_reload.fd_nplanes = app.nplanes;
mini_reload.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_reload_on.fd_nplanes = app.nplanes;
mini_reload_on.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_printer.fd_nplanes = app.nplanes;
mini_printer.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_printer_on.fd_nplanes = app.nplanes;
mini_printer_on.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_info.fd_nplanes = app.nplanes;
mini_info.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_info_on.fd_nplanes = app.nplanes;
mini_info_on.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_find.fd_nplanes = app.nplanes;
mini_find.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_find_on.fd_nplanes = app.nplanes;
mini_find_on.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_delete.fd_nplanes = app.nplanes;
mini_delete.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_delete_on.fd_nplanes= app.nplanes;
mini_delete_on.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_fullscreen.fd_nplanes= app.nplanes;
mini_fullscreen.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_fullscreen_on.fd_nplanes= app.nplanes;
mini_fullscreen_on.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_open.fd_nplanes = app.nplanes;
mini_open.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_open_on.fd_nplanes = app.nplanes;
mini_open_on.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_save.fd_nplanes = app.nplanes;
mini_save.fd_addr = ( void*)small_icon_buffer_addr;
small_icon_buffer_addr += small_icon_buffer_size;
mini_save_on.fd_nplanes = app.nplanes;
mini_save_on.fd_addr = ( void*)small_icon_buffer_addr;
return( 1);
}
/*==================================================================================*
* void set_entry_icon: *
* Set the entry's icon. *
*----------------------------------------------------------------------------------*
* input: *
* entry -> pointer to the entry to set *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void set_entry_icon( Entry *entry)
{
int16 i, j, c = 0;
char extention[4], plugin[4];
strcpy( extention, entry->name + strlen( entry->name) - 3);
str2upper( extention);
if ( S_ISDIR( entry->stat.st_mode))
{
entry->type = ET_DIR;
entry->icon = icon_folder.image;
return;
}
if(( strncmp ( extention, "TTP", 3) == 0)
|| ( strncmp ( extention, "TOS", 3) == 0)
|| ( strncmp ( extention, "GTP", 3) == 0)
|| ( strncmp ( extention, "PRG", 3) == 0)
|| ( strncmp ( extention, "APP", 3) == 0))
{
entry->type = ET_PRG;
entry->icon = &icon_prg.image[0];
return;
}
if( strncmp ( extention, "PDF", 3) == 0)
{
entry->type = ET_PDF;
entry->icon = &icon_pdf.image[0];
return;
}
for( i = 0; i < plugins_nbr; i++, c = 0)
{
for( j = 0; j < codecs[i]->user_ext; j++)
{
plugin[0] = codecs[i]->infos[c++];
plugin[1] = codecs[i]->infos[c++];
plugin[2] = codecs[i]->infos[c++];
if( strncmp ( extention, plugin, 3) == 0)
{
entry->type = ET_IMAGE;
entry->icon = &icon_image.image[0];
return;
}
}
}
entry->type = ET_FILE;
entry->icon = &icon_file.image[0];
}
/*==================================================================================*
* void redraw_icon: *
* send a redraw event at the entry's position. *
*----------------------------------------------------------------------------------*
* input: *
* win -> the target window. *
* entry -> the icon to be redraw. *
*----------------------------------------------------------------------------------*
* returns: - *
*==================================================================================*/
void redraw_icon( WINDOW *win, Entry *entry)
{
int16 xw, yw, hw, x, y, w, h;
WindGet ( win, WF_WORKXYWH, &xw, &yw, &w, &hw);
x = entry->case_pos.x1 - 2;
y = entry->case_pos.y1 - 1;
w = entry->case_pos.x2 - x + 4;
h = entry->case_pos.y2 - y + 2;
x += xw;
y += yw;
if (( y + entry->case_pos.y2 > yw) && ( y < yw + hw))
{
draw_frame_slider = 0;
draw_page( win, x, y, w, h);
draw_frame_slider = 1;
}
}
/*==================================================================================*
* void draw_icon: *
* draw a icon. *
*----------------------------------------------------------------------------------*
* input: *
* handle -> the target VDI handle. *
* entry -> the icon entry to be draw. *
* selected -> the icon is selected or not. *
* dst_rect -> Destination Bitmap for the icon. *
*----------------------------------------------------------------------------------*
* returns: - *
*==================================================================================*/
void draw_icon( int16 handle, Entry *entry, boolean selected, RECT16 *dst_rect)
{
MFDB *icon = ( entry->preview.page ? &entry->preview.image[0] : entry->icon),
screen = {0};
int16 xy[8], color[2] = { BLACK, WHITE};
/* Source Rectangle */
xy[0] = 0;
xy[1] = 0;
xy[2] = icon->fd_w - 1;
xy[3] = icon->fd_h - 1;
/* destination Rectangle */
xy[4] = dst_rect->x1;
xy[5] = dst_rect->y1;
xy[6] = dst_rect->x2;
xy[7] = dst_rect->y2;
if ( icon->fd_nplanes == 1)
vrt_cpyfm( handle, MD_REPLACE, xy, icon, &screen, color);
else
vro_cpyfm( handle, S_ONLY, xy, icon, &screen);
}
/*==================================================================================*
* boolean icon_is_visible: *
* check if the icon is visible. *
*----------------------------------------------------------------------------------*
* input: *
* entry -> the icon entry to be checked. *
* window_height -> the window height. *
*----------------------------------------------------------------------------------*
* returns: TRUE if visible else FALSE. *
*==================================================================================*/
boolean icon_is_visible( Entry *entry, int16 window_height)
{
if ( ( entry->case_pos.y2 > 1) && ( entry->case_pos.y1 < window_height))
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,43 @@
extern int16 icons_init( void);
extern void icons_exit(void);
extern void set_entry_icon( Entry *entry);
extern void redraw_icon( WINDOW *wind, Entry *entry);
extern void draw_icon( int16 handle, Entry *entry, boolean selected, RECT16 *dst_rect);
extern boolean icon_is_visible( Entry *entry, int16 window_height);
extern IMAGE icon_image;
extern IMAGE icon_file;
extern IMAGE icon_folder;
extern IMAGE icon_tos;
extern IMAGE icon_pdf;
extern MFDB mini_hdd;
extern MFDB mini_folder;
extern MFDB mini_big;
extern MFDB mini_big_on;
extern MFDB mini_small;
extern MFDB mini_small_on;
extern MFDB mini_forward;
extern MFDB mini_forward_on;
extern MFDB mini_back;
extern MFDB mini_back_on;
extern MFDB mini_up;
extern MFDB mini_up_on;
extern MFDB mini_reload;
extern MFDB mini_reload_on;
extern MFDB mini_printer;
extern MFDB mini_printer_on;
extern MFDB mini_info;
extern MFDB mini_info_on;
extern MFDB mini_find;
extern MFDB mini_find_on;
extern MFDB mini_delete;
extern MFDB mini_delete_on;
extern MFDB mini_fullscreen;
extern MFDB mini_fullscreen_on;
extern MFDB mini_open;
extern MFDB mini_open_on;
extern MFDB mini_save;
extern MFDB mini_save_on;

View File

@@ -0,0 +1,465 @@
#include "../general.h"
#include "../prefs.h"
#include "../zedit/zedit.h"
#include "../file/file.h"
#include "../file/count.h"
#include "../file/delete.h"
#include "../file/rename.h"
#include "../ztext.h"
#include "catalog_entry.h"
#include "catalog_mini_entry.h"
#include "catalog_icons.h"
#include "../pic_load.h"
#include "../winimg.h"
#include "catalog.h"
#include "../mfdb.h"
#include "../custom_font.h"
/* local constant */
static const char allowed_char[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0123456789 &\"'(<28>!)-_`<60>^[]*{},?;.:/=+%#|@~<>";
char fullname[MAX_PATH+MAXNAMLEN];
/* Prototype */
void WinCatalog_Keyb( WINDOW *win);
// extern boolean create_icon( const char *filename, MFDB *icon, MFDB *icon_selected, MFDB *icon_mask);
/*==================================================================================*
* void WinCatalog_Keyb: *
* this function handle the keyboard event for the main frame in the *
* catalog ( the entries). *
*----------------------------------------------------------------------------------*
* input: *
* win -> The window to handle. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_Keyb( WINDOW *win)
{
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
Mini_Entry *old_selected;
Entry *old_entry = wicones->first_selected;
int16 res, selection, x, y, w, h, i;
char old_dir[128] = "";
switch ( evnt.keybd >> 8)
{
case SC_UPARW:
case SC_DWARW:
case SC_LFARW:
case SC_RTARW:
case SC_RETURN:
case SC_ENTER:
case SC_HOME:
if( wicones->first_selected)
{
if( wicones->first_selected->next_selected)
{
Entry *entry_ptr;
while( wicones->first_selected->next_selected)
{
entry_ptr = wicones->first_selected->next_selected;
remove_selected_entry( wicones, wicones->first_selected->next_selected);
redraw_icon( win, entry_ptr);
}
return;
}
}
break;
default:
break;
}
WindGet ( win, WF_WORKXYWH, &x, &y, &w, &h);
if ( !wicones->edit)
{
res = selection = return_entry_nbr( wicones, wicones->first_selected);
switch ( evnt.keybd >> 8)
{
case SC_UPARW:
if ( selection == -1)
selection = 0;
else if ( selection >= wicones->columns)
selection = selection - wicones->columns;
goto common;
case SC_DWARW:
if ( selection == -1)
selection = 0;
else if ( selection < wicones->nbr_icons - wicones->icons_last_line && selection + wicones->columns < wicones->nbr_icons)
selection = selection + wicones->columns;
goto common;
case SC_LFARW:
if ( selection == -1)
selection = 0;
else if ( selection > 0)
selection--;
goto common;
case SC_RTARW:
if ( selection == -1)
selection = 0;
else if ( selection < wicones->nbr_icons - 1)
selection++;
common:
if ( wicones->entry[selection].icn_pos.y1 < 0)
{
if ( wicones->entry[selection].icn_pos.y1 + wicones->case_h >= 0)
{
wicones->first_selected = &wicones->entry[selection];
if ( res >= 0)
redraw_icon( win, &wicones->entry[res]);
snd_arrw( win, WA_UPLINE);
/* WindMakePreview( win); */
}
else
{
while ( wicones->entry[selection].icn_pos.y1 <= 0)
{
if ( win->ypos == 0)
break;
wicones->entry[selection].icn_pos.y1 += wicones->case_h;
win->ypos--;
}
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
WindMakePreview( win);
goto end_case;
}
}
else if ( wicones->entry[selection].icn_pos.y2 > h)
{
if ( wicones->entry[selection].icn_pos.y2 - wicones->case_h <= h)
{
wicones->first_selected = &wicones->entry[selection];
snd_arrw( win, WA_DNLINE);
if ( res >= 0)
redraw_icon( win, &wicones->entry[res]);
redraw_icon( win, wicones->first_selected);
}
else
{
while ( wicones->entry[selection].icn_pos.y2 >= h)
{
if ( win->ypos == win->ypos_max)
break;
wicones->entry[selection].icn_pos.y2 -= wicones->case_h;
win->ypos++;
}
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
WindMakePreview( win);
goto end_case;
}
}
else if ( res != selection)
{
wicones->first_selected = &wicones->entry[selection];
if ( res >= 0)
redraw_icon( win, &wicones->entry[res]);
redraw_icon( win, wicones->first_selected);
}
end_case:
break;
case SC_RETURN:
case SC_ENTER:
if( !wicones->first_selected)
break;
else if ( wicones->entry[selection].type == ET_DIR)
{
Mini_Entry *old_selected_mini_entry = wicones->mini_selected;
wicones->mini_selected = NULL;
if ( old_selected_mini_entry && browser_frame_width)
redraw_mini_entry( win, old_selected_mini_entry);
strcat( wicones->directory, wicones->entry[selection].name);
( void)scan_dir( win, wicones->directory);
WindSetStr ( win, WF_NAME, wicones->directory);
wicones->first_selected = NULL;
win->ypos = 0;
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
WindMakePreview( win);
}
else if ( ( wicones->entry[selection].type == ET_IMAGE && wicones->entry[selection].preview.page) || wicones->entry[selection].type == ET_PDF)
{
strcpy( fullname, wicones->directory);
strcat( fullname, wicones->entry[selection].name);
WindView( fullname);
}
break;
case SC_HOME:
if ( !dir_parent( wicones->directory, old_dir))
break;
old_selected = wicones->mini_selected;
wicones->mini_selected = NULL;
if ( old_selected)
redraw_mini_entry( win, old_selected);
( void)scan_dir( win, wicones->directory);
WindSetStr ( win, WF_NAME, wicones->directory);
win->ypos = 0;
for (i = 0 ; i < wicones->nbr_icons ; i++)
if ( !strcmp( wicones->entry[i].name, old_dir))
{
wicones->first_selected = &wicones->entry[i];
break;
}
WinCatalog_Refresh( win);
if ( wicones->first_selected->txt_pos.y2 > h)
while ( wicones->first_selected->txt_pos.y2 + wicones->case_h > h)
{
wicones->first_selected->txt_pos.y2 -= wicones->case_h;
win->ypos++;
}
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
WindMakePreview( win);
break;
case SC_DEL:
if ( wicones->first_selected)
delete_entry( win);
break;
/* case SC_F1:
{
Entry *entry_ptr = wicones->first_selected;
while( entry_ptr)
{
zdebug( "entry = %s", entry_ptr);
entry_ptr = entry_ptr->next_selected;
}
zdebug( "---");
}
break;
case SC_F3:
{
MFDB nicon, nicon_selected, icon_mask, screen = {0};
int16 xy[8], fvdi = 1;
if( create_icon( "c://1.gif", &nicon, &nicon_selected, &icon_mask))
{
int16 color[2], blitmode;
xy[0] = 0;
xy[1] = 0;
xy[2] = nicon.fd_w - 1;
xy[3] = nicon.fd_h - 1;
xy[4] = 40;
xy[5] = 40;
xy[6] += nicon.fd_w - 1;
xy[7] += nicon.fd_h - 1;
vro_cpyfm( app.handle, S_ONLY, xy, &nicon, &screen);
xy[4] += nicon.fd_w - 1;
xy[6] += nicon.fd_h - 1;
vro_cpyfm( app.handle, S_ONLY, xy, &nicon_selected, &screen);
xy[4] += nicon.fd_w - 1;
xy[6] += nicon.fd_h - 1;
color[0] = WHITE;
color[1] = BLACK;
vrt_cpyfm( app.handle, MD_REPLACE, xy, &icon_mask, &screen, color);
xy[4] += nicon.fd_w - 1;
xy[6] += nicon.fd_h - 1;
blitmode = app.nplanes > 8 ? S_AND_D : S_OR_D;
if( fvdi)
{
color[0] = WHITE;
color[1] = BLACK;
vrt_cpyfm( app.handle, 4, xy, &icon_mask, &screen, color);
}
else
{
color[0] = BLACK;
color[1] = WHITE;
vrt_cpyfm( app.handle, MD_TRANS, xy, &icon_mask, &screen, color);
}
vro_cpyfm( app.handle, S_OR_D, xy, &nicon, &screen);
delete_mfdb( &nicon);
delete_mfdb( &nicon_selected);
delete_mfdb( &icon_mask);
}
else
zdebug("error");
}
break;
case SC_F4:
{
int16 mode = mode2logic( T_TRANSPARENT);
zdebug( "%i", mode);
}
*/
default:
break;
}
if( !( wicones->first_selected))
{
menu_ienable( get_tree( MENU_BAR), MENU_BAR_INFORMATION, 0);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_SAVE, 0);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_DELETE, 0);
if( old_entry)
{
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_DELETE, 1);
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_INFO, 1);
if( old_entry->type == ET_IMAGE)
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_SAVE, 1);
}
}
else
{
if( wicones->first_selected->type == ET_IMAGE)
menu_ienable( get_tree( MENU_BAR), MENU_BAR_SAVE, 1);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_DELETE, 1);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_INFORMATION, 1);
if( !old_entry)
{
if( wicones->first_selected->type == ET_IMAGE)
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_SAVE, 1);
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_DELETE, 1);
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_INFO, 1);
}
else if(( wicones->first_selected->type != old_entry->type) && ( wicones->first_selected->type == ET_IMAGE || old_entry->type == ET_IMAGE))
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_SAVE, 1);
}
}
else if ( wicones->edit)
{
Mini_Entry *mini_ptr = NULL;
int16 c = evnt.keybd & 0x00FF;
int16 max_len = ( int16)Dpathconf( wicones->directory, 3);
switch( evnt.keybd >> 8)
{
case SC_RETURN:
case SC_ENTER:
if ( wicones->first_selected->type == ET_DIR)
{
strcpy( fullname, wicones->directory);
strcat( fullname, wicones->first_selected->name);
strcat( fullname, "\\");
}
if( !rename_entry( win, wicones->edit->top->buf))
{
exit_edit_mode( win, wicones->first_selected);
break;
}
strcpy( wicones->first_selected->name_shown, wicones->first_selected->name);
if (( wicones->first_selected->icon_txt_w = get_text_width( wicones->first_selected->name_shown)) >= wicones->case_w - 4)
wicones->first_selected->icon_txt_w = name_shorter( wicones->case_w - 6, wicones->first_selected->name_shown);
exit_edit_mode( win, wicones->first_selected);
// Now, we change the name of the dir in the file browser if necessary( left frame).
if ( wicones->first_selected->type != ET_DIR)
break;
if (( mini_ptr = find_mini_entry_by_path( wicones, fullname)) != NULL)
{
strcpy( mini_ptr->foldername, mini_ptr->parent->foldername);
strcat( mini_ptr->foldername, wicones->first_selected->name);
strcat( mini_ptr->foldername, "\\");
strcpy( mini_ptr->name, wicones->first_selected->name);
mini_ptr->icon_txt_w = get_text_width( mini_ptr->name);
mini_ptr->icon_position.x2 = mini_ptr->icon_position.x1 + 15 + x_space + mini_ptr->icon_txt_w;
if( browser_frame_width)
redraw_mini_entry( win, mini_ptr);
}
break;
case SC_LFARW:
if ( curs_left( wicones->edit))
edit_icon_txt( win, wicones->first_selected);
break;
case SC_RTARW:
if ( curs_right( wicones->edit))
edit_icon_txt( win, wicones->first_selected);
break;
case SC_UPARW:
case SC_DWARW:
case SC_ESC:
exit_edit_mode( win, wicones->first_selected);
break;
case SC_DEL:
curs_right( wicones->edit);
case SC_BACK:
if ( char_del( wicones->edit) != 0)
edit_icon_txt( win, wicones->first_selected);
break;
default:
if (( wicones->edit->top->len < max_len || wicones->edit->top->len > 10000) && strchr( allowed_char, c))
{
char_put ( wicones->edit, c);
edit_icon_txt( win, wicones->first_selected);
}
break;
}
}
}

View File

@@ -0,0 +1,2 @@
extern void WinCatalog_Keyb( WINDOW *win);

View File

@@ -0,0 +1,570 @@
#include "../general.h"
#include "../prefs.h"
#include "../custom_font.h"
#include "catalog_icons.h"
#include "catalog_entry.h"
#include "../file/file.h"
#include "catalog.h"
/* Prototype */
void delete_mini_entry_child( Mini_Entry *entry);
void redraw_mini_entry( WINDOW *win, Mini_Entry *entry);
void draw_mini_entry( WINDOW *win, Mini_Entry *selected, Mini_Entry *entry, int16 xw, int16 yw, int16 hw);
int16 draw_mini_entry_child( WINDOW *win, Mini_Entry *selected, Mini_Entry *entry, int16 x, int16 y, int16 xw, int16 yw, int16 hw);
int find_mini_entry_child_on_mouse( WINDOW *win, Mini_Entry *entry, int16 mouse_x, int16 mouse_y);
Mini_Entry *find_mini_entry_child_by_path( Mini_Entry *parent, char *path);
Mini_Entry *find_mini_entry_by_path( WINDICON *wicones, char *path);
void calc_mini_entry_slider( WINDICON *wicones, OBJECT *slider_root);
/* extern variable */
extern int16 need_frame_slider;
/*==================================================================================*
* delete_mini_entry_child: *
* Free the memory used by all the 'child' items of a mini entry and put the *
* parent 'nbr_child' counter to zero. *
*----------------------------------------------------------------------------------*
* input: *
* entry = the entry parent. *
*----------------------------------------------------------------------------------*
* return: *
* -- *
*==================================================================================*/
void delete_mini_entry_child( Mini_Entry *entry)
{
int i;
/* if nothing to do, end the function */
if( entry->child == NULL)
return;
/* make a loop to see if the childs mini entries have child, if it's true, delete it */
for ( i = 0; i < entry->nbr_child ; i++)
{
if ( entry->child[i].nbr_child)
delete_mini_entry_child( &entry->child[i]);
}
/* Free the memory and put the counter to zero */
gfree( entry->child);
entry->child = NULL;
entry->nbr_child = 0;
}
/*==================================================================================*
* redraw_mini_entry: *
* Send a redraw event for a mini_entry in the WINDOW *win. *
*----------------------------------------------------------------------------------*
* input: *
* win = the target window *
* entry = the icon to be redraw *
*----------------------------------------------------------------------------------*
* return: *
* -- *
*==================================================================================*/
void redraw_mini_entry( WINDOW *win, Mini_Entry *entry)
{
int16 xw, yw, hw, x, y, w, h;
WindGet ( win, WF_WORKXYWH, &xw, &yw, &w, &hw);
x = entry->arrow_position.x1;
y = entry->icon_position.y1;
w = entry->icon_position.x2 - entry->icon_position.x1 + 20;
h = entry->icon_position.y2 - y + 1;
x += xw;
y += yw;
/* send the redraw event only if the mini entry is visible */
if (( y + entry->icon_position.y2 > yw) && ( y < yw + hw))
draw_page( win, x, y, MIN( w, browser_frame_width), h);
}
/*==================================================================================*
* draw_mini_entry: *
* draw a mini_entry in the WINDOW *win. *
*----------------------------------------------------------------------------------*
* input: *
* handle = the window's VDI handle. *
* selected = the mini_entry to be draw. *
* entry = pointer to the mini_entry selected. *
*----------------------------------------------------------------------------------*
* return: *
* -- *
*==================================================================================*/
void draw_mini_entry( WINDOW *win, Mini_Entry *selected, Mini_Entry *entry, int16 x, int16 y, int16 h)
{
MFDB *icon, screen = {0};
int16 xy[8], xtext, ytext;
if( ( entry->icon_position.y1 + y) < y || ( entry->icon_position.y1 + y) >= y + h)
return;
/* DRAW ARROW IS NEEDED */
if ( entry->state != UNKNOWN)
{
if ( entry->state == ON)
{
xy[0] = entry->arrow_position.x1 + x;
xy[1] = entry->arrow_position.y1 + 3 + y;
xy[2] = xy[0] + 10;
xy[3] = xy[1];
xy[4] = xy[0] + 5;
xy[5] = xy[1] + 5;
}
else
{
xy[0] = entry->arrow_position.x1 + x + 4;
xy[1] = entry->arrow_position.y1 + y;
xy[2] = xy[0];
xy[3] = xy[1] + 10;
xy[4] = xy[0] + 5;
xy[5] = xy[1] + 5;
}
vsf_color( win->graf.handle, LBLACK);
v_fillarea( win->graf.handle, 3, xy);
}
/* DRAW ICON */
if ( entry->parent)
icon = &mini_folder;
else
{
switch( entry->name[0])
{
case 'A':
case 'B':
icon = &mini_hdd;
break;
default:
icon = &mini_hdd;
break;
}
}
xy[0] = 0;
xy[1] = 0;
xy[2] = 15;
xy[3] = 15;
xy[4] = entry->icon_position.x1 + x;
xy[5] = entry->icon_position.y1 + y;
xy[6] = xy[4] + 15;
xy[7] = xy[5] + 15;
if ( icon->fd_nplanes == 1)
{
int16 color[2];
color[0] = WHITE;
color[1] = BLACK;
vrt_cpyfm( win->graf.handle, MD_REPLACE, xy, icon, &screen, color);
}
else
vro_cpyfm( win->graf.handle, S_ONLY, xy, icon, &screen);
/* DRAW TEXT */
xtext = entry->icon_position.x1 + x + 15 + x_space; /* column x position + arrow + icon + space */
ytext = entry->icon_position.y1 + y + 4; /* line x postion + 1 + (( line height - font height) / 2) */
if ( entry == selected)
{
xy[0] = xtext - 2;
xy[2] = xy[0] + entry->icon_txt_w + 4;
xy[1] = ytext - 1;
xy[3] = xy[1] + hcell + 2;
vsf_color( win->graf.handle, BLACK);
v_bar( win->graf.handle, xy);
draw_text( win->graf.handle, xtext, ytext, WHITE, entry->name);
}
else
draw_text( win->graf.handle, xtext, ytext, BLACK, entry->name);
}
/*==================================================================================*
* calc_mini_entry_line: *
* compute the number of line needed for entry's mini_entries's childs. *
*----------------------------------------------------------------------------------*
* input: *
* entry = The parent mini_entry. *
*----------------------------------------------------------------------------------*
* return: *
* number of lines needed *
*==================================================================================*/
int16 calc_mini_entry_line( Mini_Entry *entry)
{
int16 i, lines = 0;
if( entry->child == NULL)
return lines;
for ( i = 0; i < entry->nbr_child ; i++)
{
lines++;
lines += calc_mini_entry_line( &entry->child[i]);
}
return lines;
}
/*==================================================================================*
* draw_mini_entry_child: *
* draw every mini_entry's childs in the WINDOW *win. *
*----------------------------------------------------------------------------------*
* input: *
* win = the window where to draw. *
* selected = pointer to the mini_entry selected. *
* entry = The parent mini_entry. *
* x = x window's position. *
* y = y window's position. *
*----------------------------------------------------------------------------------*
* return: *
* number of lines drawn *
*==================================================================================*/
int16 draw_mini_entry_child( WINDOW *win, Mini_Entry *selected, Mini_Entry *entry, int16 x, int16 y, int16 xw, int16 yw, int16 hw)
{
int16 i, dum, lines = 0;
if( entry->child == NULL)
return lines;
for ( i = 0; i < entry->nbr_child ; i++)
{
entry->child[i].arrow_position.x1 = x + 3;
entry->child[i].arrow_position.y1 = y + 3;
entry->child[i].arrow_position.x2 = entry->child[i].arrow_position.x1 + 11;
entry->child[i].arrow_position.y2 = entry->child[i].arrow_position.y1 + 11;
entry->child[i].icon_position.x1 = x + 15;
entry->child[i].icon_position.y1 = y + 1;
entry->child[i].icon_position.x2 = entry->child[i].icon_position.x1 + 15 + x_space + entry->child[i].icon_txt_w;
entry->child[i].icon_position.y2 = entry->child[i].icon_position.y1 + 15;
draw_mini_entry( win, selected, &entry->child[i], xw, yw, hw);
lines++;
y += 18;
dum = draw_mini_entry_child( win, selected, &entry->child[i], x + 15, y, xw, yw, hw);
y += ( dum * 18);
lines += dum;
}
return lines;
}
/*==================================================================================*
* find_mini_entry_child_on_mouse: *
* Look if the mouse click is on a entry's childs or on childs's arrow. *
* If yes, open the mini_entry if the mouse is on the arrow or enter in the *
* directory seleted and send a redraw event to the main frame if is on the *
* entry itself. *
*----------------------------------------------------------------------------------*
* input: *
* win = the target window. *
* entry = the mini_entry where search for childs'entry selected. *
* mouse_x, mouse_y = the mouse position. *
*----------------------------------------------------------------------------------*
* return: *
* 1 if the mini_entry selected is found or 0. *
*==================================================================================*/
int find_mini_entry_child_on_mouse( WINDOW *win, Mini_Entry *entry, int16 mouse_x, int16 mouse_y)
{
int i;
if( entry->child == NULL)
return( 0);
for ( i = 0; i < entry->nbr_child ; i++)
{
if ( entry->child[i].nbr_child > 0)
if ( find_mini_entry_child_on_mouse( win, &entry->child[i], mouse_x, mouse_y))
return ( 1);
if (( mouse_x >= entry->child[i].icon_position.x1 && mouse_x <= entry->child[i].icon_position.x2 && mouse_y >= entry->child[i].icon_position.y1 && mouse_y <= entry->child[i].icon_position.y2))
{
WINDICON *wicones = ( WINDICON *)DataSearch( win, WD_ICON);
if ( wicones->mini_selected != &entry->child[i])
{
Mini_Entry *old_selected = wicones->mini_selected;
wicones->mini_selected = &entry->child[i];
if ( old_selected)
redraw_mini_entry( win, old_selected);
redraw_mini_entry( win, wicones->mini_selected);
if ( strcmp ( wicones->mini_selected->foldername, wicones->directory) != 0)
{
int16 x, y, w, h;
if ( wicones->first_selected)
{
while ( wicones->first_selected)
remove_selected_entry( wicones, wicones->first_selected);
}
graf_mouse( BUSYBEE, NULL);
( void)scan_dir( win, wicones->mini_selected->foldername);
WindSetStr ( win, WF_NAME, wicones->directory);
wicones->first_selected = NULL;
win->ypos = 0;
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
draw_page( win, x + browser_frame_width, y, w - browser_frame_width, h);
graf_mouse( ARROW, NULL);
WindMakePreview( win);
}
}
return( 1);
}
else if ( entry->child[i].state != UNKNOWN)
{
if (( mouse_x >= entry->child[i].arrow_position.x1 && mouse_x <= entry->child[i].arrow_position.x2 && mouse_y >= entry->child[i].arrow_position.y1 && mouse_y <= entry->child[i].arrow_position.y2))
{
int16 x, y, h, w;
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
if ( entry->child[i].state == ON)
{
entry->child[i].state = OFF;
delete_mini_entry_child( &entry->child[i]);
}
else
{
Mini_Entry *selected = &entry->child[i];
graf_mouse( BUSYBEE, NULL);
selected->state = ON;
scan_mini_dir( win, selected);
check_mini_dir( selected->nbr_child, selected->child);
graf_mouse( ARROW, NULL);
}
WinCatalog_Refresh( win);
draw_page( win, x, y, browser_frame_width, h);
return( 1);
}
}
}
return( 0);
}
/*==================================================================================*
* find_mini_entry_child_by_path: *
* find a child mini_entry in parent and return it. *
*----------------------------------------------------------------------------------*
* input: *
* parent = the parent where to search. *
* path = the path of the mini_entry wanted. *
*----------------------------------------------------------------------------------*
* return: *
* A pointer to the mini_entry if found else NULL. *
*==================================================================================*/
Mini_Entry *find_mini_entry_child_by_path( Mini_Entry *parent, char *path)
{
int i;
Mini_Entry *entry = NULL;
if( parent->child == NULL)
return NULL;
/* make a loop to see if the childs mini entries have child, if it's true, check it */
for ( i = 0; i < parent->nbr_child ; i++)
{
if ( parent->child[i].nbr_child)
{
if ( ( entry = find_mini_entry_child_by_path( &parent->child[i], path)))
return entry;
}
if ( strcmp ( parent->child[i].foldername, path) == 0)
return &parent->child[i];
}
return NULL;
}
/*==================================================================================*
* find_mini_entry_by_path: *
* find a mini_entry and return it. *
*----------------------------------------------------------------------------------*
* input: *
* wicones = the WINDICON struct where to search. *
* path = the path of the mini_entry wanted. *
*----------------------------------------------------------------------------------*
* return: *
* A pointer to the mini_entry if found else NULL. *
*==================================================================================*/
Mini_Entry *find_mini_entry_by_path( WINDICON *wicones, char *path)
{
Mini_Entry *entry = NULL;
int16 i;
for ( i = 0; i < wicones->nbr_child; i++)
{
if ( wicones->root[i].nbr_child)
{
if ( ( entry = find_mini_entry_child_by_path( &wicones->root[i], path)))
return entry;
}
if ( strcmp ( wicones->root[i].foldername, path) == 0)
return &wicones->root[i];
}
return NULL;
}
/*==================================================================================*
* recalc_mini_entry_child_txt_width: *
* static function called by recalc_mini_entry_txt_width() *
*----------------------------------------------------------------------------------*
* input: *
* wicones = the WINDICON struct where to search. *
*----------------------------------------------------------------------------------*
* return: *
* -- *
*==================================================================================*/
static void recalc_mini_entry_child_txt_width( Mini_Entry *parent)
{
int i;
if( parent->child == NULL)
return;
/* make a loop to see if the childs mini entries have child, if it's true, make the job */
for ( i = 0; i < parent->nbr_child; i++)
{
if ( parent->child[i].nbr_child)
recalc_mini_entry_child_txt_width( &parent->child[i]);
parent->child[i].icon_txt_w = get_text_width( parent->child[i].name);
parent->child[i].icon_position.x2 = parent->child[i].icon_position.x1 + 15 + x_space + parent->child[i].icon_txt_w;
}
}
/*==================================================================================*
* recalc_mini_entry_txt_width: *
* After a font change, we need to recalc the mini_entry text width. *
* This function do it. *
*----------------------------------------------------------------------------------*
* input: *
* wicones = the WINDICON struct where to search. *
*----------------------------------------------------------------------------------*
* return: *
* -- *
*==================================================================================*/
void recalc_mini_entry_txt_width( WINDICON *wicones)
{
int16 i;
for ( i = 0; i < wicones->nbr_child; i++)
{
if ( wicones->root[i].nbr_child)
recalc_mini_entry_child_txt_width( &wicones->root[i]);
wicones->root[i].icon_txt_w = get_text_width( wicones->root[i].name);
wicones->root[i].icon_position.x2 = wicones->root[i].icon_position.x1 + 15 + x_space + wicones->root[i].icon_txt_w;
}
}
/*==================================================================================*
* calc_mini_entry_slider: *
* compute the frame slider size and coordinate. *
*----------------------------------------------------------------------------------*
* input: *
* wicones = the target WINDICON struct. *
* slider_root = the parent slider OBJECT. *
*----------------------------------------------------------------------------------*
* return: *
* -- *
*==================================================================================*/
void calc_mini_entry_slider( WINDICON *wicones, OBJECT *slider_root)
{
int16 max_mover_size = slider_root[SLIDERS_BACK].ob_height;
int16 full_win_size = wicones->ypos_max * wicones->h_u;
int16 win_h = slider_root->ob_height + 3;
if ( win_h >= full_win_size)
{
wicones -> ypos = 0;
slider_root[SLIDERS_MOVER].ob_y = 0;
slider_root[SLIDERS_MOVER].ob_height = max_mover_size;
}
else
{
int16 ligne_reste;
float mover_position = 0L;
float position_step = 0L;
float mover_size = MAX( ( float)max_mover_size * ( ( float)win_h / ( float)full_win_size), 10L);
if( wicones->ypos)
{
ligne_reste = wicones->ypos_max - ( win_h / wicones->h_u);
position_step = (( float)max_mover_size - mover_size) / ( float)ligne_reste;
mover_position = position_step * ( float)wicones->ypos;
while( (( int16)mover_size + ( int16)mover_position > max_mover_size) && wicones->ypos > 0)
{
wicones->ypos--;
mover_position -= position_step;
}
}
slider_root[SLIDERS_MOVER].ob_height = ( int16)mover_size;
slider_root[SLIDERS_MOVER].ob_y = ( int16)mover_position;
}
}

View File

@@ -0,0 +1,10 @@
extern void delete_mini_entry_child( Mini_Entry *entry);
extern int find_mini_entry_child_on_mouse( WINDOW *win, Mini_Entry *entry, int16 mouse_x, int16 mouse_y);
extern void redraw_mini_entry( WINDOW *win, Mini_Entry *entry);
extern void draw_mini_entry( WINDOW *win, Mini_Entry *selected, Mini_Entry *entry, int16 x, int16 y, int16 h);
extern int16 draw_mini_entry_child( WINDOW *win, Mini_Entry *selected, Mini_Entry *entry, int16 x, int16 y, int16 xw, int16 yw, int16 hw);
extern Mini_Entry *find_mini_entry_by_path( WINDICON *wicones, char *path);
extern Mini_Entry *find_mini_entry_child_by_path( Mini_Entry *parent, char *path);
extern void calc_mini_entry_slider( WINDICON *wicones, OBJECT *slider_root);
extern int16 calc_mini_entry_line( Mini_Entry *entry);
extern void recalc_mini_entry_txt_width( WINDICON *wicones);

View File

@@ -0,0 +1,527 @@
#include "../general.h"
#include "../ztext.h"
#include "catalog_entry.h"
#include "catalog_mini_entry.h"
#include "../prefs.h"
#include "../infobox.h"
#include "../pic_load.h"
#include "../winimg.h"
#include "../zedit/zedit.h"
#include "../file/file.h"
#include "catalog.h"
#include "catalog_icons.h"
#include "catalog_slider.h"
#include "catalog_popup.h"
/* Local variable */
static int16 dum;
extern char fullname[MAX_PATH+MAXNAMLEN];
/* Prototype */
void WinCatalog_Mouse( WINDOW *win);
/*==================================================================================*
* void WinCatalog_Mouse: *
* this function handle the mouse event for the main frame in the *
* catalog ( the entries). *
*----------------------------------------------------------------------------------*
* input: *
* win -> The window to handle. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_Mouse( WINDOW *win)
{
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
GRECT mouse;
int16 x, y, w, h, old_x, old_entry = 0, old_y, i = 0, nb_click, in_txt = 0, in_icn = 0, in_frame_border = 0, in_browser = 0;
Entry *entry_ptr = NULL, *old_selected = wicones->first_selected;
EntryType old_type = ET_FILE;
if( old_selected)
{
old_entry = 1;
old_type = old_selected->type;
}
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
mouse.g_x = evnt.mx - x;
mouse.g_y = evnt.my - y;
old_x = evnt.mx;
old_y = evnt.my;
nb_click = evnt.nb_click;
if ( browser_frame_width && ( mouse.g_x >= wicones->border_position[0] && mouse.g_x <= wicones->border_position[1]))
{ /* mouse on frame border */
in_frame_border = 1;
}
else if ( browser_frame_width && ( mouse.g_x < wicones->border_position[0]))
{ /* mouse on browser */
in_browser = 1;
}
else
{
for ( i = 0 ; i < wicones->nbr_icons ; i++) /* Check if the mouse is over a icon */
{
/* mouse on text */
if (( mouse.g_x >= wicones->entry[i].txt_pos.x1 && mouse.g_x <= wicones->entry[i].txt_pos.x2 && mouse.g_y >= wicones->entry[i].txt_pos.y1 && mouse.g_y <= wicones->entry[i].txt_pos.y2))
{
in_txt = 1;
break;
}
/* click on case to select */
else if (( mouse.g_x >= wicones->entry[i].case_pos.x1 && mouse.g_x <= wicones->entry[i].case_pos.x2 && mouse.g_y >= wicones->entry[i].case_pos.y1 && mouse.g_y <= wicones->entry[i].case_pos.y2))
{
in_icn = 1;
break;
}
}
}
if(( evnt.mkstate & ( K_LSHIFT|K_RSHIFT)))
{
if( wicones->edit)
exit_edit_mode( win, old_selected);
/* If no icon or text icon are selected, we return */
if( in_icn || in_txt)
{
if( !check_selected_entry( wicones, &wicones->entry[i]))
add_selected_entry( wicones, &wicones->entry[i]);
else
remove_selected_entry( wicones, &wicones->entry[i]);
redraw_icon( win, &wicones->entry[i]);
}
}
else if( in_icn)
{
if( wicones->edit)
exit_edit_mode( win, old_selected);
if( wicones->first_selected)
{
while( wicones->first_selected->next_selected)
{
entry_ptr = wicones->first_selected->next_selected;
remove_selected_entry( wicones, wicones->first_selected->next_selected);
redraw_icon( win, entry_ptr);
}
}
wicones->first_selected = &wicones->entry[i];
if( old_selected != wicones->first_selected)
{
if( old_selected)
redraw_icon( win, old_selected);
redraw_icon( win, wicones->first_selected);
}
/*
graf_mkstate( &evnt.mx, &evnt.my, &evnt.mbut, &evnt.mkstate);
if (( evnt.mbut == 1) && ( ( evnt.mx != old_x) || ( evnt.my != old_y)))
move_icon( win, wicones);
*/
if ( nb_click == 2 && evnt.mbut == 1)
{
if ( wicones->first_selected->type == ET_DIR)
{
Mini_Entry *old_selected_mini_entry = wicones->mini_selected;
wicones->mini_selected = NULL;
if ( old_selected_mini_entry && browser_frame_width)
redraw_mini_entry( win, old_selected_mini_entry);
strcat( wicones->directory, wicones->entry[i].name);
( void)scan_dir( win, wicones->directory);
WindSetStr ( win, WF_NAME, wicones->directory);
wicones->first_selected = NULL;
win->ypos = 0;
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
WindMakePreview( win);
}
else if ( ( wicones->first_selected->type == ET_IMAGE && wicones->first_selected->preview.page) || wicones->first_selected->type == ET_PDF)
{
strcpy( fullname, wicones->directory);
strcat( fullname, wicones->first_selected->name);
WindView( fullname);
// WindView( wicones->first_selected->name);
}
}
else if( evnt.mbut == 2)
{
WinCatalog_Popup( win, wicones);
}
}
else if( in_txt)
{
if( wicones->first_selected)
{
while( wicones->first_selected->next_selected)
{
entry_ptr = wicones->first_selected->next_selected;
remove_selected_entry( wicones, wicones->first_selected->next_selected);
redraw_icon( win, entry_ptr);
}
}
wicones->first_selected = &wicones->entry[i];
if( old_selected != wicones->first_selected)
{
if( old_selected)
{
if( wicones->edit)
exit_edit_mode( win, old_selected);
else
redraw_icon( win, old_selected);
}
redraw_icon( win, wicones->first_selected);
}
else if( !wicones->edit)
init_edit_mode( win, wicones->first_selected);
}
else if ( in_frame_border && evnt.mbut == 1)
{
int16 last_mouse_x;
if ( wicones->edit)
exit_edit_mode( win, old_selected);
graf_mouse( FLAT_HAND, NULL);
while( !wind_update( BEG_MCTRL));
graf_dragbox( border_size, h, x + browser_frame_width, y, x + 100, y, w - ( 100 + win -> w_u), h, &last_mouse_x, &dum );
/* Set the new toolbar position */
if ( last_mouse_x != x + browser_frame_width)
{
int16 ww;
if ( last_mouse_x < x + 100)
browser_frame_width = 100;
else if ( last_mouse_x > x + ( w - win -> w_u))
browser_frame_width = w - win -> w_u;
else
browser_frame_width = last_mouse_x - x;
/* Set new minimum value */
WindCalc( WC_BORDER, win, 0, 0, wicones->case_w + border_size + browser_frame_width, wicones->case_h, &dum, &dum, &ww, &dum);
win -> w_min = ww;
/* ensure that the ypos is inferior that it maximum size */
WinCatalog_Refresh( win);
i = 0;
while ( i < win -> ypos_max - h / win -> h_u)
i ++;
if( win -> ypos > i)
win -> ypos = i;
EvntRedraw( win);
WindMakePreview( win);
}
wind_update( END_MCTRL);
graf_mouse( ARROW, NULL);
}
else if ( in_browser)
{
if ( wicones->edit)
exit_edit_mode( win, old_selected);
if( need_frame_slider && ( mouse.g_x > browser_frame_width - 15) && ( mouse.g_x < browser_frame_width))
{
int16 res;
frame_slider_root->ob_x = x + browser_frame_width - 15;
frame_slider_root->ob_y = y + 2;
res = objc_find( frame_slider_root, SLIDERS_BOX, 2, evnt.mx, evnt.my);
if( res != -1)
{
int32 pos, old_ypos = wicones->ypos;
int16 dy, selected_object, page, redraw_arrow_slider = 0;
switch ( res)
{
case SLIDERS_UP:
if( wicones -> ypos > 0L)
ObjcWindChange( win, frame_slider_root, SLIDERS_UP, frame_slider_root->ob_x, frame_slider_root[SLIDERS_UP].ob_y + y, frame_slider_root[SLIDERS_UP].ob_width + 1, frame_slider_root[SLIDERS_UP].ob_height + 1, SELECTED);
do
{
if ( wicones -> ypos > 0L)
{
wicones -> ypos--;
move_frame_work( win, -wicones->h_u);
redraw_arrow_slider = 1;
}
graf_mkstate( &dum, &dum, &res, &dum);
} while( res);
if( redraw_arrow_slider)
{
/* We don't call ObjcWindChange to change the up arrow state because it seem not work with userdraw object
ObjcWindChange( win, frame_slider_root, SLIDERS_UP, frame_slider_root->ob_x, frame_slider_root[SLIDERS_UP].ob_y + y, frame_slider_root->ob_width, frame_slider_root->ob_height, ~SELECTED); */
frame_slider_root[SLIDERS_UP].ob_state &= ~SELECTED;
ObjcWindDraw( win, frame_slider_root, SLIDERS_UP, 1, frame_slider_root->ob_x, frame_slider_root[SLIDERS_UP].ob_y + y, frame_slider_root[SLIDERS_UP].ob_width + 1, frame_slider_root[SLIDERS_UP].ob_height + 1);
}
break;
case SLIDERS_DOWN:
do
{
if (( wicones -> ypos < wicones -> ypos_max - h / wicones -> h_u) && ( wicones -> ypos_max > h / wicones -> h_u ))
{
if( redraw_arrow_slider == 0)
ObjcWindChange( win, frame_slider_root, SLIDERS_DOWN, frame_slider_root->ob_x, frame_slider_root[SLIDERS_DOWN].ob_y + y, frame_slider_root[SLIDERS_DOWN].ob_width + 1, frame_slider_root[SLIDERS_DOWN].ob_height + 1, SELECTED);
wicones -> ypos++;
move_frame_work( win, wicones->h_u);
redraw_arrow_slider = 1;
}
graf_mkstate( &dum, &dum, &res, &dum);
} while( res);
if( redraw_arrow_slider)
{
/* We don't call ObjcWindChange to change the up arrow state because it seem not work with userdraw object */
frame_slider_root[SLIDERS_DOWN].ob_state &= ~SELECTED;
ObjcWindDraw( win, frame_slider_root, SLIDERS_DOWN, 1, frame_slider_root->ob_x, frame_slider_root[SLIDERS_DOWN].ob_y + y, frame_slider_root[SLIDERS_DOWN].ob_width + 1, frame_slider_root[SLIDERS_DOWN].ob_height + 1);
}
break;
case SLIDERS_MOVER:
if( app.aes4 & AES4_XGMOUSE)
graf_mouse( M_SAVE, 0L);
graf_mouse( FLAT_HAND, NULL);
while( !wind_update( BEG_MCTRL));
res = graf_slidebox( frame_slider_root, SLIDERS_BACK, SLIDERS_MOVER, 1);
wind_update( END_MCTRL);
pos = ( int32)( wicones->ypos_max - h / wicones->h_u) * res / 1000L;
if ( pos < 0)
pos = 0;
dy = ( int16)(( pos - wicones->ypos) * wicones->h_u);
wicones->ypos = pos;
if( dy && ( old_ypos != wicones->ypos))
move_frame_work( win, dy);
if( app.aes4 & AES4_XGMOUSE)
graf_mouse( M_RESTORE, 0L);
graf_mouse( ARROW,NULL);
break;
case SLIDERS_BACK:
objc_offset( frame_slider_root, SLIDERS_MOVER, &dum, &dy);
dum = ( evnt.my < dy) ? WA_UPPAGE : WA_DNPAGE;
selected_object = ( evnt.my < dy) ? SLIDERS_UP : SLIDERS_DOWN;
while( !wind_update( BEG_MCTRL));
frame_slider_root[selected_object].ob_state |= SELECTED;
if( dum == WA_DNPAGE)
{
do
{
page = h / wicones -> h_u;
if ( wicones -> ypos < wicones -> ypos_max - page)
{
wicones -> ypos = MIN( wicones->ypos_max, wicones->ypos) + page;
wicones -> ypos = MIN( wicones -> ypos, wicones -> ypos_max - page);
dy = ( int16) (( wicones->ypos - old_ypos) * wicones->h_u);
move_frame_work( win, dy);
}
graf_mkstate( &dum, &dum, &res, &dum);
} while( res);
}
else
{
do
{
if ( wicones -> ypos > 0L)
{
pos = MAX( 0L, wicones->ypos - h / wicones->h_u);
dy = ( int16) (( pos - wicones->ypos) * wicones->h_u);
wicones->ypos = pos;
move_frame_work( win, dy);
}
graf_mkstate( &dum, &dum, &res, &dum);
} while( res);
}
frame_slider_root[selected_object].ob_state &= ~SELECTED;
ObjcWindDraw( win, frame_slider_root, selected_object, 1, x, y, w, h);
wind_update( END_MCTRL);
break;
default:
break;
}
}
}
else
{
for ( i = 0; i < wicones->nbr_child; i++)
{
if ( wicones->root[i].nbr_child > 0)
if ( find_mini_entry_child_on_mouse( win, &wicones->root[i], mouse.g_x, mouse.g_y))
break;
if (( mouse.g_x >= wicones->root[i].icon_position.x1 && mouse.g_x <= wicones->root[i].icon_position.x2 && mouse.g_y >= wicones->root[i].icon_position.y1 && mouse.g_y <= wicones->root[i].icon_position.y2))
{
if ( wicones->mini_selected != &wicones->root[i])
{
Mini_Entry *old_selected_mini_entry = wicones->mini_selected;
wicones->mini_selected = &wicones->root[i];
if ( old_selected_mini_entry)
redraw_mini_entry( win, old_selected_mini_entry);
redraw_mini_entry( win, wicones->mini_selected);
if ( strcmp ( wicones->mini_selected->foldername, wicones->directory) != 0)
{
while ( wicones->first_selected)
remove_selected_entry( wicones, wicones->first_selected);
graf_mouse( BUSYBEE, NULL);
( void)scan_dir( win, wicones->mini_selected->foldername);
WindSetStr ( win, WF_NAME, wicones->directory);
wicones->first_selected = NULL;
win->ypos = 0;
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
graf_mouse( ARROW, NULL);
WindMakePreview( win);
}
}
break;
}
else if ( wicones->root[i].state != UNKNOWN)
{
if (( mouse.g_x >= wicones->root[i].arrow_position.x1 && mouse.g_x <= wicones->root[i].arrow_position.x2 && mouse.g_y >= wicones->root[i].arrow_position.y1 && mouse.g_y <= wicones->root[i].arrow_position.y2))
{
if ( wicones->root[i].state == ON)
{
wicones->root[i].state = OFF;
delete_mini_entry_child( &wicones->root[i]);
}
else
{
Mini_Entry *selected = &wicones->root[i];
graf_mouse( BUSYBEE, NULL);
selected->state = ON;
scan_mini_dir( win, selected);
check_mini_dir( selected->nbr_child, selected->child);
graf_mouse( ARROW, NULL);
}
WinCatalog_Refresh( win);
draw_page( win, x, y , browser_frame_width, h);
break;
}
}
}
}
}
else if ( !in_txt && !in_icn && !in_browser && !in_frame_border)
{
if ( wicones->edit)
exit_edit_mode( win, old_selected);
while( wicones->first_selected)
{
entry_ptr = wicones->first_selected;
remove_selected_entry( wicones, wicones->first_selected);
redraw_icon( win, entry_ptr);
}
}
if( !( wicones->first_selected))
{
menu_ienable( get_tree( MENU_BAR), MENU_BAR_INFORMATION, 0);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_SAVE, 0);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_DELETE, 0);
if( old_entry)
{
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_DELETE, 1);
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_INFO, 1);
if( old_type == ET_IMAGE)
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_SAVE, 1);
}
}
else
{
if( wicones->first_selected->type == ET_IMAGE)
menu_ienable( get_tree( MENU_BAR), MENU_BAR_SAVE, 1);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_DELETE, 1);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_INFORMATION, 1);
if( !old_entry)
{
if( wicones->first_selected->type == ET_IMAGE)
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_SAVE, 1);
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_DELETE, 1);
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_INFO, 1);
}
else if(( wicones->first_selected->type != old_type) && ( wicones->first_selected->type == ET_IMAGE || old_type == ET_IMAGE))
ObjcDraw( OC_TOOLBAR, win, TOOLBAR_SAVE, 1);
}
/* a wait loop while the mouse button is pressed */
while(( evnt.mbut == 1) || ( evnt.mbut == 2))
graf_mkstate( &evnt.mx, &evnt.my, &evnt.mbut, &evnt.mkstate);
}

View File

@@ -0,0 +1,2 @@
extern void WinCatalog_Mouse( WINDOW *win) ;

View File

@@ -0,0 +1,103 @@
#include "../general.h"
#include "catalog.h"
#include "../prefs.h"
/* Prototype */
void WinCatalog_Fulled( WINDOW *win);
void WinCatalog_top( WINDOW *win);
void WinCatalog_bottom( WINDOW *win);
/*==================================================================================*
* void WinCatalog_Fulled: *
* this function handle the WM_FULLED event for the main frame in the *
* catalog ( the entries). *
*----------------------------------------------------------------------------------*
* input: *
* win -> The target window. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_Fulled( WINDOW *win)
{
int16 x, y, w, h;
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
if( win->status & WS_FULLSIZE)
{
wind_get( evnt.buff[3], WF_PREVXYWH, &x, &y, &w, &h);
wind_set( evnt.buff[3], WF_CURRXYWH, x, y, w, h);
} else
wind_set( evnt.buff[3], WF_CURRXYWH, app.x, app.y, win->w_max, win->h_max);
win->status ^= WS_FULLSIZE;
win -> ypos = 0;
wicones -> ypos = 0;
WindSlider( win, VSLIDER);
WindGet ( win, WF_WORKXYWH, &x, &y, &w, &h);
draw_page( win, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
WindMakePreview( win);
}
/*==================================================================================*
* void WinCatalog_top: *
* this function handle the WM_TOPPED event for the main frame in the *
* catalog ( the entries). *
*----------------------------------------------------------------------------------*
* input: *
* win -> The target window. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_top( WINDOW *win)
{
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
OBJECT *menu = get_tree( MENU_BAR);
if( !wicones->first_selected)
{
menu_ienable( menu, MENU_BAR_INFORMATION, 0);
menu_ienable( menu, MENU_BAR_SAVE, 0);
menu_ienable( menu, MENU_BAR_DELETE, 0);
}
else
{
if( wicones->first_selected->type == ET_IMAGE)
menu_ienable( menu, MENU_BAR_SAVE, 1);
menu_ienable( menu, MENU_BAR_DELETE, 1);
menu_ienable( menu, MENU_BAR_INFORMATION, 1);
}
menu_ienable( menu, MENU_BAR_SHOW_FULLSCREEN, 0);
}
/*==================================================================================*
* void WinCatalog_bottom: *
* this function handle the WM_BOTTOMED event for the main frame in the *
* catalog ( the entries). *
*----------------------------------------------------------------------------------*
* input: *
* win -> The target window. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_bottom( WINDOW *win)
{
win = win; // for prevent compiler warning
menu_ienable( get_tree( MENU_BAR), MENU_BAR_INFORMATION, 0);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_SAVE, 0);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_DELETE, 0);
}

View File

@@ -0,0 +1,5 @@
extern void WinCatalog_Fulled( WINDOW *win);
extern void WinCatalog_top( WINDOW *win);
extern void WinCatalog_bottom( WINDOW *win);

View File

@@ -0,0 +1,23 @@
#include "../general.h"
#include "../ztext.h"
#include "../mfdb.h"
#include "catalog_entry.h"
#include "../plugins.h"
/*==================================================================================*
* void WinCatalog_Popup: *
* . *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_Popup( WINDOW *win, WINDICON *wicones)
{
}

View File

@@ -0,0 +1 @@
extern void WinCatalog_Popup( WINDOW *win, WINDICON *wicones);

View File

@@ -0,0 +1,108 @@
#include "../general.h"
#include "../prefs.h"
#include "catalog_mini_entry.h"
#include "catalog.h"
/* Prototype */
void WinCatalog_Size( WINDOW *win);
/*==================================================================================*
* void WinCatalog_Size: *
* this function handle the WM_SIZED event for the main frame in the *
* catalog ( the entries). *
*----------------------------------------------------------------------------------*
* input: *
* win -> The target window. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_Size( WINDOW *win)
{
int16 dum, x, y, w, h, old_h, rdw_win = 0, rdw_frame = 0;
uint32 old_win_ypos, old_frame_ypos;
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
x = MAX( evnt.buff[6], win -> w_min);
y = MAX( evnt.buff[7], win -> h_min);
w = MIN( x, win -> w_max);
h = MIN( y, win -> h_max);
WindGet( win, WF_WORKXYWH, &dum, &dum, &dum, &old_h);
wind_set( evnt.buff[3], WF_CURRXYWH, evnt.buff[4], evnt.buff[5], w, h);
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
old_win_ypos = win -> ypos;
old_frame_ypos = wicones -> ypos;
if( ( uint16)h > wicones -> ypos_max * wicones -> h_u)
wicones -> ypos = 0;
else
wicones -> ypos = MIN( wicones -> ypos, wicones -> ypos_max - h / wicones -> h_u);
if( ( uint16)h > win -> ypos_max * win -> h_u)
win -> ypos = 0;
else
win -> ypos = MIN( win -> ypos, win -> ypos_max - h / win -> h_u);
if( old_frame_ypos != wicones -> ypos)
{
rdw_frame = 1;
}
if( old_win_ypos != win -> ypos)
{
rdw_win = 1;
}
else if ( w >= (( wicones->columns + 1) * wicones->case_w + border_size + browser_frame_width) || w < wicones->columns * wicones->case_w + border_size + browser_frame_width)
{
if ( w < (( wicones->nbr_icons + 1) * wicones->case_w + border_size + browser_frame_width))
rdw_win = 1;
}
win->status &= ~WS_FULLSIZE;
if( rdw_win)
{
draw_page( win, x + browser_frame_width + border_size , y + 1, w - ( browser_frame_width + border_size), h - 1);
WindMakePreview( win);
}
else if( ( old_h != h) && browser_frame_width)
{
if( rdw_frame)
draw_page( win, x, y + 1, browser_frame_width, h - 1);
else if( ( wicones -> ypos_max * wicones -> h_u) >= h)
{
need_frame_slider = 1;
frame_slider_root->ob_x = x + browser_frame_width - 15;
frame_slider_root->ob_y = y + 2;
frame_slider_root->ob_height = h - 3;
frame_slider_root[SLIDERS_BACK].ob_height = h - 31;
frame_slider_root[SLIDERS_UP].ob_y = frame_slider_root->ob_height - 31;
frame_slider_root[SLIDERS_DOWN].ob_y = frame_slider_root->ob_height - 15;
calc_mini_entry_slider( wicones, frame_slider_root);
/* check it in the windom source, I'm not sure if the clipping area must be clip.g_x, clip.g_y, clip.g_w, clip.g_h or not */
ObjcWindDraw( win, frame_slider_root, SLIDERS_BOX, 2, x + browser_frame_width - 15, y, 16, h);
WindSlider( win, VSLIDER);
}
else /* if( need_frame_slider) */
{
need_frame_slider = 0;
draw_page( win, x + browser_frame_width - 16 , y + 1, 16, h - 1);
}
}
else if( old_h != h)
{
WindSlider( win, VSLIDER);
}
}

View File

@@ -0,0 +1,2 @@
extern void WinCatalog_Size( WINDOW *win);

View File

@@ -0,0 +1,463 @@
#include "../general.h"
#include "../prefs.h"
#include "catalog_mini_entry.h"
#include "catalog.h"
/* prototype */
void WinCatalog_Arrow( WINDOW *win);
void WinCatalog_VSlide( WINDOW *win);
void WinCatalog_DownLine( WINDOW *win);
void WinCatalog_UpLine( WINDOW *win);
void WinCatalog_DownPage( WINDOW *win);
void WinCatalog_UpPage( WINDOW *win);
void move_area( int16 handle, GRECT *screen, int16 dx, int16 dy);
void move_main_work( WINDOW *win, int16 xw, int16 yw, int16 ww, int16 hw, int16 dx, int16 dy, int16 first_frame_width, int16 border_width);
void move_frame_work( WINDOW *win, int16 dy);
/*==================================================================================*
* void move_area: *
* utility function for the move_*_work functions. *
*----------------------------------------------------------------------------------*
* input: *
* handle -> The vdi handle. *
* screen -> The area coordinate to move. *
* dy -> The step for the move. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void move_area( int16 handle, GRECT *screen, int16 dx, int16 dy)
{
int16 xy[8];
MFDB screen_mfdb = {0};
GRECT g;
wind_get( 0, WF_CURRXYWH, &g.g_x, &g.g_y, &g.g_w, &g.g_h);
rc_intersect( &g, screen);
xy[0] = screen -> g_x;
xy[1] = screen -> g_y;
xy[2] = xy[0] + screen -> g_w - 1;
xy[3] = xy[1] + screen -> g_h - 1;
xy[4] = xy[0] + dx;
xy[5] = xy[1] + dy;
xy[6] = xy[2] + dx;
xy[7] = xy[3] + dy;
vro_cpyfm( handle, S_ONLY, xy, &screen_mfdb, &screen_mfdb);
}
/*==================================================================================*
* void move_work: *
* this function moves the main frame ( entries) work area of the window. *
*----------------------------------------------------------------------------------*
* input: *
* win -> The target window. *
* dy -> The step for the move. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void move_main_work( WINDOW *win, int16 xw, int16 yw, int16 ww, int16 hw, int16 dx, int16 dy, int16 first_frame_width, int16 border_width)
{
int16 x = xw, y = yw + 1, w = ww, h = hw - 1, absolute_dy, absolute_dx;
GRECT rect, r1, r2, screen;
absolute_dy = abs( dy);
absolute_dx = abs( dx);
if ( dx || dy)
{
x += ( first_frame_width + border_width);
w -= ( first_frame_width + border_width);
while( !wind_update(BEG_UPDATE));
graf_mouse( M_OFF, 0L);
rc_set( &rect, x, y, w, h);
wind_get_grect( 0, WF_CURRXYWH, &screen);
wind_get( win -> handle, WF_FIRSTXYWH, &r1.g_x, &r1.g_y, &r1.g_w, &r1.g_h);
while ( r1.g_w && r1.g_h)
{
if( rc_intersect( &rect, &r1) && rc_intersect( &screen, &r1))
{
if ( ( absolute_dx < r1.g_w) && ( absolute_dy < r1.g_h))
{
r2 = r1; /* save */
if ( dy > 0)
{
r1.g_y += dy;
r1.g_h -= dy;
}
else
r1.g_h += dy;
if (dx > 0)
{
r1.g_x += dx;
r1.g_w -= dx;
}
else
r1.g_w += dx;
move_area( win->graf.handle, &r1, -dx, -dy);
if (dx)
{
r1 = r2 ; /* restore */
if (dx > 0)
{
r1.g_x += r1.g_w - dx;
r1.g_w = dx;
}
else
r1.g_w = - dx;
if (dy > 0)
r1.g_h -= dy;
else
{
r1.g_y -= dy;
r1.g_h += dy;
}
rc_clip_on( win->graf.handle, &r1);
EvntExec( win, WM_REDRAW);
rc_clip_off( win->graf.handle);
}
if ( dy)
{
r1 = r2 ; /* restore */
if (dy > 0)
{
r1.g_y += r1.g_h - dy;
r1.g_h = dy;
}
else
r1.g_h = -dy;
rc_clip_on( win->graf.handle, &r1);
EvntExec( win, WM_REDRAW);
rc_clip_off( win->graf.handle);
}
}
else
{
rc_clip_on( win->graf.handle, &r1);
EvntExec( win, WM_REDRAW);
rc_clip_off( win->graf.handle);
}
}
wind_get( win->handle, WF_NEXTXYWH, &r1.g_x, &r1.g_y, &r1.g_w, &r1.g_h);
}
graf_mouse( M_ON, 0L);
wind_update(END_UPDATE);
if ( dy)
WindSlider( win, VSLIDER);
if ( dx)
WindSlider( win, HSLIDER);
}
}
/*==================================================================================*
* void move_frame_work: *
* this function moves the mini_entry frame work area of the window. *
*----------------------------------------------------------------------------------*
* input: *
* win -> The target window. *
* dy -> The step fo the move. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void move_frame_work( WINDOW *win, int16 dy)
{
int16 x, y, w, h, absolute_dy;
GRECT rect, r1, r2, screen;
absolute_dy = abs( dy);
if ( dy)
{
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
y++;
h--;
w = browser_frame_width - 16;
while( !wind_update(BEG_UPDATE));
graf_mouse( M_OFF, 0L);
rc_set( &rect, x + 1, y, w, h);
wind_get_grect( 0, WF_CURRXYWH, &screen);
wind_get( win -> handle, WF_FIRSTXYWH, &r1.g_x, &r1.g_y, &r1.g_w, &r1.g_h);
while ( r1.g_w && r1.g_h)
{
if( rc_intersect( &rect, &r1) && rc_intersect( &screen, &r1))
{
if ( ( absolute_dy < r1.g_h) )
{
r2 = r1; /* save */
if ( dy > 0)
{
r1.g_y += dy;
r1.g_h -= dy;
}
else
r1.g_h += dy;
move_area( win->graf.handle, &r1, 0, -dy);
if ( dy)
{
r1 = r2 ; /* restore */
if (dy > 0)
{
r1.g_y += r1.g_h - dy;
r1.g_h = dy;
}
else
r1.g_h = -dy;
rc_clip_on( win->graf.handle, &r1);
EvntExec( win, WM_REDRAW);
rc_clip_off( win->graf.handle);
}
}
else
{
rc_clip_on( win->graf.handle, &r1);
EvntExec( win, WM_REDRAW);
rc_clip_off( win->graf.handle);
}
}
wind_get( win->handle, WF_NEXTXYWH, &r1.g_x, &r1.g_y, &r1.g_w, &r1.g_h);
}
wind_update(END_UPDATE);
graf_mouse( M_ON, 0L);
if ( dy)
{
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
need_frame_slider = 1;
calc_mini_entry_slider( wicones, frame_slider_root);
/* check it in the windom source, I'm not sure if the clipping area must be clip.g_x, clip.g_y, clip.g_w, clip.g_h or not */
ObjcWindDraw( win, frame_slider_root, SLIDERS_BACK, 2, x + browser_frame_width - 15, y, 16, h - 31);
}
}
}
/*==================================================================================*
* void WinCatalog_VSlide: *
* this function handle the WM_VSLID event for the main frame in the *
* catalog ( the entries). *
*----------------------------------------------------------------------------------*
* input: *
* win -> The target window. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_VSlide( WINDOW *win)
{
int32 pos;
int16 x, y, w, h, dy;
int16 old_ypos = win->ypos;
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
pos = ( int32)( win->ypos_max - h / win->h_u) * ( int32)evnt.buff[4] / 1000L;
if ( pos < 0)
pos = 0;
dy = ( int16)(( pos - win->ypos) * win->h_u);
win->ypos = ( int16) pos;
if( dy && ( old_ypos != win->ypos))
{
move_main_work( win, x, y, w, h, 0, dy, browser_frame_width, border_size);
/* we look if image are visible and we create the preview */
WindMakePreview( win);
}
}
/*==================================================================================*
* void WinCatalog_DownPage: *
* this function handle the WM_DNPAGE event for the main frame in the *
* catalog ( the entries). *
*----------------------------------------------------------------------------------*
* input: *
* win -> The target window. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_DownPage( WINDOW *win)
{
int16 page, x, y, w, h, dy;
int32 old_pos = win -> ypos;
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
page = h / win -> h_u;
if ( win -> ypos < win -> ypos_max - page)
{
win -> ypos = MIN( win->ypos_max, win->ypos) + page;
win -> ypos = MIN( win -> ypos, win -> ypos_max - page);
dy = ( int16) (( win->ypos - old_pos) * win->h_u);
move_main_work( win, x, y, w, h, 0, dy, browser_frame_width, border_size);
/* After each 'downpage', we look if image are visible and we create the preview */
WindMakePreview( win);
}
}
/*==================================================================================*
* void WinCatalog_UpPage: *
* this function handle the WM_UPPAGE event for the main frame in the *
* catalog ( the entries). *
*----------------------------------------------------------------------------------*
* input: *
* win -> The target window. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_UpPage( WINDOW *win)
{
int32 pos;
int16 x, y, w, h, dy;
if ( win -> ypos > 0L)
{
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
pos = MAX( 0L, win->ypos - h / win->h_u);
dy = ( int16) (( pos - win->ypos) * win->h_u);
win->ypos = pos;
move_main_work( win, x, y, w, h, 0, dy, browser_frame_width, border_size);
/* After each 'uppage', we look if image are visible and we create the preview */
WindMakePreview( win);
}
}
/*==================================================================================*
* void WinCatalog_UpLine: *
* this function handle the WM_UPLINE event for the main frame in the *
* catalog ( the entries). *
*----------------------------------------------------------------------------------*
* input: *
* win -> The target window. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_UpLine( WINDOW *win)
{
if ( win -> ypos > 0L)
{
int16 x, y, w, h;
win->ypos --;
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
move_main_work( win, x, y, w, h, 0, -win->h_u, browser_frame_width, border_size);
/* After each 'upline', we look if image are visible and we create the preview */
WindMakePreview( win);
}
}
/*==================================================================================*
* void WinCatalog_DownLine: *
* this function handle the WM_DNLINE event for the main frame in the *
* catalog ( the entries). *
*----------------------------------------------------------------------------------*
* input: *
* win -> The target window. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_DownLine( WINDOW *win)
{
int16 x, y, w, h;
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h);
if (( win -> ypos < win -> ypos_max - h / win -> h_u) && ( win -> ypos_max > h / win -> h_u ))
{
win -> ypos ++;
move_main_work( win, x, y, w, h, 0, win->h_u, browser_frame_width, border_size);
/* After each 'downpage', we look if image are visible and we create the preview */
WindMakePreview( win);
}
}
/*==================================================================================*
* void WinCatalog_Arrow: *
* this function handle the WM_ARROWED event for the main frame in the *
* catalog ( the entries). *
*----------------------------------------------------------------------------------*
* input: *
* win -> The target window. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void WinCatalog_Arrow( WINDOW *win)
{
switch( evnt.buff[4])
{
case WA_UPPAGE:
WinCatalog_UpPage( win);
break;
case WA_DNPAGE:
WinCatalog_DownPage( win);
break;
case WA_UPLINE:
WinCatalog_UpLine( win);
break;
case WA_DNLINE:
WinCatalog_DownLine( win);
break;
default:
break;
}
}

View File

@@ -0,0 +1,11 @@
extern void WinCatalog_Arrow( WINDOW *win);
extern void WinCatalog_VSlide( WINDOW *win);
extern void WinCatalog_DownLine( WINDOW *win);
extern void WinCatalog_UpLine( WINDOW *win);
extern void WinCatalog_DownPage( WINDOW *win);
extern void WinCatalog_UpPage( WINDOW *win);
extern void move_main_work( WINDOW *win, int16 xw, int16 yw, int16 ww, int16 hw, int16 dx, int16 dy, int16 first_frame_width, int16 border_width);
extern void move_frame_work( WINDOW *win, int16 dy);
extern void move_area( int16 handle, GRECT *screen, int16 dx, int16 dy);

View File

@@ -0,0 +1,49 @@
#include "general.h"
/* Prototype */
void chrono_off( char *info);
void chrono_on( void);
/* Global variable */
int32 start_time, end_time;
/*==================================================================================*
* void chrono_on: *
* save the current time in 'start_time' global variable. *
*----------------------------------------------------------------------------------*
* input: *
* --- *
*----------------------------------------------------------------------------------*
* return: *
* --- *
*==================================================================================*/
void chrono_on( void)
{
int32 oldssp = Super( 0L);
start_time = *( int32 *)0x4ba;
Super(( void *)oldssp);
}
/*==================================================================================*
* void chrono_off: *
* save the current time in 'end_time' global variable and compute the time *
* since the call of the 'chrono_on' function *
*----------------------------------------------------------------------------------*
* input: *
* info -> place where to write the time elapsed. *
*----------------------------------------------------------------------------------*
* return: *
* --- *
*==================================================================================*/
void chrono_off( char *info)
{
int32 oldssp = Super( 0L);
end_time = *( int32 *)0x4ba;
Super(( void *)oldssp);
sprintf( info ,"%ld.%01ld sec", ( end_time - start_time) / 200L, (( end_time - start_time) % 200L) * 5L);
}

View File

@@ -0,0 +1,3 @@
extern void chrono_on( void);
extern void chrono_off( char *info);

View File

@@ -0,0 +1,35 @@
#include "general.h"
/* Prototype */
void close_modal( WINDOW *win);
/*==================================================================================*
* void close_modal: *
* special destroy function for modal windows. *
*----------------------------------------------------------------------------------*
* input: *
* win -> the modal window to destroy. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void close_modal( WINDOW *win)
{
MenuEnable();
frm_cls( win);
}

View File

@@ -0,0 +1,14 @@
extern void close_modal( WINDOW *win);

View File

@@ -0,0 +1,503 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 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.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
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 and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, 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 library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete 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 distribute a copy of this License along with the
Library.
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 Library or any portion
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
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 Library, 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 Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you 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.
If distribution of 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 satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be 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.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library 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.
9. 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 Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
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 with
this License.
11. 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 Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library 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 Library.
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.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library 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.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser 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 Library
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 Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
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
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. 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 LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@@ -0,0 +1,241 @@
#include "general.h"
#include "custom_font.h"
static MFDB screen = {0};
static short ofwf[256] = /* tableau espacements des caract<63>res */
{
0, 7, 7, 7, 7, 8, 8, 8, 7, 8, 7, 7, 7, 7, 6, 7,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7,
3, 3, 5, 7, 6, 6, 7, 3, 4, 4, 6, 6, 3, 6, 2, 5,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 3, 4, 5, 4, 6,
7, 6, 6, 6, 6, 5, 5, 6, 6, 2, 5, 6, 5, 7, 6, 6,
6, 6, 6, 6, 6, 6, 6, 8, 6, 6, 6, 3, 5, 3, 6, 6,
3, 5, 5, 5, 5, 5, 3, 5, 5, 4, 4, 5, 4, 8, 5, 5,
5, 5, 4, 5, 3, 5, 5, 6, 6, 5, 6, 5, 2, 5, 7, 6,
6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 6, 6,
5, 8, 8, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 5,
5, 4, 5, 5, 5, 6, 5, 5, 6, 7, 7, 8, 8, 3, 7, 7,
5, 5, 8, 7, 8, 8, 6, 6, 6, 6, 5, 4, 8, 8, 8, 8,
6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 6, 8,
7, 6, 6, 8, 7, 6, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 8, 8, 6, 7, 5, 5, 4, 7, 5, 5, 5, 6
};
static short my_font_8[1280] = /* Tableau des donn<6E>es de la fonte */
{
0x0018, 0x3C7E, 0x1818, 0x1800, 0x0018, 0x1818, 0x7E3C, 0x1800,
0x0008, 0x0C7E, 0x7E0C, 0x0800, 0x0010, 0x307E, 0x7E30, 0x1000,
0x3C99, 0xC3E7, 0xC399, 0x3C00, 0xFFFF, 0xFEFC, 0xF9F3, 0xE700,
0xE7C3, 0x993C, 0x99C3, 0xE700, 0x0002, 0x068C, 0xD870, 0x2000,
0x7EC3, 0x9195, 0x9981, 0xC37E, 0x183C, 0x3C3C, 0x7E10, 0x3810,
0x000E, 0x0B08, 0x0838, 0x7830, 0xF080, 0xDC90, 0x9810, 0x1000,
0x6080, 0x9C92, 0x7C12, 0x1200, 0x0A0A, 0x0A1A, 0x1A32, 0xF2E2,
0xA0A0, 0xA0B0, 0xB098, 0x9E8E, 0x3844, 0x4400, 0x4444, 0x3800,
0x0404, 0x0400, 0x0404, 0x0400, 0x3804, 0x0438, 0x4040, 0x3800,
0x7008, 0x0870, 0x0808, 0x7000, 0x4444, 0x4438, 0x0404, 0x0400,
0x3840, 0x4038, 0x0404, 0x3800, 0x3840, 0x4038, 0x4444, 0x3800,
0x7008, 0x0800, 0x0808, 0x0800, 0x3844, 0x4438, 0x4444, 0x3800,
0x3844, 0x4438, 0x0404, 0x3800, 0x0000, 0x7804, 0x7844, 0x3800,
0x7040, 0x7040, 0x7C10, 0x1C00, 0x0F1F, 0x3F30, 0x3020, 0x3C2E,
0xE0F0, 0xD808, 0x0808, 0x78A8, 0x2216, 0x1B0C, 0x0F5C, 0x7370,
0x0850, 0xB050, 0xA020, 0xC000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4040, 0x4040, 0x4000, 0x4000, 0x4848, 0x0000, 0x0000, 0x0000,
0x0024, 0x7E24, 0x247E, 0x2400, 0x103C, 0x5038, 0x1478, 0x1000,
0x0048, 0x0810, 0x1020, 0x2400, 0x1824, 0x1830, 0x4A44, 0x3A00,
0x2020, 0x4000, 0x0000, 0x0000, 0x1020, 0x4040, 0x4040, 0x2010,
0x4020, 0x1010, 0x1010, 0x2040, 0x0028, 0x107C, 0x1028, 0x0000,
0x0010, 0x107C, 0x1010, 0x0000, 0x0000, 0x0000, 0x0020, 0x2040,
0x0000, 0x007C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4000,
0x0808, 0x1010, 0x2020, 0x4040, 0x3844, 0x4444, 0x4444, 0x3800,
0x1030, 0x1010, 0x1010, 0x3800, 0x3844, 0x0408, 0x1020, 0x7C00,
0x7C08, 0x1038, 0x0444, 0x3800, 0x0818, 0x2848, 0x7C08, 0x0800,
0x7C40, 0x7804, 0x0444, 0x3800, 0x1820, 0x4078, 0x4444, 0x3800,
0x7C04, 0x0408, 0x1010, 0x1000, 0x3844, 0x4438, 0x4444, 0x3800,
0x3844, 0x443C, 0x0408, 0x3000, 0x0000, 0x4000, 0x0040, 0x0000,
0x0000, 0x2000, 0x0020, 0x2040, 0x0010, 0x2040, 0x2010, 0x0000,
0x0000, 0x7800, 0x7800, 0x0000, 0x0040, 0x2010, 0x2040, 0x0000,
0x3844, 0x0408, 0x1000, 0x1000, 0x3C42, 0x5A52, 0x5C40, 0x3E00,
0x1028, 0x4444, 0x7C44, 0x4400, 0x7844, 0x4478, 0x4444, 0x7800,
0x3844, 0x4040, 0x4044, 0x3800, 0x7048, 0x4444, 0x4448, 0x7000,
0x7840, 0x4070, 0x4040, 0x7800, 0x7840, 0x4070, 0x4040, 0x4000,
0x3844, 0x404C, 0x4444, 0x3800, 0x4444, 0x447C, 0x4444, 0x4400,
0x4040, 0x4040, 0x4040, 0x4000, 0x0808, 0x0808, 0x0848, 0x3000,
0x4448, 0x5060, 0x5048, 0x4400, 0x4040, 0x4040, 0x4040, 0x7800,
0x4266, 0x5A42, 0x4242, 0x4200, 0x4464, 0x544C, 0x4444, 0x4400,
0x3844, 0x4444, 0x4444, 0x3800, 0x7844, 0x4478, 0x4040, 0x4000,
0x3844, 0x4444, 0x5448, 0x3400, 0x7844, 0x4478, 0x5048, 0x4400,
0x3844, 0x4038, 0x0444, 0x3800, 0x7C10, 0x1010, 0x1010, 0x1000,
0x4444, 0x4444, 0x4444, 0x3800, 0x4444, 0x4444, 0x2828, 0x1000,
0x4141, 0x4149, 0x2A2A, 0x1400, 0x4444, 0x2810, 0x2844, 0x4400,
0x4444, 0x4428, 0x1010, 0x1000, 0x7C04, 0x0810, 0x2040, 0x7C00,
0x6040, 0x4040, 0x4040, 0x6000, 0x4040, 0x2020, 0x1010, 0x0808,
0x6020, 0x2020, 0x2020, 0x6000, 0x1028, 0x4400, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x7C00, 0x4040, 0x2000, 0x0000, 0x0000,
0x0000, 0x3008, 0x3848, 0x3800, 0x4040, 0x7048, 0x4848, 0x7000,
0x0000, 0x3048, 0x4048, 0x3000, 0x0808, 0x3848, 0x4848, 0x3800,
0x0000, 0x3048, 0x7840, 0x3800, 0x3040, 0x4060, 0x4040, 0x4000,
0x0000, 0x3848, 0x4838, 0x0870, 0x4040, 0x7048, 0x4848, 0x4800,
0x2000, 0x6020, 0x2020, 0x7000, 0x1000, 0x1010, 0x1010, 0x5020,
0x4040, 0x4850, 0x6050, 0x4800, 0x6020, 0x2020, 0x2020, 0x7000,
0x0000, 0x7649, 0x4949, 0x4900, 0x0000, 0x7048, 0x4848, 0x4800,
0x0000, 0x3048, 0x4848, 0x3000, 0x0000, 0x7048, 0x4848, 0x7040,
0x0000, 0x3848, 0x4848, 0x3808, 0x0000, 0x5060, 0x4040, 0x4000,
0x0000, 0x3840, 0x3008, 0x7000, 0x4040, 0x6040, 0x4040, 0x2000,
0x0000, 0x4848, 0x4848, 0x3800, 0x0000, 0x4848, 0x4850, 0x2000,
0x0000, 0x4444, 0x5438, 0x2800, 0x0000, 0x4428, 0x1028, 0x4400,
0x0000, 0x4848, 0x4838, 0x0870, 0x0000, 0x7C08, 0x1020, 0x7C00,
0x1820, 0x2040, 0x2020, 0x1800, 0x4040, 0x4040, 0x4040, 0x4040,
0x6010, 0x1008, 0x1010, 0x6000, 0x0020, 0x724E, 0x0400, 0x0000,
0x0010, 0x2828, 0x447C, 0x0000, 0x3844, 0x4040, 0x4438, 0x1020,
0x4800, 0x4848, 0x4848, 0x3800, 0x1020, 0x3048, 0x7840, 0x3800,
0x3048, 0x3008, 0x3848, 0x3800, 0x2800, 0x3008, 0x3848, 0x3800,
0x1008, 0x3008, 0x3848, 0x3800, 0x1010, 0x3008, 0x3848, 0x3800,
0x0030, 0x4840, 0x4830, 0x1060, 0x1028, 0x3048, 0x7840, 0x3800,
0x2800, 0x3048, 0x7840, 0x3800, 0x2010, 0x3048, 0x7840, 0x3800,
0x5000, 0x6020, 0x2020, 0x7000, 0x2050, 0x6020, 0x2020, 0x7000,
0x2010, 0x6020, 0x2020, 0x7000, 0x2800, 0x1028, 0x447C, 0x4400,
0x1000, 0x1028, 0x447C, 0x4400, 0x1020, 0x7840, 0x7040, 0x7800,
0x0000, 0x3E09, 0x3F48, 0x3E00, 0x1F38, 0x484E, 0x7848, 0x4F00,
0x3048, 0x3048, 0x4848, 0x3000, 0x4800, 0x3048, 0x4848, 0x3000,
0x2010, 0x3048, 0x4848, 0x3000, 0x3048, 0x0048, 0x4848, 0x3800,
0x2010, 0x0048, 0x4848, 0x3800, 0x4800, 0x4848, 0x4838, 0x0870,
0x2800, 0x3844, 0x4444, 0x3800, 0x4400, 0x4444, 0x4444, 0x3800,
0x1038, 0x5450, 0x5438, 0x1000, 0x1824, 0x2078, 0x2020, 0x7800,
0x4444, 0x3810, 0x7C10, 0x1000, 0x1824, 0x4478, 0x4444, 0x7840,
0x1820, 0x2070, 0x2020, 0x4000, 0x1020, 0x3008, 0x3848, 0x3800,
0x2040, 0x0060, 0x2020, 0x7000, 0x1020, 0x0030, 0x4848, 0x3000,
0x1020, 0x0048, 0x4848, 0x3800, 0x2850, 0x0070, 0x4848, 0x4800,
0x3458, 0x0064, 0x544C, 0x4400, 0x0030, 0x0838, 0x4838, 0x0078,
0x0030, 0x4848, 0x4830, 0x0078, 0x1000, 0x1020, 0x4044, 0x3800,
0x0000, 0x0000, 0x1E10, 0x1000, 0x0000, 0x0000, 0x7808, 0x0800,
0x4244, 0x4816, 0x2142, 0x0700, 0x4244, 0x4816, 0x2A4F, 0x0200,
0x0040, 0x0040, 0x4040, 0x4040, 0x0012, 0x2448, 0x2412, 0x0000,
0x0048, 0x2412, 0x2448, 0x0000, 0x2850, 0x0030, 0x0878, 0x3800,
0x2850, 0x0030, 0x4848, 0x3000, 0x1D22, 0x262A, 0x3222, 0x5C00,
0x0000, 0x1A24, 0x3C24, 0x5800, 0x0000, 0x3E49, 0x4F48, 0x3E00,
0x3F48, 0x484E, 0x4848, 0x3F00, 0x1008, 0x1028, 0x447C, 0x4400,
0x3458, 0x1028, 0x447C, 0x4400, 0x3458, 0x0038, 0x4444, 0x3800,
0x2400, 0x0000, 0x0000, 0x0000, 0x1020, 0x4000, 0x0000, 0x0000,
0x2070, 0x2020, 0x0000, 0x0000, 0x3A4A, 0x4A4A, 0x3A0A, 0x0A0A,
0x3C42, 0x99A1, 0xA199, 0x423C, 0x3C42, 0xB9A5, 0xB9A5, 0x423C,
0xEA4E, 0x4A4A, 0x0000, 0x0000, 0x2400, 0x6424, 0x2474, 0x0418,
0x7424, 0x2424, 0x2474, 0x0418, 0x0000, 0x1038, 0x7C10, 0x1010,
0x1010, 0x107C, 0x3810, 0x0000, 0x0010, 0x18FC, 0x1810, 0x0000,
0x0008, 0x183F, 0x1808, 0x0000, 0x1010, 0x101F, 0x0000, 0x0000,
0x0000, 0x00F0, 0x1010, 0x1010, 0x1010, 0x10F0, 0x0000, 0x0000,
0x0000, 0x001F, 0x1010, 0x1010, 0x0000, 0x00FF, 0x0000, 0x0000,
0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x10FF, 0x1010, 0x1010,
0x1010, 0x101F, 0x1010, 0x1010, 0x0000, 0x00FF, 0x1010, 0x1010,
0x1010, 0x10F0, 0x1010, 0x1010, 0x1010, 0x10FF, 0x0000, 0x0000,
0x0010, 0x181C, 0x1C18, 0x1000, 0x0008, 0x1838, 0x3818, 0x0800,
0x0024, 0x343C, 0x3C34, 0x2400, 0x0024, 0x2C3C, 0x3C2C, 0x2400,
0x0048, 0x6C7E, 0x7E6C, 0x4800, 0x0012, 0x367E, 0x7E36, 0x1200,
0x0010, 0x387C, 0x007C, 0x0000, 0x007C, 0x7C7C, 0x7C7C, 0x0000,
0x0038, 0x7C7C, 0x7C38, 0x0000, 0x3C42, 0x8181, 0x8250, 0x3810,
0x1054, 0x9282, 0x8244, 0x3800, 0x0004, 0x0404, 0x247C, 0x2000,
0x0609, 0x1C22, 0x221C, 0x4830, 0x0000, 0x1028, 0x4400, 0x0000,
0x0036, 0x4949, 0x3600, 0x0000, 0x0000, 0x324C, 0x484C, 0x3200,
0x1824, 0x4478, 0x4444, 0x7840, 0x7C24, 0x2020, 0x2020, 0x7000,
0x0001, 0x3E54, 0x1414, 0x1400, 0x7E22, 0x1008, 0x1022, 0x7E00,
0x001C, 0x3048, 0x4848, 0x3000, 0x0000, 0x2424, 0x2424, 0x3A40,
0x0004, 0x3850, 0x1010, 0x1000, 0x3810, 0x3844, 0x4438, 0x1038,
0x0038, 0x447C, 0x4444, 0x3800, 0x0038, 0x4444, 0x4428, 0x6C00,
0x3020, 0x1038, 0x4444, 0x3800, 0x0408, 0x3854, 0x5438, 0x2040,
0x1038, 0x5454, 0x5438, 0x1000, 0x3C60, 0x407C, 0x4060, 0x3C00,
0x386C, 0x4444, 0x4444, 0x4400, 0x007C, 0x007C, 0x007C, 0x0000,
0x0010, 0x107C, 0x1010, 0x007C, 0x0020, 0x1008, 0x1020, 0x007C,
0x0008, 0x1020, 0x1008, 0x007C, 0x0609, 0x0808, 0x0808, 0x0808,
0x0808, 0x0808, 0x0808, 0x4830, 0x0010, 0x007C, 0x0010, 0x0000,
0x0032, 0x4C00, 0x324C, 0x0000, 0x3048, 0x4830, 0x0000, 0x0000,
0x3078, 0x7830, 0x0000, 0x0000, 0x0000, 0x0000, 0x3030, 0x0000,
0x0006, 0x0808, 0x6828, 0x1000, 0x3048, 0x4848, 0x0000, 0x0000,
0x3048, 0x1020, 0x7800, 0x0000, 0x7008, 0x3008, 0x7000, 0x0000,
0xFE00, 0x0000, 0x0000, 0x0000
};
void draw_text( int16 vdih, int16 xf, int16 yf, int16 color, const char *str)
{
MFDB pic;
short fx_mem[16], sys_pxy[20], char_width, tcolor[2] = { color, WHITE};
unsigned short c;
pic.fd_addr = fx_mem;
pic.fd_w = 16;
pic.fd_h = 8;
pic.fd_wdwidth = 1;
pic.fd_stand = 0;
pic.fd_nplanes = 1;
sys_pxy[0] = 0;
sys_pxy[1] = 0;
sys_pxy[2] = 0;
sys_pxy[3] = 7;
sys_pxy[4] = xf;
sys_pxy[5] = yf;
sys_pxy[6] = 0;
sys_pxy[7] = yf + 7;
while ( (c = (unsigned char)*str++) != 0) {
char *model = (char*) &my_font_8[(c - 1) << 2] ;
char *dest = (char*)fx_mem;
char_width = ofwf[c];
memset(fx_mem,0,20);
*dest = *model++; dest+=2;
*dest = *model++; dest+=2;
*dest = *model++; dest+=2;
*dest = *model++; dest+=2;
*dest = *model++; dest+=2;
*dest = *model++; dest+=2;
*dest = *model++; dest+=2;
*dest = *model;
sys_pxy[2] = char_width - 1;
sys_pxy[6] = sys_pxy[4] + sys_pxy[2];
/*vdi*/
vrt_cpyfm( vdih, 2, sys_pxy, &pic, &screen, tcolor);
sys_pxy[4] += char_width;
}
}
int16 get_text_width( const char *str)
{
int16 c, text_width = 0;
while ( (c = *str++) != 0)
{
text_width += ofwf[c];
}
return text_width;
}
int16 name_shorter( int16 max_size, char *str)
{
int16 len, current_len;
len = ( int16) strlen( str) - 1;
do
{
str[len - 3] = '.';
str[len - 2] = '.';
str[len - 1] = '.';
str[len] = '\0';
len--;
current_len = get_text_width( str);
} while ( ( current_len >= max_size) && ( len > 0));
return current_len;
}

View File

@@ -0,0 +1,17 @@
#ifndef CFONT_H
#define CFONT_H
#ifdef __cplusplus
extern "C" {
#endif
extern void draw_text( int16 vdih, int16 xf, int16 yf, int16 color, const char *str);
extern int16 get_text_width( const char *str);
extern int16 name_shorter( int16 max_size, char *str);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,32 @@
#include "general.h"
#ifdef DEBUG
#include <wout.h>
#endif
/*==================================================================================*
* void zdebug: *
* print debug information in 'wout' window. *
*----------------------------------------------------------------------------------*
* input: *
* ... -> text and parameter are the same that sandard "printf" function. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void zdebug( const char *format, ...)
{
#ifdef DEBUG
va_list args;
char fo_buff[255], *p;
va_start( args, format);
vsprintf( fo_buff, format, args);
p = fo_buff;
va_end( args);
wout_printf("%s\n", p);
#endif
}

View File

@@ -0,0 +1,114 @@
#include "../general.h"
#include "file.h"
/* Prototype */
int16 count_files( WINDICON *wicones, fileinfo *file);
int16 count_dir( const char *path, fileinfo *file);
/*==================================================================================*
* int16 count_dir : *
* Do a recursive file count in a directory. *
*----------------------------------------------------------------------------------*
* input: *
* path -> the path where to search. *
* item -> the adress where to return the number of files. *
* size -> the adress where to return the total size of all the files. *
*----------------------------------------------------------------------------------*
* return: *
* 1 is ok else 0 *
*==================================================================================*/
int16 count_dir( const char *path, fileinfo *file)
{
char old_dir[MAX_PATH];
DIR *dir;
struct dirent *de;
struct stat file_stat;
if ( dir_cd( path, old_dir, ( int16)( sizeof old_dir)))
{
if (( dir = opendir( ".")) != NULL)
{
while(( de = readdir( dir)) != NULL)
{
if (( strcmp( de->d_name, ".") == 0) || ( strcmp( de->d_name, "..") == 0))
continue;
if ( lstat( de->d_name, &file_stat) != 0)
{
closedir( dir);
dir_cd( old_dir, NULL, 0);
return 0;
}
if ( S_ISDIR( file_stat.st_mode))
{
if ( !count_dir( de->d_name, file))
{
closedir( dir);
dir_cd( old_dir, NULL, 0);
return 0;
}
else
file->item ++;
}
else
{
file->item ++;
file->size += file_stat.st_size;
}
}
closedir( dir);
}
else
return 0;
dir_cd( old_dir, NULL, 0);
}
else
return 0;
return 1;
}
/*==================================================================================*
* int16 count_files: *
* Do a recursive file count. *
*----------------------------------------------------------------------------------*
* input: *
* wicones -> the target wicones. *
* item -> the adress where to return the number of files. *
* size -> the adress where to return the total size of all the files. *
*----------------------------------------------------------------------------------*
* return: *
* 1 is ok else 0 *
*==================================================================================*/
int16 count_files( WINDICON *wicones, fileinfo *file)
{
Entry *entry = wicones->first_selected;
file->item = 0L;
file->size = 0L;
while ( entry)
{
if ( S_ISDIR( entry->stat.st_mode))
{
if( !count_dir( entry->name, file))
return 0;
else
file->item ++;
}
else
{
file->item ++;
file->size += entry->stat.st_size;
}
entry = entry->next_selected;
}
return 1;
}

View File

@@ -0,0 +1,2 @@
extern int16 count_files( WINDICON *wicones, fileinfo *file);

View File

@@ -0,0 +1,312 @@
#include "../general.h"
#include "../prefs.h"
#include "../ztext.h"
#include "../close_modal.h"
#include "../catalog/catalog.h"
#include "../catalog/catalog_entry.h"
#include "../catalog/catalog_mini_entry.h"
#include "file.h"
#include "count.h"
/* local variable */
static char size_to_delete[16];
static uint32 size_deleted;
static uint32 item_deleted;
static uint32 item_to_delete;
static OBJECT *save_dialog;
/* prototype */
boolean delete_file( const char *name, struct stat *file_stat);
boolean delete_dir( WINDOW *win, const char *path);
void delete_entry( WINDOW *win);
void delete_progress( WINDOW *win);
/*==================================================================================*
* delete_file: *
* Delete a plain file. This is capable of removing anything that is not a *
* directory. *
*----------------------------------------------------------------------------------*
* returns: TRUE = success, FALSE = error *
*==================================================================================*/
boolean delete_file( const char *name, struct stat *file_stat)
{
if ( unlink( name) != 0)
{
/* If possible, change the file permission for delete it */
( void)chmod( name, S_IRWXU);
return unlink( name) == 0 ? TRUE : FALSE;
}
else
return ( TRUE);
}
/*==================================================================================*
* delete_dir: *
* Delete a directory. *
*----------------------------------------------------------------------------------*
* returns: TRUE = success, FALSE = error *
*==================================================================================*/
boolean delete_dir( WINDOW *win, const char *path)
{
char old_dir[MAX_PATH];
DIR *dir;
struct dirent *de;
struct stat file_stat;
if ( rmdir( path) == 0)
return TRUE;
else
{
if ( dir_cd( path, old_dir, ( int16)( sizeof old_dir)))
{
if (( dir = opendir( ".")) != NULL)
{
while(( de = readdir( dir)) != NULL)
{
if (( strcmp( de->d_name, ".") == 0) || ( strcmp( de->d_name, "..") == 0))
continue;
if ( lstat( de->d_name, &file_stat) != 0)
break;
if ( S_ISDIR( file_stat.st_mode))
{
if ( delete_dir( win, de->d_name) == FALSE)
break;
else
{
item_deleted++;
delete_progress( win);
}
}
else
{
if ( delete_file( de->d_name, &file_stat) == FALSE)
break;
else
{
item_deleted++;
size_deleted += file_stat.st_size;
delete_progress( win);
}
}
}
closedir( dir);
}
dir_cd( old_dir, NULL, 0);
}
return rmdir( path) == 0 ? TRUE : FALSE;
}
}
void delete_progress( WINDOW *win)
{
static int32 bar_width = 0L;
int32 new_bar_width = ( ( item_deleted * 100L) / item_to_delete) * 3;
int16 pxy[4];
char tmp[16];
GRECT rwin, raes;
W_FORM *form = ( W_FORM *)DataSearch( win, WD_WFRM);
size_to_text( tmp, ( float)size_deleted);
sprintf( save_dialog[OPERATION_DIAL_INFO].ob_spec.tedinfo->te_ptext, get_string( DELETE_INFO), item_to_delete - item_deleted);
sprintf( save_dialog[OPERATION_DIAL_PROGRESS].ob_spec.tedinfo->te_ptext, get_string( PROGRESS_TXT), tmp, size_to_delete);
ObjcDraw( OC_FORM, win, OPERATION_DIAL_INFO, 0);
ObjcDraw( OC_FORM, win, OPERATION_DIAL_PROGRESS, 0);
if (( bar_width == new_bar_width) || !new_bar_width)
return;
WindGet( win, WF_WORKXYWH, &rwin.g_x, &rwin.g_y, &rwin.g_w, &rwin.g_h);
bar_width = new_bar_width;
pxy[0] = rwin.g_x + form->root[OPERATION_DIAL_BAR].ob_x;
pxy[1] = rwin.g_y + form->root[OPERATION_DIAL_BAR].ob_y;
pxy[2] = pxy[0] + bar_width;
pxy[3] = pxy[1] + form->root[OPERATION_DIAL_BAR].ob_height;
while( !wind_update( BEG_UPDATE));
graf_mouse( M_OFF, 0L);
wind_get( win->handle, WF_FIRSTXYWH, &raes.g_x, &raes.g_y, &raes.g_w, &raes.g_h);
while ( raes.g_w && raes.g_h)
{
if( rc_intersect( &rwin, &raes))
{
rc_clip_on( win->graf.handle, &raes);
v_bar( win->graf.handle, pxy);
rc_clip_off( win->graf.handle);
}
wind_get( win->handle, WF_NEXTXYWH, &raes.g_x, &raes.g_y, &raes.g_w, &raes.g_h);
}
graf_mouse( M_ON, 0L);
wind_update( END_UPDATE);
}
void delete_function( WINDOW *win)
{
WINDICON *wicones = ( WINDICON *)DataSearch( win_catalog, WD_ICON);
Mini_Entry *mini_entry;
fileinfo file;
int16 x, y, w, h, deleted_entry = 0;
switch( evnt.buff[4])
{
case OPERATION_DIAL_CANCEL:
ObjcChange( OC_FORM, win, OPERATION_DIAL_CANCEL, ~SELECTED, TRUE);
ApplWrite( app.id, WM_CLOSED, win->handle, 0, 0, 0, 0);
break;
case OPERATION_DIAL_OK:
ObjcChange( OC_FORM, win, OPERATION_DIAL_OK, ~SELECTED, TRUE);
strcpy( save_dialog[OPERATION_DIAL_INFO].ob_spec.tedinfo->te_ptext, get_string( CALCUL));
vsf_color( win->graf.handle, RED);
if( !count_files( wicones, &file))
{
ApplWrite( app.id, WM_CLOSED, win->handle, 0, 0, 0, 0);
errshow( "", errno);
return;
}
item_to_delete = file.item;
size_deleted = 0L;
item_deleted = 0L;
size_to_text( size_to_delete, ( float)file.size);
delete_progress( win);
while ( wicones->first_selected)
{
if ( S_ISDIR( wicones->first_selected->stat.st_mode))
{
if ( !delete_dir( win, wicones->first_selected->name))
{
errshow( wicones->first_selected->name, errno);
break;
}
else
{
deleted_entry++;
item_deleted++;
delete_progress( win);
remove_selected_entry( wicones, wicones->first_selected);
/* the mini_entry returned is the mini_entry parent of the directory deleted
because we give the current directory ( wicones->directory) as parameter */
if ( ( mini_entry = find_mini_entry_by_path( wicones, wicones->directory)))
{
int16 old_state = mini_entry->state;
delete_mini_entry_child( mini_entry);
scan_mini_dir( win_catalog, mini_entry);
check_mini_dir( mini_entry->nbr_child, mini_entry->child);
mini_entry->state = old_state;
if( mini_entry->state == OFF)
delete_mini_entry_child( mini_entry);
if ( browser_frame_width)
{
WindGet( win_catalog, WF_WORKXYWH, &x, &y, &w, &h);
draw_page( win_catalog, x, y + mini_entry->arrow_position.y1 - 1, browser_frame_width, h - mini_entry->arrow_position.y1);
}
}
}
}
else
{
if ( !delete_file( wicones->first_selected->name, &wicones->first_selected->stat))
{
errshow( wicones->first_selected->name, errno);
break;
}
else
{
deleted_entry++;
item_deleted++;
size_deleted += wicones->first_selected->stat.st_size;
delete_progress( win);
remove_selected_entry( wicones, wicones->first_selected);
}
}
}
ObjcDraw( OC_FORM, win, OPERATION_DIAL_INFO, FALSE);
close_modal( win);
if ( deleted_entry)
{
( void)scan_dir( win_catalog, wicones->directory);
WinCatalog_filelist_redraw();
ObjcDraw( OC_TOOLBAR, win_catalog, TOOLBAR_DELETE, 1);
ObjcDraw( OC_TOOLBAR, win_catalog, TOOLBAR_INFO, 1);
ObjcDraw( OC_TOOLBAR, win_catalog, TOOLBAR_SAVE, 1);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_DELETE, 0);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_INFORMATION, 0);
menu_ienable( get_tree( MENU_BAR), MENU_BAR_SAVE, 0);
}
break;
default:
break;
}
}
/*==================================================================================*
* void delete_entry: *
* Delete all the selected entries in the WINDOW win. *
* A modal dialog box is shown for approve it. *
*----------------------------------------------------------------------------------*
* input: *
* win -> the window's adress to handle. *
*----------------------------------------------------------------------------------*
* return: *
* entries deleted *
*==================================================================================*/
void delete_entry( WINDOW *win)
{
WINDOW *win_save_dialog;
save_dialog = get_tree( OPERATION_DIAL);
zstrncpy( save_dialog[OPERATION_DIAL_INFO].ob_spec.tedinfo->te_ptext, get_string( DELETE_ASK), 48);
strcpy( save_dialog[OPERATION_DIAL_PROGRESS].ob_spec.tedinfo->te_ptext, "");
win_save_dialog = FormCreate( save_dialog, NAME|MOVER, delete_function, get_string( DELETE_TITLE), NULL, TRUE, FALSE);
WindSet( win_save_dialog, WF_BEVENT, BEVENT_MODAL, 0, 0, 0);
EvntAttach( win_save_dialog, WM_CLOSED, close_modal);
MenuDisable();
}

View File

@@ -0,0 +1,2 @@
extern void delete_entry( WINDOW *win);

View File

@@ -0,0 +1,439 @@
/*----------------------------------------------------------------------*/
/* Files utilities */
/*----------------------------------------------------------------------*/
#include "../general.h"
#include "../zedit/zedit.h"
#include "../catalog/catalog_entry.h"
#include "../ztext.h"
#include "../catalog/catalog_icons.h"
#include "../prefs.h"
#include "../mfdb.h"
#include "../txt_data.h"
#include "../custom_font.h"
#include "sort.h"
#define ALLOC_NDIRENTRIES (4) /* number of entries that should be allocated at once by readdir() */
/* Prototype */
boolean dir_parent( char *dir, char *old_dir);
boolean dir_cd( const char *new_dir, char *old_dir, int16 bufflen);
boolean check_write_perm( const struct stat *file_stat);
boolean scan_dir( WINDOW *win, const char *dirpath);
boolean scan_mini_drv( WINDOW *win);
void check_mini_dir( int16 nbr_child, Mini_Entry *entry);
boolean scan_mini_dir( WINDOW *win, Mini_Entry *parent);
/*==================================================================================*
* dir_parent: *
* go to the parent directory. *
*----------------------------------------------------------------------------------*
* returns: TRUE = success, FALSE = if root path ( so, no dir up). *
*----------------------------------------------------------------------------------*
* dir: Pointer to the current directory, the new directory will be *
* returned on the same pointer. *
* old_dir: Pointer on a null string where will be returned the name of the *
* old directory. ( not the full path, only the name) *
*==================================================================================*/
boolean dir_parent( char *dir, char *old_dir)
{
int16 len, i, ii;
len = ( int16) strlen( dir) - 1;
if ( len < 3)
return FALSE;
if ( dir[len] == '\\')
dir[len] = '\0';
len--;
i = len;
while ( dir[i] != '\\')
i--;
ii = len - i - 1;
old_dir[ii + 1] = '\0';
while ( dir[len] != '\\')
{
old_dir[ii] = dir[len];
dir[len] = '\0';
len--;
ii--;
}
return TRUE;
}
/*==================================================================================*
* dir_cd: *
* enter to a directory. *
*----------------------------------------------------------------------------------*
* returns: TRUE = success, FALSE = error *
*----------------------------------------------------------------------------------*
* new_dir: The New directory. *
* old_dir: Pointer where save the previous directory. *
* ( If NULL, no storing is done). *
*==================================================================================*/
boolean dir_cd( const char *new_dir, char *old_dir, int16 bufflen)
{
if ( old_dir != NULL)
getcwd( old_dir, bufflen);
return chdir( new_dir) == 0 ? TRUE : FALSE;
}
/*==================================================================================*
* check_write_perm: *
* Do complex WRITE permission check. *
*----------------------------------------------------------------------------------*
* returns: TRUE = ok, FALSE = no *
*----------------------------------------------------------------------------------*
* stat: Entry Stat. *
*==================================================================================*/
boolean check_write_perm( const struct stat *file_stat)
{
uid_t uid = geteuid();
gid_t gid = getegid();
/* if ( uid == 0)
return TRUE;
*/
if ( file_stat->st_uid == uid)
return ( file_stat->st_mode & S_IWUSR) ? TRUE : FALSE;
if ( file_stat->st_gid == gid)
return ( file_stat->st_mode & S_IWGRP) ? TRUE : FALSE;
return ( file_stat->st_mode & S_IWOTH) ? TRUE : FALSE;
}
/*==================================================================================*
* scan_dir: *
* scan the 'dirpath' directory and fit somes entries in 'dirfile'. *
*----------------------------------------------------------------------------------*
* return: TRUE if ok or FALSE if error *
*==================================================================================*/
boolean scan_dir( WINDOW *win, const char *dirpath)
{
short dum, allocated_entries = 0;
Entry *entry;
DIR *dir;
struct dirent *de;
struct stat file_stat;
struct tm *tmt;
WINDICON *dirfile = ( WINDICON *)DataSearch( win, WD_ICON);
if ( dirfile->nbr_icons)
{
for ( dum = 0; dum < dirfile->nbr_icons; dum++)
{
delete_txt_data( &dirfile->entry[dum].preview);
delete_mfdb( dirfile->entry[dum].preview.image, dirfile->entry[dum].preview.page);
}
dirfile->nbr_icons = 0;
gfree( dirfile->entry);
}
dirfile->first_selected = NULL;
dirfile->entry = NULL;
dirfile->edit = NULL;
if ( !dir_cd( dirpath, NULL, 0))
dir_cd( ".", NULL, 0);
strcpy( dirfile->directory, dirpath);
dum = ( int16)strlen( dirfile->directory);
if ( dirfile->directory[dum-1] != '\\')
strcat( dirfile->directory, "\\");
if (( dir = opendir( ".")) == NULL)
{
errshow( "dir", errno);
goto abort;
}
while(( de = readdir( dir)) != NULL)
{
if (( strcmp( de->d_name, ".") == 0) || ( strcmp( de->d_name, "..") == 0))
continue;
if ( stat( de->d_name, &file_stat) != 0)
continue;
if (((( file_stat.st_flags & FA_HIDDEN) != 0) || de->d_name[0] == '.') && !show_hidden)
continue;
/* allocate new memory for entries if needed */
if ( dirfile->nbr_icons >= allocated_entries)
{ /* allocate new entries */
if ( dirfile->nbr_icons == 0)
{ /* alloc for the first time */
if (( dirfile->entry = ( Entry *)gmalloc( ALLOC_NDIRENTRIES * sizeof( Entry))) == NULL)
{
errshow( "", ENOMEM);
goto abort;
}
}
else
{ /* expand allocated memory */
if (( entry = ( Entry *)grealloc( dirfile->entry, ( allocated_entries + ALLOC_NDIRENTRIES) * sizeof( Entry))) == NULL)
{
errshow( "", ENOMEM);
goto abort;
}
dirfile->entry = entry;
}
allocated_entries += ALLOC_NDIRENTRIES;
}
/* fill out and add new entry */
entry = &dirfile->entry[dirfile->nbr_icons];
entry->preview.image = NULL;
entry->preview.page = 0;
entry->preview.comments = NULL;
entry->next_selected = NULL;
entry->stat = file_stat;
strcpy( entry->name, de->d_name);
zstrncpy( entry->name_shown, de->d_name, 99);
/* Get Size */
size_to_text( entry->size, ( float)file_stat.st_size);
/* Get Time */
tmt = localtime(&file_stat.st_mtime);
strftime( entry->date, 28, "%A %d %B %Y", tmt);
strftime( entry->time, 12, "%H:%M:%S", tmt);
set_entry_icon( entry);
/* find if the entry name is bigger than the case width */
if (( entry->icon_txt_w = get_text_width( entry->name_shown)) >= dirfile->case_w - 4)
entry->icon_txt_w = name_shorter( dirfile->case_w - 6, entry->name_shown);
dirfile->nbr_icons++;
}
closedir( dir);
sort_entries( dirfile);
return TRUE;
abort:
closedir( dir);
if ( dirfile->nbr_icons > 0)
gfree( dirfile->entry);
return FALSE;
}
/*==================================================================================*
* scan_mini_drv: *
* Creates a list with the available drives. *
*----------------------------------------------------------------------------------*
* returns: TRUE if ok, FALSE if any error occured *
*==================================================================================*/
boolean scan_mini_drv( WINDOW *win)
{
int current_drv, drv, allocated_entries = 0;
uint32 drives, tmp_d;
Mini_Entry *entry;
WINDICON *dirlist = ( WINDICON *)DataSearch( win, WD_ICON);
/* initialise directory descriptor */
dirlist->nbr_child = 0;
dirlist->entry = NULL;
dirlist->mini_selected = NULL;
/* read contents of directory and build list */
drives = Drvmap();
tmp_d = drives;
for ( current_drv = 0; current_drv < 32; current_drv++, tmp_d >>= 1)
{
if ( tmp_d & 0x1)
{
drv = 'A' + current_drv;
if ( strchr( skip_drive, drv))
continue;
/* allocate new memory for entries if needed */
if ( dirlist->nbr_child >= allocated_entries)
{
if ( dirlist->nbr_child == 0)
{
if (( dirlist->root = ( Mini_Entry *)gmalloc( ALLOC_NDIRENTRIES * sizeof( Mini_Entry))) == NULL)
goto abort;
}
else
{
if (( entry = ( Mini_Entry *)grealloc( dirlist->root, ( allocated_entries + ALLOC_NDIRENTRIES) * sizeof( Mini_Entry))) == NULL)
goto abort;
dirlist->root = entry;
}
allocated_entries += ALLOC_NDIRENTRIES;
}
/* fill out and add new entry */
entry = &dirlist->root[dirlist->nbr_child];
sprintf( entry->foldername, "%c:\\", drv);
sprintf( entry->name, "%c", drv);
entry->parent = NULL;
entry->child = NULL;
entry->nbr_child = 0;
entry->icon_txt_w = get_text_width( entry->name);
entry->state = UNKNOWN;
dirlist->nbr_child++;
}
}
return TRUE;
abort:
if ( dirlist->nbr_child > 0)
gfree( dirlist->root);
errshow( "", ENOMEM);
return FALSE;
}
void check_mini_dir( int16 nbr_child, Mini_Entry *entry)
{
int16 i, next;
char old_dir[MAX_PATH];
DIR *dir;
struct dirent *de;
struct stat file_stat;
for ( i = 0 ; i < nbr_child; i++)
{
next = 0;
if ( dir_cd( entry[i].foldername, old_dir, ( int)( sizeof old_dir)))
{
if (( dir = opendir( entry[i].foldername)) != NULL)
{
while(( de = readdir( dir)) != NULL && next == 0)
{
if (( strcmp( de->d_name, ".") == 0) || ( strcmp( de->d_name, "..") == 0))
continue;
if ( stat( de->d_name, &file_stat) != 0)
continue;
if ( S_ISDIR( file_stat.st_mode))
{
next = 1;
entry[i].state = OFF;
}
}
closedir( dir);
}
dir_cd( old_dir, NULL, 0);
}
}
}
boolean scan_mini_dir( WINDOW *win, Mini_Entry *parent)
{
short allocated_entries = 0;
char old_dir[MAX_PATH];
Mini_Entry *entry;
DIR *dir;
struct dirent *de;
struct stat file_stat;
if ( dir_cd( parent->foldername, old_dir, ( int)( sizeof old_dir)))
{
if (( dir = opendir( ".")) != NULL)
{
while(( de = readdir( dir)) != NULL)
{
if (( strcmp( de->d_name, ".") == 0) || ( strcmp( de->d_name, "..") == 0))
continue;
if ( stat( de->d_name, &file_stat) != 0)
continue;
if ( !S_ISDIR( file_stat.st_mode))
continue;
if (( file_stat.st_flags & 2) == FA_HIDDEN && !show_hidden)
continue;
if ( parent->nbr_child >= allocated_entries)
{
if ( parent->nbr_child == 0)
{
if (( parent->child = ( Mini_Entry *)gmalloc( ALLOC_NDIRENTRIES * sizeof( Mini_Entry))) == NULL)
goto abort;
}
else
{
if (( entry = ( Mini_Entry *)grealloc( parent->child, ( allocated_entries + ALLOC_NDIRENTRIES) * sizeof( Mini_Entry))) == NULL)
goto abort;
parent->child = entry;
}
allocated_entries += ALLOC_NDIRENTRIES;
}
entry = &parent->child[parent->nbr_child];
strcpy( entry->foldername, parent->foldername);
strcat( entry->foldername, de->d_name);
strcat( entry->foldername, "\\");
strcpy( entry->name, de->d_name);
entry->parent = parent;
entry->child = NULL;
entry->nbr_child = 0;
entry->icon_txt_w = get_text_width( entry->name);
entry->state = UNKNOWN;
parent->nbr_child++;
}
closedir( dir);
}
dir_cd( old_dir, NULL, 0);
}
qsort( parent->child, parent->nbr_child, sizeof( Mini_Entry), cmp_entries_name);
return TRUE;
abort:
closedir( dir);
if ( parent->nbr_child > 0)
gfree( parent->child);
parent->nbr_child = 0;
return FALSE;
}

View File

@@ -0,0 +1,7 @@
extern boolean dir_cd( const char *new_dir, char *old_dir, int16 bufflen);
extern boolean dir_parent( char *dir, char *old_dir);
extern boolean check_write_perm( const struct stat *file_stat);
extern boolean scan_dir( WINDOW *win, const char *dirpath);
extern boolean scan_mini_drv( WINDOW *win);
extern void check_mini_dir( int16 nb_child, Mini_Entry *entry);
extern boolean scan_mini_dir( WINDOW *win, Mini_Entry *parent);

View File

@@ -0,0 +1,55 @@
/*----------------------------------------------------------------------*/
/* Rename functions */
/*----------------------------------------------------------------------*/
#include "../general.h"
#include "../catalog/catalog_icons.h"
#include "file.h"
/* prototype */
boolean rename_entry( WINDOW *win, const char *new_name);
/*==================================================================================*
* rename_entry: *
* rename a file or directory. *
*----------------------------------------------------------------------------------*
* returns: TRUE = success, FALSE = rename not complete. *
*----------------------------------------------------------------------------------*
* old_name: Pointer to the current file/directory name. *
* new_name: Pointer to the new file/directory name. *
*==================================================================================*/
boolean rename_entry( WINDOW *win, const char *new_name)
{
int16 i;
WINDICON *wicones = (WINDICON *)DataSearch( win, WD_ICON);
if( strcmp( wicones->first_selected->name, new_name) == 0) /* if name is unchanged, do nothing */
return FALSE;
if( strchr( new_name, '/') || strchr( new_name, '\\')) /* disallow attempts to use rename to move files */
{
errshow( wicones->first_selected->name, INVAL);
return FALSE;
}
for ( i = 0 ; i < wicones->nbr_icons ; i++)
if ( !strcmp( wicones->entry[i].name, new_name))
{
errshow( "", E_NAMEEXIST);
return FALSE;
}
if ( rename( wicones->first_selected->name, new_name) != 0)
{
errshow( wicones->first_selected->name, errno);
return FALSE;
}
strcpy( wicones->first_selected->name, new_name);
set_entry_icon( wicones->first_selected);
return TRUE;
}

View File

@@ -0,0 +1,2 @@
extern boolean rename_entry( WINDOW *win, const char *new_name);

View File

@@ -0,0 +1,159 @@
/*----------------------------------------------------------------------*/
/* Sortring Operations */
/*------------------- ---------------------------------------------------*/
#include "..//general.h"
#include "..//ztext.h"
#include "..//prefs.h"
/* prototype */
int cmp_entries_name( const void *obj_a, const void *obj_b);
static int cmp_entries_size( const void *obj_a, const void *obj_b);
static int cmp_entries_date( const void *obj_a, const void *obj_b);
static int cmp_entries_dirsbeforefiles(const void *obj_a, const void *obj_b);
int16 sort_entries( WINDICON *dirfile);
int cmp_entries_name(const void *obj_a, const void *obj_b)
{
Entry *entry_a;
Entry *entry_b;
int cmp_val;
char name_a[256];
char name_b[256];
entry_a = (Entry *)obj_a;
entry_b = (Entry *)obj_b;
strcpy(name_a, entry_a->name);
str2lower(name_a);
strcpy(name_b, entry_b->name);
str2lower(name_b);
cmp_val = strcmp(name_a, name_b);
return cmp_val;
}
static int cmp_entries_size(const void *obj_a, const void *obj_b)
{
Entry *entry_a;
Entry *entry_b;
int cmp_val;
int32 size_a;
int32 size_b;
entry_a = (Entry *)obj_a;
entry_b = (Entry *)obj_b;
size_a = entry_a->stat.st_size;
size_b = entry_b->stat.st_size;
if ( size_a < size_b)
cmp_val = -1;
else if ( size_a == size_b)
cmp_val = 0;
else
cmp_val = 1;
return cmp_val;
}
static int cmp_entries_date(const void *obj_a, const void *obj_b)
{
Entry *entry_a;
Entry *entry_b;
int cmp_val;
int32 date_a;
int32 date_b;
entry_a = (Entry *)obj_a;
entry_b = (Entry *)obj_b;
date_a = entry_a->stat.st_mtime;
date_b = entry_b->stat.st_mtime;
if ( date_a < date_b)
cmp_val = -1;
else if ( date_a == date_b)
cmp_val = 0;
else
cmp_val = 1;
return cmp_val;
}
static int cmp_entries_dirsbeforefiles(const void *obj_a, const void *obj_b)
{
Entry *entry_a;
Entry *entry_b;
int cmp_val;
entry_a = (Entry *)obj_a;
entry_b = (Entry *)obj_b;
if ( entry_a->type == ET_DIR)
cmp_val = ( ( entry_b->type == ET_DIR) ? 0 : -1);
else
cmp_val = ( ( entry_b->type == ET_DIR) ? 1 : 0);
return cmp_val;
}
int16 sort_entries( WINDICON *dirfile)
{
int16 nb_of_dirs = 0;
if ( dirfile->nbr_icons < 2)
return 1;
switch ( sortingmode)
{
case 0: /* directories before files */
/* get number of directories */
qsort(dirfile->entry, dirfile->nbr_icons, sizeof(Entry), cmp_entries_dirsbeforefiles);
while ( (nb_of_dirs < dirfile->nbr_icons) && ( dirfile->entry[nb_of_dirs].type == ET_DIR))
nb_of_dirs++;
/* sort directories */
if (nb_of_dirs > 1)
qsort(dirfile->entry, nb_of_dirs, sizeof(Entry), cmp_entries_name);
/* sort files */
if (dirfile->nbr_icons - nb_of_dirs > 1)
qsort(&dirfile->entry[nb_of_dirs], dirfile->nbr_icons - nb_of_dirs, sizeof(Entry), cmp_entries_name);
break;
case 1 :
/* get number of directories */
qsort(dirfile->entry, dirfile->nbr_icons, sizeof(Entry), cmp_entries_dirsbeforefiles);
while ( (nb_of_dirs < dirfile->nbr_icons) && ( dirfile->entry[nb_of_dirs].type == ET_DIR))
nb_of_dirs++;
/* sort directories */
if (nb_of_dirs > 1)
qsort(dirfile->entry, nb_of_dirs, sizeof(Entry), cmp_entries_name);
/* sort files */
if (dirfile->nbr_icons - nb_of_dirs > 1)
qsort(&dirfile->entry[nb_of_dirs], dirfile->nbr_icons - nb_of_dirs, sizeof(Entry), cmp_entries_size);
break;
case 2 : /* files before directories */
/* get number of directories */
qsort(dirfile->entry, dirfile->nbr_icons, sizeof(Entry), cmp_entries_dirsbeforefiles);
while ( (nb_of_dirs < dirfile->nbr_icons) && ( dirfile->entry[nb_of_dirs].type == ET_DIR))
nb_of_dirs++;
/* sort directories */
if (nb_of_dirs > 1)
qsort(dirfile->entry, nb_of_dirs, sizeof(Entry), cmp_entries_name);
/* sort files */
if (dirfile->nbr_icons - nb_of_dirs > 1)
qsort(&dirfile->entry[nb_of_dirs], dirfile->nbr_icons - nb_of_dirs, sizeof(Entry), cmp_entries_date);
break;
default:
break;
}
return 1;
}

View File

@@ -0,0 +1,2 @@
extern int16 sort_entries( WINDICON *dirfile);
extern int cmp_entries_name(const void *obj_a, const void *obj_b);

View File

@@ -0,0 +1,142 @@
#include "general.h"
#include "pic_load.h"
#include "winimg.h"
#include "mfdb.h"
#include "pic_resize.h"
int16 full_screen = FALSE;
/*==================================================================================*
* void restore_screen: *
* Close the form dialog created previously with clear_screen() function and *
* restore the menubar and the mouse. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void restore_screen( void)
{
form_dial( FMD_FINISH, 0, 0, 1 + app.work_out[0], 1 + app.work_out[1], 0, 0, 1 + app.work_out[0], 1 + app.work_out[1]);
menu_bar( app.menu, 1) ;
v_show_c( app.handle, 0);
}
/*==================================================================================*
* void clear_screen: *
* Open a full size form dialog and hide the mouse.. *
* It's the only way that I know for work in pseudo-fullscreen and remain *
* "GEM friendly". *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void clear_screen( void)
{
int16 xy[8];
vswr_mode( app.handle, MD_REPLACE);
form_dial( FMD_START, 0, 0, 1 + app.work_out[0], 1 + app.work_out[1], 0, 0, 1 + app.work_out[0], 1 + app.work_out[1]);
vsf_perimeter( app.handle, 0);
vsf_interior( app.handle, FIS_SOLID);
xy[0] = xy[1] = 0;
xy[2] = app.work_out[0];
xy[3] = app.work_out[1];
v_hide_c( app.handle);
vsf_color( app.handle, BLACK);
vr_recfl( app.handle, xy);
}
/*==================================================================================*
* void clear_screen: *
* Show a MFDB in fullscreen.. We wait for a keyboard event before to release. *
*----------------------------------------------------------------------------------*
* input: *
* img -> The MFDB to show. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void show_fullscreen( WINDATA *windata)
{
MFDB *out, resized_out = { NULL, app.work_out[0], app.work_out[1], 0, 0, 0, 0, 0, 0}, screen = {0};
int16 posx, posy, xy[8];
IMAGE *img = &windata->img;
/* int16 dum;
char info[256];
*/
full_screen = TRUE;
out = &img->image[windata->page_to_show];
if( out->fd_w > app.work_out[0] || out->fd_h > app.work_out[1])
{
if( pic_resize( &img->image[windata->page_to_show], &resized_out) == 0)
{
errshow( "", ENOMEM);
full_screen = FALSE;
return;
}
out = &resized_out;
}
clear_screen();
wind_update(BEG_UPDATE);
posx = MAX( ( 1 + app.work_out[0] - out->fd_w) >> 1, 0);
posy = MAX( ( 1 + app.work_out[1] - out->fd_h) >> 1, 0);
if (posx == 0)
xy[2] = app.work_out[0];
else
xy[2] = out->fd_w - 1;
if (posy == 0)
xy[3] = app.work_out[1];
else
xy[3] = out->fd_h - 1;
xy[0] = 0;
xy[1] = 0;
xy[4] = posx;
xy[5] = posy;
xy[6] = posx + xy[2];
xy[7] = posy + xy[3];
/* draw the image */
if ( out->fd_nplanes == 1)
{
int16 color[2] = { BLACK, WHITE};
vrt_cpyfm( app.handle, MD_REPLACE, xy, out, &screen, color);
}
else
vro_cpyfm( app.handle, S_ONLY, xy, out, &screen);
/* and now the image's information */
/* sprintf( info, "%dx%dx%d | %ld colors | %s", img->img_w, img->img_h, img->bits, img->colors, img->info);
vst_alignment( app.handle, 2, 4, &dum, &dum);
vst_color( app.handle, BLACK);
vst_point( app.handle, 8, &dum, &dum, &dum, &dum);
v_ftext( app.handle, app.work_out[0] - 4, app.work_out[1] - 4, info);
*/
/* We wait for a keyboard event and after, restore the screen */
evnt_keybd();
if( resized_out.fd_addr != NULL)
gfree( resized_out.fd_addr);
restore_screen();
wind_update( END_UPDATE);
full_screen = FALSE;
}

View File

@@ -0,0 +1,5 @@
extern void restore_screen( void);
extern void clear_screen( void);
extern void show_fullscreen( WINDATA *windata);
extern int16 full_screen;

View File

@@ -0,0 +1,252 @@
/*
* zView.
* Copyright (c) 2004-2005 Zorro ( zorro270@yahoo.fr)
*
* This application 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.1 of the License, or (at your option) any later version.
*
* This application 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "types2b.h"
#include <osbind.h>
#include <mintbind.h>
#include <dirent.h>
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <windom1.h>
#include <scancode.h>
#include <ldg.h>
#include "zaes.h"
#include "zedit/libtedit.h"
#include "pdf/goo/gmem.h"
#include "zview.rsh"
/* Window's Attrib. */
#define WINATTRIB MOVER|NAME|VSLIDE|MOVER|CLOSER|DNARROW|UPARROW|SIZER|SMALLER|FULLER
/* Custom data name */
#define WD_ICON 0x49434F4EL
#define WD_WIMG 0x57494D47L
/* Custom error code */
#define E_NAMEEXIST 10001
#define E_RSC 10002
#define NO_EDDI 10003
#define NO_ICON 10004
/* custom def */
#define preview_mode 1
#define full_size 0
#define ON 1
#define OFF 0
#define UNKNOWN -1
/* xfont text attrib. */
#define BOLD 0x01
#define LIGHT 0x02
#define ITALIC 0x04
#define ULINE 0x08
#define INVERSE 0x10
#define SHADOW 0x20
#define MONOSPACE 0x40
#ifndef MAXNAMLEN
#define MAXNAMLEN 255
#endif
#ifndef MAX_PATH
#define MAX_PATH 1024
#endif
#define shared_malloc( s) _ldg_malloc( s, ldg_global[2]);
#define shared_realloc( s, b) _ldg_realloc( s, b, ldg_global[2]);
#define shared_free( s) _ldg_free( s, ldg_global[2]);
/* MACRO */
#ifndef ABS
#define ABS(val) ( ( ( val) < 0) ? -( val) : ( val))
#endif
#ifndef XATTR
typedef struct
{
uint16 mode;
int32 index;
uint16 dev;
uint16 reserved1;
uint16 nlink;
uint16 uid;
uint16 gid;
int32 size;
int32 blksize;
int32 nblocks;
int16 mtime;
int16 mdate;
int16 atime;
int16 adate;
int16 ctime;
int16 cdate;
int16 attr;
int16 reserved2;
int32 reserved3;
int32 reserved4;
} XATTR;
#endif
typedef struct
{
uint32 item;
uint32 size;
} fileinfo;
typedef enum
{
ET_DIR,
ET_FILE,
ET_IMAGE,
ET_PDF,
ET_PRG
} EntryType;
typedef struct _txt_data
{
int16 lines; /* Number of lines in the text */
int16 max_lines_length; /* The length of the greater line ( in nbr char) */
int8 *txt[256];
} txt_data;
typedef struct
{
/* Image Info */
uint16 img_w, img_h; /* original size */
int16 bits; /* image's colors bits */
int8 working_time[12]; /* ex: 15,2s */
uint32 colors; /* Picture colors's number */
int8 info[38]; /* Information about the image, for ex: "Portable Network Graphic" */
int8 compression[5]; /* Compression type, ex: "LZW" */
int16 page; /* Number of page/image in the file */
uint16 delay[1024]; /* Animation delay in millise. between each frame */
txt_data *comments;
/* Private Data */
int16 view_mode; /* preview or full size view? */
int16 progress_bar; /* display the progress bar? */
/* Private data for the PDF */
void *_priv_ptr;
void *_priv_ptr_more;
/* ------------------------ */
MFDB *image; /* The Image itself */
}IMAGE;
typedef struct _entry
{
int8 name[MAXNAMLEN]; /* The real file's name */
int8 name_shown[100]; /* The file's name shown in the window */
struct stat stat; /* Entry's Unix Stat */
int8 size[15]; /* File size in human readable format */
int8 date[28]; /* date of last modification */
int8 time[12]; /* time of last modification */
int16 icon_txt_w; /* Text width for screen output */
RECT16 txt_pos; /* text position in the window */
RECT16 icn_pos; /* icon position in the window */
RECT16 case_pos; /* case position in the window */
EntryType type; /* icon type */
IMAGE preview; /* the preview data and picture */
MFDB *icon; /* icon */
struct _entry *next_selected;
struct _entry *next;
} Entry;
typedef struct _mini
{
char foldername[MAX_PATH + MAXNAMLEN]; /* Folder name with the full path */
char name[MAXNAMLEN]; /* Folder's name shown in the window */
RECT16 icon_position; /* text position in the window */
RECT16 arrow_position; /* icon position in the window */
struct _mini *parent; /* the parent entry */
struct _mini *child; /* the child(s) entry */
int16 nbr_child; /* number of valid child's entries */
int16 icon_txt_w; /* Text width for screen output */
int16 state; /* Deployed or not ( ON/OFF) */
} Mini_Entry;
typedef struct
{
char directory[MAX_PATH]; /* current directory */
/* File browser data */
int16 border_position[2]; /* frame's border position in the 'x' axe */
int16 case_w; /* case width */
int16 case_h; /* case height */
int16 columns; /* number of columns */
int16 icons_last_line; /* number of icons in the last line */
EDIT *edit; /* Text struct for the edition mode */
Entry *first_selected; /* Pointer to the first icon selected */
Entry *entry; /* pointer to 'Entry' structur */
int16 nbr_icons; /* number of valid icons */
/* "Tree view" data */
Mini_Entry *mini_selected; /* Pointer to 'Mini_Entry' structur */
Mini_Entry *root; /* Pointer to 'Mini_Entry' structur */
int16 nbr_child; /* Number of valid child's entries */
int32 ypos; /* relative data position in the window */
int32 ypos_max; /* Maximal values of previous variables */
int16 h_u; /* vertical and horizontal scroll offset */
} WINDICON;
extern int16 pic_load( const char *file, char *extention, IMAGE *img);
extern void zdebug( const char *format, ...);
extern void applexit( void);
/* Globals variables */
extern WINDOW *win_catalog;
extern WINDOW *win_image;
extern char zview_path[MAX_PATH];
extern int16 mint_os, magic_os;
/* Windom's function not defined in windom.h */
extern void frm_cls( WINDOW *win);
extern void snd_rdw( WINDOW *win);
extern void snd_msg( WINDOW *win, int msg, int par1, int par2, int par3, int par4);
extern void draw_page( WINDOW *win, int x, int y, int w, int h);

View File

@@ -0,0 +1,11 @@
Building zView is a little bit complicated but not that much.
1. Download & compile & install libfreetype2 (the most recent version is
2.4.6 in time of writing this, it's proven to work).
2. Download & compile & install windom 1.21.3 after applying the patch.
3. Rename libwindom.a -> libwindom1.a, same for the header file (windom.h ->
windom1.h)
4. Checkout & compile & install ldg (from the official sf.net site). You
must not use the latest stable version (2.33).
5. Edit the path to libfreetype2 in the toplevel Makefile.
6. make

View File

@@ -0,0 +1,38 @@
diff -ur tiff-3.8.2/libtiff/Makefile.am tiff-3.8.2-new/libtiff/Makefile.am
--- tiff-3.8.2/libtiff/Makefile.am 2006-03-23 15:31:53.000000000 +0100
+++ tiff-3.8.2-new/libtiff/Makefile.am 2011-10-24 21:19:02.146076731 +0200
@@ -108,7 +108,7 @@
libtiff_la_SOURCES = $(SRCS)
libtiff_la_LDFLAGS = \
-no-undefined \
- -version-number $(LIBTIFF_VERSION_INFO)
+ -version-info $(LIBTIFF_VERSION_INFO)
if HAVE_RPATH
libtiff_la_LDFLAGS += $(LIBDIR)
endif
@@ -117,7 +117,7 @@
libtiffxx_la_SOURCES = $(SRCSXX)
libtiffxx_la_LDFLAGS = \
-no-undefined \
- -version-number $(LIBTIFF_VERSION_INFO)
+ -version-info $(LIBTIFF_VERSION_INFO)
if HAVE_RPATH
libtiffxx_la_LDFLAGS += $(LIBDIR)
endif
diff -ur tiff-3.8.2/libtiff/Makefile.in tiff-3.8.2-new/libtiff/Makefile.in
--- tiff-3.8.2/libtiff/Makefile.in 2006-03-23 15:44:45.000000000 +0100
+++ tiff-3.8.2-new/libtiff/Makefile.in 2011-10-24 21:19:12.932758298 +0200
@@ -355,11 +355,11 @@
noinst_HEADERS = $(EXTRA_HDRS)
lib_LTLIBRARIES = libtiff.la $(am__append_2)
libtiff_la_SOURCES = $(SRCS)
-libtiff_la_LDFLAGS = -no-undefined -version-number \
+libtiff_la_LDFLAGS = -no-undefined -version-info \
$(LIBTIFF_VERSION_INFO) $(am__append_3)
libtiff_la_LIBADD = $(LIBPORT)
libtiffxx_la_SOURCES = $(SRCSXX)
-libtiffxx_la_LDFLAGS = -no-undefined -version-number \
+libtiffxx_la_LDFLAGS = -no-undefined -version-info \
$(LIBTIFF_VERSION_INFO) $(am__append_4)
libtiffxx_la_LIBADD = $(LIBTIFF) $(LIBPORT)
libtiffxx_la_DEPENDENCIES = libtiff.la

View File

@@ -0,0 +1,134 @@
diff -ruw windom-1.21.3/include/windom.h windom-1.21.3-new/include/windom.h
--- windom-1.21.3/include/windom.h 2004-11-24 22:08:29.000000000 +0100
+++ windom-1.21.3-new/include/windom.h 2011-10-17 17:13:19.440919410 +0200
@@ -522,11 +522,7 @@
int ApplGet ( int mode, ...);
int ApplSet ( int mode, ...);
int ApplName ( char *name, int handle);
-#ifdef __MSHORT__
int ApplWrite ( int to, int msg, ...);
-#else
-int ApplWrite ( int to, int msg, int b3, int b4, int b5, int b6, int b7);
-#endif
int ApplControl ( int ap_cid, int ap_cwhat);
/* AV library */
diff -ruw windom-1.21.3/src/appl_set.c windom-1.21.3-new/src/appl_set.c
--- windom-1.21.3/src/appl_set.c 2004-11-24 22:08:29.000000000 +0100
+++ windom-1.21.3-new/src/appl_set.c 2011-10-17 17:13:19.440919410 +0200
@@ -44,10 +44,10 @@
if( !CONF(app)) return 2;
va_start( list, mode);
- v1 = va_arg( list, short);
- v2 = va_arg( list, short);
- v3 = va_arg( list, short);
- v4 = va_arg( list, short);
+ v1 = va_arg( list, int);
+ v2 = va_arg( list, int);
+ v3 = va_arg( list, int);
+ v4 = va_arg( list, int);
va_end( list);
switch( mode) {
diff -ruw windom-1.21.3/src/appl_write.c windom-1.21.3-new/src/appl_write.c
--- windom-1.21.3/src/appl_write.c 2004-11-24 22:08:29.000000000 +0100
+++ windom-1.21.3-new/src/appl_write.c 2011-10-17 17:13:19.444252608 +0200
@@ -34,29 +34,6 @@
/* A more pratical call to appl_write() */
-#ifndef __MSHORT__
-
-/* en 32bits, on attend des 'int' plutot que '...' (va_args) en parametre */
-/* car c'est le seul moyen d'<27>viter l'utilisation du code genre */
-/* ApplWrite( to, msg, "tralala"); */
-/* qui fonctionne uniquement en 16 bits si on utilise va_args */
-
-int ApplWrite( int to, int msg, int b3, int b4, int b5, int b6, int b7) {
- INT16 buf[8];
-
- buf[0] = msg;
- buf[1] = app.id;
- buf[2] = 0;
- buf[3] = b3;
- buf[4] = b4;
- buf[5] = b5;
- buf[6] = b6;
- buf[7] = b7;
- return appl_write( to, 16, buf);
-}
-
-#else
-
int ApplWrite( int to, int msg, ...) {
va_list args;
short buf[8];
@@ -65,13 +42,11 @@
buf[1] = app.id;
buf[2] = 0;
va_start( args, msg);
- buf[3] = va_arg( args, short);
- buf[4] = va_arg( args, short);
- buf[5] = va_arg( args, short);
- buf[6] = va_arg( args, short);
- buf[7] = va_arg( args, short);
+ buf[3] = va_arg( args, int);
+ buf[4] = va_arg( args, int);
+ buf[5] = va_arg( args, int);
+ buf[6] = va_arg( args, int);
+ buf[7] = va_arg( args, int);
va_end( args);
return appl_write( to, 16, buf);
}
-#endif
-
diff -ruw windom-1.21.3/src/av_init.c windom-1.21.3-new/src/av_init.c
--- windom-1.21.3/src/av_init.c 2004-11-24 22:08:29.000000000 +0100
+++ windom-1.21.3-new/src/av_init.c 2011-10-17 17:14:40.931886052 +0200
@@ -73,7 +73,8 @@
static int av_ping( int status, long idle) {
INT16 msg[8];
- ApplWrite( app.avid, AV_PROTOKOLL, status, 0, 0, ADR(__av_name));
+ strcpy( app.pipe, __av_name);
+ ApplWrite( app.avid, AV_PROTOKOLL, status, 0, 0, ADR(app.pipe));
if( AvWaitfor( VA_PROTOSTATUS, msg, idle)) {
__av_status[0] = msg[3];
__av_status[1] = msg[4];
diff -ruw windom-1.21.3/src/objc_dup.c windom-1.21.3-new/src/objc_dup.c
--- windom-1.21.3/src/objc_dup.c 2004-11-24 22:08:30.000000000 +0100
+++ windom-1.21.3-new/src/objc_dup.c 2011-10-17 17:13:19.444252608 +0200
@@ -133,7 +133,7 @@
case G_TITLE:
mem_adr = __malloc_obspec(&cpy[i],strlen((char*)wparm->wp_spec)+1);
strcpy(mem_adr,(char*)wparm->wp_spec);
- (char*)wparm->wp_spec = mem_adr;
+ wparm->wp_spec = mem_adr;
break;
}
}
diff -ruw windom-1.21.3/src/objc_string.c windom-1.21.3-new/src/objc_string.c
--- windom-1.21.3/src/objc_string.c 2004-11-24 22:08:30.000000000 +0100
+++ windom-1.21.3-new/src/objc_string.c 2011-10-17 17:13:19.444252608 +0200
@@ -78,7 +78,7 @@
case XFREESTR:
user = tree[idx].ob_spec.userblk;
if( put)
- (char*)((W_PARM*)user->ub_parm)->wp_spec = put;
+ ((W_PARM*)user->ub_parm)->wp_spec = put;
return ( (char*)((W_PARM*)user->ub_parm)->wp_spec);
#ifdef MODIF_XEDIT
diff -ruw windom-1.21.3/src/popup.c windom-1.21.3-new/src/popup.c
--- windom-1.21.3/src/popup.c 2004-11-24 22:08:30.000000000 +0100
+++ windom-1.21.3-new/src/popup.c 2011-10-17 17:13:19.444252608 +0200
@@ -87,7 +87,7 @@
static void uo_init_type( OBJECT *tree, int index, void *func,
int extype, XUSERBLK * uo) {
- (W_PARM *)(uo -> user . ub_parm) = & ( uo -> w_parm );
+ uo -> user . ub_parm = & ( uo -> w_parm );
uo -> user . ub_code = func;
((W_PARM*)uo -> user . ub_parm) -> wp_type = tree[index].ob_type;
((W_PARM*)uo -> user . ub_parm) -> wp_spec = tree[index].ob_spec.index;

View File

@@ -0,0 +1,559 @@
--- /dev/null 2011-11-05 17:04:04.509133295 +0100
+++ new/pdflib.cc 2011-11-05 21:15:20.575216608 +0100
@@ -0,0 +1,487 @@
+#include "../general.h"
+#include "../prefs.h"
+#include "../winimg.h"
+#include "aconf.h"
+#include "../custom_font.h"
+#include "goo/gmem.h"
+#include "goo/GString.h"
+#include "goo/GList.h"
+#include "xpdf/GlobalParams.h"
+#include "xpdf/Object.h"
+#include "xpdf/PDFDoc.h"
+#include "splash/SplashBitmap.h"
+#include "splash/Splash.h"
+#include "xpdf/SplashOutputDev.h"
+#include "xpdf/CharTypes.h"
+#include "xpdf/UnicodeMap.h"
+#include "xpdf/Outline.h"
+#include "xpdf/Link.h"
+
+extern "C" {
+
+
+static char latin_to_atari[] = { /*0x00A0*/'*','<27>','<27>','<27>','*','<27>',17,'<27>','<27>','<27>','<27>','<27>','<27>','-','<27>',
+'<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','*','\'','<27>','<27>','<27>','<27>','*','<27>','<27>','A','A','<27>','<27>','<27>','<27>',
+'<27>','E','<27>','E','E','I','I','I','I','D','<27>','O','O','O','<27>','<27>','x','<27>','U','U','U','<27>','Y','*',
+'<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>',
+'<27>','<27>','<27>','<27>','<27>','y','*','<27>'};
+
+char pdf_title[256];
+
+
+void delete_bookmark_child( Bookmark *book)
+{
+ int i;
+
+ /* if nothing to do, end the function */
+ if( book->child == NULL)
+ return;
+
+ /* make a loop to see if the childs mini entries have child, if it's true, delete it */
+ for ( i = 0; i < book->nbr_child ; i++)
+ {
+ if ( book->child[i].nbr_child)
+ delete_bookmark_child( &book->child[i]);
+ }
+
+ /* Free the memory and put the counter to zero */
+ gfree( book->child);
+ book->child = NULL;
+ book->nbr_child = 0;
+}
+
+
+int setupOutlineItems( WINDOW * win, PDFDoc *doc, GList *items, UnicodeMap *uMap, Bookmark *book, Bookmark *parent)
+{
+ OutlineItem *item;
+ GList *kids;
+ LinkAction *link_action;
+ char buf[8], *test;
+ int i, j, n, count, lenght;
+
+ for (i = 0; i < items->getLength(); ++i)
+ {
+ item = (OutlineItem *)items->get(i);
+
+ book[i].parent = parent;
+ book[i].child = NULL;
+ book[i].nbr_child = 0;
+ book[i].state = UNKNOWN;
+ book[i].valid = FALSE;
+
+ link_action = item->getAction();
+
+ if( link_action && link_action->getKind () == actionGoTo)
+ {
+ LinkGoTo *link = dynamic_cast <LinkGoTo *> (link_action);
+ LinkDest *link_dest = link->getDest();
+ GString *named_dest = link->getNamedDest ();
+
+ if (link_dest != NULL)
+ {
+ if (link_dest->isPageRef ())
+ {
+ Ref page_ref = link_dest->getPageRef ();
+ book[i].linked_page = doc->findPage( page_ref.num, page_ref.gen) - 1;
+ }
+ else
+ {
+ book[i].linked_page = link_dest->getPageNum() - 1;
+ }
+
+ book[i].valid = TRUE;
+ }
+ else if( named_dest != NULL)
+ {
+ link_dest = doc->findDest (named_dest);
+
+ if (link_dest->isPageRef ())
+ {
+ Ref page_ref = link_dest->getPageRef ();
+ book[i].linked_page = doc->findPage( page_ref.num, page_ref.gen) - 1;
+ }
+ else
+ {
+ book[i].linked_page = link_dest->getPageNum () - 1;
+ }
+
+ delete link_dest;
+ book[i].valid = TRUE;
+ }
+ }
+
+ if( book[i].valid == FALSE)
+ continue;
+
+ test = book[i].name;
+
+
+ /* Unicode to Latin 1 */
+ for (j = 0, lenght = 0; j < item->getTitleLength(); ++j)
+ {
+ n = uMap->mapUnicode(item->getTitle()[j], buf, sizeof(buf));
+
+ for( count = 0; n > count && lenght < 254; count++)
+ test[lenght++] = buf[count++];
+ }
+
+ test[lenght] = '\0';
+
+ /* Latin 1 to Atari */
+ for ( lenght = 0; test[lenght] != '\0'; ++lenght)
+ {
+ if( ( uint8)test[lenght] > 0x9F)
+ {
+ uint8 c = ( uint8)test[lenght] - 0xA0;
+ test[lenght] = latin_to_atari[c];
+ }
+ }
+
+ book[i].txt_width = get_text_width( book[i].name);
+
+ item->open();
+
+ if( item->hasKids() && ( kids = item->getKids()) && kids->getLength() > 0)
+ {
+ book[i].nbr_child = kids->getLength();
+ book[i].child = ( Bookmark*)gmalloc( sizeof( Bookmark) * kids->getLength());
+ book[i].state = item->isOpen();
+
+ if( !setupOutlineItems(win, doc, kids, uMap, book[i].child, book))
+ {
+ gfree( book[i].child);
+ book[i].child = NULL;
+ book[i].nbr_child = 0;
+ return( 0);
+ }
+ }
+ }
+ return( 1);
+}
+
+void pdf_build_bookmark( WINDATA *windata, WINDOW *win)
+{
+ IMAGE *img = &windata->img;
+ PDFDoc *doc = ( PDFDoc*)img->_priv_ptr;
+ Outline *outline;
+ GList *items;
+ int i;
+
+ outline = doc->getOutline();
+
+ if( outline == NULL)
+ return;
+
+ items = outline->getItems();
+
+ if( items == NULL)
+ return;
+
+ if ( items->getLength() > 0)
+ {
+ windata->root = ( Bookmark*)gmalloc( sizeof( Bookmark) * items->getLength());
+
+ if( windata->root == NULL)
+ return;
+
+ GString *enc = new GString("Latin1");
+ UnicodeMap *uMap = globalParams->getUnicodeMap(enc);
+ delete enc;
+
+ windata->nbr_bookmark = items->getLength();
+
+ if( !setupOutlineItems( win, doc, items, uMap, windata->root, NULL))
+ {
+ for ( i = 0; i < windata->nbr_bookmark; i++)
+ {
+ if ( windata->root[i].nbr_child)
+ delete_bookmark_child( &windata->root[i]);
+ }
+
+ gfree( windata->root);
+ windata->root = NULL;
+ windata->nbr_bookmark = 0;
+ }
+
+ uMap->decRefCnt();
+ }
+}
+
+
+boolean lib_pdf_load( const char *name, IMAGE *img)
+{
+ PDFDoc *doc = NULL;
+ SplashColor paperColor;
+ SplashOutputDev *splashOut = NULL;
+
+ char* aaString = const_cast<char*>( pdf_aa ? "yes" : "no");
+ globalParams->setAntialias( aaString);
+
+ GString nameString( name);
+ doc = new PDFDoc( &nameString);
+
+ if (!doc->isOk())
+ {
+ delete doc;
+ return FALSE;
+ }
+
+ paperColor[0] = paperColor[1] = paperColor[2] = 0xff;
+ splashOut = new SplashOutputDev( splashModeRGB8, 1, gFalse, paperColor);
+ splashOut->startDoc(doc->getXRef());
+
+ img->bits = 24;
+ img->colors = ( 1L << ( uint32)img->bits) - 1;
+ img->page = ( uint16)doc->getNumPages();
+ img->comments = NULL;
+ img->_priv_ptr = ( void*)doc;
+ img->_priv_ptr_more = ( void*)splashOut;
+
+ strcpy( ( char*)img->info, "PDF");
+ strcpy( ( char*)img->compression, "None");
+
+ return TRUE;
+}
+
+
+
+void pdf_get_page_size( IMAGE *img, int page, uint16 *width, uint16 *height)
+{
+ PDFDoc *doc = ( PDFDoc*)img->_priv_ptr;
+ int rotation = doc->getPageRotate( page);
+
+ if( ( rotation == 90) || ( rotation == 270))
+ {
+ *width = (uint16)doc->getPageCropHeight( page);
+ *height = (uint16)doc->getPageCropWidth( page);
+ }
+ else
+ {
+ *width = (uint16)doc->getPageCropWidth( page);
+ *height = (uint16)doc->getPageCropHeight( page);
+ }
+}
+
+
+void pdf_decode_page( IMAGE *img, int page, double scale)
+{
+ PDFDoc *doc = ( PDFDoc*)img->_priv_ptr;
+ SplashOutputDev *splashOut = ( SplashOutputDev*)img->_priv_ptr_more;
+ int rotation = doc->getPageRotate( page);
+
+ if( ( rotation == 90) || ( rotation == 270))
+ {
+ img->img_w = (uint16)MAX(( doc->getPageCropHeight( page) * scale + 0.5), 1);
+ img->img_h = (uint16)MAX(( doc->getPageCropWidth( page) * scale + 0.5), 1);
+ }
+ else
+ {
+ img->img_w = (uint16)MAX(( doc->getPageCropWidth( page) * scale + 0.5), 1);
+ img->img_h = (uint16)MAX(( doc->getPageCropHeight( page) * scale + 0.5), 1);
+ }
+
+ doc->displayPage( splashOut, page, 72.0 * scale, 72.0 * scale, 0, gFalse, gTrue, gFalse);
+}
+
+
+uint32 *pdf_get_page_addr( IMAGE *img)
+{
+ SplashOutputDev *splashOut = ( SplashOutputDev*)img->_priv_ptr_more;
+ SplashColorPtr data = splashOut->getBitmap()->getDataPtr();
+
+ return ( uint32*)( data); // ( data.rgb8);
+}
+
+static char *InfoString(Dict *infoDict, char *key, UnicodeMap *uMap)
+{
+ Object obj;
+ GString *s1;
+ GBool isUnicode;
+ Unicode u;
+ char buf[8];
+ static char text[256];
+ int i, n, lenght = 0, count;
+
+ if (infoDict->lookup(key, &obj)->isString())
+ {
+ s1 = obj.getString();
+
+ if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff)
+ {
+ isUnicode = gTrue;
+ i = 2;
+ }
+ else
+ {
+ isUnicode = gFalse;
+ i = 0;
+ }
+
+ while ( i < obj.getString()->getLength())
+ {
+ if (isUnicode)
+ {
+ u = ((s1->getChar(i) & 0xff) << 8) | (s1->getChar(i+1) & 0xff);
+ i += 2;
+ }
+ else
+ {
+ u = s1->getChar(i) & 0xff;
+ ++i;
+ }
+
+ n = uMap->mapUnicode(u, buf, sizeof(buf));
+
+ count = 0;
+
+ if(( n + lenght) > 234)
+ {
+ text[lenght] = '\0';
+ obj.free();
+ return ( char*)&text;
+ }
+
+ while( n > count)
+ text[lenght++] = buf[count++];
+ }
+ }
+
+ text[lenght] = '\0';
+ obj.free();
+
+ return ( char*)&text;
+}
+
+static char *InfoDate(Dict *infoDict, char *key)
+{
+ Object obj;
+ char *s;
+ int year, mon, day, hour, min, sec;
+ struct tm tmStruct;
+ static char buf[256];
+
+ if (infoDict->lookup(key, &obj)->isString())
+ {
+ s = obj.getString()->getCString();
+
+ if (s[0] == 'D' && s[1] == ':')
+ {
+ s += 2;
+ }
+
+ if (sscanf(s, "%4d%2d%2d%2d%2d%2d", &year, &mon, &day, &hour, &min, &sec) == 6)
+ {
+ tmStruct.tm_year = year - 1900;
+ tmStruct.tm_mon = mon - 1;
+ tmStruct.tm_mday = day;
+ tmStruct.tm_hour = hour;
+ tmStruct.tm_min = min;
+ tmStruct.tm_sec = sec;
+ tmStruct.tm_wday = -1;
+ tmStruct.tm_yday = -1;
+ tmStruct.tm_isdst = -1;
+ // compute the tm_wday and tm_yday fields
+ if (mktime(&tmStruct) != (time_t)-1 && strftime(buf, sizeof(buf), "%c", &tmStruct))
+ {
+ obj.free();
+ return ( char*)&buf;
+ }
+ }
+
+ strcpy( buf, s);
+ }
+ else buf[0] = '\0';
+
+ obj.free();
+ return ( char*)&buf;
+}
+
+void pdf_get_info( IMAGE *img, txt_data *txtdata)
+{
+ Object info;
+ UnicodeMap *uMap;
+ PDFDoc *doc = ( PDFDoc*)img->_priv_ptr;
+ char *txt;
+
+ if (!( uMap = globalParams->getTextEncoding()))
+ {
+ pdf_title[0] = '\0';
+ txtdata->txt[0][0] = '\0';
+ txtdata->txt[1][0] = '\0';
+ txtdata->txt[2][0] = '\0';
+ txtdata->txt[3][0] = '\0';
+ txtdata->txt[4][0] = '\0';
+ txtdata->txt[5][0] = '\0';
+ txtdata->txt[6][0] = '\0';
+ txtdata->txt[7][0] = '\0';
+ return;
+ }
+
+ doc->getDocInfo(&info);
+
+ if (info.isDict())
+ {
+ txt = InfoString(info.getDict(), "Title", uMap);
+ sprintf( ( char*)txtdata->txt[0] , "Title: %s", txt);
+ strcpy( pdf_title, txt);
+ txt = InfoString(info.getDict(), "Subject", uMap);
+ sprintf( ( char*)txtdata->txt[1] , "Subject: %s", txt);
+ txt = InfoString(info.getDict(), "Keywords", uMap);
+ sprintf( ( char*)txtdata->txt[2] , "Keywords: %s", txt);
+ txt = InfoString(info.getDict(), "Author", uMap);
+ sprintf( ( char*)txtdata->txt[3] , "Author: %s", txt);
+ txt = InfoString(info.getDict(), "Creator", uMap);
+ sprintf( ( char*)txtdata->txt[4] , "Creator: %s", txt);
+ txt = InfoString(info.getDict(), "Producer", uMap);
+ sprintf( ( char*)txtdata->txt[5] , "Producer: %s", txt);
+// sprintf( ( char*)txtdata->txt[6] , "PDF version: %.1f", doc->getPDFVersion());
+
+ txt = InfoDate(info.getDict(), "CreationDate");
+ sprintf( ( char*)txtdata->txt[6] , "Creation Date: %s", txt);
+ txt = InfoDate(info.getDict(), "ModDate");
+ sprintf( ( char*)txtdata->txt[7] , "Modification Date: %s", txt);
+ }
+ else
+ {
+ pdf_title[0] = '\0';
+ txtdata->txt[0][0] = '\0';
+ txtdata->txt[1][0] = '\0';
+ txtdata->txt[2][0] = '\0';
+ txtdata->txt[3][0] = '\0';
+ txtdata->txt[4][0] = '\0';
+ txtdata->txt[5][0] = '\0';
+ txtdata->txt[6][0] = '\0';
+ txtdata->txt[7][0] = '\0';
+ }
+
+ info.free();
+ uMap->decRefCnt();
+}
+
+void pdf_quit( IMAGE *img)
+{
+ PDFDoc *doc = ( PDFDoc*)img->_priv_ptr;
+ SplashOutputDev *splashOut = ( SplashOutputDev*)img->_priv_ptr_more;
+
+ delete splashOut;
+ delete doc;
+}
+
+char *get_pdf_title( void)
+{
+ return ( char*)&pdf_title;
+}
+
+boolean pdf_init( char *path)
+{
+ globalParams = new GlobalParams( NULL);
+ globalParams->setupBaseFonts( path);
+ return TRUE;
+}
+
+void pdf_exit( void)
+{
+ delete globalParams;
+}
+
+}
diff -ruwN _deps/xpdf-3.03/pdflib.h xpdf-3.03/pdflib.h
--- _deps/xpdf-3.03/pdflib.h 1970-01-01 01:00:00.000000000 +0100
+++ xpdf-3.03/pdflib.h 2011-10-16 22:33:31.870338392 +0200
@@ -0,0 +1,13 @@
+boolean lib_pdf_load( const char *name, IMAGE *img);
+void pdf_get_page_size( IMAGE *img, int page, uint16 *width, uint16 *height);
+void pdf_decode_page( IMAGE *img, int page, double scale);
+uint32 *pdf_get_page_addr( IMAGE *img);
+void pdf_quit( IMAGE *img);
+boolean pdf_init( char *path);
+void pdf_exit( void);
+char *get_pdf_title( void) ;
+void pdf_build_bookmark( WINDATA *windata, WINDOW *win);
+void pdf_get_info( IMAGE *img, txt_data *txtdata);
+void delete_bookmark_child( Bookmark *book);
+
+
diff -ruwN _deps/xpdf-3.03/xpdf/GlobalParams.cc xpdf-3.03/xpdf/GlobalParams.cc
--- _deps/xpdf-3.03/xpdf/GlobalParams.cc 2011-08-15 23:08:53.000000000 +0200
+++ xpdf-3.03/xpdf/GlobalParams.cc 2011-10-16 22:33:46.513693391 +0200
@@ -85,20 +85,20 @@
const char *t1FileName;
const char *ttFileName;
} displayFontTab[] = {
- {"Courier", "n022003l.pfb", "cour.ttf"},
- {"Courier-Bold", "n022004l.pfb", "courbd.ttf"},
- {"Courier-BoldOblique", "n022024l.pfb", "courbi.ttf"},
- {"Courier-Oblique", "n022023l.pfb", "couri.ttf"},
- {"Helvetica", "n019003l.pfb", "arial.ttf"},
- {"Helvetica-Bold", "n019004l.pfb", "arialbd.ttf"},
- {"Helvetica-BoldOblique", "n019024l.pfb", "arialbi.ttf"},
- {"Helvetica-Oblique", "n019023l.pfb", "ariali.ttf"},
- {"Symbol", "s050000l.pfb", NULL},
- {"Times-Bold", "n021004l.pfb", "timesbd.ttf"},
- {"Times-BoldItalic", "n021024l.pfb", "timesbi.ttf"},
- {"Times-Italic", "n021023l.pfb", "timesi.ttf"},
- {"Times-Roman", "n021003l.pfb", "times.ttf"},
- {"ZapfDingbats", "d050000l.pfb", NULL},
+ {"Courier", "fonts\\n022003l.pfb", "cour.ttf"},
+ {"Courier-Bold", "fonts\\n022004l.pfb", "courbd.ttf"},
+ {"Courier-BoldOblique", "fonts\\n022024l.pfb", "courbi.ttf"},
+ {"Courier-Oblique", "fonts\\n022023l.pfb", "couri.ttf"},
+ {"Helvetica", "fonts\\n019003l.pfb", "arial.ttf"},
+ {"Helvetica-Bold", "fonts\\n019004l.pfb", "arialbd.ttf"},
+ {"Helvetica-BoldOblique", "fonts\\n019024l.pfb", "arialbi.ttf"},
+ {"Helvetica-Oblique", "fonts\\n019023l.pfb", "ariali.ttf"},
+ {"Symbol", "fonts\\s050000l.pfb", NULL},
+ {"Times-Bold", "fonts\\n021004l.pfb", "timesbd.ttf"},
+ {"Times-BoldItalic", "fonts\\n021024l.pfb", "timesbi.ttf"},
+ {"Times-Italic", "fonts\\n021023l.pfb", "timesi.ttf"},
+ {"Times-Roman", "fonts\\n021003l.pfb", "times.ttf"},
+ {"ZapfDingbats", "fonts\\d050000l.pfb", NULL},
{NULL}
};
@@ -110,11 +110,13 @@
};
#else
static const char *displayFontDirs[] = {
+ /*
"/usr/share/ghostscript/fonts",
"/usr/local/share/ghostscript/fonts",
"/usr/share/fonts/default/Type1",
"/usr/share/fonts/default/ghostscript",
"/usr/share/fonts/type1/gsfonts",
+ */
NULL
};
#endif

View File

@@ -0,0 +1,342 @@
#include "general.h"
#include "ztext.h"
#include "infobox.h"
#include "zedit/zedit.h"
#include "close_modal.h"
#include "pic_load.h"
#include "winimg.h"
#include "file/count.h"
#include "custom_font.h"
#include <math.h>
/* Prototype */
void generic_form_event( WINDOW *win);
void infobox( void);
static int16 dum, res;
static int16 posy, xy[8], dum;
static uint32 ypos_max, ypos;
float slider_pos = 0.0, slider_step = 0.0;
static OBJECT *infotext;
static txt_data *exif_box;
static OBJECT *slider_root;
static short vdi_intin[VDI_INTINMAX];
static short vdi_intout[VDI_INTOUTMAX];
static short vdi_ptsin[VDI_PTSINMAX];
static short vdi_ptsout[VDI_PTSOUTMAX];
static short vdi_control[VDI_CNTRLMAX];
static VDIPB vdi_params = {
&vdi_control[0],
&vdi_intin[0],
&vdi_ptsin[0],
&vdi_intout[0],
&vdi_ptsout[0]
};
static int my_vsl_color (short handle, short idx) {
vdi_intin[0] = idx;
vdi_control[0] = 17;
vdi_control[1] = vdi_control[5] = 0;
vdi_control[3] = 1;
vdi_control[6] = handle;
vdi (&vdi_params);
return ((int)vdi_intout[0]);
}
void CDECL draw_exif_info( WINDOW *win, PARMBLK *pblk, void *data)
{
exif_box = (txt_data *) data;
xy[0] = pblk->pb_x;
xy[1] = pblk->pb_y;
xy[2] = xy[0] + pblk->pb_w - 2;
xy[3] = xy[1] + pblk->pb_h - 1;
vsf_color( win->graf.handle, WHITE);
v_bar( win->graf.handle, xy);
xy[0] = pblk->pb_x + pblk->pb_w - 1;
xy[1] = pblk->pb_y;
xy[2] = pblk->pb_x;
xy[3] = pblk->pb_y;
xy[4] = pblk->pb_x;
xy[5] = pblk->pb_y + pblk->pb_h - 1;
xy[6] = xy[0];
xy[7] = xy[5];
my_vsl_color( win->graf.handle, BLACK);
v_pline( win->graf.handle, 4, xy);
posy = pblk->pb_y;
for ( dum = ypos; dum < exif_box->lines; dum++, posy += 12)
{
if( posy >= ( pblk->pb_y + pblk->pb_h - 1))
break;
draw_text( win->graf.handle, pblk->pb_x + 3, posy + 3, BLACK, exif_box->txt[dum]);
}
}
void calc_exif_slider( WINDOW *win)
{
int16 max_mover_size;
int16 full_win_size = ypos_max * 12;
max_mover_size = slider_root[FILE_INFO_VBACK].ob_height;
slider_root[FILE_INFO_VMOVER].ob_y = 0;
slider_root[FILE_INFO_VMOVER].ob_height = max_mover_size;
if ( slider_root[FILE_INFO_COMMENT].ob_height < full_win_size)
{
float factor = ( float)slider_root[FILE_INFO_COMMENT].ob_height / ( float)full_win_size;
float mover_size = MAX(( float)max_mover_size * factor, 6L);
slider_pos = 0;
slider_step = ( float)max_mover_size / ( float)ypos_max;
slider_root[FILE_INFO_VMOVER].ob_height = ( int16)( mover_size);
}
}
static void slid_up( WINDOW *win, int obj_index, int mode)
{
ObjcChange( mode, win, obj_index, SELECTED, TRUE);
do
{
if ( ypos > 0L)
{
ypos--;
ObjcDraw( OC_FORM, win, FILE_INFO_COMMENT, 1);
slider_pos -= slider_step;
slider_root[FILE_INFO_VMOVER].ob_y = MAX( 0, ( int16)floor( slider_pos));
ObjcDraw( OC_FORM, win, FILE_INFO_VBACK, 2);
}
graf_mkstate( &dum, &dum, &res, &dum);
} while( res);
ObjcChange( mode, win, obj_index, ~SELECTED, TRUE);
}
static void slid_down( WINDOW *win, int obj_index, int mode)
{
ObjcChange( mode, win, obj_index, SELECTED, TRUE);
do
{
if (( ypos < ( ypos_max - slider_root[FILE_INFO_COMMENT].ob_height / 12)) && ( ypos_max > slider_root[FILE_INFO_COMMENT].ob_height / 12))
{
ypos ++;
ObjcDraw( OC_FORM, win, FILE_INFO_COMMENT, 1);
slider_pos += slider_step;
slider_root[FILE_INFO_VMOVER].ob_y = ( int16)floor( slider_pos);
ObjcDraw( OC_FORM, win, FILE_INFO_VBACK, 2);
}
graf_mkstate( &dum, &dum, &res, &dum);
} while( res);
ObjcChange( mode, win, obj_index, ~SELECTED, TRUE);
}
static void slid_vmover( WINDOW *win, int obj_index, int mode)
{
int32 old_ypos = ypos;
ObjcChange( mode, win, obj_index, SELECTED, TRUE);
graf_mouse( FLAT_HAND, NULL);
while( !wind_update( BEG_MCTRL));
res = graf_slidebox( slider_root, FILE_INFO_VBACK, FILE_INFO_VMOVER, 1);
wind_update( END_MCTRL);
ypos = MAX( 0, ( ypos_max - slider_root[FILE_INFO_COMMENT].ob_height / 12) * res / 1000L);
if( old_ypos != ypos)
{
slider_pos = ypos * slider_step;
slider_root[FILE_INFO_VMOVER].ob_y = ( int16)floor( slider_pos);
ObjcDraw( OC_FORM, win, FILE_INFO_VBACK, 2);
ObjcDraw( OC_FORM, win, FILE_INFO_COMMENT, 1);
}
graf_mouse( ARROW, NULL);
ObjcChange( mode, win, obj_index, ~SELECTED, TRUE);
}
/*==================================================================================*
* void infobox: *
* Show the infobox for a image or a file. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void infobox( void)
{
WINDOW *wininfo;
WINDICON *wicones;
WINDATA *windata;
IMAGE *img;
char temp[30];
float uncompressed_size;
int32 file_size;
int16 name_len;
int frms[] = { FILE_INFO_PANEL1, FILE_INFO_PANEL2, FILE_INFO_PANEL3};
int buts[] = { FILE_INFO_FILE, FILE_INFO_IMAGE, FILE_INFO_EXIF};
infotext = get_tree( FILE_INFO);
if(( wicones = ( WINDICON *)DataSearch( wglb.front, WD_ICON))) /* See if the target picture is in the catalog window */
{
Entry *entry = wicones->first_selected;
img = &entry->preview;
file_size = entry->stat.st_size;
if( wicones->edit)
exit_edit_mode( win_catalog, wicones->first_selected);
name_len = MIN( 29, strlen( entry->name));
zstrncpy( temp, entry->name, name_len+1);
ObjcStrCpy( infotext, FILE_INFO_NAME, temp);
ObjcStrCpy( infotext, FILE_INFO_DATE, entry->date);
ObjcStrCpy( infotext, FILE_INFO_TIME, entry->time);
if( entry->type == ET_DIR)
{
fileinfo file;
graf_mouse( BUSYBEE, NULL);
if( !count_files( wicones, &file))
{
errshow( "", errno);
return;
}
size_to_text( temp, ( float)file.size);
ObjcStrCpy( infotext, FILE_INFO_SIZE, temp);
graf_mouse( ARROW, NULL);
}
else
ObjcStrCpy( infotext, FILE_INFO_SIZE, entry->size);
}
else if(( windata = (WINDATA *)DataSearch( wglb.front, WD_DATA))) /* See if the picture is in a "normal" window */
{
struct stat file_stat;
struct tm *tmt;
int16 path_len, file_len;
int8 *fullname = windata->name;
img = &windata->img;
file_len = ( int16)strlen( fullname);
path_len = file_len;
while(( fullname[path_len] != '/') && ( fullname[path_len] != '\\'))
path_len--;
name_len = MIN( 29, file_len - path_len);
path_len++;
zstrncpy( temp, &fullname[path_len], name_len+1);
ObjcStrCpy( infotext, FILE_INFO_NAME, temp);
lstat( fullname, &file_stat);
file_size = file_stat.st_size;
size_to_text( temp, ( float)file_stat.st_size);
ObjcStrCpy( infotext, FILE_INFO_SIZE, temp);
tmt = localtime(&file_stat.st_mtime);
strftime( temp, 28, "%A %d %B %Y", tmt);
ObjcStrCpy( infotext, FILE_INFO_DATE, temp);
strftime( temp, 12, "%H:%M:%S", tmt);
ObjcStrCpy( infotext, FILE_INFO_TIME, temp);
}
else
return; /* normally, never */
if( img->comments)
infotext[FILE_INFO_EXIF].ob_flags &= ~HIDETREE;
else
infotext[FILE_INFO_EXIF].ob_flags |= HIDETREE;
if ( img->page)
{
infotext[FILE_INFO_IMAGE].ob_flags &= ~HIDETREE;
sprintf( infotext[FILE_INFO_COLOR].ob_spec.tedinfo->te_ptext, "%ld", img->colors);
sprintf( infotext[FILE_INFO_WIDTH].ob_spec.tedinfo->te_ptext, "%d", img->img_w);
sprintf( infotext[FILE_INFO_HEIGHT].ob_spec.tedinfo->te_ptext, "%d", img->img_h);
sprintf( infotext[FILE_INFO_PLANES].ob_spec.tedinfo->te_ptext, "%d", img->bits);
sprintf( infotext[FILE_INFO_PAGE].ob_spec.tedinfo->te_ptext, "%d", img->page);
ObjcStrCpy( infotext, FILE_INFO_DEC_TIME, img->working_time);
ObjcStrCpy( infotext, FILE_INFO_COMPRESSION, img->compression);
ObjcStrCpy( infotext, FILE_INFO_INFO, img->info);
/* Calculate the Image decompressed size */
uncompressed_size = (((( float)img->img_w / 8.0) + 1) * ( float)img->bits) * ( float)img->img_h;
size_to_text( infotext[FILE_INFO_MEM].ob_spec.tedinfo->te_ptext, uncompressed_size);
sprintf( infotext[FILE_INFO_RATIO].ob_spec.tedinfo->te_ptext, "%.1f : 1", uncompressed_size / ( float)file_size);
}
else
infotext[FILE_INFO_IMAGE].ob_flags |= HIDETREE;
wininfo = FormCreate( infotext, NAME|MOVER|CLOSER, NULL, "Information", NULL, TRUE, FALSE);
FormThumb( wininfo, frms, buts, 3);
WindSet( wininfo, WF_BEVENT, BEVENT_MODAL, 0, 0, 0);
EvntAttach( wininfo, WM_CLOSED, close_modal);
if( img->comments)
{
ypos = 0;
ypos_max = img->comments->lines;
wininfo->h_u = 12;
slider_root = FORM( wininfo);
calc_exif_slider( wininfo);
RsrcUserDraw ( OC_FORM, wininfo, FILE_INFO_COMMENT, draw_exif_info, ( void*)img->comments);
// draw_exif_info( wininfo);
ObjcAttach( OC_FORM, wininfo, FILE_INFO_UP, BIND_FUNC, slid_up);
ObjcAttach( OC_FORM, wininfo, FILE_INFO_DOWN, BIND_FUNC, slid_down);
ObjcAttach( OC_FORM, wininfo, FILE_INFO_VMOVER, BIND_FUNC, slid_vmover);
}
MenuDisable();
}

View File

@@ -0,0 +1,29 @@
typedef struct slider
{
float min, max;
float sinc, linc;
int ori; /* HORI,VERT*/
int upd; /* */
float value; /* valeur courante */
void (*doslid)( WINDOW *win, int mode, float value, void *data); /* Pas fix<69> sur les sp<73>cifs */
void *data; /* user data for user function */
int mode;
WINDOW *win;
int up, dn, sld, bsld;
} SLIDER;
typedef struct
{
txt_data *txt;
int32 ypos; /* relative data position in the window */
int32 ypos_max; /* Maximal values of previous variables */
int16 h_u; /* vertical and horizontal scroll offset */
int32 xpos;
int32 xpos_max;
int16 w_u;
} exif_box_data;
extern void infobox( void);

View File

@@ -0,0 +1,118 @@
#include "general.h"
#include "prefs.h"
#include "ztext.h"
#include "pic_load.h"
#include "catalog/catalog.h"
OBJECT *jpg_option_content;
static int16 quality = 90;
static J_COLOR_SPACE color_space = JCS_RGB;
static boolean progressive = FALSE;
static boolean show_preview = FALSE;
void *jpg_option_slider = NULL;
extern void CDECL ( *set_jpg_option)( int16 set_quality, J_COLOR_SPACE set_color_space, boolean set_progressive);
static void jpg_option_close( WINDOW *win)
{
free( jpg_option_slider);
frm_cls( win);
}
static void jpg_option_gray_event( WINDOW *win, int16 obj_index)
{
color_space = ( color_space == JCS_RGB ? JCS_GRAYSCALE : JCS_RGB);
/* a wait loop while the mouse button is pressed */
while(( evnt.mbut == 1) || ( evnt.mbut == 2))
graf_mkstate( &evnt.mx, &evnt.my, &evnt.mbut, &evnt.mkstate);
}
static void jpg_option_progressive_event( WINDOW *win, int16 obj_index)
{
progressive = ( progressive == TRUE ? FALSE : TRUE);
/* a wait loop while the mouse button is pressed */
while(( evnt.mbut == 1) || ( evnt.mbut == 2))
graf_mkstate( &evnt.mx, &evnt.my, &evnt.mbut, &evnt.mkstate);
}
static void jpg_option_show_preview( WINDOW *win, int16 obj_index)
{
show_preview = ( show_preview == TRUE ? FALSE : TRUE);
/* a wait loop while the mouse button is pressed */
while(( evnt.mbut == 1) || ( evnt.mbut == 2))
graf_mkstate( &evnt.mx, &evnt.my, &evnt.mbut, &evnt.mkstate);
}
static void jpg_option_ok_event( WINDOW *win, int16 obj_index)
{
set_jpg_option( quality, color_space, progressive);
ObjcChange( OC_FORM, win, obj_index, NORMAL, TRUE);
ApplWrite( app.id, WM_CLOSED, win->handle, 0, 0, 0, 0);
}
static void jpg_option_slider_event( WINDOW *win, int mode, float value)
{
quality = ( int16)value;
evnt_timer( 50);
sprintf( ObjcString( FORM( win), JPGPREF_PERCENT, NULL), "%d", quality);
ObjcDraw( mode, win, JPGPREF_PERCENT, TRUE);
}
/*==================================================================================*
* void jpg_option_dialog: *
* Open and handle JPG encoder option dialog. *
*----------------------------------------------------------------------------------*
* input: *
* source_file: the full path name of the source file. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void jpg_option_dialog( char *source_file)
{
// struct stat file_stat;
WINDOW *win;
jpg_option_content = get_tree( JPGPREF);
// stat( source_file, &file_stat);
// size_to_text( ObjcString( jpg_option_content, JPGPREF_ORIGINAL_SIZE, NULL), ( float)file_stat.st_size);
// sprintf( ObjcString( jpg_option_content, JPGPREF_PERCENT, NULL), "%d", quality);
jpg_option_content[JPGPREF_SL].ob_x = quality;
if( ( win = FormCreate( jpg_option_content, NAME|MOVER, NULL, get_string( JPG_OPTION_TITLE), NULL, TRUE, FALSE)) == NULL)
{
WindClose( win);
errshow( "", ALERT_WINDOW);
return;
}
// RsrcUserDraw ( OC_FORM, win, JPGPREF_ORIGINAL, draw_object_image, NULL);
// RsrcUserDraw ( OC_FORM, win, JPGPREF_RESULT, draw_object_image, NULL);
WindSet( win, WF_BEVENT, BEVENT_MODAL, 0, 0, 0);
if( ( jpg_option_slider = SlidCreate( 1, 100, 1, 10, quality, SLD_HORI, SLD_IMME)) == NULL)
{
frm_cls( win);
errshow( "", ENOMEM);
return;
}
EvntAttach( win, WM_CLOSED, jpg_option_close);
SlidAttach( jpg_option_slider, OC_FORM, win, JPGPREF_LF, JPGPREF_PG, JPGPREF_SL, JPGPREF_RT);
SlidSetFunc( jpg_option_slider, jpg_option_slider_event, NULL);
// ObjcAttach( OC_FORM, win, JPGPREF_PREVIEW, BIND_FUNC, jpg_option_show_preview);
ObjcAttach( OC_FORM, win, JPGPREF_GRAY, BIND_FUNC, jpg_option_gray_event);
ObjcAttach( OC_FORM, win, JPGPREF_OK, BIND_FUNC, jpg_option_ok_event);
ObjcAttach( OC_FORM, win, JPGPREF_PROGRESSIVE, BIND_FUNC, jpg_option_progressive_event);
}

View File

@@ -0,0 +1,171 @@
#include "general.h"
#include "catalog/catalog_icons.h"
#include "menu.h"
#include "prefs.h"
#include "pic_load.h"
#include "winimg.h"
#include "pdf_load.h"
#include "pdf/pdflib.h"
#include "plugins.h"
#include "av_prot.h"
#include "wintimer.h"
#include "zvdi/vdi.h"
#include "catalog/catalog.h"
#include <av.h>
WINDOW *win_catalog = NULL;
char zview_path[MAX_PATH];
int16 mint_os = 0, magic_os = 0;
/*==================================================================================*
* void applexit: *
* The clean "end" function: *
* - Close all the windows. *
* - Free up the memory used by the plugins ( if any), the icons and the rsc *
* file. *
* - Close the windom's av_client function. *
* - Finnish the Application. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void applexit( void)
{
while( wglb.first)
{
snd_msg( wglb.first, WM_DESTROY, 0, 0, 0, 0);
EvntWindom( MU_MESAG);
}
EvntDelete( NULL, WM_XTIMER);
if( pdf_initialised == TRUE)
pdf_exit();
( void)prefs_write();
plugins_quit();
icons_exit();
MenuBar ( NULL, 0);
RsrcXtype( 0, NULL, 0);
RsrcFree();
AvExit();
ApplExit();
#ifdef DEBUG
gMemReport();
#endif
exit( 0);
}
/*==================================================================================*
* void applinit: *
* The global initialisation function: *
* - Initialise the application via Windom ( "ApplInit"). *
* - Inquire if MagiC/MiNT are present and set the good Pdomain(). *
* - Inquire screen's information ( "vdi_init"). *
* - Register the application with the AES ( "menu_register"). *
* - Load the ressource's file and read the application prefs ( "prefs_read"). *
* - Initialise the av_client , the menu bar and load the plugins ( if any). *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void applinit( void)
{
ApplInit();
if( !vdi_init())
{
errshow( "", NO_EDDI);
ApplExit();
exit( 0);
}
/* is it unusefull ? */
if( _AESnumapps == -1)
menu_register( app.id, " zView ");
if( !RsrcLoad( "zview.rsc"))
{
errshow( "", E_RSC);
ApplExit();
exit( 0);
}
magic_os = vq_magx();
mint_os = vq_mint();
if ( magic_os || mint_os)
{
( void)Pdomain( 1);
}
RsrcXtype( RSRC_XTYPE, NULL, 0);
if( AvInit( "ZVIEW ", A_START|A_QUOTE, 1000 ) >= 0)
EvntAttach( NULL, VA_START, va_start);
/* Get the current path for the different file loading like icon, etc... */
zview_path[0] = 'A' + Dgetdrv();
zview_path[1] = ':';
Dgetpath( zview_path + 2, 0);
prefs_read();
MenuDesktop();
EvntAttach( NULL, AP_TERM, applexit);
/* Load the plugins.. */
if( plugins_init() == 0)
{
errshow( "", NOZCODECS);
applexit();
}
TimerInit( 20);
evnt.bclick = 258;
evnt.bmask = 3;
evnt.bstate = 0;
}
/*==================================================================================*
* int main: *
* The main function: *
*----------------------------------------------------------------------------------*
* input: *
* argc, *argv -> the application's parameters. *
*----------------------------------------------------------------------------------*
* returns: *
* 0. *
*==================================================================================*/
int main( int argc, char *argv[])
{
applinit();
if ( argc > 1)
WindView( argv[argc - 1]);
for(;;)
EvntWindom( MU_MESAG|MU_TIMER|MU_KEYBD|MU_BUTTON);
return 0;
}

View File

@@ -0,0 +1,685 @@
#include "general.h"
#include "prefs.h"
#include "pic_load.h"
#include "winimg.h"
#include "infobox.h"
#include "close_modal.h"
#include "pref_dialog.h"
#include "full_scr.h"
#include "file/sort.h"
#include "file/delete.h"
#include "catalog/catalog.h"
#include "catalog/catalog_entry.h"
#include "zedit/zedit.h"
/* Prototype */
static void MenuHandle( void);
static void Menu_about( void);
void Menu_open_image( void);
static void Menu_preference( void);
static void Menu_file_info( void);
static void Menu_close_win( void);
static void Menu_show_non_image( void);
static void Menu_sort_by_name( void);
static void Menu_sort_by_size( void);
static void Menu_sort_by_date( void);
static void Menu_thumb_size( void);
static void Menu_delete( void);
static void Menu_show_browser( void);
void MenuDesktop( void);
extern char fullname[MAX_PATH+MAXNAMLEN];
extern void save_dialog( const char *fullfilename);
/*==================================================================================*
* void MenuHandle: *
* Windom function to handle the TOS menubar statut ( selected or not). *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void MenuHandle( void)
{
MenuTnormal( NULL, evnt.buff[3], 1);
}
/*==================================================================================*
* void Menu_about: *
* Show the about box. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_about( void)
{
OBJECT *aboutbox = get_tree( ABOUT);
WINDOW *winabout = FormCreate( aboutbox, NAME|MOVER|CLOSER, generic_form_event, get_string( ABOUT_TITLE), NULL, TRUE, FALSE);
/* Set the window modal */
WindSet( winabout, WF_BEVENT, BEVENT_MODAL, 0, 0, 0);
/* New closer event function */
EvntAttach( winabout, WM_CLOSED, close_modal);
/* Disable the desktop menu */
MenuDisable();
}
/*==================================================================================*
* void Menu_open_image: *
* Handle the "Open" option in the TOS menubar. *
* It opens the file selector and after, it loads the wanted picture *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void Menu_open_image( void)
{
static char path[MAX_PATH] = "C:\\"; /* Fist usage : current directory */
char name[MAXNAMLEN] = "";
if( FselInput( path, name, "*.*", get_string( LOAD_TITLE), NULL, NULL))
{
/* if a file is not selected, return */
if( strcmp ( name, "") == 0)
return;
strcpy( fullname, path);
strcat( fullname, name);
WindView( fullname);
}
}
/*==================================================================================*
* void Menu_file_info: *
* Handle the "Info" option in the TOS menubar. *
* It opens the info's dialog boxe and show various information about the file *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_file_info( void)
{
infobox();
}
/*==================================================================================*
* void Menu_preference: *
* Handle the "Preference" option in the TOS menubar. *
* It opens the preference's dialog boxe. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_preference( void)
{
preference_dialog();
}
/*==================================================================================*
* void Menu_file_save: *
* Handle the "Save as" option in the TOS menubar. *
* It opens the save's dialog boxe. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_file_save( void)
{
WINDICON *wicones;
WINDATA *windata;
if(( wicones = ( WINDICON *)DataSearch( wglb.front, WD_ICON))) /* See if the target picture is in the catalog window */
{
if( !wicones->first_selected || wicones->first_selected->type != ET_IMAGE)
return;
if( wicones->edit)
exit_edit_mode( win_catalog, wicones->first_selected);
strcpy( fullname, wicones->directory);
strcat( fullname, wicones->first_selected->name);
save_dialog( fullname);
}
else if(( windata = ( WINDATA *)DataSearch( wglb.front, WD_DATA))) /* See if the picture is in a "normal" window */
{
save_dialog( windata->name);
}
}
/*==================================================================================*
* void Menu_close_win: *
* Handle the "Close Window" option in the TOS menubar. *
* It close the "focused" window. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_close_win( void)
{
if( wglb.front)
{
ApplWrite( app.id, WM_DESTROY, wglb.front->handle, 0, 0, 0, 0);
}
}
/*==================================================================================*
* void Menu_delete: *
* Handle the "delete" option in the TOS menubar. *
* This function delete all selected files and directories. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_delete( void)
{
WINDICON *wicones;
if ( !win_catalog)
return;
wicones = ( WINDICON *)DataSearch( win_catalog, WD_ICON);
if( wicones->first_selected)
{
if( wicones->edit)
exit_edit_mode( win_catalog, wicones->first_selected);
delete_entry( win_catalog);
}
}
/*==================================================================================*
* void Menu_select_all: *
* Handle the "Select All" option in the TOS menubar. *
* This function mark as selected all file from the directory active. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_select_all( void)
{
WINDICON *wicones;
int16 i, x, y, w, h;
if ( !win_catalog)
return;
wicones = ( WINDICON *)DataSearch( win_catalog, WD_ICON);
if( wicones->edit)
exit_edit_mode( win_catalog, wicones->first_selected);
for ( i = 0 ; i < wicones->nbr_icons; i++)
{
if ( ( !show_non_image) && ( wicones->entry[i].type != ET_IMAGE))
continue;
if( !check_selected_entry( wicones, &wicones->entry[i]))
add_selected_entry( wicones, &wicones->entry[i]);
}
WindGet( win_catalog, WF_WORKXYWH, &x, &y, &w, &h);
draw_page( win_catalog, x + browser_frame_width + border_size , y, w - ( browser_frame_width + border_size), h);
}
/*==================================================================================*
* void Menu_show_non_image: *
* Handle the "Show Non-Image" option in the TOS menubar. *
* This function shows common file in the catalog window. *
* So, both the image files and the comon files are shown. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_show_non_image( void)
{
if ( !show_non_image)
{
MenuIcheck( NULL, MENU_BAR_SHOW, 1);
show_non_image = 1;
if( win_catalog)
WinCatalog_filelist_redraw();
}
else
{
MenuIcheck( NULL, MENU_BAR_SHOW, 0);
show_non_image = 0;
if( win_catalog)
WinCatalog_filelist_redraw();
WindMakePreview( win_catalog);
}
}
/*==================================================================================*
* void Menu_sort_by_name: *
* Handle the "Sort by name" option in the TOS menubar. *
* This function sorts the files in the catalog window in alphabetical order. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_sort_by_name( void)
{
if ( sortingmode != 0)
{
WINDICON *wicones;
MenuIcheck( NULL, MENU_BAR_BY_NAME, 1);
MenuIcheck( NULL, MENU_BAR_BY_SIZE, 0);
MenuIcheck( NULL, MENU_BAR_BY_DATE, 0);
sortingmode = 0;
if( !win_catalog)
return;
wicones = ( WINDICON *)DataSearch( win_catalog, WD_ICON);
sort_entries( wicones);
WinCatalog_filelist_redraw();
}
}
/*==================================================================================*
* void Menu_sort_by_size: *
* Handle the "Sort by size" option in the TOS menubar. *
* This function sorts the files by size in the catalog window. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_sort_by_size( void)
{
if ( sortingmode != 1)
{
WINDICON *wicones;
MenuIcheck( NULL, MENU_BAR_BY_SIZE, 1);
MenuIcheck( NULL, MENU_BAR_BY_DATE, 0);
MenuIcheck( NULL, MENU_BAR_BY_NAME, 0);
sortingmode = 1;
if( !win_catalog)
return;
wicones = ( WINDICON *)DataSearch( win_catalog, WD_ICON);
sort_entries( wicones);
WinCatalog_filelist_redraw();
}
}
/*==================================================================================*
* void Menu_sort_by_date: *
* Handle the "Sort by date" option in the TOS menubar. *
* This function sorts the files by date in the catalog window. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_sort_by_date( void)
{
if ( sortingmode != 2)
{
WINDICON *wicones;
MenuIcheck( NULL, MENU_BAR_BY_NAME, 0);
MenuIcheck( NULL, MENU_BAR_BY_SIZE, 0);
MenuIcheck( NULL, MENU_BAR_BY_DATE, 1);
sortingmode = 2;
if( !win_catalog)
return;
wicones = ( WINDICON *)DataSearch( win_catalog, WD_ICON);
sort_entries( wicones);
WinCatalog_filelist_redraw();
}
}
/*==================================================================================*
* void Menu_fullscreen: *
* Show a picture in fullscreen mode. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_fullscreen( void)
{
WINDATA *windata;
if( !wglb.front)
return;
windata = ( WINDATA *)DataSearch( wglb.front, WD_DATA);
if( !windata)
return;
show_fullscreen( windata);
}
/*==================================================================================*
* void Menu_show_browser: *
* Handle the "Show Browser" option in the TOS menubar. *
* This function shows the folder's browser frame in the catalog window. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_show_browser( void)
{
if( browser_frame_width)
{
old_browser_size = browser_frame_width;
old_border_size = border_size;
browser_frame_width = 0;
border_size = 0;
MenuIcheck( NULL, MENU_BAR_SHOW_BROWSER, 0);
}
else
{
browser_frame_width = old_browser_size;
border_size = old_border_size;
MenuIcheck( NULL, MENU_BAR_SHOW_BROWSER, 1);
}
if( win_catalog)
{
int16 dum, xw, yw, hw, ww, x, y, w, h;
WINDICON *wicones = (WINDICON *)DataSearch( win_catalog, WD_ICON);
WindGet ( win_catalog, WF_WORKXYWH, &x, &y, &w, &h);
WindCalc( WC_BORDER, win_catalog, 0, 0, wicones->case_w + border_size + browser_frame_width, wicones->case_h, &dum, &dum, &ww, &dum);
win_catalog -> w_min = ww;
if( win_catalog -> w_min > w)
{
WindGet ( win_catalog, WF_CURRXYWH, &xw, &yw, &dum, &hw);
wind_set( win_catalog -> handle, WF_CURRXYWH, xw, yw, ww, hw);
}
win_catalog->ypos = 0;
WinCatalog_Refresh( win_catalog);
if ( wicones->nbr_icons && wicones->first_selected)
{
if( wicones->first_selected->txt_pos.y2 > h)
{
while ( wicones->first_selected->txt_pos.y2 > h)
{
wicones->first_selected->txt_pos.y2 -= win_catalog->h_u;
win_catalog->ypos++;
}
}
}
draw_page( win_catalog, x, y, w, h);
WindMakePreview( win_catalog);
}
}
/*==================================================================================*
* void Menu_show_preview_area: *
* Handle the "Show Preview Area" option in the TOS menubar. *
* This function shows the "preview" frame in the catalog window. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
/* static void Menu_show_preview_area( void)
{
if( preview_frame_height)
{
old_preview_area_size = preview_frame_height;
preview_frame_height = 0;
MenuIcheck( NULL, MENU_BAR_SHOW_PREVIEW, 0);
}
else
{
preview_frame_height = old_preview_area_size;
MenuIcheck( NULL, MENU_BAR_SHOW_PREVIEW, 1);
}
if( win_catalog && browser_frame_width)
{
int16 dum, x, y, h;
WindGet ( win_catalog, WF_WORKXYWH, &x, &y, &dum, &h);
draw_page( win_catalog, x, y, browser_frame_width + border_size, h);
WindMakePreview( win_catalog);
}
}
*/
/*==================================================================================*
* void Menu_thumb_size: *
* Set the thumbnails's size from 4:3 to 3:4 and from 3:4 to 4:3 *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_thumb_size( void)
{
if ( thumbnail_size > 3)
{
if ( thumbnail_size == 4) thumbnail_size = 0;
else
if ( thumbnail_size == 5) thumbnail_size = 1;
else
if ( thumbnail_size == 6) thumbnail_size = 2;
else thumbnail_size = 3;
MenuIcheck( NULL, MENU_BAR_LARGE_THUMB, 1);
MenuIcheck( NULL, MENU_BAR_LONG_THUMB, 0);
}
else
{
if ( thumbnail_size == 0) thumbnail_size = 4;
else
if ( thumbnail_size == 1) thumbnail_size = 5;
else
if ( thumbnail_size == 2) thumbnail_size = 6;
else thumbnail_size = 7;
MenuIcheck( NULL, MENU_BAR_LONG_THUMB, 1);
MenuIcheck( NULL, MENU_BAR_LARGE_THUMB, 0);
}
if( win_catalog)
WinCatalog_set_thumbnails_size( win_catalog);
}
/*==================================================================================*
* void Menu_show_help: *
* Call StGuide and show "zview.hyp" with it. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_show_help( void)
{
strcpy( fullname, zview_path);
strcat( fullname, "\\doc\\zview.hyp");
CallStGuide( fullname);
}
/*==================================================================================*
* void Menu_show_history: *
* Call StGuide and show "history.txt" with it. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
static void Menu_show_history( void)
{
strcpy( fullname, zview_path);
strcat( fullname, "\\doc\\history.txt");
CallStGuide( fullname);
}
/*==================================================================================*
* void Menu_sort_by_date: *
* Bind the wanted function with the items in the TOS menubar. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void MenuDesktop( void)
{
MenuBar ( get_tree( MENU_BAR), 1);
/* Attach Menu functions */
ObjcAttach( OC_MENU, NULL, MENU_BAR_OPEN, BIND_FUNC, Menu_open_image);
ObjcAttach( OC_MENU, NULL, MENU_BAR_ABOUT, BIND_FUNC, Menu_about);
ObjcAttach( OC_MENU, NULL, MENU_BAR_QUIT, BIND_FUNC, applexit);
ObjcAttach( OC_MENU, NULL, MENU_BAR_BROWSER, BIND_FUNC, WinCatalog);
ObjcAttach( OC_MENU, NULL, MENU_BAR_CLOSE, BIND_FUNC, Menu_close_win);
ObjcAttach( OC_MENU, NULL, MENU_BAR_SHOW, BIND_FUNC, Menu_show_non_image);
ObjcAttach( OC_MENU, NULL, MENU_BAR_BY_NAME, BIND_FUNC, Menu_sort_by_name);
ObjcAttach( OC_MENU, NULL, MENU_BAR_BY_SIZE, BIND_FUNC, Menu_sort_by_size);
ObjcAttach( OC_MENU, NULL, MENU_BAR_BY_DATE, BIND_FUNC, Menu_sort_by_date);
ObjcAttach( OC_MENU, NULL, MENU_BAR_SHOW_BROWSER, BIND_FUNC, Menu_show_browser);
ObjcAttach( OC_MENU, NULL, MENU_BAR_SELECT_ALL, BIND_FUNC, Menu_select_all);
ObjcAttach( OC_MENU, NULL, MENU_BAR_LARGE_THUMB, BIND_FUNC, Menu_thumb_size);
ObjcAttach( OC_MENU, NULL, MENU_BAR_LONG_THUMB, BIND_FUNC, Menu_thumb_size);
ObjcAttach( OC_MENU, NULL, MENU_BAR_INFORMATION, BIND_FUNC, Menu_file_info);
ObjcAttach( OC_MENU, NULL, MENU_BAR_PREFERENCE, BIND_FUNC, Menu_preference);
ObjcAttach( OC_MENU, NULL, MENU_BAR_SAVE, BIND_FUNC, Menu_file_save);
ObjcAttach( OC_MENU, NULL, MENU_BAR_DELETE, BIND_FUNC, Menu_delete);
ObjcAttach( OC_MENU, NULL, MENU_BAR_HISTORY, BIND_FUNC, Menu_show_history);
ObjcAttach( OC_MENU, NULL, MENU_BAR_GUIDE, BIND_FUNC, Menu_show_help);
ObjcAttach( OC_MENU, NULL, MENU_BAR_SHOW_FULLSCREEN, BIND_FUNC, Menu_fullscreen);
if( browser_frame_width)
MenuIcheck( NULL, MENU_BAR_SHOW_BROWSER, 1);
// if( preview_frame_height)
// MenuIcheck( NULL, MENU_BAR_SHOW_PREVIEW, 1);
if ( show_non_image)
MenuIcheck( NULL, MENU_BAR_SHOW, 1);
if ( thumbnail_size > 3)
MenuIcheck( NULL, MENU_BAR_LONG_THUMB, 1);
else
MenuIcheck( NULL, MENU_BAR_LARGE_THUMB, 1);
switch ( sortingmode)
{
case 0:
MenuIcheck( NULL, MENU_BAR_BY_NAME, 1);
break;
case 1:
MenuIcheck( NULL, MENU_BAR_BY_SIZE, 1);
break;
case 2:
MenuIcheck( NULL, MENU_BAR_BY_DATE, 1);
break;
}
EvntAttach( NULL, MN_SELECTED, MenuHandle);
}

View File

@@ -0,0 +1,4 @@
extern void MenuDesktop( void);
extern void Menu_open_image( void);

View File

@@ -0,0 +1,75 @@
#include "general.h"
/* Prototype */
int16 init_mfdb( MFDB *bm, int16 width, int16 height, int16 planes);
void delete_mfdb( MFDB *bm, int16 nbr);
/*==================================================================================*
* int16 init_mfdb: *
* fit a MFDB with the parameters suppplied. *
*----------------------------------------------------------------------------------*
* input: *
* bm -> The MFDB to fit. *
* width -> Image's width. *
* height -> Image's height. *
* planes -> Screen planes or 1 if the image is monochrome. *
*----------------------------------------------------------------------------------*
* returns: *
* '0' if error or the memory size allocated. *
*==================================================================================*/
int16 init_mfdb( MFDB *bm, int16 width, int16 height, int16 planes)
{
uint32 length;
bm->fd_w = width;
bm->fd_h = height;
bm->fd_wdwidth = ( width >> 4) + (( width % 16) != 0);
bm->fd_stand = 0;
bm->fd_nplanes = planes;
bm->fd_r1 = 0;
bm->fd_r2 = 0;
bm->fd_r3 = 0;
length = (( (( uint32)bm->fd_wdwidth << 1 ) * ( uint32)bm->fd_nplanes) * ( uint32)bm->fd_h) + 256L;
bm->fd_addr = gmalloc( length);
if( bm->fd_addr)
return( 1);
bm->fd_addr = NULL;
return ( 0);
}
/*==================================================================================*
* int16 delete_mfdb: *
* free the data of MFDB struct. *
*----------------------------------------------------------------------------------*
* input: *
* bm -> pointer to the MFDB to delete. *
* nbr -> The number of MFDB struct. to delete. *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void delete_mfdb( MFDB *bm, int16 nbr)
{
register int16 i;
if(( nbr == 0) || ( bm == NULL))
return;
for ( i = 0; i < nbr; i++)
{
if ( bm[i].fd_addr == NULL)
continue;
gfree( bm[i].fd_addr);
}
gfree( bm);
}

View File

@@ -0,0 +1,2 @@
extern int16 init_mfdb( MFDB *bm, int16 width, int16 height, int16 planes);
extern void delete_mfdb( MFDB *bm, int16 nbr);

View File

@@ -0,0 +1,224 @@
#include "general.h"
#include "pic_load.h"
#include "prefs.h"
#include "progress.h"
#include "plugins.h"
#include "mfdb.h"
#include "winimg.h"
#include "chrono.h"
#include "txt_data.h"
#include "zvdi/color.h"
#include "zvdi/raster.h"
#include "zvdi/vdi.h"
#include "pdf/pdflib.h"
int16 pdf_initialised = FALSE;
/*==================================================================================*
* read_pdf: *
* Read a image and fit the MFDB within IMAGE structur with the data. *
*----------------------------------------------------------------------------------*
* img: The struct. with the MFDB to be fitted. *
* page: The wanted page. *
*----------------------------------------------------------------------------------*
* returns: 0 if error. *
*==================================================================================*/
int16 read_pdf( IMAGE *img, int16 page, double scale)
{
DECDATA data;
uint16 *dst;
uint8 *src, *src_prt;
uint32 src_line_size;
uint16 x, y;
data = ( dec_data *) gmalloc( sizeof( dec_data));
if ( !data)
{
errshow( "", ENOMEM);
return ( 0);
}
data->IncXfx = 0x10000uL;
data->IncYfx = 0x10000uL;
chrono_on();
pdf_decode_page( img, page, scale);
if( app.nplanes > 8)
data->DthBuf = NULL;
else
{
size_t size = ( img->img_w + 15) * 3;
data->DthBuf = gmalloc( size);
if( data->DthBuf == NULL)
{
gfree( data);
errshow( "", ENOMEM);
return ( 0);
}
memset( data->DthBuf, 0, size);
}
data->DthWidth = img->img_w;
data->PixMask = img->colors;
if ( !init_mfdb( &img->image[page - 1], img->img_w, img->img_h, app.nplanes))
{
if( data->DthBuf)
gfree( data->DthBuf);
gfree( data);
errshow( "", ENOMEM);
return ( 0);
}
data->LnSize = img->image[page - 1].fd_wdwidth * app.nplanes;
dst = ( uint16*)img->image[page - 1].fd_addr;
src_line_size = img->img_w * 3;
src = ( uint8*)pdf_get_page_addr( img);
src_prt = src;
/* now, we draw a line around the pdf */
for( y = 0 ; y < img->img_h ; y++, src_prt += src_line_size)
{
if( y == 0 || y == img->img_h - 1)
{
for( x = 0 ; x < src_line_size ; x += 3)
{
src_prt[x] = 0x00;
src_prt[x + 1] = 0x00;
src_prt[x + 2] = 0x00;
}
}
src_prt[0] = 0x00;
src_prt[1] = 0x00;
src_prt[2] = 0x00;
src_prt[src_line_size - 3] = 0x00;
src_prt[src_line_size - 2] = 0x00;
src_prt[src_line_size - 1] = 0x00;
}
for( y = 0 ; y < img->img_h ; y++, src += src_line_size)
{
data->RowBuf = src;
( *raster_true)( data, dst);
dst += data->LnSize;
}
if( data->DthBuf)
gfree( data->DthBuf);
gfree( data);
chrono_off( ( char*)img->working_time);
return( 1);
}
double get_scale_value( IMAGE *img, int16 page, uint16 target_width, uint16 target_height)
{
int fit_pdf_to_win = 3; /* 0 = 100%, 1 = fit width, 2 = fit height, 3 = best fit */
double w_scale, h_scale, scale;
uint16 doc_width, doc_height;
pdf_get_page_size( img, page, &doc_width, &doc_height);
switch( fit_pdf_to_win)
{
case 1:
scale = (double)target_width / doc_width;
break;
case 2:
scale = (double)target_height / doc_height;
break;
case 3:
w_scale = (double)target_width / doc_width;
h_scale = (double)target_height / doc_height;
scale = MIN (w_scale, h_scale);
break;
default:
scale = 1;
}
return scale;
}
/*==================================================================================*
* pdf_load: *
* initialise and read the first page of a PDF and fill the IMAGE *
* struct. *
*----------------------------------------------------------------------------------*
* file: The file that will be read. *
* img: The IMAGE struct. to be filled. *
*----------------------------------------------------------------------------------*
* returns: '0' if error. *
*==================================================================================*/
int16 pdf_load( const char *file, IMAGE *img, uint16 width, uint16 height)
{
int16 i;
uint16 w = width;
double scale = 1.0;
if( pdf_initialised == FALSE)
pdf_initialised = pdf_init( zview_path);
if( lib_pdf_load( file, img) == FALSE)
return( 0);
if( ( img->image = ( MFDB *)gmalloc( sizeof( MFDB) * img->page)) == NULL)
{
pdf_quit( img);
return ( 0);
}
for( i = 0 ; i < img->page ; i++)
{
MFDB *mfdb = &img->image[i];
mfdb->fd_addr = NULL;
img->delay[i] = 0;
}
/* if the pdf owns only one page, we don't need the bookmark's frame */
if( img->page == 1)
w += 205;
if( pdf_fit_to_win)
scale = get_scale_value( img, 1, w, height);
if( !read_pdf( img, 1, scale))
{
pdf_quit( img);
return ( 0);
}
if( !init_txt_data( img, 8, 256))
{
pdf_quit( img);
delete_mfdb( img->image, img->page);
return ( 0);
}
pdf_get_info( img, img->comments);
return ( 1);
}

View File

@@ -0,0 +1,4 @@
extern int16 pdf_initialised;
extern int16 read_pdf( IMAGE *img, int16 page, double scale);
extern int16 pdf_load( const char *file, IMAGE *img, uint16 width, uint16 height);
extern double get_scale_value( IMAGE *img, int16 page, uint16 target_width, uint16 target_height);

View File

@@ -0,0 +1,352 @@
#include "general.h"
#include "pic_load.h"
#include "prefs.h"
#include "progress.h"
#include "plugins.h"
#include "mfdb.h"
#include "ztext.h"
#include "chrono.h"
#include "txt_data.h"
#include "zvdi//color.h"
#include "zvdi//raster.h"
#include "zvdi//vdi.h"
#include <math.h>
boolean decoder_init_done = FALSE;
void ( *raster) ( DECDATA, void *dst);
void ( *raster_cmap) ( DECDATA, void *);
void ( *raster_true) ( DECDATA, void *);
void ( *cnvpal_color) ( IMGINFO, DECDATA);
void ( *raster_gray) ( DECDATA, void *);
void CDECL ( *decoder_quit) ( IMGINFO);
boolean CDECL ( *decoder_init) ( const char *, IMGINFO);
boolean CDECL ( *decoder_read) ( IMGINFO, uint8 *);
void CDECL ( *decoder_get_txt) ( IMGINFO, txt_data *);
extern int16 smooth_resize( MFDB *source_image, MFDB *resized_image, int resize_algo);
static int16 setup ( IMAGE *img, IMGINFO info, DECDATA data)
{
int16 i, n_planes = ( ( info->planes == 1 && info->components == 1) ? 1: app.nplanes);
uint16 display_w, display_h;
double precise_x, precise_y, factor;
size_t src_line_size;
if( img->view_mode && ( info->width > thumbnail[thumbnail_size][0] || info->height > thumbnail[thumbnail_size][1]) && ( !smooth_thumbnail || n_planes < 16))
{
factor = MAX( ( ( double)info->height / ( double)thumbnail[thumbnail_size][1]), ( ( double)info->width / ( double)thumbnail[thumbnail_size][0]));
precise_x = ( double)info->width / factor;
precise_y = ( double)info->height / factor;
display_w = ( uint16)( precise_x > 0 ? precise_x : 16);
display_h = ( uint16)( precise_y > 0 ? precise_y : 16);
data->IncXfx = ((( uint32)info->width << 16) + ( display_w >> 1)) / display_w;
data->IncYfx = ((( uint32)info->height << 16) + ( display_h >> 1)) / display_h;
}
else
{
display_w = info->width;
display_h = info->height;
data->IncXfx = 0x10000uL;
data->IncYfx = 0x10000uL;
}
if( img->view_mode)
/* if we are in preview mode, we decompress only one image */
img->page = 1;
else
img->page = info->page;
if( ( img->image = ( MFDB *)gmalloc( sizeof( MFDB) * img->page)) == NULL)
return( 0);
for ( i = 0 ; i < img->page ; i++)
{
if ( !init_mfdb( &img->image[i], display_w, display_h, n_planes))
return( 0);
}
if( info->num_comments)
{
/* we initialise the txt_data struct... */
if( !init_txt_data( img, info->num_comments, info->max_comments_length))
return ( 0);
decoder_get_txt( info, img->comments);
}
else
img->comments = NULL;
// we assume that the pixel size is minimum 8 bits because some GNU libraries return 1 and 4 bits format like 8 bits ones.
// We add also a little more memory for avoid buffer overflow for plugin badly coded.
src_line_size = ( info->width + 64) * info->components;
data->RowBuf = ( uint8*)gmalloc( src_line_size);
if( !data->RowBuf)
return ( 0);
if(( info->planes == 1 && info->components == 1) || app.nplanes > 8)
data->DthBuf = NULL;
else
{
size_t size = ( display_w + 15) * 3;
if( ( data->DthBuf = gmalloc( size)) == NULL)
return ( 0);
memset( data->DthBuf, 0, size);
}
data->DthWidth = display_w;
data->PixMask = ( 1 << info->planes) - 1;
data->LnSize = img->image[0].fd_wdwidth * n_planes;
if ( info->planes == 1 && info->components == 1)
{
cnvpal_mono( info, data);
raster = raster_mono;
}
else
{
if ( info->indexed_color)
{
( *cnvpal_color)( info, data);
raster = raster_cmap;
}
else
raster = ( info->components >= 3 ? raster_true : raster_gray);
}
img->img_w = info->real_width;
img->img_h = info->real_height;
img->colors = info->colors;
img->bits = info->planes;
strcpy( img->info, info->info);
strcpy( img->compression, info->compression);
return( 1);
}
/*==================================================================================*
* read_img: *
* Read a image and fit the MFDB within IMAGE structur with the data. *
*----------------------------------------------------------------------------------*
* img: The struct. with the MFDB to be fitted. *
* info: The struct. with the line and dither buffer *
*----------------------------------------------------------------------------------*
* returns: - *
*==================================================================================*/
static inline void read_img ( IMAGE *img, IMGINFO info, DECDATA data)
{
uint16 *dst;
int16 y_dst, i, y, progress_counter = 0, img_h = info->height;
int32 line_size = data->LnSize, line_to_decode = img_h * img->page;
uint8 *buf = data->RowBuf;
for ( i = 0; i < img->page; i++)
{
uint32 scale = ( data->IncYfx + 1) >> 1;
y_dst = img->image[0].fd_h;
dst = img->image[i].fd_addr;
if( info->orientation == DOWN_TO_UP)
{
dst += data->LnSize * ( y_dst - 1);
line_size = -data->LnSize;
}
info->page_wanted = i;
for( y = 1; y <= img_h; y++)
{
if( !decoder_read( info, buf))
return;
while(( scale >> 16) < y)
{
( *raster)( data, dst);
dst += line_size;
scale += data->IncYfx;
if (!--y_dst) break;
}
if( img->progress_bar)
{
progress_counter++;
win_progress(( int16)((( int32)progress_counter * 150L) / line_to_decode));
}
}
img->delay[i] = info->delay;
}
}
/*==================================================================================*
* quit_img: *
* Close the image's file and free the line/dither/info buffer. *
*----------------------------------------------------------------------------------*
* info: The struct. to liberate *
*----------------------------------------------------------------------------------*
* returns: - *
*==================================================================================*/
void quit_img( IMGINFO info, DECDATA data)
{
if( decoder_init_done == TRUE)
decoder_quit( info);
if( data->DthBuf != NULL)
gfree( data->DthBuf);
if( data->RowBuf != NULL)
gfree( data->RowBuf);
gfree( data);
gfree( info);
decoder_init_done = FALSE;
}
boolean get_pic_info( const char *file, char *extention, IMGINFO info)
{
int16 i, j, c = 0;
char plugin[3];
/* We check if a plug-ins can do the job */
for( i = 0; i < plugins_nbr; i++, c = 0)
{
for( j = 0; j < codecs[i]->user_ext; j++)
{
plugin[0] = codecs[i]->infos[c++];
plugin[1] = codecs[i]->infos[c++];
plugin[2] = codecs[i]->infos[c++];
if( strncmp( extention, plugin, 3) == 0)
{
if ( !( decoder_init = ldg_find( "reader_init", codecs[i]))
|| !( decoder_read = ldg_find( "reader_read", codecs[i]))
|| !( decoder_quit = ldg_find( "reader_quit", codecs[i]))
|| !( decoder_get_txt = ldg_find( "reader_get_txt", codecs[i])))
{
errshow( codecs[i]->infos, ldg_error());
return FALSE;
}
// decoder_get_page_size = ldg_find( "reader_get_page_size", codecs[i]);
return decoder_init( file, info);
}
}
}
/* I wish that it will never append ! */
return FALSE;
}
/*==================================================================================*
* pic_load: *
* read a supported picture and fill a IMAGE structure. *
*----------------------------------------------------------------------------------*
* file: The file that will be read. *
* img: The IMAGE struct. that will be filled. *
*----------------------------------------------------------------------------------*
* returns: '0' if error or picture not supported *
*==================================================================================*/
int16 pic_load( const char *file, char *extention, IMAGE *img)
{
IMGINFO info;
DECDATA data;
info = ( img_info *) gmalloc( sizeof( img_info));
if ( !info)
{
errshow( "", ENOMEM);
return( 0);
}
data = ( dec_data *) gmalloc( sizeof( dec_data));
if ( !data)
{
errshow( "", ENOMEM);
gfree( info);
return ( 0);
}
if( img->progress_bar)
win_progress_begin( "Please Wait...");
/* We initialise some variables needed by the codecs */
info->background_color = 0xFFFFFF;
info->thumbnail = img->view_mode;
chrono_on();
if(( decoder_init_done = get_pic_info( file, extention, info)) == FALSE)
{
gfree( data);
gfree( info);
win_progress_end();
return ( 0);
}
if( !setup ( img, info, data))
{
errshow( "", ENOMEM);
quit_img( info, data);
delete_mfdb( img->image, img->page);
win_progress_end();
return ( 0);
}
read_img ( img, info, data);
quit_img( info, data);
win_progress_end();
if( img->view_mode && ( img->image[0].fd_w > thumbnail[thumbnail_size][0] || img->image[0].fd_h > thumbnail[thumbnail_size][1]) && smooth_thumbnail && img->image[0].fd_nplanes >= 16)
{
MFDB resized_image;
double precise_x, precise_y, factor;
uint16 display_w, display_h;
factor = MAX((( double)img->image[0].fd_h / ( double)thumbnail[thumbnail_size][1]), (( double)img->image[0].fd_w / ( double)thumbnail[thumbnail_size][0]));
precise_x = ( double)img->image[0].fd_w / factor;
precise_y = ( double)img->image[0].fd_h / factor;
display_w = ( uint16)( precise_x > 0 ? precise_x : 16);
display_h = ( uint16)( precise_y > 0 ? precise_y : 16);
init_mfdb( &resized_image, display_w, display_h, img->image[0].fd_nplanes);
smooth_resize( &img->image[0], &resized_image, smooth_thumbnail);
gfree( img->image[0].fd_addr);
img->image[0].fd_addr = resized_image.fd_addr;
img->image[0].fd_w = resized_image.fd_w;
img->image[0].fd_h = resized_image.fd_h;
img->image[0].fd_wdwidth = resized_image.fd_wdwidth;
}
chrono_off( img->working_time);
return ( 1);
}

View File

@@ -0,0 +1,96 @@
#define UP_TO_DOWN 0
#define DOWN_TO_UP 1
#define ST_RAM 0
#define TT_RAM 1
typedef enum
{
JCS_UNKNOWN, /* error/unspecified */
JCS_GRAYSCALE, /* monochrome */
JCS_RGB, /* red/green/blue */
JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
JCS_CMYK, /* C/M/Y/K */
JCS_YCCK /* Y/Cb/Cr/K */
} J_COLOR_SPACE;
typedef struct
{
uint8 red;
uint8 green;
uint8 blue;
} COLOR_MAP;
typedef struct _img_info *IMGINFO;
typedef struct _img_info
{
/* Data returned by the decoder Picture's initialisation */
uint16 width; /* Picture width */
uint16 height; /* Picture Height */
uint16 components; /* Picture components */
uint16 planes; /* Picture bits by pixel */
uint32 colors; /* Picture colors number */
int16 orientation; /* picture orientation: UP_TO_DOWN or DONW_TO_UP ( ex: TGA) */
uint16 page; /* Number of page/image in the file */
uint16 delay; /* Animation delay in 200th sec. between each frame. */
uint16 num_comments; /* Lines in the file's comment. ( 0 if none) */
uint16 max_comments_length; /* The length of the greater line in the comment */
int16 indexed_color; /* Picture has a palette: 0) No 1) Yes */
int16 memory_alloc; /* where to do the memory allocation for the reader_read
function buffer, possible values are ST_RAM or TT_RAM */
COLOR_MAP palette[256]; /* Palette in standard RGB format */
/* data send to the codec */
uint32 background_color; /* The wanted background's color in hexa */
int16 thumbnail; /* 1 if true else 0.
Some format have thumbnail inside the picture, if 1, we
want only this thumbnail and not the image itself */
uint16 page_wanted; /* The wanted page to get for the reader_read() function
The first page is 0 and the last is img_info->page - 1 */
/* The following variable are only for Information Prupose, the zview doesn't
use it for decoding routine but only for the information dialog */
int8 info[40]; /* Picture's info, for ex: "Gif 87a" */
int8 compression[5]; /* Compression type, ex: "LZW" */
uint16 real_width; /* Real picture width( if the thumbnail variable is 1) */
uint16 real_height; /* Ral picture Height( if the thumbnail variable is 1) */
/* Private data for the plugin */
void *_priv_ptr;
void *_priv_ptr_more;
void *__priv_ptr_more;
int32 _priv_var;
int32 _priv_var_more;
} img_info;
typedef struct _dec_data *DECDATA;
typedef struct _dec_data
{
uint8 *RowBuf;
void *DthBuf;
uint8 *DstBuf;
uint16 DthWidth;
uint16 PixMask;
int32 LnSize;
uint32 IncXfx;
uint32 IncYfx;
uint32 Pixel[256];
} dec_data;
extern void ( *raster) ( DECDATA, void *dst);
extern void ( *raster_cmap) ( DECDATA, void *);
extern void ( *raster_true) ( DECDATA, void *);
extern void ( *rasterize_32) ( DECDATA, void *);
extern void ( *cnvpal_color)( IMGINFO, DECDATA);
extern void ( *raster_gray) ( DECDATA, void *);
extern boolean get_pic_info( const char *file, char *extention, IMGINFO info);
extern void quit_img( IMGINFO info, DECDATA data);
extern boolean decoder_init_done;

View File

@@ -0,0 +1,138 @@
#include "general.h"
#include "pic_load.h"
#include "mfdb.h"
#include "zvdi/raster_resize.h"
#include "zvdi/vdi.h"
#include "zvdi/p2c.h"
void ( *resize)( DECDATA, void *dst);
void ( *my_resize)( DECDATA, void *dst);
extern int32 plane2packed( int32 no_words, int32 plane_length, int16 no_planes, void *src, void *dst);
static int16 resize_setup( MFDB *in, MFDB *out, DECDATA data)
{
uint16 display_w, display_h;
float precise_x, precise_y, factor;
factor = MAX( ( ( float)in->fd_h / out->fd_h), ( ( float)in->fd_w / out->fd_w));
precise_x = ( float)in->fd_w / factor;
precise_y = ( float)in->fd_h / factor;
display_w = ( ( uint16)precise_x > 0 ? ( uint16)precise_x : 16);
display_h = ( ( uint16)precise_y > 0 ? ( uint16)precise_y : 16);
data->IncXfx = ((( uint32)in->fd_w << 16) + ( display_w >> 1)) / display_w;
data->IncYfx = ((( uint32)in->fd_h << 16) + ( display_h >> 1)) / display_h;
if ( !init_mfdb( out, display_w, display_h, in->fd_nplanes))
return ( 0);
data->RowBuf = in->fd_addr;
if( planar)
{
data->DstBuf = gmalloc((( uint32)in->fd_wdwidth << 4 ) + 256uL);
if( data->DstBuf == NULL)
{
delete_mfdb( out, 1);
return ( 0);
}
}
else
data->DstBuf = NULL;
data->DthWidth = display_w;
data->LnSize = out->fd_wdwidth * out->fd_nplanes;
if( out->fd_nplanes == 1)
my_resize = resize_mono;
else
my_resize = resize;
return( 1);
}
/*==================================================================================*
* read_img: *
* Read a image and fit the MFDB within IMAGE structur with the data. *
*----------------------------------------------------------------------------------*
* img: The struct. with the MFDB to be fitted. *
* info: The struct. with the line and dither buffer *
*----------------------------------------------------------------------------------*
* returns: - io;p^= * *==================================================================================*/
static inline void resize_img( MFDB *in, MFDB *out, DECDATA data)
{
uint16 *dst = out->fd_addr;
int16 y = 0;
int32 in_line_size = (( uint32)in->fd_wdwidth << 1 ) * ( uint32)in->fd_nplanes,
out_line_size = data->LnSize;
uint32 scale = ( data->IncYfx + 1) >> 1;
int16 y_dst = out->fd_h;
while ( y < in->fd_h)
{
y++;
if( planar)
{
if( ( scale >> 16) < y)
planar_to_chunky( data->RowBuf, data->DstBuf, in->fd_w);
}
while (( scale >> 16) < y)
{
my_resize( data, dst);
dst += out_line_size;
scale += data->IncYfx;
if ( !--y_dst) break;
}
data->RowBuf += in_line_size;
}
}
/*==================================================================================*
* pic_resize: *
* Create a resized MFDB. the wanted size are in out->fd_h and *
* out->fd_w.. the size will be changed later to maintain the aspect *
* ratio. *
*----------------------------------------------------------------------------------*
* in: The src MFDB. *
* img: The target MFDB. *
*----------------------------------------------------------------------------------*
* returns: '0' if error else 1. *
*==================================================================================*/
int16 pic_resize( MFDB *in, MFDB *out)
{
DECDATA data;
/* 2 planes zoom not available */
if( in->fd_nplanes == 2)
return ( 0);
data = ( dec_data *)gmalloc( sizeof( dec_data));
if( !data)
return ( 0);
if( !resize_setup( in, out, data))
{
free( data);
return ( 0);
}
resize_img ( in, out, data);
if( data->DstBuf)
gfree( data->DstBuf);
gfree( data);
return ( 1);
}

View File

@@ -0,0 +1,3 @@
extern void ( *resize)( DECDATA, void *dst);
extern int16 pic_resize( MFDB *in, MFDB *out);

View File

@@ -0,0 +1,268 @@
#include "general.h"
#include "pic_load.h"
#include "prefs.h"
#include "ztext.h"
#include "zvdi//color.h"
#include "zvdi//raster.h"
#include "zvdi//vdi.h"
#include "plugins.h"
#include "progress.h"
extern void CDECL ( *decoder_quit) ( IMGINFO);
extern boolean CDECL ( *decoder_read) ( IMGINFO, uint8 *);
extern boolean CDECL ( *decoder_init) ( const char *, IMGINFO);
extern void CDECL ( *encoder_quit) ( IMGINFO);
extern boolean CDECL ( *encoder_write) ( IMGINFO, uint8 *);
extern boolean CDECL ( *encoder_init) ( const char *, IMGINFO);
static boolean encoder_init_done = FALSE;
static int16 setup_encoder ( IMGINFO in_info, IMGINFO out_info, DECDATA data)
{
size_t src_line_size, dst_line_size;
data->IncXfx = 0x10000uL;
src_line_size = ( in_info->width + 15) * in_info->components;
dst_line_size = ( out_info->width + 15) * out_info->components;
data->RowBuf = ( uint8*)gmalloc( src_line_size);
if( data->RowBuf == NULL)
return( 0);
data->DthBuf = NULL;
/* If the image is inverted like in iNTEL format, we must to decompress
the entire picture before to save it */
if( in_info->orientation == DOWN_TO_UP)
{
data->DstBuf = ( uint8*)gmalloc( dst_line_size * ( out_info->height + 1));
}
else
data->DstBuf = ( uint8*)gmalloc( dst_line_size);
if( data->DstBuf == NULL)
return( 0);
data->DthWidth = in_info->width;
data->PixMask = ( 1 << in_info->planes) - 1;
data->LnSize = out_info->width * out_info->components;
switch( out_info->planes)
{
case 24:
if( in_info->planes == 1 && in_info->components == 1)
{
data->Pixel[0] = 0xFFFFFF;
data->Pixel[1] = 0x000000;
raster = raster_24;
}
else if( in_info->indexed_color)
{
cnvpal_true( in_info, data);
raster = raster_24;
}
else
raster = ( in_info->components >= 3 ? dither_24 : gscale_24);
break;
default:
return( 0);
}
return( 1);
}
/*==================================================================================*
* read_img: *
* Read a image and fit the MFDB within IMAGE structur with the data. *
*----------------------------------------------------------------------------------*
* img: The struct. with the MFDB to be fitted. *
* info: The struct. with the line and dither buffer *
*----------------------------------------------------------------------------------*
* returns: - *
*==================================================================================*/
static void write_img( IMGINFO in_info, IMGINFO out_info, DECDATA data)
{
int16 y, img_h = in_info->height;
uint8 *dst = data->DstBuf;
in_info->page_wanted = 0;
if( in_info->orientation == UP_TO_DOWN)
{
for( y = 0; y < img_h; y++)
{
decoder_read( in_info, data->RowBuf);
( *raster)( data, dst);
encoder_write( out_info, dst);
if( show_write_progress_bar)
win_progress(( int16)((( int32)y * 150L) / img_h));
}
}
else /* inversed INTEL format */
{
int16 h = ( img_h << 1); /* image height * 2 . don't worry about this, is only for the progress bar */
dst += data->LnSize * ( in_info->height - 1);
/* First pass, we decode the entire image */
for( y = 0; y < img_h; y++)
{
decoder_read( in_info, data->RowBuf);
( *raster)( data, dst);
dst -= data->LnSize;
if( show_write_progress_bar)
win_progress(( int16)((( int32)y * 75L) / img_h));
}
dst = data->DstBuf;
/* second pass, we encode it */
for( ; y < h; y++)
{
encoder_write( out_info, dst);
dst += data->LnSize;
if( show_write_progress_bar)
win_progress(( int16)((( int32)y * 75L) / img_h));
}
}
}
static void exit_pic_save( IMGINFO in_info, IMGINFO out_info, DECDATA data)
{
if( data->DthBuf)
gfree( data->DthBuf);
if( data->DstBuf)
gfree( data->DstBuf);
if( data->RowBuf)
gfree( data->RowBuf);
if( encoder_init_done)
encoder_quit( out_info);
if( decoder_init_done)
decoder_quit( in_info);
gfree( data);
gfree( out_info);
gfree( in_info);
graf_mouse( ARROW, NULL);
encoder_init_done = FALSE;
decoder_init_done = FALSE;
}
/*==================================================================================*
* pic_load: *
* read a supported picture and fill a IMAGE structure. *
*----------------------------------------------------------------------------------*
* file: The file that will be read. *
* img: The IMAGE struct. that will be filled. *
*----------------------------------------------------------------------------------*
* returns: '0' if error or picture not supported *
*==================================================================================*/
int16 pic_save( const char *in_file, const char *out_file)
{
char extention[4];
IMGINFO in_info = NULL, out_info = NULL;
DECDATA data = NULL;
graf_mouse( BUSYBEE, NULL);
in_info = ( img_info *) gmalloc( sizeof( img_info));
out_info = ( img_info *) gmalloc( sizeof( img_info));
data = ( dec_data *) gmalloc( sizeof( dec_data));
if ( !in_info || !out_info || !data)
{
if ( data)
gfree( data);
if ( out_info)
gfree( out_info);
if ( in_info)
gfree( in_info);
graf_mouse( ARROW, NULL);
errshow( "", ENOMEM);
return( 0);
}
data->DthBuf = NULL;
data->DstBuf = NULL;
data->RowBuf = NULL;
if( show_write_progress_bar)
win_progress_begin( get_string( SAVE_TITLE));
/* We initialise some variables needed by the codecs */
in_info->background_color = 0xFFFFFF;
in_info->thumbnail = FALSE;
/* get the file extention */
strcpy ( extention, in_file + strlen( in_file) - 3);
str2upper( extention);
if(( decoder_init_done = get_pic_info( in_file, extention, in_info)) == FALSE)
{
errshow( in_file, CANT_LOAD_IMG);
exit_pic_save( in_info, out_info, data);
win_progress_end();
graf_mouse( ARROW, NULL);
return ( 0);
}
/* copy information from input's information to output's information struct */
memcpy( out_info, in_info, sizeof( img_info));
if (( encoder_init_done = encoder_init( out_file, out_info)) == FALSE)
{
errshow( NULL, CANT_SAVE_IMG);
exit_pic_save( in_info, out_info, data);
win_progress_end();
graf_mouse( ARROW, NULL);
return ( 0);
}
if( !setup_encoder( in_info, out_info, data))
{
errshow( NULL, ENOMEM);
exit_pic_save( in_info, out_info, data);
win_progress_end();
graf_mouse( ARROW, NULL);
return ( 0);
}
write_img( in_info, out_info, data);
exit_pic_save( in_info, out_info, data);
graf_mouse( ARROW, NULL);
win_progress_end();
return ( 1);
}

View File

@@ -0,0 +1,124 @@
#include "general.h"
#include "ztext.h"
/* Prototype */
int16 plugins_init( void);
void plugins_quit( void);
/* LDG function */
void CDECL( *codec_init)( void) = NULL;
/* Global variable */
int16 plugins_nbr = 0;
LDG *codecs[100];
/*==================================================================================*
* void plugins_quit: *
* unload all the codec from memory. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
void plugins_quit( void)
{
int16 i;
for( i = 0; i < plugins_nbr; i++)
ldg_close( codecs[i], ldg_global);
}
/*==================================================================================*
* void plugins_init: *
* load all the codec to memory. *
*----------------------------------------------------------------------------------*
* input: *
* -- *
*----------------------------------------------------------------------------------*
* returns: *
* -- *
*==================================================================================*/
int16 plugins_init( void)
{
char *env_ldg, plugin_dir[MAX_PATH];
DIR *dir;
LDG_INFOS *cook;
struct dirent *de;
int16 len;
char extention[4];
strcpy( plugin_dir, zview_path);
strcat( plugin_dir, "\\codecs");
/* We try to find the zcodecs folder in zview directory... */
if ( chdir( plugin_dir) != 0)
{
shel_envrn( &env_ldg, "LDGPATH=");
/* ...if this directory doesn't exist, we try to find
the zcodecs folder in the default LDG path, with
the LDG cookie or with the environment variable. */
if( ldg_cookie( LDG_COOKIE, ( int32*)&cook))
strcpy( plugin_dir, cook->path);
else if( env_ldg)
strcpy( plugin_dir, env_ldg);
else
strcpy( plugin_dir, "C:\\gemsys\\ldg\\");
len = ( int16)strlen( plugin_dir);
if( plugin_dir[len-1] != '\\')
strcat( plugin_dir, "\\");
strcat( plugin_dir, "codecs");
if ( chdir( plugin_dir) != 0)
return( 0);
}
if (( dir = opendir( ".")) != NULL)
{
while(( de = readdir( dir)) != NULL)
{
if (( strcmp( de->d_name, ".") == 0) || ( strcmp( de->d_name, "..") == 0))
continue;
strcpy ( extention, de->d_name + strlen( de->d_name) - 3);
str2lower( extention);
if( strcmp ( extention, "ldg") == 0)
{
if ( ( codecs[plugins_nbr] = ldg_open( de->d_name, ldg_global)))
{
if ( ( codec_init = ldg_find( "plugin_init", codecs[plugins_nbr])))
{
codec_init();
plugins_nbr++;
}
else
{
errshow( de->d_name, ldg_error());
ldg_close( codecs[plugins_nbr], ldg_global);
}
}
else
{
errshow( de->d_name, ldg_error());
}
}
}
closedir( dir);
}
chdir( zview_path);
return plugins_nbr;
}

View File

@@ -0,0 +1,5 @@
extern int16 plugins_init( void);
extern void plugins_quit( void);
extern LDG *codecs[100];
extern int16 plugins_nbr;

View File

@@ -0,0 +1,26 @@
PLUGINS = \
bmp \
degas \
eureka \
gif \
godpaint \
img \
jpg \
neochrome \
png \
tga \
tiff
default: $(PLUGINS)
.PHONY: $(PLUGINS)
$(PLUGINS):
$(MAKE) -C $@ $(MAKECMDGOALS) CROSS=yes
dist:
rm -rf codecs
mkdir codecs
for f in $(PLUGINS); do cp $$f/*.ldg codecs; done
clean: $(PLUGINS)
rm -f *~ *.ldg

View File

@@ -0,0 +1,13 @@
STACKSIZE = 64k
OPTIMISATION = -O2 -fomit-frame-pointer -finline-functions
CPU = -m68020-60
LIB = -lldgserver
CFLAGS = $(CPU) $(OPTIMISATION) -Wall -I../common
LDFLAGS = -nostdlib
OBJ = $(LDG_STARTUP_OBJ) bmpldg.o
PROGRAM = bmp.ldg
include ../../../common.mak

Some files were not shown because too many files have changed in this diff Show More