Source code of file oscpmwin_v0.4.1.723/pimgzoom.pas from the
osCommerce Product Manager for Windows.


0000:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001:   osCommerce Product Manager for Windows (oscpmwin).
0002:   Copyright �2003-2006 by Mario A. Valdez-Ramirez.
0003:   
0004:   You can contact Mario A. Valdez-Ramirez
0005:   by email at mario@mariovaldez.org or paper mail at
0006:   Olmos 809, San Nicolas, NL. 66495, Mexico.
0007:   
0008:   This program is free software; you can redistribute it and/or modify
0009:   it under the terms of the GNU General Public License as published by
0010:   the Free Software Foundation; either version 2 of the License, or (at
0011:   your option) any later version.
0012:   
0013:   This program is distributed in the hope that it will be useful, but
0014:   WITHOUT ANY WARRANTY; without even the implied warranty of
0015:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0016:   General Public License for more details.
0017:   
0018:   You should have received a copy of the GNU General Public License
0019:   along with this program; if not, write to the Free Software
0020:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0021:   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0022:   unit pimgzoom;
0023:   
0024:   interface
0025:   
0026:   uses
0027:     Windows, Classes, Graphics, Controls, Forms, ExtCtrls;
0028:   
0029:   type
0030:     Topm_Form_ImageZoom = class(TForm)
0031:       opm_Image_ZoomImage: TImage;
0032:       procedure opm_Image_ZoomImageClick(Sender: TObject);
0033:       procedure FormShow(Sender: TObject);
0034:       procedure FormCreate(Sender: TObject);
0035:       procedure FormDeactivate(Sender: TObject);
0036:       procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
0037:       procedure FormHide(Sender: TObject);
0038:     private
0039:     public
0040:     end;
0041:   
0042:   var
0043:     opm_Form_ImageZoom: Topm_Form_ImageZoom;
0044:   
0045:   implementation
0046:   
0047:   uses gnugettext, oscpmdata, attention;
0048:   
0049:   {$R *.dfm}
0050:   
0051:   
0052:   
0053:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0054:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0055:   procedure Topm_Form_ImageZoom.opm_Image_ZoomImageClick(Sender: TObject);
0056:   begin
0057:     PRopm_Sound ('RestoreDown', opmG_UISilent);
0058:     opm_Form_ImageZoom.Close;
0059:   end;
0060:   
0061:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0062:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0063:   procedure Topm_Form_ImageZoom.FormShow(Sender: TObject);
0064:   VAR
0065:     MaxX, MaxY, WSizeX, WSizeY : LONGINT;
0066:   begin
0067:     MaxX := Screen.WorkAreaWidth;
0068:     MaxY := Screen.WorkAreaHeight;
0069:     WSizeX := (opm_Form_ImageZoom.Width - opm_Form_ImageZoom.ClientWidth) + opm_Image_ZoomImage.Picture.Width;
0070:     WSizeY := (opm_Form_ImageZoom.Height - opm_Form_ImageZoom.ClientHeight) + opm_Image_ZoomImage.Picture.Height;
0071:     IF (WSizeX > MaxX) THEN
0072:       BEGIN
0073:         opm_Form_ImageZoom.Width := MaxX;
0074:         HorzScrollBar.Range := opm_Image_ZoomImage.Picture.Width;
0075:         HorzScrollBar.Position := 0;
0076:       END
0077:     ELSE
0078:       BEGIN
0079:         opm_Form_ImageZoom.ClientWidth := opm_Image_ZoomImage.Picture.Width;
0080:         HorzScrollBar.Range := opm_Image_ZoomImage.Picture.Width;
0081:       END;
0082:     IF (WSizeY > MaxY) THEN
0083:       BEGIN
0084:         opm_Form_ImageZoom.Height := MaxY;
0085:         VertScrollBar.Range := opm_Image_ZoomImage.Picture.Height;
0086:         VertScrollBar.Position := 0;
0087:       END
0088:     ELSE
0089:       BEGIN
0090:         opm_Form_ImageZoom.ClientHeight := opm_Image_ZoomImage.Picture.Height;
0091:         VertScrollBar.Range := opm_Image_ZoomImage.Picture.Height;
0092:       END;
0093:     opm_Image_ZoomImage.Hint := opm_Image_ZoomImage.Hint + #13#10#13#10 + _('Click to close...');
0094:     opm_Form_ImageZoom.Top := ((MaxY - opm_Form_ImageZoom.Height) DIV 2);
0095:     opm_Form_ImageZoom.Left := ((MaxX - opm_Form_ImageZoom.Width) DIV 2);
0096:     PRopm_Sound ('RestoreUp', opmG_UISilent);
0097:   end;
0098:   
0099:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0100:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0101:   procedure Topm_Form_ImageZoom.FormCreate(Sender: TObject);
0102:   begin
0103:     opm_Image_ZoomImage.Cursor := crHandPoint;
0104:     TranslateComponent (self);
0105:   end;
0106:   
0107:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0108:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0109:   procedure Topm_Form_ImageZoom.FormDeactivate(Sender: TObject);
0110:   begin
0111:     PRopm_Sound ('RestoreDown', opmG_UISilent);
0112:     opm_Form_ImageZoom.Close;
0113:   end;
0114:   
0115:   
0116:   
0117:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0118:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0119:   procedure Topm_Form_ImageZoom.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
0120:   begin
0121:     CASE Key OF
0122:       VK_RETURN, VK_SPACE, VK_ESCAPE : opm_Form_ImageZoom.Close;
0123:       VK_LEFT : HorzScrollBar.Position := HorzScrollBar.Position - HorzScrollBar.Increment;
0124:       VK_RIGHT : HorzScrollBar.Position := HorzScrollBar.Position + HorzScrollBar.Increment;
0125:       VK_UP : VertScrollBar.Position := VertScrollBar.Position - VertScrollBar.Increment;
0126:       VK_DOWN : VertScrollBar.Position := VertScrollBar.Position + VertScrollBar.Increment;
0127:     END;
0128:   end;
0129:   
0130:   
0131:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0132:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0133:   procedure Topm_Form_ImageZoom.FormHide(Sender: TObject);
0134:   begin
0135:     opm_Image_ZoomImage.Picture := NIL;
0136:   end;
0137:   
0138:   end.
 
 
NA fum/lmd: 2007.07.15
Copyright ©1994-2024 by Mario A. Valdez-Ramírez.
no siga este enlace / do not follow this link