fixed TOpenGlControl at designtime

git-svn-id: trunk@8439 -
This commit is contained in:
mattias 2006-01-04 16:56:49 +00:00
parent dbba7ab026
commit b032ace882
7 changed files with 302 additions and 11 deletions

2
.gitattributes vendored
View File

@ -198,7 +198,9 @@ components/opengl/gtk2x11/include/xsettings-common.inc svneol=native#text/plain
components/opengl/gtk2x11/scripts/gdkx11_h2pas.sh svneol=native#text/plain
components/opengl/lazopenglcontext.lpk svneol=native#text/plain
components/opengl/lazopenglcontext.pas svneol=native#text/plain
components/opengl/openglcontext.lrs svneol=native#text/plain
components/opengl/openglcontext.pas svneol=native#text/plain
components/opengl/topenglcontrol.xpm svneol=native#text/plain
components/prettyformat/pfidesource.pas svneol=native#text/plain
components/prettyformat/prettyformat.lpk svneol=native#text/plain
components/prettyformat/prettyformat.pas svneol=native#text/plain

View File

@ -71,7 +71,6 @@ begin
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glViewport(0,0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0, double(width) / height, 0.1, 100.0);

View File

@ -11,7 +11,7 @@
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=""/>
<ActiveEditorIndexAtStart Value="3"/>
<ActiveEditorIndexAtStart Value="1"/>
</General>
<LazDoc Paths=""/>
<Units Count="2">
@ -21,10 +21,10 @@
<IsPartOfProject Value="True"/>
<TopLine Value="1"/>
<UnitName Value="TestOpenGLContext1"/>
<UsageCount Value="134"/>
<UsageCount Value="141"/>
</Unit0>
<Unit1>
<CursorPos X="9" Y="107"/>
<CursorPos X="19" Y="109"/>
<EditorIndex Value="0"/>
<Filename Value="mainunit.pas"/>
<ComponentName Value="Form1"/>
@ -33,7 +33,7 @@
<ResourceFilename Value="mainunit.lrs"/>
<TopLine Value="97"/>
<UnitName Value="MainUnit"/>
<UsageCount Value="134"/>
<UsageCount Value="141"/>
</Unit1>
</Units>
<PublishOptions>

View File

@ -0,0 +1,73 @@
LazarusResources.Add('topenglcontrol','XPM',[
'/* XPM */'#10'static char * tgtkglareacontrol_xpm[] = {'#10'"18 21 187 2",'
+#10'" '#9'c None",'#10'". '#9'c #C2DAFE",'#10'"+ '#9'c #BECEFE",'#10'"@ '#9
+'c #B2C2FE",'#10'"# '#9'c #B6CAFE",'#10'"$ '#9'c #AABAFE",'#10'"% '#9'c #A2A'
+'EFE",'#10'"& '#9'c #96A2FE",'#10'"* '#9'c #A2B2FE",'#10'"= '#9'c #929EFE",'
+#10'"- '#9'c #8E92FE",'#10'"; '#9'c #868AFE",'#10'"> '#9'c #8A82FE",'#10'", '
+#9'c #62AAFE",'#10'"'' '#9'c #7EAAFA",'#10'") '#9'c #A6BEFA",'#10'"! '#9'c #'
+'AEBEFE",'#10'"~ '#9'c #9AA2FE",'#10'"{ '#9'c #9296FE",'#10'"] '#9'c #7E86F6'
+'",'#10'"^ '#9'c #3E66DE",'#10'"/ '#9'c #064ABA",'#10'"( '#9'c #66AAFE",'#10
+'"_ '#9'c #5E96F6",'#10'": '#9'c #5A92F6",'#10'"< '#9'c #7E9AF6",'#10'"[ '#9
+'c #92A2FA",'#10'"} '#9'c #7E92FA",'#10'"| '#9'c #4E76E6",'#10'"1 '#9'c #125'
+'2C6",'#10'"2 '#9'c #0246B2",'#10'"3 '#9'c #06429E",'#10'"4 '#9'c #66A2FA",'
+#10'"5 '#9'c #5E8AEE",'#10'"6 '#9'c #5A8EEE",'#10'"7 '#9'c #527EE6",'#10'"8 '
+#9'c #527AE6",'#10'"9 '#9'c #2262E6",'#10'"0 '#9'c #0252CE",'#10'"a '#9'c #0'
+'24ABA",'#10'"b '#9'c #0642A6",'#10'"c '#9'c #0A4296",'#10'"d '#9'c #5286FA"'
+','#10'"e '#9'c #527AE2",'#10'"f '#9'c #5276DA",'#10'"g '#9'c #4272E2",'#10
+'"h '#9'c #0A5ADE",'#10'"i '#9'c #024EBE",'#10'"j '#9'c #0246AA",'#10'"k '#9
+'c #063A92",'#10'"l '#9'c #06367E",'#10'"m '#9'c #FEDADA",'#10'"n '#9'c #FAC'
+'ECE",'#10'"o '#9'c #3E76EE",'#10'"p '#9'c #5272DA",'#10'"q '#9'c #4E6ED6",'
+#10'"r '#9'c #3A5AC6",'#10'"s '#9'c #0A4EC2",'#10'"t '#9'c #0646AA",'#10'"u '
+#9'c #063E92",'#10'"v '#9'c #06327A",'#10'"w '#9'c #062E72",'#10'"x '#9'c #F'
+'EC2C2",'#10'"y '#9'c #F6B6B6",'#10'"z '#9'c #3266DE",'#10'"A '#9'c #4A66CE"'
+','#10'"B '#9'c #4A62CA",'#10'"C '#9'c #0A46AE",'#10'"D '#9'c #063686",'#10
+'"E '#9'c #062E6A",'#10'"F '#9'c #0A2656",'#10'"G '#9'c #FEB6B6",'#10'"H '#9
+'c #F6A6AA",'#10'"I '#9'c #4662CE",'#10'"J '#9'c #425ACA",'#10'"K '#9'c #3E5'
+'2C2",'#10'"L '#9'c #324EB6",'#10'"M '#9'c #0A3272",'#10'"N '#9'c #12223E",'
+#10'"O '#9'c #FE6666",'#10'"P '#9'c #FE8686",'#10'"Q '#9'c #FEAAAA",'#10'"R '
+#9'c #FEAEB2",'#10'"S '#9'c #FEA6A2",'#10'"T '#9'c #E67E7E",'#10'"U '#9'c #8'
+'64666",'#10'"V '#9'c #4A4EAA",'#10'"W '#9'c #3E4ABA",'#10'"X '#9'c #2E42AA"'
+','#10'"Y '#9'c #0A368A",'#10'"Z '#9'c #0E2652",'#10'"` '#9'c #223E46",'#10
+'" .'#9'c #5A6E26",'#10'"..'#9'c #FA4E4E",'#10'"+.'#9'c #F64646",'#10'"@.'#9
+'c #F64A4A",'#10'"#.'#9'c #F66E72",'#10'"$.'#9'c #F28A86",'#10'"%.'#9'c #DA6'
+'E6E",'#10'"&.'#9'c #862626",'#10'"*.'#9'c #461206",'#10'"=.'#9'c #3A529A",'
+#10'"-.'#9'c #0A2E6E",'#10'";.'#9'c #425A32",'#10'">.'#9'c #5E8222",'#10'",.'
+#9'c #5E9626",'#10'"''.'#9'c #629622",'#10'").'#9'c #F24242",'#10'"!.'#9'c #'
+'EE3E3E",'#10'"~.'#9'c #EE3A3A",'#10'"{.'#9'c #E63232",'#10'"].'#9'c #9E0A0A'
+'",'#10'"^.'#9'c #6A0202",'#10'"/.'#9'c #72DE3E",'#10'"(.'#9'c #96EE6A",'#10
+'"_.'#9'c #5ADA26",'#10'":.'#9'c #6EB23E",'#10'"<.'#9'c #6ABA3E",'#10'"[.'#9
+'c #66BA3E",'#10'"}.'#9'c #5EBE32",'#10'"|.'#9'c #4AA21E",'#10'"1.'#9'c #367'
+'A0E",'#10'"2.'#9'c #EE4242",'#10'"3.'#9'c #E63636",'#10'"4.'#9'c #A60606",'
+#10'"5.'#9'c #7A0206",'#10'"6.'#9'c #3ECE02",'#10'"7.'#9'c #3ECA0A",'#10'"8.'
+#9'c #76E64A",'#10'"9.'#9'c #8AFE62",'#10'"0.'#9'c #76FA4E",'#10'"a.'#9'c #6'
+'2DA3A",'#10'"b.'#9'c #329616",'#10'"c.'#9'c #1E6E06",'#10'"d.'#9'c #1A6206"'
+','#10'"e.'#9'c #E63632",'#10'"f.'#9'c #E62E2E",'#10'"g.'#9'c #E22626",'#10
+'"h.'#9'c #960206",'#10'"i.'#9'c #6E0206",'#10'"j.'#9'c #3EC606",'#10'"k.'#9
+'c #3AC606",'#10'"l.'#9'c #36BA02",'#10'"m.'#9'c #32B602",'#10'"n.'#9'c #4EC'
+'226",'#10'"o.'#9'c #36961E",'#10'"p.'#9'c #1E7206",'#10'"q.'#9'c #1A6202",'
+#10'"r.'#9'c #165E02",'#10'"s.'#9'c #1A5A06",'#10'"t.'#9'c #EA3636",'#10'"u.'
+#9'c #E22E2E",'#10'"v.'#9'c #DE2A2A",'#10'"w.'#9'c #D61E1E",'#10'"x.'#9'c #8'
+'20202",'#10'"y.'#9'c #560206",'#10'"z.'#9'c #36B606",'#10'"A.'#9'c #32AE06"'
+','#10'"B.'#9'c #2EA206",'#10'"C.'#9'c #1E6606",'#10'"D.'#9'c #1A5E06",'#10
+'"E.'#9'c #165606",'#10'"F.'#9'c #164E06",'#10'"G.'#9'c #420206",'#10'"H.'#9
+'c #32AA06",'#10'"I.'#9'c #2EA606",'#10'"J.'#9'c #269606",'#10'"K.'#9'c #124'
+'606",'#10'"L.'#9'c #5E0206",'#10'"M.'#9'c #2AA206",'#10'"N.'#9'c #2A9E06",'
+#10'"O.'#9'c #268E06",'#10'"P.'#9'c #165206",'#10'"Q.'#9'c #164A06",'#10'"R.'
+#9'c #123E06",'#10'"S.'#9'c #2AA606",'#10'"T.'#9'c #2A9A06",'#10'"U.'#9'c #2'
+'28606",'#10'"V.'#9'c #124E06",'#10'"W.'#9'c #124206",'#10'"X.'#9'c #0E3A06"'
+','#10'"Y.'#9'c #123606",'#10'"Z.'#9'c #228A06",'#10'"`.'#9'c #1A7A06",'#10
+'" +'#9'c #0E3E06",'#10'".+'#9'c #1A6E06",'#10'"++'#9'c #0E3606",'#10'" '
+' . + ",'#10'" @ @ # $ % & '
+'",'#10'" @ @ @ @ @ * = - ; > ",'#10'" , '' ) ! % '
+'~ { ] ^ / ",'#10'" ( _ : < [ } | 1 2 3 ",'#10'" '
+' 4 5 6 7 8 9 0 a b c ",'#10'" d 7 e f g h i j k l ",'
+#10'" m n o f p q r s t u v w ",'#10'" x x x y z q A B r C k D'
+' E F ",'#10'"x x x x G H I B J K L c v M F N ",'#10'"O P Q G R S T '
,'U V W X Y w Z ` . ",'#10'"..+.@.#.$.%.&.*.*.*.=.-.` ;. .>.,.''.",'#10'"'
+'@.).!.~.{.].^.*./.(._.:.:.<.[.}.|.1.",'#10'"2.!.3.3.{.4.5.*.6.7._.8.9.0.a.b'
+'.c.d.",'#10'"!.e.{.f.g.h.i.*.j.k.l.m.n.o.p.q.r.s.",'#10'"t.u.v.g.w.x.y.*.l.'
+'z.z.A.B.r.C.D.E.F.",'#10'" w.w.w.i.G.*.z.H.I.I.J.D.D.E.F.K.",'#10'" '
+' w.L. H.I.M.N.O.E.P.Q.K.R.",'#10'" S.T.J.O.U.Q.V.W.X.Y.'
+'",'#10'" Z.Z.`.W. +X. ",'#10'" '
+' .+++ "};'#10
]);

View File

@ -27,7 +27,7 @@ unit OpenGLContext;
interface
uses
Classes, SysUtils, LCLProc, Forms, Controls, LCLType, LCLIntf,
Classes, SysUtils, LCLProc, Forms, Controls, LCLType, LCLIntf, LResources,
Graphics, LMessages, WSLCLClasses, WSControls;
type
@ -96,6 +96,7 @@ type
published
property Align;
property Anchors;
property AutoResizeViewport;
property BorderSpacing;
property Enabled;
property OnClick;
@ -284,17 +285,21 @@ end;
procedure TCustomOpenGLControl.Paint;
begin
if IsVisible and HandleAllocated and MakeCurrent then begin
if IsVisible and HandleAllocated then begin
UpdateFrameTimeDiff;
if AutoResizeViewport then
LOpenGLViewport(0,0,Width,Height);
if ([csDesigning,csDestroying]*ComponentState=[]) then begin
if not MakeCurrent then exit;
if AutoResizeViewport then
LOpenGLViewport(0,0,Width,Height);
end;
DoOnPaint;
end;
end;
procedure TCustomOpenGLControl.RealizeBounds;
begin
if IsVisible and HandleAllocated and MakeCurrent then begin
if IsVisible and HandleAllocated
and ([csDesigning,csDestroying]*ComponentState=[]) and MakeCurrent then begin
if AutoResizeViewport then
LOpenGLViewport(0,0,Width,Height);
end;
@ -315,6 +320,7 @@ function TCustomOpenGLControl.MakeCurrent(SaveOldToStack: boolean): boolean;
var
Allowed: Boolean;
begin
if csDesigning in ComponentState then exit(false);
if Assigned(FOnMakeCurrent) then begin
Allowed:=true;
OnMakeCurrent(Self,Allowed);
@ -385,6 +391,7 @@ end;
initialization
RegisterWSComponent(TCustomOpenGLControl,TWSOpenGLControl);
{$I openglcontext.lrs}
end.

View File

@ -0,0 +1,211 @@
/* XPM */
static char * tgtkglareacontrol_xpm[] = {
"18 21 187 2",
" c None",
". c #C2DAFE",
"+ c #BECEFE",
"@ c #B2C2FE",
"# c #B6CAFE",
"$ c #AABAFE",
"% c #A2AEFE",
"& c #96A2FE",
"* c #A2B2FE",
"= c #929EFE",
"- c #8E92FE",
"; c #868AFE",
"> c #8A82FE",
", c #62AAFE",
"' c #7EAAFA",
") c #A6BEFA",
"! c #AEBEFE",
"~ c #9AA2FE",
"{ c #9296FE",
"] c #7E86F6",
"^ c #3E66DE",
"/ c #064ABA",
"( c #66AAFE",
"_ c #5E96F6",
": c #5A92F6",
"< c #7E9AF6",
"[ c #92A2FA",
"} c #7E92FA",
"| c #4E76E6",
"1 c #1252C6",
"2 c #0246B2",
"3 c #06429E",
"4 c #66A2FA",
"5 c #5E8AEE",
"6 c #5A8EEE",
"7 c #527EE6",
"8 c #527AE6",
"9 c #2262E6",
"0 c #0252CE",
"a c #024ABA",
"b c #0642A6",
"c c #0A4296",
"d c #5286FA",
"e c #527AE2",
"f c #5276DA",
"g c #4272E2",
"h c #0A5ADE",
"i c #024EBE",
"j c #0246AA",
"k c #063A92",
"l c #06367E",
"m c #FEDADA",
"n c #FACECE",
"o c #3E76EE",
"p c #5272DA",
"q c #4E6ED6",
"r c #3A5AC6",
"s c #0A4EC2",
"t c #0646AA",
"u c #063E92",
"v c #06327A",
"w c #062E72",
"x c #FEC2C2",
"y c #F6B6B6",
"z c #3266DE",
"A c #4A66CE",
"B c #4A62CA",
"C c #0A46AE",
"D c #063686",
"E c #062E6A",
"F c #0A2656",
"G c #FEB6B6",
"H c #F6A6AA",
"I c #4662CE",
"J c #425ACA",
"K c #3E52C2",
"L c #324EB6",
"M c #0A3272",
"N c #12223E",
"O c #FE6666",
"P c #FE8686",
"Q c #FEAAAA",
"R c #FEAEB2",
"S c #FEA6A2",
"T c #E67E7E",
"U c #864666",
"V c #4A4EAA",
"W c #3E4ABA",
"X c #2E42AA",
"Y c #0A368A",
"Z c #0E2652",
"` c #223E46",
" . c #5A6E26",
".. c #FA4E4E",
"+. c #F64646",
"@. c #F64A4A",
"#. c #F66E72",
"$. c #F28A86",
"%. c #DA6E6E",
"&. c #862626",
"*. c #461206",
"=. c #3A529A",
"-. c #0A2E6E",
";. c #425A32",
">. c #5E8222",
",. c #5E9626",
"'. c #629622",
"). c #F24242",
"!. c #EE3E3E",
"~. c #EE3A3A",
"{. c #E63232",
"]. c #9E0A0A",
"^. c #6A0202",
"/. c #72DE3E",
"(. c #96EE6A",
"_. c #5ADA26",
":. c #6EB23E",
"<. c #6ABA3E",
"[. c #66BA3E",
"}. c #5EBE32",
"|. c #4AA21E",
"1. c #367A0E",
"2. c #EE4242",
"3. c #E63636",
"4. c #A60606",
"5. c #7A0206",
"6. c #3ECE02",
"7. c #3ECA0A",
"8. c #76E64A",
"9. c #8AFE62",
"0. c #76FA4E",
"a. c #62DA3A",
"b. c #329616",
"c. c #1E6E06",
"d. c #1A6206",
"e. c #E63632",
"f. c #E62E2E",
"g. c #E22626",
"h. c #960206",
"i. c #6E0206",
"j. c #3EC606",
"k. c #3AC606",
"l. c #36BA02",
"m. c #32B602",
"n. c #4EC226",
"o. c #36961E",
"p. c #1E7206",
"q. c #1A6202",
"r. c #165E02",
"s. c #1A5A06",
"t. c #EA3636",
"u. c #E22E2E",
"v. c #DE2A2A",
"w. c #D61E1E",
"x. c #820202",
"y. c #560206",
"z. c #36B606",
"A. c #32AE06",
"B. c #2EA206",
"C. c #1E6606",
"D. c #1A5E06",
"E. c #165606",
"F. c #164E06",
"G. c #420206",
"H. c #32AA06",
"I. c #2EA606",
"J. c #269606",
"K. c #124606",
"L. c #5E0206",
"M. c #2AA206",
"N. c #2A9E06",
"O. c #268E06",
"P. c #165206",
"Q. c #164A06",
"R. c #123E06",
"S. c #2AA606",
"T. c #2A9A06",
"U. c #228606",
"V. c #124E06",
"W. c #124206",
"X. c #0E3A06",
"Y. c #123606",
"Z. c #228A06",
"`. c #1A7A06",
" + c #0E3E06",
".+ c #1A6E06",
"++ c #0E3606",
" . + ",
" @ @ # $ % & ",
" @ @ @ @ @ * = - ; > ",
" , ' ) ! % ~ { ] ^ / ",
" ( _ : < [ } | 1 2 3 ",
" 4 5 6 7 8 9 0 a b c ",
" d 7 e f g h i j k l ",
" m n o f p q r s t u v w ",
" x x x y z q A B r C k D E F ",
"x x x x G H I B J K L c v M F N ",
"O P Q G R S T U V W X Y w Z ` . ",
"..+.@.#.$.%.&.*.*.*.=.-.` ;. .>.,.'.",
"@.).!.~.{.].^.*./.(._.:.:.<.[.}.|.1.",
"2.!.3.3.{.4.5.*.6.7._.8.9.0.a.b.c.d.",
"!.e.{.f.g.h.i.*.j.k.l.m.n.o.p.q.r.s.",
"t.u.v.g.w.x.y.*.l.z.z.A.B.r.C.D.E.F.",
" w.w.w.i.G.*.z.H.I.I.J.D.D.E.F.K.",
" w.L. H.I.M.N.O.E.P.Q.K.R.",
" S.T.J.O.U.Q.V.W.X.Y.",
" Z.Z.`.W. +X. ",
" .+++ "};

View File

@ -3020,7 +3020,6 @@ var
HeaderSrc: String;
OutputDir: String;
OldSrc: String;
CaseInsensitiveUnitName: String;
NeedsRegisterProcCall: boolean;
begin
{$IFDEF VerbosePkgCompile}