Power BASIC


El Turbo Basic fue creado originalmente por Robert "Bob" Zale (1945-2012) y fue comprado por Borland. Cuando Borland decidió dejar de darle soporte (1989), Zale lo volvió a comprar a Borland, le cambió el nombre a PowerBASIC y creo PowerBASIC Inc. para continuar con el desarrollo del mismo.






PowerBASIC pasó a desarrollar compiladores Basic para Windows, primero PBWIN - su producto estrella -.

El 6 de noviembre de 2012, Robert Zale, el creador de PowerBASIC, murió. Durante un tiempo, se supuso que la compañía podría cesar sus operaciones. Su esposa, la señora Vivian Zale, publicaba el 8 de marzo de 2014 en los foros de PowerBASIC un comunicado diciendo que la compañía continuaría en funcionamiento.  El 10 de mayo de 2015, la Sra Zale anunció que el trabajo continuaba en las nuevas versiones de los compiladores PowerBASIC.

El 1 de noviembre de 2016, Vivian Zale ha anunciado su intención de comenzar la búsqueda de un comprador para la empresa.

El paquete completo consta de PowerBASIC para DOS (PBDos), PowerBASIC Compilador Consolsa (PBCC), PowerBASIC Compilador para Windows (PBWin), Formularios PowerBASIC (PBForms). La ultima versión es la 10.4. Con fecha 1 de Noviembre de 2016 se liberaron las versiones (PBWin 9.07),  (PBForms 1.0) y (PBCC 5.07).

El problema de PowerBASIC es el precio de todo el paquete de desarrollo que está en 210.- dolares sin contar todas la herramientas que hay disponibles a la venta de desarrolladores independientes. (acceso Internet, red, forms, printer...).

Yo siempre me considere un buen programador de Turbo Basic, pero al retomar PowerBASIC nuevamente, me he dado cuenta, que su curva de aprendizaje es realmente muy, muy empinada.

Por contra tiene una comunidad de usuarios inmensa, muchos foros, muy buenos manuales, y muchas herramientas adicionales de terceros.







'====================================================================
'
'  Text3D.bas for PowerBASIC Compiler for Windows
'  Copyright (c) 2005 - 2008 PowerBASIC, Inc.
'  All Rights Reserved.
'
'  Print 3D text in a Graphic control.
'
'====================================================================
#COMPILER PBWIN 9
#COMPILE EXE
'--------------------------------------------------------------------
%IDC_GRAPHIC1  = 111
%IDC_FRAME1    = 121
%IDC_SUNKEN    = 131
%IDC_RAISED    = 132
%IDC_NORMAL    = 133
'--------------------------------------------------------------------
GLOBAL hFont AS LONG

'********************************************************************
FUNCTION PBMAIN () AS LONG
'--------------------------------------------------------------------
' Program entrance
'--------------------------------------------------------------------
  LOCAL hDlg AS DWORD, w, h AS LONG

  FONT NEW "Times New Roman", 48, 1 TO hFont

  DIALOG NEW 0, "Texto en 3D",,, 240, 132, _
                %WS_CAPTION OR %WS_SYSMENU, 0 TO hDlg

  '------------------------------------------------------------------
  CONTROL ADD GRAPHIC, hDlg, %IDC_GRAPHIC1,"", 0, 0, 240, 80
  GRAPHIC ATTACH hDlg, %IDC_GRAPHIC1

  '------------------------------------------------------------------
  ' Setup pixel based coordinate system in the Graphic control
  '------------------------------------------------------------------
  CONTROL GET CLIENT hDlg, %IDC_GRAPHIC1 TO w, h  'get client size
  DIALOG UNITS hDlg, w, h TO PIXELS w, h        'convert to pixels
  GRAPHIC SCALE (0, 0) - (w, h)  'scale to pixel coordinate system

  '------------------------------------------------------------------
  CONTROL ADD FRAME, hDlg, %IDC_FRAME1,  "&Apariencia",  5,  82,  60, 46
  CONTROL SET COLOR hDlg, %IDC_FRAME1, %BLUE, -1&

  CONTROL ADD OPTION, hDlg, %IDC_SUNKEN, "&Hundido", 10,  94,  50, 10
  CONTROL ADD OPTION, hDlg, %IDC_RAISED, "&Elevado", 10, 104,  50, 10
  CONTROL ADD OPTION, hDlg, %IDC_NORMAL, "&Normal", 10, 114,  50, 10

  CONTROL SET OPTION hDlg, %IDC_SUNKEN, %IDC_SUNKEN, %IDC_NORMAL
  PrintText3D hDlg, %IDC_GRAPHIC1, "Power Basic", %IDC_SUNKEN, hFont

  '------------------------------------------------------------------
  CONTROL ADD BUTTON, hDlg, %IDCANCEL, "&Salir", 186, 114, 50, 14

  '------------------------------------------------------------------
  DIALOG SHOW MODAL hDlg CALL DlgProc

END FUNCTION


'********************************************************************
CALLBACK FUNCTION DlgProc() AS LONG
'--------------------------------------------------------------------
' Main dialog callback procedure
'--------------------------------------------------------------------

  STATIC hFont AS LONG

  SELECT CASE CB.MSG


  CASE %WM_COMMAND
      SELECT CASE CB.CTL
      CASE %IDC_SUNKEN TO %IDC_NORMAL
          IF CB.CTLMSG = %BN_CLICKED THEN
              PrintText3D CB.HNDL, %IDC_GRAPHIC1, "Power Basic", CB.CTL, hFont
          END IF

      CASE %IDCANCEL
          IF CB.CTLMSG = %BN_CLICKED THEN
              DIALOG END CB.HNDL
          END IF

      END SELECT

  END SELECT

END FUNCTION


'********************************************************************
SUB PrintText3D (BYVAL hDlg AS DWORD, BYVAL ID AS LONG, _
                 BYVAL sText AS STRING, BYVAL Appearence AS LONG, BYVAL hFont AS LONG)
'--------------------------------------------------------------------
' Print text with 3D looks
'--------------------------------------------------------------------
  LOCAL x, y, w, h, w1, h1 AS LONG

  '------------------------------------------
  ' Set up Font and clear the control
  '------------------------------------------
  GRAPHIC ATTACH hDlg, ID
  GRAPHIC CLEAR %LTGRAY
  GRAPHIC SET FONT hFont

  '------------------------------------------
  ' Calculate centered position
  '------------------------------------------
  GRAPHIC GET CLIENT TO w, h
  GRAPHIC TEXT SIZE sText TO w1, h1
  x = (w-w1)/2
  y = (h-h1)/2

  '------------------------------------------
  ' Print the text, here using red text color
  '------------------------------------------
  SELECT CASE Appearence
  CASE %IDC_RAISED
      GRAPHIC COLOR RGB(255, 255, 255), -2
      GRAPHIC SET POS (x-1, y-1)
      GRAPHIC PRINT sText

      GRAPHIC COLOR RGB(128, 0, 0), -2
      GRAPHIC SET POS (x+1, y+1)
      GRAPHIC PRINT sText

      GRAPHIC COLOR RGB(255, 0, 0), -2
      GRAPHIC SET POS (x, y)
      GRAPHIC PRINT sText

  CASE %IDC_SUNKEN
      GRAPHIC COLOR RGB(128, 0, 0), -2
      GRAPHIC SET POS (x-1, y-1)
      GRAPHIC PRINT sText

      GRAPHIC COLOR RGB(255, 255, 255), -2
      GRAPHIC SET POS (x+1, y+1)
      GRAPHIC PRINT sText

      GRAPHIC COLOR RGB(255, 0, 0), -2
      GRAPHIC SET POS (x, y)
      GRAPHIC PRINT sText

  CASE %IDC_NORMAL
      GRAPHIC COLOR RGB(255, 0, 0), -2
      GRAPHIC SET POS (x, y)
      GRAPHIC PRINT sText

  END SELECT

END SUB







'====================================================================
'
'  PWRCLOCK.BAS for PowerBASIC Compiler for Windows
'  Copyright (c) 2005 - 2008 PowerBASIC, Inc.
'  All Rights Reserved.
'
'  Example showing how to use the GRAPHIC control and commands
'  to draw an analog clock. It also shows how to create and use
'  a timer to trigger drawing operations in regular intervals.
'
'====================================================================

#COMPILER PBWIN 9
#COMPILE EXE
#DIM ALL

%USEMACROS = 1
#INCLUDE "WIN32API.INC"

%ID_TIMER1    = 100
%IDC_GRAPHIC1 = 120


'====================================================================
FUNCTION PBMAIN
'--------------------------------------------------------------------
  ' PROGRAM ENTRANCE
  ' The Graphic control is scaled Pixels to enable pixel-based
  ' calculations for drawing operations. Exstyle& %WS_EX_TOPMOST
  ' is set to make it float above all other programs, and style&
  ' %WS_MINIMIZEBOX is set to show the minimize button.
  '------------------------------------------------------------------
  LOCAL h, w  AS LONG
  LOCAL hDlg  AS DWORD
  LOCAL hFont AS LONG

  DIALOG NEW 0, "PowerClock",,, 120, 100, _
                %WS_CAPTION OR %WS_MINIMIZEBOX OR %WS_SYSMENU, _
                %WS_EX_TOPMOST TO hDlg

  CONTROL ADD GRAPHIC, hDlg, %IDC_GRAPHIC1,"", 0, 0, 120, 100

  '------------------------------------------------------------------
  ' Setup font and colors for Graphic control
  '------------------------------------------------------------------
  GRAPHIC ATTACH hDlg, %IDC_GRAPHIC1
  GRAPHIC COLOR RGB(191,191,191), RGB(255, 255, 255)
  FONT NEW "Times New Roman", 10, 3 TO hFont
  GRAPHIC SET FONT hFont

  '------------------------------------------------------------------
  ' Setup pixel based coordinate system in the Graphic control
  '------------------------------------------------------------------
  CONTROL GET CLIENT hDlg, %IDC_GRAPHIC1 TO w, h  'get client size
  DIALOG UNITS hDlg, w, h TO PIXELS w, h        'convert to pixels
  GRAPHIC SCALE (0, 0) - (w, h)  'scale to pixel coordinate system


  DIALOG SHOW MODAL hDlg CALL DlgCallback
  FONT END hFont

END FUNCTION


'====================================================================
CALLBACK FUNCTION DlgCallback()
'--------------------------------------------------------------------
  ' MAIN DIALOG'S CALLBACK PROCEDURE
  ' A 500 ms (0.5 sec.) timer is created under %WM_INITDIALOG
  ' and it will trigger a %WM_TIMER message every 0.5 second,
  ' which in turn calls SUB DrawClock, where all drawing is done.
  '------------------------------------------------------------------
   SELECT CASE AS LONG CB.MSG
   CASE %WM_INITDIALOG                             ' Sent right before the dialog is displayed.
       STATIC idEvent AS LONG                      ' Keep SetTimer's result in a static variable
       idEvent = SetTimer(CB.HNDL, %ID_TIMER1, _   ' Create WM_TIMER events with the SetTimer API
                         500, BYVAL %NULL)         ' at 500 ms (0.5 s) interval
       DrawClock CBHNDL, %IDC_GRAPHIC1, TIME$      ' Perform an initial draw operation

   CASE %WM_TIMER                                  ' Posted by the created timer
       IF CB.WPARAM = %ID_TIMER1 THEN              ' Make sure it's corrent timer id
           DrawClock CB.HNDL, %IDC_GRAPHIC1, TIME$ ' Call SUB DrawClock with current time
       END IF

   CASE %WM_DESTROY                                ' Sent when the dialog is being destroyed
       IF idEvent THEN                             ' If a timer identifier exists
           KillTimer CBHNDL, idEvent               ' make sure to stop the timer events
       END IF

   CASE %WM_COMMAND                                ' Sent from controls and menu items, etc.
       SELECT CASE AS LONG CB.CTL
       CASE %IDCANCEL                              ' Allow the Esc key to close the dialog
           IF CB.CTLMSG = %BN_CLICKED _            ' If Button Notification Clicked was sent
           OR CB.CTLMSG = 1 THEN                   ' or an accelerator key was pressed
               DIALOG END CB.HNDL, 0               ' Close the dialog
           END IF
       END SELECT

   END SELECT
END FUNCTION


'====================================================================
SUB DrawClock (BYVAL hDlg   AS LONG, _   ' Parent dialog's handle
               BYVAL CtrlId AS LONG, _   ' Graphic control's id
               BYVAL sTime  AS STRING)   ' Time in 24-hour format, hh:mm:ss
'--------------------------------------------------------------------
  ' Draw both analog and digital clock in the Graphic control,
  ' using the Graphic commands only. The procedure has been
  ' made generic in the sense that it can be used for multiple
  ' Graphic controls showing different times, if so desired.
  '------------------------------------------------------------------
  LOCAL Angle, x, y, CenterX, CenterY, Radius, hour, minute, second AS LONG
  LOCAL dAngle AS DOUBLE, Pi AS EXT

  '------------------------------------------------------------------
  ' Select the Graphic control and set it up for faster, buffered draw
  '------------------------------------------------------------------
  GRAPHIC ATTACH hDlg, CtrlId, REDRAW

  '------------------------------------------------------------------
  ' Draw digital time
  '------------------------------------------------------------------
  GRAPHIC CLEAR RGB(255, 255, 255)                         ' Clear the whole clock-face
  GRAPHIC SET POS (5, 2)                                   ' Set position for Print
  GRAPHIC PRINT sTime                                      ' Print given TIME$

  '------------------------------------------------------------------
  ' Extract hours, minutes and seconds into numerical variables
  '------------------------------------------------------------------
  hour   = VAL(LEFT$(sTime, 2))
  minute = VAL(MID$(sTime, 4, 2))
  second = VAL(RIGHT$(sTime, 2))

  '------------------------------------------------------------------
  ' Calculate center points, Radius and Pi
  '------------------------------------------------------------------
  CONTROL GET CLIENT hDlg, CtrlId TO x, y                  ' get control's width and height
  DIALOG UNITS hDlg, x, y TO PIXELS x, y                   ' convert to pixels
  CenterX = x / 2                                          ' calculate center x
  CenterY = y / 2                                          ' calculate center y
  Radius  = MIN&(CenterX, CenterY) - 10                    ' calculate clock face radius
  Pi      = 4 * ATN(1)                                     ' pre-calculate Pi

  '------------------------------------------------------------------
  ' Draw clock-face
  '------------------------------------------------------------------
  GRAPHIC WIDTH 2                                          ' Set pen width for GRAPHIC CIRCLE
  FOR Angle = 0 TO 354 STEP 6                              ' Draw markers for minutes and hours
      x = CenterX + Radius * COS(Angle * Pi / 180)         ' Calculate x point
      y = CenterY + Radius * SIN(Angle * Pi / 180)         ' Calculate y point
      IF Angle MOD 30 = 0 THEN                             ' On every 30th degree
          GRAPHIC BOX (x, y)-(x+2, y+2), 0, RGB(0,127,127) ' Draw thicker hour point
      ELSE
          GRAPHIC SET PIXEL (x, y), RGB(0,0,0)             ' Else plot minute points
      END IF
  NEXT

  '------------------------------------------------------------------
  ' Draw hour hand
  ' Note: convert from 24 to 12-hour format with (hour MOD 12)
  '------------------------------------------------------------------
  dAngle = (hour MOD 12) * (360\12) - 90                   ' Calculate angle. Each marker = 12 minutes.
  dAngle = dAngle + 30 * minute \ 60                       ' Add minutes part. Each hour = 5 x 6 = 30 degrees.
  x = CenterX + (Radius - 26) * COS(dAngle * Pi / 180)     ' Calculate x (end point)
  y = CenterY + (Radius - 26) * SIN(dAngle * Pi / 180)     ' Calculate y (end point)
  GRAPHIC WIDTH 6                                          ' Set thick line for hour hand
  GRAPHIC LINE (CenterX, CenterY) - (x, y), RGB(0,127,127) ' Draw Hour hand

  '------------------------------------------------------------------
  ' Draw minute hand
  '------------------------------------------------------------------
  dAngle = minute * (360\60) - 90                          ' Calculate angle. Each marker = 1 minute.
  dAngle = dAngle + 6 * second \ 60                        ' Add seconds part. Each minute = 6 degrees.
  x = CenterX + (Radius - 14) * COS(dAngle * Pi / 180)     ' Calculate x (end point)
  y = CenterY + (Radius - 14) * SIN(dAngle * Pi / 180)     ' Calculate y (end point)
  GRAPHIC WIDTH 3                                          ' Set medium line for minute hand
  GRAPHIC LINE (CenterX, CenterY) - (x, y), RGB(0,159,159) ' Draw Minute hand

  '------------------------------------------------------------------
  ' Draw second hand
  '------------------------------------------------------------------
  dAngle = second * (360\60) - 90                         ' Calculate angle. Each marker = 1 second.
  x = CenterX + (Radius - 6) * COS(dAngle * Pi / 180)     ' Calculate x (end point)
  y = CenterY + (Radius - 6) * SIN(dAngle * Pi / 180)     ' Calculate y (end point)
  GRAPHIC WIDTH 1                                         ' Set thin line for second hand
  GRAPHIC LINE (CenterX, CenterY) - (x, y), RGB(0,0,0)    ' Draw Second hand

  '------------------------------------------------------------------
  ' Draw center part
  '------------------------------------------------------------------
  GRAPHIC WIDTH 2                                          ' 2 pixels wide
  GRAPHIC ELLIPSE (CenterX-3, CenterY-3) _
                 -(CenterX+3, CenterY+3), RGB(255,255,255) ' white circle
  GRAPHIC WIDTH 1                                          ' 1 pixels wide
  GRAPHIC ELLIPSE (CenterX-3.5, CenterY-3.5)_
                 -(CenterX+3.5, CenterY+3.5), RGB(0, 0, 0) ' black circle

  '------------------------------------------------------------------
  ' Perform a redraw to refresh the Graphic control
  '------------------------------------------------------------------
  GRAPHIC REDRAW

END SUB



http://powerbasic.com/

http://perfectsync.com/

http://cwsof.com/index2.html

http://www.jose.it-berater.org/index.html

http://www.planetsquires.com/




No hay comentarios:

Publicar un comentario

Nota: solo los miembros de este blog pueden publicar comentarios.