Thread: [Glxtreem-commits] GLXtreem/Source/Designtime GLXTextureEditor.dfm,NONE,1.1 GLXTextureEditor.pas,NON
Brought to you by:
andreaz
|
From: Andreas L. <an...@us...> - 2004-04-01 18:03:15
|
Update of /cvsroot/glxtreem/GLXtreem/Source/Designtime In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3770/Source/Designtime Modified Files: GLXResourceSourceEditor.pas Added Files: GLXTextureEditor.dfm GLXTextureEditor.pas Log Message: texture in the resource editor Index: GLXResourceSourceEditor.pas =================================================================== RCS file: /cvsroot/glxtreem/GLXtreem/Source/Designtime/GLXResourceSourceEditor.pas,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GLXResourceSourceEditor.pas 1 Apr 2004 01:14:21 -0000 1.1 --- GLXResourceSourceEditor.pas 1 Apr 2004 17:51:13 -0000 1.2 *************** *** 192,195 **** --- 192,196 ---- try ResEdit:=Resource as IEditor; + if ResEdit.Edit then begin fSource.Save(Resource); --- NEW FILE: GLXTextureEditor.pas --- unit GLXTextureEditor; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, GLXTexture, StdCtrls, ExtCtrls, ExtDlgs; type TTGLXTextureEditorForm = class(TForm) InfoLabel: TLabel; Load: TButton; OpenPictureDialog1: TOpenPictureDialog; Button1: TButton; Bevel1: TBevel; Panel1: TPanel; Shape: TShape; ViewBox: TImage; NoneLabel: TLabel; Bevel2: TBevel; Button2: TButton; Button3: TButton; procedure LoadClick(Sender: TObject); procedure UpdatePreview(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure Button1Click(Sender: TObject); procedure OKButtonClick(Sender: TObject); procedure CancelButtonClick(Sender: TObject); private { Private declarations } FTexture: TGLXTexture; FPreview: TBitmap; procedure SetTexture(const Value: TGLXTexture); public { Public declarations } Property Texture: TGLXTexture write SetTexture; end; var Form: TTGLXTextureEditorForm; implementation {$R *.dfm} //------------------------------------------------------------------------------ procedure TTGLXTextureEditorForm.FormCreate(Sender: TObject); begin FPreview:= TBitmap.Create; end; //------------------------------------------------------------------------------ procedure TTGLXTextureEditorForm.FormDestroy(Sender: TObject); begin FPreview.Free; end; //------------------------------------------------------------------------------ procedure TTGLXTextureEditorForm.SetTexture(const Value: TGLXTexture); begin FTexture:=Value; UpdatePreview(nil); end; //------------------------------------------------------------------------------ procedure TTGLXTextureEditorForm.LoadClick(Sender: TObject); begin IF OpenPictureDialog1.Execute then begin FTexture.LoadTexture(OpenPictureDialog1.FileName); end; UpdatePreview(nil); end; //------------------------------------------------------------------------------ procedure TTGLXTextureEditorForm.Button1Click(Sender: TObject); begin Case FTexture.Format of gtNone : ; gtBitmap: begin FTexture.Bitmap.Width:=0; FTexture.Bitmap.Height:=0; end; gtJpeg : begin FTexture.Jpeg .Width:=0; FTexture.Jpeg .Height:=0; end; gtTarga : begin FTexture.Targa .Width:=0; FTexture.Targa .Height:=0; end; gtPng : begin FTexture.Png .Width:=0; FTexture.Png .Height:=0; end; end; FTexture.Format:=gtNone; UpdatePreview(nil); end; //------------------------------------------------------------------------------ procedure TTGLXTextureEditorForm.UpdatePreview(Sender: TObject); begin Case FTexture.Format of gtNone : ViewBox.Picture.Graphic := nil; gtBitmap: ViewBox.Picture.Assign( FTexture.Bitmap ); gtJpeg : ViewBox.Picture.Assign( FTexture.Jpeg ); gtTarga : ViewBox.Picture.Assign( FTexture.Targa ); gtPng : ViewBox.Picture.Assign( FTexture.Png ); end; Case FTexture.Format of gtNone : InfoLabel.Caption:='No image'#13; gtBitmap: InfoLabel.Caption:='Image: bmp'#13; gtJpeg : InfoLabel.Caption:='Image: jpg'#13; gtTarga : InfoLabel.Caption:='Image: tga'#13; gtPng : InfoLabel.Caption:='Image: png'#13; end; NoneLabel.Visible:= FTexture.Format = gtNone; InfoLabel.Visible:= FTexture.Format <> gtNone; InfoLabel.Caption:=InfoLabel.Caption + Format('Width: %d'#13'Height: %d', [FTexture.Width, FTexture.Height]); end; //------------------------------------------------------------------------------ procedure TTGLXTextureEditorForm.OKButtonClick(Sender: TObject); begin ModalResult:=mrOK; end; //------------------------------------------------------------------------------ procedure TTGLXTextureEditorForm.CancelButtonClick(Sender: TObject); begin ModalResult:=mrCancel; end; end. --- NEW FILE: GLXTextureEditor.dfm --- object TGLXTextureEditorForm: TTGLXTextureEditorForm Left = 573 Top = 352 BorderStyle = bsToolWindow Caption = 'TGLXTextureEditorForm' ClientHeight = 306 ClientWidth = 356 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate OnDestroy = FormDestroy PixelsPerInch = 96 TextHeight = 13 object Bevel2: TBevel Left = 272 Top = 72 Width = 73 Height = 81 end object InfoLabel: TLabel Left = 280 Top = 80 Width = 44 Height = 13 Caption = 'InfoLabel' end object Bevel1: TBevel Left = 8 Top = 8 Width = 257 Height = 289 Shape = bsFrame end object Load: TButton Left = 24 Top = 264 Width = 75 Height = 25 Caption = '&Load...' TabOrder = 0 OnClick = LoadClick end object Button1: TButton Left = 104 Top = 264 Width = 75 Height = 25 Caption = '&Clear' TabOrder = 1 OnClick = Button1Click end object Panel1: TPanel Left = 16 Top = 16 Width = 241 Height = 241 BevelOuter = bvNone BorderStyle = bsSingle Color = clWhite TabOrder = 2 object Shape: TShape Left = -10 Top = -10 Width = 251 Height = 251 Brush.Color = clBlack Brush.Style = bsDiagCross end object ViewBox: TImage Left = 6 Top = 6 Width = 228 Height = 228 Center = True Stretch = True end object NoneLabel: TLabel Left = 102 Top = 112 Width = 32 Height = 13 Alignment = taCenter Caption = '(None)' end end object Button2: TButton Left = 272 Top = 8 Width = 75 Height = 25 Caption = 'Ok' Default = True TabOrder = 3 OnClick = OKButtonClick end object Button3: TButton Left = 272 Top = 40 Width = 75 Height = 25 Cancel = True Caption = 'Cancel' TabOrder = 4 OnClick = OKButtonClick end object OpenPictureDialog1: TOpenPictureDialog Filter = 'All (*.bmp, *.tga, *.jpg)|*.bmp;*.tga;*.jpg|Windows Bitmap (*.bm' + 'p)|*.bmp|Truevision Targa (*.tga)|*.tga|JPEG Image File (*.jpg)|' + '*.jpg' Options = [ofHideReadOnly, ofAllowMultiSelect, ofEnableSizing] Left = 34 Top = 39 end end |