Update dialog to version 20100428. This changes the license under which
dialog is distributed from GPLv2 to LGPLv2 and introduces a number of new features and a new and better libdialog API. The existing libdialog will be kept temporarily as libodialog for compatibility purposes until sade, sysinstall and tzsetup have been either updated or replaced. __FreeBSD_version is now 900030. Discussed on: -current Approved by: core Obtained from: http://invisible-island.net/dialog
This commit is contained in:
parent
bcaa0b6789
commit
4c8945a06b
@ -38,6 +38,51 @@
|
||||
# xargs -n1 | sort | uniq -d;
|
||||
# done
|
||||
|
||||
# 20110112: Update dialog to new version, rename old libdialog to libodialog,
|
||||
# removing associated man pages and header files.
|
||||
OLD_FILES+=usr/share/man/man3/draw_shadow.3.gz \
|
||||
usr/share/man/man3/draw_box.3.gz usr/share/man/man3/line_edit.3.gz \
|
||||
usr/share/man/man3/strheight.3.gz usr/share/man/man3/strwidth.3.gz \
|
||||
usr/share/man/man3/dialog_create_rc.3.gz \
|
||||
usr/share/man/man3/dialog_yesno.3.gz usr/share/man/man3/dialog_noyes.3.gz \
|
||||
usr/share/man/man3/dialog_prgbox.3.gz \
|
||||
usr/share/man/man3/dialog_textbox.3.gz usr/share/man/man3/dialog_menu.3.gz \
|
||||
usr/share/man/man3/dialog_checklist.3.gz \
|
||||
usr/share/man/man3/dialog_radiolist.3.gz \
|
||||
usr/share/man/man3/dialog_inputbox.3.gz \
|
||||
usr/share/man/man3/dialog_clear_norefresh.3.gz \
|
||||
usr/share/man/man3/dialog_clear.3.gz usr/share/man/man3/dialog_update.3.gz \
|
||||
usr/share/man/man3/dialog_fselect.3.gz \
|
||||
usr/share/man/man3/dialog_notify.3.gz \
|
||||
usr/share/man/man3/dialog_mesgbox.3.gz \
|
||||
usr/share/man/man3/dialog_gauge.3.gz usr/share/man/man3/init_dialog.3.gz \
|
||||
usr/share/man/man3/end_dialog.3.gz usr/share/man/man3/use_helpfile.3.gz \
|
||||
usr/share/man/man3/use_helpline.3.gz usr/share/man/man3/get_helpline.3.gz \
|
||||
usr/share/man/man3/restore_helpline.3.gz \
|
||||
usr/share/man/man3/dialog_msgbox.3.gz \
|
||||
usr/share/man/man3/dialog_ftree.3.gz usr/share/man/man3/dialog_tree.3.gz \
|
||||
usr/share/examples/dialog/README usr/share/examples/dialog/checklist \
|
||||
usr/share/examples/dialog/ftreebox usr/share/examples/dialog/infobox \
|
||||
usr/share/examples/dialog/inputbox usr/share/examples/dialog/menubox \
|
||||
usr/share/examples/dialog/msgbox usr/share/examples/dialog/prgbox \
|
||||
usr/share/examples/dialog/radiolist usr/share/examples/dialog/textbox \
|
||||
usr/share/examples/dialog/treebox usr/share/examples/dialog/yesno \
|
||||
usr/share/examples/libdialog/Makefile usr/share/examples/libdialog/check1.c\
|
||||
usr/share/examples/libdialog/check2.c usr/share/examples/libdialog/check3.c\
|
||||
usr/share/examples/libdialog/dselect.c \
|
||||
usr/share/examples/libdialog/fselect.c \
|
||||
usr/share/examples/libdialog/ftree1.c \
|
||||
usr/share/examples/libdialog/ftree1.test \
|
||||
usr/share/examples/libdialog/ftree2.c \
|
||||
usr/share/examples/libdialog/ftree2.test \
|
||||
usr/share/examples/libdialog/gauge.c usr/share/examples/libdialog/input1.c \
|
||||
usr/share/examples/libdialog/input2.c usr/share/examples/libdialog/menu1.c \
|
||||
usr/share/examples/libdialog/menu2.c usr/share/examples/libdialog/menu3.c \
|
||||
usr/share/examples/libdialog/msg.c usr/share/examples/libdialog/prgbox.c \
|
||||
usr/share/examples/libdialog/radio1.c usr/share/examples/libdialog/radio2.c\
|
||||
usr/share/examples/libdialog/radio3.c usr/share/examples/libdialog/text.c \
|
||||
usr/share/examples/libdialog/tree.c usr/share/examples/libdialog/yesno.c
|
||||
OLD_DIRS+=usr/share/examples/libdialog usr/share/examples/dialog
|
||||
# 20101114: Remove long-obsolete MAKEDEV.8
|
||||
OLD_FILES+=usr/share/man/man8/MAKEDEV.8.gz
|
||||
# 20101112: vgonel(9) has gone to private API a while ago
|
||||
|
8
UPDATING
8
UPDATING
@ -22,6 +22,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW:
|
||||
machines to maximize performance. (To disable malloc debugging, run
|
||||
ln -s aj /etc/malloc.conf.)
|
||||
|
||||
20110112:
|
||||
The system dialog(1) has been replaced with a new version previously
|
||||
in ports as devel/cdialog. dialog(1) is mostly command-line compatible
|
||||
with the previous version, but the libdialog associated with it has
|
||||
a largely incompatible API. As such, the original version of libdialog
|
||||
will be kept temporarily as libodialog, until its base system consumers
|
||||
are replaced or updated. Bump __FreeBSD_version to 900030.
|
||||
|
||||
20110103:
|
||||
If you are trying to run make universe on a -stable system, and you get
|
||||
the following warning:
|
||||
|
1526
contrib/dialog/CHANGES
Normal file
1526
contrib/dialog/CHANGES
Normal file
File diff suppressed because it is too large
Load Diff
504
contrib/dialog/COPYING
Normal file
504
contrib/dialog/COPYING
Normal file
@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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!
|
||||
|
||||
|
61
contrib/dialog/README
Normal file
61
contrib/dialog/README
Normal file
@ -0,0 +1,61 @@
|
||||
-(1999-12-25)-------------------------------------------------------------------
|
||||
This version of dialog, formerly known as cdialog is based on the Debian
|
||||
package for dialog 0.9a (see CHANGES for recent modifications)
|
||||
- T.Dickey <dickey@invisible-island.net>
|
||||
|
||||
-(1996-01-15)-------------------------------------------------------------------
|
||||
I have uploaded cdialog-0.9a.tar.gz to sunsite. It should be moved
|
||||
to pub/Linux/utils/shell, I think.
|
||||
|
||||
Starting point for cdialog v.0.9a was dialog-0.6c. Many new features
|
||||
like as Resolution-independence, Auto-sizing, Maximizing, more widget
|
||||
on the same screen (multi-widget), etc. were added. New widget are
|
||||
tailbox and tailbox-in-background. Here are the options:
|
||||
|
||||
Usage: dialog <Common options> <Box options>
|
||||
{ --and-widget <Common options> <Box options> }
|
||||
|
||||
Common options: <Global options>
|
||||
[--backtitle <backtitle>] [--sleep <secs>] [--beep] [--beep-after]
|
||||
[--clear] [--begin <y> <x>] [--aspect <ratio>] [--print-size]
|
||||
[--print-maxsize] [--size-err] [--separate-output] [--cr-wrap]
|
||||
[--tab-len <n>] [--tab-correct] [--print-version] [--no-kill]
|
||||
[--title <title>]
|
||||
|
||||
Global options: [--shadow] [--no-shadow] [--separate-widget "<str>"]
|
||||
|
||||
At the moment, mouse support with libgpm can't be added because it
|
||||
does't implement the wtimeout() function of ncurses. Wtimeout() is
|
||||
needed to have more widgets (es.tailbox) cooperating on the same
|
||||
screen... I don't know if with newer versions of libgpm it's possible.
|
||||
|
||||
I have no more time to write docs for this new version...Is there
|
||||
anyone, that looking at the code, can do it??? Ouch! :-)
|
||||
Don't flame me!
|
||||
|
||||
For the future, if any volunteer want, the way to evolve cdialog is to
|
||||
1) make a daemon for a better support of multi-tasking or implementing
|
||||
multithreading.
|
||||
2) add an option that could permit to read commands (--options) from a
|
||||
file, like as in a normal programming language, but maintaining
|
||||
compatiblity with older version of dialog.
|
||||
|
||||
I no longer could maintain cdialog...
|
||||
Executable and library name of cdialog are the same of dialog, for
|
||||
compatiblity.
|
||||
|
||||
I think that only one directive should be follow: don't use a resource
|
||||
like stdin, stdout when you'll write new options for cdialog; these
|
||||
resources have to be shared from all widgets on the command line.
|
||||
Guage uses stdin :-/ so that can't be mixed for example with an inputbox,
|
||||
but it was made before of multi-widget. However this is not a big problem!
|
||||
|
||||
THERE ARE NO *KNOWN* BUGS. If anyone has much time and can find the way
|
||||
to add wtimeout() support to libgpm, also mouse could be supported.
|
||||
|
||||
Please use ncurses-1.9.4 or newer.
|
||||
|
||||
| __ | demarco_p@abramo.it:~$ make Linux | more > UserFriendly;
|
||||
| /__) | /~~ _ _ _ _ /~\ _ / . _ |
|
||||
|/ ako | (___ (_) | ) ) (-' (__/ | ) /__ | | ) (_| >< . coordinator.
|
||||
|
1
contrib/dialog/VERSION
Normal file
1
contrib/dialog/VERSION
Normal file
@ -0,0 +1 @@
|
||||
7:1:0 1.1 20100428
|
3879
contrib/dialog/aclocal.m4
vendored
Normal file
3879
contrib/dialog/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
217
contrib/dialog/arrows.c
Normal file
217
contrib/dialog/arrows.c
Normal file
@ -0,0 +1,217 @@
|
||||
/*
|
||||
* $Id: arrows.c,v 1.29 2010/02/24 09:17:00 Samuel.Martin.Moro Exp $
|
||||
*
|
||||
* arrows.c -- draw arrows to indicate end-of-range for lists
|
||||
*
|
||||
* Copyright 2000-2009,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
|
||||
#ifdef USE_WIDE_CURSES
|
||||
#define add_acs(win, code) wadd_wch(win, W ## code)
|
||||
#else
|
||||
#define add_acs(win, code) waddch(win, dlg_boxchar(code))
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COLOR
|
||||
static chtype
|
||||
merge_colors(chtype foreground, chtype background)
|
||||
{
|
||||
chtype result = foreground;
|
||||
if ((foreground & A_COLOR) != (background & A_COLOR)) {
|
||||
short fg_f, bg_f;
|
||||
short fg_b, bg_b;
|
||||
short fg_pair = (short) PAIR_NUMBER(foreground);
|
||||
short bg_pair = (short) PAIR_NUMBER(background);
|
||||
|
||||
if (pair_content(fg_pair, &fg_f, &bg_f) != ERR
|
||||
&& pair_content(bg_pair, &fg_b, &bg_b) != ERR) {
|
||||
result &= ~A_COLOR;
|
||||
result |= dlg_color_pair(fg_f, bg_b);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
#define merge_colors(f,b) (f)
|
||||
#endif
|
||||
|
||||
void
|
||||
dlg_draw_arrows2(WINDOW *win,
|
||||
int top_arrow,
|
||||
int bottom_arrow,
|
||||
int x,
|
||||
int top,
|
||||
int bottom,
|
||||
chtype attr,
|
||||
chtype borderattr)
|
||||
{
|
||||
chtype save = getattrs(win);
|
||||
int cur_x, cur_y;
|
||||
int limit_x = getmaxx(win);
|
||||
bool draw_top = TRUE;
|
||||
|
||||
getyx(win, cur_y, cur_x);
|
||||
|
||||
/*
|
||||
* If we're drawing a centered title, do not overwrite with the arrows.
|
||||
*/
|
||||
if (dialog_vars.title) {
|
||||
int have = (limit_x - dlg_count_columns(dialog_vars.title)) / 2;
|
||||
int need = x + 5;
|
||||
if (need > have)
|
||||
draw_top = FALSE;
|
||||
}
|
||||
|
||||
if (draw_top) {
|
||||
(void) wmove(win, top, x);
|
||||
if (top_arrow) {
|
||||
wattrset(win, merge_colors(uarrow_attr, attr));
|
||||
(void) add_acs(win, ACS_UARROW);
|
||||
(void) waddstr(win, "(-)");
|
||||
} else {
|
||||
wattrset(win, attr);
|
||||
(void) whline(win, dlg_boxchar(ACS_HLINE), 4);
|
||||
}
|
||||
}
|
||||
mouse_mkbutton(top, x - 1, 6, KEY_PPAGE);
|
||||
|
||||
(void) wmove(win, bottom, x);
|
||||
if (bottom_arrow) {
|
||||
wattrset(win, merge_colors(darrow_attr, attr));
|
||||
(void) add_acs(win, ACS_DARROW);
|
||||
(void) waddstr(win, "(+)");
|
||||
} else {
|
||||
wattrset(win, borderattr);
|
||||
(void) whline(win, dlg_boxchar(ACS_HLINE), 4);
|
||||
}
|
||||
mouse_mkbutton(bottom, x - 1, 6, KEY_NPAGE);
|
||||
|
||||
(void) wmove(win, cur_y, cur_x);
|
||||
wrefresh(win);
|
||||
|
||||
wattrset(win, save);
|
||||
}
|
||||
|
||||
void
|
||||
dlg_draw_scrollbar(WINDOW *win,
|
||||
long first_data,
|
||||
long this_data,
|
||||
long next_data,
|
||||
long total_data,
|
||||
int left,
|
||||
int right,
|
||||
int top,
|
||||
int bottom,
|
||||
chtype attr,
|
||||
chtype borderattr)
|
||||
{
|
||||
char buffer[80];
|
||||
int percent;
|
||||
int len;
|
||||
int oldy, oldx, maxy, maxx;
|
||||
|
||||
chtype save = getattrs(win);
|
||||
int top_arrow = (first_data != 0);
|
||||
int bottom_arrow = (next_data < total_data);
|
||||
|
||||
getyx(win, oldy, oldx);
|
||||
getmaxyx(win, maxy, maxx);
|
||||
|
||||
if (bottom_arrow || top_arrow || dialog_state.use_scrollbar) {
|
||||
percent = (!total_data
|
||||
? 100
|
||||
: (int) ((next_data * 100)
|
||||
/ total_data));
|
||||
|
||||
if (percent < 0)
|
||||
percent = 0;
|
||||
else if (percent > 100)
|
||||
percent = 100;
|
||||
|
||||
wattrset(win, position_indicator_attr);
|
||||
(void) sprintf(buffer, "%d%%", percent);
|
||||
(void) wmove(win, bottom, right - 7);
|
||||
(void) waddstr(win, buffer);
|
||||
if ((len = dlg_count_columns(buffer)) < 4) {
|
||||
wattrset(win, border_attr);
|
||||
whline(win, dlg_boxchar(ACS_HLINE), 4 - len);
|
||||
}
|
||||
}
|
||||
#define BARSIZE(num) ((all_high * (num)) + all_high - 1) / total_data
|
||||
|
||||
if (dialog_state.use_scrollbar) {
|
||||
int all_high = (bottom - top - 1);
|
||||
|
||||
if (total_data > 0 && all_high > 0) {
|
||||
int bar_high;
|
||||
int bar_y;
|
||||
|
||||
bar_high = BARSIZE(next_data - this_data);
|
||||
if (bar_high <= 0)
|
||||
bar_high = 1;
|
||||
|
||||
if (bar_high < all_high) {
|
||||
wmove(win, top + 1, right);
|
||||
|
||||
wattrset(win, save);
|
||||
wvline(win, ACS_VLINE | A_REVERSE, all_high);
|
||||
|
||||
bar_y = BARSIZE(this_data);
|
||||
if (bar_y > all_high - bar_high)
|
||||
bar_y = all_high - bar_high;
|
||||
|
||||
wmove(win, top + 1 + bar_y, right);
|
||||
|
||||
wattrset(win, position_indicator_attr);
|
||||
wattron(win, A_REVERSE);
|
||||
wvline(win, ACS_BLOCK, bar_high);
|
||||
}
|
||||
}
|
||||
}
|
||||
dlg_draw_arrows2(win,
|
||||
top_arrow,
|
||||
bottom_arrow,
|
||||
left + ARROWS_COL,
|
||||
top,
|
||||
bottom,
|
||||
attr,
|
||||
borderattr);
|
||||
|
||||
wattrset(win, save);
|
||||
wmove(win, oldy, oldx);
|
||||
}
|
||||
|
||||
void
|
||||
dlg_draw_arrows(WINDOW *win,
|
||||
int top_arrow,
|
||||
int bottom_arrow,
|
||||
int x,
|
||||
int top,
|
||||
int bottom)
|
||||
{
|
||||
dlg_draw_arrows2(win,
|
||||
top_arrow,
|
||||
bottom_arrow,
|
||||
x,
|
||||
top,
|
||||
bottom,
|
||||
menubox_attr,
|
||||
menubox_border_attr);
|
||||
}
|
657
contrib/dialog/buttons.c
Normal file
657
contrib/dialog/buttons.c
Normal file
@ -0,0 +1,657 @@
|
||||
/*
|
||||
* $Id: buttons.c,v 1.81 2010/04/28 20:57:29 tom Exp $
|
||||
*
|
||||
* buttons.c -- draw buttons, e.g., OK/Cancel
|
||||
*
|
||||
* Copyright 2000-2007,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#ifdef NEED_WCHAR_H
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#define MIN_BUTTON (dialog_state.visit_items ? -1 : 0)
|
||||
|
||||
static void
|
||||
center_label(char *buffer, int longest, const char *label)
|
||||
{
|
||||
int len = dlg_count_columns(label);
|
||||
int left = 0, right = 0;
|
||||
|
||||
*buffer = 0;
|
||||
if (len < longest) {
|
||||
left = (longest - len) / 2;
|
||||
right = (longest - len - left);
|
||||
if (left > 0)
|
||||
sprintf(buffer, "%*s", left, " ");
|
||||
}
|
||||
strcat(buffer, label);
|
||||
if (right > 0)
|
||||
sprintf(buffer + strlen(buffer), "%*s", right, " ");
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse a multibyte character out of the string, set it past the parsed
|
||||
* character.
|
||||
*/
|
||||
static int
|
||||
string_to_char(const char **stringp)
|
||||
{
|
||||
int result;
|
||||
#ifdef USE_WIDE_CURSES
|
||||
const char *string = *stringp;
|
||||
size_t have = strlen(string);
|
||||
size_t check;
|
||||
size_t len;
|
||||
wchar_t cmp2[2];
|
||||
mbstate_t state;
|
||||
|
||||
memset(&state, 0, sizeof(state));
|
||||
len = mbrlen(string, have, &state);
|
||||
if ((int) len > 0 && len <= have) {
|
||||
memset(&state, 0, sizeof(state));
|
||||
memset(cmp2, 0, sizeof(cmp2));
|
||||
check = mbrtowc(cmp2, string, len, &state);
|
||||
if ((int) check <= 0)
|
||||
cmp2[0] = 0;
|
||||
*stringp += len;
|
||||
} else {
|
||||
cmp2[0] = UCH(*string);
|
||||
*stringp += 1;
|
||||
}
|
||||
result = cmp2[0];
|
||||
#else
|
||||
const char *string = *stringp;
|
||||
result = UCH(*string);
|
||||
*stringp += 1;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a button
|
||||
*/
|
||||
static void
|
||||
print_button(WINDOW *win, char *label, int y, int x, int selected)
|
||||
{
|
||||
int i;
|
||||
int state = 0;
|
||||
const int *indx = dlg_index_wchars(label);
|
||||
int limit = dlg_count_wchars(label);
|
||||
chtype key_attr = (selected
|
||||
? button_key_active_attr
|
||||
: button_key_inactive_attr);
|
||||
chtype label_attr = (selected
|
||||
? button_label_active_attr
|
||||
: button_label_inactive_attr);
|
||||
|
||||
(void) wmove(win, y, x);
|
||||
wattrset(win, selected
|
||||
? button_active_attr
|
||||
: button_inactive_attr);
|
||||
(void) waddstr(win, "<");
|
||||
wattrset(win, label_attr);
|
||||
for (i = 0; i < limit; ++i) {
|
||||
int first = indx[i];
|
||||
int last = indx[i + 1];
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
#ifdef USE_WIDE_CURSES
|
||||
if ((last - first) != 1) {
|
||||
const char *temp = (label + first);
|
||||
int cmp = string_to_char(&temp);
|
||||
if (dlg_isupper(cmp)) {
|
||||
wattrset(win, key_attr);
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if (dlg_isupper(UCH(label[first]))) {
|
||||
wattrset(win, key_attr);
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
wattrset(win, label_attr);
|
||||
state = 2;
|
||||
break;
|
||||
}
|
||||
waddnstr(win, label + first, last - first);
|
||||
}
|
||||
wattrset(win, selected
|
||||
? button_active_attr
|
||||
: button_inactive_attr);
|
||||
(void) waddstr(win, ">");
|
||||
(void) wmove(win, y, x + ((int) strspn(label, " ")) + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Count the buttons in the list.
|
||||
*/
|
||||
int
|
||||
dlg_button_count(const char **labels)
|
||||
{
|
||||
int result = 0;
|
||||
while (*labels++ != 0)
|
||||
++result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the size of the button array in columns. Return the total number of
|
||||
* columns in *length, and the longest button's columns in *longest
|
||||
*/
|
||||
void
|
||||
dlg_button_sizes(const char **labels,
|
||||
int vertical,
|
||||
int *longest,
|
||||
int *length)
|
||||
{
|
||||
int n;
|
||||
|
||||
*length = 0;
|
||||
*longest = 0;
|
||||
for (n = 0; labels[n] != 0; n++) {
|
||||
if (vertical) {
|
||||
*length += 1;
|
||||
*longest = 1;
|
||||
} else {
|
||||
int len = dlg_count_columns(labels[n]);
|
||||
if (len > *longest)
|
||||
*longest = len;
|
||||
*length += len;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If we can, make all of the buttons the same size. This is only optional
|
||||
* for buttons laid out horizontally.
|
||||
*/
|
||||
if (*longest < 6 - (*longest & 1))
|
||||
*longest = 6 - (*longest & 1);
|
||||
if (!vertical)
|
||||
*length = *longest * n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the size of the button array.
|
||||
*/
|
||||
int
|
||||
dlg_button_x_step(const char **labels, int limit, int *gap, int *margin, int *step)
|
||||
{
|
||||
int count = dlg_button_count(labels);
|
||||
int longest;
|
||||
int length;
|
||||
int unused;
|
||||
int used;
|
||||
|
||||
if (count == 0)
|
||||
return 0;
|
||||
dlg_button_sizes(labels, FALSE, &longest, &length);
|
||||
used = (length + (count * 2));
|
||||
unused = limit - used;
|
||||
|
||||
if ((*gap = unused / (count + 3)) <= 0) {
|
||||
if ((*gap = unused / (count + 1)) <= 0)
|
||||
*gap = 1;
|
||||
*margin = *gap;
|
||||
} else {
|
||||
*margin = *gap * 2;
|
||||
}
|
||||
*step = *gap + (used + count - 1) / count;
|
||||
return (*gap > 0) && (unused >= 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure there is enough space for the buttons
|
||||
*/
|
||||
void
|
||||
dlg_button_layout(const char **labels, int *limit)
|
||||
{
|
||||
int width = 1;
|
||||
int gap, margin, step;
|
||||
|
||||
if (labels != 0 && dlg_button_count(labels)) {
|
||||
while (!dlg_button_x_step(labels, width, &gap, &margin, &step))
|
||||
++width;
|
||||
width += (4 * MARGIN);
|
||||
if (width > COLS)
|
||||
width = COLS;
|
||||
if (width > *limit)
|
||||
*limit = width;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a list of buttons at the given position.
|
||||
*/
|
||||
void
|
||||
dlg_draw_buttons(WINDOW *win,
|
||||
int y, int x,
|
||||
const char **labels,
|
||||
int selected,
|
||||
int vertical,
|
||||
int limit)
|
||||
{
|
||||
chtype save = getattrs(win);
|
||||
int n;
|
||||
int step = 0;
|
||||
int length;
|
||||
int longest;
|
||||
int final_x;
|
||||
int final_y;
|
||||
int gap;
|
||||
int margin;
|
||||
size_t need;
|
||||
char *buffer;
|
||||
|
||||
dlg_mouse_setbase(getbegx(win), getbegy(win));
|
||||
|
||||
getyx(win, final_y, final_x);
|
||||
|
||||
dlg_button_sizes(labels, vertical, &longest, &length);
|
||||
|
||||
if (vertical) {
|
||||
y += 1;
|
||||
step = 1;
|
||||
} else {
|
||||
dlg_button_x_step(labels, limit, &gap, &margin, &step);
|
||||
x += margin;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a buffer big enough for any label.
|
||||
*/
|
||||
need = (size_t) longest;
|
||||
for (n = 0; labels[n] != 0; ++n) {
|
||||
need += strlen(labels[n]) + 1;
|
||||
}
|
||||
buffer = dlg_malloc(char, need);
|
||||
assert_ptr(buffer, "dlg_draw_buttons");
|
||||
|
||||
/*
|
||||
* Draw the labels.
|
||||
*/
|
||||
for (n = 0; labels[n] != 0; n++) {
|
||||
center_label(buffer, longest, labels[n]);
|
||||
mouse_mkbutton(y, x, dlg_count_columns(buffer), n);
|
||||
print_button(win, buffer, y, x,
|
||||
(selected == n) || (n == 0 && selected < 0));
|
||||
if (selected == n)
|
||||
getyx(win, final_y, final_x);
|
||||
|
||||
if (vertical) {
|
||||
if ((y += step) > limit)
|
||||
break;
|
||||
} else {
|
||||
if ((x += step) > limit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
(void) wmove(win, final_y, final_x);
|
||||
wrefresh(win);
|
||||
free(buffer);
|
||||
wattrset(win, save);
|
||||
}
|
||||
|
||||
/*
|
||||
* Match a given character against the beginning of the string, ignoring case
|
||||
* of the given character. The matching string must begin with an uppercase
|
||||
* character.
|
||||
*/
|
||||
int
|
||||
dlg_match_char(int ch, const char *string)
|
||||
{
|
||||
if (string != 0) {
|
||||
int cmp2 = string_to_char(&string);
|
||||
#ifdef USE_WIDE_CURSES
|
||||
wint_t cmp1 = dlg_toupper(ch);
|
||||
if (cmp2 != 0 && (wchar_t) cmp1 == (wchar_t) dlg_toupper(cmp2)) {
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
if (ch > 0 && ch < 256) {
|
||||
if (dlg_toupper(ch) == dlg_toupper(cmp2))
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the first uppercase character in the label, which we may use for an
|
||||
* abbreviation.
|
||||
*/
|
||||
int
|
||||
dlg_button_to_char(const char *label)
|
||||
{
|
||||
int cmp = -1;
|
||||
|
||||
while (*label != 0) {
|
||||
cmp = string_to_char(&label);
|
||||
if (dlg_isupper(cmp)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return cmp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a list of button labels, and a character which may be the abbreviation
|
||||
* for one, find it, if it exists. An abbreviation will be the first character
|
||||
* which happens to be capitalized in the label.
|
||||
*/
|
||||
int
|
||||
dlg_char_to_button(int ch, const char **labels)
|
||||
{
|
||||
if (labels != 0) {
|
||||
int j;
|
||||
|
||||
ch = (int) dlg_toupper(dlg_last_getc());
|
||||
for (j = 0; labels[j] != 0; ++j) {
|
||||
int cmp = dlg_button_to_char(labels[j]);
|
||||
if (ch == cmp) {
|
||||
dlg_flush_getc();
|
||||
return j;
|
||||
}
|
||||
}
|
||||
}
|
||||
return DLG_EXIT_UNKNOWN;
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_yes_label(void)
|
||||
{
|
||||
return (dialog_vars.yes_label != NULL)
|
||||
? dialog_vars.yes_label
|
||||
: _("Yes");
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_no_label(void)
|
||||
{
|
||||
return (dialog_vars.no_label != NULL)
|
||||
? dialog_vars.no_label
|
||||
: _("No");
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_ok_label(void)
|
||||
{
|
||||
return (dialog_vars.ok_label != NULL)
|
||||
? dialog_vars.ok_label
|
||||
: _("OK");
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_cancel_label(void)
|
||||
{
|
||||
return (dialog_vars.cancel_label != NULL)
|
||||
? dialog_vars.cancel_label
|
||||
: _("Cancel");
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_exit_label(void)
|
||||
{
|
||||
return (dialog_vars.exit_label != NULL)
|
||||
? dialog_vars.exit_label
|
||||
: _("EXIT");
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_extra_label(void)
|
||||
{
|
||||
return (dialog_vars.extra_label != NULL)
|
||||
? dialog_vars.extra_label
|
||||
: _("Extra");
|
||||
}
|
||||
|
||||
static const char *
|
||||
my_help_label(void)
|
||||
{
|
||||
return (dialog_vars.help_label != NULL)
|
||||
? dialog_vars.help_label
|
||||
: _("Help");
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a list of button labels.
|
||||
*/
|
||||
const char **
|
||||
dlg_exit_label(void)
|
||||
{
|
||||
const char **result;
|
||||
|
||||
if (dialog_vars.extra_button) {
|
||||
result = dlg_ok_labels();
|
||||
} else {
|
||||
static const char *labels[3];
|
||||
int n = 0;
|
||||
|
||||
labels[n++] = my_exit_label();
|
||||
if (dialog_vars.help_button)
|
||||
labels[n++] = my_help_label();
|
||||
labels[n] = 0;
|
||||
|
||||
result = labels;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Map the given button index for dlg_exit_label() into our exit-code.
|
||||
*/
|
||||
int
|
||||
dlg_exit_buttoncode(int button)
|
||||
{
|
||||
int result = DLG_EXIT_ERROR;
|
||||
|
||||
if (dialog_vars.extra_button) {
|
||||
result = dlg_ok_buttoncode(button);
|
||||
} else if (button == 0) {
|
||||
result = DLG_EXIT_OK;
|
||||
} else if (button == 1 && dialog_vars.help_button) {
|
||||
result = DLG_EXIT_HELP;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const char **
|
||||
dlg_ok_label(void)
|
||||
{
|
||||
static const char *labels[3];
|
||||
int n = 0;
|
||||
|
||||
labels[n++] = my_ok_label();
|
||||
if (dialog_vars.help_button)
|
||||
labels[n++] = my_help_label();
|
||||
labels[n] = 0;
|
||||
return labels;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a list of button labels for the OK/Cancel group.
|
||||
*/
|
||||
const char **
|
||||
dlg_ok_labels(void)
|
||||
{
|
||||
static const char *labels[5];
|
||||
int n = 0;
|
||||
|
||||
if (!dialog_vars.nook)
|
||||
labels[n++] = my_ok_label();
|
||||
if (dialog_vars.extra_button)
|
||||
labels[n++] = my_extra_label();
|
||||
if (!dialog_vars.nocancel)
|
||||
labels[n++] = my_cancel_label();
|
||||
if (dialog_vars.help_button)
|
||||
labels[n++] = my_help_label();
|
||||
labels[n] = 0;
|
||||
return labels;
|
||||
}
|
||||
|
||||
/*
|
||||
* Map the given button index for dlg_ok_labels() into our exit-code
|
||||
*/
|
||||
int
|
||||
dlg_ok_buttoncode(int button)
|
||||
{
|
||||
int result = DLG_EXIT_ERROR;
|
||||
int n = !dialog_vars.nook;
|
||||
|
||||
if (!dialog_vars.nook && (button <= 0)) {
|
||||
result = DLG_EXIT_OK;
|
||||
} else if (dialog_vars.extra_button && (button == n++)) {
|
||||
result = DLG_EXIT_EXTRA;
|
||||
} else if (!dialog_vars.nocancel && (button == n++)) {
|
||||
result = DLG_EXIT_CANCEL;
|
||||
} else if (dialog_vars.help_button && (button == n)) {
|
||||
result = DLG_EXIT_HELP;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given that we're using dlg_ok_labels() to list buttons, find the next index
|
||||
* in the list of buttons. The 'extra' parameter if negative provides a way to
|
||||
* enumerate extra active areas on the widget.
|
||||
*/
|
||||
int
|
||||
dlg_next_ok_buttonindex(int current, int extra)
|
||||
{
|
||||
int result = current + 1;
|
||||
|
||||
if (current >= 0
|
||||
&& dlg_ok_buttoncode(result) < 0)
|
||||
result = extra;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Similarly, find the previous button index.
|
||||
*/
|
||||
int
|
||||
dlg_prev_ok_buttonindex(int current, int extra)
|
||||
{
|
||||
int result = current - 1;
|
||||
|
||||
if (result < extra) {
|
||||
for (result = 0; dlg_ok_buttoncode(result + 1) >= 0; ++result) {
|
||||
;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the button-index for the "OK" or "Cancel" button, according to
|
||||
* whether --defaultno is given. If --nocancel was given, we always return
|
||||
* the index for "OK".
|
||||
*/
|
||||
int
|
||||
dlg_defaultno_button(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
if (dialog_vars.defaultno && !dialog_vars.nocancel) {
|
||||
while (dlg_ok_buttoncode(result) != DLG_EXIT_CANCEL)
|
||||
++result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a list of buttons for Yes/No labels.
|
||||
*/
|
||||
const char **
|
||||
dlg_yes_labels(void)
|
||||
{
|
||||
const char **result;
|
||||
|
||||
if (dialog_vars.extra_button) {
|
||||
result = dlg_ok_labels();
|
||||
} else {
|
||||
static const char *labels[4];
|
||||
int n = 0;
|
||||
|
||||
labels[n++] = my_yes_label();
|
||||
labels[n++] = my_no_label();
|
||||
if (dialog_vars.help_button)
|
||||
labels[n++] = my_help_label();
|
||||
labels[n] = 0;
|
||||
|
||||
result = labels;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Map the given button index for dlg_yes_labels() into our exit-code.
|
||||
*/
|
||||
int
|
||||
dlg_yes_buttoncode(int button)
|
||||
{
|
||||
int result = DLG_EXIT_ERROR;
|
||||
|
||||
if (dialog_vars.extra_button) {
|
||||
result = dlg_ok_buttoncode(button);
|
||||
} else if (button == 0) {
|
||||
result = DLG_EXIT_OK;
|
||||
} else if (button == 1) {
|
||||
result = DLG_EXIT_CANCEL;
|
||||
} else if (button == 2 && dialog_vars.help_button) {
|
||||
result = DLG_EXIT_HELP;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the next index in labels[];
|
||||
*/
|
||||
int
|
||||
dlg_next_button(const char **labels, int button)
|
||||
{
|
||||
if (labels[button + 1] != 0)
|
||||
++button;
|
||||
else
|
||||
button = MIN_BUTTON;
|
||||
return button;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the previous index in labels[];
|
||||
*/
|
||||
int
|
||||
dlg_prev_button(const char **labels, int button)
|
||||
{
|
||||
if (button > MIN_BUTTON)
|
||||
--button;
|
||||
else {
|
||||
while (labels[button + 1] != 0)
|
||||
++button;
|
||||
}
|
||||
return button;
|
||||
}
|
678
contrib/dialog/calendar.c
Normal file
678
contrib/dialog/calendar.c
Normal file
@ -0,0 +1,678 @@
|
||||
/*
|
||||
* $Id: calendar.c,v 1.59 2010/01/18 09:50:44 tom Exp $
|
||||
*
|
||||
* calendar.c -- implements the calendar box
|
||||
*
|
||||
* Copyright 2001-2009,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#define ONE_DAY (60 * 60 * 24)
|
||||
|
||||
#define MON_WIDE 4 /* width of a month-name */
|
||||
#define DAY_HIGH 6 /* maximum lines in day-grid */
|
||||
#define DAY_WIDE (8 * MON_WIDE) /* width of the day-grid */
|
||||
#define HDR_HIGH 1 /* height of cells with month/year */
|
||||
#define BTN_HIGH 1 /* height of button-row excluding margin */
|
||||
|
||||
/* two more lines: titles for day-of-week and month/year boxes */
|
||||
#define MIN_HIGH (DAY_HIGH + 2 + HDR_HIGH + BTN_HIGH + (7 * MARGIN))
|
||||
#define MIN_WIDE (DAY_WIDE + (4 * MARGIN))
|
||||
|
||||
typedef enum {
|
||||
sMONTH = -3
|
||||
,sYEAR = -2
|
||||
,sDAY = -1
|
||||
} STATES;
|
||||
|
||||
struct _box;
|
||||
|
||||
typedef int (*BOX_DRAW) (struct _box *, struct tm *);
|
||||
|
||||
typedef struct _box {
|
||||
WINDOW *parent;
|
||||
WINDOW *window;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
BOX_DRAW box_draw;
|
||||
} BOX;
|
||||
|
||||
static const char *
|
||||
nameOfDayOfWeek(int n)
|
||||
{
|
||||
static const char *table[7]
|
||||
#ifndef ENABLE_NLS
|
||||
=
|
||||
{
|
||||
"Sunday",
|
||||
"Monday",
|
||||
"Tuesday",
|
||||
"Wednesday",
|
||||
"Thursday",
|
||||
"Friday",
|
||||
"Saturday"
|
||||
}
|
||||
#endif
|
||||
;
|
||||
const char *result = 0;
|
||||
|
||||
if (n >= 0 && n < 7) {
|
||||
#ifdef ENABLE_NLS
|
||||
if (table[n] == 0) {
|
||||
nl_item items[7] =
|
||||
{
|
||||
ABDAY_1, ABDAY_2, ABDAY_3, ABDAY_4, ABDAY_5, ABDAY_6, ABDAY_7
|
||||
};
|
||||
table[n] = nl_langinfo(items[n]);
|
||||
}
|
||||
#endif
|
||||
result = table[n];
|
||||
}
|
||||
if (result == 0) {
|
||||
result = "?";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static const char *
|
||||
nameOfMonth(int n)
|
||||
{
|
||||
static const char *table[12]
|
||||
#ifndef ENABLE_NLS
|
||||
=
|
||||
{
|
||||
"January",
|
||||
"February",
|
||||
"March",
|
||||
"April",
|
||||
"May",
|
||||
"June",
|
||||
"July",
|
||||
"August",
|
||||
"September",
|
||||
"October",
|
||||
"November",
|
||||
"December"
|
||||
}
|
||||
#endif
|
||||
;
|
||||
const char *result = 0;
|
||||
|
||||
if (n >= 0 && n < 12) {
|
||||
#ifdef ENABLE_NLS
|
||||
if (table[n] == 0) {
|
||||
nl_item items[12] =
|
||||
{
|
||||
MON_1, MON_2, MON_3, MON_4, MON_5, MON_6,
|
||||
MON_7, MON_8, MON_9, MON_10, MON_11, MON_12
|
||||
};
|
||||
table[n] = nl_langinfo(items[n]);
|
||||
}
|
||||
#endif
|
||||
result = table[n];
|
||||
}
|
||||
if (result == 0) {
|
||||
result = "?";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
days_in_month(struct tm *current, int offset /* -1, 0, 1 */ )
|
||||
{
|
||||
static const int nominal[] =
|
||||
{
|
||||
31, 28, 31, 30, 31, 30,
|
||||
31, 31, 30, 31, 30, 31
|
||||
};
|
||||
int year = current->tm_year;
|
||||
int month = current->tm_mon + offset;
|
||||
int result;
|
||||
|
||||
while (month < 0) {
|
||||
month += 12;
|
||||
year -= 1;
|
||||
}
|
||||
while (month >= 12) {
|
||||
month -= 12;
|
||||
year += 1;
|
||||
}
|
||||
result = nominal[month];
|
||||
if (month == 1)
|
||||
result += ((year % 4) == 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
days_in_year(struct tm *current, int offset /* -1, 0, 1 */ )
|
||||
{
|
||||
int year = current->tm_year + 1900 + offset;
|
||||
|
||||
return ((year % 4) == 0) ? 366 : 365;
|
||||
}
|
||||
|
||||
static int
|
||||
day_cell_number(struct tm *current)
|
||||
{
|
||||
int cell;
|
||||
cell = current->tm_mday - ((6 + current->tm_mday - current->tm_wday) % 7);
|
||||
if ((current->tm_mday - 1) % 7 != current->tm_wday)
|
||||
cell += 6;
|
||||
else
|
||||
cell--;
|
||||
return cell;
|
||||
}
|
||||
|
||||
static int
|
||||
next_or_previous(int key, int two_d)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
switch (key) {
|
||||
case DLGK_GRID_UP:
|
||||
result = two_d ? -7 : -1;
|
||||
break;
|
||||
case DLGK_GRID_LEFT:
|
||||
result = -1;
|
||||
break;
|
||||
case DLGK_GRID_DOWN:
|
||||
result = two_d ? 7 : 1;
|
||||
break;
|
||||
case DLGK_GRID_RIGHT:
|
||||
result = 1;
|
||||
break;
|
||||
default:
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw the day-of-month selection box
|
||||
*/
|
||||
static int
|
||||
draw_day(BOX * data, struct tm *current)
|
||||
{
|
||||
int cell_wide = MON_WIDE;
|
||||
int y, x, this_x = 0;
|
||||
int save_y = 0, save_x = 0;
|
||||
int day = current->tm_mday;
|
||||
int mday;
|
||||
int week;
|
||||
int last = days_in_month(current, 0);
|
||||
int prev = days_in_month(current, -1);
|
||||
|
||||
werase(data->window);
|
||||
dlg_draw_box(data->parent,
|
||||
data->y - MARGIN, data->x - MARGIN,
|
||||
data->height + (2 * MARGIN), data->width + (2 * MARGIN),
|
||||
menubox_border_attr, menubox_attr); /* border of daybox */
|
||||
|
||||
wattrset(data->window, menubox_attr); /* daynames headline */
|
||||
for (x = 0; x < 7; x++) {
|
||||
mvwprintw(data->window,
|
||||
0, (x + 1) * cell_wide, "%*.*s ",
|
||||
cell_wide - 1,
|
||||
cell_wide - 1,
|
||||
nameOfDayOfWeek(x));
|
||||
}
|
||||
|
||||
mday = ((6 + current->tm_mday - current->tm_wday) % 7) - 7;
|
||||
if (mday <= -7)
|
||||
mday += 7;
|
||||
/* mday is now in the range -6 to 0. */
|
||||
week = (current->tm_yday + 6 + mday - current->tm_mday) / 7;
|
||||
|
||||
for (y = 1; mday < last; y++) {
|
||||
wattrset(data->window, menubox_attr); /* weeknumbers headline */
|
||||
mvwprintw(data->window,
|
||||
y, 0,
|
||||
"%*d ",
|
||||
cell_wide - 1,
|
||||
++week);
|
||||
for (x = 0; x < 7; x++) {
|
||||
this_x = 1 + (x + 1) * cell_wide;
|
||||
++mday;
|
||||
if (wmove(data->window, y, this_x) == ERR)
|
||||
continue;
|
||||
wattrset(data->window, item_attr); /* not selected days */
|
||||
if (mday == day) {
|
||||
wattrset(data->window, item_selected_attr); /* selected day */
|
||||
save_y = y;
|
||||
save_x = this_x;
|
||||
}
|
||||
if (mday > 0) {
|
||||
if (mday <= last) {
|
||||
wprintw(data->window, "%*d", cell_wide - 2, mday);
|
||||
} else if (mday == day) {
|
||||
wprintw(data->window, "%*d", cell_wide - 2, mday - last);
|
||||
}
|
||||
} else if (mday == day) {
|
||||
wprintw(data->window, "%*d", cell_wide - 2, mday + prev);
|
||||
}
|
||||
}
|
||||
wmove(data->window, save_y, save_x);
|
||||
}
|
||||
/* just draw arrows - scrollbar is unsuitable here */
|
||||
dlg_draw_arrows(data->parent, TRUE, TRUE,
|
||||
data->x + ARROWS_COL,
|
||||
data->y - 1,
|
||||
data->y + data->height);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw the month-of-year selection box
|
||||
*/
|
||||
static int
|
||||
draw_month(BOX * data, struct tm *current)
|
||||
{
|
||||
int month;
|
||||
|
||||
month = current->tm_mon + 1;
|
||||
|
||||
wattrset(data->parent, dialog_attr); /* Headline "Month" */
|
||||
(void) mvwprintw(data->parent, data->y - 2, data->x - 1, _("Month"));
|
||||
dlg_draw_box(data->parent,
|
||||
data->y - 1, data->x - 1,
|
||||
data->height + 2, data->width + 2,
|
||||
menubox_border_attr, menubox_attr); /* borders of monthbox */
|
||||
wattrset(data->window, item_attr); /* color the month selection */
|
||||
mvwprintw(data->window, 0, 0, "%s", nameOfMonth(month - 1));
|
||||
wmove(data->window, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw the year selection box
|
||||
*/
|
||||
static int
|
||||
draw_year(BOX * data, struct tm *current)
|
||||
{
|
||||
int year = current->tm_year + 1900;
|
||||
|
||||
wattrset(data->parent, dialog_attr); /* Headline "Year" */
|
||||
(void) mvwprintw(data->parent, data->y - 2, data->x - 1, _("Year"));
|
||||
dlg_draw_box(data->parent,
|
||||
data->y - 1, data->x - 1,
|
||||
data->height + 2, data->width + 2,
|
||||
menubox_border_attr, menubox_attr); /* borders of yearbox */
|
||||
wattrset(data->window, item_attr); /* color the year selection */
|
||||
mvwprintw(data->window, 0, 0, "%4d", year);
|
||||
wmove(data->window, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
init_object(BOX * data,
|
||||
WINDOW *parent,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
BOX_DRAW box_draw,
|
||||
int code)
|
||||
{
|
||||
data->parent = parent;
|
||||
data->x = x;
|
||||
data->y = y;
|
||||
data->width = width;
|
||||
data->height = height;
|
||||
data->box_draw = box_draw;
|
||||
|
||||
data->window = derwin(data->parent,
|
||||
data->height, data->width,
|
||||
data->y, data->x);
|
||||
if (data->window == 0)
|
||||
return -1;
|
||||
(void) keypad(data->window, TRUE);
|
||||
|
||||
dlg_mouse_setbase(getbegx(parent), getbegy(parent));
|
||||
if (code == 'D') {
|
||||
dlg_mouse_mkbigregion(y + 1, x + MON_WIDE, height - 1, width - MON_WIDE,
|
||||
KEY_MAX, 1, MON_WIDE, 3);
|
||||
} else {
|
||||
dlg_mouse_mkregion(y, x, height, width, code);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
CleanupResult(int code, WINDOW *dialog, char *prompt, DIALOG_VARS * save_vars)
|
||||
{
|
||||
if (dialog != 0)
|
||||
dlg_del_window(dialog);
|
||||
dlg_mouse_free_regions();
|
||||
if (prompt != 0)
|
||||
free(prompt);
|
||||
dlg_restore_vars(save_vars);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
#define DrawObject(data) (data)->box_draw(data, ¤t)
|
||||
|
||||
/*
|
||||
* Display a dialog box for entering a date
|
||||
*/
|
||||
int
|
||||
dialog_calendar(const char *title,
|
||||
const char *subtitle,
|
||||
int height,
|
||||
int width,
|
||||
int day,
|
||||
int month,
|
||||
int year)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
static DLG_KEYS_BINDING binding[] = {
|
||||
ENTERKEY_BINDINGS,
|
||||
DLG_KEYS_DATA( DLGK_ENTER, ' ' ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_DOWN, 'j' ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_DOWN, DLGK_MOUSE(KEY_NPAGE) ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_DOWN, KEY_DOWN ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_DOWN, KEY_NPAGE ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_LEFT, '-' ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_LEFT, 'h' ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_LEFT, CHR_BACKSPACE ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_LEFT, CHR_PREVIOUS ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_LEFT, KEY_LEFT ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_RIGHT, '+' ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_RIGHT, 'l' ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_RIGHT, CHR_NEXT ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_RIGHT, KEY_NEXT ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_RIGHT, KEY_RIGHT ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, 'k' ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, KEY_PPAGE ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, KEY_PREVIOUS ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, KEY_UP ),
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, DLGK_MOUSE(KEY_PPAGE) ),
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
#endif
|
||||
BOX dy_box, mn_box, yr_box;
|
||||
int fkey;
|
||||
int key = 0;
|
||||
int key2;
|
||||
int step;
|
||||
int button;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
WINDOW *dialog;
|
||||
time_t now_time = time((time_t *) 0);
|
||||
struct tm current;
|
||||
int state = dlg_defaultno_button();
|
||||
const char **buttons = dlg_ok_labels();
|
||||
char *prompt = dlg_strclone(subtitle);
|
||||
int mincols = MIN_WIDE;
|
||||
char buffer[MAX_LEN];
|
||||
DIALOG_VARS save_vars;
|
||||
|
||||
dlg_save_vars(&save_vars);
|
||||
dialog_vars.separate_output = TRUE;
|
||||
|
||||
dlg_does_output();
|
||||
|
||||
now_time = time((time_t *) 0);
|
||||
current = *localtime(&now_time);
|
||||
if (day < 0)
|
||||
day = current.tm_mday;
|
||||
if (month < 0)
|
||||
month = current.tm_mon + 1;
|
||||
if (year < 0)
|
||||
year = current.tm_year + 1900;
|
||||
|
||||
/* compute a struct tm that matches the day/month/year parameters */
|
||||
if (((year -= 1900) > 0) && (year < 200)) {
|
||||
/* ugly, but I'd like to run this on older machines w/o mktime -TD */
|
||||
for (;;) {
|
||||
if (year > current.tm_year) {
|
||||
now_time += ONE_DAY * days_in_year(¤t, 0);
|
||||
} else if (year < current.tm_year) {
|
||||
now_time -= ONE_DAY * days_in_year(¤t, -1);
|
||||
} else if (month > current.tm_mon + 1) {
|
||||
now_time += ONE_DAY * days_in_month(¤t, 0);
|
||||
} else if (month < current.tm_mon + 1) {
|
||||
now_time -= ONE_DAY * days_in_month(¤t, -1);
|
||||
} else if (day > current.tm_mday) {
|
||||
now_time += ONE_DAY;
|
||||
} else if (day < current.tm_mday) {
|
||||
now_time -= ONE_DAY;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
current = *localtime(&now_time);
|
||||
}
|
||||
}
|
||||
dlg_button_layout(buttons, &mincols);
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
retry:
|
||||
#endif
|
||||
|
||||
dlg_auto_size(title, prompt, &height, &width, 0, mincols);
|
||||
height += MIN_HIGH - 1;
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
dialog = dlg_new_window(height, width,
|
||||
dlg_box_y_ordinate(height),
|
||||
dlg_box_x_ordinate(width));
|
||||
dlg_register_window(dialog, "calendar", binding);
|
||||
dlg_register_buttons(dialog, "calendar", buttons);
|
||||
|
||||
/* mainbox */
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr); /* text mainbox */
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
/* compute positions of day, month and year boxes */
|
||||
memset(&dy_box, 0, sizeof(dy_box));
|
||||
memset(&mn_box, 0, sizeof(mn_box));
|
||||
memset(&yr_box, 0, sizeof(yr_box));
|
||||
|
||||
if (init_object(&dy_box,
|
||||
dialog,
|
||||
(width - DAY_WIDE) / 2,
|
||||
1 + (height - (DAY_HIGH + BTN_HIGH + (5 * MARGIN))),
|
||||
DAY_WIDE,
|
||||
DAY_HIGH + 1,
|
||||
draw_day,
|
||||
'D') < 0
|
||||
|| DrawObject(&dy_box) < 0) {
|
||||
return CleanupResult(DLG_EXIT_ERROR, dialog, prompt, &save_vars);
|
||||
}
|
||||
|
||||
if (init_object(&mn_box,
|
||||
dialog,
|
||||
dy_box.x,
|
||||
dy_box.y - (HDR_HIGH + 2 * MARGIN),
|
||||
(DAY_WIDE / 2) - MARGIN,
|
||||
HDR_HIGH,
|
||||
draw_month,
|
||||
'M') < 0
|
||||
|| DrawObject(&mn_box) < 0) {
|
||||
return CleanupResult(DLG_EXIT_ERROR, dialog, prompt, &save_vars);
|
||||
}
|
||||
|
||||
if (init_object(&yr_box,
|
||||
dialog,
|
||||
dy_box.x + mn_box.width + 2,
|
||||
mn_box.y,
|
||||
mn_box.width,
|
||||
mn_box.height,
|
||||
draw_year,
|
||||
'Y') < 0
|
||||
|| DrawObject(&yr_box) < 0) {
|
||||
return CleanupResult(DLG_EXIT_ERROR, dialog, prompt, &save_vars);
|
||||
}
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
BOX *obj = (state == sDAY ? &dy_box
|
||||
: (state == sMONTH ? &mn_box :
|
||||
(state == sYEAR ? &yr_box : 0)));
|
||||
|
||||
button = (state < 0) ? 0 : state;
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
if (obj != 0)
|
||||
dlg_set_focus(dialog, obj->window);
|
||||
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
break;
|
||||
|
||||
if (fkey && (key >= DLGK_MOUSE(KEY_MIN) && key <= DLGK_MOUSE(KEY_MAX))) {
|
||||
key = dlg_lookup_key(dialog, key - M_EVENT, &fkey);
|
||||
}
|
||||
|
||||
if ((key2 = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
result = key2;
|
||||
} else if (fkey) {
|
||||
/* handle function-keys */
|
||||
switch (key) {
|
||||
case DLGK_MOUSE('D'):
|
||||
state = sDAY;
|
||||
break;
|
||||
case DLGK_MOUSE('M'):
|
||||
state = sMONTH;
|
||||
break;
|
||||
case DLGK_MOUSE('Y'):
|
||||
state = sYEAR;
|
||||
break;
|
||||
case DLGK_ENTER:
|
||||
result = dlg_ok_buttoncode(button);
|
||||
break;
|
||||
case DLGK_FIELD_PREV:
|
||||
state = dlg_prev_ok_buttonindex(state, sMONTH);
|
||||
break;
|
||||
case DLGK_FIELD_NEXT:
|
||||
state = dlg_next_ok_buttonindex(state, sMONTH);
|
||||
break;
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
/* reset data */
|
||||
height = old_height;
|
||||
width = old_width;
|
||||
/* repaint */
|
||||
dlg_clear();
|
||||
dlg_del_window(dialog);
|
||||
refresh();
|
||||
dlg_mouse_free_regions();
|
||||
goto retry;
|
||||
#endif
|
||||
default:
|
||||
step = 0;
|
||||
key2 = -1;
|
||||
if (is_DLGK_MOUSE(key)) {
|
||||
if ((key2 = dlg_ok_buttoncode(key - M_EVENT)) >= 0) {
|
||||
result = key2;
|
||||
break;
|
||||
} else if (key >= DLGK_MOUSE(KEY_MAX)) {
|
||||
state = sDAY;
|
||||
obj = &dy_box;
|
||||
key2 = 1;
|
||||
step = (key
|
||||
- DLGK_MOUSE(KEY_MAX)
|
||||
- day_cell_number(¤t));
|
||||
}
|
||||
}
|
||||
if (obj != 0) {
|
||||
if (key2 < 0)
|
||||
step = next_or_previous(key, (obj == &dy_box));
|
||||
if (step != 0) {
|
||||
struct tm old = current;
|
||||
|
||||
/* see comment regarding mktime -TD */
|
||||
if (obj == &dy_box) {
|
||||
now_time += ONE_DAY * step;
|
||||
} else if (obj == &mn_box) {
|
||||
if (step > 0)
|
||||
now_time += ONE_DAY *
|
||||
days_in_month(¤t, 0);
|
||||
else
|
||||
now_time -= ONE_DAY *
|
||||
days_in_month(¤t, -1);
|
||||
} else if (obj == &yr_box) {
|
||||
if (step > 0)
|
||||
now_time += (ONE_DAY
|
||||
* days_in_year(¤t, 0));
|
||||
else
|
||||
now_time -= (ONE_DAY
|
||||
* days_in_year(¤t, -1));
|
||||
}
|
||||
|
||||
current = *localtime(&now_time);
|
||||
|
||||
if (obj != &dy_box
|
||||
&& (current.tm_mday != old.tm_mday
|
||||
|| current.tm_mon != old.tm_mon
|
||||
|| current.tm_year != old.tm_year))
|
||||
DrawObject(&dy_box);
|
||||
if (obj != &mn_box && current.tm_mon != old.tm_mon)
|
||||
DrawObject(&mn_box);
|
||||
if (obj != &yr_box && current.tm_year != old.tm_year)
|
||||
DrawObject(&yr_box);
|
||||
(void) DrawObject(obj);
|
||||
}
|
||||
} else if (state >= 0) {
|
||||
if (next_or_previous(key, FALSE) < 0)
|
||||
state = dlg_prev_ok_buttonindex(state, sMONTH);
|
||||
else if (next_or_previous(key, FALSE) > 0)
|
||||
state = dlg_next_ok_buttonindex(state, sMONTH);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define DefaultFormat(dst, src) \
|
||||
sprintf(dst, "%02d/%02d/%0d", \
|
||||
src.tm_mday, src.tm_mon + 1, src.tm_year + 1900)
|
||||
#ifdef HAVE_STRFTIME
|
||||
if (dialog_vars.date_format != 0) {
|
||||
size_t used = strftime(buffer,
|
||||
sizeof(buffer) - 1,
|
||||
dialog_vars.date_format,
|
||||
¤t);
|
||||
if (used == 0 || *buffer == '\0')
|
||||
DefaultFormat(buffer, current);
|
||||
} else
|
||||
#endif
|
||||
DefaultFormat(buffer, current);
|
||||
|
||||
dlg_add_result(buffer);
|
||||
dlg_add_separator();
|
||||
|
||||
return CleanupResult(result, dialog, prompt, &save_vars);
|
||||
}
|
712
contrib/dialog/checklist.c
Normal file
712
contrib/dialog/checklist.c
Normal file
@ -0,0 +1,712 @@
|
||||
/*
|
||||
* $Id: checklist.c,v 1.121 2010/01/17 19:32:17 tom Exp $
|
||||
*
|
||||
* checklist.c -- implements the checklist box
|
||||
*
|
||||
* Copyright 2000-2009,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*
|
||||
* An earlier version of this program lists as authors:
|
||||
* Savio Lam (lam836@cs.cuhk.hk)
|
||||
* Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension
|
||||
* Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
static int list_width, check_x, item_x, checkflag;
|
||||
|
||||
#define MIN_HIGH (1 + (5 * MARGIN))
|
||||
|
||||
#define LLEN(n) ((n) * CHECKBOX_TAGS)
|
||||
#define ItemData(i) &items[LLEN(i)]
|
||||
#define ItemName(i) items[LLEN(i)]
|
||||
#define ItemText(i) items[LLEN(i) + 1]
|
||||
#define ItemStatus(i) items[LLEN(i) + 2]
|
||||
#define ItemHelp(i) items[LLEN(i) + 3]
|
||||
|
||||
static void
|
||||
print_arrows(WINDOW *win,
|
||||
int box_x,
|
||||
int box_y,
|
||||
int scrollamt,
|
||||
int choice,
|
||||
int item_no,
|
||||
int list_height)
|
||||
{
|
||||
dlg_draw_scrollbar(win,
|
||||
scrollamt,
|
||||
scrollamt,
|
||||
scrollamt + choice,
|
||||
item_no,
|
||||
box_x + check_x,
|
||||
box_x + list_width,
|
||||
box_y,
|
||||
box_y + list_height + 1,
|
||||
menubox_attr,
|
||||
menubox_border_attr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print list item. The 'selected' parameter is true if 'choice' is the
|
||||
* current item. That one is colored differently from the other items.
|
||||
*/
|
||||
static void
|
||||
print_item(WINDOW *win,
|
||||
DIALOG_LISTITEM * item,
|
||||
const char *states,
|
||||
int choice,
|
||||
int selected)
|
||||
{
|
||||
chtype save = getattrs(win);
|
||||
int i;
|
||||
chtype attr = A_NORMAL;
|
||||
const int *cols;
|
||||
const int *indx;
|
||||
int limit;
|
||||
|
||||
/* Clear 'residue' of last item */
|
||||
wattrset(win, menubox_attr);
|
||||
(void) wmove(win, choice, 0);
|
||||
for (i = 0; i < list_width; i++)
|
||||
(void) waddch(win, ' ');
|
||||
|
||||
(void) wmove(win, choice, check_x);
|
||||
wattrset(win, selected ? check_selected_attr : check_attr);
|
||||
(void) wprintw(win,
|
||||
(checkflag == FLAG_CHECK) ? "[%c]" : "(%c)",
|
||||
states[item->state]);
|
||||
wattrset(win, menubox_attr);
|
||||
(void) waddch(win, ' ');
|
||||
|
||||
if (strlen(item->name) != 0) {
|
||||
|
||||
indx = dlg_index_wchars(item->name);
|
||||
|
||||
wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
|
||||
(void) waddnstr(win, item->name, indx[1]);
|
||||
|
||||
if ((int) strlen(item->name) > indx[1]) {
|
||||
limit = dlg_limit_columns(item->name, (item_x - check_x - 6), 1);
|
||||
if (limit > 1) {
|
||||
wattrset(win, selected ? tag_selected_attr : tag_attr);
|
||||
(void) waddnstr(win,
|
||||
item->name + indx[1],
|
||||
indx[limit] - indx[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(item->text) != 0) {
|
||||
cols = dlg_index_columns(item->text);
|
||||
limit = dlg_limit_columns(item->text, (getmaxx(win) - item_x + 1), 0);
|
||||
|
||||
if (limit > 0) {
|
||||
(void) wmove(win, choice, item_x);
|
||||
wattrset(win, selected ? item_selected_attr : item_attr);
|
||||
dlg_print_text(win, item->text, cols[limit], &attr);
|
||||
}
|
||||
}
|
||||
|
||||
if (selected) {
|
||||
dlg_item_help(item->help);
|
||||
}
|
||||
wattrset(win, save);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is an alternate interface to 'checklist' which allows the application
|
||||
* to read the list item states back directly without putting them in the
|
||||
* output buffer. It also provides for more than two states over which the
|
||||
* check/radio box can display.
|
||||
*/
|
||||
int
|
||||
dlg_checklist(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int list_height,
|
||||
int item_no,
|
||||
DIALOG_LISTITEM * items,
|
||||
const char *states,
|
||||
int flag,
|
||||
int *current_item)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
static DLG_KEYS_BINDING binding[] = {
|
||||
ENTERKEY_BINDINGS,
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_FIRST, KEY_HOME ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_LAST, KEY_END ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_LAST, KEY_LL ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, '+' ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, KEY_DOWN ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, CHR_NEXT ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, '-' ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, KEY_UP ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, CHR_PREVIOUS ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, DLGK_MOUSE(KEY_NPAGE) ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, DLGK_MOUSE(KEY_PPAGE) ),
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
#endif
|
||||
int i, j, key2, found, x, y, cur_x, cur_y, box_x, box_y;
|
||||
int key = 0, fkey;
|
||||
int button = dialog_state.visit_items ? -1 : dlg_defaultno_button();
|
||||
int choice = dlg_default_listitem(items);
|
||||
int scrollamt = 0;
|
||||
int max_choice;
|
||||
int was_mouse;
|
||||
int use_height;
|
||||
int use_width, name_width, text_width;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int num_states;
|
||||
WINDOW *dialog, *list;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_labels();
|
||||
|
||||
dlg_does_output();
|
||||
dlg_tab_correct_str(prompt);
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
retry:
|
||||
#endif
|
||||
|
||||
use_height = list_height;
|
||||
if (use_height == 0) {
|
||||
use_width = dlg_calc_list_width(item_no, items) + 10;
|
||||
/* calculate height without items (4) */
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, MAX(26, use_width));
|
||||
dlg_calc_listh(&height, &use_height, item_no);
|
||||
} else {
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH + use_height, 26);
|
||||
}
|
||||
dlg_button_layout(buttons, &width);
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
/* we need at least two states */
|
||||
if (states == 0 || strlen(states) < 2)
|
||||
states = " *";
|
||||
num_states = (int) strlen(states);
|
||||
|
||||
checkflag = flag;
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
dlg_register_window(dialog, "checklist", binding);
|
||||
dlg_register_buttons(dialog, "checklist", buttons);
|
||||
|
||||
dlg_mouse_setbase(x, y);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
list_width = width - 6;
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
box_y = cur_y + 1;
|
||||
box_x = (width - list_width) / 2 - 1;
|
||||
|
||||
/*
|
||||
* After displaying the prompt, we know how much space we really have.
|
||||
* Limit the list to avoid overwriting the ok-button.
|
||||
*/
|
||||
if (use_height + MIN_HIGH > height - cur_y)
|
||||
use_height = height - MIN_HIGH - cur_y;
|
||||
if (use_height <= 0)
|
||||
use_height = 1;
|
||||
|
||||
max_choice = MIN(use_height, item_no);
|
||||
|
||||
/* create new window for the list */
|
||||
list = dlg_sub_window(dialog, use_height, list_width,
|
||||
y + box_y + 1, x + box_x + 1);
|
||||
|
||||
/* draw a box around the list items */
|
||||
dlg_draw_box(dialog, box_y, box_x,
|
||||
use_height + 2 * MARGIN,
|
||||
list_width + 2 * MARGIN,
|
||||
menubox_border_attr, menubox_attr);
|
||||
|
||||
text_width = 0;
|
||||
name_width = 0;
|
||||
/* Find length of longest item to center checklist */
|
||||
for (i = 0; i < item_no; i++) {
|
||||
text_width = MAX(text_width, dlg_count_columns(items[i].text));
|
||||
name_width = MAX(name_width, dlg_count_columns(items[i].name));
|
||||
}
|
||||
|
||||
/* If the name+text is wider than the list is allowed, then truncate
|
||||
* one or both of them. If the name is no wider than 1/4 of the list,
|
||||
* leave it intact.
|
||||
*/
|
||||
use_width = (list_width - 6);
|
||||
if (text_width + name_width > use_width) {
|
||||
int need = (int) (0.25 * use_width);
|
||||
if (name_width > need) {
|
||||
int want = (int) (use_width * ((double) name_width) /
|
||||
(text_width + name_width));
|
||||
name_width = (want > need) ? want : need;
|
||||
}
|
||||
text_width = use_width - name_width;
|
||||
}
|
||||
|
||||
check_x = (use_width - (text_width + name_width)) / 2;
|
||||
item_x = name_width + check_x + 6;
|
||||
|
||||
/* ensure we are scrolled to show the current choice */
|
||||
if (choice >= (max_choice + scrollamt)) {
|
||||
scrollamt = choice - max_choice + 1;
|
||||
choice = max_choice - 1;
|
||||
}
|
||||
/* Print the list */
|
||||
for (i = 0; i < max_choice; i++)
|
||||
print_item(list,
|
||||
&items[i + scrollamt],
|
||||
states,
|
||||
i, i == choice);
|
||||
(void) wnoutrefresh(list);
|
||||
|
||||
/* register the new window, along with its borders */
|
||||
dlg_mouse_mkbigregion(box_y + 1, box_x, use_height, list_width + 2,
|
||||
KEY_MAX, 1, 1, 1 /* by lines */ );
|
||||
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, max_choice, item_no, use_height);
|
||||
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
if (button < 0) /* --visit-items */
|
||||
wmove(dialog, box_y + choice + 1, box_x + check_x + 2);
|
||||
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
break;
|
||||
|
||||
was_mouse = (fkey && is_DLGK_MOUSE(key));
|
||||
if (was_mouse)
|
||||
key -= M_EVENT;
|
||||
|
||||
if (was_mouse && (key >= KEY_MAX)) {
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
i = (key - KEY_MAX);
|
||||
if (i < max_choice) {
|
||||
/* De-highlight current item */
|
||||
print_item(list,
|
||||
&items[scrollamt + choice],
|
||||
states,
|
||||
choice, FALSE);
|
||||
/* Highlight new item */
|
||||
choice = (key - KEY_MAX);
|
||||
print_item(list,
|
||||
&items[scrollamt + choice],
|
||||
states,
|
||||
choice, TRUE);
|
||||
(void) wnoutrefresh(list);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
|
||||
key = ' '; /* force the selected item to toggle */
|
||||
} else {
|
||||
beep();
|
||||
continue;
|
||||
}
|
||||
fkey = FALSE;
|
||||
} else if (was_mouse && key >= KEY_MIN) {
|
||||
key = dlg_lookup_key(dialog, key, &fkey);
|
||||
}
|
||||
|
||||
/*
|
||||
* A space toggles the item status. We handle either a checklist
|
||||
* (any number of items can be selected) or radio list (zero or one
|
||||
* items can be selected).
|
||||
*/
|
||||
if (key == ' ') {
|
||||
int current = scrollamt + choice;
|
||||
int next = items[current].state + 1;
|
||||
|
||||
if (next >= num_states)
|
||||
next = 0;
|
||||
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
if (flag == FLAG_CHECK) { /* checklist? */
|
||||
items[current].state = next;
|
||||
print_item(list,
|
||||
&items[scrollamt + choice],
|
||||
states,
|
||||
choice, TRUE);
|
||||
} else { /* radiolist */
|
||||
for (i = 0; i < item_no; i++) {
|
||||
if (i != current) {
|
||||
items[i].state = 0;
|
||||
}
|
||||
}
|
||||
if (items[current].state) {
|
||||
items[current].state = next ? next : 1;
|
||||
print_item(list,
|
||||
&items[current],
|
||||
states,
|
||||
choice, TRUE);
|
||||
} else {
|
||||
items[current].state = 1;
|
||||
for (i = 0; i < max_choice; i++)
|
||||
print_item(list,
|
||||
&items[scrollamt + i],
|
||||
states,
|
||||
i, i == choice);
|
||||
}
|
||||
}
|
||||
(void) wnoutrefresh(list);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
wrefresh(dialog);
|
||||
continue; /* wait for another key press */
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if key pressed matches first character of any item tag in
|
||||
* list. If there is more than one match, we will cycle through
|
||||
* each one as the same key is pressed repeatedly.
|
||||
*/
|
||||
found = FALSE;
|
||||
if (!fkey) {
|
||||
if (button < 0 || !dialog_state.visit_items) {
|
||||
for (j = scrollamt + choice + 1; j < item_no; j++) {
|
||||
if (dlg_match_char(dlg_last_getc(), items[j].name)) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
for (j = 0; j <= scrollamt + choice; j++) {
|
||||
if (dlg_match_char(dlg_last_getc(), items[j].name)) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
dlg_flush_getc();
|
||||
} else if ((j = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
button = j;
|
||||
ungetch('\n');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A single digit (1-9) positions the selection to that line in the
|
||||
* current screen.
|
||||
*/
|
||||
if (!found
|
||||
&& (key <= '9')
|
||||
&& (key > '0')
|
||||
&& (key - '1' < max_choice)) {
|
||||
found = TRUE;
|
||||
i = key - '1';
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
if (fkey) {
|
||||
found = TRUE;
|
||||
switch (key) {
|
||||
case DLGK_ITEM_FIRST:
|
||||
i = -scrollamt;
|
||||
break;
|
||||
case DLGK_ITEM_LAST:
|
||||
i = item_no - 1 - scrollamt;
|
||||
break;
|
||||
case DLGK_PAGE_PREV:
|
||||
if (choice)
|
||||
i = 0;
|
||||
else if (scrollamt != 0)
|
||||
i = -MIN(scrollamt, max_choice);
|
||||
else
|
||||
continue;
|
||||
break;
|
||||
case DLGK_PAGE_NEXT:
|
||||
i = MIN(choice + max_choice, item_no - scrollamt - 1);
|
||||
break;
|
||||
case DLGK_ITEM_PREV:
|
||||
i = choice - 1;
|
||||
if (choice == 0 && scrollamt == 0)
|
||||
continue;
|
||||
break;
|
||||
case DLGK_ITEM_NEXT:
|
||||
i = choice + 1;
|
||||
if (scrollamt + choice >= item_no - 1)
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
found = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
if (i != choice) {
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
if (i < 0 || i >= max_choice) {
|
||||
#if defined(NCURSES_VERSION_MAJOR) && NCURSES_VERSION_MAJOR < 5
|
||||
/*
|
||||
* Using wscrl to assist ncurses scrolling is not needed
|
||||
* in version 5.x
|
||||
*/
|
||||
if (i == -1) {
|
||||
if (use_height > 1) {
|
||||
/* De-highlight current first item */
|
||||
print_item(list,
|
||||
&items[scrollamt],
|
||||
states,
|
||||
0, FALSE);
|
||||
scrollok(list, TRUE);
|
||||
wscrl(list, -1);
|
||||
scrollok(list, FALSE);
|
||||
}
|
||||
scrollamt--;
|
||||
print_item(list,
|
||||
&items[scrollamt],
|
||||
states,
|
||||
0, TRUE);
|
||||
} else if (i == max_choice) {
|
||||
if (use_height > 1) {
|
||||
/* De-highlight current last item before scrolling up */
|
||||
print_item(list,
|
||||
&items[scrollamt + max_choice - 1],
|
||||
states,
|
||||
max_choice - 1, FALSE);
|
||||
scrollok(list, TRUE);
|
||||
wscrl(list, 1);
|
||||
scrollok(list, FALSE);
|
||||
}
|
||||
scrollamt++;
|
||||
print_item(list,
|
||||
&items[scrollamt + max_choice - 1],
|
||||
states,
|
||||
max_choice - 1, TRUE);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (i < 0) {
|
||||
scrollamt += i;
|
||||
choice = 0;
|
||||
} else {
|
||||
choice = max_choice - 1;
|
||||
scrollamt += (i - max_choice + 1);
|
||||
}
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(list,
|
||||
&items[scrollamt + i],
|
||||
states,
|
||||
i, i == choice);
|
||||
}
|
||||
}
|
||||
(void) wnoutrefresh(list);
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, max_choice, item_no, use_height);
|
||||
} else {
|
||||
/* De-highlight current item */
|
||||
print_item(list,
|
||||
&items[scrollamt + choice],
|
||||
states,
|
||||
choice, FALSE);
|
||||
/* Highlight new item */
|
||||
choice = i;
|
||||
print_item(list,
|
||||
&items[scrollamt + choice],
|
||||
states,
|
||||
choice, TRUE);
|
||||
(void) wnoutrefresh(list);
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, max_choice, item_no, use_height);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
wrefresh(dialog);
|
||||
}
|
||||
}
|
||||
continue; /* wait for another key press */
|
||||
}
|
||||
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case DLGK_ENTER:
|
||||
result = dlg_ok_buttoncode(button);
|
||||
break;
|
||||
case DLGK_FIELD_PREV:
|
||||
button = dlg_prev_button(buttons, button);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
case DLGK_FIELD_NEXT:
|
||||
button = dlg_next_button(buttons, button);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
/* reset data */
|
||||
height = old_height;
|
||||
width = old_width;
|
||||
/* repaint */
|
||||
dlg_clear();
|
||||
dlg_del_window(dialog);
|
||||
refresh();
|
||||
dlg_mouse_free_regions();
|
||||
goto retry;
|
||||
#endif
|
||||
default:
|
||||
if (was_mouse) {
|
||||
if ((key2 = dlg_ok_buttoncode(key)) >= 0) {
|
||||
result = key2;
|
||||
break;
|
||||
}
|
||||
beep();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
beep();
|
||||
}
|
||||
}
|
||||
|
||||
dlg_del_window(dialog);
|
||||
dlg_mouse_free_regions();
|
||||
free(prompt);
|
||||
*current_item = (scrollamt + choice);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a dialog box with a list of options that can be turned on or off
|
||||
* The `flag' parameter is used to select between radiolist and checklist.
|
||||
*/
|
||||
int
|
||||
dialog_checklist(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int list_height,
|
||||
int item_no,
|
||||
char **items,
|
||||
int flag)
|
||||
{
|
||||
int result;
|
||||
int i;
|
||||
DIALOG_LISTITEM *listitems;
|
||||
bool separate_output = ((flag == FLAG_CHECK)
|
||||
&& (dialog_vars.separate_output));
|
||||
bool show_status = FALSE;
|
||||
int current = 0;
|
||||
|
||||
listitems = dlg_calloc(DIALOG_LISTITEM, (size_t) item_no + 1);
|
||||
assert_ptr(listitems, "dialog_checklist");
|
||||
|
||||
for (i = 0; i < item_no; ++i) {
|
||||
listitems[i].name = ItemName(i);
|
||||
listitems[i].text = ItemText(i);
|
||||
listitems[i].help = ((dialog_vars.item_help)
|
||||
? ItemHelp(i)
|
||||
: dlg_strempty());
|
||||
listitems[i].state = !dlg_strcmp(ItemStatus(i), "on");
|
||||
}
|
||||
dlg_align_columns(&listitems[0].text, sizeof(DIALOG_LISTITEM), item_no);
|
||||
|
||||
result = dlg_checklist(title,
|
||||
cprompt,
|
||||
height,
|
||||
width,
|
||||
list_height,
|
||||
item_no,
|
||||
listitems,
|
||||
NULL,
|
||||
flag,
|
||||
¤t);
|
||||
|
||||
switch (result) {
|
||||
case DLG_EXIT_OK: /* FALLTHRU */
|
||||
case DLG_EXIT_EXTRA:
|
||||
show_status = TRUE;
|
||||
break;
|
||||
case DLG_EXIT_HELP:
|
||||
dlg_add_result("HELP ");
|
||||
show_status = dialog_vars.help_status;
|
||||
if (USE_ITEM_HELP(listitems[current].help)) {
|
||||
if (show_status) {
|
||||
if (separate_output) {
|
||||
dlg_add_string(listitems[current].help);
|
||||
dlg_add_separator();
|
||||
} else {
|
||||
dlg_add_quoted(listitems[current].help);
|
||||
}
|
||||
} else {
|
||||
dlg_add_string(listitems[current].help);
|
||||
}
|
||||
result = DLG_EXIT_ITEM_HELP;
|
||||
} else {
|
||||
if (show_status) {
|
||||
if (separate_output) {
|
||||
dlg_add_string(listitems[current].name);
|
||||
dlg_add_separator();
|
||||
} else {
|
||||
dlg_add_quoted(listitems[current].name);
|
||||
}
|
||||
} else {
|
||||
dlg_add_string(listitems[current].name);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (show_status) {
|
||||
for (i = 0; i < item_no; i++) {
|
||||
if (listitems[i].state) {
|
||||
if (separate_output) {
|
||||
dlg_add_string(listitems[i].name);
|
||||
dlg_add_separator();
|
||||
} else {
|
||||
if (dlg_need_separator())
|
||||
dlg_add_separator();
|
||||
dlg_add_string(listitems[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dlg_free_columns(&listitems[0].text, sizeof(DIALOG_LISTITEM), item_no);
|
||||
free(listitems);
|
||||
return result;
|
||||
}
|
174
contrib/dialog/columns.c
Normal file
174
contrib/dialog/columns.c
Normal file
@ -0,0 +1,174 @@
|
||||
/*
|
||||
* $Id: columns.c,v 1.5 2010/01/18 10:26:36 tom Exp $
|
||||
*
|
||||
* columns.c -- implements column-alignment
|
||||
*
|
||||
* Copyright 2008,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
|
||||
#define each(row, data) \
|
||||
row = 0, data = target; \
|
||||
row < num_rows - 1; \
|
||||
++row, data = next_row(data, per_row)
|
||||
|
||||
static char *
|
||||
column_separator(void)
|
||||
{
|
||||
char *result = 0;
|
||||
|
||||
if ((result = dialog_vars.column_separator) != 0) {
|
||||
if (*result == '\0')
|
||||
result = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static char **
|
||||
next_row(char **target, int per_row)
|
||||
{
|
||||
char *result = (char *) target;
|
||||
result += per_row;
|
||||
return (char **) result;
|
||||
}
|
||||
|
||||
static char *
|
||||
next_col(char *source, unsigned offset)
|
||||
{
|
||||
char *mark = column_separator();
|
||||
char *result = source + offset;
|
||||
if (offset)
|
||||
result += strlen(mark);
|
||||
return strstr(result, mark);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the source string, storing the offsets and widths of each column in
|
||||
* the corresponding arrays. Return the number of columns.
|
||||
*/
|
||||
static unsigned
|
||||
split_row(char *source, unsigned *offsets, unsigned *widths)
|
||||
{
|
||||
int mark = (int) strlen(column_separator());
|
||||
char *next = 0;
|
||||
unsigned result = 0;
|
||||
unsigned offset = 0;
|
||||
|
||||
do {
|
||||
if (result) {
|
||||
offset = (unsigned) (mark + next - source);
|
||||
widths[result - 1] = offset - offsets[result - 1] - (unsigned) mark;
|
||||
}
|
||||
offsets[result] = offset;
|
||||
++result;
|
||||
} while ((next = next_col(source, offset)) != 0);
|
||||
|
||||
offset = strlen(source);
|
||||
widths[result - 1] = offset - offsets[result - 1];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* The caller passes a pointer to a struct or array containing pointers
|
||||
* to strings that we may want to copy and reformat according to the column
|
||||
* separator.
|
||||
*/
|
||||
void
|
||||
dlg_align_columns(char **target, int per_row, int num_rows)
|
||||
{
|
||||
int row;
|
||||
|
||||
if (column_separator()) {
|
||||
char **value;
|
||||
unsigned numcols = 1;
|
||||
unsigned maxcols = 0;
|
||||
unsigned *widths;
|
||||
unsigned *offsets;
|
||||
unsigned *maxwidth;
|
||||
unsigned realwidth;
|
||||
unsigned n;
|
||||
|
||||
/* first allocate arrays for workspace */
|
||||
for (each(row, value)) {
|
||||
unsigned len = strlen(*value);
|
||||
if (maxcols < len)
|
||||
maxcols = len;
|
||||
}
|
||||
++maxcols;
|
||||
widths = dlg_calloc(unsigned, maxcols);
|
||||
offsets = dlg_calloc(unsigned, maxcols);
|
||||
maxwidth = dlg_calloc(unsigned, maxcols);
|
||||
|
||||
assert_ptr(widths, "dlg_align_columns");
|
||||
assert_ptr(offsets, "dlg_align_columns");
|
||||
assert_ptr(maxwidth, "dlg_align_columns");
|
||||
|
||||
/* now, determine the number of columns and the column-widths */
|
||||
for (each(row, value)) {
|
||||
unsigned cols = split_row(*value, offsets, widths);
|
||||
if (numcols < cols)
|
||||
numcols = cols;
|
||||
for (n = 0; n < cols; ++n) {
|
||||
if (maxwidth[n] < widths[n])
|
||||
maxwidth[n] = widths[n];
|
||||
}
|
||||
}
|
||||
realwidth = numcols - 1;
|
||||
for (n = 0; n < numcols; ++n) {
|
||||
realwidth += maxwidth[n];
|
||||
}
|
||||
|
||||
/* finally, construct reformatted strings */
|
||||
for (each(row, value)) {
|
||||
unsigned cols = split_row(*value, offsets, widths);
|
||||
unsigned offset = 0;
|
||||
char *text = dlg_malloc(char, realwidth + 1);
|
||||
|
||||
assert_ptr(text, "dlg_align_columns");
|
||||
|
||||
memset(text, ' ', realwidth);
|
||||
for (n = 0; n < cols; ++n) {
|
||||
memcpy(text + offset, *value + offsets[n], widths[n]);
|
||||
offset += maxwidth[n] + 1;
|
||||
}
|
||||
*value = text;
|
||||
}
|
||||
|
||||
free(widths);
|
||||
free(offsets);
|
||||
free(maxwidth);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Free temporary storage used while making column-aligned data.
|
||||
*/
|
||||
void
|
||||
dlg_free_columns(char **target, int per_row, int num_rows)
|
||||
{
|
||||
int row;
|
||||
char **value;
|
||||
|
||||
if (column_separator()) {
|
||||
for (each(row, value)) {
|
||||
free(*value);
|
||||
}
|
||||
}
|
||||
}
|
1502
contrib/dialog/config.guess
vendored
Executable file
1502
contrib/dialog/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
4
contrib/dialog/config.hin
Normal file
4
contrib/dialog/config.hin
Normal file
@ -0,0 +1,4 @@
|
||||
/*
|
||||
* The configure script expands this as a set of definitions
|
||||
*/
|
||||
@DEFS@
|
1708
contrib/dialog/config.sub
vendored
Executable file
1708
contrib/dialog/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
14272
contrib/dialog/configure
vendored
Executable file
14272
contrib/dialog/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
187
contrib/dialog/configure.in
Normal file
187
contrib/dialog/configure.in
Normal file
@ -0,0 +1,187 @@
|
||||
dnl $Id: configure.in,v 1.57 2010/04/28 20:33:01 tom Exp $
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
AC_PREREQ(2.13.20020210)
|
||||
AC_INIT(dialog.h)
|
||||
AC_CONFIG_HEADER(dlg_config.h:config.hin)
|
||||
|
||||
CF_VERSION_INFO(dialog)
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
DESTDIR=
|
||||
AC_SUBST(DESTDIR)
|
||||
|
||||
dnl
|
||||
dnl Checks for programs.
|
||||
dnl
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_INSTALL
|
||||
|
||||
dnl needed for CF_WITH_LIBTOOL
|
||||
AC_CHECK_TOOL(AR, ar, ar)
|
||||
|
||||
AC_ISC_POSIX
|
||||
AC_C_CONST
|
||||
|
||||
CF_MAKEFLAGS
|
||||
CF_MAKE_TAGS
|
||||
CF_DISABLE_ECHO
|
||||
CF_PROG_EXT
|
||||
CF_PATHSEP
|
||||
CF_LIB_PREFIX
|
||||
CF_XOPEN_SOURCE
|
||||
CF_LARGEFILE
|
||||
|
||||
CF_WITH_WARNINGS
|
||||
|
||||
dnl
|
||||
dnl Checks for libraries.
|
||||
dnl
|
||||
EXTRAOBJS=""
|
||||
CF_BUNDLED_INTL(makefile,enable)
|
||||
CF_MATH_LIB(,sqrt(x))
|
||||
|
||||
CF_WITH_NO_LEAKS
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want --trace option],
|
||||
trace,
|
||||
[ --disable-trace do not support --trace option],
|
||||
[EXTRAOBJS="$EXTRAOBJS trace\$o"
|
||||
AC_DEFINE(HAVE_DLG_TRACE)],,yes)
|
||||
|
||||
LIBTOOL_MAKE="#"
|
||||
CF_WITH_LIBTOOL
|
||||
if test "$with_libtool" = "yes" ; then
|
||||
OBJEXT="lo"
|
||||
LIBTOOL_MAKE=
|
||||
CF_WITH_LIBTOOL_OPTS
|
||||
fi
|
||||
AC_SUBST(LIBTOOL_MAKE)
|
||||
|
||||
use_ncurses=no
|
||||
AC_ARG_WITH(ncurses,
|
||||
[ --with-ncurses compile/link with ncurses library],
|
||||
[use_ncurses=ncurses])
|
||||
AC_ARG_WITH(ncursesw,
|
||||
[ --with-ncursesw compile/link with wide-char ncurses library],
|
||||
[use_ncurses=ncursesw])
|
||||
if test $use_ncurses != no ; then
|
||||
cf_wide_curses=yes
|
||||
if test $use_ncurses = ncursesw ; then
|
||||
CF_UTF8_LIB
|
||||
fi
|
||||
CF_NCURSES_CONFIG($use_ncurses)
|
||||
else
|
||||
cf_wide_curses=no
|
||||
CF_CURSES_CONFIG
|
||||
fi
|
||||
|
||||
cf_all_widgets=yes
|
||||
CF_ARG_MSG_ENABLE([if you want extra dialogs],
|
||||
extras,
|
||||
[ --disable-extras do not include extra dialogs],
|
||||
[cf_all_widgets=yes],[cf_all_widgets=no],yes)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want config-file support],
|
||||
rc-file,
|
||||
[ --disable-rc-file do not include config-file support],
|
||||
[EXTRAOBJS="$EXTRAOBJS rc\$o"
|
||||
AC_DEFINE(HAVE_RC_FILE)],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want Xdialog-style dialogs],
|
||||
Xdialog,
|
||||
[ --disable-Xdialog do not include Xdialog-style dialogs],
|
||||
[EXTRAOBJS="$EXTRAOBJS calendar\$o fselect\$o timebox\$o"
|
||||
AC_DEFINE(HAVE_XDIALOG)],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the form dialog],
|
||||
form,
|
||||
[ --disable-form do not include the form dialog],
|
||||
[EXTRAOBJS="$EXTRAOBJS formbox\$o"
|
||||
AC_DEFINE(HAVE_DLG_FORMBOX)],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the gauge dialog],
|
||||
gauge,
|
||||
[ --disable-gauge do not include the gauge dialogs],
|
||||
[EXTRAOBJS="$EXTRAOBJS guage\$o pause\$o progressbox\$o"
|
||||
AC_DEFINE(HAVE_DLG_GAUGE)],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the tailbox dialog],
|
||||
tailbox,
|
||||
[ --disable-tailbox do not include the tailbox dialog],
|
||||
[EXTRAOBJS="$EXTRAOBJS tailbox\$o"
|
||||
AC_DEFINE(HAVE_DLG_TAILBOX)],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the mixedform dialog],
|
||||
mixedform,
|
||||
[ --disable-mixedform do not include the mixedform dialog],
|
||||
[EXTRAOBJS="$EXTRAOBJS mixedform\$o"
|
||||
AC_DEFINE(HAVE_DLG_MIXEDFORM)],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the mixedgauge dialog],
|
||||
mixedgauge,
|
||||
[ --disable-mixedgauge do not include the mixedgauge dialog],
|
||||
[EXTRAOBJS="$EXTRAOBJS mixedgauge\$o"
|
||||
AC_DEFINE(HAVE_MIXEDGAUGE)],,$cf_all_widgets)
|
||||
|
||||
CF_ARG_MSG_ENABLE([if you want the wide-curses features],
|
||||
widec,
|
||||
[ --enable-widec enable wide-curses features],
|
||||
[AC_DEFINE(USE_WIDE_CURSES)],,$cf_wide_curses)
|
||||
|
||||
AC_SUBST(EXTRAOBJS)
|
||||
|
||||
dnl
|
||||
dnl Checks for header files.
|
||||
dnl
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_TIME
|
||||
AC_HEADER_DIRENT
|
||||
AC_CHECK_HEADERS(search.h unctrl.h unistd.h)
|
||||
CF_CURSES_TERM_H
|
||||
|
||||
dnl
|
||||
dnl Checks for library functions.
|
||||
dnl
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS(\
|
||||
_nc_free_and_exit \
|
||||
strcasecmp \
|
||||
strftime \
|
||||
tsearch \
|
||||
waitpid \
|
||||
)
|
||||
|
||||
CF_CURSES_FUNCS(\
|
||||
flushinp \
|
||||
getbegx \
|
||||
getbegy \
|
||||
getbegyx \
|
||||
getcurx \
|
||||
getcury \
|
||||
getmaxx \
|
||||
getmaxy \
|
||||
getmaxyx \
|
||||
getparx \
|
||||
getpary \
|
||||
getparyx \
|
||||
use_default_colors \
|
||||
wget_wch \
|
||||
)
|
||||
|
||||
AC_CHECK_FUNC(start_color,[AC_DEFINE(HAVE_COLOR)])
|
||||
CF_CURSES_CHTYPE
|
||||
CF_FUNC_WAIT
|
||||
CF_MBSTATE_T
|
||||
|
||||
CF_HEADERS_SH(DLG,dlg_config.h)
|
||||
|
||||
AC_TRY_LINK([#include <locale.h>],[setlocale(LC_ALL, "")],[AC_DEFINE(HAVE_SETLOCALE)])
|
||||
|
||||
CF_DISABLE_RPATH_HACK
|
||||
|
||||
AC_OUTPUT(dialog-config makefile $EXTRA_OUTPUT $SUB_MAKEFILE samples/install/makefile,,,sort -u)
|
135
contrib/dialog/dialog-config.in
Normal file
135
contrib/dialog/dialog-config.in
Normal file
@ -0,0 +1,135 @@
|
||||
#!@SHELL@
|
||||
# $Id: dialog-config.in,v 1.3 2007/02/25 19:33:58 tom Exp $
|
||||
##############################################################################
|
||||
# Copyright (c) 2007 Thomas E. Dickey #
|
||||
# #
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a #
|
||||
# copy of this software and associated documentation files (the "Software"), #
|
||||
# to deal in the Software without restriction, including without limitation #
|
||||
# the rights to use, copy, modify, merge, publish, distribute, distribute #
|
||||
# with modifications, sublicense, and/or sell copies of the Software, and to #
|
||||
# permit persons to whom the Software is furnished to do so, subject to the #
|
||||
# following conditions: #
|
||||
# #
|
||||
# The above copyright notice and this permission notice shall be included in #
|
||||
# all copies or substantial portions of the Software. #
|
||||
# #
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
|
||||
# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
|
||||
# DEALINGS IN THE SOFTWARE. #
|
||||
# #
|
||||
# Except as contained in this notice, the name(s) of the above copyright #
|
||||
# holders shall not be used in advertising or otherwise to promote the sale, #
|
||||
# use or other dealings in this Software without prior written #
|
||||
# authorization. #
|
||||
##############################################################################
|
||||
|
||||
prefix="@prefix@"
|
||||
exec_prefix="@exec_prefix@"
|
||||
|
||||
bindir="@bindir@"
|
||||
libdir="@libdir@"
|
||||
datadir="@datadir@"
|
||||
mandir="@mandir@"
|
||||
|
||||
THIS="dialog"
|
||||
|
||||
test $# = 0 && exec @SHELL@ $0 --error
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*)
|
||||
ARG=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
|
||||
;;
|
||||
*)
|
||||
ARG=
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
# basic configuration
|
||||
--prefix=*)
|
||||
prefix="$ARG"
|
||||
test -z "$exec_prefix" && exec_prefix="$ARG"
|
||||
;;
|
||||
--prefix)
|
||||
echo "$prefix"
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix="$ARG"
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo "$exec_prefix"
|
||||
;;
|
||||
# compile/link
|
||||
--cflags)
|
||||
INCS=
|
||||
if test "${prefix}/include" != /usr/include ; then
|
||||
INCS="-I${prefix}/include"
|
||||
fi
|
||||
sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
|
||||
$INCS
|
||||
ENDECHO
|
||||
;;
|
||||
--libs)
|
||||
sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
|
||||
-L${exec_prefix}/lib -l${THIS} @LIBS@
|
||||
ENDECHO
|
||||
;;
|
||||
# identification
|
||||
--version)
|
||||
echo "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@"
|
||||
;;
|
||||
--abi-version)
|
||||
echo "@VERSION@" | sed -e 's/:/./g'
|
||||
;;
|
||||
# locations
|
||||
--bindir)
|
||||
echo "${bindir}"
|
||||
;;
|
||||
--datadir)
|
||||
echo "${datadir}"
|
||||
;;
|
||||
--libdir)
|
||||
echo "${libdir}"
|
||||
;;
|
||||
--mandir)
|
||||
echo "${mandir}"
|
||||
;;
|
||||
# general info
|
||||
--help)
|
||||
cat <<ENDHELP
|
||||
Usage: ${THIS}-config [options]
|
||||
|
||||
Options:
|
||||
--prefix echos the package-prefix of ${THIS}
|
||||
--prefix=ARG sets the package-prefix of ${THIS}
|
||||
--exec-prefix echos the executable-prefix of ${THIS}
|
||||
--exec-prefix=ARG sets the executable-prefix of ${THIS}
|
||||
|
||||
--cflags echos the C compiler flags needed to compile with ${THIS}
|
||||
--libs echos the libraries needed to link with ${THIS}
|
||||
|
||||
--version echos the release+patchdate version of ${THIS}
|
||||
--abi-version echos the ABI version of ${THIS}
|
||||
|
||||
--bindir echos the directory containing ${THIS} programs
|
||||
--datadir echos the directory containing ${THIS} data
|
||||
--libdir echos the directory containing ${THIS} libraries
|
||||
--mandir echos the directory containing ${THIS} manpages
|
||||
|
||||
--help prints this message
|
||||
ENDHELP
|
||||
;;
|
||||
--error|*)
|
||||
@SHELL@ $0 --help 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
# vile:shmode
|
1289
contrib/dialog/dialog.1
Normal file
1289
contrib/dialog/dialog.1
Normal file
File diff suppressed because it is too large
Load Diff
2782
contrib/dialog/dialog.3
Normal file
2782
contrib/dialog/dialog.3
Normal file
File diff suppressed because it is too large
Load Diff
1710
contrib/dialog/dialog.c
Normal file
1710
contrib/dialog/dialog.c
Normal file
File diff suppressed because it is too large
Load Diff
784
contrib/dialog/dialog.h
Normal file
784
contrib/dialog/dialog.h
Normal file
@ -0,0 +1,784 @@
|
||||
/*
|
||||
* $Id: dialog.h,v 1.214 2010/04/28 21:11:49 tom Exp $
|
||||
*
|
||||
* dialog.h -- common declarations for all dialog modules
|
||||
*
|
||||
* Copyright 2000-2008,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*
|
||||
* An earlier version of this program lists as authors
|
||||
* Savio Lam (lam836@cs.cuhk.hk)
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_H_included
|
||||
#define DIALOG_H_included 1
|
||||
|
||||
#include <dlg_config.h>
|
||||
|
||||
#ifdef __hpux
|
||||
#define __HP_CURSES_COMPAT /* workaround for getattrs, etc. */
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <signal.h> /* fork() etc. */
|
||||
#include <math.h> /* sqrt() */
|
||||
|
||||
#if defined(HAVE_NCURSESW_NCURSES_H)
|
||||
#include <ncursesw/ncurses.h>
|
||||
#elif defined(HAVE_NCURSES_NCURSES_H)
|
||||
#include <ncurses/ncurses.h>
|
||||
#elif defined(HAVE_NCURSES_CURSES_H)
|
||||
#include <ncurses/curses.h>
|
||||
#elif defined(HAVE_NCURSES_H)
|
||||
#include <ncurses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
/* most curses.h headers include this, some do not */
|
||||
#if defined(HAVE_UNCTRL_H)
|
||||
#include <unctrl.h>
|
||||
#endif
|
||||
|
||||
/* possible conflicts with <term.h> which may be included in <curses.h> */
|
||||
#ifdef color_names
|
||||
#undef color_names
|
||||
#endif
|
||||
|
||||
#ifdef buttons
|
||||
#undef buttons
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
#include <libintl.h>
|
||||
#include <langinfo.h>
|
||||
#define _(s) dgettext(PACKAGE, s)
|
||||
#else
|
||||
#undef _
|
||||
#define _(s) s
|
||||
#endif
|
||||
|
||||
#ifndef GCC_NORETURN
|
||||
#define GCC_NORETURN /*nothing*/
|
||||
#endif
|
||||
|
||||
#ifndef GCC_UNUSED
|
||||
#define GCC_UNUSED /*nothing*/
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WGET_WCH
|
||||
#undef USE_WIDE_CURSES
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FIXME: a configure check would be useful
|
||||
*/
|
||||
#ifdef __hpux
|
||||
#undef ACS_UARROW
|
||||
#undef ACS_DARROW
|
||||
#undef ACS_BLOCK
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Change these if you want
|
||||
*/
|
||||
#define USE_SHADOW TRUE
|
||||
#define USE_COLORS TRUE
|
||||
|
||||
#ifdef HAVE_COLOR
|
||||
#define SCOLS (COLS - (dialog_state.use_shadow ? 2 : 0))
|
||||
#define SLINES (LINES - (dialog_state.use_shadow ? 1 : 0))
|
||||
#else
|
||||
#define SCOLS COLS
|
||||
#define SLINES LINES
|
||||
#endif
|
||||
|
||||
#define DLG_EXIT_ESC 255
|
||||
#define DLG_EXIT_UNKNOWN -2 /* never return this (internal use) */
|
||||
#define DLG_EXIT_ERROR -1 /* the shell sees this as 255 */
|
||||
#define DLG_EXIT_OK 0
|
||||
#define DLG_EXIT_CANCEL 1
|
||||
#define DLG_EXIT_HELP 2
|
||||
#define DLG_EXIT_EXTRA 3
|
||||
#define DLG_EXIT_ITEM_HELP 4 /* actually DLG_EXIT_HELP */
|
||||
|
||||
#define DLG_CTRL(n) ((n) & 0x1f) /* CTRL is preferred, but conflicts */
|
||||
|
||||
#define CHR_BACKSPACE DLG_CTRL('H')
|
||||
#define CHR_REPAINT DLG_CTRL('L')
|
||||
#define CHR_KILL DLG_CTRL('U')
|
||||
#define CHR_LITERAL DLG_CTRL('V')
|
||||
#define CHR_DELETE 127
|
||||
#define CHR_NEXT DLG_CTRL('N')
|
||||
#define CHR_PREVIOUS DLG_CTRL('P')
|
||||
#define CHR_TRACE DLG_CTRL('T')
|
||||
|
||||
#define ESC 27
|
||||
#define TAB DLG_CTRL('I')
|
||||
|
||||
#define MARGIN 1
|
||||
#define GUTTER 2
|
||||
#define SHADOW_ROWS 1
|
||||
#define SHADOW_COLS 2
|
||||
#define ARROWS_COL 5
|
||||
|
||||
#define MAX_LEN 2048
|
||||
#define BUF_SIZE (10*1024)
|
||||
|
||||
#undef MIN
|
||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
#undef MAX
|
||||
#define MAX(x,y) ((x) > (y) ? (x) : (y))
|
||||
|
||||
#define DEFAULT_SEPARATE_STR "\t"
|
||||
#define DEFAULT_ASPECT_RATIO 9
|
||||
/* how many spaces is a tab long (default)? */
|
||||
#define TAB_LEN 8
|
||||
#define WTIMEOUT_VAL 10
|
||||
|
||||
#ifndef A_CHARTEXT
|
||||
#define A_CHARTEXT 0xff
|
||||
#endif
|
||||
|
||||
#define CharOf(ch) ((ch) & 0xff)
|
||||
|
||||
#ifndef ACS_ULCORNER
|
||||
#define ACS_ULCORNER '+'
|
||||
#endif
|
||||
#ifndef ACS_LLCORNER
|
||||
#define ACS_LLCORNER '+'
|
||||
#endif
|
||||
#ifndef ACS_URCORNER
|
||||
#define ACS_URCORNER '+'
|
||||
#endif
|
||||
#ifndef ACS_LRCORNER
|
||||
#define ACS_LRCORNER '+'
|
||||
#endif
|
||||
#ifndef ACS_HLINE
|
||||
#define ACS_HLINE '-'
|
||||
#endif
|
||||
#ifndef ACS_VLINE
|
||||
#define ACS_VLINE '|'
|
||||
#endif
|
||||
#ifndef ACS_LTEE
|
||||
#define ACS_LTEE '+'
|
||||
#endif
|
||||
#ifndef ACS_RTEE
|
||||
#define ACS_RTEE '+'
|
||||
#endif
|
||||
#ifndef ACS_UARROW
|
||||
#define ACS_UARROW '^'
|
||||
#endif
|
||||
#ifndef ACS_DARROW
|
||||
#define ACS_DARROW 'v'
|
||||
#endif
|
||||
#ifndef ACS_BLOCK
|
||||
#define ACS_BLOCK '#'
|
||||
#endif
|
||||
|
||||
/* these definitions may work for antique versions of curses */
|
||||
#ifndef HAVE_GETBEGYX
|
||||
#undef getbegyx
|
||||
#define getbegyx(win,y,x) (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETMAXYX
|
||||
#undef getmaxyx
|
||||
#define getmaxyx(win,y,x) (y = (win)?(win)->_maxy:ERR, x = (win)?(win)->_maxx:ERR)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETPARYX
|
||||
#undef getparyx
|
||||
#define getparyx(win,y,x) (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* these definitions may be needed for bleeding-edge curses implementations */
|
||||
#if !(defined(HAVE_GETBEGX) && defined(HAVE_GETBEGY))
|
||||
#undef getbegx
|
||||
#undef getbegy
|
||||
#define getbegx(win) dlg_getbegx(win)
|
||||
#define getbegy(win) dlg_getbegy(win)
|
||||
extern int dlg_getbegx(WINDOW * /*win*/);
|
||||
extern int dlg_getbegy(WINDOW * /*win*/);
|
||||
#endif
|
||||
|
||||
#if !(defined(HAVE_GETCURX) && defined(HAVE_GETCURY))
|
||||
#undef getcurx
|
||||
#undef getcury
|
||||
#define getcurx(win) dlg_getcurx(win)
|
||||
#define getcury(win) dlg_getcury(win)
|
||||
extern int dlg_getcurx(WINDOW * /*win*/);
|
||||
extern int dlg_getcury(WINDOW * /*win*/);
|
||||
#endif
|
||||
|
||||
#if !(defined(HAVE_GETMAXX) && defined(HAVE_GETMAXY))
|
||||
#undef getmaxx
|
||||
#undef getmaxy
|
||||
#define getmaxx(win) dlg_getmaxx(win)
|
||||
#define getmaxy(win) dlg_getmaxy(win)
|
||||
extern int dlg_getmaxx(WINDOW * /*win*/);
|
||||
extern int dlg_getmaxy(WINDOW * /*win*/);
|
||||
#endif
|
||||
|
||||
#if !(defined(HAVE_GETPARX) && defined(HAVE_GETPARY))
|
||||
#undef getparx
|
||||
#undef getpary
|
||||
#define getparx(win) dlg_getparx(win)
|
||||
#define getpary(win) dlg_getpary(win)
|
||||
extern int dlg_getparx(WINDOW * /*win*/);
|
||||
extern int dlg_getpary(WINDOW * /*win*/);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is a list of "old" names, which should be helpful in updating
|
||||
* applications that use libdialog. Starting with 2003/11/26, all exported
|
||||
* symbols from libdialog have "dlg_" prefix, or "dialog_" prefix or "_dialog"
|
||||
* suffix (or suffix "_dialog", e.g., init_dialog).
|
||||
*/
|
||||
#ifdef __DIALOG_OLD_NAMES__
|
||||
#define color_table dlg_color_table
|
||||
#define attr_clear(win,h,w,a) dlg_attr_clear(win,h,w,a)
|
||||
#define auto_size(t,s,h,w,xl,mc) dlg_auto_size(t,s,h,w,xl,mc)
|
||||
#define auto_sizefile(t,f,h,w,xl,mc) dlg_auto_sizefile(t,f,h,w,xl,mc)
|
||||
#define beeping() dlg_beeping()
|
||||
#define box_x_ordinate(w) dlg_box_x_ordinate(w)
|
||||
#define box_y_ordinate(h) dlg_box_y_ordinate(h)
|
||||
#define calc_listh(h,lh,in) dlg_calc_listh(h,lh,in)
|
||||
#define calc_listw(in,items,group) dlg_calc_listw(in,items,group)
|
||||
#define color_setup() dlg_color_setup()
|
||||
#define create_rc(f) dlg_create_rc(f)
|
||||
#define ctl_size(h,w) dlg_ctl_size(h,w)
|
||||
#define del_window(win) dlg_del_window(win)
|
||||
#define dialog_clear() dlg_clear()
|
||||
#define draw_bottom_box(win) dlg_draw_bottom_box(win)
|
||||
#define draw_box(win,y,x,h,w,xc,bc) dlg_draw_box(win,y,x,h,w,xc,bc)
|
||||
#define draw_shadow(win,h,w,y,x) dlg_draw_shadow(win,h,w,y,x)
|
||||
#define draw_title(win,t) dlg_draw_title(win,t)
|
||||
#define exiterr dlg_exiterr
|
||||
#define killall_bg(n) dlg_killall_bg(n)
|
||||
#define mouse_bigregion(y,x) dlg_mouse_bigregion(y,x)
|
||||
#define mouse_free_regions() dlg_mouse_free_regions()
|
||||
#define mouse_mkbigregion(y,x,h,w,n,ix,iy,m) dlg_mouse_mkbigregion(y,x,h,w,n,ix,iy,m)
|
||||
#define mouse_mkregion(y,x,h,w,n) dlg_mouse_mkregion(y,x,h,w,n)
|
||||
#define mouse_region(y,x) dlg_mouse_region(y,x)
|
||||
#define mouse_setbase(x,y) dlg_mouse_setbase(x,y)
|
||||
#define mouse_wgetch(w,c) dlg_mouse_wgetch(w,c)
|
||||
#define new_window(h,w,y,x) dlg_new_window(h,w,y,x)
|
||||
#define parse_rc() dlg_parse_rc()
|
||||
#define print_autowrap(win,s,h,w) dlg_print_autowrap(win,s,h,w)
|
||||
#define print_size(h,w) dlg_print_size(h,w)
|
||||
#define put_backtitle() dlg_put_backtitle()
|
||||
#define strclone(cprompt) dlg_strclone(cprompt)
|
||||
#define sub_window(win,h,w,y,x) dlg_sub_window(win,h,w,y,x)
|
||||
#define tab_correct_str(s) dlg_tab_correct_str(s)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Attribute names
|
||||
*/
|
||||
#define DIALOG_ATR(n) dlg_color_table[n].atr
|
||||
|
||||
#define screen_attr DIALOG_ATR(0)
|
||||
#define shadow_attr DIALOG_ATR(1)
|
||||
#define dialog_attr DIALOG_ATR(2)
|
||||
#define title_attr DIALOG_ATR(3)
|
||||
#define border_attr DIALOG_ATR(4)
|
||||
#define button_active_attr DIALOG_ATR(5)
|
||||
#define button_inactive_attr DIALOG_ATR(6)
|
||||
#define button_key_active_attr DIALOG_ATR(7)
|
||||
#define button_key_inactive_attr DIALOG_ATR(8)
|
||||
#define button_label_active_attr DIALOG_ATR(9)
|
||||
#define button_label_inactive_attr DIALOG_ATR(10)
|
||||
#define inputbox_attr DIALOG_ATR(11)
|
||||
#define inputbox_border_attr DIALOG_ATR(12)
|
||||
#define searchbox_attr DIALOG_ATR(13)
|
||||
#define searchbox_title_attr DIALOG_ATR(14)
|
||||
#define searchbox_border_attr DIALOG_ATR(15)
|
||||
#define position_indicator_attr DIALOG_ATR(16)
|
||||
#define menubox_attr DIALOG_ATR(17)
|
||||
#define menubox_border_attr DIALOG_ATR(18)
|
||||
#define item_attr DIALOG_ATR(19)
|
||||
#define item_selected_attr DIALOG_ATR(20)
|
||||
#define tag_attr DIALOG_ATR(21)
|
||||
#define tag_selected_attr DIALOG_ATR(22)
|
||||
#define tag_key_attr DIALOG_ATR(23)
|
||||
#define tag_key_selected_attr DIALOG_ATR(24)
|
||||
#define check_attr DIALOG_ATR(25)
|
||||
#define check_selected_attr DIALOG_ATR(26)
|
||||
#define uarrow_attr DIALOG_ATR(27)
|
||||
#define darrow_attr DIALOG_ATR(28)
|
||||
#define itemhelp_attr DIALOG_ATR(29)
|
||||
#define form_active_text_attr DIALOG_ATR(30)
|
||||
#define form_text_attr DIALOG_ATR(31)
|
||||
#define form_item_readonly_attr DIALOG_ATR(32)
|
||||
|
||||
#define DLGK_max (KEY_MAX + 256)
|
||||
|
||||
/*
|
||||
* Callbacks are used to implement the "background" tailbox.
|
||||
*/
|
||||
struct _dlg_callback;
|
||||
|
||||
typedef void (*DIALOG_FREEBACK) (struct _dlg_callback * /* p */);
|
||||
|
||||
typedef struct _dlg_callback {
|
||||
struct _dlg_callback *next;
|
||||
FILE *input;
|
||||
WINDOW *win;
|
||||
bool keep_bg; /* keep in background, on exit */
|
||||
bool bg_task; /* true if this is background task */
|
||||
bool (*handle_getc)(struct _dlg_callback *p, int ch, int fkey, int *result);
|
||||
bool keep_win; /* true to not erase window on exit */
|
||||
/* data for dlg_add_callback_ref */
|
||||
struct _dlg_callback **caller;
|
||||
DIALOG_FREEBACK freeback;
|
||||
} DIALOG_CALLBACK;
|
||||
|
||||
typedef struct _dlg_windows {
|
||||
struct _dlg_windows *next;
|
||||
WINDOW *normal;
|
||||
WINDOW *shadow;
|
||||
} DIALOG_WINDOWS;
|
||||
|
||||
/*
|
||||
* Global variables, which are initialized as needed
|
||||
*/
|
||||
typedef struct {
|
||||
DIALOG_CALLBACK *getc_callbacks;
|
||||
DIALOG_CALLBACK *getc_redirect;
|
||||
DIALOG_WINDOWS *all_windows;
|
||||
FILE *output; /* option "--output-fd fd" */
|
||||
FILE *pipe_input; /* used for gauge widget */
|
||||
FILE *screen_output; /* newterm(), etc. */
|
||||
bool screen_initialized;
|
||||
bool use_colors; /* use colors by default? */
|
||||
bool use_scrollbar; /* option "--scrollbar" */
|
||||
bool use_shadow; /* shadow dialog boxes by default? */
|
||||
bool visit_items; /* option "--visit-items" */
|
||||
char *separate_str; /* option "--separate-widget string" */
|
||||
int aspect_ratio; /* option "--aspect ratio" */
|
||||
int output_count; /* # of widgets that may have done output */
|
||||
int tab_len; /* option "--tab-len n" */
|
||||
/* 1.0-20070227 */
|
||||
FILE *input; /* option "--input-fd fd" */
|
||||
#ifdef HAVE_DLG_TRACE
|
||||
FILE *trace_output; /* option "--trace file" */
|
||||
#endif
|
||||
} DIALOG_STATE;
|
||||
|
||||
extern DIALOG_STATE dialog_state;
|
||||
|
||||
/*
|
||||
* Global variables, which dialog resets before each widget
|
||||
*/
|
||||
typedef struct {
|
||||
bool beep_after_signal; /* option "--beep-after" */
|
||||
bool beep_signal; /* option "--beep" */
|
||||
bool begin_set; /* option "--begin y x" was used */
|
||||
bool cant_kill; /* option "--no-kill" */
|
||||
bool colors; /* option "--colors" */
|
||||
bool cr_wrap; /* option "--cr-wrap" */
|
||||
bool defaultno; /* option "--defaultno" */
|
||||
bool dlg_clear_screen; /* option "--clear" */
|
||||
bool extra_button; /* option "--extra-button" */
|
||||
bool help_button; /* option "--help-button" */
|
||||
bool help_status; /* option "--help-status" */
|
||||
bool input_menu; /* menu vs inputmenu widget */
|
||||
bool insecure; /* option "--insecure" */
|
||||
bool item_help; /* option "--item-help" */
|
||||
bool keep_window; /* option "--keep-window" */
|
||||
bool nocancel; /* option "--no-cancel" */
|
||||
bool nocollapse; /* option "--no-collapse" */
|
||||
bool print_siz; /* option "--print-size" */
|
||||
bool separate_output; /* option "--separate-output" */
|
||||
bool single_quoted; /* option "--single-quoted" */
|
||||
bool size_err; /* option "--size-err" */
|
||||
bool tab_correct; /* option "--tab-correct" */
|
||||
bool trim_whitespace; /* option "--trim" */
|
||||
char *backtitle; /* option "--backtitle backtitle" */
|
||||
char *cancel_label; /* option "--cancel-label string" */
|
||||
char *default_item; /* option "--default-item string" */
|
||||
char *exit_label; /* option "--exit-label string" */
|
||||
char *extra_label; /* option "--extra-label string" */
|
||||
char *help_label; /* option "--help-label string" */
|
||||
char *input_result;
|
||||
char *no_label; /* option "--no-label string" */
|
||||
char *ok_label; /* option "--ok-label string" */
|
||||
char *title; /* option "--title title" */
|
||||
char *yes_label; /* option "--yes-label string" */
|
||||
int begin_x; /* option "--begin y x" (second value) */
|
||||
int begin_y; /* option "--begin y x" (first value) */
|
||||
int max_input; /* option "--max-input size" */
|
||||
int scale_factor; /* RESERVED */
|
||||
int sleep_secs; /* option "--sleep secs" */
|
||||
int timeout_secs; /* option "--timeout secs" */
|
||||
unsigned input_length; /* nonzero if input_result is allocated */
|
||||
/* 1.0-20051207 */
|
||||
unsigned formitem_type; /* DIALOG_FORMITEM.type in dialog_form() */
|
||||
/* 1.1-20070227 */
|
||||
bool keep_tite; /* option "--keep-tite" */
|
||||
bool ascii_lines; /* option "--ascii-lines" */
|
||||
bool no_lines; /* option "--no-lines" */
|
||||
/* 1.1-20070930 */
|
||||
bool nook; /* option "--no-ok" */
|
||||
/* 1.1-20080727 */
|
||||
bool quoted; /* option "--quoted" */
|
||||
char *column_header; /* RESERVED "--column-header" */
|
||||
char *column_separator; /* option "--column-separator" */
|
||||
char *output_separator; /* option "--output-separator" */
|
||||
/* 1.1-20100118 */
|
||||
char *date_format; /* option "--date-format" */
|
||||
char *time_format; /* option "--time-format" */
|
||||
} DIALOG_VARS;
|
||||
|
||||
#define USE_ITEM_HELP(s) (dialog_vars.item_help && (s) != 0)
|
||||
#define CHECKBOX_TAGS (dialog_vars.item_help ? 4 : 3)
|
||||
#define MENUBOX_TAGS (dialog_vars.item_help ? 3 : 2)
|
||||
#define FORMBOX_TAGS (dialog_vars.item_help ? 9 : 8)
|
||||
#define MIXEDFORM_TAGS (FORMBOX_TAGS + 1)
|
||||
#define MIXEDGAUGE_TAGS 2
|
||||
|
||||
extern DIALOG_VARS dialog_vars;
|
||||
|
||||
#ifndef HAVE_TYPE_CHTYPE
|
||||
#define chtype long
|
||||
#endif
|
||||
|
||||
#define UCH(ch) ((unsigned char)(ch))
|
||||
|
||||
#define assert_ptr(ptr,msg) if ((ptr) == 0) dlg_exiterr("cannot allocate memory in " msg)
|
||||
|
||||
#define dlg_malloc(t,n) (t *) malloc((n) * sizeof(t))
|
||||
#define dlg_calloc(t,n) (t *) calloc((n), sizeof(t))
|
||||
#define dlg_realloc(t,n,p) (t *) realloc((p), (n) * sizeof(t))
|
||||
|
||||
/*
|
||||
* Table for attribute- and color-values.
|
||||
*/
|
||||
typedef struct {
|
||||
chtype atr;
|
||||
#ifdef HAVE_COLOR
|
||||
int fg;
|
||||
int bg;
|
||||
int hilite;
|
||||
#endif
|
||||
#ifdef HAVE_RC_FILE
|
||||
const char *name;
|
||||
const char *comment;
|
||||
#endif
|
||||
} DIALOG_COLORS;
|
||||
|
||||
extern DIALOG_COLORS dlg_color_table[];
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
extern const char *dialog_version(void);
|
||||
|
||||
/* widgets, each in separate files */
|
||||
extern int dialog_calendar(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*day*/, int /*month*/, int /*year*/);
|
||||
extern int dialog_checklist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, char ** /*items*/, int /*flag*/);
|
||||
extern int dialog_dselect(const char * /*title*/, const char * /*path*/, int /*height*/, int /*width*/);
|
||||
extern int dialog_editbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/);
|
||||
extern int dialog_form(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, char ** /*items*/);
|
||||
extern int dialog_fselect(const char * /*title*/, const char * /*path*/, int /*height*/, int /*width*/);
|
||||
extern int dialog_gauge(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*percent*/);
|
||||
extern int dialog_inputbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, const char * /*init*/, const int /*password*/);
|
||||
extern int dialog_menu(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*menu_height*/, int /*item_no*/, char ** /*items*/);
|
||||
extern int dialog_mixedform(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, char ** /*items*/);
|
||||
extern int dialog_mixedgauge(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*percent*/, int /*item_no*/, char ** /*items*/);
|
||||
extern int dialog_msgbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*pauseopt*/);
|
||||
extern int dialog_pause(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*seconds*/);
|
||||
extern int dialog_progressbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/);
|
||||
extern int dialog_tailbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/, int /*bg_task*/);
|
||||
extern int dialog_textbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/);
|
||||
extern int dialog_timebox(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*hour*/, int /*minute*/, int /*second*/);
|
||||
extern int dialog_yesno(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/);
|
||||
|
||||
/* some widgets have alternate entrypoints, to allow list manipulation */
|
||||
typedef struct {
|
||||
char *name;
|
||||
char *text;
|
||||
char *help;
|
||||
int state;
|
||||
} DIALOG_LISTITEM;
|
||||
|
||||
typedef struct {
|
||||
unsigned type; /* the field type (0=input, 1=password) */
|
||||
char *name; /* the field label */
|
||||
int name_len; /* ...its length */
|
||||
int name_y; /* ...its y-ordinate */
|
||||
int name_x; /* ...its x-ordinate */
|
||||
bool name_free; /* ...true if .name can be freed */
|
||||
char *text; /* the field contents */
|
||||
int text_len; /* ...its length on the screen */
|
||||
int text_y; /* ...its y-ordinate */
|
||||
int text_x; /* ...its x-ordinate */
|
||||
int text_flen; /* ...its length on screen, or 0 if no input allowed */
|
||||
int text_ilen; /* ...its limit on amount to be entered */
|
||||
bool text_free; /* ...true if .text can be freed */
|
||||
char *help; /* help-message, if any */
|
||||
bool help_free; /* ...true if .help can be freed */
|
||||
} DIALOG_FORMITEM;
|
||||
|
||||
typedef int (DIALOG_INPUTMENU) (DIALOG_LISTITEM * /*items*/, int /*current*/, char * /*newtext*/);
|
||||
|
||||
extern int dlg_checklist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, const char * /*states*/, int /*flag*/, int * /*current_item*/);
|
||||
extern int dlg_form(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, DIALOG_FORMITEM * /*items*/, int * /*current_item*/);
|
||||
extern int dlg_menu(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*menu_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, int * /*current_item*/, DIALOG_INPUTMENU /*rename_menu*/);
|
||||
|
||||
/* arrows.c */
|
||||
extern void dlg_draw_arrows(WINDOW * /*dialog*/, int /*top_arrow*/, int /*bottom_arrow*/, int /*x*/, int /*top*/, int /*bottom*/);
|
||||
extern void dlg_draw_arrows2(WINDOW * /*dialog*/, int /*top_arrow*/, int /*bottom_arrow*/, int /*x*/, int /*top*/, int /*bottom*/, chtype /*attr*/, chtype /*borderattr*/);
|
||||
extern void dlg_draw_scrollbar(WINDOW * /*dialog*/, long /* first_data */, long /* this_data */, long /* next_data */, long /* total_data */, int /* left */, int /* right */, int /*top*/, int /*bottom*/, chtype /*attr*/, chtype /*borderattr*/);
|
||||
|
||||
/* buttons.c */
|
||||
extern const char ** dlg_exit_label(void);
|
||||
extern const char ** dlg_ok_label(void);
|
||||
extern const char ** dlg_ok_labels(void);
|
||||
extern const char ** dlg_yes_labels(void);
|
||||
extern int dlg_button_count(const char ** /*labels*/);
|
||||
extern int dlg_button_to_char(const char * /*label*/);
|
||||
extern int dlg_button_x_step(const char ** /*labels*/, int /*limit*/, int * /*gap*/, int * /*margin*/, int * /*step*/);
|
||||
extern int dlg_char_to_button(int /*ch*/, const char ** /*labels*/);
|
||||
extern int dlg_exit_buttoncode(int /*button*/);
|
||||
extern int dlg_match_char(int /*ch*/, const char * /*string*/);
|
||||
extern int dlg_next_button(const char ** /*labels*/, int /*button*/);
|
||||
extern int dlg_next_ok_buttonindex(int /*current*/, int /*extra*/);
|
||||
extern int dlg_ok_buttoncode(int /*button*/);
|
||||
extern int dlg_prev_button(const char ** /*labels*/, int /*button*/);
|
||||
extern int dlg_prev_ok_buttonindex(int /*current*/, int /*extra*/);
|
||||
extern int dlg_yes_buttoncode(int /*button*/);
|
||||
extern void dlg_button_layout(const char ** /*labels*/, int * /*limit*/);
|
||||
extern void dlg_button_sizes(const char ** /*labels*/, int /*vertical*/, int * /*longest*/, int * /*length*/);
|
||||
extern void dlg_draw_buttons(WINDOW * /*win*/, int /*y*/, int /*x*/, const char ** /*labels*/, int /*selected*/, int /*vertical*/, int /*limit*/);
|
||||
|
||||
/* columns.c */
|
||||
extern void dlg_align_columns(char ** /* target */, int /* per_row */, int /* num_rows */);
|
||||
extern void dlg_free_columns(char ** /* target */, int /* per_row */, int /* num_rows */);
|
||||
|
||||
/* editbox.c */
|
||||
extern int dlg_editbox(const char */*title*/, char ***/*list*/, int */*rows*/, int /*height*/, int /*width*/);
|
||||
|
||||
/* formbox.c */
|
||||
extern int dlg_default_formitem(DIALOG_FORMITEM * /*items*/);
|
||||
extern int dlg_ordinate(const char * /*s*/);
|
||||
extern void dlg_free_formitems(DIALOG_FORMITEM * /*items*/);
|
||||
|
||||
/* inputstr.c */
|
||||
extern bool dlg_edit_string(char * /*string*/, int * /*offset*/, int /*key*/, int /*fkey*/, bool /*force*/);
|
||||
extern const int * dlg_index_columns(const char * /*string*/);
|
||||
extern const int * dlg_index_wchars(const char * /*string*/);
|
||||
extern int dlg_count_columns(const char * /*string*/);
|
||||
extern int dlg_count_wchars(const char * /*string*/);
|
||||
extern int dlg_edit_offset(char * /*string*/, int /*offset*/, int /*x_last*/);
|
||||
extern int dlg_find_index(const int * /*list*/, int /*limit*/, int /*to_find*/);
|
||||
extern int dlg_limit_columns(const char * /*string*/, int /*limit*/, int /*offset*/);
|
||||
extern void dlg_show_string(WINDOW * /*win*/, const char * /*string*/, int /*offset*/, chtype /*attr*/, int /*y_base*/, int /*x_base*/, int /*x_last*/, bool /*hidden*/, bool /*force*/);
|
||||
|
||||
/* rc.c */
|
||||
#ifdef HAVE_RC_FILE
|
||||
extern int dlg_parse_rc(void);
|
||||
extern void dlg_create_rc(const char * /*filename*/);
|
||||
#endif
|
||||
|
||||
/* ui_getc.c */
|
||||
extern int dlg_getc(WINDOW * /*win*/, int * /*fkey*/);
|
||||
extern int dlg_getc_callbacks(int /*ch*/, int /*fkey*/, int * /*result*/);
|
||||
extern int dlg_last_getc(void);
|
||||
extern void dlg_add_callback(DIALOG_CALLBACK * /*p*/);
|
||||
extern void dlg_add_callback_ref(DIALOG_CALLBACK ** /*p*/, DIALOG_FREEBACK /* cleanup */);
|
||||
extern void dlg_flush_getc(void);
|
||||
extern void dlg_remove_callback(DIALOG_CALLBACK * /*p*/);
|
||||
extern void dlg_killall_bg(int *retval);
|
||||
|
||||
/* util.c */
|
||||
extern WINDOW * dlg_new_modal_window(WINDOW * /*parent*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);
|
||||
extern WINDOW * dlg_new_window(int /*height*/, int /*width*/, int /*y*/, int /*x*/);
|
||||
extern WINDOW * dlg_sub_window(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);
|
||||
extern bool dlg_need_separator(void);
|
||||
extern char * dlg_set_result(const char * /*string*/);
|
||||
extern char * dlg_strclone(const char * /*cprompt*/);
|
||||
extern char * dlg_strempty(void);
|
||||
extern chtype dlg_asciibox(chtype /*ch*/);
|
||||
extern chtype dlg_boxchar(chtype /*ch*/);
|
||||
extern const char * dlg_print_line(WINDOW */*win*/, chtype */*attr*/, const char */*prompt*/, int /*lm*/, int /*rm*/, int */*x*/);
|
||||
extern int dlg_box_x_ordinate(int /*width*/);
|
||||
extern int dlg_box_y_ordinate(int /*height*/);
|
||||
extern int dlg_calc_list_width(int /*item_no*/, DIALOG_LISTITEM * /*items*/);
|
||||
extern int dlg_calc_listw(int /*item_no*/, char ** /*items*/, int /*group*/);
|
||||
extern int dlg_check_scrolled(int /* key */, int /* last */, int /* page */, bool */* show */, int */* offset */);
|
||||
extern int dlg_default_item(char ** /*items*/, int /*llen*/);
|
||||
extern int dlg_default_listitem(DIALOG_LISTITEM * /*items*/);
|
||||
extern int dlg_defaultno_button(void);
|
||||
extern int dlg_max_input(int /*max_len*/);
|
||||
extern int dlg_print_scrolled(WINDOW * /* win */, const char * /* prompt */, int /* offset */, int /* height */, int /* width */, int /* pauseopt */);
|
||||
extern void dlg_add_quoted(char * /*string*/);
|
||||
extern void dlg_add_result(const char * /*string*/);
|
||||
extern void dlg_add_separator(void);
|
||||
extern void dlg_add_string(char * /*string*/);
|
||||
extern void dlg_attr_clear(WINDOW * /*win*/, int /*height*/, int /*width*/, chtype /*attr*/);
|
||||
extern void dlg_auto_size(const char * /*title*/, const char * /*prompt*/, int * /*height*/, int * /*width*/, int /*boxlines*/, int /*mincols*/);
|
||||
extern void dlg_auto_sizefile(const char * /*title*/, const char * /*file*/, int * /*height*/, int * /*width*/, int /*boxlines*/, int /*mincols*/);
|
||||
extern void dlg_beeping(void);
|
||||
extern void dlg_calc_listh(int * /*height*/, int * /*list_height*/, int /*item_no*/);
|
||||
extern void dlg_clear(void);
|
||||
extern void dlg_clr_result(void);
|
||||
extern void dlg_ctl_size(int /*height*/, int /*width*/);
|
||||
extern void dlg_del_window(WINDOW * /*win*/);
|
||||
extern void dlg_does_output(void);
|
||||
extern void dlg_draw_bottom_box(WINDOW * /*win*/);
|
||||
extern void dlg_draw_box(WINDOW * /*win*/, int /*y*/, int /*x*/, int /*height*/, int /*width*/, chtype /*boxchar*/, chtype /*borderchar*/);
|
||||
extern void dlg_draw_title(WINDOW *win, const char *title);
|
||||
extern void dlg_exit(int /*code*/) GCC_NORETURN;
|
||||
extern void dlg_item_help(const char * /*txt*/);
|
||||
extern void dlg_print_autowrap(WINDOW * /*win*/, const char * /*prompt*/, int /*height*/, int /*width*/);
|
||||
extern void dlg_print_size(int /*height*/, int /*width*/);
|
||||
extern void dlg_print_text(WINDOW * /*win*/, const char * /*txt*/, int /*len*/, chtype * /*attr*/);
|
||||
extern void dlg_put_backtitle(void);
|
||||
extern void dlg_restore_vars(DIALOG_VARS * /* save */);
|
||||
extern void dlg_save_vars(DIALOG_VARS * /* save */);
|
||||
extern void dlg_set_focus(WINDOW * /*parent*/, WINDOW * /*win*/);
|
||||
extern void dlg_tab_correct_str(char * /*prompt*/);
|
||||
extern void dlg_trim_string(char * /*src*/);
|
||||
extern void end_dialog(void);
|
||||
extern void init_dialog(FILE * /*input*/, FILE * /*output*/);
|
||||
|
||||
extern void dlg_exiterr(const char *, ...) GCC_NORETURN
|
||||
#if defined(__GNUC__) && !defined(printf)
|
||||
__attribute__((format(printf,1,2)))
|
||||
#endif
|
||||
;
|
||||
|
||||
#ifdef HAVE_COLOR
|
||||
extern chtype dlg_color_pair(int /*foreground*/, int /*background*/);
|
||||
extern int dlg_color_count(void);
|
||||
extern void dlg_color_setup(void);
|
||||
extern void dlg_draw_shadow(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRCASECMP
|
||||
#define dlg_strcmp(a,b) strcasecmp(a,b)
|
||||
#else
|
||||
extern int dlg_strcmp(const char * /*a*/, const char * /*b*/);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DLG_TRACE
|
||||
#define DLG_TRACE(params) dlg_trace_msg params
|
||||
extern void dlg_trace_msg(const char *fmt, ...)
|
||||
#ifdef GCC_PRINTF
|
||||
__attribute__((format(printf,1,2)))
|
||||
#endif
|
||||
;
|
||||
extern void dlg_trace_win(WINDOW * /*win*/);
|
||||
extern void dlg_trace_chr(int /*ch*/, int /*fkey*/);
|
||||
extern void dlg_trace(const char * /*fname*/);
|
||||
#else
|
||||
#define DLG_TRACE(params) /* nothing */
|
||||
#define dlg_trace_win(win) /* nothing */
|
||||
#define dlg_trace_chr(ch,fkey) /* nothing */
|
||||
#define dlg_trace(fname) /* nothing */
|
||||
#endif
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
extern void dlg_move_window(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following stuff is needed for mouse support
|
||||
*/
|
||||
typedef struct mseRegion {
|
||||
int x, y, X, Y, code;
|
||||
int mode, step_x, step_y;
|
||||
struct mseRegion *next;
|
||||
} mseRegion;
|
||||
|
||||
#if defined(NCURSES_MOUSE_VERSION)
|
||||
|
||||
#define mouse_open() mousemask(BUTTON1_CLICKED, (mmask_t *) 0)
|
||||
#define mouse_close() mousemask(0, (mmask_t *) 0)
|
||||
|
||||
extern mseRegion * dlg_mouse_mkregion (int /*y*/, int /*x*/, int /*height*/, int /*width*/, int /*code*/);
|
||||
extern void dlg_mouse_free_regions (void);
|
||||
extern void dlg_mouse_mkbigregion (int /*y*/, int /*x*/, int /*height*/, int /*width*/, int /*code*/, int /*step_x*/, int /*step_y*/, int /*mode*/);
|
||||
extern void dlg_mouse_setbase (int /*x*/, int /*y*/);
|
||||
|
||||
#define USE_MOUSE 1
|
||||
|
||||
#else
|
||||
|
||||
#define mouse_open() /*nothing*/
|
||||
#define mouse_close() /*nothing*/
|
||||
#define dlg_mouse_free_regions() /* nothing */
|
||||
#define dlg_mouse_mkregion(y, x, height, width, code) /*nothing*/
|
||||
#define dlg_mouse_mkbigregion(y, x, height, width, code, step_x, step_y, mode) /*nothing*/
|
||||
#define dlg_mouse_setbase(x, y) /*nothing*/
|
||||
|
||||
#define USE_MOUSE 0
|
||||
|
||||
#endif
|
||||
|
||||
extern mseRegion *dlg_mouse_region (int /*y*/, int /*x*/);
|
||||
extern mseRegion *dlg_mouse_bigregion (int /*y*/, int /*x*/);
|
||||
extern int dlg_mouse_wgetch (WINDOW * /*win*/, int * /*fkey*/);
|
||||
extern int dlg_mouse_wgetch_nowait (WINDOW * /*win*/, int * /*fkey*/);
|
||||
|
||||
#define mouse_mkbutton(y,x,len,code) dlg_mouse_mkregion(y,x,1,len,code);
|
||||
|
||||
/*
|
||||
* This is the base for fictitious keys, which activate
|
||||
* the buttons.
|
||||
*
|
||||
* Mouse-generated keys are the following:
|
||||
* -- the first 32 are used as numbers, in addition to '0'-'9'
|
||||
* -- uppercase chars are used to invoke the button (M_EVENT + 'O')
|
||||
*/
|
||||
#define M_EVENT (DLGK_max + 1)
|
||||
|
||||
/*
|
||||
* The `flag' parameter in checklist is used to select between
|
||||
* radiolist and checklist
|
||||
*/
|
||||
#define FLAG_CHECK 1
|
||||
#define FLAG_RADIO 0
|
||||
|
||||
/*
|
||||
* This is used only for debugging (FIXME: should have a separate header).
|
||||
*/
|
||||
#ifdef NO_LEAKS
|
||||
extern void _dlg_inputstr_leaks(void);
|
||||
#if defined(NCURSES_VERSION) && defined(HAVE__NC_FREE_AND_EXIT)
|
||||
extern void _nc_free_and_exit(int); /* nc_alloc.h normally not installed */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DIALOG_H_included */
|
23
contrib/dialog/dialog.lsm
Normal file
23
contrib/dialog/dialog.lsm
Normal file
@ -0,0 +1,23 @@
|
||||
Begin3
|
||||
Title: dialog - Display dialog boxes in scripts
|
||||
Version: 1.0-20060221
|
||||
Entered-date: 21FEB06
|
||||
Description: Dialog is a program that will let you present a variety
|
||||
of questions or display messages in nice looking color
|
||||
non-graphical dialog boxes from a shell or perl script.
|
||||
Various dialog boxes can be presented such as yes/no, menu,
|
||||
input, message, checklist, radiolist, and more.
|
||||
|
||||
This program is based on the no longer maintained cdialog, but
|
||||
contains bug fixes and more features.
|
||||
Keywords: dialog, cdialog, shell, script, window
|
||||
Author: Originally Savio Lam for the ancient version
|
||||
Maintained-by: Thomas E. Dickey <dickey@invisible-island.net>
|
||||
Vila, Santiago <sanvila@debian.org>
|
||||
Primary-site: http://invisible-island.net/dialog/
|
||||
http://packages.debian.org/
|
||||
Alternate-site: ftp://ftp.us.debian.org/debian/pool/main/d/dialog/
|
||||
Original-site: ftp://sunsite.unc.edu/pub/Linux/utils/shell
|
||||
Platforms: Linux *nix, OS/2 EMX
|
||||
Copying-policy: LGPL
|
||||
End
|
454
contrib/dialog/dialog.pl
Normal file
454
contrib/dialog/dialog.pl
Normal file
@ -0,0 +1,454 @@
|
||||
# Functions that handle calling dialog(1) -*-perl-*-
|
||||
# $Id: dialog.pl,v 1.4 2001/10/13 00:40:22 tom Exp $
|
||||
|
||||
# Return values are 1 for success and 0 for failure (or cancel)
|
||||
# Resultant text (if any) is in dialog_result
|
||||
|
||||
# Unfortunately, the gauge requires use of /bin/sh to get going.
|
||||
# I didn't bother to make the others shell-free, although it
|
||||
# would be simple to do.
|
||||
|
||||
# Note that dialog generally returns 0 for success, so I invert the
|
||||
# sense of the return code for more readable boolean expressions.
|
||||
|
||||
$scr_lines = 24;
|
||||
|
||||
require "flush.pl";
|
||||
|
||||
sub rhs_clear {
|
||||
return system("dialog --clear");
|
||||
}
|
||||
|
||||
sub rhs_textbox {
|
||||
local ( $title, $file, $width, $height ) = @_;
|
||||
|
||||
system("dialog --title \"$title\" --textbox $file $height $width");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub rhs_msgbox {
|
||||
local ( $title, $message, $width ) = @_;
|
||||
local ( $tmp, $height, $message_len );
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
$height = 4 + $message_len;
|
||||
|
||||
$tmp = system("dialog --title \"$title\" --msgbox \"$message\" $height $width");
|
||||
if ($tmp) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
sub rhs_infobox {
|
||||
local ( $title, $message, $width ) = @_;
|
||||
local ( $tmp, $height, $message_len );
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
$height = 2 + $message_len;
|
||||
|
||||
return system("dialog --title \"$title\" --infobox \"$message\" $height $width");
|
||||
}
|
||||
|
||||
sub rhs_yesno {
|
||||
local ( $title, $message, $width ) = @_;
|
||||
local ( $tmp, $height, $message_len );
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
$height = 4 + $message_len;
|
||||
|
||||
$tmp = system("dialog --title \"$title\" --yesno \"$message\" $height $width");
|
||||
# Dumb: dialog returns 0 for "yes" and 1 for "no"
|
||||
if (! $tmp) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sub rhs_gauge {
|
||||
local ( $title, $message, $width, $percent ) = @_;
|
||||
local ( $tmp, $height, $message_len );
|
||||
|
||||
$gauge_width = $width;
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
$height = 5 + $message_len;
|
||||
|
||||
open(GAUGE, "|dialog --title \"$title\" --gauge \"$message\" $height $width $percent");
|
||||
}
|
||||
|
||||
sub rhs_update_gauge {
|
||||
local ( $percent ) = @_;
|
||||
|
||||
&printflush(GAUGE, "$percent\n");
|
||||
}
|
||||
|
||||
sub rhs_update_gauge_and_message {
|
||||
local ( $message, $percent ) = @_;
|
||||
|
||||
$message = &rhs_wordwrap($message, $gauge_width);
|
||||
$message =~ s/\n/\\n/g;
|
||||
&printflush(GAUGE, "XXX\n$percent\n$message\nXXX\n");
|
||||
}
|
||||
|
||||
sub rhs_stop_gauge {
|
||||
close GAUGE;
|
||||
}
|
||||
|
||||
sub rhs_inputbox {
|
||||
local ( $title, $message, $width, $instr ) = @_;
|
||||
local ( $tmp, $height, $message_len );
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
$height = 7 + $message_len;
|
||||
|
||||
return &return_output(0, "dialog --title \"$title\" --inputbox \"$message\" $height $width \"$instr\"");
|
||||
}
|
||||
|
||||
sub rhs_menu {
|
||||
local ( $title, $message, $width, $numitems ) = @_;
|
||||
local ( $i, $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
shift; shift; shift; shift;
|
||||
|
||||
@list = ();
|
||||
for ($i = 0; $i < $numitems; $i++) {
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
|
||||
return &return_output(0, "dialog --title \"$title\" --menu \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub rhs_menul {
|
||||
local ( $title, $message, $width, $numitems ) = @_;
|
||||
local ( $i, $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
shift; shift; shift; shift;
|
||||
|
||||
@list = ();
|
||||
for ($i = 0; $i < $numitems; $i++) {
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$list[@list] = "\"\"";
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
|
||||
return &return_output(0, "dialog --title \"$title\" --menu \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub rhs_menua {
|
||||
local ( $title, $message, $width, %items ) = @_;
|
||||
local ( $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
@list = ();
|
||||
foreach $ent (sort keys (%items)) {
|
||||
$list[@list] = "\"$ent\"";
|
||||
$list[@list] = "\"$items{$ent}\"";
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$numitems = keys(%items);
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
|
||||
return &return_output(0, "dialog --title \"$title\" --menu \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub rhs_checklist {
|
||||
local ( $title, $message, $width, $numitems ) = @_;
|
||||
local ( $i, $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
shift; shift; shift; shift;
|
||||
|
||||
@list = ();
|
||||
for ($i = 0; $i < $numitems; $i++) {
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$ent = shift;
|
||||
if ($ent) {
|
||||
$list[@list] = "ON";
|
||||
} else {
|
||||
$list[@list] = "OFF";
|
||||
}
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
|
||||
return &return_output("list", "dialog --title \"$title\" --separate-output --checklist \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub rhs_checklistl {
|
||||
local ( $title, $message, $width, $numitems ) = @_;
|
||||
local ( $i, $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
shift; shift; shift; shift;
|
||||
|
||||
@list = ();
|
||||
for ($i = 0; $i < $numitems; $i++) {
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$list[@list] = "\"\"";
|
||||
$list[@list] = "OFF";
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
return &return_output("list", "dialog --title \"$title\" --separate-output --checklist \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub rhs_checklista {
|
||||
local ( $title, $message, $width, %items ) = @_;
|
||||
local ( $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
shift; shift; shift; shift;
|
||||
|
||||
@list = ();
|
||||
foreach $ent (sort keys (%items)) {
|
||||
$list[@list] = "\"$ent\"";
|
||||
$list[@list] = "\"$items{$ent}\"";
|
||||
$list[@list] = "OFF";
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$numitems = keys(%items);
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
|
||||
return &return_output("list", "dialog --title \"$title\" --separate-output --checklist \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub rhs_radiolist {
|
||||
local ( $title, $message, $width, $numitems ) = @_;
|
||||
local ( $i, $tmp, $ent, $height, $menuheight, @list, $message_len );
|
||||
|
||||
shift; shift; shift; shift;
|
||||
|
||||
@list = ();
|
||||
for ($i = 0; $i < $numitems; $i++) {
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$ent = shift;
|
||||
$list[@list] = "\"$ent\"";
|
||||
$ent = shift;
|
||||
if ($ent) {
|
||||
$list[@list] = "ON";
|
||||
} else {
|
||||
$list[@list] = "OFF";
|
||||
}
|
||||
}
|
||||
|
||||
$message = &rhs_wordwrap($message, $width);
|
||||
|
||||
$message_len = split(/^/, $message);
|
||||
$tmp = $message;
|
||||
if (chop($tmp) eq "\n") {
|
||||
$message_len++;
|
||||
}
|
||||
|
||||
$height = $message_len + 6 + $numitems;
|
||||
if ($height <= $scr_lines) {
|
||||
$menuheight = $numitems;
|
||||
} else {
|
||||
$height = $scr_lines;
|
||||
$menuheight = $scr_lines - $message_len - 6;
|
||||
}
|
||||
|
||||
return &return_output(0 , "dialog --title \"$title\" --radiolist \"$message\" $height $width $menuheight @list");
|
||||
}
|
||||
|
||||
sub return_output {
|
||||
local ( $listp, $command ) = @_;
|
||||
local ( $res ) = 1;
|
||||
|
||||
pipe(PARENT_READER, CHILD_WRITER);
|
||||
# We have to fork (as opposed to using "system") so that the parent
|
||||
# process can read from the pipe to avoid deadlock.
|
||||
my ($pid) = fork;
|
||||
if ($pid == 0) { # child
|
||||
close(PARENT_READER);
|
||||
open(STDERR, ">&CHILD_WRITER");
|
||||
exec($command);
|
||||
die("no exec");
|
||||
}
|
||||
if ($pid > 0) { # parent
|
||||
close( CHILD_WRITER );
|
||||
if ($listp) {
|
||||
@dialog_result = ();
|
||||
while (<PARENT_READER>) {
|
||||
chop;
|
||||
$dialog_result[@dialog_result] = $_;
|
||||
}
|
||||
}
|
||||
else { $dialog_result = <PARENT_READER>; }
|
||||
close(PARENT_READER);
|
||||
waitpid($pid,0);
|
||||
$res = $?;
|
||||
}
|
||||
|
||||
# Again, dialog returns results backwards
|
||||
if (! $res) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sub rhs_wordwrap {
|
||||
local ( $intext, $width ) = @_;
|
||||
local ( $outtext, $i, $j, @lines, $wrap, @words, $pos, $pad );
|
||||
|
||||
$outtext = "";
|
||||
$pad = 3; # leave 3 spaces around each line
|
||||
$pos = $pad; # current insert position
|
||||
$wrap = 0; # 1 if we have been auto wraping
|
||||
$insert_nl = 0; # 1 if we just did an absolute
|
||||
# and we should preface any new text
|
||||
# with a new line
|
||||
@lines = split(/\n/, $intext);
|
||||
for ($i = 0; $i <= $#lines; $i++) {
|
||||
if ($lines[$i] =~ /^>/) {
|
||||
$outtext .= "\n" if ($insert_nl);
|
||||
$outtext .= "\n" if ($wrap);
|
||||
$lines[$i] =~ /^>(.*)$/;
|
||||
$outtext .= $1;
|
||||
$insert_nl = 1;
|
||||
$wrap = 0;
|
||||
$pos = $pad;
|
||||
} else {
|
||||
$wrap = 1;
|
||||
@words = split(/\s+/,$lines[$i]);
|
||||
for ($j = 0; $j <= $#words; $j++) {
|
||||
if ($insert_nl) {
|
||||
$outtext .= "\n";
|
||||
$insert_nl = 0;
|
||||
}
|
||||
if ((length($words[$j]) + $pos) > $width - $pad) {
|
||||
$outtext .= "\n";
|
||||
$pos = $pad;
|
||||
}
|
||||
$outtext .= $words[$j] . " ";
|
||||
$pos += length($words[$j]) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $outtext;
|
||||
}
|
||||
|
||||
############
|
||||
1;
|
182
contrib/dialog/dlg_colors.h
Normal file
182
contrib/dialog/dlg_colors.h
Normal file
@ -0,0 +1,182 @@
|
||||
/*
|
||||
* $Id: dlg_colors.h,v 1.15 2007/02/18 18:23:29 tom Exp $
|
||||
*
|
||||
* colors.h -- color attribute definitions
|
||||
*
|
||||
* Copyright 2000-2005,2006 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*
|
||||
* An earlier version of this program lists as authors
|
||||
* Savio Lam (lam836@cs.cuhk.hk)
|
||||
*/
|
||||
|
||||
#ifndef COLORS_H_included
|
||||
#define COLORS_H_included 1
|
||||
|
||||
#include <dialog.h>
|
||||
|
||||
/*
|
||||
* Default color definitions (DLGC means "Dialog Color")
|
||||
*
|
||||
* DLGC_FG_xxx = foreground for "xxx"
|
||||
* DLGC_BG_xxx = background for "xxx"
|
||||
* DLGC_HL_xxx = highlight for "xxx"
|
||||
*/
|
||||
#define DLGC_FG_SCREEN COLOR_CYAN
|
||||
#define DLGC_BG_SCREEN COLOR_BLUE
|
||||
#define DLGC_HL_SCREEN TRUE
|
||||
|
||||
#define DLGC_FG_SHADOW COLOR_BLACK
|
||||
#define DLGC_BG_SHADOW COLOR_BLACK
|
||||
#define DLGC_HL_SHADOW TRUE
|
||||
|
||||
#define DLGC_FG_DIALOG COLOR_BLACK
|
||||
#define DLGC_BG_DIALOG COLOR_WHITE
|
||||
#define DLGC_HL_DIALOG FALSE
|
||||
|
||||
#define DLGC_FG_TITLE COLOR_BLUE
|
||||
#define DLGC_BG_TITLE COLOR_WHITE
|
||||
#define DLGC_HL_TITLE TRUE
|
||||
|
||||
#define DLGC_FG_BORDER COLOR_WHITE
|
||||
#define DLGC_BG_BORDER COLOR_WHITE
|
||||
#define DLGC_HL_BORDER TRUE
|
||||
|
||||
#define DLGC_FG_BUTTON_ACTIVE COLOR_WHITE
|
||||
#define DLGC_BG_BUTTON_ACTIVE COLOR_BLUE
|
||||
#define DLGC_HL_BUTTON_ACTIVE TRUE
|
||||
|
||||
#define DLGC_FG_BUTTON_INACTIVE COLOR_BLACK
|
||||
#define DLGC_BG_BUTTON_INACTIVE COLOR_WHITE
|
||||
#define DLGC_HL_BUTTON_INACTIVE FALSE
|
||||
|
||||
#define DLGC_FG_BUTTON_KEY_ACTIVE COLOR_WHITE
|
||||
#define DLGC_BG_BUTTON_KEY_ACTIVE COLOR_BLUE
|
||||
#define DLGC_HL_BUTTON_KEY_ACTIVE TRUE
|
||||
|
||||
#define DLGC_FG_BUTTON_KEY_INACTIVE COLOR_RED
|
||||
#define DLGC_BG_BUTTON_KEY_INACTIVE COLOR_WHITE
|
||||
#define DLGC_HL_BUTTON_KEY_INACTIVE FALSE
|
||||
|
||||
#define DLGC_FG_BUTTON_LABEL_ACTIVE COLOR_YELLOW
|
||||
#define DLGC_BG_BUTTON_LABEL_ACTIVE COLOR_BLUE
|
||||
#define DLGC_HL_BUTTON_LABEL_ACTIVE TRUE
|
||||
|
||||
#define DLGC_FG_BUTTON_LABEL_INACTIVE COLOR_BLACK
|
||||
#define DLGC_BG_BUTTON_LABEL_INACTIVE COLOR_WHITE
|
||||
#define DLGC_HL_BUTTON_LABEL_INACTIVE TRUE
|
||||
|
||||
#define DLGC_FG_FORM_ITEM_READONLY COLOR_CYAN
|
||||
#define DLGC_BG_FORM_ITEM_READONLY COLOR_WHITE
|
||||
#define DLGC_HL_FORM_ITEM_READONLY TRUE
|
||||
|
||||
#define DLGC_FG_INPUTBOX COLOR_BLACK
|
||||
#define DLGC_BG_INPUTBOX COLOR_WHITE
|
||||
#define DLGC_HL_INPUTBOX FALSE
|
||||
|
||||
#define DLGC_FG_INPUTBOX_BORDER COLOR_BLACK
|
||||
#define DLGC_BG_INPUTBOX_BORDER COLOR_WHITE
|
||||
#define DLGC_HL_INPUTBOX_BORDER FALSE
|
||||
|
||||
#define DLGC_FG_SEARCHBOX COLOR_BLACK
|
||||
#define DLGC_BG_SEARCHBOX COLOR_WHITE
|
||||
#define DLGC_HL_SEARCHBOX FALSE
|
||||
|
||||
#define DLGC_FG_SEARCHBOX_TITLE COLOR_BLUE
|
||||
#define DLGC_BG_SEARCHBOX_TITLE COLOR_WHITE
|
||||
#define DLGC_HL_SEARCHBOX_TITLE TRUE
|
||||
|
||||
#define DLGC_FG_SEARCHBOX_BORDER COLOR_WHITE
|
||||
#define DLGC_BG_SEARCHBOX_BORDER COLOR_WHITE
|
||||
#define DLGC_HL_SEARCHBOX_BORDER TRUE
|
||||
|
||||
#define DLGC_FG_POSITION_INDICATOR COLOR_BLUE
|
||||
#define DLGC_BG_POSITION_INDICATOR COLOR_WHITE
|
||||
#define DLGC_HL_POSITION_INDICATOR TRUE
|
||||
|
||||
#define DLGC_FG_MENUBOX COLOR_BLACK
|
||||
#define DLGC_BG_MENUBOX COLOR_WHITE
|
||||
#define DLGC_HL_MENUBOX FALSE
|
||||
|
||||
#define DLGC_FG_MENUBOX_BORDER COLOR_WHITE
|
||||
#define DLGC_BG_MENUBOX_BORDER COLOR_WHITE
|
||||
#define DLGC_HL_MENUBOX_BORDER TRUE
|
||||
|
||||
#define DLGC_FG_ITEM COLOR_BLACK
|
||||
#define DLGC_BG_ITEM COLOR_WHITE
|
||||
#define DLGC_HL_ITEM FALSE
|
||||
|
||||
#define DLGC_FG_ITEM_SELECTED COLOR_WHITE
|
||||
#define DLGC_BG_ITEM_SELECTED COLOR_BLUE
|
||||
#define DLGC_HL_ITEM_SELECTED TRUE
|
||||
|
||||
#define DLGC_FG_TAG COLOR_BLUE
|
||||
#define DLGC_BG_TAG COLOR_WHITE
|
||||
#define DLGC_HL_TAG TRUE
|
||||
|
||||
#define DLGC_FG_TAG_SELECTED COLOR_YELLOW
|
||||
#define DLGC_BG_TAG_SELECTED COLOR_BLUE
|
||||
#define DLGC_HL_TAG_SELECTED TRUE
|
||||
|
||||
#define DLGC_FG_TAG_KEY COLOR_RED
|
||||
#define DLGC_BG_TAG_KEY COLOR_WHITE
|
||||
#define DLGC_HL_TAG_KEY FALSE
|
||||
|
||||
#define DLGC_FG_TAG_KEY_SELECTED COLOR_RED
|
||||
#define DLGC_BG_TAG_KEY_SELECTED COLOR_BLUE
|
||||
#define DLGC_HL_TAG_KEY_SELECTED TRUE
|
||||
|
||||
#define DLGC_FG_CHECK COLOR_BLACK
|
||||
#define DLGC_BG_CHECK COLOR_WHITE
|
||||
#define DLGC_HL_CHECK FALSE
|
||||
|
||||
#define DLGC_FG_CHECK_SELECTED COLOR_WHITE
|
||||
#define DLGC_BG_CHECK_SELECTED COLOR_BLUE
|
||||
#define DLGC_HL_CHECK_SELECTED TRUE
|
||||
|
||||
#define DLGC_FG_UARROW COLOR_GREEN
|
||||
#define DLGC_BG_UARROW COLOR_WHITE
|
||||
#define DLGC_HL_UARROW TRUE
|
||||
|
||||
#define DLGC_FG_DARROW COLOR_GREEN
|
||||
#define DLGC_BG_DARROW COLOR_WHITE
|
||||
#define DLGC_HL_DARROW TRUE
|
||||
|
||||
#define DLGC_FG_ITEMHELP COLOR_WHITE
|
||||
#define DLGC_BG_ITEMHELP COLOR_BLACK
|
||||
#define DLGC_HL_ITEMHELP FALSE
|
||||
|
||||
#define DLGC_FG_FORM_ACTIVE_TEXT COLOR_WHITE
|
||||
#define DLGC_BG_FORM_ACTIVE_TEXT COLOR_BLUE
|
||||
#define DLGC_HL_FORM_ACTIVE_TEXT TRUE
|
||||
|
||||
#define DLGC_FG_FORM_TEXT COLOR_WHITE
|
||||
#define DLGC_BG_FORM_TEXT COLOR_CYAN
|
||||
#define DLGC_HL_FORM_TEXT TRUE
|
||||
|
||||
/* End of default color definitions */
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int value;
|
||||
} color_names_st;
|
||||
|
||||
#endif /* COLORS_H_included */
|
729
contrib/dialog/dlg_keys.c
Normal file
729
contrib/dialog/dlg_keys.c
Normal file
@ -0,0 +1,729 @@
|
||||
/*
|
||||
* $Id: dlg_keys.c,v 1.26 2009/02/22 16:19:51 tom Exp $
|
||||
*
|
||||
* dlg_keys.c -- runtime binding support for dialog
|
||||
*
|
||||
* Copyright 2006-2007,2009 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#define LIST_BINDINGS struct _list_bindings
|
||||
|
||||
LIST_BINDINGS {
|
||||
LIST_BINDINGS *link;
|
||||
WINDOW *win; /* window on which widget gets input */
|
||||
const char *name; /* widget name */
|
||||
bool buttons; /* true only for dlg_register_buttons() */
|
||||
DLG_KEYS_BINDING *binding; /* list of bindings */
|
||||
};
|
||||
|
||||
static LIST_BINDINGS *all_bindings;
|
||||
static const DLG_KEYS_BINDING end_keys_binding = END_KEYS_BINDING;
|
||||
|
||||
/*
|
||||
* For a given named widget's window, associate a binding table.
|
||||
*/
|
||||
void
|
||||
dlg_register_window(WINDOW *win, const char *name, DLG_KEYS_BINDING * binding)
|
||||
{
|
||||
LIST_BINDINGS *p, *q;
|
||||
|
||||
for (p = all_bindings, q = 0; p != 0; q = p, p = p->link) {
|
||||
if (p->win == win && !strcmp(p->name, name)) {
|
||||
p->binding = binding;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* add built-in bindings at the end of the list (see compare_bindings). */
|
||||
if ((p = dlg_calloc(LIST_BINDINGS, 1)) != 0) {
|
||||
p->win = win;
|
||||
p->name = name;
|
||||
p->binding = binding;
|
||||
if (q != 0)
|
||||
q->link = p;
|
||||
else
|
||||
all_bindings = p;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Unlike dlg_lookup_key(), this looks for either widget-builtin or rc-file
|
||||
* definitions, depending on whether 'win' is null.
|
||||
*/
|
||||
static int
|
||||
key_is_bound(WINDOW *win, const char *name, int curses_key, int function_key)
|
||||
{
|
||||
LIST_BINDINGS *p;
|
||||
|
||||
for (p = all_bindings; p != 0; p = p->link) {
|
||||
if (p->win == win && !dlg_strcmp(p->name, name)) {
|
||||
int n;
|
||||
for (n = 0; p->binding[n].is_function_key >= 0; ++n) {
|
||||
if (p->binding[n].curses_key == curses_key
|
||||
&& p->binding[n].is_function_key == function_key) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call this function after dlg_register_window(), for the list of button
|
||||
* labels associated with the widget.
|
||||
*
|
||||
* Ensure that dlg_lookup_key() will not accidentally translate a key that
|
||||
* we would like to use for a button abbreviation to some other key, e.g.,
|
||||
* h/j/k/l for navigation into a cursor key. Do this by binding the key
|
||||
* to itself.
|
||||
*
|
||||
* See dlg_char_to_button().
|
||||
*/
|
||||
void
|
||||
dlg_register_buttons(WINDOW *win, const char *name, const char **buttons)
|
||||
{
|
||||
int n;
|
||||
LIST_BINDINGS *p;
|
||||
DLG_KEYS_BINDING *q;
|
||||
|
||||
if (buttons == 0)
|
||||
return;
|
||||
|
||||
for (n = 0; buttons[n] != 0; ++n) {
|
||||
int curses_key = dlg_button_to_char(buttons[n]);
|
||||
|
||||
/* ignore multibyte characters */
|
||||
if (curses_key >= KEY_MIN)
|
||||
continue;
|
||||
|
||||
/* if it is not bound in the widget, skip it (no conflicts) */
|
||||
if (!key_is_bound(win, name, curses_key, FALSE))
|
||||
continue;
|
||||
|
||||
#ifdef HAVE_RC_FILE
|
||||
/* if it is bound in the rc-file, skip it */
|
||||
if (key_is_bound(0, name, curses_key, FALSE))
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if ((p = dlg_calloc(LIST_BINDINGS, 1)) != 0) {
|
||||
if ((q = dlg_calloc(DLG_KEYS_BINDING, 2)) != 0) {
|
||||
q[0].is_function_key = 0;
|
||||
q[0].curses_key = curses_key;
|
||||
q[0].dialog_key = curses_key;
|
||||
q[1] = end_keys_binding;
|
||||
|
||||
p->win = win;
|
||||
p->name = name;
|
||||
p->buttons = TRUE;
|
||||
p->binding = q;
|
||||
|
||||
/* put these at the beginning, to override the widget's table */
|
||||
p->link = all_bindings;
|
||||
all_bindings = p;
|
||||
} else {
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the bindings for a given window.
|
||||
*/
|
||||
void
|
||||
dlg_unregister_window(WINDOW *win)
|
||||
{
|
||||
LIST_BINDINGS *p, *q;
|
||||
|
||||
for (p = all_bindings, q = 0; p != 0; p = p->link) {
|
||||
if (p->win == win) {
|
||||
if (q != 0) {
|
||||
q->link = p->link;
|
||||
} else {
|
||||
all_bindings = p->link;
|
||||
}
|
||||
/* the user-defined and buttons-bindings all are length=1 */
|
||||
if (p->binding[1].is_function_key < 0)
|
||||
free(p->binding);
|
||||
free(p);
|
||||
dlg_unregister_window(win);
|
||||
break;
|
||||
}
|
||||
q = p;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Call this after wgetch(), using the same window pointer and passing
|
||||
* the curses-key.
|
||||
*
|
||||
* If there is no binding associated with the widget, it simply returns
|
||||
* the given curses-key.
|
||||
*
|
||||
* Parameters:
|
||||
* win is the window on which the wgetch() was done.
|
||||
* curses_key is the value returned by wgetch().
|
||||
* fkey in/out (on input, it is true if curses_key is a function key,
|
||||
* and on output, it is true if the result is a function key).
|
||||
*/
|
||||
int
|
||||
dlg_lookup_key(WINDOW *win, int curses_key, int *fkey)
|
||||
{
|
||||
LIST_BINDINGS *p;
|
||||
int n;
|
||||
|
||||
/*
|
||||
* Ignore mouse clicks, since they are already encoded properly.
|
||||
*/
|
||||
#ifdef KEY_MOUSE
|
||||
if (*fkey != 0 && curses_key == KEY_MOUSE) {
|
||||
;
|
||||
} else
|
||||
#endif
|
||||
/*
|
||||
* Ignore resize events, since they are already encoded properly.
|
||||
*/
|
||||
#ifdef KEY_RESIZE
|
||||
if (*fkey != 0 && curses_key == KEY_RESIZE) {
|
||||
;
|
||||
} else
|
||||
#endif
|
||||
if (*fkey == 0 || curses_key < KEY_MAX) {
|
||||
for (p = all_bindings; p != 0; p = p->link) {
|
||||
if (p->win == win || p->win == 0) {
|
||||
int function_key = (*fkey != 0);
|
||||
for (n = 0; p->binding[n].is_function_key >= 0; ++n) {
|
||||
if (p->buttons
|
||||
&& !function_key
|
||||
&& p->binding[n].curses_key == (int) dlg_toupper(curses_key)) {
|
||||
*fkey = 0;
|
||||
return p->binding[n].dialog_key;
|
||||
}
|
||||
if (p->binding[n].curses_key == curses_key
|
||||
&& p->binding[n].is_function_key == function_key) {
|
||||
*fkey = p->binding[n].dialog_key;
|
||||
return *fkey;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return curses_key;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test a dialog internal keycode to see if it corresponds to one of the push
|
||||
* buttons on the widget such as "OK".
|
||||
*
|
||||
* This is only useful if there are user-defined key bindings, since there are
|
||||
* no built-in bindings that map directly to DLGK_OK, etc.
|
||||
*
|
||||
* See also dlg_ok_buttoncode().
|
||||
*/
|
||||
int
|
||||
dlg_result_key(int dialog_key, int fkey GCC_UNUSED, int *resultp)
|
||||
{
|
||||
int done = FALSE;
|
||||
|
||||
#ifdef HAVE_RC_FILE
|
||||
if (fkey) {
|
||||
switch ((DLG_KEYS_ENUM) dialog_key) {
|
||||
case DLGK_OK:
|
||||
*resultp = DLG_EXIT_OK;
|
||||
done = TRUE;
|
||||
break;
|
||||
case DLGK_CANCEL:
|
||||
if (!dialog_vars.nocancel) {
|
||||
*resultp = DLG_EXIT_CANCEL;
|
||||
done = TRUE;
|
||||
}
|
||||
break;
|
||||
case DLGK_EXTRA:
|
||||
if (dialog_vars.extra_button) {
|
||||
*resultp = DLG_EXIT_EXTRA;
|
||||
done = TRUE;
|
||||
}
|
||||
break;
|
||||
case DLGK_HELP:
|
||||
if (dialog_vars.help_button) {
|
||||
*resultp = DLG_EXIT_HELP;
|
||||
done = TRUE;
|
||||
}
|
||||
break;
|
||||
case DLGK_ESC:
|
||||
*resultp = DLG_EXIT_ESC;
|
||||
done = TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
if (dialog_key == ESC) {
|
||||
*resultp = DLG_EXIT_ESC;
|
||||
done = TRUE;
|
||||
} else if (dialog_key == ERR) {
|
||||
*resultp = DLG_EXIT_ERROR;
|
||||
done = TRUE;
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
#ifdef HAVE_RC_FILE
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int code;
|
||||
} CODENAME;
|
||||
|
||||
#define CURSES_NAME(upper) { #upper, KEY_ ## upper }
|
||||
#define COUNT_CURSES sizeof(curses_names)/sizeof(curses_names[0])
|
||||
static const CODENAME curses_names[] =
|
||||
{
|
||||
CURSES_NAME(DOWN),
|
||||
CURSES_NAME(UP),
|
||||
CURSES_NAME(LEFT),
|
||||
CURSES_NAME(RIGHT),
|
||||
CURSES_NAME(HOME),
|
||||
CURSES_NAME(BACKSPACE),
|
||||
CURSES_NAME(F0),
|
||||
CURSES_NAME(DL),
|
||||
CURSES_NAME(IL),
|
||||
CURSES_NAME(DC),
|
||||
CURSES_NAME(IC),
|
||||
CURSES_NAME(EIC),
|
||||
CURSES_NAME(CLEAR),
|
||||
CURSES_NAME(EOS),
|
||||
CURSES_NAME(EOL),
|
||||
CURSES_NAME(SF),
|
||||
CURSES_NAME(SR),
|
||||
CURSES_NAME(NPAGE),
|
||||
CURSES_NAME(PPAGE),
|
||||
CURSES_NAME(STAB),
|
||||
CURSES_NAME(CTAB),
|
||||
CURSES_NAME(CATAB),
|
||||
CURSES_NAME(ENTER),
|
||||
CURSES_NAME(PRINT),
|
||||
CURSES_NAME(LL),
|
||||
CURSES_NAME(A1),
|
||||
CURSES_NAME(A3),
|
||||
CURSES_NAME(B2),
|
||||
CURSES_NAME(C1),
|
||||
CURSES_NAME(C3),
|
||||
CURSES_NAME(BTAB),
|
||||
CURSES_NAME(BEG),
|
||||
CURSES_NAME(CANCEL),
|
||||
CURSES_NAME(CLOSE),
|
||||
CURSES_NAME(COMMAND),
|
||||
CURSES_NAME(COPY),
|
||||
CURSES_NAME(CREATE),
|
||||
CURSES_NAME(END),
|
||||
CURSES_NAME(EXIT),
|
||||
CURSES_NAME(FIND),
|
||||
CURSES_NAME(HELP),
|
||||
CURSES_NAME(MARK),
|
||||
CURSES_NAME(MESSAGE),
|
||||
CURSES_NAME(MOVE),
|
||||
CURSES_NAME(NEXT),
|
||||
CURSES_NAME(OPEN),
|
||||
CURSES_NAME(OPTIONS),
|
||||
CURSES_NAME(PREVIOUS),
|
||||
CURSES_NAME(REDO),
|
||||
CURSES_NAME(REFERENCE),
|
||||
CURSES_NAME(REFRESH),
|
||||
CURSES_NAME(REPLACE),
|
||||
CURSES_NAME(RESTART),
|
||||
CURSES_NAME(RESUME),
|
||||
CURSES_NAME(SAVE),
|
||||
CURSES_NAME(SBEG),
|
||||
CURSES_NAME(SCANCEL),
|
||||
CURSES_NAME(SCOMMAND),
|
||||
CURSES_NAME(SCOPY),
|
||||
CURSES_NAME(SCREATE),
|
||||
CURSES_NAME(SDC),
|
||||
CURSES_NAME(SDL),
|
||||
CURSES_NAME(SELECT),
|
||||
CURSES_NAME(SEND),
|
||||
CURSES_NAME(SEOL),
|
||||
CURSES_NAME(SEXIT),
|
||||
CURSES_NAME(SFIND),
|
||||
CURSES_NAME(SHELP),
|
||||
CURSES_NAME(SHOME),
|
||||
CURSES_NAME(SIC),
|
||||
CURSES_NAME(SLEFT),
|
||||
CURSES_NAME(SMESSAGE),
|
||||
CURSES_NAME(SMOVE),
|
||||
CURSES_NAME(SNEXT),
|
||||
CURSES_NAME(SOPTIONS),
|
||||
CURSES_NAME(SPREVIOUS),
|
||||
CURSES_NAME(SPRINT),
|
||||
CURSES_NAME(SREDO),
|
||||
CURSES_NAME(SREPLACE),
|
||||
CURSES_NAME(SRIGHT),
|
||||
CURSES_NAME(SRSUME),
|
||||
CURSES_NAME(SSAVE),
|
||||
CURSES_NAME(SSUSPEND),
|
||||
CURSES_NAME(SUNDO),
|
||||
CURSES_NAME(SUSPEND),
|
||||
CURSES_NAME(UNDO),
|
||||
};
|
||||
|
||||
#define DIALOG_NAME(upper) { #upper, DLGK_ ## upper }
|
||||
#define COUNT_DIALOG sizeof(dialog_names)/sizeof(dialog_names[0])
|
||||
static const CODENAME dialog_names[] =
|
||||
{
|
||||
DIALOG_NAME(OK),
|
||||
DIALOG_NAME(CANCEL),
|
||||
DIALOG_NAME(EXTRA),
|
||||
DIALOG_NAME(HELP),
|
||||
DIALOG_NAME(ESC),
|
||||
DIALOG_NAME(PAGE_FIRST),
|
||||
DIALOG_NAME(PAGE_LAST),
|
||||
DIALOG_NAME(PAGE_NEXT),
|
||||
DIALOG_NAME(PAGE_PREV),
|
||||
DIALOG_NAME(ITEM_FIRST),
|
||||
DIALOG_NAME(ITEM_LAST),
|
||||
DIALOG_NAME(ITEM_NEXT),
|
||||
DIALOG_NAME(ITEM_PREV),
|
||||
DIALOG_NAME(FIELD_FIRST),
|
||||
DIALOG_NAME(FIELD_LAST),
|
||||
DIALOG_NAME(FIELD_NEXT),
|
||||
DIALOG_NAME(FIELD_PREV),
|
||||
DIALOG_NAME(GRID_UP),
|
||||
DIALOG_NAME(GRID_DOWN),
|
||||
DIALOG_NAME(GRID_LEFT),
|
||||
DIALOG_NAME(GRID_RIGHT),
|
||||
DIALOG_NAME(DELETE_LEFT),
|
||||
DIALOG_NAME(DELETE_RIGHT),
|
||||
DIALOG_NAME(DELETE_ALL),
|
||||
DIALOG_NAME(ENTER),
|
||||
DIALOG_NAME(BEGIN),
|
||||
DIALOG_NAME(FINAL),
|
||||
DIALOG_NAME(SELECT)
|
||||
};
|
||||
|
||||
static char *
|
||||
skip_white(char *s)
|
||||
{
|
||||
while (*s != '\0' && isspace(UCH(*s)))
|
||||
++s;
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *
|
||||
skip_black(char *s)
|
||||
{
|
||||
while (*s != '\0' && !isspace(UCH(*s)))
|
||||
++s;
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find a user-defined binding, given the curses key code.
|
||||
*/
|
||||
static DLG_KEYS_BINDING *
|
||||
find_binding(char *widget, int curses_key)
|
||||
{
|
||||
LIST_BINDINGS *p;
|
||||
DLG_KEYS_BINDING *result = 0;
|
||||
|
||||
for (p = all_bindings; p != 0; p = p->link) {
|
||||
if (p->win == 0
|
||||
&& !dlg_strcmp(p->name, widget)
|
||||
&& p->binding->curses_key == curses_key) {
|
||||
result = p->binding;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Built-in bindings have a nonzero "win" member, and the associated binding
|
||||
* table can have more than one entry. We keep those last, since lookups will
|
||||
* find the user-defined bindings first and use those.
|
||||
*
|
||||
* Sort "*" (all-widgets) entries past named widgets, since those are less
|
||||
* specific.
|
||||
*/
|
||||
static int
|
||||
compare_bindings(LIST_BINDINGS * a, LIST_BINDINGS * b)
|
||||
{
|
||||
int result = 0;
|
||||
if (a->win == b->win) {
|
||||
if (!strcmp(a->name, b->name)) {
|
||||
result = a->binding[0].curses_key - b->binding[0].curses_key;
|
||||
} else if (!strcmp(b->name, "*")) {
|
||||
result = -1;
|
||||
} else if (!strcmp(a->name, "*")) {
|
||||
result = 1;
|
||||
} else {
|
||||
result = dlg_strcmp(a->name, b->name);
|
||||
}
|
||||
} else if (b->win) {
|
||||
result = -1;
|
||||
} else {
|
||||
result = 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find a user-defined binding, given the curses key code. If it does not
|
||||
* exist, create a new one, inserting it into the linked list, keeping it
|
||||
* sorted to simplify lookups for user-defined bindings that can override
|
||||
* the built-in bindings.
|
||||
*/
|
||||
static DLG_KEYS_BINDING *
|
||||
make_binding(char *widget, int curses_key, int is_function, int dialog_key)
|
||||
{
|
||||
LIST_BINDINGS *entry = 0;
|
||||
DLG_KEYS_BINDING *data = 0;
|
||||
char *name;
|
||||
LIST_BINDINGS *p, *q;
|
||||
DLG_KEYS_BINDING *result = find_binding(widget, curses_key);
|
||||
|
||||
if (result == 0
|
||||
&& (entry = dlg_calloc(LIST_BINDINGS, 1)) != 0
|
||||
&& (data = dlg_calloc(DLG_KEYS_BINDING, 2)) != 0
|
||||
&& (name = dlg_strclone(widget)) != 0) {
|
||||
|
||||
entry->name = name;
|
||||
entry->binding = data;
|
||||
|
||||
data[0].is_function_key = is_function;
|
||||
data[0].curses_key = curses_key;
|
||||
data[0].dialog_key = dialog_key;
|
||||
|
||||
data[1] = end_keys_binding;
|
||||
|
||||
for (p = all_bindings, q = 0; p != 0; q = p, p = p->link) {
|
||||
if (compare_bindings(entry, p) < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (q != 0) {
|
||||
q->link = entry;
|
||||
} else {
|
||||
all_bindings = entry;
|
||||
}
|
||||
if (p != 0) {
|
||||
entry->link = p;
|
||||
}
|
||||
result = data;
|
||||
} else if (entry != 0) {
|
||||
free(entry);
|
||||
if (data)
|
||||
free(data);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the parameters of the "bindkeys" configuration-file entry. This
|
||||
* expects widget name which may be "*", followed by curses key definition and
|
||||
* then dialog key definition.
|
||||
*
|
||||
* The curses key "should" be one of the names (ignoring case) from
|
||||
* curses_names[], but may also be a single control character (prefix "^" or
|
||||
* "~" depending on whether it is C0 or C1), or an escaped single character.
|
||||
* Binding a printable character with dialog is possible but not useful.
|
||||
*
|
||||
* The dialog key must be one of the names from dialog_names[].
|
||||
*/
|
||||
int
|
||||
dlg_parse_bindkey(char *params)
|
||||
{
|
||||
char *p = skip_white(params);
|
||||
char *q;
|
||||
bool escaped = FALSE;
|
||||
int modified = 0;
|
||||
int result = FALSE;
|
||||
unsigned xx;
|
||||
char *widget;
|
||||
int is_function = FALSE;
|
||||
int curses_key;
|
||||
int dialog_key;
|
||||
|
||||
curses_key = -1;
|
||||
dialog_key = -1;
|
||||
widget = p;
|
||||
|
||||
p = skip_black(p);
|
||||
if (p != widget && *p != '\0') {
|
||||
*p++ = '\0';
|
||||
q = p;
|
||||
while (*p != '\0' && curses_key < 0) {
|
||||
if (escaped) {
|
||||
escaped = FALSE;
|
||||
curses_key = *p;
|
||||
} else if (*p == '\\') {
|
||||
escaped = TRUE;
|
||||
} else if (modified) {
|
||||
if (*p == '?') {
|
||||
curses_key = ((modified == '^')
|
||||
? 127
|
||||
: 255);
|
||||
} else {
|
||||
curses_key = ((modified == '^')
|
||||
? (*p & 0x1f)
|
||||
: ((*p & 0x1f) | 0x80));
|
||||
}
|
||||
} else if (*p == '^') {
|
||||
modified = *p;
|
||||
} else if (*p == '~') {
|
||||
modified = *p;
|
||||
} else if (isspace(UCH(*p))) {
|
||||
break;
|
||||
}
|
||||
++p;
|
||||
}
|
||||
if (!isspace(UCH(*p))) {
|
||||
;
|
||||
} else {
|
||||
*p++ = '\0';
|
||||
if (curses_key < 0) {
|
||||
char fprefix[2];
|
||||
char check[2];
|
||||
int keynumber;
|
||||
if (sscanf(q, "%[Ff]%d%c", fprefix, &keynumber, check) == 2) {
|
||||
curses_key = KEY_F(keynumber);
|
||||
is_function = TRUE;
|
||||
} else {
|
||||
for (xx = 0; xx < COUNT_CURSES; ++xx) {
|
||||
if (!dlg_strcmp(curses_names[xx].name, q)) {
|
||||
curses_key = curses_names[xx].code;
|
||||
is_function = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
q = skip_white(p);
|
||||
p = skip_black(q);
|
||||
if (p != q) {
|
||||
for (xx = 0; xx < COUNT_DIALOG; ++xx) {
|
||||
if (!dlg_strcmp(dialog_names[xx].name, q)) {
|
||||
dialog_key = dialog_names[xx].code;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*widget != '\0'
|
||||
&& curses_key >= 0
|
||||
&& dialog_key >= 0
|
||||
&& make_binding(widget, curses_key, is_function, dialog_key) != 0) {
|
||||
result = TRUE;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
dump_curses_key(FILE *fp, int curses_key)
|
||||
{
|
||||
if (curses_key > KEY_MIN) {
|
||||
unsigned n;
|
||||
bool found = FALSE;
|
||||
for (n = 0; n < COUNT_CURSES; ++n) {
|
||||
if (curses_names[n].code == curses_key) {
|
||||
fprintf(fp, "%s", curses_names[n].name);
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (curses_key >= KEY_F(0)) {
|
||||
fprintf(fp, "F%d", curses_key - KEY_F(0));
|
||||
} else {
|
||||
fprintf(fp, "curses%d", curses_key);
|
||||
}
|
||||
}
|
||||
} else if (curses_key >= 0 && curses_key < 32) {
|
||||
fprintf(fp, "^%c", curses_key + 64);
|
||||
} else if (curses_key == 127) {
|
||||
fprintf(fp, "^?");
|
||||
} else if (curses_key >= 128 && curses_key < 160) {
|
||||
fprintf(fp, "~%c", curses_key - 64);
|
||||
} else if (curses_key == 255) {
|
||||
fprintf(fp, "~?");
|
||||
} else {
|
||||
fprintf(fp, "\\%c", curses_key);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dump_dialog_key(FILE *fp, int dialog_key)
|
||||
{
|
||||
unsigned n;
|
||||
bool found = FALSE;
|
||||
for (n = 0; n < COUNT_DIALOG; ++n) {
|
||||
if (dialog_names[n].code == dialog_key) {
|
||||
fputs(dialog_names[n].name, fp);
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
fprintf(fp, "dialog%d", dialog_key);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dump_one_binding(FILE *fp, const char *widget, DLG_KEYS_BINDING * binding)
|
||||
{
|
||||
fprintf(fp, "bindkey %s ", widget);
|
||||
dump_curses_key(fp, binding->curses_key);
|
||||
fputc(' ', fp);
|
||||
dump_dialog_key(fp, binding->dialog_key);
|
||||
fputc('\n', fp);
|
||||
}
|
||||
|
||||
void
|
||||
dlg_dump_keys(FILE *fp)
|
||||
{
|
||||
LIST_BINDINGS *p;
|
||||
const char *last = "";
|
||||
unsigned n;
|
||||
unsigned count = 0;
|
||||
|
||||
for (p = all_bindings; p != 0; p = p->link) {
|
||||
if (p->win == 0) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
if (count != 0) {
|
||||
for (p = all_bindings, n = 0; p != 0; p = p->link) {
|
||||
if (p->win == 0) {
|
||||
if (dlg_strcmp(last, p->name)) {
|
||||
fprintf(fp, "\n# key bindings for %s widgets\n",
|
||||
!strcmp(p->name, "*") ? "all" : p->name);
|
||||
last = p->name;
|
||||
}
|
||||
dump_one_binding(fp, p->name, p->binding);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_RC_FILE */
|
148
contrib/dialog/dlg_keys.h
Normal file
148
contrib/dialog/dlg_keys.h
Normal file
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* $Id: dlg_keys.h,v 1.24 2010/01/19 00:57:36 tom Exp $
|
||||
*
|
||||
* dlg_keys.h -- runtime binding support for dialog
|
||||
*
|
||||
* Copyright 2005-2007,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*/
|
||||
|
||||
#ifndef DLG_KEYS_H_included
|
||||
#define DLG_KEYS_H_included 1
|
||||
|
||||
#include <dialog.h>
|
||||
|
||||
#ifdef USE_WIDE_CURSES
|
||||
#include <wctype.h>
|
||||
#define dlg_toupper(ch) towupper((wint_t)ch)
|
||||
#define dlg_isupper(ch) iswupper((wint_t)ch)
|
||||
#else
|
||||
#define dlg_toupper(ch) toupper(ch)
|
||||
#define dlg_isupper(ch) (isalpha(ch) && isupper(ch))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int is_function_key;
|
||||
int curses_key;
|
||||
int dialog_key;
|
||||
} DLG_KEYS_BINDING;
|
||||
|
||||
#define DLG_KEYS_DATA(dialog, curses) { curses >= KEY_MIN, curses, dialog }
|
||||
|
||||
#define END_KEYS_BINDING { -1, 0, 0 }
|
||||
|
||||
/*
|
||||
* Define dialog's internal function-keys past the range used by curses.
|
||||
*/
|
||||
typedef enum {
|
||||
DLGK_MIN = KEY_MAX + 1,
|
||||
/* predefined buttons */
|
||||
DLGK_OK,
|
||||
DLGK_CANCEL,
|
||||
DLGK_EXTRA,
|
||||
DLGK_HELP,
|
||||
DLGK_ESC,
|
||||
/* moving from screen to screen (pages) */
|
||||
DLGK_PAGE_FIRST,
|
||||
DLGK_PAGE_LAST,
|
||||
DLGK_PAGE_NEXT,
|
||||
DLGK_PAGE_PREV,
|
||||
/* moving within a list */
|
||||
DLGK_ITEM_FIRST,
|
||||
DLGK_ITEM_LAST,
|
||||
DLGK_ITEM_NEXT,
|
||||
DLGK_ITEM_PREV,
|
||||
/* moving from field to field (or buttons) */
|
||||
DLGK_FIELD_FIRST,
|
||||
DLGK_FIELD_LAST,
|
||||
DLGK_FIELD_NEXT,
|
||||
DLGK_FIELD_PREV,
|
||||
/* moving within a grid */
|
||||
DLGK_GRID_UP,
|
||||
DLGK_GRID_DOWN,
|
||||
DLGK_GRID_LEFT,
|
||||
DLGK_GRID_RIGHT,
|
||||
/* delete */
|
||||
DLGK_DELETE_LEFT,
|
||||
DLGK_DELETE_RIGHT,
|
||||
DLGK_DELETE_ALL,
|
||||
/* special */
|
||||
DLGK_ENTER,
|
||||
DLGK_BEGIN,
|
||||
DLGK_FINAL,
|
||||
DLGK_SELECT,
|
||||
DLGK_TRACE
|
||||
} DLG_KEYS_ENUM;
|
||||
|
||||
#define is_DLGK_MOUSE(code) ((code) >= M_EVENT)
|
||||
#define DLGK_MOUSE(code) ((code) + M_EVENT)
|
||||
|
||||
#define ENTERKEY_BINDINGS \
|
||||
DLG_KEYS_DATA( DLGK_ENTER, '\n' ), \
|
||||
DLG_KEYS_DATA( DLGK_ENTER, '\r' ), \
|
||||
DLG_KEYS_DATA( DLGK_ENTER, KEY_ENTER )
|
||||
|
||||
/* ^U == 21 */
|
||||
#define INPUTSTR_BINDINGS \
|
||||
DLG_KEYS_DATA( DLGK_BEGIN, KEY_HOME ), \
|
||||
DLG_KEYS_DATA( DLGK_DELETE_ALL, CHR_KILL ), \
|
||||
DLG_KEYS_DATA( DLGK_DELETE_LEFT, CHR_BACKSPACE ), \
|
||||
DLG_KEYS_DATA( DLGK_DELETE_LEFT, KEY_BACKSPACE ), \
|
||||
DLG_KEYS_DATA( DLGK_DELETE_RIGHT, CHR_DELETE ), \
|
||||
DLG_KEYS_DATA( DLGK_DELETE_RIGHT, KEY_DC ), \
|
||||
DLG_KEYS_DATA( DLGK_FINAL, KEY_END ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_LEFT, KEY_LEFT ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_RIGHT, KEY_RIGHT )
|
||||
|
||||
#define SCROLLKEY_BINDINGS \
|
||||
DLG_KEYS_DATA( DLGK_GRID_DOWN, 'J' ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_DOWN, 'j' ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_DOWN, KEY_DOWN ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, 'K' ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, 'k' ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, KEY_UP ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_FIRST, 'g' ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_FIRST, KEY_HOME ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_LAST, 'G' ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_LAST, KEY_END ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, 'F' ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, 'f' ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, 'B' ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, 'b' ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE )
|
||||
|
||||
extern int dlg_lookup_key(WINDOW * /*win*/, int /*curses_key*/, int * /*dialog_key*/);
|
||||
extern int dlg_result_key(int /*dialog_key*/, int /*fkey*/, int * /*resultp*/);
|
||||
extern void dlg_register_buttons(WINDOW * /*win*/, const char * /*name*/, const char ** /*buttons*/);
|
||||
extern void dlg_register_window(WINDOW * /*win*/, const char * /*name*/, DLG_KEYS_BINDING * /*binding*/);
|
||||
extern void dlg_unregister_window(WINDOW * /*win*/);
|
||||
|
||||
#ifdef HAVE_RC_FILE
|
||||
extern int dlg_parse_bindkey(char * /*params*/);
|
||||
extern void dlg_dump_keys(FILE * /*fp*/);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DLG_KEYS_H_included */
|
719
contrib/dialog/editbox.c
Normal file
719
contrib/dialog/editbox.c
Normal file
@ -0,0 +1,719 @@
|
||||
/*
|
||||
* $Id: editbox.c,v 1.54 2010/04/28 21:02:01 tom Exp $
|
||||
*
|
||||
* editbox.c -- implements the edit box
|
||||
*
|
||||
* Copyright 2007-2009,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define sTEXT -1
|
||||
|
||||
static void
|
||||
fail_list(void)
|
||||
{
|
||||
dlg_exiterr("File too large");
|
||||
}
|
||||
|
||||
static void
|
||||
grow_list(char ***list, int *have, int want)
|
||||
{
|
||||
if (want > *have) {
|
||||
size_t last = (size_t) *have;
|
||||
size_t need = (size_t) (want | 31) + 3;
|
||||
*have = (int) need;
|
||||
(*list) = dlg_realloc(char *, need, *list);
|
||||
if ((*list) == 0) {
|
||||
fail_list();
|
||||
}
|
||||
while (++last < need) {
|
||||
(*list)[last] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
load_list(const char *file, char ***list, int *rows)
|
||||
{
|
||||
FILE *fp;
|
||||
char *blob = 0;
|
||||
struct stat sb;
|
||||
unsigned n, pass;
|
||||
unsigned need;
|
||||
size_t size;
|
||||
|
||||
*list = 0;
|
||||
*rows = 0;
|
||||
|
||||
if (stat(file, &sb) < 0 ||
|
||||
(sb.st_mode & S_IFMT) != S_IFREG)
|
||||
dlg_exiterr("Not a file: %s", file);
|
||||
|
||||
size = (size_t) sb.st_size;
|
||||
if ((blob = dlg_malloc(char, size + 1)) == 0)
|
||||
fail_list();
|
||||
blob[size] = '\0';
|
||||
|
||||
if ((fp = fopen(file, "r")) == 0)
|
||||
dlg_exiterr("Cannot open: %s", file);
|
||||
size = fread(blob, sizeof(char), size, fp);
|
||||
fclose(fp);
|
||||
|
||||
for (pass = 0; pass < 2; ++pass) {
|
||||
int first = TRUE;
|
||||
need = 0;
|
||||
for (n = 0; n < size; ++n) {
|
||||
if (first && pass) {
|
||||
(*list)[need] = blob + n;
|
||||
first = FALSE;
|
||||
}
|
||||
if (blob[n] == '\n') {
|
||||
first = TRUE;
|
||||
++need;
|
||||
if (pass)
|
||||
blob[n] = '\0';
|
||||
}
|
||||
}
|
||||
if (pass) {
|
||||
if (need == 0) {
|
||||
(*list)[0] = dlg_strclone("");
|
||||
(*list)[1] = 0;
|
||||
} else {
|
||||
for (n = 0; n < need; ++n) {
|
||||
(*list)[n] = dlg_strclone((*list)[n]);
|
||||
}
|
||||
(*list)[need] = 0;
|
||||
}
|
||||
} else {
|
||||
grow_list(list, rows, (int) need + 1);
|
||||
}
|
||||
}
|
||||
free(blob);
|
||||
}
|
||||
|
||||
static void
|
||||
free_list(char ***list, int *rows)
|
||||
{
|
||||
if (*list != 0) {
|
||||
int n;
|
||||
for (n = 0; n < (*rows); ++n) {
|
||||
if ((*list)[n] != 0)
|
||||
free((*list)[n]);
|
||||
}
|
||||
free(*list);
|
||||
*list = 0;
|
||||
}
|
||||
*rows = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a single row in the editing window:
|
||||
* thisrow is the actual row number that's being displayed.
|
||||
* show_row is the row number that's highlighted for edit.
|
||||
* base_row is the first row number in the window
|
||||
*/
|
||||
static bool
|
||||
display_one(WINDOW *win,
|
||||
char *text,
|
||||
int thisrow,
|
||||
int show_row,
|
||||
int base_row,
|
||||
int chr_offset)
|
||||
{
|
||||
bool result;
|
||||
|
||||
if (text != 0) {
|
||||
dlg_show_string(win,
|
||||
text,
|
||||
chr_offset,
|
||||
((thisrow == show_row)
|
||||
? form_active_text_attr
|
||||
: form_text_attr),
|
||||
thisrow - base_row,
|
||||
0,
|
||||
getmaxx(win),
|
||||
FALSE,
|
||||
FALSE);
|
||||
result = TRUE;
|
||||
} else {
|
||||
result = FALSE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
display_all(WINDOW *win,
|
||||
char **list,
|
||||
int show_row,
|
||||
int firstrow,
|
||||
int lastrow,
|
||||
int chr_offset)
|
||||
{
|
||||
int limit = getmaxy(win);
|
||||
int row;
|
||||
|
||||
dlg_attr_clear(win, getmaxy(win), getmaxx(win), dialog_attr);
|
||||
if (lastrow - firstrow >= limit)
|
||||
lastrow = firstrow + limit;
|
||||
for (row = firstrow; row < lastrow; ++row) {
|
||||
if (!display_one(win, list[row],
|
||||
row, show_row, firstrow,
|
||||
(row == show_row) ? chr_offset : 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
size_list(char **list)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
if (list != 0) {
|
||||
while (*list++ != 0) {
|
||||
++result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool
|
||||
scroll_to(int pagesize, int rows, int *base_row, int *this_row, int target)
|
||||
{
|
||||
bool result = FALSE;
|
||||
|
||||
if (target < *base_row) {
|
||||
if (target < 0) {
|
||||
if (*base_row == 0 && *this_row == 0) {
|
||||
beep();
|
||||
} else {
|
||||
*this_row = 0;
|
||||
*base_row = 0;
|
||||
result = TRUE;
|
||||
}
|
||||
} else {
|
||||
*this_row = target;
|
||||
*base_row = target;
|
||||
result = TRUE;
|
||||
}
|
||||
} else if (target >= rows) {
|
||||
if (*this_row < rows - 1) {
|
||||
*this_row = rows - 1;
|
||||
*base_row = rows - 1;
|
||||
result = TRUE;
|
||||
} else {
|
||||
beep();
|
||||
}
|
||||
} else if (target >= *base_row + pagesize) {
|
||||
*this_row = target;
|
||||
*base_row = target;
|
||||
result = TRUE;
|
||||
} else {
|
||||
*this_row = target;
|
||||
result = FALSE;
|
||||
}
|
||||
if (pagesize < rows) {
|
||||
if (*base_row + pagesize >= rows) {
|
||||
*base_row = rows - pagesize;
|
||||
}
|
||||
} else {
|
||||
*base_row = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
col_to_chr_offset(const char *text, int col)
|
||||
{
|
||||
const int *cols = dlg_index_columns(text);
|
||||
const int *indx = dlg_index_wchars(text);
|
||||
bool found = FALSE;
|
||||
int result = 0;
|
||||
unsigned n;
|
||||
unsigned len = (unsigned) dlg_count_wchars(text);
|
||||
|
||||
for (n = 0; n < len; ++n) {
|
||||
if (cols[n] <= col && cols[n + 1] > col) {
|
||||
result = indx[n];
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found && len && cols[len] == col) {
|
||||
result = indx[len];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#define SCROLL_TO(target) show_all = scroll_to(pagesize, listsize, &base_row, &thisrow, target)
|
||||
|
||||
#define PREV_ROW (*list)[thisrow - 1]
|
||||
#define THIS_ROW (*list)[thisrow]
|
||||
#define NEXT_ROW (*list)[thisrow + 1]
|
||||
|
||||
#define UPDATE_COL(input) col_offset = dlg_edit_offset(input, chr_offset, box_width)
|
||||
|
||||
static int
|
||||
widest_line(char **list)
|
||||
{
|
||||
int result = MAX_LEN;
|
||||
char *value;
|
||||
|
||||
if (list != 0) {
|
||||
while ((value = *list++) != 0) {
|
||||
int check = (int) strlen(value);
|
||||
if (check > result)
|
||||
result = check;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#define NAVIGATE_BINDINGS \
|
||||
DLG_KEYS_DATA( DLGK_GRID_DOWN, KEY_DOWN ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_RIGHT, KEY_RIGHT ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_LEFT, KEY_LEFT ), \
|
||||
DLG_KEYS_DATA( DLGK_GRID_UP, KEY_UP ), \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ), \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_FIRST, KEY_HOME ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_LAST, KEY_END ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_LAST, KEY_LL ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, DLGK_MOUSE(KEY_NPAGE) ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, DLGK_MOUSE(KEY_PPAGE) )
|
||||
/*
|
||||
* Display a dialog box for editing a copy of a file
|
||||
*/
|
||||
int
|
||||
dlg_editbox(const char *title,
|
||||
char ***list,
|
||||
int *rows,
|
||||
int height,
|
||||
int width)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
static DLG_KEYS_BINDING binding[] = {
|
||||
ENTERKEY_BINDINGS,
|
||||
NAVIGATE_BINDINGS,
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
static DLG_KEYS_BINDING binding2[] = {
|
||||
INPUTSTR_BINDINGS,
|
||||
ENTERKEY_BINDINGS,
|
||||
NAVIGATE_BINDINGS,
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
#endif
|
||||
int x, y, box_y, box_x, box_height, box_width;
|
||||
int show_buttons;
|
||||
int thisrow, base_row, lastrow;
|
||||
int goal_col = -1;
|
||||
int col_offset = 0;
|
||||
int chr_offset = 0;
|
||||
int key, fkey, code;
|
||||
int pagesize;
|
||||
int listsize = size_list(*list);
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int state;
|
||||
size_t max_len = (size_t) dlg_max_input(widest_line(*list));
|
||||
char *input, *buffer;
|
||||
bool show_all, show_one, was_mouse;
|
||||
WINDOW *dialog;
|
||||
WINDOW *editing;
|
||||
DIALOG_VARS save_vars;
|
||||
const char **buttons = dlg_ok_labels();
|
||||
int mincols = (3 * COLS / 4);
|
||||
|
||||
dlg_save_vars(&save_vars);
|
||||
dialog_vars.separate_output = TRUE;
|
||||
|
||||
dlg_does_output();
|
||||
|
||||
buffer = dlg_malloc(char, max_len + 1);
|
||||
assert_ptr(buffer, "dlg_editbox");
|
||||
|
||||
thisrow = base_row = lastrow = 0;
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
retry:
|
||||
#endif
|
||||
show_buttons = TRUE;
|
||||
state = dialog_vars.defaultno ? dlg_defaultno_button() : sTEXT;
|
||||
key = fkey = 0;
|
||||
|
||||
dlg_button_layout(buttons, &mincols);
|
||||
dlg_auto_size(title, "", &height, &width, 3 * LINES / 4, mincols);
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
dlg_register_window(dialog, "editbox", binding);
|
||||
dlg_register_buttons(dialog, "editbox", buttons);
|
||||
|
||||
dlg_mouse_setbase(x, y);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
|
||||
/* Draw the editing field in a box */
|
||||
box_y = MARGIN + 0;
|
||||
box_x = MARGIN + 1;
|
||||
box_width = width - 2 - (2 * MARGIN);
|
||||
box_height = height - (4 * MARGIN);
|
||||
|
||||
dlg_draw_box(dialog,
|
||||
box_y,
|
||||
box_x,
|
||||
box_height,
|
||||
box_width,
|
||||
border_attr, dialog_attr);
|
||||
dlg_mouse_mkbigregion(box_y + MARGIN,
|
||||
box_x + MARGIN,
|
||||
box_height - (2 * MARGIN),
|
||||
box_width - (2 * MARGIN),
|
||||
KEY_MAX, 1, 1, 3);
|
||||
editing = dlg_sub_window(dialog,
|
||||
box_height - (2 * MARGIN),
|
||||
box_width - (2 * MARGIN),
|
||||
getbegy(dialog) + box_y + 1,
|
||||
getbegx(dialog) + box_x + 1);
|
||||
dlg_register_window(editing, "editbox", binding2);
|
||||
|
||||
show_all = TRUE;
|
||||
show_one = FALSE;
|
||||
pagesize = getmaxy(editing);
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
int edit = 0;
|
||||
|
||||
if (show_all) {
|
||||
display_all(editing, *list, thisrow, base_row, listsize, chr_offset);
|
||||
display_one(editing, THIS_ROW,
|
||||
thisrow, thisrow, base_row, chr_offset);
|
||||
show_all = FALSE;
|
||||
show_one = TRUE;
|
||||
} else {
|
||||
if (thisrow != lastrow) {
|
||||
display_one(editing, (*list)[lastrow],
|
||||
lastrow, thisrow, base_row, 0);
|
||||
show_one = TRUE;
|
||||
}
|
||||
}
|
||||
if (show_one) {
|
||||
display_one(editing, THIS_ROW,
|
||||
thisrow, thisrow, base_row, chr_offset);
|
||||
getyx(editing, y, x);
|
||||
dlg_draw_scrollbar(dialog,
|
||||
base_row,
|
||||
base_row,
|
||||
base_row + pagesize,
|
||||
listsize,
|
||||
box_x,
|
||||
box_x + getmaxx(editing),
|
||||
box_y + 0,
|
||||
box_y + getmaxy(editing) + 1,
|
||||
dialog_attr,
|
||||
border_attr);
|
||||
wmove(editing, y, x);
|
||||
show_one = FALSE;
|
||||
}
|
||||
lastrow = thisrow;
|
||||
input = THIS_ROW;
|
||||
|
||||
/*
|
||||
* The last field drawn determines where the cursor is shown:
|
||||
*/
|
||||
if (show_buttons) {
|
||||
show_buttons = FALSE;
|
||||
UPDATE_COL(input);
|
||||
if (state != sTEXT) {
|
||||
display_one(editing, input, thisrow,
|
||||
-1, base_row, 0);
|
||||
wrefresh(editing);
|
||||
}
|
||||
dlg_draw_buttons(dialog,
|
||||
height - 2,
|
||||
0,
|
||||
buttons,
|
||||
(state != sTEXT) ? state : 99,
|
||||
FALSE,
|
||||
width);
|
||||
if (state == sTEXT) {
|
||||
display_one(editing, input, thisrow,
|
||||
thisrow, base_row, chr_offset);
|
||||
}
|
||||
}
|
||||
|
||||
key = dlg_mouse_wgetch((state == sTEXT) ? editing : dialog, &fkey);
|
||||
if (key == ERR) {
|
||||
result = DLG_EXIT_ERROR;
|
||||
break;
|
||||
} else if (key == ESC) {
|
||||
result = DLG_EXIT_ESC;
|
||||
break;
|
||||
}
|
||||
if (state != sTEXT) {
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
break;
|
||||
}
|
||||
|
||||
was_mouse = (fkey && is_DLGK_MOUSE(key));
|
||||
if (was_mouse)
|
||||
key -= M_EVENT;
|
||||
|
||||
/*
|
||||
* Handle mouse clicks first, since we want to know if this is a
|
||||
* button, or something that dlg_edit_string() should handle.
|
||||
*/
|
||||
if (fkey
|
||||
&& was_mouse
|
||||
&& (code = dlg_ok_buttoncode(key)) >= 0) {
|
||||
result = code;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (was_mouse
|
||||
&& (key >= KEY_MAX)) {
|
||||
int wide = getmaxx(editing);
|
||||
int cell = key - KEY_MAX;
|
||||
thisrow = (cell / wide) + base_row;
|
||||
col_offset = (cell % wide);
|
||||
chr_offset = col_to_chr_offset(THIS_ROW, col_offset);
|
||||
show_one = TRUE;
|
||||
if (state != sTEXT) {
|
||||
state = sTEXT;
|
||||
show_buttons = TRUE;
|
||||
}
|
||||
continue;
|
||||
} else if (was_mouse && key >= KEY_MIN) {
|
||||
key = dlg_lookup_key(dialog, key, &fkey);
|
||||
}
|
||||
|
||||
if (state == sTEXT) { /* editing box selected */
|
||||
/*
|
||||
* Intercept scrolling keys that dlg_edit_string() does not
|
||||
* understand.
|
||||
*/
|
||||
if (fkey) {
|
||||
bool moved = TRUE;
|
||||
|
||||
switch (key) {
|
||||
case DLGK_GRID_UP:
|
||||
SCROLL_TO(thisrow - 1);
|
||||
break;
|
||||
case DLGK_GRID_DOWN:
|
||||
SCROLL_TO(thisrow + 1);
|
||||
break;
|
||||
case DLGK_PAGE_FIRST:
|
||||
SCROLL_TO(0);
|
||||
break;
|
||||
case DLGK_PAGE_LAST:
|
||||
SCROLL_TO(listsize);
|
||||
break;
|
||||
case DLGK_PAGE_NEXT:
|
||||
SCROLL_TO(base_row + pagesize);
|
||||
break;
|
||||
case DLGK_PAGE_PREV:
|
||||
if (thisrow > base_row) {
|
||||
SCROLL_TO(base_row);
|
||||
} else {
|
||||
SCROLL_TO(base_row - pagesize);
|
||||
}
|
||||
break;
|
||||
case DLGK_DELETE_LEFT:
|
||||
if (chr_offset == 0) {
|
||||
if (thisrow == 0) {
|
||||
beep();
|
||||
} else {
|
||||
size_t len = (strlen(THIS_ROW) +
|
||||
strlen(PREV_ROW) + 1);
|
||||
char *tmp = dlg_malloc(char, len);
|
||||
|
||||
assert_ptr(tmp, "dlg_editbox");
|
||||
|
||||
chr_offset = dlg_count_wchars(PREV_ROW);
|
||||
UPDATE_COL(PREV_ROW);
|
||||
goal_col = col_offset;
|
||||
|
||||
sprintf(tmp, "%s%s", PREV_ROW, THIS_ROW);
|
||||
if (len > max_len)
|
||||
tmp[max_len] = '\0';
|
||||
|
||||
free(PREV_ROW);
|
||||
PREV_ROW = tmp;
|
||||
for (y = thisrow; y < listsize; ++y) {
|
||||
(*list)[y] = (*list)[y + 1];
|
||||
}
|
||||
--listsize;
|
||||
--thisrow;
|
||||
SCROLL_TO(thisrow);
|
||||
|
||||
show_all = TRUE;
|
||||
}
|
||||
} else {
|
||||
/* dlg_edit_string() can handle this case */
|
||||
moved = FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
moved = FALSE;
|
||||
break;
|
||||
}
|
||||
if (moved) {
|
||||
if (thisrow != lastrow) {
|
||||
if (goal_col < 0)
|
||||
goal_col = col_offset;
|
||||
chr_offset = col_to_chr_offset(THIS_ROW, goal_col);
|
||||
} else {
|
||||
UPDATE_COL(THIS_ROW);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
strncpy(buffer, input, max_len - 1)[max_len - 1] = '\0';
|
||||
edit = dlg_edit_string(buffer, &chr_offset, key, fkey, FALSE);
|
||||
|
||||
if (edit) {
|
||||
goal_col = UPDATE_COL(input);
|
||||
if (strcmp(input, buffer)) {
|
||||
free(input);
|
||||
THIS_ROW = dlg_strclone(buffer);
|
||||
input = THIS_ROW;
|
||||
}
|
||||
display_one(editing, input, thisrow,
|
||||
thisrow, base_row, chr_offset);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle non-functionkeys */
|
||||
if (!fkey && (code = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
dlg_del_window(dialog);
|
||||
result = dlg_ok_buttoncode(code);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* handle functionkeys */
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case DLGK_FIELD_PREV:
|
||||
show_buttons = TRUE;
|
||||
state = dlg_prev_ok_buttonindex(state, sTEXT);
|
||||
break;
|
||||
case DLGK_FIELD_NEXT:
|
||||
show_buttons = TRUE;
|
||||
state = dlg_next_ok_buttonindex(state, sTEXT);
|
||||
break;
|
||||
case DLGK_ENTER:
|
||||
if (state == sTEXT) {
|
||||
const int *indx = dlg_index_wchars(THIS_ROW);
|
||||
int split = indx[chr_offset];
|
||||
char *tmp = dlg_strclone(THIS_ROW + split);
|
||||
|
||||
assert_ptr(tmp, "dlg_editbox");
|
||||
grow_list(list, rows, listsize + 1);
|
||||
++listsize;
|
||||
for (y = listsize; y > thisrow; --y) {
|
||||
(*list)[y] = (*list)[y - 1];
|
||||
}
|
||||
THIS_ROW[split] = '\0';
|
||||
++thisrow;
|
||||
chr_offset = 0;
|
||||
col_offset = 0;
|
||||
THIS_ROW = tmp;
|
||||
SCROLL_TO(thisrow);
|
||||
show_all = TRUE;
|
||||
} else {
|
||||
result = dlg_ok_buttoncode(state);
|
||||
}
|
||||
break;
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
/* reset data */
|
||||
height = old_height;
|
||||
width = old_width;
|
||||
/* repaint */
|
||||
dlg_clear();
|
||||
dlg_del_window(editing);
|
||||
dlg_del_window(dialog);
|
||||
refresh();
|
||||
dlg_mouse_free_regions();
|
||||
goto retry;
|
||||
#endif
|
||||
default:
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if ((key == ' ') && (state != sTEXT)) {
|
||||
result = dlg_ok_buttoncode(state);
|
||||
} else {
|
||||
beep();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dlg_unregister_window(editing);
|
||||
dlg_del_window(editing);
|
||||
dlg_del_window(dialog);
|
||||
dlg_mouse_free_regions();
|
||||
|
||||
/*
|
||||
* The caller's copy of the (*list)[] array has been updated, but for
|
||||
* consistency with the other widgets, we put the "real" result in
|
||||
* the output buffer.
|
||||
*/
|
||||
if (result == DLG_EXIT_OK) {
|
||||
int n;
|
||||
for (n = 0; n < listsize; ++n) {
|
||||
dlg_add_result((*list)[n]);
|
||||
dlg_add_separator();
|
||||
}
|
||||
}
|
||||
free(buffer);
|
||||
dlg_restore_vars(&save_vars);
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
dialog_editbox(const char *title, const char *file, int height, int width)
|
||||
{
|
||||
int result;
|
||||
char **list;
|
||||
int rows;
|
||||
|
||||
load_list(file, &list, &rows);
|
||||
result = dlg_editbox(title, &list, &rows, height, width);
|
||||
free_list(&list, &rows);
|
||||
return result;
|
||||
}
|
902
contrib/dialog/formbox.c
Normal file
902
contrib/dialog/formbox.c
Normal file
@ -0,0 +1,902 @@
|
||||
/*
|
||||
* $Id: formbox.c,v 1.71 2010/02/24 10:45:57 Samuel.Martin.Moro Exp $
|
||||
*
|
||||
* formbox.c -- implements the form (i.e, some pairs label/editbox)
|
||||
*
|
||||
* Copyright 2003-2009,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*
|
||||
* This is adapted from source contributed by
|
||||
* Valery Reznic (valery_reznic@users.sourceforge.net)
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#define LLEN(n) ((n) * FORMBOX_TAGS)
|
||||
|
||||
#define ItemName(i) items[LLEN(i) + 0]
|
||||
#define ItemNameY(i) items[LLEN(i) + 1]
|
||||
#define ItemNameX(i) items[LLEN(i) + 2]
|
||||
#define ItemText(i) items[LLEN(i) + 3]
|
||||
#define ItemTextY(i) items[LLEN(i) + 4]
|
||||
#define ItemTextX(i) items[LLEN(i) + 5]
|
||||
#define ItemTextFLen(i) items[LLEN(i) + 6]
|
||||
#define ItemTextILen(i) items[LLEN(i) + 7]
|
||||
#define ItemHelp(i) (dialog_vars.item_help ? items[LLEN(i) + 8] : dlg_strempty())
|
||||
|
||||
static bool
|
||||
is_readonly(DIALOG_FORMITEM * item)
|
||||
{
|
||||
return ((item->type & 2) != 0) || (item->text_flen <= 0);
|
||||
}
|
||||
|
||||
static bool
|
||||
is_hidden(DIALOG_FORMITEM * item)
|
||||
{
|
||||
return ((item->type & 1) != 0);
|
||||
}
|
||||
|
||||
static bool
|
||||
in_window(WINDOW *win, int scrollamt, int y)
|
||||
{
|
||||
return (y >= scrollamt && y - scrollamt < getmaxy(win));
|
||||
}
|
||||
|
||||
static bool
|
||||
ok_move(WINDOW *win, int scrollamt, int y, int x)
|
||||
{
|
||||
return in_window(win, scrollamt, y)
|
||||
&& (wmove(win, y - scrollamt, x) != ERR);
|
||||
}
|
||||
|
||||
static void
|
||||
move_past(WINDOW *win, int y, int x)
|
||||
{
|
||||
if (wmove(win, y, x) == ERR)
|
||||
wmove(win, y, getmaxx(win) - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print form item
|
||||
*/
|
||||
static int
|
||||
print_item(WINDOW *win, DIALOG_FORMITEM * item, int scrollamt, bool choice)
|
||||
{
|
||||
int count = 0;
|
||||
int len;
|
||||
|
||||
if (ok_move(win, scrollamt, item->name_y, item->name_x)) {
|
||||
len = item->name_len;
|
||||
len = MIN(len, getmaxx(win) - item->name_x);
|
||||
if (len > 0) {
|
||||
dlg_show_string(win,
|
||||
item->name,
|
||||
0,
|
||||
menubox_attr,
|
||||
item->name_y - scrollamt,
|
||||
item->name_x,
|
||||
len,
|
||||
FALSE,
|
||||
FALSE);
|
||||
move_past(win, item->name_y - scrollamt, item->name_x + len);
|
||||
count = 1;
|
||||
}
|
||||
}
|
||||
if (item->text_len && ok_move(win, scrollamt, item->text_y, item->text_x)) {
|
||||
chtype this_item_attribute;
|
||||
|
||||
len = item->text_len;
|
||||
len = MIN(len, getmaxx(win) - item->text_x);
|
||||
|
||||
if (!is_readonly(item)) {
|
||||
this_item_attribute = choice
|
||||
? form_active_text_attr
|
||||
: form_text_attr;
|
||||
} else {
|
||||
this_item_attribute = form_item_readonly_attr;
|
||||
}
|
||||
|
||||
if (len > 0) {
|
||||
dlg_show_string(win,
|
||||
item->text,
|
||||
0,
|
||||
this_item_attribute,
|
||||
item->text_y - scrollamt,
|
||||
item->text_x,
|
||||
len,
|
||||
is_hidden(item),
|
||||
FALSE);
|
||||
move_past(win, item->text_y - scrollamt, item->text_x + len);
|
||||
count = 1;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the entire form.
|
||||
*/
|
||||
static void
|
||||
print_form(WINDOW *win, DIALOG_FORMITEM * item, int total, int scrollamt, int choice)
|
||||
{
|
||||
int n;
|
||||
int count = 0;
|
||||
|
||||
for (n = 0; n < total; ++n) {
|
||||
count += print_item(win, item + n, scrollamt, n == choice);
|
||||
}
|
||||
if (count) {
|
||||
wbkgdset(win, menubox_attr | ' ');
|
||||
wclrtobot(win);
|
||||
(void) wnoutrefresh(win);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
set_choice(DIALOG_FORMITEM item[], int choice, int item_no, bool * noneditable)
|
||||
{
|
||||
int result = -1;
|
||||
int i;
|
||||
|
||||
*noneditable = FALSE;
|
||||
if (!is_readonly(&item[choice])) {
|
||||
result = choice;
|
||||
} else {
|
||||
for (i = 0; i < item_no; i++) {
|
||||
if (!is_readonly(&(item[i]))) {
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (result < 0) {
|
||||
*noneditable = TRUE;
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the last y-value in the form.
|
||||
*/
|
||||
static int
|
||||
form_limit(DIALOG_FORMITEM item[])
|
||||
{
|
||||
int n;
|
||||
int limit = 0;
|
||||
for (n = 0; item[n].name != 0; ++n) {
|
||||
if (limit < item[n].name_y)
|
||||
limit = item[n].name_y;
|
||||
if (limit < item[n].text_y)
|
||||
limit = item[n].text_y;
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tab to the next field.
|
||||
*/
|
||||
static bool
|
||||
tab_next(WINDOW *win,
|
||||
DIALOG_FORMITEM item[],
|
||||
int item_no,
|
||||
int stepsize,
|
||||
int *choice,
|
||||
int *scrollamt)
|
||||
{
|
||||
int old_choice = *choice;
|
||||
int old_scroll = *scrollamt;
|
||||
bool wrapped = FALSE;
|
||||
|
||||
do {
|
||||
do {
|
||||
*choice += stepsize;
|
||||
if (*choice < 0) {
|
||||
*choice = item_no - 1;
|
||||
wrapped = TRUE;
|
||||
} else if (*choice >= item_no) {
|
||||
*choice = 0;
|
||||
wrapped = TRUE;
|
||||
}
|
||||
} while ((*choice != old_choice) && is_readonly(&(item[*choice])));
|
||||
|
||||
if (item[*choice].text_flen > 0) {
|
||||
int lo = MIN(item[*choice].name_y, item[*choice].text_y);
|
||||
int hi = MAX(item[*choice].name_y, item[*choice].text_y);
|
||||
|
||||
if (old_choice == *choice)
|
||||
break;
|
||||
print_item(win, item + old_choice, *scrollamt, FALSE);
|
||||
|
||||
if (*scrollamt < lo + 1 - getmaxy(win))
|
||||
*scrollamt = lo + 1 - getmaxy(win);
|
||||
if (*scrollamt > hi)
|
||||
*scrollamt = hi;
|
||||
/*
|
||||
* If we have to scroll to show a wrap-around, it does get
|
||||
* confusing. Just give up rather than scroll. Tab'ing to the
|
||||
* next field in a multi-column form is a different matter. Scroll
|
||||
* for that.
|
||||
*/
|
||||
if (*scrollamt != old_scroll) {
|
||||
if (wrapped) {
|
||||
beep();
|
||||
*scrollamt = old_scroll;
|
||||
*choice = old_choice;
|
||||
} else {
|
||||
scrollok(win, TRUE);
|
||||
wscrl(win, *scrollamt - old_scroll);
|
||||
scrollok(win, FALSE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while (*choice != old_choice);
|
||||
|
||||
return (old_choice != *choice) || (old_scroll != *scrollamt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Scroll to the next page, putting the choice at the first editable field
|
||||
* in that page. Note that fields are not necessarily in top-to-bottom order,
|
||||
* nor is there necessarily a field on each row of the window.
|
||||
*/
|
||||
static bool
|
||||
scroll_next(WINDOW *win, DIALOG_FORMITEM item[], int stepsize, int *choice, int *scrollamt)
|
||||
{
|
||||
int old_choice = *choice;
|
||||
int old_scroll = *scrollamt;
|
||||
int old_row = MIN(item[old_choice].text_y, item[old_choice].name_y);
|
||||
int target = old_scroll + stepsize;
|
||||
int n;
|
||||
|
||||
if (stepsize < 0) {
|
||||
if (old_row != old_scroll)
|
||||
target = old_scroll;
|
||||
else
|
||||
target = old_scroll + stepsize;
|
||||
if (target < 0)
|
||||
target = 0;
|
||||
} else {
|
||||
int limit = form_limit(item);
|
||||
if (target > limit)
|
||||
target = limit;
|
||||
}
|
||||
|
||||
for (n = 0; item[n].name != 0; ++n) {
|
||||
if (item[n].text_flen > 0) {
|
||||
int new_row = MIN(item[n].text_y, item[n].name_y);
|
||||
if (abs(new_row - target) < abs(old_row - target)) {
|
||||
old_row = new_row;
|
||||
*choice = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (old_choice != *choice)
|
||||
print_item(win, item + old_choice, *scrollamt, FALSE);
|
||||
|
||||
*scrollamt = *choice;
|
||||
if (*scrollamt != old_scroll) {
|
||||
scrollok(win, TRUE);
|
||||
wscrl(win, *scrollamt - old_scroll);
|
||||
scrollok(win, FALSE);
|
||||
}
|
||||
return (old_choice != *choice) || (old_scroll != *scrollamt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Do a sanity check on the field length, and return the "right" value.
|
||||
*/
|
||||
static int
|
||||
real_length(DIALOG_FORMITEM * item)
|
||||
{
|
||||
return (item->text_flen > 0
|
||||
? item->text_flen
|
||||
: (item->text_flen < 0
|
||||
? -item->text_flen
|
||||
: item->text_len));
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the form size, setup field buffers.
|
||||
*/
|
||||
static void
|
||||
make_FORM_ELTs(DIALOG_FORMITEM * item,
|
||||
int item_no,
|
||||
int *min_height,
|
||||
int *min_width)
|
||||
{
|
||||
int i;
|
||||
int min_w = 0;
|
||||
int min_h = 0;
|
||||
|
||||
for (i = 0; i < item_no; ++i) {
|
||||
int real_len = real_length(item + i);
|
||||
|
||||
/*
|
||||
* Special value '0' for text_flen: no input allowed
|
||||
* Special value '0' for text_ilen: 'be the same as text_flen'
|
||||
*/
|
||||
if (item[i].text_ilen == 0)
|
||||
item[i].text_ilen = real_len;
|
||||
|
||||
min_h = MAX(min_h, item[i].name_y + 1);
|
||||
min_h = MAX(min_h, item[i].text_y + 1);
|
||||
min_w = MAX(min_w, item[i].name_x + 1 + item[i].name_len);
|
||||
min_w = MAX(min_w, item[i].text_x + 1 + real_len);
|
||||
|
||||
item[i].text_len = real_length(item + i);
|
||||
|
||||
/*
|
||||
* We do not know the actual length of .text, so we allocate it here
|
||||
* to ensure it is big enough.
|
||||
*/
|
||||
if (item[i].text_flen > 0) {
|
||||
int max_len = dlg_max_input(MAX(item[i].text_ilen + 1, MAX_LEN));
|
||||
char *old_text = item[i].text;
|
||||
|
||||
item[i].text = dlg_malloc(char, (size_t) max_len + 1);
|
||||
assert_ptr(item[i].text, "make_FORM_ELTs");
|
||||
|
||||
sprintf(item[i].text, "%.*s", item[i].text_ilen, old_text);
|
||||
|
||||
if (item[i].text_free) {
|
||||
item[i].text_free = FALSE;
|
||||
free(old_text);
|
||||
}
|
||||
item[i].text_free = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
*min_height = min_h;
|
||||
*min_width = min_w;
|
||||
}
|
||||
|
||||
int
|
||||
dlg_default_formitem(DIALOG_FORMITEM * items)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
if (dialog_vars.default_item != 0) {
|
||||
int count = 0;
|
||||
while (items->name != 0) {
|
||||
if (!strcmp(dialog_vars.default_item, items->name)) {
|
||||
result = count;
|
||||
break;
|
||||
}
|
||||
++items;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#define sTEXT -1
|
||||
|
||||
static int
|
||||
next_valid_buttonindex(int state, int extra, bool non_editable)
|
||||
{
|
||||
state = dlg_next_ok_buttonindex(state, extra);
|
||||
while (non_editable && state == sTEXT)
|
||||
state = dlg_next_ok_buttonindex(state, sTEXT);
|
||||
return state;
|
||||
}
|
||||
|
||||
static int
|
||||
prev_valid_buttonindex(int state, int extra, bool non_editable)
|
||||
{
|
||||
state = dlg_prev_ok_buttonindex(state, extra);
|
||||
while (non_editable && state == sTEXT)
|
||||
state = dlg_prev_ok_buttonindex(state, sTEXT);
|
||||
return state;
|
||||
}
|
||||
|
||||
#define NAVIGATE_BINDINGS \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ), \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ), \
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, CHR_NEXT ), \
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, KEY_DOWN ), \
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, KEY_NEXT ), \
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, CHR_PREVIOUS ), \
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, KEY_PREVIOUS ), \
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, KEY_UP ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE )
|
||||
/*
|
||||
* Display a form for fulfill a number of fields
|
||||
*/
|
||||
int
|
||||
dlg_form(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int form_height,
|
||||
int item_no,
|
||||
DIALOG_FORMITEM * items,
|
||||
int *current_item)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
static DLG_KEYS_BINDING binding[] = {
|
||||
ENTERKEY_BINDINGS,
|
||||
NAVIGATE_BINDINGS,
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
static DLG_KEYS_BINDING binding2[] = {
|
||||
INPUTSTR_BINDINGS,
|
||||
ENTERKEY_BINDINGS,
|
||||
NAVIGATE_BINDINGS,
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
#endif
|
||||
|
||||
int form_width;
|
||||
int first = TRUE;
|
||||
int chr_offset = 0;
|
||||
int state = dialog_vars.defaultno ? dlg_defaultno_button() : sTEXT;
|
||||
int x, y, cur_x, cur_y, box_x, box_y;
|
||||
int code;
|
||||
int key = 0;
|
||||
int fkey;
|
||||
int choice = dlg_default_formitem(items);
|
||||
int new_choice, new_scroll;
|
||||
int scrollamt = 0;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int min_width = 0, min_height = 0;
|
||||
bool was_autosize = (height == 0 || width == 0);
|
||||
bool show_buttons = FALSE;
|
||||
bool scroll_changed = FALSE;
|
||||
bool field_changed = FALSE;
|
||||
bool non_editable = FALSE;
|
||||
WINDOW *dialog, *form;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_labels();
|
||||
DIALOG_FORMITEM *current;
|
||||
|
||||
make_FORM_ELTs(items, item_no, &min_height, &min_width);
|
||||
dlg_button_layout(buttons, &min_width);
|
||||
dlg_does_output();
|
||||
dlg_tab_correct_str(prompt);
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
retry:
|
||||
#endif
|
||||
|
||||
dlg_auto_size(title, prompt, &height, &width,
|
||||
1 + 3 * MARGIN,
|
||||
MAX(26, 2 + min_width));
|
||||
|
||||
if (form_height == 0)
|
||||
form_height = min_height;
|
||||
|
||||
if (was_autosize) {
|
||||
form_height = MIN(SLINES - height, form_height);
|
||||
height += form_height;
|
||||
} else {
|
||||
int thigh = 0;
|
||||
int twide = 0;
|
||||
dlg_auto_size(title, prompt, &thigh, &twide, 0, width);
|
||||
thigh = SLINES - (height - (thigh + 1 + 3 * MARGIN));
|
||||
form_height = MIN(thigh, form_height);
|
||||
}
|
||||
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
dlg_register_window(dialog, "formbox", binding);
|
||||
dlg_register_window(dialog, "formfield", binding2);
|
||||
dlg_register_buttons(dialog, "formbox", buttons);
|
||||
|
||||
dlg_mouse_setbase(x, y);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
form_width = width - 6;
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
box_y = cur_y + 1;
|
||||
box_x = (width - form_width) / 2 - 1;
|
||||
|
||||
/* create new window for the form */
|
||||
form = dlg_sub_window(dialog, form_height, form_width, y + box_y + 1,
|
||||
x + box_x + 1);
|
||||
|
||||
/* draw a box around the form items */
|
||||
dlg_draw_box(dialog, box_y, box_x, form_height + 2, form_width + 2,
|
||||
menubox_border_attr, menubox_attr);
|
||||
|
||||
/* register the new window, along with its borders */
|
||||
dlg_mouse_mkbigregion(getbegy(form) - getbegy(dialog),
|
||||
getbegx(form) - getbegx(dialog),
|
||||
getmaxy(form),
|
||||
getmaxx(form),
|
||||
KEY_MAX, 1, 1, 3 /* by cells */ );
|
||||
|
||||
show_buttons = TRUE;
|
||||
scroll_changed = TRUE;
|
||||
|
||||
choice = set_choice(items, choice, item_no, &non_editable);
|
||||
current = &items[choice];
|
||||
if (non_editable)
|
||||
state = next_valid_buttonindex(state, sTEXT, non_editable);
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
int edit = FALSE;
|
||||
|
||||
if (scroll_changed) {
|
||||
print_form(form, items, item_no, scrollamt, choice);
|
||||
dlg_draw_scrollbar(dialog,
|
||||
scrollamt,
|
||||
scrollamt,
|
||||
scrollamt + form_height + 1,
|
||||
min_height,
|
||||
box_x + 1,
|
||||
box_x + form_width,
|
||||
box_y,
|
||||
box_y + form_height + 1,
|
||||
menubox_attr,
|
||||
menubox_border_attr);
|
||||
scroll_changed = FALSE;
|
||||
}
|
||||
|
||||
if (show_buttons) {
|
||||
dlg_item_help("");
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons,
|
||||
((state < 0)
|
||||
? 1000 /* no such button, not highlighted */
|
||||
: state),
|
||||
FALSE, width);
|
||||
show_buttons = FALSE;
|
||||
}
|
||||
|
||||
if (field_changed || state == sTEXT) {
|
||||
if (field_changed)
|
||||
chr_offset = 0;
|
||||
current = &items[choice];
|
||||
dialog_vars.max_input = current->text_ilen;
|
||||
dlg_item_help(current->help);
|
||||
dlg_show_string(form, current->text, chr_offset,
|
||||
form_active_text_attr,
|
||||
current->text_y - scrollamt,
|
||||
current->text_x,
|
||||
current->text_len,
|
||||
is_hidden(current), first);
|
||||
field_changed = FALSE;
|
||||
}
|
||||
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
break;
|
||||
|
||||
/* handle non-functionkeys */
|
||||
if (!fkey) {
|
||||
if (state != sTEXT) {
|
||||
code = dlg_char_to_button(key, buttons);
|
||||
if (code >= 0) {
|
||||
dlg_del_window(dialog);
|
||||
result = dlg_ok_buttoncode(code);
|
||||
continue;
|
||||
}
|
||||
if (key == ' ') {
|
||||
fkey = TRUE;
|
||||
key = DLGK_ENTER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* handle functionkeys */
|
||||
if (fkey) {
|
||||
bool do_scroll = FALSE;
|
||||
bool do_tab = FALSE;
|
||||
int move_by = 0;
|
||||
|
||||
switch (key) {
|
||||
case DLGK_MOUSE(KEY_PPAGE):
|
||||
case DLGK_PAGE_PREV:
|
||||
do_scroll = TRUE;
|
||||
move_by = -form_height;
|
||||
break;
|
||||
|
||||
case DLGK_MOUSE(KEY_NPAGE):
|
||||
case DLGK_PAGE_NEXT:
|
||||
do_scroll = TRUE;
|
||||
move_by = form_height;
|
||||
break;
|
||||
|
||||
case DLGK_ENTER:
|
||||
dlg_del_window(dialog);
|
||||
result = (state >= 0) ? dlg_ok_buttoncode(state) : DLG_EXIT_OK;
|
||||
continue;
|
||||
|
||||
case DLGK_GRID_LEFT:
|
||||
if (state == sTEXT)
|
||||
break;
|
||||
/* FALLTHRU */
|
||||
case DLGK_ITEM_PREV:
|
||||
if (state == sTEXT) {
|
||||
do_tab = TRUE;
|
||||
move_by = -1;
|
||||
break;
|
||||
} else {
|
||||
state = prev_valid_buttonindex(state, 0, non_editable);
|
||||
show_buttons = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
case DLGK_FIELD_PREV:
|
||||
state = prev_valid_buttonindex(state, sTEXT, non_editable);
|
||||
show_buttons = TRUE;
|
||||
continue;
|
||||
|
||||
case DLGK_FIELD_NEXT:
|
||||
state = next_valid_buttonindex(state, sTEXT, non_editable);
|
||||
show_buttons = TRUE;
|
||||
continue;
|
||||
|
||||
case DLGK_GRID_RIGHT:
|
||||
if (state == sTEXT)
|
||||
break;
|
||||
/* FALLTHRU */
|
||||
|
||||
case DLGK_ITEM_NEXT:
|
||||
if (state == sTEXT) {
|
||||
do_tab = TRUE;
|
||||
move_by = 1;
|
||||
break;
|
||||
} else {
|
||||
state = next_valid_buttonindex(state, 0, non_editable);
|
||||
show_buttons = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
/* reset data */
|
||||
height = old_height;
|
||||
width = old_width;
|
||||
/* repaint */
|
||||
dlg_clear();
|
||||
dlg_del_window(dialog);
|
||||
refresh();
|
||||
dlg_mouse_free_regions();
|
||||
goto retry;
|
||||
#endif
|
||||
default:
|
||||
#if USE_MOUSE
|
||||
if (is_DLGK_MOUSE(key)) {
|
||||
if (key >= DLGK_MOUSE(KEY_MAX)) {
|
||||
int cell = key - DLGK_MOUSE(KEY_MAX);
|
||||
int row = (cell / getmaxx(form)) + scrollamt;
|
||||
int col = (cell % getmaxx(form));
|
||||
int n;
|
||||
|
||||
for (n = 0; n < item_no; ++n) {
|
||||
if (items[n].name_y == row
|
||||
&& items[n].name_x <= col
|
||||
&& (items[n].name_x + items[n].name_len > col
|
||||
|| (items[n].name_y == items[n].text_y
|
||||
&& items[n].text_x > col))) {
|
||||
if (!is_readonly(&(items[n]))) {
|
||||
field_changed = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (items[n].text_y == row
|
||||
&& items[n].text_x <= col
|
||||
&& items[n].text_x + items[n].text_ilen > col) {
|
||||
if (!is_readonly(&(items[n]))) {
|
||||
field_changed = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (field_changed) {
|
||||
print_item(form, items + choice, scrollamt, FALSE);
|
||||
choice = n;
|
||||
continue;
|
||||
}
|
||||
beep();
|
||||
} else if ((code = dlg_ok_buttoncode(key - M_EVENT)) >= 0) {
|
||||
result = code;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
new_scroll = scrollamt;
|
||||
new_choice = choice;
|
||||
if (do_scroll) {
|
||||
if (scroll_next(form, items, move_by, &new_choice, &new_scroll)) {
|
||||
if (choice != new_choice) {
|
||||
choice = new_choice;
|
||||
field_changed = TRUE;
|
||||
}
|
||||
if (scrollamt != new_scroll) {
|
||||
scrollamt = new_scroll;
|
||||
scroll_changed = TRUE;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (do_tab) {
|
||||
if (tab_next(form, items, item_no, move_by, &new_choice, &new_scroll)) {
|
||||
if (choice != new_choice) {
|
||||
choice = new_choice;
|
||||
field_changed = TRUE;
|
||||
}
|
||||
if (scrollamt != new_scroll) {
|
||||
scrollamt = new_scroll;
|
||||
scroll_changed = TRUE;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (state == sTEXT) { /* Input box selected */
|
||||
if (!is_readonly(current))
|
||||
edit = dlg_edit_string(current->text, &chr_offset, key,
|
||||
fkey, first);
|
||||
if (edit) {
|
||||
dlg_show_string(form, current->text, chr_offset,
|
||||
form_active_text_attr,
|
||||
current->text_y - scrollamt,
|
||||
current->text_x,
|
||||
current->text_len,
|
||||
is_hidden(current), first);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dlg_mouse_free_regions();
|
||||
dlg_del_window(dialog);
|
||||
free(prompt);
|
||||
|
||||
*current_item = choice;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free memory owned by a list of DIALOG_FORMITEM's.
|
||||
*/
|
||||
void
|
||||
dlg_free_formitems(DIALOG_FORMITEM * items)
|
||||
{
|
||||
int n;
|
||||
for (n = 0; items[n].name != 0; ++n) {
|
||||
if (items[n].name_free)
|
||||
free(items[n].name);
|
||||
if (items[n].text_free)
|
||||
free(items[n].text);
|
||||
if (items[n].help_free && items[n].help != dlg_strempty())
|
||||
free(items[n].help);
|
||||
}
|
||||
free(items);
|
||||
}
|
||||
|
||||
/*
|
||||
* The script accepts values beginning at 1, while curses starts at 0.
|
||||
*/
|
||||
int
|
||||
dlg_ordinate(const char *s)
|
||||
{
|
||||
int result = atoi(s);
|
||||
if (result > 0)
|
||||
--result;
|
||||
else
|
||||
result = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
dialog_form(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int form_height,
|
||||
int item_no,
|
||||
char **items)
|
||||
{
|
||||
int result;
|
||||
int choice;
|
||||
int i;
|
||||
DIALOG_FORMITEM *listitems;
|
||||
DIALOG_VARS save_vars;
|
||||
bool show_status = FALSE;
|
||||
|
||||
dlg_save_vars(&save_vars);
|
||||
dialog_vars.separate_output = TRUE;
|
||||
|
||||
listitems = dlg_calloc(DIALOG_FORMITEM, (size_t) item_no + 1);
|
||||
assert_ptr(listitems, "dialog_form");
|
||||
|
||||
for (i = 0; i < item_no; ++i) {
|
||||
listitems[i].type = dialog_vars.formitem_type;
|
||||
listitems[i].name = ItemName(i);
|
||||
listitems[i].name_len = (int) strlen(ItemName(i));
|
||||
listitems[i].name_y = dlg_ordinate(ItemNameY(i));
|
||||
listitems[i].name_x = dlg_ordinate(ItemNameX(i));
|
||||
listitems[i].text = ItemText(i);
|
||||
listitems[i].text_len = (int) strlen(ItemText(i));
|
||||
listitems[i].text_y = dlg_ordinate(ItemTextY(i));
|
||||
listitems[i].text_x = dlg_ordinate(ItemTextX(i));
|
||||
listitems[i].text_flen = atoi(ItemTextFLen(i));
|
||||
listitems[i].text_ilen = atoi(ItemTextILen(i));
|
||||
listitems[i].help = ((dialog_vars.item_help)
|
||||
? ItemHelp(i)
|
||||
: dlg_strempty());
|
||||
}
|
||||
|
||||
result = dlg_form(title,
|
||||
cprompt,
|
||||
height,
|
||||
width,
|
||||
form_height,
|
||||
item_no,
|
||||
listitems,
|
||||
&choice);
|
||||
|
||||
switch (result) {
|
||||
case DLG_EXIT_OK: /* FALLTHRU */
|
||||
case DLG_EXIT_EXTRA:
|
||||
show_status = TRUE;
|
||||
break;
|
||||
case DLG_EXIT_HELP:
|
||||
dlg_add_result("HELP ");
|
||||
show_status = dialog_vars.help_status;
|
||||
if (USE_ITEM_HELP(listitems[choice].help)) {
|
||||
dlg_add_string(listitems[choice].help);
|
||||
result = DLG_EXIT_ITEM_HELP;
|
||||
} else {
|
||||
dlg_add_string(listitems[choice].name);
|
||||
}
|
||||
if (show_status)
|
||||
dlg_add_separator();
|
||||
break;
|
||||
}
|
||||
if (show_status) {
|
||||
for (i = 0; i < item_no; i++) {
|
||||
if (listitems[i].text_flen > 0) {
|
||||
dlg_add_string(listitems[i].text);
|
||||
dlg_add_separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dlg_free_formitems(listitems);
|
||||
dlg_restore_vars(&save_vars);
|
||||
|
||||
return result;
|
||||
}
|
882
contrib/dialog/fselect.c
Normal file
882
contrib/dialog/fselect.c
Normal file
@ -0,0 +1,882 @@
|
||||
/*
|
||||
* $Id: fselect.c,v 1.74 2010/04/28 20:45:40 tom Exp $
|
||||
*
|
||||
* fselect.c -- implements the file-selector box
|
||||
*
|
||||
* Copyright 2000-2009,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
# define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
#else
|
||||
# define dirent direct
|
||||
# define NAMLEN(dirent) (dirent)->d_namlen
|
||||
# if HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif
|
||||
# if HAVE_SYS_DIR_H
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# if HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# if defined(_FILE_OFFSET_BITS) && defined(HAVE_STRUCT_DIRENT64)
|
||||
# if !defined(_LP64) && (_FILE_OFFSET_BITS == 64)
|
||||
# define DIRENT struct dirent64
|
||||
# else
|
||||
# define DIRENT struct dirent
|
||||
# endif
|
||||
# else
|
||||
# define DIRENT struct dirent
|
||||
# endif
|
||||
|
||||
#define EXT_WIDE 1
|
||||
#define HDR_HIGH 1
|
||||
#define BTN_HIGH (1 + 2 * MARGIN) /* Ok/Cancel, also input-box */
|
||||
#define MIN_HIGH (HDR_HIGH - MARGIN + (BTN_HIGH * 2) + 4 * MARGIN)
|
||||
#define MIN_WIDE (2 * MAX(dlg_count_columns(d_label), dlg_count_columns(f_label)) + 6 * MARGIN + 2 * EXT_WIDE)
|
||||
|
||||
#define MOUSE_D (KEY_MAX + 0)
|
||||
#define MOUSE_F (KEY_MAX + 10000)
|
||||
#define MOUSE_T (KEY_MAX + 20000)
|
||||
|
||||
typedef enum {
|
||||
sDIRS = -3
|
||||
,sFILES = -2
|
||||
,sTEXT = -1
|
||||
} STATES;
|
||||
|
||||
typedef struct {
|
||||
WINDOW *par; /* parent window */
|
||||
WINDOW *win; /* this window */
|
||||
int length; /* length of the data[] array */
|
||||
int offset; /* index of first item on screen */
|
||||
int choice; /* index of the selection */
|
||||
int mousex; /* base of mouse-code return-values */
|
||||
unsigned allocd;
|
||||
char **data;
|
||||
} LIST;
|
||||
|
||||
typedef struct {
|
||||
int length;
|
||||
char **data;
|
||||
} MATCH;
|
||||
|
||||
static void
|
||||
init_list(LIST * list, WINDOW *par, WINDOW *win, int mousex)
|
||||
{
|
||||
list->par = par;
|
||||
list->win = win;
|
||||
list->length = 0;
|
||||
list->offset = 0;
|
||||
list->choice = 0;
|
||||
list->mousex = mousex;
|
||||
list->allocd = 0;
|
||||
list->data = 0;
|
||||
dlg_mouse_mkbigregion(getbegy(win), getbegx(win),
|
||||
getmaxy(win), getmaxx(win),
|
||||
mousex, 1, 1, 1 /* by lines */ );
|
||||
}
|
||||
|
||||
static char *
|
||||
leaf_of(char *path)
|
||||
{
|
||||
char *leaf = strrchr(path, '/');
|
||||
if (leaf != 0)
|
||||
leaf++;
|
||||
else
|
||||
leaf = path;
|
||||
return leaf;
|
||||
}
|
||||
|
||||
static char *
|
||||
data_of(LIST * list)
|
||||
{
|
||||
if (list != 0
|
||||
&& list->data != 0)
|
||||
return list->data[list->choice];
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
free_list(LIST * list, int reinit)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (list->data != 0) {
|
||||
for (n = 0; list->data[n] != 0; n++)
|
||||
free(list->data[n]);
|
||||
free(list->data);
|
||||
list->data = 0;
|
||||
}
|
||||
if (reinit)
|
||||
init_list(list, list->par, list->win, list->mousex);
|
||||
}
|
||||
|
||||
static void
|
||||
add_to_list(LIST * list, char *text)
|
||||
{
|
||||
unsigned need;
|
||||
|
||||
need = (unsigned) (list->length + 1);
|
||||
if (need + 1 > list->allocd) {
|
||||
list->allocd = 2 * (need + 1);
|
||||
if (list->data == 0) {
|
||||
list->data = dlg_malloc(char *, list->allocd);
|
||||
} else {
|
||||
list->data = dlg_realloc(char *, list->allocd, list->data);
|
||||
}
|
||||
assert_ptr(list->data, "add_to_list");
|
||||
}
|
||||
list->data[list->length++] = dlg_strclone(text);
|
||||
list->data[list->length] = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
keep_visible(LIST * list)
|
||||
{
|
||||
int high = getmaxy(list->win);
|
||||
|
||||
if (list->choice < list->offset) {
|
||||
list->offset = list->choice;
|
||||
}
|
||||
if (list->choice - list->offset >= high)
|
||||
list->offset = list->choice - high + 1;
|
||||
}
|
||||
|
||||
#define Value(c) (int)((c) & 0xff)
|
||||
|
||||
static int
|
||||
find_choice(char *target, LIST * list)
|
||||
{
|
||||
int n;
|
||||
int choice = list->choice;
|
||||
int len_1, len_2, cmp_1, cmp_2;
|
||||
|
||||
if (*target == 0) {
|
||||
list->choice = 0;
|
||||
} else {
|
||||
/* find the match with the longest length. If more than one has the
|
||||
* same length, choose the one with the closest match of the final
|
||||
* character.
|
||||
*/
|
||||
len_1 = 0;
|
||||
cmp_1 = 256;
|
||||
for (n = 0; n < list->length; n++) {
|
||||
char *a = target;
|
||||
char *b = list->data[n];
|
||||
|
||||
len_2 = 0;
|
||||
while ((*a != 0) && (*b != 0) && (*a == *b)) {
|
||||
a++;
|
||||
b++;
|
||||
len_2++;
|
||||
}
|
||||
cmp_2 = Value(*a) - Value(*b);
|
||||
if (cmp_2 < 0)
|
||||
cmp_2 = -cmp_2;
|
||||
if ((len_2 > len_1)
|
||||
|| (len_1 == len_2 && cmp_2 < cmp_1)) {
|
||||
len_1 = len_2;
|
||||
cmp_1 = cmp_2;
|
||||
list->choice = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (choice != list->choice) {
|
||||
keep_visible(list);
|
||||
}
|
||||
return (choice != list->choice);
|
||||
}
|
||||
|
||||
static void
|
||||
display_list(LIST * list)
|
||||
{
|
||||
int n;
|
||||
int x;
|
||||
int y;
|
||||
int top;
|
||||
int bottom;
|
||||
|
||||
if (list->win != 0) {
|
||||
dlg_attr_clear(list->win, getmaxy(list->win), getmaxx(list->win), item_attr);
|
||||
for (n = list->offset; n < list->length && list->data[n]; n++) {
|
||||
y = n - list->offset;
|
||||
if (y >= getmaxy(list->win))
|
||||
break;
|
||||
(void) wmove(list->win, y, 0);
|
||||
if (n == list->choice)
|
||||
wattrset(list->win, item_selected_attr);
|
||||
(void) waddstr(list->win, list->data[n]);
|
||||
wattrset(list->win, item_attr);
|
||||
}
|
||||
wattrset(list->win, item_attr);
|
||||
|
||||
getparyx(list->win, y, x);
|
||||
|
||||
top = y - 1;
|
||||
bottom = y + getmaxy(list->win);
|
||||
dlg_draw_scrollbar(list->par,
|
||||
list->offset,
|
||||
list->offset,
|
||||
list->offset + getmaxy(list->win),
|
||||
list->length,
|
||||
x + 1,
|
||||
x + getmaxx(list->win),
|
||||
top,
|
||||
bottom,
|
||||
menubox_attr,
|
||||
menubox_border_attr);
|
||||
|
||||
(void) wmove(list->win, list->choice - list->offset, 0);
|
||||
(void) wnoutrefresh(list->win);
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: see arrows.c
|
||||
* This workaround is used to allow two lists to have scroll-tabs at the same
|
||||
* time, by reassigning their return-values to be different. Just for
|
||||
* readability, we use the names of keys with similar connotations, though all
|
||||
* that is really required is that they're distinct, so we can put them in a
|
||||
* switch statement.
|
||||
*/
|
||||
static void
|
||||
fix_arrows(LIST * list)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int top;
|
||||
int bottom;
|
||||
|
||||
if (list->win != 0) {
|
||||
getparyx(list->win, y, x);
|
||||
top = y - 1;
|
||||
bottom = y + getmaxy(list->win);
|
||||
|
||||
mouse_mkbutton(top, x, 6,
|
||||
((list->mousex == MOUSE_D)
|
||||
? KEY_PREVIOUS
|
||||
: KEY_PPAGE));
|
||||
mouse_mkbutton(bottom, x, 6,
|
||||
((list->mousex == MOUSE_D)
|
||||
? KEY_NEXT
|
||||
: KEY_NPAGE));
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
show_list(char *target, LIST * list, bool keep)
|
||||
{
|
||||
int changed = keep || find_choice(target, list);
|
||||
display_list(list);
|
||||
return changed;
|
||||
}
|
||||
|
||||
/*
|
||||
* Highlight the closest match to 'target' in the given list, setting offset
|
||||
* to match.
|
||||
*/
|
||||
static int
|
||||
show_both_lists(char *input, LIST * d_list, LIST * f_list, bool keep)
|
||||
{
|
||||
char *leaf = leaf_of(input);
|
||||
|
||||
return show_list(leaf, d_list, keep) | show_list(leaf, f_list, keep);
|
||||
}
|
||||
|
||||
/*
|
||||
* Move up/down in the given list
|
||||
*/
|
||||
static bool
|
||||
change_list(int choice, LIST * list)
|
||||
{
|
||||
if (data_of(list) != 0) {
|
||||
int last = list->length - 1;
|
||||
|
||||
choice += list->choice;
|
||||
if (choice < 0)
|
||||
choice = 0;
|
||||
if (choice > last)
|
||||
choice = last;
|
||||
list->choice = choice;
|
||||
keep_visible(list);
|
||||
display_list(list);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
scroll_list(int direction, LIST * list)
|
||||
{
|
||||
if (data_of(list) != 0) {
|
||||
int length = getmaxy(list->win);
|
||||
if (change_list(direction * length, list))
|
||||
return;
|
||||
}
|
||||
beep();
|
||||
}
|
||||
|
||||
static int
|
||||
compar(const void *a, const void *b)
|
||||
{
|
||||
return strcmp(*(const char *const *) a, *(const char *const *) b);
|
||||
}
|
||||
|
||||
static void
|
||||
match(char *name, LIST * d_list, LIST * f_list, MATCH * match_list)
|
||||
{
|
||||
char *test = leaf_of(name);
|
||||
size_t test_len = strlen(test);
|
||||
char **matches = dlg_malloc(char *, (size_t) (d_list->length + f_list->length));
|
||||
size_t data_len = 0;
|
||||
int i;
|
||||
for (i = 2; i < d_list->length; i++) {
|
||||
if (strncmp(test, d_list->data[i], test_len) == 0) {
|
||||
matches[data_len++] = d_list->data[i];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < f_list->length; i++) {
|
||||
if (strncmp(test, f_list->data[i], test_len) == 0) {
|
||||
matches[data_len++] = f_list->data[i];
|
||||
}
|
||||
}
|
||||
matches = dlg_realloc(char *, data_len, matches);
|
||||
match_list->data = matches;
|
||||
match_list->length = (int) data_len;
|
||||
}
|
||||
|
||||
static void
|
||||
free_match(MATCH * match_list)
|
||||
{
|
||||
free(match_list->data);
|
||||
match_list->length = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
complete(char *name, LIST * d_list, LIST * f_list, char **buff_ptr)
|
||||
{
|
||||
MATCH match_list;
|
||||
char *test;
|
||||
size_t test_len;
|
||||
size_t i;
|
||||
int j;
|
||||
char *buff;
|
||||
|
||||
match(name, d_list, f_list, &match_list);
|
||||
if (match_list.length == 0) {
|
||||
*buff_ptr = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
test = match_list.data[0];
|
||||
test_len = strlen(test);
|
||||
buff = dlg_malloc(char, test_len + 2);
|
||||
if (match_list.length == 1) {
|
||||
strcpy(buff, test);
|
||||
i = test_len;
|
||||
if (test == data_of(d_list)) {
|
||||
buff[test_len] = '/';
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < test_len; i++) {
|
||||
char test_char = test[i];
|
||||
if (test_char == '\0')
|
||||
break;
|
||||
for (j = 0; j < match_list.length; j++) {
|
||||
if (match_list.data[j][i] != test_char) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == match_list.length) {
|
||||
(buff)[i] = test_char;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
buff = dlg_realloc(char, i + 1, buff);
|
||||
}
|
||||
free_match(&match_list);
|
||||
buff[i] = '\0';
|
||||
*buff_ptr = buff;
|
||||
return (i != 0);
|
||||
}
|
||||
|
||||
static bool
|
||||
fill_lists(char *current, char *input, LIST * d_list, LIST * f_list, bool keep)
|
||||
{
|
||||
DIR *dp;
|
||||
DIRENT *de;
|
||||
struct stat sb;
|
||||
int n;
|
||||
char path[MAX_LEN + 1];
|
||||
char *leaf;
|
||||
|
||||
/* check if we've updated the lists */
|
||||
for (n = 0; current[n] && input[n]; n++) {
|
||||
if (current[n] != input[n])
|
||||
break;
|
||||
}
|
||||
if (current[n] == input[n])
|
||||
return FALSE;
|
||||
if (strchr(current + n, '/') == 0
|
||||
&& strchr(input + n, '/') == 0) {
|
||||
return show_both_lists(input, d_list, f_list, keep);
|
||||
}
|
||||
|
||||
strcpy(current, input);
|
||||
|
||||
/* refill the lists */
|
||||
free_list(d_list, TRUE);
|
||||
free_list(f_list, TRUE);
|
||||
strcpy(path, current);
|
||||
if ((leaf = strrchr(path, '/')) != 0) {
|
||||
*++leaf = 0;
|
||||
} else {
|
||||
strcpy(path, "./");
|
||||
leaf = path + strlen(path);
|
||||
}
|
||||
if ((dp = opendir(path)) != 0) {
|
||||
while ((de = readdir(dp)) != 0) {
|
||||
strncpy(leaf, de->d_name, NAMLEN(de))[NAMLEN(de)] = 0;
|
||||
if (stat(path, &sb) == 0) {
|
||||
if ((sb.st_mode & S_IFMT) == S_IFDIR)
|
||||
add_to_list(d_list, leaf);
|
||||
else if (f_list->win)
|
||||
add_to_list(f_list, leaf);
|
||||
}
|
||||
}
|
||||
(void) closedir(dp);
|
||||
/* sort the lists */
|
||||
qsort(d_list->data,
|
||||
(size_t) d_list->length,
|
||||
sizeof(d_list->data[0]),
|
||||
compar);
|
||||
qsort(f_list->data,
|
||||
(size_t) f_list->length,
|
||||
sizeof(f_list->data[0]),
|
||||
compar);
|
||||
}
|
||||
|
||||
(void) show_both_lists(input, d_list, f_list, FALSE);
|
||||
d_list->offset = d_list->choice;
|
||||
f_list->offset = f_list->choice;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool
|
||||
usable_state(int state, LIST * dirs, LIST * files)
|
||||
{
|
||||
bool result;
|
||||
|
||||
switch (state) {
|
||||
case sDIRS:
|
||||
result = (dirs->win != 0) && (data_of(dirs) != 0);
|
||||
break;
|
||||
case sFILES:
|
||||
result = (files->win != 0) && (data_of(files) != 0);
|
||||
break;
|
||||
default:
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#define which_list() ((state == sFILES) \
|
||||
? &f_list \
|
||||
: ((state == sDIRS) \
|
||||
? &d_list \
|
||||
: 0))
|
||||
#define NAVIGATE_BINDINGS \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ), \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ), \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ), \
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, KEY_DOWN ), \
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, CHR_NEXT ), \
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, KEY_NEXT ), \
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, CHR_PREVIOUS ), \
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, KEY_UP ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ), \
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE )
|
||||
|
||||
/*
|
||||
* Display a dialog box for entering a filename
|
||||
*/
|
||||
static int
|
||||
dlg_fselect(const char *title, const char *path, int height, int width, bool dselect)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
static DLG_KEYS_BINDING binding[] = {
|
||||
ENTERKEY_BINDINGS,
|
||||
NAVIGATE_BINDINGS,
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
static DLG_KEYS_BINDING binding2[] = {
|
||||
INPUTSTR_BINDINGS,
|
||||
ENTERKEY_BINDINGS,
|
||||
NAVIGATE_BINDINGS,
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
bool resized = FALSE;
|
||||
#endif
|
||||
int tbox_y, tbox_x, tbox_width, tbox_height;
|
||||
int dbox_y, dbox_x, dbox_width, dbox_height;
|
||||
int fbox_y, fbox_x, fbox_width, fbox_height;
|
||||
int show_buttons = TRUE;
|
||||
int offset = 0;
|
||||
int key = 0;
|
||||
int fkey = FALSE;
|
||||
int code;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int state = dialog_vars.defaultno ? dlg_defaultno_button() : sTEXT;
|
||||
int button = state;
|
||||
int first = (state == sTEXT);
|
||||
char *input;
|
||||
char *completed;
|
||||
char current[MAX_LEN + 1];
|
||||
WINDOW *dialog = 0;
|
||||
WINDOW *w_text = 0;
|
||||
WINDOW *w_work = 0;
|
||||
const char **buttons = dlg_ok_labels();
|
||||
char *d_label = _("Directories");
|
||||
char *f_label = _("Files");
|
||||
char *partial;
|
||||
int min_wide = MIN_WIDE;
|
||||
int min_items = height ? 0 : 4;
|
||||
LIST d_list, f_list;
|
||||
|
||||
dlg_does_output();
|
||||
|
||||
/* Set up the initial value */
|
||||
input = dlg_set_result(path);
|
||||
offset = (int) strlen(input);
|
||||
*current = 0;
|
||||
|
||||
dlg_button_layout(buttons, &min_wide);
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
retry:
|
||||
#endif
|
||||
dlg_auto_size(title, (char *) 0, &height, &width, 6, 25);
|
||||
height += MIN_HIGH + min_items;
|
||||
if (width < min_wide)
|
||||
width = min_wide;
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
dialog = dlg_new_window(height, width,
|
||||
dlg_box_y_ordinate(height),
|
||||
dlg_box_x_ordinate(width));
|
||||
dlg_register_window(dialog, "fselect", binding);
|
||||
dlg_register_buttons(dialog, "fselect", buttons);
|
||||
|
||||
dlg_mouse_setbase(0, 0);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
|
||||
/* Draw the input field box */
|
||||
tbox_height = 1;
|
||||
tbox_width = width - (4 * MARGIN + 2);
|
||||
tbox_y = height - (BTN_HIGH * 2) + MARGIN;
|
||||
tbox_x = (width - tbox_width) / 2;
|
||||
|
||||
w_text = derwin(dialog, tbox_height, tbox_width, tbox_y, tbox_x);
|
||||
if (w_text == 0)
|
||||
return DLG_EXIT_ERROR;
|
||||
|
||||
(void) keypad(w_text, TRUE);
|
||||
dlg_draw_box(dialog, tbox_y - MARGIN, tbox_x - MARGIN,
|
||||
(2 * MARGIN + 1), tbox_width + (MARGIN + EXT_WIDE),
|
||||
menubox_border_attr, menubox_attr);
|
||||
dlg_mouse_mkbigregion(getbegy(dialog) + tbox_y - MARGIN,
|
||||
getbegx(dialog) + tbox_x - MARGIN,
|
||||
1 + (2 * MARGIN),
|
||||
tbox_width + (MARGIN + EXT_WIDE),
|
||||
MOUSE_T, 1, 1, 3 /* doesn't matter */ );
|
||||
|
||||
dlg_register_window(w_text, "fselect", binding2);
|
||||
|
||||
/* Draw the directory listing box */
|
||||
if (dselect)
|
||||
dbox_width = (width - (6 * MARGIN));
|
||||
else
|
||||
dbox_width = (width - (6 * MARGIN + 2 * EXT_WIDE)) / 2;
|
||||
dbox_height = height - MIN_HIGH;
|
||||
dbox_y = (2 * MARGIN + 1);
|
||||
dbox_x = tbox_x;
|
||||
|
||||
w_work = derwin(dialog, dbox_height, dbox_width, dbox_y, dbox_x);
|
||||
if (w_work == 0)
|
||||
return DLG_EXIT_ERROR;
|
||||
|
||||
(void) keypad(w_work, TRUE);
|
||||
(void) mvwprintw(dialog, dbox_y - (MARGIN + 1), dbox_x - MARGIN, d_label);
|
||||
dlg_draw_box(dialog,
|
||||
dbox_y - MARGIN, dbox_x - MARGIN,
|
||||
dbox_height + (MARGIN + 1), dbox_width + (MARGIN + 1),
|
||||
menubox_border_attr, menubox_attr);
|
||||
init_list(&d_list, dialog, w_work, MOUSE_D);
|
||||
|
||||
if (!dselect) {
|
||||
/* Draw the filename listing box */
|
||||
fbox_height = dbox_height;
|
||||
fbox_width = dbox_width;
|
||||
fbox_y = dbox_y;
|
||||
fbox_x = tbox_x + dbox_width + (2 * MARGIN);
|
||||
|
||||
w_work = derwin(dialog, fbox_height, fbox_width, fbox_y, fbox_x);
|
||||
if (w_work == 0)
|
||||
return DLG_EXIT_ERROR;
|
||||
|
||||
(void) keypad(w_work, TRUE);
|
||||
(void) mvwprintw(dialog, fbox_y - (MARGIN + 1), fbox_x - MARGIN, f_label);
|
||||
dlg_draw_box(dialog,
|
||||
fbox_y - MARGIN, fbox_x - MARGIN,
|
||||
fbox_height + (MARGIN + 1), fbox_width + (MARGIN + 1),
|
||||
menubox_border_attr, menubox_attr);
|
||||
init_list(&f_list, dialog, w_work, MOUSE_F);
|
||||
} else {
|
||||
memset(&f_list, 0, sizeof(f_list));
|
||||
}
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
|
||||
if (fill_lists(current, input, &d_list, &f_list, state < sTEXT))
|
||||
show_buttons = TRUE;
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
if (resized) {
|
||||
resized = FALSE;
|
||||
dlg_show_string(w_text, input, offset, inputbox_attr,
|
||||
0, 0, tbox_width, 0, first);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The last field drawn determines where the cursor is shown:
|
||||
*/
|
||||
if (show_buttons) {
|
||||
show_buttons = FALSE;
|
||||
button = (state < 0) ? 0 : state;
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
}
|
||||
if (state < 0) {
|
||||
switch (state) {
|
||||
case sTEXT:
|
||||
dlg_set_focus(dialog, w_text);
|
||||
break;
|
||||
case sFILES:
|
||||
dlg_set_focus(dialog, f_list.win);
|
||||
break;
|
||||
case sDIRS:
|
||||
dlg_set_focus(dialog, d_list.win);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (first) {
|
||||
(void) wrefresh(dialog);
|
||||
} else {
|
||||
fix_arrows(&d_list);
|
||||
fix_arrows(&f_list);
|
||||
key = dlg_mouse_wgetch((state == sTEXT) ? w_text : dialog, &fkey);
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
break;
|
||||
}
|
||||
|
||||
if (!fkey && key == ' ') {
|
||||
key = DLGK_SELECT;
|
||||
fkey = TRUE;
|
||||
}
|
||||
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case DLGK_MOUSE(KEY_PREVIOUS):
|
||||
state = sDIRS;
|
||||
scroll_list(-1, which_list());
|
||||
continue;
|
||||
case DLGK_MOUSE(KEY_NEXT):
|
||||
state = sDIRS;
|
||||
scroll_list(1, which_list());
|
||||
continue;
|
||||
case DLGK_MOUSE(KEY_PPAGE):
|
||||
state = sFILES;
|
||||
scroll_list(-1, which_list());
|
||||
continue;
|
||||
case DLGK_MOUSE(KEY_NPAGE):
|
||||
state = sFILES;
|
||||
scroll_list(1, which_list());
|
||||
continue;
|
||||
case DLGK_PAGE_PREV:
|
||||
scroll_list(-1, which_list());
|
||||
continue;
|
||||
case DLGK_PAGE_NEXT:
|
||||
scroll_list(1, which_list());
|
||||
continue;
|
||||
case DLGK_ITEM_PREV:
|
||||
if (change_list(-1, which_list()))
|
||||
continue;
|
||||
/* FALLTHRU */
|
||||
case DLGK_FIELD_PREV:
|
||||
show_buttons = TRUE;
|
||||
do {
|
||||
state = dlg_prev_ok_buttonindex(state, sDIRS);
|
||||
} while (!usable_state(state, &d_list, &f_list));
|
||||
continue;
|
||||
case DLGK_ITEM_NEXT:
|
||||
if (change_list(1, which_list()))
|
||||
continue;
|
||||
/* FALLTHRU */
|
||||
case DLGK_FIELD_NEXT:
|
||||
show_buttons = TRUE;
|
||||
do {
|
||||
state = dlg_next_ok_buttonindex(state, sDIRS);
|
||||
} while (!usable_state(state, &d_list, &f_list));
|
||||
continue;
|
||||
case DLGK_SELECT:
|
||||
completed = 0;
|
||||
partial = 0;
|
||||
if (state == sFILES && !dselect) {
|
||||
completed = data_of(&f_list);
|
||||
} else if (state == sDIRS) {
|
||||
completed = data_of(&d_list);
|
||||
} else {
|
||||
if (complete(input, &d_list, &f_list, &partial)) {
|
||||
completed = partial;
|
||||
}
|
||||
}
|
||||
if (completed != 0) {
|
||||
state = sTEXT;
|
||||
show_buttons = TRUE;
|
||||
strcpy(leaf_of(input), completed);
|
||||
offset = (int) strlen(input);
|
||||
dlg_show_string(w_text, input, offset, inputbox_attr,
|
||||
0, 0, tbox_width, 0, first);
|
||||
if (partial != NULL)
|
||||
free(partial);
|
||||
continue;
|
||||
} else { /* if (state < sTEXT) */
|
||||
(void) beep();
|
||||
continue;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case DLGK_ENTER:
|
||||
result = (state > 0) ? dlg_ok_buttoncode(state) : DLG_EXIT_OK;
|
||||
continue;
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
/* reset data */
|
||||
height = old_height;
|
||||
width = old_width;
|
||||
show_buttons = TRUE;
|
||||
*current = 0;
|
||||
resized = TRUE;
|
||||
/* repaint */
|
||||
dlg_clear();
|
||||
dlg_del_window(dialog);
|
||||
refresh();
|
||||
dlg_mouse_free_regions();
|
||||
goto retry;
|
||||
#endif
|
||||
default:
|
||||
if (key >= DLGK_MOUSE(MOUSE_T)) {
|
||||
state = sTEXT;
|
||||
continue;
|
||||
} else if (key >= DLGK_MOUSE(MOUSE_F)) {
|
||||
if (f_list.win != 0) {
|
||||
state = sFILES;
|
||||
f_list.choice = (key - DLGK_MOUSE(MOUSE_F)) + f_list.offset;
|
||||
display_list(&f_list);
|
||||
}
|
||||
continue;
|
||||
} else if (key >= DLGK_MOUSE(MOUSE_D)) {
|
||||
if (d_list.win != 0) {
|
||||
state = sDIRS;
|
||||
d_list.choice = (key - DLGK_MOUSE(MOUSE_D)) + d_list.offset;
|
||||
display_list(&d_list);
|
||||
}
|
||||
continue;
|
||||
} else if (is_DLGK_MOUSE(key)
|
||||
&& (code = dlg_ok_buttoncode(key - M_EVENT)) >= 0) {
|
||||
result = code;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (state < 0) { /* Input box selected if we're editing */
|
||||
int edit = dlg_edit_string(input, &offset, key, fkey, first);
|
||||
|
||||
if (edit) {
|
||||
dlg_show_string(w_text, input, offset, inputbox_attr,
|
||||
0, 0, tbox_width, 0, first);
|
||||
first = FALSE;
|
||||
state = sTEXT;
|
||||
}
|
||||
} else if (state >= 0 &&
|
||||
(code = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
result = dlg_ok_buttoncode(code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dlg_unregister_window(w_text);
|
||||
dlg_del_window(dialog);
|
||||
dlg_mouse_free_regions();
|
||||
free_list(&d_list, FALSE);
|
||||
free_list(&f_list, FALSE);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a dialog box for entering a filename
|
||||
*/
|
||||
int
|
||||
dialog_fselect(const char *title, const char *path, int height, int width)
|
||||
{
|
||||
return dlg_fselect(title, path, height, width, FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a dialog box for entering a directory
|
||||
*/
|
||||
int
|
||||
dialog_dselect(const char *title, const char *path, int height, int width)
|
||||
{
|
||||
return dlg_fselect(title, path, height, width, TRUE);
|
||||
}
|
300
contrib/dialog/guage.c
Normal file
300
contrib/dialog/guage.c
Normal file
@ -0,0 +1,300 @@
|
||||
/*
|
||||
* $Id: guage.c,v 1.45 2010/01/19 09:15:20 tom Exp $
|
||||
*
|
||||
* guage.c -- implements the gauge dialog
|
||||
*
|
||||
* Copyright 2000-2007,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*
|
||||
* An earlier version of this program lists as authors
|
||||
* Marc Ewing, Red Hat Software
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#define MY_LEN (MAX_LEN)/2
|
||||
|
||||
#define MIN_HIGH (4)
|
||||
#define MIN_WIDE (10 + 2 * (2 + MARGIN))
|
||||
|
||||
#define isMarker(buf) !strncmp(buf, "XXX", 3)
|
||||
|
||||
typedef struct {
|
||||
DIALOG_CALLBACK obj;
|
||||
WINDOW *text;
|
||||
bool done;
|
||||
const char *title;
|
||||
char *prompt;
|
||||
char prompt_buf[MY_LEN];
|
||||
int percent;
|
||||
int height;
|
||||
int width;
|
||||
char line[MAX_LEN + 1];
|
||||
} MY_OBJ;
|
||||
|
||||
static int
|
||||
read_data(char *buffer, FILE *fp)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (feof(fp)) {
|
||||
result = 0;
|
||||
} else if (fgets(buffer, MY_LEN, fp) != 0) {
|
||||
dlg_trim_string(buffer);
|
||||
result = 1;
|
||||
} else {
|
||||
result = -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
decode_percent(char *buffer)
|
||||
{
|
||||
char *tmp = 0;
|
||||
long value = strtol(buffer, &tmp, 10);
|
||||
|
||||
if (tmp != 0 && (*tmp == 0 || isspace(UCH(*tmp))) && value >= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
repaint_text(MY_OBJ * obj)
|
||||
{
|
||||
WINDOW *dialog = obj->obj.win;
|
||||
int i, x;
|
||||
|
||||
(void) werase(dialog);
|
||||
dlg_draw_box(dialog, 0, 0, obj->height, obj->width, dialog_attr, border_attr);
|
||||
|
||||
dlg_draw_title(dialog, obj->title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, obj->prompt, obj->height, obj->width);
|
||||
|
||||
dlg_draw_box(dialog,
|
||||
obj->height - 4, 2 + MARGIN,
|
||||
2 + MARGIN, obj->width - 2 * (2 + MARGIN),
|
||||
dialog_attr,
|
||||
border_attr);
|
||||
|
||||
/*
|
||||
* Clear the area for the progress bar by filling it with spaces
|
||||
* in the title-attribute, and write the percentage with that
|
||||
* attribute.
|
||||
*/
|
||||
(void) wmove(dialog, obj->height - 3, 4);
|
||||
wattrset(dialog, title_attr);
|
||||
|
||||
for (i = 0; i < (obj->width - 2 * (3 + MARGIN)); i++)
|
||||
(void) waddch(dialog, ' ');
|
||||
|
||||
(void) wmove(dialog, obj->height - 3, (obj->width / 2) - 2);
|
||||
(void) wprintw(dialog, "%3d%%", obj->percent);
|
||||
|
||||
/*
|
||||
* Now draw a bar in reverse, relative to the background.
|
||||
* The window attribute was useful for painting the background,
|
||||
* but requires some tweaks to reverse it.
|
||||
*/
|
||||
x = (obj->percent * (obj->width - 2 * (3 + MARGIN))) / 100;
|
||||
if ((title_attr & A_REVERSE) != 0) {
|
||||
wattroff(dialog, A_REVERSE);
|
||||
} else {
|
||||
wattrset(dialog, A_REVERSE);
|
||||
}
|
||||
(void) wmove(dialog, obj->height - 3, 4);
|
||||
for (i = 0; i < x; i++) {
|
||||
chtype ch2 = winch(dialog);
|
||||
if (title_attr & A_REVERSE) {
|
||||
ch2 &= ~A_REVERSE;
|
||||
}
|
||||
(void) waddch(dialog, ch2);
|
||||
}
|
||||
|
||||
(void) wrefresh(dialog);
|
||||
}
|
||||
|
||||
static int
|
||||
handle_input(MY_OBJ * obj)
|
||||
{
|
||||
int status;
|
||||
char buf[MY_LEN];
|
||||
|
||||
if ((status = read_data(buf, dialog_state.pipe_input)) > 0) {
|
||||
|
||||
if (isMarker(buf)) {
|
||||
/*
|
||||
* Historically, next line should be percentage, but one of the
|
||||
* worse-written clones of 'dialog' assumes the number is missing.
|
||||
* (Gresham's Law applied to software).
|
||||
*/
|
||||
if ((status = read_data(buf, dialog_state.pipe_input)) > 0) {
|
||||
|
||||
obj->prompt_buf[0] = '\0';
|
||||
if (decode_percent(buf))
|
||||
obj->percent = atoi(buf);
|
||||
else
|
||||
strcpy(obj->prompt_buf, buf);
|
||||
|
||||
/* Rest is message text */
|
||||
while ((status = read_data(buf, dialog_state.pipe_input)) > 0
|
||||
&& !isMarker(buf)) {
|
||||
if (strlen(obj->prompt_buf) + strlen(buf) <
|
||||
sizeof(obj->prompt_buf) - 1) {
|
||||
strcat(obj->prompt_buf, buf);
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->prompt != obj->prompt_buf)
|
||||
free(obj->prompt);
|
||||
obj->prompt = obj->prompt_buf;
|
||||
}
|
||||
} else if (decode_percent(buf)) {
|
||||
obj->percent = atoi(buf);
|
||||
}
|
||||
} else {
|
||||
obj->done = TRUE;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static bool
|
||||
handle_my_getc(DIALOG_CALLBACK * cb, int ch, int fkey, int *result)
|
||||
{
|
||||
MY_OBJ *obj = (MY_OBJ *) cb;
|
||||
int status = TRUE;
|
||||
|
||||
*result = DLG_EXIT_OK;
|
||||
if (obj != 0) {
|
||||
if (!fkey && (ch == ERR)) {
|
||||
if (handle_input(obj) > 0)
|
||||
repaint_text(obj);
|
||||
else
|
||||
status = FALSE;
|
||||
}
|
||||
} else {
|
||||
status = FALSE;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
static void
|
||||
my_cleanup(DIALOG_CALLBACK * cb)
|
||||
{
|
||||
MY_OBJ *obj = (MY_OBJ *) cb;
|
||||
|
||||
if (obj != 0) {
|
||||
if (obj->prompt != obj->prompt_buf)
|
||||
free(obj->prompt);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a gauge, or progress meter. Starts at percent% and reads stdin. If
|
||||
* stdin is not XXX, then it is interpreted as a percentage, and the display is
|
||||
* updated accordingly. Otherwise the next line is the percentage, and
|
||||
* subsequent lines up to another XXX are used for the new prompt. Note that
|
||||
* the size of the window never changes, so the prompt can not get any larger
|
||||
* than the height and width specified.
|
||||
*/
|
||||
int
|
||||
dialog_gauge(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int percent)
|
||||
{
|
||||
#ifdef KEY_RESIZE
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
#endif
|
||||
int fkey;
|
||||
int ch, result;
|
||||
int x, y;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
WINDOW *dialog;
|
||||
MY_OBJ *obj = 0;
|
||||
|
||||
curs_set(0);
|
||||
|
||||
dlg_tab_correct_str(prompt);
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
retry:
|
||||
#endif
|
||||
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, MIN_WIDE);
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
/* center dialog box on screen */
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
|
||||
if (obj == 0) {
|
||||
MY_OBJ **objref;
|
||||
|
||||
obj = dlg_calloc(MY_OBJ, 1);
|
||||
assert_ptr(obj, "dialog_gauge");
|
||||
|
||||
objref = &obj;
|
||||
obj->obj.input = dialog_state.pipe_input;
|
||||
obj->obj.win = dialog;
|
||||
obj->obj.keep_win = TRUE;
|
||||
obj->obj.bg_task = TRUE;
|
||||
obj->obj.handle_getc = handle_my_getc;
|
||||
obj->title = title;
|
||||
obj->prompt = prompt;
|
||||
obj->percent = percent;
|
||||
obj->height = height;
|
||||
obj->width = width;
|
||||
dlg_add_callback_ref((DIALOG_CALLBACK **) objref, my_cleanup);
|
||||
}
|
||||
|
||||
repaint_text(obj);
|
||||
|
||||
do {
|
||||
ch = dlg_getc(dialog, &fkey);
|
||||
#ifdef KEY_RESIZE
|
||||
if (fkey && ch == KEY_RESIZE) {
|
||||
/* reset data */
|
||||
height = old_height;
|
||||
width = old_width;
|
||||
/* repaint */
|
||||
dlg_clear();
|
||||
dlg_del_window(dialog);
|
||||
refresh();
|
||||
dlg_mouse_free_regions();
|
||||
goto retry;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
while (handle_my_getc(&(obj->obj), ch, fkey, &result));
|
||||
|
||||
curs_set(1);
|
||||
dlg_del_window(dialog);
|
||||
|
||||
return (DLG_EXIT_OK);
|
||||
}
|
150
contrib/dialog/headers-sh.in
Executable file
150
contrib/dialog/headers-sh.in
Executable file
@ -0,0 +1,150 @@
|
||||
#! /bin/sh
|
||||
# $Id: headers-sh.in,v 1.5 2007/07/05 00:20:18 tom Exp $
|
||||
##############################################################################
|
||||
# Copyright (c) 2004,2007 Thomas E. Dickey #
|
||||
# #
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a #
|
||||
# copy of this software and associated documentation files (the "Software"), #
|
||||
# to deal in the Software without restriction, including without limitation #
|
||||
# the rights to use, copy, modify, merge, publish, distribute, distribute #
|
||||
# with modifications, sublicense, and/or sell copies of the Software, and to #
|
||||
# permit persons to whom the Software is furnished to do so, subject to the #
|
||||
# following conditions: #
|
||||
# #
|
||||
# The above copyright notice and this permission notice shall be included in #
|
||||
# all copies or substantial portions of the Software. #
|
||||
# #
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
|
||||
# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
|
||||
# DEALINGS IN THE SOFTWARE. #
|
||||
# #
|
||||
# Except as contained in this notice, the name(s) of the above copyright #
|
||||
# holders shall not be used in advertising or otherwise to promote the sale, #
|
||||
# use or other dealings in this Software without prior written #
|
||||
# authorization. #
|
||||
##############################################################################
|
||||
#
|
||||
# Adjust includes for header files that reside in a subdirectory of
|
||||
# /usr/include, etc.
|
||||
#
|
||||
# Parameters (the first case creates the sed script):
|
||||
# $1 is the target directory
|
||||
# $2 is the source directory
|
||||
# or (the second case does the install, using the sed script):
|
||||
# $1 is the script to use for installing
|
||||
# $2 is the target directory
|
||||
# $3 is the source directory
|
||||
# $4 is the file to install, editing source/target/etc.
|
||||
|
||||
PACKAGE=@PACKAGE@
|
||||
PKGNAME=@PACKAGE_PREFIX@
|
||||
CONFIGH=@PACKAGE_CONFIG@
|
||||
|
||||
TMPSED=headers.sed
|
||||
|
||||
DIGIT=0123456789
|
||||
alpha=abcdefghijklmnopqrstuvwxyz
|
||||
ALPHA=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
|
||||
alnum=_${DIGIT}${alpha}
|
||||
ALNUM=_${DIGIT}${ALPHA}
|
||||
MIXED=_${DIGIT}${ALPHA}${alpha}
|
||||
|
||||
if test $# = 2 ; then
|
||||
rm -f $TMPSED
|
||||
DST=$1
|
||||
REF=$2
|
||||
LEAF=`basename $DST`
|
||||
|
||||
# map the include-directory, if needed, to the subdirectory
|
||||
case $DST in
|
||||
/*/include/$LEAF)
|
||||
END=`basename $DST`
|
||||
for i in $REF/*.h
|
||||
do
|
||||
NAME=`basename $i`
|
||||
echo "s/<$NAME>/<$END\/$NAME>/g" >> $TMPSED
|
||||
done
|
||||
;;
|
||||
*)
|
||||
echo "" >> $TMPSED
|
||||
;;
|
||||
esac
|
||||
|
||||
# cannot do _this_ in -e options:
|
||||
cat >headers.tmp <<EOF
|
||||
s/^#[^ ][^ ]*//
|
||||
s/[^'$MIXED']/ /g
|
||||
s/[ ][ ]*/ /g
|
||||
s/^ //
|
||||
s/ $//
|
||||
:split
|
||||
h
|
||||
s/ .*//
|
||||
p
|
||||
t next
|
||||
b done
|
||||
:next
|
||||
x
|
||||
s/^[^ ][^ ]* //
|
||||
t split
|
||||
:done
|
||||
EOF
|
||||
# pick up autoconf-style symbols used in the application's headers
|
||||
for i in $REF/*.h
|
||||
do
|
||||
sed -e 's/^[ ][ ]*#[ ][ ]*/#/' $i \
|
||||
| egrep '^#(if|ifdef|ifndef|elif)' \
|
||||
| sed -f headers.tmp \
|
||||
| sort -u \
|
||||
| egrep '^(HAVE_|NEED_|NO_|ENABLE_|DISABLE_)' \
|
||||
| sed -e 's%^\(.*\)%s/\\<\1\\>/'${PKGNAME}'_\1/g%' >>$TMPSED
|
||||
done
|
||||
rm -f headers.tmp
|
||||
|
||||
# pick up autoconf-defined symbols in the config.h file
|
||||
for name in `
|
||||
egrep '^#define[ ][ ]*['$ALNUM']' $REF/$CONFIGH \
|
||||
| sed -e 's/^#define[ ][ ]*//' \
|
||||
-e 's/[ ].*//' \
|
||||
| egrep -v "^${PACKAGE}_" \
|
||||
| sort -u \
|
||||
| egrep -v "^${PKGNAME}_"`
|
||||
do
|
||||
echo "s/\\<$name\\>/${PKGNAME}_$name/g" >>$TMPSED
|
||||
done
|
||||
|
||||
# reduce the count if possible, since some old sed's limit is 100 lines
|
||||
sort -u $TMPSED >headers.tmp
|
||||
mv headers.tmp $TMPSED
|
||||
else
|
||||
PRG=""
|
||||
while test $# != 3
|
||||
do
|
||||
PRG="$PRG $1"; shift
|
||||
done
|
||||
|
||||
DST=$1
|
||||
REF=$2
|
||||
SRC=$3
|
||||
|
||||
SHOW=`basename $SRC`
|
||||
TMPSRC=${TMPDIR-/tmp}/${SHOW}$$
|
||||
|
||||
echo " ... $SHOW"
|
||||
test -f $REF/$SRC && SRC="$REF/$SRC"
|
||||
|
||||
rm -f $TMPSRC
|
||||
sed -f $TMPSED $SRC > $TMPSRC
|
||||
NAME=`basename $SRC`
|
||||
|
||||
# Just in case someone gzip'd manpages, remove the conflicting copy.
|
||||
test -f $DST/$NAME.gz && rm -f $DST/$NAME.gz
|
||||
|
||||
eval $PRG $TMPSRC $DST/$NAME
|
||||
rm -f $TMPSRC
|
||||
fi
|
233
contrib/dialog/inputbox.c
Normal file
233
contrib/dialog/inputbox.c
Normal file
@ -0,0 +1,233 @@
|
||||
/*
|
||||
* $Id: inputbox.c,v 1.64 2010/01/19 01:03:39 tom Exp $
|
||||
*
|
||||
* inputbox.c -- implements the input box
|
||||
*
|
||||
* Copyright 2000-2009,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*
|
||||
* An earlier version of this program lists as authors:
|
||||
* Savio Lam (lam836@cs.cuhk.hk)
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#define sTEXT -1
|
||||
|
||||
#define NAVIGATE_BINDINGS \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_DOWN ), \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ), \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ), \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ), \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ), \
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_UP )
|
||||
|
||||
/*
|
||||
* Display a dialog box for entering a string
|
||||
*/
|
||||
int
|
||||
dialog_inputbox(const char *title, const char *cprompt, int height, int width,
|
||||
const char *init, const int password)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
static DLG_KEYS_BINDING binding[] = {
|
||||
ENTERKEY_BINDINGS,
|
||||
NAVIGATE_BINDINGS,
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
static DLG_KEYS_BINDING binding2[] = {
|
||||
INPUTSTR_BINDINGS,
|
||||
ENTERKEY_BINDINGS,
|
||||
NAVIGATE_BINDINGS,
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
#endif
|
||||
int xorg, yorg;
|
||||
int x, y, box_y, box_x, box_width;
|
||||
int show_buttons;
|
||||
int col_offset = 0;
|
||||
int chr_offset = 0;
|
||||
int key, fkey, code;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int state;
|
||||
int first;
|
||||
char *input;
|
||||
WINDOW *dialog;
|
||||
WINDOW *editor;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_labels();
|
||||
|
||||
dlg_does_output();
|
||||
|
||||
dlg_tab_correct_str(prompt);
|
||||
|
||||
/* Set up the initial value */
|
||||
input = dlg_set_result(init);
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
retry:
|
||||
#endif
|
||||
show_buttons = TRUE;
|
||||
state = dialog_vars.defaultno ? dlg_defaultno_button() : sTEXT;
|
||||
first = (state == sTEXT);
|
||||
key = fkey = 0;
|
||||
|
||||
if (init != NULL) {
|
||||
dlg_auto_size(title, prompt, &height, &width, 5,
|
||||
MIN(MAX(dlg_count_columns(init) + 7, 26),
|
||||
SCOLS - (dialog_vars.begin_set ?
|
||||
dialog_vars.begin_x : 0)));
|
||||
chr_offset = (int) strlen(init);
|
||||
} else {
|
||||
dlg_auto_size(title, prompt, &height, &width, 5, 26);
|
||||
}
|
||||
dlg_button_layout(buttons, &width);
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
xorg = dlg_box_x_ordinate(width);
|
||||
yorg = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, yorg, xorg);
|
||||
dlg_register_window(dialog, "inputbox", binding);
|
||||
dlg_register_buttons(dialog, "inputbox", buttons);
|
||||
|
||||
dlg_mouse_setbase(xorg, yorg);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
/* Draw the input field box */
|
||||
box_width = width - 6;
|
||||
getyx(dialog, y, x);
|
||||
box_y = y + 2;
|
||||
box_x = (width - box_width) / 2;
|
||||
dlg_mouse_mkregion(y + 1, box_x - 1, 3, box_width + 2, 'i');
|
||||
dlg_draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2,
|
||||
border_attr, dialog_attr);
|
||||
|
||||
/* Make a window for the input-field, to associate bindings */
|
||||
editor = dlg_sub_window(dialog, 1, box_width, yorg + box_y, xorg + box_x);
|
||||
dlg_register_window(editor, "inputbox", binding2);
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
int edit = 0;
|
||||
|
||||
/*
|
||||
* The last field drawn determines where the cursor is shown:
|
||||
*/
|
||||
if (show_buttons) {
|
||||
show_buttons = FALSE;
|
||||
col_offset = dlg_edit_offset(input, chr_offset, box_width);
|
||||
(void) wmove(dialog, box_y, box_x + col_offset);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, state, FALSE, width);
|
||||
}
|
||||
|
||||
if (!first) {
|
||||
key = dlg_mouse_wgetch((state == sTEXT) ? editor : dialog, &fkey);
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle mouse clicks first, since we want to know if this is a button,
|
||||
* or something that dlg_edit_string() should handle.
|
||||
*/
|
||||
if (fkey
|
||||
&& is_DLGK_MOUSE(key)
|
||||
&& (code = dlg_ok_buttoncode(key - M_EVENT)) >= 0) {
|
||||
result = code;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (state == sTEXT) { /* Input box selected */
|
||||
edit = dlg_edit_string(input, &chr_offset, key, fkey, first);
|
||||
|
||||
if (edit) {
|
||||
dlg_show_string(dialog, input, chr_offset, inputbox_attr,
|
||||
box_y, box_x, box_width, password, first);
|
||||
first = FALSE;
|
||||
continue;
|
||||
} else if (first) {
|
||||
first = FALSE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle non-functionkeys */
|
||||
if (!fkey && (code = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
dlg_del_window(dialog);
|
||||
result = dlg_ok_buttoncode(code);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* handle functionkeys */
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case DLGK_MOUSE('i'): /* mouse enter events */
|
||||
state = 0;
|
||||
/* FALLTHRU */
|
||||
case DLGK_FIELD_PREV:
|
||||
show_buttons = TRUE;
|
||||
state = dlg_prev_ok_buttonindex(state, sTEXT);
|
||||
break;
|
||||
case DLGK_FIELD_NEXT:
|
||||
show_buttons = TRUE;
|
||||
state = dlg_next_ok_buttonindex(state, sTEXT);
|
||||
break;
|
||||
case ' ': /* FIXME: conflict with inputstr.c */
|
||||
case DLGK_ENTER:
|
||||
dlg_del_window(dialog);
|
||||
result = (state >= 0) ? dlg_ok_buttoncode(state) : DLG_EXIT_OK;
|
||||
break;
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
/* reset data */
|
||||
height = old_height;
|
||||
width = old_width;
|
||||
/* repaint */
|
||||
dlg_clear();
|
||||
dlg_del_window(dialog);
|
||||
refresh();
|
||||
dlg_mouse_free_regions();
|
||||
goto retry;
|
||||
#endif
|
||||
default:
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
beep();
|
||||
}
|
||||
}
|
||||
|
||||
dlg_unregister_window(editor);
|
||||
dlg_del_window(dialog);
|
||||
dlg_mouse_free_regions();
|
||||
free(prompt);
|
||||
return result;
|
||||
}
|
751
contrib/dialog/inputstr.c
Normal file
751
contrib/dialog/inputstr.c
Normal file
@ -0,0 +1,751 @@
|
||||
/*
|
||||
* $Id: inputstr.c,v 1.66 2010/01/15 23:13:36 tom Exp $
|
||||
*
|
||||
* inputstr.c -- functions for input/display of a string
|
||||
*
|
||||
* Copyright 2000-2009,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SEARCH_H) && defined(HAVE_TSEARCH)
|
||||
#include <search.h>
|
||||
#else
|
||||
#undef HAVE_TSEARCH
|
||||
#endif
|
||||
|
||||
#ifdef NEED_WCHAR_H
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#if defined(USE_WIDE_CURSES)
|
||||
#define USE_CACHING 1
|
||||
#elif defined(HAVE_XDIALOG)
|
||||
#define USE_CACHING 1 /* editbox really needs caching! */
|
||||
#else
|
||||
#define USE_CACHING 0
|
||||
#endif
|
||||
|
||||
typedef struct _cache {
|
||||
struct _cache *next;
|
||||
#if USE_CACHING
|
||||
struct _cache *cache_at; /* unique: associate caches by CACHE */
|
||||
const char *string_at; /* unique: associate caches by char* */
|
||||
#endif
|
||||
unsigned s_len; /* strlen(string) - we add 1 for EOS */
|
||||
unsigned i_len; /* length(list) - we add 1 for EOS */
|
||||
char *string; /* a copy of the last-processed string */
|
||||
int *list; /* indices into the string */
|
||||
} CACHE;
|
||||
|
||||
#if USE_CACHING
|
||||
#define SAME_CACHE(c,s,l) (c->string != 0 && memcmp(c->string,s,l) == 0)
|
||||
|
||||
static CACHE *cache_list;
|
||||
|
||||
#ifdef HAVE_TSEARCH
|
||||
static void *sorted_cache;
|
||||
#endif
|
||||
|
||||
#ifdef USE_WIDE_CURSES
|
||||
static int
|
||||
have_locale(void)
|
||||
{
|
||||
static int result = -1;
|
||||
if (result < 0) {
|
||||
char *test = setlocale(LC_ALL, 0);
|
||||
if (test == 0 || *test == 0) {
|
||||
result = FALSE;
|
||||
} else if (strcmp(test, "C") && strcmp(test, "POSIX")) {
|
||||
result = TRUE;
|
||||
} else {
|
||||
result = FALSE;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TSEARCH
|
||||
static int
|
||||
compare_cache(const void *a, const void *b)
|
||||
{
|
||||
const CACHE *p = (const CACHE *) a;
|
||||
const CACHE *q = (const CACHE *) b;
|
||||
int result = 0;
|
||||
result = p->cache_at - q->cache_at;
|
||||
if (result == 0)
|
||||
result = p->string_at - q->string_at;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
static CACHE *
|
||||
find_cache(CACHE * cache, const char *string)
|
||||
{
|
||||
CACHE *p;
|
||||
|
||||
#ifdef HAVE_TSEARCH
|
||||
void *pp;
|
||||
CACHE find;
|
||||
|
||||
memset(&find, 0, sizeof(find));
|
||||
find.cache_at = cache;
|
||||
find.string_at = string;
|
||||
|
||||
if ((pp = tfind(&find, &sorted_cache, compare_cache)) != 0) {
|
||||
p = *(CACHE **) pp;
|
||||
} else {
|
||||
p = 0;
|
||||
}
|
||||
#else
|
||||
for (p = cache_list; p != 0; p = p->next) {
|
||||
if (p->cache_at == cache
|
||||
&& p->string_at == string) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return p;
|
||||
}
|
||||
|
||||
static void
|
||||
make_cache(CACHE * cache, const char *string)
|
||||
{
|
||||
CACHE *p;
|
||||
|
||||
p = dlg_calloc(CACHE, 1);
|
||||
assert_ptr(p, "load_cache");
|
||||
p->next = cache_list;
|
||||
cache_list = p;
|
||||
|
||||
p->cache_at = cache;
|
||||
p->string_at = string;
|
||||
|
||||
*cache = *p;
|
||||
#ifdef HAVE_TSEARCH
|
||||
(void) tsearch(p, &sorted_cache, compare_cache);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
load_cache(CACHE * cache, const char *string)
|
||||
{
|
||||
CACHE *p;
|
||||
|
||||
if ((p = find_cache(cache, string)) != 0) {
|
||||
*cache = *p;
|
||||
} else {
|
||||
make_cache(cache, string);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
save_cache(CACHE * cache, const char *string)
|
||||
{
|
||||
CACHE *p;
|
||||
|
||||
if ((p = find_cache(cache, string)) != 0) {
|
||||
CACHE *q = p->next;
|
||||
*p = *cache;
|
||||
p->next = q;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define SAME_CACHE(c,s,l) (c->string != 0)
|
||||
#define load_cache(cache, string) /* nothing */
|
||||
#define save_cache(cache, string) /* nothing */
|
||||
#endif /* USE_WIDE_CURSES */
|
||||
|
||||
/*
|
||||
* If the given string has not changed, we do not need to update the index.
|
||||
* If we need to update the index, allocate enough memory for it.
|
||||
*/
|
||||
static bool
|
||||
same_cache2(CACHE * cache, const char *string, unsigned i_len)
|
||||
{
|
||||
unsigned need;
|
||||
unsigned s_len = strlen(string);
|
||||
|
||||
if (cache->s_len != 0
|
||||
&& cache->s_len >= s_len
|
||||
&& cache->list != 0
|
||||
&& SAME_CACHE(cache, string, s_len)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
need = (i_len + 1);
|
||||
if (cache->list == 0) {
|
||||
cache->list = dlg_malloc(int, need);
|
||||
} else if (cache->i_len < i_len) {
|
||||
cache->list = dlg_realloc(int, need, cache->list);
|
||||
}
|
||||
cache->i_len = i_len;
|
||||
|
||||
if (cache->s_len >= s_len && cache->string != 0) {
|
||||
strcpy(cache->string, string);
|
||||
} else {
|
||||
if (cache->string != 0)
|
||||
free(cache->string);
|
||||
cache->string = dlg_strclone(string);
|
||||
}
|
||||
cache->s_len = s_len;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef USE_WIDE_CURSES
|
||||
/*
|
||||
* Like same_cache2(), but we are only concerned about caching a copy of the
|
||||
* string and its associated length.
|
||||
*/
|
||||
static bool
|
||||
same_cache1(CACHE * cache, const char *string, unsigned i_len)
|
||||
{
|
||||
unsigned s_len = strlen(string);
|
||||
|
||||
if (cache->s_len == s_len
|
||||
&& SAME_CACHE(cache, string, s_len)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (cache->s_len >= s_len && cache->string != 0) {
|
||||
strcpy(cache->string, string);
|
||||
} else {
|
||||
if (cache->string != 0)
|
||||
free(cache->string);
|
||||
cache->string = dlg_strclone(string);
|
||||
}
|
||||
cache->s_len = s_len;
|
||||
cache->i_len = i_len;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* USE_CACHING */
|
||||
|
||||
/*
|
||||
* Counts the number of bytes that make up complete wide-characters, up to byte
|
||||
* 'len'. If there is no locale set, simply return the original length.
|
||||
*/
|
||||
#ifdef USE_WIDE_CURSES
|
||||
static int
|
||||
dlg_count_wcbytes(const char *string, size_t len)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (have_locale()) {
|
||||
static CACHE cache;
|
||||
|
||||
load_cache(&cache, string);
|
||||
if (!same_cache1(&cache, string, len)) {
|
||||
while (len != 0) {
|
||||
int part = 0;
|
||||
size_t code = 0;
|
||||
const char *src = cache.string;
|
||||
mbstate_t state;
|
||||
char save = cache.string[len];
|
||||
|
||||
cache.string[len] = '\0';
|
||||
memset(&state, 0, sizeof(state));
|
||||
code = mbsrtowcs((wchar_t *) 0, &src, len, &state);
|
||||
cache.string[len] = save;
|
||||
if ((int) code >= 0) {
|
||||
break;
|
||||
}
|
||||
++part;
|
||||
--len;
|
||||
}
|
||||
cache.i_len = len;
|
||||
save_cache(&cache, string);
|
||||
}
|
||||
result = (int) cache.i_len;
|
||||
} else {
|
||||
result = (int) len;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif /* USE_WIDE_CURSES */
|
||||
|
||||
/*
|
||||
* Counts the number of wide-characters in the string.
|
||||
*/
|
||||
int
|
||||
dlg_count_wchars(const char *string)
|
||||
{
|
||||
int result;
|
||||
|
||||
#ifdef USE_WIDE_CURSES
|
||||
if (have_locale()) {
|
||||
static CACHE cache;
|
||||
size_t len = strlen(string);
|
||||
|
||||
load_cache(&cache, string);
|
||||
if (!same_cache1(&cache, string, len)) {
|
||||
const char *src = cache.string;
|
||||
mbstate_t state;
|
||||
int part = dlg_count_wcbytes(cache.string, len);
|
||||
char save = cache.string[part];
|
||||
size_t code;
|
||||
wchar_t *temp = dlg_calloc(wchar_t, len + 1);
|
||||
|
||||
cache.string[part] = '\0';
|
||||
memset(&state, 0, sizeof(state));
|
||||
code = mbsrtowcs(temp, &src, (size_t) part, &state);
|
||||
cache.i_len = ((int) code >= 0) ? wcslen(temp) : 0;
|
||||
cache.string[part] = save;
|
||||
free(temp);
|
||||
save_cache(&cache, string);
|
||||
}
|
||||
result = (int) cache.i_len;
|
||||
} else
|
||||
#endif /* USE_WIDE_CURSES */
|
||||
{
|
||||
result = (int) strlen(string);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Build an index of the wide-characters in the string, so we can easily tell
|
||||
* which byte-offset begins a given wide-character.
|
||||
*/
|
||||
const int *
|
||||
dlg_index_wchars(const char *string)
|
||||
{
|
||||
static CACHE cache;
|
||||
unsigned len = (unsigned) dlg_count_wchars(string);
|
||||
unsigned inx;
|
||||
|
||||
load_cache(&cache, string);
|
||||
if (!same_cache2(&cache, string, len)) {
|
||||
const char *current = string;
|
||||
|
||||
cache.list[0] = 0;
|
||||
for (inx = 1; inx <= len; ++inx) {
|
||||
#ifdef USE_WIDE_CURSES
|
||||
if (have_locale()) {
|
||||
mbstate_t state;
|
||||
int width;
|
||||
memset(&state, 0, sizeof(state));
|
||||
width = (int) mbrlen(current, strlen(current), &state);
|
||||
if (width <= 0)
|
||||
width = 1; /* FIXME: what if we have a control-char? */
|
||||
current += width;
|
||||
cache.list[inx] = cache.list[inx - 1] + width;
|
||||
} else
|
||||
#endif /* USE_WIDE_CURSES */
|
||||
{
|
||||
(void) current;
|
||||
cache.list[inx] = (int) inx;
|
||||
}
|
||||
}
|
||||
save_cache(&cache, string);
|
||||
}
|
||||
return cache.list;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given the character-offset to find in the list, return the corresponding
|
||||
* array index.
|
||||
*/
|
||||
int
|
||||
dlg_find_index(const int *list, int limit, int to_find)
|
||||
{
|
||||
int result;
|
||||
for (result = 0; result <= limit; ++result) {
|
||||
if (to_find == list[result]
|
||||
|| result == limit
|
||||
|| to_find < list[result + 1])
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Build a list of the display-columns for the given string's characters.
|
||||
*/
|
||||
const int *
|
||||
dlg_index_columns(const char *string)
|
||||
{
|
||||
static CACHE cache;
|
||||
unsigned len = (unsigned) dlg_count_wchars(string);
|
||||
unsigned inx;
|
||||
|
||||
load_cache(&cache, string);
|
||||
if (!same_cache2(&cache, string, len)) {
|
||||
cache.list[0] = 0;
|
||||
#ifdef USE_WIDE_CURSES
|
||||
if (have_locale()) {
|
||||
size_t num_bytes = strlen(string);
|
||||
const int *inx_wchars = dlg_index_wchars(string);
|
||||
mbstate_t state;
|
||||
|
||||
for (inx = 0; inx < len; ++inx) {
|
||||
wchar_t temp[2];
|
||||
size_t check;
|
||||
int result;
|
||||
|
||||
if (string[inx_wchars[inx]] == TAB) {
|
||||
result = ((cache.list[inx] | 7) + 1) - cache.list[inx];
|
||||
} else {
|
||||
memset(&state, 0, sizeof(state));
|
||||
memset(temp, 0, sizeof(temp));
|
||||
check = mbrtowc(temp,
|
||||
string + inx_wchars[inx],
|
||||
num_bytes - (size_t) inx_wchars[inx],
|
||||
&state);
|
||||
if ((int) check <= 0) {
|
||||
result = 1;
|
||||
} else {
|
||||
result = wcwidth(temp[0]);
|
||||
}
|
||||
if (result < 0) {
|
||||
wchar_t *printable;
|
||||
cchar_t temp2;
|
||||
setcchar(&temp2, temp, 0, 0, 0);
|
||||
printable = wunctrl(&temp2);
|
||||
result = printable ? (int) wcslen(printable) : 1;
|
||||
}
|
||||
}
|
||||
cache.list[inx + 1] = result;
|
||||
if (inx != 0)
|
||||
cache.list[inx + 1] += cache.list[inx];
|
||||
}
|
||||
} else
|
||||
#endif /* USE_WIDE_CURSES */
|
||||
{
|
||||
for (inx = 0; inx < len; ++inx) {
|
||||
chtype ch = UCH(string[inx]);
|
||||
|
||||
if (ch == TAB)
|
||||
cache.list[inx + 1] =
|
||||
((cache.list[inx] | 7) + 1) - cache.list[inx];
|
||||
else if (isprint(ch))
|
||||
cache.list[inx + 1] = 1;
|
||||
else {
|
||||
const char *printable;
|
||||
printable = unctrl(ch);
|
||||
cache.list[inx + 1] = (printable
|
||||
? (int) strlen(printable)
|
||||
: 1);
|
||||
}
|
||||
if (inx != 0)
|
||||
cache.list[inx + 1] += cache.list[inx];
|
||||
}
|
||||
}
|
||||
save_cache(&cache, string);
|
||||
}
|
||||
return cache.list;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the number of columns used for a string. That happens to be the
|
||||
* end-value of the cols[] array.
|
||||
*/
|
||||
int
|
||||
dlg_count_columns(const char *string)
|
||||
{
|
||||
int result = 0;
|
||||
int limit = dlg_count_wchars(string);
|
||||
if (limit > 0) {
|
||||
const int *cols = dlg_index_columns(string);
|
||||
result = cols[limit];
|
||||
} else {
|
||||
result = (int) strlen(string);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a column limit, count the number of wide characters that can fit
|
||||
* into that limit. The offset is used to skip over a leading character
|
||||
* that was already written.
|
||||
*/
|
||||
int
|
||||
dlg_limit_columns(const char *string, int limit, int offset)
|
||||
{
|
||||
const int *cols = dlg_index_columns(string);
|
||||
int result = dlg_count_wchars(string);
|
||||
|
||||
while (result > 0 && (cols[result] - cols[offset]) > limit)
|
||||
--result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Updates the string and character-offset, given various editing characters
|
||||
* or literal characters which are inserted at the character-offset.
|
||||
*/
|
||||
bool
|
||||
dlg_edit_string(char *string, int *chr_offset, int key, int fkey, bool force)
|
||||
{
|
||||
int i;
|
||||
int len = (int) strlen(string);
|
||||
int limit = dlg_count_wchars(string);
|
||||
const int *indx = dlg_index_wchars(string);
|
||||
int offset = dlg_find_index(indx, limit, *chr_offset);
|
||||
int max_len = dlg_max_input(MAX_LEN);
|
||||
bool edit = TRUE;
|
||||
|
||||
/* transform editing characters into equivalent function-keys */
|
||||
if (!fkey) {
|
||||
fkey = TRUE; /* assume we transform */
|
||||
switch (key) {
|
||||
case 0:
|
||||
break;
|
||||
case ESC:
|
||||
case TAB:
|
||||
fkey = FALSE; /* this is used for navigation */
|
||||
break;
|
||||
default:
|
||||
fkey = FALSE; /* ...no, we did not transform */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case 0: /* special case for loop entry */
|
||||
edit = force;
|
||||
break;
|
||||
case DLGK_GRID_LEFT:
|
||||
if (*chr_offset)
|
||||
*chr_offset = indx[offset - 1];
|
||||
break;
|
||||
case DLGK_GRID_RIGHT:
|
||||
if (offset < limit)
|
||||
*chr_offset = indx[offset + 1];
|
||||
break;
|
||||
case DLGK_BEGIN:
|
||||
if (*chr_offset)
|
||||
*chr_offset = 0;
|
||||
break;
|
||||
case DLGK_FINAL:
|
||||
if (offset < limit)
|
||||
*chr_offset = indx[limit];
|
||||
break;
|
||||
case DLGK_DELETE_LEFT:
|
||||
if (offset) {
|
||||
int gap = indx[offset] - indx[offset - 1];
|
||||
*chr_offset = indx[offset - 1];
|
||||
if (gap > 0) {
|
||||
for (i = *chr_offset;
|
||||
(string[i] = string[i + gap]) != '\0';
|
||||
i++) {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DLGK_DELETE_RIGHT:
|
||||
if (limit) {
|
||||
if (--limit == 0) {
|
||||
string[*chr_offset = 0] = '\0';
|
||||
} else {
|
||||
int gap = ((offset <= limit)
|
||||
? (indx[offset + 1] - indx[offset])
|
||||
: 0);
|
||||
if (gap > 0) {
|
||||
for (i = indx[offset];
|
||||
(string[i] = string[i + gap]) != '\0';
|
||||
i++) {
|
||||
;
|
||||
}
|
||||
} else if (offset > 0) {
|
||||
string[indx[offset - 1]] = '\0';
|
||||
}
|
||||
if (*chr_offset > indx[limit])
|
||||
*chr_offset = indx[limit];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DLGK_DELETE_ALL:
|
||||
string[*chr_offset = 0] = '\0';
|
||||
break;
|
||||
case DLGK_ENTER:
|
||||
edit = 0;
|
||||
break;
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
edit = 0;
|
||||
break;
|
||||
#endif
|
||||
case DLGK_GRID_UP:
|
||||
case DLGK_GRID_DOWN:
|
||||
case DLGK_FIELD_NEXT:
|
||||
case DLGK_FIELD_PREV:
|
||||
edit = 0;
|
||||
break;
|
||||
case ERR:
|
||||
edit = 0;
|
||||
break;
|
||||
default:
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (key == ESC || key == ERR) {
|
||||
edit = 0;
|
||||
} else {
|
||||
if (len < max_len) {
|
||||
for (i = ++len; i > *chr_offset; i--)
|
||||
string[i] = string[i - 1];
|
||||
string[*chr_offset] = (char) key;
|
||||
*chr_offset += 1;
|
||||
} else {
|
||||
(void) beep();
|
||||
}
|
||||
}
|
||||
}
|
||||
return edit;
|
||||
}
|
||||
|
||||
static void
|
||||
compute_edit_offset(const char *string,
|
||||
int chr_offset,
|
||||
int x_last,
|
||||
int *p_dpy_column,
|
||||
int *p_scroll_amt)
|
||||
{
|
||||
const int *cols = dlg_index_columns(string);
|
||||
const int *indx = dlg_index_wchars(string);
|
||||
int limit = dlg_count_wchars(string);
|
||||
int offset = dlg_find_index(indx, limit, chr_offset);
|
||||
int offset2;
|
||||
int dpy_column;
|
||||
int n;
|
||||
|
||||
for (n = offset2 = 0; n <= offset; ++n) {
|
||||
if ((cols[offset] - cols[n]) < x_last
|
||||
&& (offset == limit || (cols[offset + 1] - cols[n]) < x_last)) {
|
||||
offset2 = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dpy_column = cols[offset] - cols[offset2];
|
||||
|
||||
if (p_dpy_column != 0)
|
||||
*p_dpy_column = dpy_column;
|
||||
if (p_scroll_amt != 0)
|
||||
*p_scroll_amt = offset2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given the character-offset in the string, returns the display-offset where
|
||||
* we will position the cursor.
|
||||
*/
|
||||
int
|
||||
dlg_edit_offset(char *string, int chr_offset, int x_last)
|
||||
{
|
||||
int result;
|
||||
|
||||
compute_edit_offset(string, chr_offset, x_last, &result, 0);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Displays the string, shifted as necessary, to fit within the box and show
|
||||
* the current character-offset.
|
||||
*/
|
||||
void
|
||||
dlg_show_string(WINDOW *win,
|
||||
const char *string, /* string to display (may be multibyte) */
|
||||
int chr_offset, /* character (not bytes) offset */
|
||||
chtype attr, /* window-attributes */
|
||||
int y_base, /* beginning row on screen */
|
||||
int x_base, /* beginning column on screen */
|
||||
int x_last, /* number of columns on screen */
|
||||
bool hidden, /* if true, do not echo */
|
||||
bool force) /* if true, force repaint */
|
||||
{
|
||||
x_last = MIN(x_last + x_base, getmaxx(win)) - x_base;
|
||||
|
||||
if (hidden && !dialog_vars.insecure) {
|
||||
if (force) {
|
||||
(void) wmove(win, y_base, x_base);
|
||||
wrefresh(win);
|
||||
}
|
||||
} else {
|
||||
const int *cols = dlg_index_columns(string);
|
||||
const int *indx = dlg_index_wchars(string);
|
||||
int limit = dlg_count_wchars(string);
|
||||
|
||||
int i, j, k;
|
||||
int input_x;
|
||||
int scrollamt;
|
||||
|
||||
compute_edit_offset(string, chr_offset, x_last, &input_x, &scrollamt);
|
||||
|
||||
wattrset(win, attr);
|
||||
(void) wmove(win, y_base, x_base);
|
||||
for (i = scrollamt, k = 0; i < limit && k < x_last; ++i) {
|
||||
int check = cols[i + 1] - cols[scrollamt];
|
||||
if (check <= x_last) {
|
||||
for (j = indx[i]; j < indx[i + 1]; ++j) {
|
||||
chtype ch = UCH(string[j]);
|
||||
if (hidden && dialog_vars.insecure) {
|
||||
waddch(win, '*');
|
||||
} else if (ch == TAB) {
|
||||
int count = cols[i + 1] - cols[i];
|
||||
while (--count >= 0)
|
||||
waddch(win, ' ');
|
||||
} else {
|
||||
waddch(win, ch);
|
||||
}
|
||||
}
|
||||
k = check;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (k++ < x_last)
|
||||
waddch(win, ' ');
|
||||
(void) wmove(win, y_base, x_base + input_x);
|
||||
wrefresh(win);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NO_LEAKS
|
||||
void
|
||||
_dlg_inputstr_leaks(void)
|
||||
{
|
||||
#if USE_CACHING
|
||||
while (cache_list != 0) {
|
||||
CACHE *next = cache_list->next;
|
||||
#ifdef HAVE_TSEARCH
|
||||
tdelete(cache_list, &sorted_cache, compare_cache);
|
||||
#endif
|
||||
if (cache_list->string != 0)
|
||||
free(cache_list->string);
|
||||
if (cache_list->list != 0)
|
||||
free(cache_list->list);
|
||||
free(cache_list);
|
||||
cache_list = next;
|
||||
}
|
||||
#endif /* USE_CACHING */
|
||||
}
|
||||
#endif /* NO_LEAKS */
|
294
contrib/dialog/install-sh
Executable file
294
contrib/dialog/install-sh
Executable file
@ -0,0 +1,294 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
#
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd=$cpprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd=$stripprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "$0: no input file specified" >&2
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d "$dst" ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f "$src" ] || [ -d "$src" ]
|
||||
then
|
||||
:
|
||||
else
|
||||
echo "$0: $src does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "$0: no destination specified" >&2
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d "$dst" ]
|
||||
then
|
||||
dst=$dst/`basename "$src"`
|
||||
else
|
||||
:
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-$defaultIFS}"
|
||||
|
||||
oIFS=$IFS
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS=$oIFS
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp=$pathcomp$1
|
||||
shift
|
||||
|
||||
if [ ! -d "$pathcomp" ] ;
|
||||
then
|
||||
$mkdirprog "$pathcomp"
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
pathcomp=$pathcomp/
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd "$dst" &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename "$dst"`
|
||||
else
|
||||
dstfile=`basename "$dst" $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename "$dst"`
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
rmtmp=$dstdir/#rm.$$#
|
||||
|
||||
# Trap to clean up temp files at exit.
|
||||
|
||||
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd "$src" "$dsttmp" &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
|
||||
|
||||
# Now remove or move aside any old file at destination location. We try this
|
||||
# two ways since rm can't unlink itself on some systems and the destination
|
||||
# file might be busy for other reasons. In this case, the final cleanup
|
||||
# might fail but the new file should still install successfully.
|
||||
|
||||
{
|
||||
if [ -f "$dstdir/$dstfile" ]
|
||||
then
|
||||
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
|
||||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
|
||||
{
|
||||
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
||||
(exit 1); exit
|
||||
}
|
||||
else
|
||||
:
|
||||
fi
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
||||
|
||||
fi &&
|
||||
|
||||
# The final little trick to "correctly" pass the exit status to the exit trap.
|
||||
|
||||
{
|
||||
(exit 0); exit
|
||||
}
|
283
contrib/dialog/makefile.in
Normal file
283
contrib/dialog/makefile.in
Normal file
@ -0,0 +1,283 @@
|
||||
# $Id: makefile.in,v 1.71 2010/04/28 00:45:38 tom Exp $
|
||||
# template makefile for DIALOG
|
||||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
x = @EXEEXT@
|
||||
o = .@OBJEXT@
|
||||
a = @LIB_SUFFIX@
|
||||
|
||||
DESTDIR =
|
||||
|
||||
bindir = @bindir@
|
||||
includedir = @includedir@
|
||||
libdir = @libdir@
|
||||
mandir = @mandir@
|
||||
|
||||
BINDIR = $(DESTDIR)$(bindir)
|
||||
INCLUDEDIR = $(DESTDIR)$(includedir)
|
||||
LIBDIR = $(DESTDIR)$(libdir)
|
||||
MANDIR = $(DESTDIR)$(mandir)
|
||||
|
||||
MAN1DIR = $(MANDIR)/man1
|
||||
MAN3DIR = $(MANDIR)/man3
|
||||
|
||||
# see po/makefile
|
||||
localedir = $(prefix)/@DATADIRNAME@/locale
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@ @DEFS@ -I. -I$(srcdir) -DLOCALEDIR=\"$(localedir)\"
|
||||
EXTRA_CFLAGS = @EXTRA_CFLAGS@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
AR = @AR@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@ @INTLLIBS@
|
||||
RANLIB = @LIB_PREP@
|
||||
|
||||
RM = rm -f
|
||||
LINT = lint
|
||||
|
||||
CTAGS = @CTAGS@
|
||||
ETAGS = @ETAGS@
|
||||
|
||||
LIBTOOL = @LIBTOOL@ @ECHO_LT@
|
||||
LIBTOOL_OPTS = @LIBTOOL_OPTS@
|
||||
LIBTOOL_CLEAN = @LIB_CLEAN@
|
||||
LIBTOOL_COMPILE = @LIB_COMPILE@
|
||||
LIBTOOL_CREATE = @LIB_CREATE@
|
||||
LIBTOOL_LINK = @LIB_LINK@
|
||||
LIBTOOL_INSTALL = @LIB_INSTALL@
|
||||
LIBTOOL_UNINSTALL = @LIB_UNINSTALL@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = $(LIBTOOL_INSTALL) @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
LINK = $(LIBTOOL_LINK)
|
||||
|
||||
PACKAGE = `echo @PACKAGE@ |sed @program_transform_name@`
|
||||
#
|
||||
# Standard .c to .o compile line.
|
||||
#
|
||||
.SUFFIXES: .c .i $o .html .1 .3 .man .ps .pdf .txt
|
||||
.c.i :
|
||||
@RULE_CC@
|
||||
@ECHO_CC@$(CPP) $(CPPFLAGS) -c $< >$@
|
||||
.c$o :
|
||||
@RULE_CC@
|
||||
@ECHO_CC@$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
.1.html :
|
||||
GROFF_NO_SGR=stupid $(SHELL) -c "tbl $< | groff -Thtml -man" >$@
|
||||
|
||||
.1.ps :
|
||||
$(SHELL) -c "tbl $< | groff -man" >$@
|
||||
|
||||
.1.txt :
|
||||
GROFF_NO_SGR=stupid $(SHELL) -c "tbl $< | nroff -Tascii -man | col -bx" >$@
|
||||
|
||||
.ps.pdf :
|
||||
ps2pdf $*.ps
|
||||
|
||||
EXTRAOBJS = @EXTRAOBJS@
|
||||
OBJECTS = $(EXTRAOBJS) \
|
||||
arrows$o \
|
||||
buttons$o \
|
||||
checklist$o \
|
||||
columns$o \
|
||||
dlg_keys$o \
|
||||
editbox$o \
|
||||
inputbox$o \
|
||||
inputstr$o \
|
||||
menubox$o \
|
||||
mouse$o \
|
||||
mousewget$o \
|
||||
msgbox$o \
|
||||
textbox$o \
|
||||
ui_getc$o \
|
||||
util$o \
|
||||
version$o \
|
||||
yesno$o
|
||||
|
||||
LIB_OBJECT = @LIB_OBJECT@
|
||||
|
||||
SRCS = $(OBJECTS:$o=.c)
|
||||
HDRS = \
|
||||
dialog.h \
|
||||
dlg_colors.h \
|
||||
dlg_config.h \
|
||||
dlg_keys.h
|
||||
|
||||
LIB = @LIB_PREFIX@dialog$a
|
||||
PROG = dialog$x
|
||||
ALL = $(LIB) $(PROG)
|
||||
|
||||
BIN_DIRS = $(BINDIR) $(MAN1DIR)
|
||||
LIB_DIRS = $(LIBDIR) $(INCLUDEDIR)
|
||||
|
||||
PO_DIR = $(srcdir)/po
|
||||
|
||||
all :: $(ALL)
|
||||
|
||||
@LIBTOOL_MAKE@install :: install-lib
|
||||
@LIBTOOL_MAKE@uninstall :: uninstall-lib
|
||||
|
||||
@INTLDIR_MAKE@@INTLLIBS@ :
|
||||
@INTLDIR_MAKE@ @echo "Building GNU gettext library..."
|
||||
@INTLDIR_MAKE@ @cd intl && $(MAKE) @cf_cv_makeflags@
|
||||
|
||||
dialog$o \
|
||||
$(OBJECTS) : $(srcdir)/dialog.h $(srcdir)/dlg_keys.h dlg_config.h VERSION
|
||||
|
||||
$(LIB) : $(LIB_OBJECT)
|
||||
$(LIBTOOL_CREATE) $(LIB) $(LIB_OBJECT)
|
||||
$(RANLIB) $@
|
||||
|
||||
dialog$x : $(LIB) dialog$o @INTLDIR_MAKE@ @INTLLIBS@
|
||||
$(LINK) -o $@ dialog$o -L. -ldialog $(LDFLAGS) $(LIBS)
|
||||
|
||||
clean \
|
||||
distclean \
|
||||
install \
|
||||
install-full \
|
||||
install-strip \
|
||||
uninstall ::
|
||||
@echo making $@
|
||||
@INTLDIR_MAKE@ @-test -f intl/makefile && cd intl && $(MAKE) @cf_cv_makeflags@ $@
|
||||
@MSG_DIR_MAKE@ @-test -f po/makefile && cd po && $(MAKE) @cf_cv_makeflags@ $@
|
||||
|
||||
clean ::
|
||||
@- $(RM) -r autom4te.cache
|
||||
- $(RM) *.*cov *.da *.bb *.bbg
|
||||
- $(LIBTOOL_CLEAN) $(RM) *.i *$o $(ALL)
|
||||
- $(RM) headers.sed
|
||||
- $(RM) *.html *.pdf *.png *.ps *.txt dialog_lib.1
|
||||
- $(RM) core *~ tags TAGS
|
||||
|
||||
distclean :: clean
|
||||
$(RM) intl/libintl.h intl/po2tbl.sed
|
||||
$(RM) makefile dlg_config.h config.cache config.log config.status
|
||||
$(RM) samples/install/makefile
|
||||
$(RM) headers-sh
|
||||
$(RM) dialog-config
|
||||
|
||||
install :: install-bin install-man
|
||||
@echo "made $@"
|
||||
|
||||
install-full :: install-lib install-bin install-man
|
||||
@echo "made $@"
|
||||
|
||||
install-strip :: $(PROG) $(BINDIR)
|
||||
$(INSTALL_PROGRAM) -s $(PROG) $(BINDIR)
|
||||
|
||||
uninstall :: uninstall-bin uninstall-man
|
||||
@echo "made $@"
|
||||
|
||||
uninstall-full :: uninstall-bin uninstall-man uninstall-lib
|
||||
@echo "made $@"
|
||||
|
||||
install-bin : $(PROG) $(BINDIR)
|
||||
$(INSTALL_PROGRAM) $(PROG) $(BINDIR)/$(PACKAGE)$x
|
||||
|
||||
uninstall-bin :
|
||||
$(RM) $(BINDIR)/$(PACKAGE)$x
|
||||
|
||||
install-man :: $(MAN1DIR)
|
||||
$(INSTALL_DATA) $(srcdir)/dialog.1 $(MAN1DIR)/$(PACKAGE).1
|
||||
|
||||
uninstall-man ::
|
||||
$(RM) $(MAN1DIR)/$(PACKAGE).1
|
||||
|
||||
# most users do not want/need the library, so the install rules are distinct.
|
||||
install-lib :: $(BINDIR) dialog-config
|
||||
@ echo "** installing config script in $(BINDIR)"
|
||||
@ $(INSTALL_SCRIPT) dialog-config $(BINDIR)
|
||||
|
||||
install-lib :: $(LIB_DIRS) $(LIB) headers.sed
|
||||
@ echo "** installing library in $(LIBDIR)"
|
||||
@ $(LIBTOOL_INSTALL) $(INSTALL_DATA) $(LIB) $(LIBDIR)
|
||||
@ echo "** installing headers in $(INCLUDEDIR)"
|
||||
@ $(SHELL) $(srcdir)/headers-sh $(INSTALL_DATA) $(INCLUDEDIR) $(srcdir) dialog.h
|
||||
@ $(SHELL) $(srcdir)/headers-sh $(INSTALL_DATA) $(INCLUDEDIR) $(srcdir) dlg_colors.h
|
||||
@ $(SHELL) $(srcdir)/headers-sh $(INSTALL_DATA) $(INCLUDEDIR) $(srcdir) dlg_keys.h
|
||||
@ $(SHELL) $(srcdir)/headers-sh $(INSTALL_DATA) $(INCLUDEDIR) . dlg_config.h
|
||||
|
||||
uninstall-lib :: $(BINDIR)
|
||||
$(RM) $(BINDIR)/dialog-config
|
||||
|
||||
uninstall-lib :: $(LIB_DIRS)
|
||||
- $(LIBTOOL_UNINSTALL) $(RM) $(LIBDIR)/$(LIB)
|
||||
$(RM) $(INCLUDEDIR)/dialog.h
|
||||
$(RM) $(INCLUDEDIR)/dlg_colors.h
|
||||
$(RM) $(INCLUDEDIR)/dlg_keys.h
|
||||
$(RM) $(INCLUDEDIR)/dlg_config.h
|
||||
|
||||
install-lib :: $(MAN3DIR)
|
||||
$(INSTALL_DATA) $(srcdir)/dialog.3 $(MAN3DIR)/$(PACKAGE).3
|
||||
|
||||
uninstall-lib ::
|
||||
$(RM) $(MAN3DIR)/$(PACKAGE).3
|
||||
|
||||
headers.sed : $(srcdir)/headers-sh
|
||||
$(SHELL) $(srcdir)/headers-sh $(INCLUDEDIR) $(srcdir)
|
||||
|
||||
################################################################################
|
||||
TOP_DOCS = \
|
||||
dialog.html \
|
||||
dialog.pdf \
|
||||
dialog.ps \
|
||||
dialog.txt
|
||||
dialog.html : dialog.1
|
||||
dialog.pdf : dialog.ps
|
||||
dialog.ps : dialog.1
|
||||
dialog.txt : dialog.1
|
||||
################################################################################
|
||||
# rename, to use suffix-rules
|
||||
dialog_lib.1 : dialog.3
|
||||
-$(RM) $@
|
||||
cp dialog.3 $@
|
||||
|
||||
LIB_DOCS = \
|
||||
dialog_lib.1 \
|
||||
dialog_lib.html \
|
||||
dialog_lib.pdf \
|
||||
dialog_lib.ps \
|
||||
dialog_lib.txt
|
||||
dialog_lib.html : dialog_lib.1
|
||||
dialog_lib.pdf : dialog_lib.ps
|
||||
dialog_lib.ps : dialog_lib.1
|
||||
dialog_lib.txt : dialog_lib.1
|
||||
################################################################################
|
||||
docs: $(TOP_DOCS) $(LIB_DOCS)
|
||||
clean-docs:
|
||||
-$(RM) $(TOP_DOCS) $(LIB_DOCS)
|
||||
################################################################################
|
||||
|
||||
$(MAN1DIR) \
|
||||
$(MAN3DIR) \
|
||||
$(BINDIR) \
|
||||
$(INCLUDEDIR) \
|
||||
$(LIBDIR) : ; mkdir -p $@
|
||||
|
||||
@MAKE_LOWER_TAGS@tags :
|
||||
@MAKE_LOWER_TAGS@ $(CTAGS) $(SRCS) $(HDRS)
|
||||
|
||||
@MAKE_LOWER_TAGS@TAGS :
|
||||
@MAKE_LOWER_TAGS@ $(ETAGS) $(SRCS) $(HDRS)
|
||||
|
||||
update-po:
|
||||
rsync -Lrtvz translationproject.org::tp/latest/dialog/ $(PO_DIR)
|
||||
test -f $(PO_DIR)/makefile && cd $(PO_DIR) && $(MAKE) $@
|
||||
|
||||
lint:
|
||||
$(LINT) $(CPPFLAGS) *.c
|
818
contrib/dialog/menubox.c
Normal file
818
contrib/dialog/menubox.c
Normal file
@ -0,0 +1,818 @@
|
||||
/*
|
||||
* $Id: menubox.c,v 1.118 2010/01/17 22:24:11 tom Exp $
|
||||
*
|
||||
* menubox.c -- implements the menu box
|
||||
*
|
||||
* Copyright 2000-2009,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public Licens, version 2.1e
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*
|
||||
* An earlier version of this program lists as authors
|
||||
* Savio Lam (lam836@cs.cuhk.hk)
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
static int menu_width, tag_x, item_x;
|
||||
|
||||
typedef enum {
|
||||
Unselected = 0,
|
||||
Selected,
|
||||
Editing
|
||||
} Mode;
|
||||
|
||||
#define MIN_HIGH (1 + (5 * MARGIN))
|
||||
|
||||
#define INPUT_ROWS 3 /* rows per inputmenu entry */
|
||||
|
||||
#define LLEN(n) ((n) * MENUBOX_TAGS)
|
||||
#define ItemName(i) items[LLEN(i)]
|
||||
#define ItemText(i) items[LLEN(i) + 1]
|
||||
#define ItemHelp(i) items[LLEN(i) + 2]
|
||||
|
||||
#define RowHeight(i) (is_inputmenu ? ((i) * INPUT_ROWS) : ((i) * 1))
|
||||
#define ItemToRow(i) (is_inputmenu ? ((i) * INPUT_ROWS + 1) : (i))
|
||||
#define RowToItem(i) (is_inputmenu ? ((i) / INPUT_ROWS + 0) : (i))
|
||||
|
||||
static void
|
||||
print_arrows(WINDOW *win,
|
||||
int box_x,
|
||||
int box_y,
|
||||
int scrollamt,
|
||||
int max_choice,
|
||||
int item_no,
|
||||
int menu_height)
|
||||
{
|
||||
dlg_draw_scrollbar(win,
|
||||
scrollamt,
|
||||
scrollamt,
|
||||
scrollamt + max_choice,
|
||||
item_no,
|
||||
box_x,
|
||||
box_x + menu_width,
|
||||
box_y,
|
||||
box_y + menu_height + 1,
|
||||
menubox_attr,
|
||||
menubox_border_attr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the tag of a menu-item
|
||||
*/
|
||||
static void
|
||||
print_tag(WINDOW *win,
|
||||
DIALOG_LISTITEM * item,
|
||||
int choice,
|
||||
Mode selected,
|
||||
bool is_inputmenu)
|
||||
{
|
||||
int my_x = item_x;
|
||||
int my_y = ItemToRow(choice);
|
||||
int tag_width = (my_x - tag_x - GUTTER);
|
||||
const int *cols;
|
||||
const int *indx;
|
||||
int limit;
|
||||
int prefix;
|
||||
|
||||
cols = dlg_index_columns(item->name);
|
||||
indx = dlg_index_wchars(item->name);
|
||||
limit = dlg_count_wchars(item->name);
|
||||
prefix = (indx[1] - indx[0]);
|
||||
|
||||
/* highlight first char of the tag to be special */
|
||||
(void) wmove(win, my_y, tag_x);
|
||||
wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
|
||||
if (strlen(item->name) != 0)
|
||||
(void) waddnstr(win, item->name, prefix);
|
||||
/* print rest of the string */
|
||||
wattrset(win, selected ? tag_selected_attr : tag_attr);
|
||||
if ((int) strlen(item->name) > prefix) {
|
||||
limit = dlg_limit_columns(item->name, tag_width, 1);
|
||||
if (limit > 0)
|
||||
(void) waddnstr(win, item->name + indx[1], indx[limit] - indx[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Print menu item
|
||||
*/
|
||||
static void
|
||||
print_item(WINDOW *win,
|
||||
DIALOG_LISTITEM * items,
|
||||
int choice,
|
||||
Mode selected,
|
||||
bool is_inputmenu)
|
||||
{
|
||||
chtype save = getattrs(win);
|
||||
int n;
|
||||
int my_width = menu_width;
|
||||
int my_x = item_x;
|
||||
int my_y = ItemToRow(choice);
|
||||
chtype attr = A_NORMAL;
|
||||
chtype textchar;
|
||||
chtype bordchar;
|
||||
|
||||
switch (selected) {
|
||||
default:
|
||||
case Unselected:
|
||||
textchar = item_attr;
|
||||
bordchar = item_attr;
|
||||
break;
|
||||
case Selected:
|
||||
textchar = item_selected_attr;
|
||||
bordchar = item_selected_attr;
|
||||
break;
|
||||
case Editing:
|
||||
textchar = inputbox_attr;
|
||||
bordchar = dialog_attr;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Clear 'residue' of last item and mark current current item */
|
||||
if (is_inputmenu) {
|
||||
wattrset(win, (selected != Unselected) ? item_selected_attr : item_attr);
|
||||
for (n = my_y - 1; n < my_y + INPUT_ROWS - 1; n++) {
|
||||
wmove(win, n, 0);
|
||||
wprintw(win, "%*s", my_width, " ");
|
||||
}
|
||||
} else {
|
||||
wattrset(win, menubox_attr);
|
||||
wmove(win, my_y, 0);
|
||||
wprintw(win, "%*s", my_width, " ");
|
||||
}
|
||||
|
||||
print_tag(win, items, choice, selected, is_inputmenu);
|
||||
|
||||
/* Draw the input field box (only for inputmenu) */
|
||||
(void) wmove(win, my_y, my_x);
|
||||
if (is_inputmenu) {
|
||||
my_width -= 1;
|
||||
dlg_draw_box(win, my_y - 1, my_x, INPUT_ROWS, my_width - my_x - tag_x,
|
||||
bordchar,
|
||||
bordchar);
|
||||
my_width -= 1;
|
||||
++my_x;
|
||||
}
|
||||
|
||||
/* print actual item */
|
||||
wmove(win, my_y, my_x);
|
||||
wattrset(win, textchar);
|
||||
dlg_print_text(win, items->text, my_width - my_x, &attr);
|
||||
|
||||
if (selected) {
|
||||
dlg_item_help(items->help);
|
||||
}
|
||||
wattrset(win, save);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allow the user to edit the text of a menu entry.
|
||||
*/
|
||||
static int
|
||||
input_menu_edit(WINDOW *win,
|
||||
DIALOG_LISTITEM * items,
|
||||
int choice,
|
||||
char **resultp)
|
||||
{
|
||||
chtype save = getattrs(win);
|
||||
char *result;
|
||||
int offset = 0;
|
||||
int key = 0, fkey = 0;
|
||||
int first = TRUE;
|
||||
/* see above */
|
||||
bool is_inputmenu = TRUE;
|
||||
int y = ItemToRow(choice);
|
||||
int code = TRUE;
|
||||
int max_len = dlg_max_input(MAX((int) strlen(items->text) + 1, MAX_LEN));
|
||||
|
||||
result = dlg_malloc(char, (size_t) max_len);
|
||||
assert_ptr(result, "input_menu_edit");
|
||||
|
||||
/* original item is used to initialize the input string. */
|
||||
result[0] = '\0';
|
||||
strcpy(result, items->text);
|
||||
|
||||
print_item(win, items, choice, Editing, TRUE);
|
||||
|
||||
/* taken out of inputbox.c - but somewhat modified */
|
||||
for (;;) {
|
||||
if (!first)
|
||||
key = dlg_mouse_wgetch(win, &fkey);
|
||||
if (dlg_edit_string(result, &offset, key, fkey, first)) {
|
||||
dlg_show_string(win, result, offset, inputbox_attr,
|
||||
y, item_x + 1, menu_width - item_x - 3,
|
||||
FALSE, first);
|
||||
first = FALSE;
|
||||
} else if (key == ESC || key == TAB) {
|
||||
code = FALSE;
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
print_item(win, items, choice, Selected, TRUE);
|
||||
wattrset(win, save);
|
||||
|
||||
*resultp = result;
|
||||
return code;
|
||||
}
|
||||
|
||||
static int
|
||||
handle_button(int code, DIALOG_LISTITEM * items, int choice)
|
||||
{
|
||||
switch (code) {
|
||||
case DLG_EXIT_OK: /* FALLTHRU */
|
||||
case DLG_EXIT_EXTRA:
|
||||
dlg_add_string(items[choice].name);
|
||||
break;
|
||||
case DLG_EXIT_HELP:
|
||||
dlg_add_result("HELP ");
|
||||
if (USE_ITEM_HELP(items[choice].help)) {
|
||||
dlg_add_string(items[choice].help);
|
||||
code = DLG_EXIT_ITEM_HELP;
|
||||
} else {
|
||||
dlg_add_string(items[choice].name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static int
|
||||
dlg_renamed_menutext(DIALOG_LISTITEM * items, int current, char *newtext)
|
||||
{
|
||||
if (dialog_vars.input_result)
|
||||
dialog_vars.input_result[0] = '\0';
|
||||
dlg_add_result("RENAMED ");
|
||||
dlg_add_string(items[current].name);
|
||||
dlg_add_result(" ");
|
||||
dlg_add_string(newtext);
|
||||
return DLG_EXIT_EXTRA;
|
||||
}
|
||||
|
||||
static int
|
||||
dlg_dummy_menutext(DIALOG_LISTITEM * items, int current, char *newtext)
|
||||
{
|
||||
(void) items;
|
||||
(void) current;
|
||||
(void) newtext;
|
||||
return DLG_EXIT_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is an alternate interface to 'menu' which allows the application
|
||||
* to read the list item states back directly without putting them in the
|
||||
* output buffer.
|
||||
*/
|
||||
int
|
||||
dlg_menu(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int menu_height,
|
||||
int item_no,
|
||||
DIALOG_LISTITEM * items,
|
||||
int *current_item,
|
||||
DIALOG_INPUTMENU rename_menutext)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
static DLG_KEYS_BINDING binding[] = {
|
||||
ENTERKEY_BINDINGS,
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, ' ' ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, '+' ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, KEY_DOWN ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_NEXT, CHR_NEXT ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, '-' ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, KEY_UP ),
|
||||
DLG_KEYS_DATA( DLGK_ITEM_PREV, CHR_PREVIOUS ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_FIRST, KEY_HOME ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_LAST, KEY_END ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_LAST, KEY_LL ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ),
|
||||
DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE ),
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
static DLG_KEYS_BINDING binding2[] = {
|
||||
INPUTSTR_BINDINGS,
|
||||
ENTERKEY_BINDINGS,
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
#endif
|
||||
int i, j, x, y, cur_x, cur_y, box_x, box_y;
|
||||
int key = 0, fkey;
|
||||
int button = dialog_state.visit_items ? -1 : dlg_defaultno_button();
|
||||
int choice = dlg_default_listitem(items);
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int scrollamt = 0;
|
||||
int max_choice, min_width;
|
||||
int found;
|
||||
int use_height, use_width, name_width, text_width;
|
||||
WINDOW *dialog, *menu;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_labels();
|
||||
bool is_inputmenu = (rename_menutext == dlg_renamed_menutext);
|
||||
|
||||
dlg_does_output();
|
||||
dlg_tab_correct_str(prompt);
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
retry:
|
||||
#endif
|
||||
|
||||
use_height = menu_height;
|
||||
if (use_height == 0) {
|
||||
min_width = dlg_calc_list_width(item_no, items) + 10;
|
||||
/* calculate height without items (4) */
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, MAX(26, min_width));
|
||||
dlg_calc_listh(&height, &use_height, item_no);
|
||||
} else {
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH + use_height, 26);
|
||||
}
|
||||
dlg_button_layout(buttons, &width);
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
dlg_register_window(dialog, "menubox", binding);
|
||||
dlg_register_buttons(dialog, "menubox", buttons);
|
||||
|
||||
dlg_mouse_setbase(x, y);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
menu_width = width - 6;
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
box_y = cur_y + 1;
|
||||
box_x = (width - menu_width) / 2 - 1;
|
||||
|
||||
/*
|
||||
* After displaying the prompt, we know how much space we really have.
|
||||
* Limit the list to avoid overwriting the ok-button.
|
||||
*/
|
||||
if (use_height + MIN_HIGH > height - cur_y)
|
||||
use_height = height - MIN_HIGH - cur_y;
|
||||
if (use_height <= 0)
|
||||
use_height = 1;
|
||||
|
||||
/* Find out maximal number of displayable items at once. */
|
||||
max_choice = MIN(use_height,
|
||||
RowHeight(item_no));
|
||||
if (is_inputmenu)
|
||||
max_choice /= INPUT_ROWS;
|
||||
|
||||
/* create new window for the menu */
|
||||
menu = dlg_sub_window(dialog, use_height, menu_width,
|
||||
y + box_y + 1,
|
||||
x + box_x + 1);
|
||||
dlg_register_window(menu, "menu", binding2);
|
||||
dlg_register_buttons(menu, "menu", buttons);
|
||||
|
||||
/* draw a box around the menu items */
|
||||
dlg_draw_box(dialog, box_y, box_x, use_height + 2, menu_width + 2,
|
||||
menubox_border_attr, menubox_attr);
|
||||
|
||||
name_width = 0;
|
||||
text_width = 0;
|
||||
|
||||
/* Find length of longest item to center menu *
|
||||
* only if --menu was given, using --inputmenu *
|
||||
* won't be centered. */
|
||||
for (i = 0; i < item_no; i++) {
|
||||
name_width = MAX(name_width, dlg_count_columns(items[i].name));
|
||||
text_width = MAX(text_width, dlg_count_columns(items[i].text));
|
||||
}
|
||||
|
||||
/* If the name+text is wider than the list is allowed, then truncate
|
||||
* one or both of them. If the name is no wider than 30% of the list,
|
||||
* leave it intact.
|
||||
*
|
||||
* FIXME: the gutter width and name/list ratio should be configurable.
|
||||
*/
|
||||
use_width = (menu_width - GUTTER);
|
||||
if (text_width + name_width > use_width) {
|
||||
int need = (int) (0.30 * use_width);
|
||||
if (name_width > need) {
|
||||
int want = (int) (use_width
|
||||
* ((double) name_width)
|
||||
/ (text_width + name_width));
|
||||
name_width = (want > need) ? want : need;
|
||||
}
|
||||
text_width = use_width - name_width;
|
||||
}
|
||||
|
||||
tag_x = (is_inputmenu
|
||||
? 0
|
||||
: (use_width - text_width - name_width) / 2);
|
||||
item_x = name_width + tag_x + GUTTER;
|
||||
|
||||
if (choice - scrollamt >= max_choice) {
|
||||
scrollamt = choice - (max_choice - 1);
|
||||
choice = max_choice - 1;
|
||||
}
|
||||
|
||||
/* Print the menu */
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(menu,
|
||||
&items[i + scrollamt],
|
||||
i,
|
||||
(i == choice) ? Selected : Unselected,
|
||||
is_inputmenu);
|
||||
}
|
||||
(void) wnoutrefresh(menu);
|
||||
|
||||
/* register the new window, along with its borders */
|
||||
dlg_mouse_mkbigregion(box_y + 1, box_x, use_height + 2, menu_width + 2,
|
||||
KEY_MAX, 1, 1, 1 /* by lines */ );
|
||||
|
||||
print_arrows(dialog, box_x, box_y, scrollamt, max_choice, item_no, use_height);
|
||||
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
if (button < 0) /* --visit-items */
|
||||
wmove(dialog, box_y + ItemToRow(choice) + 1, box_x + tag_x + 1);
|
||||
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
break;
|
||||
|
||||
found = FALSE;
|
||||
if (fkey) {
|
||||
/*
|
||||
* Allow a mouse-click on a box to switch selection to that box.
|
||||
* Handling a button click is a little more complicated, since we
|
||||
* push a KEY_ENTER back onto the input stream so we'll put the
|
||||
* cursor at the right place before handling the "keypress".
|
||||
*/
|
||||
if (key >= DLGK_MOUSE(KEY_MAX)) {
|
||||
key -= DLGK_MOUSE(KEY_MAX);
|
||||
i = RowToItem(key);
|
||||
if (i < max_choice) {
|
||||
found = TRUE;
|
||||
} else {
|
||||
beep();
|
||||
continue;
|
||||
}
|
||||
} else if (is_DLGK_MOUSE(key)
|
||||
&& dlg_ok_buttoncode(key - M_EVENT) >= 0) {
|
||||
button = (key - M_EVENT);
|
||||
ungetch('\n');
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Check if key pressed matches first character of any item tag in
|
||||
* list. If there is more than one match, we will cycle through
|
||||
* each one as the same key is pressed repeatedly.
|
||||
*/
|
||||
if (button < 0 || !dialog_state.visit_items) {
|
||||
for (j = scrollamt + choice + 1; j < item_no; j++) {
|
||||
if (dlg_match_char(dlg_last_getc(), items[j].name)) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
for (j = 0; j <= scrollamt + choice; j++) {
|
||||
if (dlg_match_char(dlg_last_getc(), items[j].name)) {
|
||||
found = TRUE;
|
||||
i = j - scrollamt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
dlg_flush_getc();
|
||||
} else if ((j = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
button = j;
|
||||
ungetch('\n');
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* A single digit (1-9) positions the selection to that line in the
|
||||
* current screen.
|
||||
*/
|
||||
if (!found
|
||||
&& (key <= '9')
|
||||
&& (key > '0')
|
||||
&& (key - '1' < max_choice)) {
|
||||
found = TRUE;
|
||||
i = key - '1';
|
||||
}
|
||||
}
|
||||
|
||||
if (!found && fkey) {
|
||||
found = TRUE;
|
||||
switch (key) {
|
||||
case DLGK_PAGE_FIRST:
|
||||
i = -scrollamt;
|
||||
break;
|
||||
case DLGK_PAGE_LAST:
|
||||
i = item_no - 1 - scrollamt;
|
||||
break;
|
||||
case DLGK_MOUSE(KEY_PPAGE):
|
||||
case DLGK_PAGE_PREV:
|
||||
if (choice)
|
||||
i = 0;
|
||||
else if (scrollamt != 0)
|
||||
i = -MIN(scrollamt, max_choice);
|
||||
else
|
||||
continue;
|
||||
break;
|
||||
case DLGK_MOUSE(KEY_NPAGE):
|
||||
case DLGK_PAGE_NEXT:
|
||||
i = MIN(choice + max_choice, item_no - scrollamt - 1);
|
||||
break;
|
||||
case DLGK_ITEM_PREV:
|
||||
i = choice - 1;
|
||||
if (choice == 0 && scrollamt == 0)
|
||||
continue;
|
||||
break;
|
||||
case DLGK_ITEM_NEXT:
|
||||
i = choice + 1;
|
||||
if (scrollamt + choice >= item_no - 1)
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
found = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
if (i != choice) {
|
||||
getyx(dialog, cur_y, cur_x);
|
||||
if (i < 0 || i >= max_choice) {
|
||||
#if defined(NCURSES_VERSION_MAJOR) && NCURSES_VERSION_MAJOR < 5
|
||||
/*
|
||||
* Using wscrl to assist ncurses scrolling is not needed
|
||||
* in version 5.x
|
||||
*/
|
||||
if (i == -1) {
|
||||
if (use_height > 1) {
|
||||
/* De-highlight current first item */
|
||||
print_item(menu,
|
||||
&items[scrollamt],
|
||||
0, Unselected, is_inputmenu);
|
||||
scrollok(menu, TRUE);
|
||||
wscrl(menu, -RowHeight(1));
|
||||
scrollok(menu, FALSE);
|
||||
}
|
||||
scrollamt--;
|
||||
print_item(menu,
|
||||
&items[scrollamt],
|
||||
0, Selected, is_inputmenu);
|
||||
} else if (i == max_choice) {
|
||||
if (use_height > 1) {
|
||||
/* De-highlight current last item before scrolling up */
|
||||
print_item(menu,
|
||||
&items[scrollamt + max_choice - 1],
|
||||
max_choice - 1,
|
||||
Unselected,
|
||||
is_inputmenu);
|
||||
scrollok(menu, TRUE);
|
||||
wscrl(menu, RowHeight(1));
|
||||
scrollok(menu, FALSE);
|
||||
}
|
||||
scrollamt++;
|
||||
print_item(menu,
|
||||
&items[scrollamt + max_choice - 1],
|
||||
max_choice - 1, TRUE,
|
||||
is_inputmenu);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (i < 0) {
|
||||
scrollamt += i;
|
||||
choice = 0;
|
||||
} else {
|
||||
choice = max_choice - 1;
|
||||
scrollamt += (i - max_choice + 1);
|
||||
}
|
||||
for (i = 0; i < max_choice; i++) {
|
||||
print_item(menu,
|
||||
&items[scrollamt + i],
|
||||
i,
|
||||
(i == choice) ? Selected : Unselected,
|
||||
is_inputmenu);
|
||||
}
|
||||
}
|
||||
/* Clean bottom lines */
|
||||
if (is_inputmenu) {
|
||||
int spare_lines, x_count;
|
||||
spare_lines = use_height % INPUT_ROWS;
|
||||
wattrset(menu, menubox_attr);
|
||||
for (; spare_lines; spare_lines--) {
|
||||
wmove(menu, use_height - spare_lines, 0);
|
||||
for (x_count = 0; x_count < menu_width;
|
||||
x_count++) {
|
||||
waddch(menu, ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
(void) wnoutrefresh(menu);
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, max_choice, item_no, use_height);
|
||||
} else {
|
||||
/* De-highlight current item */
|
||||
print_item(menu,
|
||||
&items[scrollamt + choice],
|
||||
choice,
|
||||
Unselected,
|
||||
is_inputmenu);
|
||||
/* Highlight new item */
|
||||
choice = i;
|
||||
print_item(menu,
|
||||
&items[scrollamt + choice],
|
||||
choice,
|
||||
Selected,
|
||||
is_inputmenu);
|
||||
(void) wnoutrefresh(menu);
|
||||
print_arrows(dialog,
|
||||
box_x, box_y,
|
||||
scrollamt, max_choice, item_no, use_height);
|
||||
(void) wmove(dialog, cur_y, cur_x);
|
||||
wrefresh(dialog);
|
||||
}
|
||||
}
|
||||
continue; /* wait for another key press */
|
||||
}
|
||||
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
case DLGK_FIELD_PREV:
|
||||
button = dlg_prev_button(buttons, button);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
case DLGK_FIELD_NEXT:
|
||||
button = dlg_next_button(buttons, button);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
case DLGK_ENTER:
|
||||
result = dlg_ok_buttoncode(button);
|
||||
|
||||
/*
|
||||
* If dlg_menu() is called from dialog_menu(), we want to
|
||||
* capture the results into dialog_vars.input_result, but not
|
||||
* if dlg_menu() is called directly from an application. We
|
||||
* can check this by testing if rename_menutext is the function
|
||||
* pointer owned by dialog_menu(). It would be nicer to have
|
||||
* this logic inside dialog_menu(), but that cannot be done
|
||||
* since we would lose compatibility for the results reported
|
||||
* after input_menu_edit().
|
||||
*/
|
||||
if (result == DLG_EXIT_ERROR) {
|
||||
result = DLG_EXIT_UNKNOWN;
|
||||
} else if (is_inputmenu
|
||||
|| rename_menutext == dlg_dummy_menutext) {
|
||||
result = handle_button(result,
|
||||
items,
|
||||
scrollamt + choice);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we have a rename_menutext function, interpret the Extra
|
||||
* button as a request to rename the menu's text. If that
|
||||
* function doesn't return "Unknown", we will exit from this
|
||||
* function. Usually that is done for dialog_menu(), so the
|
||||
* shell script can use the updated value. If it does return
|
||||
* "Unknown", update the list item only. A direct caller of
|
||||
* dlg_menu() can free the renamed value - we cannot.
|
||||
*/
|
||||
if (is_inputmenu && result == DLG_EXIT_EXTRA) {
|
||||
char *tmp;
|
||||
|
||||
if (input_menu_edit(menu,
|
||||
&items[scrollamt + choice],
|
||||
choice,
|
||||
&tmp)) {
|
||||
result = rename_menutext(items, scrollamt + choice, tmp);
|
||||
if (result == DLG_EXIT_UNKNOWN) {
|
||||
items[scrollamt + choice].text = tmp;
|
||||
} else {
|
||||
free(tmp);
|
||||
}
|
||||
} else {
|
||||
result = DLG_EXIT_UNKNOWN;
|
||||
print_item(menu,
|
||||
&items[scrollamt + choice],
|
||||
choice,
|
||||
Selected,
|
||||
is_inputmenu);
|
||||
(void) wnoutrefresh(menu);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
if (result == DLG_EXIT_UNKNOWN) {
|
||||
dlg_draw_buttons(dialog, height - 2, 0,
|
||||
buttons, button, FALSE, width);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
/* reset data */
|
||||
height = old_height;
|
||||
width = old_width;
|
||||
/* repaint */
|
||||
dlg_clear();
|
||||
dlg_del_window(dialog);
|
||||
refresh();
|
||||
dlg_mouse_free_regions();
|
||||
goto retry;
|
||||
#endif
|
||||
default:
|
||||
flash();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dlg_mouse_free_regions();
|
||||
dlg_unregister_window(menu);
|
||||
dlg_del_window(dialog);
|
||||
free(prompt);
|
||||
|
||||
*current_item = scrollamt + choice;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a menu for choosing among a number of options
|
||||
*/
|
||||
int
|
||||
dialog_menu(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int menu_height,
|
||||
int item_no,
|
||||
char **items)
|
||||
{
|
||||
int result;
|
||||
int choice;
|
||||
int i;
|
||||
DIALOG_LISTITEM *listitems;
|
||||
|
||||
listitems = dlg_calloc(DIALOG_LISTITEM, (size_t) item_no + 1);
|
||||
assert_ptr(listitems, "dialog_menu");
|
||||
|
||||
for (i = 0; i < item_no; ++i) {
|
||||
listitems[i].name = ItemName(i);
|
||||
listitems[i].text = ItemText(i);
|
||||
listitems[i].help = ((dialog_vars.item_help)
|
||||
? ItemHelp(i)
|
||||
: dlg_strempty());
|
||||
}
|
||||
dlg_align_columns(&listitems[0].text, sizeof(DIALOG_LISTITEM), item_no);
|
||||
|
||||
result = dlg_menu(title,
|
||||
cprompt,
|
||||
height,
|
||||
width,
|
||||
menu_height,
|
||||
item_no,
|
||||
listitems,
|
||||
&choice,
|
||||
dialog_vars.input_menu ? dlg_renamed_menutext : dlg_dummy_menutext);
|
||||
|
||||
dlg_free_columns(&listitems[0].text, sizeof(DIALOG_LISTITEM), item_no);
|
||||
free(listitems);
|
||||
return result;
|
||||
}
|
121
contrib/dialog/mixedform.c
Normal file
121
contrib/dialog/mixedform.c
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* $Id: mixedform.c,v 1.8 2010/04/28 20:54:11 tom Exp $
|
||||
*
|
||||
* formbox.c -- implements the form (i.e, some pairs label/editbox)
|
||||
*
|
||||
* Copyright 2007-2008,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*
|
||||
* This is inspired by a patch from Kiran Cherupally
|
||||
* (but different interface design).
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
|
||||
#define LLEN(n) ((n) * MIXEDFORM_TAGS)
|
||||
|
||||
#define ItemName(i) items[LLEN(i) + 0]
|
||||
#define ItemNameY(i) items[LLEN(i) + 1]
|
||||
#define ItemNameX(i) items[LLEN(i) + 2]
|
||||
#define ItemText(i) items[LLEN(i) + 3]
|
||||
#define ItemTextY(i) items[LLEN(i) + 4]
|
||||
#define ItemTextX(i) items[LLEN(i) + 5]
|
||||
#define ItemTextFLen(i) items[LLEN(i) + 6]
|
||||
#define ItemTextILen(i) items[LLEN(i) + 7]
|
||||
#define ItemTypep(i) items[LLEN(i) + 8]
|
||||
#define ItemHelp(i) (dialog_vars.item_help ? items[LLEN(i) + 9] : dlg_strempty())
|
||||
|
||||
int
|
||||
dialog_mixedform(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int form_height,
|
||||
int item_no,
|
||||
char **items)
|
||||
{
|
||||
int result;
|
||||
int choice;
|
||||
int i;
|
||||
DIALOG_FORMITEM *listitems;
|
||||
DIALOG_VARS save_vars;
|
||||
bool show_status = FALSE;
|
||||
|
||||
dlg_save_vars(&save_vars);
|
||||
dialog_vars.separate_output = TRUE;
|
||||
|
||||
listitems = dlg_calloc(DIALOG_FORMITEM, (size_t) item_no + 1);
|
||||
assert_ptr(listitems, "dialog_mixedform");
|
||||
|
||||
for (i = 0; i < item_no; ++i) {
|
||||
listitems[i].type = dialog_vars.formitem_type;
|
||||
listitems[i].name = ItemName(i);
|
||||
listitems[i].name_len = (int) strlen(ItemName(i));
|
||||
listitems[i].name_y = dlg_ordinate(ItemNameY(i));
|
||||
listitems[i].name_x = dlg_ordinate(ItemNameX(i));
|
||||
listitems[i].text = ItemText(i);
|
||||
listitems[i].text_len = (int) strlen(ItemText(i));
|
||||
listitems[i].text_y = dlg_ordinate(ItemTextY(i));
|
||||
listitems[i].text_x = dlg_ordinate(ItemTextX(i));
|
||||
listitems[i].text_flen = atoi(ItemTextFLen(i));
|
||||
listitems[i].text_ilen = atoi(ItemTextILen(i));
|
||||
listitems[i].help = (dialog_vars.item_help ? ItemHelp(i) :
|
||||
dlg_strempty());
|
||||
listitems[i].type = (unsigned) atoi(ItemTypep(i));
|
||||
}
|
||||
|
||||
result = dlg_form(title,
|
||||
cprompt,
|
||||
height,
|
||||
width,
|
||||
form_height,
|
||||
item_no,
|
||||
listitems,
|
||||
&choice);
|
||||
|
||||
switch (result) {
|
||||
case DLG_EXIT_OK: /* FALLTHRU */
|
||||
case DLG_EXIT_EXTRA:
|
||||
show_status = TRUE;
|
||||
break;
|
||||
case DLG_EXIT_HELP:
|
||||
dlg_add_result("HELP ");
|
||||
show_status = dialog_vars.help_status;
|
||||
if (USE_ITEM_HELP(listitems[choice].help)) {
|
||||
dlg_add_string(listitems[choice].help);
|
||||
result = DLG_EXIT_ITEM_HELP;
|
||||
} else {
|
||||
dlg_add_string(listitems[choice].name);
|
||||
}
|
||||
if (show_status)
|
||||
dlg_add_separator();
|
||||
break;
|
||||
}
|
||||
if (show_status) {
|
||||
for (i = 0; i < item_no; i++) {
|
||||
if (listitems[i].text_flen > 0) {
|
||||
dlg_add_string(listitems[i].text);
|
||||
dlg_add_separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dlg_free_formitems(listitems);
|
||||
dlg_restore_vars(&save_vars);
|
||||
|
||||
return result;
|
||||
}
|
393
contrib/dialog/mixedgauge.c
Normal file
393
contrib/dialog/mixedgauge.c
Normal file
@ -0,0 +1,393 @@
|
||||
/*
|
||||
* $Id: mixedgauge.c,v 1.18 2010/01/15 23:43:53 tom Exp $
|
||||
*
|
||||
* mixedgauge.c -- implements the mixedgauge dialog
|
||||
*
|
||||
* Copyright 2007,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*
|
||||
* This is inspired by a patch from Kiran Cherupally
|
||||
* (but different interface design).
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
|
||||
#define LLEN(n) ((n) * MIXEDGAUGE_TAGS)
|
||||
#define ItemData(i) &items[LLEN(i)]
|
||||
#define ItemName(i) items[LLEN(i)]
|
||||
#define ItemText(i) items[LLEN(i) + 1]
|
||||
|
||||
#define MIN_HIGH (4)
|
||||
#define MIN_WIDE (10 + 2 * (2 + MARGIN))
|
||||
|
||||
typedef struct {
|
||||
WINDOW *dialog;
|
||||
WINDOW *caption;
|
||||
const char *title;
|
||||
char *prompt;
|
||||
int height, old_height, min_height;
|
||||
int width, old_width, min_width;
|
||||
int len_name, len_text;
|
||||
int item_no;
|
||||
DIALOG_LISTITEM *list;
|
||||
} DIALOG_MIXEDGAUGE;
|
||||
|
||||
static const char *
|
||||
status_string(char *given, char **freeMe)
|
||||
{
|
||||
const char *result;
|
||||
|
||||
*freeMe = 0;
|
||||
if (isdigit(UCH(*given))) {
|
||||
switch (*given) {
|
||||
case '0':
|
||||
result = _("Succeeded");
|
||||
break;
|
||||
case '1':
|
||||
result = _("Failed");
|
||||
break;
|
||||
case '2':
|
||||
result = _("Passed");
|
||||
break;
|
||||
case '3':
|
||||
result = _("Completed");
|
||||
break;
|
||||
case '4':
|
||||
result = _("Checked");
|
||||
break;
|
||||
case '5':
|
||||
result = _("Done");
|
||||
break;
|
||||
case '6':
|
||||
result = _("Skipped");
|
||||
break;
|
||||
case '7':
|
||||
result = _("In Progress");
|
||||
break;
|
||||
case '8':
|
||||
result = "";
|
||||
break;
|
||||
case '9':
|
||||
result = _("N/A");
|
||||
break;
|
||||
default:
|
||||
result = "?";
|
||||
break;
|
||||
}
|
||||
} else if (*given == '-') {
|
||||
unsigned need = strlen(++given);
|
||||
char *temp = dlg_malloc(char, need);
|
||||
*freeMe = temp;
|
||||
sprintf(temp, "%3s%%", given);
|
||||
result = temp;
|
||||
} else if (!isspace(UCH(*given))) {
|
||||
result = given;
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This function displays status messages */
|
||||
static void
|
||||
myprint_status(DIALOG_MIXEDGAUGE * dlg)
|
||||
{
|
||||
WINDOW *win = dlg->dialog;
|
||||
int limit_y = dlg->height;
|
||||
int limit_x = dlg->width;
|
||||
|
||||
int y = MARGIN;
|
||||
int item;
|
||||
int cells = dlg->len_text - 2;
|
||||
int rm = limit_x; /* right margin */
|
||||
int lm = limit_x - dlg->len_text - 1;
|
||||
int bm = limit_y; /* bottom margin */
|
||||
int last_y = 0, last_x = 0;
|
||||
int j, xxx;
|
||||
float percent;
|
||||
const char *status = "";
|
||||
char *freeMe = 0;
|
||||
|
||||
if (win) {
|
||||
rm -= (2 * MARGIN);
|
||||
bm -= (2 * MARGIN);
|
||||
}
|
||||
if (win != 0)
|
||||
getyx(win, last_y, last_x);
|
||||
for (item = 0; item < dlg->item_no; ++item) {
|
||||
chtype attr = A_NORMAL;
|
||||
|
||||
y = item + MARGIN + 1;
|
||||
if (y > bm)
|
||||
break;
|
||||
|
||||
status = status_string(dlg->list[item].text, &freeMe);
|
||||
if (status == 0 || *status == 0)
|
||||
continue;
|
||||
|
||||
(void) wmove(win, y, 2 * MARGIN);
|
||||
dlg_print_text(win, dlg->list[item].name, lm, &attr);
|
||||
|
||||
(void) wmove(win, y, lm);
|
||||
(void) waddch(win, '[');
|
||||
(void) wmove(win, y, lm + (cells - (int) strlen(status)) / 2);
|
||||
if (freeMe) {
|
||||
(void) wmove(win, y, lm + 1);
|
||||
wattrset(win, title_attr);
|
||||
for (j = 0; j < cells; j++)
|
||||
(void) waddch(win, ' ');
|
||||
|
||||
(void) wmove(win, y, lm + (cells - (int) strlen(status)) / 2);
|
||||
(void) waddstr(win, status);
|
||||
|
||||
if ((title_attr & A_REVERSE) != 0) {
|
||||
wattroff(win, A_REVERSE);
|
||||
} else {
|
||||
wattrset(win, A_REVERSE);
|
||||
}
|
||||
(void) wmove(win, y, lm + 1);
|
||||
|
||||
if (sscanf(status, "%f%%", &percent) != 1)
|
||||
percent = 0.0;
|
||||
xxx = (int) ((cells * (percent + 0.5)) / 100.0);
|
||||
for (j = 0; j < xxx; j++) {
|
||||
chtype ch1 = winch(win);
|
||||
if (title_attr & A_REVERSE) {
|
||||
ch1 &= ~A_REVERSE;
|
||||
}
|
||||
(void) waddch(win, ch1);
|
||||
}
|
||||
free(freeMe);
|
||||
|
||||
} else {
|
||||
(void) wmove(win, y, lm + (cells - (int) strlen(status)) / 2);
|
||||
(void) waddstr(win, status);
|
||||
}
|
||||
(void) wmove(win, y, limit_x - 3);
|
||||
(void) waddch(win, ']');
|
||||
(void) wnoutrefresh(win);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mydraw_mixed_box(WINDOW *win, int y, int x, int height, int width,
|
||||
chtype boxchar, chtype borderchar)
|
||||
{
|
||||
dlg_draw_box(win, y, x, height, width, boxchar, borderchar);
|
||||
{
|
||||
chtype attr = A_NORMAL;
|
||||
char *message = _("Overall Progress");
|
||||
chtype save2 = getattrs(win);
|
||||
wattrset(win, title_attr);
|
||||
(void) wmove(win, y, x + 2);
|
||||
dlg_print_text(win, message, width, &attr);
|
||||
wattrset(win, save2);
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
clean_copy(const char *string)
|
||||
{
|
||||
char *result = dlg_strclone(string);
|
||||
|
||||
dlg_trim_string(result);
|
||||
dlg_tab_correct_str(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update mixed-gauge dialog (may be from pipe, may be via direct calls).
|
||||
*/
|
||||
static void
|
||||
dlg_update_mixedgauge(DIALOG_MIXEDGAUGE * dlg, int percent)
|
||||
{
|
||||
int i, x;
|
||||
|
||||
/*
|
||||
* Clear the area for the progress bar by filling it with spaces
|
||||
* in the title-attribute, and write the percentage with that
|
||||
* attribute.
|
||||
*/
|
||||
(void) wmove(dlg->dialog, dlg->height - 3, 4);
|
||||
wattrset(dlg->dialog, title_attr);
|
||||
|
||||
for (i = 0; i < (dlg->width - 2 * (3 + MARGIN)); i++)
|
||||
(void) waddch(dlg->dialog, ' ');
|
||||
|
||||
(void) wmove(dlg->dialog, dlg->height - 3, (dlg->width / 2) - 2);
|
||||
(void) wprintw(dlg->dialog, "%3d%%", percent);
|
||||
|
||||
/*
|
||||
* Now draw a bar in reverse, relative to the background.
|
||||
* The window attribute was useful for painting the background,
|
||||
* but requires some tweaks to reverse it.
|
||||
*/
|
||||
x = (percent * (dlg->width - 2 * (3 + MARGIN))) / 100;
|
||||
if ((title_attr & A_REVERSE) != 0) {
|
||||
wattroff(dlg->dialog, A_REVERSE);
|
||||
} else {
|
||||
wattrset(dlg->dialog, A_REVERSE);
|
||||
}
|
||||
(void) wmove(dlg->dialog, dlg->height - 3, 4);
|
||||
for (i = 0; i < x; i++) {
|
||||
chtype ch = winch(dlg->dialog);
|
||||
if (title_attr & A_REVERSE) {
|
||||
ch &= ~A_REVERSE;
|
||||
}
|
||||
(void) waddch(dlg->dialog, ch);
|
||||
}
|
||||
myprint_status(dlg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup dialog.
|
||||
*/
|
||||
static void
|
||||
dlg_begin_mixedgauge(DIALOG_MIXEDGAUGE * dlg,
|
||||
int *began,
|
||||
const char *aTitle,
|
||||
const char *aPrompt,
|
||||
int aHeight,
|
||||
int aWidth,
|
||||
int aItemNo,
|
||||
char **items)
|
||||
{
|
||||
int n, y, x;
|
||||
|
||||
if (!*began) {
|
||||
curs_set(0);
|
||||
|
||||
memset(dlg, 0, sizeof(*dlg));
|
||||
dlg->title = aTitle;
|
||||
dlg->prompt = clean_copy(aPrompt);
|
||||
dlg->height = dlg->old_height = aHeight;
|
||||
dlg->width = dlg->old_width = aWidth;
|
||||
dlg->item_no = aItemNo;
|
||||
|
||||
dlg->list = dlg_calloc(DIALOG_LISTITEM, (size_t) aItemNo);
|
||||
assert_ptr(dlg->list, "dialog_mixedgauge");
|
||||
|
||||
dlg->len_name = 0;
|
||||
dlg->len_text = 15;
|
||||
|
||||
for (n = 0; n < aItemNo; ++n) {
|
||||
int thisWidth = (int) strlen(ItemName(n));
|
||||
if (dlg->len_name < thisWidth)
|
||||
dlg->len_name = thisWidth;
|
||||
dlg->list[n].name = ItemName(n);
|
||||
dlg->list[n].text = ItemText(n);
|
||||
}
|
||||
|
||||
dlg->min_height = MIN_HIGH + aItemNo;
|
||||
dlg->min_width = MIN_WIDE + dlg->len_name + GUTTER + dlg->len_text;
|
||||
|
||||
if (dlg->prompt != 0 && *(dlg->prompt) != 0)
|
||||
dlg->min_height += (2 * MARGIN);
|
||||
#ifdef KEY_RESIZE
|
||||
nodelay(stdscr, TRUE);
|
||||
#endif
|
||||
}
|
||||
#ifdef KEY_RESIZE
|
||||
else {
|
||||
dlg_del_window(dlg->dialog);
|
||||
dlg->height = dlg->old_height;
|
||||
dlg->width = dlg->old_width;
|
||||
}
|
||||
#endif
|
||||
|
||||
dlg_auto_size(dlg->title, dlg->prompt,
|
||||
&(dlg->height),
|
||||
&(dlg->width),
|
||||
dlg->min_height,
|
||||
dlg->min_width);
|
||||
dlg_print_size(dlg->height, dlg->width);
|
||||
dlg_ctl_size(dlg->height, dlg->width);
|
||||
|
||||
/* center dialog box on screen */
|
||||
x = dlg_box_x_ordinate(dlg->width);
|
||||
y = dlg_box_y_ordinate(dlg->height);
|
||||
|
||||
dlg->dialog = dlg_new_window(dlg->height, dlg->width, y, x);
|
||||
|
||||
(void) werase(dlg->dialog);
|
||||
dlg_draw_box(dlg->dialog,
|
||||
0, 0,
|
||||
dlg->height,
|
||||
dlg->width,
|
||||
dialog_attr, border_attr);
|
||||
|
||||
dlg_draw_title(dlg->dialog, dlg->title);
|
||||
|
||||
if ((dlg->prompt != 0 && *(dlg->prompt) != 0)
|
||||
&& wmove(dlg->dialog, dlg->item_no, 0) != ERR) {
|
||||
dlg->caption = dlg_sub_window(dlg->dialog,
|
||||
dlg->height - dlg->item_no - (2 * MARGIN),
|
||||
dlg->width,
|
||||
y + dlg->item_no + (2 * MARGIN),
|
||||
x);
|
||||
wattrset(dlg->caption, dialog_attr);
|
||||
dlg_print_autowrap(dlg->caption, dlg->prompt, dlg->height, dlg->width);
|
||||
}
|
||||
|
||||
mydraw_mixed_box(dlg->dialog,
|
||||
dlg->height - 4,
|
||||
2 + MARGIN,
|
||||
2 + MARGIN,
|
||||
dlg->width - 2 * (2 + MARGIN),
|
||||
dialog_attr,
|
||||
border_attr);
|
||||
|
||||
*began += 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Discard the mixed-gauge dialog.
|
||||
*/
|
||||
static int
|
||||
dlg_finish_mixedgauge(DIALOG_MIXEDGAUGE * dlg, int status)
|
||||
{
|
||||
(void) wrefresh(dlg->dialog);
|
||||
#ifdef KEY_RESIZE
|
||||
nodelay(stdscr, FALSE);
|
||||
#endif
|
||||
curs_set(1);
|
||||
dlg_del_window(dlg->dialog);
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup dialog, read mixed-gauge data from pipe.
|
||||
*/
|
||||
int
|
||||
dialog_mixedgauge(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int percent,
|
||||
int item_no,
|
||||
char **items)
|
||||
{
|
||||
DIALOG_MIXEDGAUGE dlg;
|
||||
int began = 0;
|
||||
|
||||
dlg_begin_mixedgauge(&dlg, &began, title, cprompt, height,
|
||||
width, item_no, items);
|
||||
|
||||
dlg_update_mixedgauge(&dlg, percent);
|
||||
|
||||
return dlg_finish_mixedgauge(&dlg, DLG_EXIT_OK);
|
||||
}
|
139
contrib/dialog/mouse.c
Normal file
139
contrib/dialog/mouse.c
Normal file
@ -0,0 +1,139 @@
|
||||
/*
|
||||
* $Id: mouse.c,v 1.18 2007/02/22 21:51:38 tom Exp $
|
||||
*
|
||||
* mouse.c -- mouse support for dialog
|
||||
*
|
||||
* Copyright 2002-2006,2007 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#if USE_MOUSE
|
||||
|
||||
static int basex, basey;
|
||||
|
||||
static mseRegion *regionList = NULL;
|
||||
|
||||
/*=========== region related functions =============*/
|
||||
|
||||
static mseRegion *
|
||||
find_region_by_code(int code)
|
||||
{
|
||||
mseRegion *butPtr;
|
||||
|
||||
for (butPtr = regionList; butPtr; butPtr = butPtr->next) {
|
||||
if (code == butPtr->code)
|
||||
break;
|
||||
}
|
||||
return butPtr;
|
||||
}
|
||||
|
||||
void
|
||||
dlg_mouse_setbase(int x, int y)
|
||||
{
|
||||
basex = x;
|
||||
basey = y;
|
||||
}
|
||||
|
||||
void
|
||||
dlg_mouse_mkbigregion(int y, int x,
|
||||
int height, int width,
|
||||
int code,
|
||||
int step_y, int step_x,
|
||||
int mode)
|
||||
{
|
||||
mseRegion *butPtr = dlg_mouse_mkregion(y, x, height, width, -DLGK_MOUSE(code));
|
||||
butPtr->mode = mode;
|
||||
butPtr->step_x = MAX(1, step_x);
|
||||
butPtr->step_y = MAX(1, step_y);
|
||||
}
|
||||
|
||||
void
|
||||
dlg_mouse_free_regions(void)
|
||||
{
|
||||
while (regionList != 0) {
|
||||
mseRegion *butPtr = regionList->next;
|
||||
free(regionList);
|
||||
regionList = butPtr;
|
||||
}
|
||||
}
|
||||
|
||||
mseRegion *
|
||||
dlg_mouse_mkregion(int y, int x, int height, int width, int code)
|
||||
{
|
||||
mseRegion *butPtr;
|
||||
|
||||
if ((butPtr = find_region_by_code(code)) == 0) {
|
||||
butPtr = dlg_malloc(mseRegion, 1);
|
||||
assert_ptr(butPtr, "dlg_mouse_mkregion");
|
||||
butPtr->next = regionList;
|
||||
regionList = butPtr;
|
||||
}
|
||||
if (butPtr != 0) {
|
||||
butPtr->mode = -1;
|
||||
butPtr->step_x = 0;
|
||||
butPtr->step_y = 0;
|
||||
butPtr->y = basey + y;
|
||||
butPtr->Y = basey + y + height;
|
||||
butPtr->x = basex + x;
|
||||
butPtr->X = basex + x + width;
|
||||
butPtr->code = code;
|
||||
}
|
||||
return butPtr;
|
||||
}
|
||||
|
||||
/* retrieve the frame under the pointer */
|
||||
static mseRegion *
|
||||
any_mouse_region(int y, int x, int small)
|
||||
{
|
||||
mseRegion *butPtr;
|
||||
|
||||
for (butPtr = regionList; butPtr; butPtr = butPtr->next) {
|
||||
if (small ^ (butPtr->code >= 0))
|
||||
continue;
|
||||
if (y < butPtr->y || y >= butPtr->Y)
|
||||
continue;
|
||||
if (x < butPtr->x || x >= butPtr->X)
|
||||
continue;
|
||||
break; /* found */
|
||||
}
|
||||
return butPtr;
|
||||
}
|
||||
|
||||
/* retrieve the frame under the pointer */
|
||||
mseRegion *
|
||||
dlg_mouse_region(int y, int x)
|
||||
{
|
||||
return any_mouse_region(y, x, TRUE);
|
||||
}
|
||||
|
||||
/* retrieve the bigframe under the pointer */
|
||||
mseRegion *
|
||||
dlg_mouse_bigregion(int y, int x)
|
||||
{
|
||||
return any_mouse_region(y, x, FALSE);
|
||||
}
|
||||
|
||||
#else
|
||||
void mouse_dummy(void);
|
||||
void
|
||||
mouse_dummy(void)
|
||||
{
|
||||
}
|
||||
#endif /* USE_MOUSE */
|
91
contrib/dialog/mousewget.c
Normal file
91
contrib/dialog/mousewget.c
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* $Id: mousewget.c,v 1.21 2008/03/16 20:09:03 tom Exp $
|
||||
*
|
||||
* mousewget.c -- mouse/wgetch support for dialog
|
||||
*
|
||||
* Copyright 2000-2006,2008 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
static int
|
||||
mouse_wgetch(WINDOW *win, int *fkey, bool ignore_errs)
|
||||
{
|
||||
int mouse_err = FALSE;
|
||||
int key;
|
||||
|
||||
do {
|
||||
|
||||
key = dlg_getc(win, fkey);
|
||||
|
||||
#if USE_MOUSE
|
||||
|
||||
mouse_err = FALSE;
|
||||
if (fkey && (key == KEY_MOUSE)) {
|
||||
MEVENT event;
|
||||
mseRegion *p;
|
||||
|
||||
if (getmouse(&event) != ERR) {
|
||||
if ((p = dlg_mouse_region(event.y, event.x)) != 0) {
|
||||
key = DLGK_MOUSE(p->code);
|
||||
} else if ((p = dlg_mouse_bigregion(event.y, event.x)) != 0) {
|
||||
int x = event.x - p->x;
|
||||
int y = event.y - p->y;
|
||||
int row = (p->X - p->x) / p->step_x;
|
||||
|
||||
key = -(p->code);
|
||||
switch (p->mode) {
|
||||
case 1: /* index by lines */
|
||||
key += y;
|
||||
break;
|
||||
case 2: /* index by columns */
|
||||
key += (x / p->step_x);
|
||||
break;
|
||||
default:
|
||||
case 3: /* index by cells */
|
||||
key += (x / p->step_x) + (y * row);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
(void) beep();
|
||||
mouse_err = TRUE;
|
||||
}
|
||||
} else {
|
||||
(void) beep();
|
||||
mouse_err = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} while (ignore_errs && mouse_err);
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
int
|
||||
dlg_mouse_wgetch(WINDOW *win, int *fkey)
|
||||
{
|
||||
return mouse_wgetch(win, fkey, TRUE);
|
||||
}
|
||||
|
||||
int
|
||||
dlg_mouse_wgetch_nowait(WINDOW *win, int *fkey)
|
||||
{
|
||||
return mouse_wgetch(win, fkey, FALSE);
|
||||
}
|
183
contrib/dialog/msgbox.c
Normal file
183
contrib/dialog/msgbox.c
Normal file
@ -0,0 +1,183 @@
|
||||
/*
|
||||
* $Id: msgbox.c,v 1.64 2010/01/15 10:50:17 tom Exp $
|
||||
*
|
||||
* msgbox.c -- implements the message box and info box
|
||||
*
|
||||
* Copyright 2000-2009,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*
|
||||
* An earlier version of this program lists as authors:
|
||||
* Savio Lam (lam836@cs.cuhk.hk)
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
/*
|
||||
* Display a message box. Program will pause and display an "OK" button
|
||||
* if the parameter 'pauseopt' is non-zero.
|
||||
*/
|
||||
int
|
||||
dialog_msgbox(const char *title, const char *cprompt, int height, int width,
|
||||
int pauseopt)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
static DLG_KEYS_BINDING binding[] = {
|
||||
ENTERKEY_BINDINGS,
|
||||
DLG_KEYS_DATA( DLGK_ENTER, ' ' ),
|
||||
SCROLLKEY_BINDINGS,
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_DOWN ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_UP ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ),
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
int x, y, last = 0, page;
|
||||
int button = 0;
|
||||
int key = 0, fkey;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
WINDOW *dialog = 0;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
const char **buttons = dlg_ok_label();
|
||||
int offset = 0;
|
||||
int check;
|
||||
bool show = TRUE;
|
||||
int min_width = (pauseopt == 1 ? 12 : 0);
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
int req_high = height;
|
||||
int req_wide = width;
|
||||
restart:
|
||||
#endif
|
||||
|
||||
dlg_button_layout(buttons, &min_width);
|
||||
|
||||
dlg_tab_correct_str(prompt);
|
||||
dlg_auto_size(title, prompt, &height, &width,
|
||||
(pauseopt == 1 ? 2 : 0),
|
||||
min_width);
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
if (dialog != 0)
|
||||
dlg_move_window(dialog, height, width, y, x);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
dlg_register_window(dialog, "msgbox", binding);
|
||||
dlg_register_buttons(dialog, "msgbox", buttons);
|
||||
}
|
||||
page = height - (1 + 3 * MARGIN);
|
||||
|
||||
dlg_mouse_setbase(x, y);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
|
||||
if (pauseopt) {
|
||||
dlg_draw_bottom_box(dialog);
|
||||
mouse_mkbutton(height - 2, width / 2 - 4, 6, '\n');
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
|
||||
while (result == DLG_EXIT_UNKNOWN) {
|
||||
if (show) {
|
||||
last = dlg_print_scrolled(dialog, prompt, offset,
|
||||
page, width, pauseopt);
|
||||
show = FALSE;
|
||||
}
|
||||
key = dlg_mouse_wgetch(dialog, &fkey);
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
break;
|
||||
|
||||
if (!fkey && (check = dlg_char_to_button(key, buttons)) >= 0) {
|
||||
result = check ? DLG_EXIT_HELP : DLG_EXIT_OK;
|
||||
break;
|
||||
}
|
||||
|
||||
if (fkey) {
|
||||
switch (key) {
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
dlg_clear();
|
||||
height = req_high;
|
||||
width = req_wide;
|
||||
show = TRUE;
|
||||
goto restart;
|
||||
#endif
|
||||
case DLGK_FIELD_NEXT:
|
||||
button = dlg_next_button(buttons, button);
|
||||
if (button < 0)
|
||||
button = 0;
|
||||
dlg_draw_buttons(dialog,
|
||||
height - 2, 0,
|
||||
buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
case DLGK_FIELD_PREV:
|
||||
button = dlg_prev_button(buttons, button);
|
||||
if (button < 0)
|
||||
button = 0;
|
||||
dlg_draw_buttons(dialog,
|
||||
height - 2, 0,
|
||||
buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
case DLGK_ENTER:
|
||||
result = button ? DLG_EXIT_HELP : DLG_EXIT_OK;
|
||||
break;
|
||||
case DLGK_MOUSE(0):
|
||||
result = DLG_EXIT_OK;
|
||||
break;
|
||||
case DLGK_MOUSE(1):
|
||||
result = DLG_EXIT_HELP;
|
||||
break;
|
||||
default:
|
||||
if (dlg_check_scrolled(key,
|
||||
last,
|
||||
page,
|
||||
&show,
|
||||
&offset) == 0)
|
||||
break;
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
beep();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dlg_print_scrolled(dialog, prompt, offset, page, width, pauseopt);
|
||||
wrefresh(dialog);
|
||||
result = DLG_EXIT_OK;
|
||||
}
|
||||
|
||||
dlg_del_window(dialog);
|
||||
dlg_mouse_free_regions();
|
||||
free(prompt);
|
||||
return result;
|
||||
}
|
244
contrib/dialog/pause.c
Normal file
244
contrib/dialog/pause.c
Normal file
@ -0,0 +1,244 @@
|
||||
/*
|
||||
* $Id: pause.c,v 1.22 2010/04/28 00:29:50 tom Exp $
|
||||
*
|
||||
* pause.c -- implements the pause dialog
|
||||
*
|
||||
* Copyright 2004-2009,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*
|
||||
* This is adapted from source contributed by
|
||||
* Yura Kalinichenko
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#define MY_TIMEOUT 50
|
||||
|
||||
#define MIN_HIGH (4)
|
||||
#define MIN_WIDE (10 + 2 * (2 + MARGIN))
|
||||
#define BTN_HIGH (1 + 2 * MARGIN)
|
||||
|
||||
/*
|
||||
* This is like gauge, but can be interrupted.
|
||||
*
|
||||
* A pause box displays a meter along the bottom of the box. The meter
|
||||
* indicates how many seconds remain until the end of the pause. The pause
|
||||
* exits when timeout is reached (status OK) or the user presses:
|
||||
* OK button (status OK)
|
||||
* CANCEL button (status CANCEL)
|
||||
* Esc key (status ESC)
|
||||
*
|
||||
*/
|
||||
int
|
||||
dialog_pause(const char *title,
|
||||
const char *cprompt,
|
||||
int height,
|
||||
int width,
|
||||
int seconds)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
static DLG_KEYS_BINDING binding[] = {
|
||||
ENTERKEY_BINDINGS,
|
||||
DLG_KEYS_DATA( DLGK_ENTER, ' ' ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_DOWN ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_UP ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ),
|
||||
DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ),
|
||||
END_KEYS_BINDING
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
int old_height = height;
|
||||
int old_width = width;
|
||||
#endif
|
||||
|
||||
int i, x, y, step;
|
||||
int button = 0;
|
||||
int seconds_orig;
|
||||
WINDOW *dialog;
|
||||
const char **buttons = dlg_ok_labels();
|
||||
bool have_buttons = (dlg_button_count(buttons) != 0);
|
||||
int key = 0, fkey;
|
||||
int result = DLG_EXIT_UNKNOWN;
|
||||
int button_high = (have_buttons ? BTN_HIGH : MARGIN);
|
||||
int guage_y;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
|
||||
curs_set(0);
|
||||
|
||||
dlg_tab_correct_str(prompt);
|
||||
|
||||
seconds_orig = (seconds > 0) ? seconds : 1;
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
retry:
|
||||
height = old_height;
|
||||
width = old_width;
|
||||
#endif
|
||||
|
||||
if (have_buttons) {
|
||||
dlg_auto_size(title, prompt, &height, &width,
|
||||
MIN_HIGH,
|
||||
MIN_WIDE);
|
||||
dlg_button_layout(buttons, &width);
|
||||
} else {
|
||||
dlg_auto_size(title, prompt, &height, &width,
|
||||
MIN_HIGH + MARGIN - BTN_HIGH,
|
||||
MIN_WIDE);
|
||||
}
|
||||
guage_y = height - button_high - (1 + 2 * MARGIN);
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
/* center dialog box on screen */
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
dlg_register_window(dialog, "pause", binding);
|
||||
dlg_register_buttons(dialog, "pause", buttons);
|
||||
|
||||
dlg_mouse_setbase(x, y);
|
||||
nodelay(dialog, TRUE);
|
||||
|
||||
do {
|
||||
(void) werase(dialog);
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
|
||||
dlg_draw_box(dialog,
|
||||
guage_y, 2 + MARGIN,
|
||||
2 + MARGIN, width - 2 * (2 + MARGIN),
|
||||
dialog_attr,
|
||||
border_attr);
|
||||
|
||||
/*
|
||||
* Clear the area for the progress bar by filling it with spaces
|
||||
* in the title-attribute, and write the percentage with that
|
||||
* attribute.
|
||||
*/
|
||||
(void) wmove(dialog, guage_y + MARGIN, 4);
|
||||
wattrset(dialog, title_attr);
|
||||
|
||||
for (i = 0; i < (width - 2 * (3 + MARGIN)); i++)
|
||||
(void) waddch(dialog, ' ');
|
||||
|
||||
(void) wmove(dialog, guage_y + MARGIN, (width / 2) - 2);
|
||||
(void) wprintw(dialog, "%3d", seconds);
|
||||
|
||||
/*
|
||||
* Now draw a bar in reverse, relative to the background.
|
||||
* The window attribute was useful for painting the background,
|
||||
* but requires some tweaks to reverse it.
|
||||
*/
|
||||
x = (seconds * (width - 2 * (3 + MARGIN))) / seconds_orig;
|
||||
if ((title_attr & A_REVERSE) != 0) {
|
||||
wattroff(dialog, A_REVERSE);
|
||||
} else {
|
||||
wattrset(dialog, A_REVERSE);
|
||||
}
|
||||
(void) wmove(dialog, guage_y + MARGIN, 4);
|
||||
for (i = 0; i < x; i++) {
|
||||
chtype ch = winch(dialog);
|
||||
if (title_attr & A_REVERSE) {
|
||||
ch &= ~A_REVERSE;
|
||||
}
|
||||
(void) waddch(dialog, ch);
|
||||
}
|
||||
|
||||
mouse_mkbutton(height - 2, width / 2 - 4, 6, '\n');
|
||||
if (have_buttons) {
|
||||
dlg_draw_bottom_box(dialog);
|
||||
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
|
||||
}
|
||||
(void) wrefresh(dialog);
|
||||
|
||||
for (step = 0;
|
||||
(result == DLG_EXIT_UNKNOWN) && (step < 1000);
|
||||
step += MY_TIMEOUT) {
|
||||
|
||||
napms(MY_TIMEOUT);
|
||||
key = dlg_mouse_wgetch_nowait(dialog, &fkey);
|
||||
if (key == ERR) {
|
||||
; /* ignore errors in nodelay mode */
|
||||
} else {
|
||||
if (dlg_result_key(key, fkey, &result))
|
||||
break;
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
#ifdef KEY_RESIZE
|
||||
case KEY_RESIZE:
|
||||
dlg_clear(); /* fill the background */
|
||||
dlg_del_window(dialog); /* delete this window */
|
||||
refresh(); /* get it all onto the terminal */
|
||||
goto retry;
|
||||
#endif
|
||||
case DLGK_FIELD_NEXT:
|
||||
button = dlg_next_button(buttons, button);
|
||||
if (button < 0)
|
||||
button = 0;
|
||||
dlg_draw_buttons(dialog,
|
||||
height - 2, 0,
|
||||
buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
case DLGK_FIELD_PREV:
|
||||
button = dlg_prev_button(buttons, button);
|
||||
if (button < 0)
|
||||
button = 0;
|
||||
dlg_draw_buttons(dialog,
|
||||
height - 2, 0,
|
||||
buttons, button,
|
||||
FALSE, width);
|
||||
break;
|
||||
case DLGK_ENTER:
|
||||
/* Do not use dlg_exit_buttoncode() since we want to return
|
||||
* a cancel rather than ok if the timeout has not expired.
|
||||
*/
|
||||
result = button ? DLG_EXIT_CANCEL : DLG_EXIT_OK;
|
||||
break;
|
||||
case DLGK_MOUSE(0):
|
||||
result = DLG_EXIT_OK;
|
||||
break;
|
||||
case DLGK_MOUSE(1):
|
||||
result = DLG_EXIT_CANCEL;
|
||||
break;
|
||||
case ERR:
|
||||
break;
|
||||
default:
|
||||
result = DLG_EXIT_OK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while ((result == DLG_EXIT_UNKNOWN) && (seconds-- > 0));
|
||||
|
||||
nodelay(dialog, FALSE);
|
||||
curs_set(1);
|
||||
dlg_mouse_free_regions();
|
||||
dlg_del_window(dialog);
|
||||
free(prompt);
|
||||
return ((result == DLG_EXIT_UNKNOWN) ? DLG_EXIT_OK : result);
|
||||
}
|
32
contrib/dialog/po/POTFILES.in
Normal file
32
contrib/dialog/po/POTFILES.in
Normal file
@ -0,0 +1,32 @@
|
||||
arrows.c
|
||||
buttons.c
|
||||
calendar.c
|
||||
checklist.c
|
||||
dialog.c
|
||||
dialog.h
|
||||
dlg_colors.h
|
||||
dlg_keys.c
|
||||
dlg_keys.h
|
||||
editbox.c
|
||||
formbox.c
|
||||
fselect.c
|
||||
guage.c
|
||||
inputbox.c
|
||||
inputstr.c
|
||||
menubox.c
|
||||
mixedform.c
|
||||
mixedgauge.c
|
||||
mouse.c
|
||||
mousewget.c
|
||||
msgbox.c
|
||||
pause.c
|
||||
progressbox.c
|
||||
rc.c
|
||||
tailbox.c
|
||||
textbox.c
|
||||
timebox.c
|
||||
trace.c
|
||||
ui_getc.c
|
||||
util.c
|
||||
version.c
|
||||
yesno.c
|
111
contrib/dialog/po/ar.po
Normal file
111
contrib/dialog/po/ar.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Arabic translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
# Abdulaziz Al-Arfaj <alarfaj0@yahoo.com>, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2004-07-21 00:22+0300\n"
|
||||
"Last-Translator: Abdulaziz Al-Arfaj <alarfaj0@yahoo.com>\n"
|
||||
"Language-Team: Arabic <support@arabeyes.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.3\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "نعم"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "لا"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "موافق"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "إلغاء"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr ""
|
109
contrib/dialog/po/be@latin.po
Normal file
109
contrib/dialog/po/be@latin.po
Normal file
@ -0,0 +1,109 @@
|
||||
# Dialog
|
||||
# Copyright 2003-2006,2007 # Thomas Dickey
|
||||
# Ihar Hrachyshka <ihar.hrachyshka@gmail.com>, 2007.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2007-12-03 01:13+0200\n"
|
||||
"Last-Translator: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>\n"
|
||||
"Language-Team: Belarusian (Latin script) <translation-team-be-latin@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Tak"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Nie"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Anuluj"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "VYCHAD"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Dadatkova"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Dapamoha"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Miesiac"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Hod"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Źmiani nazvu"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Katalohi"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Fajły"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Paśpiachova"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Niaŭdała"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Projdziena"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Skončana"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Pravierana"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Zroblena"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Abminuta"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Dziejničaje"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Niama"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Ahulny prahres"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Šukaj"
|
111
contrib/dialog/po/bg.po
Normal file
111
contrib/dialog/po/bg.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Bulgarian translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
# Ognyan Kulev <ogi@fmi.uni-sofia.bg>, 2004.
|
||||
#
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2004-09-13 09:02+0300\n"
|
||||
"Last-Translator: Ognyan Kulev <ogi@fmi.uni-sofia.bg>\n"
|
||||
"Language-Team: Bulgarian <dict@linux.zonebg.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Да"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Не"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Отказ"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr ""
|
110
contrib/dialog/po/ca.po
Normal file
110
contrib/dialog/po/ca.po
Normal file
@ -0,0 +1,110 @@
|
||||
# Catalan translation of Dialog.
|
||||
# Copyright © 2004, 2005, 2008 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same licence as the dialog package.
|
||||
# Jordi Mallach <jordi@debian.org>, 2004, 2005, 2008.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-07-20 14:31-0400\n"
|
||||
"PO-Revision-Date: 2008-06-10 00:50+0200\n"
|
||||
"Last-Translator: Jordi Mallach <jordi@gnu.org>\n"
|
||||
"Language-Team: Catalan <ca@dodds.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Sí"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "D'acord"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Cancel·la"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "SURT"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Ajuda"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mes"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Any"
|
||||
|
||||
#: dialog.c:744
|
||||
msgid "Rename"
|
||||
msgstr "Canvia el nom"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Directoris"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Fitxers"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Ha tingut èxit"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Ha fallat"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Ha passat"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "S'ha completat"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Activat"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Fet"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Omès"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "En progrés"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/D"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Progrés general"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Cerca"
|
108
contrib/dialog/po/cs.po
Normal file
108
contrib/dialog/po/cs.po
Normal file
@ -0,0 +1,108 @@
|
||||
# From: Martin Povolny <martin@solnet.cz>
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 0.9a-20010527\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2004-12-19 20:14-0500\n"
|
||||
"Last-Translator: Martin Povolny <martin@solnet.cz>\n"
|
||||
"Language-Team:\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Ano"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Ne"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Storno"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Konec"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Měsíc"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Rok"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Adresáře"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Soubory"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "Soubory"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Search"
|
110
contrib/dialog/po/cy.po
Normal file
110
contrib/dialog/po/cy.po
Normal file
@ -0,0 +1,110 @@
|
||||
# Dialog
|
||||
# Copyright 2003,2004 # Thomas Dickey
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2004-03-30 23:00+0100\n"
|
||||
"Last-Translator: Dafydd Harries <daf@muse.19inch.net>\n"
|
||||
"Language-Team: Welsh <cy@pengwyn.linux.org.uk>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Ie"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Na"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Iawn"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Diddymu"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "GADAEL"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Ychwanegol"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Cymorth"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mis"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Blwyddyn"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Ailenwy"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Cyfeiriaduron"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Ffeiliau"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "Ffeiliau"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Search"
|
111
contrib/dialog/po/da.po
Normal file
111
contrib/dialog/po/da.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Danish translation of Dialog.
|
||||
# Copyright (C) 2001-2007 Thomas Dickey.
|
||||
# This file is distributed under the same license as the Dialog package.
|
||||
# Morten Brix Pedersen <morten@wtf.dk>, 2001-2004.
|
||||
# Joe Hansen <joedalton2@yahoo.dk>, 2008.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog-1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2009-02-22 07:05-0500\n"
|
||||
"PO-Revision-Date: 2008-08-20 22:53+0200\n"
|
||||
"Last-Translator: Keld Jørn Simonsen <keld@dkuug.dk>\n"
|
||||
"Language-Team: Danish <dansk@dansk-gruppen.dk>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Ja"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Nej"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "O.K."
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Anullér"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "AFSLUT"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Ekstra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Hjælp"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Måned"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "År"
|
||||
|
||||
#: dialog.c:744
|
||||
msgid "Rename"
|
||||
msgstr "Omdøb"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Kataloger"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Filer"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Lykkedes"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Mislykkedes"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Bestod"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Færdig"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Kontrolleret"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Færdig"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Sprunget over"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "I gang"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/A"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Samlet status"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Søg"
|
111
contrib/dialog/po/de.po
Normal file
111
contrib/dialog/po/de.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Dialog
|
||||
# Copyright 2001, # Thomas Dickey
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
#
|
||||
# Michael Piefel <piefel@informatik.hu-berlin.de>, 2002.
|
||||
# Roland Illig <roland.illig@gmx.de>, 2009.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20080819\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2009-11-08 23:48+0100\n"
|
||||
"Last-Translator: Roland Illig <roland.illig@gmx.de>\n"
|
||||
"Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Ja"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Nein"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Abbrechen"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "VERLASSEN"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Hilfe"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Monat"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Jahr"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Bearbeiten"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Verzeichnisse"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Dateien"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Erfolgreich"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Fehlgeschlagen"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Bestanden"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Abgeschlossen"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Geprüft"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Erledigt"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Übersprungen"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "In Bearbeitung"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/A"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Gesamtfortschritt"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Suche"
|
109
contrib/dialog/po/dialog.pot
Normal file
109
contrib/dialog/po/dialog.pot
Normal file
@ -0,0 +1,109 @@
|
||||
# Dialog
|
||||
# Copyright 2003-2007,2008 # Thomas Dickey
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20080316\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr ""
|
107
contrib/dialog/po/el.po
Normal file
107
contrib/dialog/po/el.po
Normal file
@ -0,0 +1,107 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2002-06-05 10:00GMT+2\n"
|
||||
"Last-Translator: kromJx <kromJx@crosswinds.net>\n"
|
||||
"Language-Team: <i18ngr@hellug.gr>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Ναι"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Όχι"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Άκυρο"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Έξοδος"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Βοήθεια"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Μήνας"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Έτος"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Φάκελοι"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Αρχεία"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "Αρχεία"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Search"
|
109
contrib/dialog/po/eo.po
Normal file
109
contrib/dialog/po/eo.po
Normal file
@ -0,0 +1,109 @@
|
||||
# Esperanto translation of Dialog
|
||||
# Copyright (C) 2008 Felipe Castro
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Felipe Castro <fefcas@gmail.com>, 2008
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2007-02-25 16:06-0500\n"
|
||||
"PO-Revision-Date: 2008-08-03 15:50-0300\n"
|
||||
"Last-Translator: Felipe Castro <fefcas@gmail.com>\n"
|
||||
"Language-Team: Esperanto <translation-team-eo@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:379
|
||||
msgid "Yes"
|
||||
msgstr "Jes"
|
||||
|
||||
#: buttons.c:387
|
||||
msgid "No"
|
||||
msgstr "Ne"
|
||||
|
||||
#: buttons.c:395
|
||||
msgid "OK"
|
||||
msgstr "Certe"
|
||||
|
||||
#: buttons.c:403
|
||||
msgid "Cancel"
|
||||
msgstr "Rezigni"
|
||||
|
||||
#: buttons.c:411
|
||||
msgid "EXIT"
|
||||
msgstr "ELIRI"
|
||||
|
||||
#: buttons.c:419
|
||||
msgid "Extra"
|
||||
msgstr "Krome"
|
||||
|
||||
#: buttons.c:427
|
||||
msgid "Help"
|
||||
msgstr "Helpo"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Monato"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Jaro"
|
||||
|
||||
#: dialog.c:727
|
||||
msgid "Rename"
|
||||
msgstr "Renomigi"
|
||||
|
||||
#: fselect.c:548
|
||||
msgid "Directories"
|
||||
msgstr "Dosierujoj"
|
||||
|
||||
#: fselect.c:549
|
||||
msgid "Files"
|
||||
msgstr "Dosieroj"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Sukcesis"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Malsukcesis"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Pasite"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Kompletite"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Kontrolite"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Farite"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Preterpasite"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Evoluado"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/A"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Tuta Evoluo"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Serĉi"
|
111
contrib/dialog/po/es.po
Normal file
111
contrib/dialog/po/es.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Mensajes en español para dialog.
|
||||
# Copyright (C) 2001, 2003, 2004 Thomas Dickey.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Santiago Vila Doncel <sanvila@unex.es>, 2001, 2003, 2004, 2010.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20080819\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2010-02-14 14:26+0100\n"
|
||||
"Last-Translator: Santiago Vila Doncel <sanvila@unex.es>\n"
|
||||
"Language-Team: Spanish <es@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Sí"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Aceptar"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Salir"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Ayuda"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mes"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Año"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Renombrar"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Directorios"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Ficheros"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Finalizado con éxito"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Falló"
|
||||
|
||||
# Esta no me convence mucho. Se admiten sugerencias
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Pasado"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Completado"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Comprobado"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Hecho"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Saltado"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "En progreso"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/A"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Progreso total"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Buscar"
|
110
contrib/dialog/po/et.po
Normal file
110
contrib/dialog/po/et.po
Normal file
@ -0,0 +1,110 @@
|
||||
# Dialog
|
||||
# Copyright 2001, Thomas Dickey
|
||||
# Copyright 2001, Ivar Smolin
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2001-09-08 00:05+0200\n"
|
||||
"Last-Translator: Ivar Smolin <okul@linux.ee>\n"
|
||||
"Language-Team: Estonian <et@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Jah"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Ei"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Tühista"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Lõpeta"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Kuu"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Aasta"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Kataloogid"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Failid"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "Failid"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Otsingu"
|
111
contrib/dialog/po/eu.po
Normal file
111
contrib/dialog/po/eu.po
Normal file
@ -0,0 +1,111 @@
|
||||
# translation of dialog-1.1.20070704.po to Euskara
|
||||
# Dialog
|
||||
# Copyright 2003,2004 # Thomas Dickey
|
||||
#
|
||||
# Piarres Beobide Egaña <pi@beobide.net>, 2004, 2007.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog-1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2007-09-20 00:01+0200\n"
|
||||
"Last-Translator: Piarres Beobide <pi@beobide.net>\n"
|
||||
"Language-Team: Basque <translation-team-eu@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.11.4\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Bai"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Ez"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Ados"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Utzi"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "IRTEN"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Gehigarria"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Laguntza"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Hilabetea"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Urtea"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Berizendatu"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Direktorioak"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Fitxategiak"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Lortua"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Huts eginda"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Pasata"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Osatua"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Egiaztatua"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Eginda"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Salto eginda"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Aurrerakuntza"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "E/G"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Aurrerapen nagusia"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Bilaketa"
|
111
contrib/dialog/po/fi.po
Normal file
111
contrib/dialog/po/fi.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Finnish translation for dialog.
|
||||
# Copyright © 2005 Lauri Nurmi <lanurmi@iki.fi>
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Lauri Nurmi <lanurmi@iki.fi>, 2005.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2005-03-07 19:15+0200\n"
|
||||
"Last-Translator: Lauri Nurmi <lanurmi@iki.fi>\n"
|
||||
"Language-Team: Finnish <translation-team-fi@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Kyllä"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Ei"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Peru"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Poistu"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Painike"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Ohje"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Kuukausi"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Vuosi"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Nimeä"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Kansiot"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Tiedostot"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "Tiedostot"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Etsi"
|
110
contrib/dialog/po/fr.po
Normal file
110
contrib/dialog/po/fr.po
Normal file
@ -0,0 +1,110 @@
|
||||
# French translation of Dialog.
|
||||
# Copyright (C) 2001 Thomas Dickey.
|
||||
# Frédéric L. W. Meunier <0 @ pervalidus.net>, 2001.
|
||||
# François-Xavier Coudert <fxcoudert@gmail.com>, 2008.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2008-03-28 23:14+0000\n"
|
||||
"Last-Translator: François-Xavier Coudert <fxcoudert@gmail.com>\n"
|
||||
"Language-Team: French <traduc@traduc.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Oui"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Non"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Accepter"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Annuler"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "SORTIR"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Aide"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mois"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Année"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Renommer"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Répertoires"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Fichiers"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Succès"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Échec"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Passé"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Terminé"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Vérifié"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Fini"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Ignoré"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "En cours"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/A"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Avancement général"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Rechercher"
|
108
contrib/dialog/po/ga.po
Normal file
108
contrib/dialog/po/ga.po
Normal file
@ -0,0 +1,108 @@
|
||||
# Dialog
|
||||
# Copyright 2003,2004 # Thomas Dickey
|
||||
# Kevin Patrick Scannell <scannell@SLU.EDU>, 2005, 2007.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2007-07-20 11:57-0500\n"
|
||||
"Last-Translator: Kevin Scannell <kscanne@gmail.com>\n"
|
||||
"Language-Team: Irish <gaeilge-gnulinux@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Tá"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Níl"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Cealaigh"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "SCOIR"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Breise"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Cabhair"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mí"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Bliain"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Athainmnigh"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Comhadlanna"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Comhaid"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "D'éirigh leis"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Teipthe"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Ceadaithe"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Críochnaithe"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Deimhnithe"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Déanta"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Scipeáilte"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Faoi Shiúl"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/A/F"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Dul Chun Cinn Iomlán"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Cuardaigh"
|
110
contrib/dialog/po/gl.po
Normal file
110
contrib/dialog/po/gl.po
Normal file
@ -0,0 +1,110 @@
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Mensaxes en galego para dialog.
|
||||
# Copyright 2003-2006,2007 Thomas Dickey
|
||||
# Diego Pérez Montes <kabute@gulo.org>, 2008
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2008-05-13 23:57+0100\n"
|
||||
"Last-Translator: Diego Pérez Montes <kabute@gulo.org>\n"
|
||||
"Language-Team: Galician <proxecto@trasno.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Sí"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Non"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Aceptar"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "SAÍR"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Suplementario"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Axuda"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mes"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Ano"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Renomear"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Directorios"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Ficheiros"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Conseguido"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Fallou"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Correcto"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Completado"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Seleccionado"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Feito"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Omitido"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "En Progreso"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Non Dispoñible"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Progreso Total"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Procurar"
|
112
contrib/dialog/po/hi.po
Normal file
112
contrib/dialog/po/hi.po
Normal file
@ -0,0 +1,112 @@
|
||||
# Hindi translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2007-07-18 11:06+0200\n"
|
||||
"Last-Translator: Deepika Mangla <deepika.mangla@gmail.com>\n"
|
||||
"Language-Team: <elinks@knopper.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: 2\n"
|
||||
"X-Poedit-Language: Hindi\n"
|
||||
"X-Poedit-Country: INDIA\n"
|
||||
"X-Generator: KBabel 1.11.4\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "à€¹à€Ÿà€"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "à€šà€¹à¥à€"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "à€ à¥à€"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "à€°à€Šà¥à€Š à€à€°à¥à€"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "à€šà€¿à€°à¥à€à€®"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "à€
à€€à€¿à€°à€¿à€à¥à€€"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "à€®à€Šà€Š"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "à€®à€¹à¥à€šà€Ÿ"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "à€µà€°à¥à€·"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "à€ªà¥à€šà€à€šà€Ÿà€®à€à€°à€£"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "à€šà€¿à€°à¥à€Šà¥à€¶à€¿à€à€Ÿ"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "à€žà€à€à€¿à€à€Ÿ"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "à€žà€«à€²"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "à€žà€«à€²"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "à€ªà€Ÿà€ž"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "à€žà€®à¥à€ªà¥à€°à€¿à€€"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "à€
à€µà€°à¥à€Šà¥à€§"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "à€žà€«à€² "
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "à€à¥à€¡à€Œ à€Šà€¿à€¯à€Ÿ"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "à€ªà¥à€°à€à€€à€¿ à€®à¥à€ à€¹à¥"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "à€²à€Ÿà€à¥ à€šà€¹à¥à€"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "à€žà€®à€à¥à€° à€ªà¥à€°à€à€€à€¿"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "à€
à€šà¥à€žà€šà¥à€§à€Ÿà€š"
|
109
contrib/dialog/po/hr.po
Normal file
109
contrib/dialog/po/hr.po
Normal file
@ -0,0 +1,109 @@
|
||||
# Croatian translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2004-07-25 14:52+0200\n"
|
||||
"Last-Translator: Krunoslav Gernhard <kruno@linux.hr>\n"
|
||||
"Language-Team: Croatian <lokalizacija@linux.hr>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Da"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Ne"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "U redu"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Otkaži"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr ""
|
111
contrib/dialog/po/hu.po
Normal file
111
contrib/dialog/po/hu.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Dialog
|
||||
# Copyright 2003, # Thomas Dickey
|
||||
# Arpad Biro <biro_arpad@yahoo.com>, 2003
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2005-02-02 08:21+0100\n"
|
||||
"Last-Translator: Németh Csaba <csaba@sopron.hu>\n"
|
||||
"Language-Team: Hungarian <translation-team-hu@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.0.1\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Igen"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Nem"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Mégsem"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "KILÉPÉS"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Súgó"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Hónap"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Év"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Átnevezés"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Könyvtárak"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Fájlok"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "Fájlok"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Keresés"
|
110
contrib/dialog/po/id.po
Normal file
110
contrib/dialog/po/id.po
Normal file
@ -0,0 +1,110 @@
|
||||
# Indonesian translations for dialog package.
|
||||
# Copyright 2003-2006,2007 # Thomas Dickey.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Andhika Padmawan <andhika.padmawan@gmail.com>, 2008.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20080819\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2009-03-29 19:30-0400\n"
|
||||
"PO-Revision-Date: 2008-07-21 13:40+0700\n"
|
||||
"Last-Translator: Andhika Padmawan <andhika.padmawan@gmail.com>\n"
|
||||
"Language-Team: Indonesian <translation-team-id@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Ya"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Tidak"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Batal"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "KELUAR"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Ekstra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Bantuan"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Bulan"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Tahun"
|
||||
|
||||
#: dialog.c:744
|
||||
msgid "Rename"
|
||||
msgstr "Ganti Nama"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Kamus"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Berkas"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Sukses"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Gagal"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Lulus"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Selesai"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Diperiksa"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Selesai"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Dilewati"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Dalam Proses"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Tak Tersedia"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Keseluruhan Proses"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Telusur"
|
111
contrib/dialog/po/is.po
Normal file
111
contrib/dialog/po/is.po
Normal file
@ -0,0 +1,111 @@
|
||||
# translation of dialog-1.1.20080819.po to Icelandic
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright 2003-2007,2008 Thomas Dickey
|
||||
#
|
||||
# Sveinn í Felli <sveinki@nett.is>, 2009.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog-1.1.20080819\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2009-09-03 17:02+0000\n"
|
||||
"Last-Translator: Sveinn í Felli <sveinki@nett.is>\n"
|
||||
"Language-Team: Icelandic <(nothing)>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.11.4\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Já"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Nei"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Í lagi"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Hætta við"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "LOKA"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Auka"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Hjálp"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mánuður"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Ár"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Endurnefna"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Möppur"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Skrár"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Tókst"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Mistókst"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Stóðst prófun"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Fullgert"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Athugað"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Lokið"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Sleppt"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Í vinnslu"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Ekki tiltækt"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Heildarframvinda"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Leita"
|
111
contrib/dialog/po/it.po
Normal file
111
contrib/dialog/po/it.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Italian messages for dialog.
|
||||
# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Marco Colombo <m.colombo@ed.ac.uk>, 2005, 2007.
|
||||
# Marco Mariani <marcom@sferacarta.com>, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2007-08-06 15:47+0100\n"
|
||||
"Last-Translator: Marco Colombo <m.colombo@ed.ac.uk>\n"
|
||||
"Language-Team: Italian <tp@lists.linux.it>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Sì"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "No"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Annulla"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Esci"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Aiuto"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mese"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Anno"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Rinomina"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Cartelle"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "File"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Riuscito"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Fallito"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Superato"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Completato"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Controllato"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Fatto"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Saltato"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "In corso"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/A"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Progresso complessivo"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Ricerca"
|
111
contrib/dialog/po/ja.po
Normal file
111
contrib/dialog/po/ja.po
Normal file
@ -0,0 +1,111 @@
|
||||
# dialog Japanese po file.
|
||||
# Copyright 2000, Thomas Dickey
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Hirofumi Takeda <takepin@turbolinux.co.jp>, 2000.
|
||||
# Takeshi Hamasaki <hmatrjp@users.sourceforge.jp>, 2008.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-07-27 18:05-0400\n"
|
||||
"PO-Revision-Date: 2008-07-24 00:12+0900\n"
|
||||
"Last-Translator: Takeshi Hamasaki <hmatrjp@users.sourceforge.jp>\n"
|
||||
"Language-Team: Japanese <translation-team-ja@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=EUC-JP\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "はい"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "いいえ"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "了解"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "取消"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "終了"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "拡張"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "ヘルプ"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "月"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "年"
|
||||
|
||||
#: dialog.c:744
|
||||
msgid "Rename"
|
||||
msgstr "名前変更"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "ディレクトリ"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "ファイル"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "成功"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "失敗"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "パス"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "完了"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "確認終了"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "終了"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "スキップ"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "処理中"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "無効"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "全体の進行状況"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "調査"
|
112
contrib/dialog/po/ku.po
Normal file
112
contrib/dialog/po/ku.po
Normal file
@ -0,0 +1,112 @@
|
||||
# Dialog
|
||||
# Copyright 2003-2006,2007 # Thomas Dickey
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
#
|
||||
# Erdal Ronahi <erdal.ronahi@gmail.com>, 2008.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2008-04-25 16:51+0200\n"
|
||||
"Last-Translator: Erdal Ronahi <erdal.ronahi@gmail.com>\n"
|
||||
"Language-Team: Kurdish <translation-team-ku@ferheng.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KAider 0.1\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Erê"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Na"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "TEMAM"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Betal"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "DERKETIN"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Ekstra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Alîkarî"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Meh"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Sal"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Nav guherandin"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Peldank"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Pel"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Biserket"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Biserneket"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Derbas bû"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Temamkirî"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Kontrolkirî"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Xelas"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Derbaskirî"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Didome"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Tune"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Pêşketina Giştî"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Lêgerîn"
|
111
contrib/dialog/po/lt.po
Normal file
111
contrib/dialog/po/lt.po
Normal file
@ -0,0 +1,111 @@
|
||||
# translation of dialog-1.1.20070704 to Lithuanian
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
#
|
||||
# Gintautas Miliauskas <gintas@akl.lt>, 2008.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog-1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2008-05-14 02:51+0300\n"
|
||||
"Last-Translator: Gintautas Miliauskas <gintas@akl.lt>\n"
|
||||
"Language-Team: Lithuanian <komp_lt@konferencijos.lt>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.11.4\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Taip"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Ne"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Atmesti"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "IŠEITI"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Papildoma"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Žinynas"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mėnuo"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Metai"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Pervadinti"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Aplankai"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Failai"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Sėkminga"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Nesėkminga"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Praėjo"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Baigta"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Patikrinta"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Baigta"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Peršokta"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Vykdoma"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/d"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Bendras progresas"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Ieškoti"
|
113
contrib/dialog/po/lv.po
Normal file
113
contrib/dialog/po/lv.po
Normal file
@ -0,0 +1,113 @@
|
||||
# Dialog
|
||||
# Copyright 2003-2007,2008 # Thomas Dickey
|
||||
#
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
#
|
||||
# Rihards Prieditis <RPrieditis@inbox.lv>, 2009.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20080819\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2009-04-11 20:50+0300\n"
|
||||
"Last-Translator: Rihards Prieditis <RPrieditis@inbox.lv>\n"
|
||||
"Language-Team: Latvian <translation-team-lv@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Lokalize 0.3\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Jā"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Nē"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Labi"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Atcelt"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "IZIET"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Papildus"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Palīdzība"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mēnesis"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Gads"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Pārdēvēt"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Direktorijas"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Faili"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Izdevies"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Neizdevies"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Iziets"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Pabeigts"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Pārbaudīts"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Pabeigts"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Izlaists"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Tiek apstrādāts"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "n/z"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Vispārējais progress"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Meklēt"
|
261
contrib/dialog/po/makefile.inn
Normal file
261
contrib/dialog/po/makefile.inn
Normal file
@ -0,0 +1,261 @@
|
||||
# Makefile for program source directory in GNU NLS utilities package.
|
||||
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
||||
#
|
||||
# This file may be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
SHELL = /bin/sh
|
||||
@SET_MAKE@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datadir = $(prefix)/@DATADIRNAME@
|
||||
localedir = $(datadir)/locale
|
||||
gnulocaledir = $(prefix)/share/locale
|
||||
gettextsrcdir = $(prefix)/share/gettext/po
|
||||
subdir = po
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
DESTDIR = @DESTDIR@
|
||||
|
||||
CC = @CC@
|
||||
GENCAT = @GENCAT@
|
||||
GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
|
||||
MSGFMT = @MSGFMT@
|
||||
XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
|
||||
MSGMERGE = PATH=../src:$$PATH msgmerge
|
||||
|
||||
DEFS = @DEFS@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
|
||||
INCLUDES = -I.. -I$(top_srcdir)/intl
|
||||
|
||||
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
|
||||
|
||||
SOURCES = @INTLDIR_MAKE@ cat-id-tbl.c
|
||||
POFILES = @POFILES@
|
||||
GMOFILES = @GMOFILES@
|
||||
DISTFILES = ChangeLog makefile.inn POTFILES.in $(PACKAGE).pot \
|
||||
stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
|
||||
|
||||
POTFILES = \
|
||||
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) $<
|
||||
|
||||
.po.pox:
|
||||
$(MAKE) $(PACKAGE).pot
|
||||
$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
|
||||
|
||||
.po.mo:
|
||||
$(MSGFMT) -o $@ $<
|
||||
|
||||
.po.gmo:
|
||||
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
|
||||
&& rm -f $$file && $(GMSGFMT) -o $$file $<
|
||||
|
||||
.po.cat:
|
||||
sed -f ../intl/po2msg.sed < $< > $*.msg \
|
||||
&& rm -f $@ && $(GENCAT) $@ $*.msg
|
||||
|
||||
|
||||
all: all-@USE_NLS@
|
||||
|
||||
all-yes: $(SOURCES) $(CATALOGS)
|
||||
all-no:
|
||||
|
||||
$(srcdir)/$(PACKAGE).pot: $(POTFILES)
|
||||
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
|
||||
--add-comments --keyword=_ --keyword=N_ \
|
||||
--files-from=$(srcdir)/POTFILES.in \
|
||||
&& test ! -f $(PACKAGE).po \
|
||||
|| ( rm -f $(srcdir)/$(PACKAGE).pot \
|
||||
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
|
||||
|
||||
$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
|
||||
$(srcdir)/stamp-cat-id: $(PACKAGE).pot
|
||||
rm -f cat-id-tbl.tmp
|
||||
sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
|
||||
| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
|
||||
if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
|
||||
rm cat-id-tbl.tmp; \
|
||||
else \
|
||||
echo cat-id-tbl.c changed; \
|
||||
rm -f $(srcdir)/cat-id-tbl.c; \
|
||||
mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
|
||||
fi
|
||||
cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
|
||||
|
||||
|
||||
install install-full: install-exec install-data
|
||||
install-exec:
|
||||
install-data: install-data-@USE_NLS@
|
||||
install-data-no: all
|
||||
install-data-yes: all
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
|
||||
else \
|
||||
mkdir -p $(DESTDIR)$(datadir); \
|
||||
fi
|
||||
@catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
case "$$cat" in \
|
||||
*.gmo) destdir=$(gnulocaledir);; \
|
||||
*) destdir=$(localedir);; \
|
||||
esac; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $$dir; \
|
||||
else \
|
||||
mkdir -p $$dir; \
|
||||
fi; \
|
||||
if test -r $$cat; then \
|
||||
$(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
|
||||
else \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
echo "installing $(srcdir)/$$cat as" \
|
||||
"$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
|
||||
fi; \
|
||||
if test -r $$cat.m; then \
|
||||
$(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
|
||||
else \
|
||||
if test -r $(srcdir)/$$cat.m ; then \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat.m \
|
||||
$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
echo "installing $(srcdir)/$$cat as" \
|
||||
"$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
|
||||
else \
|
||||
true; \
|
||||
fi; \
|
||||
fi; \
|
||||
done
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
|
||||
else \
|
||||
mkdir -p $(DESTDIR)$(gettextsrcdir); \
|
||||
fi; \
|
||||
$(INSTALL_DATA) $(srcdir)/makefile.inn \
|
||||
$(DESTDIR)$(gettextsrcdir)/makefile.inn; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
# Define this as empty until I find a useful application.
|
||||
installcheck:
|
||||
|
||||
uninstall:
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
|
||||
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
done
|
||||
rm -f $(gettextsrcdir)/po-makefile.inn
|
||||
|
||||
check: all
|
||||
|
||||
cat-id-tbl.o: ../intl/libgettext.h
|
||||
|
||||
dvi info tags TAGS ID:
|
||||
|
||||
mostlyclean:
|
||||
rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
|
||||
rm -fr *.o
|
||||
|
||||
clean: mostlyclean
|
||||
|
||||
distclean: clean
|
||||
rm -f cat-id-tbl.c stamp-cat-id *.gmo
|
||||
rm -f makefile makefile.in POTFILES *.mo *.msg *.cat *.cat.m
|
||||
|
||||
maintainer-clean: distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
rm -f $(GMOFILES)
|
||||
|
||||
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
dist distdir: update-po $(DISTFILES)
|
||||
dists="$(DISTFILES)"; \
|
||||
for file in $$dists; do \
|
||||
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|
||||
|| cp -p $(srcdir)/$$file $(distdir); \
|
||||
done
|
||||
|
||||
# GNU msgfmt -C option can also check for X/Open compat.
|
||||
check-po:
|
||||
cd $(srcdir); \
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
echo "$$lang:"; \
|
||||
$(MSGFMT) -f -c -v $$lang.po; \
|
||||
done
|
||||
|
||||
update-po: makefile
|
||||
$(MAKE) $(PACKAGE).pot
|
||||
PATH=`pwd`/../src:$$PATH; \
|
||||
cd $(srcdir); \
|
||||
catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
cat=`basename $$cat`; \
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
mv $$lang.po $$lang.old.po; \
|
||||
echo "$$lang:"; \
|
||||
if $(MSGMERGE) -w 132 $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
|
||||
rm -f $$lang.old.po; \
|
||||
else \
|
||||
echo "msgmerge for $$cat failed!"; \
|
||||
rm -f $$lang.po; \
|
||||
mv $$lang.old.po $$lang.po; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
POTFILES: POTFILES.in
|
||||
( if test 'x$(srcdir)' != 'x.'; then \
|
||||
posrcprefix='$(top_srcdir)/'; \
|
||||
else \
|
||||
posrcprefix="../"; \
|
||||
fi; \
|
||||
rm -f $@-t $@ \
|
||||
&& (sed -e '/^#/d' -e '/^[ ]*$$/d' \
|
||||
-e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
|
||||
| sed -e '$$s/\\$$//') > $@-t \
|
||||
&& chmod a-w $@-t \
|
||||
&& mv $@-t $@ )
|
||||
|
||||
makefile: makefile.inn ../config.status POTFILES
|
||||
cd .. \
|
||||
&& CONFIG_FILES=$(subdir)/$@.in:$(subdir)/$@.inn CONFIG_HEADERS= \
|
||||
$(SHELL) ./config.status
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
110
contrib/dialog/po/mg.po
Normal file
110
contrib/dialog/po/mg.po
Normal file
@ -0,0 +1,110 @@
|
||||
# Malagasy translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2004-11-21 17:33+0100\n"
|
||||
"Last-Translator: Jaonary Rabarisoa <jaonary@ifrance.fr>\n"
|
||||
"Language-Team: <en@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.9.1\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Eny"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Tsia"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Ekena"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Ajanony"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr ""
|
111
contrib/dialog/po/mk.po
Normal file
111
contrib/dialog/po/mk.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Macedonian translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
# Georgi Stanojevski <glisha@gmail.com>, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2004-10-10 00:18+0200\n"
|
||||
"Last-Translator: Georgi Stanojevski <glisha@gmail.com>\n"
|
||||
"Language-Team: <ossm-members@hedona.on.net.mk>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.3.1\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Да"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Не"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Во ред"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Откажи"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr ""
|
109
contrib/dialog/po/ms.po
Normal file
109
contrib/dialog/po/ms.po
Normal file
@ -0,0 +1,109 @@
|
||||
# Dialog Bahasa Melayu (Malay) (ms)
|
||||
# Copyright 2003,2004 # Thomas Dickey
|
||||
# Sharuzzaman Ahmat Raslan <sharuzzaman@myrealbox.com>, 2005, 2006, 2007
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2007-08-14 01:22+0800\n"
|
||||
"Last-Translator: Sharuzzaman Ahmat Raslan <sharuzzaman@myrealbox.com>\n"
|
||||
"Language-Team: Malay <translation-team-ms@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Ya"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Tidak"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Batal"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "KELUAR"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Ekstra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Bantuan"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Bulan"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Tahun"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Tukar nama"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Direktori"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Fail"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Berjaya"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Gagal"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Lulus"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Selesai"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Diperiksa"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Selesai"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Dilangkau"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Sedang Dilaksanakan"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Tiada"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Kemajuan Keseluruhan"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Cari"
|
108
contrib/dialog/po/nb.po
Normal file
108
contrib/dialog/po/nb.po
Normal file
@ -0,0 +1,108 @@
|
||||
# Dialog
|
||||
# Copyright 2003-2006,2007 # Thomas Dickey
|
||||
# Roy Hvaara <roy.hvaara@gmail.com>, 2008.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2008-03-24 14:00+0100\n"
|
||||
"Last-Translator: Roy Hvaara <roy.hvaara@gmail.com>\n"
|
||||
"Language-Team: Norwegian Bokmaal <i18n-nb@lister.ping.uio.no>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Ja"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Nei"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Avbryt"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "AVSLUTT"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Ekstra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Hjelp"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Måned"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "År"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Endre navn"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Mapper"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Filer"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Vellykktes"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Feilet"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Bestått"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Fullført"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Kontrollert"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Ferdig"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Ignorert"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "I gang"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "-"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Total fremdrift"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Søk"
|
112
contrib/dialog/po/nl.po
Normal file
112
contrib/dialog/po/nl.po
Normal file
@ -0,0 +1,112 @@
|
||||
# Translation of dialog-1.1.20070704 to Dutch.
|
||||
# Copyright 2003-2006,2007 # Thomas Dickey
|
||||
#
|
||||
# Jacques Weewer <j.weewer_at_chello.nl>, 2004.
|
||||
# Luk Claes <luk.claes@ugent.be>, 2005.
|
||||
# Benno Schulenberg <benno@vertaalt.nl>, 2007.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog-1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2007-10-08 12:42+0200\n"
|
||||
"Last-Translator: Benno Schulenberg <benno@vertaalt.nl>\n"
|
||||
"Language-Team: Dutch <vertaling@vrijschrift.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.11.4\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Ja"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Nee"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Annuleren"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Afsluiten"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Help"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Maand"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Jaar"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Hernoemen"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Mappen"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Bestanden"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Gelukt"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Mislukt"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Geslaagd"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Voltooid"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Gecontroleerd"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Klaar"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Overgeslagen"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Bezig"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Onbeschikbaar"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Voortgang"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Zoeken"
|
112
contrib/dialog/po/pl.po
Normal file
112
contrib/dialog/po/pl.po
Normal file
@ -0,0 +1,112 @@
|
||||
# translation of dialog.po to Polish
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Jaroslaw Swierczynski <swiergot@intersec.pl>, 2003
|
||||
# Michał Trzebiatowski <hippie_1968@hotmail.com>, 2009
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20080819\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2009-03-29 19:30-0400\n"
|
||||
"PO-Revision-Date: 2009-03-11 10:32+0100\n"
|
||||
"Last-Translator: Michał Trzebiatowski <hippie_1968@hotmail.com>\n"
|
||||
"Language-Team: Polish <translation-team-pl@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Polish\n"
|
||||
"X-Poedit-Country: POLAND\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Tak"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Nie"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Anuluj"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "WYJDŹ"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Ekstra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Pomoc"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Miesiąc"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Rok"
|
||||
|
||||
#: dialog.c:744
|
||||
msgid "Rename"
|
||||
msgstr "Zmień nazwę"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Katalogi"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Pliki"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Udane"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Niepowodzone"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Przeszłe"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Zakończone"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Sprawdzone"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Gotowe"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Pominięte"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "W toku"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Brak"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Ogólny postęp"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Szukaj"
|
111
contrib/dialog/po/pt.po
Normal file
111
contrib/dialog/po/pt.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Portuguese translation of Dialog.
|
||||
# Copyright (C) 2001 Thomas Dickey.
|
||||
# Frédéric L. W. Meunier <0 @ pervalidus.net>, 2001.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 0.9a-20020814\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2002-09-04 19:12-0300\n"
|
||||
"Last-Translator: Frédéric L. W. Meunier <0 @ pervalidus.net>\n"
|
||||
"Language-Team: Portuguese <pt @ li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8-bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Sim"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Não"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Aceitar"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Sair"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Ajuda"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mês"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Ano"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Directorias"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Ficheiros"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "Ficheiros"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Busca"
|
112
contrib/dialog/po/pt_BR.po
Normal file
112
contrib/dialog/po/pt_BR.po
Normal file
@ -0,0 +1,112 @@
|
||||
# Brazilian Portuguese translation of Dialog.
|
||||
# Copyright (C) 2001 Thomas Dickey.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Frédéric L. W. Meunier <0@pervalidus.net>, 2001.
|
||||
# Flamarion Jorge <flamarilinux@yahoo.com.br>, 2009.
|
||||
#
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20080819\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2009-03-29 19:30-0400\n"
|
||||
"PO-Revision-Date: 2009-01-06 23:48-0200\n"
|
||||
"Last-Translator: Flamarion Jorge <flamarilinux@yahoo.com.br>\n"
|
||||
"Language-Team: Brazilian Portuguese <ldp-br@bazar.conectiva.com.br>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Sim"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Não"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Aceitar"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Sair"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Ajuda"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mês"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Ano"
|
||||
|
||||
#: dialog.c:744
|
||||
msgid "Rename"
|
||||
msgstr "Renomear"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Diretórios"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Arquivos"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Sucesso"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Falhou"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Passou"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Completo"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Checado"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Feito"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Pulado"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Em Progresso"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/A"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Progresso Global"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Pesquisa"
|
113
contrib/dialog/po/rm.po
Normal file
113
contrib/dialog/po/rm.po
Normal file
@ -0,0 +1,113 @@
|
||||
# Rumantsch (Rhaeto-Romance) [rm] translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2003-2004,2005 Thomas Dickey.
|
||||
# Florian Verdet _goto <fvgoto@linuxbourg.ch>, 2005.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2005-02-06 13:22+0100\n"
|
||||
"Last-Translator: Florian Verdet _goto <fvgoto@linuxbourg.ch>\n"
|
||||
"Language-Team: Rhaeto-Romance <gnu-rumantsch@guglielmtux.ch>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.2\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Schi"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Na"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Laschar star"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "SORTIR"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Agüd"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mais"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "On"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Müdar nom"
|
||||
|
||||
#: fselect.c:550
|
||||
#, fuzzy
|
||||
msgid "Directories"
|
||||
msgstr "Registers"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Datotecas"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "Datotecas"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Tscherchar"
|
114
contrib/dialog/po/ro.po
Normal file
114
contrib/dialog/po/ro.po
Normal file
@ -0,0 +1,114 @@
|
||||
# Mesajele în limba română pentru dialog.
|
||||
# Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
# Acest fişier este distribuit sub aceeaşi licenţă ca şi pachetul dialog.
|
||||
# Laurentiu Buzdugan <lbuz@rolix.org>, 2005.
|
||||
#
|
||||
#
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-07-20 14:31-0400\n"
|
||||
"PO-Revision-Date: 2005-01-20 12:00-0500\n"
|
||||
"Last-Translator: Laurentiu Buzdugan <lbuz@rolix.org>\n"
|
||||
"Language-Team: Romanian <translation-team-ro@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Da"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Nu"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Renunţă"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "TERMINĂ"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Ajutor"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Luna"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "An"
|
||||
|
||||
#: dialog.c:744
|
||||
msgid "Rename"
|
||||
msgstr "Redenumeşte"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Directoare"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Fişiere"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "Fişiere"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Căutare"
|
114
contrib/dialog/po/ru.po
Normal file
114
contrib/dialog/po/ru.po
Normal file
@ -0,0 +1,114 @@
|
||||
# translation of dialog-1.1.20070704.ru.po to Russian
|
||||
# Dialog
|
||||
# Copyright 2003, # Thomas Dickey
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
#
|
||||
# Leonid Kanter <leon@asplinux.ru>, 2004.
|
||||
# Yuri Kozlov <yuray@komyakino.ru>, 2009.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2009-02-22 07:05-0500\n"
|
||||
"PO-Revision-Date: 2009-01-24 23:09+0300\n"
|
||||
"Last-Translator: Yuri Kozlov <yuray@komyakino.ru>\n"
|
||||
"Language-Team: Russian <gnu@mx.ru>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.11.4\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Да"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Нет"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Отмена"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Выход"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Дополнительно"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Справка"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Месяц"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Год"
|
||||
|
||||
#: dialog.c:744
|
||||
msgid "Rename"
|
||||
msgstr "Переименовать"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Каталоги"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Файлы"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Успешно"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Неудачно"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Пройдено"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Завершено"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Проверено"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Выполнено"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Пропущено"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Выполняется"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Н/Д"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Всего выполнено"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Поиск"
|
126
contrib/dialog/po/rw.po
Normal file
126
contrib/dialog/po/rw.po
Normal file
@ -0,0 +1,126 @@
|
||||
# translation of dialog to Kinyarwanda.
|
||||
# Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Steve Murphy <murf@e-tools.com>, 2005.
|
||||
# Steve performed initial rough translation from compendium built from translations provided by the following translators:
|
||||
# Philibert Ndandali <ndandali@yahoo.fr>, 2005.
|
||||
# Viateur MUGENZI <muvia1@yahoo.fr>, 2005.
|
||||
# Noëlla Mupole <s24211045@tuks.co.za>, 2005.
|
||||
# Carole Karema <karemacarole@hotmail.com>, 2005.
|
||||
# JEAN BAPTISTE NGENDAHAYO <ngenda_denis@yahoo.co.uk>, 2005.
|
||||
# Augustin KIBERWA <akiberwa@yahoo.co.uk>, 2005.
|
||||
# Donatien NSENGIYUMVA <ndonatienuk@yahoo.co.uk>, 2005.
|
||||
# Antoine Bigirimana <antoine@e-tools.com>, 2005.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2005-04-04 10:55-0700\n"
|
||||
"Last-Translator: Steven Michael Murphy <murf@e-tools.com>\n"
|
||||
"Language-Team: Kinyarwanda <translation-team-rw@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Yego"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Oya"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OKE"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Kureka"
|
||||
|
||||
# #-#-#-#-# setup2.pot (PACKAGE VERSION) #-#-#-#-#
|
||||
# setup2/source\ui\app.src:STR_RESTART_BTN_NO.text
|
||||
# #-#-#-#-# setup2.pot (PACKAGE VERSION) #-#-#-#-#
|
||||
# setup2/source\ui\pages\phavefun.src:RESID_PAGE_PAGEHAVEFUN.STR_LOGOUT_BTN_NO.text
|
||||
#: buttons.c:417
|
||||
#, fuzzy
|
||||
msgid "EXIT"
|
||||
msgstr "Gusohoka"
|
||||
|
||||
#: buttons.c:425
|
||||
#, fuzzy
|
||||
msgid "Extra"
|
||||
msgstr "Birenga"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Gufasha"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Ukwezi"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Umwaka"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Guhindura izina"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "ububiko bw'amaderese"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "amadosiye"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "amadosiye"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Gushaka"
|
110
contrib/dialog/po/sq.po
Normal file
110
contrib/dialog/po/sq.po
Normal file
@ -0,0 +1,110 @@
|
||||
# Albanian translation of Dialog.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Copyright (C) 2005 Thomas Dickey.
|
||||
# Elian Myftiu <elian@lycos.com>, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Dialog 1.0-20050116\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2004-11-18 02:28+0100\n"
|
||||
"Last-Translator: Elian Myftiu <elian@lycos.com>\n"
|
||||
"Language-Team: Albanian <gnome-albanian-perkthyesit@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Po"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Jo"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "mirë"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Anullo"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Dal"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr ""
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr ""
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr ""
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr ""
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr ""
|
110
contrib/dialog/po/sr.po
Normal file
110
contrib/dialog/po/sr.po
Normal file
@ -0,0 +1,110 @@
|
||||
# Serbian translation of `dialog'.
|
||||
# Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same license as the `dialog' package.
|
||||
# Aleksandar Jelenak <jelenak@verizon.net>, 2005.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2005-08-21 12:53-0400\n"
|
||||
"Last-Translator: Aleksandar Jelenak <jelenak@verizon.net>\n"
|
||||
"Language-Team: Serbian <gnu@prevod.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Да"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Не"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "У реду"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Поништи"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "ИЗЛАЗ"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Додатно"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Помоћ"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Месец"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Година"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Преименуј"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Директоријуми"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Датотеке"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "Датотеке"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Претрага"
|
109
contrib/dialog/po/sv.po
Normal file
109
contrib/dialog/po/sv.po
Normal file
@ -0,0 +1,109 @@
|
||||
# Swedish translation of dialog.
|
||||
# Copyright 2003,2004,2005, 2007 # Thomas Dickey
|
||||
# Daniel Nylander <po@danielnylander.se>, 2005, 2007.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2007-07-23 00:02+0100\n"
|
||||
"Last-Translator: Daniel Nylander <po@danielnylander.se>\n"
|
||||
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Ja"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Nej"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Avbryt"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "AVSLUTA"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Extra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Hjälp"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Månad"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "År"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Byt namn"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Kataloger"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Filer"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Lyckades"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Misslyckades"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Klarades"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Färdig"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Kontrollerad"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Klar"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Hoppades över"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Pågår"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Inte tillgänglig"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Totalt förlopp"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Sök"
|
110
contrib/dialog/po/sw.po
Normal file
110
contrib/dialog/po/sw.po
Normal file
@ -0,0 +1,110 @@
|
||||
# Dialog
|
||||
# Copyright 2003-2007,2008 # Thomas Dickey
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Emanuel Feruzi <emanuel.feruzi@trilabs.co.tz>, 2009
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20080819\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2009-05-01 03:07+0300\n"
|
||||
"Last-Translator: Emanuel Feruzi <emanuel.feruzi@trilabs.co.tz>\n"
|
||||
"Language-Team: Swahili <translation-team-sw@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Ndio"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Hapana"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Sawa"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Ghahiri"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Funga"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Nyongeza"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Msaada"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Mwezi"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Mwaka"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Badili jina"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Masaraka"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Mafaili"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Inefanikiwa"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Imeshindwa"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Imepita"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Imekamilika"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Imetikiwa"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Imemaliza"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Imerukwa"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Inaendelea"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Haitumiki"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Maendeleo kwa ujumla"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Tafuta"
|
111
contrib/dialog/po/th.po
Normal file
111
contrib/dialog/po/th.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Dialog
|
||||
# Copyright 2003-2006,2007 # Thomas Dickey
|
||||
# Seksan Poltree <seksan.poltree@gmail.com>, 2007.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2007-11-22 19:23+0700\n"
|
||||
"Last-Translator: Seksan Poltree <seksan.poltree@gmail.com>\n"
|
||||
"Language-Team: Thai <seksan.poltree@gmail.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Thai\n"
|
||||
"X-Poedit-Country: THAILAND\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "ใช่"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "ไม่"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "ตกลง"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "ยกเลิก"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "ออก"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "เพิ่มเติม"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "ช่วยเหลือ"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "เดือน"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "ปี"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "เปลี่ยนชื่อ"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "ไดเร็กทอรี่"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "ไฟล์"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "สำเร็จ"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "ล้มเหลว"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "ผ่าน"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "เสร็จสิ้น"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "กาเครื่องหมาย"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "เรียบร้อย"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "ข้าม"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "กำลังดำเนินการ"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "ไม่มีอยู่"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "ความก้าวหน้าทั้งสิ้น"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "ค้นหา"
|
112
contrib/dialog/po/tr.po
Normal file
112
contrib/dialog/po/tr.po
Normal file
@ -0,0 +1,112 @@
|
||||
# Turkish translation of dialog.
|
||||
# Copyright (C) 2005 dialog GNU GPL:
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Abdullah Ulas <potkal@bioinformatics.org>, 2005.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.0-rel20041222\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2005-04-08 18:29+0300\n"
|
||||
"Last-Translator: Abdullah Ulas <potkal@bioinformatics.org>\n"
|
||||
"Language-Team: Turkish <gnu-tr-u12a@lists.sourceforge.net>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Evet"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Hayır"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Tamam"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "İptal"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "ÇIKIŞ"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Ekstra"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Yardım"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Ay"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Yıl"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Yeniden adlandır"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Dizinler"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Dosyalar"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "Dosyalar"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Arama"
|
113
contrib/dialog/po/uk.po
Normal file
113
contrib/dialog/po/uk.po
Normal file
@ -0,0 +1,113 @@
|
||||
# translation of uk.po to Ukrainian
|
||||
# Dialog
|
||||
# Copyright 2003, # Thomas Dickey
|
||||
# Eugeniy Meshcheryakov <eugen@univ.kiev.ua>, 2004.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: uk\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2004-02-12 20:17+0200\n"
|
||||
"Last-Translator: Eugeniy Meshcheryakov <eugen@univ.kiev.ua>\n"
|
||||
"Language-Team: Ukrainian\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.0.2\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Так"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Ні"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "Гаразд"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Скасувати"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "ВИЙТИ"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Додатково"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Допомога"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Місяць"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Рік"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Перейменувати"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Каталоги"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Файли"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:61
|
||||
#, fuzzy
|
||||
msgid "Failed"
|
||||
msgstr "Файли"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr ""
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr ""
|
||||
|
||||
#: textbox.c:489
|
||||
#, fuzzy
|
||||
msgid "Search"
|
||||
msgstr "Search"
|
113
contrib/dialog/po/vi.po
Normal file
113
contrib/dialog/po/vi.po
Normal file
@ -0,0 +1,113 @@
|
||||
# Vietnamese Translation for Dialog.
|
||||
# Copyright 2003,2004,2005 Thomas Dickey (msgid)
|
||||
# Copyright © 2009 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Clytie Siddall <clytie@riverland.net.au>, 2005-2009.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20080819\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2009-09-24 22:36+0930\n"
|
||||
"Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n"
|
||||
"Language-Team: Vietnamese <vi-VN@googlegroups.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: LocFactoryEditor 1.8\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Có"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Không"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Thôi"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "THOÁT"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Thêm"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Trợ giúp"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Tháng"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Năm"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Thay tên"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Thư mục"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Tập tin"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Thành công"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Trượt"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Đỗ"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Hoàn toàn"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Đã kiểm tra"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Hoàn tất"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Bị bỏ qua"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "Đang chạy"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "Không có"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Toàn tiến hành"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Tìm kiếm"
|
110
contrib/dialog/po/wa.po
Normal file
110
contrib/dialog/po/wa.po
Normal file
@ -0,0 +1,110 @@
|
||||
# Translation of Dialog into the walloon language.
|
||||
# Copyright 2003-2006,2007 # Thomas Dickey
|
||||
#
|
||||
# Pablo Saratxaga <pablo@walon.org>, 2007.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2007-08-29 18:24+0200\n"
|
||||
"Last-Translator: Pablo Saratxaga <pablo@walon.org>\n"
|
||||
"Language-Team: Walloon <linux-wa@walon.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: KBabel 1.0.2\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "Oyi"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "Neni"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "'l est bon"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "Rinoncî"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "Moussî foû"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "Rawete"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "Aidance"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "Moes"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "Anêye"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "Rilomer"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "Ridants"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "Fitchîs"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "Succès"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "Berwete"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "Passé"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "Tot fwait"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "Verifyî"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "Fwait"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "Passé houte"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "En alaedje"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/D"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "Avançmint"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "Cweri"
|
111
contrib/dialog/po/zh_CN.po
Normal file
111
contrib/dialog/po/zh_CN.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Simplified Chinese translation for dialog.
|
||||
# Copyright 2003,2004 # Thomas Dickey
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Meng Jie <zuxyhere@eastday.com>, 2005.
|
||||
# LI Daobing <lidaobing@gmail.com>, 2007.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2007-02-25 16:06-0500\n"
|
||||
"PO-Revision-Date: 2007-08-20 07:25+0800\n"
|
||||
"Last-Translator: Meng Jie <zuxy.meng@gmail.com>\n"
|
||||
"Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: buttons.c:379
|
||||
msgid "Yes"
|
||||
msgstr "是"
|
||||
|
||||
#: buttons.c:387
|
||||
msgid "No"
|
||||
msgstr "否"
|
||||
|
||||
#: buttons.c:395
|
||||
msgid "OK"
|
||||
msgstr "确认"
|
||||
|
||||
#: buttons.c:403
|
||||
msgid "Cancel"
|
||||
msgstr "取消"
|
||||
|
||||
#: buttons.c:411
|
||||
msgid "EXIT"
|
||||
msgstr "退出"
|
||||
|
||||
#: buttons.c:419
|
||||
msgid "Extra"
|
||||
msgstr "附加"
|
||||
|
||||
#: buttons.c:427
|
||||
msgid "Help"
|
||||
msgstr "帮助"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "月"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "年"
|
||||
|
||||
#: dialog.c:727
|
||||
msgid "Rename"
|
||||
msgstr "重命名"
|
||||
|
||||
#: fselect.c:548
|
||||
msgid "Directories"
|
||||
msgstr "目录"
|
||||
|
||||
#: fselect.c:549
|
||||
msgid "Files"
|
||||
msgstr "文件"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "成功"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "失败"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "已跳过"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "已完成"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "已检查"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "完成"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "跳过"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "进行中"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "N/A"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "整体进度"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "搜索"
|
111
contrib/dialog/po/zh_TW.po
Normal file
111
contrib/dialog/po/zh_TW.po
Normal file
@ -0,0 +1,111 @@
|
||||
# Traditional Chinese Messages for dialog.
|
||||
# Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same license as the dialog package.
|
||||
# Wei-Lun Chao <chaoweilun@gmail.com>, 2005, 2007.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: dialog 1.1.20070704\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-06-18 18:26-0400\n"
|
||||
"PO-Revision-Date: 2007-12-19 23:39+0800\n"
|
||||
"Last-Translator: Wei-Lun Chao <chaoweilun@gmail.com>\n"
|
||||
"Language-Team: Chinese (traditional) <zh-l10n@linux.org.tw>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#: buttons.c:385
|
||||
msgid "Yes"
|
||||
msgstr "是"
|
||||
|
||||
#: buttons.c:393
|
||||
msgid "No"
|
||||
msgstr "否"
|
||||
|
||||
#: buttons.c:401
|
||||
msgid "OK"
|
||||
msgstr "確定"
|
||||
|
||||
#: buttons.c:409
|
||||
msgid "Cancel"
|
||||
msgstr "取消"
|
||||
|
||||
#: buttons.c:417
|
||||
msgid "EXIT"
|
||||
msgstr "離開"
|
||||
|
||||
#: buttons.c:425
|
||||
msgid "Extra"
|
||||
msgstr "其他"
|
||||
|
||||
#: buttons.c:433
|
||||
msgid "Help"
|
||||
msgstr "求助"
|
||||
|
||||
#. Headline "Month"
|
||||
#: calendar.c:273
|
||||
msgid "Month"
|
||||
msgstr "月"
|
||||
|
||||
#. Headline "Year"
|
||||
#: calendar.c:293
|
||||
msgid "Year"
|
||||
msgstr "年"
|
||||
|
||||
#: dialog.c:741
|
||||
msgid "Rename"
|
||||
msgstr "更名"
|
||||
|
||||
#: fselect.c:550
|
||||
msgid "Directories"
|
||||
msgstr "目錄"
|
||||
|
||||
#: fselect.c:551
|
||||
msgid "Files"
|
||||
msgstr "檔案"
|
||||
|
||||
#: mixedgauge.c:58
|
||||
msgid "Succeeded"
|
||||
msgstr "已成功"
|
||||
|
||||
#: mixedgauge.c:61
|
||||
msgid "Failed"
|
||||
msgstr "已失敗"
|
||||
|
||||
#: mixedgauge.c:64
|
||||
msgid "Passed"
|
||||
msgstr "已傳遞"
|
||||
|
||||
#: mixedgauge.c:67
|
||||
msgid "Completed"
|
||||
msgstr "已完成"
|
||||
|
||||
#: mixedgauge.c:70
|
||||
msgid "Checked"
|
||||
msgstr "已勾選"
|
||||
|
||||
#: mixedgauge.c:73
|
||||
msgid "Done"
|
||||
msgstr "已完成"
|
||||
|
||||
#: mixedgauge.c:76
|
||||
msgid "Skipped"
|
||||
msgstr "已略過"
|
||||
|
||||
#: mixedgauge.c:79
|
||||
msgid "In Progress"
|
||||
msgstr "正在進行"
|
||||
|
||||
#: mixedgauge.c:85
|
||||
msgid "N/A"
|
||||
msgstr "不明"
|
||||
|
||||
#: mixedgauge.c:193
|
||||
msgid "Overall Progress"
|
||||
msgstr "整體進度"
|
||||
|
||||
#: textbox.c:489
|
||||
msgid "Search"
|
||||
msgstr "搜尋"
|
187
contrib/dialog/progressbox.c
Normal file
187
contrib/dialog/progressbox.c
Normal file
@ -0,0 +1,187 @@
|
||||
/*
|
||||
* $Id: progressbox.c,v 1.8 2010/01/12 10:46:24 tom Exp $
|
||||
*
|
||||
* progressbox.c -- implements the progress box
|
||||
*
|
||||
* Copyright 2005 Valery Reznic
|
||||
*
|
||||
* This program 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 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#define MIN_HIGH (4)
|
||||
#define MIN_WIDE (10 + 2 * (2 + MARGIN))
|
||||
|
||||
typedef struct {
|
||||
DIALOG_CALLBACK obj;
|
||||
WINDOW *text;
|
||||
char line[MAX_LEN + 1];
|
||||
int is_eof;
|
||||
} MY_OBJ;
|
||||
|
||||
/*
|
||||
* Return current line of text.
|
||||
*/
|
||||
static char *
|
||||
get_line(MY_OBJ * obj)
|
||||
{
|
||||
FILE *fp = obj->obj.input;
|
||||
int col = 0;
|
||||
int j, tmpint, ch;
|
||||
|
||||
while (1) {
|
||||
if ((ch = getc(fp)) == EOF) {
|
||||
obj->is_eof = 1;
|
||||
if (col) {
|
||||
break;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (ch == '\n')
|
||||
break;
|
||||
if (ch == '\r')
|
||||
break;
|
||||
if ((ch == TAB) && (dialog_vars.tab_correct)) {
|
||||
tmpint = dialog_state.tab_len
|
||||
- (col % dialog_state.tab_len);
|
||||
for (j = 0; j < tmpint; j++) {
|
||||
if (col < MAX_LEN)
|
||||
obj->line[col] = ' ';
|
||||
++col;
|
||||
}
|
||||
} else {
|
||||
obj->line[col] = (char) ch;
|
||||
++col;
|
||||
}
|
||||
if (col >= MAX_LEN)
|
||||
break;
|
||||
}
|
||||
|
||||
obj->line[col] = '\0';
|
||||
|
||||
return obj->line;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a new line of text.
|
||||
*/
|
||||
static void
|
||||
print_line(MY_OBJ * obj, WINDOW *win, int row, int width)
|
||||
{
|
||||
int i, y, x;
|
||||
char *line = obj->line;
|
||||
|
||||
(void) wmove(win, row, 0); /* move cursor to correct line */
|
||||
(void) waddch(win, ' ');
|
||||
#ifdef NCURSES_VERSION
|
||||
(void) waddnstr(win, line, MIN((int) strlen(line), width - 2));
|
||||
#else
|
||||
line[MIN((int) strlen(line), width - 2)] = '\0';
|
||||
waddstr(win, line);
|
||||
#endif
|
||||
|
||||
getyx(win, y, x);
|
||||
/* Clear 'residue' of previous line */
|
||||
for (i = 0; i < width - x; i++)
|
||||
(void) waddch(win, ' ');
|
||||
}
|
||||
|
||||
/*
|
||||
* Display text from a stdin in a scrolling window.
|
||||
*/
|
||||
int
|
||||
dialog_progressbox(const char *title, const char *cprompt, int height, int width)
|
||||
{
|
||||
int i;
|
||||
int x, y, thigh;
|
||||
WINDOW *dialog, *text;
|
||||
MY_OBJ *obj;
|
||||
FILE *fd = dialog_state.pipe_input;
|
||||
char *prompt = dlg_strclone(cprompt);
|
||||
|
||||
dlg_tab_correct_str(prompt);
|
||||
dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, MIN_WIDE);
|
||||
dlg_print_size(height, width);
|
||||
dlg_ctl_size(height, width);
|
||||
|
||||
x = dlg_box_x_ordinate(width);
|
||||
y = dlg_box_y_ordinate(height);
|
||||
thigh = height - (2 * MARGIN);
|
||||
|
||||
dialog = dlg_new_window(height, width, y, x);
|
||||
|
||||
dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
|
||||
dlg_draw_title(dialog, title);
|
||||
|
||||
if (*prompt != '\0') {
|
||||
int y2, x2;
|
||||
|
||||
wattrset(dialog, dialog_attr);
|
||||
dlg_print_autowrap(dialog, prompt, height, width);
|
||||
getyx(dialog, y2, x2);
|
||||
++y2;
|
||||
wmove(dialog, y2, MARGIN);
|
||||
for (i = 0; i < getmaxx(dialog) - 2 * MARGIN; i++)
|
||||
(void) waddch(dialog, dlg_boxchar(ACS_HLINE));
|
||||
y += y2;
|
||||
thigh -= y2;
|
||||
}
|
||||
|
||||
/* Create window for text region, used for scrolling text */
|
||||
text = dlg_sub_window(dialog,
|
||||
thigh,
|
||||
width - (2 * MARGIN),
|
||||
y + MARGIN,
|
||||
x + MARGIN);
|
||||
|
||||
(void) wrefresh(dialog);
|
||||
|
||||
(void) wmove(dialog, thigh, (MARGIN + 1));
|
||||
(void) wnoutrefresh(dialog);
|
||||
|
||||
obj = dlg_calloc(MY_OBJ, 1);
|
||||
assert_ptr(obj, "dialog_progressbox");
|
||||
|
||||
obj->obj.input = fd;
|
||||
obj->obj.win = dialog;
|
||||
obj->text = text;
|
||||
|
||||
dlg_attr_clear(text, thigh, getmaxx(text), dialog_attr);
|
||||
for (i = 0; get_line(obj); i++) {
|
||||
if (i < thigh) {
|
||||
print_line(obj, text, i, width - (2 * MARGIN));
|
||||
} else {
|
||||
scrollok(text, TRUE);
|
||||
scroll(text);
|
||||
scrollok(text, FALSE);
|
||||
print_line(obj, text, thigh - 1, width - (2 * MARGIN));
|
||||
}
|
||||
(void) wnoutrefresh(text);
|
||||
(void) wrefresh(text);
|
||||
if (obj->is_eof)
|
||||
break;
|
||||
}
|
||||
dlg_unregister_window(text);
|
||||
dlg_del_window(dialog);
|
||||
free(prompt);
|
||||
free(obj);
|
||||
|
||||
return DLG_EXIT_OK;
|
||||
}
|
588
contrib/dialog/rc.c
Normal file
588
contrib/dialog/rc.c
Normal file
@ -0,0 +1,588 @@
|
||||
/*
|
||||
* $Id: rc.c,v 1.45 2010/01/18 10:28:16 tom Exp $
|
||||
*
|
||||
* rc.c -- routines for processing the configuration file
|
||||
*
|
||||
* Copyright 2000-2008,2010 Thomas E. Dickey
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License, version 2.1
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin St., Fifth Floor
|
||||
* Boston, MA 02110, USA.
|
||||
*
|
||||
* An earlier version of this program lists as authors
|
||||
* Savio Lam (lam836@cs.cuhk.hk)
|
||||
*/
|
||||
|
||||
#include <dialog.h>
|
||||
|
||||
#include <dlg_keys.h>
|
||||
|
||||
#ifdef HAVE_COLOR
|
||||
#include <dlg_colors.h>
|
||||
|
||||
/*
|
||||
* For matching color names with color values
|
||||
*/
|
||||
static const color_names_st color_names[] =
|
||||
{
|
||||
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||
{"DEFAULT", -1},
|
||||
#endif
|
||||
{"BLACK", COLOR_BLACK},
|
||||
{"RED", COLOR_RED},
|
||||
{"GREEN", COLOR_GREEN},
|
||||
{"YELLOW", COLOR_YELLOW},
|
||||
{"BLUE", COLOR_BLUE},
|
||||
{"MAGENTA", COLOR_MAGENTA},
|
||||
{"CYAN", COLOR_CYAN},
|
||||
{"WHITE", COLOR_WHITE},
|
||||
}; /* color names */
|
||||
#define COLOR_COUNT (sizeof(color_names) / sizeof(color_names[0]))
|
||||
#endif /* HAVE_COLOR */
|
||||
|
||||
#define GLOBALRC "/etc/dialogrc"
|
||||
#define DIALOGRC ".dialogrc"
|
||||
|
||||
/* Types of values */
|
||||
#define VAL_INT 0
|
||||
#define VAL_STR 1
|
||||
#define VAL_BOOL 2
|
||||
|
||||
/* Type of line in configuration file */
|
||||
typedef enum {
|
||||
LINE_ERROR = -1,
|
||||
LINE_EQUALS,
|
||||
LINE_EMPTY
|
||||
} PARSE_LINE;
|
||||
|
||||
/* number of configuration variables */
|
||||
#define VAR_COUNT (sizeof(vars) / sizeof(vars_st))
|
||||
|
||||
/* check if character is white space */
|
||||
#define whitespace(c) (c == ' ' || c == TAB)
|
||||
|
||||
/* check if character is string quoting characters */
|
||||
#define isquote(c) (c == '"' || c == '\'')
|
||||
|
||||
/* get last character of string */
|
||||
#define lastch(str) str[strlen(str)-1]
|
||||
|
||||
/*
|
||||
* Configuration variables
|
||||
*/
|
||||
typedef struct {
|
||||
const char *name; /* name of configuration variable as in DIALOGRC */
|
||||
void *var; /* address of actual variable to change */
|
||||
int type; /* type of value */
|
||||
const char *comment; /* comment to put in "rc" file */
|
||||
} vars_st;
|
||||
|
||||
/*
|
||||
* This table should contain only references to dialog_state, since dialog_vars
|
||||
* is reset specially in dialog.c before each widget.
|
||||
*/
|
||||
static const vars_st vars[] =
|
||||
{
|
||||
{"aspect",
|
||||
&dialog_state.aspect_ratio,
|
||||
VAL_INT,
|
||||
"Set aspect-ration."},
|
||||
|
||||
{"separate_widget",
|
||||
&dialog_state.separate_str,
|
||||
VAL_STR,
|
||||
"Set separator (for multiple widgets output)."},
|
||||
|
||||
{"tab_len",
|
||||
&dialog_state.tab_len,
|
||||
VAL_INT,
|
||||
"Set tab-length (for textbox tab-conversion)."},
|
||||
|
||||
{"visit_items",
|
||||
&dialog_state.visit_items,
|
||||
VAL_BOOL,
|
||||
"Make tab-traversal for checklist, etc., include the list."},
|
||||
|
||||
#ifdef HAVE_COLOR
|
||||
{"use_shadow",
|
||||
&dialog_state.use_shadow,
|
||||
VAL_BOOL,
|
||||
"Shadow dialog boxes? This also turns on color."},
|
||||
|
||||
{"use_colors",
|
||||
&dialog_state.use_colors,
|
||||
VAL_BOOL,
|
||||
"Turn color support ON or OFF"},
|
||||
#endif /* HAVE_COLOR */
|
||||
}; /* vars */
|
||||
|
||||
static int
|
||||
skip_whitespace(char *str, int n)
|
||||
{
|
||||
while (whitespace(str[n]) && str[n] != '\0')
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
static int
|
||||
skip_keyword(char *str, int n)
|
||||
{
|
||||
while (isalnum(UCH(str[n])) && str[n] != '\0')
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
static int
|
||||
find_vars(char *name)
|
||||
{
|
||||
int result = -1;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < VAR_COUNT; i++) {
|
||||
if (dlg_strcmp(vars[i].name, name) == 0) {
|
||||
result = (int) i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef HAVE_COLOR
|
||||
static int
|
||||
find_color(char *name)
|
||||
{
|
||||
int result = -1;
|
||||
int i;
|
||||
int limit = dlg_color_count();
|
||||
|
||||
for (i = 0; i < limit; i++) {
|
||||
if (dlg_strcmp(dlg_color_table[i].name, name) == 0) {
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert an attribute to a string representation like this:
|
||||
*
|
||||
* "(foreground,background,highlight)"
|
||||
*/
|
||||
static char *
|
||||
attr_to_str(char *str, int fg, int bg, int hl)
|
||||
{
|
||||
int i;
|
||||
|
||||
strcpy(str, "(");
|
||||
/* foreground */
|
||||
for (i = 0; fg != color_names[i].value; i++) ;
|
||||
strcat(str, color_names[i].name);
|
||||
strcat(str, ",");
|
||||
|
||||
/* background */
|
||||
for (i = 0; bg != color_names[i].value; i++) ;
|
||||
strcat(str, color_names[i].name);
|
||||
|
||||
/* highlight */
|
||||
strcat(str, hl ? ",ON)" : ",OFF)");
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the foreground, background and highlight values from an attribute
|
||||
* represented as a string in this form:
|
||||
*
|
||||
* "(foreground,background,highlight)"
|
||||
*/
|
||||
static int
|
||||
str_to_attr(char *str, int *fg, int *bg, int *hl)
|
||||
{
|
||||
int i = 0, get_fg = 1;
|
||||
unsigned j;
|
||||
char tempstr[MAX_LEN + 1], *part;
|
||||
|
||||
if (str[0] != '(' || lastch(str) != ')')
|
||||
return -1; /* invalid representation */
|
||||
|
||||
/* remove the parenthesis */
|
||||
strcpy(tempstr, str + 1);
|
||||
lastch(tempstr) = '\0';
|
||||
|
||||
/* get foreground and background */
|
||||
|
||||
while (1) {
|
||||
/* skip white space before fg/bg string */
|
||||
i = skip_whitespace(tempstr, i);
|
||||
if (tempstr[i] == '\0')
|
||||
return -1; /* invalid representation */
|
||||
part = tempstr + i; /* set 'part' to start of fg/bg string */
|
||||
|
||||
/* find end of fg/bg string */
|
||||
while (!whitespace(tempstr[i]) && tempstr[i] != ','
|
||||
&& tempstr[i] != '\0')
|
||||
i++;
|
||||
|
||||
if (tempstr[i] == '\0')
|
||||
return -1; /* invalid representation */
|
||||
else if (whitespace(tempstr[i])) { /* not yet ',' */
|
||||
tempstr[i++] = '\0';
|
||||
|
||||
/* skip white space before ',' */
|
||||
i = skip_whitespace(tempstr, i);
|
||||
if (tempstr[i] != ',')
|
||||
return -1; /* invalid representation */
|
||||
}
|
||||
tempstr[i++] = '\0'; /* skip the ',' */
|
||||
for (j = 0; j < COLOR_COUNT && dlg_strcmp(part, color_names[j].name);
|
||||
j++) ;
|
||||
if (j == COLOR_COUNT) /* invalid color name */
|
||||
return -1;
|
||||
if (get_fg) {
|
||||
*fg = color_names[j].value;
|
||||
get_fg = 0; /* next we have to get the background */
|
||||
} else {
|
||||
*bg = color_names[j].value;
|
||||
break;
|
||||
}
|
||||
} /* got foreground and background */
|
||||
|
||||
/* get highlight */
|
||||
|
||||
/* skip white space before highlight string */
|
||||
i = skip_whitespace(tempstr, i);
|
||||
if (tempstr[i] == '\0')
|
||||
return -1; /* invalid representation */
|
||||
part = tempstr + i; /* set 'part' to start of highlight string */
|
||||
|
||||
/* trim trailing white space from highlight string */
|
||||
i = (int) strlen(part) - 1;
|
||||
while (whitespace(part[i]) && i > 0)
|
||||
i--;
|
||||
part[i + 1] = '\0';
|
||||
|
||||
if (!dlg_strcmp(part, "ON"))
|
||||
*hl = TRUE;
|
||||
else if (!dlg_strcmp(part, "OFF"))
|
||||
*hl = FALSE;
|
||||
else
|
||||
return -1; /* invalid highlight value */
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_COLOR */
|
||||
|
||||
/*
|
||||
* Check if the line begins with a special keyword; if so, return true while
|
||||
* pointing params to its parameters.
|
||||
*/
|
||||
static int
|
||||
begins_with(char *line, const char *keyword, char **params)
|
||||
{
|
||||
int i = skip_whitespace(line, 0);
|
||||
int j = skip_keyword(line, i);
|
||||
|
||||
if ((j - i) == (int) strlen(keyword)) {
|
||||
char save = line[j];
|
||||
line[j] = 0;
|
||||
if (!dlg_strcmp(keyword, line + i)) {
|
||||
*params = line + skip_whitespace(line, j + 1);
|
||||
return 1;
|
||||
}
|
||||
line[j] = save;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse a line in the configuration file
|
||||
*
|
||||
* Each line is of the form: "variable = value". On exit, 'var' will contain
|
||||
* the variable name, and 'value' will contain the value string.
|
||||
*
|
||||
* Return values:
|
||||
*
|
||||
* LINE_EMPTY - line is blank or comment
|
||||
* LINE_EQUALS - line contains "variable = value"
|
||||
* LINE_ERROR - syntax error in line
|
||||
*/
|
||||
static PARSE_LINE
|
||||
parse_line(char *line, char **var, char **value)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
/* ignore white space at beginning of line */
|
||||
i = skip_whitespace(line, i);
|
||||
|
||||
if (line[i] == '\0') /* line is blank */
|
||||
return LINE_EMPTY;
|
||||
else if (line[i] == '#') /* line is comment */
|
||||
return LINE_EMPTY;
|
||||
else if (line[i] == '=') /* variable names cannot start with a '=' */
|
||||
return LINE_ERROR;
|
||||
|
||||
/* set 'var' to variable name */
|
||||
*var = line + i++; /* skip to next character */
|
||||
|
||||
/* find end of variable name */
|
||||
while (!whitespace(line[i]) && line[i] != '=' && line[i] != '\0')
|
||||
i++;
|
||||
|
||||
if (line[i] == '\0') /* syntax error */
|
||||
return LINE_ERROR;
|
||||
else if (line[i] == '=')
|
||||
line[i++] = '\0';
|
||||
else {
|
||||
line[i++] = '\0';
|
||||
|
||||
/* skip white space before '=' */
|
||||
i = skip_whitespace(line, i);
|
||||
|
||||
if (line[i] != '=') /* syntax error */
|
||||
return LINE_ERROR;
|
||||
else
|
||||
i++; /* skip the '=' */
|
||||
}
|
||||
|
||||
/* skip white space after '=' */
|
||||
i = skip_whitespace(line, i);
|
||||
|
||||
if (line[i] == '\0')
|
||||
return LINE_ERROR;
|
||||
else
|
||||
*value = line + i; /* set 'value' to value string */
|
||||
|
||||
/* trim trailing white space from 'value' */
|
||||
i = (int) strlen(*value) - 1;
|
||||
while (whitespace((*value)[i]) && i > 0)
|
||||
i--;
|
||||
(*value)[i + 1] = '\0';
|
||||
|
||||
return LINE_EQUALS; /* no syntax error in line */
|
||||
}
|
||||
|
||||
/*
|
||||
* Create the configuration file
|
||||
*/
|
||||
void
|
||||
dlg_create_rc(const char *filename)
|
||||
{
|
||||
unsigned i;
|
||||
FILE *rc_file;
|
||||
|
||||
if ((rc_file = fopen(filename, "wt")) == NULL)
|
||||
dlg_exiterr("Error opening file for writing in dlg_create_rc().");
|
||||
|
||||
fprintf(rc_file, "#\n\
|
||||
# Run-time configuration file for dialog\n\
|
||||
#\n\
|
||||
# Automatically generated by \"dialog --create-rc <file>\"\n\
|
||||
#\n\
|
||||
#\n\
|
||||
# Types of values:\n\
|
||||
#\n\
|
||||
# Number - <number>\n\
|
||||
# String - \"string\"\n\
|
||||
# Boolean - <ON|OFF>\n"
|
||||
#ifdef HAVE_COLOR
|
||||
"\
|
||||
# Attribute - (foreground,background,highlight?)\n"
|
||||
#endif
|
||||
);
|
||||
|
||||
/* Print an entry for each configuration variable */
|
||||
for (i = 0; i < VAR_COUNT; i++) {
|
||||
fprintf(rc_file, "\n# %s\n", vars[i].comment);
|
||||
switch (vars[i].type) {
|
||||
case VAL_INT:
|
||||
fprintf(rc_file, "%s = %d\n", vars[i].name,
|
||||
*((int *) vars[i].var));
|
||||
break;
|
||||
case VAL_STR:
|
||||
fprintf(rc_file, "%s = \"%s\"\n", vars[i].name,
|
||||
(char *) vars[i].var);
|
||||
break;
|
||||
case VAL_BOOL:
|
||||
fprintf(rc_file, "%s = %s\n", vars[i].name,
|
||||
*((bool *) vars[i].var) ? "ON" : "OFF");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_COLOR
|
||||
for (i = 0; i < (unsigned) dlg_color_count(); ++i) {
|
||||
char buffer[MAX_LEN + 1];
|
||||
|
||||
fprintf(rc_file, "\n# %s\n", dlg_color_table[i].comment);
|
||||
fprintf(rc_file, "%s = %s\n", dlg_color_table[i].name,
|
||||
attr_to_str(buffer,
|
||||
dlg_color_table[i].fg,
|
||||
dlg_color_table[i].bg,
|
||||
dlg_color_table[i].hilite));
|
||||
}
|
||||
#endif /* HAVE_COLOR */
|
||||
#if 1
|
||||
dlg_dump_keys(rc_file);
|
||||
#endif
|
||||
|
||||
(void) fclose(rc_file);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the configuration file and set up variables
|
||||
*/
|
||||
int
|
||||
dlg_parse_rc(void)
|
||||
{
|
||||
int i;
|
||||
int l = 1;
|
||||
PARSE_LINE parse;
|
||||
char str[MAX_LEN + 1];
|
||||
char *var;
|
||||
char *value;
|
||||
char *tempptr;
|
||||
int result = 0;
|
||||
FILE *rc_file = 0;
|
||||
#if 1
|
||||
char *params;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* At startup, dialog determines the settings to use as follows:
|
||||
*
|
||||
* a) if the environment variable $DIALOGRC is set, its value determines
|
||||
* the name of the configuration file.
|
||||
*
|
||||
* b) if the file in (a) can't be found, use the file $HOME/.dialogrc
|
||||
* as the configuration file.
|
||||
*
|
||||
* c) if the file in (b) can't be found, try using the GLOBALRC file.
|
||||
* Usually this will be /etc/dialogrc.
|
||||
*
|
||||
* d) if the file in (c) cannot be found, use the compiled-in defaults.
|
||||
*/
|
||||
|
||||
/* try step (a) */
|
||||
if ((tempptr = getenv("DIALOGRC")) != NULL)
|
||||
rc_file = fopen(tempptr, "rt");
|
||||
|
||||
if (rc_file == NULL) { /* step (a) failed? */
|
||||
/* try step (b) */
|
||||
if ((tempptr = getenv("HOME")) != NULL
|
||||
&& strlen(tempptr) < MAX_LEN - (sizeof(DIALOGRC) + 3)) {
|
||||
if (tempptr[0] == '\0' || lastch(tempptr) == '/')
|
||||
sprintf(str, "%s%s", tempptr, DIALOGRC);
|
||||
else
|
||||
sprintf(str, "%s/%s", tempptr, DIALOGRC);
|
||||
rc_file = fopen(str, "rt");
|
||||
}
|
||||
}
|
||||
|
||||
if (rc_file == NULL) { /* step (b) failed? */
|
||||
/* try step (c) */
|
||||
strcpy(str, GLOBALRC);
|
||||
if ((rc_file = fopen(str, "rt")) == NULL)
|
||||
return 0; /* step (c) failed, use default values */
|
||||
}
|
||||
|
||||
/* Scan each line and set variables */
|
||||
while ((result == 0) && (fgets(str, MAX_LEN, rc_file) != NULL)) {
|
||||
dlg_trace_msg("rc:%s\n", str);
|
||||
if (*str == '\0' || lastch(str) != '\n') {
|
||||
/* ignore rest of file if line too long */
|
||||
fprintf(stderr, "\nParse error: line %d of configuration"
|
||||
" file too long.\n", l);
|
||||
result = -1; /* parse aborted */
|
||||
break;
|
||||
}
|
||||
|
||||
lastch(str) = '\0';
|
||||
if (begins_with(str, "bindkey", ¶ms)) {
|
||||
dlg_parse_bindkey(params);
|
||||
continue;
|
||||
}
|
||||
parse = parse_line(str, &var, &value); /* parse current line */
|
||||
|
||||
switch (parse) {
|
||||
case LINE_EMPTY: /* ignore blank lines and comments */
|
||||
break;
|
||||
case LINE_EQUALS:
|
||||
/* search table for matching config variable name */
|
||||
if ((i = find_vars(var)) >= 0) {
|
||||
switch (vars[i].type) {
|
||||
case VAL_INT:
|
||||
*((int *) vars[i].var) = atoi(value);
|
||||
break;
|
||||
case VAL_STR:
|
||||
if (!isquote(value[0]) || !isquote(lastch(value))
|
||||
|| strlen(value) < 2) {
|
||||
fprintf(stderr, "\nParse error: string value "
|
||||
"expected at line %d of configuration "
|
||||
"file.\n", l);
|
||||
result = -1; /* parse aborted */
|
||||
} else {
|
||||
/* remove the (") quotes */
|
||||
value++;
|
||||
lastch(value) = '\0';
|
||||
strcpy((char *) vars[i].var, value);
|
||||
}
|
||||
break;
|
||||
case VAL_BOOL:
|
||||
if (!dlg_strcmp(value, "ON"))
|
||||
*((bool *) vars[i].var) = TRUE;
|
||||
else if (!dlg_strcmp(value, "OFF"))
|
||||
*((bool *) vars[i].var) = FALSE;
|
||||
else {
|
||||
fprintf(stderr, "\nParse error: boolean value "
|
||||
"expected at line %d of configuration "
|
||||
"file (found %s).\n", l, value);
|
||||
result = -1; /* parse aborted */
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifdef HAVE_COLOR
|
||||
} else if ((i = find_color(var)) >= 0) {
|
||||
int fg = 0;
|
||||
int bg = 0;
|
||||
int hl = 0;
|
||||
if (str_to_attr(value, &fg, &bg, &hl) == -1) {
|
||||
fprintf(stderr, "\nParse error: attribute "
|
||||
"value expected at line %d of configuration "
|
||||
"file.\n", l);
|
||||
result = -1; /* parse aborted */
|
||||
} else {
|
||||
dlg_color_table[i].fg = fg;
|
||||
dlg_color_table[i].bg = bg;
|
||||
dlg_color_table[i].hilite = hl;
|
||||
}
|
||||
} else {
|
||||
#endif /* HAVE_COLOR */
|
||||
fprintf(stderr, "\nParse error: unknown variable "
|
||||
"at line %d of configuration file:\n\t%s\n", l, var);
|
||||
result = -1; /* parse aborted */
|
||||
}
|
||||
break;
|
||||
case LINE_ERROR:
|
||||
fprintf(stderr, "\nParse error: syntax error at line %d of "
|
||||
"configuration file.\n", l);
|
||||
result = -1; /* parse aborted */
|
||||
break;
|
||||
}
|
||||
l++; /* next line */
|
||||
}
|
||||
|
||||
(void) fclose(rc_file);
|
||||
return result;
|
||||
}
|
40
contrib/dialog/samples/README
Normal file
40
contrib/dialog/samples/README
Normal file
@ -0,0 +1,40 @@
|
||||
-- $Id: README,v 1.3 2007/01/11 22:52:19 tom Exp $
|
||||
|
||||
You can set the environment-variable DIALOG to whatever program you
|
||||
want to check. Default is "dialog".
|
||||
|
||||
Use "export DIALOG=/usr/bin/dialog" for sh or "setenv DIALOG ../dialog" for csh
|
||||
to test the /usr/bin/dialog program.
|
||||
|
||||
-- Here is the original README for the samples directory.
|
||||
|
||||
There is no documentation at the moment for cdialog 0.9a, but here are a
|
||||
small installer (copismall) for 'points' fido-like, that uses cdialog 0.9a.
|
||||
It can demonstrate some of the new features... run "copismall" paying
|
||||
attention because after asking for some things, it then installs and/or
|
||||
configures programs like as Inn, Ifmail, Smail to make the 'point'.
|
||||
It's in Italian language only at moment, but the code is bash......
|
||||
If you want look at other much professional products FREE realized with
|
||||
cdialog and that use much of the other new characteristics, look for one of
|
||||
the ComeOn Point Suites v1.1+. Makers are a sub-group of the ComeOn Linux
|
||||
Development Team... ComeOn Linux! follows GNU philosophy.
|
||||
|
||||
Mail demarco_p@abramo.it to have the actual location of these Suites and
|
||||
of other free ComeOn Linux! software, or if you want more info about
|
||||
ComeOn Linux!
|
||||
|
||||
To run the "ComeOn Point Installer! v0.9a.small", type:
|
||||
$ copismall
|
||||
|
||||
Other external samples could be:
|
||||
|
||||
copa - ComeOn Point Administrator! v0.8
|
||||
copm - ComeOn Point Maintainer! v0.2
|
||||
copi - ComeOn Point Installer! v0.9 (system-wide version of copi)
|
||||
coepi - ComeOn Expert Point Installer! v1.3 (Professional)
|
||||
|
||||
cops - ComeOn Point Suite! v1.1
|
||||
copsp - ComeOn Point Suite Professional! v1.1
|
||||
|
||||
coui - ComeOn UUCP Installer! v0.1 (makes dialup networks in a moment)
|
||||
|
11
contrib/dialog/samples/calendar
Executable file
11
contrib/dialog/samples/calendar
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# $Id: calendar,v 1.9 2010/01/13 10:20:33 tom Exp $
|
||||
|
||||
. ./setup-vars
|
||||
|
||||
exec 3>&1
|
||||
RESULT=`$DIALOG --title "CALENDAR" "$@" --calendar "Please choose a date..." 0 0 7 7 1981 2>&1 1>&3`
|
||||
retval=$?
|
||||
exec 3>&-
|
||||
|
||||
. ./report-string
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user