From: Andr? S. <asn...@us...> - 2004-01-10 15:16:46
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1:/tmp/cvs-serv2228/JVCL3/run Modified Files: JvJCLUtils.pas JvJVCLUtils.pas JvThemes.pas Log Message: Changes to make it compile under LINUX Index: JvJCLUtils.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvJCLUtils.pas,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** JvJCLUtils.pas 9 Jan 2004 21:37:59 -0000 1.54 --- JvJCLUtils.pas 10 Jan 2004 15:16:40 -0000 1.55 *************** *** 53,57 **** CopyIconToClipboard(), AssignClipboardIcon(), CreateIconFromClipboard(), GetIconSize(), CreateRealSizeIcon(), DrawRealSizeIcon() ! HasAttr(), FileLock(), FileUnlock(), FileUnlock(), GetWindowsDir(), GetSystemDir(), CreateFileLink(), DeleteFileLink() } --- 53,57 ---- CopyIconToClipboard(), AssignClipboardIcon(), CreateIconFromClipboard(), GetIconSize(), CreateRealSizeIcon(), DrawRealSizeIcon() ! FileLock(), FileUnlock(), FileUnlock(), GetWindowsDir(), GetSystemDir(), CreateFileLink(), DeleteFileLink() } *************** *** 71,75 **** {$ENDIF VCL} {$IFDEF VisualCLX} ! Qt, QGraphics, QClipbrd, QWindows, Types, {$ENDIF VisualCLX} {$IFDEF COMPILER6_UP} --- 71,75 ---- {$ENDIF VCL} {$IFDEF VisualCLX} ! Qt, QStdCtrls, QGraphics, QClipbrd, QWindows, Types, DateUtils, {$ENDIF VisualCLX} {$IFDEF COMPILER6_UP} *************** *** 456,460 **** --- 456,462 ---- { begin JvDateUtil } + {$IFDEF MSWINDOWS} function CurrentYear: Word; + {$ENDIF} function IsLeapYear(AYear: Integer): Boolean; function DaysPerMonth(AYear, AMonth: Integer): Integer; *************** *** 495,501 **** function DefDateMask(BlanksChar: Char; AFourDigitYear: Boolean): string; function FormatLongDate(Value: TDateTime): string; function FormatLongDateTime(Value: TDateTime): string; ! { end JvDateUtil } --- 497,504 ---- function DefDateMask(BlanksChar: Char; AFourDigitYear: Boolean): string; + {$IFDEF MSWINDOWS} function FormatLongDate(Value: TDateTime): string; function FormatLongDateTime(Value: TDateTime): string; ! {$ENDIF} { end JvDateUtil } *************** *** 557,560 **** --- 560,564 ---- { CenterStr centers the characters in the string based upon the Len specified. } + {$IFDEF MSWINDOWS} function CompStr(const S1, S2: string): Integer; { CompStr compares S1 to S2, with case-sensitivity. The return value is *************** *** 563,566 **** --- 567,571 ---- { CompText compares S1 to S2, without case-sensitivity. The return value is the same as for CompStr. } + {$ENDIF} function Copy2Symb(const S: string; Symb: Char): string; { Copy2Symb returns a substring of a string S from begining to first *************** *** 661,667 **** { begin JvFileUtil } function FileDateTime(const FileName: string): TDateTime; - {$IFDEF MSWINDOWS} function HasAttr(const FileName: string; Attr: Integer): Boolean; - {$ENDIF MSWINDOWS} function DeleteFilesEx(const FileMasks: array of string): Boolean; function NormalDir(const DirName: string): string; --- 666,670 ---- *************** *** 965,971 **** function ActivatePrevInstance(const MainFormClass, ATitle: string): Boolean; {$ENDIF BCB} { BrowseForFolder displays Browse For Folder dialog } function BrowseForFolder(const Handle: HWND; const Title: string; var Folder: string): Boolean; ! {$ENDIF VCL} procedure AntiAlias(Clip: TBitmap); --- 968,976 ---- function ActivatePrevInstance(const MainFormClass, ATitle: string): Boolean; {$ENDIF BCB} + {$ENDIF VCL} + {$IFDEF MSWINDOWS} { BrowseForFolder displays Browse For Folder dialog } function BrowseForFolder(const Handle: HWND; const Title: string; var Folder: string): Boolean; ! {$ENDIF} procedure AntiAlias(Clip: TBitmap); *************** *** 3751,3754 **** --- 3756,3760 ---- end; + {$IFDEF WINDOWS} procedure ReadIcon(Stream: TStream; var Icon: HICON; ImageCount: Integer; StartOffset: Integer); *************** *** 3856,3859 **** --- 3862,3866 ---- end; end; + {$ENDIF WINDOWS} {$IFDEF VCL} *************** *** 4297,4300 **** --- 4304,4308 ---- end; + {$IFDEF MSWINDOWS} function CurrentYear: Word; var *************** *** 4304,4307 **** --- 4312,4316 ---- Result := SystemTime.wYear; end; + {$ENDIF} { String to date conversions. Copied from SYSUTILS.PAS unit. } *************** *** 4389,4392 **** --- 4398,4402 ---- function CurrentMonth: Word; + {$IFDEF WINDOWS} var SystemTime: TSystemTime; *************** *** 4395,4398 **** --- 4405,4415 ---- Result := SystemTime.wMonth; end; + {$ENDIF} + {$IFDEF LINUX} + begin + Result := MonthOfTheYear(Now); + end; + {$ENDIF} + {Modified} *************** *** 4660,4663 **** --- 4677,4681 ---- end; + {$IFDEF MSWINDOWS} function FormatLongDate(Value: TDateTime): string; var *************** *** 4678,4681 **** --- 4696,4700 ---- Result := ''; end; + {$ENDIF} function FourDigitYear: Boolean; *************** *** 4945,4948 **** --- 4964,4968 ---- end; + {$IFDEF MSWINDOWS} function CompStr(const S1, S2: string): Integer; begin *************** *** 4956,4959 **** --- 4976,4980 ---- PChar(S1), Length(S1), PChar(S2), Length(S2)) - 2; end; + {$ENDIF} function Copy2Symb(const S: string; Symb: Char): string; *************** *** 5755,5759 **** end; - {$IFDEF MSWINDOWS} function HasAttr(const FileName: string; Attr: Integer): Boolean; var --- 5776,5779 ---- *************** *** 5765,5769 **** Result := (FileAttr >= 0) and (FileAttr and Attr = Attr); end; - {$ENDIF MSWINDOWS} function DeleteFilesEx(const FileMasks: array of string): Boolean; --- 5785,5788 ---- *************** *** 5812,5816 **** --- 5831,5840 ---- var TempDir: string; + {$IFDEF MSWINDOWS} TempFile: array [0..MAX_PATH] of Char; + {$ENDIF} + {$IFDEF LINUX} + TempFile: string; + {$ENDIF} STempDir: TFileName; Res: Integer; *************** *** 5837,5841 **** {$ENDIF MSWINDOWS} {$IFDEF LINUX} ! TempFile := GetTempFileName('~JV'); {$ENDIF LINUX} if Res <> 0 then --- 5861,5865 ---- {$ENDIF MSWINDOWS} {$IFDEF LINUX} ! // TempFile := GetTempFileName('~JV'); {$ENDIF LINUX} if Res <> 0 then *************** *** 6160,6164 **** {$IFDEF LINUX} begin ! if FileExists(LongtName) then Result := LongName else --- 6184,6188 ---- {$IFDEF LINUX} begin ! if FileExists(LongName) then Result := LongName else *************** *** 6290,6294 **** const ! OneMillisecond = 1/24/60/60/1000; function CompareDateTime(const A, B:TDateTime):integer; --- 6314,6318 ---- const ! OneMillisecond = 1/24/60/60/1000; // as TDateTime function CompareDateTime(const A, B:TDateTime):integer; *************** *** 6460,6464 **** {$IFDEF LINUX} begin ! if Directory = '' then Directory := GetCurrentDirectory; Libc.system(PChar(Format('cd "%s" ; "%s" %s &', [Directory, FileName, Parameters]))); end; --- 6484,6488 ---- {$IFDEF LINUX} begin ! if Directory = '' then Directory := GetCurrentDir; Libc.system(PChar(Format('cd "%s" ; "%s" %s &', [Directory, FileName, Parameters]))); end; *************** *** 7451,7455 **** {$WARNINGS ON} {$ENDIF MSWINDOWS} ! {$IFDEF LINUX} Result := Libc.malloc(Size + 4); if Result <> nil then --- 7475,7480 ---- {$WARNINGS ON} {$ENDIF MSWINDOWS} ! {$IFDEF LINUX} ! begin Result := Libc.malloc(Size + 4); if Result <> nil then *************** *** 7458,7462 **** Result := Pointer(Integer(Result) + SizeOf(Integer)); end; ! {$ENDIF LINUX} else Result := nil; --- 7483,7488 ---- Result := Pointer(Integer(Result) + SizeOf(Integer)); end; ! end ! {$ENDIF LINUX} else Result := nil; *************** *** 7887,7890 **** --- 7913,7917 ---- end; end; + {$ENDIF MSWINDOWS} procedure FitRectToScreen(var Rect: TRect); *************** *** 7922,7926 **** end; end; - {$ENDIF MSWINDOWS} procedure CenterWindow(Wnd: HWND); --- 7949,7952 ---- Index: JvJVCLUtils.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvJVCLUtils.pas,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** JvJVCLUtils.pas 10 Jan 2004 12:40:53 -0000 1.61 --- JvJVCLUtils.pas 10 Jan 2004 15:16:40 -0000 1.62 *************** *** 37,42 **** Windows, ShellAPI, Registry, {$ENDIF MSWINDOWS} SysUtils, Classes, - JvClxUtils, {$IFDEF VCL} Messages, Forms, Graphics, Controls, StdCtrls, ExtCtrls, Menus, Dialogs, --- 37,44 ---- Windows, ShellAPI, Registry, {$ENDIF MSWINDOWS} + {$IFDEF LINUX} + Libc, + {$ENDIF} SysUtils, Classes, {$IFDEF VCL} Messages, Forms, Graphics, Controls, StdCtrls, ExtCtrls, Menus, Dialogs, *************** *** 144,148 **** { Execute executes other program and waiting for it terminating, then return its Exit Code } ! function Execute(const CommandLine, WorkingDirectory: string): Integer; // launches the specified CPL file --- 146,150 ---- { Execute executes other program and waiting for it terminating, then return its Exit Code } ! function Execute(const CommandLine: string; WorkingDirectory: string): Integer; // launches the specified CPL file *************** *** 214,220 **** --- 216,224 ---- function WaitCursor: IInterface; function ScreenCursor(ACursor: TCursor): IInterface; + {$IFDEF MSWINDOWS} // loads the more modern looking drag cursors from OLE32.DLL function LoadOLEDragCursors: Boolean; // set some default cursor from JVCL + {$ENDIF} procedure SetDefaultJVCLCursors; *************** *** 580,586 **** uses ! Consts, SysConst, CommCtrl, MMSystem, ShlObj, ActiveX, Math, ! JclSysInfo, ! JvConsts, JvProgressUtils, JvResources; {$IFDEF MSWINDOWS} --- 584,596 ---- uses ! SysConst, ! {$IFDEF VCL} ! Consts, CommCtrl, MMSystem, ShlObj, ActiveX, ! {$ENDIF} ! {$IFDEF VisualCLX} ! QConsts, ! {$ENDIF} ! Math, ! JclSysInfo, JvConsts, JvProgressUtils, JvResources; {$IFDEF MSWINDOWS} *************** *** 632,636 **** end; - {$IFDEF MSWINDOWS} {$IFDEF VCL} --- 642,645 ---- *************** *** 703,706 **** --- 712,716 ---- procedure RGBToHSV(R, G, B: Integer; var H, S, V: Integer); + {$IFDEF VCL} var Delta: Integer; *************** *** 748,751 **** --- 758,771 ---- end; end; + {$ENDIF} + {$IFDEF VisualCLX} + var + QC: QColorH; + begin + QC := QColor_create(R, G , B); + QColor_getHsv(QC, @H, @S, @V); + QColor_destroy(QC); + end; + {$ENDIF} (* (rom) to be deleted. Use ScreenShot from JCL *************** *** 820,823 **** --- 840,844 ---- *) + {$IFDEF MSWINDOWS} procedure SetWallpaper(const Path: string); begin *************** *** 1015,1019 **** // (rom) a thread to wait would be more elegant, also JCL function available ! function Execute(const CommandLine, WorkingDirectory: string): Integer; {$IFDEF MSWINDOWS} var --- 1036,1040 ---- // (rom) a thread to wait would be more elegant, also JCL function available ! function Execute(const CommandLine: string; WorkingDirectory: string): Integer; {$IFDEF MSWINDOWS} var *************** *** 1052,1056 **** {$IFDEF LINUX} begin ! if WorkingDirectory = '' then WorkingDirectory := GetCurrentDirectory; Result := Libc.system(PChar(Format('cd "%s" ; %s', [WorkingDirectory, CommandLine]))); --- 1073,1077 ---- {$IFDEF LINUX} begin ! if WorkingDirectory = '' then WorkingDirectory := GetCurrentDir; Result := Libc.system(PChar(Format('cd "%s" ; %s', [WorkingDirectory, CommandLine]))); *************** *** 1252,1267 **** begin Result := []; if HasFlag(State, LVIS_ACTIVATING) then Include(Result, isActivating); - {$IFDEF VCL} if HasFlag(State, LVIS_CUT) then Include(Result, isCut); if HasFlag(State, LVIS_DROPHILITED) then Include(Result, isDropHilited); - {$ENDIF VCL} if HasFlag(State, LVIS_FOCUSED) then Include(Result, IsFocused); if HasFlag(State, LVIS_SELECTED) then Include(Result, isSelected); end; --- 1273,1288 ---- begin Result := []; + {$IFDEF VCL} if HasFlag(State, LVIS_ACTIVATING) then Include(Result, isActivating); if HasFlag(State, LVIS_CUT) then Include(Result, isCut); if HasFlag(State, LVIS_DROPHILITED) then Include(Result, isDropHilited); if HasFlag(State, LVIS_FOCUSED) then Include(Result, IsFocused); if HasFlag(State, LVIS_SELECTED) then Include(Result, isSelected); + {$ENDIF VCL} end; *************** *** 2329,2333 **** --- 2350,2356 ---- function ScreenWorkArea: TRect; begin + {$IFDEF MSWINDOWS} if not SystemParametersInfo(SPI_GETWORKAREA, 0, @Result, 0) then + {$ENDIF} with Screen do Result := Bounds(0, 0, Width, Height); *************** *** 2710,2713 **** --- 2733,2737 ---- end; + {$IFDEF MSWINDOWS} function LoadOLEDragCursors: Boolean; const *************** *** 2735,2738 **** --- 2759,2763 ---- end; end; + {$ENDIF} procedure SetDefaultJVCLCursors; Index: JvThemes.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvThemes.pas,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** JvThemes.pas 6 Jan 2004 21:22:58 -0000 1.32 --- JvThemes.pas 10 Jan 2004 15:16:40 -0000 1.33 *************** *** 48,59 **** {$ENDIF VCL} {$IFDEF VisualCLX} ! QControls, QForms, QGraphics, QButtons, {$ENDIF VisualCLX} SysUtils, Classes; const // Add a message handler to a component that is themed by the ThemeManager but // should not be themed. CM_DENYSUBCLASSING = CM_BASE + 2000; // from ThemeMgr.pas type --- 48,61 ---- {$ENDIF VCL} {$IFDEF VisualCLX} ! QControls, QForms, QGraphics, QButtons, Types, {$ENDIF VisualCLX} SysUtils, Classes; + {$IFDEF VCL} const // Add a message handler to a component that is themed by the ThemeManager but // should not be themed. CM_DENYSUBCLASSING = CM_BASE + 2000; // from ThemeMgr.pas + {$ENDIF} type |