diff --git a/lcl/include/canvas.inc b/lcl/include/canvas.inc index f64c428ee4..2a8069bc4d 100644 --- a/lcl/include/canvas.inc +++ b/lcl/include/canvas.inc @@ -144,6 +144,15 @@ end; ------------------------------------------------------------------------------} procedure TCanvas.CreatePen; var OldHandle: HPEN; +const PenModes:Array[TPenMode] of Integer = + ( R2_BLACK, R2_WHITE, R2_NOP, R2_NOT, R2_COPYPEN, R2_NOTCOPYPEN, R2_MERGEPENNOT, + R2_MASKPENNOT, R2_MERGENOTPEN, R2_MASKNOTPEN, R2_MERGEPEN, R2_NOTMERGEPEN, + R2_MASKPEN, R2_NOTMASKPEN, R2_XORPEN, R2_NOTXORPEN ); +{ + TPenMode = (pmBlack, pmWhite, pmNop, pmNot, pmCopy, pmNotCopy, pmMergePenNot, + pmMaskPenNot, pmMergeNotPen, pmMaskNotPen, pmMerge,pmNotMerge, + pmMask, pmNotMask, pmXor, pmNotXor +} begin //DebugLn('[TCanvas.CreatePen] ',Classname,' Self=',HexStr(Cardinal(Pointer(Self)),8) // ,' Pen=',HexStr(Cardinal(Pointer(Pen)),8)); @@ -152,7 +161,7 @@ begin FSavedPenHandle:=OldHandle; SetPenPos(FPenPos); Include(FState, csPenValid); -// SetROP2(FHandle, PenModes[Pen.Mode]); + SetROP2(FHandle, PenModes[Pen.Mode]); end; {------------------------------------------------------------------------------ @@ -1268,6 +1277,9 @@ end; { ============================================================================= $Log$ + Revision 1.86 2005/01/08 11:03:18 mattias + implemented TPen.Mode=pmXor from Jesus + Revision 1.85 2005/01/01 20:05:08 mattias accelerated code completion box in IDE and replaced ExtTextOut with ExtUTF8Out in TCanvas.TextOut diff --git a/lcl/include/intfbasewinapi.inc b/lcl/include/intfbasewinapi.inc index 5003ce1d2d..0db10fe32a 100644 --- a/lcl/include/intfbasewinapi.inc +++ b/lcl/include/intfbasewinapi.inc @@ -849,6 +849,11 @@ begin Result := SIMPLEREGION; end; +Function TWidgetSet.GetROP2(DC: HDC): Integer; +begin + Result := 0; +end; + function TWidgetSet.GetScrollInfo(Handle: HWND; SBStyle: Integer; var ScrollInfo: TScrollInfo): Boolean; begin @@ -1293,6 +1298,11 @@ Begin Result := True; end; +function TWidgetSet.SetROP2(DC: HDC; Mode: Integer): Integer; +begin + Result := 0; +end; + function TWidgetSet.SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; Redraw : Boolean): Integer; begin @@ -1404,6 +1414,9 @@ end; { ============================================================================= $Log$ + Revision 1.16 2005/01/08 11:03:18 mattias + implemented TPen.Mode=pmXor from Jesus + Revision 1.15 2004/12/19 19:29:04 marc * x86_64 fix: Conversion if integer to pointer diff --git a/lcl/include/winapi.inc b/lcl/include/winapi.inc index 0234e124b6..3c987a348e 100644 --- a/lcl/include/winapi.inc +++ b/lcl/include/winapi.inc @@ -374,6 +374,11 @@ begin Result := InterfaceObject.GetRGNBox(RGN, lpRect); end; +function GetROP2(DC: HDC): integer; +begin + result := InterfaceObject.GetROP2(DC); +end; + function GetScrollInfo(Handle: HWND; SBStyle: Integer; var ScrollInfo: TScrollInfo): Boolean; begin Result := InterfaceObject.GetScrollInfo(Handle, SBStyle, ScrollInfo); @@ -681,6 +686,11 @@ Begin Result := InterfaceObject.SetProp(Handle,Str,Data); end; +function SetROP2(DC: HDC; Mode: Integer): Integer; +begin + Result := InterfaceObject.SetRop2(Dc, Mode); +end; + Function SelectClipRGN(DC : hDC; RGN : HRGN) : Longint; begin Result := InterfaceObject.SelectClipRGN(DC, RGN); @@ -1315,6 +1325,9 @@ end; { ============================================================================= $Log$ + Revision 1.116 2005/01/08 11:03:18 mattias + implemented TPen.Mode=pmXor from Jesus + Revision 1.115 2005/01/07 18:40:10 mattias clean up, added GetRGBValues diff --git a/lcl/include/winapih.inc b/lcl/include/winapih.inc index db6c58a619..f74201d44f 100644 --- a/lcl/include/winapih.inc +++ b/lcl/include/winapih.inc @@ -122,6 +122,7 @@ function GetPaletteEntries(Palette: HPALETTE; StartIndex, NumEntries: UINT; Function GetParent(Handle : HWND): HWND; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} Function GetProp(Handle : hwnd; Str : PChar): Pointer;{$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} Function GetRgnBox(RGN : HRGN; lpRect : PRect) : Longint; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} +function GetROP2(DC: HDC): integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function GetScrollInfo(Handle: HWND; SBStyle: Integer; var ScrollInfo: TScrollInfo): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} //function GetScrollPos --> independent //function GetScrollRange --> independent @@ -202,6 +203,7 @@ function SetMapMode(DC: HDC; MapMode: Integer): Integer; {$IFDEF IF_BASE_MEMBER} Function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} //function SetRect --> independent //function SetRectEmpty --> independent +function SetROP2(DC: HDC; Mode: Integer): Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function SetScrollInfo(Handle: HWND; SBStyle: Integer; ScrollInfo: TScrollInfo; Redraw : Boolean): Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} //function SetScrollPos --> independent //function SetScrollRange --> independent @@ -297,6 +299,9 @@ function RGB(R, G, B : Byte) : TColorRef; { ============================================================================= $Log$ + Revision 1.103 2005/01/08 11:03:18 mattias + implemented TPen.Mode=pmXor from Jesus + Revision 1.102 2005/01/07 18:40:10 mattias clean up, added GetRGBValues diff --git a/lcl/interfaces/gtk/gtkint.pp b/lcl/interfaces/gtk/gtkint.pp index 2b5830551e..f914088188 100644 --- a/lcl/interfaces/gtk/gtkint.pp +++ b/lcl/interfaces/gtk/gtkint.pp @@ -235,6 +235,8 @@ type procedure ResizeChild(Sender : TObject; Left,Top,Width,Height : Integer);virtual; procedure RemoveCallbacks(Widget: PGtkWidget); virtual; + function ROP2ModeToGdkFunction(Mode: Integer): TGdkFunction; + function gdkFunctionToROP2Mode(aFunction: TGdkFunction): Integer; public // for gtk specific components: procedure SetLabelCaption(const ALabel: PGtkLabel; const ACaption: String; const AComponent: TComponent; const ASignalWidget: PGTKWidget; const ASignal: PChar); virtual; @@ -430,6 +432,9 @@ end. { ============================================================================= $Log$ + Revision 1.218 2005/01/08 11:03:18 mattias + implemented TPen.Mode=pmXor from Jesus + Revision 1.217 2004/10/16 15:36:49 mattias implemented gtkwscomctrls.TGtkWSStatusBar diff --git a/lcl/interfaces/gtk/gtkobject.inc b/lcl/interfaces/gtk/gtkobject.inc index 5d3f62cdd8..756a47115b 100644 --- a/lcl/interfaces/gtk/gtkobject.inc +++ b/lcl/interfaces/gtk/gtkobject.inc @@ -6896,6 +6896,52 @@ begin CleanUpFont; end; +function TGtkWidgetSet.ROP2ModeToGdkFunction(Mode: IntegeR): TGdkFunction; +begin + case Mode of + R2_COPYPEN: result := GDK_COPY; + R2_NOT: result := GDK_INVERT; + R2_XORPEN: result := GDK_XOR; + R2_BLACK: result := GDK_CLEAR; + R2_MASKPEN: result := GDK_AND; + R2_MASKPENNOT: result := GDK_AND_REVERSE; + R2_MASKNOTPEN: result := GDK_AND_INVERT; + R2_NOP: result := GDK_NOOP; + R2_MERGEPEN: result := GDK_OR; + R2_NOTXORPEN: result := GDK_EQUIV; + R2_MERGEPENNOT: result := GDK_OR_REVERSE; + R2_NOTCOPYPEN: result := GDK_COPY_INVERT; + R2_NOTMASKPEN: result := GDK_NAND; + //R2_NOTMERGEPEN: result := GDK_NOR; + R2_WHITE: result := GDK_SET; + else + result := GDK_COPY; + end; +end; + +function TGtkWidgetSet.GdkFunctionToROP2Mode(aFunction: TGdkFunction): Integer; +begin + case aFunction of + GDK_COPY: result := R2_COPYPEN; + GDK_INVERT: result := R2_NOT; + GDK_XOR: result := R2_XORPEN; + GDK_CLEAR: result := R2_BLACK; + GDK_AND: result := R2_MASKPEN; + GDK_AND_REVERSE: result := R2_MASKPENNOT; + GDK_AND_INVERT: result := R2_MASKNOTPEN; + GDK_NOOP: result := R2_NOP; + GDK_OR: result := R2_MERGEPEN; + GDK_EQUIV: result := R2_NOTXORPEN; + GDK_OR_REVERSE: result := R2_MERGEPENNOT; + GDK_COPY_INVERT: result := R2_NOTCOPYPEN; + GDK_NAND: result := R2_NOTMASKPEN; + //GDK_NOR: result := R2_NOTMERGEPEN; + GDK_SET: result := R2_WHITE; + else + result := R2_COPYPEN; + end; +end; + function TGtkWidgetSet.ForceLineBreaks(DC : hDC; Src: PChar; MaxWidthInPixels : Longint; ProcessAmpersands : Boolean) : PChar; var @@ -6944,6 +6990,9 @@ end; { ============================================================================= $Log$ + Revision 1.614 2005/01/08 11:03:18 mattias + implemented TPen.Mode=pmXor from Jesus + Revision 1.613 2005/01/07 20:51:11 micha swap TCustomStaticText and TCustomLabel diff --git a/lcl/interfaces/gtk/gtkwinapi.inc b/lcl/interfaces/gtk/gtkwinapi.inc index 5a4b600169..5a7d1650a9 100644 --- a/lcl/interfaces/gtk/gtkwinapi.inc +++ b/lcl/interfaces/gtk/gtkwinapi.inc @@ -4043,6 +4043,25 @@ begin end; end; +Function TGtkWidgetSet.GetROP2(DC: HDC): Integer; +var + Values: TGdkGCValues; +begin + if not IsValidDC(DC) then begin + Assert(False, 'Trace:[TGtkWidgetSet.GetROP2] Invalid GC'); + result := 0 + end else + with TDeviceContext(DC) do begin + if GC = nil then begin + Assert(False, 'Trace:[TGtkWidgetSet.GetROP2] Uninitialized GC'); + Result := 0; + end else begin + gdk_gc_get_values(GC, @Values); + result := GdkFunctionToROP2Mode( Values.thefunction ) + end; + end; +end; + {------------------------------------------------------------------------------ Function: GetClipRGN Params: dc, rgn @@ -7894,6 +7913,26 @@ Begin Result:=true; end; +{------------------------------------------------------------------------------ + Function TGtkWidgetSet.SetROPMode(Handle: hwnd; Str : PChar; + Data : Pointer) : Boolean; + ------------------------------------------------------------------------------} +Function TGtkWidgetSet.SetROP2(DC: HDC; Mode: Integer) : Integer; +Begin + if IsValidDC(DC) then with TDeviceContext(DC) do begin + if GC=nil then begin + Assert(False, 'Trace:[TGtkWidgetSet.SetROP2] Uninitialized GC'); + result := 0 + end else begin + Result := GetROP2(DC); + gdk_gc_set_function(GC, ROP2ModeToGdkFunction(Mode)); + end; + end else begin + Assert(False, 'Trace:[TGtkWidgetSet.SetROP2] Invalid GC'); + Result := 0; + end; +end; + {------------------------------------------------------------------------------ Function: SetScrollInfo Params: none @@ -8826,6 +8865,9 @@ end; { ============================================================================= $Log$ + Revision 1.384 2005/01/08 11:03:18 mattias + implemented TPen.Mode=pmXor from Jesus + Revision 1.383 2005/01/07 18:40:10 mattias clean up, added GetRGBValues diff --git a/lcl/interfaces/gtk/gtkwinapih.inc b/lcl/interfaces/gtk/gtkwinapih.inc index aa83e1086f..73a46e197b 100644 --- a/lcl/interfaces/gtk/gtkwinapih.inc +++ b/lcl/interfaces/gtk/gtkwinapih.inc @@ -112,6 +112,7 @@ Function GetProp(Handle : hwnd; Str : PChar): Pointer; override; function GetRawImageFromDevice(SrcDC: HDC; const SrcRect: TRect; var NewRawImage: TRawImage): boolean; override; function GetRawImageFromBitmap(SrcBitmap, SrcMaskBitmap: HBITMAP; const SrcRect: TRect; var NewRawImage: TRawImage): boolean; override; Function GetRgnBox(RGN : HRGN; lpRect : PRect) : Longint; override; +function GetROP2(DC: HDC): Integer; override; function GetScrollBarSize(Handle: HWND; BarKind: Integer): integer; override; function GetScrollbarVisible(Handle: HWND; SBStyle: Integer): boolean; override; function GetScrollInfo(Handle: HWND; SBStyle: Integer; var ScrollInfo: TScrollInfo): Boolean; override; @@ -184,6 +185,7 @@ function SetCaretPosEx(Handle: HWnd; X, Y: Integer): Boolean; override; function SetCaretRespondToFocus(handle: HWND; ShowHideOnFocus: boolean): Boolean; override; function SetFocus(hWnd: HWND): HWND; override; Function SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean; override; +function SetROP2(DC: HDC; Mode: Integer): Integer; override; function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; bRedraw : Boolean): Integer; override; function SetSysColors(cElements: Integer; const lpaElements; const lpaRgbValues): Boolean; override; Function SetTextCharacterExtra(_hdc : hdc; nCharExtra : Integer):Integer; override; @@ -212,6 +214,9 @@ Function WindowFromPoint(Point : TPoint) : HWND; override; { ============================================================================= $Log$ + Revision 1.91 2005/01/08 11:03:18 mattias + implemented TPen.Mode=pmXor from Jesus + Revision 1.90 2004/09/10 16:28:51 mattias implemented very rudimentary TTabControl diff --git a/lcl/interfaces/win32/win32winapi.inc b/lcl/interfaces/win32/win32winapi.inc index 61bf118362..f8ede9be60 100644 --- a/lcl/interfaces/win32/win32winapi.inc +++ b/lcl/interfaces/win32/win32winapi.inc @@ -1833,6 +1833,19 @@ Begin End; +{------------------------------------------------------------------------------ + Method: GetROP2 + Params: DC - Handle of the device context + + Returns: 0 if unsuccessful, the current Foreground Mixing Mode if successul + + Retrieves the current Foreground Mixing Mode in the given device context + ------------------------------------------------------------------------------} +function TWin32WidgetSet.GetROP2(DC: HDC): Integer; +begin + Result := Windows.GetROP2(DC); +end; + {------------------------------------------------------------------------------ Method: GetScrollInfo Params: Handle - handle of window with scroll bar @@ -2699,6 +2712,18 @@ Begin Assert(False, Format('Trace:TWin32WidgetSet.SetProp --> Window handle: 0x%X, Propery to set: %S, Data to set: 0x%P, Property was successfully set: %S', [Handle, String(Str), Data, BOOL_RESULT[Result]])); End; +{------------------------------------------------------------------------------ + Method: SetROP2 + Params: DC - Device Context + Mode - Foreground mixing mode + + Returns: 0 if unsuccessful or the old Mode if successful + ------------------------------------------------------------------------------} +Function TWin32WidgetSet.SetROP2(DC: HDC; Mode: Integer): Integer; +begin + result := Windows.SetROP2(DC, Mode); +end; + {------------------------------------------------------------------------------ Method: SetScrollInfo Params: Handle - handle of window with scroll bar @@ -3042,6 +3067,9 @@ end; { ============================================================================= $Log$ + Revision 1.132 2005/01/08 11:03:18 mattias + implemented TPen.Mode=pmXor from Jesus + Revision 1.131 2005/01/01 11:39:02 micha make stretchmaskblt handle the general case, and let maskblt call stretchmaskblt diff --git a/lcl/interfaces/win32/win32winapih.inc b/lcl/interfaces/win32/win32winapih.inc index 0a84f4a0b8..45f257bd44 100644 --- a/lcl/interfaces/win32/win32winapih.inc +++ b/lcl/interfaces/win32/win32winapih.inc @@ -105,6 +105,7 @@ Function GetKeyState(NVirtKey: Integer): SmallInt; Override; Function GetObject(GDIObj: HGDIOBJ; BufSize: Integer; Buf: Pointer): Integer; Override; Function GetParent(Handle: HWND): HWND; Override; Function GetProp(Handle: HWND; Str: PChar): Pointer; Override; +Function GetROP2(DC: HDC): Integer; override; Function GetScrollInfo(Handle: HWND; BarFlag: Integer; Var ScrollInfo: TScrollInfo): Boolean; Override; Function GetStockObject(Value: Integer): LongInt; Override; Function GetSysColor(NIndex: Integer): DWORD; Override; @@ -164,6 +165,7 @@ Function SetCaretPosEx(Handle: HWnd; X, Y: Integer): Boolean; Override; Function SetCaretRespondToFocus(Handle: HWND; ShowHideOnFocus: Boolean): Boolean; Override; Function SetFocus(HWnd: HWND): HWND; Override; Function SetProp(Handle: hwnd; Str: PChar; Data: Pointer): Boolean; Override; +Function SetROP2(DC: HDC; Mode: Integer): Integer; override; Function SetScrollInfo(Handle: HWND; SBStyle: Integer; ScrollInfo: TScrollInfo; BRedraw: Boolean): Integer; Override; Function SetSysColors(CElements: Integer; Const LPAElements; Const LPARgbValues): Boolean; Override; Function SetTextCharacterExtra(_HDC: HDC; NCharExtra: Integer): Integer; Override; @@ -191,6 +193,9 @@ Procedure DeleteCriticalSection(var CritSection: TCriticalSection); Override; { ============================================================================= $Log$ + Revision 1.51 2005/01/08 11:03:18 mattias + implemented TPen.Mode=pmXor from Jesus + Revision 1.50 2004/11/19 21:59:23 micha fix focus issue (for example using MessageDlg) diff --git a/lcl/lcltype.pp b/lcl/lcltype.pp index a8588a0b0f..8532afc988 100644 --- a/lcl/lcltype.pp +++ b/lcl/lcltype.pp @@ -1309,6 +1309,8 @@ const PS_TYPE_MASK = $F0000; + + //============================================== // API system Color constants pbd // note these are usually shown ORed with @@ -1436,6 +1438,44 @@ const SYS_COLOR_BASE = TColorRef($80000000); +{$ifndef win32} + R2_BLACK = 0; + R2_COPYPEN = 1; + R2_MASKNOTPEN = 2; + R2_MASKPEN = 3; + R2_MASKPENNOT = 4; + R2_MERGENOTPEN = 5; + R2_MERGEPEN = 6; + R2_MERGEPENNOT = 7; + R2_NOP = 8; + R2_NOT = 9; + R2_NOTCOPYPEN = 10; + R2_NOTMASKPEN = 11; + R2_NOTMERGEPEN = 12; + R2_NOTXORPEN = 13; + R2_WHITE = 14; + R2_XORPEN = 15; + +{$else} + R2_BLACK = Windows.R2_BLACK; + R2_COPYPEN = Windows.R2_COPYPEN; + R2_MASKNOTPEN = Windows.R2_MASKNOTPEN; + R2_MASKPEN = Windows.R2_MASKPEN; + R2_MASKPENNOT = Windows.R2_MASKPENNOT; + R2_MERGENOTPEN = Windows.R2_MERGENOTPEN; + R2_MERGEPEN = Windows.R2_MERGEPEN; + R2_MERGEPENNOT = Windows.R2_MERGEPENNOT; + R2_NOP = Windows.R2_NOP; + R2_NOT = Windows.R2_NOT; + R2_NOTCOPYPEN = Windows.R2_NOTCOPYPEN; + R2_NOTMASKPEN = Windows.R2_NOTMASKPEN; + R2_NOTMERGEPEN = windows.R2_NOTMERGEPEN; + R2_NOTXORPEN = Windows.R2_NOTXORPEN; + R2_WHITE = Windows.R2_WHITE; + R2_XORPEN = windows.R2_XORPEN; +{$endif} + + //============================================== // Stock Objects //============================================== @@ -2272,6 +2312,9 @@ end. { $Log$ + Revision 1.74 2005/01/08 11:03:18 mattias + implemented TPen.Mode=pmXor from Jesus + Revision 1.73 2005/01/07 20:51:10 micha swap TCustomStaticText and TCustomLabel