fixed parameter type for beginPanel

more work on implementing in gl font based on the nvbasefont class

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2240 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blaszijk
2012-01-07 21:16:10 +00:00
parent 2f697282f8
commit 4b919d496b
5 changed files with 98 additions and 78 deletions

View File

@ -50,7 +50,7 @@
<UnitName Value="nvShaderUtils"/> <UnitName Value="nvShaderUtils"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="..\src\nvWidgets.pas"/> <Filename Value="..\src\nvwidgets.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="nvWidgets"/> <UnitName Value="nvWidgets"/>
</Unit3> </Unit3>
@ -85,7 +85,6 @@
</Parsing> </Parsing>
<Linking> <Linking>
<Debugging> <Debugging>
<DebugInfoType Value="dsStabs"/>
<UseHeaptrc Value="True"/> <UseHeaptrc Value="True"/>
</Debugging> </Debugging>
</Linking> </Linking>

View File

@ -25,6 +25,7 @@ var
errorScale: double = 4; errorScale: double = 4;
compressionRate: double = 1; compressionRate: double = 1;
texture: GLuint = 0; texture: GLuint = 0;
unfold: boolean = true;
procedure closeapp; procedure closeapp;
begin begin
@ -93,13 +94,12 @@ var
ui.beginGroup(GroupFlags_GrowLeftFromTop or GroupFlags_LayoutNoMargin); ui.beginGroup(GroupFlags_GrowLeftFromTop or GroupFlags_LayoutNoMargin);
ui.doCheckButton(none, 'Show difference', options[OPTION_DIFF]); ui.doCheckButton(none, 'Show difference', options[OPTION_DIFF]);
ui.beginPanel(none, 'panel', true); ui.beginPanel(none, 'panel', unfold);
ui.doCheckButton(none, 'Show difference', options[OPTION_DIFF]); ui.doCheckButton(none, 'Show difference', options[OPTION_DIFF]);
ui.endPanel; ui.endPanel;
if options[OPTION_DIFF] then if options[OPTION_DIFF] then
ui.doHorizontalSlider(none, 1, 16, errorScale); ui.doHorizontalSlider(none, 1, 16, errorScale);
ui.endGroup; ui.endGroup;
ui.beginGroup(GroupFlags_GrowLeftFromTop); ui.beginGroup(GroupFlags_GrowLeftFromTop);
@ -122,6 +122,7 @@ var
textureRect.Rect(0, 0, 100, 100); textureRect.Rect(0, 0, 100, 100);
ui.doTextureView(textureRect, texture, textureRect); ui.doTextureView(textureRect, texture, textureRect);
end; end;
ui.endGroup; ui.endGroup;
if options[OPTION_COMPRESS] then if options[OPTION_COMPRESS] then

View File

@ -10,7 +10,8 @@ unit GLFreeType;
interface interface
uses uses
SysUtils, freetypeh, GL, GLu; SysUtils, freetypeh, GL, GLu,
nvBaseFont;
//This holds all of the information related to any //This holds all of the information related to any
//freetype font that we want to create. //freetype font that we want to create.
@ -18,10 +19,24 @@ type
{ TGLFreeTypeFont } { TGLFreeTypeFont }
TGLFreeTypeFont = object TGLFreeTypeFont = object //class(TNVBaseFont)
Height: cardinal; //< Holds the height of the font.
textures: pGLuint; //< Holds the texture id's textures: pGLuint; //< Holds the texture id's
list_base: GLuint; //< Holds the first display list id list_base: GLuint; //< Holds the first display list id
{ public
constructor Create(AName: string; ASize: integer); override;
//text metrics
function TextHeight(Text: string): integer; override;
function TextWidth(Text: string): integer; override;
procedure TextSize(Text: string; var w, h: integer); override;
//printing function
procedure TextOut(x, y: double; Text: string); override;
}
Height: cardinal; //< Holds the height of the font.
//The init function will create a font of //The init function will create a font of
//of the height h from the file fname. //of the height h from the file fname.

View File

@ -23,7 +23,7 @@ type
protected protected
procedure SetAngle(AValue: double); virtual; procedure SetAngle(AValue: double); virtual;
public public
constructor Create(AName: string; ASize: integer); constructor Create(AName: string; ASize: integer); virtual;
//font characteristics //font characteristics
property Name: string read FName; property Name: string read FName;

View File

@ -342,7 +342,7 @@ type
procedure beginFrame(groupFlags: integer = GroupFlags_LayoutDefault; const rect: Rect = 0; style: integer = 0); procedure beginFrame(groupFlags: integer = GroupFlags_LayoutDefault; const rect: Rect = 0; style: integer = 0);
procedure endFrame; procedure endFrame;
function beginPanel(r: Rect; const Text: string; isUnfold: boolean; groupFlags: integer = GroupFlags_LayoutDefault; style: integer = 0): boolean; function beginPanel(var r: Rect; const Text: string; var isUnfold: boolean; groupFlags: integer = GroupFlags_LayoutDefault; style: integer = 0): boolean;
procedure endPanel; procedure endPanel;
function getGroupWidth: integer; function getGroupWidth: integer;
@ -1080,6 +1080,7 @@ begin
// Vertical behavior. // Vertical behavior.
aRect.y := aRect.y + (parentGroup.bounds.y + newGroup^.margin + EvalBool((parentAlign and GroupFlags_AlignTop) > 0) * (parentGroup.bounds.h - 2 * newGroup^.margin - aRect.h)); aRect.y := aRect.y + (parentGroup.bounds.y + newGroup^.margin + EvalBool((parentAlign and GroupFlags_AlignTop) > 0) * (parentGroup.bounds.h - 2 * newGroup^.margin - aRect.h));
end; end;
newGroup^.bounds := aRect; newGroup^.bounds := aRect;
end; end;
@ -1132,7 +1133,7 @@ begin
m_painter.drawFrame(m_groupStack[m_groupIndex + 1].bounds, m_groupStack[m_groupIndex + 1].margin, 0); m_painter.drawFrame(m_groupStack[m_groupIndex + 1].bounds, m_groupStack[m_groupIndex + 1].margin, 0);
end; end;
function UIContext.beginPanel(r: Rect; const Text: string; isUnfold: boolean; groupFlags: integer; style: integer): boolean; function UIContext.beginPanel(var r: Rect; const Text: string; var isUnfold: boolean; groupFlags: integer; style: integer): boolean;
var var
rt: Rect; rt: Rect;
ra: Rect; ra: Rect;
@ -1143,13 +1144,17 @@ var
tmp: Rect; tmp: Rect;
begin begin
rpanel := m_painter.getPanelRect(SetRect(r.x, r.y), Text, rt, ra); rpanel := m_painter.getPanelRect(SetRect(r.x, r.y), Text, rt, ra);
if (groupFlags and GroupFlags_LayoutDefault) > 0 then if (groupFlags and GroupFlags_LayoutDefault) > 0 then
groupFlags := GroupFlags_LayoutDefaultFallback; groupFlags := GroupFlags_LayoutDefaultFallback;
beginGroup((groupFlags or GroupFlags_LayoutNoMargin or GroupFlags_LayoutNoSpace) and GroupFlags_StartXMask, rpanel); beginGroup((groupFlags or GroupFlags_LayoutNoMargin or GroupFlags_LayoutNoSpace) and GroupFlags_StartXMask, rpanel);
aRect := m_groupStack[m_groupIndex].bounds; aRect := m_groupStack[m_groupIndex].bounds;
focus := hasFocus(aRect); focus := hasFocus(aRect);
hover := isHover(aRect); hover := isHover(aRect);
if focus then if focus then
begin begin
m_uiOnFocus := True; m_uiOnFocus := True;