|
From: Andr? S. <asn...@us...> - 2004-01-27 06:53:21
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28152/JVCL3/run Modified Files: JvJCLUtils.pas JvJVCLUtils.pas Log Message: (Re) moved SetRect, Fixes, OpenObject is now OS independant Index: JvJCLUtils.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvJCLUtils.pas,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** JvJCLUtils.pas 19 Jan 2004 18:28:42 -0000 1.60 --- JvJCLUtils.pas 25 Jan 2004 21:41:24 -0000 1.61 *************** *** 17,21 **** Contributor(s): ! Last Modified: 2003-11-05 You may retrieve the latest version of this file at the Project JEDI's JVCL home page, --- 17,21 ---- Contributor(s): ! Last Modified: 2004-01-24 You may retrieve the latest version of this file at the Project JEDI's JVCL home page, *************** *** 71,75 **** {$ENDIF VCL} {$IFDEF VisualCLX} ! Qt, QStdCtrls, QGraphics, QClipbrd, Types, QWindows, {$ENDIF VisualCLX} {$IFDEF COMPILER6_UP} --- 71,75 ---- {$ENDIF VCL} {$IFDEF VisualCLX} ! Qt, QStdCtrls, QGraphics, QClipbrd, Types, QWindows, {$ENDIF VisualCLX} {$IFDEF COMPILER6_UP} *************** *** 80,84 **** const {$IFDEF MSWINDOWS} ! PathDelim = '\'; DriveDelim = ':'; PathSep = ';'; --- 80,84 ---- const {$IFDEF MSWINDOWS} ! PathDelim = '\'; DriveDelim = ':'; PathSep = ';'; *************** *** 290,296 **** { TrueInflateRect inflates rect in other method, than InflateRect API function } function TrueInflateRect(const R: TRect; const I: Integer): TRect; - {$IFDEF LINUX} - procedure SetRect(out R: TRect; Left, Top, Right, Bottom: Integer); - {$ENDIF LINUX} {**** other routines } --- 290,293 ---- *************** *** 392,395 **** --- 389,394 ---- { TextWidth calculate text with for writing using standard desktop font } function TextWidth(const AStr: string): Integer; + { TextHeight calculate text height for writing using standard desktop font } + function TextHeight(const AStr: string): Integer; procedure SetChildPropOrd(Owner: TComponent; const PropName: string; Value: Longint); *************** *** 709,717 **** { moved from JvJVCLUTils } - {$IFDEF MSWINDOWS} //Open an object with the shell (url or something like that) function OpenObject(Value: PChar): Boolean; overload; function OpenObject(const Value: string): Boolean; overload; //Raise the last Exception procedure RaiseLastWin32; overload; --- 708,716 ---- { moved from JvJVCLUTils } //Open an object with the shell (url or something like that) function OpenObject(Value: PChar): Boolean; overload; function OpenObject(const Value: string): Boolean; overload; + {$IFDEF MSWINDOWS} //Raise the last Exception procedure RaiseLastWin32; overload; *************** *** 1557,1570 **** end; - {$IFDEF LINUX} - procedure SetRect(out R: TRect; Left, Top, Right, Bottom: Integer); - begin - R.Left := Left; - R.Top := Top; - R.Right := Right; - R.Bottom := Bottom; - end; - {$ENDIF LINUX} - function FileGetInfo(FileName: TFileName; var SearchRec: TSearchRec): Boolean; var --- 1556,1559 ---- *************** *** 3043,3046 **** --- 3032,3056 ---- {$ENDIF MSWINDOWS} + function TextHeight(const AStr: string): Integer; + var + Canvas: TCanvas; + DC: HDC; + begin + DC := GetDC(HWND_DESKTOP); + Canvas := TCanvas.Create; + try + Canvas.Handle := DC; + Result := Canvas.TextHeight(AStr); + {$IFDEF VCL} + Canvas.Handle := 0; + {$ELSE} + Canvas.Handle := nil; + {$ENDIF VCL} + finally + ReleaseDC(HWND_DESKTOP, DC); + Canvas.Free; + end; + end; + function TextWidth(const AStr: string): Integer; *************** *** 6372,6376 **** end; - {$IFDEF MSWINDOWS} function OpenObject(const Value: string): Boolean; overload; begin --- 6382,6385 ---- *************** *** 6385,6388 **** --- 6394,6399 ---- end; + {$IFDEF MSWINDOWS} + procedure RaiseLastWin32; overload; begin *************** *** 6478,6484 **** end; procedure Exec(FileName, Parameters, Directory: string); - {$IFDEF MSWINDOWS} var Operation: string; --- 6489,6501 ---- end; + {$IFDEF LINUX} + // for Exec function + function GetForegroundWindow: QWidgetH; + begin + Result := nil; // QWindows ShellExececute ignores handle under linux + end; + {$ENDIF LINUX} procedure Exec(FileName, Parameters, Directory: string); var Operation: string; *************** *** 6488,6497 **** SW_SHOWNORMAL); end; - {$ENDIF MSWINDOWS} {$IFDEF LINUX} ! begin ! if Directory = '' then Directory := GetCurrentDir; ! Libc.system(PChar(Format('cd "%s" ; "%s" %s &', [Directory, FileName, Parameters]))); ! end; {$ENDIF LINUX} --- 6505,6513 ---- SW_SHOWNORMAL); end; {$IFDEF LINUX} ! // begin ! // if Directory = '' then Directory := GetCurrentDir; ! // Libc.system(PChar(Format('cd "%s" ; "%s" %s &', [Directory, FileName, Parameters]))); ! // end; {$ENDIF LINUX} *************** *** 6522,6526 **** begin // ignore Visibility ! Libc.system(PChar(FileName)); end; {$ENDIF LINUX} --- 6538,6543 ---- begin // ignore Visibility ! Libc.system(PChar(Format('kfmclient exec "%s"', [FileName])); ! // Libc.system(PChar(FileName)); end; {$ENDIF LINUX} Index: JvJVCLUtils.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvJVCLUtils.pas,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** JvJVCLUtils.pas 24 Jan 2004 17:19:53 -0000 1.68 --- JvJVCLUtils.pas 25 Jan 2004 21:41:36 -0000 1.69 *************** *** 451,462 **** function ScreenColorCount: Integer; - procedure TileImage(Canvas: TCanvas; Rect: TRect; Image: TGraphic); - function ZoomImage(ImageW, ImageH, MaxW, MaxH: Integer; Stretch: Boolean): - TPoint; - var DefaultMappingMethod: TMappingMethod = mmHistogram; {$ENDIF VCL} type TJvGradientOptions = class(TPersistent) --- 451,462 ---- function ScreenColorCount: Integer; var DefaultMappingMethod: TMappingMethod = mmHistogram; {$ENDIF VCL} + procedure TileImage(Canvas: TCanvas; Rect: TRect; Image: TGraphic); + function ZoomImage(ImageW, ImageH, MaxW, MaxH: Integer; Stretch: Boolean): + TPoint; + type TJvGradientOptions = class(TPersistent) *************** *** 2463,2483 **** Brush: HBRUSH; begin - if IsRectEmpty(ARect) and (GetMapMode(Canvas.Handle) = MM_TEXT) then - Exit; {$IFDEF VisualCLX} Canvas.Start; try {$ENDIF VisualCLX} ! if Colors < 2 then begin ! Brush := CreateSolidBrush(ColorToRGB(StartColor)); ! FillRect(Canvas.Handle, ARect, Brush); ! DeleteObject(Brush); ! Exit; ! end; ! StartColor := ColorToRGB(StartColor); ! EndColor := ColorToRGB(EndColor); ! case Direction of ! fdTopToBottom, fdLeftToRight: begin { Set the Red, Green and Blue colors } --- 2463,2484 ---- Brush: HBRUSH; begin {$IFDEF VisualCLX} Canvas.Start; try {$ENDIF VisualCLX} ! if Not (IsRectEmpty(ARect) and ! (GetMapMode(Canvas.Handle) = MM_TEXT) ) then begin ! if Colors < 2 then ! begin ! Brush := CreateSolidBrush(ColorToRGB(StartColor)); ! FillRect(Canvas.Handle, ARect, Brush); ! DeleteObject(Brush); ! Exit; ! end; ! StartColor := ColorToRGB(StartColor); ! EndColor := ColorToRGB(EndColor); ! case Direction of ! fdTopToBottom, fdLeftToRight: begin { Set the Red, Green and Blue colors } *************** *** 2579,2582 **** --- 2580,2584 ---- end; {$IFDEF VisualCLX} + end; // if Not (IsRectEmpty(ARect) and ... finally Canvas.Stop; *************** *** 5450,5453 **** --- 5452,5456 ---- SetBitmapPixelFormat(Bitmap, pf8bit, mmGrayscale); end; + {$ENDIF VCL} function ZoomImage(ImageW, ImageH, MaxW, MaxH: Integer; Stretch: Boolean): *************** *** 5500,5504 **** end; end; - {$ENDIF VCL} //=== TJvGradientOptions ============================================================ --- 5503,5506 ---- |