Revision: 29144 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29144 Author: jwilkins Date: 2010-06-01 23:06:18 +0200 (Tue, 01 Jun 2010)
Log Message: ----------- merged with head Modified Paths: -------------- branches/soc-2010-jwilkins/intern/ghost/GHOST_C-api.h branches/soc-2010-jwilkins/intern/ghost/GHOST_IWindow.h branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_C-api.cpp branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_Window.cpp branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_Window.h branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowCocoa.h branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowCocoa.mm branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowWin32.cpp branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowWin32.h branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowX11.cpp branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowX11.h branches/soc-2010-jwilkins/release/scripts/modules/bpy/utils.py branches/soc-2010-jwilkins/release/scripts/op/wm.py branches/soc-2010-jwilkins/release/scripts/ui/properties_data_lamp.py branches/soc-2010-jwilkins/release/scripts/ui/properties_texture.py branches/soc-2010-jwilkins/release/scripts/ui/space_info.py branches/soc-2010-jwilkins/release/scripts/ui/space_userpref.py branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_customdata.h branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_multires.h branches/soc-2010-jwilkins/source/blender/blenkernel/intern/CCGSubSurf.c branches/soc-2010-jwilkins/source/blender/blenkernel/intern/customdata.c branches/soc-2010-jwilkins/source/blender/blenkernel/intern/multires.c branches/soc-2010-jwilkins/source/blender/blenkernel/intern/texture.c branches/soc-2010-jwilkins/source/blender/blenloader/intern/readfile.c branches/soc-2010-jwilkins/source/blender/editors/mesh/editmesh_mods.c branches/soc-2010-jwilkins/source/blender/editors/screen/screen_ops.c branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c branches/soc-2010-jwilkins/source/blender/editors/space_outliner/outliner.c branches/soc-2010-jwilkins/source/blender/editors/space_script/script_edit.c branches/soc-2010-jwilkins/source/blender/editors/space_script/script_intern.h branches/soc-2010-jwilkins/source/blender/editors/space_script/script_ops.c branches/soc-2010-jwilkins/source/blender/editors/space_view3d/view3d_edit.c branches/soc-2010-jwilkins/source/blender/editors/space_view3d/view3d_intern.h branches/soc-2010-jwilkins/source/blender/editors/space_view3d/view3d_view.c branches/soc-2010-jwilkins/source/blender/imbuf/IMB_thumbs.h branches/soc-2010-jwilkins/source/blender/imbuf/intern/IMB_filetype.h branches/soc-2010-jwilkins/source/blender/imbuf/intern/filetype.c branches/soc-2010-jwilkins/source/blender/imbuf/intern/thumbs.c branches/soc-2010-jwilkins/source/blender/imbuf/intern/thumbs_blend.c branches/soc-2010-jwilkins/source/blender/imbuf/intern/tiff.c branches/soc-2010-jwilkins/source/blender/makesdna/DNA_texture_types.h branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_actuator.c branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_modifier.c branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_scene.c branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_texture.c branches/soc-2010-jwilkins/source/blender/python/doc/blender-org/static/default.css_t branches/soc-2010-jwilkins/source/blender/render/intern/source/convertblender.c branches/soc-2010-jwilkins/source/blender/render/intern/source/voxeldata.c branches/soc-2010-jwilkins/source/blender/windowmanager/WM_api.h branches/soc-2010-jwilkins/source/blender/windowmanager/intern/wm_files.c branches/soc-2010-jwilkins/source/blender/windowmanager/intern/wm_jobs.c branches/soc-2010-jwilkins/source/blender/windowmanager/intern/wm_operators.c branches/soc-2010-jwilkins/source/blender/windowmanager/intern/wm_window.c Modified: branches/soc-2010-jwilkins/intern/ghost/GHOST_C-api.h =================================================================== --- branches/soc-2010-jwilkins/intern/ghost/GHOST_C-api.h 2010-06-01 20:21:40 UTC (rev 29143) +++ branches/soc-2010-jwilkins/intern/ghost/GHOST_C-api.h 2010-06-01 21:06:18 UTC (rev 29144) @@ -264,7 +264,24 @@ extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle); +/*************************************************************************************** + ** Progress bar functionality + ***************************************************************************************/ +/** + * Sets the progress bar value displayed in the window/application icon + * @param windowhandle The handle to the window + * @param progress The progress % (0.0 to 1.0) + */ +extern GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle, float progress); + +/** + * Hides the progress bar in the icon + * @param windowhandle The handle to the window + */ +extern GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle); + + /*************************************************************************************** ** N-degree of freedom device management functionality ***************************************************************************************/ Modified: branches/soc-2010-jwilkins/intern/ghost/GHOST_IWindow.h =================================================================== --- branches/soc-2010-jwilkins/intern/ghost/GHOST_IWindow.h 2010-06-01 20:21:40 UTC (rev 29143) +++ branches/soc-2010-jwilkins/intern/ghost/GHOST_IWindow.h 2010-06-01 21:06:18 UTC (rev 29144) @@ -235,6 +235,21 @@ virtual const GHOST_TabletData* GetTabletData() = 0; /*************************************************************************************** + ** Progress bar functionality + ***************************************************************************************/ + + /** + * Sets the progress bar value displayed in the window/application icon + * @param progress The progress % + */ + virtual GHOST_TSuccess setProgressBar(float progress) = 0; + + /** + * Hides the progress bar in the icon + */ + virtual GHOST_TSuccess endProgressBar() = 0; + + /*************************************************************************************** ** Cursor management functionality ***************************************************************************************/ Modified: branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_C-api.cpp =================================================================== --- branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_C-api.cpp 2010-06-01 20:21:40 UTC (rev 29143) +++ branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_C-api.cpp 2010-06-01 21:06:18 UTC (rev 29144) @@ -248,6 +248,21 @@ return system->addEventConsumer((GHOST_CallbackEventConsumer*)consumerhandle); } +GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle,float progress) +{ + GHOST_IWindow* window = (GHOST_IWindow*) windowhandle; + + return window->setProgressBar(progress); +} + +GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle) +{ + GHOST_IWindow* window = (GHOST_IWindow*) windowhandle; + + return window->endProgressBar(); +} + + int GHOST_OpenNDOF(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle, GHOST_NDOFLibraryInit_fp setNdofLibraryInit, GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown, Modified: branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_Window.cpp =================================================================== --- branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_Window.cpp 2010-06-01 20:21:40 UTC (rev 29143) +++ branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_Window.cpp 2010-06-01 21:06:18 UTC (rev 29144) @@ -53,6 +53,8 @@ m_isUnsavedChanges = false; m_canAcceptDragOperation = false; + m_progressBarVisible = false; + m_cursorGrabAccumPos[0] = 0; m_cursorGrabAccumPos[1] = 0; Modified: branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_Window.h =================================================================== --- branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_Window.h 2010-06-01 20:21:40 UTC (rev 29143) +++ branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_Window.h 2010-06-01 21:06:18 UTC (rev 29144) @@ -192,6 +192,17 @@ virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect& bounds); /** + * Sets the progress bar value displayed in the window/application icon + * @param progress The progress % (0.0 to 1.0) + */ + virtual GHOST_TSuccess setProgressBar(float progress) {return GHOST_kFailure;}; + + /** + * Hides the progress bar in the icon + */ + virtual GHOST_TSuccess endProgressBar() {return GHOST_kFailure;}; + + /** * Tells if the ongoing drag'n'drop object can be accepted upon mouse drop */ virtual void setAcceptDragOperation(bool canAccept); @@ -313,6 +324,9 @@ /** The current shape of the cursor */ GHOST_TStandardCursor m_cursorShape; + /** The presence of progress indicator with the application icon */ + bool m_progressBarVisible; + /** The acceptance of the "drop candidate" of the current drag'n'drop operation */ bool m_canAcceptDragOperation; Modified: branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowCocoa.h =================================================================== --- branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowCocoa.h 2010-06-01 20:21:40 UTC (rev 29143) +++ branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowCocoa.h 2010-06-01 21:06:18 UTC (rev 29144) @@ -226,6 +226,17 @@ GHOST_TabletData& GetCocoaTabletData() { return m_tablet; } + + /** + * Sets the progress bar value displayed in the window/application icon + * @param progress The progress % (0.0 to 1.0) + */ + virtual GHOST_TSuccess setProgressBar(float progress); + + /** + * Hides the progress bar icon + */ + virtual GHOST_TSuccess endProgressBar(); protected: /** * Tries to install a rendering context in this window. @@ -291,14 +302,6 @@ NSCursor* m_customCursor; GHOST_TabletData m_tablet; - - /** - * The width/height of the size rectangle in the lower right corner of a - * Mac/Carbon window. This is also the height of the gutter area. - */ -#ifdef GHOST_DRAW_CARBON_GUTTER - static const GHOST_TInt32 s_sizeRectSize; -#endif // GHOST_DRAW_CARBON_GUTTER }; #endif // _GHOST_WINDOW_COCOA_H_ Modified: branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowCocoa.mm =================================================================== --- branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowCocoa.mm 2010-06-01 20:21:40 UTC (rev 29143) +++ branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowCocoa.mm 2010-06-01 21:06:18 UTC (rev 29144) @@ -1020,6 +1020,66 @@ return GHOST_kSuccess; } +#pragma mark Progress bar + +GHOST_TSuccess GHOST_WindowCocoa::setProgressBar(float progress) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + if ((progress >=0.0) && (progress <=1.0)) { + NSImage* dockIcon = [[NSImage alloc] initWithSize:NSMakeSize(128,128)]; + + [dockIcon lockFocus]; + NSRect progressBox = {{4, 4}, {120, 16}}; + + [[NSImage imageNamed:@"NSApplicationIcon"] dissolveToPoint:NSZeroPoint fraction:1.0]; + + // Track & Outline + [[NSColor blackColor] setFill]; + NSRectFill(progressBox); + + [[NSColor whiteColor] set]; + NSFrameRect(progressBox); + + // Progress fill + progressBox = NSInsetRect(progressBox, 1, 1); + [[NSColor knobColor] setFill]; + progressBox.size.width = progressBox.size.width * progress; + NSRectFill(progressBox); + + [dockIcon unlockFocus]; + + [NSApp setApplicationIconImage:dockIcon]; + [dockIcon release]; + + m_progressBarVisible = true; + } + + [pool drain]; + return GHOST_kSuccess; +} + + +GHOST_TSuccess GHOST_WindowCocoa::endProgressBar() +{ + if (!m_progressBarVisible) return GHOST_kFailure; + m_progressBarVisible = false; + + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + NSImage* dockIcon = [[NSImage alloc] initWithSize:NSMakeSize(128,128)]; + [dockIcon lockFocus]; + [[NSImage imageNamed:@"NSApplicationIcon"] dissolveToPoint:NSZeroPoint fraction:1.0]; + [dockIcon unlockFocus]; + [NSApp setApplicationIconImage:dockIcon]; + [dockIcon release]; + + [pool drain]; + return GHOST_kSuccess; +} + + + #pragma mark Cursor handling void GHOST_WindowCocoa::loadCursor(bool visible, GHOST_TStandardCursor cursor) const Modified: branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowWin32.cpp =================================================================== --- branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowWin32.cpp 2010-06-01 20:21:40 UTC (rev 29143) +++ branches/soc-2010-jwilkins/intern/ghost/intern/GHOST_WindowWin32.cpp 2010-06-01 21:06:18 UTC (rev 29144) @@ -64,6 +64,7 @@ LPCSTR GHOST_WindowWin32::s_windowClassName = "GHOST_WindowClass"; const int GHOST_WindowWin32::s_maxTitleLength = 128; HGLRC GHOST_WindowWin32::s_firsthGLRc = NULL; +HDC GHOST_WindowWin32::s_firstHDC = NULL; static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd); static int EnumPixelFormats(HDC hdc); @@ -134,6 +135,7 @@ m_top(top), m_width(width), m_height(height), + m_normal_state(GHOST_kWindowStateNormal), m_stereo(stereoVisual), m_nextWindow(NULL) { @@ -202,6 +204,10 @@ // Store the device context m_hDC = ::GetDC(m_hWnd); + if(!s_firstHDC) { + s_firstHDC = m_hDC; + } + // Show the window int nCmdShow; switch (state) { @@ -308,10 +314,11 @@ m_customCursor = NULL; } + ::wglMakeCurrent(NULL, NULL); m_multisampleEnabled = GHOST_kFailure; m_multisample = 0; setDrawingContextType(GHOST_kDrawingContextTypeNone); - if (m_hDC) { + if (m_hDC && m_hDC != s_firstHDC) { ::ReleaseDC(m_hWnd, m_hDC); m_hDC = 0; } @@ -482,9 +489,13 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state) { + GHOST_TWindowState curstate = getState(); WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); ::GetWindowPlacement(m_hWnd, &wp); + + if (state == GHOST_kWindowStateNormal) + state = m_normal_state; switch (state) { case GHOST_kWindowStateMinimized: wp.showCmd = SW_SHOWMINIMIZED; @@ -495,6 +506,8 @@ @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs