unpack zips in src to better compression
This commit is contained in:
43
sources/z-tools/trunk/common.mak
Normal file
43
sources/z-tools/trunk/common.mak
Normal file
@@ -0,0 +1,43 @@
|
||||
CROSS = yes
|
||||
|
||||
ifeq ($(CROSS),yes)
|
||||
AS = m68k-atari-mint-as
|
||||
CC = m68k-atari-mint-gcc
|
||||
CXX = m68k-atari-mint-g++
|
||||
AR = m68k-atari-mint-ar
|
||||
RANLIB = m68k-atari-mint-ranlib
|
||||
STRIP = m68k-atari-mint-strip -s
|
||||
STACK = m68k-atari-mint-stack
|
||||
FLAGS = m68k-atari-mint-flags -r
|
||||
else
|
||||
AS = as
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
STRIP = strip -s
|
||||
STACK = stack
|
||||
FLAGS = flags -r
|
||||
endif
|
||||
COMPRESS = upx -9
|
||||
|
||||
CFLAGS += -Wno-pointer-sign
|
||||
LDG_STARTUP_OBJ = /home/mikro/gnu-tools/m68k-atari-mint/lib/m68020-60/ldgstart.o
|
||||
|
||||
all: $(PROGRAM) stack strip compress
|
||||
|
||||
$(PROGRAM): $(OBJ)
|
||||
$(CC) $(CPU) $(OPTIMISATION) -o $@ $(OBJ) $(LDFLAGS) $(LIB)
|
||||
|
||||
strip: $(PROGRAM)
|
||||
$(STRIP) $(PROGRAM)
|
||||
|
||||
stack: $(PROGRAM)
|
||||
$(STACK) -S $(STACKSIZE) $(PROGRAM)
|
||||
|
||||
compress: $(PROGRAM)
|
||||
$(COMPRESS) $(PROGRAM)
|
||||
$(FLAGS) $(PROGRAM)
|
||||
|
||||
clean:
|
||||
rm -f $(filter-out $(LDG_STARTUP_OBJ),$(OBJ)) $(PROGRAM) *~
|
||||
18
sources/z-tools/trunk/prerequisites.txt
Normal file
18
sources/z-tools/trunk/prerequisites.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
Current zTools are verified to work / compile with:
|
||||
|
||||
- freetype 2.4.6
|
||||
- gemlib (latest from CVS)
|
||||
- ldg (latest SVN plus fix for memory protection)
|
||||
- libmem (same source as ldg)
|
||||
- libshare 0.1.1
|
||||
- libxml 2.3.11
|
||||
- mintlib (latest CVS)
|
||||
- pml 2.03 (from Vincent's gcc4 port)
|
||||
- transprt.h (STiK/STinG header file, available from http://mikro.atari.org)
|
||||
- windom 1.21.3 (plus fix for gcc4 and memory protection) [zView, current zWeather]
|
||||
- windom (latest from CVS) [zTask, zWeather in future release]
|
||||
- xpdf 3.03
|
||||
- zlib 1.2.5
|
||||
|
||||
Compiler used for development is gcc / g++ 4.6.x with binutils 2.21, CFLAGS
|
||||
and CXXFLAGS for all components are '-m68060-20 -O2 -fomit-frame-pointer'.
|
||||
7
sources/z-tools/trunk/todo.txt
Normal file
7
sources/z-tools/trunk/todo.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
- reuse some code parts, for example:
|
||||
- zView should use zcodeclib, it has its own copy&pasted routines
|
||||
- things like zvdi, debug, general.h, memory in all projects
|
||||
- convert zView to windom 2.x (zWeather is done in the latest revision)
|
||||
- add right licenses, to zXXX code, plugins, libraries used by plugins, ...
|
||||
- implement true http links in zWeather -- now both icon and promo links are only shown, they should open
|
||||
browser with URL from weather.com license
|
||||
503
sources/z-tools/trunk/zcodeclib/copyright
Normal file
503
sources/z-tools/trunk/zcodeclib/copyright
Normal 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!
|
||||
BIN
sources/z-tools/trunk/zcodeclib/exemple/8.gif
Normal file
BIN
sources/z-tools/trunk/zcodeclib/exemple/8.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 85 KiB |
BIN
sources/z-tools/trunk/zcodeclib/exemple/exemple.app
Normal file
BIN
sources/z-tools/trunk/zcodeclib/exemple/exemple.app
Normal file
Binary file not shown.
89
sources/z-tools/trunk/zcodeclib/exemple/main.c
Normal file
89
sources/z-tools/trunk/zcodeclib/exemple/main.c
Normal file
@@ -0,0 +1,89 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <osbind.h>
|
||||
#include <mintbind.h>
|
||||
#include <gem.h>
|
||||
#include <ldg.h>
|
||||
#include <types2b.h>
|
||||
#include <zcodec.h>
|
||||
|
||||
|
||||
int main( int argc, char *argv[])
|
||||
{
|
||||
IMAGE *test_img = NULL;
|
||||
MFDB *resize = NULL, screen = {0};
|
||||
int16 xy[8];
|
||||
|
||||
/* We load the wanted codecs but if we want to
|
||||
load the entire codecs's pack, we can do "codecs_init( "all"); */
|
||||
if( !codecs_init( "gif.ldg"))
|
||||
Cconws("can't init the codec \n\r");
|
||||
|
||||
if ( argc > 1)
|
||||
{ /* we load the dragged picture, we put - 1 to both w and h options because we don't want zoom */
|
||||
if( ! (test_img = load_img( argv[argc - 1], -1, -1, 0)))
|
||||
{
|
||||
Cconws("can't load image \n\r");
|
||||
codecs_quit();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Cconws("Drag and Drop a gif image\n\r");
|
||||
codecs_quit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
xy[0] = 0;
|
||||
xy[1] = 0;
|
||||
xy[2] = test_img->image[0].fd_w - 1;
|
||||
xy[3] = test_img->image[0].fd_h - 1;
|
||||
xy[4] = 20;
|
||||
xy[5] = 20;
|
||||
xy[6] = xy[4] + xy[2];
|
||||
xy[7] = xy[5] + xy[3];
|
||||
|
||||
if ( test_img->image[0].fd_nplanes == 1)
|
||||
{
|
||||
int16 color[2] = { 0, 1};
|
||||
|
||||
vrt_cpyfm( vdi_handle, MD_REPLACE, xy, &test_img->image[0], &screen, color);
|
||||
}
|
||||
else
|
||||
vro_cpyfm( vdi_handle, S_ONLY, xy, &test_img->image[0], &screen);
|
||||
|
||||
if( !( resize = pic_resize( &test_img->image[0],64, 64, 1)))
|
||||
{
|
||||
Cconws("can't resize image \n\r");
|
||||
delete_img( test_img);
|
||||
codecs_quit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
xy[0] = 0;
|
||||
xy[1] = 0;
|
||||
xy[2] = resize->fd_w - 1;
|
||||
xy[3] = resize->fd_h - 1;
|
||||
xy[4] = 20 + test_img->image[0].fd_w - 1;
|
||||
xy[5] = 20;
|
||||
xy[6] = xy[4] + xy[2];
|
||||
xy[7] = xy[5] + xy[3];
|
||||
|
||||
/* draw the image */
|
||||
if ( resize->fd_nplanes == 1)
|
||||
{
|
||||
int16 color[2] = { 0, 1};
|
||||
|
||||
vrt_cpyfm( vdi_handle, MD_REPLACE, xy, resize, &screen, color);
|
||||
}
|
||||
else
|
||||
vro_cpyfm( vdi_handle, S_ONLY, xy, resize, &screen);
|
||||
|
||||
|
||||
delete_mfdb( resize, 1);
|
||||
delete_img( test_img);
|
||||
codecs_quit();
|
||||
return 0;
|
||||
}
|
||||
41
sources/z-tools/trunk/zcodeclib/exemple/makefile
Normal file
41
sources/z-tools/trunk/zcodeclib/exemple/makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
ifeq ($(CROSS),yes)
|
||||
AS = m68k-atari-mint-as
|
||||
CC = m68k-atari-mint-gcc
|
||||
STACK = m68k-atari-mint-stack
|
||||
INCLUDE_PATH = /home/zorro/cross-tools/include
|
||||
LIB_PATH = /home/zorro/cross-tools/lib
|
||||
else
|
||||
AS = as
|
||||
CC = gcc
|
||||
STACK = stack
|
||||
INCLUDE_PATH = /usr/GEM/include
|
||||
LIB_PATH = /usr/GEM/lib
|
||||
endif
|
||||
|
||||
STACKSIZE = 128k
|
||||
COMPRESS = upx
|
||||
OPTIMISATION = -O2 -fomit-frame-pointer -finline-functions
|
||||
CPU = -m68020-60
|
||||
LIB = -lzcodec -lgem -lldg
|
||||
|
||||
CFLAGS = $(CPU) $(OPTIMISATION) -Wall -I$(INCLUDE_PATH)
|
||||
|
||||
OBJ = main.o
|
||||
|
||||
PROGRAM = exemple.app
|
||||
|
||||
|
||||
all: $(PROGRAM) stack #compress
|
||||
|
||||
$(PROGRAM): $(OBJ)
|
||||
$(CC) -o$@ $(OBJ) -Xlinker -s -L$(LIB_PATH) $(LIB)
|
||||
|
||||
stack:
|
||||
$(STACK) -S $(STACKSIZE) $(PROGRAM)
|
||||
|
||||
compress:
|
||||
$(COMPRESS) $(PROGRAM)
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
|
||||
43
sources/z-tools/trunk/zcodeclib/include/types2b.h
Normal file
43
sources/z-tools/trunk/zcodeclib/include/types2b.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef __2B_UNIVERSAL_TYPES__
|
||||
#define __2B_UNIVERSAL_TYPES__
|
||||
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef signed long int32;
|
||||
typedef unsigned long uint32;
|
||||
typedef int32 fix31;
|
||||
|
||||
#ifdef __GNUC__
|
||||
typedef signed short int16;
|
||||
typedef unsigned short uint16;
|
||||
#define __2B_HAS64_SUPPORT /* Compiler supports 64 Bit Integers */
|
||||
typedef signed long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
#else /* Compiler doesn't support 64 Bit Integers */
|
||||
typedef signed int int16;
|
||||
typedef unsigned int uint16;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32 hi;
|
||||
uint32 lo;
|
||||
} int64;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32 hi;
|
||||
uint32 lo;
|
||||
} loff_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32 hi;
|
||||
uint32 lo;
|
||||
} uint64;
|
||||
#endif
|
||||
|
||||
|
||||
typedef int32 boolean;
|
||||
|
||||
|
||||
#endif /* __2B_UNIVERSAL_TYPES__ */
|
||||
29
sources/z-tools/trunk/zcodeclib/include/zcodec.h
Normal file
29
sources/z-tools/trunk/zcodeclib/include/zcodec.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef __ZCODECLIB_ZCODEC_H__
|
||||
#define __ZCODECLIB_ZCODEC_H__
|
||||
|
||||
#include <types2b.h>
|
||||
|
||||
struct LDG;
|
||||
struct MFDB;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int16 page; /* Number of page/image in the file */
|
||||
uint16 *delay; /* Animation delay in millise. between each frame */
|
||||
MFDB *image; /* The Image itself */
|
||||
}IMAGE;
|
||||
|
||||
extern int16 planar, vdi_handle, nplanes, vdi_work_in[10], vdi_work_out[57];
|
||||
extern LDG *ldg_mem;
|
||||
|
||||
extern int16 codecs_init( char *codec_name);
|
||||
extern void codecs_quit( void);
|
||||
extern IMAGE *load_img( const char *file, int16 w, int16 h, int16 keep_ratio);
|
||||
extern void delete_img( IMAGE *img);
|
||||
extern MFDB *pic_resize( MFDB *in, int16 w, int16 h, int16 keep_ratio);
|
||||
extern void delete_mfdb( MFDB *bm, int16 nbr);
|
||||
|
||||
#define shared_malloc( s) _ldg_malloc( s, ldg_global[2]);
|
||||
#define shared_free( s) _ldg_free( s, ldg_global[2]);
|
||||
|
||||
#endif
|
||||
29
sources/z-tools/trunk/zcodeclib/src/Makefile
Normal file
29
sources/z-tools/trunk/zcodeclib/src/Makefile
Normal file
@@ -0,0 +1,29 @@
|
||||
ifeq ($(CROSS),yes)
|
||||
AS = m68k-atari-mint-as
|
||||
AR = m68k-atari-mint-ar
|
||||
CC = m68k-atari-mint-gcc
|
||||
STACK = m68k-atari-mint-stack
|
||||
else
|
||||
AS = as
|
||||
AR = ar
|
||||
CC = gcc
|
||||
STACK = stack
|
||||
endif
|
||||
|
||||
OPTIMISATION = -O2 -fomit-frame-pointer
|
||||
CPU = -m68020-60
|
||||
|
||||
CFLAGS = $(CPU) $(OPTIMISATION) -Wall -I../include
|
||||
|
||||
VDI_OBJ = zvdi/p2c.o zvdi/color.o zvdi/dither.o zvdi/raster.o zvdi/raresize.o zvdi/vdi.o
|
||||
|
||||
OBJ = $(VDI_OBJ) img.o resize.o codecs.o mfdb.o load_img.o ztext.o mem.o
|
||||
|
||||
TARGET = ../lib/m68020-60/libzcodec.a
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
rm -f $@
|
||||
$(AR) cru $@ $^
|
||||
|
||||
clean:
|
||||
rm -f *.o zvdi/*.o *.O zvdi/*.O *~ $(TARGET)
|
||||
142
sources/z-tools/trunk/zcodeclib/src/codecs.c
Normal file
142
sources/z-tools/trunk/zcodeclib/src/codecs.c
Normal file
@@ -0,0 +1,142 @@
|
||||
#include "general.h"
|
||||
#include "ztext.h"
|
||||
#include "zvdi/vdi.h"
|
||||
|
||||
|
||||
/* Prototype */
|
||||
int16 plugins_init( void);
|
||||
void plugins_quit( void);
|
||||
|
||||
/* LDG function */
|
||||
void CDECL( *codec_init)( void) = NULL;
|
||||
|
||||
static int16 vdi_initialised = 0;
|
||||
static int16 mem_initialised = 0;
|
||||
|
||||
/* Global variable */
|
||||
int16 plugins_nbr = 0;
|
||||
LDG *codecs[100];
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void plugins_quit: *
|
||||
* unload all the codec from memory. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* -- *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
void codecs_quit( void)
|
||||
{
|
||||
int16 i;
|
||||
|
||||
for( i = 0; i < plugins_nbr; i++)
|
||||
{
|
||||
ldg_close( codecs[i], ldg_global);
|
||||
}
|
||||
|
||||
mem_quit();
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void plugins_init: *
|
||||
* load codec(s) to memory. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* codec_name: the name of the codec to load, if this one is "all", we load *
|
||||
* the codec. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* 0 if error. *
|
||||
*==================================================================================*/
|
||||
int16 codecs_init( char *codec_name)
|
||||
{
|
||||
char *env_ldg, current_dir[1024], plugin_dir[1024];
|
||||
DIR *dir;
|
||||
LDG_INFOS *cook;
|
||||
struct dirent *de;
|
||||
int16 len;
|
||||
char extention[4];
|
||||
|
||||
shel_envrn( &env_ldg, "LDGPATH=");
|
||||
|
||||
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");
|
||||
|
||||
current_dir[0] = 'A' + Dgetdrv();
|
||||
current_dir[1] = ':';
|
||||
Dgetpath( current_dir + 2, 0);
|
||||
|
||||
if( vdi_initialised == 0)
|
||||
if( !( vdi_initialised = vdi_init()))
|
||||
return( 0);
|
||||
|
||||
if( mem_initialised == 0)
|
||||
if( !( mem_initialised = mem_init()))
|
||||
return( 0);
|
||||
|
||||
if ( chdir( plugin_dir) != 0)
|
||||
{
|
||||
mem_quit();
|
||||
return( 0);
|
||||
}
|
||||
|
||||
if( strcmp ( codec_name, "all") == 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
|
||||
ldg_close( codecs[plugins_nbr], ldg_global);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir( dir);
|
||||
}
|
||||
}
|
||||
else if ( ( codecs[plugins_nbr] = ldg_open( codec_name, ldg_global)))
|
||||
{
|
||||
if ( ( codec_init = ldg_find( "plugin_init", codecs[plugins_nbr])))
|
||||
{
|
||||
codec_init();
|
||||
plugins_nbr++;
|
||||
}
|
||||
else
|
||||
ldg_close( codecs[plugins_nbr], ldg_global);
|
||||
}
|
||||
|
||||
chdir( current_dir);
|
||||
|
||||
return plugins_nbr;
|
||||
}
|
||||
|
||||
2
sources/z-tools/trunk/zcodeclib/src/codecs.h
Normal file
2
sources/z-tools/trunk/zcodeclib/src/codecs.h
Normal file
@@ -0,0 +1,2 @@
|
||||
extern LDG *codecs[100];
|
||||
extern int16 plugins_nbr;
|
||||
44
sources/z-tools/trunk/zcodeclib/src/general.h
Normal file
44
sources/z-tools/trunk/zcodeclib/src/general.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* zcodeclib.
|
||||
* Copyright (c) 2001-2005 Zorro ( zorro270@yahoo.fr)
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <osbind.h>
|
||||
#include <mintbind.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <gemx.h>
|
||||
#include <ldg.h>
|
||||
#include <ldg/mem.h>
|
||||
#include <types2b.h>
|
||||
#include "mem.h"
|
||||
|
||||
#define shared_malloc( s) _ldg_malloc( s, ldg_global[2]);
|
||||
#define shared_free( s) _ldg_free( s, ldg_global[2]);
|
||||
|
||||
#ifndef MIN
|
||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
# define TRUE 1
|
||||
# define FALSE 0
|
||||
#endif
|
||||
|
||||
53
sources/z-tools/trunk/zcodeclib/src/img.c
Normal file
53
sources/z-tools/trunk/zcodeclib/src/img.c
Normal file
@@ -0,0 +1,53 @@
|
||||
#include "general.h"
|
||||
#include "mfdb.h"
|
||||
#include "load_img.h"
|
||||
|
||||
IMAGE *init_img( int16 page, int16 w, int16 h, int16 planes)
|
||||
{
|
||||
IMAGE *data;
|
||||
int16 i;
|
||||
|
||||
data = ( IMAGE *)shared_malloc( sizeof( IMAGE));
|
||||
|
||||
if( data == NULL)
|
||||
return NULL;
|
||||
|
||||
data->page = page;
|
||||
data->delay = NULL;
|
||||
|
||||
data->image = ( MFDB *)shared_malloc( sizeof( MFDB) * page);
|
||||
|
||||
if( data->image == NULL)
|
||||
{
|
||||
shared_free( data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for ( i = 0 ; i < page ; i++)
|
||||
{
|
||||
if ( !init_mfdb( &data->image[i], w, h, planes))
|
||||
{
|
||||
if( i)
|
||||
delete_mfdb( data->image, i + 1);
|
||||
|
||||
shared_free( data->image);
|
||||
shared_free( data);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void delete_img( IMAGE *data)
|
||||
{
|
||||
if( data == NULL)
|
||||
return;
|
||||
|
||||
delete_mfdb( data->image, data->page);
|
||||
|
||||
if( data->delay)
|
||||
shared_free( data->delay);
|
||||
|
||||
shared_free( data);
|
||||
}
|
||||
3
sources/z-tools/trunk/zcodeclib/src/img.h
Normal file
3
sources/z-tools/trunk/zcodeclib/src/img.h
Normal file
@@ -0,0 +1,3 @@
|
||||
extern IMAGE *init_img( int16 page, int16 w, int16 h, int16 planes);
|
||||
extern void delete_img( IMAGE *data);
|
||||
|
||||
259
sources/z-tools/trunk/zcodeclib/src/load_img.c
Normal file
259
sources/z-tools/trunk/zcodeclib/src/load_img.c
Normal file
@@ -0,0 +1,259 @@
|
||||
#include "general.h"
|
||||
#include "codecs.h"
|
||||
#include "load_img.h"
|
||||
#include "img.h"
|
||||
#include "ztext.h"
|
||||
#include "zvdi/color.h"
|
||||
#include "zvdi/raster.h"
|
||||
#include "zvdi/vdi.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 *);
|
||||
|
||||
|
||||
static IMAGE *setup ( IMGINFO info, DECDATA data, int16 w, int16 h, int16 keep_ratio)
|
||||
{
|
||||
int16 n_planes = ( ( info->planes == 1 && info->components == 1) ? 1: nplanes);
|
||||
uint16 display_w, display_h;
|
||||
int16 wanted_w = ( w > 0 ? w : info->width), wanted_h = ( h > 0 ? h : info->height);
|
||||
float precise_x, precise_y;
|
||||
size_t src_line_size;
|
||||
IMAGE *image;
|
||||
|
||||
/* the image size is different that the original and we want to keep the aspect ratio */
|
||||
if( keep_ratio && ( info->width != wanted_w) && ( info->height != wanted_h))
|
||||
{
|
||||
float factor = MAX( ( float)info->height / ( float)wanted_h, ( float)info->width / ( float)wanted_w);
|
||||
precise_x = ( float)info->width / factor;
|
||||
precise_y = ( float)info->height / factor;
|
||||
|
||||
display_w = ( ( uint16)precise_x > 0 ? ( uint16)precise_x : 16);
|
||||
display_h = ( ( uint16)precise_y > 0 ? ( uint16)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 if(( info->width != wanted_w) && ( info->height != wanted_h))
|
||||
{
|
||||
float x_factor = ( float)info->width / ( float)wanted_w;
|
||||
float y_factor = ( float)info->height / ( float)wanted_h;
|
||||
precise_x = ( float)info->width / x_factor;
|
||||
precise_y = ( float)info->height / y_factor;
|
||||
|
||||
display_w = ( ( uint16)precise_x > 0 ? ( uint16)precise_x : 16);
|
||||
display_h = ( ( uint16)precise_y > 0 ? ( uint16)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;
|
||||
}
|
||||
|
||||
image = init_img( info->page, display_w, display_h, n_planes);
|
||||
|
||||
if( image == NULL)
|
||||
return 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*)shared_malloc( src_line_size);
|
||||
|
||||
if( !data->RowBuf)
|
||||
return NULL;
|
||||
|
||||
if(( info->planes == 1 && info->components == 1) || nplanes > 8)
|
||||
data->DthBuf = NULL;
|
||||
else
|
||||
{
|
||||
size_t size = ( display_w + 15) * 3;
|
||||
|
||||
data->DthBuf = shared_malloc( size);
|
||||
|
||||
if( data->DthBuf == NULL)
|
||||
return NULL;
|
||||
|
||||
memset( data->DthBuf, 0, size);
|
||||
}
|
||||
|
||||
data->DthWidth = display_w;
|
||||
data->PixMask = ( 1 << info->planes) - 1;
|
||||
data->LnSize = image->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);
|
||||
}
|
||||
|
||||
image->delay = NULL;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static inline void read_img ( IMAGE *img, IMGINFO info, DECDATA data)
|
||||
{
|
||||
uint16 *dst;
|
||||
int16 y_dst, i, y, img_h = info->height;
|
||||
int32 line_size = data->LnSize;
|
||||
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->delay != NULL )
|
||||
{
|
||||
img->delay[i] = info->delay;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void quit_img( IMGINFO info, DECDATA data)
|
||||
{
|
||||
if( decoder_init_done == TRUE)
|
||||
decoder_quit( info);
|
||||
|
||||
if( data->DthBuf)
|
||||
shared_free( data->DthBuf);
|
||||
|
||||
if( data->RowBuf)
|
||||
shared_free( data->RowBuf);
|
||||
|
||||
shared_free( data);
|
||||
shared_free( info);
|
||||
|
||||
decoder_init_done = FALSE;
|
||||
}
|
||||
|
||||
|
||||
boolean get_pic_info( const char *file, IMGINFO info)
|
||||
{
|
||||
int16 i, j, c = 0;
|
||||
char extention[3+1], plugin[3];
|
||||
|
||||
strcpy ( extention, file + strlen( file) - 3);
|
||||
str2upper( extention);
|
||||
|
||||
/* 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])))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return decoder_init( file, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* I wish that it will never append ! */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
IMAGE *load_img( const char *file, int16 w, int16 h, int16 keep_ratio)
|
||||
{
|
||||
IMGINFO info;
|
||||
DECDATA data;
|
||||
IMAGE *img;
|
||||
|
||||
/* One codec or more must be present */
|
||||
if( codecs[0] == NULL)
|
||||
return( NULL);
|
||||
|
||||
info = ( img_info *)shared_malloc( sizeof( img_info));
|
||||
|
||||
if( !info)
|
||||
return( NULL);
|
||||
|
||||
data = ( dec_data *)shared_malloc( sizeof( dec_data));
|
||||
|
||||
if( !data)
|
||||
{
|
||||
shared_free( info);
|
||||
return ( NULL);
|
||||
}
|
||||
|
||||
info->background_color = 0xFFFFFF;
|
||||
info->thumbnail = FALSE;
|
||||
|
||||
if (( decoder_init_done = get_pic_info( file, info)) == FALSE)
|
||||
{
|
||||
shared_free( data);
|
||||
shared_free( info);
|
||||
return ( NULL);
|
||||
}
|
||||
|
||||
img = setup ( info, data, w, h, keep_ratio);
|
||||
if( img == NULL)
|
||||
{
|
||||
delete_img( img);
|
||||
quit_img( info, data);
|
||||
return ( NULL);
|
||||
}
|
||||
|
||||
read_img ( img, info, data);
|
||||
|
||||
quit_img( info, data);
|
||||
|
||||
return ( img);
|
||||
}
|
||||
92
sources/z-tools/trunk/zcodeclib/src/load_img.h
Normal file
92
sources/z-tools/trunk/zcodeclib/src/load_img.h
Normal file
@@ -0,0 +1,92 @@
|
||||
#define UP_TO_DOWN 0
|
||||
#define DOWN_TO_UP 1
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
typedef struct _img
|
||||
{
|
||||
int16 page; /* Number of page/image in the file */
|
||||
uint16 *delay; /* Animation delay in millise. between each frame */
|
||||
MFDB *image; /* The Image itself */
|
||||
}IMAGE;
|
||||
|
||||
extern void ( *raster) ( DECDATA, void *dst);
|
||||
extern void ( *raster_cmap) ( DECDATA, void *);
|
||||
extern void ( *raster_true) ( DECDATA, void *);
|
||||
extern void ( *cnvpal_color)( IMGINFO, DECDATA);
|
||||
extern void ( *raster_gray) ( DECDATA, void *);
|
||||
|
||||
extern IMAGE *load_img( const char *file, int16 w, int16 h, int16 keep_ratio);
|
||||
|
||||
55
sources/z-tools/trunk/zcodeclib/src/mem.c
Normal file
55
sources/z-tools/trunk/zcodeclib/src/mem.c
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "general.h"
|
||||
|
||||
/* Prototype */
|
||||
void mem_quit( void);
|
||||
int16 mem_init( void);
|
||||
|
||||
LDG *ldg_mem = NULL;
|
||||
|
||||
/*==================================================================================*
|
||||
* int16 mem_init: *
|
||||
* Initialise the memory manager. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* -- *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* '1' if all is OK else '0' *
|
||||
*==================================================================================*/
|
||||
|
||||
int16 mem_init( void)
|
||||
{
|
||||
ldg_mem = ldg_open( "C:\\gemsys\\ldg\\mem.ldg", ldg_global);
|
||||
|
||||
if( !ldg_mem)
|
||||
ldg_mem = ldg_open( "mem.ldg", ldg_global);
|
||||
|
||||
_ldg_malloc = ldg_find( "ldg_malloc", ldg_mem);
|
||||
_ldg_free = ldg_find( "ldg_free", ldg_mem);
|
||||
_ldg_allocmode = ldg_find( "ldg_allocmode", ldg_mem);
|
||||
|
||||
if ( !ldg_mem || !_ldg_malloc || !_ldg_free || !_ldg_allocmode)
|
||||
return( 0);
|
||||
|
||||
ldg_allocmode( 0L);
|
||||
|
||||
return( 1);
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* void mem_quit: *
|
||||
* close the memory manager. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* -- *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
void mem_quit( void)
|
||||
{
|
||||
if( ldg_mem)
|
||||
ldg_close( ldg_mem, ldg_global);
|
||||
}
|
||||
|
||||
4
sources/z-tools/trunk/zcodeclib/src/mem.h
Normal file
4
sources/z-tools/trunk/zcodeclib/src/mem.h
Normal file
@@ -0,0 +1,4 @@
|
||||
extern int16 mem_init( void);
|
||||
extern void mem_quit( void);
|
||||
|
||||
|
||||
71
sources/z-tools/trunk/zcodeclib/src/mfdb.c
Normal file
71
sources/z-tools/trunk/zcodeclib/src/mfdb.c
Normal file
@@ -0,0 +1,71 @@
|
||||
#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 = shared_malloc( length);
|
||||
|
||||
if ( bm->fd_addr)
|
||||
return ( 1);
|
||||
else
|
||||
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)
|
||||
shared_free( bm[i].fd_addr);
|
||||
}
|
||||
|
||||
shared_free( bm);
|
||||
}
|
||||
|
||||
2
sources/z-tools/trunk/zcodeclib/src/mfdb.h
Normal file
2
sources/z-tools/trunk/zcodeclib/src/mfdb.h
Normal 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);
|
||||
156
sources/z-tools/trunk/zcodeclib/src/resize.c
Normal file
156
sources/z-tools/trunk/zcodeclib/src/resize.c
Normal file
@@ -0,0 +1,156 @@
|
||||
#include "general.h"
|
||||
#include "load_img.h"
|
||||
#include "mfdb.h"
|
||||
#include "zvdi/raresize.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, int16 w, int16 h, int16 keep_ratio)
|
||||
{
|
||||
uint16 display_w, display_h;
|
||||
float precise_x, precise_y;
|
||||
|
||||
/* the image size is different that the original and we want to keep the aspect ratio */
|
||||
if( keep_ratio)
|
||||
{
|
||||
float factor = MAX( ( float)in->fd_h / ( float)h, ( float)in->fd_w / ( float)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;
|
||||
}
|
||||
else
|
||||
{
|
||||
float x_factor = ( float)in->fd_w / ( float)w;
|
||||
float y_factor = ( float)in->fd_h / ( float)h;
|
||||
precise_x = ( float)in->fd_w / x_factor;
|
||||
precise_y = ( float)in->fd_h / y_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 = shared_malloc((( 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);
|
||||
}
|
||||
|
||||
|
||||
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. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* in: The src MFDB. *
|
||||
* img: The target MFDB. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: '0' if error else 1. *
|
||||
*==================================================================================*/
|
||||
|
||||
MFDB *pic_resize( MFDB *in, int16 w, int16 h, int16 keep_ratio)
|
||||
{
|
||||
DECDATA data;
|
||||
MFDB *out;
|
||||
|
||||
/* 2 planes zoom not available */
|
||||
if( in->fd_nplanes == 2)
|
||||
return NULL;
|
||||
|
||||
out = ( MFDB *)shared_malloc( sizeof( MFDB));
|
||||
|
||||
if( out == NULL)
|
||||
return NULL;
|
||||
|
||||
data = ( dec_data *)shared_malloc( sizeof( dec_data));
|
||||
|
||||
if( !data)
|
||||
{
|
||||
shared_free( out);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if( !resize_setup( in, out, data, w, h, keep_ratio))
|
||||
{
|
||||
shared_free( data);
|
||||
shared_free( out);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
resize_img ( in, out, data);
|
||||
|
||||
if( data->DstBuf)
|
||||
shared_free( data->DstBuf);
|
||||
|
||||
shared_free( data);
|
||||
|
||||
return( out);
|
||||
}
|
||||
3
sources/z-tools/trunk/zcodeclib/src/resize.h
Normal file
3
sources/z-tools/trunk/zcodeclib/src/resize.h
Normal file
@@ -0,0 +1,3 @@
|
||||
extern void ( *resize)( DECDATA, void *dst);
|
||||
extern MFDB *pic_resize( MFDB *in, int16 w, int16 h, int16 keep_ratio);
|
||||
|
||||
78
sources/z-tools/trunk/zcodeclib/src/ztext.c
Normal file
78
sources/z-tools/trunk/zcodeclib/src/ztext.c
Normal file
@@ -0,0 +1,78 @@
|
||||
#include "general.h"
|
||||
|
||||
|
||||
/* Local variable */
|
||||
typedef struct
|
||||
{
|
||||
char upper;
|
||||
char lower;
|
||||
} CUL;
|
||||
|
||||
|
||||
static CUL c[] = { {'A', 'a'}, {'B', 'b'}, {'C', 'c'}, {'D', 'd'}, {'E', 'e'}, {'F', 'f'}, {'G', 'g'}, {'H', 'h'},
|
||||
{'I', 'i'}, {'J', 'j'}, {'K', 'k'}, {'L', 'l'}, {'M', 'm'}, {'N', 'n'}, {'O', 'o'}, {'P', 'p'},
|
||||
{'Q', 'q'}, {'R', 'r'}, {'S', 's'}, {'T', 't'}, {'U', 'u'}, {'V', 'v'}, {'W', 'w'}, {'X', 'x'},
|
||||
{'Y', 'y'}, {'Z', 'z'}, {'<EFBFBD>', '<EFBFBD>'}, {'<EFBFBD>', '<EFBFBD>'}, {'<EFBFBD>', '<EFBFBD>'}, {0xb6, '<EFBFBD>'}, {'<EFBFBD>', '<EFBFBD>'}, {'<EFBFBD>', '<EFBFBD>'},
|
||||
{'<EFBFBD>', '<EFBFBD>'}, {'<EFBFBD>', '<EFBFBD>'}, {'<EFBFBD>', '<EFBFBD>'}, {0xb7, 0xb0}, {0xb8, 0xb1}, {0xb2, 0xb3}, {0xb5, 0xb4} };
|
||||
|
||||
|
||||
/* Prototype */
|
||||
void str2lower(char *str);
|
||||
void str2upper(char *str);
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* str2lower: *
|
||||
* Transforms all letters in the string to lower case. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: - *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* str: Pointer to null terminated string. *
|
||||
*==================================================================================*/
|
||||
void str2lower(char *str)
|
||||
{
|
||||
int16 i, k;
|
||||
|
||||
i = 0;
|
||||
while (str[i] != '\0')
|
||||
{
|
||||
for (k = 0; k < (sizeof(c) / sizeof(CUL)); k++)
|
||||
{
|
||||
if (c[k].upper == str[i])
|
||||
{
|
||||
str[i] = c[k].lower;
|
||||
break;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* str2upper: *
|
||||
* Transforms all letters in the string to uper case. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: - *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* str: Pointer to null terminated string. *
|
||||
*==================================================================================*/
|
||||
void str2upper(char *str)
|
||||
{
|
||||
int16 i, k;
|
||||
|
||||
i = 0;
|
||||
while (str[i] != '\0')
|
||||
{
|
||||
for (k = 0; k < (sizeof(c) / sizeof(CUL)); k++)
|
||||
{
|
||||
if (c[k].lower == str[i])
|
||||
{
|
||||
str[i] = c[k].upper;
|
||||
break;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
5
sources/z-tools/trunk/zcodeclib/src/ztext.h
Normal file
5
sources/z-tools/trunk/zcodeclib/src/ztext.h
Normal file
@@ -0,0 +1,5 @@
|
||||
extern void size_to_text( char *txt, float size);
|
||||
extern void str2lower(char *str);
|
||||
extern void str2upper(char *str);
|
||||
extern int16 name_shorter( int16 handle, int16 max_size, char *str);
|
||||
extern char *zstrncpy( char *dst, const char *src, size_t n);
|
||||
200
sources/z-tools/trunk/zcodeclib/src/zvdi/color.c
Normal file
200
sources/z-tools/trunk/zcodeclib/src/zvdi/color.c
Normal file
@@ -0,0 +1,200 @@
|
||||
#ifdef __PUREC__
|
||||
#include "..\general.h"
|
||||
#include "..\load_img.h"
|
||||
#else
|
||||
#include "../general.h"
|
||||
#include "../load_img.h"
|
||||
#endif
|
||||
#include "vdi.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8 satur;
|
||||
uint8 red, green, blue;
|
||||
} SRGB;
|
||||
|
||||
static SRGB screen_colortab[256];
|
||||
|
||||
|
||||
/* prototype */
|
||||
void save_colors(void);
|
||||
int16 remap_color (int32 value);
|
||||
uint32 color_lookup ( uint32 rgb, int16 *trans);
|
||||
void cnvpal_mono ( IMGINFO info, DECDATA data);
|
||||
void cnvpal_1_2 (IMGINFO info, DECDATA data);
|
||||
void cnvpal_4_8( IMGINFO info, DECDATA data);
|
||||
void cnvpal_15( IMGINFO info, DECDATA data);
|
||||
void cnvpal_high( IMGINFO info, DECDATA data);
|
||||
void cnvpal_true( IMGINFO info, DECDATA data);
|
||||
|
||||
|
||||
static uint8 saturation (uint8 * rgb)
|
||||
{
|
||||
uint8 satr;
|
||||
|
||||
if (rgb[0] >= rgb[1])
|
||||
{
|
||||
if (rgb[1] >= rgb[2])
|
||||
satr = rgb[0] - rgb[2];
|
||||
else if (rgb[0] > rgb[2])
|
||||
satr = rgb[0] - rgb[1];
|
||||
else
|
||||
satr = rgb[2] - rgb[1];
|
||||
}
|
||||
else if (rgb[1] >= rgb[2])
|
||||
{
|
||||
if (rgb[0] >= rgb[2])
|
||||
satr = rgb[1] - rgb[2];
|
||||
else
|
||||
satr = rgb[1] - rgb[0];
|
||||
}
|
||||
else
|
||||
satr = rgb[2] - rgb[0];
|
||||
|
||||
return satr;
|
||||
}
|
||||
|
||||
|
||||
void save_colors(void)
|
||||
{
|
||||
register int16 i;
|
||||
int16 colors = 1 << nplanes;
|
||||
|
||||
for( i = 0; i < colors; i++)
|
||||
{
|
||||
int16 coltab[3];
|
||||
|
||||
vq_color( vdi_handle, i, 1, coltab);
|
||||
|
||||
screen_colortab[i].red = ((((int32)coltab[0] << 8 ) - coltab[0]) + 500) / 1000;
|
||||
screen_colortab[i].green = ((((int32)coltab[1] << 8 ) - coltab[1]) + 500) / 1000;
|
||||
screen_colortab[i].blue = ((((int32)coltab[2] << 8 ) - coltab[2]) + 500) / 1000;
|
||||
screen_colortab[i].satur = saturation ( &screen_colortab[i].red);
|
||||
}
|
||||
}
|
||||
|
||||
int16 remap_color (int32 value)
|
||||
{
|
||||
int16 red = ((uint8*)&value)[1];
|
||||
int16 green = ((uint8*)&value)[2];
|
||||
int16 blue = ((uint8*)&value)[3];
|
||||
int16 satur = saturation (((uint8*)&value) +1);
|
||||
|
||||
int16 best_fit = 0;
|
||||
uint16 best_err = 0xFFFFu;
|
||||
int16 max_color = 1 << nplanes;
|
||||
|
||||
int16 i = 0;
|
||||
|
||||
value = ( value & 0x00FFFFFFl) | (( int32)satur << 24);
|
||||
|
||||
do
|
||||
{
|
||||
if ( *( int32*)&screen_colortab[i] == value)
|
||||
{
|
||||
/* gotcha! */
|
||||
best_fit = i;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16 err =
|
||||
( red > screen_colortab[i].red ? red - screen_colortab[i].red : screen_colortab[i].red - red)
|
||||
+ (green > screen_colortab[i].green ? green - screen_colortab[i].green : screen_colortab[i].green - green)
|
||||
+ (blue > screen_colortab[i].blue ? blue - screen_colortab[i].blue : screen_colortab[i].blue - blue)
|
||||
+ (satur > screen_colortab[i].satur ? satur - screen_colortab[i].satur : screen_colortab[i].satur - satur);
|
||||
|
||||
if (err <= best_err)
|
||||
{
|
||||
best_err = err;
|
||||
best_fit = i;
|
||||
}
|
||||
}
|
||||
} while (++i < max_color);
|
||||
|
||||
return best_fit;
|
||||
}
|
||||
|
||||
|
||||
uint32 color_lookup ( uint32 rgb, int16 *trans)
|
||||
{
|
||||
uint8 idx = ((rgb & ~0xFFuL) == ~0xFFuL ? rgb : remap_color (rgb));
|
||||
return ( (( int32)(trans ? trans[idx] : idx) << 24) | (*(int32*)&screen_colortab[idx] & 0x00FFFFFFuL));
|
||||
}
|
||||
|
||||
|
||||
void cnvpal_mono ( IMGINFO info, DECDATA data)
|
||||
{
|
||||
/* if ( info->indexed_color)
|
||||
{
|
||||
uint32 bgnd, fgnd;
|
||||
|
||||
bgnd = (((( int32)info->palette[0].red <<8) | info->palette[0].green) <<8) | info->palette[0].blue;
|
||||
fgnd = (((( int32)info->palette[1].red <<8) | info->palette[1].green) <<8) | info->palette[1].blue;
|
||||
|
||||
data->Pixel[0] = remap_color ( bgnd);
|
||||
data->Pixel[1] = remap_color ( fgnd);
|
||||
|
||||
}
|
||||
else
|
||||
*/ {
|
||||
data->Pixel[0] = G_WHITE;
|
||||
data->Pixel[1] = G_BLACK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cnvpal_1_2 (IMGINFO info, DECDATA data)
|
||||
{
|
||||
register int32 i;
|
||||
|
||||
for( i = 0; i < info->colors; i++)
|
||||
{
|
||||
data->Pixel[i] = ( int16)info->palette[i].red * 5 + ( int16)info->palette[i].green * 9 + (( int16)info->palette[i].blue << 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cnvpal_4_8( IMGINFO info, DECDATA data)
|
||||
{
|
||||
register int32 i;
|
||||
|
||||
for( i = 0; i < info->colors; i++)
|
||||
{
|
||||
uint32 rgb = (((( int32)info->palette[i].red << 8) | info->palette[i].green) << 8) | info->palette[i].blue;
|
||||
data->Pixel[i] = rgb | (( int32)pixel_val[remap_color ( rgb)] << 24);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cnvpal_15( IMGINFO info, DECDATA data)
|
||||
{
|
||||
register int32 i;
|
||||
|
||||
for( i = 0; i < info->colors; i++)
|
||||
{
|
||||
data->Pixel[i] = (( int16)( info->palette[i].red & 0xF8) << 7) | (( int16)( info->palette[i].green & 0xF8) << 2) | ( info->palette[i].blue >> 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cnvpal_high( IMGINFO info, DECDATA data)
|
||||
{
|
||||
register int32 i;
|
||||
|
||||
for( i = 0; i < info->colors; i++)
|
||||
{
|
||||
data->Pixel[i] = (( int16)( info->palette[i].red & 0xF8) << 8) | (( int16)( info->palette[i].green & 0xFC) << 3) | ( info->palette[i].blue >> 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cnvpal_true ( IMGINFO info, DECDATA data)
|
||||
{
|
||||
register int32 i;
|
||||
|
||||
for( i = 0; i < info->colors; i++)
|
||||
{
|
||||
data->Pixel[i] = (((( int32)info->palette[i].red << 8) | info->palette[i].green) << 8) | info->palette[i].blue;
|
||||
}
|
||||
}
|
||||
14
sources/z-tools/trunk/zcodeclib/src/zvdi/color.h
Normal file
14
sources/z-tools/trunk/zcodeclib/src/zvdi/color.h
Normal file
@@ -0,0 +1,14 @@
|
||||
extern void save_colors( void);
|
||||
extern int16 remap_color( int32 value);
|
||||
|
||||
extern uint32 color_lookup( uint32 rgb, int16 *trans);
|
||||
|
||||
extern void cnvpal_mono( IMGINFO info, DECDATA data);
|
||||
extern void cnvpal_1_2( IMGINFO info, DECDATA data);
|
||||
extern void cnvpal_4_8( IMGINFO info, DECDATA data);
|
||||
extern void cnvpal_15( IMGINFO info, DECDATA data);
|
||||
extern void cnvpal_high( IMGINFO info, DECDATA data);
|
||||
extern void cnvpal_true( IMGINFO info, DECDATA data);
|
||||
|
||||
extern void ( *cnvpal_color)( IMGINFO, DECDATA);
|
||||
|
||||
46
sources/z-tools/trunk/zcodeclib/src/zvdi/dither.c
Normal file
46
sources/z-tools/trunk/zcodeclib/src/zvdi/dither.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifdef __PUREC__
|
||||
#include "..\general.h"
|
||||
#else
|
||||
#include "../general.h"
|
||||
#endif
|
||||
|
||||
|
||||
extern uint32 cube216[216];
|
||||
extern uint32 graymap[32];
|
||||
|
||||
/* prototype */
|
||||
inline uint8 dither_true ( uint8 * rgb, int16 * err, int8 ** buf);
|
||||
inline uint8 dither_gray( uint8 *gray, int16 *err, int8 **buf);
|
||||
|
||||
inline uint8 dither_true ( uint8 * rgb, int16 * err, int8 ** buf)
|
||||
{
|
||||
int8 *dth = *buf;
|
||||
unsigned short r = (( err[0] += ( int16)dth[0] + rgb[0]) <= 42 ? 0 : err[0] >= 213 ? 5 : ( err[0] * 3) >> 7);
|
||||
unsigned short g = (( err[1] += ( int16)dth[1] + rgb[1]) <= 42 ? 0 : err[1] >= 213 ? 5 : ( err[1] * 3) >> 7);
|
||||
unsigned short b = (( err[2] += ( int16)dth[2] + rgb[2]) <= 42 ? 0 : err[2] >= 213 ? 5 : ( err[2] * 3) >> 7);
|
||||
uint8 * irgb = ( uint8*)&cube216[( r * 6 + g) * 6 + b];
|
||||
|
||||
err[0] -= irgb[1];
|
||||
dth[0] = ( err[0] <= -254 ? ( err[0] =- 127) : err[0] >= +254 ? ( err[0] =+ 127) : ( err[0] >>= 1));
|
||||
err[1] -= irgb[2];
|
||||
dth[1] = ( err[1] <= -254 ? ( err[1] =- 127) : err[1] >= +254 ? ( err[1] =+ 127) : ( err[1] >>= 1));
|
||||
err[2] -= irgb[3];
|
||||
dth[2] = ( err[2] <= -254 ? ( err[2] = -127) : err[2] >= +254 ? ( err[2] = +127) : ( err[2] >>= 1));
|
||||
( *buf) += 3;
|
||||
|
||||
return irgb[0];
|
||||
}
|
||||
|
||||
|
||||
inline uint8 dither_gray( uint8 *gray, int16 *err, int8 **buf)
|
||||
{
|
||||
int8 *dth = *buf;
|
||||
unsigned short idx = (( err[0] += ( int16)dth[0] + gray[0]) <= 0x07 ? 0 : err[0] >= 0xF8 ? 0x1F : err[0] >> 3);
|
||||
uint8 *irgb = ( uint8*)&graymap[idx];
|
||||
|
||||
err[0] -= irgb[1];
|
||||
dth[0] = ( err[0] <= -254 ? ( err[0] = -127) : err[0] >= +254 ? ( err[0] =+ 127) : ( err[0] >>= 1));
|
||||
(*buf) += 1;
|
||||
|
||||
return irgb[0];
|
||||
}
|
||||
2
sources/z-tools/trunk/zcodeclib/src/zvdi/dither.h
Normal file
2
sources/z-tools/trunk/zcodeclib/src/zvdi/dither.h
Normal file
@@ -0,0 +1,2 @@
|
||||
extern inline uint8 dither_true ( uint8 * rgb, int16 * err, int8 ** buf);
|
||||
extern inline uint8 dither_gray( uint8 *gray, int16 *err, int8 **buf);
|
||||
87
sources/z-tools/trunk/zcodeclib/src/zvdi/p2c.c
Normal file
87
sources/z-tools/trunk/zcodeclib/src/zvdi/p2c.c
Normal file
@@ -0,0 +1,87 @@
|
||||
#ifdef __PUREC__
|
||||
#include "..\general.h"
|
||||
#else
|
||||
#include "../general.h"
|
||||
#endif
|
||||
|
||||
|
||||
void ( *planar_to_chunky)( uint8 *in, uint8 *out, int16 width);
|
||||
|
||||
|
||||
inline void planar8_to_chunky8( uint8 *in, uint8 *out, int16 width)
|
||||
{
|
||||
uint8 *l;
|
||||
uint16 x, c, p0, p1, p2, p3, p4, p5, p6, p7;
|
||||
|
||||
for( x = 0, l = in; x < width; l += 16)
|
||||
{
|
||||
p0 = ( l[0] << 8) | l[1];
|
||||
p1 = ( l[2] << 8) | l[3];
|
||||
p2 = ( l[4] << 8) | l[5];
|
||||
p3 = ( l[6] << 8) | l[7];
|
||||
p4 = ( l[8] << 8) | l[9];
|
||||
p5 = ( l[10] << 8) | l[11];
|
||||
p6 = ( l[12] << 8) | l[13];
|
||||
p7 = ( l[14] << 8) | l[15];
|
||||
|
||||
for ( c = 0; c < 16; c++)
|
||||
{
|
||||
out[x++] = ((p0 >> 15) & 1) | ((p1 >> 14) & 2) | ((p2 >> 13) & 4) | ((p3 >> 12) & 8) |
|
||||
((p4 >> 11) & 16) | ((p5 >> 10) & 32)| ((p6 >> 9) & 64) | ((p7 >> 8) & 128);
|
||||
p0 <<= 1;
|
||||
p1 <<= 1;
|
||||
p2 <<= 1;
|
||||
p3 <<= 1;
|
||||
p4 <<= 1;
|
||||
p5 <<= 1;
|
||||
p6 <<= 1;
|
||||
p7 <<= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void planar4_to_chunky8( uint8 *in, uint8 *out, int16 width)
|
||||
{
|
||||
uint8 *l;
|
||||
uint16 x, c, p0, p1, p2, p3;
|
||||
|
||||
for( x = 0, l = in; x < width; l += 8)
|
||||
{
|
||||
p0 = ( l[0] << 8) | l[1];
|
||||
p1 = ( l[2] << 8) | l[3];
|
||||
p2 = ( l[4] << 8) | l[5];
|
||||
p3 = ( l[6] << 8) | l[7];
|
||||
|
||||
for ( c = 0; c < 16; c++)
|
||||
{
|
||||
out[x++] = ((p0 >> 15) & 1) | ((p1 >> 14) & 2) | ((p2 >> 13) & 4) | ((p3 >> 12) & 8);
|
||||
|
||||
p0 <<= 1;
|
||||
p1 <<= 1;
|
||||
p2 <<= 1;
|
||||
p3 <<= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void planar2_to_chunky8( uint8 *in, uint8 *out, int16 width)
|
||||
{
|
||||
uint8 *l;
|
||||
uint16 x, c, p0, p1;
|
||||
|
||||
for ( x = 0, l = in; x < width; l += 4)
|
||||
{
|
||||
p0 = (l[0] << 8) | l[1];
|
||||
p1 = (l[2] << 8) | l[3];
|
||||
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
out[x++] = ((p0 >> 15) & 1) | ((p1 >> 14) & 2);
|
||||
p0 <<= 1;
|
||||
p1 <<= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
5
sources/z-tools/trunk/zcodeclib/src/zvdi/p2c.h
Normal file
5
sources/z-tools/trunk/zcodeclib/src/zvdi/p2c.h
Normal file
@@ -0,0 +1,5 @@
|
||||
extern void ( *planar_to_chunky)( uint8 *in, uint8 *out, int16 width);
|
||||
extern void planar8_to_chunky8( uint8 *in, uint8 *out, int16 width);
|
||||
extern void planar4_to_chunky8( uint8 *in, uint8 *out, int16 width);
|
||||
extern void planar2_to_chunky8( uint8 *in, uint8 *out, int16 width);
|
||||
|
||||
152
sources/z-tools/trunk/zcodeclib/src/zvdi/raresize.c
Normal file
152
sources/z-tools/trunk/zcodeclib/src/zvdi/raresize.c
Normal file
@@ -0,0 +1,152 @@
|
||||
#ifdef __PUREC__
|
||||
#include "..\general.h"
|
||||
#include "..\load_img.h"
|
||||
#else
|
||||
#include "../general.h"
|
||||
#include "../load_img.h"
|
||||
#endif
|
||||
#include "dither.h"
|
||||
#include "raster.h"
|
||||
|
||||
inline void resize_mono ( DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 4;
|
||||
uint16 pixel = 0x80, chunk = 0;
|
||||
|
||||
do
|
||||
{
|
||||
chunk |= ( info->RowBuf[x >> 16] & 1);
|
||||
chunk <<= 1;
|
||||
|
||||
if ( !--width || !(pixel >>= 1))
|
||||
{
|
||||
*(dst++) = chunk;
|
||||
chunk = 0;
|
||||
pixel = 0x80;
|
||||
}
|
||||
|
||||
x += ( info->IncXfx >> 3);
|
||||
|
||||
} while ( width);
|
||||
}
|
||||
|
||||
|
||||
inline void resize_I4 ( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx +1) >> 1;
|
||||
uint8 buf[16];
|
||||
int16 n = 16;
|
||||
uint8 *tmp = buf;
|
||||
|
||||
do
|
||||
{
|
||||
*(tmp++) = *( uint8*)&info->DstBuf[x >> 16];
|
||||
|
||||
if (!--width || !--n)
|
||||
{
|
||||
raster_chunk4( buf, dst, tmp - buf);
|
||||
dst += 4;
|
||||
n = 16;
|
||||
tmp = buf;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while ( width);
|
||||
}
|
||||
|
||||
|
||||
inline void resize_I8 ( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx +1) >> 1;
|
||||
uint8 buf[16];
|
||||
int16 n = 16;
|
||||
uint8 *tmp = buf;
|
||||
|
||||
do
|
||||
{
|
||||
*(tmp++) = *( uint8*)&info->DstBuf[x >> 16];
|
||||
|
||||
if (!--width || !--n)
|
||||
{
|
||||
raster_chunk8 (buf, dst, tmp - buf);
|
||||
dst += 8;
|
||||
n = 16;
|
||||
tmp = buf;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while (width);
|
||||
}
|
||||
|
||||
|
||||
inline void resize_P8(DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 *rgb = &info->RowBuf[x >> 16];
|
||||
*(dst++) = *(rgb);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
|
||||
inline void resize_16(DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 *rgb = &info->RowBuf[(x >> 16) << 1];
|
||||
*(dst++) = *(rgb++);
|
||||
*(dst++) = *(rgb);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
|
||||
inline void resize_24(DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 * rgb = &info->RowBuf[(x >>16) * 3];
|
||||
*(dst++) = *(rgb++);
|
||||
*(dst++) = *(rgb++);
|
||||
*(dst++) = *(rgb);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
|
||||
inline void resize_32( DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 * rgb = &info->RowBuf[(x >> 16) << 2];
|
||||
*(dst++) = *(rgb++);
|
||||
*(dst++) = *(rgb++);
|
||||
*(dst++) = *(rgb++);
|
||||
*(dst++) = *(rgb);
|
||||
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
8
sources/z-tools/trunk/zcodeclib/src/zvdi/raresize.h
Normal file
8
sources/z-tools/trunk/zcodeclib/src/zvdi/raresize.h
Normal file
@@ -0,0 +1,8 @@
|
||||
extern void resize_mono( DECDATA info, void * _dst);
|
||||
extern void resize_I4( DECDATA info, void * _dst);
|
||||
extern void resize_I8( DECDATA info, void * _dst);
|
||||
extern void resize_P8( DECDATA info, void * _dst);
|
||||
extern void resize_16( DECDATA info, void * _dst);
|
||||
extern void resize_24( DECDATA info, void * _dst);
|
||||
extern void resize_32( DECDATA info, void * _dst);
|
||||
|
||||
877
sources/z-tools/trunk/zcodeclib/src/zvdi/raster.c
Normal file
877
sources/z-tools/trunk/zcodeclib/src/zvdi/raster.c
Normal file
@@ -0,0 +1,877 @@
|
||||
#ifdef __PUREC__
|
||||
#include "..\general.h"
|
||||
#include "..\load_img.h"
|
||||
#else
|
||||
#include "../general.h"
|
||||
#include "../load_img.h"
|
||||
#endif
|
||||
#include "dither.h"
|
||||
#include "raster.h"
|
||||
|
||||
inline void raster_mono ( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
uint32 *map = info->Pixel;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
uint16 pixel = 0x8000;
|
||||
uint16 chunk = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if ( map[(int16)info->RowBuf[x >>16] & 1])
|
||||
chunk |= pixel;
|
||||
|
||||
if ( !--width || !(pixel >>= 1))
|
||||
{
|
||||
*(dst++) = chunk;
|
||||
chunk = 0;
|
||||
pixel = 0x8000;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while ( width);
|
||||
}
|
||||
|
||||
inline void raster_D1 ( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
uint32 *map = info->Pixel;
|
||||
uint16 mask = info->PixMask;
|
||||
int16 *buf = info->DthBuf;
|
||||
int16 ins = 0;
|
||||
uint16 pixel = 0x8000;
|
||||
uint16 chunk = 0;
|
||||
|
||||
do
|
||||
{
|
||||
ins += *buf + map[(int16)info->RowBuf[x >>16] & mask];
|
||||
|
||||
if ( ins < 2040)
|
||||
chunk |= pixel;
|
||||
else
|
||||
ins -= 4080;
|
||||
|
||||
*(buf++) = (ins >>= 2);
|
||||
|
||||
if ( !--width || !(pixel >>= 1))
|
||||
{
|
||||
*(dst++) = chunk;
|
||||
chunk = 0;
|
||||
pixel = 0x8000;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while ( width);
|
||||
}
|
||||
|
||||
inline void gscale_D1( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = ( info->IncXfx + 1) >> 1;
|
||||
int16 *buf = info->DthBuf;
|
||||
int16 ins = 0;
|
||||
uint16 pixel = 0x8000;
|
||||
uint16 chunk = 0;
|
||||
|
||||
do
|
||||
{
|
||||
ins += *buf + ( int16)info->RowBuf[x >>16];
|
||||
|
||||
if ( ins < 0x80)
|
||||
chunk |= pixel;
|
||||
else
|
||||
ins -= 0xFF;
|
||||
|
||||
*(buf++) = (ins >>= 2);
|
||||
|
||||
if ( !--width || !(pixel >>= 1))
|
||||
{
|
||||
*(dst++) = chunk;
|
||||
chunk = 0;
|
||||
pixel = 0x8000;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while (width);
|
||||
}
|
||||
|
||||
inline void dither_D1 ( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = ( info->IncXfx + 1) >> 1;
|
||||
int16 *buf = info->DthBuf;
|
||||
int16 ins = 0;
|
||||
uint16 pixel = 0x8000;
|
||||
uint16 chunk = 0;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 *rgb = &info->RowBuf[(x >>16) *3];
|
||||
ins += *buf + ( int16)rgb[0] * 5 + ( int16)rgb[1] * 9 + ( int16)rgb[2] * 2;
|
||||
|
||||
if (ins < 2040)
|
||||
chunk |= pixel;
|
||||
else
|
||||
ins -= 4080;
|
||||
|
||||
*(buf++) = (ins >>= 2);
|
||||
|
||||
if (!--width || !(pixel >>= 1))
|
||||
{
|
||||
*(dst++) = chunk;
|
||||
chunk = 0;
|
||||
pixel = 0x8000;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while( width);
|
||||
}
|
||||
|
||||
inline void raster_D2 ( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = ( info->IncXfx + 1) >> 1;
|
||||
uint32 *map = info->Pixel;
|
||||
uint16 mask = info->PixMask;
|
||||
int16 *buf = info->DthBuf;
|
||||
int16 ins = 0;
|
||||
uint16 pixel = 0x8000;
|
||||
uint16 chunk = 0;
|
||||
|
||||
do
|
||||
{
|
||||
ins += *buf + map[( int16)info->RowBuf[x >>16] & mask];
|
||||
|
||||
if ( ins < 2040)
|
||||
chunk |= pixel;
|
||||
else
|
||||
ins -= 4080;
|
||||
|
||||
*(buf++) = (ins >>= 2);
|
||||
|
||||
if (!--width || !(pixel >>= 1))
|
||||
{
|
||||
*(dst++) = chunk;
|
||||
*(dst++) = chunk;
|
||||
chunk = 0;
|
||||
pixel = 0x8000;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while ( width);
|
||||
}
|
||||
|
||||
inline void gscale_D2( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = ( info->IncXfx + 1) >> 1;
|
||||
int16 *buf = info->DthBuf;
|
||||
int16 ins = 0;
|
||||
uint16 pixel = 0x8000;
|
||||
uint16 chunk = 0;
|
||||
|
||||
do
|
||||
{
|
||||
ins += *buf + (short)info->RowBuf[x >>16];
|
||||
|
||||
if (ins < 0x80)
|
||||
chunk |= pixel;
|
||||
else
|
||||
ins -= 0xFF;
|
||||
|
||||
*(buf++) = (ins >>= 2);
|
||||
|
||||
if (!--width || !(pixel >>= 1))
|
||||
{
|
||||
*(dst++) = chunk;
|
||||
*(dst++) = chunk;
|
||||
chunk = 0;
|
||||
pixel = 0x8000;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while (width);
|
||||
}
|
||||
|
||||
inline void dither_D2 ( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = ( info->IncXfx + 1) >> 1;
|
||||
int16 *buf = info->DthBuf;
|
||||
int16 ins = 0;
|
||||
uint16 pixel = 0x8000;
|
||||
uint16 chunk = 0;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 *rgb = &info->RowBuf[( x >>16) * 3];
|
||||
ins += *buf + (int16)rgb[0] * 5 + (int16)rgb[1] * 9 + (int16)rgb[2] * 2;
|
||||
|
||||
if (ins < 2040)
|
||||
chunk |= pixel;
|
||||
else
|
||||
ins -= 4080;
|
||||
|
||||
*(buf++) = (ins >>= 2);
|
||||
|
||||
if (!--width || !(pixel >>= 1))
|
||||
{
|
||||
*(dst++) = chunk;
|
||||
*(dst++) = chunk;
|
||||
chunk = 0;
|
||||
pixel = 0x8000;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while ( width);
|
||||
}
|
||||
|
||||
inline void raster_chunks ( uint8 *src, uint16 *dst, uint16 num, uint16 depth)
|
||||
{
|
||||
uint16 mask = 0x8000;
|
||||
uint16 *chunk = dst;
|
||||
uint8 pixel = *src;
|
||||
int16 i = depth;
|
||||
|
||||
do
|
||||
{
|
||||
*( chunk++) = ( pixel & 1 ? mask : 0);
|
||||
pixel >>= 1;
|
||||
} while (--i);
|
||||
|
||||
while (--num)
|
||||
{
|
||||
mask >>= 1;
|
||||
chunk = dst;
|
||||
pixel = *( ++src);
|
||||
i = depth;
|
||||
|
||||
do
|
||||
{
|
||||
if ( pixel & 1) *chunk |= mask;
|
||||
else *chunk &= ~mask;
|
||||
chunk++;
|
||||
pixel >>= 1;
|
||||
} while (--i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline void raster_I4 ( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx +1) >> 1;
|
||||
uint8 buf[16];
|
||||
int16 n = 16;
|
||||
uint8 *tmp = buf;
|
||||
|
||||
do
|
||||
{
|
||||
uint16 idx = info->RowBuf[x >>16];
|
||||
*(tmp++) = *( uint8*)&info->Pixel[idx];
|
||||
|
||||
if (!--width || !--n)
|
||||
{
|
||||
raster_chunk4( buf, dst, tmp - buf);
|
||||
dst += 4;
|
||||
n = 16;
|
||||
tmp = buf;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while ( width);
|
||||
}
|
||||
|
||||
inline void gscale_I4( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx +1) >> 1;
|
||||
int8 *dth = info->DthBuf;
|
||||
int16 err = 0;
|
||||
uint8 buf[16];
|
||||
int16 n = 16;
|
||||
uint8 *tmp = buf;
|
||||
|
||||
do
|
||||
{
|
||||
*(tmp++) = dither_gray (&info->RowBuf[x >>16], &err, &dth);
|
||||
|
||||
if (!--width || !--n)
|
||||
{
|
||||
raster_chunk4 (buf, dst, tmp - buf);
|
||||
dst += 4;
|
||||
n = 16;
|
||||
tmp = buf;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while (width);
|
||||
}
|
||||
|
||||
inline void dither_I4 ( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx +1) >> 1;
|
||||
int8 *dth = info->DthBuf;
|
||||
int16 err[3] = { 0, 0, 0 };
|
||||
uint8 buf[16];
|
||||
int16 n = 16;
|
||||
uint8 *tmp = buf;
|
||||
|
||||
do
|
||||
{
|
||||
*(tmp++) = dither_true (&info->RowBuf[(x >>16) *3], err, &dth);
|
||||
|
||||
if (!--width || !--n)
|
||||
{
|
||||
raster_chunk4 (buf, dst, tmp - buf);
|
||||
dst += 4;
|
||||
n = 16;
|
||||
tmp = buf;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while (width);
|
||||
}
|
||||
|
||||
inline void raster_I8 ( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx +1) >> 1;
|
||||
uint8 buf[16];
|
||||
int16 n = 16;
|
||||
uint8 *tmp = buf;
|
||||
|
||||
do
|
||||
{
|
||||
uint16 idx = info->RowBuf[x >>16];
|
||||
*(tmp++) = *(uint8*)&info->Pixel[idx];
|
||||
|
||||
if (!--width || !--n)
|
||||
{
|
||||
raster_chunk8 (buf, dst, tmp - buf);
|
||||
dst += 8;
|
||||
n = 16;
|
||||
tmp = buf;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while (width);
|
||||
}
|
||||
|
||||
inline void gscale_I8( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
int8 *dth = info->DthBuf;
|
||||
int16 err = 0;
|
||||
uint8 buf[16];
|
||||
int16 n = 16;
|
||||
uint8 *tmp = buf;
|
||||
|
||||
do
|
||||
{
|
||||
*(tmp++) = dither_gray (&info->RowBuf[x >>16], &err, &dth);
|
||||
|
||||
if (!--width || !--n) {
|
||||
raster_chunk8 (buf, dst, tmp - buf);
|
||||
dst += 8;
|
||||
n = 16;
|
||||
tmp = buf;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while (width);
|
||||
}
|
||||
|
||||
inline void dither_I8 (DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
int8 *dth = info->DthBuf;
|
||||
int16 err[3] = { 0, 0, 0 };
|
||||
uint8 buf[16];
|
||||
int16 n = 16;
|
||||
uint8 *tmp = buf;
|
||||
|
||||
do
|
||||
{
|
||||
*(tmp++) = dither_true (&info->RowBuf[(x >>16) *3], err, &dth);
|
||||
|
||||
if (!--width || !--n)
|
||||
{
|
||||
raster_chunk8 (buf, dst, tmp - buf);
|
||||
dst += 8;
|
||||
n = 16;
|
||||
tmp = buf;
|
||||
}
|
||||
x += info->IncXfx;
|
||||
|
||||
} while ( width);
|
||||
}
|
||||
|
||||
inline void raster_P8 (DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
uint32 *map = info->Pixel;
|
||||
uint16 mask = info->PixMask;
|
||||
|
||||
do
|
||||
{
|
||||
*(dst++) = *( uint8*)&map[( int16)info->RowBuf[x >>16] & mask];
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void gscale_P8( DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
int8 *dth = info->DthBuf;
|
||||
int16 err = 0;
|
||||
|
||||
do
|
||||
{
|
||||
*(dst++) = dither_gray (&info->RowBuf[x >>16], &err, &dth);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void dither_P8 (DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
int8 *dth = info->DthBuf;
|
||||
int16 err[3] = { 0, 0, 0 };
|
||||
|
||||
do
|
||||
{
|
||||
*(dst++) = dither_true (&info->RowBuf[(x >>16) *3], err, &dth);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void raster_15 (DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
uint32 *map = info->Pixel;
|
||||
uint16 mask = info->PixMask;
|
||||
|
||||
do
|
||||
{
|
||||
*(dst++) = map[(short)info->RowBuf[x >>16] & mask];
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void gscale_15( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 * dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint16 rgb = info->RowBuf[(x >>16)];
|
||||
rgb = ((rgb & 0xF8) <<7) | ((rgb & 0xF8) <<2) | (rgb >>3);
|
||||
*(dst++) = (rgb >> 8) | (rgb << 8);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void dither_15 (DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do {
|
||||
uint8 * rgb = &info->RowBuf[(x >>16) * 3];
|
||||
*(dst++) = (((uint16)rgb[0] & 0xF8) << 7) | (((uint16)rgb[1] & 0xF8) << 2) | ( rgb[2] >> 3);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void raster_15r (DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
uint32 *map = info->Pixel;
|
||||
uint16 mask = info->PixMask;
|
||||
|
||||
do
|
||||
{
|
||||
uint16 rgb = map[(short)info->RowBuf[x >>16] & mask];
|
||||
*(dst++) = (rgb >> 8) | (rgb << 8);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void gscale_15r( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 * dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint16 rgb = info->RowBuf[(x >>16)];
|
||||
rgb = ((rgb & 0xF8) <<7) | ((rgb & 0xF8) <<2) | (rgb >>3);
|
||||
*(dst++) = (rgb >> 8) | (rgb << 8);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void dither_15r (DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 * rgb = &info->RowBuf[(x >>16) * 3];
|
||||
uint16 pix = (((uint16)rgb[0] & 0xF8) << 7) | (((uint16)rgb[1] & 0xF8) << 2) | (rgb[2] >> 3);
|
||||
*(dst++) = (pix >> 8) | (pix << 8);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void raster_16 (DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
uint32 *map = info->Pixel;
|
||||
uint16 mask = info->PixMask;
|
||||
|
||||
do
|
||||
{
|
||||
*(dst++) = map[(int16)info->RowBuf[x >>16] & mask];
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void gscale_16( DECDATA info, void * _dst)
|
||||
{
|
||||
register uint16 *dst = _dst;
|
||||
register int16 width = info->DthWidth;
|
||||
register uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint16 rgb = info->RowBuf[(x >>16)];
|
||||
*(dst++) = ((rgb & 0xF8) <<8) | ((rgb & 0xFC) <<3) | (rgb >>3);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void dither_16 (DECDATA info, void * _dst)
|
||||
{
|
||||
register uint16 *dst = _dst;
|
||||
register int16 width = info->DthWidth;
|
||||
register uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
register uint8 *rgb = &info->RowBuf[(x >> 16) * 3];
|
||||
|
||||
*(dst++) = (((uint16)rgb[0] & 0xF8) << 8) | (((uint16)rgb[1] & 0xFC) << 3) | ( rgb[2] >> 3);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
|
||||
inline void raster_16r (DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
uint32 *map = info->Pixel;
|
||||
uint16 mask = info->PixMask;
|
||||
|
||||
do
|
||||
{
|
||||
uint16 rgb = map[(int16)info->RowBuf[x >>16] & mask];
|
||||
*(dst++) = (rgb >> 8) | (rgb << 8);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void gscale_16r( DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint16 rgb = info->RowBuf[(x >>16)];
|
||||
rgb = ((rgb & 0xF8) <<8) | ((rgb & 0xFC) <<3) | (rgb >>3);
|
||||
*(dst++) = (rgb >> 8) | (rgb << 8);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void dither_16r (DECDATA info, void * _dst)
|
||||
{
|
||||
uint16 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 * rgb = &info->RowBuf[(x >>16) *3];
|
||||
uint16 pix = ((( uint16)rgb[0] & 0xF8) << 8) | ((( uint16)rgb[1] & 0xFC) << 3) | ( rgb[2] >> 3);
|
||||
*(dst++) = (pix >> 8) | (pix << 8);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void raster_24 (DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
uint32 *map = info->Pixel;
|
||||
uint16 mask = info->PixMask;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 * rgb = (uint8*)&map[( int16)info->RowBuf[x >>16] & mask];
|
||||
*(dst++) = *(++rgb);
|
||||
*(dst++) = *(++rgb);
|
||||
*(dst++) = *(++rgb);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void gscale_24( DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 rgb = info->RowBuf[(x >>16)];
|
||||
*(dst++) = rgb;
|
||||
*(dst++) = rgb;
|
||||
*(dst++) = rgb;
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void dither_24 (DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 * rgb = &info->RowBuf[(x >>16) *3];
|
||||
*(dst++) = *(rgb++);
|
||||
*(dst++) = *(rgb++);
|
||||
*(dst++) = *(rgb);
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
|
||||
inline void raster_24r (DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
uint32 *map = info->Pixel;
|
||||
uint16 mask = info->PixMask;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 * rgb = (uint8*)&map[(int16)info->RowBuf[x >>16] & mask];
|
||||
*(dst++) = rgb[3];
|
||||
*(dst++) = rgb[2];
|
||||
*(dst++) = rgb[1];
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void gscale_24r( DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 rgb = info->RowBuf[(x >> 16)];
|
||||
*(dst++) = rgb;
|
||||
*(dst++) = rgb;
|
||||
*(dst++) = rgb;
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void dither_24r( DECDATA info, void * _dst)
|
||||
{
|
||||
uint8 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 * rgb = &info->RowBuf[(x >> 16) *3];
|
||||
*(dst++) = rgb[2];
|
||||
*(dst++) = rgb[1];
|
||||
*(dst++) = rgb[0];
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void raster_32 (DECDATA info, void * _dst)
|
||||
{
|
||||
uint32 * dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
uint32 *map = info->Pixel;
|
||||
uint16 mask = info->PixMask;
|
||||
|
||||
do
|
||||
{
|
||||
*(dst++) = map[(int16)info->RowBuf[x >> 16] & mask];
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void gscale_32( DECDATA info, void * _dst)
|
||||
{
|
||||
uint32 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint32 rgb = info->RowBuf[(x >> 16)];
|
||||
*(dst++) = ((( rgb << 8) | rgb) << 8) | rgb;
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void dither_32 (DECDATA info, void * _dst)
|
||||
{
|
||||
uint32 * dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 * rgb = &info->RowBuf[(x >> 16) *3];
|
||||
*(dst++) = ((((uint32)rgb[0] << 8) | rgb[1]) << 8) | rgb[2];
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
|
||||
inline void raster_32r( DECDATA info, void * _dst)
|
||||
{
|
||||
uint32 * dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
uint32 *map = info->Pixel;
|
||||
uint16 mask = info->PixMask;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 * rgb = (uint8*)&map[(int16)info->RowBuf[x >>16] & mask];
|
||||
*(dst++) = (((((int32)rgb[3] << 8) | rgb[2]) << 8) | rgb[1]) << 8;
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void gscale_32r( DECDATA info, void * _dst)
|
||||
{
|
||||
uint32 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint32 rgb = info->RowBuf[(x >>16)];
|
||||
*(dst++) = (((( rgb << 8) | rgb) << 8) | rgb) << 8;
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void dither_32r (DECDATA info, void * _dst)
|
||||
{
|
||||
uint32 * dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx + 1) >> 1;
|
||||
|
||||
do
|
||||
{
|
||||
uint8 * rgb = &info->RowBuf[(x >>16) *3];
|
||||
*(dst++) = (((((uint32)rgb[2] <<8) | rgb[1]) << 8) | rgb[0]) << 8;
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void raster_32z ( DECDATA info, void * _dst)
|
||||
{
|
||||
uint32 * dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx +1) >> 1;
|
||||
uint32 * map = info->Pixel;
|
||||
uint16 mask = info->PixMask;
|
||||
do {
|
||||
*(dst++) = map[(int16)info->RowBuf[x >>16] & mask] << 8;
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void gscale_32z (DECDATA info, void * _dst)
|
||||
{
|
||||
uint32 * dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx +1) >> 1;
|
||||
do {
|
||||
uint32 rgb = info->RowBuf[(x >>16)];
|
||||
*(dst++) = ((((rgb <<8) | rgb) <<8) | rgb) << 8;
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
|
||||
inline void dither_32z (DECDATA info, void * _dst)
|
||||
{
|
||||
uint32 *dst = _dst;
|
||||
int16 width = info->DthWidth;
|
||||
uint32 x = (info->IncXfx +1) >> 1;
|
||||
do {
|
||||
uint8 * rgb = &info->RowBuf[(x >>16) *3];
|
||||
*(dst++) = (((((uint32)rgb[0] <<8) | rgb[1]) <<8) | rgb[2]) << 8;
|
||||
x += info->IncXfx;
|
||||
} while (--width);
|
||||
}
|
||||
63
sources/z-tools/trunk/zcodeclib/src/zvdi/raster.h
Normal file
63
sources/z-tools/trunk/zcodeclib/src/zvdi/raster.h
Normal file
@@ -0,0 +1,63 @@
|
||||
extern void raster_chunks ( uint8 *src, uint16 *dst, uint16 num, uint16 depth);
|
||||
|
||||
#define raster_chunk4(s,d,n) raster_chunks ( s, d, n, 4)
|
||||
#define raster_chunk8(s,d,n) raster_chunks ( s, d, n, 8)
|
||||
|
||||
extern void raster_mono ( DECDATA info, void * _dst);
|
||||
extern void raster_D1 ( DECDATA info, void * _dst);
|
||||
extern void dither_D1 ( DECDATA info, void * _dst);
|
||||
extern void gscale_D1 ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_D2 ( DECDATA info, void * _dst);
|
||||
|
||||
extern void dither_D2 ( DECDATA info, void * _dst);
|
||||
extern void gscale_D2 ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_I4 ( DECDATA info, void * _dst);
|
||||
extern void dither_I4 ( DECDATA info, void * _dst);
|
||||
extern void gscale_I4 ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_I8 ( DECDATA info, void * _dst);
|
||||
extern void dither_I8 ( DECDATA info, void * _dst);
|
||||
extern void gscale_I8 ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_P8 ( DECDATA info, void * _dst);
|
||||
extern void dither_P8 ( DECDATA info, void * _dst);
|
||||
extern void gscale_P8 ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_15 ( DECDATA info, void * _dst);
|
||||
extern void dither_15 ( DECDATA info, void * _dst);
|
||||
extern void gscale_15 ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_15r ( DECDATA info, void * _dst);
|
||||
extern void dither_15r ( DECDATA info, void * _dst);
|
||||
extern void gscale_15r ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_16 ( DECDATA info, void * _dst);
|
||||
extern void dither_16 ( DECDATA info, void * _dst);
|
||||
extern void gscale_16 ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_16r ( DECDATA info, void * _dst);
|
||||
extern void dither_16r ( DECDATA info, void * _dst);
|
||||
extern void gscale_16r ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_24 ( DECDATA info, void * _dst);
|
||||
extern void dither_24 ( DECDATA info, void * _dst);
|
||||
extern void gscale_24 ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_24r ( DECDATA info, void * _dst);
|
||||
extern void dither_24r ( DECDATA info, void * _dst);
|
||||
extern void gscale_24r ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_32 ( DECDATA info, void * _dst);
|
||||
extern void dither_32 ( DECDATA info, void * _dst);
|
||||
extern void gscale_32 ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_32r ( DECDATA info, void * _dst);
|
||||
extern void dither_32r ( DECDATA info, void * _dst);
|
||||
extern void gscale_32r ( DECDATA info, void * _dst);
|
||||
|
||||
extern void raster_32z ( DECDATA info, void * _dst);
|
||||
extern void dither_32z ( DECDATA info, void * _dst);
|
||||
extern void gscale_32z ( DECDATA info, void * _dst);
|
||||
|
||||
221
sources/z-tools/trunk/zcodeclib/src/zvdi/vdi.c
Normal file
221
sources/z-tools/trunk/zcodeclib/src/zvdi/vdi.c
Normal file
@@ -0,0 +1,221 @@
|
||||
#ifdef __PUREC__
|
||||
#include "..\general.h"
|
||||
#include "..\resize.h"
|
||||
#include "..\load_img.h"
|
||||
#else
|
||||
#include "../general.h"
|
||||
#include "../load_img.h"
|
||||
#include "../resize.h"
|
||||
#endif
|
||||
#include "raster.h"
|
||||
#include "raresize.h"
|
||||
#include "color.h"
|
||||
#include "p2c.h"
|
||||
|
||||
int16 pixel_val[256];
|
||||
uint32 cube216[216];
|
||||
uint32 graymap[32];
|
||||
int16 planar = 0;
|
||||
int16 vdi_handle, nplanes, vdi_work_in[10], vdi_work_out[57];
|
||||
|
||||
|
||||
/* prototype */
|
||||
int16 vdi_init ( void);
|
||||
|
||||
|
||||
int16 vdi_init( void)
|
||||
{
|
||||
int16 out[273] = { -1, };
|
||||
int16 dum, depth, aes_handle;
|
||||
boolean reverse, z_trail;
|
||||
int32 cookie_dum;
|
||||
|
||||
if( !ldg_cookie( 0x45644449L, (int32*)&cookie_dum))
|
||||
return( 0);
|
||||
|
||||
/* open a VDI workstation */
|
||||
aes_handle = graf_handle( &dum, &dum, &dum, &dum);
|
||||
vq_extnd( aes_handle, 1, vdi_work_out);
|
||||
nplanes = vdi_work_out[ 4];
|
||||
vdi_work_in[0] = Getrez() + 2;
|
||||
vdi_handle = aes_handle;
|
||||
v_opnvwk( vdi_work_in, &vdi_handle, vdi_work_out);
|
||||
|
||||
/* Get the screen's informations */
|
||||
vq_scrninfo ( vdi_handle, out);
|
||||
|
||||
if ( nplanes <= 8)
|
||||
{
|
||||
save_colors();
|
||||
memcpy ( pixel_val, out + 16, 512);
|
||||
}
|
||||
|
||||
depth = (( uint16)out[4] == 0x8000u ? 15 : out[2]); /* bits per pixel used */
|
||||
reverse = (out[16] < out[48]); /* intel crap... */
|
||||
z_trail = (out[48] > 0); /* bits are shifted to the right side */
|
||||
|
||||
if ( depth == 1)
|
||||
{ /* monochrome */
|
||||
cnvpal_color = cnvpal_1_2;
|
||||
raster_cmap = raster_D1;
|
||||
raster_true = dither_D1;
|
||||
raster_gray = gscale_D1;
|
||||
resize = resize_mono;
|
||||
}
|
||||
else if ( out[0] == 0) /* Planar */
|
||||
{
|
||||
planar = 1;
|
||||
|
||||
switch ( depth)
|
||||
{
|
||||
case 2:
|
||||
cnvpal_color = cnvpal_1_2;
|
||||
raster_cmap = raster_D2;
|
||||
raster_true = dither_D2;
|
||||
raster_gray = gscale_D2;
|
||||
planar_to_chunky = planar2_to_chunky8;
|
||||
break;
|
||||
case 4:
|
||||
cnvpal_color = cnvpal_4_8;
|
||||
raster_cmap = raster_I4;
|
||||
raster_true = dither_I4;
|
||||
raster_gray = gscale_I4;
|
||||
resize = resize_I4;
|
||||
planar_to_chunky = planar4_to_chunky8;
|
||||
break;
|
||||
case 8:
|
||||
cnvpal_color = cnvpal_4_8;
|
||||
raster_cmap = raster_I8;
|
||||
raster_true = dither_I8;
|
||||
raster_gray = gscale_I8;
|
||||
resize = resize_I8;
|
||||
planar_to_chunky = planar8_to_chunky8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( out[0] == 2) /* chunky */
|
||||
switch ( depth)
|
||||
{
|
||||
case 8:
|
||||
cnvpal_color = cnvpal_4_8;
|
||||
raster_cmap = raster_P8;
|
||||
raster_true = dither_P8;
|
||||
raster_gray = gscale_P8;
|
||||
resize = resize_P8;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
if (!(out[14] & 0x02))
|
||||
{
|
||||
cnvpal_color = cnvpal_15;
|
||||
|
||||
if (reverse)
|
||||
{
|
||||
raster_cmap = raster_15r;
|
||||
raster_gray = gscale_15r;
|
||||
raster_true = dither_15r;
|
||||
}
|
||||
else
|
||||
{
|
||||
raster_cmap = raster_15;
|
||||
raster_gray = gscale_15;
|
||||
raster_true = dither_15;
|
||||
}
|
||||
|
||||
resize = resize_16;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 16:
|
||||
cnvpal_color = cnvpal_high;
|
||||
|
||||
if (reverse)
|
||||
{
|
||||
raster_cmap = raster_16r;
|
||||
raster_gray = gscale_16r;
|
||||
raster_true = dither_16r;
|
||||
}
|
||||
else
|
||||
{
|
||||
raster_cmap = raster_16;
|
||||
raster_gray = gscale_16;
|
||||
raster_true = dither_16;
|
||||
}
|
||||
|
||||
resize = resize_16;
|
||||
|
||||
break;
|
||||
|
||||
case 24:
|
||||
cnvpal_color = cnvpal_true;
|
||||
|
||||
if (reverse)
|
||||
{
|
||||
raster_cmap = raster_24r;
|
||||
raster_gray = gscale_24r;
|
||||
raster_true = dither_24r;
|
||||
}
|
||||
else
|
||||
{
|
||||
raster_cmap = raster_24;
|
||||
raster_gray = gscale_24;
|
||||
raster_true = dither_24;
|
||||
}
|
||||
|
||||
resize = resize_24;
|
||||
|
||||
break;
|
||||
|
||||
case 32:
|
||||
cnvpal_color = cnvpal_true;
|
||||
|
||||
if (reverse)
|
||||
{
|
||||
raster_cmap = raster_32r;
|
||||
raster_gray = gscale_32r;
|
||||
raster_true = dither_32r;
|
||||
}
|
||||
else if( z_trail)
|
||||
{
|
||||
raster_cmap = raster_32z;
|
||||
raster_gray = gscale_32z;
|
||||
raster_true = dither_32z;
|
||||
}
|
||||
else
|
||||
{
|
||||
raster_cmap = raster_32;
|
||||
raster_gray = gscale_32;
|
||||
raster_true = dither_32;
|
||||
}
|
||||
|
||||
resize = resize_32;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (depth == 4 || depth == 8)
|
||||
{
|
||||
uint32 * dst;
|
||||
uint32 r, g, b;
|
||||
dst = cube216;
|
||||
|
||||
for (r = 0x000000uL; r <= 0xFF0000uL; r += 0x330000uL)
|
||||
{
|
||||
for (g = 0x000000uL; g <= 0x00FF00uL; g += 0x003300uL)
|
||||
{
|
||||
for (b = 0x000000uL; b <= 0x0000FFuL; b += 0x000033uL)
|
||||
{
|
||||
*(dst++) = color_lookup ( r | g | b, pixel_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dst = graymap;
|
||||
|
||||
for ( g = 0x000000uL; g <= 0xF8F8F8uL; g += 0x080808uL)
|
||||
*( dst++) = color_lookup ( g | (( g >> 5) & 0x030303uL), pixel_val);
|
||||
}
|
||||
|
||||
return( 1);
|
||||
}
|
||||
7
sources/z-tools/trunk/zcodeclib/src/zvdi/vdi.h
Normal file
7
sources/z-tools/trunk/zcodeclib/src/zvdi/vdi.h
Normal file
@@ -0,0 +1,7 @@
|
||||
extern int16 pixel_val[256];
|
||||
extern uint32 cube216[216];
|
||||
extern uint32 graymap[32];
|
||||
|
||||
extern int16 vdi_init( void);
|
||||
extern int16 planar, vdi_handle, nplanes, vdi_work_in[10], vdi_work_out[57];
|
||||
|
||||
BIN
sources/z-tools/trunk/zcodeclib/zcodeclib.hyp
Normal file
BIN
sources/z-tools/trunk/zcodeclib/zcodeclib.hyp
Normal file
Binary file not shown.
355
sources/z-tools/trunk/zcodeclib/zcodeclib.stg
Normal file
355
sources/z-tools/trunk/zcodeclib/zcodeclib.stg
Normal file
@@ -0,0 +1,355 @@
|
||||
@database "zcodeclib Dev. Guide"
|
||||
@subject "Documentation"
|
||||
@author "Zorro"
|
||||
@$VER: ZCODEC.HYP (@:"__DATE__")
|
||||
@options +Z
|
||||
@options -S
|
||||
|
||||
@default Index
|
||||
|
||||
@node Index "zcodeclib dev."
|
||||
zcodeclib dev.
|
||||
@line 1 70 0 0 1
|
||||
|
||||
|
||||
1. Introduction
|
||||
2. Functions
|
||||
3. Global variables
|
||||
4. The IMAGE structure.
|
||||
5. Do you use MEM.LDG in your application?
|
||||
|
||||
|
||||
@endnode
|
||||
|
||||
|
||||
@node "Introduction"
|
||||
1. Introduction
|
||||
@line 1 70 0 0 1
|
||||
|
||||
Make a basic GEM application is a very easy task but problems
|
||||
become when we have to draw something on the screen.
|
||||
|
||||
Indeed, on Atari and others TOS computers, there are many
|
||||
different screens' formats and, of course, we can't deal with
|
||||
it in the same manner.
|
||||
|
||||
The problem is worst when we have to load and to draw a picture
|
||||
from, for example, a JPG file. We have to make ourselves loading
|
||||
routines, etc... A real nightmare!
|
||||
|
||||
The goal of this library is to offer easy and fast functions for
|
||||
load images from file and for, especially, deal with the screen.
|
||||
It provide also useful functions like MFDB zooming and others.
|
||||
|
||||
This library load and use the zview's codecs, so it's fast and
|
||||
stable.
|
||||
|
||||
@{B}For use this library, you need:@{0}
|
||||
|
||||
- A VDI with a valid EDDI (like NovaVDI, NVDI > 2.5, fVDI, etc..).
|
||||
- The zview's codec correctly installed with mem.ldg (provided in
|
||||
the zview archive).
|
||||
- the LDG library ( http://ldg.org.free.fr)
|
||||
- A recent GEMLIB.
|
||||
|
||||
|
||||
(Index)
|
||||
|
||||
@endnode
|
||||
|
||||
@node "Functions"
|
||||
2. Functions
|
||||
@line 1 70 0 0 1
|
||||
|
||||
|
||||
1. codecs_init()
|
||||
2. codecs_quit()
|
||||
3. load_img()
|
||||
4. delete_img()
|
||||
5. pic_resize()
|
||||
6. delete_mfdb()
|
||||
|
||||
|
||||
(Index)
|
||||
|
||||
@endnode
|
||||
|
||||
|
||||
@node "codecs_init()"
|
||||
codecs_init()
|
||||
@line 1 70 0 0 1
|
||||
|
||||
@{B}NAME@{0}
|
||||
codec_init - initialise and load the wanted codecs.
|
||||
|
||||
@{B}PROTOTYPAGE@{0}
|
||||
int16 codecs_init( char *codec_name);
|
||||
|
||||
|
||||
@{B}PARAMETERS@{0}
|
||||
codec_name: the name of the codec to load.
|
||||
|
||||
return: 0 if an error occurs else 1.
|
||||
|
||||
|
||||
@{B}DESCRIPTION@{0}
|
||||
It's the first function to call.
|
||||
|
||||
The function's job is to initialize the VDI's informations,
|
||||
load MEM.LDG ( for shareable allocation) and load the wanted
|
||||
codecs.
|
||||
|
||||
For example:
|
||||
|
||||
codecs_init( "jpg.ldg");
|
||||
|
||||
If you need others codecs, you can to call this function any
|
||||
numbers of times like:
|
||||
|
||||
codecs_init( "jpg.ldg");
|
||||
codecs_init( "png.ldg");
|
||||
....
|
||||
|
||||
Cool feature, you can load the complete codec's pack with:
|
||||
|
||||
codec_init( "all");
|
||||
|
||||
|
||||
@{B}IMPORTANT@{0}
|
||||
Be careful, you can't load two times the same codec so, don't
|
||||
call again this function after a codec_init( "all").
|
||||
|
||||
|
||||
(Index)
|
||||
|
||||
@endnode
|
||||
|
||||
@node "codecs_quit()"
|
||||
codecs_quit()
|
||||
@line 1 70 0 0 1
|
||||
|
||||
@{B}NAME@{0}
|
||||
codecs_quit - unload the codecs and MEM.LDG.
|
||||
|
||||
@{B}PROTOTYPAGE@{0}
|
||||
void codecs_quit( void);
|
||||
|
||||
|
||||
@{B}DESCRIPTION@{0}
|
||||
You must call this function at the end of your code or when we
|
||||
don't use anymore the functions form this library.
|
||||
|
||||
It unloads MEM.LDG and the codecs previously loaded.
|
||||
|
||||
|
||||
(Index)
|
||||
|
||||
@endnode
|
||||
|
||||
@node "load_img()"
|
||||
load_img()
|
||||
@line 1 70 0 0 1
|
||||
|
||||
@{B}NAME@{0}l
|
||||
load_img() - load, convert and zoom a image.
|
||||
|
||||
@{B}PROTOTYPAGE@{0}
|
||||
IMAGE *load_img( const char *file, int16 w, int16 h, int16 keep_ratio);
|
||||
|
||||
|
||||
@{B}PARAMETERS@{0}
|
||||
file: the file to load.
|
||||
|
||||
w: the wanted image's width.
|
||||
-1 for to keep the image's width.
|
||||
|
||||
h: the wanted image's height.
|
||||
-1 for to keep the image's height.
|
||||
|
||||
keep_ratio: in the case where you set the wanted image's size
|
||||
with the w and h variables, if 'keep_ratio' if TRUE,
|
||||
the image is resized to fit in w and h for maintain
|
||||
the aspect ratio else the image will be exactly at
|
||||
the wanted size.
|
||||
|
||||
|
||||
return: NULL if an error occurs else a valid IMAGE structure.
|
||||
|
||||
|
||||
@{B}DESCRIPTION@{0}
|
||||
The most important function of this library; it loads, converts
|
||||
to screen format and eventually, zooms a picture. All in one
|
||||
function!
|
||||
|
||||
|
||||
@{B}IMPORTANT@{0}
|
||||
Don't allocate the IMG structure yourself, the function make it
|
||||
for you (see example.c).
|
||||
|
||||
|
||||
(Index)
|
||||
|
||||
@endnode
|
||||
|
||||
|
||||
|
||||
@endnode
|
||||
|
||||
@node "delete_img()"
|
||||
delete_img()
|
||||
@line 1 70 0 0 1
|
||||
|
||||
@{B}NAME@{0}
|
||||
delete_img - free a IMAGE structure.
|
||||
|
||||
@{B}PROTOTYPAGE@{0}
|
||||
void delete_img( IMAGE *img);
|
||||
|
||||
|
||||
@{B}DESCRIPTION@{0}
|
||||
This function frees all the memories previously allocated for
|
||||
the "img" structure and also "img" itself.
|
||||
|
||||
(Index)
|
||||
|
||||
@endnode
|
||||
|
||||
|
||||
@node "pic_resize()"
|
||||
pic_resize()
|
||||
@line 1 70 0 0 1
|
||||
|
||||
@{B}NAME@{0}l
|
||||
pic_resize() - resize a MFDB.
|
||||
|
||||
@{B}PROTOTYPAGE@{0}
|
||||
MFDB *pic_resize( MFDB *in, int16 w, int16 h, int16 keep_ratio);
|
||||
|
||||
|
||||
@{B}PARAMETERS@{0}
|
||||
in: the input MFDB address.
|
||||
|
||||
w: the wanted MFDB's width.
|
||||
|
||||
h: the wanted MFDB's height.
|
||||
|
||||
keep_ratio: if 'keep_ratio' if TRUE, the MFDB is resized for to
|
||||
fit in 'w' and 'h' for maintain the aspect ratio
|
||||
else the MFDB will be exactly at the 'w' and 'h' size.
|
||||
|
||||
return: NULL if an error occurs else a valid MFDB address.
|
||||
|
||||
|
||||
@{B}DESCRIPTION@{0}
|
||||
Return a MFDB resized with the data of 'in'.
|
||||
|
||||
|
||||
@{B}IMPORTANT@{0}
|
||||
1) Don't allocate the "out" MFDB yourself, the function make it
|
||||
for you (see example.c).
|
||||
2) You can't free the MFDB youself, use delete_mfdb() for do that.
|
||||
|
||||
|
||||
(Index)
|
||||
|
||||
@endnode
|
||||
|
||||
|
||||
|
||||
@node "delete_mfdb()"
|
||||
delete_mfdb()
|
||||
@line 1 70 0 0 1
|
||||
|
||||
@{B}NAME@{0}l
|
||||
delete_mfdb() - delete one or more MFDB structure(s).
|
||||
|
||||
@{B}PROTOTYPAGE@{0}
|
||||
void delete_mfdb( MFDB *bm, int16 nbr);
|
||||
|
||||
|
||||
@{B}PARAMETERS@{0}
|
||||
bm: the MFDB to free.
|
||||
|
||||
nbr: the number of MFDB in 'bm'.
|
||||
|
||||
return: nothing.
|
||||
|
||||
|
||||
@{B}DESCRIPTION@{0}
|
||||
Free one or more MFDB created with pic_resize().
|
||||
|
||||
|
||||
(Index)
|
||||
|
||||
@endnode
|
||||
|
||||
|
||||
@node "Global variables"
|
||||
Global variables
|
||||
@line 1 70 0 0 1
|
||||
|
||||
|
||||
All this global variable are in in16 format( short).
|
||||
|
||||
planar: The screen format, 1 if planar else 0.
|
||||
|
||||
nplanes: the screen planes' number.
|
||||
|
||||
vdi_work_in[10], vdi_work_out[57]: useful information about
|
||||
the VDI.
|
||||
|
||||
vdi_handle: a "ready to use" VDI handle.
|
||||
|
||||
|
||||
(Index)
|
||||
|
||||
@endnode
|
||||
|
||||
|
||||
@node "IMAGE"
|
||||
IMAGE
|
||||
@line 1 70 0 0 1
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int16 page;
|
||||
uint16 *delay;
|
||||
MFDB *image;
|
||||
} IMAGE;
|
||||
|
||||
|
||||
delay: exists only if the image is a animated one ( for example:
|
||||
animated GIF, FLI, etc..).
|
||||
|
||||
page: is the number of image returned (For animated picture or
|
||||
multi-pages documents like FAX).
|
||||
|
||||
image: is one of many MFDB structure(s) ready to be transferred to
|
||||
the screen.
|
||||
|
||||
|
||||
@endnode
|
||||
|
||||
|
||||
@node "Do you use MEM.LDG in your application?"
|
||||
Do you use MEM.LDG in your application?
|
||||
@line 1 70 0 0 1
|
||||
|
||||
|
||||
Libzcodec loads already the MEM.LDG so you can't do it again in your
|
||||
code!
|
||||
|
||||
For this prupose, in the header's file, we can find
|
||||
'shared_malloc( a)' and 'shared_free( a)'.
|
||||
|
||||
This functions are only ldg_malloc() and ldg_free() binded; you
|
||||
can use it without any problem and if far better that Mintlib malloc's
|
||||
function.
|
||||
|
||||
If you need ldg_realloc or ldg_calloc, you need to make a
|
||||
ldg_find( "ldg_calloc", ldg_mem) youself. ( ldg_mem is a global
|
||||
variable used for load MEM.LDG).
|
||||
|
||||
|
||||
@endnode
|
||||
12
sources/z-tools/trunk/ztask/Makefile
Normal file
12
sources/z-tools/trunk/ztask/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
DEBUG = # -DDEBUG
|
||||
STACKSIZE = 64k
|
||||
OPTIMISATION = -O2 -fomit-frame-pointer
|
||||
CPU = -m68020-60
|
||||
LIB = -lwindom -lgem -lldg -lm #-lwout
|
||||
CFLAGS = $(CPU) $(OPTIMISATION) $(DEBUG) -Wall -Wshadow
|
||||
|
||||
OBJ = debug.o gmem.o prefs.o color_selector.o taskman.o pref_panel.o shutdown.o quit.o app.o process.o cpu.o string.o popup.o win.o main.o
|
||||
|
||||
PROGRAM = ztask.app
|
||||
|
||||
include ../common.mak
|
||||
310
sources/z-tools/trunk/ztask/app.c
Normal file
310
sources/z-tools/trunk/ztask/app.c
Normal file
@@ -0,0 +1,310 @@
|
||||
#include "general.h"
|
||||
#include "gmem.h"
|
||||
#include "string.h"
|
||||
|
||||
app_data *root = NULL, *selected = NULL, *old_selected = NULL;
|
||||
int16 app_nbr = 0;
|
||||
|
||||
|
||||
int16 find_top_app_by_window( void)
|
||||
{
|
||||
int16 win_handle, next_win_handle, aes_id, dum;
|
||||
|
||||
if( mt_wind_get( 0, WF_TOP, &win_handle, &aes_id, &next_win_handle, &dum, app.aes_global) == 0)
|
||||
return -1;
|
||||
|
||||
return aes_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* app_data_attach: *
|
||||
* attach a entry in the global application list. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* name: The application name. *
|
||||
* name_shown: The name to be shown in the taskbar. *
|
||||
* id: The AES ID of the application. *
|
||||
* name_shown_width: The text width of 'name_shown' in pixel. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* TRUE if all is ok else FALSE *
|
||||
*==================================================================================*/
|
||||
|
||||
int16 app_data_attach( char *name, char *name_shown, int16 id, int16 pid, int16 name_shown_width)
|
||||
{
|
||||
app_data *new = ( app_data *)gmalloc( sizeof(app_data));
|
||||
|
||||
if( !new)
|
||||
return FALSE;
|
||||
|
||||
new -> id = id;
|
||||
new -> pid = pid;
|
||||
new -> next = root;
|
||||
new -> name_shown_width = name_shown_width;
|
||||
|
||||
strcpy( new -> name, name);
|
||||
strcpy( new -> name_shown, name_shown);
|
||||
|
||||
root = new;
|
||||
|
||||
app_nbr++;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* app_data_find_parent: *
|
||||
* find the parent( previous) entry in the application list. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* child: the function returns the parent of this entry. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* the parent entry else the root entry. *
|
||||
*==================================================================================*/
|
||||
app_data *app_data_find_parent( app_data *child)
|
||||
{
|
||||
app_data *scan = root;
|
||||
|
||||
while( scan)
|
||||
{
|
||||
if( scan->next != child)
|
||||
{
|
||||
scan = scan->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return( scan);
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* app_data_delete: *
|
||||
* Delete an entry in the application list. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* id: the AES id of the entry to delete. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
void app_data_delete( int16 id)
|
||||
{
|
||||
app_data *scan = root, *parent;
|
||||
|
||||
while( scan)
|
||||
{
|
||||
if( scan->id != id)
|
||||
{
|
||||
scan = scan->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
parent = app_data_find_parent( scan);
|
||||
|
||||
if( parent == NULL)
|
||||
root = scan->next;
|
||||
else
|
||||
parent->next = scan->next;
|
||||
|
||||
gfree( scan);
|
||||
app_nbr--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* app_data_find: *
|
||||
* Find an entry in the application list. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* id: the AES id of the entry to find. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* the entry or NULL if not found. *
|
||||
*==================================================================================*/
|
||||
app_data *app_data_find( int16 id)
|
||||
{
|
||||
app_data *scan = root, *result = NULL;
|
||||
|
||||
while( scan)
|
||||
{
|
||||
if( scan->id != id)
|
||||
{
|
||||
scan = scan->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
result = scan;
|
||||
break;
|
||||
}
|
||||
|
||||
return( result);
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* app_have_wind: *
|
||||
* Check if an application owns at least one window. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* id: the AES id of the entry to check. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* 1 if TRUE else 0. *
|
||||
*==================================================================================*/
|
||||
int16 app_have_wind( int16 id)
|
||||
{
|
||||
int16 result = 0, dum, aes_win, next = -1, status, aes_id;
|
||||
|
||||
if( mt_wind_get( 0, WF_OWNER, &aes_id, &status, &aes_win, &dum, app.aes_global) == 0)
|
||||
return result;
|
||||
|
||||
while( aes_win)
|
||||
{
|
||||
if( mt_wind_get( aes_win, WF_OWNER, &aes_id, &status, &next, &dum, app.aes_global) == 0)
|
||||
break;
|
||||
|
||||
if( ( aes_id != id) || ( status == 0))
|
||||
{
|
||||
aes_win = next;
|
||||
continue;
|
||||
}
|
||||
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* app_data_search: *
|
||||
* Make a list of all the loaded application and add it in the global *
|
||||
* application list if necessary. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* -- *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
void app_data_search( void)
|
||||
{
|
||||
char name[9], name_shown[MAXNAMLEN];
|
||||
app_data *scan = root, *tmp = NULL;
|
||||
int16 lenght, i, id, pid, type, count = 0, ap_cout, name_shown_width, old_id_by_win, old_id_by_menu;
|
||||
static int16 id_by_win = 0, id_by_menu = 0;
|
||||
|
||||
for( i = 0; mt_appl_search( i, name, &type, &id, app.aes_global); i = 1)
|
||||
{
|
||||
// Is an accessory?
|
||||
if( show_acc == FALSE && ( type & APP_ACCESSORY))
|
||||
continue;
|
||||
|
||||
// Is a system app or zTask itself?
|
||||
if(( type & APP_SYSTEM) || ( id == _AESapid))
|
||||
continue;
|
||||
|
||||
count++;
|
||||
|
||||
// Is already listed?
|
||||
if( app_data_find( id))
|
||||
continue;
|
||||
|
||||
if( mt_appl_control( id, APC_INFO, &ap_cout, app.aes_global) == 0)
|
||||
{
|
||||
count--;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if it's not a accessory, if the application doesn't own a menu bar and if it doesn't own a window, we skip this id.
|
||||
if(( type != APP_ACCESSORY) && !( ap_cout & APCI_HASMBAR) && !app_have_wind( id))
|
||||
{
|
||||
count--;
|
||||
continue;
|
||||
}
|
||||
|
||||
// We setup the name to show in the case
|
||||
mt_appl_search( -id, name_shown, &type, &pid, app.aes_global);
|
||||
|
||||
trim_start(name_shown);
|
||||
trim_end( name_shown, strlen( name_shown) - 1);
|
||||
|
||||
if( strcmp( "XaSYS", name_shown) == 0)
|
||||
{
|
||||
count--;
|
||||
continue;
|
||||
}
|
||||
|
||||
lenght = strlen( name_shown);
|
||||
|
||||
if( lenght > 4)
|
||||
{
|
||||
char *extention = name_shown + lenght - 4;
|
||||
|
||||
// If the application's name has an extention ( like "xxx.app"), we remove it
|
||||
if( *extention == '.')
|
||||
*extention = '\0';
|
||||
}
|
||||
|
||||
name_shown_width = get_text_width( name_shown);
|
||||
|
||||
if( name_shown_width > ( app_width - 6))
|
||||
name_shown_width = name_shorter( app_width - 6, name_shown);
|
||||
|
||||
app_data_attach( name, name_shown, id, pid, name_shown_width);
|
||||
}
|
||||
|
||||
if( count != app_nbr)
|
||||
{
|
||||
while( scan)
|
||||
{
|
||||
if( mt_appl_find( scan->name, app.aes_global) == -1)
|
||||
{
|
||||
id = scan->id;
|
||||
scan = scan->next;
|
||||
app_data_delete( id);
|
||||
continue;
|
||||
}
|
||||
|
||||
scan = scan->next;
|
||||
}
|
||||
}
|
||||
|
||||
old_id_by_win = id_by_win;
|
||||
old_id_by_menu = id_by_menu;
|
||||
|
||||
id_by_win = find_top_app_by_window();
|
||||
id_by_menu = mt_menu_bar( NULL, MENU_INQUIRE, app.aes_global);
|
||||
|
||||
id = 0;
|
||||
|
||||
if(( old_id_by_win != id_by_win) && ( old_id_by_menu == id_by_menu))
|
||||
id = id_by_win;
|
||||
else if(( old_id_by_win == id_by_win) && ( old_id_by_menu != id_by_menu))
|
||||
id = id_by_menu;
|
||||
else if(( old_id_by_win != id_by_win) && ( old_id_by_menu != id_by_menu))
|
||||
id = id_by_menu;
|
||||
|
||||
if( id)
|
||||
{
|
||||
tmp = app_data_find( id);
|
||||
|
||||
if( tmp != selected)
|
||||
{
|
||||
old_selected = selected;
|
||||
selected = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
9
sources/z-tools/trunk/ztask/app.h
Normal file
9
sources/z-tools/trunk/ztask/app.h
Normal file
@@ -0,0 +1,9 @@
|
||||
extern app_data *root, *selected, *old_selected;
|
||||
extern int16 app_nbr;
|
||||
|
||||
extern int16 app_data_attach( char *name, int16 id);
|
||||
extern void app_data_delete( int16 id);
|
||||
extern app_data *app_data_find( int16 id);
|
||||
extern void app_data_search( void);
|
||||
|
||||
|
||||
192
sources/z-tools/trunk/ztask/color_selector.c
Normal file
192
sources/z-tools/trunk/ztask/color_selector.c
Normal file
@@ -0,0 +1,192 @@
|
||||
#include "general.h"
|
||||
|
||||
static int16 xw, yw, ww, hw, color_by_line;
|
||||
static int16 selected_color;
|
||||
static int16 object_parent;
|
||||
|
||||
extern WINDOW *pref_dialog_win;
|
||||
extern int tmp_button_off_background, tmp_button_off_light_color, tmp_button_off_dark_color,
|
||||
tmp_button_off_text_color, tmp_button_off_text_shadow_color, tmp_button_on_background,
|
||||
tmp_button_on_light_color, tmp_button_on_dark_color, tmp_button_on_text_color,
|
||||
tmp_button_on_text_shadow_color, tmp_geek_area_color, tmp_geek_area_dark_line,
|
||||
tmp_geek_area_light_line, tmp_app_width, tmp_cpu_bar_color,
|
||||
tmp_tt_bar_color, tmp_st_bar_color, tmp_geek_area_text_color;
|
||||
|
||||
static void CDECL timer_function( WINDOW *win, int16 buff[8])
|
||||
{
|
||||
if( !IS_IN( evnt.mx, evnt.my, xw, yw, ww, hw))
|
||||
ApplWrite( _AESapid, WM_DESTROY, win->handle, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
static void CDECL win_mouse_event( WINDOW *win, int16 buff[8])
|
||||
{
|
||||
int16 x, y, pxy[2];
|
||||
int color = 0;
|
||||
|
||||
for( y = 0, pxy[1] = yw + 1; y < color_by_line; y++, pxy[1] += 11)
|
||||
{
|
||||
for( x = 0, pxy[0] = xw + 1; x < color_by_line; x++, pxy[0] += 11, color++)
|
||||
{
|
||||
if( IS_IN( evnt.mx, evnt.my, pxy[0], pxy[1], 9, 9))
|
||||
{
|
||||
switch( object_parent)
|
||||
{
|
||||
case PREFS_ON_BACK:
|
||||
tmp_button_on_background = color;
|
||||
break;
|
||||
|
||||
case PREFS_ON_LINE1:
|
||||
tmp_button_on_light_color = color;
|
||||
break;
|
||||
|
||||
case PREFS_ON_LINE2:
|
||||
tmp_button_on_dark_color = color;
|
||||
break;
|
||||
|
||||
case PREFS_ON_TEXT1:
|
||||
tmp_button_on_text_color = color;
|
||||
break;
|
||||
|
||||
case PREFS_ON_TEXT2:
|
||||
tmp_button_on_text_shadow_color = color;
|
||||
break;
|
||||
|
||||
case PREFS_OFF_BACK:
|
||||
tmp_button_off_background = color;
|
||||
break;
|
||||
|
||||
case PREFS_OFF_LINE1:
|
||||
tmp_button_off_light_color = color;
|
||||
break;
|
||||
|
||||
case PREFS_OFF_LINE2:
|
||||
tmp_button_off_dark_color = color;
|
||||
break;
|
||||
|
||||
case PREFS_OFF_TEXT1:
|
||||
tmp_button_off_text_color = color;
|
||||
break;
|
||||
|
||||
case PREFS_OFF_TEXT2:
|
||||
tmp_button_off_text_shadow_color = color;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_BACK:
|
||||
tmp_geek_area_color = color;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_LINE1:
|
||||
tmp_geek_area_light_line = color;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_LINE2:
|
||||
tmp_geek_area_dark_line = color;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_RAM1:
|
||||
tmp_st_bar_color = color;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_RAM2:
|
||||
tmp_tt_bar_color = color;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_CPU:
|
||||
tmp_cpu_bar_color = color;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_TEXT:
|
||||
tmp_geek_area_text_color = color;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ApplWrite( _AESapid, WM_DESTROY, win->handle, 0, 0, 0, 0);
|
||||
ObjcDraw( OC_FORM, pref_dialog_win, PREFS_PREVIEW, 1);
|
||||
}
|
||||
|
||||
|
||||
static void CDECL win_redraw_event( WINDOW *win, int16 buff[8])
|
||||
{
|
||||
int16 x, y, pxy[4], xy[10], color = 0;
|
||||
|
||||
pxy[0] = xw;
|
||||
pxy[1] = yw;
|
||||
pxy[2] = pxy[0] + ww - 1;
|
||||
pxy[3] = pxy[1] + hw - 1;
|
||||
|
||||
vsf_color( win->graf->handle, WHITE);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
|
||||
vsl_color( win->graf->handle, BLACK);
|
||||
|
||||
for( y = 0, pxy[1] = yw + 1; y < color_by_line; y++, pxy[1] += 11)
|
||||
{
|
||||
for( x = 0, pxy[0] = xw + 1; x < color_by_line; x++, pxy[0] += 11, color++)
|
||||
{
|
||||
pxy[2] = pxy[0] + 9;
|
||||
pxy[3] = pxy[1] + 9;
|
||||
|
||||
vsf_color( win->graf->handle, color);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
|
||||
xy[0] = pxy[0];
|
||||
xy[1] = pxy[1];
|
||||
xy[2] = xy[0];
|
||||
xy[3] = xy[1] + 9;
|
||||
xy[4] = xy[0] + 9;
|
||||
xy[5] = xy[3];
|
||||
xy[6] = xy[4];
|
||||
xy[7] = xy[1];
|
||||
xy[8] = xy[0];
|
||||
xy[9] = xy[1];
|
||||
|
||||
v_pline( win->graf->handle, 5, xy);
|
||||
|
||||
if( color == selected_color)
|
||||
{
|
||||
xy[0] = pxy[0] - 1;
|
||||
xy[1] = pxy[1] - 1;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = xy[1] + 11;
|
||||
xy[4] = xy[0] + 11;
|
||||
xy[5] = xy[3];
|
||||
xy[6] = xy[4];
|
||||
xy[7] = xy[1];
|
||||
xy[8] = xy[0];
|
||||
xy[9] = xy[1];
|
||||
|
||||
v_pline( win->graf->handle, 5, xy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vdi_color_selector( int16 x, int16 y, int16 color_selected, int16 parent_object)
|
||||
{
|
||||
WINDOW *win = WindCreate( 0, app.x, app.y, app.w, app.h);
|
||||
|
||||
EvntAttach( win, WM_REDRAW, win_redraw_event);
|
||||
EvntAttach( win, WM_XBUTTON, win_mouse_event);
|
||||
|
||||
color_by_line = (( app.nplanes < 8) ? 4 : 16);
|
||||
selected_color = color_selected;
|
||||
object_parent = parent_object;
|
||||
|
||||
if( app.nplanes == 4)
|
||||
WindCalc( WC_BORDER, win, x, y, 45, 45, &xw, &yw, &ww, &hw);
|
||||
else
|
||||
WindCalc( WC_BORDER, win, x, y, 177, 177, &xw, &yw, &ww, &hw);
|
||||
|
||||
WindSet( win, WF_BEVENT, BEVENT_MODAL, 0, 0, 0);
|
||||
EvntAttach( win, WM_XTIMER, timer_function);
|
||||
WindOpen( win, xw, yw, ww, hw);
|
||||
WindGet( win, WF_WORKXYWH, &xw, &yw, &ww, &hw);
|
||||
}
|
||||
|
||||
151
sources/z-tools/trunk/ztask/cpu.c
Normal file
151
sources/z-tools/trunk/ztask/cpu.c
Normal file
@@ -0,0 +1,151 @@
|
||||
#include "general.h"
|
||||
|
||||
char buf[2048];
|
||||
|
||||
extern uint32 total_stram;
|
||||
extern uint32 total_ttram;
|
||||
|
||||
|
||||
|
||||
/* returns current cpu usage in percent */
|
||||
inline int16 cpu_get_usage( void)
|
||||
{
|
||||
static int32 pre_used = 0, pre_total = 0;
|
||||
int16 usage = 0;
|
||||
int32 mcpu, mnice, msystem, midle, used = 0, total = 0;
|
||||
FILE *fp;
|
||||
|
||||
if ( !( fp = fopen("U:/kern/stat", "r")))
|
||||
return usage;
|
||||
|
||||
fread( buf, 1, 2048, fp);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
sscanf( buf, "%*s %ld %ld %ld %ld", &mcpu, &mnice, &msystem, &midle);
|
||||
|
||||
used = mcpu + msystem + mnice;
|
||||
total = used + midle;
|
||||
|
||||
/* calc CPU usage */
|
||||
if( total - pre_total > 0)
|
||||
usage = ( int16)(( 20 * ( double)( used - pre_used)) / ( double)( total - pre_total));
|
||||
|
||||
if( usage < 0)
|
||||
usage = 0;
|
||||
|
||||
pre_used = used;
|
||||
pre_total = total;
|
||||
|
||||
return usage;
|
||||
}
|
||||
|
||||
|
||||
void get_total_ram( void)
|
||||
{
|
||||
size_t bytes_read;
|
||||
char *match;
|
||||
FILE *fp;
|
||||
|
||||
total_stram = 0;
|
||||
total_ttram = 0;
|
||||
|
||||
if ( !( fp = fopen("U:/kern/meminfo", "r")))
|
||||
return;
|
||||
|
||||
bytes_read = fread( buf, 1, 2048, fp);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
if( bytes_read == 0)
|
||||
return;
|
||||
|
||||
match = strstr( buf, "FastTotal");
|
||||
|
||||
if( match == NULL)
|
||||
return;
|
||||
|
||||
sscanf( match, "FastTotal: %ld", &total_ttram);
|
||||
|
||||
match = strstr( buf, "CoreTotal");
|
||||
|
||||
if( match == NULL)
|
||||
return;
|
||||
|
||||
sscanf( match, "CoreTotal: %ld", &total_stram);
|
||||
}
|
||||
|
||||
|
||||
inline void get_free_ram( uint32 *st_ram, uint32 *tt_ram)
|
||||
{
|
||||
size_t bytes_read;
|
||||
uint32 free_ram;
|
||||
char *match;
|
||||
FILE *fp;
|
||||
|
||||
*tt_ram = 0;
|
||||
*st_ram = 0;
|
||||
|
||||
if ( !( fp = fopen("U:/kern/meminfo", "r")))
|
||||
return;
|
||||
|
||||
bytes_read = fread( buf, 1, 2048, fp);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
if( bytes_read == 0)
|
||||
return;
|
||||
|
||||
match = strstr( buf, "FastFree");
|
||||
|
||||
if( match == NULL)
|
||||
return;
|
||||
|
||||
sscanf( match, "FastFree: %lu", &free_ram);
|
||||
|
||||
*tt_ram = free_ram;
|
||||
|
||||
match = strstr( buf, "CoreFree");
|
||||
|
||||
if( match == NULL)
|
||||
return;
|
||||
|
||||
sscanf( match, "CoreFree: %lu", &free_ram);
|
||||
|
||||
*st_ram = free_ram;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline void get_info_by_pid( int pid, char *name, char *ram_usage, uint32 *cpu_time)
|
||||
{
|
||||
size_t bytes_read;
|
||||
char *s, *t;
|
||||
uint32 user_time, system_time;
|
||||
int32 ram;
|
||||
|
||||
FILE *fp;
|
||||
|
||||
sprintf( buf, "U:/kern/%d/stat", pid);
|
||||
|
||||
if ( !( fp = fopen( buf, "r")))
|
||||
return;
|
||||
|
||||
bytes_read = fread( buf, 1, 2048, fp);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
if( bytes_read == 0)
|
||||
return;
|
||||
|
||||
s = strchr ( buf, '(') + 1;
|
||||
t = strchr ( buf, ')');
|
||||
strncpy( name, s, t - s);
|
||||
name[t - s] = '\0';
|
||||
|
||||
sscanf( t + 2, "%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %lu %lu %*d %*d %*d %*d %*u %*d %*u %*u %ld", &user_time, &system_time, &ram);
|
||||
|
||||
sprintf( ram_usage, "%ld kB", ram >> 10);
|
||||
|
||||
*cpu_time = user_time + system_time;
|
||||
}
|
||||
9
sources/z-tools/trunk/ztask/cpu.h
Normal file
9
sources/z-tools/trunk/ztask/cpu.h
Normal file
@@ -0,0 +1,9 @@
|
||||
extern inline int16 cpu_get_usage( void);
|
||||
extern void get_total_ram( void);
|
||||
extern inline void get_info_by_pid( int pid, char *name, char *ram_usage, uint32 *cpu_time);
|
||||
extern inline void get_free_ram( uint32 *st_Ram, uint32 *tt_ram);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
32
sources/z-tools/trunk/ztask/debug.c
Normal file
32
sources/z-tools/trunk/ztask/debug.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "general.h"
|
||||
#ifdef DEBUG
|
||||
#include <windom/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
|
||||
}
|
||||
|
||||
|
||||
|
||||
154
sources/z-tools/trunk/ztask/font_8.h
Normal file
154
sources/z-tools/trunk/ztask/font_8.h
Normal file
@@ -0,0 +1,154 @@
|
||||
/* MY_FONT8: Fonte 8*8 'non monospac<61>e'. */
|
||||
/* Version 1.0 (c) Eric Reboux 1997. */
|
||||
|
||||
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
|
||||
};
|
||||
120
sources/z-tools/trunk/ztask/general.h
Normal file
120
sources/z-tools/trunk/ztask/general.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* zbar.
|
||||
* Copyright (c) 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 <osbind.h>
|
||||
#include <mintbind.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <windom.h>
|
||||
#include <ldg.h>
|
||||
#include <scancode.h>
|
||||
#include "types2b.h"
|
||||
#include "prefs.h"
|
||||
#include "ztask.rsh"
|
||||
|
||||
/* Option */
|
||||
|
||||
#ifndef MAXNAMLEN
|
||||
#define MAXNAMLEN 255
|
||||
#endif
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 1024
|
||||
#endif
|
||||
|
||||
/* xfont text attrib. */
|
||||
#define BOLD 0x01
|
||||
#define LIGHT 0x02
|
||||
#define ITALIC 0x04
|
||||
#define ULINE 0x08
|
||||
#define INVERSE 0x10
|
||||
#define SHADOW 0x20
|
||||
#define MONOSPACE 0x40
|
||||
|
||||
#define POPUP_ITEM 64
|
||||
|
||||
#define BOLD 0x01
|
||||
#define LIGHT 0x02
|
||||
#define ITALIC 0x04
|
||||
#define ULINE 0x08
|
||||
#define INVERSE 0x10
|
||||
#define SHADOW 0x20
|
||||
#define MONOSPACE 0x40
|
||||
|
||||
#define F_HIDE 1
|
||||
#define F_QUIT 2
|
||||
#define F_KILL 3
|
||||
#define F_TASKMANAGER 4
|
||||
#define F_PREFERENCES 5
|
||||
#define F_SHUTDOWN 6
|
||||
#define F_QUIT_ZBAR 7
|
||||
|
||||
typedef struct _app_data
|
||||
{
|
||||
int16 id, pid;
|
||||
char name[9];
|
||||
char name_shown[MAXNAMLEN];
|
||||
int16 name_shown_width;
|
||||
int16 x_pos, y_pos;
|
||||
struct _app_data *next;
|
||||
} app_data;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char item_name[POPUP_ITEM][64];
|
||||
RECT16 item_pos[POPUP_ITEM];
|
||||
int16 icon[POPUP_ITEM];
|
||||
int16 selectable[POPUP_ITEM];
|
||||
int16 function[POPUP_ITEM];
|
||||
int16 item_nbr;
|
||||
int16 selected, old_selected;
|
||||
int16 x_pos, y_pos, w_pos, h_pos;
|
||||
app_data *entry;
|
||||
WINDOW *win;
|
||||
} popup_data;
|
||||
|
||||
|
||||
typedef struct _process
|
||||
{
|
||||
int pid;
|
||||
char cpu_usage[5];
|
||||
char ram_usage[30];
|
||||
char name[MAXNAMLEN];
|
||||
uint32 cpu_time;
|
||||
int16 ram_usage_txt_width;
|
||||
int16 y_pos;
|
||||
struct _process *next;
|
||||
} process;
|
||||
|
||||
|
||||
extern void zdebug( const char *format, ...);
|
||||
extern OBJECT *get_tree( int16 obj_index);
|
||||
extern char *get_string( int16 str_index);
|
||||
extern void shutdown_dialog( void);
|
||||
extern void quit_dialog( void);
|
||||
extern void pref_dialog( void);
|
||||
|
||||
|
||||
|
||||
247
sources/z-tools/trunk/ztask/gmem.c
Normal file
247
sources/z-tools/trunk/ztask/gmem.c
Normal file
@@ -0,0 +1,247 @@
|
||||
#include "general.h"
|
||||
#include "gmem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
typedef struct _GMemHdr
|
||||
{
|
||||
int size;
|
||||
int index;
|
||||
struct _GMemHdr *next;
|
||||
} GMemHdr;
|
||||
|
||||
#define gMemHdrSize (( sizeof(GMemHdr) + 7) & ~7)
|
||||
#define gMemTrlSize 4
|
||||
#define gMemDeadVal 0xFFFFFFFFUL
|
||||
|
||||
/* round data size so trailer will be aligned */
|
||||
#define gMemDataSize(size) ((((size) + gMemTrlSize - 1) / gMemTrlSize) * gMemTrlSize)
|
||||
|
||||
#define gMemNLists 64
|
||||
#define gMemListShift 4
|
||||
#define gMemListMask (gMemNLists - 1)
|
||||
static GMemHdr *gMemList[gMemNLists] = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
static int gMemIndex = 0;
|
||||
static int gMemAlloc = 0;
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
void *gmalloc(int size)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
int size1;
|
||||
char *mem;
|
||||
GMemHdr *hdr;
|
||||
void *data;
|
||||
int lst;
|
||||
unsigned long *trl, *p;
|
||||
|
||||
if (size <= 0)
|
||||
return NULL;
|
||||
|
||||
size1 = gMemDataSize(size);
|
||||
|
||||
mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize);
|
||||
|
||||
if ( mem == NULL)
|
||||
{
|
||||
zdebug( "Out of memory");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hdr = (GMemHdr *)mem;
|
||||
data = (void *)(mem + gMemHdrSize);
|
||||
trl = (unsigned long *)(mem + gMemHdrSize + size1);
|
||||
hdr->size = size;
|
||||
hdr->index = gMemIndex++;
|
||||
lst = ((int)hdr >> gMemListShift) & gMemListMask;
|
||||
hdr->next = gMemList[lst];
|
||||
gMemList[lst] = hdr;
|
||||
++gMemAlloc;
|
||||
|
||||
for (p = (unsigned long *)data; p <= trl; ++p)
|
||||
*p = gMemDeadVal;
|
||||
|
||||
return data;
|
||||
#else
|
||||
void *p;
|
||||
|
||||
if (size <= 0)
|
||||
return NULL;
|
||||
|
||||
p = malloc(size);
|
||||
|
||||
if ( p == NULL)
|
||||
{
|
||||
zdebug( "Out of memory");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return p;
|
||||
#endif
|
||||
}
|
||||
|
||||
void *grealloc(void *p, int size)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
GMemHdr *hdr;
|
||||
void *q;
|
||||
int oldSize;
|
||||
|
||||
if (size <= 0)
|
||||
{
|
||||
if (p)
|
||||
gfree(p);
|
||||
return NULL;
|
||||
}
|
||||
if (p)
|
||||
{
|
||||
hdr = (GMemHdr *)((char *)p - gMemHdrSize);
|
||||
oldSize = hdr->size;
|
||||
q = gmalloc(size);
|
||||
memcpy(q, p, size < oldSize ? size : oldSize);
|
||||
gfree(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
q = gmalloc(size);
|
||||
}
|
||||
return q;
|
||||
#else
|
||||
void *q;
|
||||
|
||||
if (size <= 0)
|
||||
{
|
||||
if (p)
|
||||
free(p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (p)
|
||||
q = realloc( p, size);
|
||||
else
|
||||
q = malloc(size);
|
||||
|
||||
if (!q)
|
||||
{
|
||||
zdebug( "Out of memory");
|
||||
return NULL;
|
||||
}
|
||||
return q;
|
||||
#endif
|
||||
}
|
||||
|
||||
void gfree(void *p)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
int size;
|
||||
GMemHdr *hdr;
|
||||
GMemHdr *prevHdr, *q;
|
||||
int lst;
|
||||
unsigned long *trl, *clr;
|
||||
|
||||
if (p)
|
||||
{
|
||||
hdr = (GMemHdr *)((char *)p - gMemHdrSize);
|
||||
lst = ((int)hdr >> gMemListShift) & gMemListMask;
|
||||
|
||||
for (prevHdr = NULL, q = gMemList[lst]; q; prevHdr = q, q = q->next)
|
||||
{
|
||||
if ( q == hdr)
|
||||
break;
|
||||
}
|
||||
|
||||
if( q)
|
||||
{
|
||||
if (prevHdr)
|
||||
prevHdr->next = hdr->next;
|
||||
else
|
||||
gMemList[lst] = hdr->next;
|
||||
|
||||
--gMemAlloc;
|
||||
size = gMemDataSize(hdr->size);
|
||||
trl = (unsigned long *)((char *)hdr + gMemHdrSize + size);
|
||||
|
||||
if (*trl != gMemDeadVal)
|
||||
{
|
||||
zdebug( "Overwrite past end of block %d at address %p", hdr->index, p);
|
||||
}
|
||||
|
||||
for (clr = (unsigned long *)hdr; clr <= trl; ++clr)
|
||||
*clr = gMemDeadVal;
|
||||
|
||||
free(hdr);
|
||||
}
|
||||
else
|
||||
{
|
||||
zdebug( "Attempted to free bad address %p", p);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (p)
|
||||
free(p);
|
||||
#endif
|
||||
}
|
||||
|
||||
void gMemReport( void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
FILE *inffile;
|
||||
GMemHdr *p;
|
||||
int lst;
|
||||
|
||||
if (( inffile = fopen( "C:\\ztkdebug.txt", "wb+")) == NULL)
|
||||
return;
|
||||
|
||||
fprintf( inffile, "%d memory allocations in all\n", gMemIndex);
|
||||
|
||||
if( gMemAlloc > 0)
|
||||
{
|
||||
fprintf( inffile, "%d memory blocks left allocated:\n", gMemAlloc);
|
||||
fprintf( inffile, " index size\n");
|
||||
fprintf( inffile, "-------- --------\n");
|
||||
|
||||
for (lst = 0; lst < gMemNLists; ++lst)
|
||||
{
|
||||
for (p = gMemList[lst]; p; p = p->next)
|
||||
fprintf( inffile, "%8d %8d\n", p->index, p->size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf( inffile, "No memory blocks left allocated\n");
|
||||
}
|
||||
|
||||
fprintf( inffile, "--= End =--");
|
||||
|
||||
fclose( inffile);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
char *copyString(char *s)
|
||||
{
|
||||
char *s1;
|
||||
|
||||
s1 = (char *)gmalloc(strlen(s) + 1);
|
||||
strcpy(s1, s);
|
||||
return s1;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
19
sources/z-tools/trunk/ztask/gmem.h
Normal file
19
sources/z-tools/trunk/ztask/gmem.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef GMEM_H
|
||||
#define GMEM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void *gmalloc(int size);
|
||||
extern void *grealloc(void *p, int size);
|
||||
extern void gfree(void *p);
|
||||
extern void gMemReport( void);
|
||||
char *copyString(char *s);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
22
sources/z-tools/trunk/ztask/history.txt
Normal file
22
sources/z-tools/trunk/ztask/history.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
22 March 2006: BETA2
|
||||
====================
|
||||
|
||||
News:
|
||||
-----
|
||||
- Preference panel added.
|
||||
- With Xaaes, "XaSys" is not more listed as a GEM process.
|
||||
|
||||
|
||||
Bugs fixes:
|
||||
-----------
|
||||
- The first drawn of the process list in the Task Manager
|
||||
was corrupted.
|
||||
- Some littles bugs fixed.
|
||||
|
||||
|
||||
|
||||
|
||||
14 March 2006: BETA1
|
||||
======================
|
||||
|
||||
- First public release.
|
||||
125
sources/z-tools/trunk/ztask/main.c
Normal file
125
sources/z-tools/trunk/ztask/main.c
Normal file
@@ -0,0 +1,125 @@
|
||||
#include "general.h"
|
||||
#include "gmem.h"
|
||||
#include "app.h"
|
||||
#include "cpu.h"
|
||||
#include "process.h"
|
||||
#include <mint/cookie.h>
|
||||
|
||||
extern int16 cpu_history[100];
|
||||
extern void main_win( void);
|
||||
|
||||
OBJECT *get_tree( int16 obj_index)
|
||||
{
|
||||
OBJECT *tree;
|
||||
RsrcGaddr( NULL, 0, obj_index, &tree);
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
||||
char *get_string( int16 str_index)
|
||||
{
|
||||
char *txt;
|
||||
rsrc_gaddr( 5, str_index, &txt);
|
||||
return txt;
|
||||
}
|
||||
|
||||
|
||||
void applexit( WINDOW *w, short buff[8])
|
||||
{
|
||||
WINDOW *last_closed = NULL;
|
||||
|
||||
if( EvntFind( NULL, WM_XTIMER))
|
||||
EvntDelete( NULL, WM_XTIMER);
|
||||
|
||||
/* Close all windows */
|
||||
while( wglb.first)
|
||||
{
|
||||
if (last_closed != wglb.first)
|
||||
{
|
||||
ApplWrite( _AESapid, WM_DESTROY, wglb.first->handle, 0, 0, 0, 0);
|
||||
last_closed = wglb.first; /* to prevent sending toons of WM_CLOSED messages to each window */
|
||||
}
|
||||
|
||||
if( EvntWindom( MU_MESAG | MU_TIMER) & MU_TIMER) /* MU_TIMER event catched ? */
|
||||
last_closed = NULL; /* then WM_CLOSED message has been lost ! it should be resent */
|
||||
}
|
||||
|
||||
prefs_write();
|
||||
|
||||
while( root != NULL)
|
||||
app_data_delete( root->id);
|
||||
|
||||
while( process_root != NULL)
|
||||
process_delete( process_root->pid);
|
||||
|
||||
RsrcXtype( 0, NULL, 0);
|
||||
RsrcFree();
|
||||
|
||||
ApplExit();
|
||||
gMemReport();
|
||||
exit( 0);
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[])
|
||||
{
|
||||
int16 i, dum, app_long_name;
|
||||
int32 mint = 0;
|
||||
|
||||
ApplInit();
|
||||
|
||||
if( app.nplanes < 4)
|
||||
{
|
||||
( void)FormAlert( 1 , "[1][Sorry, zTask needs minimum a 16 colors display][Quit]");
|
||||
ApplExit();
|
||||
exit( 0);
|
||||
}
|
||||
|
||||
if( Getcookie( C_MiNT, ( long*)&mint) != 0)
|
||||
{
|
||||
( void)FormAlert( 1 , "[1][Sorry, zTask works only with MiNT][Quit]");
|
||||
ApplExit();
|
||||
exit( 0);
|
||||
}
|
||||
|
||||
mt_appl_getinfo( AES_EXTENDED, &dum, &dum, &app_long_name, &dum, app.aes_global);
|
||||
|
||||
if( app_long_name <= 0)
|
||||
{
|
||||
( void)FormAlert( 1 , "[1][AES 4.x needed!][Quit]");
|
||||
ApplExit();
|
||||
exit( 0);
|
||||
}
|
||||
|
||||
if( !RsrcLoad( "ztask.rsc"))
|
||||
{
|
||||
( void)FormAlert( 1 , "[1][ztask.rsc not found!][Quit]");
|
||||
ApplExit();
|
||||
exit( 0);
|
||||
}
|
||||
|
||||
RsrcXtype( RSRC_XTYPE, NULL, 0);
|
||||
|
||||
prefs_read();
|
||||
|
||||
get_total_ram();
|
||||
|
||||
evnt.timer = 20L;
|
||||
evnt.bclick = 258;
|
||||
evnt.bmask = 3;
|
||||
evnt.bstate = 0;
|
||||
|
||||
EvntAttach( NULL, AP_TERM, applexit);
|
||||
|
||||
for( i = 0; i < 101;)
|
||||
cpu_history[i++] = 100;
|
||||
|
||||
main_win();
|
||||
|
||||
for(;;)
|
||||
EvntWindom( MU_MESAG|MU_TIMER|MU_KEYBD|MU_BUTTON);
|
||||
|
||||
// applexit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
233
sources/z-tools/trunk/ztask/popup.c
Normal file
233
sources/z-tools/trunk/ztask/popup.c
Normal file
@@ -0,0 +1,233 @@
|
||||
#include "general.h"
|
||||
#include "app.h"
|
||||
#include "string.h"
|
||||
#include "win.h"
|
||||
#include "taskman.h"
|
||||
#include <signal.h>
|
||||
|
||||
popup_data popup;
|
||||
extern WINDOW *app_bar;
|
||||
|
||||
|
||||
void CDECL popup_delete( WINDOW *win, int16 buff[8])
|
||||
{
|
||||
WindDelete( win);
|
||||
popup.win = NULL;
|
||||
|
||||
if( menu_enabled == TRUE)
|
||||
{
|
||||
menu_enabled = FALSE;
|
||||
draw_page( app_bar, root->x_pos - 24, root->y_pos, 24, 23);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void process_popup_item( WINDOW *win, int16 buff[8])
|
||||
{
|
||||
if( popup.selected < 0)
|
||||
return;
|
||||
|
||||
switch( popup.function[popup.selected])
|
||||
{
|
||||
case F_SHUTDOWN:
|
||||
shutdown_dialog();
|
||||
break;
|
||||
|
||||
case F_TASKMANAGER:
|
||||
taskman_dialog();
|
||||
break;
|
||||
|
||||
case F_QUIT_ZBAR:
|
||||
quit_dialog();
|
||||
break;
|
||||
|
||||
case F_KILL:
|
||||
Pkill( popup.entry->pid, SIGKILL);
|
||||
mt_evnt_timer( 100L, app.aes_global);
|
||||
break;
|
||||
|
||||
case F_PREFERENCES:
|
||||
pref_dialog();
|
||||
break;
|
||||
|
||||
case F_QUIT:
|
||||
ApplWrite( popup.entry->id, AP_TERM, 0, 0, 0, 0, 0);
|
||||
mt_evnt_timer( 100L, app.aes_global);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
popup_delete( win, buff);
|
||||
}
|
||||
|
||||
|
||||
int16 popup_item_under_mouse( void)
|
||||
{
|
||||
int16 i, ok, result = -1;
|
||||
|
||||
for( i = 0; i < popup.item_nbr; i++)
|
||||
{
|
||||
ok = IS_IN( evnt.mx, evnt.my, popup.item_pos[i].x1, popup.item_pos[i].y1, popup.item_pos[i].x2, popup.item_pos[i].y2);
|
||||
|
||||
if( ok)
|
||||
{
|
||||
if( popup.selectable[i] == TRUE)
|
||||
result = i;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void CDECL popup_redraw( WINDOW *win, int16 buff[8])
|
||||
{
|
||||
int16 pxy[6], i, y, title_color, title_shadow;
|
||||
|
||||
pxy[0] = popup.x_pos;
|
||||
pxy[1] = popup.y_pos;
|
||||
pxy[2] = pxy[0] + popup.w_pos - 1;
|
||||
pxy[3] = pxy[1] + popup.h_pos - 1;
|
||||
|
||||
vsf_color( win->graf->handle, button_off_background);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
|
||||
pxy[5] = pxy[1];
|
||||
pxy[1] = pxy[3];
|
||||
pxy[4] = pxy[2];
|
||||
|
||||
vsl_color( win->graf->handle, button_off_dark_color);
|
||||
v_pline( win->graf->handle, 3, pxy);
|
||||
|
||||
pxy[4] = pxy[2];
|
||||
pxy[2] = pxy[0];
|
||||
pxy[3] = popup.y_pos;
|
||||
pxy[5] = pxy[3];
|
||||
|
||||
vsl_color( win->graf->handle, button_off_light_color);
|
||||
v_pline( win->graf->handle, 3, pxy);
|
||||
|
||||
pxy[0] = popup.x_pos + 1;
|
||||
pxy[1] = popup.y_pos + 1;
|
||||
pxy[2] = pxy[0] + popup.w_pos - 3;
|
||||
|
||||
for( i = 0, y = popup.y_pos + 7; i < popup.item_nbr; i++, y += 18, pxy[1] += 18)
|
||||
{
|
||||
popup.item_pos[i].x1 = pxy[0];
|
||||
popup.item_pos[i].x2 = popup.w_pos;
|
||||
popup.item_pos[i].y1 = pxy[1];
|
||||
|
||||
if( popup.item_name[i][0] == '\0')
|
||||
{
|
||||
int16 xy[4] = { pxy[0] + 1, pxy[1] + 5, pxy[2] - 1, pxy[1] + 5};
|
||||
|
||||
v_pline( win->graf->handle, 2, xy);
|
||||
|
||||
xy[1]--;
|
||||
xy[3]--;
|
||||
|
||||
vsl_color( win->graf->handle, button_off_dark_color);
|
||||
v_pline( win->graf->handle, 2, xy);
|
||||
|
||||
y -= 9;
|
||||
pxy[1] -= 9;
|
||||
popup.item_pos[i].y2 = 9;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
popup.item_pos[i].y2 = 18;
|
||||
|
||||
if( i == popup.selected)
|
||||
{
|
||||
pxy[3] = pxy[1] + 17;
|
||||
vsf_color( win->graf->handle, button_on_background);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
title_color = button_on_text_color;
|
||||
title_shadow = button_on_text_shadow_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
title_color = button_off_text_color;
|
||||
title_shadow = button_off_text_shadow_color;
|
||||
}
|
||||
|
||||
if( popup.icon[i] > -1)
|
||||
{
|
||||
icons[popup.icon[i]].ob_x = popup.x_pos + x_space;
|
||||
icons[popup.icon[i]].ob_y = pxy[1] + 2;
|
||||
|
||||
mt_objc_draw( icons, popup.icon[i], 1, win->graf->clip.g_x, win->graf->clip.g_y, win->graf->clip.g_w, win->graf->clip.g_h, app.aes_global);
|
||||
|
||||
draw_text( win->graf->handle, icons[popup.icon[i]].ob_x + 17 + x_space, y + 1, title_shadow, popup.item_name[i]);
|
||||
draw_text( win->graf->handle, icons[popup.icon[i]].ob_x + 16 + x_space, y, title_color, popup.item_name[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_text( win->graf->handle, popup.x_pos + x_space + 1, y + 1, title_shadow, popup.item_name[i]);
|
||||
draw_text( win->graf->handle, popup.x_pos + x_space, y, title_color, popup.item_name[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void open_popup( app_data *entry)
|
||||
{
|
||||
int16 i, lenght, zbarx, zbary, dum;
|
||||
|
||||
WindGet( app_bar, WF_CURRXYWH, &zbarx, &zbary, &dum, &dum);
|
||||
|
||||
if( entry)
|
||||
popup.x_pos = entry->x_pos - 1;
|
||||
else
|
||||
popup.x_pos = zbarx;
|
||||
|
||||
popup.h_pos = 5;
|
||||
popup.selected = -1;
|
||||
popup.old_selected = -1;
|
||||
|
||||
for( popup.w_pos = 0, i = 0; i < popup.item_nbr; i++)
|
||||
{
|
||||
if( popup.item_name[i][0] == '\0')
|
||||
{
|
||||
popup.h_pos += 9;
|
||||
continue;
|
||||
}
|
||||
|
||||
lenght = get_text_width( popup.item_name[i]);
|
||||
|
||||
if( popup.icon[i] > -1)
|
||||
lenght += 16 + x_space;
|
||||
|
||||
if( lenght > popup.w_pos)
|
||||
popup.w_pos = lenght;
|
||||
|
||||
popup.h_pos += 18;
|
||||
}
|
||||
|
||||
popup.w_pos += ( x_space * 3);
|
||||
popup.w_pos = MAX( popup.w_pos, app_width + 1);
|
||||
|
||||
while( popup.x_pos + popup.w_pos > app.x + app.w)
|
||||
popup.x_pos--;
|
||||
|
||||
popup.entry = entry;
|
||||
popup.win = WindCreate( 0, app.x, app.y, app.w, app.h);
|
||||
|
||||
EvntAttach( popup.win, WM_DESTROY, popup_delete);
|
||||
EvntAttach( popup.win, WM_REDRAW, popup_redraw);
|
||||
EvntAttach( popup.win, WM_XBUTTON, process_popup_item);
|
||||
|
||||
popup.y_pos = zbary - popup.h_pos + 1;
|
||||
|
||||
WindOpen( popup.win, popup.x_pos, popup.y_pos, popup.w_pos, popup.h_pos);
|
||||
// WindSet( popup.win, WF_BEVENT, BEVENT_MODAL, 0, 0, 0);
|
||||
WindGet( popup.win, WF_WORKXYWH, &popup.x_pos, &popup.y_pos, &popup.w_pos, &popup.h_pos);
|
||||
}
|
||||
|
||||
|
||||
8
sources/z-tools/trunk/ztask/popup.h
Normal file
8
sources/z-tools/trunk/ztask/popup.h
Normal file
@@ -0,0 +1,8 @@
|
||||
extern popup_data popup;
|
||||
extern void open_popup( app_data *entry);
|
||||
extern int16 popup_item_under_mouse( void);
|
||||
extern void popup_delete( WINDOW *win);
|
||||
|
||||
|
||||
|
||||
|
||||
614
sources/z-tools/trunk/ztask/pref_panel.c
Normal file
614
sources/z-tools/trunk/ztask/pref_panel.c
Normal file
@@ -0,0 +1,614 @@
|
||||
#include "general.h"
|
||||
#include "win.h"
|
||||
#include "string.h"
|
||||
#include "app.h"
|
||||
|
||||
int tmp_button_off_background, tmp_button_off_light_color, tmp_button_off_dark_color,
|
||||
tmp_button_off_text_color, tmp_button_off_text_shadow_color, tmp_button_on_background,
|
||||
tmp_button_on_light_color, tmp_button_on_dark_color, tmp_button_on_text_color,
|
||||
tmp_button_on_text_shadow_color, tmp_geek_area_color, tmp_geek_area_dark_line,
|
||||
tmp_geek_area_light_line, tmp_app_width, tmp_cpu_bar_color,
|
||||
tmp_tt_bar_color, tmp_st_bar_color, tmp_show_clock, tmp_clock_us,
|
||||
tmp_show_system_info, tmp_show_acc, tmp_geek_area_text_color;
|
||||
static void *thumb = NULL;
|
||||
int *tmp;
|
||||
static int16 xy[10], tmp_cpu_x, tmp_tt_x, tmp_st_x, tmp_clock_x, tmp_geek_area_width, tmp_y_text_pos,
|
||||
tmp_x_pos, tmp_y_pos, tmp_w_pos, tmp_geek_area_x, text_width, x;
|
||||
static OBJECT *dial = NULL;
|
||||
WINDOW *pref_dialog_win = NULL;
|
||||
|
||||
extern void vdi_color_selector( int16 xw, int16 yw, int16 color_selected, int16 parent_object);
|
||||
|
||||
|
||||
static void CDECL pref_dialog_cancel_event( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
ObjcChange( OC_FORM, win, obj, NORMAL, TRUE);
|
||||
ApplWrite( _AESapid, WM_DESTROY, win->handle, 0, 0, 0, 0);
|
||||
pref_dialog_win = NULL;
|
||||
}
|
||||
|
||||
static void CDECL pref_dialog_ok_event( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
ObjcChange( OC_FORM, win, obj, NORMAL, TRUE);
|
||||
ApplWrite( _AESapid, WM_DESTROY, win->handle, 0, 0, 0, 0);
|
||||
pref_dialog_win = NULL;
|
||||
|
||||
button_off_background = tmp_button_off_background;
|
||||
button_off_light_color = tmp_button_off_light_color;
|
||||
button_off_dark_color = tmp_button_off_dark_color;
|
||||
button_off_text_color = tmp_button_off_text_color;
|
||||
button_off_text_shadow_color = tmp_button_off_text_shadow_color;
|
||||
button_on_background = tmp_button_on_background;
|
||||
button_on_light_color = tmp_button_on_light_color;
|
||||
button_on_dark_color = tmp_button_on_dark_color;
|
||||
button_on_text_color = tmp_button_on_text_color;
|
||||
button_on_text_shadow_color = tmp_button_on_text_shadow_color;
|
||||
geek_area_text_color = tmp_geek_area_text_color;
|
||||
geek_area_color = tmp_geek_area_color;
|
||||
geek_area_dark_line = tmp_geek_area_dark_line;
|
||||
geek_area_light_line = tmp_geek_area_light_line;
|
||||
app_width = tmp_app_width;
|
||||
cpu_bar_color = tmp_cpu_bar_color;
|
||||
tt_bar_color = tmp_tt_bar_color;
|
||||
st_bar_color = tmp_st_bar_color;
|
||||
show_clock = tmp_show_clock;
|
||||
clock_us = tmp_clock_us;
|
||||
show_system_info = tmp_show_system_info;
|
||||
|
||||
|
||||
if( show_acc != tmp_show_acc)
|
||||
{
|
||||
while( root != NULL)
|
||||
app_data_delete( root->id);
|
||||
|
||||
show_acc = tmp_show_acc;
|
||||
app_data_search();
|
||||
}
|
||||
else
|
||||
show_acc = tmp_show_acc;
|
||||
|
||||
set_component_position();
|
||||
|
||||
w_pos = geek_area_width + ( app_nbr * app_width) + 24;
|
||||
|
||||
while( w_pos > app.w)
|
||||
w_pos -= app_width;
|
||||
|
||||
x_pos = app.x + ( app.w - w_pos);
|
||||
w_pos -= 1;
|
||||
|
||||
WindSet( app_bar, WF_WORKXYWH, x_pos, y_pos, w_pos, h_pos);
|
||||
|
||||
// Xaaes bug... with this AES, WindSet( win, WF_CURRXYWH,... doesn't redraw the taskbar.
|
||||
draw_page( app_bar, x_pos, y_pos, w_pos, h_pos);
|
||||
}
|
||||
|
||||
|
||||
static void CDECL click_on_color( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
int16 y, color_selection_width, selected_color = 0;
|
||||
|
||||
switch( obj)
|
||||
{
|
||||
case PREFS_ON_BACK:
|
||||
selected_color = ( int16)tmp_button_on_background;
|
||||
break;
|
||||
|
||||
case PREFS_ON_LINE1:
|
||||
selected_color = ( int16)tmp_button_on_light_color;
|
||||
break;
|
||||
|
||||
case PREFS_ON_LINE2:
|
||||
selected_color = ( int16)tmp_button_on_dark_color;
|
||||
break;
|
||||
|
||||
case PREFS_ON_TEXT1:
|
||||
selected_color = ( int16)tmp_button_on_text_color;
|
||||
break;
|
||||
|
||||
case PREFS_ON_TEXT2:
|
||||
selected_color = ( int16)tmp_button_on_text_shadow_color;
|
||||
break;
|
||||
|
||||
case PREFS_OFF_BACK:
|
||||
selected_color = ( int16)tmp_button_off_background;
|
||||
break;
|
||||
|
||||
case PREFS_OFF_LINE1:
|
||||
selected_color = ( int16)tmp_button_off_light_color;
|
||||
break;
|
||||
|
||||
case PREFS_OFF_LINE2:
|
||||
selected_color = ( int16)tmp_button_off_dark_color;
|
||||
break;
|
||||
|
||||
case PREFS_OFF_TEXT1:
|
||||
selected_color = ( int16)tmp_button_off_text_color;
|
||||
break;
|
||||
|
||||
case PREFS_OFF_TEXT2:
|
||||
selected_color = ( int16)tmp_button_off_text_shadow_color;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_BACK:
|
||||
selected_color = ( int16)tmp_geek_area_color;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_LINE1:
|
||||
selected_color = ( int16)tmp_geek_area_light_line;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_LINE2:
|
||||
selected_color = ( int16)tmp_geek_area_dark_line;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_RAM1:
|
||||
selected_color = ( int16)tmp_st_bar_color;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_RAM2:
|
||||
selected_color = ( int16)tmp_tt_bar_color;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_CPU:
|
||||
selected_color = ( int16)tmp_cpu_bar_color;
|
||||
break;
|
||||
|
||||
case PREFS_GEEK_TEXT:
|
||||
selected_color = ( int16)tmp_geek_area_text_color;
|
||||
break;
|
||||
}
|
||||
|
||||
mt_objc_offset( dial, obj, &x, &y, app.aes_global);
|
||||
|
||||
if( app.nplanes == 4)
|
||||
color_selection_width = 45;
|
||||
else
|
||||
color_selection_width = 177;
|
||||
|
||||
while( x + color_selection_width + 2 > app.w)
|
||||
x--;
|
||||
|
||||
while( y + color_selection_width + 2 > app.h)
|
||||
y--;
|
||||
|
||||
vdi_color_selector( x, y, selected_color, ( int16)obj);
|
||||
}
|
||||
|
||||
static void CDECL pref_dialog_default_event( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
if( app.nplanes < 8)
|
||||
{
|
||||
tmp_button_off_light_color = WHITE;
|
||||
tmp_button_off_dark_color = LBLACK;
|
||||
tmp_button_off_text_color = BLACK;
|
||||
tmp_button_off_text_shadow_color = WHITE;
|
||||
tmp_button_on_background = LBLACK;
|
||||
tmp_button_on_light_color = LWHITE;
|
||||
tmp_button_on_dark_color = BLACK;
|
||||
tmp_button_on_text_color = BLACK;
|
||||
tmp_button_on_text_shadow_color = LWHITE;
|
||||
tmp_geek_area_text_color = BLACK;
|
||||
tmp_geek_area_color = LWHITE;
|
||||
tmp_geek_area_dark_line = LBLACK;
|
||||
tmp_geek_area_light_line = WHITE;
|
||||
tmp_cpu_bar_color = CYAN;
|
||||
tmp_tt_bar_color = BLUE;
|
||||
tmp_st_bar_color = RED;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_button_off_background = 8;
|
||||
tmp_button_off_light_color = 250;
|
||||
tmp_button_off_dark_color = 252;
|
||||
tmp_button_off_text_color = 255;
|
||||
tmp_button_off_text_shadow_color = 250;
|
||||
tmp_button_on_background = 252;
|
||||
tmp_button_on_light_color = 8;
|
||||
tmp_button_on_dark_color = 144;
|
||||
tmp_button_on_text_color = 1;
|
||||
tmp_button_on_text_shadow_color = 251;
|
||||
tmp_geek_area_text_color = 1;
|
||||
tmp_geek_area_color = 252;
|
||||
tmp_geek_area_dark_line = 144;
|
||||
tmp_geek_area_light_line = 250;
|
||||
tmp_app_width = 72;
|
||||
tmp_cpu_bar_color = 146;
|
||||
tmp_tt_bar_color = 73;
|
||||
tmp_st_bar_color = 106;
|
||||
}
|
||||
|
||||
if( FormThbGet( thumb, 0) == PREFS_COLOR)
|
||||
{
|
||||
ObjcDraw( OC_FORM, win, PREFS_PANEL1, 3);
|
||||
ObjcDraw( OC_FORM, win, PREFS_COLOR, 1);
|
||||
}
|
||||
|
||||
ObjcChange( OC_FORM, win, obj, NORMAL, TRUE);
|
||||
}
|
||||
|
||||
|
||||
static void CDECL draw_preview( WINDOW *win, PARMBLK *pblk, void *data)
|
||||
{
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y;
|
||||
xy[2] = pblk->pb_x + pblk->pb_w - 1;
|
||||
xy[3] = pblk->pb_y + pblk->pb_h - 1;
|
||||
|
||||
vsf_color( win->graf->handle, LCYAN);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y;
|
||||
xy[2] = pblk->pb_x;
|
||||
xy[3] = pblk->pb_y + pblk->pb_h - 1;
|
||||
xy[4] = pblk->pb_x + pblk->pb_w - 1;
|
||||
xy[5] = xy[3];
|
||||
xy[6] = xy[4];
|
||||
xy[7] = pblk->pb_y;
|
||||
xy[8] = pblk->pb_x;
|
||||
xy[9] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, BLACK);
|
||||
v_pline( win->graf->handle, 5, xy);
|
||||
|
||||
x = x_space + 2;
|
||||
|
||||
if( tmp_show_system_info)
|
||||
{
|
||||
tmp_cpu_x = x;
|
||||
x += ( bar_width + 2);
|
||||
|
||||
tmp_st_x = x;
|
||||
x += ( bar_width + 2);
|
||||
|
||||
tmp_tt_x = x;
|
||||
x += ( bar_width + x_space);
|
||||
}
|
||||
|
||||
if( tmp_show_clock == TRUE)
|
||||
{
|
||||
tmp_clock_x = x;
|
||||
|
||||
if( tmp_clock_us == FALSE)
|
||||
text_width = get_text_width( "22:37:05");
|
||||
else
|
||||
text_width = get_text_width( "10:37:05 PM");
|
||||
|
||||
x += ( text_width + x_space);
|
||||
}
|
||||
|
||||
tmp_geek_area_width = x + 1;
|
||||
|
||||
tmp_y_text_pos = pblk->pb_y + pblk->pb_h - 15;
|
||||
|
||||
tmp_w_pos = tmp_geek_area_width + ( 2 * tmp_app_width) + 23;
|
||||
tmp_x_pos = pblk->pb_x + ( pblk->pb_w - tmp_w_pos) - 1;
|
||||
tmp_y_pos = pblk->pb_y + pblk->pb_h - 22;
|
||||
|
||||
|
||||
tmp_geek_area_x = tmp_x_pos + tmp_w_pos - tmp_geek_area_width;
|
||||
|
||||
/* we draw the menu area */
|
||||
xy[0] = tmp_x_pos;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0] + 23;
|
||||
xy[3] = xy[1] + 20;
|
||||
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_button_off_background);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[1] = xy[3];
|
||||
xy[2] = xy[0];
|
||||
xy[3] = tmp_y_pos;
|
||||
xy[4] = xy[0] + 22;
|
||||
xy[5] = tmp_y_pos;
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_off_light_color);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[0] = xy[4] + 1;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = xy[1] + 20;
|
||||
xy[4] = tmp_x_pos;
|
||||
xy[5] = xy[3];
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_off_dark_color);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
// icons[ICONS_MENU].ob_x = xw + 4;
|
||||
// icons[ICONS_MENU].ob_y = y_pos + 2;
|
||||
|
||||
// mt_objc_draw( icons, ICONS_MENU, 1, win->graf->clip.g_x, win->graf->clip.g_y, win->graf->clip.g_w, win->graf->clip.g_h, app.aes_global);
|
||||
|
||||
tmp_x_pos += 24;
|
||||
|
||||
xy[0] = tmp_x_pos;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0] + tmp_app_width - 1;
|
||||
xy[3] = xy[1] + 20;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_button_on_background);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[1] = xy[3];
|
||||
xy[2] = xy[0];
|
||||
xy[3] = tmp_y_pos;
|
||||
xy[4] = xy[0] + tmp_app_width - 2;
|
||||
xy[5] = tmp_y_pos;
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_on_dark_color);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[0] = xy[4] + 1;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = xy[1] + 20;
|
||||
xy[4] = tmp_x_pos;
|
||||
xy[5] = xy[3];
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_on_light_color);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
draw_text( win->graf->handle, tmp_x_pos + 21, tmp_y_text_pos + 1, ( int16)tmp_button_on_text_shadow_color, "Dummy");
|
||||
draw_text( win->graf->handle, tmp_x_pos + 20, tmp_y_text_pos, ( int16)tmp_button_on_text_color, "Dummy");
|
||||
|
||||
tmp_x_pos += tmp_app_width;
|
||||
|
||||
xy[0] = tmp_x_pos;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0] + tmp_app_width - 1;
|
||||
xy[3] = xy[1] + 20;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_button_off_background);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[1] = xy[3];
|
||||
xy[2] = xy[0];
|
||||
xy[3] = tmp_y_pos;
|
||||
xy[4] = xy[0] + tmp_app_width - 2;
|
||||
xy[5] = tmp_y_pos;
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_off_light_color);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[0] = xy[4] + 1;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = xy[1] + 20;
|
||||
xy[4] = tmp_x_pos;
|
||||
xy[5] = xy[3];
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_off_dark_color);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
draw_text( win->graf->handle, tmp_x_pos + 21, tmp_y_text_pos + 1, ( int16)tmp_button_off_text_shadow_color, "Dummy");
|
||||
draw_text( win->graf->handle, tmp_x_pos + 20, tmp_y_text_pos, ( int16)tmp_button_off_text_color, "Dummy");
|
||||
|
||||
tmp_x_pos += tmp_app_width;
|
||||
|
||||
|
||||
|
||||
/* draw the "geek" area */
|
||||
xy[0] = tmp_x_pos + 2;
|
||||
xy[1] = tmp_y_pos + 2;
|
||||
xy[2] = xy[0] + tmp_geek_area_width - 6;
|
||||
xy[3] = xy[1] + 16;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_geek_area_color);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = tmp_x_pos;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = xy[1] + 20;
|
||||
xy[4] = xy[2] + tmp_geek_area_width - 2;
|
||||
xy[5] = xy[3];
|
||||
xy[6] = xy[4];
|
||||
xy[7] = xy[1];
|
||||
xy[8] = xy[0];
|
||||
xy[9] = xy[1];
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_off_background);
|
||||
v_pline( win->graf->handle, 5, xy);
|
||||
|
||||
xy[0]++;
|
||||
xy[1] = xy[3] - 1;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = tmp_y_pos + 1;
|
||||
xy[4]--;
|
||||
xy[5] = xy[3];
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_geek_area_dark_line);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[2] = xy[4];
|
||||
xy[3] = xy[1];
|
||||
xy[5] = tmp_y_pos + 2;
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_geek_area_light_line);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
|
||||
/* draw the cpu % in the "geek" area */
|
||||
if( tmp_show_system_info)
|
||||
{
|
||||
/* the CPU usage */
|
||||
xy[0] = tmp_cpu_x + tmp_geek_area_x;
|
||||
xy[1] = tmp_y_pos + 3;
|
||||
xy[2] = xy[0] + bar_width - 1;
|
||||
xy[3] = xy[1] + 14;
|
||||
|
||||
vsf_color( win->graf->handle, BLACK);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = xy[0] + 1;
|
||||
xy[2] = xy[2] - 1;
|
||||
xy[3] = tmp_y_pos + 16;
|
||||
xy[1] = tmp_y_pos + 9;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_cpu_bar_color);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
/* the STRAM usage */
|
||||
xy[0] = tmp_st_x + tmp_geek_area_x;
|
||||
xy[1] = tmp_y_pos + 3;
|
||||
xy[2] = xy[0] + bar_width - 1;
|
||||
xy[3] = xy[1] + 14;
|
||||
|
||||
vsf_color( win->graf->handle, BLACK);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = xy[0] + 1;
|
||||
xy[2] = xy[2] - 1;
|
||||
xy[3] = tmp_y_pos + 16;
|
||||
xy[1] = tmp_y_pos + 9;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_st_bar_color);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = tmp_tt_x + tmp_geek_area_x;
|
||||
xy[1] = tmp_y_pos + 3;
|
||||
xy[2] = xy[0] + bar_width - 1;
|
||||
xy[3] = xy[1] + 14;
|
||||
|
||||
vsf_color( win->graf->handle, BLACK);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
|
||||
xy[0] = xy[0] + 1;
|
||||
xy[2] = xy[2] - 1;
|
||||
xy[3] = tmp_y_pos + 16;
|
||||
xy[1] = tmp_y_pos + 9;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_tt_bar_color);
|
||||
v_bar( win->graf->handle, xy);
|
||||
}
|
||||
|
||||
if( tmp_show_clock == TRUE)
|
||||
{
|
||||
if( tmp_clock_us == FALSE)
|
||||
draw_text( win->graf->handle, tmp_clock_x + tmp_geek_area_x, tmp_y_text_pos, (int16)tmp_geek_area_text_color, "22:37:05");
|
||||
else
|
||||
draw_text( win->graf->handle, tmp_clock_x + tmp_geek_area_x, tmp_y_text_pos, (int16)tmp_geek_area_text_color, "10:37:05 PM");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void CDECL draw_color_case( WINDOW *win, PARMBLK *pblk, void *data)
|
||||
{
|
||||
tmp = ( int*)data;
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y;
|
||||
xy[2] = xy[0] + 127;
|
||||
xy[3] = xy[1] + 127;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)*tmp);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y;
|
||||
xy[2] = pblk->pb_x;
|
||||
xy[3] = pblk->pb_y + pblk->pb_h - 1;
|
||||
xy[4] = pblk->pb_x + pblk->pb_w - 1;
|
||||
xy[5] = xy[3];
|
||||
xy[6] = xy[4];
|
||||
xy[7] = pblk->pb_y;
|
||||
xy[8] = pblk->pb_x;
|
||||
xy[9] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, BLACK);
|
||||
v_pline( win->graf->handle, 5, xy);
|
||||
}
|
||||
|
||||
|
||||
void pref_dialog( void)
|
||||
{
|
||||
int frms[] = { PREFS_PANEL1, PREFS_PANEL2};
|
||||
int buts[] = { PREFS_COLOR, PREFS_MISC};
|
||||
|
||||
if( pref_dialog_win != NULL)
|
||||
return;
|
||||
|
||||
dial = get_tree( PREFS);
|
||||
|
||||
tmp_button_off_background = button_off_background;
|
||||
tmp_button_off_light_color = button_off_light_color;
|
||||
tmp_button_off_dark_color = button_off_dark_color;
|
||||
tmp_button_off_text_color = button_off_text_color;
|
||||
tmp_button_off_text_shadow_color = button_off_text_shadow_color;
|
||||
tmp_button_on_background = button_on_background;
|
||||
tmp_button_on_light_color = button_on_light_color;
|
||||
tmp_button_on_dark_color = button_on_dark_color;
|
||||
tmp_button_on_text_color = button_on_text_color;
|
||||
tmp_button_on_text_shadow_color = button_on_text_shadow_color;
|
||||
tmp_geek_area_text_color = geek_area_text_color;
|
||||
tmp_geek_area_color = geek_area_color;
|
||||
tmp_geek_area_dark_line = geek_area_dark_line;
|
||||
tmp_geek_area_light_line = geek_area_light_line;
|
||||
tmp_app_width = app_width;
|
||||
tmp_cpu_bar_color = cpu_bar_color;
|
||||
tmp_tt_bar_color = tt_bar_color;
|
||||
tmp_st_bar_color = st_bar_color;
|
||||
tmp_show_clock = show_clock;
|
||||
tmp_clock_us = clock_us;
|
||||
tmp_show_system_info = show_system_info;
|
||||
tmp_show_acc = show_acc;
|
||||
|
||||
|
||||
if( ( pref_dialog_win = FormCreate( dial, NAME|MOVER, NULL, "Preferences", NULL, TRUE, FALSE)) == NULL)
|
||||
return;
|
||||
|
||||
dial = FORM( pref_dialog_win);
|
||||
|
||||
thumb = FormThumb( pref_dialog_win, frms, buts, 2);
|
||||
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_ON_BACK, draw_color_case, &tmp_button_on_background);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_ON_LINE1, draw_color_case, &tmp_button_on_light_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_ON_LINE2, draw_color_case, &tmp_button_on_dark_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_ON_TEXT1, draw_color_case, &tmp_button_on_text_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_ON_TEXT2, draw_color_case, &tmp_button_on_text_shadow_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_OFF_BACK, draw_color_case, &tmp_button_off_background);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_OFF_LINE1, draw_color_case, &tmp_button_off_light_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_OFF_LINE2, draw_color_case, &tmp_button_off_dark_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_OFF_TEXT1, draw_color_case, &tmp_button_off_text_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_OFF_TEXT2, draw_color_case, &tmp_button_off_text_shadow_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_GEEK_BACK, draw_color_case, &tmp_geek_area_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_GEEK_LINE1, draw_color_case, &tmp_geek_area_light_line);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_GEEK_LINE2, draw_color_case, &tmp_geek_area_dark_line);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_GEEK_RAM1, draw_color_case, &tmp_st_bar_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_GEEK_RAM2, draw_color_case, &tmp_tt_bar_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_GEEK_CPU, draw_color_case, &tmp_cpu_bar_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_GEEK_TEXT, draw_color_case, &tmp_geek_area_text_color);
|
||||
RsrcUserDraw( OC_FORM, pref_dialog_win, PREFS_PREVIEW, draw_preview, NULL);
|
||||
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_OK, pref_dialog_ok_event, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_CANCEL, pref_dialog_cancel_event, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_DEFAULT, pref_dialog_default_event, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_ON_BACK, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_ON_LINE1, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_ON_LINE2, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_ON_TEXT1, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_ON_TEXT2, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_OFF_BACK, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_OFF_LINE1, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_OFF_LINE2, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_OFF_TEXT1, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_OFF_TEXT2, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_GEEK_BACK, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_GEEK_LINE1, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_GEEK_LINE2, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_GEEK_RAM1, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_GEEK_RAM2, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_GEEK_CPU, click_on_color, NULL);
|
||||
ObjcAttachFormFunc( pref_dialog_win, PREFS_GEEK_TEXT, click_on_color, NULL);
|
||||
|
||||
ObjcAttachVar( OC_FORM, pref_dialog_win, PREFS_SHOW_US_CLOCK, &tmp_clock_us, 1);
|
||||
ObjcAttachVar( OC_FORM, pref_dialog_win, PREFS_SHOW_ACC, &tmp_show_acc, 1);
|
||||
ObjcAttachVar( OC_FORM, pref_dialog_win, PREFS_SYSTEM_INFO, &tmp_show_system_info, 1);
|
||||
ObjcAttachVar( OC_FORM, pref_dialog_win, PREFS_SHOW_CLOCK, &tmp_show_clock, 1);
|
||||
}
|
||||
|
||||
392
sources/z-tools/trunk/ztask/preference.c
Normal file
392
sources/z-tools/trunk/ztask/preference.c
Normal file
@@ -0,0 +1,392 @@
|
||||
#include "general.h"
|
||||
#include "win.h"
|
||||
#include "string.h"
|
||||
|
||||
int tmp_button_off_background, tmp_button_off_light_color, tmp_button_off_dark_color,
|
||||
tmp_button_off_text_color, tmp_button_off_text_shadow_color, tmp_button_on_background,
|
||||
tmp_button_on_light_color, tmp_button_on_dark_color, tmp_button_on_text_color,
|
||||
tmp_button_on_text_shadow_color, tmp_geek_area_color, tmp_geek_area_dark_line,
|
||||
tmp_geek_area_light_line, tmp_app_width, tmp_cpu_bar_color,
|
||||
tmp_tt_bar_color, tmp_st_bar_color, tmp_show_clock, tmp_clock_us,
|
||||
tmp_show_system_info, tmp_show_acc;
|
||||
|
||||
int *tmp;
|
||||
static int16 xy[10], tmp_cpu_x, tmp_tt_x, tmp_st_x, tmp_clock_x, tmp_geek_area_width, tmp_y_text_pos,
|
||||
tmp_x_pos, tmp_y_pos, tmp_w_pos, tmp_geek_area_x, text_width, x;
|
||||
static OBJECT *dial = NULL;
|
||||
|
||||
|
||||
static void CDECL pref_dialog_cancel_event( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
ObjcChange( OC_FORM, win, obj, NORMAL, TRUE);
|
||||
}
|
||||
|
||||
static void CDECL pref_dialog_ok_event( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
ObjcChange( OC_FORM, win, obj, NORMAL, TRUE);
|
||||
ApplWrite( _AESapid, WM_DESTROY, win->handle, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
static void CDECL draw_preview( WINDOW *win, PARMBLK *pblk, void *data)
|
||||
{
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y;
|
||||
xy[2] = pblk->pb_x + pblk->pb_w - 1;
|
||||
xy[3] = pblk->pb_y + pblk->pb_h - 1;
|
||||
|
||||
vsf_color( win->graf->handle, LCYAN);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y;
|
||||
xy[2] = pblk->pb_x;
|
||||
xy[3] = pblk->pb_y + pblk->pb_h - 1;
|
||||
xy[4] = pblk->pb_x + pblk->pb_w - 1;
|
||||
xy[5] = xy[3];
|
||||
xy[6] = xy[4];
|
||||
xy[7] = pblk->pb_y;
|
||||
xy[8] = pblk->pb_x;
|
||||
xy[9] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, BLACK);
|
||||
v_pline( win->graf->handle, 5, xy);
|
||||
|
||||
x = x_space + 2;
|
||||
|
||||
if( tmp_show_system_info)
|
||||
{
|
||||
tmp_cpu_x = x;
|
||||
x += ( bar_width + 2);
|
||||
|
||||
tmp_st_x = x;
|
||||
x += ( bar_width + 2);
|
||||
|
||||
tmp_tt_x = x;
|
||||
x += ( bar_width + x_space);
|
||||
}
|
||||
|
||||
if( tmp_show_clock == TRUE)
|
||||
{
|
||||
tmp_clock_x = x;
|
||||
|
||||
if( tmp_clock_us == FALSE)
|
||||
text_width = get_text_width( "22:37:05");
|
||||
else
|
||||
text_width = get_text_width( "10:37:05 PM");
|
||||
|
||||
x += ( text_width + x_space);
|
||||
}
|
||||
|
||||
tmp_geek_area_width = x + 1;
|
||||
|
||||
tmp_y_text_pos = pblk->pb_y + pblk->pb_h - 15;
|
||||
|
||||
tmp_w_pos = tmp_geek_area_width + ( 2 * tmp_app_width) + 23;
|
||||
tmp_x_pos = pblk->pb_x + ( pblk->pb_w - tmp_w_pos) - 1;
|
||||
tmp_y_pos = pblk->pb_y + pblk->pb_h - 22;
|
||||
|
||||
|
||||
tmp_geek_area_x = tmp_x_pos + tmp_w_pos - tmp_geek_area_width;
|
||||
|
||||
/* we draw the menu area */
|
||||
xy[0] = tmp_x_pos;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0] + 23;
|
||||
xy[3] = xy[1] + 20;
|
||||
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_button_off_background);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[1] = xy[3];
|
||||
xy[2] = xy[0];
|
||||
xy[3] = tmp_y_pos;
|
||||
xy[4] = xy[0] + 22;
|
||||
xy[5] = tmp_y_pos;
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_off_light_color);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[0] = xy[4] + 1;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = xy[1] + 20;
|
||||
xy[4] = tmp_x_pos;
|
||||
xy[5] = xy[3];
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_off_dark_color);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
// icons[ICONS_MENU].ob_x = xw + 4;
|
||||
// icons[ICONS_MENU].ob_y = y_pos + 2;
|
||||
|
||||
// mt_objc_draw( icons, ICONS_MENU, 1, win->graf->clip.g_x, win->graf->clip.g_y, win->graf->clip.g_w, win->graf->clip.g_h, app.aes_global);
|
||||
|
||||
tmp_x_pos += 24;
|
||||
|
||||
xy[0] = tmp_x_pos;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0] + tmp_app_width - 1;
|
||||
xy[3] = xy[1] + 20;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_button_on_background);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[1] = xy[3];
|
||||
xy[2] = xy[0];
|
||||
xy[3] = tmp_y_pos;
|
||||
xy[4] = xy[0] + tmp_app_width - 2;
|
||||
xy[5] = tmp_y_pos;
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_on_dark_color);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[0] = xy[4] + 1;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = xy[1] + 20;
|
||||
xy[4] = tmp_x_pos;
|
||||
xy[5] = xy[3];
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_on_light_color);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
draw_text( win->graf->handle, tmp_x_pos + 21, tmp_y_text_pos + 1, ( int16)tmp_button_on_text_shadow_color, "Dummy");
|
||||
draw_text( win->graf->handle, tmp_x_pos + 20, tmp_y_text_pos, ( int16)tmp_button_on_text_color, "Dummy");
|
||||
|
||||
tmp_x_pos += tmp_app_width;
|
||||
|
||||
xy[0] = tmp_x_pos;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0] + tmp_app_width - 1;
|
||||
xy[3] = xy[1] + 20;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_button_off_background);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[1] = xy[3];
|
||||
xy[2] = xy[0];
|
||||
xy[3] = tmp_y_pos;
|
||||
xy[4] = xy[0] + tmp_app_width - 2;
|
||||
xy[5] = tmp_y_pos;
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_off_light_color);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[0] = xy[4] + 1;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = xy[1] + 20;
|
||||
xy[4] = tmp_x_pos;
|
||||
xy[5] = xy[3];
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_off_dark_color);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
draw_text( win->graf->handle, tmp_x_pos + 21, tmp_y_text_pos + 1, ( int16)tmp_button_off_text_shadow_color, "Dummy");
|
||||
draw_text( win->graf->handle, tmp_x_pos + 20, tmp_y_text_pos, ( int16)tmp_button_off_text_color, "Dummy");
|
||||
|
||||
tmp_x_pos += tmp_app_width;
|
||||
|
||||
|
||||
|
||||
/* draw the "geek" area */
|
||||
xy[0] = tmp_x_pos + 2;
|
||||
xy[1] = tmp_y_pos + 2;
|
||||
xy[2] = xy[0] + tmp_geek_area_width - 6;
|
||||
xy[3] = xy[1] + 16;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_geek_area_color);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = tmp_x_pos;
|
||||
xy[1] = tmp_y_pos;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = xy[1] + 20;
|
||||
xy[4] = xy[2] + tmp_geek_area_width - 2;
|
||||
xy[5] = xy[3];
|
||||
xy[6] = xy[4];
|
||||
xy[7] = xy[1];
|
||||
xy[8] = xy[0];
|
||||
xy[9] = xy[1];
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_button_off_background);
|
||||
v_pline( win->graf->handle, 5, xy);
|
||||
|
||||
xy[0]++;
|
||||
xy[1] = xy[3] - 1;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = tmp_y_pos + 1;
|
||||
xy[4]--;
|
||||
xy[5] = xy[3];
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_geek_area_dark_line);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[2] = xy[4];
|
||||
xy[3] = xy[1];
|
||||
xy[5] = tmp_y_pos + 2;
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)tmp_geek_area_light_line);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
|
||||
/* draw the cpu % in the "geek" area */
|
||||
if( tmp_show_system_info)
|
||||
{
|
||||
/* the CPU usage */
|
||||
xy[0] = tmp_cpu_x + tmp_geek_area_x;
|
||||
xy[1] = tmp_y_pos + 3;
|
||||
xy[2] = xy[0] + bar_width - 1;
|
||||
xy[3] = xy[1] + 14;
|
||||
|
||||
vsf_color( win->graf->handle, BLACK);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = xy[0] + 1;
|
||||
xy[2] = xy[2] - 1;
|
||||
xy[3] = tmp_y_pos + 16;
|
||||
xy[1] = tmp_y_pos + 9;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_cpu_bar_color);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
/* the STRAM usage */
|
||||
xy[0] = tmp_st_x + tmp_geek_area_x;
|
||||
xy[1] = tmp_y_pos + 3;
|
||||
xy[2] = xy[0] + bar_width - 1;
|
||||
xy[3] = xy[1] + 14;
|
||||
|
||||
vsf_color( win->graf->handle, BLACK);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = xy[0] + 1;
|
||||
xy[2] = xy[2] - 1;
|
||||
xy[3] = tmp_y_pos + 16;
|
||||
xy[1] = tmp_y_pos + 9;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_st_bar_color);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = tmp_tt_x + tmp_geek_area_x;
|
||||
xy[1] = tmp_y_pos + 3;
|
||||
xy[2] = xy[0] + bar_width - 1;
|
||||
xy[3] = xy[1] + 14;
|
||||
|
||||
vsf_color( win->graf->handle, BLACK);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
|
||||
xy[0] = xy[0] + 1;
|
||||
xy[2] = xy[2] - 1;
|
||||
xy[3] = tmp_y_pos + 16;
|
||||
xy[1] = tmp_y_pos + 9;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tmp_tt_bar_color);
|
||||
v_bar( win->graf->handle, xy);
|
||||
}
|
||||
|
||||
if( tmp_show_clock == TRUE)
|
||||
{
|
||||
if( tmp_clock_us == FALSE)
|
||||
draw_text( win->graf->handle, tmp_clock_x + tmp_geek_area_x, tmp_y_text_pos, BLACK, "22:37:05");
|
||||
else
|
||||
draw_text( win->graf->handle, tmp_clock_x + tmp_geek_area_x, tmp_y_text_pos, BLACK, "10:37:05 PM");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void CDECL draw_color_case( WINDOW *win, PARMBLK *pblk, void *data)
|
||||
{
|
||||
tmp = ( int*)data;
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y;
|
||||
xy[2] = xy[0] + 127;
|
||||
xy[3] = xy[1] + 127;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)*tmp);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y;
|
||||
xy[2] = pblk->pb_x;
|
||||
xy[3] = pblk->pb_y + pblk->pb_h - 1;
|
||||
xy[4] = pblk->pb_x + pblk->pb_w - 1;
|
||||
xy[5] = xy[3];
|
||||
xy[6] = xy[4];
|
||||
xy[7] = pblk->pb_y;
|
||||
xy[8] = pblk->pb_x;
|
||||
xy[9] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, BLACK);
|
||||
v_pline( win->graf->handle, 5, xy);
|
||||
}
|
||||
|
||||
|
||||
void pref_dialog( void)
|
||||
{
|
||||
WINDOW *win;
|
||||
int frms[] = { PREFS_PANEL1, PREFS_PANEL2};
|
||||
int buts[] = { PREFS_COLOR, PREFS_MISC};
|
||||
|
||||
dial = get_tree( PREFS);
|
||||
|
||||
tmp_button_off_background = button_off_background;
|
||||
tmp_button_off_light_color = button_off_light_color;
|
||||
tmp_button_off_dark_color = button_off_dark_color;
|
||||
tmp_button_off_text_color = button_off_text_color;
|
||||
tmp_button_off_text_shadow_color = button_off_text_shadow_color;
|
||||
tmp_button_on_background = button_on_background;
|
||||
tmp_button_on_light_color = button_on_light_color;
|
||||
tmp_button_on_dark_color = button_on_dark_color;
|
||||
tmp_button_on_text_color = button_on_text_color;
|
||||
tmp_button_on_text_shadow_color = button_on_text_shadow_color;
|
||||
tmp_geek_area_color = geek_area_color;
|
||||
tmp_geek_area_dark_line = geek_area_dark_line;
|
||||
tmp_geek_area_light_line = geek_area_light_line;
|
||||
tmp_app_width = app_width;
|
||||
tmp_cpu_bar_color = cpu_bar_color;
|
||||
tmp_tt_bar_color = tt_bar_color;
|
||||
tmp_st_bar_color = st_bar_color;
|
||||
tmp_show_clock = show_clock;
|
||||
tmp_clock_us = clock_us;
|
||||
tmp_show_system_info = show_system_info;
|
||||
tmp_show_acc = show_acc;
|
||||
|
||||
|
||||
if( ( win = FormCreate( dial, NAME|MOVER, NULL, "Preferences", NULL, TRUE, FALSE)) == NULL)
|
||||
return;
|
||||
|
||||
dial = FORM( win);
|
||||
|
||||
FormThumb( win, frms, buts, 2);
|
||||
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_ON_BACK, draw_color_case, &tmp_button_on_background);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_ON_LINE1, draw_color_case, &tmp_button_on_light_color);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_ON_LINE2, draw_color_case, &tmp_button_on_dark_color);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_ON_TEXT1, draw_color_case, &tmp_button_on_text_color);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_ON_TEXT2, draw_color_case, &tmp_button_on_text_shadow_color);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_OFF_BACK, draw_color_case, &tmp_button_off_background);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_OFF_LINE1, draw_color_case, &tmp_button_off_light_color);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_OFF_LINE2, draw_color_case, &tmp_button_off_dark_color);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_OFF_TEXT1, draw_color_case, &tmp_button_off_text_color);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_OFF_TEXT2, draw_color_case, &tmp_button_off_text_shadow_color);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_GEEK_BACK, draw_color_case, &tmp_geek_area_color);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_GEEK_LINE1, draw_color_case, &tmp_geek_area_light_line);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_GEEK_LINE2, draw_color_case, &tmp_geek_area_dark_line);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_GEEK_RAM1, draw_color_case, &tmp_st_bar_color);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_GEEK_RAM2, draw_color_case, &tmp_tt_bar_color);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_GEEK_CPU, draw_color_case, &tmp_cpu_bar_color);
|
||||
RsrcUserDraw( OC_FORM, win, PREFS_PREVIEW, draw_preview, NULL);
|
||||
|
||||
WindSet( win, WF_BEVENT, BEVENT_MODAL, 0, 0, 0);
|
||||
ObjcAttachFormFunc( win, PREFS_OK, pref_dialog_ok_event, NULL);
|
||||
ObjcAttachFormFunc( win, PREFS_CANCEL, pref_dialog_cancel_event, NULL);
|
||||
ObjcAttachVar( OC_FORM, win, PREFS_SHOW_US_CLOCK, &tmp_clock_us, 1);
|
||||
ObjcAttachVar( OC_FORM, win, PREFS_SHOW_ACC, &tmp_show_acc, 1);
|
||||
ObjcAttachVar( OC_FORM, win, PREFS_SYSTEM_INFO, &tmp_show_system_info, 1);
|
||||
ObjcAttachVar( OC_FORM, win, PREFS_SHOW_CLOCK, &tmp_show_clock, 1);
|
||||
}
|
||||
|
||||
354
sources/z-tools/trunk/ztask/prefs.c
Normal file
354
sources/z-tools/trunk/ztask/prefs.c
Normal file
@@ -0,0 +1,354 @@
|
||||
#include "general.h"
|
||||
|
||||
int button_off_background = 8;
|
||||
int button_off_light_color = 250;
|
||||
int button_off_dark_color = 252;
|
||||
int button_off_text_color = 255;
|
||||
int button_off_text_shadow_color = 250;
|
||||
int button_on_background = 252;
|
||||
int button_on_light_color = 8;
|
||||
int button_on_dark_color = 144;
|
||||
int button_on_text_color = 1;
|
||||
int button_on_text_shadow_color = 251;
|
||||
int geek_area_text_color = 1;
|
||||
int geek_area_color = 252;
|
||||
int geek_area_dark_line = 144;
|
||||
int geek_area_light_line = 250;
|
||||
int app_width = 72;
|
||||
int cpu_bar_color = 146;
|
||||
int tt_bar_color = 73;
|
||||
int st_bar_color = 106;
|
||||
int show_clock = TRUE;
|
||||
int clock_us = FALSE;
|
||||
int show_system_info = TRUE;
|
||||
int show_acc = TRUE;
|
||||
|
||||
/* Prototype */
|
||||
int prefs_read( void);
|
||||
int prefs_write( void);
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* prefs_read: *
|
||||
* Reads the content of the INF file an put it in the preference global variables. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: 0 if error *
|
||||
*==================================================================================*/
|
||||
int prefs_read( void)
|
||||
{
|
||||
char filename[256] = "";
|
||||
char unknown_s[256] = "";
|
||||
FILE *inffile;
|
||||
int32 filepos;
|
||||
char *env_home;
|
||||
int16 len;
|
||||
boolean valid_entry_found;
|
||||
|
||||
shel_envrn( &env_home, "HOME=");
|
||||
|
||||
/* Home directory exist? */
|
||||
if ( env_home != NULL)
|
||||
{
|
||||
strcpy( filename, env_home);
|
||||
len = ( int16)strlen( filename);
|
||||
|
||||
if ((filename[len - 1] != '\\') && (filename[len - 1] != '/'))
|
||||
{
|
||||
strcat( filename, "\\");
|
||||
}
|
||||
|
||||
strcat( filename, "ztask.inf");
|
||||
|
||||
if (( inffile = fopen( filename, "rb+")) != NULL)
|
||||
goto loop;
|
||||
|
||||
}
|
||||
|
||||
/* With ftell, we MUST open the file in binary mode and not in text mode !!! */
|
||||
if (( inffile = fopen( "ztask.inf", "rb+")) == NULL)
|
||||
{
|
||||
if( app.nplanes < 8)
|
||||
{
|
||||
button_off_light_color = WHITE;
|
||||
button_off_dark_color = LBLACK;
|
||||
button_off_text_color = BLACK;
|
||||
button_off_text_shadow_color = WHITE;
|
||||
button_on_background = LBLACK;
|
||||
button_on_light_color = LWHITE;
|
||||
button_on_dark_color = BLACK;
|
||||
button_on_text_color = BLACK;
|
||||
button_on_text_shadow_color = LWHITE;
|
||||
geek_area_color = LWHITE;
|
||||
geek_area_dark_line = LBLACK;
|
||||
geek_area_light_line = WHITE;
|
||||
cpu_bar_color = CYAN;
|
||||
tt_bar_color = BLUE;
|
||||
st_bar_color = RED;
|
||||
}
|
||||
|
||||
return( 0);
|
||||
}
|
||||
|
||||
loop:
|
||||
|
||||
do
|
||||
{
|
||||
valid_entry_found = FALSE;
|
||||
|
||||
filepos = ftell( inffile);
|
||||
|
||||
if ( fscanf( inffile, "button_off_background=%d ", &button_off_background) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if (fscanf( inffile, "button_off_light_color=%d ", &button_off_light_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "button_off_dark_color=%d ", &button_off_dark_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if (fscanf( inffile, "button_off_text_color=%d ", &button_off_text_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "button_off_text_shadow_color=%d ", &button_off_text_shadow_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "button_on_background=%d ", &button_on_background) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if (fscanf( inffile, "button_on_light_color=%d ", &button_on_light_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "button_on_dark_color=%d ", &button_on_dark_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if (fscanf( inffile, "button_on_text_color=%d ", &button_on_text_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "button_on_text_shadow_color=%d ", &button_on_text_shadow_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "geek_area_text_color=%d ", &geek_area_text_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
|
||||
if ( fscanf( inffile, "geek_area_color=%d ", &geek_area_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
|
||||
if ( fscanf( inffile, "geek_area_dark_line=%d ", &geek_area_dark_line) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "geek_area_light_line=%d ", &geek_area_light_line) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "app_width=%d ", &app_width) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
|
||||
if ( fscanf( inffile, "cpu_bar_color=%d ", &cpu_bar_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
|
||||
if ( fscanf( inffile, "tt_bar_color=%d ", &tt_bar_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "st_bar_color=%d ", &st_bar_color) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "show_clock=%d ", &show_clock) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "clock_us=%d ", &clock_us) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "show_system_info=%d ", &show_system_info) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "show_acc=%d ", &show_acc) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
if ( fscanf( inffile, "%s ", unknown_s) == 1)
|
||||
{
|
||||
valid_entry_found = TRUE;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
fseek( inffile, filepos, SEEK_SET);
|
||||
|
||||
} while ( valid_entry_found);
|
||||
|
||||
fclose( inffile);
|
||||
|
||||
return( 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* prefs_write: *
|
||||
* Writes the preference variables in the preference file. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: 0 if error *
|
||||
*==================================================================================*/
|
||||
int prefs_write( void)
|
||||
{
|
||||
char filename[256] = "ztask.inf";
|
||||
FILE *inffile;
|
||||
char *env_home;
|
||||
int16 len;
|
||||
|
||||
shel_envrn( &env_home, "HOME=");
|
||||
|
||||
/* Home directory exist? */
|
||||
if ( env_home != NULL)
|
||||
{
|
||||
strcpy( filename, env_home);
|
||||
|
||||
len = ( int16)strlen( filename);
|
||||
|
||||
if ((filename[len - 1] != '\\') && (filename[len - 1] != '/'))
|
||||
strcat( filename, "\\");
|
||||
|
||||
strcat( filename, "ztask.inf");
|
||||
}
|
||||
|
||||
/* With ftell, we MUST open the file in binary mode and not in text mode !!! */
|
||||
if (( inffile = fopen( filename, "wb+")) == NULL)
|
||||
return( 0);
|
||||
|
||||
fprintf( inffile, "button_off_background=%d\r\n", button_off_background);
|
||||
fprintf( inffile, "button_off_light_color=%d\r\n", button_off_light_color);
|
||||
fprintf( inffile, "button_off_dark_color=%d\r\n", button_off_dark_color);
|
||||
fprintf( inffile, "button_off_text_color=%d\r\n", button_off_text_color);
|
||||
fprintf( inffile, "button_off_text_shadow_color=%d\r\n", button_off_text_shadow_color);
|
||||
fprintf( inffile, "button_on_background=%d\r\n", button_on_background);
|
||||
fprintf( inffile, "button_on_light_color=%d\r\n", button_on_light_color);
|
||||
fprintf( inffile, "button_on_dark_color=%d\r\n", button_on_dark_color);
|
||||
fprintf( inffile, "button_on_text_color=%d\r\n", button_on_text_color);
|
||||
fprintf( inffile, "button_on_text_shadow_color=%d\r\n", button_on_text_shadow_color);
|
||||
fprintf( inffile, "geek_area_text_color=%d\r\n", geek_area_text_color);
|
||||
fprintf( inffile, "geek_area_color=%d\r\n", geek_area_color);
|
||||
fprintf( inffile, "geek_area_dark_line=%d\r\n", geek_area_dark_line);
|
||||
fprintf( inffile, "geek_area_light_line=%d\r\n", geek_area_light_line);
|
||||
fprintf( inffile, "app_width=%d\r\n", app_width);
|
||||
fprintf( inffile, "cpu_bar_color=%d\r\n", cpu_bar_color);
|
||||
fprintf( inffile, "tt_bar_color=%d\r\n", tt_bar_color);
|
||||
fprintf( inffile, "st_bar_color=%d\r\n", st_bar_color);
|
||||
fprintf( inffile, "show_clock=%d\r\n", show_clock);
|
||||
fprintf( inffile, "clock_us=%d\r\n", clock_us);
|
||||
fprintf( inffile, "show_system_info=%d\r\n", show_system_info);
|
||||
fprintf( inffile, "show_acc=%d\r\n", show_acc);
|
||||
fclose( inffile);
|
||||
|
||||
return( 1);
|
||||
}
|
||||
30
sources/z-tools/trunk/ztask/prefs.h
Normal file
30
sources/z-tools/trunk/ztask/prefs.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Global variable */
|
||||
extern int button_off_background;
|
||||
extern int button_on_background;
|
||||
extern int button_on_light_color;
|
||||
extern int button_off_light_color;
|
||||
extern int button_on_dark_color;
|
||||
extern int button_off_dark_color;
|
||||
extern int button_on_text_color;
|
||||
extern int button_on_text_shadow_color;
|
||||
extern int button_off_text_color;
|
||||
extern int button_off_text_shadow_color;
|
||||
extern int geek_area_text_color;
|
||||
extern int geek_area_color;
|
||||
extern int geek_area_dark_line;
|
||||
extern int geek_area_light_line;
|
||||
extern int app_width;
|
||||
extern int cpu_bar_color;
|
||||
extern int tt_bar_color;
|
||||
extern int st_bar_color;
|
||||
extern int show_clock;
|
||||
extern int clock_us;
|
||||
extern int show_system_info;
|
||||
extern int show_acc;
|
||||
|
||||
|
||||
/* Function */
|
||||
extern int prefs_read( void);
|
||||
extern int prefs_write( void);
|
||||
|
||||
|
||||
230
sources/z-tools/trunk/ztask/process.c
Normal file
230
sources/z-tools/trunk/ztask/process.c
Normal file
@@ -0,0 +1,230 @@
|
||||
#include "general.h"
|
||||
#include "gmem.h"
|
||||
#include "string.h"
|
||||
#include "cpu.h"
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/vfs.h>
|
||||
|
||||
process *process_root = NULL;
|
||||
int process_nbr = 0;
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* process_attach: *
|
||||
* attach a entry in the global process list. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* pid: The PID of the application. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* the processe created or NULL *
|
||||
*==================================================================================*/
|
||||
|
||||
process *process_attach( int pid)
|
||||
{
|
||||
process *new = ( process *)gmalloc( sizeof(process));
|
||||
|
||||
if( !new)
|
||||
return NULL;
|
||||
|
||||
new -> pid = pid;
|
||||
new -> next = process_root;
|
||||
new->cpu_time = 0;
|
||||
|
||||
process_root = new;
|
||||
|
||||
process_nbr++;
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* process_find_parent: *
|
||||
* find the parent( previous) entry in the process list. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* child: the function returns the parent of this entry. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* the parent entry else the root entry. *
|
||||
*==================================================================================*/
|
||||
process *process_find_parent( process *child)
|
||||
{
|
||||
process *scan = process_root;
|
||||
|
||||
while( scan)
|
||||
{
|
||||
if( scan->next != child)
|
||||
{
|
||||
scan = scan->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return( scan);
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* process_delete: *
|
||||
* Delete an entry in the process list. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* pid: the pid of the entry to delete. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
void process_delete( int pid)
|
||||
{
|
||||
process *scan = process_root, *parent;
|
||||
|
||||
while( scan)
|
||||
{
|
||||
if( scan->pid != pid)
|
||||
{
|
||||
scan = scan->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
parent = process_find_parent( scan);
|
||||
|
||||
if( parent == NULL)
|
||||
process_root = scan->next;
|
||||
else
|
||||
parent->next = scan->next;
|
||||
|
||||
gfree( scan);
|
||||
process_nbr--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* process_find: *
|
||||
* Find an entry in the process list. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* id: the pid of the entry to find. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* the entry or NULL if not found. *
|
||||
*==================================================================================*/
|
||||
process *process_find( int pid)
|
||||
{
|
||||
process *scan = process_root, *result = NULL;
|
||||
|
||||
while( scan)
|
||||
{
|
||||
if( scan->pid != pid)
|
||||
{
|
||||
scan = scan->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
result = scan;
|
||||
break;
|
||||
}
|
||||
|
||||
return( result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* scan_process: *
|
||||
* Make a list of all the process and add it in the global process list if *
|
||||
* necessary. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* input: *
|
||||
* -- *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: *
|
||||
* -- *
|
||||
*==================================================================================*/
|
||||
void scan_process( void)
|
||||
{
|
||||
int pid, count = 0;
|
||||
uint32 old_cpu_time;
|
||||
DIR *dir;
|
||||
char *dirname;
|
||||
char buf[128];
|
||||
struct dirent *de;
|
||||
process *current_process = NULL, *scan;
|
||||
clock_t current_t, relative_t;
|
||||
static clock_t old_t = 0;
|
||||
|
||||
current_t = clock();
|
||||
|
||||
relative_t = current_t - old_t;
|
||||
|
||||
old_t = current_t;
|
||||
|
||||
if (( dir = opendir( "U:/kern")) == NULL)
|
||||
return;
|
||||
|
||||
while(( de = readdir( dir)) != NULL)
|
||||
{
|
||||
dirname = de->d_name;
|
||||
|
||||
if( dirname[0] != '1' && dirname[0] != '2' && dirname[0] != '3' && dirname[0] != '4' && dirname[0] != '5'
|
||||
&& dirname[0] != '6' && dirname[0] != '7' && dirname[0] != '8' && dirname[0] != '9')
|
||||
continue;
|
||||
|
||||
count++;
|
||||
|
||||
pid = atoi( dirname);
|
||||
|
||||
current_process = process_find( pid);
|
||||
|
||||
// Is already listed?
|
||||
if( current_process == NULL)
|
||||
current_process = process_attach( pid);
|
||||
|
||||
old_cpu_time = current_process->cpu_time;
|
||||
|
||||
get_info_by_pid( pid, current_process->name, current_process->ram_usage, ¤t_process->cpu_time);
|
||||
|
||||
sprintf( current_process->cpu_usage, "%lu", ((current_process->cpu_time - old_cpu_time) * 20) / relative_t);
|
||||
|
||||
current_process->ram_usage_txt_width = get_text_width( current_process->ram_usage);
|
||||
}
|
||||
|
||||
closedir( dir);
|
||||
|
||||
if( count != process_nbr)
|
||||
{
|
||||
scan = process_root;
|
||||
|
||||
while( scan != NULL)
|
||||
{
|
||||
sprintf( buf, "U:/kern/%d", scan->pid);
|
||||
|
||||
if (( dir = opendir( buf)) == NULL)
|
||||
{
|
||||
pid = scan->pid;
|
||||
scan = scan->next;
|
||||
process_delete( pid);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
closedir( dir);
|
||||
|
||||
scan = scan->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
4
sources/z-tools/trunk/ztask/process.h
Normal file
4
sources/z-tools/trunk/ztask/process.h
Normal file
@@ -0,0 +1,4 @@
|
||||
extern process *process_root;
|
||||
extern int process_nbr;
|
||||
extern void process_delete( int pid);
|
||||
extern void scan_process( void);
|
||||
26
sources/z-tools/trunk/ztask/quit.c
Normal file
26
sources/z-tools/trunk/ztask/quit.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "general.h"
|
||||
|
||||
static void quit_dialog_cancel_event( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
ObjcChange( OC_FORM, win, obj, NORMAL, TRUE);
|
||||
ApplWrite( _AESapid, WM_DESTROY, win->handle, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
static void quit_dialog_ok_event( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
ObjcChange( OC_FORM, win, obj, NORMAL, TRUE);
|
||||
ApplWrite( _AESapid, AP_TERM, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
void quit_dialog( void)
|
||||
{
|
||||
WINDOW *win;
|
||||
|
||||
if( ( win = FormCreate( get_tree( QUIT), NAME|MOVER, NULL, "", NULL, TRUE, FALSE)) == NULL)
|
||||
return;
|
||||
|
||||
WindSet( win, WF_BEVENT, BEVENT_MODAL, 0, 0, 0);
|
||||
ObjcAttachFormFunc( win, QUIT_YES, quit_dialog_ok_event, NULL);
|
||||
ObjcAttachFormFunc( win, QUIT_NO, quit_dialog_cancel_event, NULL);
|
||||
}
|
||||
34
sources/z-tools/trunk/ztask/shutdown.c
Normal file
34
sources/z-tools/trunk/ztask/shutdown.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "general.h"
|
||||
|
||||
static int shutdown_mode = SHUTDOWN_DIAL_HALT;
|
||||
|
||||
|
||||
static void shutdown_dialog_cancel_event( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
ObjcChange( OC_FORM, win, obj, NORMAL, TRUE);
|
||||
ApplWrite( _AESapid, WM_DESTROY, win->handle, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
static void shutdown_dialog_ok_event( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
ObjcChange( OC_FORM, win, obj, NORMAL, TRUE);
|
||||
ApplWrite( _AESapid, WM_DESTROY, win->handle, 0, 0, 0, 0);
|
||||
Shutdown(( long)shutdown_mode);
|
||||
}
|
||||
|
||||
|
||||
void shutdown_dialog( void)
|
||||
{
|
||||
WINDOW *win;
|
||||
|
||||
if( ( win = FormCreate( get_tree( SHUTDOWN_DIAL), NAME|MOVER, NULL, get_string( S_SHUTDOWN), NULL, TRUE, FALSE)) == NULL)
|
||||
return;
|
||||
|
||||
ObjcAttachVar( OC_FORM, win, SHUTDOWN_DIAL_WARN, &shutdown_mode, 1);
|
||||
ObjcAttachVar( OC_FORM, win, SHUTDOWN_DIAL_COLD, &shutdown_mode, 2);
|
||||
ObjcAttachVar( OC_FORM, win, SHUTDOWN_DIAL_HALT, &shutdown_mode, 0);
|
||||
|
||||
ObjcAttachFormFunc( win, SHUTDOWN_DIAL_OK, shutdown_dialog_ok_event, NULL);
|
||||
ObjcAttachFormFunc( win, SHUTDOWN_DIAL_CANCEL, shutdown_dialog_cancel_event, NULL);
|
||||
}
|
||||
|
||||
180
sources/z-tools/trunk/ztask/string.c
Normal file
180
sources/z-tools/trunk/ztask/string.c
Normal file
@@ -0,0 +1,180 @@
|
||||
#include "general.h"
|
||||
#include "font_8.h"
|
||||
|
||||
void trim_start( char *name)
|
||||
{
|
||||
while( name[0] == ' ')
|
||||
// memcpy( name, name + 1, strlen( name));
|
||||
strcpy( name, name + 1);
|
||||
}
|
||||
|
||||
|
||||
void trim_end( char *name, int16 len)
|
||||
{
|
||||
while( name[len] == ' ')
|
||||
name[len--] = '\0';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* zstrncpy: *
|
||||
* Copy <n> bytes from <src> to <dst>, including the terminating \0'-byte. * *
|
||||
* If <src> is longer than <n-1>, it will be truncated with a '\0'-byte at *
|
||||
* position n-1. *
|
||||
* Example: zstrncpy(b, "string", 1) would put a '\0'-byte at b[0] and *
|
||||
* return. *
|
||||
* Basically, think of the <n> as a limiter on the number of bytes at <dst> *
|
||||
* we're allowed to touch, and then fit a string-copying idea on top of that. *
|
||||
* Works for me, and a lot better than the standard strncpy(), too. *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* returns: <dst> *
|
||||
*----------------------------------------------------------------------------------*
|
||||
* dst: Pointer to destination text. *
|
||||
* src: Pointer to source text. *
|
||||
* n: Limiter on the number of bytes at <dst> *
|
||||
*==================================================================================*/
|
||||
char *zstrncpy( char *dst, const char *src, size_t n)
|
||||
{
|
||||
register const char *source = src;
|
||||
register char *dest = dst;
|
||||
register size_t count = n;
|
||||
|
||||
if( dest && !source && count)
|
||||
*dest = '\0';
|
||||
else if( dest && source && (count >= 1))
|
||||
{
|
||||
for( count--; count > 0 && *source != '\0'; count--)
|
||||
*dest++ = *source++;
|
||||
*dest = '\0';
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline void draw_text_to_buffer( int16 xf, int16 yf, int32 src_line_octets, const char *str, MFDB *bm)
|
||||
{
|
||||
int16 c, character_pixel_skip = 0;
|
||||
int32 src_line_word = src_line_octets >> 1;
|
||||
|
||||
while ( (c = *str++) != 0)
|
||||
{
|
||||
int xpos = xf + character_pixel_skip;
|
||||
int xpos_octet = xpos >> 3;
|
||||
register int pixel_shift = xpos - ( xpos_octet << 3);
|
||||
register char *character = (char*)&my_font_8[(c - 1) << 2];
|
||||
register int i;
|
||||
|
||||
if( pixel_shift == 0)
|
||||
{
|
||||
register char *dest = bm->fd_addr + ( yf * src_line_octets) + xpos_octet;
|
||||
|
||||
for( i = 0; i < 8; i++)
|
||||
{
|
||||
*dest = *character++;
|
||||
dest += src_line_octets;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
register short *dest = ( short*)( bm->fd_addr + ( yf * src_line_octets) + xpos_octet);
|
||||
|
||||
for( i = 0; i < 8; i++)
|
||||
{
|
||||
*dest |= (( *character++) << 8) >> pixel_shift;
|
||||
dest += src_line_word;
|
||||
}
|
||||
}
|
||||
|
||||
character_pixel_skip += ofwf[c];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw_text( int16 vdih, int16 xf, int16 yf, int16 color, const char *str)
|
||||
{
|
||||
MFDB pic, screen = {0};
|
||||
short fx_mem[16], sys_pxy[8] = { 0, 0, 0, 7, xf, yf, 0, yf + 7}, c, char_width, tcolor[2] = { color, WHITE};
|
||||
|
||||
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;
|
||||
|
||||
while ( (c = *str++) != 0)
|
||||
{
|
||||
register char *model = (char*)&my_font_8[(c - 1) << 2] ;
|
||||
register 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline int16 get_text_width( const char *str)
|
||||
{
|
||||
register 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
11
sources/z-tools/trunk/ztask/string.h
Normal file
11
sources/z-tools/trunk/ztask/string.h
Normal file
@@ -0,0 +1,11 @@
|
||||
extern void draw_text( int16 vdih, int16 xf, int16 yf, int16 color, const char *str);
|
||||
extern inline void draw_text_to_buffer( int16 xf, int16 yf, int32 src_line_octets, const char *str, MFDB *bm);
|
||||
extern inline int16 get_text_width( const char *str);
|
||||
extern int16 name_shorter( int16 max_size, char *str);
|
||||
extern char *zstrncpy( char *dst, const char *src, size_t n);
|
||||
extern void trim_start( char *name);
|
||||
extern void trim_end( char *name, int16 len);
|
||||
|
||||
|
||||
|
||||
|
||||
612
sources/z-tools/trunk/ztask/taskman.c
Normal file
612
sources/z-tools/trunk/ztask/taskman.c
Normal file
@@ -0,0 +1,612 @@
|
||||
#include "general.h"
|
||||
#include "win.h"
|
||||
#include "process.h"
|
||||
#include "gmem.h"
|
||||
#include "string.h"
|
||||
#include <math.h>
|
||||
#include <signal.h>
|
||||
|
||||
WINDOW *taskman_win = NULL;
|
||||
static void *thumb = NULL;
|
||||
process *process_loop, *process_selected = NULL;
|
||||
MFDB cpu_average_background = {0}, process_list_buffer = {0};
|
||||
static int16 wanted_color[2] = { BLACK, LGREEN}, txt_color[2] = { BLACK, WHITE}, selected_txt_color[2] = { BLACK, LWHITE}, xy[8], x, i, ii, dum, res, cpu_history_point[202];
|
||||
static OBJECT *dial = NULL;
|
||||
uint32 old_stram, old_ttram, process_list_buffer_lenght;
|
||||
int32 uptime, loadaverage[3], updays, tmpdays, uphours, tmphours, upmins, upsecs, ypos, ypos_max;
|
||||
static MFDB screen = {0};
|
||||
float slider_pos = 0.0, slider_step = 0.0;
|
||||
|
||||
|
||||
/*==================================================================================*
|
||||
* 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. *
|
||||
*==================================================================================*/
|
||||
uint32 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( length - 256);
|
||||
|
||||
bm->fd_addr = NULL;
|
||||
|
||||
return ( 0);
|
||||
}
|
||||
|
||||
|
||||
static void CDECL taskman_win_mouse_event( WINDOW *win, int16 buff[8])
|
||||
{
|
||||
int16 ob_x, ob_y;
|
||||
|
||||
if( FormThbGet( thumb, 0) != TASK_PROCESS)
|
||||
return;
|
||||
|
||||
mt_objc_offset( FORM( win), TASK_PROCESS_LIST, &ob_x, &ob_y, app.aes_global);
|
||||
|
||||
if( !IS_IN( evnt.mx, evnt.my, ob_x, ob_y, dial[TASK_PROCESS_LIST].ob_width, dial[TASK_PROCESS_LIST].ob_height))
|
||||
return;
|
||||
|
||||
evnt.my -= ( ob_y + 15);
|
||||
|
||||
process_loop = process_root;
|
||||
|
||||
while( process_loop != NULL)
|
||||
{
|
||||
if(( process_loop->y_pos > evnt.my) && ( process_loop->y_pos < evnt.my + 13))
|
||||
{
|
||||
process_selected = process_loop;
|
||||
break;
|
||||
}
|
||||
|
||||
process_loop = process_loop->next;
|
||||
}
|
||||
|
||||
if( process_selected)
|
||||
{
|
||||
ObjcDraw( OC_FORM, taskman_win, TASK_PROCESS_LIST, 1);
|
||||
|
||||
if( dial[TASK_KILL].ob_state & DISABLED)
|
||||
{
|
||||
ObjcChange( OC_FORM, win, TASK_KILL, ~DISABLED, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CDECL draw_process_list( WINDOW *win, PARMBLK *pblk, void *data)
|
||||
{
|
||||
memset( process_list_buffer.fd_addr, 0, process_list_buffer_lenght);
|
||||
|
||||
i = 0;
|
||||
process_loop = process_root;
|
||||
|
||||
|
||||
while( process_loop != NULL)
|
||||
{
|
||||
process_loop->y_pos = i - ( ypos * 13);
|
||||
|
||||
if(( process_loop->y_pos >= pblk->pb_h - 12) || ( process_loop->y_pos < 0))
|
||||
{
|
||||
process_loop = process_loop->next;
|
||||
i += 13;
|
||||
continue;
|
||||
}
|
||||
|
||||
draw_text_to_buffer( 2, process_loop->y_pos + 3, process_list_buffer.fd_wdwidth << 1, process_loop->name, &process_list_buffer);
|
||||
draw_text_to_buffer( 183, process_loop->y_pos + 3, process_list_buffer.fd_wdwidth << 1, process_loop->cpu_usage, &process_list_buffer);
|
||||
draw_text_to_buffer( pblk->pb_w - ( process_loop->ram_usage_txt_width + 4), process_loop->y_pos + 3, process_list_buffer.fd_wdwidth << 1, process_loop->ram_usage, &process_list_buffer);
|
||||
|
||||
i += 13;
|
||||
|
||||
process_loop = process_loop->next;
|
||||
}
|
||||
|
||||
xy[0] = 0;
|
||||
xy[1] = 0;
|
||||
xy[2] = pblk->pb_w - 1;
|
||||
xy[3] = pblk->pb_h - 1;
|
||||
xy[4] = pblk->pb_x;
|
||||
xy[5] = pblk->pb_y;
|
||||
xy[6] = pblk->pb_x + pblk->pb_w - 1;
|
||||
xy[7] = pblk->pb_y + pblk->pb_h - 1;
|
||||
|
||||
vrt_cpyfm( win->graf->handle, MD_REPLACE, xy, &process_list_buffer, &screen, txt_color);
|
||||
|
||||
if( process_selected != NULL)
|
||||
{
|
||||
if(( process_selected->y_pos >= pblk->pb_h - 12) || ( process_selected->y_pos < 0))
|
||||
return;
|
||||
|
||||
xy[0] = 0;
|
||||
xy[1] = process_selected->y_pos;
|
||||
xy[2] = pblk->pb_w - 1;
|
||||
xy[3] = xy[1] + 12;
|
||||
xy[4] = pblk->pb_x;
|
||||
xy[5] = pblk->pb_y + process_selected->y_pos;
|
||||
xy[6] = pblk->pb_x + pblk->pb_w - 1;
|
||||
xy[7] = xy[5] + 12;
|
||||
vrt_cpyfm( win->graf->handle, MD_REPLACE, xy, &process_list_buffer, &screen, selected_txt_color);
|
||||
}
|
||||
}
|
||||
|
||||
static void calc_process_slider( WINDOW *win)
|
||||
{
|
||||
int16 max_mover_size;
|
||||
int16 full_win_size = ypos_max * 13;
|
||||
|
||||
max_mover_size = dial[TASK_VBACK].ob_height;
|
||||
|
||||
dial[TASK_VMOVER].ob_y = 0;
|
||||
dial[TASK_VMOVER].ob_height = max_mover_size;
|
||||
|
||||
if ( dial[TASK_PROCESS_LIST].ob_height < full_win_size)
|
||||
{
|
||||
float factor = ( float)dial[TASK_PROCESS_LIST].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;
|
||||
dial[TASK_VMOVER].ob_height = ( int16)( mover_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void CDECL taskman_dialog_kill( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
if( process_selected == NULL)
|
||||
return;
|
||||
|
||||
Pkill( process_selected->pid, SIGKILL);
|
||||
ObjcChange( mode, win, obj, ~SELECTED, TRUE);
|
||||
ObjcChange( mode, win, obj, DISABLED, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void CDECL slid_up( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
ObjcChange( mode, win, obj, SELECTED, TRUE);
|
||||
|
||||
do
|
||||
{
|
||||
if ( ypos > 0L)
|
||||
{
|
||||
ypos--;
|
||||
ObjcDraw( OC_FORM, win, TASK_PROCESS_LIST, 1);
|
||||
slider_pos -= slider_step;
|
||||
dial[TASK_VMOVER].ob_y = MAX( 0, ( int16)floor( slider_pos));
|
||||
ObjcDraw( OC_FORM, win, TASK_VBACK, 2);
|
||||
mt_evnt_timer( 100L, app.aes_global);
|
||||
}
|
||||
graf_mkstate( &dum, &dum, &res, &dum);
|
||||
|
||||
} while( res);
|
||||
|
||||
ObjcChange( mode, win, obj, ~SELECTED, TRUE);
|
||||
}
|
||||
|
||||
|
||||
static void CDECL slid_down( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
ObjcChange( mode, win, obj, SELECTED, TRUE);
|
||||
|
||||
do
|
||||
{
|
||||
if (( ypos < ( ypos_max - dial[TASK_PROCESS_LIST].ob_height / 13)) && ( ypos_max > dial[TASK_PROCESS_LIST].ob_height / 13))
|
||||
{
|
||||
ypos ++;
|
||||
ObjcDraw( OC_FORM, win, TASK_PROCESS_LIST, 1);
|
||||
slider_pos += slider_step;
|
||||
dial[TASK_VMOVER].ob_y = ( int16)floor( slider_pos);
|
||||
ObjcDraw( OC_FORM, win, TASK_VBACK, 2);
|
||||
mt_evnt_timer( 100L, app.aes_global);
|
||||
}
|
||||
graf_mkstate( &dum, &dum, &res, &dum);
|
||||
|
||||
} while( res);
|
||||
|
||||
ObjcChange( mode, win, obj, ~SELECTED, TRUE);
|
||||
}
|
||||
|
||||
|
||||
static void CDECL slid_vmover( WINDOW *win, int obj, int mode, void *data)
|
||||
{
|
||||
int32 old_ypos = ypos;
|
||||
|
||||
ObjcChange( mode, win, obj, SELECTED, TRUE);
|
||||
|
||||
graf_mouse( FLAT_HAND, NULL);
|
||||
|
||||
while( !wind_update( BEG_MCTRL));
|
||||
|
||||
res = graf_slidebox( dial, TASK_VBACK, TASK_VMOVER, 1);
|
||||
|
||||
wind_update( END_MCTRL);
|
||||
|
||||
ypos = MAX( 0, ( ypos_max - dial[TASK_PROCESS_LIST].ob_height / 13) * res / 1000L);
|
||||
|
||||
if( old_ypos != ypos)
|
||||
{
|
||||
slider_pos = ypos * slider_step;
|
||||
dial[TASK_VMOVER].ob_y = ( int16)floor( slider_pos);
|
||||
ObjcDraw( OC_FORM, win, TASK_VBACK, 2);
|
||||
ObjcDraw( OC_FORM, win, TASK_PROCESS_LIST, 1);
|
||||
}
|
||||
|
||||
graf_mouse( ARROW, NULL);
|
||||
|
||||
ObjcChange( mode, win, obj, ~SELECTED, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void CDECL draw_cpu_average( WINDOW *win, PARMBLK *pblk, void *data)
|
||||
{
|
||||
xy[0] = xy[1] = 0;
|
||||
xy[2] = 300;
|
||||
xy[3] = 100;
|
||||
xy[4] = pblk->pb_x;
|
||||
xy[5] = pblk->pb_y;
|
||||
xy[6] = xy[4] + 300;
|
||||
xy[7] = xy[5] + 100;
|
||||
|
||||
vrt_cpyfm( win->graf->handle, MD_REPLACE, xy, &cpu_average_background, &screen, wanted_color);
|
||||
|
||||
x = pblk->pb_x;
|
||||
|
||||
for( i = 0, ii = 0; i < 101; x += 3)
|
||||
{
|
||||
cpu_history_point[ii++] = x;
|
||||
cpu_history_point[ii++] = pblk->pb_y + cpu_history[i++];
|
||||
}
|
||||
|
||||
vsl_color( win->graf->handle, CYAN);
|
||||
v_pline( win->graf->handle, 101, cpu_history_point);
|
||||
}
|
||||
|
||||
static void CDECL draw_name_button( WINDOW *win, PARMBLK *pblk, void *data)
|
||||
{
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y;
|
||||
xy[2] = xy[0] + pblk->pb_w - 1;
|
||||
xy[3] = xy[1] + pblk->pb_h - 1;
|
||||
|
||||
vsf_color( win->graf->handle, LWHITE);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y + pblk->pb_h - 1;
|
||||
xy[2] = xy[0] + pblk->pb_w - 1;
|
||||
xy[3] = xy[1];
|
||||
xy[4] = xy[2];
|
||||
xy[5] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, BLACK);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y + pblk->pb_h - 2;
|
||||
xy[2] = xy[0] + pblk->pb_w - 2;
|
||||
xy[3] = xy[1];
|
||||
xy[4] = xy[2];
|
||||
xy[5] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, LBLACK);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y + pblk->pb_h - 2;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = pblk->pb_y;
|
||||
xy[4] = xy[0] + pblk->pb_w - 2;
|
||||
xy[5] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, WHITE);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
draw_text( win->graf->handle, pblk->pb_x + 5, pblk->pb_y + 3, BLACK, "Process name");
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void CDECL draw_cpu_button( WINDOW *win, PARMBLK *pblk, void *data)
|
||||
{
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y;
|
||||
xy[2] = xy[0] + pblk->pb_w - 1;
|
||||
xy[3] = xy[1] + pblk->pb_h - 1;
|
||||
|
||||
vsf_color( win->graf->handle, LWHITE);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y + pblk->pb_h - 1;
|
||||
xy[2] = xy[0] + pblk->pb_w - 1;
|
||||
xy[3] = xy[1];
|
||||
xy[4] = xy[2];
|
||||
xy[5] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, BLACK);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y + pblk->pb_h - 2;
|
||||
xy[2] = xy[0] + pblk->pb_w - 2;
|
||||
xy[3] = xy[1];
|
||||
xy[4] = xy[2];
|
||||
xy[5] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, LBLACK);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y + pblk->pb_h - 2;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = pblk->pb_y;
|
||||
xy[4] = xy[0] + pblk->pb_w - 2;
|
||||
xy[5] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, WHITE);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
draw_text( win->graf->handle, pblk->pb_x + 25, pblk->pb_y + 3, BLACK, "CPU");
|
||||
|
||||
}
|
||||
|
||||
static void CDECL draw_ram_button( WINDOW *win, PARMBLK *pblk, void *data)
|
||||
{
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y;
|
||||
xy[2] = xy[0] + pblk->pb_w - 1;
|
||||
xy[3] = xy[1] + pblk->pb_h - 1;
|
||||
|
||||
vsf_color( win->graf->handle, LWHITE);
|
||||
v_bar( win->graf->handle, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y + pblk->pb_h - 1;
|
||||
xy[2] = xy[0] + pblk->pb_w - 1;
|
||||
xy[3] = xy[1];
|
||||
// xy[4] = xy[2];
|
||||
// xy[5] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, BLACK);
|
||||
v_pline( win->graf->handle, 2, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y + pblk->pb_h - 2;
|
||||
xy[2] = xy[0] + pblk->pb_w - 1;
|
||||
xy[3] = xy[1];
|
||||
xy[4] = xy[2];
|
||||
xy[5] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, LBLACK);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
xy[0] = pblk->pb_x;
|
||||
xy[1] = pblk->pb_y + pblk->pb_h - 2;
|
||||
xy[2] = xy[0];
|
||||
xy[3] = pblk->pb_y;
|
||||
xy[4] = xy[0] + pblk->pb_w - 2;
|
||||
xy[5] = pblk->pb_y;
|
||||
|
||||
vsl_color( win->graf->handle, WHITE);
|
||||
v_pline( win->graf->handle, 3, xy);
|
||||
|
||||
draw_text( win->graf->handle, pblk->pb_x + 33, pblk->pb_y + 3, BLACK, "Memory Usage");
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void CDECL taskman_dialog_close( WINDOW *win, int16 buff[8])
|
||||
{
|
||||
ApplWrite( _AESapid, WM_DESTROY, win->handle, 0, 0, 0, 0);
|
||||
|
||||
// zdebug( "close");
|
||||
}
|
||||
|
||||
static void CDECL taskman_dialog_free_ressource( WINDOW *win, int16 buff[8])
|
||||
{
|
||||
while( process_root != NULL)
|
||||
process_delete( process_root->pid);
|
||||
|
||||
if( process_list_buffer.fd_addr)
|
||||
{
|
||||
gfree( process_list_buffer.fd_addr);
|
||||
process_list_buffer.fd_addr = NULL;
|
||||
}
|
||||
|
||||
// zdebug( "destroy");
|
||||
|
||||
taskman_win = NULL;
|
||||
thumb = NULL;
|
||||
}
|
||||
|
||||
void taskman_timer( void)
|
||||
{
|
||||
int old_process_nbr;
|
||||
|
||||
|
||||
switch( FormThbGet( thumb, 0))
|
||||
{
|
||||
case TASK_SYSTEM:
|
||||
if( old_stram != stram)
|
||||
{
|
||||
old_stram = stram;
|
||||
sprintf( ObjcString( dial, TASK_ST_FREE, NULL), "%ld", stram);
|
||||
ObjcDraw( OC_FORM, taskman_win, TASK_ST_FREE, 1);
|
||||
}
|
||||
|
||||
if( old_ttram != ttram)
|
||||
{
|
||||
old_ttram = ttram;
|
||||
sprintf( ObjcString( dial, TASK_TT_FREE, NULL), "%ld", ttram);
|
||||
ObjcDraw( OC_FORM, taskman_win, TASK_TT_FREE, 1);
|
||||
}
|
||||
|
||||
ObjcDraw( OC_FORM, taskman_win, TASK_CPU_AVERAGE, 1);
|
||||
|
||||
|
||||
Suptime( &uptime, loadaverage);
|
||||
updays = uptime / 86400;
|
||||
tmpdays = updays * 86400;
|
||||
uphours = (uptime - tmpdays) / 3600;
|
||||
tmphours = uphours * 3600;
|
||||
upmins = (uptime - tmpdays - tmphours) / 60;
|
||||
upsecs = (uptime - tmpdays - tmphours - ( upmins * 60));
|
||||
|
||||
sprintf( ObjcString( dial, TASK_UPTIME, NULL), "%ld days %ld hours %ld minutes %ld secs", updays, uphours, upmins, upsecs);
|
||||
ObjcDraw( OC_FORM, taskman_win, TASK_UPTIME, 1);
|
||||
break;
|
||||
|
||||
|
||||
case TASK_PROCESS:
|
||||
old_process_nbr = process_nbr;
|
||||
scan_process();
|
||||
|
||||
if( old_process_nbr != process_nbr)
|
||||
{
|
||||
ypos = 0;
|
||||
ypos_max = process_nbr;
|
||||
calc_process_slider( taskman_win);
|
||||
ObjcDraw( OC_FORM, taskman_win, TASK_PROCESS_LIST, 1);
|
||||
ObjcDraw( OC_FORM, taskman_win, TASK_VBACK, 2);
|
||||
}
|
||||
else
|
||||
ObjcDraw( OC_FORM, taskman_win, TASK_PROCESS_LIST, 1);
|
||||
|
||||
if( dial[TASK_LED1].ob_state & SELECTED)
|
||||
{
|
||||
ObjcChange( OC_FORM, taskman_win, TASK_LED1, NORMAL, 1);
|
||||
ObjcChange( OC_FORM, taskman_win, TASK_LED2, SELECTED, 1);
|
||||
}
|
||||
else if( dial[TASK_LED2].ob_state & SELECTED)
|
||||
{
|
||||
ObjcChange( OC_FORM, taskman_win, TASK_LED2, NORMAL, 1);
|
||||
ObjcChange( OC_FORM, taskman_win, TASK_LED3, SELECTED, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ObjcChange( OC_FORM, taskman_win, TASK_LED1, SELECTED, 1);
|
||||
ObjcChange( OC_FORM, taskman_win, TASK_LED3, NORMAL, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void taskman_dialog( void)
|
||||
{
|
||||
BITBLK *image;
|
||||
|
||||
int frms[] = { TASK_PANEL1, TASK_PANEL2, TASK_PANEL3};
|
||||
int buts[] = { TASK_PROCESS, TASK_SYSTEM, TASK_NETWORK};
|
||||
|
||||
if( taskman_win != NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
process_selected = NULL;
|
||||
|
||||
dial = get_tree( TASK);
|
||||
|
||||
sprintf( ObjcString( dial, TASK_ST_TOTAL, NULL), "%ld", total_stram);
|
||||
sprintf( ObjcString( dial, TASK_TT_TOTAL, NULL), "%ld", total_ttram);
|
||||
sprintf( ObjcString( dial, TASK_ST_FREE, NULL), "%ld", stram);
|
||||
sprintf( ObjcString( dial, TASK_TT_FREE, NULL), "%ld", ttram);
|
||||
|
||||
old_stram = stram;
|
||||
old_ttram = ttram;
|
||||
|
||||
Suptime( &uptime, loadaverage);
|
||||
updays = uptime / 86400;
|
||||
tmpdays = updays * 86400;
|
||||
uphours = (uptime - tmpdays) / 3600;
|
||||
tmphours = uphours * 3600;
|
||||
upmins = (uptime - tmpdays - tmphours) / 60;
|
||||
upsecs = (uptime - tmpdays - tmphours - ( upmins * 60));
|
||||
sprintf( ObjcString( dial, TASK_UPTIME, NULL), "%ld days %ld hours %ld minutes %ld secs", updays, uphours, upmins, upsecs);
|
||||
|
||||
dial[TASK_NETWORK].ob_flags |= HIDETREE;
|
||||
dial[TASK_KILL].ob_state |= DISABLED;
|
||||
|
||||
if( ( taskman_win = FormCreate( dial, NAME|MOVER|CLOSER, NULL, get_string( S_TASKMAN), NULL, TRUE, FALSE)) == NULL)
|
||||
return;
|
||||
|
||||
dial = FORM( taskman_win);
|
||||
|
||||
scan_process();
|
||||
|
||||
{
|
||||
ypos = 0;
|
||||
ypos_max = process_nbr;
|
||||
taskman_win->h_u = 13;
|
||||
|
||||
calc_process_slider( taskman_win);
|
||||
|
||||
ObjcAttachFormFunc( taskman_win, TASK_UP, slid_up, NULL);
|
||||
ObjcAttachFormFunc( taskman_win, TASK_DOWN, slid_down, NULL);
|
||||
ObjcAttachFormFunc( taskman_win, TASK_VMOVER, slid_vmover, NULL);
|
||||
}
|
||||
|
||||
thumb = FormThumb( taskman_win, frms, buts, 3);
|
||||
|
||||
|
||||
process_list_buffer_lenght = init_mfdb( &process_list_buffer, dial[TASK_PROCESS_LIST].ob_width, dial[TASK_PROCESS_LIST].ob_height, 1);
|
||||
|
||||
rsrc_gaddr( R_IMAGEDATA, CPU_AVERAGE, &image);
|
||||
|
||||
cpu_average_background.fd_w = 304;
|
||||
cpu_average_background.fd_h = 101;
|
||||
cpu_average_background.fd_wdwidth = ( 304 >> 4) + (( 304 % 16) != 0);
|
||||
cpu_average_background.fd_stand = 0;
|
||||
cpu_average_background.fd_nplanes = 1;
|
||||
cpu_average_background.fd_r1 = 0;
|
||||
cpu_average_background.fd_r2 = 0;
|
||||
cpu_average_background.fd_r3 = 0;
|
||||
cpu_average_background.fd_addr = (void*)image->bi_pdata;
|
||||
|
||||
|
||||
RsrcUserDraw( OC_FORM, taskman_win, TASK_CPU_AVERAGE, draw_cpu_average, NULL);
|
||||
RsrcUserDraw( OC_FORM, taskman_win, TASK_PROCESS_LIST, draw_process_list, NULL);
|
||||
RsrcUserDraw( OC_FORM, taskman_win, TASK_C_NAME, draw_name_button, NULL);
|
||||
RsrcUserDraw( OC_FORM, taskman_win, TASK_C_CPU, draw_cpu_button, NULL);
|
||||
RsrcUserDraw( OC_FORM, taskman_win, TASK_C_RAM, draw_ram_button, NULL);
|
||||
|
||||
EvntAttach( taskman_win, WM_CLOSED, taskman_dialog_close);
|
||||
EvntAdd( taskman_win, WM_XBUTTON, taskman_win_mouse_event, EV_BOT);
|
||||
EvntAdd( taskman_win, WM_DESTROY, taskman_dialog_free_ressource, EV_TOP);
|
||||
|
||||
ObjcAttachFormFunc( taskman_win, TASK_KILL, taskman_dialog_kill, NULL);
|
||||
}
|
||||
|
||||
7
sources/z-tools/trunk/ztask/taskman.h
Normal file
7
sources/z-tools/trunk/ztask/taskman.h
Normal file
@@ -0,0 +1,7 @@
|
||||
extern void taskman_dialog( void);
|
||||
extern void taskman_timer( void);
|
||||
extern WINDOW *taskman_win;
|
||||
|
||||
|
||||
|
||||
|
||||
43
sources/z-tools/trunk/ztask/types2b.h
Normal file
43
sources/z-tools/trunk/ztask/types2b.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef __2B_UNIVERSAL_TYPES__
|
||||
#define __2B_UNIVERSAL_TYPES__
|
||||
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef signed long int32;
|
||||
typedef unsigned long uint32;
|
||||
typedef int32 fix31;
|
||||
|
||||
#ifdef __GNUC__
|
||||
typedef signed short int16;
|
||||
typedef unsigned short uint16;
|
||||
#define __2B_HAS64_SUPPORT /* Compiler supports 64 Bit Integers */
|
||||
typedef signed long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
#else /* Compiler doesn't support 64 Bit Integers */
|
||||
typedef signed int int16;
|
||||
typedef unsigned int uint16;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32 hi;
|
||||
uint32 lo;
|
||||
} int64;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32 hi;
|
||||
uint32 lo;
|
||||
} loff_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32 hi;
|
||||
uint32 lo;
|
||||
} uint64;
|
||||
#endif
|
||||
|
||||
|
||||
typedef int32 boolean;
|
||||
|
||||
|
||||
#endif /* __2B_UNIVERSAL_TYPES__ */
|
||||
672
sources/z-tools/trunk/ztask/win.c
Normal file
672
sources/z-tools/trunk/ztask/win.c
Normal file
@@ -0,0 +1,672 @@
|
||||
#include "general.h"
|
||||
#include "app.h"
|
||||
#include "cpu.h"
|
||||
#include "popup.h"
|
||||
#include "string.h"
|
||||
#include "taskman.h"
|
||||
|
||||
static clock_t chrono_value, update_time = ( clock_t)( 100L);
|
||||
int16 cpu_usage = 0;
|
||||
int32 total_stram = 0;
|
||||
int32 total_ttram = 0;
|
||||
uint32 stram = 0;
|
||||
uint32 ttram = 0;
|
||||
int16 stram_percent = 0;
|
||||
int16 ttram_percent = 0;
|
||||
int16 bar_width = 6;
|
||||
int16 geek_area_width = 64;
|
||||
int16 cpu_history[101];
|
||||
int16 x_pos, w_pos, y_pos, h_pos, geek_area_x, clock_x, cpu_x, st_x, tt_x;
|
||||
int16 hcell = 8, dum, y_text_pos, x_space = 5, menu_enabled = FALSE;
|
||||
char xbios_time[15];
|
||||
|
||||
WINDOW *app_bar;
|
||||
OBJECT *icons = NULL;
|
||||
static void win_mouse_event( WINDOW *win, int16 buff[8]);
|
||||
static void win_redraw_event( WINDOW *win, int16 buff[8]);
|
||||
|
||||
|
||||
static void CDECL timer_function( WINDOW *win, int16 buff[8])
|
||||
{
|
||||
app_data *tmp;
|
||||
clock_t current_t;
|
||||
clock_t relative_t;
|
||||
time_t curtime;
|
||||
struct tm *loctime;
|
||||
int16 old_app_nbr = app_nbr;
|
||||
static int skip = 0;
|
||||
|
||||
if( popup.win)
|
||||
{
|
||||
if( IS_IN( evnt.mx, evnt.my, popup.x_pos, popup.y_pos, popup.w_pos, popup.h_pos + 2))
|
||||
{
|
||||
popup.selected = popup_item_under_mouse();
|
||||
|
||||
if( popup.selected != popup.old_selected)
|
||||
{
|
||||
if( popup.selected >= 0)
|
||||
draw_page( popup.win, popup.item_pos[popup.selected].x1, popup.item_pos[popup.selected].y1, popup.item_pos[popup.selected].x2, popup.item_pos[popup.selected].y2);
|
||||
|
||||
if( popup.old_selected >= 0)
|
||||
draw_page( popup.win, popup.item_pos[popup.old_selected].x1, popup.item_pos[popup.old_selected].y1, popup.item_pos[popup.old_selected].x2, popup.item_pos[popup.old_selected].y2);
|
||||
|
||||
popup.old_selected = popup.selected;
|
||||
}
|
||||
}
|
||||
else if( menu_enabled == TRUE)
|
||||
{
|
||||
if( !IS_IN( evnt.mx, evnt.my, root->x_pos - 24, root->y_pos, 24, 23))
|
||||
popup_delete( popup.win);
|
||||
}
|
||||
else if( !IS_IN( evnt.mx, evnt.my, popup.entry->x_pos, popup.entry->y_pos, app_width, 23))
|
||||
popup_delete( popup.win);
|
||||
}
|
||||
|
||||
current_t = clock();
|
||||
|
||||
relative_t = current_t - chrono_value;
|
||||
|
||||
if( relative_t < update_time)
|
||||
return;
|
||||
|
||||
chrono_value = current_t;
|
||||
|
||||
cpu_usage = cpu_get_usage();
|
||||
|
||||
if( skip == 0)
|
||||
{
|
||||
memcpy( cpu_history, &cpu_history[1], 200);
|
||||
cpu_history[100] = 100 - cpu_usage;
|
||||
|
||||
if( show_clock == TRUE)
|
||||
{
|
||||
curtime = time( NULL);
|
||||
loctime = localtime( &curtime);
|
||||
|
||||
if( clock_us == TRUE)
|
||||
strftime( xbios_time, 12, "%I:%M:%S %p", loctime);
|
||||
else
|
||||
strftime( xbios_time, 12, "%H:%M:%S", loctime);
|
||||
}
|
||||
|
||||
if( show_system_info)
|
||||
{
|
||||
get_free_ram( &stram, &ttram);
|
||||
stram_percent = (int16)(( 100 * stram) / total_stram);
|
||||
|
||||
if( total_ttram != 0)
|
||||
ttram_percent = (int16)(( 100 * ttram) / total_ttram);
|
||||
|
||||
}
|
||||
|
||||
skip = 1;
|
||||
|
||||
tmp = selected;
|
||||
|
||||
app_data_search();
|
||||
|
||||
if( old_app_nbr == app_nbr)
|
||||
{
|
||||
draw_page( win, geek_area_x + 4, app.y + app.h - 19, geek_area_width - 9, 15);
|
||||
|
||||
if( selected != tmp)
|
||||
{
|
||||
if( selected != NULL)
|
||||
draw_page( win, selected->x_pos, selected->y_pos, app_width, h_pos);
|
||||
|
||||
if( old_selected != NULL)
|
||||
draw_page( win, old_selected->x_pos, old_selected->y_pos, app_width, h_pos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
w_pos = geek_area_width + ( app_nbr * app_width) + 24;
|
||||
|
||||
while( w_pos > app.w)
|
||||
w_pos -= app_width;
|
||||
|
||||
x_pos = app.x + ( app.w - w_pos);
|
||||
w_pos -= 1;
|
||||
|
||||
WindSet( win, WF_WORKXYWH, x_pos, y_pos, w_pos, h_pos);
|
||||
|
||||
// Xaaes bug... with this AES, WindSet( win, WF_CURRXYWH,... doesn't redraw the taskbar.
|
||||
draw_page( win, x_pos, y_pos, w_pos, h_pos);
|
||||
}
|
||||
|
||||
if( taskman_win != NULL)
|
||||
taskman_timer();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_page( win, geek_area_x + 4, app.y + app.h - 19, geek_area_width - 9, 15);
|
||||
skip = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void CDECL win_mouse_event( WINDOW *win, int16 buff[8])
|
||||
{
|
||||
app_data *scan = root, *tmp = NULL;
|
||||
|
||||
// evnt.nb_click = 0;
|
||||
|
||||
while( scan != NULL)
|
||||
{
|
||||
if( scan->x_pos == -1)
|
||||
continue;
|
||||
|
||||
if( IS_IN( evnt.mx, evnt.my, scan->x_pos, scan->y_pos, app_width, h_pos))
|
||||
{
|
||||
tmp = scan;
|
||||
break;
|
||||
}
|
||||
|
||||
scan = scan->next;
|
||||
}
|
||||
|
||||
|
||||
if( tmp != NULL)
|
||||
{
|
||||
int16 ap_cout;
|
||||
|
||||
old_selected = selected;
|
||||
selected = tmp;
|
||||
|
||||
if( old_selected != selected)
|
||||
{
|
||||
mt_appl_control( selected->id, APC_INFO, &ap_cout, app.aes_global);
|
||||
|
||||
if( ap_cout & APCI_HIDDEN)
|
||||
mt_appl_control( selected->id, APC_SHOW, &ap_cout, app.aes_global);
|
||||
|
||||
mt_appl_control( selected->id, APC_TOP, &ap_cout, app.aes_global);
|
||||
|
||||
draw_page( win, selected->x_pos, selected->y_pos, app_width, h_pos);
|
||||
|
||||
if( old_selected != NULL)
|
||||
draw_page( win, old_selected->x_pos, old_selected->y_pos, app_width, h_pos);
|
||||
}
|
||||
}
|
||||
|
||||
if( popup.win)
|
||||
return;
|
||||
|
||||
/* if we are on the menu icon or on an application item, we open a popup */
|
||||
if(( tmp != NULL) && ( evnt.mbut == 2))
|
||||
{
|
||||
char dummy[MAXNAMLEN];
|
||||
uint32 dummy_var;
|
||||
|
||||
popup.item_nbr = 0;
|
||||
|
||||
get_info_by_pid((int)tmp->pid, dummy, popup.item_name[popup.item_nbr], &dummy_var);
|
||||
|
||||
popup.selectable[popup.item_nbr] = FALSE;
|
||||
popup.function[popup.item_nbr] = 0;
|
||||
popup.icon[popup.item_nbr++] = ICONS_MEM;
|
||||
|
||||
popup.selectable[popup.item_nbr] = FALSE;
|
||||
popup.function[popup.item_nbr] = 0;
|
||||
popup.item_name[popup.item_nbr][0] = '\0';
|
||||
popup.icon[popup.item_nbr++] = -1;
|
||||
|
||||
/* popup.selectable[popup.item_nbr] = TRUE;
|
||||
popup.function[popup.item_nbr] = F_HIDE;
|
||||
strcpy( popup.item_name[popup.item_nbr], get_string( S_HIDE));
|
||||
popup.icon[popup.item_nbr++] = -1;
|
||||
*/
|
||||
popup.selectable[popup.item_nbr] = TRUE;
|
||||
popup.function[popup.item_nbr] = F_QUIT;
|
||||
strcpy( popup.item_name[popup.item_nbr], get_string( S_QUIT));
|
||||
popup.icon[popup.item_nbr++] = -1;
|
||||
|
||||
popup.selectable[popup.item_nbr] = TRUE;
|
||||
popup.function[popup.item_nbr] = F_KILL;
|
||||
strcpy( popup.item_name[popup.item_nbr], get_string( S_KILL));
|
||||
popup.icon[popup.item_nbr++] = -1;
|
||||
|
||||
open_popup( tmp);
|
||||
}
|
||||
else if(( tmp == NULL) && ( evnt.mx < root->x_pos) && ( evnt.mbut == 1))
|
||||
{
|
||||
int16 x, y;
|
||||
|
||||
popup.item_nbr = 0;
|
||||
|
||||
popup.selectable[popup.item_nbr] = TRUE;
|
||||
popup.function[popup.item_nbr] = F_TASKMANAGER;
|
||||
strcpy( popup.item_name[popup.item_nbr], get_string( S_TASKMAN));
|
||||
popup.icon[popup.item_nbr++] = ICONS_TASK;
|
||||
|
||||
popup.selectable[popup.item_nbr] = TRUE;
|
||||
popup.function[popup.item_nbr] = F_PREFERENCES;
|
||||
strcpy( popup.item_name[popup.item_nbr], get_string( S_PREFS));
|
||||
popup.icon[popup.item_nbr++] = ICONS_CONFIGURE;
|
||||
|
||||
popup.selectable[popup.item_nbr] = FALSE;
|
||||
popup.function[popup.item_nbr] = 0;
|
||||
popup.item_name[popup.item_nbr][0] = '\0';
|
||||
popup.icon[popup.item_nbr++] = -1;
|
||||
|
||||
popup.selectable[popup.item_nbr] = TRUE;
|
||||
popup.function[popup.item_nbr] = F_QUIT_ZBAR;
|
||||
strcpy( popup.item_name[popup.item_nbr], get_string( S_QUIT));
|
||||
popup.icon[popup.item_nbr++] = ICONS_ARROW;
|
||||
|
||||
popup.selectable[popup.item_nbr] = TRUE;
|
||||
popup.function[popup.item_nbr] = F_SHUTDOWN;
|
||||
strcpy( popup.item_name[popup.item_nbr], get_string( S_SHUTDOWN));
|
||||
popup.icon[popup.item_nbr++] = ICONS_SHUTDOWN;
|
||||
|
||||
menu_enabled = TRUE;
|
||||
WindGet( win, WF_WORKXYWH, &x, &y, &dum, &dum);
|
||||
draw_page( win, x, y, 25, 24);
|
||||
|
||||
open_popup( tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void CDECL win_redraw_event( WINDOW *win, int16 buff[8])
|
||||
{
|
||||
int16 x_text_pos, xw, pxy[10], background, top_line, lower_line, title_shadow, title_color;
|
||||
app_data *scan = root;
|
||||
|
||||
xw = x_pos;
|
||||
|
||||
geek_area_x = xw + w_pos - geek_area_width;
|
||||
|
||||
/* we draw the menu area */
|
||||
pxy[0] = xw;
|
||||
pxy[1] = y_pos;
|
||||
pxy[2] = pxy[0] + 23;
|
||||
pxy[3] = pxy[1] + h_pos - 1;
|
||||
|
||||
if( menu_enabled == TRUE)
|
||||
{
|
||||
background = ( int16)button_on_background;
|
||||
top_line = ( int16)button_on_dark_color;
|
||||
lower_line = ( int16)button_on_light_color;
|
||||
title_color = ( int16)button_on_text_color;
|
||||
title_shadow = ( int16)button_on_text_shadow_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
background = ( int16)button_off_background;
|
||||
top_line = ( int16)button_off_light_color;
|
||||
lower_line = ( int16)button_off_dark_color;
|
||||
title_color = ( int16)button_off_text_color;
|
||||
title_shadow = ( int16)button_off_text_shadow_color;
|
||||
}
|
||||
|
||||
vsf_color( win->graf->handle, background);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
|
||||
pxy[1] = pxy[3];
|
||||
pxy[2] = pxy[0];
|
||||
pxy[3] = y_pos;
|
||||
pxy[4] = pxy[0] + 22;
|
||||
pxy[5] = y_pos;
|
||||
|
||||
vsl_color( win->graf->handle, top_line);
|
||||
v_pline( win->graf->handle, 3, pxy);
|
||||
|
||||
pxy[0] = pxy[4] + 1;
|
||||
pxy[1] = y_pos;
|
||||
pxy[2] = pxy[0];
|
||||
pxy[3] = pxy[1] + h_pos - 1;
|
||||
pxy[4] = xw;
|
||||
pxy[5] = pxy[3];
|
||||
|
||||
vsl_color( win->graf->handle, lower_line);
|
||||
v_pline( win->graf->handle, 3, pxy);
|
||||
|
||||
icons[ICONS_MENU].ob_x = xw + 4;
|
||||
icons[ICONS_MENU].ob_y = y_pos + 2;
|
||||
|
||||
mt_objc_draw( icons, ICONS_MENU, 1, win->graf->clip.g_x, win->graf->clip.g_y, win->graf->clip.g_w, win->graf->clip.g_h, app.aes_global);
|
||||
|
||||
xw += 24;
|
||||
|
||||
|
||||
/* We draw the application list */
|
||||
while( scan != NULL)
|
||||
{
|
||||
if(( pxy[0] + app_width - 2) > geek_area_x)
|
||||
{
|
||||
scan->x_pos = -1;
|
||||
scan->y_pos = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
scan->x_pos = xw;
|
||||
scan->y_pos = y_pos;
|
||||
xw += app_width;
|
||||
|
||||
pxy[0] = scan->x_pos;
|
||||
pxy[1] = y_pos;
|
||||
pxy[2] = pxy[0] + app_width - 1;
|
||||
pxy[3] = pxy[1] + h_pos - 1;
|
||||
|
||||
if( scan == selected)
|
||||
{
|
||||
background = ( int16)button_on_background;
|
||||
top_line = ( int16)button_on_dark_color;
|
||||
lower_line = ( int16)button_on_light_color;
|
||||
title_color = ( int16)button_on_text_color;
|
||||
title_shadow = ( int16)button_on_text_shadow_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
background = ( int16)button_off_background;
|
||||
top_line = ( int16)button_off_light_color;
|
||||
lower_line = ( int16)button_off_dark_color;
|
||||
title_color = ( int16)button_off_text_color;
|
||||
title_shadow = ( int16)button_off_text_shadow_color;
|
||||
}
|
||||
|
||||
vsf_color( win->graf->handle, background);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
|
||||
pxy[1] = pxy[3];
|
||||
pxy[2] = pxy[0];
|
||||
pxy[3] = y_pos;
|
||||
pxy[4] = pxy[0] + app_width - 2;
|
||||
pxy[5] = y_pos;
|
||||
|
||||
vsl_color( win->graf->handle, top_line);
|
||||
v_pline( win->graf->handle, 3, pxy);
|
||||
|
||||
pxy[0] = pxy[4] + 1;
|
||||
pxy[1] = y_pos;
|
||||
pxy[2] = pxy[0];
|
||||
pxy[3] = pxy[1] + h_pos - 1;
|
||||
pxy[4] = scan->x_pos;
|
||||
pxy[5] = pxy[3];
|
||||
|
||||
vsl_color( win->graf->handle, lower_line);
|
||||
v_pline( win->graf->handle, 3, pxy);
|
||||
|
||||
x_text_pos = scan->x_pos + (( app_width - scan->name_shown_width) >> 1);
|
||||
|
||||
draw_text( win->graf->handle, x_text_pos + 1, y_text_pos + 1, ( int16)title_shadow, scan->name_shown);
|
||||
draw_text( win->graf->handle, x_text_pos, y_text_pos, ( int16)title_color, scan->name_shown);
|
||||
|
||||
}
|
||||
|
||||
scan = scan->next;
|
||||
}
|
||||
|
||||
/* draw the "geek" area */
|
||||
pxy[0] = xw + 2;
|
||||
pxy[1] = y_pos + 2;
|
||||
pxy[2] = pxy[0] + geek_area_width - 6;
|
||||
pxy[3] = pxy[1] + h_pos - 5;
|
||||
|
||||
vsf_color( win->graf->handle, geek_area_color);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
|
||||
pxy[0] = xw;
|
||||
pxy[1] = y_pos;
|
||||
pxy[2] = pxy[0];
|
||||
pxy[3] = pxy[1] + h_pos - 1;
|
||||
pxy[4] = pxy[2] + geek_area_width - 2;
|
||||
pxy[5] = pxy[3];
|
||||
pxy[6] = pxy[4];
|
||||
pxy[7] = pxy[1];
|
||||
pxy[8] = pxy[0];
|
||||
pxy[9] = pxy[1];
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)button_off_background);
|
||||
v_pline( win->graf->handle, 5, pxy);
|
||||
|
||||
pxy[0]++;
|
||||
pxy[1] = pxy[3] - 1;
|
||||
pxy[2] = pxy[0];
|
||||
pxy[3] = y_pos + 1;
|
||||
pxy[4]--;
|
||||
pxy[5] = pxy[3];
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)geek_area_dark_line);
|
||||
v_pline( win->graf->handle, 3, pxy);
|
||||
|
||||
pxy[2] = pxy[4];
|
||||
pxy[3] = pxy[1];
|
||||
pxy[5] = y_pos + 2;
|
||||
|
||||
vsl_color( win->graf->handle, ( int16)geek_area_light_line);
|
||||
v_pline( win->graf->handle, 3, pxy);
|
||||
|
||||
|
||||
/* draw the cpu % in the "geek" area */
|
||||
if( show_system_info)
|
||||
{
|
||||
/* the CPU usage */
|
||||
pxy[0] = cpu_x + geek_area_x;
|
||||
pxy[1] = y_pos + 3;
|
||||
pxy[2] = pxy[0] + bar_width - 1;
|
||||
pxy[3] = pxy[1] + 14;
|
||||
|
||||
vsf_color( win->graf->handle, BLACK);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
|
||||
pxy[0] = pxy[0] + 1;
|
||||
pxy[2] = pxy[2] - 1;
|
||||
pxy[3] = y_pos + 16;
|
||||
|
||||
if( cpu_usage >= 8)
|
||||
{
|
||||
if( cpu_usage >= 99)
|
||||
pxy[1] = y_pos + 4;
|
||||
else if( cpu_usage >= 91)
|
||||
pxy[1] = y_pos + 5;
|
||||
else if( cpu_usage >= 83)
|
||||
pxy[1] = y_pos + 6;
|
||||
else if( cpu_usage >= 75)
|
||||
pxy[1] = y_pos + 7;
|
||||
else if( cpu_usage >= 66)
|
||||
pxy[1] = y_pos + 8;
|
||||
else if( cpu_usage >= 58)
|
||||
pxy[1] = y_pos + 9;
|
||||
else if( cpu_usage >= 50)
|
||||
pxy[1] = y_pos + 10;
|
||||
else if( cpu_usage >= 41)
|
||||
pxy[1] = y_pos + 11;
|
||||
else if( cpu_usage >= 33)
|
||||
pxy[1] = y_pos + 12;
|
||||
else if( cpu_usage >= 25)
|
||||
pxy[1] = y_pos + 13;
|
||||
else if( cpu_usage >= 16)
|
||||
pxy[1] = y_pos + 14;
|
||||
else
|
||||
pxy[1] = y_pos + 15;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)cpu_bar_color);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
}
|
||||
|
||||
/* the STRAM usage */
|
||||
pxy[0] = st_x + geek_area_x;
|
||||
pxy[1] = y_pos + 3;
|
||||
pxy[2] = pxy[0] + bar_width - 1;
|
||||
pxy[3] = pxy[1] + 14;
|
||||
|
||||
vsf_color( win->graf->handle, BLACK);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
|
||||
|
||||
pxy[0] = pxy[0] + 1;
|
||||
pxy[2] = pxy[2] - 1;
|
||||
pxy[3] = y_pos + 16;
|
||||
|
||||
if( stram_percent >= 8)
|
||||
{
|
||||
if( stram_percent >= 99)
|
||||
pxy[1] = y_pos + 4;
|
||||
else if( stram_percent >= 91)
|
||||
pxy[1] = y_pos + 5;
|
||||
else if( stram_percent >= 83)
|
||||
pxy[1] = y_pos + 6;
|
||||
else if( stram_percent >= 75)
|
||||
pxy[1] = y_pos + 7;
|
||||
else if( stram_percent >= 66)
|
||||
pxy[1] = y_pos + 8;
|
||||
else if( stram_percent >= 58)
|
||||
pxy[1] = y_pos + 9;
|
||||
else if( stram_percent >= 50)
|
||||
pxy[1] = y_pos + 10;
|
||||
else if( stram_percent >= 41)
|
||||
pxy[1] = y_pos + 11;
|
||||
else if( stram_percent >= 33)
|
||||
pxy[1] = y_pos + 12;
|
||||
else if( stram_percent >= 25)
|
||||
pxy[1] = y_pos + 13;
|
||||
else if( stram_percent >= 16)
|
||||
pxy[1] = y_pos + 14;
|
||||
else
|
||||
pxy[1] = y_pos + 15;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)st_bar_color);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
}
|
||||
|
||||
/* the TTRAM usage */
|
||||
|
||||
if( total_ttram != 0)
|
||||
{
|
||||
pxy[0] = tt_x + geek_area_x;
|
||||
pxy[1] = y_pos + 3;
|
||||
pxy[2] = pxy[0] + bar_width - 1;
|
||||
pxy[3] = pxy[1] + 14;
|
||||
|
||||
vsf_color( win->graf->handle, BLACK);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
|
||||
|
||||
pxy[0] = pxy[0] + 1;
|
||||
pxy[2] = pxy[2] - 1;
|
||||
pxy[3] = y_pos + 16;
|
||||
|
||||
if( ttram_percent >= 8)
|
||||
{
|
||||
if( ttram_percent >= 99)
|
||||
pxy[1] = y_pos + 4;
|
||||
else if( ttram_percent >= 91)
|
||||
pxy[1] = y_pos + 5;
|
||||
else if( ttram_percent >= 83)
|
||||
pxy[1] = y_pos + 6;
|
||||
else if( ttram_percent >= 75)
|
||||
pxy[1] = y_pos + 7;
|
||||
else if( ttram_percent >= 66)
|
||||
pxy[1] = y_pos + 8;
|
||||
else if( ttram_percent >= 58)
|
||||
pxy[1] = y_pos + 9;
|
||||
else if( ttram_percent >= 50)
|
||||
pxy[1] = y_pos + 10;
|
||||
else if( ttram_percent >= 41)
|
||||
pxy[1] = y_pos + 11;
|
||||
else if( ttram_percent >= 33)
|
||||
pxy[1] = y_pos + 12;
|
||||
else if( ttram_percent >= 25)
|
||||
pxy[1] = y_pos + 13;
|
||||
else if( ttram_percent >= 16)
|
||||
pxy[1] = y_pos + 14;
|
||||
else
|
||||
pxy[1] = y_pos + 15;
|
||||
|
||||
vsf_color( win->graf->handle, ( int16)tt_bar_color);
|
||||
v_bar( win->graf->handle, pxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* draw the clock in the "geek" area */
|
||||
if( show_clock == TRUE)
|
||||
{
|
||||
draw_text( win->graf->handle, clock_x + geek_area_x, y_text_pos, (int16)geek_area_text_color, xbios_time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void set_component_position( void)
|
||||
{
|
||||
int16 text_width, x = x_space + 2;
|
||||
|
||||
if( show_system_info)
|
||||
{
|
||||
cpu_x = x;
|
||||
x += ( bar_width + 2);
|
||||
|
||||
if( total_ttram != 0)
|
||||
{
|
||||
st_x = x;
|
||||
x += ( bar_width + 2);
|
||||
|
||||
tt_x = x;
|
||||
x += ( bar_width + x_space);
|
||||
}
|
||||
else
|
||||
{
|
||||
st_x = x;
|
||||
x += ( bar_width + x_space);
|
||||
|
||||
tt_x = x;
|
||||
}
|
||||
}
|
||||
|
||||
if( show_clock == TRUE)
|
||||
{
|
||||
clock_x = x;
|
||||
|
||||
if( clock_us == FALSE)
|
||||
text_width = get_text_width( "00:00:00");
|
||||
else
|
||||
text_width = get_text_width( "00:00:00 PM");
|
||||
|
||||
x += ( text_width + x_space);
|
||||
}
|
||||
|
||||
geek_area_width = x + 1;
|
||||
y_text_pos = app.y + app.h - 14;
|
||||
}
|
||||
|
||||
|
||||
void main_win( void)
|
||||
{
|
||||
chrono_value = clock();
|
||||
|
||||
rsrc_gaddr( 0, ICONS, &icons);
|
||||
popup.win = NULL;
|
||||
|
||||
app_bar = WindCreate( 0, app.x, app.y, app.w, app.h);
|
||||
|
||||
EvntAttach( app_bar, WM_REDRAW, win_redraw_event);
|
||||
EvntAttach( app_bar, WM_XBUTTON, win_mouse_event);
|
||||
|
||||
set_component_position();
|
||||
app_data_search();
|
||||
|
||||
w_pos = geek_area_width + ( app_nbr * app_width) + 24;
|
||||
|
||||
while( w_pos > app.w)
|
||||
w_pos -= app_width;
|
||||
|
||||
x_pos = app.x + ( app.w - w_pos);
|
||||
w_pos -= 1;
|
||||
y_pos = app.y + app.h - 21;
|
||||
|
||||
|
||||
WindCalc( WC_BORDER, app_bar, x_pos, y_pos, w_pos, 22, &x_pos, &y_pos, &w_pos, &h_pos);
|
||||
|
||||
WindSet( app_bar, WF_BEVENT, BEVENT_WORK, 0, 0, 0);
|
||||
WindOpen( app_bar, x_pos, y_pos, w_pos, h_pos);
|
||||
EvntAttach( app_bar, WM_XTIMER, timer_function);
|
||||
WindGet( app_bar, WF_WORKXYWH, &x_pos, &y_pos, &w_pos, &h_pos);
|
||||
|
||||
h_pos = 21;
|
||||
}
|
||||
|
||||
20
sources/z-tools/trunk/ztask/win.h
Normal file
20
sources/z-tools/trunk/ztask/win.h
Normal file
@@ -0,0 +1,20 @@
|
||||
extern int16 cpu_usage;
|
||||
extern int32 total_stram;
|
||||
extern int32 total_ttram;
|
||||
extern uint32 stram;
|
||||
extern uint32 ttram;
|
||||
extern int16 bar_width;
|
||||
extern int16 geek_area_width;
|
||||
extern int16 geek_area_border_width;
|
||||
extern int16 hcell, x_space;
|
||||
extern int16 x_pos, w_pos, y_pos, h_pos;
|
||||
|
||||
extern WINDOW *app_bar;
|
||||
extern OBJECT *icons;
|
||||
extern int16 x_space, menu_enabled;
|
||||
extern int16 cpu_history[100];
|
||||
|
||||
extern void set_component_position( void);
|
||||
|
||||
|
||||
|
||||
BIN
sources/z-tools/trunk/ztask/ztask.hrd
Normal file
BIN
sources/z-tools/trunk/ztask/ztask.hrd
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/ztask/ztask.rsc
Normal file
BIN
sources/z-tools/trunk/ztask/ztask.rsc
Normal file
Binary file not shown.
102
sources/z-tools/trunk/ztask/ztask.rsh
Normal file
102
sources/z-tools/trunk/ztask/ztask.rsh
Normal file
@@ -0,0 +1,102 @@
|
||||
/* Resource C-Header-File v1.95 f<>r ResourceMaster ab v2.06 by ARDISOFT */
|
||||
|
||||
#define ICONS 0 /* form/dial */
|
||||
#define ICONS_CPU 3 /* CICON in tree ICONS */
|
||||
#define ICONS_MEM 4 /* CICON in tree ICONS */
|
||||
#define ICONS_ARROW 5 /* CICON in tree ICONS */
|
||||
#define ICONS_NET 6 /* CICON in tree ICONS */
|
||||
#define ICONS_LED 7 /* CICON in tree ICONS */
|
||||
#define ICONS_MENU 8 /* CICON in tree ICONS */
|
||||
#define ICONS_SHUTDOWN 9 /* CICON in tree ICONS */
|
||||
#define ICONS_CONFIGURE 1 /* CICON in tree ICONS */
|
||||
#define ICONS_TASK 2 /* CICON in tree ICONS */
|
||||
|
||||
#define SHUTDOWN_DIAL 1 /* form/dial */
|
||||
#define SHUTDOWN_DIAL_OK 1 /* BUTTON in tree SHUTDOWN_DIAL */
|
||||
#define SHUTDOWN_DIAL_WARN 3 /* BUTTON in tree SHUTDOWN_DIAL */
|
||||
#define SHUTDOWN_DIAL_COLD 4 /* BUTTON in tree SHUTDOWN_DIAL */
|
||||
#define SHUTDOWN_DIAL_HALT 5 /* BUTTON in tree SHUTDOWN_DIAL */
|
||||
#define SHUTDOWN_DIAL_CANCEL 6 /* BUTTON in tree SHUTDOWN_DIAL */
|
||||
|
||||
#define TASK 2 /* form/dial */
|
||||
#define TASK_PANEL3 1 /* BUTTON in tree TASK */
|
||||
#define TASK_PANEL2 3 /* BUTTON in tree TASK */
|
||||
#define TASK_CPU_AVERAGE 5 /* BOX in tree TASK */
|
||||
#define TASK_CPU 6 /* CICON in tree TASK */
|
||||
#define TASK_ST_TOTAL 9 /* TEXT in tree TASK */
|
||||
#define TASK_TT_TOTAL 11 /* TEXT in tree TASK */
|
||||
#define TASK_ST_FREE 13 /* TEXT in tree TASK */
|
||||
#define TASK_TT_FREE 15 /* TEXT in tree TASK */
|
||||
#define TASK_UPTIME 17 /* BOXTEXT in tree TASK */
|
||||
#define TASK_MEM 18 /* CICON in tree TASK */
|
||||
#define TASK_SHUTDOWN 19 /* CICON in tree TASK */
|
||||
#define TASK_PANEL1 20 /* BUTTON in tree TASK */
|
||||
#define TASK_BOX_00 21 /* BOX in tree TASK */
|
||||
#define TASK_UP 22 /* CICON in tree TASK */
|
||||
#define TASK_DOWN 23 /* CICON in tree TASK */
|
||||
#define TASK_VBACK 24 /* BOX in tree TASK */
|
||||
#define TASK_VMOVER 25 /* BOX in tree TASK */
|
||||
#define TASK_KILL 26 /* BUTTON in tree TASK */
|
||||
#define TASK_PROCESS_LIST 28 /* BOX in tree TASK */
|
||||
#define TASK_C_NAME 32 /* BOX in tree TASK */
|
||||
#define TASK_C_CPU 33 /* BOX in tree TASK */
|
||||
#define TASK_C_RAM 34 /* BOX in tree TASK */
|
||||
#define TASK_LED1 35 /* CICON in tree TASK */
|
||||
#define TASK_LED2 36 /* CICON in tree TASK */
|
||||
#define TASK_LED3 37 /* CICON in tree TASK */
|
||||
#define TASK_PROCESS 29 /* BUTTON in tree TASK */
|
||||
#define TASK_SYSTEM 30 /* BUTTON in tree TASK */
|
||||
#define TASK_NETWORK 31 /* BUTTON in tree TASK */
|
||||
|
||||
#define QUIT 3 /* form/dial */
|
||||
#define QUIT_NO 4 /* BUTTON in tree QUIT */
|
||||
#define QUIT_YES 5 /* BUTTON in tree QUIT */
|
||||
|
||||
#define PREFS 4 /* form/dial */
|
||||
#define PREFS_PANEL2 1 /* BUTTON in tree PREFS */
|
||||
#define PREFS_SYSTEM_INFO 2 /* BUTTON in tree PREFS */
|
||||
#define PREFS_SHOW_ACC 3 /* BUTTON in tree PREFS */
|
||||
#define PREFS_SHOW_US_CLOCK 10 /* BUTTON in tree PREFS */
|
||||
#define PREFS_SHOW_CLOCK 11 /* BUTTON in tree PREFS */
|
||||
#define PREFS_PANEL1 12 /* BUTTON in tree PREFS */
|
||||
#define PREFS_PREVIEW 14 /* BOX in tree PREFS */
|
||||
#define PREFS_OFF_BACK 17 /* BOX in tree PREFS */
|
||||
#define PREFS_OFF_LINE2 19 /* BOX in tree PREFS */
|
||||
#define PREFS_OFF_LINE1 20 /* BOX in tree PREFS */
|
||||
#define PREFS_OFF_TEXT1 22 /* BOX in tree PREFS */
|
||||
#define PREFS_OFF_TEXT2 23 /* BOX in tree PREFS */
|
||||
#define PREFS_ON_BACK 26 /* BOX in tree PREFS */
|
||||
#define PREFS_ON_LINE2 28 /* BOX in tree PREFS */
|
||||
#define PREFS_ON_LINE1 29 /* BOX in tree PREFS */
|
||||
#define PREFS_ON_TEXT1 31 /* BOX in tree PREFS */
|
||||
#define PREFS_ON_TEXT2 32 /* BOX in tree PREFS */
|
||||
#define PREFS_GEEK_BACK 35 /* BOX in tree PREFS */
|
||||
#define PREFS_GEEK_LINE2 37 /* BOX in tree PREFS */
|
||||
#define PREFS_GEEK_LINE1 38 /* BOX in tree PREFS */
|
||||
#define PREFS_GEEK_RAM1 40 /* BOX in tree PREFS */
|
||||
#define PREFS_GEEK_CPU 41 /* BOX in tree PREFS */
|
||||
#define PREFS_GEEK_RAM2 43 /* BOX in tree PREFS */
|
||||
#define PREFS_GEEK_TEXT 50 /* BOX in tree PREFS */
|
||||
#define PREFS_COLOR 44 /* BUTTON in tree PREFS */
|
||||
#define PREFS_MISC 45 /* BUTTON in tree PREFS */
|
||||
#define PREFS_OK 46 /* BUTTON in tree PREFS */
|
||||
#define PREFS_CANCEL 47 /* BUTTON in tree PREFS */
|
||||
#define PREFS_DEFAULT 48 /* BUTTON in tree PREFS */
|
||||
|
||||
#define S_SHUTDOWN 0 /* Free string */
|
||||
|
||||
#define S_PREFS 1 /* Free string */
|
||||
|
||||
#define S_TASKMAN 2 /* Free string */
|
||||
|
||||
#define S_KILL 3 /* Free string */
|
||||
|
||||
#define S_QUIT 4 /* Free string */
|
||||
|
||||
#define S_HIDE 5 /* Free string */
|
||||
|
||||
#define S_SCREENSHOT 6 /* Free string */
|
||||
|
||||
#define F_SHOW 7 /* Free string */
|
||||
|
||||
#define CPU_AVERAGE 0 /* Free image */
|
||||
95
sources/z-tools/trunk/ztask/ztask.rsm
Normal file
95
sources/z-tools/trunk/ztask/ztask.rsm
Normal file
@@ -0,0 +1,95 @@
|
||||
ResourceMaster v3.5
|
||||
#C 5@8@1@0@
|
||||
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
|
||||
#FoHRD@rsm2out@HRD@hrd@@@[HRD-File@0@
|
||||
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
|
||||
#R 0@0@3@1@3@1@
|
||||
#M 2001011@0@7728@580@
|
||||
#T 0@2@ICONS@@10@@
|
||||
#O 3@33@CPU@@
|
||||
#O 4@33@MEM@@
|
||||
#O 5@33@ARROW@@
|
||||
#O 6@33@NET@@
|
||||
#O 7@33@LED@@
|
||||
#O 8@33@MENU@@
|
||||
#O 9@33@SHUTDOWN@@
|
||||
#O 1@33@CONFIGURE@@
|
||||
#O 2@33@TASK@@
|
||||
#T 1@2@SHUTDOWN_DIAL@@7@@
|
||||
#O 1@26@OK@@
|
||||
#O 3@26@WARN@@
|
||||
#O 4@26@COLD@@
|
||||
#O 5@26@HALT@@
|
||||
#O 6@26@CANCEL@@
|
||||
#T 2@2@TASK@@38@@
|
||||
#O 1@26@PANEL3@@
|
||||
#O 3@26@PANEL2@@
|
||||
#O 5@20@CPU_AVERAGE@@
|
||||
#O 6@33@CPU@@
|
||||
#O 9@21@ST_TOTAL@@
|
||||
#O 11@21@TT_TOTAL@@
|
||||
#O 13@21@ST_FREE@@
|
||||
#O 15@21@TT_FREE@@
|
||||
#O 17@22@UPTIME@@
|
||||
#O 18@33@MEM@@
|
||||
#O 19@33@SHUTDOWN@@
|
||||
#O 20@26@PANEL1@@
|
||||
#O 21@20@BOX_00@@
|
||||
#O 22@33@UP@@
|
||||
#O 23@33@DOWN@@
|
||||
#O 24@20@VBACK@@
|
||||
#O 25@20@VMOVER@@
|
||||
#O 26@26@KILL@@
|
||||
#O 28@20@PROCESS_LIST@@
|
||||
#O 32@20@C_NAME@@
|
||||
#O 33@20@C_CPU@@
|
||||
#O 34@20@C_RAM@@
|
||||
#O 35@33@LED1@@
|
||||
#O 36@33@LED2@@
|
||||
#O 37@33@LED3@@
|
||||
#O 29@26@PROCESS@@
|
||||
#O 30@26@SYSTEM@@
|
||||
#O 31@26@NETWORK@@
|
||||
#T 3@2@QUIT@@6@@
|
||||
#O 4@26@NO@@
|
||||
#O 5@26@YES@@
|
||||
#T 4@2@PREFS@@51@@
|
||||
#O 1@26@PANEL2@@
|
||||
#O 2@26@SYSTEM_INFO@@
|
||||
#O 3@26@SHOW_ACC@@
|
||||
#O 10@26@SHOW_US_CLOCK@@
|
||||
#O 11@26@SHOW_CLOCK@@
|
||||
#O 12@26@PANEL1@@
|
||||
#O 14@20@PREVIEW@@
|
||||
#O 17@20@OFF_BACK@@
|
||||
#O 19@20@OFF_LINE2@@
|
||||
#O 20@20@OFF_LINE1@@
|
||||
#O 22@20@OFF_TEXT1@@
|
||||
#O 23@20@OFF_TEXT2@@
|
||||
#O 26@20@ON_BACK@@
|
||||
#O 28@20@ON_LINE2@@
|
||||
#O 29@20@ON_LINE1@@
|
||||
#O 31@20@ON_TEXT1@@
|
||||
#O 32@20@ON_TEXT2@@
|
||||
#O 35@20@GEEK_BACK@@
|
||||
#O 37@20@GEEK_LINE2@@
|
||||
#O 38@20@GEEK_LINE1@@
|
||||
#O 40@20@GEEK_RAM1@@
|
||||
#O 41@20@GEEK_CPU@@
|
||||
#O 43@20@GEEK_RAM2@@
|
||||
#O 50@20@GEEK_TEXT@@
|
||||
#O 44@26@COLOR@@
|
||||
#O 45@26@MISC@@
|
||||
#O 46@26@OK@@
|
||||
#O 47@26@CANCEL@@
|
||||
#O 48@26@DEFAULT@@
|
||||
#S 0@5@S_SHUTDOWN@@
|
||||
#S 1@5@S_PREFS@@
|
||||
#S 2@5@S_TASKMAN@@
|
||||
#S 3@5@S_KILL@@
|
||||
#S 4@5@S_QUIT@@
|
||||
#S 5@5@S_HIDE@@
|
||||
#S 6@5@S_SCREENSHOT@@
|
||||
#S 7@5@F_SHOW@@
|
||||
#I 0@6@CPU_AVERAGE@@
|
||||
#c 8983@
|
||||
80
sources/z-tools/trunk/zview/Makefile
Normal file
80
sources/z-tools/trunk/zview/Makefile
Normal 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
|
||||
674
sources/z-tools/trunk/zview/_dist/doc/copying.gpl
Normal file
674
sources/z-tools/trunk/zview/_dist/doc/copying.gpl
Normal 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>.
|
||||
272
sources/z-tools/trunk/zview/_dist/doc/history.txt
Normal file
272
sources/z-tools/trunk/zview/_dist/doc/history.txt
Normal 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.
|
||||
BIN
sources/z-tools/trunk/zview/_dist/doc/zView.hyp
Normal file
BIN
sources/z-tools/trunk/zview/_dist/doc/zView.hyp
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/d050000l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/d050000l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/n019003l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/n019003l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/n019004l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/n019004l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/n019023l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/n019023l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/n019024l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/n019024l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/n021003l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/n021003l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/n021004l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/n021004l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/n021023l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/n021023l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/n021024l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/n021024l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/n022003l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/n022003l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/n022004l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/n022004l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/n022023l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/n022023l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/n022024l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/n022024l.pfb
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/fonts/s050000l.pfb
Normal file
BIN
sources/z-tools/trunk/zview/_dist/fonts/s050000l.pfb
Normal file
Binary file not shown.
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
BIN
sources/z-tools/trunk/zview/_dist/goodies/Enhancer/Enhancer.prg
Normal file
BIN
sources/z-tools/trunk/zview/_dist/goodies/Enhancer/Enhancer.prg
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/goodies/jpegd.prg
Normal file
BIN
sources/z-tools/trunk/zview/_dist/goodies/jpegd.prg
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/goodies/nfjpeg.prg
Normal file
BIN
sources/z-tools/trunk/zview/_dist/goodies/nfjpeg.prg
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/goodies/zviewicn.rsc
Normal file
BIN
sources/z-tools/trunk/zview/_dist/goodies/zviewicn.rsc
Normal file
Binary file not shown.
BIN
sources/z-tools/trunk/zview/_dist/icons/file.god
Normal file
BIN
sources/z-tools/trunk/zview/_dist/icons/file.god
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user