You've already forked lazarus-ccr
Implemented multi line support
Some formatting improvements Added fpdoc path to project file git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2214 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -13,6 +13,7 @@
|
|||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
<ResourceType Value="res"/>
|
<ResourceType Value="res"/>
|
||||||
</General>
|
</General>
|
||||||
|
<LazDoc Paths="..\..\..\doc"/>
|
||||||
<i18n>
|
<i18n>
|
||||||
<EnableI18N LFM="False"/>
|
<EnableI18N LFM="False"/>
|
||||||
</i18n>
|
</i18n>
|
||||||
@ -32,7 +33,7 @@
|
|||||||
<FormatVersion Value="1"/>
|
<FormatVersion Value="1"/>
|
||||||
</local>
|
</local>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<Units Count="3">
|
<Units Count="5">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="example.pp"/>
|
<Filename Value="example.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -48,10 +49,20 @@
|
|||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="nvShaderUtils"/>
|
<UnitName Value="nvShaderUtils"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
|
<Unit3>
|
||||||
|
<Filename Value="..\nvWidgets.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="nvWidgets"/>
|
||||||
|
</Unit3>
|
||||||
|
<Unit4>
|
||||||
|
<Filename Value="..\nvglutwidgets.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="nvGlutWidgets"/>
|
||||||
|
</Unit4>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="10"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<Target>
|
<Target>
|
||||||
<Filename Value="example"/>
|
<Filename Value="example"/>
|
||||||
@ -69,9 +80,9 @@
|
|||||||
</Parsing>
|
</Parsing>
|
||||||
<Linking>
|
<Linking>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<UseLineInfoUnit Value="False"/>
|
<DebugInfoType Value="dsStabs"/>
|
||||||
|
<UseHeaptrc Value="True"/>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
<LinkSmart Value="True"/>
|
|
||||||
</Linking>
|
</Linking>
|
||||||
<Other>
|
<Other>
|
||||||
<CompilerMessages>
|
<CompilerMessages>
|
||||||
|
@ -803,25 +803,34 @@ var
|
|||||||
w: integer;
|
w: integer;
|
||||||
wLine: integer;
|
wLine: integer;
|
||||||
i: integer;
|
i: integer;
|
||||||
|
s: TStrings;
|
||||||
|
t: string;
|
||||||
|
j: Integer;
|
||||||
begin
|
begin
|
||||||
|
s := TStringList.Create;
|
||||||
|
|
||||||
|
try
|
||||||
|
s.Text:= Text;
|
||||||
w := 0;
|
w := 0;
|
||||||
wLine := 0;
|
wLine := 0;
|
||||||
nbLines := 1;
|
|
||||||
|
|
||||||
for i := 1 to length(Text) do
|
nbLines := s.Count;
|
||||||
|
|
||||||
|
for i := 0 to nbLines - 1 do
|
||||||
begin
|
begin
|
||||||
if (Text[i] <> #13) and (Text[i + 1] <> #10) then
|
|
||||||
wLine := wLine + glutBitmapWidth(GLUT_BITMAP_HELVETICA_12, Ord(Text[i]))
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
Inc(nbLines);
|
|
||||||
w := max(w, wLine);
|
|
||||||
wLine := 0;
|
wLine := 0;
|
||||||
|
t := s[i];
|
||||||
|
|
||||||
|
for j := 1 to Length(t) do
|
||||||
|
wLine := wLine + glutBitmapWidth(GLUT_BITMAP_HELVETICA_12, Ord(t[j]));
|
||||||
|
|
||||||
|
w := Max(w, wLine);
|
||||||
end;
|
end;
|
||||||
|
finally
|
||||||
|
s.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
w := max(w, wLine) + 2;
|
Result := Max(w, wLine) + 2;
|
||||||
Result := w;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GLUIPainter.getTextLineWidthAt(const Text: string; charNb: integer): integer;
|
function GLUIPainter.getTextLineWidthAt(const Text: string; charNb: integer): integer;
|
||||||
@ -923,42 +932,24 @@ end;
|
|||||||
|
|
||||||
procedure GLUIPainter.drawString(x: integer; y: integer; Text: string; nbLines: integer);
|
procedure GLUIPainter.drawString(x: integer; y: integer; Text: string; nbLines: integer);
|
||||||
var
|
var
|
||||||
endNb: integer;
|
s: TStrings;
|
||||||
startNb: integer;
|
t: string;
|
||||||
textOri: string;
|
i: Integer;
|
||||||
lineNb: integer;
|
|
||||||
begin
|
begin
|
||||||
glListBase(m_textListBase);
|
glListBase(m_textListBase);
|
||||||
|
|
||||||
if nbLines < 2 then
|
s := TStringList.Create;
|
||||||
begin
|
try
|
||||||
glRasterPos2i(x + 1, y + 4);
|
s.Text := Text;
|
||||||
glCallLists(Length(Text), GL_UNSIGNED_BYTE, @Text[1]);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
lineNb := nbLines;
|
|
||||||
startNb := 0;
|
|
||||||
endNb := 0;
|
|
||||||
|
|
||||||
textOri := Text;
|
for i := 0 to s.Count - 1 do
|
||||||
{$note fix multiline support, use TStrings instead of array of string}
|
begin
|
||||||
//while lineNb <>0 do
|
t := s[s.Count - 1 - i];
|
||||||
//begin
|
glRasterPos2i(x + 1, y + 4 + i * getFontHeight);
|
||||||
// if {*}text^<>#0)and( *text<>#13#10 then
|
glCallLists(Length(t), GL_UNSIGNED_BYTE, @t[1]);
|
||||||
// begin
|
end;
|
||||||
// inc(endNb);
|
finally
|
||||||
// end
|
s.Free;
|
||||||
// else
|
|
||||||
// begin
|
|
||||||
// dec(lineNb);
|
|
||||||
// glRasterPos2i(x+1,y+4+lineNb*getFontHeight);
|
|
||||||
// glCallLists(endNb-startNb,GL_UNSIGNED_BYTE,textOri+startNb);
|
|
||||||
// inc(endNb);
|
|
||||||
// startNb:= endNb;
|
|
||||||
// end;
|
|
||||||
// inc(text);
|
|
||||||
//end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1043,6 +1034,7 @@ begin
|
|||||||
glTexCoord2f(0, yb);
|
glTexCoord2f(0, yb);
|
||||||
glVertex2f(x1, y3);
|
glVertex2f(x1, y3);
|
||||||
glEnd;
|
glEnd;
|
||||||
|
|
||||||
glBegin(GL_TRIANGLE_STRIP);
|
glBegin(GL_TRIANGLE_STRIP);
|
||||||
glTexCoord2f(0, yb);
|
glTexCoord2f(0, yb);
|
||||||
glVertex2f(x2, y0);
|
glVertex2f(x2, y0);
|
||||||
@ -1064,6 +1056,7 @@ begin
|
|||||||
glTexCoord2f(xb, yb);
|
glTexCoord2f(xb, yb);
|
||||||
glVertex2f(x3, y3);
|
glVertex2f(x3, y3);
|
||||||
glEnd;
|
glEnd;
|
||||||
|
|
||||||
glBegin(GL_TRIANGLE_STRIP);
|
glBegin(GL_TRIANGLE_STRIP);
|
||||||
glTexCoord2f(0, yb);
|
glTexCoord2f(0, yb);
|
||||||
glVertex2f(x1, y0);
|
glVertex2f(x1, y0);
|
||||||
|
Reference in New Issue
Block a user