gtk intf: using default when gdk does not know the physical screen size

git-svn-id: trunk@10642 -
This commit is contained in:
mattias 2007-02-14 11:09:42 +00:00
parent dc73afae9b
commit 49242c3818
5 changed files with 32 additions and 13 deletions

View File

@ -1154,6 +1154,7 @@ begin
dec(FScannedLines,AnUnit.ScannedLines);
AnUnit.ScannedBytes:=0;
AnUnit.ScannedLines:=0;
dec(FScannedUnits);
end;
AnUnit.Scanned:=true;
inc(FScannedUnits);
@ -1184,8 +1185,6 @@ begin
Node:=List.Units.FindLowest;
while Node<>nil do begin
AnUnit:=TCodeBrowserUnit(Node.Data);
if fOutdatedFiles<>nil then
fOutdatedFiles.Remove(AnUnit);
RemoveUnit(AnUnit);
Node:=List.Units.FindSuccessor(Node);
end;
@ -1221,6 +1220,8 @@ begin
dec(FScannedLines,AnUnit.ScannedLines);
dec(FScannedBytes,AnUnit.ScannedBytes);
AnUnit.Scanned:=false;
if fOutdatedFiles<>nil then
fOutdatedFiles.Remove(AnUnit);
end;
end;
@ -1320,7 +1321,7 @@ procedure TCodeBrowserUnitList.InternalRemoveUnitList(List: TCodeBrowserUnitList
);
begin
if FUnitLists<>nil then
FUnitLists.Add(List);
FUnitLists.Remove(List);
end;
procedure TCodeBrowserUnitList.InternalAddUnit(AnUnit: TCodeBrowserUnit);
@ -1333,7 +1334,7 @@ end;
procedure TCodeBrowserUnitList.InternalRemoveUnit(AnUnit: TCodeBrowserUnit);
begin
if FUnits<>nil then
FUnits.Add(AnUnit);
FUnits.Remove(AnUnit);
end;
constructor TCodeBrowserUnitList.Create(TheOwner: string;

View File

@ -1917,12 +1917,10 @@ begin
//FillScreenFonts(Screen.Fonts);
InitKeyboardTables;
{ Compute pixels per inch variable }
//writeln('TGtkWidgetSet.AppInit gdk_screen_width_mm=',gdk_screen_width_mm);
ScreenInfo.PixelsPerInchX :=
RoundToInt(gdk_screen_width / (gdk_screen_width_mm / 25.4));
//writeln('TGtkWidgetSet.AppInit gdk_screen_height_mm=',gdk_screen_height_mm);
RoundToInt(gdk_screen_width / (GetScreenWidthMM / 25.4));
ScreenInfo.PixelsPerInchY :=
RoundToInt(gdk_screen_height / (gdk_screen_height_mm / 25.4));
RoundToInt(gdk_screen_height / (GetScreenHeightMM / 25.4));
ScreenInfo.ColorDepth := gdk_visual_get_system^.depth;
end;

View File

@ -6552,6 +6552,20 @@ begin
Result:=GdkTrue; // go on, make sure getting a message at least every second
end;
function GetScreenWidthMM(GdkValue: boolean): integer;
begin
Result:=gdk_screen_width_mm;
if (Result<=0) and not GdkValue then
Result:=300; // some TV-out screens don't know there size
end;
function GetScreenHeightMM(GdkValue: boolean): integer;
begin
Result:=gdk_screen_height_mm;
if (Result<=0) and not GdkValue then
Result:=300; // some TV-out screens don't know there size
end;
{------------------------------------------------------------------------------
Function: WaitForClipboardAnswer
Params: none

View File

@ -693,8 +693,14 @@ function CreateTopologicalSortedWidgets(HashArray: TDynHashArray): TFPList;
procedure GetGTKDefaultWidgetSize(AWinControl: TWinControl;
var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean);
Procedure ReportNotObsolete(const Texts: String);
// debug
procedure ReportNotObsolete(const Texts: String);
// screen
function GetScreenWidthMM(GdkValue: boolean = false): integer;
function GetScreenHeightMM(GdkValue: boolean = false): integer;
// clipboard
function WaitForClipboardAnswer(c: PClipboardEventData): boolean;
function RequestSelectionData(ClipboardWidget: PGtkWidget;
ClipboardType: TClipboardType; FormatID: cardinal): TGtkSelectionData;
@ -743,8 +749,8 @@ function XGetWorkarea(var ax,ay,awidth,aheight:gint): gint;
// decoration
Function GetWindowDecorations(AForm: TCustomForm): Longint;
Function GetWindowFunction(AForm: TCustomForm): Longint;
function GetWindowDecorations(AForm: TCustomForm): Longint;
function GetWindowFunction(AForm: TCustomForm): Longint;
// functions for easier GTK2<->GTK1 Compatibility/Consistency ---->
function gtk_widget_get_xthickness(Style: PGTKStyle): gint; overload;

View File

@ -5020,10 +5020,10 @@ begin
//we will also have to add internal support for Papersizes etc..
LOGPIXELSX : { Logical pixels per inch in X }
Result := RoundToInt(gdk_screen_width / (gdk_screen_width_mm / 25.4));
Result := RoundToInt(gdk_screen_width / (GetScreenWidthMM / 25.4));
LOGPIXELSY : { Logical pixels per inch in Y }
Result := RoundToInt(gdk_screen_height / (gdk_screen_height_mm / 25.4));
Result := RoundToInt(gdk_screen_height / (GetScreenHeightMM / 25.4));
SIZEPALETTE: { number of entries in color palette }
if GetVisual then