mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-22 06:48:31 +02:00
remove USE_PANGO define since pango now apears to work properly.
git-svn-id: trunk@4650 -
This commit is contained in:
parent
11880858a9
commit
d743352fb0
@ -315,7 +315,7 @@ begin
|
|||||||
|
|
||||||
// the gtk always toggles the check flag
|
// the gtk always toggles the check flag
|
||||||
// -> restore 'checked' flag if needed
|
// -> restore 'checked' flag if needed
|
||||||
if MenuItemChecked(AMenuItem) = LCLMenuItem.Checked then Exit;
|
if gtk_check_menu_item_get_active(AMenuItem) = LCLMenuItem.Checked then Exit;
|
||||||
if LCLMenuItem.AutoCheck then Exit;
|
if LCLMenuItem.AutoCheck then Exit;
|
||||||
|
|
||||||
// restore it
|
// restore it
|
||||||
@ -2854,6 +2854,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.192 2003/09/19 00:41:51 ajgenius
|
||||||
|
remove USE_PANGO define since pango now apears to work properly.
|
||||||
|
|
||||||
Revision 1.191 2003/09/17 15:26:41 mattias
|
Revision 1.191 2003/09/17 15:26:41 mattias
|
||||||
fixed removing TPage
|
fixed removing TPage
|
||||||
|
|
||||||
|
@ -29,10 +29,6 @@ unit GTKDef;
|
|||||||
{$mode objfpc}
|
{$mode objfpc}
|
||||||
{$LONGSTRINGS ON}
|
{$LONGSTRINGS ON}
|
||||||
|
|
||||||
{$IFDEF gtk2}
|
|
||||||
{$DEFINE USE_PANGO}
|
|
||||||
{$EndIf}
|
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -95,7 +91,7 @@ type
|
|||||||
GDIBrushPixMap: PGdkPixmap;
|
GDIBrushPixMap: PGdkPixmap;
|
||||||
);
|
);
|
||||||
gdiFont: (
|
gdiFont: (
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK2}
|
||||||
GDIFontObject: PPangoFontDescription;
|
GDIFontObject: PPangoFontDescription;
|
||||||
StrikeOut : gboolean;//Description can't set these so we use these
|
StrikeOut : gboolean;//Description can't set these so we use these
|
||||||
Underline : gboolean;//instead of an additional AttributeList
|
Underline : gboolean;//instead of an additional AttributeList
|
||||||
@ -465,6 +461,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.48 2003/09/19 00:41:51 ajgenius
|
||||||
|
remove USE_PANGO define since pango now apears to work properly.
|
||||||
|
|
||||||
Revision 1.47 2003/09/18 09:21:03 mattias
|
Revision 1.47 2003/09/18 09:21:03 mattias
|
||||||
renamed LCLLinux to LCLIntf
|
renamed LCLLinux to LCLIntf
|
||||||
|
|
||||||
|
@ -46,10 +46,6 @@ interface
|
|||||||
|
|
||||||
{off $Define Disable_GC_SysColors}
|
{off $Define Disable_GC_SysColors}
|
||||||
|
|
||||||
{$IFDEF gtk2}
|
|
||||||
{$DEFINE USE_PANGO}
|
|
||||||
{$EndIf}
|
|
||||||
|
|
||||||
uses
|
uses
|
||||||
InterfaceBase,
|
InterfaceBase,
|
||||||
{$IFDEF gtk2}
|
{$IFDEF gtk2}
|
||||||
@ -91,7 +87,7 @@ type
|
|||||||
FStockBlackPen: HPEN;
|
FStockBlackPen: HPEN;
|
||||||
FStockWhitePen: HPEN;
|
FStockWhitePen: HPEN;
|
||||||
|
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK2}
|
||||||
FDefaultFontDesc : PPangoFontDescription;
|
FDefaultFontDesc : PPangoFontDescription;
|
||||||
{$Else}
|
{$Else}
|
||||||
FDefaultFont : PGdkFont;
|
FDefaultFont : PGdkFont;
|
||||||
@ -148,7 +144,7 @@ type
|
|||||||
function CreateDefaultFont: PGdiObject;virtual;
|
function CreateDefaultFont: PGdiObject;virtual;
|
||||||
function CreateDefaultPen: PGdiObject;virtual;
|
function CreateDefaultPen: PGdiObject;virtual;
|
||||||
procedure UpdateDCTextMetric(DC: TDeviceContext); virtual;
|
procedure UpdateDCTextMetric(DC: TDeviceContext); virtual;
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK2}
|
||||||
function GetDefaultFontDesc(IncreaseReferenceCount: boolean): PPangoFontDescription;
|
function GetDefaultFontDesc(IncreaseReferenceCount: boolean): PPangoFontDescription;
|
||||||
{$Else}
|
{$Else}
|
||||||
function GetDefaultFont(IncreaseReferenceCount: boolean): PGDKFont;
|
function GetDefaultFont(IncreaseReferenceCount: boolean): PGDKFont;
|
||||||
@ -372,6 +368,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.149 2003/09/19 00:41:51 ajgenius
|
||||||
|
remove USE_PANGO define since pango now apears to work properly.
|
||||||
|
|
||||||
Revision 1.148 2003/09/18 17:23:04 ajgenius
|
Revision 1.148 2003/09/18 17:23:04 ajgenius
|
||||||
start using GtkTextView for Gtk2 Memo
|
start using GtkTextView for Gtk2 Memo
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ begin
|
|||||||
FDeviceContexts.Options:=FDeviceContexts.Options+[dhaoCacheContains];
|
FDeviceContexts.Options:=FDeviceContexts.Options+[dhaoCacheContains];
|
||||||
FGDIObjects := TDynHashArray.Create(-1);
|
FGDIObjects := TDynHashArray.Create(-1);
|
||||||
FGDIObjects.Options:=FGDIObjects.Options+[dhaoCacheContains];
|
FGDIObjects.Options:=FGDIObjects.Options+[dhaoCacheContains];
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK2}
|
||||||
FDefaultFontDesc:= nil;
|
FDefaultFontDesc:= nil;
|
||||||
{$Else}
|
{$Else}
|
||||||
FDefaultFont:= nil;
|
FDefaultFont:= nil;
|
||||||
@ -4718,7 +4718,7 @@ begin
|
|||||||
g_signal_connect(GTK_OBJECT(MenuItemWidget), 'activate',
|
g_signal_connect(GTK_OBJECT(MenuItemWidget), 'activate',
|
||||||
gtk_signal_func(@GTKDialogMenuActivateCB),
|
gtk_signal_func(@GTKDialogMenuActivateCB),
|
||||||
OpenDialog);
|
OpenDialog);
|
||||||
gtk_menu_append({$IfNdef GTK2}PGTKMenu{$EndIf}(MenuWidget), MenuItemWidget);
|
gtk_menu_append(MenuWidget, MenuItemWidget);
|
||||||
gtk_widget_show(MenuItemWidget);
|
gtk_widget_show(MenuItemWidget);
|
||||||
end;
|
end;
|
||||||
gtk_widget_show(MenuWidget);
|
gtk_widget_show(MenuWidget);
|
||||||
@ -4915,7 +4915,7 @@ begin
|
|||||||
g_signal_connect(GTK_OBJECT(MenuItemWidget), 'activate',
|
g_signal_connect(GTK_OBJECT(MenuItemWidget), 'activate',
|
||||||
gtk_signal_func(@GTKDialogMenuActivateCB),
|
gtk_signal_func(@GTKDialogMenuActivateCB),
|
||||||
OpenDialog);
|
OpenDialog);
|
||||||
gtk_menu_append({$IfNdef GTK2}PGTKMenu{$EndIf}(MenuWidget), MenuItemWidget);
|
gtk_menu_append(MenuWidget, MenuItemWidget);
|
||||||
gtk_widget_show(MenuItemWidget);
|
gtk_widget_show(MenuItemWidget);
|
||||||
end;
|
end;
|
||||||
gtk_widget_show(MenuWidget);
|
gtk_widget_show(MenuWidget);
|
||||||
@ -7172,8 +7172,7 @@ begin
|
|||||||
if GtkWidgetIsA(ParentMenuWidget,GTK_TYPE_MENU_BAR) then begin
|
if GtkWidgetIsA(ParentMenuWidget,GTK_TYPE_MENU_BAR) then begin
|
||||||
// mainmenu (= a menu bar)
|
// mainmenu (= a menu bar)
|
||||||
ContainerMenu:=ParentMenuWidget;
|
ContainerMenu:=ParentMenuWidget;
|
||||||
gtk_menu_bar_insert({$IFNDef GTK2}PGtkMenuBar{$EndIf}(ParentMenuWidget),MenuItem,
|
gtk_menu_bar_insert(ParentMenuWidget,MenuItem, LCLMenuItem.MenuIndex);
|
||||||
LCLMenuItem.MenuIndex);
|
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
// menu item
|
// menu item
|
||||||
@ -7194,7 +7193,7 @@ begin
|
|||||||
gtk_menu_item_set_submenu(PGTKMenuItem(ParentMenuWidget),ContainerMenu);
|
gtk_menu_item_set_submenu(PGTKMenuItem(ParentMenuWidget),ContainerMenu);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
gtk_menu_insert({$IFNDef GTK2}PGtkMenu{$EndIf}(ContainerMenu), MenuItem, LCLMenuItem.MenuIndex);
|
gtk_menu_insert(ContainerMenu, MenuItem, LCLMenuItem.MenuIndex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
SetContainerMenuToggleSize;
|
SetContainerMenuToggleSize;
|
||||||
@ -7461,7 +7460,7 @@ begin
|
|||||||
|
|
||||||
gdk_gc_get_values(aDC.GC, @Values);
|
gdk_gc_get_values(aDC.GC, @Values);
|
||||||
|
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK2}
|
||||||
if (gtk_widget_get_style(ClientWidget)<>nil) and
|
if (gtk_widget_get_style(ClientWidget)<>nil) and
|
||||||
(gtk_widget_get_style(ClientWidget)^.font_desc <> nil)
|
(gtk_widget_get_style(ClientWidget)^.font_desc <> nil)
|
||||||
then begin
|
then begin
|
||||||
@ -7475,7 +7474,7 @@ begin
|
|||||||
|
|
||||||
if aDC <> nil
|
if aDC <> nil
|
||||||
then begin
|
then begin
|
||||||
{$IfNdef USE_PANGO}
|
{$Ifdef GTK1}
|
||||||
if Values.Font <> nil
|
if Values.Font <> nil
|
||||||
then begin
|
then begin
|
||||||
GdiObject:=NewGDIObject(gdiFont);
|
GdiObject:=NewGDIObject(gdiFont);
|
||||||
@ -7557,7 +7556,7 @@ end;
|
|||||||
function TgtkObject.CreateDefaultFont: PGdiObject;
|
function TgtkObject.CreateDefaultFont: PGdiObject;
|
||||||
begin
|
begin
|
||||||
Result := NewGDIObject(gdiFont);
|
Result := NewGDIObject(gdiFont);
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK2}
|
||||||
Result^.GDIFontObject:= GetDefaultFontDesc(true);
|
Result^.GDIFontObject:= GetDefaultFontDesc(true);
|
||||||
{$Else}
|
{$Else}
|
||||||
Result^.GDIFontObject:= GetDefaultFont(true);
|
Result^.GDIFontObject:= GetDefaultFont(true);
|
||||||
@ -7588,7 +7587,7 @@ end;
|
|||||||
Sets the gtk resource file and parses it.
|
Sets the gtk resource file and parses it.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TgtkObject.UpdateDCTextMetric(DC: TDeviceContext);
|
procedure TgtkObject.UpdateDCTextMetric(DC: TDeviceContext);
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK2}
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
{$Else}
|
{$Else}
|
||||||
@ -7656,7 +7655,7 @@ end;
|
|||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function TgtkObject.GetDefaultFont(IncreaseReferenceCount: boolean): PGDKFont;
|
function TgtkObject.GetDefaultFont(IncreaseReferenceCount: boolean): PGDKFont;
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK2}
|
||||||
function TgtkObject.GetDefaultFontDesc(IncreaseReferenceCount: boolean): PPangoFontDescription;
|
function TgtkObject.GetDefaultFontDesc(IncreaseReferenceCount: boolean): PPangoFontDescription;
|
||||||
begin
|
begin
|
||||||
if FDefaultFontDesc = nil then begin
|
if FDefaultFontDesc = nil then begin
|
||||||
@ -7959,7 +7958,7 @@ end;
|
|||||||
procedure TGtkObject.WordWrap(DC: HDC; AText: PChar; MaxWidthInPixel: integer;
|
procedure TGtkObject.WordWrap(DC: HDC; AText: PChar; MaxWidthInPixel: integer;
|
||||||
var Lines: PPChar; var LineCount: integer);
|
var Lines: PPChar; var LineCount: integer);
|
||||||
var
|
var
|
||||||
{$IfDef USE_PANGO}
|
{$IfDef GTK2}
|
||||||
UseFontDesc : PPangoFontDescription;
|
UseFontDesc : PPangoFontDescription;
|
||||||
{$Else}
|
{$Else}
|
||||||
UseFont : PGDKFont;
|
UseFont : PGDKFont;
|
||||||
@ -7970,7 +7969,7 @@ var
|
|||||||
var
|
var
|
||||||
lbearing, rbearing, width, ascent, descent: LongInt;
|
lbearing, rbearing, width, ascent, descent: LongInt;
|
||||||
begin
|
begin
|
||||||
{$IfDef USE_PANGO}
|
{$IfDef GTK2}
|
||||||
GetTextExtentIgnoringAmpersands(UseFontDesc, @AText[LineStart], LineLen,
|
GetTextExtentIgnoringAmpersands(UseFontDesc, @AText[LineStart], LineLen,
|
||||||
@lbearing, @rBearing, @width, @ascent, @descent);
|
@lbearing, @rBearing, @width, @ascent, @descent);
|
||||||
{$Else}
|
{$Else}
|
||||||
@ -8041,7 +8040,7 @@ var
|
|||||||
with TDeviceContext(DC) do begin
|
with TDeviceContext(DC) do begin
|
||||||
if (CurrentFont = nil) or (CurrentFont^.GDIFontObject = nil)
|
if (CurrentFont = nil) or (CurrentFont^.GDIFontObject = nil)
|
||||||
then begin
|
then begin
|
||||||
{$IfDef USE_PANGO}
|
{$IfDef GTK2}
|
||||||
UseFontDesc := GetDefaultFontDesc(true);
|
UseFontDesc := GetDefaultFontDesc(true);
|
||||||
{$Else}
|
{$Else}
|
||||||
UseFont := GetDefaultFont(true);
|
UseFont := GetDefaultFont(true);
|
||||||
@ -8049,7 +8048,7 @@ var
|
|||||||
UnRef := True;
|
UnRef := True;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
{$IfDef USE_PANGO}
|
{$IfDef GTK2}
|
||||||
UseFontDesc := CurrentFont^.GDIFontObject;
|
UseFontDesc := CurrentFont^.GDIFontObject;
|
||||||
{$Else}
|
{$Else}
|
||||||
UseFont := CurrentFont^.GDIFontObject;
|
UseFont := CurrentFont^.GDIFontObject;
|
||||||
@ -8062,7 +8061,7 @@ var
|
|||||||
procedure CleanUpFont;
|
procedure CleanUpFont;
|
||||||
begin
|
begin
|
||||||
If UnRef then
|
If UnRef then
|
||||||
{$IfDef USE_PANGO}
|
{$IfDef GTK2}
|
||||||
pango_font_description_free(UseFontDesc);
|
pango_font_description_free(UseFontDesc);
|
||||||
{$Else}
|
{$Else}
|
||||||
GDK_Font_UnRef(UseFont);
|
GDK_Font_UnRef(UseFont);
|
||||||
@ -8193,6 +8192,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.420 2003/09/19 00:41:51 ajgenius
|
||||||
|
remove USE_PANGO define since pango now apears to work properly.
|
||||||
|
|
||||||
Revision 1.419 2003/09/18 21:36:00 ajgenius
|
Revision 1.419 2003/09/18 21:36:00 ajgenius
|
||||||
add csEdit to GTK2 interface to start removing use of GtkOldEditable
|
add csEdit to GTK2 interface to start removing use of GtkOldEditable
|
||||||
|
|
||||||
|
@ -105,6 +105,26 @@ begin
|
|||||||
menu_item^.flag0:=menu_item^.flag0 and (not bm_right_justify);
|
menu_item^.flag0:=menu_item^.flag0 and (not bm_right_justify);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Function gtk_check_menu_item_get_active(menu_item : PGtkCheckMenuItem) : gboolean;
|
||||||
|
begin
|
||||||
|
Result:=(menu_item^.flag0 and bm_checkmenuitem_active <> 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure gtk_menu_append(menu : PGTKWidget; Item : PGtkWidget);
|
||||||
|
begin
|
||||||
|
gtk.gtk_menu_append(PGTKMenu(menu), Item);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure gtk_menu_insert(menu : PGtkWidget; Item : PGTKWidget; Index : gint);
|
||||||
|
begin
|
||||||
|
gtk.gtk_menu_insert(PGTKMenu(menu), Item, Index);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure gtk_menu_bar_insert(menubar : PGtkWidget; Item : PGTKWidget; Index : gint);
|
||||||
|
begin
|
||||||
|
gtk.gtk_menu_bar_insert(PGtkMenuBar(menubar), Item, Index);
|
||||||
|
end;
|
||||||
|
|
||||||
Function gtk_image_new :PGTKWidget;
|
Function gtk_image_new :PGTKWidget;
|
||||||
begin
|
begin
|
||||||
result := gtk.gtk_image_new(nil,nil);
|
result := gtk.gtk_image_new(nil,nil);
|
||||||
@ -2936,15 +2956,6 @@ begin
|
|||||||
Result:=GTK_CHECK_MENU_ITEM_CLASS(gtk_object_get_class(widget));
|
Result:=GTK_CHECK_MENU_ITEM_CLASS(gtk_object_get_class(widget));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function MenuItemChecked(MenuWidget: PGtkCheckMenuItem): boolean;
|
|
||||||
begin
|
|
||||||
{$IFDEF Gtk2}
|
|
||||||
Result:=gtk_check_menu_item_get_active(MenuWidget);
|
|
||||||
{$ELSE}
|
|
||||||
Result:=(MenuWidget^.flag0 and bm_checkmenuitem_active <> 0)
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function GetRadioMenuItemGroup(LCLMenuItem: TMenuItem): PGSList;
|
function GetRadioMenuItemGroup(LCLMenuItem: TMenuItem): PGSList;
|
||||||
|
|
||||||
@ -3029,7 +3040,7 @@ begin
|
|||||||
then begin
|
then begin
|
||||||
LCLMenuItem := TMenuItem(GetLCLObject(MenuItem));
|
LCLMenuItem := TMenuItem(GetLCLObject(MenuItem));
|
||||||
if (LCLMenuItem <> nil)
|
if (LCLMenuItem <> nil)
|
||||||
and (MenuItemChecked(MenuItem) <> LCLMenuItem.Checked)
|
and (gtk_check_menu_item_get_active(MenuItem) <> LCLMenuItem.Checked)
|
||||||
then gtk_check_menu_item_set_active(MenuItem, LCLMenuItem.Checked);
|
then gtk_check_menu_item_set_active(MenuItem, LCLMenuItem.Checked);
|
||||||
end;
|
end;
|
||||||
CurListItem := CurListItem^.Next;
|
CurListItem := CurListItem^.Next;
|
||||||
@ -3299,6 +3310,7 @@ begin
|
|||||||
gtk_check_menu_item_set_active(PGtkCheckMenuItem(MenuItemWidget),
|
gtk_check_menu_item_set_active(PGtkCheckMenuItem(MenuItemWidget),
|
||||||
LCLMenuItem.Checked);
|
LCLMenuItem.Checked);
|
||||||
{$ifdef GTK2}
|
{$ifdef GTK2}
|
||||||
|
writeln('TODO: CreateMenuItem, get old toggle size');
|
||||||
{$else}
|
{$else}
|
||||||
if (OldCheckMenuItemToggleSize=0) then
|
if (OldCheckMenuItemToggleSize=0) then
|
||||||
OldCheckMenuItemToggleSize:=MENU_ITEM_CLASS(MenuItemWidget)^.toggle_size;
|
OldCheckMenuItemToggleSize:=MENU_ITEM_CLASS(MenuItemWidget)^.toggle_size;
|
||||||
@ -4098,7 +4110,7 @@ end;
|
|||||||
a generic fixed font, if THAT fails, it gets whatever font is available.
|
a generic fixed font, if THAT fails, it gets whatever font is available.
|
||||||
If the result is not nil it MUST be GDK_FONT_UNREF'd when done.
|
If the result is not nil it MUST be GDK_FONT_UNREF'd when done.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK2}
|
||||||
function LoadDefaultFontDesc: PPangoFontDescription;
|
function LoadDefaultFontDesc: PPangoFontDescription;
|
||||||
var
|
var
|
||||||
Style : PGTKStyle;
|
Style : PGTKStyle;
|
||||||
@ -4129,11 +4141,6 @@ begin
|
|||||||
Style := GetStyle('gtk_default');
|
Style := GetStyle('gtk_default');
|
||||||
|
|
||||||
If Style <> nil then begin
|
If Style <> nil then begin
|
||||||
{$IFDEF Gtk2}
|
|
||||||
// Gtk2ToDo
|
|
||||||
if Style^.font_desc<>nil then
|
|
||||||
Result:=gdk_font_from_description(Style^.font_desc);
|
|
||||||
{$ELSE}
|
|
||||||
Result := Style^.Font;
|
Result := Style^.Font;
|
||||||
If Result = nil then
|
If Result = nil then
|
||||||
{$IFNDEF NoStyle}
|
{$IFNDEF NoStyle}
|
||||||
@ -4142,7 +4149,6 @@ begin
|
|||||||
Result := gdk_font_load(Style^.RC_Style^.font_name);
|
Result := gdk_font_load(Style^.RC_Style^.font_name);
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
If Result = nil then
|
If Result = nil then
|
||||||
@ -4573,7 +4579,7 @@ end;
|
|||||||
|
|
||||||
Gets text extent of a string, ignoring escaped Ampersands.
|
Gets text extent of a string, ignoring escaped Ampersands.
|
||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
{$Ifdef USE_PANGO}
|
{$Ifdef GTK2}
|
||||||
Procedure GetTextExtentIgnoringAmpersands(FontDesc : PPangoFontDescription; Str : PChar;
|
Procedure GetTextExtentIgnoringAmpersands(FontDesc : PPangoFontDescription; Str : PChar;
|
||||||
LineLength : Longint; lbearing, rbearing, width, ascent, descent : Pgint);
|
LineLength : Longint; lbearing, rbearing, width, ascent, descent : Pgint);
|
||||||
{$Else}
|
{$Else}
|
||||||
@ -4594,7 +4600,7 @@ begin
|
|||||||
LineLength:=StrLen(NewStr);
|
LineLength:=StrLen(NewStr);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$Ifdef USE_PANGO}
|
{$Ifdef GTK2}
|
||||||
gdk_text_extents(FontDesc, NewStr, LineLength,
|
gdk_text_extents(FontDesc, NewStr, LineLength,
|
||||||
lbearing, rBearing, width, ascent, descent);
|
lbearing, rBearing, width, ascent, descent);
|
||||||
{$Else}
|
{$Else}
|
||||||
@ -4610,7 +4616,7 @@ end;
|
|||||||
|
|
||||||
This is only a heuristic
|
This is only a heuristic
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
{$IfNdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK1}
|
||||||
function FontIsDoubleByteCharsFont(TheFont: PGdkFont): boolean;
|
function FontIsDoubleByteCharsFont(TheFont: PGdkFont): boolean;
|
||||||
var
|
var
|
||||||
SingleCharLen, DoubleCharLen: integer;
|
SingleCharLen, DoubleCharLen: integer;
|
||||||
@ -4745,7 +4751,7 @@ end;
|
|||||||
|
|
||||||
Procedure FillScreenFonts(ScreenFonts : TStrings);
|
Procedure FillScreenFonts(ScreenFonts : TStrings);
|
||||||
var
|
var
|
||||||
{$IFNDEF USE_PANGO}
|
{$IFDEF GTK1}
|
||||||
theFonts : PPChar;
|
theFonts : PPChar;
|
||||||
{$Else}
|
{$Else}
|
||||||
Widget : PGTKWidget;
|
Widget : PGTKWidget;
|
||||||
@ -4756,7 +4762,7 @@ var
|
|||||||
I, N: Integer;
|
I, N: Integer;
|
||||||
begin
|
begin
|
||||||
ScreenFonts.Clear;
|
ScreenFonts.Clear;
|
||||||
{$IFNDEF USE_PANGO}
|
{$IFDEF GTK1}
|
||||||
{$IfNdef Win32}
|
{$IfNdef Win32}
|
||||||
If X11Display = nil then
|
If X11Display = nil then
|
||||||
X11Display := XOpenDisplay(GDK_GET_DISPLAY);
|
X11Display := XOpenDisplay(GDK_GET_DISPLAY);
|
||||||
@ -4791,7 +4797,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if (families <> nil) then
|
if (families <> nil) then
|
||||||
g_free(families);
|
g_free(families);
|
||||||
{$EndIf USE_PANGO}
|
{$EndIf GTK2}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF ASSERT_IS_ON}
|
{$IFDEF ASSERT_IS_ON}
|
||||||
@ -4804,6 +4810,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.209 2003/09/19 00:41:52 ajgenius
|
||||||
|
remove USE_PANGO define since pango now apears to work properly.
|
||||||
|
|
||||||
Revision 1.208 2003/09/18 14:06:30 ajgenius
|
Revision 1.208 2003/09/18 14:06:30 ajgenius
|
||||||
fixed Tgtkobject.drawtext for Pango till the native pango one works better
|
fixed Tgtkobject.drawtext for Pango till the native pango one works better
|
||||||
|
|
||||||
|
@ -24,19 +24,12 @@ interface
|
|||||||
{off $DEFINE NoGdkPixbufLib}
|
{off $DEFINE NoGdkPixbufLib}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFDEF gtk2}
|
|
||||||
{$DEFINE USE_PANGO}
|
|
||||||
{$EndIf}
|
|
||||||
uses
|
uses
|
||||||
SysUtils, Classes,
|
SysUtils, Classes,
|
||||||
{$IFNDEF USE_PANGO}
|
{$IFDEF GTK1}
|
||||||
{$Ifndef Win32}
|
{$Ifndef Win32}
|
||||||
X, XLib,//Font retrieval
|
X, XLib,//Font retrieval
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
//hopefully we can grab a pango context off of an Invisible widget and call
|
|
||||||
//pango_context_list_families, then extract info from that list for pango,
|
|
||||||
//thus keeping us from having to expose xft, fontconfig, X, or Win32 Pango
|
|
||||||
//interfaces, or from having to call actual interfaces directly in GTK2
|
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
InterfaceBase,
|
InterfaceBase,
|
||||||
{$IFDEF gtk2}
|
{$IFDEF gtk2}
|
||||||
@ -401,7 +394,7 @@ const
|
|||||||
var
|
var
|
||||||
DesignSignalMasks: array[TDesignSignalType] of TDesignSignalMask;
|
DesignSignalMasks: array[TDesignSignalType] of TDesignSignalMask;
|
||||||
|
|
||||||
{$IFNDEF USE_PANGO}
|
{$IFDEF GTK1}
|
||||||
var
|
var
|
||||||
X11Display : Pointer;//only needed to get X fonts
|
X11Display : Pointer;//only needed to get X fonts
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
@ -434,7 +427,7 @@ Function DeleteAmpersands(var Str : String) : Longint;
|
|||||||
function Ampersands2Underscore(Src: PChar) : PChar;
|
function Ampersands2Underscore(Src: PChar) : PChar;
|
||||||
function RemoveAmpersands(Src: PChar; LineLength : Longint) : PChar;
|
function RemoveAmpersands(Src: PChar; LineLength : Longint) : PChar;
|
||||||
|
|
||||||
{$Ifdef USE_PANGO}
|
{$Ifdef GTK2}
|
||||||
Procedure GetTextExtentIgnoringAmpersands(FontDesc : PPangoFontDescription; Str : PChar;
|
Procedure GetTextExtentIgnoringAmpersands(FontDesc : PPangoFontDescription; Str : PChar;
|
||||||
LineLength : Longint; lbearing, rbearing, width, ascent, descent : Pgint);
|
LineLength : Longint; lbearing, rbearing, width, ascent, descent : Pgint);
|
||||||
{$Else}
|
{$Else}
|
||||||
@ -462,7 +455,6 @@ procedure GetGdkPixmapFromGraphic(LCLGraphic: TGraphic;
|
|||||||
// menus
|
// menus
|
||||||
function MENU_ITEM_CLASS(widget: PGtkWidget): PGtkMenuItemClass;
|
function MENU_ITEM_CLASS(widget: PGtkWidget): PGtkMenuItemClass;
|
||||||
function CHECK_MENU_ITEM_CLASS(widget: PGtkWidget): PGtkCheckMenuItemClass;
|
function CHECK_MENU_ITEM_CLASS(widget: PGtkWidget): PGtkCheckMenuItemClass;
|
||||||
function MenuItemChecked(MenuWidget: PGtkCheckMenuItem): boolean;
|
|
||||||
function GetRadioMenuItemGroup(LCLMenuItem: TMenuItem): PGSList;
|
function GetRadioMenuItemGroup(LCLMenuItem: TMenuItem): PGSList;
|
||||||
function GetRadioMenuItemGroup(MenuItem: PGtkRadioMenuItem): PGSList;
|
function GetRadioMenuItemGroup(MenuItem: PGtkRadioMenuItem): PGSList;
|
||||||
procedure LockRadioGroupOnChange(RadioGroup: PGSList; const ADelta: Integer);
|
procedure LockRadioGroupOnChange(RadioGroup: PGSList; const ADelta: Integer);
|
||||||
@ -492,7 +484,7 @@ Procedure ReleaseStyle(const WName : String);
|
|||||||
function GetStyle(const WName : String) : PGTKStyle;
|
function GetStyle(const WName : String) : PGTKStyle;
|
||||||
Function GetStyleWidget(const WName : String) : PGTKWidget;
|
Function GetStyleWidget(const WName : String) : PGTKWidget;
|
||||||
|
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK2}
|
||||||
function LoadDefaultFontDesc: PPangoFontDescription;
|
function LoadDefaultFontDesc: PPangoFontDescription;
|
||||||
{$Else}
|
{$Else}
|
||||||
function LoadDefaultFont: PGDKFont;
|
function LoadDefaultFont: PGDKFont;
|
||||||
@ -500,7 +492,7 @@ function LoadDefaultFont: PGDKFont;
|
|||||||
|
|
||||||
Function GetSysGCValues(Color : TColorRef) : TGDKGCValues;
|
Function GetSysGCValues(Color : TColorRef) : TGDKGCValues;
|
||||||
|
|
||||||
{$IfNdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK1}
|
||||||
function FontIsDoubleByteCharsFont(TheFont: PGdkFont): boolean;
|
function FontIsDoubleByteCharsFont(TheFont: PGdkFont): boolean;
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
|
|
||||||
@ -543,6 +535,10 @@ function gtk_widget_get_ythickness(Style : PGTKWidget) : gint; overload;
|
|||||||
Function gtk_window_get_modal(window:PGtkWindow):gboolean;
|
Function gtk_window_get_modal(window:PGtkWindow):gboolean;
|
||||||
Function gtk_bin_get_child(bin : PGTKBin) : PGTKWidget;
|
Function gtk_bin_get_child(bin : PGTKBin) : PGTKWidget;
|
||||||
Procedure gtk_menu_item_set_right_justified(menu_item : PGtkMenuItem; right_justified : gboolean);
|
Procedure gtk_menu_item_set_right_justified(menu_item : PGtkMenuItem; right_justified : gboolean);
|
||||||
|
Function gtk_check_menu_item_get_active(menu_item : PGtkCheckMenuItem) : gboolean;
|
||||||
|
Procedure gtk_menu_append(menu : PGTKWidget; Item : PGtkWidget);
|
||||||
|
Procedure gtk_menu_insert(menu : PGtkWidget; Item : PGTKWidget; Index : gint);
|
||||||
|
Procedure gtk_menu_bar_insert(menubar : PGtkWidget; Item : PGTKWidget; Index : gint);
|
||||||
Function gtk_image_new : PGTKWidget;
|
Function gtk_image_new : PGTKWidget;
|
||||||
Function gtk_toolbar_new : PGTKWidget;
|
Function gtk_toolbar_new : PGTKWidget;
|
||||||
Procedure gtk_color_selection_get_current_color(colorsel : PGTKColorSelection; Color : PGDKColor);
|
Procedure gtk_color_selection_get_current_color(colorsel : PGTKColorSelection; Color : PGDKColor);
|
||||||
@ -634,7 +630,7 @@ end;
|
|||||||
{$I gtkproc.inc}
|
{$I gtkproc.inc}
|
||||||
{$I gtkcallback.inc}
|
{$I gtkcallback.inc}
|
||||||
|
|
||||||
{$IFNDEF USE_PANGO} //only needed to get X fonts
|
{$IFDEF GTK1} //only needed to get X fonts
|
||||||
initialization
|
initialization
|
||||||
X11Display := nil;
|
X11Display := nil;
|
||||||
|
|
||||||
|
@ -1305,7 +1305,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TgtkObject.CreateFontIndirectEx(const LogFont: TLogFont;
|
function TgtkObject.CreateFontIndirectEx(const LogFont: TLogFont;
|
||||||
const LongFontName: string): HFONT;
|
const LongFontName: string): HFONT;
|
||||||
{$IfDef USE_PANGO}
|
{$IfDef GTK2}
|
||||||
begin
|
begin
|
||||||
writeln('ToDo: TgtkObject.CreateFontIndirectEx');
|
writeln('ToDo: TgtkObject.CreateFontIndirectEx');
|
||||||
Result:=0;
|
Result:=0;
|
||||||
@ -2128,7 +2128,7 @@ begin
|
|||||||
gdiFont:
|
gdiFont:
|
||||||
begin
|
begin
|
||||||
if GDIFontObject<>nil then
|
if GDIFontObject<>nil then
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
{$Ifdef GTK2}
|
||||||
pango_font_description_free(GDIFontObject);
|
pango_font_description_free(GDIFontObject);
|
||||||
{$Else}
|
{$Else}
|
||||||
gdk_font_unref(GDIFontObject);
|
gdk_font_unref(GDIFontObject);
|
||||||
@ -2960,7 +2960,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TgtkObject.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint;
|
function TgtkObject.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint;
|
||||||
Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
||||||
{$Ifdef USE_PANGO}
|
{$Ifdef GTK2}
|
||||||
begin
|
begin
|
||||||
writeln('ToDo: TgtkObject.ExtTextOut');
|
writeln('ToDo: TgtkObject.ExtTextOut');
|
||||||
Result:=false;
|
Result:=false;
|
||||||
@ -4227,7 +4227,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
gdiFont:
|
gdiFont:
|
||||||
begin
|
begin
|
||||||
{$IfDef USE_PANGO}
|
{$IfDef GTK2}
|
||||||
Assert(False, 'Trace:TODO: [TgtkObject.GetObject] gdiFont(PANGO)');
|
Assert(False, 'Trace:TODO: [TgtkObject.GetObject] gdiFont(PANGO)');
|
||||||
{$Else}
|
{$Else}
|
||||||
if Buf = nil then
|
if Buf = nil then
|
||||||
@ -4561,7 +4561,7 @@ var
|
|||||||
GDIObj : PGDIObject;
|
GDIObj : PGDIObject;
|
||||||
begin
|
begin
|
||||||
GDIObj := NewGDIObject(gdiFont);
|
GDIObj := NewGDIObject(gdiFont);
|
||||||
{$IfDef USE_PANGO}
|
{$IfDef GTK2}
|
||||||
GDIObj^.GDIFontObject:= GetDefaultFontDesc(true);
|
GDIObj^.GDIFontObject:= GetDefaultFontDesc(true);
|
||||||
{$Else}
|
{$Else}
|
||||||
GDIObj^.GDIFontObject:= GetDefaultFont(true);
|
GDIObj^.GDIFontObject:= GetDefaultFont(true);
|
||||||
@ -4991,7 +4991,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TgtkObject.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer;
|
function TgtkObject.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer;
|
||||||
var Size: TSize): Boolean;
|
var Size: TSize): Boolean;
|
||||||
{$IfDef USE_PANGO}
|
{$IfDef GTK2}
|
||||||
begin
|
begin
|
||||||
writeln('TGTKObject.GetTextExtentPoint ToDo');
|
writeln('TGTKObject.GetTextExtentPoint ToDo');
|
||||||
Result:=false;
|
Result:=false;
|
||||||
@ -6951,7 +6951,7 @@ begin
|
|||||||
Assert(False, Format('trace: [TgtkObject.SelectObject] DC: 0x%x, Type: Font', [DC]));
|
Assert(False, Format('trace: [TgtkObject.SelectObject] DC: 0x%x, Type: Font', [DC]));
|
||||||
Result := HFONT(CurrentFont);
|
Result := HFONT(CurrentFont);
|
||||||
CurrentFont := PGDIObject(GDIObj);
|
CurrentFont := PGDIObject(GDIObj);
|
||||||
{$IfNDef USE_PANGO}
|
{$IfDef GTK1}
|
||||||
if GC <> nil
|
if GC <> nil
|
||||||
then begin
|
then begin
|
||||||
gdk_gc_set_font(GC, PGdiObject(GDIObj)^.GDIFontObject);
|
gdk_gc_set_font(GC, PGdiObject(GDIObj)^.GDIFontObject);
|
||||||
@ -8516,7 +8516,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Function TGTKObject.TextOut(DC: HDC; X,Y : Integer; Str : Pchar;
|
Function TGTKObject.TextOut(DC: HDC; X,Y : Integer; Str : Pchar;
|
||||||
Count: Integer) : Boolean;
|
Count: Integer) : Boolean;
|
||||||
{$IfDef USE_PANGO}
|
{$IfDef GTK2}
|
||||||
begin
|
begin
|
||||||
writeln('TGTKObject.TextOut ToDo');
|
writeln('TGTKObject.TextOut ToDo');
|
||||||
Result:=false;
|
Result:=false;
|
||||||
@ -8795,6 +8795,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.287 2003/09/19 00:41:52 ajgenius
|
||||||
|
remove USE_PANGO define since pango now apears to work properly.
|
||||||
|
|
||||||
Revision 1.286 2003/09/18 14:06:30 ajgenius
|
Revision 1.286 2003/09/18 14:06:30 ajgenius
|
||||||
fixed Tgtkobject.drawtext for Pango till the native pango one works better
|
fixed Tgtkobject.drawtext for Pango till the native pango one works better
|
||||||
|
|
||||||
|
@ -30,8 +30,6 @@ interface
|
|||||||
{$ASSERTIONS ON}
|
{$ASSERTIONS ON}
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{$DEFINE USE_PANGO}
|
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
{$IfNDef GTK2_2}
|
{$IfNDef GTK2_2}
|
||||||
@ -53,14 +51,12 @@ uses
|
|||||||
type
|
type
|
||||||
TGtk2Object = class(TGtkObject)
|
TGtk2Object = class(TGtkObject)
|
||||||
public
|
public
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
|
||||||
function DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Flags: Cardinal): Integer; override;
|
function DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Flags: Cardinal): Integer; override;
|
||||||
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
|
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; override;
|
||||||
function TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean; override;
|
function TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean; override;
|
||||||
function CreateFontIndirectEx(const LogFont: TLogFont; const LongFontName: string): HFONT; override;
|
function CreateFontIndirectEx(const LogFont: TLogFont; const LongFontName: string): HFONT; override;
|
||||||
function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean; override;
|
function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean; override;
|
||||||
procedure UpdateDCTextMetric(DC: TDeviceContext); override;
|
procedure UpdateDCTextMetric(DC: TDeviceContext); override;
|
||||||
{$EndIf}
|
|
||||||
|
|
||||||
function BeginPaint(Handle: hWnd; Var PS : TPaintStruct) : hdc; override;
|
function BeginPaint(Handle: hWnd; Var PS : TPaintStruct) : hdc; override;
|
||||||
Function EndPaint(Handle : hwnd; var PS : TPaintStruct): Integer; override;
|
Function EndPaint(Handle : hwnd; var PS : TPaintStruct): Integer; override;
|
||||||
@ -93,7 +89,6 @@ procedure gdk_draw_pixbuf(drawable : PGdkDrawable; gc : PGdkGC; pixbuf : PGdkPix
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$Ifdef USE_PANGO} // we should implement pango for gtk2 soon
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: DrawText
|
Method: DrawText
|
||||||
Params: DC, Str, Count, Rect, Flags
|
Params: DC, Str, Count, Rect, Flags
|
||||||
@ -916,8 +911,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$EndIf}
|
|
||||||
|
|
||||||
function Tgtk2Object.BeginPaint(Handle: hWnd; Var PS : TPaintStruct) : hdc;
|
function Tgtk2Object.BeginPaint(Handle: hWnd; Var PS : TPaintStruct) : hdc;
|
||||||
var
|
var
|
||||||
paintrect : TGDKRectangle;
|
paintrect : TGDKRectangle;
|
||||||
@ -1541,6 +1534,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.19 2003/09/19 00:41:52 ajgenius
|
||||||
|
remove USE_PANGO define since pango now apears to work properly.
|
||||||
|
|
||||||
Revision 1.18 2003/09/18 21:36:00 ajgenius
|
Revision 1.18 2003/09/18 21:36:00 ajgenius
|
||||||
add csEdit to GTK2 interface to start removing use of GtkOldEditable
|
add csEdit to GTK2 interface to start removing use of GtkOldEditable
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user