diff --git a/rainbow/WinGl/Console.cpp b/rainbow/WinGl/Console.cpp index cd78f9464..8bace40fe 100644 --- a/rainbow/WinGl/Console.cpp +++ b/rainbow/WinGl/Console.cpp @@ -1,5 +1,7 @@ #include "Console.h" +#ifdef GUI_WINGL + NAMESPACE_UPP void Console::Paint(Draw& w) @@ -176,4 +178,6 @@ Console::Console() : init(true), resize(false) scrollLine = 0; } -END_UPP_NAMESPACE \ No newline at end of file +END_UPP_NAMESPACE + +#endif diff --git a/rainbow/WinGl/ControlPanel.cpp b/rainbow/WinGl/ControlPanel.cpp index 571fcc962..e26444a4b 100644 --- a/rainbow/WinGl/ControlPanel.cpp +++ b/rainbow/WinGl/ControlPanel.cpp @@ -1,5 +1,7 @@ #include "ControlPanel.h" +#ifdef GUI_WINGL + NAMESPACE_UPP ValueSlider::ValueSlider() @@ -204,4 +206,6 @@ float InfoPanel::GetScale() return scaleSlider.GetPos(); } -END_UPP_NAMESPACE \ No newline at end of file +END_UPP_NAMESPACE + +#endif \ No newline at end of file diff --git a/rainbow/WinGl/Ctrl.cpp b/rainbow/WinGl/Ctrl.cpp index 0504f4eb4..00cc4c5b2 100644 --- a/rainbow/WinGl/Ctrl.cpp +++ b/rainbow/WinGl/Ctrl.cpp @@ -65,6 +65,10 @@ void GuiPlatformAfterMenuPopUp() { } +void Ctrl::InstallPanicBox() +{ +} + void Ctrl::ApplyLayout() { GuiLock __; diff --git a/rainbow/WinGl/Draw.cpp b/rainbow/WinGl/Draw.cpp index 6cf69d509..2ce9f4f1f 100644 --- a/rainbow/WinGl/Draw.cpp +++ b/rainbow/WinGl/Draw.cpp @@ -42,6 +42,7 @@ int SystemDraw::GetCloffLevel() const void SystemDraw::InitClip(const Rect& clip) { + GuiLock __; drawing_clip = clip; } @@ -63,10 +64,12 @@ void SystemDraw::Reset() { } SystemDraw::SystemDraw() { + GuiLock __; Reset(); } SystemDraw::SystemDraw(Size sz) { + GuiLock __; Reset(); drawing_clip = sz; drawing_size = sz; @@ -107,6 +110,7 @@ void SystemDraw::Init() void SystemDraw::Clear(bool ontransforms) { + GuiLock __; if(ontransforms && (angle == 0 && scale == 1)) return; #if CLIP_MODE == 0 @@ -120,11 +124,13 @@ void SystemDraw::Clear(bool ontransforms) void SystemDraw::ViewPort(int width, int height) { + GuiLock __; glViewport(0, 0, (GLsizei) width < 0 ? drawing_size.cx : width, (GLsizei) height < 0 ? drawing_size.cy : height); } void SystemDraw::OrthogonalView(bool clear_modelview) { + GuiLock __; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, drawing_size.cx, drawing_size.cy, 0, -100, 100); @@ -135,6 +141,7 @@ void SystemDraw::OrthogonalView(bool clear_modelview) void SystemDraw::PerspectiveView(bool clear_modelview) { + GuiLock __; glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, GetAspect(), 1.f, 100.0f); @@ -145,6 +152,7 @@ void SystemDraw::PerspectiveView(bool clear_modelview) void SystemDraw::ApplyTransforms() { + GuiLock __; float dx = (float) drawing_size.cx / 2; float dy = (float) drawing_size.cy / 2; glTranslatef(dx, dy, 0.f); @@ -155,6 +163,7 @@ void SystemDraw::ApplyTransforms() void SystemDraw::PushContext() { + GuiLock __; MatrixStack& m = mstack[mi++]; glGetDoublev(GL_PROJECTION_MATRIX, m.projection_matrix); glGetDoublev(GL_MODELVIEW_MATRIX, m.modelview_matrix); @@ -163,6 +172,7 @@ void SystemDraw::PushContext() void SystemDraw::PopContext() { + GuiLock __; MatrixStack& m = mstack[--mi]; glMatrixMode(GL_PROJECTION); glLoadMatrixd(m.projection_matrix); diff --git a/rainbow/WinGl/DrawText.cpp b/rainbow/WinGl/DrawText.cpp index 830cd1e86..0e5228fe3 100644 --- a/rainbow/WinGl/DrawText.cpp +++ b/rainbow/WinGl/DrawText.cpp @@ -279,6 +279,7 @@ void SystemDraw::Text(int x, int y, int angle, const wchar *text, Font font, Col void SystemDraw::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx) { + GuiLock __; Text(x, y, angle, text, font, ink, 0, White, 0, White, n, dx); } diff --git a/rainbow/WinGl/Event.cpp b/rainbow/WinGl/Event.cpp index 736e48ac8..c5b52087d 100644 --- a/rainbow/WinGl/Event.cpp +++ b/rainbow/WinGl/Event.cpp @@ -12,6 +12,14 @@ Point GetMousePos() { return glmousepos; } +void Ctrl::SysEndLoop() +{ +} + +void WakeUpGuiThread() +{ +} + void Ctrl::MouseEventGl(Ptr t, int event, Point p, int zdelta) { if(!t->IsEnabled() && (t != (Ctrl*) &infoPanel && t != (Ctrl*) &console)) diff --git a/rainbow/WinGl/Scrollbar.cpp b/rainbow/WinGl/Scrollbar.cpp index cf3725e15..a7e4bf7ad 100644 --- a/rainbow/WinGl/Scrollbar.cpp +++ b/rainbow/WinGl/Scrollbar.cpp @@ -1,5 +1,7 @@ #include "Scrollbar.h" +#ifdef GUI_WINGL + NAMESPACE_UPP void AlignedFrame::FrameLayout(Rect &r) @@ -321,4 +323,6 @@ bool SlimScrollBar::IsScrollable() const return t > sz.cx && sz.cx > 0; } -END_UPP_NAMESPACE \ No newline at end of file +END_UPP_NAMESPACE + +#endif diff --git a/rainbow/WinGl/Shaders.cpp b/rainbow/WinGl/Shaders.cpp index 312539519..1a026a2b4 100644 --- a/rainbow/WinGl/Shaders.cpp +++ b/rainbow/WinGl/Shaders.cpp @@ -1,4 +1,7 @@ #include + +#ifdef GUI_WINGL + #include "Shaders.h" NAMESPACE_UPP @@ -237,4 +240,6 @@ void Shader::Stop() Shader::Shader() : program(-1) {} -END_UPP_NAMESPACE \ No newline at end of file +END_UPP_NAMESPACE + +#endif diff --git a/rainbow/WinGl/Util.cpp b/rainbow/WinGl/Util.cpp index 7845e5871..154e080bf 100644 --- a/rainbow/WinGl/Util.cpp +++ b/rainbow/WinGl/Util.cpp @@ -4,11 +4,6 @@ NAMESPACE_UPP -Size GetScreenSize() -{ - return Ctrl::screenRect.GetSize(); -} - void DDRect(RGBA *t, int dir, const byte *pattern, int pos, int count) { while(count-- > 0) { @@ -44,7 +39,7 @@ void DrawLine(const Vector& clip, int x, int y, int cx, int cy, bool horz, //glVertex2i(10, 10); //glVertex2i(100, 100); glEnd(); - glDisable(GL_LINE_STIPPLE); + //glDisable(GL_LINE_STIPPLE); } void DragRectDraw0(const Vector& clip, const Rect& rect, int n, const byte *pattern, int animation) @@ -83,6 +78,10 @@ void DrawDragRect(Ctrl& q, const Rect& rect1, const Rect& rect2, const Rect& cli { } +void FinishDragRect(Ctrl& q) +{ +} + END_UPP_NAMESPACE #endif diff --git a/rainbow/WinGl/Win.cpp b/rainbow/WinGl/Win.cpp index 126d4a6cb..e6106ef6b 100644 --- a/rainbow/WinGl/Win.cpp +++ b/rainbow/WinGl/Win.cpp @@ -259,6 +259,8 @@ int AppMain(HINSTANCE hInstance, LPSTR lpCmdLine) { GuiMainFn_(); UPP::Ctrl::ExitGl(); + USRLOG("---------- About to delete this log of WinGL..."); + UPP::AppExit__(); return UPP::GetExitCode(); } else diff --git a/rainbow/WinGl/Wnd.cpp b/rainbow/WinGl/Wnd.cpp index dd72a44b9..b3c296362 100644 --- a/rainbow/WinGl/Wnd.cpp +++ b/rainbow/WinGl/Wnd.cpp @@ -28,11 +28,13 @@ int Ctrl::PaintLock; void GlLog(int line, const char* text, Color ink) { + GuiLock __; Ctrl::console.Log(line, text, ink); } void GlLog(const char* text, Color ink) { + GuiLock __; Ctrl::console.Log(text, ink); } @@ -205,9 +207,13 @@ bool Ctrl::ProcessEvent(bool *quit) } else if(glDrawMode == DRAW_ON_IDLE) { - TimerProc(GetTickCount()); - SweepMkImageCache(); - DrawScreen(); + if(!painting) + { + GuiSleep(0); + TimerProc(GetTickCount()); + SweepMkImageCache(); + DrawScreen(); + } } return false; @@ -216,10 +222,10 @@ bool Ctrl::ProcessEvent(bool *quit) void Ctrl::DrawScreen() { if(hRC && desktop && !painting) { + painting = true; resources.BindStatic(); int64 t0 = GetHighTickCount(); frameInfo.curr_tick_count = t0; - painting = true; desktop->ApplyLayout(); desktop->ApplyTransform(TS_BEFORE_SCREEN); for(int i = 0; i < topctrl.GetCount(); i++) { @@ -295,8 +301,9 @@ void Ctrl::DrawScreen() } CursorSync(draw); - - desktop->ApplyTransform(TS_AFTER_PAINT); + + desktop->PostPaint(draw); + desktop->ApplyTransform(TS_AFTER_PAINT); glLoadIdentity(); #if CLIP_MODE == 2 @@ -320,14 +327,13 @@ void Ctrl::DrawScreen() //glEnable(GL_STENCIL_TEST); #endif MouseSync(draw); - SwapBuffers(hDC); - painting = false; int64 t1 = GetHighTickCount(); frameInfo.frame_time = t1 - t0; frameInfo.frame_factor = frameInfo.frame_time * frameInfo.frame_skip / 1000.f; frameInfo.fps = frameInfo.frame_time > 0.f ? 1000.f / (float)frameInfo.frame_time : 0.f; //LOGF("ft: %d, t0: %d, t1: %d\n", frameInfo.frame_time, t0, t1); + painting = false; } } @@ -369,8 +375,8 @@ void Ctrl::EventLoop0(Ctrl *ctrl) while(loopno > EndSessionLoopNo && !quit && (ctrl ? ctrl->IsOpen() && ctrl->InLoop() : GetTopCtrls().GetCount())) { SyncCaret(); - if(glDrawMode == DRAW_ON_TIMER) - GuiSleep(20); + //if(glDrawMode == DRAW_ON_TIMER) + // GuiSleep(20); ProcessEvents(&quit); }