wmcalc: Remove trailing whitespace.

This commit is contained in:
Doug Torrance 2015-01-10 10:59:48 -06:00 committed by Carlos R. Mafra
parent 587fe05cc1
commit 6b282a4b4d
15 changed files with 241 additions and 241 deletions

View file

@ -1,13 +1,13 @@
# wmcalc Configuration File
# Last Manual Update: 10/29/00
# General Notes:
# General Notes:
# * There must be a tab character '\t' between the variable name and
# the value, not a series of spaces.
# * wmcalc is case sensitive when reading these variables. Examine the
# * wmcalc is case sensitive when reading these variables. Examine the
# wmcalc_g.h file for currently defined variables.
#Calculator Memory Locations
#Calculator Memory Locations
#Note: These must all exist, though they may be in any order
Mem0 0.000000
Mem1 0.000000
@ -21,15 +21,15 @@ Mem8 0.000000
Mem9 0.000000
# The CalcStart variable is intended to allow the user to start a larger
# calculator for more complicated needs. Everything after the tab '\t'
# calculator for more complicated needs. Everything after the tab '\t'
# character is sent unmodified in a system() call, so anything you can type
# at the command prompt may be put here.
#CalcStart xterm -T "Basic Calculator" -e bc &
#CalcStart xterm -T "gnuplot" -sb -sl 500 -e gnuplot &
CalcStart xcalc &
# The ImagChar variable allows the user to choose between 'i' and 'j' to
# represent the sqrt(-1). (Electrical Engineers (such as myself) use 'j'
# The ImagChar variable allows the user to choose between 'i' and 'j' to
# represent the sqrt(-1). (Electrical Engineers (such as myself) use 'j'
# rather than 'i.')
#ImagChar i
ImagChar j

View file

@ -1,13 +1,13 @@
# wmcalc Configuration File
# Last Manual Update: 10/29/00
# General Notes:
# General Notes:
# * There must be a tab character '\t' between the variable name and
# the value, not a series of spaces.
# * wmcalc is case sensitive when reading these variables. Examine the
# * wmcalc is case sensitive when reading these variables. Examine the
# wmcalc_g.h file for currently defined variables.
#Calculator Memory Locations
#Calculator Memory Locations
#Note: These must all exist, though they may be in any order
Mem0 0.000000
Mem1 0.000000
@ -21,15 +21,15 @@ Mem8 0.000000
Mem9 0.000000
# The CalcStart variable is intended to allow the user to start a larger
# calculator for more complicated needs. Everything after the tab '\t'
# calculator for more complicated needs. Everything after the tab '\t'
# character is sent unmodified in a system() call, so anything you can type
# at the command prompt may be put here.
#CalcStart xterm -T "Basic Calculator" -e bc &
#CalcStart xterm -T "gnuplot" -sb -sl 500 -e gnuplot &
CalcStart xcalc &
# The ImagChar variable allows the user to choose between 'i' and 'j' to
# represent the sqrt(-1). (Electrical Engineers (such as myself) use 'j'
# The ImagChar variable allows the user to choose between 'i' and 'j' to
# represent the sqrt(-1). (Electrical Engineers (such as myself) use 'j'
# rather than 'i.')
#ImagChar i
ImagChar j

View file

@ -1,13 +1,13 @@
# wmcalc Configuration File
# Last Manual Update: 10/29/00
# General Notes:
# General Notes:
# * There must be a tab character '\t' between the variable name and
# the value, not a series of spaces.
# * wmcalc is case sensitive when reading these variables. Examine the
# * wmcalc is case sensitive when reading these variables. Examine the
# wmcalc_g.h file for currently defined variables.
#Calculator Memory Locations
#Calculator Memory Locations
#Note: These must all exist, though they may be in any order
Mem0 0.000000
Mem1 0.000000
@ -21,15 +21,15 @@ Mem8 0.000000
Mem9 0.000000
# The CalcStart variable is intended to allow the user to start a larger
# calculator for more complicated needs. Everything after the tab '\t'
# calculator for more complicated needs. Everything after the tab '\t'
# character is sent unmodified in a system() call, so anything you can type
# at the command prompt may be put here.
#CalcStart xterm -T "Basic Calculator" -e bc &
#CalcStart xterm -T "gnuplot" -sb -sl 500 -e gnuplot &
CalcStart xcalc &
# The ImagChar variable allows the user to choose between 'i' and 'j' to
# represent the sqrt(-1). (Electrical Engineers (such as myself) use 'j'
# The ImagChar variable allows the user to choose between 'i' and 'j' to
# represent the sqrt(-1). (Electrical Engineers (such as myself) use 'j'
# rather than 'i.')
#ImagChar i
ImagChar j

View file

@ -9,10 +9,10 @@ DESCRIPTION:
------------
wmcalc is a program designed to act as a simple four-function
calculator. It is different from other calculator programs, however
in that it is designed to take up very little desktop space. As such,
it can be left running on the desktop at all times. It is intended to
placed in the WindowMaker dock, or in Wharf under Afterstep, though it
should run as well under any window manager.
in that it is designed to take up very little desktop space. As such,
it can be left running on the desktop at all times. It is intended to
placed in the WindowMaker dock, or in Wharf under Afterstep, though it
should run as well under any window manager.
LICENSING:
----------
@ -24,7 +24,7 @@ CONTRIBUTORS:
-------------
Co-Developers:
Rick Stuart <stuart@xnet.com>
Philippe Trbich <philippe.trbich@free.fr>
Philippe Trbich <philippe.trbich@free.fr>
Original Web Page Designs:
Jon Bruno <bruno@ksu.edu>
Thanks to:
@ -36,35 +36,35 @@ bugs in the code, etc.
INSTALLATION:
-------------
Untar the file:
Untar the file:
tar xvzf wmcalc-0.3.tar.gz
CD to source directory:
CD to source directory:
cd wmcalc-0.3
Compile it:
make clean; make
Copy the config file:
Copy the config file:
cp .wmcalc ~
Put the executable somewhere in your path:
mv wmcalc /usr/local/bin (or anyhere in your path)
Run it:
wmcalc &
Grab the appicon and move it to the dock.
Grab the appicon and move it to the dock.
Change the settings to start with Windowmaker
Afterstep Wharf 1.6.??: (I don't use Afterstep anymore, so...)
*Wharf wmcalc -Swallow "wmcalc" wmcalc &
***Note***:
The appicon only has a two pixel border where you can grab
***Note***:
The appicon only has a two pixel border where you can grab
and move it. It is easiest to grab along the bottom edge.
If make doesn't work, you may need to fiddle with the settings in
If make doesn't work, you may need to fiddle with the settings in
the Makefile.
Tested on: (Well, it runs, I don't know if 'Tested' is quite right...)
@ -77,23 +77,23 @@ usage: wmcalc [-g geometry] [-d dpy] [-v] [-f configfilename] [-h]
-g <geometry> Window Geometry - ie: 64x64+10+10
-d <display> Display - ie: 127.0.0.1:0.0
-v Verbose Mode.
-v Verbose Mode.
-h Help. This message.
-f <filename> Full path to configuration file to use.
-f <filename> Full path to configuration file to use.
Buttons are defined as:
____________________
| x00 | where: x = 1 for Left Mouse Button
| x00 | where: x = 1 for Left Mouse Button
| 0 1 2 3 4 5 6 7 8 9| x = 2 for Middle Mouse Button
|--------------------| x = 3 for Right Mouse Button
|x01 x02 x03 x04 x05 |
|x01 x02 x03 x04 x05 |
|x06 x07 x08 x09 x10 | Note: the numbers 0..9 are the indicators
|x11 x12 x13 x14 x15 | for memory cells 0..9 respectively
|x16 x17 x18 x19 x20 |
--------------------
Button Functions:
100 Reinitialize the calculator, and both Registers
100 Reinitialize the calculator, and both Registers
(Clear All)
200 Clear all the memory registers (0..10)
300 Clear the current number being entered only
@ -106,18 +106,18 @@ Button Functions:
3yy Store Displayed number in memory location [0-9]
if yy = 2,3,4, 7,8,9, 12,13,14, 17
otherwise, can run a user-defined function (not implemented)
1xx Hopefully the other functions are obvious from their
1xx Hopefully the other functions are obvious from their
button graphics.
NOTES:
------
I am sure that there are better ways to do some of the things that are
I am sure that there are better ways to do some of the things that are
done in wmcalc. In fact, wmcalc is basically a series of hacks, but appears
to be stable...
The configuration file (.wmcalc) is written by wmcalc whenever the user
requests to store a number to memory. As a part of this process, a file
requests to store a number to memory. As a part of this process, a file
is written to /tmp. If /tmp is not accessible, it tries in the user's home
directory, as defined by the environment variable HOME. This file is
erased as soon as it is written over the main configuration file.
@ -125,16 +125,16 @@ erased as soon as it is written over the main configuration file.
Changes made to the configuration file (other than memory stores) will not
take effect until the next time wmcalc is started.
Although one can only "Clear" all unlocked memory locations, one may clear the
Although one can only "Clear" all unlocked memory locations, one may clear the
display and then "store" a '0' in the memory location, providing the
ability to clear individual cells.
The fonts are stored in charmap.xpm. This file may be edited to
change colors or fonts, but the app must be recompiled for the changes
change colors or fonts, but the app must be recompiled for the changes
to take effect. The buttons are located in calcbuttons.xpm. This
file may be edited, though the borders should stay where they are
unless you want to change the button regions that are hard coded.
The background border is defined in backdrop.xpm.
The background border is defined in backdrop.xpm.
"C code. C code run. Run, code, run.
PLEASE!?!?!?!?!?!?"
@ -158,9 +158,9 @@ CHANGE LOG:
functional calculator, but just tested the display. It was more
of a proof of concept.
TODO:
TODO:
-----
These are partially a dream list. I don't know when they'll get done,
These are partially a dream list. I don't know when they'll get done,
as I'm pretty busy at work. Anyone want to tackle these??
* Re-implement the register/display design to allow full double precision.
@ -174,19 +174,19 @@ as I'm pretty busy at work. Anyone want to tackle these??
that one can intentionally write data to. (This could grow to a pipe to
plotting programs, etc, though this is a bit extreme...)
RPN:
RPN:
I have no intention at this time to add in an RPN format, as I
personally do not like it. It should be noted that I have NOT used it
extensively, and I've heard that I would like it. But, until then...
BUGS:
BUGS:
-----
Remember, they're just undocumented FEATURES!!!
* The display can lose the last digit of a three character exponential
notation number.
* Due to an implementation fault, at every step of calculations, precision
* Due to an implementation fault, at every step of calculations, precision
is lost, as the number is only as accurate at that displayed.
* Order of operations: 1 + 2 * 5 = 15, not 11, as it should.
@ -194,8 +194,8 @@ Remember, they're just undocumented FEATURES!!!
* Changing sign when the display is blank results in "-0". Further entry
yields "-05...," but this does not affect calculations.
* Changes to the configuration file do not take effect until wmcalc is
restarted. (Note that file is written whenever a "store memory
* Changes to the configuration file do not take effect until wmcalc is
restarted. (Note that file is written whenever a "store memory
location" is requested)
Probably many more. Send comments (preferably with fixes) to
@ -204,9 +204,9 @@ I will happily include your name in the documentation for the program
if you send me a bug report and the correction. This can be in the
form of a patch file, or ASCII text to exchange, or an equivalent.
Note, this program is written in C. Not C++. I'm not a computer
science person, I don't do objects. Therefore, bug fixes that convert
science person, I don't do objects. Therefore, bug fixes that convert
this to C++ don't count, since I would no longer be able to support
the program. Of course, you can modify the code and release a new
application.
the program. Of course, you can modify the code and release a new
application.
Thanks, and Good Luck.

View file

@ -10,10 +10,10 @@ static char mask_bits[] = {
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,

View file

@ -29,23 +29,23 @@ This manual page was written for the Debian GNU/Linux distribution
because the original program does not have a manual page.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
\fBwmcalc\fP is a program designed to act as a simple calculator offering basic operations like addition, subtraction, multiplication, division, square and squareroot. It is different from other calculator programs, however in that it is designed to take up very little desktop space. As such, it can be left running on the desktop at all times. It is intended to placed in the WindowMaker dock, or in Wharf under Afterstep, though it should run as well under any window manager.
\fBwmcalc\fP is a program designed to act as a simple calculator offering basic operations like addition, subtraction, multiplication, division, square and squareroot. It is different from other calculator programs, however in that it is designed to take up very little desktop space. As such, it can be left running on the desktop at all times. It is intended to placed in the WindowMaker dock, or in Wharf under Afterstep, though it should run as well under any window manager.
\fB*IMPORTANT*\fP: this calculator, due to its simple target, does not respect the proper mathematical operations order, and they are executed in the order they are inserted.
Buttons are defined as:
.nf
____________________
____________________
| x00 | x = 1 for Left Mouse Button
| 0 1 2 3 4 5 6 7 8 9| x = 2 for Middle Mouse Button
|--------------------| x = 3 for Right Mouse Button
|x01 x02 x03 x04 x05 |
|--------------------| x = 3 for Right Mouse Button
|x01 x02 x03 x04 x05 |
|x06 x07 x08 x09 x10 | Note: the numbers 0..9 are the
|x11 x12 x13 x14 x15 | indicators for memory cells
|x11 x12 x13 x14 x15 | indicators for memory cells
|x16 x17 x18 x19 x20 | 0..9 respectively
--------------------
--------------------
.fi
.TP
Button Functions:
@ -87,7 +87,7 @@ Display - ie: 127.0.0.1:0.0
Full path to configuration file.
.TP
.B \-v
Verbose Mode.
Verbose Mode.
.TP
.B \-h
Help.

View file

@ -4,28 +4,28 @@
* Date: January 17, 2001
* Author: Edward H. Flora <ehflora@access1.net>
*
* This file is a part of the wmcalc application. As such, this
* file is licensed under the GNU General Public License, version 2.
* A copy of this license may be found in the file COPYING that should
* have been distributed with this file. If not, please refer to
* This file is a part of the wmcalc application. As such, this
* file is licensed under the GNU General Public License, version 2.
* A copy of this license may be found in the file COPYING that should
* have been distributed with this file. If not, please refer to
* http://www.gnu.org/copyleft/gpl.html for details.
*
****************************************************************
Description:
This file contains the main program code for the wmcalc
application. Wmcalc is a dockapp designed for the WindowMaker or
application. Wmcalc is a dockapp designed for the WindowMaker or
Afterstep window managers (although it should run well in most
others.) wmcalc is a four-function (and more) calculator that
has a small enough footprint that you may leave it open on your
desktop at all times, for convenient use.
Change History:
Date Modification
01/17/01 Updated to use XLookupString
12/10/00 Revised includes, extracting X libs to wmcalc_x.h
11/09/00 Added "locked" memory capabilities
11/08/00 Added Code to Support Keyboard / focus
11/08/00 Added Code to Support Keyboard / focus
10/29/00 Implemented memory use, configuration files, and a
quickstart button for a larger calculator. Also
abstracted some of the macros, global vars, function
@ -34,7 +34,7 @@
02/10/00 Added keyboard event code, without success
12/21/99 Original product release, version 0.1
11/26/99 Original file creation
****************************************************************/
#include "wmcalc_x.h"
@ -69,7 +69,7 @@ char OpFlag = ' '; /* Operation requested */
int ExpFlag = 0; /* Flag if in scientific notation */
int DecFlag = 0; /* Flag if a decimal is in display */
int ImgFlag = 0; /* Flag if a number is imaginary */
int StrCnt = 0;
int StrCnt = 0;
double RegisterA = 0.0; /* Main working register, displayed */
double RegisterB = 0.0; /* Second register to add to, etc */
char DispString[DISPSIZE+1]; /* Pointer to string of display */
@ -84,7 +84,7 @@ char *app_name = "wmcalc"; /* Name of app, for window management */
This is the main Program control function for wmcalc. It
contains all the X11 windows function calls, as well as other
general operations.
Change History:
Date Modification
01/17/01 Updated to use XLookupString to get KeySym
@ -94,7 +94,7 @@ char *app_name = "wmcalc"; /* Name of app, for window management */
****************************************************************/
int main( int argc, char **argv ) {
XEvent report;
XGCValues xgcValues;
XGCValues xgcValues;
XTextProperty app_name_atom;
int err_code = OKAY;
int dummy = 0;
@ -106,7 +106,7 @@ int main( int argc, char **argv ) {
XComposeStatus compose;
char buffer[20];
int bufsize = 20;
strcpy(configfile, getenv("HOME")); // Added to wmbutton by Casey Harkin, 3/6/99
strcat(configfile, CONFFILENAME); // Fixed Bug - didn't look in home directory
@ -117,7 +117,7 @@ int main( int argc, char **argv ) {
for(i=0; i<DISPSIZE; i++) DispString[i] = ' ';
DispString[DISPSIZE] = '\0';
/* Parse Command Line Arguments */
/* Parse Command Line Arguments */
for ( i=1; i < argc; i++ ) {
if ( *argv[i] == '-' ) {
switch ( *(argv[i]+1) ) {
@ -129,7 +129,7 @@ int main( int argc, char **argv ) {
sscanf(argv[i], "%s", Geometry_str);
if ( Verbose ) printf("Geometry is: %s\n", Geometry_str);
break;
case 'd': // Set display
case 'd': // Set display
if ( ++i >= argc ) show_usage();
sscanf(argv[i], "%s", Display_str);
if ( Verbose ) printf("Display is: %s\n", Display_str);
@ -148,35 +148,35 @@ int main( int argc, char **argv ) {
}
}
} /* End of loop to process command line options */
/* Open display on requested X server */
if ( (display = XOpenDisplay(Display_str)) == NULL ) {
error_handler(ERR_X_DISPLAY, Display_str);
}
screen = DefaultScreen(display);
rootwin = RootWindow(display,screen);
depth = DefaultDepth(display, screen);
bg_pixel = WhitePixel(display, screen );
fg_pixel = BlackPixel(display, screen );
bg_pixel = WhitePixel(display, screen );
fg_pixel = BlackPixel(display, screen );
xsizehints.flags = USSize | USPosition;
xsizehints.width = APP_WIDTH;
xsizehints.height = APP_HEIGHT;
/* Parse Geometry string and fill in sizehints fields */
XWMGeometry(display, screen,
Geometry_str,
NULL,
border,
XWMGeometry(display, screen,
Geometry_str,
NULL,
border,
&xsizehints,
&xsizehints.x,
&xsizehints.x,
&xsizehints.y,
&xsizehints.width,
&xsizehints.height,
&xsizehints.height,
&dummy);
if ( (win = XCreateSimpleWindow(display,
rootwin,
xsizehints.x,
@ -187,7 +187,7 @@ int main( int argc, char **argv ) {
fg_pixel, bg_pixel) ) == 0 ) {
error_handler(ERR_X_CREATE_WINDOW, NULL);
}
if ( (iconwin = XCreateSimpleWindow(display,
win,
xsizehints.x,
@ -202,14 +202,14 @@ int main( int argc, char **argv ) {
/* Set up shaped windows */
/*Gives the appicon a border so you can grab and move it. */
if ( ( pixmask = XCreateBitmapFromData(display,
if ( ( pixmask = XCreateBitmapFromData(display,
win,
mask_bits,
mask_width,
mask_height) ) == 0 ) {
error_handler(ERR_X_CREATE_BITMAP, NULL);
}
XShapeCombineMask(display, win, ShapeBounding, 0, 0, pixmask, ShapeSet );
XShapeCombineMask(display, iconwin, ShapeBounding, 0, 0, pixmask, ShapeSet);
@ -219,10 +219,10 @@ int main( int argc, char **argv ) {
/* Interclient Communication stuff */
/* Appicons don't work with out this stuff */
xwmhints = XAllocWMHints();
xwmhints->flags = WindowGroupHint | IconWindowHint | StateHint;
xwmhints->flags = WindowGroupHint | IconWindowHint | StateHint;
xwmhints->icon_window = iconwin;
xwmhints->window_group = win;
xwmhints->initial_state = WithdrawnState;
xwmhints->initial_state = WithdrawnState;
XSetWMHints( display, win, xwmhints );
xclasshint.res_name = app_name;
@ -230,15 +230,15 @@ int main( int argc, char **argv ) {
XSetClassHint( display, win, &xclasshint );
XSetWMNormalHints( display, win, &xsizehints );
/* Tell window manager what the title bar name is. We never see */
/* this anyways in the WithdrawnState */
if ( XStringListToTextProperty(&app_name, 1, &app_name_atom) == 0 ) {
error_handler(ERR_SETUP_WINDOW_NAME, app_name);
}
XSetWMName( display, win, &app_name_atom );
/* Create Graphic Context */
/* Create Graphic Context */
if (( gc = XCreateGC(display, win,(GCForeground | GCBackground), &xgcValues))
== NULL ) {
error_handler(ERR_CREATE_GC, NULL);
@ -246,18 +246,8 @@ int main( int argc, char **argv ) {
/* XEvent Masks. We want both windows to process X events */
XSelectInput(display, win,
ExposureMask |
ButtonPressMask |
ButtonReleaseMask | /* added ButtonReleaseMask *charkins*/
PointerMotionMask |
FocusChangeMask |
LeaveWindowMask |
KeyPressMask | /* Try this to get keyboard working */
StructureNotifyMask |
EnterWindowMask );
XSelectInput(display, iconwin,
ExposureMask |
ButtonPressMask |
ExposureMask |
ButtonPressMask |
ButtonReleaseMask | /* added ButtonReleaseMask *charkins*/
PointerMotionMask |
FocusChangeMask |
@ -265,9 +255,19 @@ int main( int argc, char **argv ) {
KeyPressMask | /* Try this to get keyboard working */
StructureNotifyMask |
EnterWindowMask );
XSelectInput(display, iconwin,
ExposureMask |
ButtonPressMask |
ButtonReleaseMask | /* added ButtonReleaseMask *charkins*/
PointerMotionMask |
FocusChangeMask |
LeaveWindowMask |
KeyPressMask | /* Try this to get keyboard working */
StructureNotifyMask |
EnterWindowMask );
/* Store the 'state' of the application for restarting */
XSetCommand( display, win, argv, argc );
XSetCommand( display, win, argv, argc );
/* Window won't ever show up until it is mapped.. then drawn after a */
/* ConfigureNotify */
@ -284,23 +284,23 @@ int main( int argc, char **argv ) {
XNextEvent(display, &report );
switch (report.type) {
case Expose:
if (report.xexpose.count != 0) {
if (report.xexpose.count != 0) {
break;
}
if ( Verbose ) printf("Event: Expose\n");
if ( Verbose ) printf("Event: Expose\n");
redraw();
break;
break;
case ConfigureNotify:
if ( Verbose ) printf("Event: ConfigureNotify\n");
if ( Verbose ) printf("Event: ConfigureNotify\n");
// redraw();
break;
case KeyPress:
if (Verbose) printf("Event: Key state: 0x%x Key: 0x%x\n",
if (Verbose) printf("Event: Key state: 0x%x Key: 0x%x\n",
report.xkey.state, report.xkey.keycode);
// ksym = XLookupKeysym(&(report.xkey), report.xkey.state);
/* KeywithMask - this allows Left, middle, and right button functions
/* KeywithMask - this allows Left, middle, and right button functions
to be implemented via keyboard */
XLookupString(&(report.xkey), buffer, bufsize, &ksym, &compose);
if (Verbose) printf("Keysym is: 0x%x\n", (int) ksym);
@ -308,7 +308,7 @@ int main( int argc, char **argv ) {
ExecFunc( KeywithMask );
redraw();
break;
case ButtonPress: /* draw button pressed, don't launch *charkins*/
switch (report.xbutton.button) {
case Button1:
@ -317,9 +317,9 @@ int main( int argc, char **argv ) {
button_pressed = N + LMASK;
// redraw();
}
if ( Verbose )
printf("Button 1:x=%d y=%d N=%d\n",
report.xbutton.x, report.xbutton.y, N+LMASK);
if ( Verbose )
printf("Button 1:x=%d y=%d N=%d\n",
report.xbutton.x, report.xbutton.y, N+LMASK);
break;
case Button2:
if (mmouse) {
@ -328,8 +328,8 @@ int main( int argc, char **argv ) {
button_pressed = N + MMASK;
// redraw();
}
if ( Verbose )
printf("Button 2:x=%d y=%d N=%d\n",
if ( Verbose )
printf("Button 2:x=%d y=%d N=%d\n",
report.xbutton.x, report.xbutton.y, N+MMASK);
}
break;
@ -339,8 +339,8 @@ int main( int argc, char **argv ) {
button_pressed = N + RMASK;
// redraw();
}
if ( Verbose )
printf("Button 3:x=%d y=%d N=%d\n",
if ( Verbose )
printf("Button 3:x=%d y=%d N=%d\n",
report.xbutton.x, report.xbutton.y, N+RMASK);
break;
}
@ -353,9 +353,9 @@ int main( int argc, char **argv ) {
ExecFunc(N + LMASK);
button_pressed=-1;
redraw();
if ( Verbose )
printf("Button 1:x=%d y=%d N=%d\n",
report.xbutton.x, report.xbutton.y, N+LMASK);
if ( Verbose )
printf("Button 1:x=%d y=%d N=%d\n",
report.xbutton.x, report.xbutton.y, N+LMASK);
break;
case Button2:
if (mmouse) {
@ -364,8 +364,8 @@ int main( int argc, char **argv ) {
ExecFunc( N + MMASK);
button_pressed=-1;
redraw();
if ( Verbose )
printf("Button 2:x=%d y=%d N=%d\n",
if ( Verbose )
printf("Button 2:x=%d y=%d N=%d\n",
report.xbutton.x, report.xbutton.y, N+MMASK);
}
break;
@ -375,8 +375,8 @@ int main( int argc, char **argv ) {
ExecFunc( N + RMASK);
button_pressed=-1;
redraw();
if ( Verbose )
printf("Button 3:x=%d y=%d N=%d\n",
if ( Verbose )
printf("Button 3:x=%d y=%d N=%d\n",
report.xbutton.x, report.xbutton.y, N+RMASK);
break;
}
@ -389,11 +389,11 @@ int main( int argc, char **argv ) {
XCloseDisplay(display);
exit(OKAY);
break;
case EnterNotify:
case LeaveNotify:
case EnterNotify:
case LeaveNotify:
XSetInputFocus(display, PointerRoot, RevertToParent, CurrentTime);
if (Verbose) printf("Focus Change\n");
break;
break;
}
}
return (OKAY);
@ -403,9 +403,9 @@ int main( int argc, char **argv ) {
* Function: redraw
****************************************************************
Description:
This function maintains the appearance of the application
This function maintains the appearance of the application
by copying the "visible" pixmap to the two windows (the withdrawn
main window, and the icon window which is the main windows's icon
main window, and the icon window which is the main windows's icon
image).
Change History:
@ -415,21 +415,21 @@ int main( int argc, char **argv ) {
void redraw() {
XCopyArea(display, template.pixmap, visible.pixmap, gc, 0, 0,
template.attributes.width, template.attributes.height, 0, 0 );
template.attributes.width, template.attributes.height, 0, 0 );
defineButtonRegions();
/* Copy button to icon */
XCopyArea(display, buttons.pixmap, visible.pixmap, gc,
XCopyArea(display, buttons.pixmap, visible.pixmap, gc,
1, 1, 53, 40, 6, 20);
flush_expose( win );
flush_expose( win );
XCopyArea(display, visible.pixmap, win, gc, 0, 0,
visible.attributes.width, visible.attributes.height, 0, 0 );
flush_expose( iconwin );
visible.attributes.width, visible.attributes.height, 0, 0 );
flush_expose( iconwin );
XCopyArea(display, visible.pixmap, iconwin, gc, 0, 0,
visible.attributes.width, visible.attributes.height, 0, 0 );
// if ( Verbose ) printf("In Redraw()\n");
// if ( Verbose ) printf("In Redraw()\n");
displaystr();
} /***** End of function redraw() ********************************/
@ -439,10 +439,10 @@ void redraw() {
Description:
Return the button at the x,y coordinates. The button need not
be visible ( drawn ). Return -1 if no button match.
Change History:
Date Modification
11/1/00 Function Header Updated
11/1/00 Function Header Updated
****************************************************************/
int whichButton( int x, int y ) {
int index;
@ -468,7 +468,7 @@ int whichButton( int x, int y ) {
Change History:
Date Modification
01/17/01 Updated to take a KeySym, rather than a KeyCode
11/09/00 Original Function creation
11/09/00 Original Function creation
****************************************************************/
int whichKey (KeySym keysym) {
extern int Verbose;
@ -612,7 +612,7 @@ int whichKey (KeySym keysym) {
****************************************************************
Description:
Load XPM data into X Pixmaps.
* Pixmap 'template' contains the untouched window backdrop image.
* Pixmap 'visible' is the template pixmap with buttons drawn on it.
-- what is seen by the user.
@ -630,31 +630,31 @@ void getPixmaps() {
visible.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
buttons.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
charmap.attributes.valuemask |= (XpmReturnPixels | XpmReturnExtensions);
/* Template Pixmap. Never Drawn To. */
if ( XpmCreatePixmapFromData( display, rootwin, backdrop_xpm,
&template.pixmap, &template.mask,
&template.pixmap, &template.mask,
&template.attributes) != XpmSuccess ) {
error_handler(ERR_CREATE_PIXMAP, "template");
}
/* Visible Pixmap. Copied from template Pixmap and then drawn to. */
if ( XpmCreatePixmapFromData( display, rootwin, backdrop_xpm,
&visible.pixmap, &visible.mask,
&visible.pixmap, &visible.mask,
&visible.attributes) != XpmSuccess ) {
error_handler(ERR_CREATE_PIXMAP, "visible");
}
/* Button Pixmap. */
if ( XpmCreatePixmapFromData( display, rootwin, calcbuttons_xpm,
&buttons.pixmap, &buttons.mask,
&buttons.pixmap, &buttons.mask,
&buttons.attributes) != XpmSuccess ) {
error_handler(ERR_CREATE_PIXMAP, "buttons");
}
/* Character Map Pixmap. */
if ( XpmCreatePixmapFromData( display, rootwin, charmap_xpm,
&charmap.pixmap, &charmap.mask,
&charmap.pixmap, &charmap.mask,
&charmap.attributes) != XpmSuccess ) {
error_handler(ERR_CREATE_PIXMAP, "charmap");
}
@ -664,7 +664,7 @@ void getPixmaps() {
* Function: flush_expose
****************************************************************
Description:
This function is a hold-over from previous programs (wmcp).
This function is a hold-over from previous programs (wmcp).
The use of this function is not well understood.
Change History:
@ -674,7 +674,7 @@ void getPixmaps() {
int flush_expose(Window w) {
XEvent dummy;
int i=0;
while (XCheckTypedWindowEvent(display, w, Expose, &dummy)) i++;
return(i);
} /***** End of function flush_expose() *************************/
@ -684,10 +684,10 @@ int flush_expose(Window w) {
****************************************************************
Description:
This function defines the start and end x and y coordinates for
the various buttons used in wmcalc.
the various buttons used in wmcalc.
There should be a better way to do this, as right now, changing
the pixmap calcbuttons.xpm may require the modification of these
There should be a better way to do this, as right now, changing
the pixmap calcbuttons.xpm may require the modification of these
magic numbers.
Change History:
@ -745,7 +745,7 @@ void defineButtonRegions(void) {
****************************************************************
Description:
This function displays individual characters to the "display".
This function should only be called from displaystr().
This function should only be called from displaystr().
Change History:
Date Modification
@ -761,26 +761,26 @@ void displaychar(char ch, int location) {
containing the character to
display */
locaty = 6;
locaty = 6;
locatx = 2 + location * 6;
/* If the character is a memory display character, use the memory
location display region. Valid Characters are:
'_' - No data in Memory Location
'=' - Value in Memory Location, Not Locked
'#' - Constant in Memory Location, Locked
'#' - Constant in Memory Location, Locked
*/
if ((ch == '=') || (ch == '_') || ch == '#') {
locaty = 15;
if ((ch == '=') || (ch == '_') || ch == '#') {
locaty = 15;
}
XCopyArea(display, charmap.pixmap, win, gc,
dispchar.x, dispchar.y,
dispchar.i-dispchar.x, dispchar.j-dispchar.y,
XCopyArea(display, charmap.pixmap, win, gc,
dispchar.x, dispchar.y,
dispchar.i-dispchar.x, dispchar.j-dispchar.y,
locatx, locaty);
XCopyArea(display, charmap.pixmap, iconwin, gc,
dispchar.x, dispchar.y,
dispchar.i-dispchar.x, dispchar.j-dispchar.y,
XCopyArea(display, charmap.pixmap, iconwin, gc,
dispchar.x, dispchar.y,
dispchar.i-dispchar.x, dispchar.j-dispchar.y,
locatx, locaty);
} /***** End of Function displaychar() **************************/
@ -789,7 +789,7 @@ void displaychar(char ch, int location) {
* Function: displaystr
****************************************************************
Description:
Change History:
Date Modification
11/09/00 Added Capabilities for "Locked" memories
@ -813,7 +813,7 @@ void displaystr(void) {
for (i = 0; i < NUM_MEM_CELLS; i++) {
if (MemArray[i] == 0.0)
displaychar('_', i); /* Value NOT stored here */
else if (MemLock[i] == 0)
else if (MemLock[i] == 0)
displaychar('=', i); /* Value IS stored here */
else
displaychar('#', i); /* Constant IS stored here */
@ -826,7 +826,7 @@ void displaystr(void) {
* Function: show_usage
****************************************************************
Description:
This function prints a brief usage message to stdout,
This function prints a brief usage message to stdout,
and exits.
Change History:
@ -842,7 +842,7 @@ void show_usage(void) {
app_name);
printf("\n");
printf("-g <geometry> Window Geometry - ie: 64x64+10+10\n");
printf("-d <display> Display - ie: 127.0.0.1:0.0\n");
printf("-d <display> Display - ie: 127.0.0.1:0.0\n");
printf("-f <filename> Name of Config file - ie: /home/user/.wmcalc\n");
printf("-v Verbose Mode. \n");
printf("-h Help. This message.\n");
@ -865,8 +865,8 @@ void error_handler (int err_code, char *err_string) {
extern char tempfile[];
if (err_code == OKAY) {
/* This case should never happen.
If it does, somebody screwed up (probably me),
/* This case should never happen.
If it does, somebody screwed up (probably me),
but don't kill the program!! */
return;
}
@ -878,9 +878,9 @@ void error_handler (int err_code, char *err_string) {
break;
case ERR_TMP_FILE_FAILED:
fprintf(stderr, "Could not open temporary file %s\n", tempfile);
break;
case ERR_X_CREATE_WINDOW:
fprintf(stderr, "Could not create simple window\n");
break;
case ERR_X_CREATE_WINDOW:
fprintf(stderr, "Could not create simple window\n");
break;
case ERR_X_CREATE_BITMAP:
fprintf(stderr, "Could not create bitmap from data\n");

View file

@ -1,13 +1,13 @@
# wmcalc Configuration File
# Last Manual Update: 10/29/00
# General Notes:
# General Notes:
# * There must be a tab character '\t' between the variable name and
# the value, not a series of spaces.
# * wmcalc is case sensitive when reading these variables. Examine the
# * wmcalc is case sensitive when reading these variables. Examine the
# wmcalc_g.h file for currently defined variables.
#Calculator Memory Locations
#Calculator Memory Locations
#Note: These must all exist, though they may be in any order
Mem0 0.000000
Mem1 0.000000
@ -21,15 +21,15 @@ Mem8 0.000000
Mem9 0.000000
# The CalcStart variable is intended to allow the user to start a larger
# calculator for more complicated needs. Everything after the tab '\t'
# calculator for more complicated needs. Everything after the tab '\t'
# character is sent unmodified in a system() call, so anything you can type
# at the command prompt may be put here.
#CalcStart xterm -T "Basic Calculator" -e bc &
#CalcStart xterm -T "gnuplot" -sb -sl 500 -e gnuplot &
CalcStart xcalc &
# The ImagChar variable allows the user to choose between 'i' and 'j' to
# represent the sqrt(-1). (Electrical Engineers (such as myself) use 'j'
# The ImagChar variable allows the user to choose between 'i' and 'j' to
# represent the sqrt(-1). (Electrical Engineers (such as myself) use 'j'
# rather than 'i.')
#ImagChar i
ImagChar j

View file

@ -3,7 +3,7 @@
* Version: 0.2
*
* Description:
* This file contains the constants settings for the wmcalc program,
* This file contains the constants settings for the wmcalc program,
* except for the error constants, which are contained in the file wmcalc_err.h
*
* Change History:

View file

@ -10,7 +10,7 @@
* Date Modification
* 01/17/01 Updated whichKey() function to take a KeySym
* 11/09/00 Removed function clrmem() as this was merged into clrallmem()
* Also add function whichKey, in wmcalc.c to handle Keyboard
* Also add function whichKey, in wmcalc.c to handle Keyboard
* events
* 10/25/00 Original file creation, extracted from wmcalc.h
*/
@ -23,7 +23,7 @@
#include "wmcalc_t.h"
void ExecFunc(int val); // function to run app N as found in conf file
void redraw(void);
void redraw(void);
void getPixmaps(void);
int whichButton(int x, int y); // determine which button has been pressed
int whichKey(KeySym keysym); // determine which key has been pressed

View file

@ -30,7 +30,7 @@ Pixel bg_pixel, fg_pixel;
XSizeHints xsizehints;
XWMHints *xwmhints;
XClassHint xclasshint;
char configfile[CONFIGFILEMAX];
char configfile[CONFIGFILEMAX];
char tempfile[CONFIGFILEMAX];
Pixmap pixmask;

View file

@ -51,4 +51,4 @@ typedef enum {
} cfg_var_label_type;
#endif
#endif

View file

@ -3,20 +3,20 @@
* Version: 0.3
* Author: Edward H. Flora <ehflora@access1.net>
*
* This file is a part of the wmcalc application. As such, this
* file is licensed under the GNU General Public License, version 2.
* A copy of this license may be found in the file COPYING that should
* have been distributed with this file. If not, please refer to
* This file is a part of the wmcalc application. As such, this
* file is licensed under the GNU General Public License, version 2.
* A copy of this license may be found in the file COPYING that should
* have been distributed with this file. If not, please refer to
* http://www.gnu.org/copyleft/gpl.html for details.
*
****************************************************************
Description:
This file includes the X libraries.
Change History:
Date Modification
12/10/00 Original File Creation, from Peter da Silva <peter@taronga.com>
****************************************************************/
#ifndef WMCALC_X_H
#define WMCALC_X_H

View file

@ -3,21 +3,21 @@
* Version: 0.21
* Author: Edward H. Flora <ehflora@access1.net>
*
* This file is a part of the wmcalc application. As such, this
* file is licensed under the GNU General Public License, version 2.
* A copy of this license may be found in the file COPYING that should
* have been distributed with this file. If not, please refer to
* This file is a part of the wmcalc application. As such, this
* file is licensed under the GNU General Public License, version 2.
* A copy of this license may be found in the file COPYING that should
* have been distributed with this file. If not, please refer to
* http://www.gnu.org/copyleft/gpl.html for details.
*
****************************************************************
Description:
This file contains the code for the actual calculator functions,
This file contains the code for the actual calculator functions,
such as a add, subt, clear, etc.
Change History:
Date Modification
11/03/00 File Header added
****************************************************************/
/***** Includes *************************************************/
@ -70,7 +70,7 @@ void clearcalc(void) {
****************************************************************
Description:
Clears the current number being entered.
Change History:
Date Modification
11/03/00 Updated function header
@ -101,7 +101,7 @@ void clearnum(void) {
****************************************************************
Description:
Add characters to the number being entered.
Change History:
Date Modification
11/03/00 Updated function header
@ -119,7 +119,7 @@ void charkey(char ch) {
if (StrCnt < DISPSIZE) {
if (ch == '.') {
if (DecFlag == 0) {
if (DecFlag == 0) {
for (i = 1; i < DISPSIZE; i++)
DispString[i-1] = DispString[i];
DecFlag = 1;
@ -160,7 +160,7 @@ void charkey(char ch) {
****************************************************************
Description:
Change the sign of the number currently being entered
Change History:
Date Modification
11/03/00 Updated Function header
@ -250,7 +250,7 @@ void sqrtnum(void) {
Add the number in Registers A to Register B.
Change History:
Date Modification
11/03/00 Updated Function header
11/03/00 Updated Function header
****************************************************************/
void addnums(void) {
extern int Verbose;
@ -363,10 +363,10 @@ void divnums(void) {
} /* End of Function divnums() ********************************/
/****************************************************************
* Function:
* Function:
****************************************************************
Description:
Calculate result of entered calculation.
Calculate result of entered calculation.
Change History:
Date Modification
11/04/00 Updated Function Header
@ -439,8 +439,8 @@ void clrallmem(void) {
* Function: stormem
****************************************************************
Description:
Store value to memory cell #N
Store value to memory cell #N
Change History:
Date Modification
11/04/00 Updated function header
@ -461,11 +461,11 @@ void stormem(int mem_loc) {
write_config();
}
else {
if (Verbose) printf("Memory location %d Locked at %f\n",
if (Verbose) printf("Memory location %d Locked at %f\n",
mem_loc, MemArray[mem_loc]);
}
if (Verbose) {
if (Verbose) {
for (i = 0; i < NUM_MEM_CELLS; i++)
printf(" %f ", MemArray[i]);
printf("\n");
@ -478,7 +478,7 @@ void stormem(int mem_loc) {
* Function: recallmem
****************************************************************
Description:
Store value to memory cell #N
Store value to memory cell #N
Change History:
Date Modification
11/04/00 Updated function header
@ -497,7 +497,7 @@ void recallmem(int mem_loc) {
sprintf(DispString, "%10.5g", RegisterA);
if (Verbose) {
if (Verbose) {
for (i = 0; i < NUM_MEM_CELLS; i++)
printf(" %f ", MemArray[i]);
printf("\n");
@ -509,7 +509,7 @@ void recallmem(int mem_loc) {
* Function: startcalc
****************************************************************
Description:
Change the sign of the number currently being entered
Change the sign of the number currently being entered
Change History:
Date Modification
11/04/00 Updated function header
@ -518,7 +518,7 @@ void startcalc(void) {
extern int Verbose;
extern char SysCalcCmd[];
if (Verbose)
if (Verbose)
fprintf(stderr, "Starting external calculator %s\n", SysCalcCmd);
if (system(SysCalcCmd) == -1)

View file

@ -4,16 +4,16 @@
* Date: November 1, 2000
* Author: Edward H. Flora <ehflora@access1.net>
*
* This file is a part of the wmcalc application. As such, this
* file is licensed under the GNU General Public License, version 2.
* A copy of this license may be found in the file COPYING that should
* have been distributed with this file. If not, please refer to
* This file is a part of the wmcalc application. As such, this
* file is licensed under the GNU General Public License, version 2.
* A copy of this license may be found in the file COPYING that should
* have been distributed with this file. If not, please refer to
* http://www.gnu.org/copyleft/gpl.html for details.
*
****************************************************************
Description:
This file contains system level functions, such as read/write of
the config file, character map boundaries, etc.
This file contains system level functions, such as read/write of
the config file, character map boundaries, etc.
Change History:
Date Modification
@ -256,8 +256,8 @@ void ExecFunc( int val ) {
* Function: getboundaries
****************************************************************
Description:
This function returns the x,y boundaries for each character
that is to be displayed on the display.
This function returns the x,y boundaries for each character
that is to be displayed on the display.
There must be a better way to do this, as by changing the file
charmap.xpm, one may have to adjust these constants.
@ -379,7 +379,7 @@ ButtonArea getboundaries(char ch) {
This function updates the configuration file as memory locations
are updated in the program. It re-writes the entire file, but
should ignore all lines that do not start with "Mem".
Change History:
Date Modification
11/01/00 Function Header updated
@ -406,7 +406,7 @@ int write_config(void) {
/* We cannot write to the global config-file... */
if(!strcmp(configfile, CONFIGGLOBAL)) {
strcpy(configfile, getenv("HOME")); // Added to wmbutton by Gordon Fraser, 9/21/01
strcat(configfile, CONFFILENAME);
strcat(configfile, CONFFILENAME);
}
/* Open Temporary File */
@ -423,7 +423,7 @@ int write_config(void) {
while ((line = readln(fp)) != NULL) { // Read Lines in config file
if (Verbose) printf("line:%s", line);
if ((strncmp(line, CfgVarList[MEM_LABEL_0],
if ((strncmp(line, CfgVarList[MEM_LABEL_0],
strlen(CfgVarList[MEM_LABEL_0]) - 1) == 0)) {
// -1 to generalize to all Mem? strings
// If we've found a memory entry
@ -445,9 +445,9 @@ int write_config(void) {
/* Copy temp file over original */
/* Note: If changing command, make sure to adjust size of string above!! */
sprintf(movefilecmd, "mv -f %s %s\n", tempfile, configfile);
sprintf(movefilecmd, "mv -f %s %s\n", tempfile, configfile);
err_code = system(movefilecmd);
if(Verbose) printf("New config file written.\n");
return(err_code);
@ -461,7 +461,7 @@ int write_config(void) {
This function reads the configuration file on program startup,
and sets the appropriate configuration options.
(By default, this is ~/.wmcalc, or a user set value)
Change History:
Date Modification
11/01/00 Function header updated.
@ -500,10 +500,10 @@ int read_config(void) {
line = readln(fp);
if (Verbose) printf("Line Read:%s\n", line);
if (line == NULL) break; // if end of file, quit
if ( (line[0] != '#') && (line[0] != '\n')) { /* Ignore comments and
if ( (line[0] != '#') && (line[0] != '\n')) { /* Ignore comments and
blanks */
if (strchr(line, sep_ch) != NULL) { /* The line has a tab, so let's
see if the variable is
see if the variable is
understood */
i = 0;
/* Loop while we haven't found the variable */
@ -514,7 +514,7 @@ int read_config(void) {
/* If we've found the variable, let's set the appropriate value */
if (i <= MAX_LABEL) {
if (Verbose) printf("Variable %s found\n", CfgVarList[i]);
/* Point to the 'tab' character, to read the value */
cfg_var_ptr = strchr(line, sep_ch);
cfg_var_ptr++; // ++ to avoid tab character itself
@ -535,7 +535,7 @@ int read_config(void) {
MemLock[i] = 0;
/* Set Memory Element */
MemArray[i] = atof(cfg_var_ptr);
if (Verbose)
if (Verbose)
printf("Assign Memory Element %d to %f\n", i, MemArray[i]);
break;
@ -553,18 +553,18 @@ int read_config(void) {
MemLock[i - MEM_LOCK_0] = 1;
/* Set Memory Element */
MemArray[i - MEM_LOCK_0] = atof(cfg_var_ptr);
if (Verbose)
if (Verbose)
printf("Assign Memory Element %d to %f\n", i -
MEM_LOCK_0, MemArray[i - MEM_LOCK_0]);
break;
case IMAG_LABEL:
/* Get the character that the user wishes to use to
/* Get the character that the user wishes to use to
represent sqrt(-1) (i or j) */
if ((cfg_var_ptr[0] == 'i') || cfg_var_ptr[0] == 'j') {
ImagChar = cfg_var_ptr[0];
}
if (Verbose)
if (Verbose)
printf("Use character '%c' to represent sqrt(-1)\n", ImagChar);
break;