diff --git a/uppsrc/GLCtrl/GLCtrl.cpp b/uppsrc/GLCtrl/GLCtrl.cpp index b92738130..885fc348a 100644 --- a/uppsrc/GLCtrl/GLCtrl.cpp +++ b/uppsrc/GLCtrl/GLCtrl.cpp @@ -2,6 +2,14 @@ namespace Upp { +Image GLCtrl::MouseEvent(int event, Point p, int zdelta, dword keyflags) +{ + if(mouseTarget) { + return mouseTarget->MouseEvent(event, p + GetScreenView().TopLeft() - mouseTarget->GetScreenView().TopLeft(), zdelta, keyflags); + } + return Ctrl::MouseEvent(event, p, zdelta, keyflags); +} + void GLCtrl::GLResize(int w, int h) { glViewport(0, 0, (GLsizei)w, (GLsizei)h); diff --git a/uppsrc/GLCtrl/GLCtrl.h b/uppsrc/GLCtrl/GLCtrl.h index 619dffbb0..17cfa7701 100644 --- a/uppsrc/GLCtrl/GLCtrl.h +++ b/uppsrc/GLCtrl/GLCtrl.h @@ -42,7 +42,7 @@ public: virtual void Paint(Draw& w); public: - Callback WhenGLPaint; + Event<> WhenGLPaint; virtual void GLPaint(); virtual void GLResize(int w, int h); @@ -54,6 +54,9 @@ public: class GLCtrl : public Ctrl { typedef GLCtrl CLASSNAME; + +public: + virtual Image MouseEvent(int event, Point p, int zdelta, dword keyflags); private: class GLPicking @@ -134,6 +137,7 @@ private: bool doubleBuffering; bool multiSampleBuffering; int numberOfSamples; + Ctrl *mouseTarget = NULL; protected: // Called after succesful OpenGL initialization @@ -156,6 +160,7 @@ public: GLCtrl& StencilBits(int n) { stencilSize = n; return *this; } GLCtrl& DoubleBuffering(bool b = true) { doubleBuffering = b; return *this; } GLCtrl& MSAA(int n = 4) { numberOfSamples = n; return *this; } + GLCtrl& RedirectMouse(Ctrl *target) { mouseTarget = target; return *this; } GLCtrl(int depthsize = 24, int stencilsize = 8, bool doublebuffer = true, bool multisamplebuffering = false, int numberofsamples = 0) diff --git a/uppsrc/GLDraw/GLDraw.cpp b/uppsrc/GLDraw/GLDraw.cpp index 391196ab6..2080acc07 100644 --- a/uppsrc/GLDraw/GLDraw.cpp +++ b/uppsrc/GLDraw/GLDraw.cpp @@ -57,7 +57,7 @@ void GLDraw::PutImage(Point p, const Image& img, const Rect& src) glEnd(); } - glDisable(GL_TEXTURE_2D); + glDisable(GL_TEXTURE_2D); } void GLDraw::SetColor(Color c) diff --git a/uppsrc/GLDraw/GLDraw.h b/uppsrc/GLDraw/GLDraw.h index 158c15a59..6d1836d8a 100644 --- a/uppsrc/GLDraw/GLDraw.h +++ b/uppsrc/GLDraw/GLDraw.h @@ -99,7 +99,8 @@ public: static void ClearCache(); static void ResetCache(); - GLDraw() { context = 0; } + GLDraw() { context = 0; } + GLDraw(Size sz) { Init(sz); } ~GLDraw(); }; diff --git a/uppsrc/GLDraw/GLDrawS.cpp b/uppsrc/GLDraw/GLDrawS.cpp index 70ec4e07c..57f7c2f54 100644 --- a/uppsrc/GLDraw/GLDrawS.cpp +++ b/uppsrc/GLDraw/GLDrawS.cpp @@ -74,9 +74,8 @@ void initializeGL() uniform sampler2D s_texture; void main() { -// gl_FragColor = texture2D(s_texture, v_texCoord); gl_FragColor = v_color; - gl_FragColor[3] = texture2D(s_texture, v_texCoord)[3]; + gl_FragColor.a = texture2D(s_texture, v_texCoord).a; } )", ATTRIB_VERTEX, "a_position", @@ -108,7 +107,7 @@ void initializeGL() } )", ATTRIB_VERTEX, "a_position", - ATTRIB_COLOR, "a_color" + ATTRIB_COLOR, "a_color" // we need this per vertex because we want to group rects ); u_color = gl_rect.GetUniform("u_color"); @@ -284,6 +283,7 @@ void GLDraw::PutRect(const Rect& rect, Color color) void GLDraw::PutImage(Point p, const Image& img, const Rect& src) { LTIMING("PutImage"); + FlushPutRect(); gl_image.Use(); @@ -334,7 +334,7 @@ void GLDraw::PutImage(Point p, const Image& img, const Rect& src) glVertexAttribPointer(ATTRIB_VERTEX, 2, GL_SHORT, GL_FALSE, 2 * sizeof(GLshort), vertex); glBindTexture(GL_TEXTURE_2D, GetTextureForImage(img)); - glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices); +// glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices); glDisableVertexAttribArray(ATTRIB_TEXPOS); } @@ -370,7 +370,7 @@ void GLDraw::PutImage(Point p, const Image& img, const Rect& src, Color color) static GLushort indices[] = { 0, 1, 2, 0, 2, 3 }; const float *tc; - + if(src == img.GetSize()) { static float fixed[] = { 0.0, 0.0, @@ -438,6 +438,7 @@ void GLDraw::Finish() GLDraw::~GLDraw() { + FlushPutRect(); } }; diff --git a/uppsrc/GLDraw/Texture.cpp b/uppsrc/GLDraw/Texture.cpp index bc2fc9956..e5a507c1b 100644 --- a/uppsrc/GLDraw/Texture.cpp +++ b/uppsrc/GLDraw/Texture.cpp @@ -15,7 +15,6 @@ GLuint CreateGLTexture(const Image& img, dword flags) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, sz.cx, sz.cy, 0, GL_BGRA, GL_UNSIGNED_BYTE, ~img); if(flags & TEXTURE_MIPMAP) glGenerateMipmap(GL_TEXTURE_2D); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, flags & TEXTURE_LINEAR ? GL_LINEAR : GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, flags & TEXTURE_LINEAR ? flags & TEXTURE_MIPMAP ? GL_LINEAR_MIPMAP_LINEAR diff --git a/uppsrc/ide/Builders/Build.cpp b/uppsrc/ide/Builders/Build.cpp index bb27b74b4..86fbdf365 100644 --- a/uppsrc/ide/Builders/Build.cpp +++ b/uppsrc/ide/Builders/Build.cpp @@ -535,9 +535,9 @@ bool MakeBuild::Build(const Workspace& wspc, String mainparam, String outfile, b mainparam, outfile, linkfile, immfile, linkopt, ok) && ok; // Set the time of target and intermediates to start-time, so that if any file // changes during compilation, it is recompiled during next build - SetFileTime(target, start_time); - for(int i = 0; i < immfile.GetCount(); i++) - SetFileTime(immfile[i], start_time); +// SetFileTime(target, start_time); +// for(int i = 0; i < immfile.GetCount(); i++) +// SetFileTime(immfile[i], start_time); } } EndBuilding(ok); diff --git a/uppsrc/ide/ide.lay b/uppsrc/ide/ide.lay index e42f8a1b4..a9917fb87 100644 --- a/uppsrc/ide/ide.lay +++ b/uppsrc/ide/ide.lay @@ -507,11 +507,11 @@ END_LAYOUT LAYOUT(SetupHlLayout, 544, 300) ITEM(ArrayCtrl, hlstyle, LeftPosZ(4, 368).TopPosZ(4, 292)) ITEM(Label, dv___1, SetLabel(t_("Scope highlighting")).LeftPosZ(380, 160).TopPosZ(4, 16)) - ITEM(Switch, hilite_scope, SetLabel(t_("None\n2 colors\n5 colors")).LeftPosZ(380, 160).TopPosZ(20, 50)) + ITEM(Switch, hilite_scope, SetLabel(t_("None\n2 colors\n5 colors")).LeftPosZ(380, 160).TopPosZ(20, 52)) ITEM(Label, dv___3, SetLabel(t_("Matching bracket highlighting")).LeftPosZ(380, 160).TopPosZ(68, 16)) - ITEM(Switch, hilite_bracket, SetLabel(t_("None\nNormal\nFlashing")).LeftPosZ(380, 160).TopPosZ(84, 50)) + ITEM(Switch, hilite_bracket, SetLabel(t_("None\nNormal\nFlashing")).LeftPosZ(380, 160).TopPosZ(84, 52)) ITEM(Label, dv___5, SetLabel(t_("#else/#elif/#endif info")).LeftPosZ(380, 160).TopPosZ(132, 16)) - ITEM(Switch, hilite_ifdef, SetLabel(t_("None\nNormal\nWith line number")).LeftPosZ(380, 160).TopPosZ(148, 50)) + ITEM(Switch, hilite_ifdef, SetLabel(t_("None\nNormal\nWith line number")).LeftPosZ(380, 160).TopPosZ(148, 52)) ITEM(Option, hilite_if_endif, SetLabel(t_("#if/#endif tracing")).LeftPosZ(380, 160).TopPosZ(196, 18)) ITEM(Option, thousands_separator, SetLabel(t_("Thousands separator")).LeftPosZ(380, 160).TopPosZ(212, 18)) ITEM(Option, hline, SetLabel(t_("Current line")).LeftPosZ(380, 160).TopPosZ(228, 18))