Skip to content

Commit

Permalink
v.5.9
Browse files Browse the repository at this point in the history
  • Loading branch information
rossetantoine committed Apr 19, 2014
1 parent 31101e6 commit 08db861
Show file tree
Hide file tree
Showing 118 changed files with 3,007 additions and 2,085 deletions.
4 changes: 4 additions & 0 deletions AYDicomPrint/AYDicomPrintWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
IBOutlet NSTextField *m_VersionNumberTextField;

NSLock *printing;

NSRect windowFrameToRestore;
BOOL scaleFitToRestore;

}
+ (void) updateAllPreferencesFormat;

Expand Down
87 changes: 50 additions & 37 deletions AYDicomPrint/AYDicomPrintWindowController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,33 @@ - (id) init

printing = [[NSLock alloc] init];

[[self window] center];
windowFrameToRestore = NSMakeRect(0, 0, 0, 0);
scaleFitToRestore = m_CurrentViewer.imageView.isScaledFit;

if( [[NSUserDefaults standardUserDefaults] boolForKey: @"SquareWindowForPrinting"])
{
int AlwaysScaleToFit = [[NSUserDefaults standardUserDefaults] integerForKey: @"AlwaysScaleToFit"];
[[NSUserDefaults standardUserDefaults] setInteger: 0 forKey: @"AlwaysScaleToFit"];

windowFrameToRestore = m_CurrentViewer.window.frame;
NSRect newFrame = [AppController usefullRectForScreen: m_CurrentViewer.window.screen];

if( newFrame.size.width < newFrame.size.height) newFrame.size.height = newFrame.size.width;
else newFrame.size.width = newFrame.size.height;

[AppController resizeWindowWithAnimation: m_CurrentViewer.window newSize: newFrame];
if( scaleFitToRestore) [m_CurrentViewer.imageView scaleToFit];

[[NSUserDefaults standardUserDefaults] setInteger: AlwaysScaleToFit forKey: @"AlwaysScaleToFit"];
}

for( ViewerController *v in [ViewerController getDisplayed2DViewers])
{
if( v != m_CurrentViewer)
[v.window orderOut: self];
}

[[self window] center];
}

return self;
Expand Down Expand Up @@ -207,14 +233,33 @@ - (void) awakeFromNib
- (IBAction) cancel: (id) sender
{
[NSApp stopModal];
[self close];


if( [[NSUserDefaults standardUserDefaults] boolForKey: @"SquareWindowForPrinting"] && NSIsEmptyRect( windowFrameToRestore) == NO)
{
int AlwaysScaleToFit = [[NSUserDefaults standardUserDefaults] integerForKey: @"AlwaysScaleToFit"];
[[NSUserDefaults standardUserDefaults] setInteger: 0 forKey: @"AlwaysScaleToFit"];

[AppController resizeWindowWithAnimation: m_CurrentViewer.window newSize: windowFrameToRestore];

if( scaleFitToRestore) [m_CurrentViewer.imageView scaleToFit];

[[NSUserDefaults standardUserDefaults] setInteger: AlwaysScaleToFit forKey: @"AlwaysScaleToFit"];
}

for( ViewerController *v in [ViewerController get2DViewers])
[v.window orderFront: self];

[m_CurrentViewer.window makeKeyAndOrderFront: self];

[self close];
}

- (IBAction) printImages: (id) sender
{
if( [m_pages intValue] > 10 && [[m_ImageSelection selectedCell] tag] == eAllImages)
{
if( NSRunInformationalAlertPanel( NSLocalizedString(@"DICOM Print", nil), [NSString stringWithFormat: NSLocalizedString(@"Are you really sure you want to print %d pages?", nil), [m_pages intValue]] , NSLocalizedString(@"OK", nil), NSLocalizedString(@"Cancel", nil), nil) != NSAlertDefaultReturn) return;
if( NSRunInformationalAlertPanel( NSLocalizedString(@"DICOM Print", nil), NSLocalizedString(@"Are you really sure you want to print %d pages?", nil) , NSLocalizedString(@"OK", nil), NSLocalizedString(@"Cancel", nil), nil, [m_pages intValue]) != NSAlertDefaultReturn) return;
}

[sender setEnabled: NO];
Expand Down Expand Up @@ -385,27 +430,7 @@ - (ViewerController *) _currentViewer

- (void) _createPrintjob: (id) object
{
NSRect windowFrameToRestore = NSMakeRect(0, 0, 0, 0);
BOOL scaleFitToRestore = m_CurrentViewer.imageView.isScaledFit;

if( [[NSUserDefaults standardUserDefaults] boolForKey: @"SquareWindowForPrinting"])
{
int AlwaysScaleToFit = [[NSUserDefaults standardUserDefaults] integerForKey: @"AlwaysScaleToFit"];
[[NSUserDefaults standardUserDefaults] setInteger: 0 forKey: @"AlwaysScaleToFit"];

windowFrameToRestore = m_CurrentViewer.window.frame;
NSRect newFrame = [AppController usefullRectForScreen: m_CurrentViewer.window.screen];

if( newFrame.size.width < newFrame.size.height) newFrame.size.height = newFrame.size.width;
else newFrame.size.width = newFrame.size.height;

[AppController resizeWindowWithAnimation: m_CurrentViewer.window newSize: newFrame];
if( scaleFitToRestore) [m_CurrentViewer.imageView scaleToFit];

[[NSUserDefaults standardUserDefaults] setInteger: AlwaysScaleToFit forKey: @"AlwaysScaleToFit"];
}

// show progress sheet
// show progress sheet
[self _setProgressMessage: nil];
[NSApp beginSheet: m_ProgressSheet modalForWindow: [self window] modalDelegate: self didEndSelector: nil contextInfo: nil];

Expand Down Expand Up @@ -531,18 +556,6 @@ - (void) _createPrintjob: (id) object
[self _setProgressMessage: NSLocalizedString( @"Can't write to temporary directory.", nil)];
else
{
if( [[NSUserDefaults standardUserDefaults] boolForKey: @"SquareWindowForPrinting"] && NSIsEmptyRect( windowFrameToRestore) == NO)
{
int AlwaysScaleToFit = [[NSUserDefaults standardUserDefaults] integerForKey: @"AlwaysScaleToFit"];
[[NSUserDefaults standardUserDefaults] setInteger: 0 forKey: @"AlwaysScaleToFit"];

[AppController resizeWindowWithAnimation: m_CurrentViewer.window newSize: windowFrameToRestore];

if( scaleFitToRestore) [m_CurrentViewer.imageView scaleToFit];

[[NSUserDefaults standardUserDefaults] setInteger: AlwaysScaleToFit forKey: @"AlwaysScaleToFit"];
}

// send printjob

NSThread* t = [[[NSThread alloc] initWithTarget:self selector:@selector(_sendPrintjob:) object: xmlPath] autorelease];
Expand All @@ -558,7 +571,7 @@ - (void) _createPrintjob: (id) object

- (void) errorMessage:(NSArray*) msg
{
NSRunCriticalAlertPanel( [msg objectAtIndex: 0], [msg objectAtIndex: 1], [msg objectAtIndex: 2], nil, nil) ;
NSRunCriticalAlertPanel( [msg objectAtIndex: 0], @"%@", [msg objectAtIndex: 2], nil, nil, [msg objectAtIndex: 1]) ;
}

- (void) _sendPrintjob: (NSString *) xmlPath
Expand Down
2 changes: 1 addition & 1 deletion Anonymization.mm
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ + (NSString*) cleanStringForFile: (NSString*) s

+ (void) error: (NSString*) s
{
NSRunCriticalAlertPanel( NSLocalizedString( @"Error", nil), s, NSLocalizedString( @"OK", nil), nil, nil);
NSRunCriticalAlertPanel( NSLocalizedString( @"Error", nil), @"%@", NSLocalizedString( @"OK", nil), nil, nil, s);
}

+(NSDictionary*)anonymizeFiles:(NSArray*)files dicomImages: (NSArray*) dicomImages toPath:(NSString*)dirPath withTags:(NSArray*)intags
Expand Down
Loading

0 comments on commit 08db861

Please sign in to comment.