void CQDM_Edit::Draw3D(bool FastMode) //draws the digital part in initialized OpenGL window { DrawMe(FastMode, true); if (ViewSection) DrawSectionPlane(FastMode); }
void CQDM_Edit::Draw2D(bool FastMode) { // int LayersBack = 2; float ThisOpacity = 0.5 + 0.3f/FadeAwayDist; DrawMe(FastMode, false, FadeAwayDist); // glDisable(GL_LIGHTING); // // if (LayersBack > 0){ //if we want to fade out layers behind the section layer // if (!CurSecFromNeg){ // for (int i = -(LayersBack-1); i<=0 ; i++){ Draw2DTransLayer(i, ThisOpacity);} // } // if (CurSecFromNeg){ // for (int i = (LayersBack-1); i>=0 ; i--){ Draw2DTransLayer(i, ThisOpacity);} // } // } // glEnable(GL_LIGHTING); Draw2DOverlay(); }
void RenderDemoDlg::RenderControl(ReDrawInfoType* ExtraInfo) { // Go get a render region DocRect VirtualSize(-ExtraInfo->dx/2, -ExtraInfo->dy/2, ExtraInfo->dx/2, ExtraInfo->dy/2); RenderRegion* pRender = CreateGRenderRegion(&VirtualSize, ExtraInfo); if (pRender!=NULL) { DialogColourInfo RedrawColours; // Get a supplier for default dlg colours // Render stuff in here // Build a Linear fill attribute LinearFillAttribute MyGradFill; MyGradFill.Colour = DocColour(255, 255, 0); MyGradFill.EndColour = DocColour(0, 255, 255); MyGradFill.StartPoint = DocCoord(0, ExtraInfo->dy); MyGradFill.EndPoint = DocCoord(ExtraInfo->dx, 0); // Build a path Path InkPath; InkPath.Initialise(12,12); InkPath.FindStartOfPath(); // Get the coords used to build a shape INT32 dx = ExtraInfo->dx / 2; INT32 dy = ExtraInfo->dy / 2; INT32 Midx = ExtraInfo->dx / 4; INT32 Midy = ExtraInfo->dy / 4; // build a circle in the middle of the control InkPath.InsertMoveTo(DocCoord(Midx, dy)); InkPath.InsertCurveTo(DocCoord(Midx+Midx/2, dy), DocCoord(dx, Midy+Midy/2), DocCoord(dx, Midy)); InkPath.InsertCurveTo(DocCoord(dx, Midy-Midy/2), DocCoord(Midx+Midx/2, 0), DocCoord(Midx, 0)); InkPath.InsertCurveTo(DocCoord(Midx-Midx/2, 0), DocCoord(0, Midy-Midy/2), DocCoord(0, Midy)); InkPath.InsertCurveTo(DocCoord(0, Midy+Midy/2), DocCoord(Midx-Midx/2, dy), DocCoord(Midx, dy)); InkPath.IsFilled = TRUE; // A Grey colour [...hmmm, it's not a very grey grey any more... oragnge more like] DocColour Grey(255,200,0); // Render the attributes and the a rectangle pRender->SaveContext(); pRender->SetLineColour(Grey); // Draw a rectangle to fill in the background - Fill with Dialogue Background colour DocRect DrawMe(0, 0, ExtraInfo->dx, ExtraInfo->dy); pRender->SetFillColour(RedrawColours.DialogBack()); pRender->DrawRect(&VirtualSize); // Draw some shapes and stuff pRender->SetFillGeometry(&MyGradFill, FALSE); pRender->DrawPath(&InkPath); // Build a path Path TriPath; TriPath.Initialise(12,12); TriPath.FindStartOfPath(); // build a circle in the middle of the control TriPath.InsertMoveTo(VirtualSize.lo); TriPath.InsertLineTo(DocCoord(VirtualSize.hi.x, VirtualSize.lo.y)); TriPath.InsertLineTo(DocCoord(0, VirtualSize.hi.y)); TriPath.InsertLineTo(VirtualSize.lo); TriPath.IsFilled = TRUE; LinearFillAttribute MyTriFill; MyTriFill.Colour = ShowFirst ? First : Second; MyTriFill.EndColour = DocColour(0,0,0); MyTriFill.StartPoint = DocCoord(ExtraInfo->dx, 0); MyTriFill.EndPoint = DocCoord(0, ExtraInfo->dy); pRender->SetFillGeometry(&MyTriFill, FALSE); pRender->DrawPath(&TriPath); pRender->RestoreContext(); // Get rid of the render region DestroyGRenderRegion(pRender); } // and animate it! if (ShowFirst) { INT32 Red, Green, Blue; First.GetRGBValue(&Red, &Green, &Blue); if (Blue>0) { // Set the colour back again Blue -= 10; First.SetRGBValue(Red, Green, Blue); // redraw it InvalidateGadget(_R(IDC_REDRAW_ME)); } } else { // Set the colour back to how it was First.SetRGBValue(255, 0, 250); } }
LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { osdmsg *ms; switch (message) { case WM_CREATE: logmsg("WindowProcedure::CREATE"); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&defstr); return 0; case WM_DESTROY: logmsg("WindowProcedure::DESTROY"); return 0; case WM_PAINT: logmsg("WindowProcedure::PAINT"); ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (ms) return DrawMe(hwnd, ms->text, ms->color); PAINTSTRUCT ps; BeginPaint(hwnd, &ps); EndPaint(hwnd, &ps); return 0; case WM_NCRBUTTONDOWN: logmsg("WindowProcedure::NCRBUTTONDOWN"); ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (ms) { if (ms->callback) ms->callback(ms->param); SendMessage(hwnd, WM_USER + 3, 0, 0); } return 0; case WM_TIMER: logmsg("WindowProcedure::TIMER"); SendMessage(hwnd, WM_USER + 3, wParam, 0); return 0; case WM_USER + 1: //draw text ((char *)string, (int) timeout logmsg("WindowProcedure::USER+1"); ms = (osdmsg*)mir_alloc(sizeof(osdmsg)); ms->text = mir_tstrdup((TCHAR *)wParam); if (lParam == 0) lParam = db_get_dw(NULL, THIS_MODULE, "timeout", DEFAULT_TIMEOUT); ms->timeout = lParam; ms->callback = 0; ms->color = db_get_dw(NULL, THIS_MODULE, "clr_msg", DEFAULT_CLRMSG); ms->param = 0; SendMessage(hwnd, WM_USER + 4, (WPARAM)ms, 0); mir_free(ms->text); mir_free(ms); return 0; case WM_USER + 2: //show logmsg("WindowProcedure::USER+2"); SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOACTIVATE); return 0; case WM_USER + 3: //hide ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA); logmsg("WindowProcedure::USER+3"); if (!ms) return 0; logmsg("WindowProcedure::USER+3/om"); KillTimer(hwnd, (UINT_PTR)ms); mir_free(ms->text); mir_free(ms); SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); ShowWindow(hwnd, SW_HIDE); return 0; case WM_USER + 4: logmsg("WindowProcedure::USER+4"); ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (ms != 0) { logmsg("WindowProcedure::USER+4/old"); KillTimer(hwnd, (UINT_PTR)ms); mir_free(ms->text); mir_free(ms); SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); } ms = (osdmsg*)mir_alloc(sizeof(osdmsg)); memcpy(ms, (osdmsg*)wParam, sizeof(osdmsg)); ms->text = mir_tstrdup(ms->text); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)ms); SetTimer(hwnd, (UINT_PTR)ms, (UINT)ms->timeout, 0); InvalidateRect(hwnd, 0, TRUE); SendMessage(hwnd, WM_USER + 2, 0, 0); return 0; case WM_NCHITTEST: { RECT rect; GetWindowRect(hwnd, &rect); logmsg("WindowProcedure::NCHITTEST"); if (LOWORD(lParam) >= (rect.left + 5) && LOWORD(lParam) <= (rect.right - 5) && HIWORD(lParam) >= (rect.top + 5) && HIWORD(lParam) <= (rect.bottom - 5)) return HTCAPTION; return DefWindowProc(hwnd, message, wParam, lParam); } //here will be the doubleclick => open-message-window solution ;-) //case WM_NCLBUTTONDBLCLK: // CallService(MS_MSG_SENDMESSAGE, wparam,(LPARAM)&odp); // return 0; default: return DefWindowProc(hwnd, message, wParam, lParam); } }