Xcalc problem solved, Xcalc problem created

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
Wosh
Posts: 60
Joined: Mon 09 Jul 2007, 19:20
Location: Nuremberg Germany

Xcalc problem solved, Xcalc problem created

#1 Post by Wosh »

Am I the first non-native English person trying to use decimal calculations with xcalc?

The decimal separator for English people is the period ".". For other countries like the locale de_DE the decimal separator is the comma ",".

If those people call xcalc preinstalled in Puppy 3.01 the following behaviour can be watched:
Entering '3' '.' '4' displays "3.4".
Adding '2' '.' '8' displays "2.8" and results in "5".
Divding '5' '/' '4' results in "1,25".
Entering '3' ',' '4' displays "3".

So obviously the preinstalled xcalc uses the decimal comma for results, but it does not allow to enter the comma as decimal separator.

A look at the modification time of xcalc shows June 14 2004.

So assuming maybe this version is a bit outdated I did the following steps:
1. Download the sources xcalc-1.0.1.tar.bz2 from the mirror t2/source/6.0/x.
2. Run confgure and make from devx_301.sfs.
3. The linker complains about the missing library Xaw7.
4. After patching the library Xaw7 to Xaw8 within the Makefile "make" builds xcalc.

Calling the new xcalc version the following valid behaviour can be watched :
Entering '3' '.' '4' displays "3,4".
Adding '2' '.' '8' displays "2,8" and results in "6,2".

Adding the two lines to the resource file /usr/X11R7/lib/X11/app-defaults/Xcalc after

XCalc*ti.bevel.screen.LCD.translations: #replace\n\

:<Key>\\,:decimal()\n\
<Key>Return:equal()\n\

makes it possible to enter the comma as decimal separator and to use the RETURN-key to calculate the result (default is ENTER or '=' only).

So even if xcalc now can be used in localized Puppy versions the look has changed.
At the left you can see the preinstalled xcalc with the invalid decimal point and a three dimensional look of the buttons.
At the right is the new compiled xcalc with the decimal comma, a rather basic look and a little bit longer.
Both programs use /usr/X11R7/lib/X11/app-defaults/Xcalc as resource.

I am not an X11-expert at all. So maybe some experienced user can answer my two questions:

1. What leads to that different look of my xcalc?
2. What does the warning mean "Cannot convert string "calculator" to type Pixmap" if any of these two versions is called from a console?
Attachments
xcalc-decimal.png
(15.98 KiB) Downloaded 1796 times
Last edited by Wosh on Sat 19 Jan 2008, 00:40, edited 2 times in total.
Wosh

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

I think it was compiled with libXaw95.
That is a library that was used by the windowmanager Fvwm95, that tried to mimic Win95 look. It was used in early versions of Puppy.
libXaw95.so should be in /usr/X11R7/lib

Mark

User avatar
Wosh
Posts: 60
Joined: Mon 09 Jul 2007, 19:20
Location: Nuremberg Germany

The reason is libXaw95

#3 Post by Wosh »

Thanks Mark

I have replaced Xaw7 with Xaw95 within the xcalc Makefile and now xcalc has the same look as the preinstalled one.
So maybe Barry will take pity on the not English speaking world and recompile xcalc.

If not, here is the localisized xcalc compiled with Xaw95:
Attachments
xcalc.zip
(9.87 KiB) Downloaded 491 times

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#4 Post by MU »

thank you, I will add it to the next german Muppy :)
Could you also upload the white one?
Some people might prefer that.
Mark

User avatar
Wosh
Posts: 60
Joined: Mon 09 Jul 2007, 19:20
Location: Nuremberg Germany

Localisized xcalc in both forms

#5 Post by Wosh »

Hello Mark, hello world

Working on this topic I have become curious.
Maybe some experienced X11 programmer still can answer what the warning means "Cannot convert string "calculator" to type Pixmap"?

It's a reference to the third line in Xcalc:
XCalc.IconPixmap: calculator

I have created a small bzip2-tar-archive xcalc-local.tar.bz2 containing:
1. XCalc.............. modified resource-file
2. Xaw95/xcalc localisized xcalc with the look in Puppy 3.01
3. Xaw8/xcalc.. localisized xcalc with the previous basic look

All you must do:
Copy XCalc to /usr/X11R7/lib/X11/app-defaults
Copy xcalc to /usr/X11R7bin

I hope you enjoy calculations.
Attachments
xcalc-local.tar.bz2
(14.72 KiB) Downloaded 476 times
Wosh

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#6 Post by MU »

Danke Wosh :)
Mark

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#7 Post by goingnuts »

The "Warning: Cannot convert string "calculator" to type Pixmap" can be removed by having file "/usr/X11R7/include/X11/bitmaps/calculator" present

It seems to do nothing. I was hoping to have a window icon - but the "X-window-icon" sticks.

How to change the window icon for these old Xaw applications?
Edit: To change jwm-window icon supply an icon in /usr/share/pixmaps with the name "xcalc.xpm" or "xcalc.png".

Content of /usr/X11R7/include/X11/bitmaps/calculator:

Code: Select all

#define icon_width 28
#define icon_height 48
static char icon_bits[] = {
   0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x0f, 0x03, 0x00, 0x00, 0x0c,
   0xd3, 0x5d, 0x5d, 0x0c, 0x13, 0x51, 0x45, 0x0c, 0xd3, 0xdd, 0xdd, 0x0d,
   0x53, 0x10, 0x51, 0x0d, 0xd3, 0x1d, 0xdd, 0x0d, 0x03, 0x00, 0x00, 0x0c,
   0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x0f, 0x01, 0x00, 0x00, 0x08,
   0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08,
   0xbd, 0xf7, 0xde, 0x0b, 0xa5, 0x94, 0x52, 0x0a, 0xbd, 0xf7, 0xde, 0x0b,
   0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0xf7, 0xde, 0x0b,
   0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b,
   0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08,
   0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0x94, 0xd2, 0x0b,
   0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b,
   0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0xf7, 0xde, 0x0b,
   0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0x94, 0xd2, 0x0b,
   0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08,
   0xbd, 0xff, 0xde, 0x0b, 0xbd, 0x80, 0xd2, 0x0b, 0xbd, 0x80, 0xd2, 0x0b,
   0xbd, 0xff, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xff, 0xff, 0xff, 0x0f};

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#8 Post by npierce »

goingnuts wrote:How to change the window icon for these old Xaw applications?
Edit: To change jwm-window icon supply an icon in /usr/share/pixmaps with the name "xcalc.xpm" or "xcalc.png".
OK, I see you have already answered your own question. So I'll just add some additional information.

Other possible homes for the icon file can be seen by looking at the /root/.jwmrc file. For instance, in the .jwmrc file for Precise 5.7.1, these directories are listed:

Code: Select all

<IconPath>/usr/local/lib/X11/mini-icons</IconPath>
<IconPath>/usr/local/lib/X11/pixmaps</IconPath>
<IconPath>/usr/share/pixmaps</IconPath>
<IconPath>/usr/local/share/pixmaps</IconPath>
goingnuts wrote:It seems to do nothing. I was hoping to have a window icon - but the "X-window-icon" sticks.
Rather than have a tasklist in the tray, some older window managers simply placed an icon on the desktop for minimized application windows. That is what the /usr/include/X11/bitmaps/calculator bitmap file is used for.


The /usr/include/X11/bitmaps/gray3 file is another bitmap file that is sometimes used by xcalc. If this file is needed but missing, xcalc will give a warning similar to the warning for the "calculator" bitmap file. I've attached a copy of this file. Download it to /usr/include/X11/bitmaps/ then gunzip it. Some Puppy users will probably never see a warning if this file is missing because some Puppies don't include the resource file that adds color to the xcalc window.

Since Puppy is puppy-sized, one of the resource files for xcalc is omitted from some (perhaps all) Puppies. If one adds the file /etc/X11/app-defaults/XCalc-color, and configures X to support it, the calculator will appear in color. (See attached screenshot). I've attached a copy of that file as well. Download it to /etc/X11/app-defaults/ then gunzip it.

To configure X so that that resource file will be read, one needs to add the following three lines to the end of the /root/.Xresources file and restart the X server:

Code: Select all

#ifdef COLOR
*customization: -color
#endif
Also, you may notice that when you use the Reverse Polish Notation mode of xcalc (by using the -rpn option), the label on the Enter button doesn't fit. (See attached screenshot). This is also related to Puppy being puppy-sized. The font intended to be used is not included in some (perhaps all) Puppies. Puppy tries to emulate it with one of its few included fonts, but it isn't perfect.

I've also attached a copy of that font for anyone that wants to correct the appearance of that button. Download it to your miscellaneous fonts directory (on Precise 5.7.1 it is /usr/share/X11/fonts/misc/). You may gunzip it to be consistent with the other files in that directory, but it should work even if you leave it as a .gz file. (Note that the attached file is for the ISO8859-1 character set. This may not work if your language requires another character set.)

You will then need to edit /usr/share/X11/fonts/misc/fonts.alias to modify the line that begins with "6x12" so that it looks like this line:

Code: Select all

6x12       -misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-iso8859-1
Lastly you will need to run these two commands:

Code: Select all

mkfontdir /usr/share/X11/fonts/misc/
xset fp rehash

Note that the attached screenshot was made before adding the gray3 pixmap file and the 6x12-ISO8859-1.pcf.gz font file.
Attachments
xcalc_guises.png
The various guises of xcalc
(184.17 KiB) Downloaded 911 times
gray3.gz
Bitmap pattern for color xcalc
(/usr/include/X11/bitmaps/gray3)
(100 Bytes) Downloaded 228 times
XCalc-color.gz
Resouce file for color xcalc
(/etc/X11/app-defaults/XCalc-color)
(1.17 KiB) Downloaded 248 times
6x12-ISO8859-1.pcf.gz
Font for xcalc -rpn
(/usr/share/X11/fonts/misc/6x12-ISO8859-1.pcf.gz)
(4.45 KiB) Downloaded 261 times

Post Reply