home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.alaska-software.com
/
2014.06.ftp.alaska-software.com.tar
/
ftp.alaska-software.com
/
acsn
/
BusiCalc_v1-40.Zip
/
BusCalcCls.prg
next >
Wrap
Text File
|
2002-10-06
|
44KB
|
1,025 lines
*****************************************************************************
*
* Module: BusCalcCls.prg
* Category: Calculator Class
* Used By: BusiCalc.prg
*
* Author: Greg Doran, Dublin Ireland e-mail: GDO@eircom.net
* Version: 1.40
* Date: 6th.Oct.2002
* Language: Xbase++
* Compile: Standard.
* Link: Standard.
*
*****************************************************************************
*
* Revision History:
* =================
* Rev 1.10 12th.Jul.2001
* Initial release.
*
* Rev 1.30 30.Sep.2002
* Changed Rev. for Release to Public Domain and added copyright.
*
* Rev 1.40 6.Oct.2002
* Changed position, height and width of oDlg:mask
*
*****************************************************************************
* Copyright (c) Greg J Doran. 2001-2002 GDO@eircom.net
*
* This code is released under the GNU General Public Licence
* and is governed by the conditions and protocols setout therein.
*
* The code is provided "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 of this
* software, its use or misuse, modified or otherwise, lies with
* you, the recipient.
*
*****************************************************************************
#include "Gra.ch"
#include "Xbp.ch"
#include "Common.ch"
#include "Appevent.ch"
#include "Busicalc.ch"
#ifndef _BUSCALC_
#define _BUSCALC_
Class _BUSCALC From Xbpdialog
EXPORTED:
VAR aCalcSize // The Calculator dimensions
VAR aDataStore // Array of variables for Push-Pop on decimal precision change
VAR aHelp // Help Headers, Text, Bmps
VAR aPos // Position of Window
VAR aPreBracket // Stores bracketed operation information
VAR aSize // Window Size
VAR cClipText // Clip board text.
VAR cDisplay // Main display character value
VAR cGenText // General text - Help, About, Message
VAR cTopText // Top Line(s) - Help, About, Message
VAR cXRate // The current Exchange Rate Mode P-E, D-E, D-P
VAR lBS_Enabled // BackSpace enabled / disabled flag
VAR lGettingDecsInput // Flag for processing the Enter Key during decimal precision change
VAR lHaveDecimal // Decimal point flag
VAR lKeysEnabled // Flag to indicate if the number keys are enabled or disabled
VAR lKillKeys // Flag to disable the processing of keystrokes under certain conditions
VAR lLBracketOpen // Flag that indicates that the left bracket is open/closed
VAR lLastOpWasImmediate // Flag to indicate that the last operation was immediate ( x^2, 1/x etc)
VAR lNewCalculation // Indicates when a new Operation is required
VAR lNewInput // Flag that indicates that the input is new or in progress
VAR lOperator // Test for keystrike preceding bracketed operation
VAR lPercent // Records whether the current display is a percent or not.
VAR lRBracketClosed // Flag that indicates that the right bracket is open/closed
VAR nAccumStore // A temporary store for the value in the accumulator
VAR nAccumulator // Holds the result of calculations
VAR nAction // The number of the action being performed
VAR nBMP // The Bitmap associated the the action being performed
VAR nConvertRate // The currently active Exchange Rate
VAR nDE // The current exchange rate Dollars to Euro
VAR nDP // The current exchange rate Dollars to Pounds British
VAR nDecs // Holds the number of decimals displayed (Rounded)
VAR nDisplay // Holds the Input/Value being processed
VAR nImmediateValue // The value returned by an immediated operation ( x^2, 1/x etc)
VAR nIntermediate // Store for display purposes, the intermediate value
VAR nLastKey // Stores the current key value to be checked on next keystrike
VAR nMemVal // Holds the current value in 'Memory'
VAR nOpCount // Operator counter.
VAR nOperation // Stores the currently active Operator/ion number
VAR nPE // The current exchange rate Pounds British to Euro
VAR nPage // Help page
VAR nStoredOpNbr // Stores the operation number preceding a bracketed operation
VAR nStoredValue // Stores the accumulator value preceding a bracketed operation
VAR nSymbol // The Bitmap number for the Symbol in front of the main display
VAR nValueStore // A store for the accumulator, recovery on divide by zero attempt
VAR oBmpBar // Static in Help/About/Error/Rates
VAR oBrackets // Displays Active brackets
VAR oClipBoard // The ClipBoard Object
VAR oDecSet2 // Display for current number of decimal places displayed.
VAR oDisplay // The main display.
VAR oGenText // Static in Help/About/Error/Rates
VAR oKeyTrap // Traps all keystrokes
VAR oMask // Prevents Mouse-Down on oDa activation (Move)
VAR oMemStore // The memory display VAR
VAR oOpenUp // The 'Maximize' (Openup) VAR on the minimised window
VAR oOperText // The Operator bitmap between the Input and Intermediate displays
VAR oPBCA // Button 'Clear Acummulator'
VAR oPBCE // Button 'Clear Entry'
VAR oPBClose // Button 'Close app'
VAR oPBDtoE // Button 'Dollars to Euros' ($|E)
VAR oPBDtoP // Button 'Dollars to Pounds' ($|ú)
VAR oPBExit // Close button on minimised decal
VAR oPBFactoral // Button 'n!'
VAR oPBForeignTo // Button [Depends on currency] E|ú or ú|$ or E|$
VAR oPBHelp // Button 'Help'
VAR oPBInfo // Button 'Information about'
VAR oPBLbracket // Button '('
VAR oPBLocalTo // Button [Depends on currency] ú|E or $|ú or $|E
VAR oPBMC // Button 'Memory Clear'
VAR oPBPi // Button 'Pi' (3.14159....)
VAR oPBPlus // Button '+'
VAR oPBPtoE // Button 'Pounds to Euro' (ú|E)
VAR oPBRbracket // Button ')'
VAR oPBRecall // Button 'Memory Recall'
VAR oPB_0 // Button as indicated.
VAR oPB_1 // Button as indicated.
VAR oPB_2 // Button as indicated.
VAR oPB_3 // Button as indicated.
VAR oPB_4 // Button as indicated.
VAR oPB_5 // Button as indicated.
VAR oPB_6 // Button as indicated.
VAR oPB_7 // Button as indicated.
VAR oPB_8 // Button as indicated.
VAR oPB_9 // Button as indicated.
VAR oPBbspace // Button as indicated.
VAR oPBcopy // Button as indicated.
VAR oPBdivide // Button as indicated.
VAR oPBequals // Button as indicated.
VAR oPBmemadd // Button as indicated.
VAR oPBmemsub // Button as indicated.
VAR oPBminus // Button as indicated.
VAR oPBmultiply // Button as indicated.
VAR oPBnegate // Button as indicated.
VAR oPBnthPwr // Button as indicated.
VAR oPBnthRoot // Button as indicated.
VAR oPBpaste // Button as indicated.
VAR oPBpercent // Button as indicated.
VAR oPBpoint // Button as indicated.
VAR oPBrecip // Button as indicated.
VAR oPBsetDec // Button as indicated.
VAR oPBsetRate // Button as indicated.
VAR oPBspace // Button as indicated ([-] Min. [i][-][x] Translated as SpaceBar key).
VAR oPBsqroot // Button as indicated.
VAR oPBsquare // Button as indicated.
VAR oSetDecMsg // Set number of Decimals message
VAR oSymbol // Symbol in front of Main Display
VAR oTopLine // Static in Help/About/Error/Rates
VAR oValAccum // The Accumulator value display (Trail)
VAR oValInput // The Input value display (Trail)
VAR oValInter // The Intemediate value display (Trail)
VAR oXchgRate // VAR to display the current exchange rate
METHOD init
METHOD create
METHOD destroy
ENDCLASS
* END CLASS _BUSCALC
******************************************************************************
******************************************************************************
* METHOD _BUSCALC:init()
******************************************************************************
*
METHOD _BUSCALC:init(oParent, oOwner, aPos, aSize, aPP, lVisible)
LOCAL nPx := -2
LOCAL nPy := +9
DEFAULT oOwner TO SetAppWindow()
***** VARs
::aCalcSize := {}
::aDataStore := {}
::aHelp := {}
::aPos := aPos
::aPreBracket := {}
::aSize := aSize
::cClipText := ""
::cDisplay := ""
::cGenText := ""
::cTopText := ""
::cXRate := ""
::lBS_Enabled := .F.
::lGettingDecsInput := .F.
::lHaveDecimal := .F.
::lKeysEnabled := .F.
::lKillKeys := .F.
::lLBracketOpen := .F.
::lLastOpWasImmediate := .F.
::lNewCalculation := .F.
::lNewInput := .F.
::lOperator := .F.
::lPercent := .F.
::lRBracketClosed := .F.
::nAccumStore := 0
::nAccumulator := 0
::nAction := 0
::nBMP := 0
::nConvertRate := 0
::nDE := 0
::nDP := 0
::nDecs := 0
::nDisplay := 0
::nImmediateValue := 0
::nIntermediate := 0
::nLastKey := 0
::nMemVal := 0
::nOpCount := 0
::nOperation := 0
::nPE := 0
::nPage := 1
::nStoredOpNbr := 0
::nStoredValue := 0
::nSymbol := 0
::nValueStore := 0
***** END VARS
***** DIALOG
::XbpDialog:init( oParent,oOwner,aPos,aSize,aPP,lVisible)
****** MASK TO PREVENT MOUSE DOWN ON oDA ACTIVATION (MOVE)
*
::oMask:= XbpStatic():new( ::drawingArea, ,{0,0}, {315,304}, { ;
{ XBP_PP_BGCLR, XBPSYSCLR_TRANSPARENT }, ;
{ XBP_PP_FGCLR, XBPSYSCLR_TRANSPARENT }, ;
{ XBP_PP_COMPOUNDNAME, "8.Arial" } } )
::oMask:caption := ""
::oMask:clipSiblings:= .F.
*** Create()
****** KEYBOARD KEYSTROKE TRAP
*
::oKeyTrap:= XbpStatic():new( ::drawingArea, ,{nPx+ 18,34+nPy}, {286,48}, { ;
{ XBP_PP_BGCLR, GRA_CLR_DARKBLUE }, ;
{ XBP_PP_FGCLR, GRA_CLR_PALEGRAY }, ;
{ XBP_PP_COMPOUNDNAME, "8.Arial" } } )
::oKeyTrap:caption := ""
::oKeyTrap:clipSiblings:= .T.
::oKeyTrap:options := XBPSTATIC_TEXT_VCENTER
*** Create()
***** TRAIL
::oValInput:= XbpStatic():new( ::drawingArea, ,{nPx+ 22,281+nPy}, { 76, 12}, { ;
{ XBP_PP_BGCLR, GRA_CLR_PALEGRAY }, ;
{ XBP_PP_FGCLR, GRA_CLR_BLACK } } )
::oValInput:caption := "ValInput"
::oValInput:clipSiblings:= .T.
::oValInput:options := XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_RIGHT
*** Create()
::oOperText:= XbpStatic():new( ::drawingArea, ,{nPx+102,279+nPy}, {22,16})
::oOperText:caption := BM_NIL_BLANK //
::oOperText:type := XBPSTATIC_TYPE_BITMAP
::oOperText:clipSiblings:= .T.
::oOperText:options := XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_CENTER
*** Create()
::oValInter:= XbpStatic():new( ::drawingArea, ,{nPx+128,281+nPy}, { 76, 12}, { ;
{ XBP_PP_BGCLR, GRA_CLR_PALEGRAY }, ;
{ XBP_PP_FGCLR, GRA_CLR_BLACK } } )
::oValInter:caption := "ValInter"
::oValInter:clipSiblings:= .T.
::oValInter:options := XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_RIGHT
*** Create()
::oValAccum:= XbpStatic():new( ::drawingArea, ,{nPx+224,281+nPy}, { 76, 12}, { ;
{ XBP_PP_BGCLR, GRA_CLR_PALEGRAY }, ;
{ XBP_PP_FGCLR, GRA_CLR_BLACK } } )
::oValAccum:caption := "ValAccum"
::oValAccum:clipSiblings:= .T.
::oValAccum:options := XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_RIGHT
*** Create()
******* MASTER DISPLAY LINE
*
::oDisplay:= XbpStatic():new( ::drawingArea, ,{nPx+ 59,253+nPy}, {241,18}, { ;
{ XBP_PP_BGCLR, GRA_CLR_BLACK }, ;
{ XBP_PP_FGCLR, GRA_CLR_GREEN }, ;
{ XBP_PP_COMPOUNDNAME,"16.Arial"} } )
::oDisplay:caption := "0."
::oDisplay:clipSiblings := .T.
::oDisplay:options := XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_RIGHT
*** Create()
::oSymbol:= XbpStatic():new( ::drawingArea, ,{nPx+30,254+nPy}, {20,16})
::oSymbol:caption := BM_NIL_BLANK // Blank
::oSymbol:clipSiblings := .T.
::oSymbol:type := XBPSTATIC_TYPE_BITMAP
*** Create()
::oBrackets:= XbpStatic():new( ::drawingArea, ,{nPx+ 121,223+nPy}, {48,16}, { ;
{ XBP_PP_BGCLR, GRA_CLR_DARKBLUE }, ;
{ XBP_PP_FGCLR, GRA_CLR_CYAN }, ;
{ XBP_PP_COMPOUNDNAME,"9.Arial"} } )
::oBrackets:caption := " ( ... 1"
::oBrackets:clipSiblings := .T.
::oBrackets:options := XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_LEFT
*** Create()
******* Memory Store
*
::oMemStore:= XbpStatic():new( ::drawingArea, ,{nPx+21,205+nPy}, {131,12}, { ;
{ XBP_PP_BGCLR, GRA_CLR_PALEGRAY }, ;
{ XBP_PP_FGCLR, GRA_CLR_BLACK } } )
::oMemStore:caption := "Memory Store"+Space(7)+"0."
::oMemStore:clipSiblings:= .T.
::oMemStore:options := XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_RIGHT
*** Create()
******************************************************
********* START STANDARD PUSH BUTTONS *********
******************************************************
::oPBInfo := XbpPushButton():new( ::drawingArea, ,{nPx+256,304+nPy}, {16,14} )
::oPBInfo:activate := {|| postAppEvent(xbeP_Keyboard,asc("q"),,::oKeyTrap) }
::oPBInfo:caption := PB_INFO // [i] "Info" (About)
::oPBInfo:clipSiblings := .T.
::oPBInfo:group := XBP_NO_GROUP
::oPBInfo:tabStop := .T.
*** Create()
::oPBspace := XbpPushButton():new( ::drawingArea, ,{nPx+272,304+nPy}, {16,14} )
::oPBspace:activate := {|| postAppEvent(xbeP_Keyboard,32,,::oKeyTrap) }
::oPBspace:caption := PB_MIN_SPACE // [-] "SpaceBar" (Minimize)
::oPBspace:clipSiblings := .T.
::oPBspace:group := XBP_NO_GROUP
::oPBspace:tabStop := .T.
*** Create()
::oPBClose := XbpPushButton():new( ::drawingArea, ,{nPx+288,304+nPy}, {16,14} )
::oPBClose:activate := {|| PostAppEvent( xbeP_Close,,, self ) }
::oPBClose:caption := PB_CLOSE // [x] "Close App"
::oPBClose:clipSiblings := .T.
::oPBClose:group := XBP_NO_GROUP
::oPBClose:tabStop := .T.
*** Create()
******* Help Button
*
::oPBHelp := XbpPushButton():new( ::drawingArea, ,{nPx+ 19,223+nPy}, {41,16} )
::oPBHelp:activate := {|| postAppEvent(xbeP_Keyboard,xbeK_F1,,::oKeyTrap) }
::oPBHelp:caption := PB_HELP //"Help"
::oPBHelp:clipSiblings := .T.
::oPBHelp:group := XBP_NO_GROUP
::oPBHelp:tabStop := .T.
*** Create()
******* Push Buttons MEMORY
*
::oPBMC := XbpPushButton():new( ::drawingArea, ,{nPx+ 19,169+nPy}, {32,32} )
::oPBMC:activate := {|| postAppEvent(xbeP_Keyboard,asc('W'),,::oKeyTrap) }
::oPBMC:caption := PB_MEM_CLEAR //"MC"
::oPBMC:clipSiblings := .T.
::oPBMC:group := XBP_NO_GROUP
::oPBMC:tabStop := .T.
*** Create()
::oPBmemsub := XbpPushButton():new( ::drawingArea, ,{nPx+ 54,169+nPy}, {32,32} )
::oPBmemsub:activate := {|| postAppEvent(xbeP_Keyboard,asc('T'),,::oKeyTrap) }
::oPBmemsub:caption := PB_MEM_SUB //"M-"
::oPBmemsub:clipSiblings:= .T.
::oPBmemsub:group := XBP_NO_GROUP
::oPBmemsub:tabStop := .T.
*** Create()
::oPBRecall := XbpPushButton():new( ::drawingArea, ,{nPx+ 89,169+nPy}, {32,32} )
::oPBRecall:activate := {|| postAppEvent(xbeP_Keyboard,asc('G'),,::oKeyTrap) }
::oPBRecall:caption := PB_MEM_RECALL //"MR"
::oPBRecall:clipSiblings:= .T.
::oPBRecall:group := XBP_NO_GROUP
::oPBRecall:tabStop := .T.
*** Create()
::oPBmemadd := XbpPushButton():new( ::drawingArea, ,{nPx+124,169+nPy}, {32,32} )
::oPBmemadd:activate := {|| postAppEvent(xbeP_Keyboard,asc('A'),,::oKeyTrap) }
::oPBmemadd:caption := PB_MEM_ADD //"M+"
::oPBmemadd:clipSiblings:= .T.
::oPBmemadd:group := XBP_NO_GROUP
::oPBmemadd:tabStop := .T.
*** Create()
******* Push Buttons NUMERIC
*
::oPB_0 := XbpPushButton():new( ::drawingArea, ,{nPx+202, 64+nPy}, {32,32} )
::oPB_0:activate := {|| postAppEvent(xbeP_Keyboard,asc('0'),,::oKeyTrap) }
::oPB_0:caption := PB__0_ENA // PB__0_DIS disabled
::oPB_0:clipSiblings := .T.
::oPB_0:group := XBP_NO_GROUP
::oPB_0:tabStop := .T.
*** Create()
::oPB_1 := XbpPushButton():new( ::drawingArea, ,{nPx+167, 99+nPy}, {32,32} )
::oPB_1:activate := {|| postAppEvent(xbeP_Keyboard,asc('1'),,::oKeyTrap) }
::oPB_1:caption := PB__1_ENA // PB__1_DIS disabled
::oPB_1:clipSiblings := .T.
::oPB_1:group := XBP_NO_GROUP
::oPB_1:tabStop := .T.
*** Create()
::oPB_2 := XbpPushButton():new( ::drawingArea, ,{nPx+202, 99+nPy}, {32,32} )
::oPB_2:activate := {|| postAppEvent(xbeP_Keyboard,asc('2'),,::oKeyTrap) }
::oPB_2:caption := PB__2_ENA // PB__2_DIS disabled
::oPB_2:clipSiblings := .T.
::oPB_2:group := XBP_NO_GROUP
::oPB_2:tabStop := .T.
*** Create()
::oPB_3 := XbpPushButton():new( ::drawingArea, ,{nPx+237, 99+nPy}, {32,32} )
::oPB_3:activate := {|| postAppEvent(xbeP_Keyboard,asc('3'),,::oKeyTrap) }
::oPB_3:caption := PB__3_ENA // PB__3_DIS disabled
::oPB_3:clipSiblings := .T.
::oPB_3:group := XBP_NO_GROUP
::oPB_3:tabStop := .T.
*** Create()
::oPB_4 := XbpPushButton():new( ::drawingArea, ,{nPx+167,134+nPy}, {32,32} )
::oPB_4:activate := {|| postAppEvent(xbeP_Keyboard,asc('4'),,::oKeyTrap) }
::oPB_4:caption := PB__4_ENA // PB__4_DIS disabled
::oPB_4:clipSiblings := .T.
::oPB_4:group := XBP_NO_GROUP
::oPB_4:tabStop := .T.
*** Create()
::oPB_5 := XbpPushButton():new( ::drawingArea, ,{nPx+202,134+nPy}, {32,32} )
::oPB_5:activate := {|| postAppEvent(xbeP_Keyboard,asc('5'),,::oKeyTrap) }
::oPB_5:caption := PB__5_ENA // PB__5_DIS disabled
::oPB_5:clipSiblings := .T.
::oPB_5:group := XBP_NO_GROUP
::oPB_5:tabStop := .T.
*** Create()
::oPB_6 := XbpPushButton():new( ::drawingArea, ,{nPx+237,134+nPy}, {32,32} )
::oPB_6:activate := {|| postAppEvent(xbeP_Keyboard,asc('6'),,::oKeyTrap) }
::oPB_6:caption := PB__6_ENA // PB__6_DIS disabled
::oPB_6:clipSiblings := .T.
::oPB_6:group := XBP_NO_GROUP
::oPB_6:tabStop := .T.
*** Create()
::oPB_7 := XbpPushButton():new( ::drawingArea, ,{nPx+167,169+nPy}, {32,32} )
::oPB_7:activate := {|| postAppEvent(xbeP_Keyboard,asc('7'),,::oKeyTrap) }
::oPB_7:caption := PB__7_ENA // PB__7_DIS disabled
::oPB_7:clipSiblings := .T.
::oPB_7:group := XBP_NO_GROUP
::oPB_7:tabStop := .T.
*** Create()
::oPB_8 := XbpPushButton():new( ::drawingArea, ,{nPx+202,169+nPy}, {32,32} )
::oPB_8:activate := {|| postAppEvent(xbeP_Keyboard,asc('8'),,::oKeyTrap) }
::oPB_8:caption := PB__8_ENA // PB__8_DIS disabled
::oPB_8:clipSiblings := .T.
::oPB_8:group := XBP_NO_GROUP
::oPB_8:tabStop := .T.
*** Create()
::oPB_9 := XbpPushButton():new( ::drawingArea, ,{nPx+237,169+nPy}, {32,32} )
::oPB_9:activate := {|| postAppEvent(xbeP_Keyboard,asc('9'),,::oKeyTrap) }
::oPB_9:caption := PB__9_ENA // PB__9_DIS disabled
::oPB_9:clipSiblings := .T.
::oPB_9:group := XBP_NO_GROUP
::oPB_9:tabStop := .T.
*** Create()
::oPBpoint := XbpPushButton():new( ::drawingArea, ,{nPx+237, 64+nPy}, {32,32} )
::oPBpoint:activate := {|| postAppEvent(xbeP_Keyboard,asc('.'),,::oKeyTrap) }
::oPBpoint:caption := PB_POINT_ENA // PB_POINT_DIS disabled
::oPBpoint:clipSiblings := .T.
::oPBpoint:tabStop := .T.
*** Create()
******** Push Buttons OPERATORS
*
::oPBPlus := XbpPushButton():new( ::drawingArea, ,{nPx+272,169+nPy}, {32,32} )
::oPBPlus:activate := {|| postAppEvent(xbeP_Keyboard,asc('+'),,::oKeyTrap) }
::oPBPlus:caption := PB_PLUS // [+]
::oPBPlus:clipSiblings := .T.
::oPBPlus:group := XBP_NO_GROUP
::oPBPlus:tabStop := .T.
*** Create()
::oPBLbracket := XbpPushButton():new( ::drawingArea, ,{nPx+272,134+nPy}, {16,32} )
::oPBLbracket:activate := {|| postAppEvent(xbeP_Keyboard,40,,::oKeyTrap) }
::oPBLbracket:caption := PB_L_BRACKET // [(]
::oPBLbracket:clipSiblings:= .T.
::oPBLbracket:group := XBP_NO_GROUP
::oPBLbracket:tabStop := .T.
*** Create()
::oPBRbracket := XbpPushButton():new( ::drawingArea, ,{nPx+288,134+nPy}, {16,32} )
::oPBRbracket:activate := {|| postAppEvent(xbeP_Keyboard,41,,::oKeyTrap) }
::oPBRbracket:caption := PB_R_BRACKET // [)]
::oPBRbracket:clipSiblings:= .T.
::oPBRbracket:group := XBP_NO_GROUP
::oPBRbracket:tabStop := .T.
*** Create()
::oPBminus := XbpPushButton():new( ::drawingArea, ,{nPx+272,204+nPy}, {32,32} )
::oPBminus:activate := {|| postAppEvent(xbeP_Keyboard,asc('-'),,::oKeyTrap) }
::oPBminus:caption := PB_MINUS //
::oPBminus:clipSiblings := .T.
::oPBminus:group := XBP_NO_GROUP
::oPBminus:tabStop := .T.
*** Create()
::oPBmultiply := XbpPushButton():new( ::drawingArea, ,{nPx+237,204+nPy}, {32,32} )
::oPBmultiply:activate := {|| postAppEvent(xbeP_Keyboard,asc('*'),,::oKeyTrap) }
::oPBmultiply:caption := PB_MULTIPLY //
::oPBmultiply:clipSiblings:= .T.
::oPBmultiply:group := XBP_NO_GROUP
::oPBmultiply:tabStop := .T.
*** Create()
::oPBdivide := XbpPushButton():new( ::drawingArea, ,{nPx+202,204+nPy}, {32,32} )
::oPBdivide:activate := {|| postAppEvent(xbeP_Keyboard,asc('/'),,::oKeyTrap) }
::oPBdivide:caption := PB_DIVIDE //
::oPBdivide:clipSiblings:= .T.
::oPBdivide:group := XBP_NO_GROUP
::oPBdivide:tabStop := .T.
*** Create()
::oPBequals := XbpPushButton():new( ::drawingArea, ,{nPx+272, 64+nPy}, {32,67} )
::oPBequals:activate := {|| postAppEvent(xbeP_Keyboard,asc('='),,::oKeyTrap) }
::oPBequals:caption := PB_EQUALS_ENA //
::oPBequals:clipSiblings:= .T.
::oPBequals:tabStop := .T.
*** Create()
****** Push Buttons CLEAR
*
::oPBCA := XbpPushButton():new( ::drawingArea, ,{nPx+ 19,134+nPy}, {32,32} )
::oPBCA:activate := {|| postAppEvent(xbeP_Keyboard,asc('C'),,::oKeyTrap) }
::oPBCA:caption := PB_CLEAR_ACCUM //"CA"
::oPBCA:clipSiblings := .T.
::oPBCA:group := XBP_NO_GROUP
::oPBCA:tabStop := .T.
*** Create()
::oPBCE := XbpPushButton():new( ::drawingArea, ,{nPx+ 19, 99+nPy}, {32,32} )
::oPBCE:activate := {|| postAppEvent(xbeP_Keyboard,asc('E'),,::oKeyTrap) }
::oPBCE:caption := PB_CLEAR_ENTRY //"CE"
::oPBCE:clipSiblings := .T.
::oPBCE:group := XBP_NO_GROUP
::oPBCE:tabStop := .T.
*** Create()
::oPBFactoral := XbpPushButton():new( ::drawingArea, ,{nPx+ 54, 64+nPy}, {32,32} )
::oPBFactoral:activate := {|| postAppEvent(xbeP_Keyboard,asc('!'),,::oKeyTrap) }
::oPBFactoral:caption := PB_N_FACTORIAL // [n!] Factoral Max: 22!
::oPBFactoral:clipSiblings:= .T.
::oPBFactoral:group := XBP_NO_GROUP
::oPBFactoral:tabStop := .T.
*** Create()
******* Push Buttons Currency EXCHANGE
*
::oPBForeignTo:= XbpPushButton():new( ::drawingArea, ,{nPx+124, 64+nPy}, {32,32} )
::oPBForeignTo:activate := {|| postAppEvent(xbeP_Keyboard,asc('F'),,::oKeyTrap) }
::oPBForeignTo:caption := PB_EUR_TO_PND // "E>ú" PB_DLR_TO_PND = $|ú PB_EUR_TO_DLR = E|$
::oPBForeignTo:clipSiblings:= .T.
::oPBForeignTo:group := XBP_NO_GROUP
::oPBForeignTo:tabStop := .T.
*** Create()
::oPBLocalTo := XbpPushButton():new( ::drawingArea, ,{nPx+ 89, 64+nPy}, {32,32} )
::oPBLocalTo:activate := {|| postAppEvent(xbeP_Keyboard,asc('L'),,::oKeyTrap) }
::oPBLocalTo:caption := PB_PND_TO_EUR //"ú>E" PB_PND_TO_DLR = ú|$ PB_DLR_TO_EUR = $|E
::oPBLocalTo:clipSiblings:= .T.
::oPBLocalTo:group := XBP_NO_GROUP
::oPBLocalTo:tabStop := .T.
*** Create()
******* Push Buttons MANIPULATION
*
::oPBnegate := XbpPushButton():new( ::drawingArea, ,{nPx+167, 64+nPy}, {32,32} )
::oPBnegate:activate := {|| postAppEvent(xbeP_Keyboard,asc('N'),,::oKeyTrap) }
::oPBnegate:caption := PB_NEGATE //"+/-"
::oPBnegate:clipSiblings:= .T.
::oPBnegate:group := XBP_NO_GROUP
::oPBnegate:tabStop := .T.
*** Create()
::oPBpercent := XbpPushButton():new( ::drawingArea, ,{nPx+124,134+nPy}, {32,32} )
::oPBpercent:activate := {|| postAppEvent(xbeP_Keyboard,asc('%'),,::oKeyTrap) }
::oPBpercent:caption := PB_PERCENT //"%"
::oPBpercent:clipSiblings:= .T.
::oPBpercent:tabStop := .T.
*** Create()
::oPBrecip := XbpPushButton():new( ::drawingArea, ,{nPx+124, 99+nPy}, {32,32} )
::oPBrecip:activate := {|| postAppEvent(xbeP_Keyboard,asc('I'),,::oKeyTrap) }
::oPBrecip:caption := PB_RECIPROCAL //"1/x"
::oPBrecip:clipSiblings := .T.
::oPBrecip:group := XBP_NO_GROUP
::oPBrecip:tabStop := .T.
*** Create()
::oPBnthRoot := XbpPushButton():new( ::drawingArea, ,{nPx+ 89,134+nPy}, {32,32} )
::oPBnthRoot:activate := {|| postAppEvent(xbeP_Keyboard,asc('#'),,::oKeyTrap) }
::oPBnthRoot:caption := PB_NTH_ROOT //Nth Root
::oPBnthRoot:clipSiblings:= .T.
::oPBnthRoot:group := XBP_NO_GROUP
::oPBnthRoot:tabStop := .T.
*** Create()
::oPBnthPwr := XbpPushButton():new( ::drawingArea, ,{nPx+ 54,134+nPy}, {32,32} )
::oPBnthPwr:activate := {|| postAppEvent(xbeP_Keyboard,asc('^'),,::oKeyTrap) }
::oPBnthPwr:caption := PB_NTH_POWER //Nth Power
::oPBnthPwr:clipSiblings:= .T.
::oPBnthPwr:group := XBP_NO_GROUP
::oPBnthPwr:tabStop := .T.
*** Create()
::oPBsqroot := XbpPushButton():new( ::drawingArea, ,{nPx+ 89, 99+nPy}, {32,32} )
::oPBsqroot:activate := {|| postAppEvent(xbeP_Keyboard,asc('R'),,::oKeyTrap) }
::oPBsqroot:caption := PB_SQR_ROOT //SqRoot
::oPBsqroot:clipSiblings:= .T.
::oPBsqroot:group := XBP_NO_GROUP
::oPBsqroot:tabStop := .T.
*** Create()
::oPBsquare := XbpPushButton():new( ::drawingArea, ,{nPx+ 54, 99+nPy}, {32,32} )
::oPBsquare:activate := {|| postAppEvent(xbeP_Keyboard,asc('S'),,::oKeyTrap) }
::oPBsquare:caption := PB_SQUARED //Squared
::oPBsquare:clipSiblings:= .T.
::oPBsquare:group := XBP_NO_GROUP
::oPBsquare:tabStop := .T.
*** Create()
::oPBPi := XbpPushButton():new( ::drawingArea, ,{nPx+ 19, 64+nPy}, {32,32} )
::oPBPi:activate := {|| postAppEvent(xbeP_Keyboard,asc('K'),,::oKeyTrap) }
::oPBPi:caption := PB_PI //"Pi"
::oPBPi:clipSiblings := .T.
::oPBPi:group := XBP_NO_GROUP
::oPBPi:tabStop := .T.
*** Create()
::oPBbspace := XbpPushButton():new( ::drawingArea, ,{nPx+167,204+nPy}, {32,32} )
::oPBbspace:activate := {|| postAppEvent(xbeP_Keyboard,8,,::oKeyTrap) }
::oPBbspace:caption := PB_BSPACE_ENA //"BSpace"
::oPBbspace:clipSiblings:= .T.
::oPBbspace:group := XBP_NO_GROUP
::oPBbspace:tabStop := .T.
*** Create()
********* END OF STANDARD PUSH BUTTONS *********
******************************************************
::oSetDecMsg:= XbpStatic():new( ::drawingArea, ,{nPx+ 19, 48+nPy}, {286, 14}, { ;
{ XBP_PP_BGCLR, GRA_CLR_DARKBLUE }, ;
{ XBP_PP_FGCLR, GRA_CLR_DARKGRAY }, ;
{ XBP_PP_COMPOUNDNAME, "8.Arial"} } )
::oSetDecMsg:caption := "Press SpaceBar to minimize"
::oSetDecMsg:clipSiblings := .F.
::oSetDecMsg:options := XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_CENTER
*** Create()
::oPBsetRate := XbpPushButton():new( ::drawingArea, ,{nPx+19, 28+nPy}, {64,16} )
::oPBsetRate:activate := {|| postAppEvent(xbeP_Keyboard,asc('X'),,::oKeyTrap) }
::oPBsetRate:caption := PB_SET_RATE //Set Exchange Rate(s)
::oPBsetRate:clipSiblings:= .T.
::oPBsetRate:tabStop := .T.
*** Create()
::oPBpaste := XbpPushButton():new( ::drawingArea, ,{nPx+93, 7+nPy}, {64,16} )
::oPBpaste:activate := {|| postAppEvent(xbeP_Keyboard,xbeK_CTRL_V,,::oKeyTrap) }
::oPBpaste:caption := PB_PASTE //Paste
::oPBpaste:clipSiblings := .F.
::oPBpaste:tabStop := .T.
*** Create()
::oPBcopy := XbpPushButton():new( ::drawingArea, ,{nPx+166, 7+nPy}, {64,16} )
::oPBcopy:activate := {|| postAppEvent(xbeP_Keyboard,xbeK_CTRL_C,,::oKeyTrap) }
::oPBcopy:caption := PB_COPY //Copy
::oPBcopy:clipSiblings := .F.
::oPBcopy:tabStop := .T.
*** Create()
::oPBsetDec := XbpPushButton():new( ::drawingArea, ,{nPx+240, 28+nPy}, {64,16} )
::oPBsetDec:activate := {|| postAppEvent(xbeP_Keyboard,asc('D'),,::oKeyTrap) }
::oPBsetDec:caption := PB_SET_DEC //Set Decimals
::oPBsetDec:clipSiblings:= .T.
::oPBsetDec:tabStop := .T.
*** Create()
****** Information Line
*
::oXchgRate:= XbpStatic():new( ::drawingArea, ,{nPx+ 20, 11+nPy}, {60,12}, { ;
{ XBP_PP_BGCLR, GRA_CLR_PALEGRAY }, ;
{ XBP_PP_FGCLR, GRA_CLR_BLACK }, ;
{ XBP_PP_COMPOUNDNAME, "8.Arial"} } )
::oXchgRate:caption := "0.787645"
::oXchgRate:clipSiblings:= .T.
::oXchgRate:options:= XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_RIGHT
*** Create()
::oPBPtoE := XbpPushButton():new( ::drawingArea, ,{nPx+106, 28+nPy}, {32,16} )
::oPBPtoE:activate := {|| postAppEvent(xbeP_Keyboard,asc('P'),,::oKeyTrap) }
::oPBPtoE:caption := PB_PND_EUR //Pound to Euro
::oPBPtoE:clipSiblings := .T.
::oPBPtoE:tabStop := .T.
*** Create()
::oPBDtoE := XbpPushButton():new( ::drawingArea, ,{nPx+144, 28+nPy}, {32,16} )
::oPBDtoE:activate := {|| postAppEvent(xbeP_Keyboard,asc('B'),,::oKeyTrap) }
::oPBDtoE:caption := PB_DLR_PND //Dollar to Pound
::oPBDtoE:clipSiblings := .T.
::oPBDtoE:tabStop := .T.
*** Create()
::oPBDtoP := XbpPushButton():new( ::drawingArea, ,{nPx+182, 28+nPy}, {32,16} )
::oPBDtoP:activate := {|| postAppEvent(xbeP_Keyboard,asc('U'),,::oKeyTrap) }
::oPBDtoP:caption := PB_DLR_EUR //Dollar to Euro
::oPBDtoP:clipSiblings := .T.
::oPBDtoP:tabStop := .T.
*** Create()
::oDecSet2:= XbpStatic():new( ::drawingArea, ,{nPx+241, 10+nPy}, { 60, 12}, { ;
{ XBP_PP_BGCLR, GRA_CLR_PALEGRAY }, ;
{ XBP_PP_FGCLR, GRA_CLR_BLACK }, ;
{ XBP_PP_COMPOUNDNAME, "8.Arial" } } )
::oDecSet2:caption := "4 Places"
::oDecSet2:clipSiblings := .T.
::oDecSet2:options := XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_RIGHT
*** Create()
::oOpenUp := XbpPushButton():new( ::drawingArea, ,{0,0}, {104,16} )
::oOpenUp:activate := {|| postAppEvent(xbeP_Keyboard,524320,,::oKeyTrap) }
::oOpenUp:caption := PB_OPEN_UP // OPENUP
::oOpenUp:visible := .F. // HIDDEN
::oOpenUp:clipSiblings := .F.
::oOpenUp:group := XBP_NO_GROUP
*** Create()
::oPBExit := XbpPushButton():new( ::drawingArea, ,{105,1}, {16,14} )
::oPBExit:activate := {|| PostAppEvent( xbeP_Close,,, self ) }
::oPBExit:caption := PB_CLOSE // "Close App"
::oPBExit:clipSiblings:= .T.
::oPBExit:visible := .F. // HIDDEN
::oPBExit:group := XBP_NO_GROUP
::oPBExit:tabStop := .F.
*** Create()
RETURN self
* END METHOD _BUSCALC:init()
******************************************************************************
******************************************************************************
* METHOD _BUSCALC:create()
******************************************************************************
*
METHOD _BUSCALC:create(oParent, oOwner, aPos, aSize, aPP, lVisible)
::XbpDialog:create(oParent, oOwner, aPos, aSize, aPP, lVisible)
::oMask:Create()
::oKeyTrap:Create()
::oClipBoard := XbpClipBoard():new():create()
********************* Trail Display Line
::oValInput:Create()
::oOperText:Create()
::oValInter:Create()
::oValAccum:Create()
********************* Master Display Line
::oDisplay:Create()
::oSymbol:Create()
********************* Brackets Active
::oBrackets:Create()
********************* Memory Store
::oMemStore:Create()
********************* START STANDARD PUSH BUTTONS
::oPBInfo:Create() // [i]
::oPBspace:Create() // [-] == Spacebar
::oPBClose:Create() // [x]
********************* Help Button
::oPBHelp:Create()
********************* Push Buttons MEMORY
::oPBMC:Create()
::oPBmemsub:Create()
::oPBRecall:Create()
::oPBmemadd:Create()
********************* Push Buttons NUMERIC
::oPB_0:Create()
::oPB_1:Create()
::oPB_2:Create()
::oPB_3:Create()
::oPB_4:Create()
::oPB_5:Create()
::oPB_6:Create()
::oPB_7:Create()
::oPB_8:Create()
::oPB_9:Create()
::oPBpoint:Create()
********************* Push Buttons OPERATORS
::oPBPlus:Create()
::oPBLbracket:Create()
::oPBRbracket:Create()
::oPBminus:Create()
::oPBmultiply:Create()
::oPBdivide:Create()
::oPBequals:Create()
********************* Push Buttons CLEAR
::oPBCA:Create()
::oPBCE:Create()
::oPBFactoral:Create()
********************* Push Buttons Currency EXCHANGE
::oPBForeignTo:Create()
::oPBLocalTo:Create()
********************* Push Buttons MANIPULATION
::oPBnegate:Create()
::oPBpercent:Create()
::oPBrecip:Create()
::oPBnthRoot:Create()
::oPBnthPwr:Create()
::oPBsqroot:Create()
::oPBsquare:Create()
::oPBPi:Create()
::oPBbspace:Create()
********************* END OF STANDARD PUSH BUTTONS
********************* Bottom Segment
::oSetDecMsg:Create()
::oPBsetRate:Create()
::oPBpaste:Create()
::oPBcopy:Create()
::oPBsetDec:Create()
********************* Information Line
::oXchgRate:Create()
::oPBPtoE:Create()
::oPBDtoE:Create()
::oPBDtoP:Create()
::oDecSet2:Create()
::oOpenUp:Create() // On minimised decal
::oPBExit:Create() // On minimsed decal
RETURN self
* END METHOD _BUSCALC:create()
******************************************************************************
******************************************************************************
* METHOD _BUSCALC:destroy()
******************************************************************************
*
METHOD _BUSCALC:destroy()
::aCalcSize := nil
::aDataStore := nil
::aPos := nil
::aPreBracket := nil
::aSize := nil
::cClipText := nil
::cDisplay := nil
::cXRate := nil
::lBS_Enabled := nil
::lGettingDecsInput := nil
::lHaveDecimal := nil
::lKeysEnabled := nil
::lKillKeys := nil
::lLBracketOpen := nil
::lLastOpWasImmediate := nil
::lNewCalculation := nil
::lNewInput := nil
::lPercent := nil
::lRBracketClosed := nil
::nAccumStore := nil
::nAccumulator := nil
::nAction := nil
::nBMP := nil
::nConvertRate := nil
::nDE := nil
::nDP := nil
::nDecs := nil
::nDisplay := nil
::nImmediateValue := nil
::nIntermediate := nil
::nMemVal := nil
::nOpCount := nil
::nOperation := nil
::nPE := nil
::nStoredOpNbr := nil
::nStoredValue := nil
::nSymbol := nil
::nValueStore := nil
::oBrackets := nil
::oClipBoard := nil
::oDecSet2 := nil
::oDisplay := nil
::oKeyTrap := nil
::oMask := nil
::oMemStore := nil
::oOpenUp := nil
::oOperText := nil
::oPBCA := nil
::oPBCE := nil
::oPBClose := nil
::oPBDtoE := nil
::oPBDtoP := nil
::oPBExit := nil
::oPBFactoral := nil
::oPBForeignTo := nil
::oPBHelp := nil
::oPBInfo := nil
::oPBLbracket := nil
::oPBLocalTo := nil
::oPBMC := nil
::oPBPi := nil
::oPBPlus := nil
::oPBPtoE := nil
::oPBRbracket := nil
::oPBRecall := nil
::oPB_0 := nil
::oPB_1 := nil
::oPB_2 := nil
::oPB_3 := nil
::oPB_4 := nil
::oPB_5 := nil
::oPB_6 := nil
::oPB_7 := nil
::oPB_8 := nil
::oPB_9 := nil
::oPBbspace := nil
::oPBcopy := nil
::oPBdivide := nil
::oPBequals := nil
::oPBmemadd := nil
::oPBmemsub := nil
::oPBminus := nil
::oPBmultiply := nil
::oPBnegate := nil
::oPBnthPwr := nil
::oPBnthRoot := nil
::oPBpaste := nil
::oPBpercent := nil
::oPBpoint := nil
::oPBrecip := nil
::oPBsetDec := nil
::oPBsetRate := nil
::oPBspace := nil
::oPBsqroot := nil
::oPBsquare := nil
::oSetDecMsg := nil
::oSymbol := nil
::oValAccum := nil
::oValInput := nil
::oValInter := nil
::oXchgRate := nil
::XbpDialog:destroy()
RETURN nil
#endif // define _BUSCALC_
*
* END METHOD _BUSCALC:destroy()
******************************************************************************
******************************************************************************
* CLASS BusiCalc
*
* Derived from the implementation-level class.
* Instance variables in _BUSCALC class.
******************************************************************************
CLASS BusiCalc FROM _BUSCALC
EXPORTED:
METHOD init
METHOD create
METHOD destroy
ENDCLASS
* END CLASS BusiCalc
******************************************************************************
******************************************************************************
* Initialize BusiCalc:init()
******************************************************************************
METHOD BusiCalc:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
* Execute method of the super class
::_BUSCALC:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
RETURN self
* END BusiCalc:init()
******************************************************************************
******************************************************************************
* Request Resources BusiCalc:create()
******************************************************************************
METHOD BusiCalc:create( oParent, oOwner, aPos, aSize, aPP, lVisible )
* Execute method of the super class
::_BUSCALC:create( oParent, oOwner, aPos, aSize, aPP, lVisible )
RETURN self
* END BusiCalc:create()
******************************************************************************
******************************************************************************
* Release Resources BusiCalc:destroy()
******************************************************************************
METHOD BusiCalc:destroy()
* Execute method of the super class
::_BUSCALC:destroy()
RETURN nil
* END BusiCalc:destroy()
******************************************************************************
*
* END BUSCALCCLS.PRG
******************************************************************************