Hi
 textOut once more

 and
 clipping (sometimes buttons are not refresh after tHint disappear


Darek


Index: interfaces/gtk/gtkwinapi.inc
===================================================================
--- interfaces/gtk/gtkwinapi.inc        (wersja 9183)
+++ interfaces/gtk/gtkwinapi.inc        (kopia robocza)
@@ -2813,8 +2813,6 @@
 
       theRect.Right := theRect.Left + LineWidth;
       theRect.Bottom := theRect.Top + NumLines*TM.tmHeight;
-      if NumLines>1 then
-        Inc(theRect.Bottom, (NumLines-1)*TM.tmDescent);// space between lines
 
       //debugln('TGtkWidgetSet.DrawText A ',dbgs(theRect),' 
TM.tmHeight=',dbgs(TM.tmHeight),' LineWidth=',dbgs(LineWidth),' 
NumLines=',dbgs(NumLines));
     end;
@@ -2971,9 +2969,6 @@
         end
         else If (Lines <> nil) and (NumLines <> 0) then begin
           For I := 0 to NumLines - 1 do begin
-            if I>0 then
-              Inc(theRect.Top, TM.tmDescent);// space between lines
-
             If (((Flags and DT_EditControl) = DT_EditControl) and
               (tm.tmHeight > (theRect.Bottom - theRect.Top))) or
               (theRect.Top > theRect.Bottom)
@@ -3844,15 +3839,16 @@
     if UseFont<>nil then begin
       LineLen := FindChar(#10,Str,Count);
       UpdateDCTextMetric(TDeviceContext(DC));
-      LineHeight:=GetTextHeight(DCTextMetric);
+      LineHeight:=DCTextMetric.TextMetric.tmHeight;
+//      LineHeight:=GetTextHeight(DCTextMetric);
       if Buffered then begin
         TxtPt.X := 0;
-        TxtPt.Y := LineHeight;
+        TxtPt.Y := DCTextMetric.TextMetric.tmAscent;;
       end
       else begin
         TopY := Y;
         TxtPt.X := X + DCOrigin.X;
-        TxtPt.Y := TopY + LineHeight + DCOrigin.Y;
+        TxtPt.Y := TopY + DCTextMetric.TextMetric.tmAscent + DCOrigin.Y;
       end;
       SelectGDKTextProps(DC);
       LineStart:=Str;
@@ -7967,10 +7963,10 @@
   var
     GtkPaintData: TLMGtkPaintData;
     OldGtkPaintMsg: TLMGtkPaint;
-    {$IFNDEF Gtk2}
     PaintDC: HDC;
     DCOrigin: TPoint;
-    {$ENDIF}
+    RRGN : hRGN;
+
   begin
     (* MG: old trick. Not used anymore, but it might be, that someday there
            will be component, that works better with this, so it is kept.
@@ -8027,15 +8023,19 @@
       // convert LM_GtkPAINT to LM_PAINT
       AMessage := TLMessage(GtkPaintMessageToPaintMessage(
                                                 TLMGtkPaint(AMessage), False));
-      {$IfNDef GTK2}
       if (GtkPaintData<>nil) and (not GtkPaintData.RepaintAll) then begin
         PaintDC:=TLMPaint(AMessage).DC;
         DCOrigin:=GetDCOffset(TDeviceContext(PaintDC));
-        with GtkPaintData.Rect do
-          IntersectClipRect(PaintDC,Left-DCOrigin.X,Top-DCOrigin.Y,
+        if (targetObject is tGraphicControl) or (targetObject is 
tCustomControl) then begin
+          with (targetObject as tControl) do begin
+                RRGN := CreateRectRgn(0,0, width, height);
+              selectClipRGN(PaintDC,RRGN);
+           end;
+        end else
+          with GtkPaintData.Rect do
+            IntersectClipRect(PaintDC,Left-DCOrigin.X,Top-DCOrigin.Y,
                             Right-DCOrigin.X,Bottom-DCOrigin.Y);
       end;
-      {$EndIf}
       GtkPaintData.Free;
     end;
   end;
Index: interfaces/gtk/gtklclintf.inc
===================================================================
--- interfaces/gtk/gtklclintf.inc       (wersja 9183)
+++ interfaces/gtk/gtklclintf.inc       (kopia robocza)
@@ -288,11 +288,7 @@
 function TGTKWidgetSet.FontCanUTF8(Font: HFont): boolean;
 begin
   Result:=IsValidGDIObject(Font) and
-{$IFDEF GTK2}
- 
FontIsDoubleByteCharsFont(gdk_font_from_description(PGdiObject(Font)^.GDIFontObject));
-{$ELSE GTK2}
- FontIsDoubleByteCharsFont(PGdiObject(Font)^.GDIFontObject);
-{$ENDIF GTK2}
+  FontIsDoubleByteCharsFont(PGDKFont(PGdiObject(Font)^.GDIFontObject));
 end;
 
 {------------------------------------------------------------------------------
Index: interfaces/gtk/gtkcallback.inc
===================================================================
--- interfaces/gtk/gtkcallback.inc      (wersja 9183)
+++ interfaces/gtk/gtkcallback.inc      (kopia robocza)
@@ -464,7 +464,7 @@
 
   // the expose area is ok, but some gtk widgets repaints everything on expose
   // -> maximize the area
-  DeliverGtkPaintMessage(Data,Widget,@Event^.Area,true);
+  DeliverGtkPaintMessage(Data,Widget,@Event^.Area,{$IFDEF gtk2} 
false{$ELSE}true{$ENDIF});
 end;
 
 function gtkfrmactivateAfter(widget: PGtkWidget; Event : PgdkEventFocus;
Index: interfaces/gtk/gtkobject.inc
===================================================================
--- interfaces/gtk/gtkobject.inc        (wersja 9183)
+++ interfaces/gtk/gtkobject.inc        (kopia robocza)
@@ -1444,13 +1444,9 @@
   PangoDescStr := AFont.Name;
   DescOpts := '';
   if FSBold in AFont.Style then
-    DescOpts := DescOpts + ' bold';
+    DescOpts := DescOpts + ' Bold';
   if FSItalic in AFont.Style then
-    DescOpts := DescOpts + ' italic';
-  if FSUnderline in AFont.Style then
-    DescOpts := DescOpts + ' underline';
-  if FSStrikeOut in AFont.Style then
-    DescOpts := DescOpts + ' strikethrough';
+    DescOpts := DescOpts + ' Italic';
 
   PangoDescStr := PangoDescStr+DescOpts+' '+IntToStr(AFont.Size);
   //DebugLn('TGtkWidgetSet.SetWidgetFont PangoDescStr="',PangoDescStr,'"');
@@ -6527,7 +6523,7 @@
     #0'{'#0'A'#0'B'#0'C'#0'D'#0'E'#0'F'#0'G'#0'H'#0'I'#0'J'#0'K'#0'L'#0'M'#0'N'
     
+#0'O'#0'P'#0'Q'#0'R'#0'S'#0'T'#0'U'#0'V'#0'W'#0'X'#0'Y'#0'Z'#0'X'#0'Y'#0'Z'
     
+#0'a'#0'b'#0'c'#0'd'#0'e'#0'f'#0'g'#0'h'#0'i'#0'j'#0'k'#0'l'#0'm'#0'n'#0'o'
-    +#0'p'#0'q'#0'r'#0's'#0't'#0'u'#0'v'#0'w'#0'x'#0'y'#0'z'#0'|'#0'_'#0'}'
+    +#0'p'#0'q'#0'r'#0's'#0't'#0'u'#0'v'#0'w'#0'x'#0'y'#0'Ó|'#0'_'#0'}'
     );
 var
   UseFont : PGDKFont;
Index: interfaces/gtk2/gtk2winapi.inc
===================================================================
--- interfaces/gtk2/gtk2winapi.inc      (wersja 9183)
+++ interfaces/gtk2/gtk2winapi.inc      (kopia robocza)
@@ -134,13 +134,12 @@
       if IsFontNameXLogicalFontDesc(LongFontName) then
           if  (PointSize <> '') and  (CompareText(PointSize,'*')<>0) then
             sizeFont:=StrToInt(PointSize) div 10;
-      if sizeFont = 0 then sizeFont:=abs(lfHeight);
-      if sizeFont = 0 then sizeFont:=12;
+      if (sizeFont=0) and (lfHeight=0) then sizeFont:=10;
 
 
 
 
-      FullString := FamilyName + ' '+ IntToStr(sizeFont );
+      FullString := FamilyName + ' ' + IntToStr(sizeFont );
 
       if FontNameRegistry='' then ;
       if Foundry='' then ;
@@ -161,14 +160,17 @@
       if lfWeight <> FW_DONTCARE then
         pango_font_description_set_weight(GdiObject^.GDIFontObject, lfWeight);
 
-      if lfItalic = 0 then
+      if lfItalic <> 0 then
         pango_font_description_set_style(GdiObject^.GDIFontObject,
-                                         PANGO_STYLE_NORMAL)
-      else
-        pango_font_description_set_style(GdiObject^.GDIFontObject,
                                          PANGO_STYLE_ITALIC);
-      if lfHeight<>0 then
-        
pango_font_description_set_size(GdiObject^.GDIFontObject,abs(lfHeight)*PANGO_SCALE);
+      if (sizefont=0) and (lfHeight<>0) then begin
+//      when Pango >1.8
+//        
pango_font_description_set_absolute_size(GdiObject^.GDIFontObject,abs(lfHeight)*PANGO_SCALE);
+        if lfHeight<0 then
+           
pango_font_description_set_size(GdiObject^.GDIFontObject,(abs(lfHeight)*72*PANGO_SCALE)
 div 96)
+        else
+           
pango_font_description_set_size(GdiObject^.GDIFontObject,abs(lfHeight)*PANGO_SCALE)
 ;
+      end;
 
       GdiObject^.StrikeOut := lfStrikeOut <> 0;
       GdiObject^.Underline := lfUnderline <> 0;
@@ -339,7 +341,7 @@
           TopY := Y;
           UpdateDCTextMetric(TDeviceContext(DC));
           TxtPt.X := X + DCOrigin.X;
-          LineHeight := DCTextMetric.TextMetric.tmAscent;
+          LineHeight := DCTextMetric.TextMetric.tmHeight;
           TxtPt.Y := TopY + LineHeight + DCOrigin.Y;
 
           SelectedColors := dcscCustom;
@@ -355,14 +357,14 @@
           end;
 
           EnsureGCColor(DC, dccCurrentTextColor, True, False);
-          RGBColor := ColorToRGB(CurrentTextColor.ColorRef);
+{          RGBColor := ColorToRGB(CurrentTextColor.ColorRef);
 
           Attr := pango_attr_foreground_new(gushort(GetRValue(RGBColor)) shl 8,
                                             gushort(GetGValue(RGBColor)) shl 8,
                                             gushort(GetBValue(RGBColor)) shl 
8);
 
           pango_attr_list_change(AttrList,Attr);
-
+}
           pango_layout_set_attributes(Layout, AttrList);
 
           Foreground := StyleForegroundColor(CurrentTextColor.ColorRef, nil);
@@ -549,7 +551,6 @@
   StrikeOut : Boolean;
 
   RGBColor : Longint;
-  Foreground : PGDKColor;
   Layout : PPangoLayout;
   UseFontDesc : PPangoFontDescription;
   AttrList : PPangoAttrList;
@@ -602,21 +603,8 @@
         pango_attr_list_change(AttrList,Attr);
 
         SelectedColors := dcscCustom;
-        EnsureGCColor(DC, dccCurrentBackColor, True, False);
         EnsureGCColor(DC, dccCurrentTextColor, True, False);
-
-        RGBColor := ColorToRGB(CurrentTextColor.ColorRef);
-
-        Attr := pango_attr_foreground_new(gushort(GetRValue(RGBColor)) shl 8,
-                                        gushort(GetGValue(RGBColor)) shl 8,
-                                        gushort(GetBValue(RGBColor)) shl 8);
-
-        pango_attr_list_change(AttrList,Attr);
-        
         pango_layout_set_attributes(Layout, AttrList);
-
-        Foreground := StyleForegroundColor(CurrentTextColor.ColorRef, nil);
-
         pango_layout_set_single_paragraph_mode(Layout, TRUE);
         pango_layout_set_width(Layout, -1);
 
@@ -635,7 +623,7 @@
 
         OffsetRect(aRect, X+DCOrigin.X,Y+DCOrigin.Y);
 
-        gdk_draw_layout_with_colors(drawable, GC, aRect.Left, aRect.Top, 
Layout, Foreground, nil);
+        gdk_draw_layout_with_colors(drawable, GC, aRect.Left, aRect.Top, 
Layout, nil, nil);
         g_object_unref(Layout);
         Result := True;
         If UnRef then
Index: interfaces/gtk2/gtk2lclintf.inc
===================================================================
--- interfaces/gtk2/gtk2lclintf.inc     (wersja 9183)
+++ interfaces/gtk2/gtk2lclintf.inc     (kopia robocza)
@@ -30,6 +30,29 @@
 
 //##apiwiz##sps##   // Do not remove
 
+function TGtk2WidgetSet.ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint;
+  Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
+begin
+    Result:=ExtTextOut(DC,X,Y,Options,Rect,Str,Count,Dx);
+end;
+function TGtk2WidgetSet.TextUTF8Out(DC: HDC; X, Y: Integer; Str: PChar; Count: 
Longint): Boolean;
+begin
+    Result:=TextOut(DC,X,Y,Str,Count);
+end;
 
+
+{------------------------------------------------------------------------------
+  function TGTKWidgetSet.FontCanUTF8(Font: HFont): boolean;
+
+  True if font recognizes Unicode.
+ 
------------------------------------------------------------------------------}
+function TGTK2WidgetSet.FontCanUTF8(Font: HFont): boolean;
+begin
+  Result:=IsValidGDIObject(Font) and
+ 
FontIsDoubleByteCharsFont(gdk_font_from_description(PGdiObject(Font)^.GDIFontObject));
+end;
+
+
+
 //##apiwiz##eps##   // Do not remove, no wizard declaration after this line
 
Index: interfaces/gtk2/gtk2int.pas
===================================================================
--- interfaces/gtk2/gtk2int.pas (wersja 9183)
+++ interfaces/gtk2/gtk2int.pas (kopia robocza)
@@ -177,6 +177,7 @@
 
 {$include gtk2object.inc}
 {$include gtk2winapi.inc}
+{$include gtk2lclintf.inc}
 
 const
   GtkListStoreItemGtkListTag = 'GtkList';
Index: interfaces/gtk2/gtk2lclintfh.inc
===================================================================
--- interfaces/gtk2/gtk2lclintfh.inc    (wersja 9183)
+++ interfaces/gtk2/gtk2lclintfh.inc    (kopia robocza)
@@ -29,6 +29,11 @@
 }
 
 //##apiwiz##sps##   // Do not remove
+function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;
+  Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
+function TextUTF8Out(DC: HDC; X, Y: Integer; Str: PChar; Count: Longint): 
Boolean; override;
+function FontCanUTF8(Font: HFont): boolean; override;
 
+
 //##apiwiz##eps##   // Do not remove, no wizard declaration after this line
 
Index: include/wincontrol.inc
===================================================================
--- include/wincontrol.inc      (wersja 9183)
+++ include/wincontrol.inc      (kopia robocza)
@@ -2511,7 +2516,7 @@
 
   if not HandleAllocated then Exit;
 
-  //DebugLn('TWinControl.UpdateShowing A ',Name,':',ClassName,' 
FShowing=',FShowing,' bShow=',bShow);
+  //DebugLn('TWinControl.UpdateShowing A ',Name,':',ClassName,' 
FShowing=',dbgs(FShowing),' bShow=',dbgs(bShow));
   if FShowing = bShow then Exit;
   
   FShowing := bShow;
@@ -2952,6 +2957,8 @@
   {$IFDEF VerboseControlDCOrigin}
   P: TPoint;
   {$ENDIF}
+  RRGN : hRGN;
+
 begin
   //DebugLn('[TWinControl.PaintControls] ',Name,':',ClassName,'  
DC=',DbgS(DC,8));
   if (csDestroying in ComponentState)
@@ -2989,7 +2996,8 @@
           {$IFDEF VerboseControlDCOrigin}
           DebugLn('TWinControl.PaintControls B Self=',DbgSName(Self),' 
Control=',DbgSName(TempControl),' 
',dbgs(Left),',',dbgs(Top),',',dbgs(Width),',',dbgs(Height));
           {$ENDIF}
-          IntersectClipRect(DC, 0, 0, Width, Height);
+          RRGN := CreateRectRgn(0,0, width, height);
+          selectClipRGN(DC,RRGN);
           {$IFDEF VerboseControlDCOrigin}
           DebugLn('TWinControl.PaintControls C');
           P:=Point(-1,-1);

Reply via email to