Skip to content

Commit

Permalink
3.8 fc
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.code.sf.net/p/osirix/code/osirix@7621 4e9e6e3d-4551-47eb-9dbe-a6127f9400a1
  • Loading branch information
rossetantoine committed Sep 20, 2010
1 parent 8c2d22b commit d5e45ab
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 21 deletions.
4 changes: 3 additions & 1 deletion AYDicomPrint/AYDicomPrintWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@


#import <Cocoa/Cocoa.h>
#include "ViewerController.h"

@class ViewerController;

/** \brief Window Controller for DICOM printing */
@interface AYDicomPrintWindowController : NSWindowController
Expand Down Expand Up @@ -46,6 +47,7 @@

NSLock *printing;
}
+ (void) updateAllPreferencesFormat;

- (IBAction) cancel: (id) sender;
- (IBAction) printImages: (id) sender;
Expand Down
63 changes: 58 additions & 5 deletions AYDicomPrint/AYDicomPrintWindowController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,63 @@ - (ViewerController *) _currentViewer;

@implementation AYDicomPrintWindowController

#define NUM_OF(x) (sizeof (x) / sizeof *(x))

+ (NSString*) tagForKey: (NSString*) v array: (NSString *[]) array size: (int) size
{
for( int i = 0 ; i < size; i++)
{
if( [array[ i] isEqualToString: v])
return [NSString stringWithFormat: @"%d", i];
}

NSLog( @"*** not found updateAllPreferencesFormat : %@", v);

return @"0";
}

+ (void) updateAllPreferencesFormat
{
BOOL updated = NO;
NSMutableArray *printers = [[[[NSUserDefaults standardUserDefaults] arrayForKey: @"AYDicomPrinter"] mutableCopy] autorelease];

for( int i = 0 ; i < [printers count] ; i++)
{
NSDictionary *dict = [printers objectAtIndex: i];

if( [dict valueForKey: @"imageDisplayFormatTag"] == nil)
{
NSMutableDictionary *mDict = [NSMutableDictionary dictionaryWithDictionary: dict];

[mDict setObject: [AYDicomPrintWindowController tagForKey: [dict valueForKey: @"filmOrientation"] array: filmOrientationTag size: NUM_OF(filmOrientationTag)] forKey: @"filmOrientationTag"];
[mDict setObject: [AYDicomPrintWindowController tagForKey: [dict valueForKey: @"filmDestination"] array: filmOrientationTag size: NUM_OF(filmOrientationTag)] forKey: @"filmDestinationTag"];
[mDict setObject: [AYDicomPrintWindowController tagForKey: [dict valueForKey: @"filmSize"] array: filmOrientationTag size: NUM_OF(filmOrientationTag)] forKey: @"filmSizeTag"];
[mDict setObject: [AYDicomPrintWindowController tagForKey: [dict valueForKey: @"magnificationType"] array: filmOrientationTag size: NUM_OF(filmOrientationTag)] forKey: @"magnificationTypeTag"];
[mDict setObject: [AYDicomPrintWindowController tagForKey: [dict valueForKey: @"trim"] array: filmOrientationTag size: NUM_OF(filmOrientationTag)] forKey: @"trimTag"];
[mDict setObject: [AYDicomPrintWindowController tagForKey: [dict valueForKey: @"imageDisplayFormat"] array: filmOrientationTag size: NUM_OF(filmOrientationTag)] forKey: @"imageDisplayFormatTag"];
[mDict setObject: [AYDicomPrintWindowController tagForKey: [dict valueForKey: @"borderDensity"] array: filmOrientationTag size: NUM_OF(filmOrientationTag)] forKey: @"borderDensityTag"];
[mDict setObject: [AYDicomPrintWindowController tagForKey: [dict valueForKey: @"emptyImageDensity"] array: filmOrientationTag size: NUM_OF(filmOrientationTag)] forKey: @"emptyImageDensityTag"];
[mDict setObject: [AYDicomPrintWindowController tagForKey: [dict valueForKey: @"priority"] array: filmOrientationTag size: NUM_OF(filmOrientationTag)] forKey: @"priorityTag"];
[mDict setObject: [AYDicomPrintWindowController tagForKey: [dict valueForKey: @"medium"] array: filmOrientationTag size: NUM_OF(filmOrientationTag)] forKey: @"mediumTag"];

[printers replaceObjectAtIndex: i withObject: mDict];

updated = YES;
}
}

if( updated)
{
[[NSUserDefaults standardUserDefaults] setObject: printers forKey: @"AYDicomPrinter"];
}
}

- (id) init
{
if (self = [super init])
{
[AYDicomPrintWindowController updateAllPreferencesFormat];

// fetch current viewer
m_CurrentViewer = [self _currentViewer];

Expand Down Expand Up @@ -340,8 +393,8 @@ - (void) _createPrintjob: (id) object
NSXMLElement *filmsession = [NSXMLElement elementWithName: @"filmsession"];
NSString *copies = [NSString stringWithFormat: @"%d", [[dict valueForKey: @"copies"] intValue]];
[filmsession addAttribute: [NSXMLNode attributeWithName: @"number_of_copies" stringValue: copies]];
[filmsession addAttribute: [NSXMLNode attributeWithName: @"print_priority" stringValue: [dict valueForKey: @"priority"]]];
[filmsession addAttribute: [NSXMLNode attributeWithName: @"medium_type" stringValue: [[dict valueForKey: @"medium"] uppercaseString]]];
[filmsession addAttribute: [NSXMLNode attributeWithName: @"print_priority" stringValue: priorityTag[ [[dict valueForKey: @"priorityTag"] intValue]]]];
[filmsession addAttribute: [NSXMLNode attributeWithName: @"medium_type" stringValue: [mediumTag[ [[dict valueForKey: @"mediumTag"] intValue]] uppercaseString]]];
[filmsession addAttribute: [NSXMLNode attributeWithName: @"film_destination" stringValue: [filmDestinationTag[[[dict valueForKey: @"filmDestinationTag"] intValue]] uppercaseString]]];
[association addChild: filmsession];

Expand Down Expand Up @@ -389,7 +442,7 @@ - (void) _createPrintjob: (id) object
if( from < 0) from = 0;
if( to == from) to = from+1;

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: columns], @"columns", [NSNumber numberWithInt: rows], @"rows", [NSNumber numberWithInt: [[m_ImageSelection selectedCell] tag]], @"mode", [NSNumber numberWithInt: from], @"from", [NSNumber numberWithInt: to], @"to", [NSNumber numberWithInt: [entireSeriesInterval intValue]], @"interval", nil];
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: columns], @"columns", [NSNumber numberWithInt: rows], @"rows", [NSNumber numberWithInt: [[m_ImageSelection selectedCell] tag]], @"mode", [NSNumber numberWithInt: from], @"from", [NSNumber numberWithInt: to], @"to", [NSNumber numberWithInt: [entireSeriesInterval intValue]], @"interval", nil];

// collect images for printing
AYNSImageToDicom *dicomConverter = [[AYNSImageToDicom alloc] init];
Expand Down Expand Up @@ -418,8 +471,8 @@ - (void) _createPrintjob: (id) object
[filmbox addAttribute: [NSXMLNode attributeWithName: @"film_orientation" stringValue: [filmOrientationTag[[[dict valueForKey: @"filmOrientationTag"] intValue]] uppercaseString]]];
[filmbox addAttribute: [NSXMLNode attributeWithName: @"film_size_id" stringValue: [filmSize uppercaseString]]];

[filmbox addAttribute: [NSXMLNode attributeWithName: @"border_density" stringValue: [dict valueForKey: @"borderDensity"]]];
[filmbox addAttribute: [NSXMLNode attributeWithName: @"empty_image_density" stringValue: [dict valueForKey: @"emptyImageDensity"]]];
[filmbox addAttribute: [NSXMLNode attributeWithName: @"border_density" stringValue: borderDensityTag[ [[dict valueForKey: @"borderDensityTag"] intValue]]]];
[filmbox addAttribute: [NSXMLNode attributeWithName: @"empty_image_density" stringValue: emptyImageDensityTag[ [[dict valueForKey: @"emptyImageDensityTag"] intValue]]]];
[filmbox addAttribute: [NSXMLNode attributeWithName: @"requested_resolution_id" stringValue: [dict valueForKey: @"requestedResolution"]]];
[filmbox addAttribute: [NSXMLNode attributeWithName: @"magnification_type" stringValue: magnificationTypeTag[[[dict valueForKey: @"magnificationTypeTag"] intValue]]]];
[filmbox addAttribute: [NSXMLNode attributeWithName: @"trim" stringValue: trimTag[[[dict valueForKey: @"trimTag"] intValue]]]];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
8D202CF10486D31800D8A456 /* AYDicomPrintPref.m in Sources */ = {isa = PBXBuildFile; fileRef = F506C03D013D9D7901CA16C8 /* AYDicomPrintPref.m */; };
8D202CF30486D31800D8A456 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
8D202CF40486D31800D8A456 /* PreferencePanes.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F506C035013D953901CA16C8 /* PreferencePanes.framework */; };
AB631BAB12475287003488D2 /* AYDicomPrintWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = AB631BAA12475287003488D2 /* AYDicomPrintWindowController.h */; };
ABE0D67C0CDB179800F0494B /* AYDicomPrintPref.xib in Resources */ = {isa = PBXBuildFile; fileRef = ABE0D67A0CDB179800F0494B /* AYDicomPrintPref.xib */; };
/* End PBXBuildFile section */

Expand All @@ -24,6 +25,7 @@
32DBCFA20370C41700C91783 /* AYDicomPrint_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AYDicomPrint_Prefix.pch; sourceTree = "<group>"; };
8D202CF70486D31800D8A456 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D202CF80486D31800D8A456 /* AYDicomPrint.prefPane */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AYDicomPrint.prefPane; sourceTree = BUILT_PRODUCTS_DIR; };
AB631BAA12475287003488D2 /* AYDicomPrintWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AYDicomPrintWindowController.h; path = ../../AYDicomPrint/AYDicomPrintWindowController.h; sourceTree = SOURCE_ROOT; };
ABE0D67B0CDB179800F0494B /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/AYDicomPrintPref.xib; sourceTree = "<group>"; };
F506C035013D953901CA16C8 /* PreferencePanes.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PreferencePanes.framework; path = /System/Library/Frameworks/PreferencePanes.framework; sourceTree = "<absolute>"; };
F506C03C013D9D7901CA16C8 /* AYDicomPrintPref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AYDicomPrintPref.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -79,6 +81,7 @@
children = (
F506C03C013D9D7901CA16C8 /* AYDicomPrintPref.h */,
F506C03D013D9D7901CA16C8 /* AYDicomPrintPref.m */,
AB631BAA12475287003488D2 /* AYDicomPrintWindowController.h */,
);
name = Classes;
sourceTree = "<group>";
Expand Down Expand Up @@ -126,6 +129,7 @@
files = (
8D202CEA0486D31800D8A456 /* AYDicomPrint_Prefix.pch in Headers */,
8D202CEB0486D31800D8A456 /* AYDicomPrintPref.h in Headers */,
AB631BAB12475287003488D2 /* AYDicomPrintWindowController.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -159,7 +163,6 @@
isa = PBXProject;
buildConfigurationList = 1DBD214C08BA80EA00186707 /* Build configuration list for PBXProject "AYDicomPrint" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Expand Down Expand Up @@ -239,6 +242,12 @@
IBC_FLATTEN_NIBS = NO;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/PreferencePanes";
OTHER_LDFLAGS = (
"-bundle",
"-twolevel_namespace",
"-undefined",
dynamic_lookup,
);
PRODUCT_NAME = AYDicomPrint;
WRAPPER_EXTENSION = prefPane;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#import "AYDicomPrintPref.h"
#import <SecurityInterface/SFAuthorizationView.h>

#import "AYDicomPrintWindowController.h"

@implementation AYDicomPrintPref

- (id) init
{
if (self = [super init])
{
[AYDicomPrintWindowController updateAllPreferencesFormat];
}

return self;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// !$*UTF8*$!
{
089C1669FE841209C02AAC07 /* Project object */ = {
activeArchitecture = i386;
activeBuildConfigurationName = Development;
activeTarget = 8D202CE80486D31800D8A456 /* OSIViewerPreferencePane */;
addToTargets = (
Expand Down Expand Up @@ -39,7 +38,7 @@
953,
60,
20,
48.16259765625,
48,
43,
43,
);
Expand All @@ -53,11 +52,11 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 229521141;
PBXWorkspaceStateSaveDate = 229521141;
PBXPerProjectTemplateStateSaveDate = 306664125;
PBXWorkspaceStateSaveDate = 306664125;
};
perUserProjectItems = {
AB57C1DF0D98EA5500C09611 /* PBXTextBookmark */ = AB57C1DF0D98EA5500C09611 /* PBXTextBookmark */;
AB631BC3124752FB003488D2 /* PBXTextBookmark */ = AB631BC3124752FB003488D2 /* PBXTextBookmark */;
ABBE70350DAE371600B07421 /* PBXTextBookmark */ = ABBE70350DAE371600B07421 /* PBXTextBookmark */;
};
sourceControlManager = AB29966A09AB2BCA00F810FC /* Source Control */;
Expand All @@ -72,22 +71,25 @@
fallbackIsa = XCSourceControlManager;
isSCMEnabled = 0;
scmConfiguration = {
repositoryNamesForRoots = {
"" = "";
};
};
scmType = "";
};
AB29966B09AB2BCA00F810FC /* Code sense */ = {
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
AB57C1DF0D98EA5500C09611 /* PBXTextBookmark */ = {
AB631BC3124752FB003488D2 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = F506C03D013D9D7901CA16C8 /* OSIViewerPreferencePanePref.m */;
name = "OSIViewerPreferencePanePref.m: 156";
rLen = 15;
rLoc = 4799;
name = "OSIViewerPreferencePanePref.m: 25";
rLen = 6;
rLoc = 917;
rType = 0;
vrLen = 1192;
vrLoc = 4044;
vrLen = 1166;
vrLoc = 401;
};
ABBE70350DAE371600B07421 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
Expand All @@ -108,9 +110,9 @@
};
F506C03D013D9D7901CA16C8 /* OSIViewerPreferencePanePref.m */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1171, 2520}}";
sepNavIntBoundsRect = "{{0, 0}, {1171, 1890}}";
sepNavSelRange = "{917, 6}";
sepNavVisRange = "{417, 1106}";
sepNavVisRange = "{401, 1166}";
sepNavVisRect = "{{0, 729}, {1185, 713}}";
};
};
Expand Down

0 comments on commit d5e45ab

Please sign in to comment.