Last release August 2016. See: https://people.debian.org/~godisch/wmweather/ --- wmWeather/BUGS | 9 - wmWeather/CHANGES | 108 ---- wmWeather/COPYING | 339 ---------- wmWeather/HINTS | 27 - wmWeather/INSTALL | 29 - wmWeather/Src/GrabWeather | 212 ------- wmWeather/Src/Makefile | 34 - wmWeather/Src/wmWeather.1 | 94 --- wmWeather/Src/wmWeather.c | 1220 ------------------------------------ wmWeather/Src/wmWeather_mask.xbm | 38 -- wmWeather/Src/wmWeather_master.gif | Bin 1734 -> 0 bytes wmWeather/Src/wmWeather_master.xpm | 162 ----- wmWeather/Src/xutils.c | 313 --------- wmWeather/Src/xutils.h | 47 -- 14 files changed, 2632 deletions(-) delete mode 100644 wmWeather/BUGS delete mode 100644 wmWeather/CHANGES delete mode 100644 wmWeather/COPYING delete mode 100644 wmWeather/HINTS delete mode 100644 wmWeather/INSTALL delete mode 100755 wmWeather/Src/GrabWeather delete mode 100644 wmWeather/Src/Makefile delete mode 100644 wmWeather/Src/wmWeather.1 delete mode 100644 wmWeather/Src/wmWeather.c delete mode 100644 wmWeather/Src/wmWeather_mask.xbm delete mode 100644 wmWeather/Src/wmWeather_master.gif delete mode 100644 wmWeather/Src/wmWeather_master.xpm delete mode 100644 wmWeather/Src/xutils.c delete mode 100644 wmWeather/Src/xutils.h
diff --git a/wmWeather/BUGS b/wmWeather/BUGS deleted file mode 100644 index 3afa0d5..0000000 --- a/wmWeather/BUGS +++ /dev/null @@ -1,9 +0,0 @@ -Please send bug reports to mghender...@lanl.gov - -Ones I know about; - - The wind speed is decoded only when it is listed in units of KT or MPS for the time being. - - The Station code needs to be 4 characters. This is a bug because some stations have - numbers as well, and while not standard METAR, some stations have 5 characters. - diff --git a/wmWeather/CHANGES b/wmWeather/CHANGES deleted file mode 100644 index 0ef2f78..0000000 --- a/wmWeather/CHANGES +++ /dev/null @@ -1,108 +0,0 @@ -wmWeather changes. - -Version Description -------------------------------------------------------------------------- -1.31 - released May 4, 1999. - fixed some conversion bugs in wind speed.. - - -1.30 - released April 13, 1999. - Fixed a bug whereby the App would crash when trying to gain input - focus under non-WindowMaker WMs (focus is now grabbed by - `PointerRoot' not `iconwin'). - - Added StationID and `time-of-last-update' labels. To do this I needed - to shrink the fonts down and scrunch them together a bit more. - - Added new command line option to change their color; - -tc <color> - - Added code to properly decode wind speed when in MPS. - - Fixed bug in beaufort wind speed calcs. - - -1.29 - released March 13, 1999. - Reorganized wmgeneral.c and renamed it xutils.c (wmgeneral.h - -> xutils.h as well ). Also moved it into the same directory as wmWeather. - Now, the openXwindow is split into 2 parts. You first need to call - initXwindow(argc, argv). This allows us to check the display depth - before we commit to a particular pixmap (this will be useful in my - other DockApps to dynamically set appropriate pixmaps based on depth). - Got rid of alot of the other routines that I never use. - - Added 4 more command line option to set the colors of the text: - - -bc <color> for setting the BackGround color. - -lc <color> for setting the Label color. - -dc <color> for setting the Data color. - -wgc <color> for setting the Wind Gust color. - - Also cleaned up the pixmap to minimize the number of colors used. - - Changed metric toggle to work with a key press (any key). - - Added double click support. Now double clicking does the following: - - Double Mouse Left: pops up the fully decoded METAR file - in xmessage. - - Double Mouse Middle: Currently undefined. - - Double Mouse Right: Forces a new update (i.e. download.) - - - - -1.28 - released March 9, 1999. - Changed -celsius (-c) option to -metric (-m). Naming makes more - sense that way... - - Added -W option to display WindChill instead of DewPoint. - Since Windchill is not always available, we only show it if its - available. If its not, we paste up DewPoint as default. - - Also added -mps option to display wind speed in units of - meters/second (when in -metric mode). - -1.27 - released March 8, 1999. - fixed bug in speed calculation when wind is gusting. - - -1.26 - released February 24, 1999. - Added -delay option. - -1.25 - released February 16, 1999. - Added Wind speeds on the 'Beaufort scale' - Thanks to Paul Martin <p...@zetnet.net> for this addition. - -1.24 - released February 12, 1999. - Added --passive-ftp option to wget... - -1.23 - released February 2, 1999. - Few more bug fixes... - Added support for different Pressure units... - -1.22 - released February 1, 1999. - Fixed minor bug in direction abbreviations. Added a bit more to man - page. - -1.21 - released January 29, 1999. - Fixed a problem in the perl script. Made the file paths absolute. - -1.2 - released January 29, 1999. - Added Wind speed line. Ended up decoding the Raw METAR line. - Fixed a few bugs... - Changed location of files from /tmp to ~/.wmWeatherReports - Changed units of pressure and wind speed to mmHg and km/h - when Celsius is set. (Really should change the flag to -metric). - -1.1 - Released Jan. 25, 1999. - Bug fixes. - Added Degrees F/C support... - Added a bit more info on where to find info on METAR/TAF - system... - -1.0 - Initial release. - Released Jan. 19, 1999. - diff --git a/wmWeather/COPYING b/wmWeather/COPYING deleted file mode 100644 index d159169..0000000 --- a/wmWeather/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, 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. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/wmWeather/HINTS b/wmWeather/HINTS deleted file mode 100644 index 0e93656..0000000 --- a/wmWeather/HINTS +++ /dev/null @@ -1,27 +0,0 @@ -Hints for wmWeather - - - -WindowMaker. ------------- -In WindowMaker simply drag and drop the wmWeather App on -the WindowMaker Dock or Clip. - - -Afterstep. ---------- -Afterstep users put the following in their .steprc -"Wharf wmWeather - MaxSwallow "wmWeather" wmWeather &". - -Note: AfterStep's Wharf has a problem with pixmaps that are -larger than 60x60 pixels. Please tell the AfterStep authors -to fix this, this is not our fault, but a Wharf problem! - - -Other window managers. ----------------------- -wmWeather shows as a 64x64 shaped icon on your desktop under other -window managers. - - - diff --git a/wmWeather/INSTALL b/wmWeather/INSTALL deleted file mode 100644 index c0bb693..0000000 --- a/wmWeather/INSTALL +++ /dev/null @@ -1,29 +0,0 @@ -Installation instructions for wmWeather. - -Requirements -------------------------------------------------------------------------------- -wmWeather requires the Xpm library (which should be available on most machines -with XFree86 installed). And it requires that the GNU wget utility be installed -as well. wget is a utility that allows you to grab stuff like html files and -images diretly off the www without using a graphical browser. (Also, you -obviously need to be connected to internet in a way that wget will work.) -You also need to have Perl installed. - -On FreeBSD systems you may need to use gmake instead of make. - -Installation -------------------------------------------------------------------------------- -1) gunzip wmWeather-1.29.tar.gz -1) tar -xvf wmWeather-1.29.tar -2) cd wmWeather-1.29/Src/ -3) make clean -4) make -5) make install (must be root) -6) wmWeather & (or 'wmWeather -h' for help, or 'man wmWeather' for the man page) -7) You need to set the location of perl correctly in GrabWeather if your perl - is located in a place other than /usr/bin/ - - - - - diff --git a/wmWeather/Src/GrabWeather b/wmWeather/Src/GrabWeather deleted file mode 100755 index 243c1b4..0000000 --- a/wmWeather/Src/GrabWeather +++ /dev/null @@ -1,212 +0,0 @@ -#!/usr/bin/perl - -# -# Grabs the latest local weather conditions from the National Weather Service (NWS). -# Uses the decoded METAR reports. -# -# Need to give the 4-character METAR station code on the Command Line. E.g.; -# -# GrabWeather KLAM -# - - - require "ctime.pl"; - - - # - # Change to users home directory. We used to dump into /tmp - # but using home dir instead avoids multiple users interfering - # with one another. (Yeah, we could "unique-ize" the filenames, but - # this is easier for now...) - # - $home = (getpwuid($<))[7]; - $ok = chdir() || chdir($home); - - - # - # Check to see if .wmWeatherReports exists. - # If not, make it and move to it. - # - if ( !(-e ".wmWeatherReports") ){ - mkdir(".wmWeatherReports", 0775); - } - chdir(".wmWeatherReports"); - - - - - - $StationID = $ARGV[0]; - $HTMLFileName = "$StationID.TXT"; - $URL = "ftp://weather.noaa.gov/data/observations/metar/decoded/$HTMLFileName"; - $DataFileName = "$StationID.dat"; - - - - - # - # I think some of these wget command line options may cause problems - # for some people? Dont know why... (Perhaps they have a ~/.wgetrc file - # that overrides command line options?). - # - $GrabCmd = "wget --proxy=off --passive-ftp --tries 0 -q -O $home/.wmWeatherReports/$StationID.TXT $URL"; - system "$GrabCmd"; - - - - - # - # Parse HTML File. - # - $Temp = -999.0; - $Chill = -999.0; - $DewPnt = -999.0; - $Pressure = -999.0; - $Hum = -999.0; - $Flag = 0; - open(TmpFile, "$HTMLFileName"); - while (<TmpFile>){ - chop; - if ($Flag == 0) { $StationInfo = $_; }; - if ($Flag == 1) { $UpdateTime = $_; }; - if ($_ =~ /^Sky conditions:/ ){ $SkyConditions = $_; $SkyConditions =~ s/Sky conditions: (.*)/\1/; } - if ($_ =~ /^Temperature:/ ){ $Temp = $_; $Temp =~ s/Temperature:\s*(\-{0,1}[0-9.]{1,}).*/\1/; } - if ($_ =~ /^Windchill:/ ){ $Chill = $_; $Chill =~ s/Windchill:\s*(\-{0,1}[0-9.]{1,}).*/\1/; } - if ($_ =~ /^Dew Point:/ ){ $DewPnt = $_; $DewPnt =~ s/Dew Point:\s*(\-{0,1}[0-9.]{1,}).*/\1/; } - if ($_ =~ /^Pressure \(.*\):/ ){ $Pressure = $_; $Pressure =~ s/Pressure \(.*\):\s*([0-9.]{2,}).*/\1/; } - if ($_ =~ /^Relative Humidity:/ ){ $Hum = $_; $Hum =~ s/Relative Humidity:\s*(\d{1,})\%.*/\1/; } - if ($_ =~ /^ob: / ){ $CodedMETAR = $_; $CodedMETAR =~ s/ob: (.*)/\1/; } - ++$Flag; - } - close(TmpFile); - - - - - # - # Isolate the Wind groups out of the coded METAR report. - # There may be two groups - the normal one and a variability set. - # - $WindGroup = $CodedMETAR; - $WindGroup =~ s/ RMK\s.*$//; - $VarWindGroup = $WindGroup; - - - if ($WindGroup =~ /.*\s\w{3}\d{2,3}KT\s\d{3}V\d{3}\s.*/ ) { - $VarWindGroup =~ s/.*\s\w{3}\d{2,3}KT\s(\d{3}V\d{3})\s.*/\1/; - $VarFlag = 1; - } elsif ($WindGroup =~ /.*\s\w{3}\d{2,3}MPS\s\d{3}V\d{3}\s.*/ ) { - $VarWindGroup =~ s/.*\s\w{3}\d{2,3}MPS\s(\d{3}V\d{3})\s.*/\1/; - $VarFlag = 1; - } elsif ($WindGroup =~ /.*\s\w{3}\d{2,3}G\d{2,3}KT\s(\d{2,3}V\d{2,3})\s.*/ ) { - $VarWindGroup =~ s/.*\s\w{3}\d{2,3}G\d{2,3}KT\s(\d{2,3}V\d{2,3})\s.*/\1/; - $VarFlag = 1; - } elsif ($WindGroup =~ /.*\s\w{3}\d{2,3}G\d{2,3}MPS\s(\d{2,3}V\d{2,3})\s.*/ ) { - $VarWindGroup =~ s/.*\s\w{3}\d{2,3}G\d{2,3}MPS\s(\d{2,3}V\d{2,3})\s.*/\1/; - $VarFlag = 1; - } else { - $VarWindGroup = ""; - $VarFlag = 0; - } - $Direction1 = $VarWindGroup; $Direction1 =~ s/(\d{3})V\d{3}/\1/; - $Direction2 = $VarWindGroup; $Direction2 =~ s/\d{3}V(\d{3})/\1/; - - - - $GustFlag = 0; - if ($WindGroup =~ /.*\s\w{3}\d{2,3}KT\s.*/ ) { - $WindGroup =~ s/.*\s(\w{3}\d{2,3}KT)\s.*/\1/; - $Direction = $WindGroup; $Direction =~ s/(\w{3})\d{2,3}KT/\1/; - $Speed = $WindGroup; $Speed =~ s/\w{3}(\d{2,3})KT/\1/; - } elsif ($WindGroup =~ /.*\s\w{3}\d{2,3}MPS\s.*/ ) { - $WindGroup =~ s/.*\s(\w{3}\d{2,3}MPS)\s.*/\1/; - $Direction = $WindGroup; $Direction =~ s/(\w{3})\d{2,3}MPS/\1/; - $Speed = $WindGroup; $Speed =~ s/\w{3}(\d{2,3})MPS/\1/; - $Speed *= 1.942; - } elsif ($WindGroup =~ /.*\s\w{3}\d{2,3}G\d{2,3}KT\s.*/ ) { - $WindGroup =~ s/.*\s(\w{3}\d{2,3}G\d{2,3}KT)\s.*/\1/; - $Direction = $WindGroup; $Direction =~ s/(\w{3})\d{2,3}G\d{2,3}KT/\1/; - $Speed1 = $WindGroup; $Speed1 =~ s/\w{3}(\d{2,3})G\d{2,3}KT/\1/; - $Speed2 = $WindGroup; $Speed2 =~ s/\w{3}\d{2,3}G(\d{2,3})KT/\1/; - $GustFlag = 1; - } elsif ($WindGroup =~ /.*\s\w{3}\d{2,3}G\d{2,3}MPS\s.*/ ) { - $WindGroup =~ s/.*\s(\w{3}\d{2,3}G\d{2,3}MPS)\s.*/\1/; - $Direction = $WindGroup; $Direction =~ s/(\w{3})\d{2,3}G\d{2,3}MPS/\1/; - $Speed1 = $WindGroup; $Speed1 =~ s/\w{3}(\d{2,3})G\d{2,3}MPS/\1/; - $Speed2 = $WindGroup; $Speed2 =~ s/\w{3}\d{2,3}G(\d{2,3})MPS/\1/; - $Speed1 *= 1.942; $Speed2 *= 1.942; - $GustFlag = 1; - } else { - $WindGroup = ""; - } - - - - # - # Get the Time out of the coded Metar Report. - # - $UniversalTime = $CodedMETAR; - if ($UniversalTime =~ /$StationID \d{1,2}\d{2}\d{2}Z/ ){ - - $UniversalTime =~ s/$StationID (\d{1,2})(\d{2})(\d{2})Z .*/\2:\3/; - - } else { - - $UniversalTime = "99:99"; - - } - - - - - - - - - - # - # Write out the stuff we need to the Data File. This is the file that will - # be read by wmWeather. - # - if ($Flag > 0){ - open(TmpFile, ">$DataFileName"); - print TmpFile "$StationInfo\n"; - print TmpFile "$UpdateTime\n"; - print TmpFile "$SkyConditions\n"; - print TmpFile "$UniversalTime\n"; - print TmpFile "$Temp\n"; - print TmpFile "$DewPnt\n"; - print TmpFile "$Chill\n"; - print TmpFile "$Pressure\n"; - print TmpFile "$Hum\n"; - - if ($Direction eq "" ){ - print TmpFile "-9999\n"; - } elsif ($Direction =~ /VRB/ ){ - print TmpFile "999\n"; - } elsif ($VarFlag) { - $Direction += 0; - print TmpFile "-$Direction\n"; - } else { - $Direction += 0; - print TmpFile "$Direction\n"; - } - - if ($WindGroup eq "" ) { - print TmpFile "-9999\n"; - } elsif ($GustFlag) { - $AvgSpeed = ($Speed1 + $Speed2)/2.0; - $AvgSpeed *= 1.15155; - print TmpFile "-$AvgSpeed\n"; - } else { - $Speed += 0; - $Speed *= 1.15155; - print TmpFile "$Speed\n"; - } - - close(TmpFile); - } - - - - diff --git a/wmWeather/Src/Makefile b/wmWeather/Src/Makefile deleted file mode 100644 index f09ac46..0000000 --- a/wmWeather/Src/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -CC = gcc -CFLAGS = -O2 -Wall -INCDIR = -I/usr/X11R6/include/X11 -I/usr/X11R6/include -DESTDIR= /usr/X11R6 -LIBDIR = -L/usr/X11R6/lib -# for linux -LIBS = -lXpm -lX11 -lXext -# for Solaris -# LIBS = -lXpm -lX11 -lXext -lsocket -OBJS = wmWeather.o \ - xutils.o - - -.c.o: - $(CC) $(CFLAGS) -D$(shell echo `uname -s`) -c $< -o $*.o $(INCDIR) - - -all: wmWeather.o wmWeather - -wmWeather.o: wmWeather_master.xpm wmWeather_mask.xbm -wmWeather: $(OBJS) - $(CC) $(CFLAGS) $(SYSTEM) -o wmWeather $^ $(INCDIR) $(LIBDIR) $(LIBS) - -clean: - for i in $(OBJS) ; do \ - rm -f $$i; \ - done - rm -f wmWeather - -install:: wmWeather - install -c -s -m 0755 wmWeather $(DESTDIR)/bin - install -c -m 0755 GrabWeather $(DESTDIR)/bin - install -c -m 0644 wmWeather.1 $(DESTDIR)/man/man1 - diff --git a/wmWeather/Src/wmWeather.1 b/wmWeather/Src/wmWeather.1 deleted file mode 100644 index 56ed778..0000000 --- a/wmWeather/Src/wmWeather.1 +++ /dev/null @@ -1,94 +0,0 @@ -.TH WMWEATHER 1.1 "19 January 1999" -.SH NAME -WMWEATHER \- Dockable Weather Monitor -.SH SYNOPSIS -.B wmWeather -station <4-char station ID> [-h] [-display <Display>] [-metric] [-kPa] [-hPa] [-mmHg] [-beaufort] [-mps] [-delay <Time in Minutes>] [-bc <color>] [-tc <color>] [-lc <color>] [-dc <color>] [-wgc <color>] -.SH DESCRIPTION -.PP -wmWeather monitors local weather conditions (temperature, Dew Point, Pressure, -Humidity and Wind direction and speed). The user needs to specify a -4-character `METAR station identifier code'. (The standardized METAR station -designations and current weather reports are designed for use by the aviation -community. Since most major cities have at least one airport, there is usually -one or more METAR stations in a given city.) You (obviously) need to be -connected to the internet and you also need to have wget installed (most linux -systems should have it already). wmWeather will then attempt to download the -latest METAR report for the station of your choice (from the National Weather -Sevice run by NOAA). -.PP -You can toggles back and forth between imperial and metric units. I.e. between -(degrees Fareheight, inches of Mercury, and miles per hour) and (degrees -Celsius, millimeters of Mercury, and kilometers per hour). Any key press will -do this. -.PP -Also, a left double click will bring up the fully decoded METAR report up in -xmessage. And a right double click will force an immediate update (i.e. -wmWeather will attempt to grab the weather information). -.PP -When the wind speed turns red, this means that the wind is gusty and the listed -value is an average only. Similarly, a red direction indicates a variable wind -direction and the value given is the average direction. -.PP -To find out more about the METAR/TAF system and to find the METAR code for your -location, look at http://www.nws.noaa.gov/oso/oso1/oso12/metar.htm for NOAA's -"National Weather Service METAR/TAF Information" page. To determine what your -station ID is use the lookup utility at: -http://www.nws.noaa.gov/oso/siteloc.shtml. -.SH OPTIONS -.TP -.B \-h -Display list of command-line options. -.TP -.B \-display <display> -Use an alternate X Display. -.TP -.B \-station <4-char station ID> (or \-s <4-char station ID>) -This option tells wmWeather which METAR station to show data for. -.TP -.B \-metric (or \-m) -Display temperatures in degrees Celsius. -.TP -.B \-kPa -When toggled to Celsius, display pressure in units of kPa. -.TP -.B \-hPa -When toggled to Celsius, display pressure in units of hPa (i.e. milliBars). -.TP -.B \-mmHg -When toggled to Celsius, display pressure in units of millimeters of Mercury. (This is -the default for Celsius when no other units are specified). -.TP -.B \-beaufort -When toggled to Celsius, display wind speeds on the "beaufort scale". -.TP -.B \-mps -When toggled to metric display, show windspeed in units of meters/second. -.TP -.B \-delay <Time in Minutes> -Override time (in minutes) between updates (default is 15 minutes). (Times are approximate.) -.TP -.B \-lc <color> -Set the color of the labels. (E.g. -lc red or -lc salmon or -lc #4523ff). -.TP -.B \-bc <color> -Set the background color. (#8e8e69 is LCD-ish). -.TP -.B \-dc <color> -Set the color of the data entries. -.TP -.B \-tc <color> -Set the color of the station ID/update time header. -.TP -.B \-wgc <color> -Set the gusty-wind/variable-direction color. The wind speed indicator will turn -this color when the wind speed is gusty. (The value shown in this case is the -average speed). Similarly, the wind direction indicator with change to this -color when the wind direction is variable. (The value shown in this case is the -average direction). -.SH BUGS -Let me know if/when you find any. -.SH NOTES -Requires that a (fairly recent) version of wget be installed on your machine. -You can download wget from "http://sunsite.auc.dk/wget/". -.SH AUTHOR -Michael G. Henderson <mghender...@lanl.gov> diff --git a/wmWeather/Src/wmWeather.c b/wmWeather/Src/wmWeather.c deleted file mode 100644 index 5733de6..0000000 --- a/wmWeather/Src/wmWeather.c +++ /dev/null @@ -1,1220 +0,0 @@ -/* - * - * wmWeather-1.31 (C) 1999 Mike Henderson (mghender...@lanl.gov) - * - * - Shows Local Weather conditions - * - * - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program (see the file COPYING); if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * - * - * - * ToDo: - * - * - Add a GTK popup window to display data in a nicer way. Currently just use - * xmessage... - * - * - Add "current conditions" graphic (as background?). I.e. one of those little - * cartoons that show clouds or sun with rain or snow, etc. on it... - * - * - Scrolling line to display "sundry" parameters. - * - * - Or maybe auto-switch between panels at some user-defined rate? - * - * - * Changes: - * - * Version 1.31 - released May 4, 1999. - * fixed some conversion bugs in wind speed.. - * - * Version 1.30 - released April 13, 1999. - * Fixed a bug whereby the App would crash when trying to gain input - * focus under non-WindowMaker WMs (focus is now grabbed by - * `PointerRoot' not `iconwin'). - * - * Added StationID and `time-of-last-update' labels. To do this I needed - * to shrink the fonts down and scrunch them together a bit more. - * - * Added new command line option to change their color; - * -tc <color> - * - * Added code to properly decode wind speed when in MPS. - * - * Fixed bug in beaufort wind speed calcs. - * - * Version 1.29 - released March 17, 1999. - * Reorganized wmgeneral.c and renamed it xutils.c (wmgeneral.h - * -> xutils.h as well ). Also moved it into the same directory as wmWeather. - * Now, the openXwindow is split into 2 parts. You first need to call - * initXwindow(argc, argv). This allows us to check the display depth - * before we commit to a particular pixmap (this will be useful in my - * other DockApps to dynamically set appropriate pixmaps based on depth). - * Got rid of alot of the other routines that I never use. - * - * Added 4 more command line option to set the colors of the text: - * - * -bc <color> for setting the BackGround color. - * -lc <color> for setting the Label color. - * -dc <color> for setting the Data color. - * -wgc <color> for setting the Wind Gust color. - * - * Also cleaned up the pixmap to minimize the number of colors used. - * - * Changed metric toggle to work with a key press (any key). - * - * Added double click support. Now double clicking does the following: - * - * Double Mouse Left: pops up the fully decoded METAR file - * in xmessage. - * - * Double Mouse Middle: Currently undefined. - * - * Double Mouse Right: Forces a new update (i.e. download.) - * - * - * Version 1.28 - released March 9, 1999. - * Changed -celsius (-c) option to -metric (-m). Naming makes more - * sense that way... - * - * Added -W option to display WindChill instead of DewPoint. - * Since Windchill is not always available, we only show it if its - * available. If its not, we paste up DewPoint as default. - * - * Also added -mps option to display wind speed in units of - * meters/second (when in -metric mode). - * - * Version 1.27 - released March 8, 1999. - * fixed bug in speed calculation when wind is gusting. - * - * Version 1.26 - released February 24, 1999. - * Added -delay option. - * - * Version 1.25 - released February 16, 1999. - * Added Wind speeds on the 'Beaufort scale' - * Thanks to Paul Martin <p...@zetnet.net> for this addition. - * - * Version 1.24 - released February 12, 1999. - * Added --passive-ftp option to wget. - * - * Version 1.23 - released February 2, 1999. - * Few more bug fixes... - * Added support for different Pressure units... - * - * - * Version 1.22 - released February 1, 1999. - * Fixed minor bug in direction abbreviations. Added a bit more to man - * page. - * - * Version 1.21 - released January 29, 1999. - * Fixed a problem in the perl script. Made the file paths absolute. - * - * Version 1.2 - released January 29, 1999. - * Added Wind speed line. Ended up decoding the Raw METAR line. - * Fixed a few bugs... - * Changed location of files from /tmp to ~/.wmWeatherReports - * Changed units of pressure and wind speed to mmHg and km/h - * when Metric is set. (Really should change the flag to -metric). - * - * Version 1.1 - released January 25, 1999. - * Bug fixes... - * Added command line switch to display Temp's in deg. C - * - * - * Version 1.0 - released January 19, 1999. - * - * - */ - - - - - -/* - * Includes - */ -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <time.h> -#include <X11/X.h> -#include <X11/xpm.h> -#include "xutils.h" -#include "wmWeather_master.xpm" -#include "wmWeather_mask.xbm" - - - -/* - * Delay between refreshes (in microseconds) - */ -#define DELAY 10000L -#define WMWEATHER_VERSION "1.31" -#define DEFAULT_UPDATEDELAY 900L - - - - -void ParseCMDLine(int argc, char *argv[]); -void ButtonPressEvent(XButtonEvent *); -void KeyPressEvent(XKeyEvent *); -char *StringToUpper(char *); - - -char StationID[10]; -int UpToDate = 0; -int ShowWindChill = 0; -int WindChillAvail = 1; -int Metric = 0; -int Beaufort = 0; -int ForceUpdate = 1; -int ForceDownload = 1; -int PressureUnits = 0; -int MetersPerSecond = 0; -double PressureConv = 1.0; -long UpdateDelay; -int GotFirstClick1, GotDoubleClick1; -int GotFirstClick2, GotDoubleClick2; -int GotFirstClick3, GotDoubleClick3; -int DblClkDelay; - - -/* - * In a more readable form the Compass directions are: - * static char *CompassDirection[] = { "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", - * "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"} - * We convert to digits in the sequence `NWSE' so we dont have to put all these - * combinations into the pixmap. - */ -static char *CompassDirection[] = { "0", "003", "03", "303", "3", "323", "23", "223", - "2", "221", "21", "121", "1", "101", "01", "001"}; - - - -char LabelColor[30] = "#79bdbf"; -char WindGustColor[30] = "#ff0000"; -char DataColor[30] = "#ffbf50"; -char BackColor[30] = "#181818"; -char StationTimeColor[30] = "#c5a6ff"; - - - -/* - * main - */ -int main(int argc, char *argv[]) { - -struct tm *tTime; -XEvent event; -int n, s, m, dt1, dt2, dt3, yd; -int i, j, len; -char dir[5]; -int Year, Month, Day; -int Hours, Mins, Secs; -int UpdateLTHour = 0.0, UpdateLTMin = 0.0, UpdateUTHour, UpdateUTMin; -long CurrentLocalTime; -double UpdateUT, UpdateLT, UT, LT, DT, hour24(); - - -double jd(), CurrentJD; -char command[1024], Line[512], FileName[10]; -int Tens, q, digit, chr; -double Pressure, Temperature, sgn, Humidity, DewPoint, WindChill, val; -double Direction, Speed; -FILE *fp; - - - - - - - - - - - - /* - * Parse any command line arguments. - */ - ParseCMDLine(argc, argv); - - - - /* - * Do the window opening in 2 stages. After the initXwindow() call, - * we know what the Depth of the Display is. We can then pick an appropriate - * XPM to use. I.e. may want to use one that has fewer colors to make the App work - * better on a low-color 8-bit display. - */ - initXwindow(argc, argv); - openXwindow(argc, argv, wmWeather_master, wmWeather_mask_bits, wmWeather_mask_width, - wmWeather_mask_height, BackColor, LabelColor, WindGustColor, DataColor, StationTimeColor); - - - - - /* - * Loop until we die - */ - n = 32000; - s = 32000; - m = 32000; - dt1 = 32000; - dt2 = 32000; - dt3 = 32000; - DblClkDelay = 32000; - UpToDate = 0; - while(1) { - - - - - /* - * Keep track of # of seconds - */ - if (m > 100){ - - m = 0; - ++dt1; - ++dt2; - ++dt3; - - } else { - - /* - * Increment counter - */ - ++m; - - } - - - - - - - /* - * Double Click Delays - * Keep track of click events. If Delay too long, set GotFirstClick's to False. - */ - if (DblClkDelay > 15) { - - DblClkDelay = 0; - GotFirstClick1 = 0; GotDoubleClick1 = 0; - GotFirstClick2 = 0; GotDoubleClick2 = 0; - GotFirstClick3 = 0; GotDoubleClick3 = 0; - - } else { - - ++DblClkDelay; - - } - - - - - - - - - - - - - /* - * Process any pending X events. - */ - while(XPending(display)){ - XNextEvent(display, &event); - switch(event.type){ - case Expose: - RedrawWindow(); - break; - case ButtonPress: - ButtonPressEvent(&event.xbutton); - break; - case KeyPress: - KeyPressEvent(&event.xkey); - break; - case ButtonRelease: - break; - case EnterNotify: - XSetInputFocus(display, PointerRoot, RevertToParent, CurrentTime); - break; - case LeaveNotify: - XSetInputFocus(display, PointerRoot, RevertToParent, CurrentTime); - break; - - } - } - - - - - - - - - /* - * Check the Current Conditions file every (approx.) several seconds. - * Can significantly reduce this frequency later. But its - * easier to debug this way... - * Do this before trying to download again! The file may be there and it - * may be Up-To-Date! - */ - if ((dt2 > 5)||(ForceUpdate)){ - - dt2 = 0; - - /* - * Compute Current Julian Date - */ - CurrentLocalTime = time(CurrentTime); - tTime = gmtime(&CurrentLocalTime); - Year = tTime->tm_year+1900; - Month = tTime->tm_mon+1; - Day = tTime->tm_mday; - Hours = tTime->tm_hour; - Mins = tTime->tm_min; - Secs = tTime->tm_sec; - UT = (double)Hours + (double)Mins/60.0 + (double)Secs/3600.0; - CurrentJD = jd(Year, Month, Day, UT); - - CurrentLocalTime = time(CurrentTime); - tTime = localtime(&CurrentLocalTime); - Year = tTime->tm_year+1900; - Month = tTime->tm_mon+1; - Day = tTime->tm_mday; - Hours = tTime->tm_hour; - Mins = tTime->tm_min; - Secs = tTime->tm_sec; - LT = (double)Hours + (double)Mins/60.0 + (double)Secs/3600.0; - - DT = UT - LT; - if (DT > 24.0) DT -= 24.0; - if (DT < 0.00) DT += 24.0; - - - - /* - * Read in weather data - */ - sprintf(FileName, "%s/.wmWeatherReports/%s.dat", getenv("HOME"), StationID); - if ((fp = fopen(FileName, "r")) != NULL){ - - fgets(Line, 512, fp); - fgets(Line, 512, fp); - fgets(Line, 512, fp); - fscanf(fp, "%d:%d", &UpdateUTHour, &UpdateUTMin); - if (UpdateUTHour != 99){ - UpdateUT = UpdateUTHour + UpdateUTMin/60.0; - UpdateLT = UpdateUT - DT; - if (UpdateLT < 0.0) UpdateLT += 24.0; - if (UpdateLT > 24.0) UpdateLT -= 24.0; - UpdateLTHour = (int)UpdateLT; - UpdateLTMin = (int)((UpdateLT - (double)UpdateLTHour)*60.0 + 0.5); - if (UpdateLTMin >= 60){ - ++UpdateLTHour; - if (UpdateLTHour >= 24) UpdateLTHour = 0; - UpdateLTMin = 0; - } - } else { - UpdateLTHour = 99; - UpdateLTMin = 99; - } - - fscanf(fp, "%lf", &Temperature); - if (Metric) Temperature = (Temperature-32.0)*5.0/9.0; - fscanf(fp, "%lf", &DewPoint); - if (Metric) DewPoint = (DewPoint-32.0)*5.0/9.0; - - fscanf(fp, "%lf", &WindChill); - /* - * If WindChill is not available, revert to DewPoint - */ - WindChillAvail = (WindChill < -900.0) ? 0 : 1; - if (Metric) WindChill = (WindChill-32.0)*5.0/9.0; - - fscanf(fp, "%lf", &Pressure); Pressure += 0.005; - Pressure *= PressureConv; - fscanf(fp, "%lf", &Humidity); - fscanf(fp, "%lf", &Direction); - fscanf(fp, "%lf", &Speed); - if (Metric){ - if (MetersPerSecond) Speed *= 0.4473; - else if (!Beaufort) Speed *= 1.609; - } - fclose(fp); - - } else { - - Temperature = -9999.0; - DewPoint = -9999.0; - WindChill = -9999.0; - Humidity = -9999.0; - Pressure = -9999.0; - Direction = -9999.0; - Speed = -9999.0; - - } - - - - } - - - - - - - - /* - * Draw window. - */ - if ( (dt3 > 5) || ForceUpdate){ - - - dt3 = 0; - - - - /* - * Clear window. - */ - copyXPMArea(5, 69, 54, 54, 5, 5); - - - /* - * Paste up Station ID and time of last update. - */ - - q = 0; - chr = (int)StationID[0] - 65; copyXPMArea(chr*5+2, 128, 5, 6, 7+q, 6); q+= 5; - chr = (int)StationID[1] - 65; copyXPMArea(chr*5+2, 128, 5, 6, 7+q, 6); q+= 5; - chr = (int)StationID[2] - 65; copyXPMArea(chr*5+2, 128, 5, 6, 7+q, 6); q+= 5; - chr = (int)StationID[3] - 65; copyXPMArea(chr*5+2, 128, 5, 6, 7+q, 6); q+= 5; - - if (UpdateLTHour != 99){ - q = 0; - Tens = (int)(UpdateLTHour); - copyXPMArea(Tens/10*5+2, 135, 5, 6, 36+q, 6); q+= 5; - copyXPMArea(Tens%10*5+2, 135, 5, 6, 36+q, 6); q+= 5; - copyXPMArea(53, 135, 1, 6, 36+q, 6); q+= 2; - Tens = (int)(UpdateLTMin); - copyXPMArea(Tens/10*5+2, 135, 5, 6, 36+q, 6); q+= 5; - copyXPMArea(Tens%10*5+2, 135, 5, 6, 36+q, 6); q+= 5; - } - - - - - - - - - - /* - * Paste up Temperature. - */ - if ((Temperature > -999.0)&&(Temperature < 1000.0)){ - sgn = (Temperature < 0.0) ? -1.0 : 1.0; - Temperature *= sgn; - Temperature = (double)((int)(Temperature + 0.5)); - q = 0; - if (Temperature >= 100.0){ - if (sgn < 0.0) { copyXPMArea(0*5+66, 35, 5, 6, 25, 15); q += 5; } - digit = (int)(Temperature/100.0); - copyXPMArea(digit*5+66, 57, 5, 6, 25+q, 15); q+= 5; - Tens = (int)(Temperature-digit*100.0); - copyXPMArea(Tens/10*5+66, 57, 5, 6, 25+q, 15); q+= 5; - copyXPMArea(Tens%10*5+66, 57, 5, 6, 25+q, 15); q+= 5; - } else { - if (sgn < 0.0) { copyXPMArea(0*5+66, 35, 5, 6, 25, 15); q += 5; } - Tens = (int)(Temperature); - if (Tens >= 10) { copyXPMArea(Tens/10*5+66, 57, 5, 6, 25+q, 15); q+= 5; } - copyXPMArea(Tens%10*5+66, 57, 5, 6, 25+q, 15); q+= 5; - } - if (Metric){ - copyXPMArea(72, 34, 3, 3, 25+q, 14); q += 4; - copyXPMArea(81, 35, 4, 6, 25+q, 15); - } else { - copyXPMArea(72, 34, 8, 7, 25+q, 14); - } - - } - - - - - - - /* - * Paste up DewPoint or WindChill Temperature. - */ - if (ShowWindChill && WindChillAvail){ - val = WindChill; - copyXPMArea(66, 87, 17, 8, 5, 24); - } else { - val = DewPoint; - copyXPMArea(5, 87, 17, 8, 5, 24); - } - - if ((val > -999.0)&&(val < 1000.0)){ - sgn = (val < 0.0) ? -1.0 : 1.0; - val *= sgn; - val = (double)((int)(val + 0.5)); - q = 0; - if (val >= 100.0){ - if (sgn < 0.0) { copyXPMArea(0*5+66, 57, 5, 6, 25, 24); q += 5; } - digit = (int)(val/100.0); - copyXPMArea(digit*5+66, 57, 5, 6, 25+q, 24); q+= 5; - Tens = (int)(val-digit*100.0); - copyXPMArea(Tens/10*5+66, 57, 5, 6, 25+q, 24); q+= 5; - copyXPMArea(Tens%10*5+66, 57, 5, 6, 25+q, 24); q+= 5; - } else { - if (sgn < 0.0) { copyXPMArea(0*5+66, 35, 5, 6, 25, 24); q += 5; } - Tens = (int)(val); - if (Tens >= 10) { copyXPMArea(Tens/10*5+66, 57, 5, 6, 25+q, 24); q+= 5; } - copyXPMArea(Tens%10*5+66, 57, 5, 6, 25+q, 24); q+= 5; - } - if (Metric){ - copyXPMArea(72, 34, 3, 3, 25+q, 23); q += 4; - copyXPMArea(81, 35, 4, 6, 25+q, 24); - } else { - copyXPMArea(72, 34, 8, 7, 25+q, 23); - } - } - - - - - - - - - - /* - * Paste up Pressure. - */ - q = 0; s= 0; - if ((Pressure > 0.0)&&(Pressure <= 10000.0)){ - val = Pressure; - - digit = (int)(val/1000.0); - if (digit > 0) { copyXPMArea(digit*5+66, 57, 5, 6, 25+q, 33); q += 5; } - val -= (double)digit*1000; - - digit = (int)(val/100.0); - if ((digit > 0)||(Pressure > 999.0)) { copyXPMArea(digit*5+66, 57, 5, 6, 25+q, 33); q += 5; } - val -= (double)digit*100; - - digit = (int)(val/10.0); - if ((digit > 0)||(Pressure > 99.0)) { copyXPMArea(digit*5+66, 57, 5, 6, 25+q, 33); q += 5; } - val -= (double)digit*10; - - digit = (int)val; - copyXPMArea(digit*5+66, 57, 5, 6, 25+q, 33); q += 5; - val -= (double)digit; - - - if ((PressureUnits != 2)||(!Metric)){ - - copyXPMArea(10*5+66+1, 57, 4, 6, 25+q, 33); q += 4; - - val *= 10; digit = (int)val; - copyXPMArea(digit*5+66, 57, 5, 6, 25+q, 33); q += 5; - val -= (double)digit; - - if (!Metric){ - val *= 10; digit = (int)val; - copyXPMArea(digit*5+66, 57, 5, 6, 25+q, 33); q += 5; - /* val -= (double)digit; */ - } - } - - - } - - - - - - - - /* - * Paste up Humidity. - */ - q = 0; - if ((Humidity > -999.0)&&(Humidity <= 100.0)){ - if (Humidity == 100.0){ - copyXPMArea(1*5+66, 57, 5, 6, 25+q, 42); q += 5; - copyXPMArea(0*5+66, 57, 5, 6, 25+q, 42); q += 5; - copyXPMArea(0*5+66, 57, 5, 6, 25+q, 42); q += 5; - } else { - Tens = (int)(Humidity); - if (Tens >= 10) { copyXPMArea(Tens/10*5+66, 57, 5, 6, 25+q, 42); q += 5; } - copyXPMArea(Tens%10*5+66, 57, 5, 6, 25+q, 42); q += 5; - } - copyXPMArea(121, 57, 5, 6, 25+q, 42); - - } - - - - - - - - - /* - * Paste up Wind Info. - */ - if ((Direction == 0.0)&&(Speed == 0.0)){ - - /* - * Just write out `Calm' if both values are 0 - */ - copyXPMArea(66, 4, 23, 7, 25, 51); - - } else { - - /* - * If the Direction < 0 this means that there was a "Wind direction - * Variability Group" found in the METAR code. I.e. Direction is variable. - * I think value should be the average. In any case flag it by making it a - * different color. - * - * Likewise, if Speed < 0, this means that a "Gusty" modifier was found - * in the RAW METAR code, and the value is only the average of the low - * and high values given. Again, flag it in a different color... - * - */ - if ((Direction >= -360.0)&&(Direction <= 360.0)){ - sgn = (Direction < 0.0) ? -1.0 : 1.0; - yd = (sgn < 0.0) ? 50 : 43; - Direction *= sgn; - q = 0; - i = (int)(Direction/360.0*16.0 + 0.5); - if (i>15) i = 0; - strcpy(dir, CompassDirection[i]); - len = strlen(dir); - for (j=0; j<len; ++j){ - digit = (int)dir[j] - 48; - copyXPMArea(digit*5+66, yd, 5, 6, 25+q, 51); q+= 5; - } - q += 2; - } else if (Direction > 0.0){ - - /* - * In this case, the wind direction is variable with speed < 6 Knots. - * A numerical direction is not given in these cases. Just write out 'VRB'. - */ - q = 0; - copyXPMArea(4*5+66, 43, 5, 6, 25+q, 51); q+= 5; - copyXPMArea(5*5+66, 43, 5, 6, 25+q, 51); q+= 5; - copyXPMArea(6*5+66, 43, 5, 6, 25+q, 51); q+= 9; - } - - if (Metric && Beaufort) { - int beau = 0; - int spd; - - sgn = (Speed < 0.0) ? -1.0 : 1.0; - spd = (int)(sgn * (int)Speed); - if (spd > 1) { beau = 1; } - if (spd > 3) { beau = 2; } - if (spd > 4) { beau = 3; } - if (spd > 10) { beau = 4; } - if (spd > 16) { beau = 5; } - if (spd > 21) { beau = 6; } - if (spd > 27) { beau = 7; } - if (spd > 33) { beau = 8; } - if (spd > 40) { beau = 9; } - if (spd > 47) { beau = 10; } - if (spd > 55) { beau = 11; } - if (spd > 63) { beau = 12; } - if (spd > 71) { beau = 13; } - Speed = sgn * (double) beau; - q++; copyXPMArea(76, 35, 4, 6, 25+q, 51); q+= 6; - } - - - if ((Speed > -999.0)&&(Speed < 1000.0)){ - sgn = (Speed < 0.0) ? -1.0 : 1.0; - yd = (sgn < 0.0) ? 64 : 57; - Speed *= sgn; - if (Speed >= 100.0){ - digit = (int)(Speed/100.0); - copyXPMArea(digit*5+66, yd, 5, 6, 25+q, 51); q+= 5; - Tens = (int)(Speed-digit*100.0); - copyXPMArea(Tens/10*5+66, yd, 5, 6, 25+q, 51); q+= 5; - copyXPMArea(Tens%10*5+66, yd, 5, 6, 25+q, 51); q+= 5; - } else { - Tens = (int)(Speed); - if (Tens >= 10) { copyXPMArea(Tens/10*5+66, yd, 5, 6, 25+q, 51); q+= 5; } - copyXPMArea(Tens%10*5+66, yd, 5, 6, 25+q, 51); q+= 5; - } - } - - } - - - - - - - - - /* - * Make changes visible - */ - RedrawWindow(); - - - - } - - - - /* - * Reset "force update" flag - */ - ForceUpdate = 0; - - - - - /* - * Check every 5 min if the values are not up to date... - */ -/* - * We still need to add a flashing LED to warn about - * times that are out of date. Also need to determine if it is uptodate... - */ -UpToDate = 0; - if (((!UpToDate)&&(dt1 > UpdateDelay)) || ForceDownload){ - - dt1 = 0; - - /* - * Execute Perl script to grab the Latest METAR Report - */ - sprintf(command, "GrabWeather %s &", StationID); - system(command); - - ForceDownload = 0; - ForceUpdate = 1; - - } - - - - - - /* - * Wait for next update - */ - usleep(DELAY); - - - } - - - -} - - - -/* - * ParseCMDLine() - */ -void ParseCMDLine(int argc, char *argv[]) { - - int i; - void print_usage(); - - StationID[0] = '\0'; - PressureUnits = 0; - MetersPerSecond = 0; - ShowWindChill = 0; - UpdateDelay = DEFAULT_UPDATEDELAY; - for (i = 1; i < argc; i++) { - - if (!strcmp(argv[i], "-display")){ - - ++i; - - } else if (!strcmp(argv[i], "-bc")){ - - if ((i+1 >= argc)||(argv[i+1][0] == '-')) { - fprintf(stderr, "wmWeather: No color found\n"); - print_usage(); - exit(-1); - } - strcpy(BackColor, argv[++i]); - - } else if (!strcmp(argv[i], "-tc")){ - - if ((i+1 >= argc)||(argv[i+1][0] == '-')) { - fprintf(stderr, "wmWeather: No color found\n"); - print_usage(); - exit(-1); - } - strcpy(StationTimeColor, argv[++i]); - - } else if (!strcmp(argv[i], "-lc")){ - - if ((i+1 >= argc)||(argv[i+1][0] == '-')) { - fprintf(stderr, "wmWeather: No color found\n"); - print_usage(); - exit(-1); - } - strcpy(LabelColor, argv[++i]); - - } else if (!strcmp(argv[i], "-wgc")){ - - if ((i+1 >= argc)||(argv[i+1][0] == '-')) { - fprintf(stderr, "wmWeather: No color found\n"); - print_usage(); - exit(-1); - } - strcpy(WindGustColor, argv[++i]); - - } else if (!strcmp(argv[i], "-dc")){ - - if ((i+1 >= argc)||(argv[i+1][0] == '-')) { - fprintf(stderr, "wmWeather: No color found\n"); - print_usage(); - exit(-1); - } - strcpy(DataColor, argv[++i]); - - } else if (!strcmp(argv[i], "-beaufort")){ - - Beaufort = 1; - - } else if (!strcmp(argv[i], "-mps")){ - - MetersPerSecond = 1; - - } else if (!strcmp(argv[i], "-W")){ - - ShowWindChill = 1; - - } else if ((!strcmp(argv[i], "-metric"))||(!strcmp(argv[i], "-m"))){ - - Metric = 1; - - } else if (!strcmp(argv[i], "-kPa")){ - - PressureUnits = 1; - PressureConv = 3.38639; - - } else if (!strcmp(argv[i], "-hPa")){ - - PressureUnits = 2; - PressureConv = 33.8639; - - } else if (!strcmp(argv[i], "-mmHg")){ - - PressureUnits = 3; - PressureConv = 25.4; - - } else if ((!strcmp(argv[i], "-station"))||(!strcmp(argv[i], "-s"))){ - - if ((i+1 >= argc)||(argv[i+1][0] == '-')) { - fprintf(stderr, "wmWeather: No METAR station ID found\n"); - print_usage(); - exit(-1); - } - strcpy(StationID, StringToUpper(argv[++i])); - - } else if (!strcmp(argv[i], "-delay")) { - - if( (i+1 >= argc)||(argv[i+1][0] == '-')) { - - fprintf(stderr,"You must give a time with the -delay option.\n"); - print_usage(); - exit(-1); - - } else if(sscanf(argv[i+1], "%ld", &UpdateDelay) != 1) { - - fprintf(stderr,"Dont understand the delay time you have entered (%s).\n", argv[i+1]); - print_usage(); - exit(-1); - - } - /* - * Convert Time to seconds - */ - UpdateDelay *= 60; - ++i; - - } else { - - print_usage(); - exit(-11); - - } - } - - if (StationID[0] == '\0') { - fprintf(stderr, "\nwmWeather: You must specify a METAR station code\n\n"); - print_usage(); - exit(1); - } - - if ((Metric)&&(PressureUnits == 0)){ - PressureUnits = 3; - PressureConv = 25.4; - } - - if (!Metric){ - PressureConv = 1.0; - } - - if (Beaufort && MetersPerSecond){ - fprintf(stderr, "\nwmWeather: You cant use both -beaufort and -mps together.\n\n"); - print_usage(); - exit(1); - } - -} - - -void print_usage(){ - - printf("\nwmWeather version: %s\n", WMWEATHER_VERSION); - printf("\nusage: wmWeather -s <StationID> [-display <Display>] [-h] [-metric] [-kPa] [-hPa] [-mmHg]\n"); - printf(" [-beaufort] [-mps] [-W] [-delay <Time in Minutes>] [-bc <color>]\n"); - printf(" [-lc <color>] [-dc <color>] [-wgc <color>] [-tc <color>]\n\n"); - printf("\t-display <Display>\t\tUse alternate X display.\n\n"); - printf("\t-h\t\t\t\tDisplay help screen.\n"); - printf("\n\t-station <METAR StationID>\n"); - printf("\t-s <METAR StationID>\tThe 4-character METAR Station ID.\n\n"); - printf("\t-W\t\t\t\tIf available, display WindChill instead\n"); - printf("\t\t\t\t\tof DewPoint Temperature.\n"); - printf("\t-metric\n"); - printf("\t-m\t\t\t\tDisplay variables in metric units.\n\n"); - printf("\t-kPa\t\t\t\tWhen toggled to metric display, show pressure\n"); - printf("\t\t\t\t\tin units of kPa.\n\n"); - printf("\t-hPa\t\t\t\tWhen toggled to metric display, show pressure\n"); - printf("\t\t\t\t\tin units of hPa.\n\n"); - printf("\t-mmHg\t\t\t\tWhen toggled to metric display, show pressure\n"); - printf("\t\t\t\t\tin units of mmHg. (This is the default for metric).\n\n"); - printf("\t-beaufort\t\t\tWhen toggled to metric display, show windspeed\n"); - printf("\t\t\t\t\ton the Beaufort scale. (default is km/h.)\n\n"); - printf("\t-mps\t\t\t\tWhen toggled to metric display, show windspeed\n"); - printf("\t\t\t\t\tin units of meters/second. (default is km/h.)\n\n"); - printf("\t-bc <color>\t\t\tBackground color. (#7e9e69 is a greenish LCD color).\n\n"); - printf("\t-lc <color>\t\t\tLabel color.\n\n"); - printf("\t-dc <color>\t\t\tData color.\n\n"); - printf("\t-wgc <color>\t\t\tGusty-wind/variable-direction color.\n\n"); - printf("\t-tc <color>\t\t\tStation ID and Time color.\n\n"); - printf("\t-delay <Time in Minutes>\tOverride time (in minutes) between updates (default\n"); - printf("\t\t\t\t\tis %ld minutes). (Times are approximate.)\n", DEFAULT_UPDATEDELAY/60); - printf("\n\nTo find out more about the METAR/TAF system and to find the \n"); - printf("METAR code for your location, look at:\n\n"); - printf(" http://www.nws.noaa.gov/oso/oso1/oso12/metar.htm \n\n"); - printf("for NOAA's ""National Weather Service METAR/TAF Information"" page.\n"); - printf("To locate your site ID go to NOAA's ""Meteorological Station Information\nLookup"" page at:\n\n"); - printf(" http://www.nws.noaa.gov/oso/siteloc.shtml\n\n"); - -} - - - - - - - - -/* - * Compute the Julian Day number for the given date. - * Julian Date is the number of days since noon of Jan 1 4713 B.C. - */ -double jd(ny, nm, nd, UT) -int ny, nm, nd; -double UT; -{ - double A, B, C, D, JD, day; - - day = nd + UT/24.0; - - - if ((nm == 1) || (nm == 2)){ - ny = ny - 1; - nm = nm + 12; - } - - if (((double)ny+nm/12.0+day/365.25)>=(1582.0+10.0/12.0+15.0/365.25)){ - A = ((int)(ny / 100.0)); - B = 2.0 - A + (int)(A/4.0); - } - else{ - B = 0.0; - } - if (ny < 0.0){ - C = (int)((365.25*(double)ny) - 0.75); - } - else{ - C = (int)(365.25*(double)ny); - } - - D = (int)(30.6001*(double)(nm+1)); - - - JD = B + C + D + day + 1720994.5; - return(JD); - -} - - - -/* - * This routine handles button presses. - * - * - Left Mouse single click toggles Deg F/C for temperatures. - * - Some other click event should display the full METAR report -- lots of - * juicy stuff in there... Should bring up a separate window... - * - * - */ -void ButtonPressEvent(XButtonEvent *xev){ - - char Command[80]; - - /* - * Process single clicks. - */ - DblClkDelay = 0; - if ((xev->button == Button1) && (xev->type == ButtonPress)){ - - if (GotFirstClick1) GotDoubleClick1 = 1; - else GotFirstClick1 = 1; - - } else if ((xev->button == Button2) && (xev->type == ButtonPress)){ - - if (GotFirstClick2) GotDoubleClick2 = 1; - else GotFirstClick2 = 1; - - } else if ((xev->button == Button3) && (xev->type == ButtonPress)){ - - if (GotFirstClick3) GotDoubleClick3 = 1; - else GotFirstClick3 = 1; - - } - - - - - /* - * We got a double click on Mouse Button1 (i.e. the left one) - */ - if (GotDoubleClick1) { - GotFirstClick1 = 0; - GotDoubleClick1 = 0; - sprintf(Command, "xmessage -center -file %s/.wmWeatherReports/%s.TXT &", getenv("HOME"), StationID); - system(Command); - } - - - /* - * We got a double click on Mouse Button2 (i.e. the left one) - */ - if (GotDoubleClick2) { - GotFirstClick2 = 0; - GotDoubleClick2 = 0; - } - - - /* - * We got a double click on Mouse Button3 (i.e. the left one) - */ - if (GotDoubleClick3) { - GotFirstClick3 = 0; - GotDoubleClick3 = 0; - ForceDownload = 1; - ForceUpdate = 1; - } - - return; - - -} - - - - -/* - * This routine handles key presses. - * - */ -void KeyPressEvent(XKeyEvent *xev){ - - Metric = !Metric; - - - - if (Metric){ - - switch(PressureUnits){ - case 0: PressureConv = 25.4; - break; - - case 1: PressureConv = 3.38639; - break; - - case 2: PressureConv = 33.8639; - break; - - case 3: PressureConv = 25.4; - break; - } - - } else if (!Metric){ - - PressureConv = 1.0; - - } - - - - ForceUpdate = 1; - - return; - -} - - -char *StringToUpper(char *String) { - - int i; - - for (i = 0; i < strlen(String); i++) - String[i] = toupper(String[i]); - - return String; - -} - - - - diff --git a/wmWeather/Src/wmWeather_mask.xbm b/wmWeather/Src/wmWeather_mask.xbm deleted file mode 100644 index cbe77b0..0000000 --- a/wmWeather/Src/wmWeather_mask.xbm +++ /dev/null @@ -1,38 +0,0 @@ -#define wmWeather_mask_width 64 -#define wmWeather_mask_height 64 -static char wmWeather_mask_bits[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff, - 0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff, - 0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff, - 0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff, - 0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0, - 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f, - 0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff, - 0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff, - 0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff, - 0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff, - 0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff, - 0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff, - 0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0, - 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f, - 0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff, - 0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff, - 0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff, - 0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff, - 0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff, - 0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff, - 0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0, - 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f, - 0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff, - 0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff, - 0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff, - 0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff, - 0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff, - 0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff, - 0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0, - 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0x0f, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00}; diff --git a/wmWeather/Src/wmWeather_master.gif b/wmWeather/Src/wmWeather_master.gif deleted file mode 100644 index 145c0f3635028b74d86fc5667d44644ce0d5a80f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1734 zcmV;%208ghNk%v~VTJ&d0P+9;0000O7#MlIzyAOLWL5wFzfjQ7&;S4cEC2ui0EPgR z000C2D7xJKFiHrjy*TU5yT?-~j^byYXbO;QOR8|Jx^(Txc)l@u&n=cfVHhYHjl`qT zC*vuf(5Q4OH2^CGq%;d<#+=l!cx<#PEZpNTEktIsUKp56uOH0<^j2GZ3*$3Dc7t_z zdP-|)ifsjeDRYF8Q-)Yti+z@Vjwg_ko=TJeLP?`ZYnXkToPwXNcUP*h7oD!2p|Y}0 z3$?bexUpaYyuD|?xvauP!pXY<$-_^##*V>849?2XRj@?^O5R2T;@#ro;pFAv;N|A& z=uflA*4fP1+MwLt-~s0R=STb6J=yooUpIpYi^MyVt>H2S_o9Rf=#SvPg9q2~(+K{B zV?}aG7UrSyEMhcR6fvp;$Z?%UeHH`u8)s3ZD3gOGUL<Jo9J`nsRi;cx)F#fH`4SEl z3Xo|^o)?t{FnY8QH-tYox^uU4=FD$iSq?DTtSXgIW<Pl&+c2#}U(*2Ta##;r$%ts% zs8M4o(cV&|`kpG~hK)iCbL~1?*7hh`KYcFg<ueM^-zSh6Q9fKD@k497?%oTvDD&mX zkl%1I%%^nZkcb79g}9h@Rnn9Vld7zD^=d}C3%i-jc?B!CVQ^b!!x~ef;HGkKCO$Pb zL*&W1nU=i#uWMAyH;1Q+ebQA$exFAUzFxTH_OA<*wO#&Iv77bjz_C8EZvOrvd12Rs zXSIRGm}6HVa@2sb(N+(Aw<VZ~U%XB6n}WqPA=?q6K_r?s0eUB*h3|pKAVVdk2q8`( zVisK{ngIr18z+wR9~7hwb{cc1q~{!X8GdoxjrQeH0g0{krsRb$HlhP9M7D_Ga7+Fe zBO*15;@^K#LZf4la%^bNjnc&Bg)X7dW6y`sD3@A%J_6_4eyR}oU|9&>N5q@Ig%@LL z$DpXDVuZ2?%brT2*5r~z1lk{62eJv`p_NgXD3F7#<|uwdmO<&BJz7cSo0`-)WTyeR znW$jCVcIA#r*>MVnLZF0g`{nwlo3Ylr1Mg*Yr!h$m`~t3%tZPa{*>%T|19h5rfU|c zjE524N0YKb3B)W+!J3L<nuHq5i%v9g<q@`9bp!1+4-RUmwL!6iE?B!NyY8UOtcaJc z+k&K(OT21Towqik3Lspx)*5S++U+>!B^0t6UxlZ^X54iKr~2u{7lPL@byku(;t~8A zVDiZ*r>yeIEVt}3ZrphsvS61j3Pp4L*`PBEdc+Lfmm)JcW6eqAyz|i$^ekSIK>pbs zajjmuL}y4>o%E6DJv_0ZR6>nj*Ch^|@YrOR&4g4d{oCwTF7=vrK~b2kgR@UH6%^V9 zy`)mJ@W_qBvP3DXx4?vF8*oQm_$>qAKs6<=PfTH3xZQ;QE50~ZlzY^Y<aMuoILR7h z3?^2<0^HTxJjwL--e7Wys^yM|E;j5w$WD74w%>lX=(_KoaqqSB4!jPz5069f#>XHn zk;xxV?2XOK&{m`lRu#SSW3t;APS?XQJ-*N1)4dAc+of+r<EKE9fa#xreES`|e<U5i zFAseN#nLsk?$I)jzY^`TNB!zjy+WBJbO3ahGX|(8YK0Gd|Kkw2_IJBz*+zQ{ilBia zwZPsj&p~+No(3H<Eeg_3ey$5c{e%ZU51_Dx7_i@eVCcdv<%fpxyVEl!ct9L(Kw5V~ zjt_sBqGBCLghPyB5e?*)B#y9CPK+T7qnJYfQBnR&+pEtNk7PqFZm~8T<X{G`XhC{} zu!m#}U>L3UMFKidT(#I@74JvJDMs;yKI|V9;OGiD>M?(2@uLoz$VX2I5?o?rV;T`z z#xYW{k@+g*C;VtfC*o0#n9QUmH_6FPdXk0#AOHc1Aj(ma(v+n<r6@z0N>-Bcm8~?w zC{Y>8BhZqTu4JVta~aE3>hhJfyd^A$iON!9K$yWCW-?`IOJ(A+nX?3@DrXr@WJYtD z*L<cmYl+Qe%JP`7^yMzONzGzDQ<vuqCo^T4%2j5QobbfuICr^Cc_Q<b$84uEfq6}7 z2J@ZVgeE<knM`+vQ=Y$EXF%)ON?!()o0;J3W<3eYPk1hrnEn)|LA~k9YF6~3<TNKh z2b!T<I#iq}-6%WX*-M0$lBN7ir#NG(&|LD;nbLgeCt>%{d5UzMFFoZng-TQtMlqWt zohMP1`UIH56O;WMCrz=LQi{&>p-=^BP5<f8Zhq99pxa_pt(wz{BJ`sb#pFU$T1>0b clcYuM>g;w(*SgyEu6WI>UiZpZDkcB`JE{g)m;e9( diff --git a/wmWeather/Src/wmWeather_master.xpm b/wmWeather/Src/wmWeather_master.xpm deleted file mode 100644 index 40f4468..0000000 --- a/wmWeather/Src/wmWeather_master.xpm +++ /dev/null @@ -1,162 +0,0 @@ -/* XPM */ -static char *wmWeather_master[] = { -/* width height num_colors chars_per_pixel */ -" 134 148 7 1", -/* colors */ -". c #000000", -"# c #181818 s BackColor", -"a c #79bdbf s LabelColor", -"b c #ff0000 s WindGustColor", -"d c #ffbf50 s DataColor", -"c c #6455ff s StationTimeColor", -"e c #d0d0d0", -/* pixels */ -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.......................................................................", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.......................................................................", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.......................................................................", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.......................................................................", -"aaaa........................................................aaa...#ddd#########dd########.............................................", -"aaaa.######################################################eaaa...d###d#########d########.............................................", -"aaaa.######################################################eaaa...d######ddd####d###dd#d#.............................................", -"aaaa.######################################################eaaa...d#########d###d###d#d#d.............................................", -"aaaa.######################################################eaaa...d######dddd###d###d#d#d.............................................", -"aaaa.######################################################eaaa...d###d#d###d###d###d#d#d.............................................", -"aaaa.######################################################eaaa...#ddd###dddd##ddd##d###d.............................................", -"aaaa.######################################################eaaa.......................................................................", -"aaaa.######################################################eaaa.......................................................................", -"aaaa.#aaa##################################################eaaa.......................................................................", -"aaaa.##a###################################################eaaa.......................................................................", -"aaaa.##a###a#a##aaa##a#####################################eaaa.......................................................................", -"aaaa.##a###aaaa#a##a#######################################eaaa...##b#####b####bbb##bbbbb####b##bbbbb###bb##bbbbb##bbb###bbb######....", -"aaaa.##a###a##a#a##a#a#####################################eaaa...#b#b###bb###b###b#####b###bb##b######b########b#b###b#b###b#####....", -"aaaa.##a###a##a#aaa########################################eaaa...b###b#b#b#######b####b###b#b##b#bb##b########b##b###b#b##bb#####....", -"aaaa.###########a##########################################eaaa...b###b###b#####bb####bb##b##b##bb##b#b#bb#####b###bbb###bb#b#####....", -"aaaa.######################################################eaaa...b###b###b####b########b#bbbbb#####b#bb##b###b###b###b#####b#####....", -"aaaa.######################################################eaaa...#b#b####b###b#####b###b####b##b###b#b###b##b####b###b####b####b#....", -"aaaa.######################################################eaaa...##b###bbbbb#bbbbb##bbb#####b###bbb###bbb###b#####bbb###bb####bbb....", -"aaaa.#aaa##################################################eaaa...##############################################################b#....", -"aaaa.#a##a#################################################eaaa.......................................................................", -"aaaa.#a##a##aa##a##a#a#####################################eaaa...##d#####d####ddd##ddddd####d##ddddd###dd##ddddd##ddd###ddd######....", -"aaaa.#a##a#a#aa#a##a#######################################eaaa...#d#d###dd###d###d#####d###dd##d######d########d#d###d#d###d#####....", -"aaaa.#a##a#aa###aaaa#a#####################################eaaa...d###d#d#d#######d####d###d#d##d#dd##d########d##d###d#d##dd#####....", -"aaaa.#aaa###aa##aaaa#######################################eaaa...d###d###d#####dd####dd##d##d##dd##d#d#dd#####d###ddd###dd#d#####....", -"aaaa.######################################################eaaa...d###d###d####d########d#ddddd#####d#dd##d###d###d###d#####d#####....", -"aaaa.######################################################eaaa...#d#d####d###d#####d###d####d##d###d#d###d##d####d###d####d####d#....", -"aaaa.######################################################eaaa...##d###ddddd#ddddd##ddd#####d###ddd###ddd###d#####ddd###dd####ddd....", -"aaaa.#aaa##################################################eaaa...##############################################################d#....", -"aaaa.#a##a#################################################eaaa...############################################........................", -"aaaa.#a##a#aaa###aaa#a#####################################eaaa...#######d####################################........................", -"aaaa.#aaa##a##a#aa#########################################eaaa...######d#d#dddd##dd############d##d######d###........................", -"aaaa.#a####a######aa#a#####################################eaaa...#######d##d####d##d###########d##d######d##d........................", -"aaaa.#a####a####aaa########################################eaaa...##########ddd##d####d#d##d#d##dddd##ddd###d#........................", -"aaaa.######################################################eaaa...dddd######d####d####dddd#dddd#d##d#d##d##d##........................", -"aaaa.######################################################eaaa...##########d####d##d#d##d#d##d#d##d##dd##d##d........................", -"aaaa.######################################################eaaa...##########d#####dd##d##d#d##d#d##d#d#######d........................", -"aaaa.#a##a#################################################eaaa...####################################ddd#####........................", -"aaaa.#a##a#################################################eaaa.......................................................................", -"aaaa.#aaaa#a##a#a#a##a#####################################eaaa...d##d#d##d##dd##dddd#d##d#ddd##ddd#..................................", -"aaaa.#a##a#a##a#aaaa#######################################eaaa...dd#d#d##d#d##d#d####d##d#d##d#d##d..................................", -"aaaa.#a##a#a##a#a##a#a#####################################eaaa...dd#d#d##d##d###ddd##d##d#d##d#ddd#..................................", -"aaaa.#a##a##aaa#a##a#######################################eaaa...d#dd#dddd###d##d####d##d#ddd##d##d..................................", -"aaaa.######################################################eaaa...d#dd#dddd#d##d#d#####dd##d#d##d##d..................................", -"aaaa.######################################################eaaa...d##d#d##d##dd##dddd##dd##d##d#ddd#..................................", -"aaaa.######################################################eaaa.......................................................................", -"aaaa.#a##a#########a#######################################eaaa...b##b#b##b##bb##bbbb#b##b#bbb##bbb#..................................", -"aaaa.#a##a#########a#######################################eaaa...bb#b#b##b#b##b#b####b##b#b##b#b##b..................................", -"aaaa.#a##a#aaa###aaa#a#####################################eaaa...bb#b#b##b##b###bbb##b##b#b##b#bbb#..................................", -"aaaa.#aaaa#a##a#a##a#######################################eaaa...b#bb#bbbb###b##b####b##b#bbb##b##b..................................", -"aaaa.#aaaa#a##a#a##a#a#####################################eaaa...b#bb#bbbb#b##b#b#####bb##b#b##b##b..................................", -"aaaa.#a##a#a##a##aaa#######################################eaaa...b##b#b##b##bb##bbbb##bb##b##b#bbb#..................................", -"aaaa.######################################################eaaa.......................................................................", -"aaaa.######################################################eaaa...#d####d####dd##dddd###d##dddd##dd##dddd##dd###dd#######d#########...", -"aaaa.######################################################eaaa...d#d##dd###d##d####d##dd##d####d#######d#d##d#d##d######d##d######...", -"aaaaeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaaa...d#d###d######d##dd##d#d##ddd##ddd####d###dd##d##d########d#######...", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...d#d###d#####d#####d#dddd####d#d##d###d##d##d##ddd#######d###ddd##...", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...d#d###d####d###d##d###d##d##d#d##d##d###d##d####d##dd##d##d######...", -"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...#d###ddd##dddd##dd####d###dd###dd###d####dd###dd###dd#####d######...", -"......................................................................................................................................", -"..................................................................#b####b####bb##bbbb###b##bbbb##bb##bbbb##bb###bb#######b#########...", -"..................................................................b#b##bb###b##b####b##bb##b####b#######b#b##b#b##b######b##b######...", -"..................................................................b#b###b######b##bb##b#b##bbb##bbb####b###bb##b##b########b#######...", -"..................................................................b#b###b#####b#####b#bbbb####b#b##b###b##b##b##bbb#######b###bbb##...", -"..................................................................b#b###b####b###b##b###b##b##b#b##b##b###b##b####b##bb##b##b######...", -".....######################################################.......#b###bbb##bbbb##bb####b###bb###bb###b####bb###bb###bb#####b######...", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....#aaa##################################################...........................................................................", -".....##a###################################################...........................................................................", -".....##a###a#a##aaa##a#####################################...........................................................................", -".....##a###aaaa#a##a#######################################...........................................................................", -".....##a###a##a#a##a#a#####################################...........................................................................", -".....##a###a##a#aaa########################################...........................................................................", -".....###########a##########################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################.......#################...................................................", -".....#aaa##################################################.......######a##a##aa###...................................................", -".....#a##a#################################################.......######a##a#a##a##...................................................", -".....#a##a##aa##a##a#a#####################################.......######a##a#a####a...................................................", -".....#a##a#a#aa#a##a#######################################.......######aaaa#a#####...................................................", -".....#a##a#aa###aaaa#a#####################################.......######aaaa#a##a#a...................................................", -".....#aaa###aa##aaaa#######################################.......######a##a##aa###...................................................", -".....######################################################.......#################...................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....#aaa##################################################...........................................................................", -".....#a##a#################################################...........................................................................", -".....#a##a#aaa###aaa#a#####################################...........................................................................", -".....#aaa##a##a#aa#########################################...........................................................................", -".....#a####a######aa#a#####################################...........................................................................", -".....#a####a####aaa########################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....#a##a#################################################...........................................................................", -".....#a##a#################################################...........................................................................", -".....#aaaa#a##a#a#a##a#####################################...........................................................................", -".....#a##a#a##a#aaaa#######################################...........................................................................", -".....#a##a#a##a#a##a#a#####################################...........................................................................", -".....#a##a##aaa#a##a#######################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -".....#a##a#########a#######################################...........................................................................", -".....#a##a#########a#######################################...........................................................................", -".....#a##a#aaa###aaa#a#####################################...........................................................................", -".....#aaaa#a##a#a##a#######################################...........................................................................", -".....#aaaa#a##a#a##a#a#####################################...........................................................................", -".....#a##a#a##a##aaa#######################################...........................................................................", -".....######################################################...........................................................................", -".....######################################################...........................................................................", -"......................................................................................................................................", -"......................................................................................................................................", -"......................................................................................................................................", -"......................................................................................................................................", -"......................................................................................................................................", -"..#cc##ccc###cc##ccc##cccc#cccc##cc##c##c#ccc#####c#c##c#c####c##c#c##c##cc##ccc###cc##ccc###cc##ccc##c##c#c##c#c##c#c##c#c#c##cccc...", -"..c##c#c##c#c##c#c##c#c####c####c##c#c##c##c######c#c#c##c####cccc#cc#c#c##c#c##c#c##c#c##c#c##c##c###c##c#c##c#c##c#c##c#c#c#####c...", -"..c##c#ccc##c####c##c#ccc##ccc##c####cccc##c######c#cc###c####cccc#cc#c#c##c#c##c#c##c#c##c##c####c###c##c#c##c#c##c##cc##c#c####c#...", -"..cccc#c##c#c####c##c#c####c####c#cc#c##c##c######c#cc###c####c##c#c#cc#c##c#ccc##c##c#ccc####c###c###c##c#c##c#cccc##cc###c####c##...", -"..c##c#c##c#c##c#c##c#c####c####c##c#c##c##c###c##c#c#c##c####c##c#c#cc#c##c#c####cc#c#c#c##c##c##c###c##c##cc##cccc#c##c##c###c###...", -"..c##c#ccc###cc##ccc##cccc#c#####ccc#c##c#ccc###cc##c##c#cccc#c##c#c##c##cc##c#####cc##c##c##cc###c####cc###cc##c##c#c##c##c###cccc...", -"......................................................................................................................................", -"..#c####c####cc##cccc###c##cccc##cc##cccc##cc###cc#####...............................................................................", -"..c#c##cc###c##c####c##cc##c####c#######c#c##c#c##c##c#...............................................................................", -"..c#c###c######c##cc##c#c##ccc##ccc####c###cc##c##c####...............................................................................", -"..c#c###c#####c#####c#cccc####c#c##c###c##c##c##ccc####...............................................................................", -"..c#c###c####c###c##c###c##c##c#c##c##c###c##c####c##c#...............................................................................", -"..#c###ccc##cccc##cc####c###cc###cc###c####cc###cc#####...............................................................................", -"......................................................................................................................................", -"......................................................................................................................................", -"......................................................................................................................................", -"......................................................................................................................................", -"......................................................................................................................................", -"......................................................................................................................................", -"......................................................................................................................................" -}; diff --git a/wmWeather/Src/xutils.c b/wmWeather/Src/xutils.c deleted file mode 100644 index 0a643b3..0000000 --- a/wmWeather/Src/xutils.c +++ /dev/null @@ -1,313 +0,0 @@ -/* - * xutils.c - A collection of X-windows utilties for creating WindowMAker - * DockApps. - * - * This file contains alot of the lower-level X windows routines. Origins with wmppp - * (by Martijn Pieterse (piete...@xs4all.nl)), but its been hacked up quite a bit - * and passed on from one new DockApp to the next. - * - * - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program (see the file COPYING); if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * - * - * - */ -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <ctype.h> -#include <stdarg.h> -#include <X11/Xlib.h> -#include <X11/xpm.h> -#include <X11/extensions/shape.h> -#include "xutils.h" - - - -/* - * X11 Variables - */ -int x_fd; -XSizeHints mysizehints; -XWMHints mywmhints; -Pixel back_pix, fore_pix; -char *Geometry = ""; -GC NormalGC; -XpmIcon wmgen; -Pixmap pixmask; - - - - - -/* - * flush_expose - */ -static int flush_expose(Window w) { - - XEvent dummy; - int i=0; - - while (XCheckTypedWindowEvent(display, w, Expose, &dummy)) - i++; - - return i; - -} - - - - - - - - - -/* - * RedrawWindow - * RedrawWindowXY - */ -void RedrawWindow(void) { - - flush_expose(iconwin); - XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, 0,0, wmgen.attributes.width, wmgen.attributes.height, 0, 0); - - flush_expose(win); - XCopyArea(display, wmgen.pixmap, win, NormalGC, 0,0, wmgen.attributes.width, wmgen.attributes.height, 0, 0); - -} - -void RedrawWindowXY(int x, int y) { - - flush_expose(iconwin); - XCopyArea(display, wmgen.pixmap, iconwin, NormalGC, x,y, wmgen.attributes.width, wmgen.attributes.height, 0, 0); - - flush_expose(win); - XCopyArea(display, wmgen.pixmap, win, NormalGC, x,y, wmgen.attributes.width, wmgen.attributes.height, 0, 0); - -} - - - - - - - -/* - * copyXPMArea - * copyXBMArea - */ -void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) { - XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy); -} - -void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) { - - XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy); -} - - - -/* - * initXwindow - */ -void initXwindow(int argc, char *argv[]){ - - int i; - char *display_name = NULL; - - for (i=1; argv[i]; ++i) { - if (!strcmp(argv[i], "-display")) display_name = argv[i+1]; - } - - - if (!(display = XOpenDisplay(display_name))) { - fprintf(stderr, "%s: can't open display %s\n", - argv[0], XDisplayName(display_name)); - exit(1); - } - - - screen = DefaultScreen(display); - Root = RootWindow(display, screen); - DisplayDepth = DefaultDepth(display, screen); - x_fd = XConnectionNumber(display); - -} - - - - - -/* - * openXwindow - */ -void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, - int pixmask_width, int pixmask_height, char *BackColor, char *LabelColor, - char *WindGustColor, char *DataColor, char *StationTimeColor) { - - unsigned int borderwidth = 1; - XClassHint classHint; - char *wname = argv[0]; - XTextProperty name; - XGCValues gcv; - unsigned long gcm; - int dummy=0; - XpmColorSymbol cols[5]={ {"BackColor", NULL, 0}, - {"LabelColor", NULL, 0}, - {"DataColor", NULL, 0}, - {"WindGustColor", NULL, 0}, - {"StationTimeColor", NULL, 0} }; - - - - - /* - * Create Pixmap - */ - cols[0].pixel = getColor(BackColor, 1.0); - cols[1].pixel = getColor(LabelColor, 1.0); - cols[2].pixel = getColor(DataColor, 1.0); - cols[3].pixel = getColor(WindGustColor, 1.0); - cols[4].pixel = getColor(StationTimeColor, 1.0); - wmgen.attributes.numsymbols = 5; - wmgen.attributes.colorsymbols = cols; - wmgen.attributes.exactColors = False; - wmgen.attributes.closeness = 40000; - wmgen.attributes.valuemask = XpmReturnPixels | XpmReturnExtensions | XpmColorSymbols - | XpmExactColors | XpmCloseness | XpmSize; - if (XpmCreatePixmapFromData(display, Root, pixmap_bytes, - &(wmgen.pixmap), &(wmgen.mask), &(wmgen.attributes)) != XpmSuccess){ - fprintf(stderr, "Not enough free colorcells.\n"); - exit(1); - } - - - - - /* - * Create a window - */ - mysizehints.flags = USSize | USPosition; - mysizehints.x = 0; - mysizehints.y = 0; - - back_pix = getColor("white", 1.0); - fore_pix = getColor("black", 1.0); - - XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints, - &mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy); - - mysizehints.width = 64; - mysizehints.height = 64; - - - - win = XCreateSimpleWindow(display, Root, mysizehints.x, mysizehints.y, - mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); - - iconwin = XCreateSimpleWindow(display, win, mysizehints.x, mysizehints.y, - mysizehints.width, mysizehints.height, borderwidth, fore_pix, back_pix); - - - - /* - * Activate hints - */ - XSetWMNormalHints(display, win, &mysizehints); - classHint.res_name = wname; - classHint.res_class = wname; - XSetClassHint(display, win, &classHint); - - - - /* - * Set up the xevents that you want the relevent windows to inherit - * Currently, its seems that setting KeyPress events here has no - * effect. I.e. for some you will need to Grab the focus and then return - * it after you are done... - */ - XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask - | PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask - | KeyPressMask | KeyReleaseMask); - XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask - | PointerMotionMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask - | KeyPressMask | KeyReleaseMask); - - - if (XStringListToTextProperty(&wname, 1, &name) == 0) { - fprintf(stderr, "%s: can't allocate window name\n", wname); - exit(1); - } - - - XSetWMName(display, win, &name); - - /* - * Create Graphics Context (GC) for drawing - */ - gcm = GCForeground | GCBackground | GCGraphicsExposures; - gcv.foreground = fore_pix; - gcv.background = back_pix; - gcv.graphics_exposures = 0; - NormalGC = XCreateGC(display, Root, gcm, &gcv); - - - - pixmask = XCreateBitmapFromData(display, win, pixmask_bits, pixmask_width, pixmask_height); - XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet); - XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet); - - - mywmhints.initial_state = WithdrawnState; - mywmhints.icon_window = iconwin; - mywmhints.icon_x = mysizehints.x; - mywmhints.icon_y = mysizehints.y; - mywmhints.window_group = win; - mywmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint; - - - XSetWMHints(display, win, &mywmhints); - - - XSetCommand(display, win, argv, argc); - XMapWindow(display, win); - -} - -unsigned long getColor(char *ColorName, float fac) { - - XColor Color; - XWindowAttributes Attributes; - - XGetWindowAttributes(display, Root, &Attributes); - Color.pixel = 0; - - XParseColor(display, Attributes.colormap, ColorName, &Color); - Color.red = (unsigned short)(Color.red/fac); - Color.blue = (unsigned short)(Color.blue/fac); - Color.green = (unsigned short)(Color.green/fac); - Color.flags = DoRed | DoGreen | DoBlue; - XAllocColor(display, Attributes.colormap, &Color); - - return Color.pixel; - -} - diff --git a/wmWeather/Src/xutils.h b/wmWeather/Src/xutils.h deleted file mode 100644 index fcd25f6..0000000 --- a/wmWeather/Src/xutils.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef WMGENERAL_H_INCLUDED -#define WMGENERAL_H_INCLUDED - - - -/* - * Typedefs - */ -typedef struct { - Pixmap pixmap; - Pixmap mask; - XpmAttributes attributes; -} XpmIcon; - - - - -/* - * Global variable - */ -Display *display; -Window Root; -Window iconwin, win; -int screen; -int DisplayDepth; - - - - - -/* - * Function Prototypes - */ -void AddMouseRegion(int, int, int, int, int); -int CheckMouseRegion(int, int); -void openXwindow(int, char **, char **, char *, int, int, char *, char *, char *, char *,char *); -void initXwindow(int, char **); -void RedrawWindow(void); -void RedrawWindowXY(int, int); -void copyXPMArea(int, int, int, int, int, int); -void copyXBMArea(int, int, int, int, int, int); -void setMaskXY(int, int); -unsigned long getColor(char *, float); -void RedrawWindow(void); - - -#endif -- 2.7.4 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.