@@ -30,7 +30,7 @@ public ScreenGridViewModel()
3030 this . RotateCounterClockwiseCommand = new RelayCommand ( ( o ) => { this . Rot = Rotator . RotateCounterClockwise ( this . Rot ) ; } ) ;
3131 this . FlipHorizontalCommand = new RelayCommand ( ( o ) => { this . FlipH = ! this . FlipH ; } ) ;
3232 this . FlipVerticalCommand = new RelayCommand ( ( o ) => { this . FlipV = ! this . FlipV ; } ) ;
33- this . SnapCommand = new RelayCommand ( ( o ) => { this . SnapToRenderView ( ) ; } ) ;
33+ this . SnapCommand = new RelayCommand ( ( o ) => { this . SnapToImageBounds ( ) ; } ) ;
3434 }
3535
3636 public ICommand RotateClockwiseCommand { get ; private set ; }
@@ -260,24 +260,10 @@ public string CaptionText
260260 }
261261 }
262262
263- private IList < string > GetWindowClassNames ( )
264- {
265- var classNames = new List < string > ( ) ;
266-
267- classNames . Add ( Models . AppsInterop . PhotoViewerWindow . MainWindowClassName ) ;
268-
269- var orw = Models . AppsInterop . OctaneRenderWindow . GetFromAllProcesses ( ) ;
270- classNames . AddRange ( orw . Select ( w => w . ClassName ) ) ;
271-
272- classNames . Add ( "MozillaWindowClass" ) ; // TODO: do not use window class names, check any applications with topmost windows
273-
274- return classNames ;
275- }
276-
277- public void SnapToRenderView ( )
263+ public void SnapToImageBounds ( )
278264 {
279265 // select foreground window from several processes of supported applications
280- var nativeWindow = Models . AppsInterop . NativeWindow . GetTopMostWindow ( this . GetWindowClassNames ( ) ) ;
266+ var nativeWindow = Models . AppsInterop . NativeWindow . GetTopMostWindow ( ) ;
281267
282268 if ( nativeWindow != null )
283269 {
@@ -298,26 +284,26 @@ public void SnapToRenderView()
298284 var bitmap = nativeWindow . GetShot ( ) ;
299285 var flatImage = new Models . FlatImage ( bitmap ) ;
300286
301- Models . Geometry . Rectangle imageBoundings ;
287+ Models . Geometry . Rectangle imageBounds ;
302288 if ( Models . AppsInterop . OctaneRenderWindow . GetFromAllProcesses ( ) . Any ( w => w . ClassName == nativeWindow . ClassName ) )
303289 {
304290 // TODO: remove this Octane Render specific code
305- imageBoundings = Models . AppsInterop . OctaneRenderWindow . FindRenderedImageBorders ( flatImage ) ;
291+ imageBounds = Models . AppsInterop . OctaneRenderWindow . FindRenderedImageBorders ( flatImage ) ;
306292 }
307293 else
308294 {
309- imageBoundings = flatImage . FindBoundingsOfInnerImage ( ) ;
295+ imageBounds = flatImage . FindBoundsOfInnerImage ( ) ;
310296 }
311297
312298 var nativeWindowLocation = new Models . Geometry . Point ( nativeWindow . Location . X , nativeWindow . Location . Y ) ;
313- return new Tuple < Models . Geometry . Rectangle , Models . Geometry . Point > ( imageBoundings , nativeWindowLocation ) ;
299+ return new Tuple < Models . Geometry . Rectangle , Models . Geometry . Point > ( imageBounds , nativeWindowLocation ) ;
314300 } ) . ContinueWith ( ( t ) =>
315301 {
316- var imageBoundings = t . Result . Item1 ;
302+ var imageBounds = t . Result . Item1 ;
317303 var windowLocation = t . Result . Item2 ;
318- if ( ! imageBoundings . IsEmpty )
304+ if ( ! imageBounds . IsEmpty )
319305 {
320- if ( ( imageBoundings . Width > 150 ) && ( imageBoundings . Height > 50 ) )
306+ if ( ( imageBounds . Width > 150 ) && ( imageBounds . Height > 50 ) )
321307 {
322308 this . PositionWindow ( t . Result . Item2 , t . Result . Item1 ) ;
323309 }
0 commit comments