First commit 25/07/1999
This commit is contained in:
		
							
								
								
									
										150
									
								
								ActImg/Copia de actimg.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										150
									
								
								ActImg/Copia de actimg.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,150 @@
 | 
				
			|||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <vcl\vcl.h>
 | 
				
			||||||
 | 
					#pragma hdrstop
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "actimg.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pragma package(smart_init)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// ValidCtrCheck is used to assure that the components created do not have
 | 
				
			||||||
 | 
					// any pure virtual functions.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					static inline TActiveImage *ValidCtrCheck()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return new TActiveImage(NULL);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					__fastcall TActiveImage::TActiveImage(TComponent* Owner)
 | 
				
			||||||
 | 
					//            : TGraphicControl(Owner)
 | 
				
			||||||
 | 
					: TButton(Owner)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						mcaptured = false;
 | 
				
			||||||
 | 
					    FGlyph = new Graphics::TCanvas;
 | 
				
			||||||
 | 
					    FGlyph->Brush->Color = clNone;
 | 
				
			||||||
 | 
					    FGlyph->Brush->Style = bsClear;
 | 
				
			||||||
 | 
					    FGlyph->CopyMode = cmSrcCopy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    GlyphNormal = new Graphics::TPicture;
 | 
				
			||||||
 | 
					    GlyphOver   = new Graphics::TPicture;
 | 
				
			||||||
 | 
					    GlyphPress  = new Graphics::TPicture;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    vAutoSize = false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					namespace Actimg
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						void __fastcall PACKAGE Register()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TComponentClass classes[1] = {__classid(TActiveImage)};
 | 
				
			||||||
 | 
							RegisterComponents("JD Soft.", classes, 0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::CreateParams(TCreateParams &Params)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TButton::CreateParams(Params); // La clase ascendente se ocupar<61> de establecer los par<61>metros generales
 | 
				
			||||||
 | 
					//  Params.ExStyle = Params.ExStyle | WS_EX_TRANSPARENT;
 | 
				
			||||||
 | 
					  Params.Style = Params.Style | BS_OWNERDRAW;
 | 
				
			||||||
 | 
					  TButton::ControlStyle = TControlStyle();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::CNMeasureItem(TWMMeasureItem& Mensaje)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					   Mensaje.MeasureItemStruct->itemWidth = Width;
 | 
				
			||||||
 | 
					   Mensaje.MeasureItemStruct->itemHeight = Height;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Cada vez que haya que dibujar el control se llamar<61> a este m<>todo
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::CNDrawItem(TWMDrawItem& Mensaje)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					   Graphics::TBitmap *Bitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   Bitmap = GlyphNormal->Bitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   if (Mensaje.DrawItemStruct->itemState & ODS_SELECTED) // El bot<6F>n est<73> pulsado
 | 
				
			||||||
 | 
					     Bitmap = GlyphPress->Bitmap;
 | 
				
			||||||
 | 
					   else
 | 
				
			||||||
 | 
					   // Si el bot<6F>n est<73> desactivado
 | 
				
			||||||
 | 
					   if (! Enabled )
 | 
				
			||||||
 | 
					     Bitmap = GlyphPress->Bitmap;
 | 
				
			||||||
 | 
					   else
 | 
				
			||||||
 | 
					   if ( mcaptured )
 | 
				
			||||||
 | 
					     Bitmap = GlyphOver->Bitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   FGlyph->Handle = Mensaje.DrawItemStruct->hDC;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   FGlyph->BrushCopy( ClientRect, Bitmap, Rect( 0, 0, Bitmap->Width-1, Bitmap->Height-1 ), Bitmap->TransparentColor );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   // El Handle de FCanvas ser<65> el Hdc enviado en Mensaje.DrawItemStruct,
 | 
				
			||||||
 | 
					   // lo que nos permitir<69> dibujar en la superficie del bot<6F>n
 | 
				
			||||||
 | 
					   FGlyph->Handle = 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Al cambiar el estado del bot<6F>n
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::SetButtonStyle(bool ADefault)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Refresh(); // simplemente redibujar
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					__fastcall TActiveImage::~TActiveImage()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						delete FGlyph;
 | 
				
			||||||
 | 
						delete GlyphNormal;
 | 
				
			||||||
 | 
						delete GlyphOver;
 | 
				
			||||||
 | 
						delete GlyphPress;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::MouseMove( Classes::TShiftState Shift, int X, int Y )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if( ! mcaptured )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        SetCapture( Handle );
 | 
				
			||||||
 | 
							mcaptured = true;
 | 
				
			||||||
 | 
					        Refresh();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if( (X<0) || (Y<0) || (X>Width) || (Y>Height))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        ReleaseCapture();
 | 
				
			||||||
 | 
							mcaptured = false;
 | 
				
			||||||
 | 
					        Refresh();
 | 
				
			||||||
 | 
						}else{
 | 
				
			||||||
 | 
							TButton::MouseMove( Shift, X, Y );
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::Click( void )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						TButton::Click();
 | 
				
			||||||
 | 
						ReleaseCapture();
 | 
				
			||||||
 | 
						mcaptured = false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::SetGlyphOver( Graphics::TPicture *val )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  GlyphOver -> Assign( val );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::SetGlyphPress( Graphics::TPicture *val )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  GlyphPress -> Assign( val );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::SetGlyphNormal( Graphics::TPicture *val )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  GlyphNormal -> Assign( val );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::SetAutoSize( bool val )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 vAutoSize = val;
 | 
				
			||||||
 | 
					 // Facilitamos la anchura y altura del control
 | 
				
			||||||
 | 
					 if ( vAutoSize && ! GlyphNormal->Graphic->Empty )
 | 
				
			||||||
 | 
					 {
 | 
				
			||||||
 | 
					   Width = GlyphNormal->Width;
 | 
				
			||||||
 | 
					   Height = GlyphNormal->Height;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										58
									
								
								ActImg/Copia de actimg.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								ActImg/Copia de actimg.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,58 @@
 | 
				
			|||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#ifndef ActImgH
 | 
				
			||||||
 | 
					#define ActImgH
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <vcl\SysUtils.hpp>
 | 
				
			||||||
 | 
					#include <vcl\Controls.hpp>
 | 
				
			||||||
 | 
					#include <vcl\Classes.hpp>
 | 
				
			||||||
 | 
					#include <vcl\Forms.hpp>
 | 
				
			||||||
 | 
					#include <vcl\ExtCtrls.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					class PACKAGE TActiveImage : // public TGraphicControl
 | 
				
			||||||
 | 
					                     public TButton
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
						bool mcaptured;
 | 
				
			||||||
 | 
						void __fastcall MouseMove( Classes::TShiftState Shift, int X, int Y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    TCanvas * FGlyph; // Para dibujar
 | 
				
			||||||
 | 
					      // Mensaje de Windows solicitando el tama<6D>o del control
 | 
				
			||||||
 | 
					    void __fastcall CNMeasureItem(TWMMeasureItem& Mensaje);
 | 
				
			||||||
 | 
					      // Mensaje de Windows solicitando que el control sea dibujado
 | 
				
			||||||
 | 
					    void __fastcall CNDrawItem(TWMDrawItem& Mensaje);
 | 
				
			||||||
 | 
						BEGIN_MESSAGE_MAP
 | 
				
			||||||
 | 
						  MESSAGE_HANDLER(CN_MEASUREITEM, TWMMeasureItem, CNMeasureItem);
 | 
				
			||||||
 | 
						  MESSAGE_HANDLER(CN_DRAWITEM, TWMDrawItem, CNDrawItem);
 | 
				
			||||||
 | 
						END_MESSAGE_MAP(TButton);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					protected:
 | 
				
			||||||
 | 
					      // Par<61>metros para la creaci<63>n del control
 | 
				
			||||||
 | 
					    void __fastcall CreateParams(TCreateParams &Params);
 | 
				
			||||||
 | 
					      // Cambio del estado del bot<6F>n
 | 
				
			||||||
 | 
					    void __fastcall SetButtonStyle(bool ADefault);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void __fastcall SetGlyphOver( Graphics::TPicture *val );
 | 
				
			||||||
 | 
					    void __fastcall SetGlyphPress( Graphics::TPicture *val );
 | 
				
			||||||
 | 
					    void __fastcall SetGlyphNormal( Graphics::TPicture *val );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool vAutoSize;
 | 
				
			||||||
 | 
					    void __fastcall SetAutoSize( bool val );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void __fastcall Click( void );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
						Graphics::TPicture *GlyphOver,*GlyphNormal, *GlyphPress;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						__fastcall TActiveImage(TComponent* Owner);
 | 
				
			||||||
 | 
						__fastcall ~TActiveImage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__published:
 | 
				
			||||||
 | 
					    __property Graphics::TPicture *Picture_Normal={read=GlyphNormal, write=SetGlyphNormal};
 | 
				
			||||||
 | 
					    __property Graphics::TPicture *Picture_Over={read=GlyphOver, write=SetGlyphOver};
 | 
				
			||||||
 | 
					    __property Graphics::TPicture *Picture_Press={read=GlyphPress, write=SetGlyphPress};
 | 
				
			||||||
 | 
					    __property bool AutoSize={read=vAutoSize, write=SetAutoSize, default=false };
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										168
									
								
								ActImg/actimg.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										168
									
								
								ActImg/actimg.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,168 @@
 | 
				
			|||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <vcl\vcl.h>
 | 
				
			||||||
 | 
					#pragma hdrstop
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "actimg.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pragma package(smart_init)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// ValidCtrCheck is used to assure that the components created do not have
 | 
				
			||||||
 | 
					// any pure virtual functions.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					static inline TActiveImage *ValidCtrCheck()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return new TActiveImage(NULL);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#define FGlyph Canvas
 | 
				
			||||||
 | 
					__fastcall TActiveImage::TActiveImage(TComponent* Owner)
 | 
				
			||||||
 | 
					            : TCustomControl(Owner)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    CState = CSt_NORMAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Width = 50;
 | 
				
			||||||
 | 
					    Height = 50;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    FGlyph->Brush->Color = clNone;
 | 
				
			||||||
 | 
					    FGlyph->Brush->Style = bsClear;
 | 
				
			||||||
 | 
					    FGlyph->CopyMode = cmSrcCopy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    RCanvas = Canvas;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    GlyphNormal = new Graphics::TBitmap;
 | 
				
			||||||
 | 
					    GlyphOver   = new Graphics::TBitmap;
 | 
				
			||||||
 | 
					    GlyphPress  = new Graphics::TBitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    vAutoSize = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    MouseCaptured = false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					namespace Actimg
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						void __fastcall PACKAGE Register()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TComponentClass classes[1] = {__classid(TActiveImage)};
 | 
				
			||||||
 | 
							RegisterComponents("JD Soft.", classes, 0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::Paint()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					   Graphics::TBitmap *Bitmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   Brush->Color = clNone;
 | 
				
			||||||
 | 
					   Brush->Style = bsClear;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   switch ( CState )
 | 
				
			||||||
 | 
					   {
 | 
				
			||||||
 | 
					    case CSt_PRESS:
 | 
				
			||||||
 | 
					        Bitmap = GlyphPress;
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case CSt_OVER:
 | 
				
			||||||
 | 
					        Bitmap = GlyphOver;
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case CSt_NORMAL:
 | 
				
			||||||
 | 
					    default:
 | 
				
			||||||
 | 
					        Bitmap = GlyphNormal;
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   if ( ! Bitmap -> Empty )
 | 
				
			||||||
 | 
					       FGlyph->BrushCopy( ClientRect, Bitmap, Rect( 0, 0, Bitmap->Width-1, Bitmap->Height-1 ), Bitmap->TransparentColor );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					__fastcall TActiveImage::~TActiveImage()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						delete GlyphNormal;
 | 
				
			||||||
 | 
						delete GlyphOver;
 | 
				
			||||||
 | 
						delete GlyphPress;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::MouseMove( Classes::TShiftState Shift, int X, int Y )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
						if( CState != CSt_OVER && CState != CSt_PRESS )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if ( !MouseCaptured && SetCapture( Handle ) != NULL  ) MouseCaptured = true;
 | 
				
			||||||
 | 
					        CState = CSt_OVER;
 | 
				
			||||||
 | 
					        Refresh();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if( (X<0) || (Y<0) || (X>Width) || (Y>Height))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if ( ReleaseCapture() != 0 ) MouseCaptured = false;
 | 
				
			||||||
 | 
					        CState = CSt_NORMAL;
 | 
				
			||||||
 | 
					        Refresh();
 | 
				
			||||||
 | 
						}else{
 | 
				
			||||||
 | 
							TCustomControl::MouseMove( Shift, X, Y );
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::MouseDown( TMouseButton Button, Classes::TShiftState Shift, int X, int Y)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  CState = CSt_PRESS;
 | 
				
			||||||
 | 
					  Refresh();
 | 
				
			||||||
 | 
					//  if ( ReleaseCapture() != 0 ) MouseCaptured = false;
 | 
				
			||||||
 | 
					  TCustomControl::MouseDown( Button, Shift, X, Y );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::MouseUp( TMouseButton Button, Classes::TShiftState Shift, int X, int Y)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  CState = CSt_NORMAL;
 | 
				
			||||||
 | 
					//  if ( ReleaseCapture() != 0 ) { MouseCaptured = false;   Refresh(); }
 | 
				
			||||||
 | 
					  TCustomControl::MouseUp( Button, Shift, X, Y );
 | 
				
			||||||
 | 
					  MouseMove( Shift, X, Y );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::SetGlyphOver( Graphics::TBitmap *val )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  GlyphOver -> Assign( val );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::SetGlyphPress( Graphics::TBitmap *val )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  GlyphPress -> Assign( val );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::SetGlyphNormal( Graphics::TBitmap *val )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  GlyphNormal -> Assign( val );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::SetAutoSize( bool val )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 vAutoSize = val;
 | 
				
			||||||
 | 
					 // Facilitamos la anchura y altura del control
 | 
				
			||||||
 | 
					 if ( vAutoSize && ! GlyphNormal->Empty )
 | 
				
			||||||
 | 
					 {
 | 
				
			||||||
 | 
					   Width = GlyphNormal->Width;
 | 
				
			||||||
 | 
					   Height = GlyphNormal->Height;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::CreateParams(TCreateParams &Params)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TCustomControl::CreateParams(Params); // La clase ascendente se ocupar<61> de establecer los par<61>metros generales
 | 
				
			||||||
 | 
					  Params.ExStyle = Params.ExStyle | WS_EX_TRANSPARENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//  Params.Style = Params.Style | BS_OWNERDRAW;
 | 
				
			||||||
 | 
					//  TButton::ControlStyle = TControlStyle();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::CMMouseEnter    ( TMessage& Msg )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					        CState = CSt_OVER;
 | 
				
			||||||
 | 
					        Refresh();
 | 
				
			||||||
 | 
					  inherited::Dispatch ( &Msg );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void __fastcall TActiveImage::CMMouseLeave    ( TMessage& Msg )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					        CState = CSt_NORMAL;
 | 
				
			||||||
 | 
					        Refresh();
 | 
				
			||||||
 | 
					  inherited::Dispatch ( &Msg );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								ActImg/actimg.dcr
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								ActImg/actimg.dcr
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										72
									
								
								ActImg/actimg.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								ActImg/actimg.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,72 @@
 | 
				
			|||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#ifndef ActImgH
 | 
				
			||||||
 | 
					#define ActImgH
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <vcl\SysUtils.hpp>
 | 
				
			||||||
 | 
					#include <vcl\Controls.hpp>
 | 
				
			||||||
 | 
					#include <vcl\Classes.hpp>
 | 
				
			||||||
 | 
					#include <vcl\Forms.hpp>
 | 
				
			||||||
 | 
					#include <vcl\ExtCtrls.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					class PACKAGE TActiveImage : public TCustomControl
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					//	bool mcaptured;
 | 
				
			||||||
 | 
					    enum CStates { CSt_NORMAL, CSt_PRESS, CSt_OVER } CState;
 | 
				
			||||||
 | 
						void __fastcall MouseMove( Classes::TShiftState Shift, int X, int Y);
 | 
				
			||||||
 | 
					    void __fastcall MouseDown( TMouseButton Button, Classes::TShiftState Shift, int X, int Y);
 | 
				
			||||||
 | 
					    void __fastcall MouseUp( TMouseButton Button, Classes::TShiftState Shift, int X, int Y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					protected:
 | 
				
			||||||
 | 
					    bool MouseCaptured;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void __fastcall Paint();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void __fastcall CreateParams(TCreateParams &Params);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void __fastcall SetGlyphOver( Graphics::TBitmap *val );
 | 
				
			||||||
 | 
					    void __fastcall SetGlyphPress( Graphics::TBitmap *val );
 | 
				
			||||||
 | 
					    void __fastcall SetGlyphNormal( Graphics::TBitmap *val );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool vAutoSize;
 | 
				
			||||||
 | 
					    void __fastcall SetAutoSize( bool val );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    MESSAGE void __fastcall CMMouseEnter    ( TMessage& Msg );
 | 
				
			||||||
 | 
					    MESSAGE void __fastcall CMMouseLeave    ( TMessage& Msg );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
						Graphics::TBitmap *GlyphOver,*GlyphNormal, *GlyphPress;
 | 
				
			||||||
 | 
					    Graphics::TCanvas *RCanvas;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						__fastcall TActiveImage(TComponent* Owner);
 | 
				
			||||||
 | 
						__fastcall ~TActiveImage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__published:
 | 
				
			||||||
 | 
					    __property Graphics::TBitmap *Glyph_Normal={read=GlyphNormal, write=SetGlyphNormal};
 | 
				
			||||||
 | 
					    __property Graphics::TBitmap *Glyph_Over={read=GlyphOver, write=SetGlyphOver};
 | 
				
			||||||
 | 
					    __property Graphics::TBitmap *Glyph_Press={read=GlyphPress, write=SetGlyphPress};
 | 
				
			||||||
 | 
					    __property bool AutoSize={read=vAutoSize, write=SetAutoSize, default=false };
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					    __property TMouseEvent OnMouseDown = {read=FOnMouseDown, write=FOnMouseDown};
 | 
				
			||||||
 | 
					    __property TMouseMoveEvent OnMouseMove = {read=FOnMouseMove, write=FOnMouseMove};
 | 
				
			||||||
 | 
					    __property TMouseEvent OnMouseUp = {read=FOnMouseUp, write=FOnMouseUp};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __property Classes::TNotifyEvent OnClick = {read=FOnClick, write=FOnClick};
 | 
				
			||||||
 | 
					    __property Classes::TNotifyEvent OnDblClick = {read=FOnDblClick, write=FOnDblClick};
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					    __property OnMouseDown;
 | 
				
			||||||
 | 
					    __property OnMouseMove;
 | 
				
			||||||
 | 
					    __property OnMouseUp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __property OnClick;
 | 
				
			||||||
 | 
					    __property OnDblClick;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  BEGIN_MESSAGE_MAP
 | 
				
			||||||
 | 
					    VCL_MESSAGE_HANDLER ( CM_MOUSEENTER,        TMessage,           CMMouseEnter     )
 | 
				
			||||||
 | 
					    VCL_MESSAGE_HANDLER ( CM_MOUSELEAVE,        TMessage,           CMMouseLeave     )
 | 
				
			||||||
 | 
					  END_MESSAGE_MAP(inherited);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								ActImg/actimg.obj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								ActImg/actimg.obj
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										341
									
								
								DigitNum/DigitNum.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										341
									
								
								DigitNum/DigitNum.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,341 @@
 | 
				
			|||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <vcl.h>
 | 
				
			||||||
 | 
					#pragma hdrstop
 | 
				
			||||||
 | 
					#include <math.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "DigitNum.h"
 | 
				
			||||||
 | 
					#pragma package(smart_init)
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// ValidCtrCheck is used to assure that the components created do not have
 | 
				
			||||||
 | 
					// any pure virtual functions.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline void ValidCtrCheck(TDigitNum *)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    new TDigitNum(NULL);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					__fastcall TDigitNum::TDigitNum(TComponent* Owner)
 | 
				
			||||||
 | 
					    : TGraphicControl(Owner)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					     Width  = 96; // Establecemos valores por defecto
 | 
				
			||||||
 | 
					     Height = 33;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     vCerosIzq = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     BorderStyle = bsSingle;
 | 
				
			||||||
 | 
					     cLED_ON =clRed;
 | 
				
			||||||
 | 
					     cLED_OFF=clBtnFace;
 | 
				
			||||||
 | 
					     cLED_BRDon=clBlack;
 | 
				
			||||||
 | 
					     cLED_BRDoff=clGray;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     FValor = 0;
 | 
				
			||||||
 | 
					     // Obtenemos la longitud de la frase. ( En d<>gitos )
 | 
				
			||||||
 | 
					     FLen = 4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  FBrush =  new TBrush;
 | 
				
			||||||
 | 
					  FBrush -> Color = clBtnFace;
 | 
				
			||||||
 | 
					  FBrush -> Style = bsClear;
 | 
				
			||||||
 | 
					  FBrush -> OnChange = CambioAtributo;
 | 
				
			||||||
 | 
					  Invalidate();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					namespace Digitnum
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						void __fastcall PACKAGE Register()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TComponentClass classes[1] = {__classid(TDigitNum)};
 | 
				
			||||||
 | 
							RegisterComponents("JD soft.", classes, 0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					__fastcall TDigitNum::~TDigitNum()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  delete FBrush;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::SetCadena( int NuevaCadena )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 FValor = NuevaCadena;
 | 
				
			||||||
 | 
					 Invalidate();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					    // Este procedimiento es llamado cada vez que se modifica
 | 
				
			||||||
 | 
					    // la brocha, el l<>piz o el tipo de letra
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::CambioAtributo( TObject  * Sender )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					     Invalidate(); // tras lo cual habr<62> que redibujar el componente
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::SetBrush( TBrush * NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 FBrush -> Assign( NuevoValor );
 | 
				
			||||||
 | 
					 Invalidate(); // y volver a dibujar el componente
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::SetLedOn( TColor NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  cLED_ON  = ( NuevoValor  );
 | 
				
			||||||
 | 
					  Invalidate(); // y volver a dibujar el componente
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::SetLedOff( TColor NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  cLED_OFF  = ( NuevoValor  );
 | 
				
			||||||
 | 
					  Invalidate(); // y volver a dibujar el componente
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::SetLedBrdOn( TColor NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  cLED_BRDon  = ( NuevoValor  );
 | 
				
			||||||
 | 
					  Invalidate(); // y volver a dibujar el componente
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::SetLedBrdOff( TColor NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  cLED_BRDoff  = ( NuevoValor  );
 | 
				
			||||||
 | 
					  Invalidate(); // y volver a dibujar el componente
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::SetNumDigit( int NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  if ( NuevoValor > 0 )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					   FLen = NuevoValor;
 | 
				
			||||||
 | 
					   Invalidate(); // y volver a dibujar el componente
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::Paint()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TRect Area;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Preparamos un RECT definiendo el <20>rea ocupada por el componente.
 | 
				
			||||||
 | 
					  Area = GetClientRect();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Dibujar en el Canvas del componente
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //  Establecer la brocha, l<>piz y tipo de letra a usar
 | 
				
			||||||
 | 
					  Canvas -> Brush = FBrush;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Rellenamos el <20>rea con la trama y color seleccionados
 | 
				
			||||||
 | 
					  Canvas -> FillRect( Area );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DibujaLD();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::SetCerosIzq( bool NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  vCerosIzq = NuevoValor;
 | 
				
			||||||
 | 
					  Invalidate();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::DibujaLD( void )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  // Proceso de redibujado de los digitos...
 | 
				
			||||||
 | 
					  int AnchoDigito, i, Digito;
 | 
				
			||||||
 | 
					  // <20> Cuanto espacio le corresponde a cada d<>gito... ?
 | 
				
			||||||
 | 
					  AnchoDigito = Width / FLen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Numero de digitos de la cifra...
 | 
				
			||||||
 | 
					  int Digitos = 1;
 | 
				
			||||||
 | 
					  while ( FValor >= (int)pow10(Digitos) ) Digitos++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  i = 0;
 | 
				
			||||||
 | 
					    DibujaDigito( (( FValor % (int)pow10(i+1) ) / (int)pow10(i) ), AnchoDigito, AnchoDigito * (FLen - i - 1) );
 | 
				
			||||||
 | 
					  for ( i = 1; i < FLen ; i++ )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    Digito = (( FValor % (int)pow10(i+1) ) / (int)pow10(i) );
 | 
				
			||||||
 | 
					    if ( !CerosIzq && i >= Digitos )//!Digito && !CerosIzq )
 | 
				
			||||||
 | 
					      DibujaDigito( 10, AnchoDigito, AnchoDigito * (FLen - i - 1) );
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      DibujaDigito( Digito, AnchoDigito, AnchoDigito * (FLen - i - 1) );
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::DibujaDigito( short int Digito, short int AnchoDigit, short int PosInicial )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  int PMedio, PVert, Medio, MedioL, MedioH;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  POINT P1[5], P2[7], P3[5], P4[5], P5[5], P6[5], P7[5];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  PMedio = (Height-1) / 8;
 | 
				
			||||||
 | 
					  PVert  = AnchoDigit / 5;
 | 
				
			||||||
 | 
					  Medio  = (Height-1)/2;//( ( ( PMedio * 6 ) - ( PMedio * 4 ) ) / 2 ) + ( PMedio*4 );
 | 
				
			||||||
 | 
					  MedioL = Medio - ( PMedio / 2 );
 | 
				
			||||||
 | 
					  MedioH = Medio + ( PMedio / 2 );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 /*                                    _ _ _ _ _ _ _
 | 
				
			||||||
 | 
					                                      |_|  _ _ _ _  |
 | 
				
			||||||
 | 
					                    1        __       |_| |#|#|#|_| |
 | 
				
			||||||
 | 
					     _   _   _      _    ___/         |_| |#|_|#|_| |
 | 
				
			||||||
 | 
					    |_| |_| |_|  4 |2| 5 ______       |_| |#|#|#|_| |
 | 
				
			||||||
 | 
					    |_| |_| |_|  6 |_| 7 ___          |_| |#|_|#|_| |
 | 
				
			||||||
 | 
					                            \__       |_| |#|#|#|_| |
 | 
				
			||||||
 | 
					                    3                 |_|_ _ _ _ _ _|
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					  //         1
 | 
				
			||||||
 | 
					  //   ______________
 | 
				
			||||||
 | 
					  //   \            /
 | 
				
			||||||
 | 
					  //    \__________/
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  P1[0] . x =         1 + 1 + PosInicial;  P1[0] . y =            0;
 | 
				
			||||||
 | 
					  P1[1] . x = PVert * 4 - 1 + PosInicial;  P1[1] . y =            0;
 | 
				
			||||||
 | 
					  P1[2] . x = PVert * 3 - 1 + PosInicial;  P1[2] . y = PMedio*1 - 1;
 | 
				
			||||||
 | 
					  P1[3] . x = PVert * 1 + 1 + PosInicial;  P1[3] . y = PMedio*1 - 1;
 | 
				
			||||||
 | 
					  P1[4] . x =         1 + 1 + PosInicial;  P1[4] . y =            0;
 | 
				
			||||||
 | 
					  //         2
 | 
				
			||||||
 | 
					  //     __________
 | 
				
			||||||
 | 
					  //    /          \
 | 
				
			||||||
 | 
					  //    \__________/
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  P2[0] . x =             2 + PosInicial;  P2[0] . y = Medio       ;
 | 
				
			||||||
 | 
					  P2[1] . x = PVert * 1 + 1 + PosInicial;  P2[1] . y = MedioL + 1;
 | 
				
			||||||
 | 
					  P2[2] . x = PVert * 3 - 1 + PosInicial;  P2[2] . y = MedioL + 1;
 | 
				
			||||||
 | 
					  P2[3] . x = PVert * 4 - 2 + PosInicial;  P2[3] . y = Medio       ;
 | 
				
			||||||
 | 
					  P2[4] . x = PVert * 3 - 1 + PosInicial;  P2[4] . y = MedioH - 1;
 | 
				
			||||||
 | 
					  P2[5] . x = PVert * 1 + 1 + PosInicial;  P2[5] . y = MedioH - 1;
 | 
				
			||||||
 | 
					  P2[6] . x =             2 + PosInicial;  P2[6] . y = Medio       ;
 | 
				
			||||||
 | 
					  //         3
 | 
				
			||||||
 | 
					  //     __________
 | 
				
			||||||
 | 
					  //    /          \
 | 
				
			||||||
 | 
					  //   /____________\
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  P3[0] . x = PVert * 1 + 1 + PosInicial;  P3[0] . y = PMedio*7 + 1;
 | 
				
			||||||
 | 
					  P3[1] . x = PVert * 3 - 1 + PosInicial;  P3[1] . y = PMedio*7 + 1;
 | 
				
			||||||
 | 
					  P3[2] . x = PVert * 4 - 1 + PosInicial;  P3[2] . y = PMedio*8    ;
 | 
				
			||||||
 | 
					  P3[3] . x = PVert * 0 + 2 + PosInicial;  P3[3] . y = PMedio*8    ;
 | 
				
			||||||
 | 
					  P3[4] . x = PVert * 1 + 1 + PosInicial;  P3[4] . y = PMedio*7 + 1;
 | 
				
			||||||
 | 
					  //    .
 | 
				
			||||||
 | 
					  //    |\
 | 
				
			||||||
 | 
					  //    | |
 | 
				
			||||||
 | 
					  //  4 | |
 | 
				
			||||||
 | 
					  //    | |
 | 
				
			||||||
 | 
					  //    |/
 | 
				
			||||||
 | 
					  //    <20>
 | 
				
			||||||
 | 
					  P4[0] . x =             0 + PosInicial;  P4[0] . y =            1;
 | 
				
			||||||
 | 
					  P4[1] . x = PVert * 1 - 1 + PosInicial;  P4[1] . y = PMedio*1 + 1;
 | 
				
			||||||
 | 
					  P4[2] . x = PVert * 1 - 1 + PosInicial;  P4[2] . y = MedioL - 1;
 | 
				
			||||||
 | 
					  P4[3] . x =             0 + PosInicial;  P4[3] . y = Medio    - 1;
 | 
				
			||||||
 | 
					  P4[4] . x =             0 + PosInicial;  P4[4] . y =            1;
 | 
				
			||||||
 | 
					  //      .
 | 
				
			||||||
 | 
					  //     /|
 | 
				
			||||||
 | 
					  //    | |
 | 
				
			||||||
 | 
					  //  5 | |
 | 
				
			||||||
 | 
					  //    | |
 | 
				
			||||||
 | 
					  //     \|
 | 
				
			||||||
 | 
					  //      <20>
 | 
				
			||||||
 | 
					  P5[0] . x = PVert * 4 + 1 + PosInicial;  P5[0] . y =            1;
 | 
				
			||||||
 | 
					  P5[1] . x = PVert * 4 + 1 + PosInicial;  P5[1] . y = Medio    - 1;
 | 
				
			||||||
 | 
					  P5[2] . x = PVert * 3 + 1 + PosInicial;  P5[2] . y = MedioL - 1;
 | 
				
			||||||
 | 
					  P5[3] . x = PVert * 3 + 1 + PosInicial;  P5[3] . y = PMedio*1 + 1;
 | 
				
			||||||
 | 
					  P5[4] . x = PVert * 4 + 1 + PosInicial;  P5[4] . y =            1;
 | 
				
			||||||
 | 
					  //    .
 | 
				
			||||||
 | 
					  //    |\
 | 
				
			||||||
 | 
					  //    | |
 | 
				
			||||||
 | 
					  //  6 | |
 | 
				
			||||||
 | 
					  //    | |
 | 
				
			||||||
 | 
					  //    |/
 | 
				
			||||||
 | 
					  //    <20>
 | 
				
			||||||
 | 
					  P6[0] . x =             0 + PosInicial;  P6[0] . y = Medio    + 1;
 | 
				
			||||||
 | 
					  P6[1] . x = PVert * 1 - 1 + PosInicial;  P6[1] . y = MedioH + 1;
 | 
				
			||||||
 | 
					  P6[2] . x = PVert * 1 - 1 + PosInicial;  P6[2] . y = PMedio*7 - 1;
 | 
				
			||||||
 | 
					  P6[3] . x =             0 + PosInicial;  P6[3] . y = PMedio*8 - 1;
 | 
				
			||||||
 | 
					  P6[4] . x =             0 + PosInicial;  P6[4] . y = MedioH + 1;
 | 
				
			||||||
 | 
					  //      .
 | 
				
			||||||
 | 
					  //     /|
 | 
				
			||||||
 | 
					  //    | |
 | 
				
			||||||
 | 
					  //  7 | |
 | 
				
			||||||
 | 
					  //    | |
 | 
				
			||||||
 | 
					  //     \|
 | 
				
			||||||
 | 
					  //      <20>
 | 
				
			||||||
 | 
					  P7[0] . x = PVert * 4 + 1 + PosInicial;  P7[0] . y = Medio    + 1;
 | 
				
			||||||
 | 
					  P7[1] . x = PVert * 4 + 1 + PosInicial;  P7[1] . y = PMedio*8 - 1;
 | 
				
			||||||
 | 
					  P7[2] . x = PVert * 3 + 1 + PosInicial;  P7[2] . y = PMedio*7 - 1;
 | 
				
			||||||
 | 
					  P7[3] . x = PVert * 3 + 1 + PosInicial;  P7[3] . y = MedioH + 1;
 | 
				
			||||||
 | 
					  P7[4] . x = PVert * 4 + 1 + PosInicial;  P7[4] . y = Medio    + 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // 1 === 0, 2, 3, 5, 6, 7, 8, 9,
 | 
				
			||||||
 | 
					  if ( Digito != 1 && Digito != 4 && Digito != 10 )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_ON;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDon;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_OFF;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDoff;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					                                          Canvas -> Polygon( P1, 4 );
 | 
				
			||||||
 | 
					  // 2 === 2, 3, 4, 5, 6, 8, 9
 | 
				
			||||||
 | 
					  if ( Digito != 0 && Digito != 1 && Digito != 7 && Digito != 10  )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_ON;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDon;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_OFF;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDoff;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					                                          Canvas -> Polygon( P2, 6 );
 | 
				
			||||||
 | 
					  // 3 === 0, 2, 3, 5, 6, 8, 9
 | 
				
			||||||
 | 
					  if ( Digito != 1 && Digito != 4 && Digito != 7 && Digito != 10  )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_ON;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDon;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_OFF;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDoff;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					                                          Canvas -> Polygon( P3, 4 );
 | 
				
			||||||
 | 
					  // 4 === 0, 4, 5, 6, 8, 9
 | 
				
			||||||
 | 
					  if ( Digito != 1 && Digito != 2 && Digito != 3&& Digito != 7 && Digito != 10  )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_ON;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDon;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_OFF;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDoff;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					                                          Canvas -> Polygon( P4, 4 );
 | 
				
			||||||
 | 
					  // 5 === 0, 1, 2, 3, 4, 7, 8, 9
 | 
				
			||||||
 | 
					  if ( Digito != 5 && Digito != 6 && Digito != 10  )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_ON;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDon;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_OFF;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDoff;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					                                          Canvas -> Polygon( P5, 4 );
 | 
				
			||||||
 | 
					  // 6 === 0, 2, 6, 8
 | 
				
			||||||
 | 
					  if ( Digito == 0 || Digito == 2 || Digito == 6 || Digito == 8 )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_ON;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDon;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_OFF;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDoff;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					                                          Canvas -> Polygon( P6, 4 );
 | 
				
			||||||
 | 
					  // 7 === 0, 1, 3, 4, 5, 6, 7, 8, 9
 | 
				
			||||||
 | 
					  if ( Digito != 2 && Digito != 10  )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_ON;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDon;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					     Canvas -> Brush -> Color = cLED_OFF;
 | 
				
			||||||
 | 
					     Canvas -> Pen -> Color   = cLED_BRDoff;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					                                          Canvas -> Polygon( P7, 4 );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TDigitNum::SetBorderStyle( TBorderStyle NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 FBorderStyle = NuevoValor;
 | 
				
			||||||
 | 
					 Invalidate(); // y volver a dibujar el componente
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								DigitNum/DigitNum.dcr
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								DigitNum/DigitNum.dcr
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										72
									
								
								DigitNum/DigitNum.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								DigitNum/DigitNum.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,72 @@
 | 
				
			|||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#ifndef DigitNumH
 | 
				
			||||||
 | 
					#define DigitNumH
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <SysUtils.hpp>
 | 
				
			||||||
 | 
					#include <Controls.hpp>
 | 
				
			||||||
 | 
					#include <Classes.hpp>
 | 
				
			||||||
 | 
					#include <Forms.hpp>
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					class PACKAGE TDigitNum : public TGraphicControl
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					    TBorderStyle FBorderStyle;	// Con borde o sin borde
 | 
				
			||||||
 | 
					    TBrush *FBrush;				// Para el relleno del fondo
 | 
				
			||||||
 | 
					    TColor cLED_ON;			    // Color de la LED encendida y
 | 
				
			||||||
 | 
					    TColor cLED_OFF;			// apagada
 | 
				
			||||||
 | 
					    TColor cLED_BRDon;            // Color para el borde
 | 
				
			||||||
 | 
					    TColor cLED_BRDoff;            // Color para el borde
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int FValor;     			// Valor inicial a mostrar
 | 
				
			||||||
 | 
					    int  FLen;	        		// N<>mero de digitos a mostrar
 | 
				
			||||||
 | 
					    bool vCerosIzq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Evento OnChange, dirigido a la siguiente funci<63>n:
 | 
				
			||||||
 | 
					    void __fastcall CambioAtributo( TObject  * Sender );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Dibujo del letrero digital
 | 
				
			||||||
 | 
					    void __fastcall DibujaLD( void );
 | 
				
			||||||
 | 
					    void __fastcall DibujaDigito( short int Digito, short int AnchoDigit, short int PosInicial );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					protected:
 | 
				
			||||||
 | 
						// Redefinimos el m<>todo Paint, que ser<65> llamado cada vez
 | 
				
			||||||
 | 
					    // que sea necesario redibujar el componente.
 | 
				
			||||||
 | 
					    void __fastcall Paint();
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    void __fastcall SetNumDigit( int NuevoValor );
 | 
				
			||||||
 | 
					    void __fastcall SetBrush( TBrush *NuevoValor );
 | 
				
			||||||
 | 
					    void __fastcall SetBorderStyle( TBorderStyle NuevoValor );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void __fastcall SetLedOn( TColor NuevoValor );
 | 
				
			||||||
 | 
					    void __fastcall SetLedOff( TColor NuevoValor );
 | 
				
			||||||
 | 
					    void __fastcall SetLedBrdOn( TColor NuevoValor );
 | 
				
			||||||
 | 
					    void __fastcall SetLedBrdOff( TColor NuevoValor );
 | 
				
			||||||
 | 
					    void __fastcall SetCerosIzq( bool NuevoValor );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    							// Cambia la cadena a mostrar: "at RunTime"
 | 
				
			||||||
 | 
					    void __fastcall SetCadena( int NuevaCadena );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						__fastcall TDigitNum(TComponent* Owner);
 | 
				
			||||||
 | 
					    __fastcall ~TDigitNum();
 | 
				
			||||||
 | 
					__published:
 | 
				
			||||||
 | 
						__property TBorderStyle BorderStyle = { read = FBorderStyle, write = SetBorderStyle, default=bsSingle };
 | 
				
			||||||
 | 
						__property TBrush *Brush     = { read = FBrush, write = SetBrush };
 | 
				
			||||||
 | 
						__property TColor LED_ON     = { read = cLED_ON,  write = SetLedOn, default = clRed };
 | 
				
			||||||
 | 
						__property TColor LED_OFF    = { read = cLED_OFF, write = SetLedOff, default = clBtnFace };
 | 
				
			||||||
 | 
						__property TColor LED_BRDon  = { read = cLED_BRDon, write = SetLedBrdOn, default = clBlack };
 | 
				
			||||||
 | 
						__property TColor LED_BRDoff = { read = cLED_BRDoff, write = SetLedBrdOff, default = clGray };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						__property Left   ;
 | 
				
			||||||
 | 
						__property Top    ;
 | 
				
			||||||
 | 
					    __property Width  ;
 | 
				
			||||||
 | 
						__property Height ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						__property bool CerosIzq = {  read = vCerosIzq, write = SetCerosIzq, default = false };
 | 
				
			||||||
 | 
					    __property int Value = { read = FValor, write = SetCadena };
 | 
				
			||||||
 | 
					    __property int MaxLength      = { read = FLen     , write = SetNumDigit     , default = 4 };
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										48
									
								
								ElasticForm (building)/ElasticForm.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								ElasticForm (building)/ElasticForm.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <vcl.h>
 | 
				
			||||||
 | 
					#pragma hdrstop
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "ElasticForm.h"
 | 
				
			||||||
 | 
					#pragma package(smart_init)
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// ValidCtrCheck is used to assure that the components created do not have
 | 
				
			||||||
 | 
					// any pure virtual functions.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline void ValidCtrCheck(TElasticForm *)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    new TElasticForm(NULL);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					__fastcall TElasticForm::TElasticForm(TComponent* Owner)
 | 
				
			||||||
 | 
					    : TControl(Owner)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 nOwner = Owner;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					namespace Elasticform
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    void __fastcall PACKAGE Register()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        TComponentClass classes[1] = {__classid(TElasticForm)};
 | 
				
			||||||
 | 
					        RegisterComponents("JD soft.", classes, 0);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall ResizeALL(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 int i;
 | 
				
			||||||
 | 
					 // Nos damos un vueltazo por todos los componectes visibles del formulario
 | 
				
			||||||
 | 
					 for ( i=0; i<nOwner->ComponentCount; i ++ )
 | 
				
			||||||
 | 
					 {
 | 
				
			||||||
 | 
					  if ( nOwner->Components[i]->ClassNameIs( "TButton" ) )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					   //cast the component to a TButton *
 | 
				
			||||||
 | 
					 	 button = (TButton *)(nOwner->Components[i]);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										22
									
								
								ElasticForm (building)/ElasticForm.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ElasticForm (building)/ElasticForm.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#ifndef ElasticFormH
 | 
				
			||||||
 | 
					#define ElasticFormH
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <SysUtils.hpp>
 | 
				
			||||||
 | 
					#include <Controls.hpp>
 | 
				
			||||||
 | 
					#include <Classes.hpp>
 | 
				
			||||||
 | 
					#include <Forms.hpp>
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					class PACKAGE TElasticForm : public TControl
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					    TComponent * nOwner;
 | 
				
			||||||
 | 
					protected:
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    void __fastcall ResizeALL(void);
 | 
				
			||||||
 | 
					    __fastcall TElasticForm(TComponent* Owner);
 | 
				
			||||||
 | 
					__published:
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								JD_soft.bpi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								JD_soft.bpi
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										140
									
								
								JD_soft.bpk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										140
									
								
								JD_soft.bpk
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,140 @@
 | 
				
			|||||||
 | 
					# ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					VERSION = BCB.03
 | 
				
			||||||
 | 
					# ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					!ifndef BCB
 | 
				
			||||||
 | 
					BCB = $(MAKEDIR)\..
 | 
				
			||||||
 | 
					!endif
 | 
				
			||||||
 | 
					# ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					PROJECT = JD_soft.bpl
 | 
				
			||||||
 | 
					OBJFILES = JD_soft.obj ActImg\actimg.obj LetreroDigital\LetreroDigital.obj \
 | 
				
			||||||
 | 
					  DigitNum\DigitNum.obj
 | 
				
			||||||
 | 
					RESFILES = JD_soft.res ActImg\actimg.dcr LetreroDigital\LetreroDigital.dcr \
 | 
				
			||||||
 | 
					  DigitNum\DigitNum.dcr
 | 
				
			||||||
 | 
					RESDEPEN = $(RESFILES)
 | 
				
			||||||
 | 
					LIBFILES =
 | 
				
			||||||
 | 
					LIBRARIES = CDopping.lib VCLDB35.lib
 | 
				
			||||||
 | 
					SPARELIBS = vcl35.lib vclx35.lib VCLDB35.lib CDopping.lib
 | 
				
			||||||
 | 
					PACKAGES = VCLX35.bpi VCL35.bpi
 | 
				
			||||||
 | 
					PATHASM = .;
 | 
				
			||||||
 | 
					PATHCPP = .;ActImg;LetreroDigital;DigitNum
 | 
				
			||||||
 | 
					PATHPAS = .;
 | 
				
			||||||
 | 
					PATHRC = .;
 | 
				
			||||||
 | 
					DEBUGLIBPATH = $(BCB)\lib\debug
 | 
				
			||||||
 | 
					RELEASELIBPATH = $(BCB)\lib\release
 | 
				
			||||||
 | 
					DEFFILE =
 | 
				
			||||||
 | 
					# ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					CFLAG1 = -Od -Hc -w -Ve -r- -k -y -v -vi- -c -b- -w-par -w-inl -Vx
 | 
				
			||||||
 | 
					CFLAG2 = -DUSEPACKAGES \
 | 
				
			||||||
 | 
					  -Ij:\cbuilder3\projects;..\ctrlmstr;digitnum;letrerodigital;actimg;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl \
 | 
				
			||||||
 | 
					  -H=$(BCB)\lib\vcld.csm
 | 
				
			||||||
 | 
					CFLAG3 = -5
 | 
				
			||||||
 | 
					PFLAGS = -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE \
 | 
				
			||||||
 | 
					  -DUSEPACKAGES \
 | 
				
			||||||
 | 
					  -Uj:\cbuilder3\projects;..\ctrlmstr;..\componentes;digitnum;letrerodigital;actimg;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;$(DEBUGLIBPATH) \
 | 
				
			||||||
 | 
					  -Ij:\cbuilder3\projects;..\ctrlmstr;digitnum;letrerodigital;actimg;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl \
 | 
				
			||||||
 | 
					  -H -$Y -$W -$O- -v -JPHNV -M
 | 
				
			||||||
 | 
					RFLAGS = -DUSEPACKAGES \
 | 
				
			||||||
 | 
					  -ij:\cbuilder3\projects;..\ctrlmstr;digitnum;letrerodigital;actimg;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl
 | 
				
			||||||
 | 
					AFLAGS = /ij:\cbuilder3\projects /i..\ctrlmstr /idigitnum /iletrerodigital /iactimg \
 | 
				
			||||||
 | 
					  /i$(BCB)\bin /i$(BCB)\objrepos /i$(BCB)\projects /i$(BCB)\include \
 | 
				
			||||||
 | 
					  /i$(BCB)\include\vcl /dUSEPACKAGES /mx /w2 /zd
 | 
				
			||||||
 | 
					LFLAGS = -Lj:\cbuilder3\projects;..\ctrlmstr;..\componentes;digitnum;letrerodigital;actimg;$(BCB)\bin;$(BCB)\objrepos;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;$(DEBUGLIBPATH) \
 | 
				
			||||||
 | 
					  -aa -Tpp -x -Gl -Gi -v soft\jd";"l:\programaci<63>n (-cbuilder-)\jd \
 | 
				
			||||||
 | 
					  soft\jd";l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;"j:\cbuilder\jd \
 | 
				
			||||||
 | 
					  soft";"j:\progwin95\jd soft";$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;"..\jd \
 | 
				
			||||||
 | 
					  soft\jd";"l:\programaci<63>n (-cbuilder-)\jd \
 | 
				
			||||||
 | 
					  soft\jd";l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;"j:\cbuilder\jd \
 | 
				
			||||||
 | 
					  soft";"j:\progwin95\jd \
 | 
				
			||||||
 | 
					  soft";$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;$(DEBUGLIBPATH) soft\jd";"l:\programaci<63>n (-cbuilder-)\jd soft\jd";l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;"j:\cbuilder\jd soft";"j:\progwin95\jd soft";$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;$(DEBUGLIBPATH) \
 | 
				
			||||||
 | 
					  soft\jd";"l:\programaci<63>n (-cbuilder-)\jd \
 | 
				
			||||||
 | 
					  soft\jd";l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;"j:\cbuilder\jd \
 | 
				
			||||||
 | 
					  soft";"j:\progwin95\jd soft";$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;$(DEBUGLIBPATH)
 | 
				
			||||||
 | 
					IFLAGS = -g
 | 
				
			||||||
 | 
					LINKER = ilink32
 | 
				
			||||||
 | 
					# ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					ALLOBJ = c0pkg32.obj $(PACKAGES) sysinit.obj $(OBJFILES)
 | 
				
			||||||
 | 
					ALLRES = $(RESFILES)
 | 
				
			||||||
 | 
					ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib
 | 
				
			||||||
 | 
					# ---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					.autodepend
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					!ifdef IDEOPTIONS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Version Info]
 | 
				
			||||||
 | 
					IncludeVerInfo=1
 | 
				
			||||||
 | 
					AutoIncBuild=1
 | 
				
			||||||
 | 
					MajorVer=1
 | 
				
			||||||
 | 
					MinorVer=0
 | 
				
			||||||
 | 
					Release=0
 | 
				
			||||||
 | 
					Build=69
 | 
				
			||||||
 | 
					Debug=1
 | 
				
			||||||
 | 
					PreRelease=0
 | 
				
			||||||
 | 
					Special=0
 | 
				
			||||||
 | 
					Private=0
 | 
				
			||||||
 | 
					DLL=0
 | 
				
			||||||
 | 
					Locale=3082
 | 
				
			||||||
 | 
					CodePage=1252
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Version Info Keys]
 | 
				
			||||||
 | 
					CompanyName=JD soft.
 | 
				
			||||||
 | 
					FileDescription=Gesti<74>n integral de m<>ltiples empresas,\n con  m<>ltiples terminales.
 | 
				
			||||||
 | 
					FileVersion=1.0.0.69
 | 
				
			||||||
 | 
					InternalName=Tpv for Windows
 | 
				
			||||||
 | 
					LegalCopyright=Copyright (C) JD soft. 1990-1998
 | 
				
			||||||
 | 
					LegalTrademarks=
 | 
				
			||||||
 | 
					OriginalFilename=Tpv
 | 
				
			||||||
 | 
					ProductName=Tpv for Win98
 | 
				
			||||||
 | 
					ProductVersion=1.0.0.0
 | 
				
			||||||
 | 
					Comments=e-mail: Jose-David.Guillen@cs.us.es
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Excluded Packages]
 | 
				
			||||||
 | 
					j:\CBuilder3\Bin\dcl31w35.bpl=Borland 1.0 Compatibility Components
 | 
				
			||||||
 | 
					C:\WIN98\SYSTEM\ibsmp35.bpl=Borland C++ InterBase Alerter Component
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[HistoryLists\hlIncludePath]
 | 
				
			||||||
 | 
					Count=1
 | 
				
			||||||
 | 
					Item0=..\jd soft\jd;l:\programaci<63>n (-cbuilder-)\jd soft\jd;l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;j:\cbuilder\jd soft;j:\progwin95\jd soft;$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[HistoryLists\hlLibraryPath]
 | 
				
			||||||
 | 
					Count=2
 | 
				
			||||||
 | 
					Item0=..\jd soft\jd;l:\programaci<63>n (-cbuilder-)\jd soft\jd;l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;j:\cbuilder\jd soft;j:\progwin95\jd soft;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;..\jd soft\jd;l:\programaci<63>n (-cbuilder-)\jd soft\jd;l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;j:\cbuilder\jd soft;j:\progwin95\jd soft;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;$(DEBUGLIBPATH)
 | 
				
			||||||
 | 
					Item1=..\jd soft\jd;l:\programaci<63>n (-cbuilder-)\jd soft\jd;l:\cbuilder\cbuilder\objrepos;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\bin;j:\cbuilder\cbuilder\objrepos;$(BCB)\bin;$(BCB)\objrepos;j:\cbuilder\jd soft;j:\progwin95\jd soft;$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[HistoryLists\hlUnitAliases]
 | 
				
			||||||
 | 
					Count=1
 | 
				
			||||||
 | 
					Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Debugging]
 | 
				
			||||||
 | 
					DebugSourceDirs=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Parameters]
 | 
				
			||||||
 | 
					RunParams=
 | 
				
			||||||
 | 
					HostApplication=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					!endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE)
 | 
				
			||||||
 | 
					    $(BCB)\BIN\$(LINKER) @&&!
 | 
				
			||||||
 | 
					    $(LFLAGS) +
 | 
				
			||||||
 | 
					    $(ALLOBJ), +
 | 
				
			||||||
 | 
					    $(PROJECT),, +
 | 
				
			||||||
 | 
					    $(ALLLIB), +
 | 
				
			||||||
 | 
					    $(DEFFILE), +
 | 
				
			||||||
 | 
					    $(ALLRES) 
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.pas.hpp:
 | 
				
			||||||
 | 
					    $(BCB)\BIN\dcc32 $(PFLAGS) { $** }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.pas.obj:
 | 
				
			||||||
 | 
					    $(BCB)\BIN\dcc32 $(PFLAGS) { $** }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.cpp.obj:
 | 
				
			||||||
 | 
					    $(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $* 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.c.obj:
 | 
				
			||||||
 | 
					    $(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.rc.res:
 | 
				
			||||||
 | 
					    $(BCB)\BIN\brcc32 $(RFLAGS) $<
 | 
				
			||||||
 | 
					#-----------------------------------------------------------------------------
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								JD_soft.bpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								JD_soft.bpl
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										22
									
								
								JD_soft.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								JD_soft.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <vcl.h>
 | 
				
			||||||
 | 
					#pragma hdrstop
 | 
				
			||||||
 | 
					USERES("JD_soft.res");
 | 
				
			||||||
 | 
					USEPACKAGE("VCLX35.bpi");
 | 
				
			||||||
 | 
					USEPACKAGE("VCL35.bpi");
 | 
				
			||||||
 | 
					USEUNIT("ActImg\actimg.cpp");
 | 
				
			||||||
 | 
					USERES("ActImg\actimg.dcr");
 | 
				
			||||||
 | 
					USEUNIT("LetreroDigital\LetreroDigital.cpp");
 | 
				
			||||||
 | 
					USERES("LetreroDigital\LetreroDigital.dcr");
 | 
				
			||||||
 | 
					USEUNIT("DigitNum\DigitNum.cpp");
 | 
				
			||||||
 | 
					USERES("DigitNum\DigitNum.dcr");
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#pragma package(smart_init)
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					//   Package source.
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return 1;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								JD_soft.lib
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								JD_soft.lib
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								JD_soft.res
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								JD_soft.res
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										253
									
								
								LetreroDigital/LetreroDigital.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										253
									
								
								LetreroDigital/LetreroDigital.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,253 @@
 | 
				
			|||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <fstream.h>
 | 
				
			||||||
 | 
					#include <vcl.h>
 | 
				
			||||||
 | 
					#pragma hdrstop
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "LetreroDigital.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pragma package(smart_init)
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// ValidCtrCheck is used to assure that the components created do not have
 | 
				
			||||||
 | 
					// any pure virtual functions.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline TLetreroDigital *ValidCtrCheck()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return new TLetreroDigital(NULL);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					__fastcall TLetreroDigital::TLetreroDigital(TComponent* Owner)
 | 
				
			||||||
 | 
						: TGraphicControl(Owner)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					     Width = 96; // Establecemos valores por defecto
 | 
				
			||||||
 | 
					     Height = 32;
 | 
				
			||||||
 | 
					     BorderStyle = bsSingle;
 | 
				
			||||||
 | 
					     TAMx =  8;
 | 
				
			||||||
 | 
					     TAMy = 16;
 | 
				
			||||||
 | 
					     AX   =  2;
 | 
				
			||||||
 | 
					     AY   =  2;
 | 
				
			||||||
 | 
					     cLED_ON =clBlack;
 | 
				
			||||||
 | 
					     cLED_OFF=clYellow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     FCadena = "JD Soft.";
 | 
				
			||||||
 | 
					     // Obtenemos la longitud de la frase. ( En d<>gitos )
 | 
				
			||||||
 | 
					     Flen = FCadena.Length();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Asignamos memoria para las fuentes RAW
 | 
				
			||||||
 | 
					  ptr_char = new char[4096];
 | 
				
			||||||
 | 
					//  SetFont( "ASCii.FNT" );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  FBrush =  new TBrush;
 | 
				
			||||||
 | 
					  FBrush -> Color = clRed;
 | 
				
			||||||
 | 
					  FBrush -> OnChange = CambioAtributo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Creamos un timer y lo asignamos a DibujaLD(); si ActivarLD = true;
 | 
				
			||||||
 | 
					  FPulsoReloj = new TTimer( this );
 | 
				
			||||||
 | 
					  FPulsoReloj->OnTimer  = OnTimerHandler;
 | 
				
			||||||
 | 
					  FPulsoReloj->Interval = 100;
 | 
				
			||||||
 | 
					  FPulsoReloj->Enabled = true;
 | 
				
			||||||
 | 
					  FFrecReloj = 100;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::OnTimerHandler(TObject *Sender)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 DibujaLD( false );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					__fastcall TLetreroDigital::~TLetreroDigital()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  delete FBrush;
 | 
				
			||||||
 | 
					  delete [] ptr_char;
 | 
				
			||||||
 | 
					  delete FPulsoReloj;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					namespace Letrerodigital
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						void __fastcall PACKAGE Register()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TComponentClass classes[1] = {__classid(TLetreroDigital)};
 | 
				
			||||||
 | 
							RegisterComponents("JD Soft.", classes, 0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::SetTAM( int NuevoTAMx, int NuevoTAMy )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 TAMx = NuevoTAMx;
 | 
				
			||||||
 | 
					 TAMy = NuevoTAMy;
 | 
				
			||||||
 | 
					 if ( TAMx == 0 ) TAMx =  8;
 | 
				
			||||||
 | 
					 if ( TAMy == 0 ) TAMy = 16;
 | 
				
			||||||
 | 
					 Invalidate(); // y volver a dibujar el componente
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::SetFrecReloj( int NuevoReloj )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 if ( NuevoReloj <= 0 ) NuevoReloj = 100;
 | 
				
			||||||
 | 
					 FFrecReloj = NuevoReloj;
 | 
				
			||||||
 | 
					 FPulsoReloj -> Interval = FFrecReloj;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::SetTAMg( TFPitchFnt Index )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  FPitchFnt = Index;
 | 
				
			||||||
 | 
					  switch ( Index )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					   case 3:
 | 
				
			||||||
 | 
					   		TAMx =  8;
 | 
				
			||||||
 | 
					        TAMy =  8;
 | 
				
			||||||
 | 
					   		break;
 | 
				
			||||||
 | 
					   case 2:
 | 
				
			||||||
 | 
					   		TAMx =  8;
 | 
				
			||||||
 | 
					        TAMy = 16;
 | 
				
			||||||
 | 
					   		break;
 | 
				
			||||||
 | 
					   case 1:
 | 
				
			||||||
 | 
					   		TAMx = 16;
 | 
				
			||||||
 | 
					        TAMy =  8;
 | 
				
			||||||
 | 
					   		break;
 | 
				
			||||||
 | 
					   case 0:
 | 
				
			||||||
 | 
					   		TAMx = 16;
 | 
				
			||||||
 | 
					        TAMy = 16;
 | 
				
			||||||
 | 
					   		break;
 | 
				
			||||||
 | 
					   default:
 | 
				
			||||||
 | 
					   		TAMx =  8;
 | 
				
			||||||
 | 
					        TAMy = 16;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  Height = AY * TAMy;
 | 
				
			||||||
 | 
					  Invalidate();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::SetCadena( AnsiString NuevaCadena )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 FCadena = NuevaCadena;
 | 
				
			||||||
 | 
					 // Obtenemos la longitud de la frase. ( En d<>gitos )
 | 
				
			||||||
 | 
					 Flen = FCadena.Length();
 | 
				
			||||||
 | 
					 Invalidate();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					    // Este procedimiento es llamado cada vez que se modifica
 | 
				
			||||||
 | 
					    // la brocha, el l<>piz o el tipo de letra
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::CambioAtributo( TObject  * Sender )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					     Invalidate(); // tras lo cual habr<62> que redibujar el componente
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::SetBrush( TBrush * NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 FBrush -> Assign( NuevoValor );
 | 
				
			||||||
 | 
					 Invalidate(); // y volver a dibujar el componente
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::SetLED_Color( TColor NuevoValorON, TColor NuevoValorOFF )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  cLED_ON  = ( NuevoValorON  );
 | 
				
			||||||
 | 
					  cLED_OFF = ( NuevoValorOFF );
 | 
				
			||||||
 | 
					  Invalidate(); // y volver a dibujar el componente
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::SetFont( AnsiString NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  fstream fich;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  FFuente = NuevoValor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  fich.open( FFuente.c_str(), ios::in | ios::binary );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if ( !fich )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					   ShowMessage( "Fallo en la apertura\nFuentes RAW no encontradas" );
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					   fich.read( ptr_char, 4096 );
 | 
				
			||||||
 | 
					   fich.close();
 | 
				
			||||||
 | 
					   Invalidate();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::SetAx( int NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					   AX = NuevoValor;
 | 
				
			||||||
 | 
					   Invalidate();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::SetAy( int NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					   AY = NuevoValor;
 | 
				
			||||||
 | 
					   Height = AY * TAMy;
 | 
				
			||||||
 | 
					   Invalidate();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::Paint()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TRect Area;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Preparamos un RECT definiendo el <20>rea ocupada por el componente.
 | 
				
			||||||
 | 
					  Area = GetClientRect();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Dibujar en el Canvas del componente
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //  Establecer la brocha, l<>piz y tipo de letra a usar
 | 
				
			||||||
 | 
					  Canvas -> Brush = FBrush;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Rellenamos el <20>rea con la trama y color seleccionados
 | 
				
			||||||
 | 
					  Canvas -> FillRect( Area );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  FPulsoReloj->Enabled = false;
 | 
				
			||||||
 | 
					  DibujaLD( true );
 | 
				
			||||||
 | 
					  FPulsoReloj->Enabled = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::DibujaLD( bool RESET )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 int  i, j, k;           // Variables de avance
 | 
				
			||||||
 | 
					 TColor  c_elec;         // Color en el momento de imprimir
 | 
				
			||||||
 | 
					 int  PosX, PosY;        // Posicion fisica final
 | 
				
			||||||
 | 
					 char LCaract;           // Caracter de linea a tratar
 | 
				
			||||||
 | 
					 char *Frase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Frase = FCadena.c_str();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 if ( RESET )
 | 
				
			||||||
 | 
					 {
 | 
				
			||||||
 | 
					  // Obtenemos la longitud de la frase. ( En d<>gitos )
 | 
				
			||||||
 | 
					  Flen  = FCadena.Length();
 | 
				
			||||||
 | 
					  if ( Flen == 0 ) Flen = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Contador de digito actual a cero
 | 
				
			||||||
 | 
					  BitByte  = 0;
 | 
				
			||||||
 | 
					  // Posicion dentro de la frase
 | 
				
			||||||
 | 
					  currByte = 0;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 // Avance horizontal de bit's ( avance de digitos )
 | 
				
			||||||
 | 
					 for ( i = 0; i < ( Width ); i++ )
 | 
				
			||||||
 | 
					 {
 | 
				
			||||||
 | 
					  k = ( (unsigned char)Frase[ ( (i+BitByte)/TAMx + currByte ) % Flen ] ) << 4;
 | 
				
			||||||
 | 
					  LCaract = ( (char)0x01 << (7 - (i+BitByte)%TAMx) );
 | 
				
			||||||
 | 
					  PosX = /*Left + */AX   * i;         // Posicion f<>sica horizontal
 | 
				
			||||||
 | 
					  // Avance vertical de bit's
 | 
				
			||||||
 | 
					  for ( j = 0; j < TAMy; j ++ )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    PosY = /*Top + */AY * j;         // Posicion f<>sica vertical
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ( ptr_char[ k + j ] & LCaract )
 | 
				
			||||||
 | 
					      c_elec = cLED_ON;
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      c_elec = cLED_OFF;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Canvas -> Pixels[ PosX ][ PosY ] = c_elec;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					 // Tenemos en cuenta el avance dentro de la frase
 | 
				
			||||||
 | 
					 if ( ( BitByte ++ ) >= 7 )
 | 
				
			||||||
 | 
					 {
 | 
				
			||||||
 | 
					  BitByte = 0; currByte ++;
 | 
				
			||||||
 | 
					  if ( (unsigned)currByte >= Flen )
 | 
				
			||||||
 | 
					     currByte = 0;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					void __fastcall TLetreroDigital::SetBorderStyle( TBorderStyle NuevoValor )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					 FBorderStyle = NuevoValor;
 | 
				
			||||||
 | 
					 Invalidate(); // y volver a dibujar el componente
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								LetreroDigital/LetreroDigital.dcr
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								LetreroDigital/LetreroDigital.dcr
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										92
									
								
								LetreroDigital/LetreroDigital.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								LetreroDigital/LetreroDigital.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,92 @@
 | 
				
			|||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#ifndef LetreroDigitalH
 | 
				
			||||||
 | 
					#define LetreroDigitalH
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#include <vcl\SysUtils.hpp>
 | 
				
			||||||
 | 
					#include <vcl\Controls.hpp>
 | 
				
			||||||
 | 
					#include <vcl\Classes.hpp>
 | 
				
			||||||
 | 
					#include <vcl\Forms.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					class PACKAGE TLetreroDigital : public TGraphicControl
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					    TBorderStyle FBorderStyle;	// Con borde o sin borde
 | 
				
			||||||
 | 
					    TBrush *FBrush;				// Para el relleno del fondo
 | 
				
			||||||
 | 
					    TColor cLED_ON;			// Color de la LED encendida y
 | 
				
			||||||
 | 
					    TColor cLED_OFF;			// apagada
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    AnsiString FFuente;			// Fuente a utilizar ( RAW Format 8x16 )
 | 
				
			||||||
 | 
					    AnsiString FCadena;			// Cadena a mostrar
 | 
				
			||||||
 | 
					    char BitByte;				// Contador de digito actual a cero
 | 
				
			||||||
 | 
					    char currByte;              // Posici<63>n dentro de la frase
 | 
				
			||||||
 | 
					    int AX, AY;				// Ancho X, e Y
 | 
				
			||||||
 | 
					    unsigned int  Flen;			// Longitud de la frase
 | 
				
			||||||
 | 
					    int  TAMx, TAMy;			// Ancho y Alto de las fuentes ( 8 x 16: Deft. )
 | 
				
			||||||
 | 
					    char *ptr_char;				// Puntero a la fuente fija RAW.
 | 
				
			||||||
 | 
					    bool FActivarLD;
 | 
				
			||||||
 | 
					    TTimer *FPulsoReloj;
 | 
				
			||||||
 | 
					    int FFrecReloj;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    enum TFPitchFnt { f_16x16, f_16x8, f_8x16, f_8x8 };
 | 
				
			||||||
 | 
					    TFPitchFnt FPitchFnt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    							// Cambia la relaci<63>n segun indice
 | 
				
			||||||
 | 
					    void __fastcall SetTAMg( TFPitchFnt Index );//, int Index );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Evento OnChange, dirigido a la siguiente funci<63>n:
 | 
				
			||||||
 | 
					    void __fastcall CambioAtributo( TObject  * Sender );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Dibujo del letrero digital (Desde cero SI/NO)
 | 
				
			||||||
 | 
					    void __fastcall DibujaLD( bool RESET );
 | 
				
			||||||
 | 
					    void __fastcall OnTimerHandler(TObject *Sender);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					protected:
 | 
				
			||||||
 | 
						// Redefinimos el m<>todo Paint, que ser<65> llamado cada vez
 | 
				
			||||||
 | 
					    // que sea necesario redibujar el componente.
 | 
				
			||||||
 | 
					    void __fastcall Paint();
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					 								// Cambia la relaci<63>n ALTO/ANCHO "at Run Time".
 | 
				
			||||||
 | 
					    void __fastcall SetAx( int NuevoValor );
 | 
				
			||||||
 | 
					    void __fastcall SetAy( int NuevoValor );
 | 
				
			||||||
 | 
					    void __fastcall SetBrush( TBrush *NuevoValor );
 | 
				
			||||||
 | 
					    void __fastcall SetBorderStyle( TBorderStyle NuevoValor );
 | 
				
			||||||
 | 
					    void __fastcall SetLED_Color( TColor NuevoValorON, TColor NuevoValorOFF );
 | 
				
			||||||
 | 
													// Tipo de letra RAW
 | 
				
			||||||
 | 
					    void __fastcall SetFont( AnsiString NuevoValor );
 | 
				
			||||||
 | 
													// Cambia la relaci<63>n ALTO/ANCHO.
 | 
				
			||||||
 | 
					    void __fastcall SetTAM( int NuevoTAMx, int NuevoTAMy );
 | 
				
			||||||
 | 
					    							// Cambia la cadena a mostrar: "at RunTime"
 | 
				
			||||||
 | 
					    void __fastcall SetCadena( AnsiString NuevaCadena );
 | 
				
			||||||
 | 
					 							    // Frecuencia del reloj
 | 
				
			||||||
 | 
					    void __fastcall SetFrecReloj( int NuevoReloj );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						__fastcall TLetreroDigital(TComponent* Owner);
 | 
				
			||||||
 | 
					    __fastcall ~TLetreroDigital();
 | 
				
			||||||
 | 
					__published:
 | 
				
			||||||
 | 
						__property TBorderStyle BorderStyle = { read = FBorderStyle, write = SetBorderStyle, default=bsSingle };
 | 
				
			||||||
 | 
						__property TBrush *Brush  = { read = FBrush, write = SetBrush };
 | 
				
			||||||
 | 
						__property TColor LED_ON  = { read = cLED_ON,  write = cLED_ON, default = clBlack };
 | 
				
			||||||
 | 
						__property TColor LED_OFF = { read = cLED_OFF, write = cLED_OFF, default = clYellow };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						__property int FrecReloj = { read = FFrecReloj, write = SetFrecReloj, default = 100 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						__property Left   ;
 | 
				
			||||||
 | 
						__property Top    ;
 | 
				
			||||||
 | 
					    __property Width   = { default = 96 };
 | 
				
			||||||
 | 
						__property Height  = { default = 32 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __property TFPitchFnt PitchFuente = { read = FPitchFnt, write = SetTAMg };
 | 
				
			||||||
 | 
					    __property AnsiString FuenteRAW = { read = FFuente, write = SetFont };
 | 
				
			||||||
 | 
					    __property AnsiString Letrero = { read = FCadena, write = SetCadena };
 | 
				
			||||||
 | 
					    __property int AmplitudX      = { read = AX     , write = SetAx     , default = 2 };
 | 
				
			||||||
 | 
					    __property int AmplitudY      = { read = AY     , write = SetAy     , default = 2 };
 | 
				
			||||||
 | 
					  //  __property bool ActivarLD     = { read = FPulsoReloj -> Enabled, write = FPulsoReloj -> Enabled };
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					//---------------------------------------------------------------------------
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								Project1.exe
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Project1.exe
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user