You've already forked lazarus-ccr
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:
@ -50,7 +50,7 @@
|
||||
<UnitName Value="nvShaderUtils"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\src\nvWidgets.pas"/>
|
||||
<Filename Value="..\src\nvwidgets.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="nvWidgets"/>
|
||||
</Unit3>
|
||||
@ -85,7 +85,6 @@
|
||||
</Parsing>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsStabs"/>
|
||||
<UseHeaptrc Value="True"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
|
@ -25,6 +25,7 @@ var
|
||||
errorScale: double = 4;
|
||||
compressionRate: double = 1;
|
||||
texture: GLuint = 0;
|
||||
unfold: boolean = true;
|
||||
|
||||
procedure closeapp;
|
||||
begin
|
||||
@ -84,66 +85,66 @@ var
|
||||
|
||||
ui._begin;
|
||||
|
||||
ui.beginGroup(GroupFlags_GrowDownFromLeft);
|
||||
ui.beginGroup(GroupFlags_GrowDownFromLeft);
|
||||
|
||||
ui.doCheckButton(none, 'Enable compression', options[OPTION_COMPRESS]);
|
||||
ui.doCheckButton(none, 'Enable compression', options[OPTION_COMPRESS]);
|
||||
|
||||
if options[OPTION_COMPRESS] then
|
||||
begin
|
||||
ui.beginGroup(GroupFlags_GrowLeftFromTop or GroupFlags_LayoutNoMargin);
|
||||
ui.doCheckButton(none, 'Show difference', options[OPTION_DIFF]);
|
||||
if options[OPTION_COMPRESS] then
|
||||
begin
|
||||
ui.beginGroup(GroupFlags_GrowLeftFromTop or GroupFlags_LayoutNoMargin);
|
||||
ui.doCheckButton(none, 'Show difference', options[OPTION_DIFF]);
|
||||
|
||||
ui.beginPanel(none, 'panel', true);
|
||||
ui.doCheckButton(none, 'Show difference', options[OPTION_DIFF]);
|
||||
ui.endPanel;
|
||||
ui.beginPanel(none, 'panel', unfold);
|
||||
ui.doCheckButton(none, 'Show difference', options[OPTION_DIFF]);
|
||||
ui.endPanel;
|
||||
|
||||
if options[OPTION_DIFF] then
|
||||
ui.doHorizontalSlider(none, 1, 16, errorScale);
|
||||
if options[OPTION_DIFF] then
|
||||
ui.doHorizontalSlider(none, 1, 16, errorScale);
|
||||
ui.endGroup;
|
||||
|
||||
ui.beginGroup(GroupFlags_GrowLeftFromTop);
|
||||
ui.doLabel(none, 'Format');
|
||||
|
||||
if options[OPTION_DXT5_YCOCG] then
|
||||
formatIdx := 0
|
||||
else
|
||||
formatIdx := 1;
|
||||
|
||||
ui.doComboBox(none, 2, formatLabel, formatIdx);
|
||||
options[OPTION_DXT5_YCOCG] := formatIdx = 0;
|
||||
ui.endGroup;
|
||||
end;
|
||||
|
||||
ui.doCheckButton(none, 'Display dummy texture', options[OPTION_THUMBNAIL]);
|
||||
|
||||
if options[OPTION_THUMBNAIL] then
|
||||
begin
|
||||
textureRect.Rect(0, 0, 100, 100);
|
||||
ui.doTextureView(textureRect, texture, textureRect);
|
||||
end;
|
||||
|
||||
ui.endGroup;
|
||||
|
||||
ui.beginGroup(GroupFlags_GrowLeftFromTop);
|
||||
ui.doLabel(none, 'Format');
|
||||
|
||||
if options[OPTION_DXT5_YCOCG] then
|
||||
formatIdx := 0
|
||||
else
|
||||
formatIdx := 1;
|
||||
|
||||
ui.doComboBox(none, 2, formatLabel, formatIdx);
|
||||
options[OPTION_DXT5_YCOCG] := formatIdx = 0;
|
||||
ui.endGroup;
|
||||
end;
|
||||
|
||||
ui.doCheckButton(none, 'Display dummy texture', options[OPTION_THUMBNAIL]);
|
||||
|
||||
if options[OPTION_THUMBNAIL] then
|
||||
begin
|
||||
textureRect.Rect(0, 0, 100, 100);
|
||||
ui.doTextureView(textureRect, texture, textureRect);
|
||||
end;
|
||||
ui.endGroup;
|
||||
|
||||
if options[OPTION_COMPRESS] then
|
||||
begin
|
||||
ui.beginGroup(GroupFlags_GrowDownFromRight);
|
||||
|
||||
if ui.doButton(none, 'Benchmark') then
|
||||
if options[OPTION_COMPRESS] then
|
||||
begin
|
||||
// doBenchmark = true;
|
||||
ui.beginGroup(GroupFlags_GrowDownFromRight);
|
||||
|
||||
if ui.doButton(none, 'Benchmark') then
|
||||
begin
|
||||
// doBenchmark = true;
|
||||
end;
|
||||
|
||||
if compressionRate <> 0 then
|
||||
begin
|
||||
Text := Format('%.2d Mpixels/sec', [100]);
|
||||
ui.doLabel(none, Text);
|
||||
end;
|
||||
|
||||
ui.endGroup;
|
||||
end;
|
||||
|
||||
if compressionRate <> 0 then
|
||||
begin
|
||||
Text := Format('%.2d Mpixels/sec', [100]);
|
||||
ui.doLabel(none, Text);
|
||||
end;
|
||||
|
||||
ui.endGroup;
|
||||
end;
|
||||
|
||||
// Pass non-ui mouse events to the manipulator
|
||||
//updateManipulator(ui, manipulator);
|
||||
// Pass non-ui mouse events to the manipulator
|
||||
//updateManipulator(ui, manipulator);
|
||||
|
||||
ui._end;
|
||||
end;
|
||||
|
@ -10,7 +10,8 @@ unit GLFreeType;
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, freetypeh, GL, GLu;
|
||||
SysUtils, freetypeh, GL, GLu,
|
||||
nvBaseFont;
|
||||
|
||||
//This holds all of the information related to any
|
||||
//freetype font that we want to create.
|
||||
@ -18,10 +19,24 @@ type
|
||||
|
||||
{ TGLFreeTypeFont }
|
||||
|
||||
TGLFreeTypeFont = object
|
||||
Height: cardinal; //< Holds the height of the font.
|
||||
TGLFreeTypeFont = object //class(TNVBaseFont)
|
||||
textures: pGLuint; //< Holds the texture id's
|
||||
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
|
||||
//of the height h from the file fname.
|
||||
|
@ -23,7 +23,7 @@ type
|
||||
protected
|
||||
procedure SetAngle(AValue: double); virtual;
|
||||
public
|
||||
constructor Create(AName: string; ASize: integer);
|
||||
constructor Create(AName: string; ASize: integer); virtual;
|
||||
|
||||
//font characteristics
|
||||
property Name: string read FName;
|
||||
|
@ -342,7 +342,7 @@ type
|
||||
procedure beginFrame(groupFlags: integer = GroupFlags_LayoutDefault; const rect: Rect = 0; style: integer = 0);
|
||||
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;
|
||||
|
||||
function getGroupWidth: integer;
|
||||
@ -1057,29 +1057,30 @@ begin
|
||||
aRect.y := aRect.y + (parentGroup.bounds.y + newGroup^.margin + EvalBool((newStart and GroupFlags_StartTop) > 0) * parentGroup.bounds.h - EvalBool((newAlign and GroupFlags_AlignTop) > 0) * (2 * newGroup^.margin + aRect.h));
|
||||
end
|
||||
else
|
||||
if parentLayout = GroupFlags_LayoutVertical then
|
||||
begin
|
||||
// Horizontal behavior.
|
||||
aRect.x := aRect.x + (parentGroup.bounds.x + newGroup^.margin + EvalBool((parentAlign and GroupFlags_AlignRight) > 0) * (parentGroup.bounds.w - 2 * newGroup^.margin - aRect.w));
|
||||
if parentLayout = GroupFlags_LayoutVertical then
|
||||
begin
|
||||
// Horizontal behavior.
|
||||
aRect.x := aRect.x + (parentGroup.bounds.x + newGroup^.margin + EvalBool((parentAlign and GroupFlags_AlignRight) > 0) * (parentGroup.bounds.w - 2 * newGroup^.margin - aRect.w));
|
||||
|
||||
// Vertical behavior.
|
||||
if (parentAlign and GroupFlags_AlignTop) > 0 then
|
||||
aRect.y := aRect.y + (parentGroup.bounds.y - (EvalBool(parentGroup.bounds.h > 0) * parentGroup.space) - newGroup^.margin - aRect.h)
|
||||
// Vertical behavior.
|
||||
if (parentAlign and GroupFlags_AlignTop) > 0 then
|
||||
aRect.y := aRect.y + (parentGroup.bounds.y - (EvalBool(parentGroup.bounds.h > 0) * parentGroup.space) - newGroup^.margin - aRect.h)
|
||||
else
|
||||
aRect.y := aRect.y + (parentGroup.bounds.y + parentGroup.bounds.h + EvalBool(parentGroup.bounds.h > 0) * parentGroup.space + newGroup^.margin);
|
||||
end
|
||||
else
|
||||
aRect.y := aRect.y + (parentGroup.bounds.y + parentGroup.bounds.h + EvalBool(parentGroup.bounds.h > 0) * parentGroup.space + newGroup^.margin);
|
||||
end
|
||||
else
|
||||
if parentLayout = GroupFlags_LayoutHorizontal then
|
||||
begin
|
||||
// Horizontal behavior.
|
||||
if (parentAlign and GroupFlags_AlignRight) > 0 then
|
||||
aRect.x := aRect.x + (parentGroup.bounds.x - (EvalBool(parentGroup.bounds.w > 0) * parentGroup.space) - newGroup^.margin - aRect.w)
|
||||
else
|
||||
aRect.x := aRect.x + (parentGroup.bounds.x + parentGroup.bounds.w + EvalBool(parentGroup.bounds.w > 0) * parentGroup.space + newGroup^.margin);
|
||||
if parentLayout = GroupFlags_LayoutHorizontal then
|
||||
begin
|
||||
// Horizontal behavior.
|
||||
if (parentAlign and GroupFlags_AlignRight) > 0 then
|
||||
aRect.x := aRect.x + (parentGroup.bounds.x - (EvalBool(parentGroup.bounds.w > 0) * parentGroup.space) - newGroup^.margin - aRect.w)
|
||||
else
|
||||
aRect.x := aRect.x + (parentGroup.bounds.x + parentGroup.bounds.w + EvalBool(parentGroup.bounds.w > 0) * parentGroup.space + newGroup^.margin);
|
||||
|
||||
// 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));
|
||||
end;
|
||||
|
||||
// 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));
|
||||
end;
|
||||
newGroup^.bounds := aRect;
|
||||
end;
|
||||
|
||||
@ -1132,7 +1133,7 @@ begin
|
||||
m_painter.drawFrame(m_groupStack[m_groupIndex + 1].bounds, m_groupStack[m_groupIndex + 1].margin, 0);
|
||||
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
|
||||
rt: Rect;
|
||||
ra: Rect;
|
||||
@ -1143,13 +1144,17 @@ var
|
||||
tmp: Rect;
|
||||
begin
|
||||
rpanel := m_painter.getPanelRect(SetRect(r.x, r.y), Text, rt, ra);
|
||||
|
||||
if (groupFlags and GroupFlags_LayoutDefault) > 0 then
|
||||
groupFlags := GroupFlags_LayoutDefaultFallback;
|
||||
|
||||
beginGroup((groupFlags or GroupFlags_LayoutNoMargin or GroupFlags_LayoutNoSpace) and GroupFlags_StartXMask, rpanel);
|
||||
|
||||
aRect := m_groupStack[m_groupIndex].bounds;
|
||||
|
||||
focus := hasFocus(aRect);
|
||||
hover := isHover(aRect);
|
||||
|
||||
if focus then
|
||||
begin
|
||||
m_uiOnFocus := True;
|
||||
|
Reference in New Issue
Block a user