New calculator for ReactOS
Moderator: Moderator Team
-
- Posts: 282
- Joined: Thu Jan 04, 2007 12:43 am
- Location: Italy
New calculator for ReactOS
Hello,
I wrote another calculator for ReactOS because I don't like winecalc very much.
I did it with really few lines of source code and for this reason it's very light weight.
Its working system is almost based on the mechanisms of Win32 APIs (that's why it's so small).
It also implements some operators not available on winecalc because its engine uses a simple but robust RPN engine, which converts between infix and postfix notations (when I wrote this core, some idea has been taken from kcalc too).
Still some things need to be completed, but I can say it's eveolving well and I'm satisfied of the results I'm getting.
It's my intention to call it "ReactOS Calc" and I would like to release it under GNU GPL license. I hope the are no problems on the choice of the name and of course I would be happy if it could be included into ReactOS in the future.
While it seems to work fine on Microsoft's operating systems, it doesn't work well on ReactOS, even with the latest 0.3.1.
Here there is small list of my errors:
1) I create my dialogbox and then I call SetWindowsHookEx() for listening the keyboard inputs. Unfortunately, it doesn't work and it seems my keyboard handler is never called.
2) If I call ShowWindow() with SW_HIDE for hiding child controls on the dialog they won't disappear. A similar thing happens with SW_SHOW. I must do an action for forcing the entire window update, like minimizing and restoring my dialogbox, otherwise it won't work.
3) It seems that the group box control doesn't work.
You know, there are some radio buttons with HEX, DEC, OCT, etc and they are on the same line.
When I select, for example, the RADIANTS radio button, the one with DEC text loses its check.
I used BS_AUTOCHECKBOX and BS_AUTORADIOBUTTON styles.
4) Clipboard-out doesn't seem to work. If I write "12" and then I select "copy", when I try to paste into the notepad I get two characters, but I these characters are displayed as two empty rectangles.
5) Clipboard-in doesn't seem to work. I write into the notepad "1+2=", I copy and paste into the calculator, but the calculator crashes.
6) Into the aboutbox I put the ReactOS logo. But there is a GFX glitch.
The background around the image isn't cleaned.
In my opinion it wouldn't be too difficult to solve this issue if you know where to put your hands.
The solution is: read the pixel at coordinates (0,0) of the image, create a brush with that color and clean the space around the image with that. I tried to search where it's done, but it's not easy to find a small thing into 140 MB of sources, perhaps the man who knows that source better will be able to do this fix in few seconds.
7) Into the about box there is also a read only edit control with some text "This is ReactOS Calc... GNU GPL... etc..." but the vertical scrollbar doesn't work. My text is just one line bigger than the vertical size of the edit control.
I hope this will be help you and me too.
Sincerely,
Carlo Bramini.
EDIT: just corrected some syntax errors
I wrote another calculator for ReactOS because I don't like winecalc very much.
I did it with really few lines of source code and for this reason it's very light weight.
Its working system is almost based on the mechanisms of Win32 APIs (that's why it's so small).
It also implements some operators not available on winecalc because its engine uses a simple but robust RPN engine, which converts between infix and postfix notations (when I wrote this core, some idea has been taken from kcalc too).
Still some things need to be completed, but I can say it's eveolving well and I'm satisfied of the results I'm getting.
It's my intention to call it "ReactOS Calc" and I would like to release it under GNU GPL license. I hope the are no problems on the choice of the name and of course I would be happy if it could be included into ReactOS in the future.
While it seems to work fine on Microsoft's operating systems, it doesn't work well on ReactOS, even with the latest 0.3.1.
Here there is small list of my errors:
1) I create my dialogbox and then I call SetWindowsHookEx() for listening the keyboard inputs. Unfortunately, it doesn't work and it seems my keyboard handler is never called.
2) If I call ShowWindow() with SW_HIDE for hiding child controls on the dialog they won't disappear. A similar thing happens with SW_SHOW. I must do an action for forcing the entire window update, like minimizing and restoring my dialogbox, otherwise it won't work.
3) It seems that the group box control doesn't work.
You know, there are some radio buttons with HEX, DEC, OCT, etc and they are on the same line.
When I select, for example, the RADIANTS radio button, the one with DEC text loses its check.
I used BS_AUTOCHECKBOX and BS_AUTORADIOBUTTON styles.
4) Clipboard-out doesn't seem to work. If I write "12" and then I select "copy", when I try to paste into the notepad I get two characters, but I these characters are displayed as two empty rectangles.
5) Clipboard-in doesn't seem to work. I write into the notepad "1+2=", I copy and paste into the calculator, but the calculator crashes.
6) Into the aboutbox I put the ReactOS logo. But there is a GFX glitch.
The background around the image isn't cleaned.
In my opinion it wouldn't be too difficult to solve this issue if you know where to put your hands.
The solution is: read the pixel at coordinates (0,0) of the image, create a brush with that color and clean the space around the image with that. I tried to search where it's done, but it's not easy to find a small thing into 140 MB of sources, perhaps the man who knows that source better will be able to do this fix in few seconds.
7) Into the about box there is also a read only edit control with some text "This is ReactOS Calc... GNU GPL... etc..." but the vertical scrollbar doesn't work. My text is just one line bigger than the vertical size of the edit control.
I hope this will be help you and me too.
Sincerely,
Carlo Bramini.
EDIT: just corrected some syntax errors
-
- Posts: 282
- Joined: Thu Jan 04, 2007 12:43 am
- Location: Italy
Hello,
I started the project "ReactOS Calc" at sourceforge.net
As soon as the sourceforge team will approve it, I will upload the files.
The binaries are available with italian and english languages.
At the moment, missing things are:
1) missing icon.
2) missing context help.
3) missing help file.
4) missing digit groups (I didn't understand exactly what it means...).
Unfortunately, it's not really useful on ReactOS at the moment, but I'm sure that things will change a lot in the near future.
Anyways, I hope this work will be appreciated by this nice community.
Sincerely,
Carlo Bramini
I started the project "ReactOS Calc" at sourceforge.net
As soon as the sourceforge team will approve it, I will upload the files.
The binaries are available with italian and english languages.
At the moment, missing things are:
1) missing icon.
2) missing context help.
3) missing help file.
4) missing digit groups (I didn't understand exactly what it means...).
Unfortunately, it's not really useful on ReactOS at the moment, but I'm sure that things will change a lot in the near future.
Anyways, I hope this work will be appreciated by this nice community.
Sincerely,
Carlo Bramini
-
- Posts: 282
- Joined: Thu Jan 04, 2007 12:43 am
- Location: Italy
Hello,
I released ReactOS Calc to the public.
You can find it here:
http://sourceforge.net/projects/reactos-calc/
I hope you will find it useful.
Sincerely,
Carlo Bramini
I released ReactOS Calc to the public.
You can find it here:
http://sourceforge.net/projects/reactos-calc/
I hope you will find it useful.
Sincerely,
Carlo Bramini
-
- Posts: 237
- Joined: Fri Nov 26, 2004 10:44 pm
- Location: Fallowfield
-
- Developer
- Posts: 509
- Joined: Mon Apr 25, 2005 12:46 pm
Nice work.
But it's gradian not gradient, and it's radians, without t.
And a full circle is 400 grad, not 200!
An idea for a workaround to the keyboardhook prob:
You could create the main window as a modeless dialog and process the keyboard messages in the message queue.
Suggestion for an enhancement: When clicking inv, the buttons could change from ln to e^x, sin to sin^-1 etc.
But it's gradian not gradient, and it's radians, without t.
And a full circle is 400 grad, not 200!
An idea for a workaround to the keyboardhook prob:
You could create the main window as a modeless dialog and process the keyboard messages in the message queue.
Suggestion for an enhancement: When clicking inv, the buttons could change from ln to e^x, sin to sin^-1 etc.
-
- Posts: 282
- Joined: Thu Jan 04, 2007 12:43 am
- Location: Italy
Thank you, I corrected this translation error.ThePhysicist wrote:But it's gradian not gradient, and it's radians, without t.
Hopefully, the italian names are right...
Ouch! you are right! Stupid mistake!ThePhysicist wrote:And a full circle is 400 grad, not 200!
Perhaps I could do something like "#ifdef KEYB_MODE==KEYB_POLL".ThePhysicist wrote:An idea for a workaround to the keyboardhook prob:
You could create the main window as a modeless dialog and process the keyboard messages in the message queue.
This will keep both solutions working.
However, I hope that the defect on SetWindowsHookEx() will be solved even if I will do this patch.
Good idea, I could append it into the todo list.ThePhysicist wrote:Suggestion for an enhancement: When clicking inv, the buttons could change from ln to e^x, sin to sin^-1 etc.
Sincerely,
Carlo Bramini
-
- Posts: 282
- Joined: Thu Jan 04, 2007 12:43 am
- Location: Italy
Hello,
I did these changes for now:
* Fixed english translation for "Radians" and "Gradians".
* Corrected conversion between radians and gradians angles.
* Added work-around for catching keys without the keyboard hook (selectable at compile time).
* The version number of the programme has been moved from the resource files to ABOUT.C.
I won't be able to test it with ReactOS until monday.
If it will work, I think I will release this bug-fixed version.
Sincerely,
Carlo Bramini
I did these changes for now:
* Fixed english translation for "Radians" and "Gradians".
* Corrected conversion between radians and gradians angles.
* Added work-around for catching keys without the keyboard hook (selectable at compile time).
* The version number of the programme has been moved from the resource files to ABOUT.C.
I won't be able to test it with ReactOS until monday.
If it will work, I think I will release this bug-fixed version.
Sincerely,
Carlo Bramini
-
- Posts: 282
- Joined: Thu Jan 04, 2007 12:43 am
- Location: Italy
Looks nice
I also have a suggestion. Wouldn't it be nice so that if you change between degrees, radians and gradians, the current number in the calculator gets converted automatically, similar to Hex/Dec/Oct/Bin?
eg, I type in 360 under degrees, then click on the gradians radio button, the calculator should say 400.
I also have a suggestion. Wouldn't it be nice so that if you change between degrees, radians and gradians, the current number in the calculator gets converted automatically, similar to Hex/Dec/Oct/Bin?
eg, I type in 360 under degrees, then click on the gradians radio button, the calculator should say 400.
-
- Posts: 237
- Joined: Fri Nov 26, 2004 10:44 pm
- Location: Fallowfield
The difference with Bin/Hex/Oct is that any operations done on a Hex number, are returned as a Hex number.
With angles, if you use a function such as Sin, then the angle is converted into a ratio (Opposite/Hypotenuse), which doesn't have units.
You convert a ratio back into an angle using Inv Sin. Of course, the unit of angle is important here too. But if you have a ratio in the calculator display, changing e.g. from degrees to radians, would multiply that ratio by Pi/180, which you wouldn't want.
So, an automatic conversion would cause a great inconvenience.
It might be an idea to have extra buttons to convert between the angle units, although adding more buttons means deviating from the original calc's layout. That would be a pretty big decision to make.
With angles, if you use a function such as Sin, then the angle is converted into a ratio (Opposite/Hypotenuse), which doesn't have units.
You convert a ratio back into an angle using Inv Sin. Of course, the unit of angle is important here too. But if you have a ratio in the calculator display, changing e.g. from degrees to radians, would multiply that ratio by Pi/180, which you wouldn't want.
So, an automatic conversion would cause a great inconvenience.
It might be an idea to have extra buttons to convert between the angle units, although adding more buttons means deviating from the original calc's layout. That would be a pretty big decision to make.
Who is online
Users browsing this forum: No registered users and 15 guests