void MCStack::view_set_content_scale(MCGFloat p_scale) { if (m_view_content_scale == p_scale) return; m_view_content_scale = p_scale; // IM-2014-01-16: [[ StackScale ]] Update view transform after changing view property view_update_transform(); // IM-2014-10-22: [[ Bug 13746 ]] Update window mask when stack scale changes loadwindowshape(); }
void MCStack::view_setbackingscale(MCGFloat p_scale) { if (p_scale == m_view_backing_scale) return; m_view_backing_scale = p_scale; // IM-2014-06-30: [[ Bug 12715 ]] backing scale changes occur when redrawing the whole stack, // so we need to update the tilecache here before continuing to draw. view_flushtilecache(); view_updatetilecacheviewport(); view_updatetilecache(); // IM-2014-10-22: [[ Bug 13746 ]] Update window mask when backing scale changes loadwindowshape(); }
void MCStack::realize() { if (MCnoui) { start_externals(); return; } if (MCModeMakeLocalWindows()) { uint32_t wstyle, exstyle; loadwindowshape(); getstyle(wstyle, exstyle); RECT wrect ; // IM-2013-09-23: [[ FullscreenMode ]] Don't change stack rect if fullscreen /* CODE DELETED */ wrect = getwrect(rect, wstyle, exstyle); LONG x = wrect.left; LONG y = wrect.top; LONG width = wrect.right - wrect.left; LONG height = wrect.bottom - wrect.top; if (flags & F_WM_PLACE && !(state & CS_BEEN_MOVED)) x = CW_USEDEFAULT; window = new _Drawable; window->type = DC_WINDOW; window->handle.window = 0; // protect against creation callbacks // MW-2011-02-15: [[ Bug 9396 ]] Tooltips should have a shadow on Windows. Boolean isxpmenu = (mode == WM_PULLDOWN || mode == WM_POPUP || mode == WM_CASCADE || mode == WM_TOOLTIP) \ && (MCcurtheme && MCcurtheme->getthemeid() == LF_NATIVEWIN); // MW-2012-09-07: [[ Bug 10368 ]] If the 'no-shadow' bit is set, then we don't // want to use the menu class. if (getflag(F_DECORATIONS) && (decorations & WD_NOSHADOW) != 0) isxpmenu = False; HWND t_parenthwnd = NULL; // MW-2007-07-06: [[ Bug 3226 ]] If the platform is NT always create a Unicode window if ((MCruntimebehaviour & RTB_NO_UNICODE_WINDOWS) == 0 && !isxpmenu && mode < WM_PULLDOWN) window -> handle . window = (MCSysWindowHandle)CreateWindowExW(exstyle, MC_WIN_CLASS_NAME_W, WideCString(getname_cstring()),wstyle | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, x, y, width, height, t_parenthwnd, NULL, MChInst, NULL); else window->handle.window = (MCSysWindowHandle)CreateWindowExA(exstyle, isxpmenu? MC_MENU_WIN_CLASS_NAME: mode >= WM_PULLDOWN ? MC_POPUP_WIN_CLASS_NAME : MC_WIN_CLASS_NAME, getname_cstring(), wstyle | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, x, y, width, height, t_parenthwnd, NULL, MChInst, NULL); SetWindowLongA((HWND)window->handle.window, GWL_USERDATA, mode); if (flags & F_DECORATIONS && !(decorations & WD_SHAPE) && !(decorations & WD_CLOSE)) EnableMenuItem(GetSystemMenu((HWND)window->handle.window, False), SC_CLOSE, MF_BYCOMMAND | MF_GRAYED); if (m_window_shape != nil && m_window_shape -> is_sharp) { MCRegionRef t_region; t_region = (MCRegionRef)m_window_shape -> handle; MCRegionOffset(t_region, rect . x - wrect . left, rect . y - wrect . top); MCRegionSetAsWindowShape(t_region, window->handle.window); // The window now owns the region. m_window_shape -> handle = nil; } if ((m_window_shape == NULL || m_window_shape -> is_sharp) && blendlevel != 100) setopacity(blendlevel * 255 / 100); } start_externals(); }
void MCStack::realize() { //create window if (!MCnoui && MCModeMakeLocalWindows()) { if ( getextendedstate(ECS_FULLSCREEN) ) { //TS-2008-08-01 : [[Bug 5703 - fullscreen stack prop interacts badly with HideMenuBar]] if (!((MCScreenDC*)MCscreen)->getmenubarhidden()) SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar); const MCDisplay *t_display; t_display = MCscreen -> getnearestdisplay(rect); MCRectangle t_workarea, t_viewport; t_workarea = t_display -> workarea; t_viewport = t_display -> viewport ; setrect(t_viewport); } else { if (!((MCScreenDC*)MCscreen)->getmenubarhidden()) SetSystemUIMode(kUIModeNormal, NULL); } Rect wrect; MCScreenDC *psdc = (MCScreenDC *)MCscreen; psdc->MCRect2MacRect(rect, wrect); window = new _Drawable; window->type = DC_WINDOW; window->handle.window = 0; char *tmpname = NULL; const unsigned char *namePascal; if (!isunnamed()) { //set window title to name of stack temporarily. tmpname = strclone(getname_cstring()); //it will be changed by setname() later. namePascal = c2pstr(tmpname); } else namePascal = (unsigned char*)"\p"; loadwindowshape(); window->handle.window = NULL; uint32_t wclass; uint32_t wattributes; getWinstyle(wattributes,wclass); wattributes |= kWindowCompositingAttribute; long testdecorations = WD_TITLE | WD_MENU | WD_CLOSE | WD_MINIMIZE | WD_MAXIMIZE; if (m_window_shape != NULL) { static WindowDefUPP s_window_mask_proc = NULL; if (s_window_mask_proc == NULL) s_window_mask_proc = NewWindowDefUPP(WindowMaskProc); WindowDefSpec t_spec; t_spec . defType = kWindowDefProcPtr; t_spec . u . defProc = s_window_mask_proc; CreateCustomWindow(&t_spec, wclass, wattributes, &wrect, (WindowPtr *)&window -> handle . window); HIWindowChangeFeatures((WindowPtr)window -> handle . window, 0, kWindowIsOpaque); } else if (((flags & F_DECORATIONS && !(decorations & testdecorations)) || wclass == kPlainWindowClass)) { static WindowDefUPP s_borderless_proc = NULL; if (s_borderless_proc == NULL) s_borderless_proc = NewWindowDefUPP(BorderlessWindowProc); WindowDefSpec t_spec; t_spec . defType = kWindowDefProcPtr; t_spec . u . defProc = s_borderless_proc; if (wclass == kPlainWindowClass) wclass = kUtilityWindowClass; CreateCustomWindow(&t_spec, wclass, wattributes, &wrect, (WindowPtr *)&window->handle.window); } else CreateNewWindow(wclass, wattributes,&wrect, (WindowPtr *)&window->handle.window); if (wclass == kFloatingWindowClass) ChangeWindowAttributes((WindowPtr)window -> handle . window, kWindowNoAttributes, kWindowHideOnSuspendAttribute); // MW-2009-10-31: Make sure we can collapse any rev window HIWindowChangeFeatures((WindowPtr)window -> handle . window, kWindowCanCollapse, 0); if (window->handle.window == NULL) SetWTitle((WindowPtr)window->handle.window, namePascal); SetWTitle((WindowPtr)window->handle.window, namePascal); setopacity(blendlevel * 255 / 100); SetWRefCon((WindowPtr)window->handle.window, mode); ControlRef t_control; MCRevolutionStackViewCreate(this, &t_control); ControlRef t_root_control; GetRootControl((WindowPtr)window -> handle . window, &t_root_control); HIViewAddSubview(t_root_control, t_control); ShowControl(t_control); if (wclass == kDrawerWindowClass) { Window pwindow = NULL; if (parentwindow != DNULL) pwindow = parentwindow; else if (MCdefaultstackptr && MCdefaultstackptr->getw() != DNULL ) pwindow = MCdefaultstackptr->getw(); if (pwindow && GetWRefCon((WindowPtr)pwindow->handle.window) != WM_DRAWER) { SetDrawerParent((WindowPtr)window->handle.window, (WindowPtr)pwindow->handle.window); WindowAttributes watt; GetWindowAttributes((WindowPtr)pwindow->handle.window,&watt); if (wattributes & kWindowResizableAttribute) ChangeWindowAttributes((WindowPtr)pwindow->handle.window, kWindowLiveResizeAttribute, 0); OptionBits draweredge; switch (wposition) { case WP_PARENTTOP: draweredge = kWindowEdgeTop; break; case WP_PARENTRIGHT: draweredge = kWindowEdgeRight; break; case WP_PARENTBOTTOM: draweredge = kWindowEdgeBottom; break; case WP_PARENTLEFT: draweredge = kWindowEdgeLeft; break; default: draweredge = kWindowEdgeDefault; break; } SetDrawerPreferredEdge((WindowPtr)window->handle.window, draweredge); if (walignment) { MCRectangle parentwindowrect; MCscreen->getwindowgeometry(pwindow, parentwindowrect); int2 wspace = 0; RgnHandle r = NewRgn(); GetWindowRegion((WindowPtr)window->handle.window, kWindowStructureRgn, r); Rect tRect; GetRegionBounds(r, &tRect); DisposeRgn(r); MCRectangle drawerwindowrect; psdc->MacRect2MCRect(tRect, drawerwindowrect); if (wposition == WP_PARENTTOP || wposition == WP_PARENTBOTTOM) { wspace = parentwindowrect.width - drawerwindowrect.width; if (watt & kWindowMetalAttribute) if (wspace) wspace += 10; //for metal } else { wspace = parentwindowrect.height - drawerwindowrect.height; if (watt & kWindowMetalAttribute) if (wspace) wspace += 5; //for metal } if (wspace > 0) switch (walignment) { case OP_CENTER: SetDrawerOffsets ((WindowPtr)window->handle.window,ceil(wspace/2) -1,floor(wspace/2) + 1); break; case OP_RIGHT: case OP_BOTTOM: SetDrawerOffsets ((WindowPtr)window->handle.window,wspace,0); break; case OP_TOP: case OP_LEFT: SetDrawerOffsets ((WindowPtr)window->handle.window,0,wspace); break; } } } } delete tmpname; // MW-2005-11-06: We also need to catch window constraining events so we can flush // the screen geometry cache. EventTypeSpec list[] = { {kEventClassWindow, kEventWindowCollapsed}, {kEventClassWindow, kEventWindowExpanded}, {kEventClassMouse, kEventMouseWheelMoved}, {kEventClassWindow, kEventWindowBoundsChanging}, {kEventClassWindow, kEventWindowBoundsChanged}, {kEventClassWindow, kEventWindowConstrain}, {kEventClassWindow, kEventWindowFocusAcquired}, {kEventClassWindow, kEventWindowFocusRelinquish}, {kEventClassWindow, kEventWindowActivated}, {kEventClassWindow, kEventWindowDeactivated}, {kEventClassWindow, kEventWindowClose}, }; EventHandlerRef ref; // MW-2005-09-07: Pass the window handle as user data, otherwise 'takewindow' causes problems InstallWindowEventHandler((WindowPtr)window->handle.window, MCS_weh, sizeof(list) / sizeof(EventTypeSpec), list, (WindowPtr)window -> handle . window, &ref); ChangeWindowAttributes((WindowPtr)window->handle.window, 0, kWindowHideOnFullScreenAttribute); updatemodifiedmark(); } start_externals(); }