I forget patch
Marc Santhoff wrote:
Am Dienstag, den 24.01.2006, 18:41 +0100 schrieb darekm:
Darek
PS. how simple test patch syntactic
patch -C < <yourmodifictions.diff>
From the man page of patch(1):
-C, --check
see what would happen, but don't do it.
I know, this is impossible, but my patch don;t have this options (I use
Gentoo)
Darek
Index: interfaces/gtk/gtkproc.inc
===================================================================
--- interfaces/gtk/gtkproc.inc (wersja 8613)
+++ interfaces/gtk/gtkproc.inc (kopia robocza)
@@ -6519,37 +6519,15 @@
end;
end;
-procedure SetWidgetColor(aWidget : PGTKwidget; data : gpointer); cdecl;
-begin
- gtk_widget_set_style(aWidget,data);
- if gtk_is_button(aWidget) or gtk_is_check_button(aWidget) then begin
- gtk_container_foreach(pGtkContainer(aWidget),@SetWidgetColor,data);
- end;
-end;
-
-procedure setWidgetBG(aColor: longint;var aWidget : pGTKWidget);
-var
- WindowStyle: PGtkStyle;
-begin
- windowStyle:=gtk_widget_get_style(aWidget);
- windowstyle^.bg[0]:=AllocGDKColor(aColor);
- SetWidgetColor(aWidget,windowStyle);
-end;
-
-procedure setWidgetFG(aColor: longint;var aWidget : pGTKWidget);
-var
- WindowStyle: PGtkStyle;
-begin
- windowStyle:=gtk_widget_get_style(aWidget);
- windowstyle^.fg[0]:=AllocGDKColor(aColor);
- SetWidgetColor(aWidget,windowStyle);
-end;
{------------------------------------------------------------------------------
function GdkAtomToStr(const Atom: TGdkAtom): string;
Returns the associated string
------------------------------------------------------------------------------}
+
+
+
function GdkAtomToStr(const Atom: TGdkAtom): string;
var
p: Pgchar;
@@ -7610,23 +7588,7 @@
else begin
Widget := MainWidget;
end;
- // writeln('update ',longint(Widget),' color
',longint(aWinControl.Color),DbgSName(AWinControl));
- if (AWinControl.Color<>clNone) then begin
- if (csOpaque in AWinControl.ControlStyle)
- and GtkWidgetIsA(MainWidget,GTKAPIWidget_GetType) then exit;
-
- if AWinControl.ColorIsStored
- and ((AWinControl.Color and SYS_COLOR_BASE)=0) then begin
- DebugLn('UpdateWidgetStyleOfControl ',DbgSName(AWinControl),'
Color=',dbgs(AWinControl.Color));
- setWidgetBG(AWinControl.Color,Widget);
- end;
- end;
- if (AWinControl.Font.Color and SYS_COLOR_BASE)=0 then begin
- DebugLn('UpdateWidgetStyleOfControl ',DbgSName(AWinControl),'
Font.Color=',dbgs(AWinControl.Font.Color));
- setWidgetFG(AWinControl.Font.Color,Widget);
- end;
-
RCStyle:=nil;
FreeFontName:=false;
FreeFontSetName:=false;
@@ -7680,8 +7642,9 @@
// set font color
// set font (currently only TCustomLabel)
- if GtkWidgetIsA(Widget,gtk_label_get_type)
+ if (GtkWidgetIsA(Widget,gtk_label_get_type)
or GtkWidgetIsA(Widget,gtk_editable_get_type)
+ or GtkWidgetIsA(Widget,gtk_check_button_get_type))
and ((AWinControl.Font.Name<>DefFontData.Name)
or (AWinControl.Font.Size<>0)
or (AWinControl.Font.Style<>[]))
Index: interfaces/gtk/gtkdef.pp
===================================================================
--- interfaces/gtk/gtkdef.pp (wersja 8613)
+++ interfaces/gtk/gtkdef.pp (kopia robocza)
@@ -223,6 +223,7 @@
wwiNotOnParentsClientArea
);
TWidgetInfoFlags = set of TWidgetInfoFlag;
+ tGtkStateEnum = set of byte;
// Info needed by the API of a HWND (=Widget)
PWidgetInfo = ^TWidgetInfo;
Index: interfaces/gtk/gtkwinapi.inc
===================================================================
--- interfaces/gtk/gtkwinapi.inc (wersja 8613)
+++ interfaces/gtk/gtkwinapi.inc (kopia robocza)
@@ -3975,13 +3975,6 @@
Result:= False;
exit;
end;
- Widget:=PGtkWidget(TDeviceContext(DC).Wnd);
- ClientWidget:=Widget;
- if Widget<>nil then begin
- ClientWidget:=GetFixedWidget(Widget);
- if ClientWidget=nil then
- ClientWidget:=Widget;
- end;
AWindow:=Drawable;
DCOrigin:=GetDCOffset(TDeviceContext(DC));
Area.X:=ARect.Left+DCOrigin.X;
@@ -3998,12 +3991,12 @@
//'');
for i:= 1 to FrameWidth do begin
- gtk_paint_shadow(TheStyle,
+ gtk_paint_shadow(theStyle,
AWindow, GTK_STATE_NORMAL,
ShadowType,
@Area,
- ClientWidget,
- 'button',
+ {ClientWidget}nil,
+ {'button'}nil,
ARect.Left+DCOrigin.X, ARect.Top+DCOrigin.Y,
ARect.Right-ARect.Left, ARect.Bottom-ARect.Top);
// inflate the rectangle (! ARect will be returned to the user with this)
Index: interfaces/gtk/gtkcallback.inc
===================================================================
--- interfaces/gtk/gtkcallback.inc (wersja 8613)
+++ interfaces/gtk/gtkcallback.inc (kopia robocza)
@@ -232,7 +232,6 @@
TheWinControl.CNPreferredSizeChanged;
SetCursor(TheWinControl, crDefault);
ConnectInternalWidgetsSignals(MainWidget,TheWinControl);
- UpdateWidgetStyleOfControl(TheWinControl);
if TheWinControl is TCustomPage then
UpdateNotebookPageTab(nil,TheWinControl);
Index: interfaces/gtk/gtkobject.inc
===================================================================
--- interfaces/gtk/gtkobject.inc (wersja 8613)
+++ interfaces/gtk/gtkobject.inc (kopia robocza)
@@ -1315,7 +1315,43 @@
else Accelerate(AComponent, ASignalWidget, Ord(AccelKey), 0, ASignal);
end;
+procedure TGtkWidgetSet.SetWidgetColor(const AWidget : PGtkWidget;const
FGColor,BGColor : longint; const Mask : tGtkStateEnum);
+var
+ WindowStyle: PGtkStyle;
+ RCStyle : PGtkRCStyle;
+ i : integer;
+ xfg,
+ xbg : TGDKColor;
+begin
+ if (GTK_WIDGET_REALIZED(AWidget)) then begin
+ WindowStyle := gtk_style_copy(gtk_widget_get_style (AWidget));
+ end else begin
+ WindowStyle := gtk_style_copy(gtk_rc_get_style (AWidget));
+ end ;
+ if (Windowstyle = nil) then begin
+ Windowstyle := gtk_style_new ;
+ end;
+
+ xfg:=AllocGDKColor(colorToRGB(FGColor));
+ xbg:=AllocGDKColor(colorToRGB(BGColor));
+ writeln('setwidget ',longint(colorToRGB(FGColor)),'
',longint(colorToRGB(BGColor)));
+ for i := 0 to 4 do begin
+ if i in mask then begin
+ if (FGCOlor<>clNone) then begin
+ windowStyle^.fg[i]:=xfg;
+ end;
+ if (BGCOlor<>clNone) then begin
+ windowStyle^.bg[i]:=xbg;
+ end;
+ end;
+ end;
+ gtk_widget_set_style(aWidget,windowStyle);
+end;
+
+
+
+
{------------------------------------------------------------------------------
procedure TGtkWidgetSet.RealizeWidgetSize(Widget: PGtkWidget; NewWidth,
NewHeight: integer);
Index: interfaces/gtk/gtkwsbuttons.pp
===================================================================
--- interfaces/gtk/gtkwsbuttons.pp (wersja 8613)
+++ interfaces/gtk/gtkwsbuttons.pp (kopia robocza)
@@ -80,6 +80,8 @@
class procedure SetMargin(const ABitBtn: TCustomBitBtn; const AValue:
Integer); override;
class procedure SetSpacing(const ABitBtn: TCustomBitBtn; const AValue:
Integer); override;
class procedure SetText(const AWinControl: TWinControl; const AText:
String); override;
+ class procedure SetColor(const AWinControl: TWinControl); override;
+
end;
{ TGtkWSSpeedButton }
@@ -369,6 +371,30 @@
WidgetInfo^.CoreWidget, 'clicked');
end;
+
+procedure TGtkWSBitBtn.SetColor(const AWinControl: TWinControl);
+var
+ WidgetInfo: PWidgetInfo;
+ BitBtnInfo: PBitBtnWidgetInfo;
+ Widget, FixWidget : PGTKWidget;
+
+
+
+begin
+ Widget:= PGtkWidget(AWinControl.Handle);
+ WidgetInfo := GetWidgetInfo(Widget);
+ BitBtnInfo := WidgetInfo^.UserData;
+ GtkWidgetSet.SetWidgetColor(Widget, AWinControl.font.color,
AWinControl.color,[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]);
+
+
+ if BitBtnInfo^.LabelWidget = nil then Exit;
+ GtkWidgetSet.SetWidgetColor(BitBtnInfo^.LabelWidget, AWinControl.font.color,
AWinControl.color,[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]);
+
+
+
+end;
+
+
procedure TGtkWSBitBtn.UpdateLayout(const AInfo: PBitBtnWidgetInfo;
const ALayout: TButtonLayout; const AMargin: Integer);
begin
Index: interfaces/gtk/gtkwscontrols.pp
===================================================================
--- interfaces/gtk/gtkwscontrols.pp (wersja 8613)
+++ interfaces/gtk/gtkwscontrols.pp (kopia robocza)
@@ -426,6 +426,8 @@
procedure TGtkWSWinControl.SetColor(const AWinControl: TWinControl);
begin
+ if ((csOpaque in AWinControl.ControlStyle)and
GtkWidgetIsA(pGtkWidget(AWinControl.handle),GTKAPIWidget_GetType)) then exit;
+ GtkWidgetSet.SetWidgetColor(pGtkWidget(AWinControl.handle),
AWinControl.font.color,
AWinControl.color,[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]);
UpdateWidgetStyleOfControl(AWinControl);
end;
Index: interfaces/gtk/gtkint.pp
===================================================================
--- interfaces/gtk/gtkint.pp (wersja 8613)
+++ interfaces/gtk/gtkint.pp (kopia robocza)
@@ -252,6 +252,7 @@
public
// for gtk specific components:
procedure SetLabelCaption(const ALabel: PGtkLabel; const ACaption: String;
const AComponent: TComponent; const ASignalWidget: PGTKWidget; const ASignal:
PChar); virtual;
+ procedure SetWidgetColor(const AWidget : PGtkWidget;const FGColor,BGColor
: longint; const Mask : tGtkStateEnum);
procedure SetCallback(const AMsg: LongInt; const AGTKObject: PGTKObject;
const ALCLObject: TObject); virtual;
procedure SendPaintMessagesForInternalWidgets(AWinControl: TWinControl);
function LCLtoGtkMessagePending: boolean;virtual;
Index: controls.pp
===================================================================
--- controls.pp (wersja 8613)
+++ controls.pp (kopia robocza)
@@ -1709,6 +1709,8 @@
procedure WMPaint(var Message: TLMPaint); message LM_PAINT;
procedure PaintWindow(DC: HDC); override;
procedure FontChanged(Sender: TObject); override;
+ procedure SetColor(Value: TColor); override;
+
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
Index: include/custompanel.inc
===================================================================
--- include/custompanel.inc (wersja 8613)
+++ include/custompanel.inc (kopia robocza)
@@ -104,7 +104,7 @@
Canvas.Frame3d(ARect, BevelWidth, BevelInner);
InflateRect(ARect, -1, -1);
end;
-
+ Canvas.FillRect(ARect);
if Caption <> '' then begin
TS := Canvas.TextStyle;
TS.Alignment:= Alignment;
Index: include/customcontrol.inc
===================================================================
--- include/customcontrol.inc (wersja 8613)
+++ include/customcontrol.inc (kopia robocza)
@@ -85,7 +85,15 @@
Canvas.Font:=Font;
inherited FontChanged(Sender);
end;
+procedure TCustomControl.SetColor(Value: TColor);
+begin
+ if Value=Color then exit;
+ inherited SetColor(Value);
+ Canvas.Color := Color;
+
+end;
+
{------------------------------------------------------------------------------
Method: TCustomControl.LMPaint
Params: Msg: The paint message