diff --git a/DicomUnEnhancer/.DS_Store b/DicomUnEnhancer/.DS_Store new file mode 100644 index 0000000..37d8df2 Binary files /dev/null and b/DicomUnEnhancer/.DS_Store differ diff --git a/DicomUnEnhancer/DicomUnEnhancer.xcodeproj/project.pbxproj b/DicomUnEnhancer/DicomUnEnhancer.xcodeproj/project.pbxproj index ea0b9f6..8087b9c 100644 --- a/DicomUnEnhancer/DicomUnEnhancer.xcodeproj/project.pbxproj +++ b/DicomUnEnhancer/DicomUnEnhancer.xcodeproj/project.pbxproj @@ -157,7 +157,8 @@ }; /* End PBXGroup section */ -/* Begin PBXHeadersBuildPhase section */ +/* Begin PBXhead +ersBuildPhase section */ 8D5B49AD048680CD000E48DA /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; diff --git a/DicomUnEnhancer/Info.plist b/DicomUnEnhancer/Info.plist deleted file mode 100644 index dba0e5e..0000000 --- a/DicomUnEnhancer/Info.plist +++ /dev/null @@ -1,29 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - DicomUnEnhancer - CFBundleIconFile - DicomUnEnhancer - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleSignature - ???? - CFBundleVersion - 1.0.2 - NSPrincipalClass - DicomUnEnhancer - MenuTitles - - Save as non-enhanced DICOM - Save as NIfTI - - pluginType - Database - - diff --git a/DicomUnEnhancer/Sources/DicomUnEnhancerDCMTK.mm b/DicomUnEnhancer/Sources/DicomUnEnhancerDCMTK.mm index dfcf7d0..7dd0134 100644 --- a/DicomUnEnhancer/Sources/DicomUnEnhancerDCMTK.mm +++ b/DicomUnEnhancer/Sources/DicomUnEnhancerDCMTK.mm @@ -9,9 +9,9 @@ #import "DicomUnEnhancerDCMTK.h" #import #import -#import -#import -#import +#import "dcmimage.h" +#import "dcfilefo.h" +#import "dcuid.h" /*void describe(DcmSequenceOfItems* items) { for (unsigned int i = 0; i < items->card(); ++i) { diff --git a/DiscPublishing/Classes/DiscPublishingFilesManager.mm b/DiscPublishing/Classes/DiscPublishingFilesManager.mm index 5327cac..db82bb5 100644 --- a/DiscPublishing/Classes/DiscPublishingFilesManager.mm +++ b/DiscPublishing/Classes/DiscPublishingFilesManager.mm @@ -267,7 +267,7 @@ -(void)observeDatabaseAddition:(NSNotification*)notification { if ([image managedObjectContext] == [[DicomDatabase defaultDatabase] managedObjectContext]) { DiscPublishingPatientStack* dpps = [self stackForImage:image serviceId:sid]; if (![dpps.images containsObject:image]) - if (image.modality && ![image.modality isEqual:@"SR"]) // TODO: why? + if (image.modality /*&& ![image.modality isEqual:@"SR"]*/) // TODO: why? [dpps addImage:image]; } } @catch (NSException* e) { diff --git a/DiscPublishing/Resources/Info.plist b/DiscPublishing/Resources/Info.plist index d82bdaa..feb1fec 100644 --- a/DiscPublishing/Resources/Info.plist +++ b/DiscPublishing/Resources/Info.plist @@ -13,7 +13,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.3.1 + 1.3.2 CFBundleIdentifier com.osirix.discpublishing CFBundleSignature @@ -23,7 +23,7 @@ Publish NSHumanReadableCopyright - © 2010-2012 OsiriX Team + © 2010-2013 OsiriX Team NSPrincipalClass DiscPublishing ToolbarIcon diff --git a/Ejection Fraction/Ejection Fraction II.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Ejection Fraction/Ejection Fraction II.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 02c9261..0000000 --- a/Ejection Fraction/Ejection Fraction II.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Ejection Fraction/Ejection Fraction II.xcodeproj/project.xcworkspace/xcuserdata/antoinerosset.xcuserdatad/UserInterfaceState.xcuserstate b/Ejection Fraction/Ejection Fraction II.xcodeproj/project.xcworkspace/xcuserdata/antoinerosset.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 3cf8651..0000000 Binary files a/Ejection Fraction/Ejection Fraction II.xcodeproj/project.xcworkspace/xcuserdata/antoinerosset.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/Ejection Fraction/Ejection Fraction II.xcodeproj/xcuserdata/antoinerosset.xcuserdatad/xcschemes/Ejection Fraction II.xcscheme b/Ejection Fraction/Ejection Fraction II.xcodeproj/xcuserdata/antoinerosset.xcuserdatad/xcschemes/Ejection Fraction II.xcscheme deleted file mode 100644 index 3881a08..0000000 --- a/Ejection Fraction/Ejection Fraction II.xcodeproj/xcuserdata/antoinerosset.xcuserdatad/xcschemes/Ejection Fraction II.xcscheme +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Ejection Fraction/Ejection Fraction II.xcodeproj/xcuserdata/antoinerosset.xcuserdatad/xcschemes/xcschememanagement.plist b/Ejection Fraction/Ejection Fraction II.xcodeproj/xcuserdata/antoinerosset.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 11493ad..0000000 --- a/Ejection Fraction/Ejection Fraction II.xcodeproj/xcuserdata/antoinerosset.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - Ejection Fraction II.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 8D5B49AC048680CD000E48DA - - primary - - - - - diff --git a/Ejection Fraction/Ejection Fraction II.xcodeproj/project.pbxproj b/Ejection Fraction/Ejection Fraction.xcodeproj/project.pbxproj similarity index 96% rename from Ejection Fraction/Ejection Fraction II.xcodeproj/project.pbxproj rename to Ejection Fraction/Ejection Fraction.xcodeproj/project.pbxproj index c801738..7e5affe 100644 --- a/Ejection Fraction/Ejection Fraction II.xcodeproj/project.pbxproj +++ b/Ejection Fraction/Ejection Fraction.xcodeproj/project.pbxproj @@ -93,7 +93,11 @@ 59FB4F7610A2D68800283D52 /* TeichholzEjectionFractionAlgorithm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TeichholzEjectionFractionAlgorithm.h; path = Sources/Algorithms/TeichholzEjectionFractionAlgorithm.h; sourceTree = ""; }; 59FB4F7710A2D68800283D52 /* TeichholzEjectionFractionAlgorithm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TeichholzEjectionFractionAlgorithm.mm; path = Sources/Algorithms/TeichholzEjectionFractionAlgorithm.mm; sourceTree = ""; }; AB5D36050680E57E00F4007A /* Ejection Fraction.osirixplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Ejection Fraction.osirixplugin"; sourceTree = BUILT_PRODUCTS_DIR; }; +<<<<<<< HEAD:Ejection Fraction/Ejection Fraction II.xcodeproj/project.pbxproj CEB6E5BB172D126500826F3F /* OsiriXAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OsiriXAPI.framework; path = ../../osirix/build/Development/OsiriXAPI.framework; sourceTree = ""; }; +======= + CE7FC25E16CB7D00003E9474 /* OsiriXAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OsiriXAPI.framework; path = ../../osirix/build/Development/OsiriXAPI.framework; sourceTree = ""; }; +>>>>>>> master:Ejection Fraction/Ejection Fraction.xcodeproj/project.pbxproj /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -228,9 +232,9 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 8D5B49AC048680CD000E48DA /* Ejection Fraction II */ = { + 8D5B49AC048680CD000E48DA /* Ejection Fraction */ = { isa = PBXNativeTarget; - buildConfigurationList = CE6A9A9008AC841300D0C1EE /* Build configuration list for PBXNativeTarget "Ejection Fraction II" */; + buildConfigurationList = CE6A9A9008AC841300D0C1EE /* Build configuration list for PBXNativeTarget "Ejection Fraction" */; buildPhases = ( 8D5B49AD048680CD000E48DA /* Headers */, 8D5B49AF048680CD000E48DA /* Resources */, @@ -242,7 +246,7 @@ ); dependencies = ( ); - name = "Ejection Fraction II"; + name = "Ejection Fraction"; productInstallPath = "$(HOME)/Library/Bundles"; productName = Invert; productReference = AB5D36050680E57E00F4007A /* Ejection Fraction.osirixplugin */; @@ -253,7 +257,7 @@ /* Begin PBXProject section */ 089C1669FE841209C02AAC07 /* Project object */ = { isa = PBXProject; - buildConfigurationList = CE6A9A9408AC841300D0C1EE /* Build configuration list for PBXProject "Ejection Fraction II" */; + buildConfigurationList = CE6A9A9408AC841300D0C1EE /* Build configuration list for PBXProject "Ejection Fraction" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; @@ -267,7 +271,7 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 8D5B49AC048680CD000E48DA /* Ejection Fraction II */, + 8D5B49AC048680CD000E48DA /* Ejection Fraction */, ); }; /* End PBXProject section */ @@ -332,12 +336,16 @@ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; COPY_PHASE_STRIP = NO; DEBUGGING_SYMBOLS = YES; +<<<<<<< HEAD:Ejection Fraction/Ejection Fraction II.xcodeproj/project.pbxproj FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/../../osirix-trunk/build/Development/\"", "\"$(SRCROOT)/../../osirix/osirix/build/Development\"", "\"$(SRCROOT)/../../osirix/build/Development\"", ); +======= + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; +>>>>>>> master:Ejection Fraction/Ejection Fraction.xcodeproj/project.pbxproj GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; @@ -381,6 +389,7 @@ ppc64, x86_64, ); + FRAMEWORK_SEARCH_PATHS = ../../osirix/build/Development/; MACOSX_DEPLOYMENT_TARGET = 10.7; SDKROOT = macosx10.7; }; @@ -389,7 +398,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - CE6A9A9008AC841300D0C1EE /* Build configuration list for PBXNativeTarget "Ejection Fraction II" */ = { + CE6A9A9008AC841300D0C1EE /* Build configuration list for PBXNativeTarget "Ejection Fraction" */ = { isa = XCConfigurationList; buildConfigurations = ( CE6A9A9108AC841300D0C1EE /* Development */, @@ -397,7 +406,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Development; }; - CE6A9A9408AC841300D0C1EE /* Build configuration list for PBXProject "Ejection Fraction II" */ = { + CE6A9A9408AC841300D0C1EE /* Build configuration list for PBXProject "Ejection Fraction" */ = { isa = XCConfigurationList; buildConfigurations = ( CE6A9A9508AC841300D0C1EE /* Development */, diff --git a/Ejection Fraction/Resources/Info.plist b/Ejection Fraction/Resources/Info.plist index 30ea104..c616d4a 100644 --- a/Ejection Fraction/Resources/Info.plist +++ b/Ejection Fraction/Resources/Info.plist @@ -25,9 +25,9 @@ pluginType roiTool CFBundleName - Ejection Fraction II + Ejection Fraction CFBundleShortVersionString - 2.5.2 + 2.5.3 NSHumanReadableCopyright © 2009-2013 OsiriX Team CFBundleIdentifier diff --git a/HipArthroplastyTemplating/HipArthroplastyTemplating.xcodeproj/project.pbxproj b/HipArthroplastyTemplating/HipArthroplastyTemplating.xcodeproj/project.pbxproj index 02a8ec2..f47f8d7 100644 --- a/HipArthroplastyTemplating/HipArthroplastyTemplating.xcodeproj/project.pbxproj +++ b/HipArthroplastyTemplating/HipArthroplastyTemplating.xcodeproj/project.pbxproj @@ -106,7 +106,7 @@ 59F6A17010564067008585F5 /* ArthroplastyTemplatingWindowController+OsiriX.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "ArthroplastyTemplatingWindowController+OsiriX.mm"; sourceTree = ""; }; 59F6A17410564159008585F5 /* ArthroplastyTemplatingWindowController+Templates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ArthroplastyTemplatingWindowController+Templates.h"; sourceTree = ""; }; 59F6A17510564159008585F5 /* ArthroplastyTemplatingWindowController+Templates.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "ArthroplastyTemplatingWindowController+Templates.mm"; sourceTree = ""; }; - 712BC55D15871807005460E6 /* OsiriXAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OsiriXAPI.framework; path = "../../osirix-trunk/build/Development/OsiriXAPI.framework"; sourceTree = ""; }; + 712BC55D15871807005460E6 /* OsiriXAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OsiriXAPI.framework; path = ../../osirix/build/Development/OsiriXAPI.framework; sourceTree = ""; }; 713D45E115AD861000B392E0 /* Versions.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Versions.txt; sourceTree = ""; }; 718D0AE8159C8E9A00F27CE9 /* HipAT2D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HipAT2D.h; sourceTree = ""; }; 718D0AE9159C8E9A00F27CE9 /* HipAT2D.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HipAT2D.mm; sourceTree = ""; }; @@ -419,7 +419,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", - "\"$(SRCROOT)/../../osirix-trunk/build/Development\"", + "\"$(SRCROOT)/../../osirix/build/Development\"", ); FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/Accelerate.framework/Versions/A/Frameworks\""; GCC_C_LANGUAGE_STANDARD = gnu99; diff --git a/HipArthroplastyTemplating/Versions.txt b/HipArthroplastyTemplating/Versions.txt index 2bfb32e..fceb6f8 100644 --- a/HipArthroplastyTemplating/Versions.txt +++ b/HipArthroplastyTemplating/Versions.txt @@ -6,7 +6,7 @@ - fixed bug: if /Library/Application Support/OsiriX doesn't exist, don't try to create it 2.4.1 -- 1-click calibration also possible with non-think reference objects thanks to better flood threshold computation +- 1-click calibration also possible with non-thick reference objects thanks to better flood threshold computation 2.4 - Added Medacta miniMAX stems diff --git a/KeyObjectSelection/KeyObjectSelection.xcodeproj/project.pbxproj b/KeyObjectSelection/KeyObjectSelection.xcodeproj/project.pbxproj index 0b4f3d2..b184b6b 100644 --- a/KeyObjectSelection/KeyObjectSelection.xcodeproj/project.pbxproj +++ b/KeyObjectSelection/KeyObjectSelection.xcodeproj/project.pbxproj @@ -40,7 +40,7 @@ 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 32DBCF630370AF2F00C91783 /* KeyObjectSelection_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyObjectSelection_Prefix.pch; path = Sources/KeyObjectSelection_Prefix.pch; sourceTree = ""; }; - 7116D7391574A91300FA293A /* OsiriX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OsiriX.framework; path = "../../osirix-trunk/build/Development/OsiriX.framework"; sourceTree = ""; }; + 7116D7391574A91300FA293A /* OsiriX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OsiriX.framework; path = ../../osirix/build/Development/OsiriX.framework; sourceTree = ""; }; 7116D74515751B9A00FA293A /* KeyObjectSelectionPrefs.prefPane */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KeyObjectSelectionPrefs.prefPane; sourceTree = BUILT_PRODUCTS_DIR; }; 7116D74715751B9A00FA293A /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 7116D74915751B9A00FA293A /* PreferencePanes.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PreferencePanes.framework; path = System/Library/Frameworks/PreferencePanes.framework; sourceTree = SDKROOT; }; @@ -53,7 +53,7 @@ 7116D76615751C5800FA293A /* KeyObjectSelectionPrefs.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = KeyObjectSelectionPrefs.xib; path = Resources/KeyObjectSelectionPrefs.xib; sourceTree = ""; }; 71E2C42E1576657800EB8B95 /* NSUserDefaults+KOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSUserDefaults+KOS.h"; path = "Sources/NSUserDefaults+KOS.h"; sourceTree = ""; }; 71E2C42F1576657800EB8B95 /* NSUserDefaults+KOS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSUserDefaults+KOS.m"; path = "Sources/NSUserDefaults+KOS.m"; sourceTree = ""; }; - 8420023112E829A200E1E9CE /* OsiriXAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OsiriXAPI.framework; path = "../../osirix-trunk/build/Development/OsiriXAPI.framework"; sourceTree = ""; }; + 8420023112E829A200E1E9CE /* OsiriXAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OsiriXAPI.framework; path = ../../osirix/build/Development/OsiriXAPI.framework; sourceTree = ""; }; 8D5B49B7048680CD000E48DA /* Plugin-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Plugin-Info.plist"; path = "Resources/Plugin-Info.plist"; sourceTree = ""; }; AB5D36050680E57E00F4007A /* KeyObjectSelection.osirixplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KeyObjectSelection.osirixplugin; sourceTree = BUILT_PRODUCTS_DIR; }; ABA48A640680BB600089EB4F /* KeyObjectSelectionFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = KeyObjectSelectionFilter.h; path = Sources/KeyObjectSelectionFilter.h; sourceTree = ""; }; @@ -412,7 +412,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)\"", - "\"../../osirix-trunk/build/Development\"", + "\"../../osirix/build/Development\"", ); GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_TRIGRAPHS = NO; @@ -434,7 +434,7 @@ OTHER_REZFLAGS = ""; PRODUCT_NAME = KeyObjectSelection; SECTORDER_FLAGS = ""; - USER_HEADER_SEARCH_PATHS = "\"../../osirix-trunk/build/Development/OsiriXAPI.framework/Versions/A/Headers\""; + USER_HEADER_SEARCH_PATHS = "\"../../osirix/build/Development/OsiriXAPI.framework/Versions/A/Headers\""; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", @@ -452,7 +452,7 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)\"", - "\"../../osirix-trunk/build/Development\"", + "\"../../osirix/build/Development\"", ); GCC_ENABLE_TRIGRAPHS = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -471,7 +471,7 @@ OTHER_REZFLAGS = ""; PRODUCT_NAME = KeyObjectSelection; SECTORDER_FLAGS = ""; - USER_HEADER_SEARCH_PATHS = "\"../../osirix-trunk/build/Development/OsiriXAPI.framework/Versions/A/Headers\""; + USER_HEADER_SEARCH_PATHS = "\"../../osirix/build/Development/OsiriXAPI.framework/Versions/A/Headers\""; WARNING_CFLAGS = ( "-Wmost", "-Wno-four-char-constants", diff --git a/KeyObjectSelection/Resources/Plugin-Info.plist b/KeyObjectSelection/Resources/Plugin-Info.plist index 7086e6a..f007f1b 100644 --- a/KeyObjectSelection/Resources/Plugin-Info.plist +++ b/KeyObjectSelection/Resources/Plugin-Info.plist @@ -15,7 +15,7 @@ CFBundleSignature ???? CFBundleShortVersionString - 1.0.2 + 1.0.3 NSPrincipalClass KeyObjectSelectionFilter diff --git a/KeyObjectSelection/Sources/KeyObjectSelectionFilter.mm b/KeyObjectSelection/Sources/KeyObjectSelectionFilter.mm index 45c17ce..f0e5b46 100644 --- a/KeyObjectSelection/Sources/KeyObjectSelectionFilter.mm +++ b/KeyObjectSelection/Sources/KeyObjectSelectionFilter.mm @@ -656,11 +656,11 @@ -(void)_ViewerController_setKeyImage:(id)sender { // import the file into our DB DicomDatabase* database = [DicomDatabase databaseForContext:study.managedObjectContext]; - NSArray* images = [database addFilesAtPaths:[NSArray arrayWithObject:path] - postNotifications:YES - dicomOnly:YES - rereadExistingItems:YES - generatedByOsiriX:YES]; + NSArray* imageIDs = [database addFilesAtPaths:[NSArray arrayWithObject:path] + postNotifications:YES + dicomOnly:YES + rereadExistingItems:YES + generatedByOsiriX:YES]; // upload the new file to the DICOM node if ([NSUserDefaults.standardUserDefaults boolForKey:KOSSynchronizeKey]) // plugin is active @@ -687,8 +687,8 @@ -(void)_ViewerController_setKeyImage:(id)sender { }]; // set the new images as key images - for (DicomImage* image in images) - [image setIsKeyImage:[NSNumber numberWithBool:YES]]; + for (DicomImage* imageID in imageIDs) + [[database objectWithID:imageID] setIsKeyImage:[NSNumber numberWithBool:YES]]; } else [self _ViewerController_setKeyImage:sender]; diff --git a/KiOP/KiOP/inc/Control_Cursor_Qt.h b/KiOP/KiOP/inc/Control_Cursor_Qt.h deleted file mode 100644 index 68f13f1..0000000 --- a/KiOP/KiOP/inc/Control_Cursor_Qt.h +++ /dev/null @@ -1,132 +0,0 @@ - -#ifndef __CONTROL_CURSOR_QT_H__ -#define __CONTROL_CURSOR_QT_H__ - - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include "Parametres.h" -#include "Point_3D.h" - -#ifdef _OS_WIN_ - #include - #include "Gestion_Curseurs.h" -#endif - - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//==========================================================================// -//=============================== CONSTANTES ===============================// - -#define STEADY_TYPE 1 -#define HAND_CLOSED_TYPE 2 -#define POINTER_TYPE 3 - -#define CORRECTION_DISTANCE_LINEAIRE 0 - -#if (1)//(SCRSZW >= SCRSZH) - #define MAXDX 45 - #define MAXDY ( (int)((double)MAXDX * ((double)SCRSZH/(double)SCRSZW)) ) -#else - #define MAXDY 45 - #define MAXDX ( (int)((double)MAXDY * ((double)SCRSZW/(double)SCRSZH)) ) -#endif - -#define COEFF_A -0.2502 -#define COEFF_B 483.99 -#define COEFF_C 654.98 -#define COEFF_D -0.001 - -#define COEFF_LIN_1X ((40*SCRSZW)/(MAXDX*COEFF_A)) -#define COEFF_LIN_1Y ((40*SCRSZH)/(MAXDY*COEFF_A)) -#define COEFF_LIN_2 (COEFF_B/COEFF_A) - -#define COEFF_EXP_X ((40*SCRSZW)/(MAXDX*COEFF_C)) -#define COEFF_EXP_Y ((40*SCRSZH)/(MAXDY*COEFF_C)) - - -//==========================================================================// -//================================ CLASSES =================================// - -class CursorQt -{ -public : - - // ---------------- Constructeur(s) ------------------ // - CursorQt(short type=STEADY_TYPE); - - // ---------------- Setter(s) ------------------ // - void SetPos(unsigned int x, unsigned int y); - void SetPos(QPoint newPos); - - void IncrementPos(int dx, int dy); - void IncrementPos(QPoint deltaPos); - - void SetMoveEnable(void); - void SetMoveDisable(void); - - void SetClicEnable(void); - void SetClicDisable(void); - - // ---------------- Getter(s) ------------------ // - short CursorType(void) const; - - QPoint Pos(void) const; - QPoint PreviousPos(void) const; - QPoint DeltaPos(void) const; - bool MoveEnable(void) const; - - bool ClicEnable(void) const; - bool LeftClicPressed() const; - - bool InCursorSession() const; - - void PressLeftClic(bool force=false); - void ReleaseLeftClic(bool force=false); - - void NewCursorSession(Point3D handPt); - void EndCursorSession(void); - - void MoveCursor(Point3D handPt); - -protected : - - short m_type; - - QCursor m_cursor; - QPoint m_previousPos; - - QPoint m_virtualPosPrev; - - bool m_moveEnable; - bool m_clicEnable; - - bool m_inCursorSession; - bool m_leftClicPressed; - - double m_courbeDeplacement[1001]; - -}; - - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/Gestion_Curseurs.h b/KiOP/KiOP/inc/Gestion_Curseurs.h deleted file mode 100644 index 8bccfb9..0000000 --- a/KiOP/KiOP/inc/Gestion_Curseurs.h +++ /dev/null @@ -1,36 +0,0 @@ - -#ifndef Gestion_Curseurs_h -#define Gestion_Curseurs_h - - -/***************************************************************************** -****************************** FICHIERS INCLUS ******************************/ - -#include "Parametres.h" - -#include -#ifdef _OS_WIN_ - #include -#endif -#include - - -#define CURSOR_FOLDER_PATH "kinect/Cursors" - - -/***************************************************************************** -************************** PROTOTYPES DE FONCTIONS **************************/ - -void InitGestionCurseurs(void); -BOOL LoadCursorFromCURFile(LPTSTR szFileName, HCURSOR *phCursor, unsigned int dimX, unsigned int dimY); -void ChangeCursor(unsigned short val); - - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/Gestion_GLUT.h b/KiOP/KiOP/inc/Gestion_GLUT.h deleted file mode 100644 index daf0813..0000000 --- a/KiOP/KiOP/inc/Gestion_GLUT.h +++ /dev/null @@ -1,33 +0,0 @@ - -#ifndef __GESTION_GLUT_H__ -#define __GESTION_GLUT_H__ - - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include "Parametres.h" - -#include -#ifdef _OS_WIN_ - #include -#endif -//#include -#include - - -//==========================================================================// -//============================== PROTOTYPES ================================// - -void RepositionnementFenetre(unsigned int val); -void RepositionnementFenetre(unsigned int x, unsigned int y); - - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/Hand_Closed_Detection.h b/KiOP/KiOP/inc/Hand_Closed_Detection.h deleted file mode 100644 index bff05c4..0000000 --- a/KiOP/KiOP/inc/Hand_Closed_Detection.h +++ /dev/null @@ -1,109 +0,0 @@ - -#ifndef __HAND_CLOSED_DETECTION__ -#define __HAND_CLOSED_DETECTION__ - - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include - -#include "Point_3D.h" -#include "Parametres.h" -#include "Region_Of_Interest.h" - -#include -#include -#include - -#include "XnCppWrapper.h" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/highgui/highgui.hpp" -//#include "cap_openni.cpp" - -using namespace std; -using namespace cv; - - -//==========================================================================// -//=============================== CONSTANTES ===============================// - -#define DISTANCE_MAX_DETECTION 1800 -#define INTERVALLE_PROFONDEUR_DETECTION 200 -#define RAPPORT_DIM_ROI 0.6 -#define NB_CASE_HAND_CLOSED_PREV 20 - -#define SEUIL_BAS 0.85 -#define SEUIL_HAUT (1/SEUIL_BAS) - - -//==========================================================================// -//================================ CLASSES =================================// - -class HandClosedDetection -{ -public : - - HandClosedDetection(); - void Update(unsigned int methode, const xn::DepthMetaData& dpmd, const Point3D handPt); - - //void ExtractionROI(const xn::DepthMetaData& dpmd); - void UpdateROI_Data(const xn::DepthMetaData& dpmd); - void Display_ROI(Mat& ROI); - - void UpdateDepthLimits(void); - void UpdateDepthLimits(unsigned int handPtZ); - - void UpdateHandPt(Point3D handPoint); - void UpdateHandPtInROI(void); - - void UpdateROI_Pt(void); - void UpdateROI_Size(void); - - QPoint ROI_Pt(void) const; - QSize ROI_Size(void) const; - - void DefinitionPointsCadrage(Mat& ROI, QPoint& haut, QPoint& bas, QPoint& gauche, QPoint& droite); - - void MethodeAireMain(const xn::DepthMetaData& dpmd); - void MethodeSurfaceRect(const xn::DepthMetaData& dpmd); - - void IncrementCompteurFrame(void); - void ResetCompteurFrame(void); - int CompteurFrame(void) const; - - void UpdateHandClosedPrev(void); - - bool HandClosed(void) const; - bool HandClosedPrev(unsigned int val) const; - bool HandClosedFlancMont(void) const; - bool HandClosedFlancDesc(void) const; - bool HandClosedClic(unsigned int val) const; - bool HandClosedStateChanged() const; - -private : - - RegionOfInterrest m_ROI; - Mat m_ROI_Data; - Mat m_ROI_Data2; - - bool m_handClosed; - bool m_handClosedPrev[NB_CASE_HAND_CLOSED_PREV]; - bool m_ROI_OutOfCamera; - - unsigned int m_depthLimitMin, m_depthLimitMax; - Point3D m_handPt; - QPoint m_handPtInROI; - - unsigned int m_compteurFrame; -}; - - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/Hand_Point.h b/KiOP/KiOP/inc/Hand_Point.h deleted file mode 100644 index 8ab3791..0000000 --- a/KiOP/KiOP/inc/Hand_Point.h +++ /dev/null @@ -1,107 +0,0 @@ - -#ifndef __HAND_POINT__ -#define __HAND_POINT__ - - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include -#include -#include -using namespace std; - -#include "Parametres.h" -#include "Point_3D.h" -#include "Steady_Class.h" -#include -#include - - -//==========================================================================// -//=============================== CONSTANTES ===============================// - -#define MIN_SMOOTH_VALUE 0 -#define MAX_SMOOTH_VALUE 40 - -#define SEUIL_BRUIT 2 -#define NB_CASE 4 - - -//==========================================================================// -//================================ CLASSES =================================// - -class HandPoint -{ -public : - - HandPoint(void); - - void Update(XnPoint3D handPt); - - Point3D HandPt(void) const; - Point3D HandPtBrut(void) const; - Point3D HandPtBrutFiltre(void) const; - Point3D LastHandPt(void) const; - Point3D DeltaHandPt(void) const; - Point3D HandVirtualPt(void) const; - - Point3D Speed(void) const; - - void FiltreBruit(void); - - void FiltreSmooth(void); - void SetSmooth(Point3D smooth); - void SetSmooth(unsigned int smoothX, unsigned int smoothY, unsigned int smoothZ); - void IncrementSmooth(Point3D increment); - void IncrementSmooth(int x, int y, int z); - Point3D Smooth(void) const; - - bool Steady2(void) const; - bool Steady5(void) const; - bool Steady10(void) const; - bool Steady15(void) const; - bool Steady20(void) const; - bool NotSteady(void) const; - void SignalResetSteadies(void); - - void IncrementCompteurFrame(void); - unsigned int CompteurFrame(void) const; - - bool DetectLeft(void); - bool DetectRight(void); - bool DetectUp(void); - bool DetectDown(void); - bool DetectForward(void); - bool DetectBackward(void); - bool DetectStatic(void); - -private : - - unsigned int m_compteurFrame; - - Point3D m_handPt; - Point3D m_handPtBrut; - Point3D m_handPtBrutFiltre; - Point3D m_lastHandPt; - Point3D m_lastHandPtBrut[NB_CASE]; - Point3D m_diffHandPt; - - Point3D m_handVirtualPt; - - Point3D m_smooth; - - SteadyClass m_sTD; -}; - - - - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/Parametres.h b/KiOP/KiOP/inc/Parametres.h deleted file mode 100644 index bfb4151..0000000 --- a/KiOP/KiOP/inc/Parametres.h +++ /dev/null @@ -1,107 +0,0 @@ - -#ifndef __PARAMETRES_H__ -#define __PARAMETRES_H__ - - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include - -#include -#include -#include - -// Définition du système d'exploitation -#if defined (_WIN32) - #define _OS_WIN_ -#elif defined (__APPLE__) - #define _OS_MAC_ -#endif - -#ifdef _OS_WIN_ - #include -#endif - -using namespace std; - - -//==========================================================================// -//============================== CONSTANTES ================================// - -#if defined _OS_WIN_ - #define SCRSZW (SCRSZWidth()) - #define SCRSZH (SCRSZHeight()) -#elif defined _OS_MAC_ - #define SCRSZW (SCRSZWidth()) - #define SCRSZH (SCRSZHeight()) -#endif - -#if defined _OS_WIN_ - #define RESETALL 0 - #define LAYOUT 1 - #define MOVE 2 - #define CONTRAST 3 - #define ZOOM 4 - #define SCROLL 5 - #define POINTER 6 - #define MOUSE 7 - #define CROSS 8 -#elif defined _OS_MAC_ - #define MOVE 0 - #define CONTRAST 1 - #define ZOOM 2 - #define SCROLL 3 - #define POINTER 4 - #define MOUSE 5 - #define CROSS 6 -#endif - -#define INACTIVE_SESSION_STATE -1 -#define NO_ACTION_STATE 0 -#define CALIBRATE_HAND_STATE 1 -#define TOOLS_MENU_STATE 2 -#define NORMAL_TOOLS_STATE 3 -#define LAYOUT_STATE 4 -#define POINTER_STATE 5 -#define MOUSE_STATE 6 -#define BACK_TO_MENU_STATE 9 - - -//==========================================================================// -//============================== PARAMETRES ================================// - -#define RAPPORT_SCRSZW_WINSZW 5 // Rapport de la largeur de l'écran sur la largeur de la fenêtre -#define RES_WINDOW_GLUT 4 -#define INIT_POS_WINDOW 1 // Position initiale de la fenêtre - -#if 1 - #define RES_X 640 - #define RES_Y 480 -#else - #define RES_X 480 - #define RES_Y 320 -#endif - -#define INIT_WIDTH_WINDOW (SCRSZW/RAPPORT_SCRSZW_WINSZW) -#define INIT_HEIGHT_WINDOW (INIT_WIDTH_WINDOW*((float)RES_Y/(float)RES_X)) - -#define MAX_STD_DEV_FOR_STEADY 0.002 -#define MAX_STD_DEV_FOR_NOT_STEADY 0.006 - - -//==========================================================================// -//============================== PROTOTYPES ================================// - -unsigned int SCRSZWidth(void); -unsigned int SCRSZHeight(void); - - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/Point_2D.h b/KiOP/KiOP/inc/Point_2D.h deleted file mode 100644 index e0b565f..0000000 --- a/KiOP/KiOP/inc/Point_2D.h +++ /dev/null @@ -1,53 +0,0 @@ - -#ifndef __POINT_2D__ -#define __POINT_2D__ - - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include "Point_3D.h" - - -//==========================================================================// -//=============================== CONSTANTES ===============================// - - - - -//==========================================================================// -//================================ CLASSES =================================// - -class Point2D : public Point3D -{ -public : - - Point2D(); - Point2D(short x, short y); - Point2D(string name); - Point2D(short x, short y, string name); - - void SetCoordinate(const Point2D &pt); - void SetCoordinate(const Point3D &pt); - void SetCoordinate(short x, short y); - void SetCoordinate(const XnPoint3D xnPt); - - void Afficher(ostream &flux) const; - void Print(void) const; - void Print(unsigned short nbEndLine) const; - -protected : - -}; - -ostream &operator<<(ostream &flux, const Point2D &pt); - - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/Point_3D.h b/KiOP/KiOP/inc/Point_3D.h deleted file mode 100644 index cba070b..0000000 --- a/KiOP/KiOP/inc/Point_3D.h +++ /dev/null @@ -1,115 +0,0 @@ - -#ifndef __POINT_3D__ -#define __POINT_3D__ - - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include -#include -using namespace std; - -#include -#include "math.h" - - -//==========================================================================// -//=============================== CONSTANTES ===============================// - - - - -//==========================================================================// -//================================ CLASSES =================================// - -class Point3D -{ -public : - - // -------------- Constructeur(s) ---------------- // - Point3D(); - Point3D(short x, short y, short z); - Point3D(const Point3D &pt); - Point3D(string name); - Point3D(short x, short y, short z, string name); - Point3D(const Point3D &pt, string name); - - // ---------------- Setter(s) ------------------ // - void SetX(short x); - void SetY(short y); - void SetZ(short z); - void IcrX(short x); - void IcrY(short y); - void IcrZ(short z); - void Rename(string newName); - - // ---------------- Accesseur(s) ------------------ // - short X(void) const; - short Y(void) const; - short Z(void) const; - string Name(void) const; - - // ---------------- Afficheur(s) ------------------ // - void Afficher(ostream &flux) const; - void Print(void) const; - void Print(unsigned short nbEndLine) const; - - // --------------- Setters secondaires -------------- // - void SetToZero(void); - void SetCoordinate(const Point3D &pt); - void SetCoordinate(short x, short y, short z); - void SetCoordinate(const XnPoint3D xnPt); - void IcrCoordinate(const Point3D &pt); - void IcrCoordinate(short x, short y, short z); - void IcrCoordinate(const XnPoint3D xnPt); - - // ----------- AAAAA ------------ // - float Norme(void) const; - Point3D Sgn(void) const; - - // ----------- Opérateurs Arithmétiques ------------ // - Point3D& operator+=(const Point3D &pt); - Point3D& operator-=(const Point3D &pt); - Point3D& operator*=(const int nb); - Point3D& operator/=(const int nb); - -protected : - short m_x, m_y, m_z; - string m_name; - -}; - -// ----------- Opérateurs Arithmétiques ------------ // -Point3D operator+(const Point3D &pt1, const Point3D &pt2); -Point3D operator-(const Point3D &pt1, const Point3D &pt2); -Point3D operator*(const Point3D &pt, const int nb); -Point3D operator/(const Point3D &pt, const int nb); - -// ----------- Opérateurs de Comparaison ------------ // -bool operator==(const Point3D &pt1, const Point3D &pt2); -bool operator!=(const Point3D &pt1, const Point3D &pt2); -Point3D operator<(const Point3D &pt1, const Point3D &pt2); -Point3D operator<=(const Point3D &pt1, const Point3D &pt2); -Point3D operator>(const Point3D &pt1, const Point3D &pt2); -Point3D operator>=(const Point3D &pt1, const Point3D &pt2); - -// ----------- Opérateurs de Flux ------------ // -ostream &operator<<(ostream &flux, const Point3D &pt); - -bool EstDansZone(const Point3D& pt, const Point3D& ptLim1, const Point3D& ptLim2); - -// ----------- Fonctions pour listes ------------ // -Point3D MeanListPt3D(const Point3D list[], unsigned short size); -void PushListPt3D(const Point3D &pt, Point3D list[], unsigned short size); -void PrintListPt3D(const Point3D list[], unsigned short size); - - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/Region_Of_Interest.h b/KiOP/KiOP/inc/Region_Of_Interest.h deleted file mode 100644 index f3ec1db..0000000 --- a/KiOP/KiOP/inc/Region_Of_Interest.h +++ /dev/null @@ -1,66 +0,0 @@ - -#ifndef __REGION_OF_INTEREST__ -#define __REGION_OF_INTEREST__ - - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include - -#include "Parametres.h" -#include -#include - -#include -#include "XnCppWrapper.h" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/highgui/highgui.hpp" - -using namespace std; -using namespace cv; - - -//==========================================================================// -//=============================== CONSTANTES ===============================// - -#define MAX_ROI_SIZE 250 - - -//==========================================================================// -//================================ CLASSES =================================// - - - -class RegionOfInterrest -{ -public : - - // Constructeurs // - RegionOfInterrest(); - RegionOfInterrest(QPoint pt, QSize size); - - void SetPt(QPoint newPoint); - void SetPt(unsigned int x, unsigned int y); - void SetSize(QSize newSize); - void SetSize(unsigned int width, unsigned int height); - - QPoint Pt(void) const; - QSize Size(void) const; - -private : - - QSize m_size; - QPoint m_pt; - -}; - - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/Steady_Class.h b/KiOP/KiOP/inc/Steady_Class.h deleted file mode 100644 index 5c87060..0000000 --- a/KiOP/KiOP/inc/Steady_Class.h +++ /dev/null @@ -1,87 +0,0 @@ - -#ifndef __STEADY_CLASS__ -#define __STEADY_CLASS__ - - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include -using namespace std; - -#include -//#include -#include - -#include "Point_3D.h" - - -//==========================================================================// -//=============================== CONSTANTES ===============================// - -#define MAX_TOC_FRAME_VALUE 1000000 - - -//==========================================================================// -//================================ CLASSES =================================// - -class SteadyClass -{ -public : - - SteadyClass(void); - - void SteadyCheck(const Point3D& handPt, const Point3D& lastHandPt); - - void ResetSteadies(void); - void SignalResetSteadies(void); - bool Steady2(void) const; - bool Steady5(void) const; - bool Steady10(void) const; - bool Steady15(void) const; - bool Steady20(void) const; - bool NotSteady(void) const; - - void IncrementCompteurTimer(void); - -private : - - unsigned int m_compteurTimer; - -}; - - -//==========================================================================// -//============================== PROTOTYPES ================================// - -void SetTocFrame(unsigned int tocFrame); - -void EnclenchementTimer(unsigned int ticFrame); -void Steady2(int ticFrame); -void Steady5(int ticFrame); -void Steady10(int ticFrame); -void Steady15(int ticFrame); -void Steady20(int ticFrame); - -void SteadyAllEnable(void); -void Steady2Enable(void); -void Steady5Enable(void); -void Steady10Enable(void); -void Steady15Enable(void); -void Steady20Enable(void); - -void SteadyAllDisable(void); -void Steady2Disable(void); -void Steady5Disable(void); -void Steady10Disable(void); -void Steady15Disable(void); -void Steady20Disable(void); - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/graphicsview.h b/KiOP/KiOP/inc/graphicsview.h deleted file mode 100644 index 0c70ab2..0000000 --- a/KiOP/KiOP/inc/graphicsview.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef GRAPHICSVIEW_H -#define GRAPHICSVIEW_H - -#include "Parametres.h" - -#ifdef _OS_WIN_ - #include -#endif - -#include -#include -#include -#include - - -class GraphicsView : public QGraphicsView -{ - Q_OBJECT - -public: - explicit GraphicsView(QGraphicsScene *scene, QWidget *parent = 0); - virtual void resizeEvent(QResizeEvent *event); - int getResX(); - int getResY(); - void setSize(int width, int height); - QPoint Size(void); - void setPosition(int x, int y); - -signals: - -public slots: - -private: - void createUI(); - void moveBottom(GraphicsView* widget); - int WIDTH; - int HEIGHT; - -protected: - void keyPressEvent(QKeyEvent * event); - /*void paintEvent(QPaintEvent * event);*/ - -}; - - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/main.h b/KiOP/KiOP/inc/main.h deleted file mode 100644 index d11434b..0000000 --- a/KiOP/KiOP/inc/main.h +++ /dev/null @@ -1,201 +0,0 @@ - -#ifndef __MAIN_H__ -#define __MAIN_H__ - - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -// Local headers -#include "Parametres.h" -#include "Gestion_GLUT.h" -#include "Control_Cursor_Qt.h" -#include "Hand_Point.h" -#include "Point_3D.h" -#include "Point_2D.h" - -#ifdef _OS_WIN_ - #include "Gestion_Curseurs.h" -#endif -#include "graphicsview.h" -#include "pixmap.h" -#include "telnetclient.h" -#include "tooldock.h" - -// Headers de base -#include -#include -#include -#include -#include -#include - -// Headers for OpenGL -//#include -//#include -//#include -#include - -// Headers for OpenNI -#include -#include -#include -#include - -// Headers for NITE -#include -#include -#include -#include -#include "XnVDepthMessage.h" -#include -#include - -// Headers for OpenCV -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/highgui/highgui.hpp" - -// Headers for Qt -#include -#include -#include -#include - -// Namespaces -using namespace std; -using namespace cv; - - -//==========================================================================// -//============================== CONSTANTES ================================// - -#define TITLE "KiOP v1.0.0-beta" - -#define DP_FAR 5000 -#define DP_CLOSE 0 -#define MAX_COLOR 255 -#define COLORS 20 - -#if 1 - #define DISTANCE_MIN 800 - #define DISTANCE_MAX 2500 -#else - #define DISTANCE_MIN 1200 - #define DISTANCE_MAX 1600 -#endif - -#if defined _OS_WIN_ - #define SENSIBILITE_MOVE 2 - #define SENSIBILITE_MOVE_X (SENSIBILITE_MOVE) - #define SENSIBILITE_MOVE_Y (SENSIBILITE_MOVE) - #define SENSIBILITE_CONTRAST 2 - #define SENSIBILITE_CONTRAST_X (SENSIBILITE_CONTRAST) - #define SENSIBILITE_CONTRAST_Y (SENSIBILITE_CONTRAST) - #define SENSIBILITE_ZOOM 1 - #define SENSIBILITE_SCROLL 1 - #define SENSIBILITE_ZOOM_CPT 1 - #define SENSIBILITE_SCROLL_CPT 4 -#elif defined _OS_MAC_ - #define SENSIBILITE_MOVE 5 - #define SENSIBILITE_MOVE_X (SENSIBILITE_MOVE) - #define SENSIBILITE_MOVE_Y (SENSIBILITE_MOVE) - #define SENSIBILITE_CONTRAST -3 - #define SENSIBILITE_CONTRAST_X (SENSIBILITE_CONTRAST) - #define SENSIBILITE_CONTRAST_Y (SENSIBILITE_CONTRAST) - #define SENSIBILITE_ZOOM 1 - #define SENSIBILITE_SCROLL 1 - #define SENSIBILITE_ZOOM_CPT 1 - #define SENSIBILITE_SCROLL_CPT 4 -#endif - -#define DIR_LEFT -1 -#define DIR_RIGHT 1 -#define DIR_UP 2 -#define DIR_DOWN -2 - -struct cptTools -{ - int scroll; - int zoom; - int dir; //direction (Right = 1; Left = -1; Up = 2; Down = -2) -}; - -#define nullifyHandPoint() \ -{ \ - g_handPt.X = -1; \ - g_handPt.Y = -1; \ - g_handPt.Z = -1; \ -} - -#define CHECK_STATUS(rc, what) \ -if (rc != XN_STATUS_OK) \ -{ \ - cout << what << " failed: " << xnGetStatusString(rc) << endl; \ - return rc; \ -} - -#define CHECK_ERRORS(rc, errors, what) \ -if (rc == XN_STATUS_NO_NODE_PRESENT) \ -{ \ - XnChar strError[1024]; \ - errors.ToString(strError, 1024); \ - cout << strError << endl; \ - return (rc); \ -} - - -//==========================================================================// -//============================== PROTOTYPES ================================// - -void Initialisation(void); -void CleanupExit(); - -void IcrWithLimits(int &val, int icr, int limUp, int limDown); - -inline bool isHandPointNull(); - -void chooseTool(int ¤tTool, int &lastTool, int &totalTools); -//void browse(int currentTool, int lastTool, vector pix); -void browse(int currentTool, int lastTool, ToolDock &tools); - -void CheckHandDown(); -void CheckBaffe(); - -bool SelectionDansUnMenu(short currentIcon); - -bool ConditionActiveTool(); -bool ConditionExitTool(); - -bool ConditionLeftClicPress(); -bool ConditionLeftClicRelease(); - -ToolDock& UploadMainTools(ToolDock &mainTools, bool write); - -void ChangeState(int newState); -void handleState(); - -void glutKeyboard (unsigned char key, int x, int y); -void glutDisplay(); -void initGL(int argc, char *argv[]); - -void XN_CALLBACK_TYPE sessionStart(const XnPoint3D& ptPosition, void* UserCxt); -void XN_CALLBACK_TYPE sessionEnd(void* UserCxt); -void XN_CALLBACK_TYPE pointCreate(const XnVHandPointContext *pContext, const XnPoint3D &ptFocus, void *cxt); -void XN_CALLBACK_TYPE pointUpdate(const XnVHandPointContext *pContext, void *cxt); -void XN_CALLBACK_TYPE pointDestroy(XnUInt32 nID, void *cxt); -void XN_CALLBACK_TYPE NoHands(void* UserCxt); -void XN_CALLBACK_TYPE FocusProgress(const XnChar* strFocus, const XnPoint3D& ptPosition, XnFloat fProgress, void* UserCxt); -void XN_CALLBACK_TYPE Wave_Detected(void *pUserCxt); -void SimulateCtrlBar(void); - -#endif //========================== FIN ====================================// - - - - - - - - - - diff --git a/KiOP/KiOP/inc/pixmap.h b/KiOP/KiOP/inc/pixmap.h deleted file mode 100644 index 8dcbb61..0000000 --- a/KiOP/KiOP/inc/pixmap.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef PIXMAP_H -#define PIXMAP_H - -#include -#include -#include -#include - - -class Pixmap : public QGraphicsWidget -{ - Q_OBJECT -public: - explicit Pixmap(const QPixmap &pix, QGraphicsItem *parent = 0); - void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *); - virtual void mousePressEvent(QGraphicsSceneMouseEvent * ); - virtual void setGeometry(const QRectF &rect); - virtual void load(const QPixmap &pix); - int getWidth(); - -Q_SIGNALS: - void clicked(); - -private: - QPixmap orig; - QPixmap p; - -signals: - -public slots: - -}; - - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/telnetclient.h b/KiOP/KiOP/inc/telnetclient.h deleted file mode 100644 index ba7bcf3..0000000 --- a/KiOP/KiOP/inc/telnetclient.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef TELNETCLIENT_H -#define TELNETCLIENT_H - -#include -#include -//#include "ui_testsocket.h" -#include -#include -#include -#include - -using namespace std; - -QT_BEGIN_NAMESPACE -class QTcpSocket; -QT_END_NAMESPACE - -class TelnetClient : public QMainWindow -{ - Q_OBJECT - -public: - TelnetClient(QWidget *parent = 0, Qt::WFlags flags = 0); - void sendCommand(QString cmd);//char cmd[]); - void connexion(); - void deconnexion(); - -protected: - - -private slots: - void socketConnected(); - void socketDisconnected(); - void displayError(QAbstractSocket::SocketError socketError); - -private: - QTcpSocket *tcpSocket; - QString message; - quint16 bufferSize; -}; - - -#endif //========================== FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/inc/tooldock.h b/KiOP/KiOP/inc/tooldock.h deleted file mode 100644 index 01cd9d9..0000000 --- a/KiOP/KiOP/inc/tooldock.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef TOOLDOCK_H -#define TOOLDOCK_H - -#include "Parametres.h" - -#ifdef _OS_WIN_ - #include -#endif - -#include -#include -#include -#include -#include "qapplication.h" -#include "graphicsview.h" -#include "pixmap.h" - - - -class ToolDock : public QGraphicsWidget -{ - -public: - explicit ToolDock(int nItems, QGraphicsItem *parent = 0); - void addItem(QString name, QString resource); - GraphicsView* getWindow(); - QGraphicsScene* getScene(); - vector getItems(); - int getItemSizeActive(); - int getItemSize(); - - void setItemSize(int size); - void setItemIdlePt(int pos); - void setItemActivePt(int pos); - void setItemActive(int item); - void setItemIdle(int item); - void createView(); - - void setToolsBackgroundTransparent(void); - void setToolsBackgroundRed(void); - -//signals: -// -//public slots: - -private: - -protected: - int itemSize; - int itemSizeActive; - //float itemSizeF; - float itemSizeAlpha; - float itemIdlePt; - float itemActivePt; - int nItems; - int resX; - int resY; - int minItemSize; - int maxItemSize; - vector items; - GraphicsView *window; - QGraphicsScene *scene; -}; - - -#endif // TOOLDOCK_H - - - - - - - diff --git a/KiOP/KiOP/res/contrast.png b/KiOP/KiOP/res/contrast.png deleted file mode 100644 index a44d74d..0000000 Binary files a/KiOP/KiOP/res/contrast.png and /dev/null differ diff --git a/KiOP/KiOP/res/cursor.png b/KiOP/KiOP/res/cursor.png deleted file mode 100644 index 22a4ceb..0000000 Binary files a/KiOP/KiOP/res/cursor.png and /dev/null differ diff --git a/KiOP/KiOP/res/cursors/aero_arrow.cur b/KiOP/KiOP/res/cursors/aero_arrow.cur deleted file mode 100644 index d37f2f1..0000000 Binary files a/KiOP/KiOP/res/cursors/aero_arrow.cur and /dev/null differ diff --git a/KiOP/KiOP/res/cursors/aero_arrow_xl.cur b/KiOP/KiOP/res/cursors/aero_arrow_xl.cur deleted file mode 100644 index 6005b56..0000000 Binary files a/KiOP/KiOP/res/cursors/aero_arrow_xl.cur and /dev/null differ diff --git a/KiOP/KiOP/res/cursors/main_fermee.cur b/KiOP/KiOP/res/cursors/main_fermee.cur deleted file mode 100644 index a7efee8..0000000 Binary files a/KiOP/KiOP/res/cursors/main_fermee.cur and /dev/null differ diff --git a/KiOP/KiOP/res/cursors/main_ouverte.cur b/KiOP/KiOP/res/cursors/main_ouverte.cur deleted file mode 100644 index 8b16705..0000000 Binary files a/KiOP/KiOP/res/cursors/main_ouverte.cur and /dev/null differ diff --git a/KiOP/KiOP/res/cursors/pointeur_jaune.cur b/KiOP/KiOP/res/cursors/pointeur_jaune.cur deleted file mode 100644 index 7f4bd20..0000000 Binary files a/KiOP/KiOP/res/cursors/pointeur_jaune.cur and /dev/null differ diff --git a/KiOP/KiOP/res/cursors/pointeur_rouge.cur b/KiOP/KiOP/res/cursors/pointeur_rouge.cur deleted file mode 100644 index 1b942d9..0000000 Binary files a/KiOP/KiOP/res/cursors/pointeur_rouge.cur and /dev/null differ diff --git a/KiOP/KiOP/res/images.qrc b/KiOP/KiOP/res/images.qrc deleted file mode 100644 index 60e0dac..0000000 --- a/KiOP/KiOP/res/images.qrc +++ /dev/null @@ -1,21 +0,0 @@ - - - contrast.png - move.png - cursor.png - reset.png - scroll.png - stop.png - layout.png - layouts/_1x1.png - layouts/_1x2.png - layouts/_2x1.png - layouts/_2x2.png - layouts/_3a.png - layouts/_3b.png - zoom.png - mouse.png - mouse_fermee.png - pointer.png - - diff --git a/KiOP/KiOP/res/kiop.ico b/KiOP/KiOP/res/kiop.ico deleted file mode 100644 index a9778bb..0000000 Binary files a/KiOP/KiOP/res/kiop.ico and /dev/null differ diff --git a/KiOP/KiOP/res/layout.png b/KiOP/KiOP/res/layout.png deleted file mode 100644 index 03904e8..0000000 Binary files a/KiOP/KiOP/res/layout.png and /dev/null differ diff --git a/KiOP/KiOP/res/layouts/_1x1.png b/KiOP/KiOP/res/layouts/_1x1.png deleted file mode 100644 index e45567a..0000000 Binary files a/KiOP/KiOP/res/layouts/_1x1.png and /dev/null differ diff --git a/KiOP/KiOP/res/layouts/_1x2.png b/KiOP/KiOP/res/layouts/_1x2.png deleted file mode 100644 index 610e67e..0000000 Binary files a/KiOP/KiOP/res/layouts/_1x2.png and /dev/null differ diff --git a/KiOP/KiOP/res/layouts/_2x1.png b/KiOP/KiOP/res/layouts/_2x1.png deleted file mode 100644 index 53dd971..0000000 Binary files a/KiOP/KiOP/res/layouts/_2x1.png and /dev/null differ diff --git a/KiOP/KiOP/res/layouts/_2x2.png b/KiOP/KiOP/res/layouts/_2x2.png deleted file mode 100644 index 03d47a1..0000000 Binary files a/KiOP/KiOP/res/layouts/_2x2.png and /dev/null differ diff --git a/KiOP/KiOP/res/layouts/_3a.png b/KiOP/KiOP/res/layouts/_3a.png deleted file mode 100644 index 9ac921e..0000000 Binary files a/KiOP/KiOP/res/layouts/_3a.png and /dev/null differ diff --git a/KiOP/KiOP/res/layouts/_3b.png b/KiOP/KiOP/res/layouts/_3b.png deleted file mode 100644 index 03904e8..0000000 Binary files a/KiOP/KiOP/res/layouts/_3b.png and /dev/null differ diff --git a/KiOP/KiOP/res/mouse.png b/KiOP/KiOP/res/mouse.png deleted file mode 100644 index 6a33f9d..0000000 Binary files a/KiOP/KiOP/res/mouse.png and /dev/null differ diff --git a/KiOP/KiOP/res/mouse_fermee.png b/KiOP/KiOP/res/mouse_fermee.png deleted file mode 100644 index a7147e4..0000000 Binary files a/KiOP/KiOP/res/mouse_fermee.png and /dev/null differ diff --git a/KiOP/KiOP/res/move.png b/KiOP/KiOP/res/move.png deleted file mode 100644 index af3b932..0000000 Binary files a/KiOP/KiOP/res/move.png and /dev/null differ diff --git a/KiOP/KiOP/res/openni.xml b/KiOP/KiOP/res/openni.xml deleted file mode 100755 index 9687778..0000000 --- a/KiOP/KiOP/res/openni.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/KiOP/KiOP/res/pointer.png b/KiOP/KiOP/res/pointer.png deleted file mode 100644 index 85f3aea..0000000 Binary files a/KiOP/KiOP/res/pointer.png and /dev/null differ diff --git a/KiOP/KiOP/res/reset.png b/KiOP/KiOP/res/reset.png deleted file mode 100644 index 13f74a4..0000000 Binary files a/KiOP/KiOP/res/reset.png and /dev/null differ diff --git a/KiOP/KiOP/res/scroll.png b/KiOP/KiOP/res/scroll.png deleted file mode 100644 index 1b75c75..0000000 Binary files a/KiOP/KiOP/res/scroll.png and /dev/null differ diff --git a/KiOP/KiOP/res/stop.png b/KiOP/KiOP/res/stop.png deleted file mode 100644 index c1e0390..0000000 Binary files a/KiOP/KiOP/res/stop.png and /dev/null differ diff --git a/KiOP/KiOP/res/zoom.png b/KiOP/KiOP/res/zoom.png deleted file mode 100644 index 3f0b19d..0000000 Binary files a/KiOP/KiOP/res/zoom.png and /dev/null differ diff --git a/KiOP/KiOP/src/Control_Cursor_Qt.cpp b/KiOP/KiOP/src/Control_Cursor_Qt.cpp deleted file mode 100644 index 07cde08..0000000 --- a/KiOP/KiOP/src/Control_Cursor_Qt.cpp +++ /dev/null @@ -1,250 +0,0 @@ - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include "Control_Cursor_Qt.h" - - -//==========================================================================// -//=============================== MÉTHODES =================================// - - -// Constructeur -CursorQt::CursorQt(short type) -{ - m_type = type; - m_moveEnable = false; - m_clicEnable = false; - m_inCursorSession = false; - m_leftClicPressed = false; - - m_previousPos = QPoint(SCRSZW/2,SCRSZH/2); - m_virtualPosPrev = QPoint(0,0); - - unsigned int x1 = 70, y1 = 30; - unsigned int x2 = 110, y2 = 80; - - double a = (double)(y2-y1)/(double)(x2-x1); - double b = (double)y2-a*(double)x2; - - double courbe[7] = - { - 0, - 0, - 7.8227E-07, - -0.00022224, - 0.020132, - -0.029578, - 0.92355 - }; - - for (int i = 1; i=0?1:-1); - - if (dys) - dyt = m_courbeDeplacement[abs(dys)] * (dys>=0?1:-1); - - IncrementPos(dxt,dyt); - cout << "dt : " << dxt << ";" << dyt << endl; -} - - - - - - - diff --git a/KiOP/KiOP/src/Gestion_Curseurs.cpp b/KiOP/KiOP/src/Gestion_Curseurs.cpp deleted file mode 100644 index 67286d3..0000000 --- a/KiOP/KiOP/src/Gestion_Curseurs.cpp +++ /dev/null @@ -1,115 +0,0 @@ - -/***************************************************************************** -****************************** FICHIERS INCLUS ******************************/ - -#include "Gestion_Curseurs.h" - - -/***************************************************************************** -**************************** VARIABLES GLOBALES *****************************/ - -// Curseurs -HCURSOR hCurDefault = NULL, - hCurBlue = NULL, - hCurGreen = NULL, - hCurRed = NULL, - hCurYellow = NULL, - hCurWhite = NULL, - hCurStd = NULL, - hCurTest1 = NULL, - hCurTest2 = NULL, - hCurWindows = NULL, - hCurHandOpen = NULL, - hCurHandClose = NULL, - hCurHaloRed = NULL, - hCurHaloBlue = NULL, - hCurYellowPointer = NULL, - hCurRedPointer = NULL; -HCURSOR hc0, hc1, hc2, hc3, hc4, hc5, hc6, hc7, hc8; -HCURSOR hCurAnime[9]; - -int test[2] = {1,2}; - -/***************************************************************************** -******************************** FONCTIONS **********************************/ - -void InitGestionCurseurs(void) -{ - hCurDefault = CopyCursor(GetCursor()); // Ne marche pas ?!? - BOOL btest = 0; - int i; - - LoadCursorFromCURFile(TEXT("res/cursors/aero_arrow.cur"),&hCurDefault,32,32); - LoadCursorFromCURFile(TEXT("res/cursors/aero_arrow.cur"),&hCurWindows,32,32); - LoadCursorFromCURFile(TEXT("res/cursors/aero_arrow_xl.cur"),&hCurWhite,32,32); - LoadCursorFromCURFile(TEXT("res/cursors/main_ouverte.cur"),&hCurHandOpen,64,64); - LoadCursorFromCURFile(TEXT("res/cursors/main_fermee.cur"),&hCurHandClose,64,64); - LoadCursorFromCURFile(TEXT("res/cursors/pointeur_jaune.cur"),&hCurYellowPointer,64,64); - LoadCursorFromCURFile(TEXT("res/cursors/pointeur_rouge.cur"),&hCurRedPointer,64,64); - -} - - -// Charge un curseur à partir d'un fichier .cur -BOOL LoadCursorFromCURFile(LPTSTR szFileName, HCURSOR *phCursor, unsigned int dimX, unsigned int dimY) -{ - *phCursor = NULL; - *phCursor = (HCURSOR)LoadImage( NULL, szFileName, IMAGE_CURSOR, dimX, dimY, LR_LOADFROMFILE | LR_SHARED); - if(*phCursor == NULL) - return FALSE; - return TRUE; -} - - -// Change le type de curseur actuel -void ChangeCursor(unsigned short val) -{ - HCURSOR hCurTemp; - BOOL testInt = 0; - static unsigned short valPrev; - - if (val != valPrev) - { - switch (val) - { - case 0 : - hCurTemp = CopyCursor(hCurWindows); - break; - case 1 : - hCurTemp = CopyCursor(hCurRedPointer); - break; - case 2 : - hCurTemp = CopyCursor(hCurHaloBlue); - break; - case 3 : - hCurTemp = CopyCursor(hCurYellowPointer); - break; - case 4 : - hCurTemp = CopyCursor(hCurHandOpen); - break; - case 5 : - hCurTemp = CopyCursor(hCurHandClose); - break; - - case 6 : - hCurTemp = CopyCursor(hCurWindows); - break; - default : - cout << "\n*** ERREUR : parametre de ChangeCursor(" << val << ") invalide. ***\n\n" << endl; - return; - } - - testInt = SetSystemCursor(hCurTemp, 32512); - valPrev = val; - } -} - - - - - - - - - - diff --git a/KiOP/KiOP/src/Gestion_GLUT.cpp b/KiOP/KiOP/src/Gestion_GLUT.cpp deleted file mode 100644 index 76e69d3..0000000 --- a/KiOP/KiOP/src/Gestion_GLUT.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include "Gestion_GLUT.h" - - -//==========================================================================// -//=============================== FONCTIONS ================================// - -void RepositionnementFenetre(unsigned int val) -{ - unsigned int posWindowX = 0, posWindowY = 0; - int dimWindowW = (INIT_WIDTH_WINDOW), dimWindowH = (INIT_HEIGHT_WINDOW); - unsigned int bordFenetreHaut = 30, bordFenetre = 8; - - switch(val) - { - case 1 : - glutPositionWindow(SCRSZW-dimWindowW-bordFenetre,bordFenetreHaut); - break; - case 2 : - glutPositionWindow(bordFenetre,bordFenetreHaut); - break; - case 3 : - glutPositionWindow(bordFenetre,SCRSZH-dimWindowH-bordFenetre); - break; - case 4 : - glutPositionWindow(SCRSZW-dimWindowW-bordFenetre,SCRSZH-dimWindowH-bordFenetre); - break; - default : - return; - } -} - -void RepositionnementFenetre(unsigned int x, unsigned int y) -{ - glutPositionWindow(x,y); -} - - - diff --git a/KiOP/KiOP/src/Hand_Closed_Detection.cpp b/KiOP/KiOP/src/Hand_Closed_Detection.cpp deleted file mode 100644 index 5edf7f7..0000000 --- a/KiOP/KiOP/src/Hand_Closed_Detection.cpp +++ /dev/null @@ -1,434 +0,0 @@ - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include "Hand_Closed_Detection.h" - - -//==========================================================================// -//================================ MÉTHODES ================================// - -// Constructeur(s) -HandClosedDetection::HandClosedDetection() -{ - m_compteurFrame = 0; - m_handClosed = false; - for (unsigned int i=0;i10) ? 1.0 : float(aireS1)/float(aireSPrec) ); - //cout << "deltaZ : " << deltaZ << "\trapport : " << rapport << endl; - //cout << "rapport : " << rapport << endl; - - // Détection de main fermée - if ((rapport < SEUIL_BAS )) - m_handClosed = true; - else if ((rapport > SEUIL_HAUT)) - m_handClosed = false; -} - -void HandClosedDetection::MethodeSurfaceRect(const xn::DepthMetaData& dpmd) -{ - QPoint haut, bas, gauche, droite; - DefinitionPointsCadrage(m_ROI_Data,haut,bas,gauche,droite); - - int largeurSurface = (droite.x() - gauche.x()); - int hauteurSurface = (bas.y() - haut.y()); - //cout << "Largeur : " << largeurSurface << "\tHauteur : " << hauteurSurface << endl; - - static int surface1 = 0, surface2 = 0, surface3 = 0, surface4 = 0, surfacePrec = 0, surfaceMoy = 0, surfaceMoyPrec = 0; - surfacePrec = surface4; - surface4 = surface3; - surface3 = surface2; - surface2 = surface1; - surface1 = largeurSurface * hauteurSurface; - - if (!(m_compteurFrame%4)) - { - surfaceMoyPrec = surfaceMoy; - surfaceMoy = (surface1+surface2+surface3+surface4)/4; - } - //cout << "SurfMoy : " << surfaceMoy; - - static int profS1 = 0, profS2 = 0, profS3 = 0, profS4 = 0, profSPrec = 0; - profSPrec = profS4; - profS4 = profS3; - profS3 = profS2; - profS2 = profS1; - profS1 = m_handPt.Z(); - int deltaZ = profS1 - profSPrec; - //cout << "DeltaZ : " << deltaZ; - - float rapport = ( (abs(deltaZ)>20) ? 1.0 : float(surfaceMoy)/float(surfaceMoyPrec) ); - static const float seuilBas = 0.5, seuilHaut = 1/seuilBas; - //cout << "Z : " << handPt.Z << "\taire : " << aireS1 << endl; - - // Détection de main fermée - if ((rapport < seuilBas )) - m_handClosed = true; - else if ((rapport > seuilHaut)) - m_handClosed = false; -} - - -// Défini l'intervalle de distances dans lequel il faut regarder -void HandClosedDetection::UpdateDepthLimits(void) -{ - m_depthLimitMin = m_handPt.Z() - INTERVALLE_PROFONDEUR_DETECTION/2; - m_depthLimitMax = m_handPt.Z() + INTERVALLE_PROFONDEUR_DETECTION/2; -} -void HandClosedDetection::UpdateDepthLimits(unsigned int handPtZ) -{ - m_depthLimitMin = handPtZ - INTERVALLE_PROFONDEUR_DETECTION/2; - m_depthLimitMax = handPtZ + INTERVALLE_PROFONDEUR_DETECTION/2; -} - -// Récupère les coordonnées 3D du handPoint -void HandClosedDetection::UpdateHandPt(Point3D handPt) -{ - m_handPt = handPt; -} - -// Défini les coordonnées de handPointInROI -void HandClosedDetection::UpdateHandPtInROI(void) -{ - m_handPtInROI.setX(m_handPt.X() - m_ROI.Pt().x()); - m_handPtInROI.setY(m_handPt.Y() - m_ROI.Pt().y()); -} - -// Défini les dimensions du ROI -void HandClosedDetection::UpdateROI_Size(void) -{ - static const float x1 = 500, x2 = 2500; - static const float y1 = 250, y2 = 50; - - static const int ROI_SizeOffset = 60; - static const float ROI_SizeCoeffA = (x1*x2) * (y1-y2)/(x2-x1); - static const float ROI_SizeCoeffB = y1 - ROI_SizeCoeffA/x1 + ROI_SizeOffset; - int val = (ROI_SizeCoeffA/m_handPt.Z()) + ROI_SizeCoeffB; - - m_ROI.SetSize(val,RAPPORT_DIM_ROI*val); // Un peu moins haut que large - - //cout << "NWidth : " << m_ROI.Size().width() << "\tNHeight : " << m_ROI.Size().height() << endl; -} - -// Défini les coordonnées haut-gauche du ROI -void HandClosedDetection::UpdateROI_Pt(void) -{ - m_ROI.SetPt(m_handPt.X() - m_ROI.Size().width() /2, - m_handPt.Y() - m_ROI.Size().height()/2); - - // Si le ROI est hors de la résolution de la caméra - if ( (m_ROI.Pt().x() <= 0) || (m_ROI.Pt().y() <= 0) - || ((m_ROI.Pt().x()+m_ROI.Size().width()) >= RES_X) || ((m_ROI.Pt().y()+m_ROI.Size().height()) >= RES_Y) ) - m_ROI_OutOfCamera = true; - else - m_ROI_OutOfCamera = false; - - //cout << "N_x : " << m_ROI.Pt().x() << "\tN_y : " << m_ROI.Pt().y() << endl; -} - -////== A EFFACER ==// -//// Extrait les données de l'image de profondeur de la zone ROI -//void HandClosedDetection::ExtractionROI(const xn::DepthMetaData& dpmd) -//{ -// unsigned int i, j; -// unsigned char imBin[MAX_ROI_SIZE][MAX_ROI_SIZE] = {0}; -// unsigned int im2[MAX_ROI_SIZE][MAX_ROI_SIZE] = {0}; -// unsigned int depth = 0; -// -// //for (i=0; i<=m_ROI.Size().height(); i++) -// // for (j=0; j<=m_ROI.Size().width(); j++) -// // { -// // depth = dpmd(j+m_ROI.Pt().x(),i+m_ROI.Pt().y()); -// // imBin[i][j] = 255*(int)((depth > m_depthLimitMin) && (depth < m_depthLimitMax)); -// // } -// -// for (i=0; i<=m_ROI.Size().height(); i++) -// for (j=0; j<=m_ROI.Size().width(); j++) -// { -// depth = dpmd(j+m_ROI.Pt().x(),i+m_ROI.Pt().y()); -// imBin[i][j] = 255*(int)((depth > m_depthLimitMin) && (depth < m_depthLimitMax)); -// //im2[i][j] = depth; -// -// } -// -// //ROI = Mat(MAX_ROI_SIZE,MAX_ROI_SIZE,CV_8UC1,imBin); -// m_ROI_Data = Mat(MAX_ROI_SIZE,MAX_ROI_SIZE,CV_8UC1,imBin); -// //m_ROI_Data2 = Mat(MAX_ROI_SIZE,MAX_ROI_SIZE,CV_8UC1,im2); -// -// //Mat test; -// //UpdateROI_Data(dpmd,test); -// //UpdateROI_Data(dpmd); -// -// //Display_ROI(ROI); -// //namedWindow("1234m_ROI_Data"); -// //imshow("1234dst1", m_ROI_Data); -// //namedWindow("1234test",CV_WINDOW_AUTOSIZE); -// //imshow("1234test", test); -// -// -//} - -// Extrait les données de l'image de profondeur de la zone ROI -void HandClosedDetection::UpdateROI_Data(const xn::DepthMetaData& dpmd) -{ - int i, j; - int cols = dpmd.XRes(); - int rows = dpmd.YRes(); - - // Acquisition de l'image de profondeur - Mat depthMap; - depthMap.create(rows, cols, CV_16UC1); - const XnDepthPixel* pDepthMap = dpmd.Data(); - CV_Assert(sizeof(unsigned short) == sizeof(XnDepthPixel)); - memcpy(depthMap.data, pDepthMap, cols*rows*sizeof(XnDepthPixel)); - - // Définition de la ROI - Mat depthMapROI (depthMap, Rect(m_ROI.Pt().x(), m_ROI.Pt().y(), m_ROI.Size().width(), m_ROI.Size().height())); - - // Binarisation de la ROI (MAJ de m_ROI_Data) - m_ROI_Data = (depthMapROI > m_depthLimitMin) & (depthMapROI < m_depthLimitMax); - - //// Collage de la ROI binaire sur l'image de profondeur - //depthMapROI.setTo(Scalar::all(255*256), m_ROI_Data); - //depthMapROI.setTo(Scalar::all(0), (m_ROI_Data==0)); - - //// Collage du cadre de la ROI sur l'image de profondeur - //for (i=-1; i(j*m_ROI.Size().height()-1,i) = 255*256; - //for (i=0; i<=1; i++) - // for (j=-1; j(j,i*m_ROI.Size().width()-1) = 255*256; - - //// Affichage de l'image de profondeur - //namedWindow("1234depthMap",CV_WINDOW_AUTOSIZE); - //imshow("1234depthMap", depthMap); -} - - -void HandClosedDetection::Display_ROI(Mat& ROI) -{ - //int i, j; - unsigned int color = 127; - - QPoint haut, bas, gauche, droite; - DefinitionPointsCadrage(ROI,haut,bas,gauche,droite); - - // Affichage des 3 points - if (0) - { - unsigned int taille = 8; - for (unsigned int i=0; i(gauche.y()+j,gauche.x()+i) = color; - ROI.at(droite.y()+j,droite.x()+i) = color; - ROI.at(haut.y()+j ,haut.x()+i ) = color; - ROI.at(bas.y()+j ,bas.x()+i ) = color; - } - } - - // Affichage du cadre - if (1) - { - for (int i=gauche.x(); i<=droite.x(); i++) - for (int j=haut.y(); j<=bas.y(); j++) - { - if ( (j==haut.y()) || (j==bas.y()) || (i==gauche.x()) || (i==droite.x()) ) - ROI.at(j,i) = color; - } - } - - namedWindow("123456789"); - imshow("123456789", ROI); - -} - - -QPoint HandClosedDetection::ROI_Pt(void) const -{ - return m_ROI.Pt(); -} - -QSize HandClosedDetection::ROI_Size(void) const -{ - return m_ROI.Size(); -} - - -void HandClosedDetection::DefinitionPointsCadrage(Mat& ROI, QPoint& haut, QPoint& bas, QPoint& gauche, QPoint& droite) -{ - //unsigned int i, j; - droite.setX(m_handPtInROI.x()); droite.setY(m_handPtInROI.y()); - - // Point Haut // - haut.setX(0); haut.setY(0); - for (int j=0; j(j,i) && !haut.y()) - { - haut.setX(i); haut.setY(j); - } - - // Point Bas // - bas.setX(haut.x()); bas.setY(0.6*(m_ROI.Size().height() + haut.y())); - - // Point Gauche // - gauche.setX(0); gauche.setY(0); - for (int i=0; i(j,i) && !gauche.x()) - { - gauche.setX(i); gauche.setY(j); - } - - // Point Droite // - droite.setX(0); droite.setY(0); - for (int i=m_ROI.Size().width(); i>m_handPtInROI.x(); i--) - for (int j=haut.y(); j(j,i) && !droite.x()) - { - droite.setX(i); droite.setY(j); - } - - -} - - - -void HandClosedDetection::IncrementCompteurFrame(void) -{ - m_compteurFrame++; -} - -void HandClosedDetection::ResetCompteurFrame(void) -{ - m_compteurFrame = 0; -} - -int HandClosedDetection::CompteurFrame(void) const -{ - return m_compteurFrame; -} - - -void HandClosedDetection::UpdateHandClosedPrev(void) -{ - unsigned int i; - for (i=(NB_CASE_HAND_CLOSED_PREV-1); i>0; i--) - m_handClosedPrev[i] = m_handClosedPrev[i-1]; - m_handClosedPrev[0] = m_handClosed; - - //cout << endl << "handPrev : "; - //for (i=0; i m_smooth.X() ? m_handPtBrutFiltre.X() - sgn.X()*(m_smooth.X()) : m_handPt.X()); - m_handPt.SetY(abs(m_diffHandPt.Y()) > m_smooth.Y() ? m_handPtBrutFiltre.Y() - sgn.Y()*(m_smooth.Y()) : m_handPt.Y()); - m_handPt.SetZ(abs(m_diffHandPt.Z()) > m_smooth.Z() ? m_handPtBrutFiltre.Z() - sgn.Z()*(m_smooth.Z()) : m_handPt.Z()); - - //m_handPt.Print(); -} - -// ------------------- Smooth -------------------- // - -void HandPoint::SetSmooth(Point3D smooth) -{ - m_smooth.SetCoordinate(smooth); -} -void HandPoint::SetSmooth(unsigned int smoothX, unsigned int smoothY, unsigned int smoothZ) -{ - Point3D temp(smoothX,smoothY,smoothZ,"temp"); - SetSmooth(temp); -} - -void HandPoint::IncrementSmooth(Point3D increment) -{ - m_smooth += increment; - if (m_smooth.X() < MIN_SMOOTH_VALUE) m_smooth.SetX(MIN_SMOOTH_VALUE); - if (m_smooth.X() > MAX_SMOOTH_VALUE) m_smooth.SetX(MAX_SMOOTH_VALUE); - if (m_smooth.Y() < MIN_SMOOTH_VALUE) m_smooth.SetY(MIN_SMOOTH_VALUE); - if (m_smooth.Y() > MAX_SMOOTH_VALUE) m_smooth.SetY(MAX_SMOOTH_VALUE); - if (m_smooth.Z() < MIN_SMOOTH_VALUE) m_smooth.SetZ(MIN_SMOOTH_VALUE); - if (m_smooth.Z() > MAX_SMOOTH_VALUE) m_smooth.SetZ(MAX_SMOOTH_VALUE); -} -void HandPoint::IncrementSmooth(int x, int y, int z) -{ - Point3D temp(x,y,z,"temp"); - IncrementSmooth(temp); -} - -Point3D HandPoint::Smooth(void) const -{ - return m_smooth; -} - - -// ------------------ Steadies ------------------- // - -bool HandPoint::Steady2(void) const -{ - return m_sTD.Steady2(); -} -bool HandPoint::Steady5(void) const -{ - return m_sTD.Steady5(); -} -bool HandPoint::Steady10(void) const -{ - return m_sTD.Steady10(); -} -bool HandPoint::Steady15(void) const -{ - return m_sTD.Steady15(); -} -bool HandPoint::Steady20(void) const -{ - return m_sTD.Steady20(); -} -bool HandPoint::NotSteady(void) const -{ - return m_sTD.NotSteady(); -} - -void HandPoint::SignalResetSteadies(void) -{ - m_sTD.SignalResetSteadies(); -} - -// ------------------ Compteur ------------------- // - -void HandPoint::IncrementCompteurFrame(void) -{ - if (m_compteurFrame++ > 1000000) - m_compteurFrame = 0; -} -unsigned int HandPoint::CompteurFrame(void) const -{ - return m_compteurFrame; -} - - -bool HandPoint::DetectLeft(void) -{ - return (m_lastHandPt.X() > m_handPt.X()); -} - -bool HandPoint::DetectRight(void) -{ - return (m_lastHandPt.X() < m_handPt.X()); -} - -bool HandPoint::DetectUp(void) -{ - return (m_lastHandPt.Y() > m_handPt.Y()); -} - -bool HandPoint::DetectDown(void) -{ - return (m_lastHandPt.Y() < m_handPt.Y()); -} - -bool HandPoint::DetectForward(void) -{ - return (m_lastHandPt.Z() > m_handPt.Z()); -} - -bool HandPoint::DetectBackward(void) -{ - return (m_lastHandPt.Z() < m_handPt.Z()); -} - -bool HandPoint::DetectStatic(void) -{ - return (m_lastHandPt == m_handPt); -} - - -//================================= FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/src/Parametres.cpp b/KiOP/KiOP/src/Parametres.cpp deleted file mode 100644 index b375702..0000000 --- a/KiOP/KiOP/src/Parametres.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include "Parametres.h" - - -#if defined _OS_WIN_ -//==========================================================================// -//=========================== VARIABLES GLOBALES ===========================// - -QDesktopWidget *desktop2 = QApplication::desktop(); -QRect rect = desktop2->screenGeometry(0); - -//#include -//RECT rc; -//bool temp = GetWindowRect(GetDesktopWindow(), &rc); -//unsigned int scrszw = rc.right; -//unsigned int scrszh = rc.bottom; - - -//==========================================================================// -//============================== FONCTIONS =================================// - -unsigned int SCRSZWidth(void) -{ - return rect.width(); -} - -unsigned int SCRSZHeight(void) -{ - return rect.height(); -} - - -//================================= FIN ====================================// -#endif - - -#if defined _OS_MAC_ -unsigned int SCRSZWidth(void) -{ - return glutGet(GLUT_SCREEN_WIDTH); -} - -unsigned int SCRSZHeight(void) -{ - return glutGet(GLUT_SCREEN_HEIGHT); -} -#endif - - - - diff --git a/KiOP/KiOP/src/Point_2D.cpp b/KiOP/KiOP/src/Point_2D.cpp deleted file mode 100644 index 0e1810c..0000000 --- a/KiOP/KiOP/src/Point_2D.cpp +++ /dev/null @@ -1,83 +0,0 @@ - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include "Point_2D.h" - - -//==========================================================================// -//================================ MÉTHODES ================================// - -// -------------- Constructeur(s) ---------------- // -Point2D::Point2D() : Point3D() -{ -} -Point2D::Point2D(short x, short y) : Point3D(x,y,0) -{ -} -Point2D::Point2D(string name) : Point3D(name) -{ -} -Point2D::Point2D(short x, short y, string name) : Point3D(x,y,0,name) -{ -} - - -void Point2D::SetCoordinate(const Point2D &pt) -{ - SetX(pt.X()); - SetY(pt.Y()); - SetZ(0); -} -void Point2D::SetCoordinate(const Point3D &pt) -{ - SetX(pt.X()); - SetY(pt.Y()); - SetZ(0); -} -void Point2D::SetCoordinate(short x, short y) -{ - SetX(x); - SetY(y); - SetZ(0); -} -void Point2D::SetCoordinate(const XnPoint3D xnPt) -{ - SetX(xnPt.X); - SetY(xnPt.Y); - SetZ(0); -} - - -void Point2D::Afficher(ostream &flux) const -{ - flux << "(" << X() << " ; " << Y() << ")"; -} - -void Point2D::Print(void) const -{ - cout << m_name << " : "; - Afficher(cout); - cout << endl; -} -void Point2D::Print(unsigned short nbEndLine) const -{ - Print(); - for (int i=0; i= 0 ? 1 : -1); - temp.SetY(Y() >= 0 ? 1 : -1); - temp.SetZ(Z() >= 0 ? 1 : -1); - return temp; -} - - -// ----------- Opérateurs Arithmétiques ------------ // - -// Operateur addition (+) -Point3D& Point3D::operator+=(const Point3D &pt) -{ - IcrX(pt.X()); - IcrY(pt.Y()); - IcrZ(pt.Z()); - return *this; -} -Point3D operator+(const Point3D &pt1, const Point3D &pt2) -{ - Point3D copie(pt1); - copie += pt2; - return copie; -} - -// Operateur soustraction (-) -Point3D& Point3D::operator-=(const Point3D &pt) -{ - IcrX(-pt.X()); - IcrY(-pt.Y()); - IcrZ(-pt.Z()); - return *this; -} -Point3D operator-(const Point3D &pt1, const Point3D &pt2) -{ - Point3D copie(pt1); - copie -= pt2; - return copie; -} - -// Operateur multiplication (*) -Point3D& Point3D::operator*=(const int nb) -{ - SetX(this->X()*nb); - SetY(this->Y()*nb); - SetZ(this->Z()*nb); - return *this; -} -Point3D operator*(const Point3D &pt, const int nb) -{ - Point3D copie(pt); - copie *= nb; - return copie; -} - -// Operateur division (/) -Point3D& Point3D::operator/=(const int nb) -{ - SetX(this->X()/nb); - SetY(this->Y()/nb); - SetZ(this->Z()/nb); - return *this; -} -Point3D operator/(const Point3D &pt, const int nb) -{ - Point3D copie(pt); - copie /= nb; - return copie; -} - - -// ----------- Opérateurs de Comparaison ------------ // - -// Operateur d'égalité (==) -bool operator==(const Point3D &pt1, const Point3D &pt2) -{ - return (pt1.X() == pt2.X() && pt1.Y() == pt2.Y() && pt1.Z() == pt2.Z()); -} - -// Operateur de différence (!=) -bool operator!=(const Point3D &pt1, const Point3D &pt2) -{ - return !(pt1 == pt2); -} - -// Operateur < -Point3D operator<(const Point3D &pt1, const Point3D &pt2) -{ - Point3D temp(pt1.X() < pt2.X(), pt1.Y() < pt2.Y(), pt1.Z() < pt2.Z()); - return temp; -} - -// Operateur <= -Point3D operator<=(const Point3D &pt1, const Point3D &pt2) -{ - Point3D temp(pt1.X() <= pt2.X(), pt1.Y() <= pt2.Y(), pt1.Z() <= pt2.Z()); - return temp; -} - -// Operateur > -Point3D operator>(const Point3D &pt1, const Point3D &pt2) -{ - Point3D temp(pt1.X() > pt2.X(), pt1.Y() > pt2.Y(), pt1.Z() > pt2.Z()); - return temp; -} - -// Operateur >= -Point3D operator>=(const Point3D &pt1, const Point3D &pt2) -{ - Point3D temp(pt1.X() >= pt2.X(), pt1.Y() >= pt2.Y(), pt1.Z() >= pt2.Z()); - return temp; -} - - -// ----------- Opérateurs de Flux ------------ // -ostream &operator<<(ostream &flux, const Point3D &pt) -{ - pt.Afficher(flux); - return flux; -} - - -// ----------- AAAAAA ------------ // -// Renvoie true si le point pt est situé à l'intérieur de la zone formée par les points ptLim1 et ptLim2. -bool EstDansZone(const Point3D& pt, const Point3D& ptLim1, const Point3D& ptLim2) -{ - Point3D temp(ptLim1.X() <= ptLim2.X(), ptLim1.Y() <= ptLim2.Y(), ptLim1.Z() <= ptLim2.Z(), "temp"); - - if ( pt.X() < (temp.X() ? ptLim1.X() : ptLim2.X()) || pt.X() > (temp.X() ? ptLim2.X() : ptLim1.X()) - || pt.Y() < (temp.Y() ? ptLim1.Y() : ptLim2.Y()) || pt.Y() > (temp.Y() ? ptLim2.Y() : ptLim1.Y()) - || pt.Z() < (temp.Z() ? ptLim1.Z() : ptLim2.Z()) || pt.Z() > (temp.Z() ? ptLim2.Z() : ptLim1.Z()) ) - return false; - - return true; -} - - -// ----------- Fonctions pour listes ------------ // -Point3D MeanListPt3D(const Point3D list[], unsigned short size) -{ - Point3D somme("somme"); - for (int i=0; i0; i--) - list[i].SetCoordinate(list[i-1]); - list[0].SetCoordinate(pt); -} - -void PrintListPt3D(const Point3D list[], unsigned short size) -{ - for (int i=0; i 2000) - seuil*=2; - - Point3D lim1(lastHandPt-seuil/2,"lim1"); - Point3D lim2(lastHandPt+seuil/2,"lim2"); - - //lim1.Print(); - //lim2.Print(); - //handPt.Print(); - //cout << endl; - - // Si le handPoint n'a pas bougé (sur une frame) - if (EstDansZone(handPt,lim1,lim2) && !g_signalResetSteadies) - { - g_notSteady = false; - EnclenchementTimer(m_compteurTimer); - } - else - { - g_notSteady = true; - ResetSteadies(); - IncrementCompteurTimer(); - g_signalResetSteadies = false; - } - SetTocFrame(m_compteurTimer); -} - - -// ------------------ Steadies ------------------- // - -void SteadyClass::ResetSteadies(void) -{ - g_steady2 = false; - g_steady5 = false; - g_steady10 = false; - g_steady15 = false; - g_steady20 = false; -} - -void SteadyClass::SignalResetSteadies() -{ - g_signalResetSteadies = true; - ResetSteadies(); -} - -bool SteadyClass::Steady2(void) const -{ - return g_steady2; -} -bool SteadyClass::Steady5(void) const -{ - return g_steady5; -} -bool SteadyClass::Steady10(void) const -{ - return g_steady10; -} -bool SteadyClass::Steady15(void) const -{ - return g_steady15; -} -bool SteadyClass::Steady20(void) const -{ - return g_steady20; -} -bool SteadyClass::NotSteady(void) const -{ - return g_notSteady; -} - - -// ------------------ Compteur ------------------- // - -void SteadyClass::IncrementCompteurTimer(void) -{ - if (m_compteurTimer++ >= MAX_TOC_FRAME_VALUE) - m_compteurTimer = 0; -} - - -//==========================================================================// -//============================== FONCTIONS =================================// - -void SetTocFrame(unsigned int tocFrame) -{ - g_tocFrame = tocFrame; -} - -void EnclenchementTimer(unsigned int ticFrame) -{ - if (g_steady2Enable) - glutTimerFunc( 200, Steady2,ticFrame); - - if (g_steady5Enable) - glutTimerFunc( 500, Steady5,ticFrame); - - if (g_steady10Enable) - glutTimerFunc(1000,Steady10,ticFrame); - - if (g_steady15Enable) - glutTimerFunc(1500,Steady15,ticFrame); - - if (g_steady20Enable) - glutTimerFunc(2000,Steady20,ticFrame); -} - -void Steady2(int ticFrame) -{ - if (ticFrame == g_tocFrame) - g_steady2 = true; - if (!g_steady2Enable) - g_steady2 = false; -} -void Steady5(int ticFrame) -{ - if (ticFrame == g_tocFrame) - g_steady5 = true; - if (!g_steady5Enable) - g_steady5 = false; -} -void Steady10(int ticFrame) -{ - if (ticFrame == g_tocFrame) - g_steady10 = true; - if (!g_steady10Enable) - g_steady10 = false; -} -void Steady15(int ticFrame) -{ - if (ticFrame == g_tocFrame) - g_steady15 = true; - if (!g_steady15Enable) - g_steady15 = false; -} -void Steady20(int ticFrame) -{ - if (ticFrame == g_tocFrame) - g_steady20 = true; - if (!g_steady20Enable) - g_steady20 = false; -} - - -void SteadyAllEnable(void) -{ - g_steady2Enable = true; - g_steady5Enable = true; - g_steady10Enable = true; - g_steady15Enable = true; - g_steady20Enable = true; - cout << "Steady 2, 5, 10, 15, 20 Enable" << endl; -} -void Steady2Enable(void) -{ - if (!g_steady2Enable) - { - g_steady2Enable = true; - cout << "Steady 2 Enable" << endl; - } -} -void Steady5Enable(void) -{ - if (!g_steady5Enable) - { - g_steady5Enable = true; - cout << "Steady 5 Enable" << endl; - } -} -void Steady10Enable(void) -{ - if (!g_steady10Enable) - { - g_steady10Enable = true; - cout << "Steady 10 Enable" << endl; - } -} -void Steady15Enable(void) -{ - if (!g_steady15Enable) - { - g_steady15Enable = true; - cout << "Steady 15 Enable" << endl; - } -} -void Steady20Enable(void) -{ - if (!g_steady20Enable) - { - g_steady20Enable = true; - cout << "Steady 20 Enable" << endl; - } -} - - -void SteadyAllDisable(void) -{ - g_steady2Enable = false; - g_steady5Enable = false; - g_steady10Enable = false; - g_steady15Enable = false; - g_steady20Enable = false; - cout << "Steady 2, 5, 10, 15, 20 Disable" << endl; -} -void Steady2Disable(void) -{ - if (g_steady2Enable) - { - g_steady2Enable = false; - cout << "Steady 2 Disable" << endl; - } -} -void Steady5Disable(void) -{ - if (g_steady5Enable) - { - g_steady5Enable = false; - cout << "Steady 5 Disable" << endl; - } -} -void Steady10Disable(void) -{ - if (g_steady10Enable) - { - g_steady10Enable = false; - cout << "Steady 10 Disable" << endl; - } -} -void Steady15Disable(void) -{ - if (g_steady15Enable) - { - g_steady15Enable = false; - cout << "Steady 15 Disable" << endl; - } -} -void Steady20Disable(void) -{ - if (g_steady20Enable) - { - g_steady20Enable = false; - cout << "Steady 20 Disable" << endl; - } -} - - -//================================= FIN ====================================// - - - - - - - diff --git a/KiOP/KiOP/src/graphicsview.cpp b/KiOP/KiOP/src/graphicsview.cpp deleted file mode 100644 index 795b983..0000000 --- a/KiOP/KiOP/src/graphicsview.cpp +++ /dev/null @@ -1,114 +0,0 @@ - -#include "graphicsview.h" - - -GraphicsView::GraphicsView(QGraphicsScene *scene, QWidget *parent) : QGraphicsView(scene, parent) -{ - Q_INIT_RESOURCE(images); - - this->setWindowOpacity(1.0); - this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); - this->setAttribute(Qt::WA_TranslucentBackground); - this->setStyleSheet("background: transparent"); - //this->setStyleSheet("background: green"); - //this->setStyleSheet("background-color: rgba(139,137,137,0.5);"); - //this->setStyleSheet("background-image: url(:/images/Resources/background.png)"); - this->setFrameStyle(0); - this->setAlignment(Qt::AlignLeft | Qt::AlignTop); - this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - //QColor bgColor = palette().light().color(); - //bgColor.setAlpha(50); - -} - -void GraphicsView::createUI() -{ - //this->show(); -} - -void GraphicsView::keyPressEvent(QKeyEvent *event) -{ - if (event->key() == Qt::Key_Escape) - { - qApp->quit(); - } -} -void GraphicsView::resizeEvent(QResizeEvent *event) -{ - fitInView(sceneRect(), Qt::KeepAspectRatio); -} - -//void GraphicsView::paintEvent(QPaintEvent *event) -//{ -// QColor backgroundColor = palette().light().color(); -// backgroundColor.setAlpha(50); -// QPainter customPainter(this); -// customPainter.fillRect(rect(),backgroundColor); -//} - - -void GraphicsView::moveBottom(GraphicsView* widget) -{ - //int cx = GetSystemMetrics(SM_CXSCREEN); - //int cy = GetSystemMetrics(SM_CYSCREEN); - int cx = getResX(); - int cy = getResY(); - - - int x, y; - int screenWidth; - int screenHeight; - - //int WIDTH = 768; - //int HEIGHT = 256; - - - QDesktopWidget *desktop = QApplication::desktop(); - - screenWidth = desktop->width(); - screenHeight = desktop->height(); - - x = (cx - WIDTH)/2; - y = (cy - HEIGHT); - /*x = (cx - WIDTH - 8); - y = (cy - HEIGHT + 40)/2;*/ - /*x = ((cx - WIDTH)); - y = ((cy - HEIGHT-40));*/ - - widget->setGeometry(x, y-40, WIDTH, HEIGHT); - widget->setFixedSize(WIDTH, HEIGHT); -} - -int GraphicsView::getResX() -{ - //return GetSystemMetrics(SM_CXSCREEN); - return SCRSZW; -} -int GraphicsView::getResY() -{ - //return GetSystemMetrics(SM_CYSCREEN); - return SCRSZH; -} - -void GraphicsView::setSize(int width, int height) -{ - this->WIDTH = width; - this->HEIGHT = height; - - this->createUI(); - this->moveBottom(this); -} - -QPoint GraphicsView::Size(void) -{ - QPoint temp; - temp.setX(WIDTH); - temp.setY(HEIGHT); - return temp; -} - -void GraphicsView::setPosition(int x, int y) -{ - -} \ No newline at end of file diff --git a/KiOP/KiOP/src/main.cpp b/KiOP/KiOP/src/main.cpp deleted file mode 100644 index bd5d63e..0000000 --- a/KiOP/KiOP/src/main.cpp +++ /dev/null @@ -1,1305 +0,0 @@ - -//==========================================================================// -//============================ FICHIERS INCLUS =============================// - -#include "Parametres.h" -#include "main.h" - -//==========================================================================// -//=========================== VARIABLES GLOBALES ===========================// - -// 0: Inactive; 1: Hand calibrating; 2: Main menu; 3: Normal tool mode; 4: Layout mode; 5: Mouse mode; 9: Return to main menu. -int g_currentState = 0; -int g_lastState = 0; -int g_stateBackup = 0; -int g_moveCounter = 0; - -// 0: Layout; 1: Move; 2: Contrast; 3: Zoom; 4: Scroll; 5: Mouse; 6: RedCross. -int g_currentTool = 3; -int g_lastTool = 3; -int g_toolToChoose = -1; - -// compteur pour sensibilite outils -struct cptTools g_cpt; - -#if defined _OS_WIN_ -int g_totalTools = 8; -#elif defined _OS_MAC_ -int g_totalTools = 6; -#endif -//int g_positionTool[7]; //position des outils dans le menu - -// Layout -int g_totalLayoutTools = 6; //+1 -int g_currentLayoutTool = 0; -int g_lastLayoutTool = 0; -bool g_layoutSelected = false; - -float g_iconIdlePt = 192.0; -//float g_iconActivePt = 64.0; // ? -xn::Context g_context; -xn::DepthGenerator g_dpGen; -xn::DepthMetaData g_dpMD; -xn::HandsGenerator g_myHandsGenerator; -XnStatus g_status; - -bool g_toolSelectable = false; -bool g_methodeMainFermeeSwitch = false; - -// NITE -bool g_activeSession = false; -XnVSessionManager *gp_sessionManager; -XnVPointControl *gp_pointControl; -XnPoint3D g_handPt; -XnPoint3D g_lastPt; -XnVFlowRouter* g_pFlowRouter; -XnFloat g_fSmoothing = 0.0f; - -// Qt -#ifdef _OS_WIN_ - int qargc = 0; - char **qargv = NULL; - QApplication app(qargc,qargv); -#endif -GraphicsView *gp_window; -GraphicsView *gp_windowActiveTool; -QGraphicsScene *gp_sceneActiveTool; -GraphicsView *gp_viewLayouts; -vector g_pix; //for main tools -vector g_pixL; //for layouts -Pixmap* gp_pixActive; //for activeTool -QColor g_toolColorActive = Qt::green; -QColor g_toolColorInactive = Qt::gray; - -#if defined _OS_WIN_ -ToolDock mainTools(g_totalTools+1); -ToolDock layoutTools(g_totalLayoutTools+1); -#endif -int g_pixSize = 0; -int g_pixSizeActive = 0; - -#ifdef _OS_WIN_ - TelnetClient g_telnet; -#endif - -// KiOP // -CursorQt g_cursorQt; -CursorQt g_pointerQt; -//HandClosedDetection g_hCD; -HandPoint g_hP; - -string g_openNi_XML_FilePath; - - -unsigned int g_handDepthAtToolSelection = 0; -const unsigned int g_handDepthThreshold = 40; -const unsigned int g_handDepthMarge = 300; - -bool g_tropPres = false; -bool g_tropLoin = false; -bool g_depthIntervalOK = true; - - -//==========================================================================// -//============================== FONCTIONS =================================// - -// Fonction d'initialisation -void Initialisation(void) -{ - ostringstream oss; - const int nb(4); - Point3D liste[nb]; - for (int i=0; i limUp) val = limUp; - if (val < limDown) val = limDown; -} - - -inline bool isHandPointNull() -{ - return ((g_handPt.X == -1) ? true : false); -} - - -void chooseTool(int ¤tTool, int &lastTool, int &totalTools) -{ - if (g_hP.DetectLeft()) - { - if (g_moveCounter > 0) - g_moveCounter = 0; - g_moveCounter += g_hP.DeltaHandPt().X(); - } - else if (g_hP.DetectRight()) - { - if (g_moveCounter < 0) - g_moveCounter = 0; - g_moveCounter += g_hP.DeltaHandPt().X(); - } - - //vitesse dans le menu en fonction de la distance - int seuil = 20 - (abs(g_hP.Speed().X())+(g_hP.HandPt().Z()/300))/3; - - //cout << "Seuil : " << seuil << endl; - if (g_moveCounter <= -seuil) - { - // Go left in the menu - lastTool = currentTool; - IcrWithLimits(currentTool,-1,0,totalTools); - g_moveCounter = 0; - - g_toolSelectable = true; - //g_pix[g_totalTools]->setOpacity(1.0); - g_pix[CROSS]->setOpacity(1.0); - } - else if (g_moveCounter >= seuil) - { - // Go right in the menu - lastTool = currentTool; - IcrWithLimits(currentTool,1,0,totalTools); - g_moveCounter = 0; - } -} - - - -//void browse(int currentTool, int lastTool, vector pix) -void browse(int currentTool, int lastTool, ToolDock &tools) -{ - //only set the pixmap geometry when needed - if (lastTool != currentTool) - { - // On réduit l'outil précédent - //pix.operator[](lastTool)->setGeometry(QRectF(lastTool*128.0, g_iconIdlePt, 64.0, 64.0)); - tools.setItemIdle(lastTool); - - // On aggrandi l'outil courant - //pix.operator[](currentTool)->setGeometry(QRectF( (currentTool*128.0)-(currentTool==0?0:32), g_iconIdlePt-64, 128.0, 128.0)); - tools.setItemActive(currentTool); - } -} - - -void CheckHandDown() -{ - if (g_currentState >= 2) - { - if (g_hP.Speed().Y() > 24) - { - cout << "-- Main baissee, vitesse : " << g_hP.Speed().Y() << endl; - gp_sessionManager->EndSession(); - } - } -} - -void CheckBaffe() -{ - if (g_currentState >= 2) - { - int vitesseBaffe = abs(g_hP.Speed().X()) + abs(g_hP.HandPt().Z()/300); - if (vitesseBaffe > 34) - { - cout << "-- Baffe detectee, vitesse : " << vitesseBaffe << endl; - gp_sessionManager->EndSession(); - } - } -} - -void CheckDepthIntervals() -{ - - unsigned int dMin = DISTANCE_MIN, dMax = DISTANCE_MAX; - - if (g_handDepthAtToolSelection + g_handDepthMarge > DISTANCE_MAX) - dMax = g_handDepthAtToolSelection + g_handDepthMarge; - - if (g_handDepthAtToolSelection - g_handDepthMarge < DISTANCE_MIN) - dMin = g_handDepthAtToolSelection - g_handDepthMarge; - - g_tropPres = (g_hP.HandPt().Z() < dMin); - g_tropLoin = (g_hP.HandPt().Z() > dMax); - g_depthIntervalOK = !(g_tropPres || g_tropLoin); - - - - - if (!g_depthIntervalOK && g_toolSelectable && g_currentState!=0) - { - cout << endl << "-- Main en dehors de l'intervalle" << " distance : " << g_hP.HandPt().Z() << endl << endl; - g_stateBackup = g_currentState; - ChangeState(NO_ACTION_STATE); - } -} - - - -bool SelectionDansUnMenu(short currentIcon) -{ - bool temp = false; - - if (g_hP.Steady10()) - { - temp = true; - g_hP.SignalResetSteadies(); - } - - return temp; -} - - - -bool ConditionActiveTool() -{ - return (g_hP.HandPt().Z() < g_handDepthAtToolSelection + g_handDepthThreshold); -} - -bool ConditionExitTool() -{ - return (g_hP.Steady15() && g_hP.HandPt().Z() > g_handDepthAtToolSelection + g_handDepthThreshold); -} - - -bool ConditionLeftClicPress() -{ - return (g_hP.Steady15()); -} -bool ConditionLeftClicRelease() -{ - return (g_hP.Steady10()); -} - - -ToolDock& UploadMainTools(ToolDock &mainTools, bool write) -{ - static ToolDock *s_mainTools = new ToolDock(NULL); - - if (write) - s_mainTools = &mainTools; - - return *s_mainTools; -} - - - -void ChangeState(int newState) -{ - if (newState != g_currentState) - { - g_lastState = g_currentState; - g_currentState = newState; - - cout << "- Entree dans l'etat no" << g_currentState << endl; - } -} - - -void handleState() -{ -#ifdef _OS_MAC_ - static TelnetClient g_telnet; - - ToolDock temp(NULL); - ToolDock *mainTools = new ToolDock(NULL); - mainTools = &UploadMainTools(temp,false); - -#endif - - CheckHandDown(); - CheckBaffe(); - CheckDepthIntervals(); - - switch (g_currentState) - { - // Session inactive - case INACTIVE_SESSION_STATE: - - break; // case INACTIVE_SESSION_STATE - - // Aucune action possible - case NO_ACTION_STATE: - - if (g_depthIntervalOK) - { - ChangeState(g_stateBackup); - -#if defined _OS_WIN_ - mainTools.setToolsBackgroundTransparent(); - layoutTools.setToolsBackgroundTransparent(); -#elif defined _OS_MAC_ - mainTools->setToolsBackgroundTransparent(); -#endif - } - else - { - gp_windowActiveTool->setWindowOpacity(0.7); - gp_windowActiveTool->setBackgroundBrush(QBrush(Qt::red, Qt::SolidPattern)); - - -#if defined _OS_WIN_ - mainTools.setToolsBackgroundRed(); - layoutTools.setToolsBackgroundRed(); -#elif defined _OS_MAC_ - mainTools->setToolsBackgroundRed(); -#endif - } - - break; // case NO_ACTION_STATE - - // Coucou effectué, passage par sessionStart, calibrage de la main (200ms) - case CALIBRATE_HAND_STATE: - - if (g_depthIntervalOK) - { - gp_window->setBackgroundBrush(Qt::NoBrush); - } - else - { - gp_window->setBackgroundBrush(QBrush(Qt::red, Qt::SolidPattern)); - } - - if (g_hP.Steady2() && g_depthIntervalOK) - { - ChangeState(TOOLS_MENU_STATE); - - gp_window->setWindowOpacity(qreal(1.0)); - g_pix[CROSS]->setOpacity(0.4); - } - break; // case CALIBRATE_HAND_STATE - - // Après le calibrage de la main, menu des outils - case TOOLS_MENU_STATE: - - chooseTool(g_currentTool, g_lastTool, g_totalTools); - -#if defined _OS_WIN_ - browse(g_currentTool, g_lastTool, mainTools); -#elif defined _OS_MAC_ - browse(g_currentTool, g_lastTool, *mainTools); -#endif - - g_handDepthAtToolSelection = 0; - - if (SelectionDansUnMenu(g_currentTool) && g_toolSelectable) - { - g_telnet.connexion(); - switch(g_currentTool) - { -#ifdef _OS_WIN_ - case RESETALL: - g_telnet.sendCommand(QString("\r\ndcmview2d:reset all\r\n")); - g_telnet.sendCommand(QString("\r\ndcmview2d:mouseLeftAction resetall\r\n")); - break; - case LAYOUT: - g_telnet.sendCommand(QString("\r\ndcmview2d:mouseLeftAction layoutTool\r\n")); - break; -#endif - case MOVE: - g_telnet.sendCommand(QString("\r\ndcmview2d:mouseLeftAction pan\r\n")); - break; - case CONTRAST: - g_telnet.sendCommand(QString("\r\ndcmview2d:mouseLeftAction winLevel\r\n")); - break; - case ZOOM: - g_telnet.sendCommand(QString("\r\ndcmview2d:mouseLeftAction zoom\r\n")); - break; - case SCROLL: - g_telnet.sendCommand(QString("\r\ndcmview2d:mouseLeftAction sequence\r\n")); - break; - case POINTER: - g_telnet.sendCommand(QString("\r\ndcmview2d:mouseLeftAction pointerTool\r\n")); - break; - case MOUSE: - g_telnet.sendCommand(QString("\r\ndcmview2d:mouseLeftAction cursorTool\r\n")); - break; - case CROSS: - g_telnet.sendCommand(QString("\r\ndcmview2d:mouseLeftAction exit\r\n")); - break; - } - - // Si un des outils "normaux" a été selectionné - if ( (g_currentTool == MOVE) || (g_currentTool == CONTRAST) || (g_currentTool == ZOOM) || (g_currentTool == SCROLL) ) - { - ChangeState(NORMAL_TOOLS_STATE); - cout << "--- Selection de l'outil : " << g_currentTool << endl; - - g_handDepthAtToolSelection = g_hP.HandPt().Z(); - cout << "\nhandDepthAtToolSelection : " << g_handDepthAtToolSelection << endl << endl; - - gp_window->hide(); - gp_windowActiveTool->show(); - gp_windowActiveTool->setBackgroundBrush(QBrush(g_toolColorInactive, Qt::SolidPattern)); - gp_pixActive->load(QPixmap(":/images/"+g_pix.operator[](g_currentTool)->objectName()+".png").scaled(g_pixSizeActive,g_pixSizeActive)); - } - - // Si l'outil pointeur a été selectionné - else if (g_currentTool == POINTER) - { - ChangeState(POINTER_STATE); - g_pointerQt.NewCursorSession(g_hP.HandPt()); - - g_handDepthAtToolSelection = g_hP.HandPt().Z(); - - gp_window->hide(); - gp_windowActiveTool->show(); - gp_pixActive->load(QPixmap(":/images/pointer.png").scaled(g_pixSizeActive,g_pixSizeActive)); - } - - // Si l'outil souris a été selectionné - else if (g_currentTool == MOUSE) - { - ChangeState(MOUSE_STATE); - g_cursorQt.NewCursorSession(g_hP.HandPt()); - - g_handDepthAtToolSelection = g_hP.HandPt().Z(); - - gp_window->hide(); - gp_windowActiveTool->show(); - gp_pixActive->load(QPixmap(":/images/mouse.png").scaled(g_pixSizeActive,g_pixSizeActive)); - } - - // Si la croix a été selectionnée - else if (g_currentTool == CROSS) - { - cout << "-- Croix selectionnee" << endl; - gp_sessionManager->EndSession(); - } - -#ifdef _OS_WIN_ - // Si le bouton ResetAll a été selectionné - else if (g_currentTool == RESETALL) - { - ChangeState(BACK_TO_MENU_STATE); - } - - // Si l'outil layout a été selectionné - else if (g_currentTool == LAYOUT) - { - ChangeState(LAYOUT_STATE); - g_currentLayoutTool = 0; - g_lastLayoutTool = 6; - - gp_window->hide(); - gp_windowActiveTool->hide(); - gp_viewLayouts->show(); - - layoutTools.setToolsBackgroundTransparent(); // Ne pas enlever - } -#endif - } - - break; // case TOOLS_MENU_STATE - - // Outil "normal" selectionné - case NORMAL_TOOLS_STATE: - - if (ConditionActiveTool()) - { - gp_windowActiveTool->setBackgroundBrush(QBrush(g_toolColorActive, Qt::SolidPattern)); - gp_windowActiveTool->setWindowOpacity(1.0); - - switch (g_currentTool) - { - case MOVE : - g_telnet.sendCommand(QString("\r\ndcmview2d:move -- %1 %2\r\n") - .arg(-SENSIBILITE_MOVE_X*g_hP.DeltaHandPt().X()).arg(-SENSIBILITE_MOVE_Y*g_hP.DeltaHandPt().Y())); - break; - - case CONTRAST : - g_telnet.sendCommand(QString("\r\ndcmview2d:wl -- %1 %2\r\n") - .arg(-SENSIBILITE_CONTRAST_X*g_hP.DeltaHandPt().X()).arg(-SENSIBILITE_CONTRAST_Y*g_hP.DeltaHandPt().Y())); - break; - - case ZOOM : - if (g_hP.DetectRight()) - g_telnet.sendCommand(QString("\r\ndcmview2d:zoom -i %1\r\n").arg(SENSIBILITE_ZOOM)); - if (g_hP.DetectLeft()) - g_telnet.sendCommand(QString("\r\ndcmview2d:zoom -d %1\r\n").arg(SENSIBILITE_ZOOM)); - break; - - case SCROLL : - int scrollSpeed = abs(g_hP.Speed().X())/2; - int cptSpeed = 0; - if (scrollSpeed < 1){ - scrollSpeed = 1; - } - else if(scrollSpeed > 4){ - cptSpeed = scrollSpeed; - scrollSpeed = 4; - } - - if (g_hP.DetectRight()){ - if (g_cpt.dir != DIR_RIGHT) - g_cpt.scroll = 0; - - g_cpt.scroll = g_cpt.scroll+scrollSpeed; - if (g_cpt.scroll >= SENSIBILITE_SCROLL_CPT){ - if (scrollSpeed<4){ - g_telnet.sendCommand(QString("\r\ndcmview2d:scroll -i %1\r\n").arg(SENSIBILITE_SCROLL)); - } - else if (scrollSpeed >= 4){ - g_telnet.sendCommand(QString("\r\ndcmview2d:scroll -i %1\r\n").arg(SENSIBILITE_SCROLL+(cptSpeed/4))); - } - g_cpt.scroll = 0; - } - g_cpt.dir = DIR_RIGHT; - - } - if (g_hP.DetectLeft()){ - if (g_cpt.dir != DIR_LEFT) - g_cpt.scroll = 0; - - g_cpt.scroll = g_cpt.scroll+scrollSpeed; - if (g_cpt.scroll >= SENSIBILITE_SCROLL_CPT){ - if (scrollSpeed<4){ - g_telnet.sendCommand(QString("\r\ndcmview2d:scroll -d %1\r\n").arg(SENSIBILITE_SCROLL)); - } - else if (scrollSpeed >= 4){ - g_telnet.sendCommand(QString("\r\ndcmview2d:scroll -d %1\r\n").arg(SENSIBILITE_SCROLL+(cptSpeed/4))); - } - g_cpt.scroll = 0; - } - g_cpt.dir = DIR_LEFT; - - } - break; - - } // end switch (g_currentTool) - } - - // Si l'outil est désactivé - else - { - gp_windowActiveTool->setBackgroundBrush(QBrush(g_toolColorInactive, Qt::SolidPattern)); - gp_windowActiveTool->setWindowOpacity(0.7); - } - - if (ConditionExitTool()) - { - ChangeState(BACK_TO_MENU_STATE); // Préparation pour le retour au menu - } - - break; // case NORMAL_TOOLS_STATE - -#ifdef _OS_WIN_ - // Outil layout selectionné - case LAYOUT_STATE: - - chooseTool(g_currentLayoutTool, g_lastLayoutTool, g_totalLayoutTools); - browse(g_currentLayoutTool,g_lastLayoutTool, layoutTools); - - if (SelectionDansUnMenu(g_currentLayoutTool)) - { - switch(g_currentLayoutTool) - { - case 0 : - g_telnet.sendCommand(QString("\r\ndcmview2d:layout -i 1x1\r\n")); - break; - case 1 : - g_telnet.sendCommand(QString("\r\ndcmview2d:layout -i 1x2\r\n")); - break; - case 2 : - g_telnet.sendCommand(QString("\r\ndcmview2d:layout -i 2x1\r\n")); - break; - case 3 : - g_telnet.sendCommand(QString("\r\ndcmview2d:layout -i layout_c1x2\r\n")); - break; - case 4 : - g_telnet.sendCommand(QString("\r\ndcmview2d:layout -i layout_c2x1\r\n")); - break; - case 5 : - g_telnet.sendCommand(QString("\r\ndcmview2d:layout -i 2x2\r\n")); - break; - case 6 : - ChangeState(BACK_TO_MENU_STATE); - break; - } - } - - break; // case LAYOUT_STATE -#endif - - // Outil pointeur selectionné - case POINTER_STATE: - - if (g_pointerQt.InCursorSession()) - { - // Distance limite de la main au capteur - if (g_hP.HandPt().Z() < (g_handDepthAtToolSelection + g_handDepthThreshold)) - { - g_pointerQt.SetMoveEnable(); - gp_windowActiveTool->setBackgroundBrush(QBrush(g_toolColorActive, Qt::SolidPattern)); - gp_windowActiveTool->setWindowOpacity(1.0); - } - else - { - g_pointerQt.SetMoveDisable(); - gp_windowActiveTool->setBackgroundBrush(QBrush(g_toolColorInactive, Qt::SolidPattern)); - gp_windowActiveTool->setWindowOpacity(0.7); - - if (g_hP.Steady20()) - g_pointerQt.EndCursorSession(); - } - - // Appel de la méthode pour déplacer le curseur - g_pointerQt.MoveCursor(g_hP.HandPt()); - } - - // Sortie du mode pointeur - else - { - ChangeState(BACK_TO_MENU_STATE); - } - - break; // case POINTER_STATE - - // Outil souris selectionné - case MOUSE_STATE: - - if (g_cursorQt.InCursorSession()) - { - // Distance limite de la main au capteur - if (g_hP.HandPt().Z() < (g_handDepthAtToolSelection + g_handDepthThreshold)) - { - g_cursorQt.SetMoveEnable(); - g_cursorQt.SetClicEnable(); - gp_windowActiveTool->setBackgroundBrush(QBrush(g_toolColorActive, Qt::SolidPattern)); - gp_windowActiveTool->setWindowOpacity(1.0); - - if (ConditionLeftClicPress()) - { - if (!g_cursorQt.LeftClicPressed()) - { - g_hP.SignalResetSteadies(); - g_cursorQt.PressLeftClic(); - gp_pixActive->load(QPixmap(":/images/mouse_fermee.png").scaled(g_pixSizeActive,g_pixSizeActive)); - } - } - if (ConditionLeftClicRelease()) - { - if (g_cursorQt.LeftClicPressed()) - { - g_hP.SignalResetSteadies(); - g_cursorQt.ReleaseLeftClic(); - gp_pixActive->load(QPixmap(":/images/mouse.png").scaled(g_pixSizeActive,g_pixSizeActive)); - } - } - } - else - { - g_cursorQt.SetMoveDisable(); - g_cursorQt.SetClicDisable(); - gp_windowActiveTool->setBackgroundBrush(QBrush(g_toolColorInactive, Qt::SolidPattern)); - gp_windowActiveTool->setWindowOpacity(0.7); - - if (g_hP.Steady20()) - g_cursorQt.EndCursorSession(); - } - - // Appel de la méthode pour déplacer le curseur - g_cursorQt.MoveCursor(g_hP.HandPt()); - } - - // Sortie du mode souris - else - { - ChangeState(BACK_TO_MENU_STATE); - } - - break; // case MOUSE_STATE - - // Préparation pour le retour au menu - case BACK_TO_MENU_STATE : - - ChangeState(TOOLS_MENU_STATE); - g_telnet.deconnexion(); - - g_hP.SignalResetSteadies(); - - g_lastTool = g_currentTool; - g_currentTool = g_totalTools; - -#if defined _OS_WIN_ - browse(g_currentTool, g_lastTool, mainTools); -#elif defined _OS_MAC_ - browse(g_currentTool, g_lastTool, *mainTools); -#endif - - gp_window->show(); - gp_viewLayouts->hide(); - gp_windowActiveTool->hide(); - - g_toolSelectable = false; - g_pix[CROSS]->setOpacity(0.4); - - break; // case BACK_TO_MENU_STATE - - } // end switch (g_currentState) -} - - -void glutKeyboard (unsigned char key, int x, int y) -{ - static int test = 0; - - switch (key) - { - - case 27 : // Esc - #ifdef _OS_WIN_ - ChangeCursor(0); - #endif - CleanupExit(); - break; - - case 'e' : - // end current session - gp_sessionManager->EndSession(); - break; - - ////////////////////////////////////// - -#if 0 - case 'i' : - g_hP.IncrementSmooth(1,1,1); - //g_hP.Smooth().Print(); - //g_hP.HandPt().Print(); - IcrWithLimits(test,3,0,10); - cout << "-- test : " << test << endl; - break; - - case 'o' : - g_hP.IncrementSmooth(-1,-1,-1); - //g_hP.Smooth().Print(); - IcrWithLimits(test,-3,0,10); - cout << "-- test : " << test << endl; - break; - - case 's' : - // Toggle smoothing - if (g_fSmoothing == 0) - g_fSmoothing = 0.1; - else - g_fSmoothing = 0; - g_myHandsGenerator.SetSmoothing(g_fSmoothing); - break; - - case 'a' : - //show some data for debugging purposes - cout << "x= " << g_hP.HandPt().X() << " ; y= " << g_hP.HandPt().Y() << " ; z= " << g_hP.HandPt().Z() << " ; " << g_fSmoothing << " ; " << g_currentState << endl; - break; - - case 'y' : - //show tools position - for (int i=0; i<=g_totalTools; i++) - { - cout << "tool" << i << " : " << g_positionTool[i] << endl; - } - break; - - case 'q' : - g_pix[0]->setScale(0.9); - mainTools.setItemActive(0); - break; - case 'w' : - g_pix[1]->setScale(0.9); - break; - //case 't' : - // g_methodeMainFermeeSwitch = !g_methodeMainFermeeSwitch; - // cout << "-- Switch Methode main fermee (" << (g_methodeMainFermeeSwitch?2:1) << ")" << endl; - // break; - - case '1' : - RepositionnementFenetre(1); - break; - case '2' : - RepositionnementFenetre(2); - break; - case '3' : - RepositionnementFenetre(3); - break; - case '4' : - RepositionnementFenetre(4); - break; -#endif - - } -} - - - -void glutDisplay() -{ - static unsigned compteurFrame = 0; compteurFrame++; - - glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //clear the gl buffers - g_status = g_context.WaitAnyUpdateAll(); //first update the g_context - refresh the depth/image data coming from the sensor - - // if the update failed, i.e. couldn't be read - if(g_status != XN_STATUS_OK) - { - cout << "\nERROR:Read failed... Quitting!\n" << endl; //print error message - exit(0); //exit the program - } - else - { - if(g_activeSession) - gp_sessionManager->Update(&g_context); - g_dpGen.GetMetaData(g_dpMD); - long xSize = g_dpMD.XRes(); - long ySize = g_dpMD.YRes(); - long totalSize = xSize * ySize; - - const XnDepthPixel* depthMapData; - depthMapData = g_dpMD.Data(); - - int i, j, colorToSet; - int depth; - - glLoadIdentity(); - glOrtho(0, xSize, ySize, 0, -1, 1); - - glBegin(GL_POINTS); - for (i=0;i DP_CLOSE)) - { - if (g_activeSession) - glColor3ub(0,colorToSet,0); - else - glColor3ub(colorToSet,colorToSet,colorToSet); - glVertex2i(i,j); - } - } - } - glEnd(); // End drawing sequence - - if ( g_activeSession && (isHandPointNull() == false)) - { - int size = 5; // Size of the box - glColor3f(255,255,255); // Set the color to white - glBegin(GL_QUADS); - glVertex2i(g_hP.HandPtBrut().X()-size,g_hP.HandPtBrut().Y()-size); - glVertex2i(g_hP.HandPtBrut().X()+size,g_hP.HandPtBrut().Y()-size); - glVertex2i(g_hP.HandPtBrut().X()+size,g_hP.HandPtBrut().Y()+size); - glVertex2i(g_hP.HandPtBrut().X()-size,g_hP.HandPtBrut().Y()+size); - glEnd(); - - size = 4; - glColor3f(0,0,255); - glBegin(GL_QUADS); - glVertex2i(g_hP.HandPtBrutFiltre().X()-size,g_hP.HandPtBrutFiltre().Y()-size); - glVertex2i(g_hP.HandPtBrutFiltre().X()+size,g_hP.HandPtBrutFiltre().Y()-size); - glVertex2i(g_hP.HandPtBrutFiltre().X()+size,g_hP.HandPtBrutFiltre().Y()+size); - glVertex2i(g_hP.HandPtBrutFiltre().X()-size,g_hP.HandPtBrutFiltre().Y()+size); - glEnd(); - - size = 5; - glColor3f(255,0,0); - glBegin(GL_QUADS); - glVertex2i(g_hP.HandPt().X()-size,g_hP.HandPt().Y()-size); - glVertex2i(g_hP.HandPt().X()+size,g_hP.HandPt().Y()-size); - glVertex2i(g_hP.HandPt().X()+size,g_hP.HandPt().Y()+size); - glVertex2i(g_hP.HandPt().X()-size,g_hP.HandPt().Y()+size); - glEnd(); - } - - ////========== HAND POINT ==========// - //if ( g_activeSession && (isHandPointNull() == false) - // && (g_hCD.ROI_Pt().x() >= 0) - // && (g_hCD.ROI_Pt().y() >= 0) - // && (g_hCD.ROI_Pt().x() <= (RES_X - g_hCD.ROI_Size().width())) - // && (g_hCD.ROI_Pt().y() <= (RES_Y - g_hCD.ROI_Size().height())) ) - //{ - // // Cadre de la main - // glColor3f(255,255,255); - // glBegin(GL_LINE_LOOP); - // glVertex2i(g_hCD.ROI_Pt().x(), g_hCD.ROI_Pt().y()); - // glVertex2i(g_hCD.ROI_Pt().x()+g_hCD.ROI_Size().width(), g_hCD.ROI_Pt().y()); - // glVertex2i(g_hCD.ROI_Pt().x()+g_hCD.ROI_Size().width(), g_hCD.ROI_Pt().y()+g_hCD.ROI_Size().height()); - // glVertex2i(g_hCD.ROI_Pt().x(), g_hCD.ROI_Pt().y()+g_hCD.ROI_Size().height()); - // glEnd(); - - //} - } - glutSwapBuffers(); - - // Gestion des états - handleState(); -} - - -void initGL(int argc, char *argv[]) -{ - glutInit(&argc,argv); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - glutInitWindowSize(INIT_WIDTH_WINDOW, INIT_HEIGHT_WINDOW); - -#if defined _OS_WIN_ - string titre = TITLE; - titre += " | "; - titre += __DATE__; - titre += " à "; - titre += __TIME__; - - const char *windowName; - windowName = titre.c_str(); - - // Fenêtre de données source - glutCreateWindow(windowName); -#endif -#if defined _OS_MAC_ - // Fenêtre de données source - glutCreateWindow(TITLE); -#endif - - RepositionnementFenetre(INIT_POS_WINDOW); - glutKeyboardFunc(glutKeyboard); - glutDisplayFunc(glutDisplay); - - // Idle callback (pour toutes les fenêtres) - glutIdleFunc(glutDisplay); - glDisable(GL_DEPTH_TEST); - glEnable(GL_TEXTURE_2D); -} - - -//==========================================================================// -//================================= MAIN ===================================// - -int main(int argc, char *argv[]) -{ - Initialisation(); - - g_openNi_XML_FilePath = argv[0]; -#if defined _OS_WIN_ - int p = g_openNi_XML_FilePath.find(".exe"); - g_openNi_XML_FilePath = g_openNi_XML_FilePath.substr(0,p-4).append("openni.xml"); -#elif defined _OS_MAC_ - int p = g_openNi_XML_FilePath.find(".app"); - g_openNi_XML_FilePath = g_openNi_XML_FilePath.substr(0,p+4).append("/Contents/Resources/openni.xml"); -#endif - - cout << "Chemin de openni.xml : " << g_openNi_XML_FilePath << endl << endl; - - //------ OPEN_NI / NITE / OPENGL ------// - xn::EnumerationErrors errors; - - g_status = g_context.InitFromXmlFile(g_openNi_XML_FilePath.c_str()); - CHECK_ERRORS(g_status, errors, "InitFromXmlFile"); - CHECK_STATUS(g_status, "InitFromXml"); - - //si le g_context a été initialisé correctement - g_status = g_context.FindExistingNode(XN_NODE_TYPE_DEPTH, g_dpGen); - CHECK_STATUS(g_status, "Find depth generator"); - g_status = g_context.FindExistingNode(XN_NODE_TYPE_HANDS, g_myHandsGenerator); - CHECK_STATUS(g_status, "Find hands generator"); - - // NITE - gp_sessionManager = new XnVSessionManager(); - - //Focus avec un coucou et Refocus avec "RaiseHand" - g_status = gp_sessionManager->Initialize(&g_context,"Wave","Wave,RaiseHand"); - CHECK_STATUS(g_status,"Session manager"); - - gp_sessionManager->RegisterSession(&g_context,sessionStart,sessionEnd,FocusProgress); - gp_sessionManager->SetQuickRefocusTimeout(3000); - - g_pFlowRouter = new XnVFlowRouter; - - gp_pointControl = new XnVPointControl("Point Tracker"); - gp_pointControl->RegisterPrimaryPointCreate(&g_context,pointCreate); - gp_pointControl->RegisterPrimaryPointDestroy(&g_context,pointDestroy); - gp_pointControl->RegisterPrimaryPointUpdate(&g_context,pointUpdate); - - // Wave detector - XnVWaveDetector waveDetect; - waveDetect.RegisterWave(&g_context,&Wave_Detected); - //waveDetect.SetFlipCount(10); - //waveDetect.SetMaxDeviation(1); - //waveDetect.SetMinLength(100); - - // Add Listener - gp_sessionManager->AddListener(gp_pointControl); - gp_sessionManager->AddListener(g_pFlowRouter); - gp_sessionManager->AddListener(&waveDetect); - - nullifyHandPoint(); - g_myHandsGenerator.SetSmoothing(g_fSmoothing); - - // Initialization done. Start generating - g_status = g_context.StartGeneratingAll(); - CHECK_STATUS(g_status, "StartGenerating"); - - initGL(argc,argv); - - - // Qt -#ifdef _OS_MAC_ - int qargc = 0; - char **qargv = NULL; - QApplication app(qargc,qargv); - - ToolDock mainTools(g_totalTools+1); - UploadMainTools(mainTools,true); -#endif - - g_pixSize = mainTools.getItemSize(); - g_pixSizeActive = mainTools.getItemSizeActive(); - - g_cursorQt = CursorQt(STEADY_TYPE); - g_pointerQt = CursorQt(POINTER_TYPE); - gp_window = new GraphicsView(NULL); - gp_windowActiveTool = new GraphicsView(NULL); - gp_sceneActiveTool = new QGraphicsScene(0,0,g_pixSizeActive,g_pixSizeActive); - gp_viewLayouts = new GraphicsView(NULL); - gp_pixActive = new Pixmap(QPixmap()); //for activeTool - //mainTools.init(g_totalTools+1); - //layoutTools.init(g_totalLayoutTools+1); - - - - //================== QT ===================// - - // Initialisation des ressources et création de la fenêtre avec les icônes - Q_INIT_RESOURCE(images); - -#ifdef _OS_WIN_ - mainTools.addItem("reset", ":/images/reset.png"); - mainTools.addItem("layout", ":/images/layout.png"); -#endif - mainTools.addItem("move", ":/images/move.png"); - mainTools.addItem("contrast", ":/images/contrast.png"); - mainTools.addItem("zoom", ":/images/zoom.png"); - mainTools.addItem("scroll", ":/images/scroll.png"); - mainTools.addItem("pointer", ":/images/pointer.png"); - mainTools.addItem("mouse", ":/images/mouse.png"); - mainTools.addItem("stop", ":/images/stop.png"); - - mainTools.createView(); - gp_window = mainTools.getWindow(); - g_pix = mainTools.getItems(); - - gp_sceneActiveTool->addItem(gp_pixActive); - //gp_windowActiveTool->setSize(126,126); - gp_windowActiveTool->setScene(gp_sceneActiveTool); - gp_windowActiveTool->setGeometry(gp_window->getResX()-g_pixSizeActive,gp_window->getResY()-g_pixSizeActive-40,g_pixSizeActive,g_pixSizeActive); - - -#ifdef _OS_WIN_ - ////////////// LAYOUT - layoutTools.addItem("1x1", ":/images/layouts/_1x1.png"); - layoutTools.addItem("1x2", ":/images/layouts/_1x2.png"); - layoutTools.addItem("2x1", ":/images/layouts/_2x1.png"); - layoutTools.addItem("3a", ":/images/layouts/_3a.png"); - layoutTools.addItem("3b", ":/images/layouts/_3b.png"); - layoutTools.addItem("2x2", ":/images/layouts/_2x2.png"); - layoutTools.addItem("stop", ":/images/stop.png"); - - layoutTools.createView(); - gp_viewLayouts = layoutTools.getWindow();//////////////////////////////////////////////////////////////////// - g_pixL = layoutTools.getItems(); -#endif - - - // Boucle principale - glutMainLoop(); - - return app.exec(); -} - - - -/**** CALLBACK DEFINITIONS ****/ - -/********************************************************************************** -Session started event handler. Session manager calls this when the session begins -**********************************************************************************/ -void XN_CALLBACK_TYPE sessionStart(const XnPoint3D& ptPosition, void* UserCxt) -{ - ChangeState(CALIBRATE_HAND_STATE); - - g_activeSession = true; - g_toolSelectable = false; - - g_currentTool = g_totalTools; - g_lastTool = 0; - -#ifdef _OS_WIN_ - for (int i=0; ishow(); - gp_window->setWindowOpacity(qreal(0.4)); - gp_viewLayouts->hide(); - gp_windowActiveTool->hide(); - - SteadyAllEnable(); - - //g_hCD.ResetCompteurFrame(); - - static int compteurSession = 1; - cout << endl << "Debut de la session : " << compteurSession++ - << "e" << (compteurSession==1?"re":"") << " fois" << endl << endl; - -#if defined _OS_WIN_ - g_telnet.connexion(); - g_telnet.sendCommand(QString("\r\ndcmview2d:mouseLeftAction sessionStart\r\n")); - g_telnet.deconnexion(); -#endif -} - -/********************************************************************************** -session end event handler. Session manager calls this when session ends -**********************************************************************************/ -void XN_CALLBACK_TYPE sessionEnd(void* UserCxt) -{ -#if defined _OS_WIN_ - g_telnet.connexion(); - g_telnet.sendCommand(QString("\r\ndcmview2d:mouseLeftAction sessionStop\r\n")); - g_telnet.deconnexion(); -#endif - - ChangeState(INACTIVE_SESSION_STATE); - - g_activeSession = false; - g_toolSelectable = false; - - g_currentTool = g_totalTools; - g_lastTool = 0; - -#ifdef _OS_WIN_ - // On réduit tous les outils et layouts - for (int i=0; i<=g_totalTools; i++) - mainTools.setItemIdle(i); - for (int i=0; i<=g_totalLayoutTools; i++) - layoutTools.setItemIdle(i); -#endif - - gp_window->hide(); - gp_viewLayouts->hide(); - gp_windowActiveTool->hide(); - - SteadyAllDisable(); - - XnPoint3D ptTemp; - ptTemp.X = g_hP.HandPt().X(); - ptTemp.Y = g_hP.HandPt().Y(); - ptTemp.Z = g_hP.HandPt().Z(); - g_lastPt = ptTemp; - - cout << endl << "Fin de la session" << endl << endl; -} - - -/********************************************************************************** -point created event handler. this is called when the gp_pointControl detects the creation -of the hand point. This is called only once when the hand point is detected -**********************************************************************************/ -void XN_CALLBACK_TYPE pointCreate(const XnVHandPointContext *pContext, const XnPoint3D &ptFocus, void *cxt) -{ - XnPoint3D coords(pContext->ptPosition); - g_dpGen.ConvertRealWorldToProjective(1,&coords,&g_handPt); - g_lastPt = g_handPt; - - g_hP.Update(g_handPt); -} -/********************************************************************************** -Following the point created method, any update in the hand point coordinates are -reflected through this event handler -**********************************************************************************/ -void XN_CALLBACK_TYPE pointUpdate(const XnVHandPointContext *pContext, void *cxt) -{ - XnPoint3D coords(pContext->ptPosition); - g_dpGen.ConvertRealWorldToProjective(1,&coords,&g_handPt); - - g_hP.Update(g_handPt); -} -/********************************************************************************** -when the point can no longer be tracked, this event handler is invoked. Here we -nullify the hand point variable -**********************************************************************************/ -void XN_CALLBACK_TYPE pointDestroy(XnUInt32 nID, void *cxt) -{ - SteadyAllDisable(); - cout << "\nPoint detruit -------------------------------------------------" - << endl << endl; - - nullifyHandPoint(); - //gp_sessionManager->EndSession(); -} - - -// Callback for no hand detected -void XN_CALLBACK_TYPE NoHands(void* UserCxt) -{ - cout << "No Hands" << endl; - g_cursorQt.EndCursorSession(); - g_pointerQt.EndCursorSession(); -} - -// Callback for when the focus is in progress -void XN_CALLBACK_TYPE FocusProgress(const XnChar* strFocus, - const XnPoint3D& ptPosition, XnFloat fProgress, void* UserCxt) -{ - //cout << "Focus progress: " << strFocus << " @(" << ptPosition.X << "," - // << ptPosition.Y << "," << ptPosition.Z << "): " << fProgress << "\n" << endl; - - /// Pour réafficher l'écran s'il s'est éteint - SimulateCtrlBar(); -} - - -// Callback for wave -void XN_CALLBACK_TYPE Wave_Detected(void *pUserCxt) -{ - cout << "-- Wave detected" << endl; -} - - -void SimulateCtrlBar(void) -{ -#if defined _OS_WIN_ - // Simulate a key press - keybd_event(VK_LCONTROL,0x45,KEYEVENTF_EXTENDEDKEY | 0,0); - // Simulate a key release - keybd_event(VK_LCONTROL,0x45,KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,0); -#endif -} - - diff --git a/KiOP/KiOP/src/pixmap.cpp b/KiOP/KiOP/src/pixmap.cpp deleted file mode 100644 index 9cd4268..0000000 --- a/KiOP/KiOP/src/pixmap.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -#include "pixmap.h" - - -Pixmap::Pixmap(const QPixmap &pix, QGraphicsItem *parent) - : QGraphicsWidget(parent), orig(pix), p(pix) -{ -} - -void Pixmap::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) -{ - painter->drawPixmap(QPointF(), p); -} - -void Pixmap::mousePressEvent(QGraphicsSceneMouseEvent * ) -{ - emit clicked(); -} - -void Pixmap::setGeometry(const QRectF &rect) -{ - QGraphicsWidget::setGeometry(rect); - - if (rect.size().width() > orig.size().width()) - p = orig.scaled(rect.size().toSize()); - else - p = orig; -} - - -void Pixmap::load(const QPixmap &pix){ - p = pix; -} - -int Pixmap::getWidth(){ - return this->p.width(); -} - - diff --git a/KiOP/KiOP/src/telnetclient.cpp b/KiOP/KiOP/src/telnetclient.cpp deleted file mode 100644 index f658b24..0000000 --- a/KiOP/KiOP/src/telnetclient.cpp +++ /dev/null @@ -1,61 +0,0 @@ - -#include "telnetclient.h" - -//#include -//#include -//#include -//#include -//#include - -using namespace std; - -TelnetClient::TelnetClient(QWidget *parent, Qt::WFlags flags) - : QMainWindow(parent, flags) -{ - - tcpSocket = new QTcpSocket(this); - connect(tcpSocket, SIGNAL(connected()), this, SLOT(socketConnected())); - connect(tcpSocket, SIGNAL(disconnected()), this, SLOT(socketDisconnected())); - connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(displayError(QAbstractSocket::SocketError))); - bufferSize = 0; - - tcpSocket->abort(); - //tcpSocket->connectToHost("localhost",17179); -} - -void TelnetClient::connexion(){ - //if (!this->tcpSocket->isValid()){ - tcpSocket->connectToHost("localhost",17179); - cout << "connexion!" << endl; - //this->sendCommand(QString("\r\ndcmview2d:mouseLeftAction sessionStart\r\n")); - //this->sendCommand(QString("\r\ndcmview2d:mouseLeftAction sessionStop\r\n")); - //this->sendCommand(QString("\r\ndcmview2d:mouseLeftAction sessionStart\r\n")); - //} -} - -void TelnetClient::deconnexion(){ - //tcpSocket->write(QString("\r\ndcmview2d:mouseLeftAction sessionStop\r\n").toAscii()); - cout << "deconnexion!" << endl; - //tcpSocket->disconnectFromHost(); -} - -void TelnetClient::sendCommand(QString cmd){//char cmd[]){ - //cout << "command: " << cmd.toStdString() << endl; - QByteArray paquet = cmd.toAscii(); - //QDataStream out(&paquet, QIODevice::WriteOnly); - - //out << cmd; - - tcpSocket->write(paquet); // On envoie le paquet -} - -void TelnetClient::socketConnected(){ - cout << "-- Connected to the server!" << endl; -} - -void TelnetClient::socketDisconnected(){ - cout << "-- Disconnected!! ._. " << endl; -} - -void TelnetClient::displayError(QAbstractSocket::SocketError socketError){ -} \ No newline at end of file diff --git a/KiOP/KiOP/src/tooldock.cpp b/KiOP/KiOP/src/tooldock.cpp deleted file mode 100644 index 9c82424..0000000 --- a/KiOP/KiOP/src/tooldock.cpp +++ /dev/null @@ -1,181 +0,0 @@ - -#include "tooldock.h" - - -ToolDock::ToolDock(int nItems, QGraphicsItem *parent) : QGraphicsWidget(parent) -{ - //this->resX = QApplication::desktop()->width(); - //this->resY = QApplication::desktop()->height(); - - QDesktopWidget screen; - QRect screenGeom = screen.screenGeometry(); - - this->resX = screenGeom.width(); - this->resY = screenGeom.height(); - - this->minItemSize = 64; - this->maxItemSize = 160; - - this->itemSizeAlpha = 1.5; - - this->window = new GraphicsView(NULL); - this->scene = new QGraphicsScene(NULL); - - //calculate the itemSize - this->itemSize = (float)(this->resX)/(float)(nItems)/this->itemSizeAlpha; - if (itemSize > this->maxItemSize){ - itemSize = this->maxItemSize; - } - else if (itemSize < this->minItemSize){ - itemSize = this->minItemSize; - } - - this->itemIdlePt = itemSize*(itemSizeAlpha-1); - this->itemActivePt = 0; - this->itemSizeActive = (int)(itemSize + itemSize/2); - - this->nItems = 0; - - setToolsBackgroundTransparent(); - - //cout << "itemSize: " << itemSize << endl; - //cout << "itemActiveSize: " << itemSizeActive << endl; -} - -void ToolDock::addItem(QString name, QString resource) -{ - Pixmap *p = new Pixmap(QPixmap(QString(resource)).scaled(itemSize,itemSize)); - p->setObjectName(name); - - this->items.push_back(p); - this->scene->addItem(p); - nItems++; -} - -//Creates the GraphicsView -void ToolDock::createView(){ - - //place the items in the window - for (int i=0; inItems; i++){ - this->items[i]->setGeometry(QRectF((this->itemSizeAlpha*i*itemSize)+(itemSize/2), itemIdlePt, itemSize, itemSize)); - } - - //Calculate our GraphicsView size knowing number of items - // and screen resolution - int width = (int)((itemSize*this->itemSizeAlpha*((float)(this->nItems)))+(this->itemSize/2)); - int height = itemSize*itemSizeAlpha; - - cout << "window: " << width << "," << height << endl; - this->scene->setSceneRect(0,0,width,height); - this->window->setSize(width,height); - this->window->setScene(this->scene); -} - -GraphicsView* ToolDock::getWindow() -{ - return this->window; -} - - -QGraphicsScene* ToolDock::getScene() -{ - return this->scene; -} - -vector ToolDock::getItems() -{ - return this->items; -} - -int ToolDock::getItemSize() -{ - return this->itemSize; -} - -int ToolDock::getItemSizeActive() -{ - return this->itemSizeActive; -} - -void ToolDock::setItemSize(int size) -{ - this->itemSize = size; -} - -void ToolDock::setItemIdlePt(int pos) -{ - this->itemIdlePt = pos; -} - -void ToolDock::setItemActivePt(int pos) -{ - this->itemActivePt = pos; -} - - -void ToolDock::setItemActive(int item){ - //this->items[item]->hide(); - //this->items[item]->setGeometry(QRectF((itemSizeAlpha*item*itemSize)+(itemSize/4), itemActivePt, itemSizeActive+5, itemSizeActive+5)); - //this->items[item]->setScale(itemSizeActive/(float)this->items[item]->getWidth()); - //QString itemName = this->items[item]->objectName(); - //this->items[item] = new Pixmap(QPixmap(":/images/"+itemName+".png").scaled(itemSizeActive, itemSizeActive)); - //this->items.at(item) = new Pixmap(QPixmap(":/images/"+itemName+".png").scaled(itemSizeActive, itemSizeActive)); - //this->items[item]->setGeometry(QRectF((itemSizeAlpha*item*itemSize)+(itemSize/4), itemActivePt, itemSizeActive, itemSizeActive)); - //this->items[item]->load(QPixmap(":/images/"+itemName+".png").scaled(itemSizeActive, itemSizeActive)); - this->items[item]->setGeometry(QRectF((itemSizeAlpha*item*itemSize)+(itemSize/4), itemActivePt, itemSizeActive, itemSizeActive)); - //this->items[item]->setScale(itemSizeActive/(float)this->items[item]->getWidth()); - /*cout << "aleft: " << itemSizeAlpha*item*itemSize << "; atop:" << itemActivePt << endl; - cout << "setScale: " << itemSizeActive/(float)this->items[item]->getWidth() << endl;*/ - //this->items[item]->show(); -} - -void ToolDock::setItemIdle(int item){ - //this->items[item]->setScale(itemSize/this->items[item]->getWidth()); - //this->items[item]->setScale(0.3); - //this->items[item]->setGeometry(QRectF((itemSizeAlpha*item*itemSize)+(itemSize/2), itemIdlePt, itemSize, itemSize)); - //this->items[item]->setGeometry(QRectF((itemSizeAlpha*item*itemSize)+(itemSize/2), this->window->size().height() - itemIdlePt, itemSize, itemSize)); - this->items[item]->setGeometry(QRectF((itemSizeAlpha*item*itemSize)+(itemSize/2), itemIdlePt, itemSize, itemSize)); - //this->items[item]->setScale(itemSize/(float)this->items[item]->getWidth()); - //this->items[item]->setScale(itemSize/this->items[item]->getWidth()); - -} - - -void ToolDock::setToolsBackgroundTransparent(void) -{ - window->setBackgroundBrush(Qt::NoBrush); - //window->setBackgroundBrush(QBrush(Qt::blue, Qt::SolidPattern)); - window->setWindowOpacity(qreal(1.0)); -} -void ToolDock::setToolsBackgroundRed(void) -{ - window->setBackgroundBrush(QBrush(Qt::red, Qt::SolidPattern)); - window->setWindowOpacity(qreal(0.7)); -} - - - - - -//ToolDock& ToolDock::operator=(const ToolDock &pt) -//{ -// -// return *this; -//} - - - - - - - - - - - - - - - - - diff --git a/KiOP/Plugin/English.lproj/InfoPlist.strings b/KiOP/Plugin/English.lproj/InfoPlist.strings deleted file mode 100644 index fa1ad42..0000000 Binary files a/KiOP/Plugin/English.lproj/InfoPlist.strings and /dev/null differ diff --git a/KiOP/Plugin/English.lproj/locversion.plist b/KiOP/Plugin/English.lproj/locversion.plist deleted file mode 100644 index c56e3cf..0000000 --- a/KiOP/Plugin/English.lproj/locversion.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - LprojCompatibleVersion - 220.2 - LprojLocale - en - LprojRevisionLevel - 1 - LprojVersion - 307 - - diff --git a/KiOP/Plugin/Info.plist b/KiOP/Plugin/Info.plist deleted file mode 100644 index 5af733a..0000000 --- a/KiOP/Plugin/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - KiOP - CFBundleIconFile - - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleSignature - ???? - CFBundleVersion - 1.0 - NSPrincipalClass - KiOPFilter - MenuTitles - - KiOP - - pluginType - imageFilter - - diff --git a/KiOP/Plugin/KiOP.xcodeproj/project.pbxproj b/KiOP/Plugin/KiOP.xcodeproj/project.pbxproj deleted file mode 100644 index e219a9e..0000000 --- a/KiOP/Plugin/KiOP.xcodeproj/project.pbxproj +++ /dev/null @@ -1,396 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 8420023212E829A200E1E9CE /* OsiriXAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8420023112E829A200E1E9CE /* OsiriXAPI.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; - 85D3209515FE274D00788A33 /* KiOP.app in Resources */ = {isa = PBXBuildFile; fileRef = 85D3209415FE274D00788A33 /* KiOP.app */; }; - 85D3209615FE275000788A33 /* KiOP.app in Copy Executables */ = {isa = PBXBuildFile; fileRef = 85D3209415FE274D00788A33 /* KiOP.app */; }; - 8D5B49AE048680CD000E48DA /* KiOP_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 32DBCF630370AF2F00C91783 /* KiOP_Prefix.pch */; }; - 8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; - 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; - ABA48A650680BB600089EB4F /* KiOPFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = ABA48A640680BB600089EB4F /* KiOPFilter.h */; }; - ABA48A670680BB690089EB4F /* KiOPFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABA48A660680BB690089EB4F /* KiOPFilter.mm */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 85D3209015FE271600788A33 /* Copy Executables */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 6; - files = ( - 85D3209615FE275000788A33 /* KiOP.app in Copy Executables */, - ); - name = "Copy Executables"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; - 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 32DBCF630370AF2F00C91783 /* KiOP_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KiOP_Prefix.pch; sourceTree = ""; }; - 8420023112E829A200E1E9CE /* OsiriXAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OsiriXAPI.framework; path = "../../osirix-trunk/build/Development/OsiriXAPI.framework"; sourceTree = ""; }; - 85D3209415FE274D00788A33 /* KiOP.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; name = KiOP.app; path = ../KiOP/build/KiOP/Build/Products/Release/KiOP.app; sourceTree = ""; }; - 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AB5D36050680E57E00F4007A /* KiOP.osirixplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KiOP.osirixplugin; sourceTree = BUILT_PRODUCTS_DIR; }; - ABA48A640680BB600089EB4F /* KiOPFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KiOPFilter.h; sourceTree = ""; }; - ABA48A660680BB690089EB4F /* KiOPFilter.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = KiOPFilter.mm; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D5B49B3048680CD000E48DA /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */, - 8420023212E829A200E1E9CE /* OsiriXAPI.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 089C166AFE841209C02AAC07 /* KiOP */ = { - isa = PBXGroup; - children = ( - 08FB77AFFE84173DC02AAC07 /* Classes */, - 32C88E010371C26100C91783 /* Other Sources */, - 089C167CFE841241C02AAC07 /* Resources */, - 089C1671FE841209C02AAC07 /* Frameworks and Libraries */, - 19C28FB8FE9D52D311CA2CBB /* Products */, - ); - name = KiOP; - sourceTree = ""; - }; - 089C1671FE841209C02AAC07 /* Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 8420023112E829A200E1E9CE /* OsiriXAPI.framework */, - 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */, - 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */, - ); - name = "Frameworks and Libraries"; - sourceTree = ""; - }; - 089C167CFE841241C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - 85D3209415FE274D00788A33 /* KiOP.app */, - 8D5B49B7048680CD000E48DA /* Info.plist */, - 089C167DFE841241C02AAC07 /* InfoPlist.strings */, - ); - name = Resources; - sourceTree = ""; - }; - 08FB77AFFE84173DC02AAC07 /* Classes */ = { - isa = PBXGroup; - children = ( - AB2C26750677B0C400A08910 /* KiOPFilter */, - ); - name = Classes; - sourceTree = ""; - }; - 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 089C1672FE841209C02AAC07 /* Foundation.framework */, - 089C167FFE841241C02AAC07 /* AppKit.framework */, - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 19C28FB8FE9D52D311CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - AB5D36050680E57E00F4007A /* KiOP.osirixplugin */, - ); - name = Products; - sourceTree = ""; - }; - 32C88E010371C26100C91783 /* Other Sources */ = { - isa = PBXGroup; - children = ( - 32DBCF630370AF2F00C91783 /* KiOP_Prefix.pch */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - AB2C26750677B0C400A08910 /* KiOPFilter */ = { - isa = PBXGroup; - children = ( - ABA48A640680BB600089EB4F /* KiOPFilter.h */, - ABA48A660680BB690089EB4F /* KiOPFilter.mm */, - ); - name = KiOPFilter; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 8D5B49AD048680CD000E48DA /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D5B49AE048680CD000E48DA /* KiOP_Prefix.pch in Headers */, - ABA48A650680BB600089EB4F /* KiOPFilter.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 8D5B49AC048680CD000E48DA /* KiOP */ = { - isa = PBXNativeTarget; - buildConfigurationList = CE6A9A9008AC841300D0C1EE /* Build configuration list for PBXNativeTarget "KiOP" */; - buildPhases = ( - 8D5B49AD048680CD000E48DA /* Headers */, - 8D5B49AF048680CD000E48DA /* Resources */, - 85D3209015FE271600788A33 /* Copy Executables */, - 8D5B49B1048680CD000E48DA /* Sources */, - 8D5B49B3048680CD000E48DA /* Frameworks */, - 8D5B49B5048680CD000E48DA /* Rez */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = KiOP; - productInstallPath = "$(HOME)/Library/Bundles"; - productName = Invert; - productReference = AB5D36050680E57E00F4007A /* KiOP.osirixplugin */; - productType = "com.apple.product-type.bundle"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 089C1669FE841209C02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0430; - }; - buildConfigurationList = CE6A9A9408AC841300D0C1EE /* Build configuration list for PBXProject "KiOP" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 089C166AFE841209C02AAC07 /* KiOP */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8D5B49AC048680CD000E48DA /* KiOP */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8D5B49AF048680CD000E48DA /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */, - 85D3209515FE274D00788A33 /* KiOP.app in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - 8D5B49B5048680CD000E48DA /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXRezBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D5B49B1048680CD000E48DA /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ABA48A670680BB690089EB4F /* KiOPFilter.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C167EFE841241C02AAC07 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - CE6A9A9108AC841300D0C1EE /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - DEBUGGING_SYMBOLS = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - "../../osirix-trunk/build/Development", - ); - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_TRIGRAPHS = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = KiOP_Prefix.pch; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = NO; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "@executable_path/../Plug-ins"; - LIBRARY_SEARCH_PATHS = ""; - LIBRARY_STYLE = Bundle; - MACOSX_DEPLOYMENT_TARGET = 10.5; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-undefined", - dynamic_lookup, - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = KiOP; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = osirixplugin; - ZERO_LINK = NO; - }; - name = Development; - }; - CE6A9A9208AC841300D0C1EE /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - "../../osirix-trunk/build/Development", - ); - GCC_ENABLE_TRIGRAPHS = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = KiOP_Prefix.pch; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = NO; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "@executable_path/../Plug-ins"; - LIBRARY_SEARCH_PATHS = ""; - LIBRARY_STYLE = Bundle; - MACOSX_DEPLOYMENT_TARGET = 10.5; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-undefined", - dynamic_lookup, - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = KiOP; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = osirixplugin; - ZERO_LINK = NO; - }; - name = Deployment; - }; - CE6A9A9508AC841300D0C1EE /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - FRAMEWORK_SEARCH_PATHS = ( - "\"$(SRCROOT)\"", - "$(inherited)", - ); - INSTALL_PATH = "@executable_path/../Plug-ins"; - MACH_O_TYPE = mh_bundle; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PRODUCT_NAME = KiOP; - SDKROOT = macosx10.7; - STRIP_STYLE = "non-global"; - WRAPPER_EXTENSION = osirixplugin; - }; - name = Development; - }; - CE6A9A9608AC841300D0C1EE /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - DEBUG_INFORMATION_FORMAT = dwarf; - FRAMEWORK_SEARCH_PATHS = ( - "\"$(SRCROOT)\"", - "$(inherited)", - ); - INSTALL_PATH = "@executable_path/../Plug-ins"; - MACH_O_TYPE = mh_bundle; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PRODUCT_NAME = KiOP; - SDKROOT = macosx10.7; - STRIP_STYLE = "non-global"; - WRAPPER_EXTENSION = osirixplugin; - }; - name = Deployment; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - CE6A9A9008AC841300D0C1EE /* Build configuration list for PBXNativeTarget "KiOP" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - CE6A9A9108AC841300D0C1EE /* Development */, - CE6A9A9208AC841300D0C1EE /* Deployment */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Development; - }; - CE6A9A9408AC841300D0C1EE /* Build configuration list for PBXProject "KiOP" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - CE6A9A9508AC841300D0C1EE /* Development */, - CE6A9A9608AC841300D0C1EE /* Deployment */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Development; - }; -/* End XCConfigurationList section */ - }; - rootObject = 089C1669FE841209C02AAC07 /* Project object */; -} diff --git a/KiOP/Plugin/KiOP.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/KiOP/Plugin/KiOP.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index b82adbd..0000000 --- a/KiOP/Plugin/KiOP.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/KiOP/Plugin/KiOPFilter.h b/KiOP/Plugin/KiOPFilter.h deleted file mode 100644 index 62ec143..0000000 --- a/KiOP/Plugin/KiOPFilter.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// KiOPFilter.h -// KiOP -// -// Copyright (c) 2012 KiOP. All rights reserved. -// - -#import -#import - -@interface KiOPFilter : PluginFilter { - NSPoint origin; -} - -- (long) filterImage:(NSString*) menuName; - -@end diff --git a/KiOP/Plugin/KiOPFilter.mm b/KiOP/Plugin/KiOPFilter.mm deleted file mode 100644 index a842008..0000000 --- a/KiOP/Plugin/KiOPFilter.mm +++ /dev/null @@ -1,290 +0,0 @@ -// -// KiOPFilter.m -// KiOP -// -// Copyright (c) 2012 KiOP. All rights reserved. -// - -#import "KiOPFilter.h" -#import -#import -#import -#import -#import - - - -//@implementation KiOPFilter -// -//- (void) initPlugin -//{ -//} -// -//- (long) filterImage:(NSString*) menuName -//{ -// ViewerController *new2DViewer; -// -// // In this plugin, we will simply duplicate the current 2D window! -// -// new2DViewer = [self duplicateCurrent2DViewerWindow]; -// -// if( new2DViewer) return 0; // No Errors -// else return -1; -//} -// -//@end - - -@interface MyConn : N2Connection{ - - NSPoint origin; -} - -@end - -@implementation MyConn - - --(id)initWithAddress:(NSString *)address port:(NSInteger)port is:(NSInputStream *)is os:(NSOutputStream *)os { - if ((self = [super initWithAddress:address port:port is:is os:os])) { - NSLog(@"Client connected"); - } - - return self; -} - --(void)handleCommand:(NSString*)cmd{ - ViewerController* v = [ViewerController frontMostDisplayed2DViewer]; - - // [v setScaleValue:[v scaleValue]*1.2]; // Zoom - // [v setImageIndex:[v imageIndex]+1]; // scroll - - - // - (void)setWL:(float)wl WW:(float)ww; //window/level - // - (void)setOrigin:(NSPoint) o; //move - // - (void) setImageIndex:(long) i - NSLog(@"%@ \n",cmd); - - if ([cmd hasPrefix:@"zoom"]){ - int value = 0; - NSRange r = [cmd rangeOfString:@"-i"]; - if (r.location != NSNotFound){ - value = [[cmd substringWithRange:NSMakeRange(r.location+3, [cmd length] - r.location-3)] intValue]; - NSLog(@"i: %d",value); - [v setScaleValue:[v scaleValue]*(1+((float)value/50.0))]; -// NSLog(@"%f",(1-(((float)value/10)))); - } - else{ - NSRange r2 = [cmd rangeOfString:@"-d"]; - if (r2.location != NSNotFound){ - value = [[cmd substringWithRange:NSMakeRange(r2.location+3, [cmd length] - r2.location-3)] intValue]; - NSLog(@"d: %d",value); - [v setScaleValue:[v scaleValue]*(1-((float)value/50.0))]; -// NSLog(@"%f",(1-((float)value/10))); - } - } - - } - - if ([cmd hasPrefix:@"wl"]){ - - NSRange r = [cmd rangeOfString:@"--"]; - - if (r.location != NSNotFound){ - - NSString *values = [cmd substringWithRange:NSMakeRange(r.location+3, [cmd length] - r.location-3)]; - NSLog(@"values: [%@]",values); // values = X_Y - NSArray *tokens = [values componentsSeparatedByString: @" "]; //seperate X , Y - - float valueX = [(NSString*)[tokens objectAtIndex:0] floatValue]; - float valueY = [(NSString*)[tokens objectAtIndex:1] floatValue]; - - NSLog(@"valueX: [%f]",valueX); - NSLog(@"valueY: [%f]",valueY); - - [v setWL:([v curWL]+valueX) WW:([v curWW]+valueY)]; - //NSLog(@"i: %d",value); - // NSLog(@"%f",(1-(((float)value/10)))); - } - else{ - NSLog(@"No values for \"wl\""); - } - - } - - if ([cmd hasPrefix:@"move"]){ - - NSRange r = [cmd rangeOfString:@"--"]; - - if (r.location != NSNotFound){ - - NSString *values = [cmd substringWithRange:NSMakeRange(r.location+3, [cmd length] - r.location-3)]; - NSLog(@"values: [%@]",values); // values = X_Y - NSArray *tokens = [values componentsSeparatedByString: @" "]; //seperate X , Y - - float valueX = [(NSString*)[tokens objectAtIndex:0] floatValue]; - float valueY = [(NSString*)[tokens objectAtIndex:1] floatValue]; - - NSLog(@"valueX: [%f]",valueX); - NSLog(@"valueY: [%f]",valueY); - - origin.x = origin.x - valueX; - origin.y = origin.y + valueY; - // NSPoint pt; - // pt.x = valueX; - // pt.y = valueY; - [v setOrigin:origin]; - } - else{ - NSLog(@"No values for \"move\""); - } - - } - - - // [v setImageIndex:[v imageIndex]+1]; //scroll - if ([cmd hasPrefix:@"scroll"]){ - int value = 0; - NSRange r = [cmd rangeOfString:@"-i"]; - if (r.location != NSNotFound){ - value = [[cmd substringWithRange:NSMakeRange(r.location+3, [cmd length] - r.location-3)] intValue]; - NSLog(@"i: %d",value); - [v setImageIndex:[v imageIndex]+value]; - } - else{ - NSRange r2 = [cmd rangeOfString:@"-d"]; - if (r2.location != NSNotFound){ - value = [[cmd substringWithRange:NSMakeRange(r2.location+3, [cmd length] - r2.location-3)] intValue]; - NSLog(@"d: %d",value); - [v setImageIndex:[v imageIndex]-value]; - } - - } - - } - -} - --(void)handleLine:(NSString*)line { - - NSLog(@"line: %@", line); - - NSRange r = [line rangeOfCharacterFromSet:[NSCharacterSet punctuationCharacterSet]]; - //if (r.location == NSNotFound) - // break; - - NSString* cmd = [line substringToIndex:r.location]; - NSArray *tokens = [line componentsSeparatedByString: @":"]; - NSLog(@"%d",(int)[tokens count]); - for (int i = 0; i<[tokens count]; i++) { - - [self handleCommand:[tokens objectAtIndex:i]]; - } - - if (cmd.length){ - @try { - NSLog(@"viewer: %@", cmd); - } @catch (NSException* e) { - NSLog(@"%@", e); - } - } - - -} - --(void)handleData:(NSMutableData*)data { - while (data.length) { - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - @try { - NSString* str = [[[NSString alloc] initWithBytesNoCopy:(void*)data.bytes length:data.length encoding:NSUTF8StringEncoding freeWhenDone:NO] autorelease]; - - NSRange r = [str rangeOfCharacterFromSet:[NSCharacterSet newlineCharacterSet]]; - if (r.location == NSNotFound) - break; - - NSString* line = [str substringToIndex:r.location]; - [data replaceBytesInRange:NSMakeRange(0, r.location+r.length) withBytes:nil length:0]; - - if (line.length) - @try { - [self handleLine:line]; - } @catch (NSException* e) { - NSLog(@"%@", e); - } - } @catch (NSException* e) { - NSLog(@"%@", e); - break; - } @finally { - [pool release]; - } - } -} - - - -@end - - - -@implementation KiOPFilter - -- (void) initPlugin -{ - origin.x = 0.0; - origin.y = 0.0; - N2ConnectionListener* cl = [[N2ConnectionListener alloc] initWithPort:17179 connectionClass:[MyConn class]]; - - [N2Shell execute:@"/usr/bin/open" arguments:[NSArray arrayWithObjects: @"-a", [[NSBundle bundleForClass:[self class]] pathForAuxiliaryExecutable:@"KiOP.app"], nil]]; - - - /*ViewerController *new2DViewer; - - // In this plugin, we will simply duplicate the current 2D window! - - new2DViewer = [self duplicateCurrent2DViewerWindow]; - - NSAlert *myAlert = [NSAlert alertWithMessageText:@"KinectOP" - defaultButton:@"launched" - alternateButton:nil - otherButton:nil - informativeTextWithFormat:@"Plugin launched"]; - [myAlert runModal];*/ -} - - - -- (long) filterImage:(NSString*) menuName -{ - //ViewerController *new2DViewer; - - // In this plugin, we will simply duplicate the current 2D window! - - //new2DViewer = [self duplicateCurrent2DViewerWindow]; - - /*NSAlert *myAlert = [NSAlert alertWithMessageText:@"KinectOP" - defaultButton:@"launched" - alternateButton:nil - otherButton:nil - informativeTextWithFormat:@"Plugin launched"]; - [myAlert runModal];*/ - //if( new2DViewer) return 0; // No Errors - //else return -1; - - - - - // pour lancer un binaire externe: - // NSTask // N2Task - - - - // - // MyConn* conn = [[MyConn alloc] initWithAddress:@"localhost" port:17179]; - // [conn reconnect]; - - - - return 0; -} - -@end diff --git a/KiOP/Plugin/KiOP_Prefix.pch b/KiOP/Plugin/KiOP_Prefix.pch deleted file mode 100644 index 809ccd3..0000000 --- a/KiOP/Plugin/KiOP_Prefix.pch +++ /dev/null @@ -1,8 +0,0 @@ -// -// Prefix header for all source files of the 'KiOP' target in the 'KiOP' project. -// - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/KiOP/Plugin/version.plist b/KiOP/Plugin/version.plist deleted file mode 100644 index 2d80049..0000000 --- a/KiOP/Plugin/version.plist +++ /dev/null @@ -1,16 +0,0 @@ - - - - - BuildVersion - 1 - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1.0 - ProjectName - DevToolsWizardTemplates - SourceVersion - 3070000 - - diff --git a/Reporter/Reporter.xcodeproj/project.pbxproj b/Reporter/Reporter.xcodeproj/project.pbxproj index 2b552d9..00a8f2f 100644 --- a/Reporter/Reporter.xcodeproj/project.pbxproj +++ b/Reporter/Reporter.xcodeproj/project.pbxproj @@ -13,8 +13,6 @@ 717FD97716C4E69900CE8222 /* ReporterPrefsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 717FD97616C4E69900CE8222 /* ReporterPrefsController.m */; }; 717FD97916C4E71200CE8222 /* PreferencePanes.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 717FD97816C4E71200CE8222 /* PreferencePanes.framework */; }; 717FD97A16C4EA4800CE8222 /* ReporterPrefs.prefPane in Resources */ = {isa = PBXBuildFile; fileRef = 717FD95F16C4E06B00CE8222 /* ReporterPrefs.prefPane */; }; - 71CD3888151B7657008B5E86 /* KBPopUpToolbarItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 71CD3886151B7657008B5E86 /* KBPopUpToolbarItem.h */; }; - 71CD3889151B7657008B5E86 /* KBPopUpToolbarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 71CD3887151B7657008B5E86 /* KBPopUpToolbarItem.m */; }; 71FD07B8151B5FA5001DA7FE /* Reporter.png in Resources */ = {isa = PBXBuildFile; fileRef = 71FD07B7151B5FA5001DA7FE /* Reporter.png */; }; 8420023212E829A200E1E9CE /* OsiriXAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8420023112E829A200E1E9CE /* OsiriXAPI.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 8D5B49AE048680CD000E48DA /* Reporter_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 32DBCF630370AF2F00C91783 /* Reporter_Prefix.pch */; }; @@ -44,15 +42,13 @@ 717FD96416C4E06B00CE8222 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 717FD96516C4E06B00CE8222 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 717FD96616C4E06B00CE8222 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 717FD96916C4E06B00CE8222 /* ReporterPrefs-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "ReporterPrefs-Info.plist"; path = "../Resources/ReporterPrefs-Info.plist"; sourceTree = ""; }; + 717FD96916C4E06B00CE8222 /* ReporterPrefs-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = "ReporterPrefs-Info.plist"; path = "Resources/ReporterPrefs-Info.plist"; sourceTree = ""; }; 717FD97316C4E67B00CE8222 /* ReporterPrefs.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ReporterPrefs.xib; path = Resources/ReporterPrefs.xib; sourceTree = SOURCE_ROOT; }; 717FD97516C4E69900CE8222 /* ReporterPrefsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ReporterPrefsController.h; path = Sources/ReporterPrefsController.h; sourceTree = SOURCE_ROOT; }; 717FD97616C4E69900CE8222 /* ReporterPrefsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ReporterPrefsController.m; path = Sources/ReporterPrefsController.m; sourceTree = SOURCE_ROOT; }; 717FD97816C4E71200CE8222 /* PreferencePanes.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PreferencePanes.framework; path = ../../../../../../System/Library/Frameworks/PreferencePanes.framework; sourceTree = ""; }; - 71CD3886151B7657008B5E86 /* KBPopUpToolbarItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KBPopUpToolbarItem.h; path = Sources/KBPopUpToolbarItem.h; sourceTree = ""; }; - 71CD3887151B7657008B5E86 /* KBPopUpToolbarItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KBPopUpToolbarItem.m; path = Sources/KBPopUpToolbarItem.m; sourceTree = ""; }; 71FD07B7151B5FA5001DA7FE /* Reporter.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Reporter.png; path = Resources/Reporter.png; sourceTree = ""; }; - 8420023112E829A200E1E9CE /* OsiriXAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OsiriXAPI.framework; path = "../../osirix-trunk/build/Development/OsiriXAPI.framework"; sourceTree = ""; }; + 8420023112E829A200E1E9CE /* OsiriXAPI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OsiriXAPI.framework; path = ../../osirix/build/Development/OsiriXAPI.framework; sourceTree = ""; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Resources/Info.plist; sourceTree = ""; }; AB5D36050680E57E00F4007A /* Reporter.osirixplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Reporter.osirixplugin; sourceTree = BUILT_PRODUCTS_DIR; }; ABA48A640680BB600089EB4F /* ReporterFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ReporterFilter.h; path = Sources/ReporterFilter.h; sourceTree = ""; }; @@ -154,8 +150,6 @@ isa = PBXGroup; children = ( 32DBCF630370AF2F00C91783 /* Reporter_Prefix.pch */, - 71CD3886151B7657008B5E86 /* KBPopUpToolbarItem.h */, - 71CD3887151B7657008B5E86 /* KBPopUpToolbarItem.m */, ); name = "Other Sources"; sourceTree = ""; @@ -200,7 +194,6 @@ files = ( 8D5B49AE048680CD000E48DA /* Reporter_Prefix.pch in Headers */, ABA48A650680BB600089EB4F /* ReporterFilter.h in Headers */, - 71CD3888151B7657008B5E86 /* KBPopUpToolbarItem.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -319,7 +312,6 @@ files = ( ABA48A670680BB690089EB4F /* ReporterFilter.mm in Sources */, 7170F8F6151A010100DC48DF /* Reporter.applescript in Sources */, - 71CD3889151B7657008B5E86 /* KBPopUpToolbarItem.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -411,11 +403,6 @@ buildSettings = { COPY_PHASE_STRIP = NO; DEBUGGING_SYMBOLS = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - "../../osirix-trunk/build/Development/", - ); GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_TRIGRAPHS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -452,11 +439,6 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - "../../osirix-trunk/build/Development/", - ); GCC_ENABLE_TRIGRAPHS = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Sources/Reporter_Prefix.pch; @@ -490,6 +472,7 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + FRAMEWORK_SEARCH_PATHS = ../../osirix/build/Development/; MACOSX_DEPLOYMENT_TARGET = 10.7; SDKROOT = macosx10.7; }; @@ -499,6 +482,7 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + FRAMEWORK_SEARCH_PATHS = ../../osirix/build/Development/; MACOSX_DEPLOYMENT_TARGET = 10.7; SDKROOT = macosx10.7; }; @@ -514,6 +498,7 @@ 717FD97016C4E06B00CE8222 /* Deployment */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Development; }; CE6A9A9008AC841300D0C1EE /* Build configuration list for PBXNativeTarget "Reporter" */ = { isa = XCConfigurationList; diff --git a/Reporter/Resources/Info.plist b/Reporter/Resources/Info.plist index 50ba9bd..67b5a60 100644 --- a/Reporter/Resources/Info.plist +++ b/Reporter/Resources/Info.plist @@ -15,7 +15,7 @@ CFBundleSignature ???? CFBundleShortVersionString - 1.1.0 + 1.2.0 NSPrincipalClass ReporterFilter MenuTitles diff --git a/Reporter/Resources/Reporter.applescript b/Reporter/Resources/Reporter.applescript index bf26292..50f1cc6 100644 --- a/Reporter/Resources/Reporter.applescript +++ b/Reporter/Resources/Reporter.applescript @@ -25,76 +25,95 @@ on run argv -- insert the image as a text box in a paragraph with style Caption tell front document - -- make sure the Caption style exists -- yes, in english... - try - set sc to paragraph style "Caption" - -- the Caption style often has 0 spacing when unused… fix this, or our insertions will be confusing - if space before of sc is 0 and space after of sc is 0 then - set space before of sc to 5 - set space after of sc to 5 - end if - on error errmsg number errnbr - make new paragraph style with properties {name:"Caption", alignment:center, space before:5, space after:5, keep lines together:true, keep with next paragraph:false, font name:"Helvetica", font size:11, italic:true} - end try - - (* - -- is there already a text box with the current uid for name? - set tb to 0 - if replaceFlag is equal to 1 then - repeat with itb in text boxes - if name of itb as Unicode text is equal to uid as Unicode text then - set tb to itb - exit repeat - end if - end repeat - end if - - if tb is not equal to 0 then - set image data of tb to imageFilePath - else - *) - - -- append a new paragraph that will represent image's caption - set p to make new paragraph at after last paragraph - set text of p to (text of p & caption as Unicode text) -- TODO: it would be great to insert a shift-newline: (text of p & shift-newline & caption as Unicode text) - returns are captured as "next paragraph", we just want a newline - -- insert a text box to include the image. this is the only way Pages.app officially allows us to insert images - make new text box at after p with properties {fill type:plain image, image data:imageFilePath, stroke type:none, extra space:1, placement:moving, name:uid, width:iwidth, height:iheight} - -- apply some styling to the newly created text box (the image) and paragraph - set paragraph style of last paragraph to paragraph style "Caption" + -- is there a replaceable image? + set replaceIndex to 0 + set counter to 0 + repeat with theImage in images + set counter to counter + 1 + if replaceable of theImage is true then + set replaceIndex to counter + exit repeat + end if + end repeat - -- set the text box to take the whole width of teh page, or the caption will show at its right - set width of last text box to "100%" - set nwidth to width of last text box - -- if the image width won't fit, adapt the height - if nwidth < iwidth then - set height of last text box to iheight / iwidth * nwidth - end if - - -- if the image is very vertical, it'll cover an entire page.. leave at least the space for the caption - set nheight to height of last text box - set mheight to height of containing page of last text box - top margin - bottom margin - 0.035277778*2 -- 2 points --- display dialog the "ssfsf " & nheight & " " & mheight - if nheight > mheight then - set pc to page count - repeat while (page count) is equal to pc - set height of last text box to height of last text box - 0.2 - end repeat - --set height of last text box to mheight - end if - - -- if the image is much smaller than the page width, force the caption text to be centered - --if nwidth - iwidth > nwidth / 3 then - set alignment of last paragraph to center -- TODO: do we want to modify the Caption style instead? - --end if + if replaceIndex is not 0 then -- there is a replaceable image object, replace it + + set image data of image replaceIndex to imageFilePath + set replaceable of image replaceIndex to false + + else -- there are no replaceable image objects + + -- make sure the Caption style exists -- yes, in english... + try + set sc to paragraph style "Caption" + -- the Caption style often has 0 spacing when unused… fix this, or our insertions will be confusing + if space before of sc is 0 and space after of sc is 0 then + set space before of sc to 5 + set space after of sc to 5 + end if + on error errmsg number errnbr + make new paragraph style with properties {name:"Caption", alignment:center, space before:5, space after:5, keep lines together:true, keep with next paragraph:false, font name:"Helvetica", font size:11, italic:true} + end try + + (* + -- is there already a text box with the current uid for name? + set tb to 0 + if replaceFlag is equal to 1 then + repeat with itb in text boxes + if name of itb as Unicode text is equal to uid as Unicode text then + set tb to itb + exit repeat + end if + end repeat + end if + + if tb is not equal to 0 then + set image data of tb to imageFilePath + else + *) + + -- append a new paragraph that will represent image's caption + set p to make new paragraph at after last paragraph + set text of p to (text of p & caption as Unicode text) -- TODO: it would be great to insert a shift-newline: (text of p & shift-newline & caption as Unicode text) - returns are captured as "next paragraph", we just want a newline + -- insert a text box to include the image. this is the only way Pages.app officially allows us to insert images + make new text box at after p with properties {fill type:plain image, image data:imageFilePath, stroke type:none, extra space:1, placement:moving, name:uid, width:iwidth, height:iheight} + -- apply some styling to the newly created text box (the image) and paragraph + set paragraph style of last paragraph to paragraph style "Caption" + + -- set the text box to take the whole width of teh page, or the caption will show at its right + set width of last text box to "100%" + set nwidth to width of last text box + -- if the image width won't fit, adapt the height + if nwidth < iwidth then + set height of last text box to iheight / iwidth * nwidth + end if + + -- if the image is very vertical, it'll cover an entire page.. leave at least the space for the caption + set nheight to height of last text box + set mheight to height of containing page of last text box - top margin - bottom margin - 0.035277778*2 -- 2 points + -- display dialog the "ssfsf " & nheight & " " & mheight + if nheight > mheight then + set pc to page count + repeat while (page count) is equal to pc + set height of last text box to height of last text box - 0.2 + end repeat + --set height of last text box to mheight + end if + + -- if the image is much smaller than the page width, force the caption text to be centered + --if nwidth - iwidth > nwidth / 3 then + set alignment of last paragraph to center -- TODO: do we want to modify the Caption style instead? + --end if - -- because of a bug in Pages, we need to re-enter the text box height, or the text box size won't be properly saved - set nheight to height of last text box - set height of last text box to 1 - set height of last text box to nheight - - (* - end if - *) + -- because of a bug in Pages, we need to re-enter the text box height, or the text box size won't be properly saved + set nheight to height of last text box + set height of last text box to 1 + set height of last text box to nheight + + (* + end if + *) + end if end tell end tell end run \ No newline at end of file diff --git a/Reporter/Sources/KBPopUpToolbarItem.h b/Reporter/Sources/KBPopUpToolbarItem.h deleted file mode 100644 index 9d4d733..0000000 --- a/Reporter/Sources/KBPopUpToolbarItem.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// KBPopUpToolbarItem.h -// -------------------- -// -// Created by Keith Blount on 14/05/2006. -// Copyright 2006 Keith Blount. All rights reserved. -// -// Provides a toolbar item that performs its given action if clicked, or displays a pop-up menu -// (if it has one) if held down for over half a second. -// - -#import -@class KBDelayedPopUpButton; - - -@interface ReporterKBPopUpToolbarItem : NSToolbarItem -{ - KBDelayedPopUpButton *button; - NSImage *smallImage; - NSImage *regularImage; -} -- (void)setMenu:(NSMenu *)menu; -- (NSMenu *)menu; -@end diff --git a/Reporter/Sources/KBPopUpToolbarItem.m b/Reporter/Sources/KBPopUpToolbarItem.m deleted file mode 100644 index 46817bf..0000000 --- a/Reporter/Sources/KBPopUpToolbarItem.m +++ /dev/null @@ -1,283 +0,0 @@ -// -// KBPopUpToolbarItem.m -// -------------------- -// -// Created by Keith Blount on 14/05/2006. -// Copyright 2006 Keith Blount. All rights reserved. -// - -#import "KBPopUpToolbarItem.h" - -@interface KBDelayedPopUpButtonCell : NSButtonCell -@end - -@implementation KBDelayedPopUpButtonCell - -- (NSPoint)menuPositionForFrame:(NSRect)cellFrame inView:(NSView *)controlView -{ - NSPoint result = [controlView convertPoint:cellFrame.origin toView:nil]; - result.x += 1.0; - result.y -= cellFrame.size.height + 5.5; - return result; -} - -- (void)showMenuForEvent:(NSEvent *)theEvent controlView:(NSView *)controlView cellFrame:(NSRect)cellFrame -{ - NSPoint menuPosition = [self menuPositionForFrame:cellFrame inView:controlView]; - - // Create event for pop up menu with adjusted mouse position - NSEvent *menuEvent = [NSEvent mouseEventWithType:[theEvent type] - location:menuPosition - modifierFlags:[theEvent modifierFlags] - timestamp:[theEvent timestamp] - windowNumber:[theEvent windowNumber] - context:[theEvent context] - eventNumber:[theEvent eventNumber] - clickCount:[theEvent clickCount] - pressure:[theEvent pressure]]; - - [NSMenu popUpContextMenu:[self menu] withEvent:menuEvent forView:controlView]; -} - -- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp -{ - - BOOL result = NO; - NSDate *endDate; - NSPoint currentPoint = [theEvent locationInWindow]; - BOOL done = NO; - BOOL trackContinously = [self startTrackingAt:currentPoint inView:controlView]; - - // Catch next mouse-dragged or mouse-up event until timeout - BOOL mouseIsUp = NO; - NSEvent *event; - while (!done) - { - NSPoint lastPoint = currentPoint; - - // Set up timer for pop-up menu if we have one - if ([self menu]) - endDate = [NSDate dateWithTimeIntervalSinceNow:0.5]; - else - endDate = [NSDate distantFuture]; - - event = [NSApp nextEventMatchingMask:(NSLeftMouseUpMask|NSLeftMouseDraggedMask) - untilDate:endDate - inMode:NSEventTrackingRunLoopMode - dequeue:YES]; - - if (event) // Mouse event - { - currentPoint = [event locationInWindow]; - - // Send continueTracking.../stopTracking... - if (trackContinously) - { - if (![self continueTracking:lastPoint at:currentPoint inView:controlView]) - { - done = YES; - [self stopTracking:lastPoint at:currentPoint inView:controlView mouseIsUp:mouseIsUp]; - } - if ([self isContinuous]) - { - [NSApp sendAction:[self action] to:[self target] from:controlView]; - } - } - - mouseIsUp = ([event type] == NSLeftMouseUp); - done = done || mouseIsUp; - - if (untilMouseUp) - { - result = mouseIsUp; - } - else - { - // Check if the mouse left our cell rect - result = NSPointInRect([controlView convertPoint:currentPoint fromView:nil], cellFrame); - if (!result) - done = YES; - } - - if (done && result && ![self isContinuous]) - [NSApp sendAction:[self action] to:[self target] from:controlView]; - - } - else // Show menu - { - done = YES; - result = YES; - [self showMenuForEvent:theEvent controlView:controlView cellFrame:cellFrame]; - } - } - return result; -} - -@end - -@interface KBDelayedPopUpButton : NSButton -@end - -@implementation KBDelayedPopUpButton - -- (id)initWithFrame:(NSRect)frameRect -{ - if (self = [super initWithFrame:frameRect]) - { - if (![[self cell] isKindOfClass:[KBDelayedPopUpButtonCell class]]) - { - NSString *title = [self title]; - if (title == nil) title = @""; - [self setCell:[[[KBDelayedPopUpButtonCell alloc] initTextCell:title] autorelease]]; - [[self cell] setControlSize:NSRegularControlSize]; - } - } - return self; -} - -@end - - -@implementation ReporterKBPopUpToolbarItem - -- (id)initWithItemIdentifier:(NSString *)ident -{ - if (self = [super initWithItemIdentifier:ident]) - { - button = [[KBDelayedPopUpButton alloc] initWithFrame:NSMakeRect(0,0,32,32)]; - [button setButtonType:NSMomentaryChangeButton]; - [button setBordered:NO]; - [self setView:button]; - [self setMinSize:NSMakeSize(32,32)]; - [self setMaxSize:NSMakeSize(32,32)]; - } - return self; -} - -// Note that we make no assumptions about the retain/release of the toolbar item's view, just to be sure - -// we therefore retain our button view until we are dealloc'd. -- (void)dealloc -{ - [button release]; - [regularImage release]; - [smallImage release]; - [super dealloc]; -} - -- (KBDelayedPopUpButtonCell *)popupCell -{ - return [(KBDelayedPopUpButton *)[self view] cell]; -} - -- (void)setMenu:(NSMenu *)menu -{ - [[self popupCell] setMenu:menu]; - - // Also set menu form representation - this is used in the toolbar overflow menu but also, more importantly, to display - // a menu in text-only mode. - NSMenuItem *menuFormRep = [[NSMenuItem alloc] initWithTitle:[self label] action:nil keyEquivalent:@""]; - [menuFormRep setSubmenu:menu]; - [self setMenuFormRepresentation:menuFormRep]; - [menuFormRep release]; -} - -- (NSMenu *)menu -{ - return [[self popupCell] menu]; -} - -- (void)setAction:(SEL)aSelector -{ - [[self popupCell] setAction:aSelector]; -} - -- (SEL)action -{ - return [[self popupCell] action]; -} - -- (void)setTarget:(id)anObject -{ - [[self popupCell] setTarget:anObject]; -} - -- (id)target -{ - return [[self popupCell] target]; -} - -- (void)setImage:(NSImage *)anImage -{ - [regularImage autorelease]; - [smallImage autorelease]; - - regularImage = [anImage retain]; - smallImage = [anImage copy]; - [smallImage setScalesWhenResized:YES]; - [smallImage setSize:NSMakeSize(24,24)]; - - if ([[self toolbar] sizeMode] == NSToolbarSizeModeSmall) anImage = smallImage; - - [[self popupCell] setImage:anImage]; -} - -- (NSImage *)image -{ - return [[self popupCell] image]; -} - -- (void)setToolTip:(NSString *)theToolTip -{ - [[self view] setToolTip:theToolTip]; -} - -- (NSString *)toolTip -{ - return [[self view] toolTip]; -} - -- (void)validate -{ - // First, make sure the toolbar image size fits the toolbar size mode; there must be a better place to do this! - NSToolbarSizeMode sizeMode = [[self toolbar] sizeMode]; - float imgWidth = [[self image] size].width; - - if (sizeMode == NSToolbarSizeModeSmall && imgWidth != 24) - { - [[self popupCell] setImage:smallImage]; - } - else if (sizeMode == NSToolbarSizeModeRegular && imgWidth == 24) - { - [[self popupCell] setImage:regularImage]; - } - - if ([self action]) - { - if (![self target]) - [self setEnabled:[[[[self view] window] firstResponder] respondsToSelector:[self action]]]; - - else { - if ([[self target] respondsToSelector:@selector(validateToolbarItem:)]) - [self setEnabled:[[self target] validateToolbarItem:self]]; - else - [self setEnabled:[[self target] respondsToSelector:[self action]]]; - } - } - else - if ([[self toolbar] delegate]) - { - BOOL enabled = YES; - - if ([[[self toolbar] delegate] respondsToSelector:@selector(validateToolbarItem:)]) - enabled = [(id)[[self toolbar] delegate] validateToolbarItem:self]; - - else if ([[[self toolbar] delegate] respondsToSelector:@selector(validateUserInterfaceItem:)]) - enabled = [(id)[[self toolbar] delegate] validateUserInterfaceItem:self]; - - [self setEnabled:enabled]; - } - else - [super validate]; -} - -@end diff --git a/Reporter/html/Reporter.osirixplugin.zip b/Reporter/html/Reporter.osirixplugin.zip index 50d37b1..9161e43 100644 Binary files a/Reporter/html/Reporter.osirixplugin.zip and b/Reporter/html/Reporter.osirixplugin.zip differ diff --git a/Reporter/html/index.html b/Reporter/html/index.html index 672f6a3..0a16e39 100644 --- a/Reporter/html/index.html +++ b/Reporter/html/index.html @@ -19,6 +19,10 @@

Reporter

Hold the toolbar button to list all the available features. +
+

Version History

+
+ Versions 1.2 inserts images in existing replaceable image objects (available in the template) before adding them at the end of the document, the old way.
Versions 1.1 allows you to include the study date in the images' captions. diff --git a/Reporter/html/style.css b/Reporter/html/style.css index 0b546ad..8d357d8 100644 --- a/Reporter/html/style.css +++ b/Reporter/html/style.css @@ -34,6 +34,11 @@ h1 { margin-top: 40px; } +h2 { + margin-left: 20px; + margin-top: 20px; +} + .text { margin: 5px 20px 5px 20px; } diff --git a/Worklists/Resources/Info.plist b/Worklists/Resources/Info.plist index 568cc03..d43aa51 100644 --- a/Worklists/Resources/Info.plist +++ b/Worklists/Resources/Info.plist @@ -15,10 +15,14 @@ CFBundleSignature ???? CFBundleShortVersionString - 1.0.5 + 1.1.0 NSPrincipalClass WorklistsPlugin pluginType - Other + Database + MenuTitles + + Temporarily disable Worklists refresh + diff --git a/Worklists/Sources/Worklist.mm b/Worklists/Sources/Worklist.mm index 45f7d3c..8190c74 100644 --- a/Worklists/Sources/Worklist.mm +++ b/Worklists/Sources/Worklist.mm @@ -180,7 +180,7 @@ - (void)setProperties:(NSDictionary*)properties { if (ti != -1) { if (!self.refreshTimer || _refreshTimer.timeInterval != ti) - self.refreshTimer = [NSTimer scheduledTimerWithTimeInterval:ti target:[WorklistsNonretainingTimerInvoker invokerWithTarget:self selector:@selector(initiateRefresh)] selector:@selector(fire:) userInfo:nil repeats:YES]; + self.refreshTimer = [NSTimer scheduledTimerWithTimeInterval:ti target:[WorklistsNonretainingTimerInvoker invokerWithTarget:self selector:@selector(_timedInitiateRefresh:)] selector:@selector(fire:) userInfo:nil repeats:YES]; [_refreshTimer fire]; } else { self.refreshTimer = nil; @@ -541,6 +541,12 @@ - (void)_threadRefresh { } } +- (void)_timedInitiateRefresh:(NSTimer*)timer { + if ([[WorklistsPlugin instance] refreshDisabled]) + return; + [self initiateRefresh]; +} + - (void)initiateRefresh { [self performSelectorInBackground:@selector(_threadRefresh) withObject:nil]; } diff --git a/Worklists/Sources/WorklistsPlugin.h b/Worklists/Sources/WorklistsPlugin.h index d627e87..00a52df 100644 --- a/Worklists/Sources/WorklistsPlugin.h +++ b/Worklists/Sources/WorklistsPlugin.h @@ -23,10 +23,14 @@ extern NSString* const WorklistAlbumIDsDefaultsKey; NSMutableDictionary* _worklistObjs; NSMutableDictionary* _errors; NSTimer* _urlSyncTimer; + NSMenuItem* _pluginMenuItem; + BOOL _refreshDisabled; + NSTimer* _refreshReenableTimer; } @property(readonly,retain) NSArrayController* worklists; @property(readonly,retain) NSTimer* urlSyncTimer; +@property(readonly) BOOL refreshDisabled; + (WorklistsPlugin*)instance; diff --git a/Worklists/Sources/WorklistsPlugin.mm b/Worklists/Sources/WorklistsPlugin.mm index ccc4bf4..8c82ffc 100644 --- a/Worklists/Sources/WorklistsPlugin.mm +++ b/Worklists/Sources/WorklistsPlugin.mm @@ -20,6 +20,7 @@ #import #import #import +#import @interface WorklistsArrayController : NSArrayController @@ -36,6 +37,7 @@ @implementation WorklistsPlugin @synthesize worklists = _worklists; @synthesize urlSyncTimer = _urlSyncTimer; +@synthesize refreshDisabled = _refreshDisabled; static WorklistsPlugin* WorklistsPluginInstance = nil; static NSString* const Worklists = @"Worklists"; @@ -83,7 +85,9 @@ - (void)dealloc { [NSUserDefaultsController.sharedUserDefaultsController removeObserver:self]; [NSNotificationCenter.defaultCenter removeObserver:self]; + self.urlSyncTimer = nil; + [_refreshReenableTimer release]; [_cachePath release]; [_worklistObjs release]; @@ -99,43 +103,42 @@ - (void)initPlugin { [PreferencesWindowController addPluginPaneWithResourceNamed:@"WorklistsPreferences" inBundle:[NSBundle bundleForClass:[self class]] withTitle:Worklists image:image]; Method method; - IMP imp; + //IMP imp; Class BrowserControllerClass = [BrowserController class]; method = class_getInstanceMethod(BrowserControllerClass, @selector(tableView:willDisplayCell:forTableColumn:row:)); if (!method) [NSException raise:NSGenericException format:@"bad OsiriX version"]; - imp = method_getImplementation(method); - class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_tableView:willDisplayCell:forTableColumn:row:), imp, method_getTypeEncoding(method)); + class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_tableView:willDisplayCell:forTableColumn:row:), method_getImplementation(method), method_getTypeEncoding(method)); method_setImplementation(method, class_getMethodImplementation([self class], @selector(_Worklists_BrowserController_tableView:willDisplayCell:forTableColumn:row:))); method = class_getInstanceMethod(BrowserControllerClass, @selector(tableView:validateDrop:proposedRow:proposedDropOperation:)); if (!method) [NSException raise:NSGenericException format:@"bad OsiriX version"]; - imp = method_getImplementation(method); - class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_tableView:validateDrop:proposedRow:proposedDropOperation:), imp, method_getTypeEncoding(method)); + class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_tableView:validateDrop:proposedRow:proposedDropOperation:), method_getImplementation(method), method_getTypeEncoding(method)); method_setImplementation(method, class_getMethodImplementation([self class], @selector(_Worklists_BrowserController_tableView:validateDrop:proposedRow:proposedDropOperation:))); method = class_getInstanceMethod(BrowserControllerClass, @selector(tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:)); if (!method) [NSException raise:NSGenericException format:@"bad OsiriX version"]; - imp = method_getImplementation(method); - class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:), imp, method_getTypeEncoding(method)); + class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:), method_getImplementation(method), method_getTypeEncoding(method)); method_setImplementation(method, class_getMethodImplementation([self class], @selector(_Worklists_BrowserController_tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:))); method = class_getInstanceMethod(BrowserControllerClass, @selector(menuWillOpen:)); if (!method) [NSException raise:NSGenericException format:@"bad OsiriX version"]; - imp = method_getImplementation(method); - class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_menuWillOpen:), imp, method_getTypeEncoding(method)); + class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_menuWillOpen:), method_getImplementation(method), method_getTypeEncoding(method)); method_setImplementation(method, class_getMethodImplementation([self class], @selector(_Worklists_BrowserController_menuWillOpen:))); method = class_getInstanceMethod(BrowserControllerClass, @selector(outlineView:willDisplayCell:forTableColumn:item:)); if (!method) [NSException raise:NSGenericException format:@"bad OsiriX version"]; - imp = method_getImplementation(method); - class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_outlineView:willDisplayCell:forTableColumn:item:), imp, method_getTypeEncoding(method)); + class_addMethod(BrowserControllerClass, @selector(_Worklists_BrowserController_outlineView:willDisplayCell:forTableColumn:item:), method_getImplementation(method), method_getTypeEncoding(method)); method_setImplementation(method, class_getMethodImplementation([self class], @selector(_Worklists_BrowserController_outlineView:willDisplayCell:forTableColumn:item:))); -} - -- (long)filterImage:(NSString*)menuName { - return 0; + + Class PluginManagerClass = [PluginManager class]; + + method = class_getClassMethod(PluginManagerClass, @selector(setMenus::::)); + if (!method) [NSException raise:NSGenericException format:@"bad OsiriX version"]; + class_addMethod(object_getClass(PluginManagerClass), @selector(_Worklists_PluginManager_setMenus::::), method_getImplementation(method), method_getTypeEncoding(method)); + method_setImplementation(method, method_getImplementation(class_getClassMethod([self class], @selector(_Worklists_PluginManager_setMenus::::)))); + } - (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change context:(void*)context { @@ -285,6 +288,38 @@ + (void)refreshAlbumsForDatabase:(DicomDatabase*)db { [BrowserController.currentBrowser refreshAlbums]; } +- (void)updateMenuItem { + [_pluginMenuItem setState:(_refreshDisabled? NSOnState : NSOffState)]; +} + +- (long)filterImage:(NSString*)menuName { + if (_refreshDisabled) { + [_refreshReenableTimer invalidate]; + _refreshReenableTimer = nil; + _refreshDisabled = NO; + [self updateMenuItem]; + } else { + NSAlert* alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Worklists won't be refreshed for the next 60 minutes.", nil) defaultButton:nil alternateButton:NSLocalizedString(@"Cancel", nil) otherButton:nil informativeTextWithFormat:NSLocalizedString(@"After 60 minutes, worklists will automatically start refreshing again, but you can use this menu item to re-enable worklists when you're done.", nil)]; + [alert beginSheetModalForWindow:nil modalDelegate:self didEndSelector:@selector(_disableRefreshSheetDidEnd:returnCode:contextInfo:) contextInfo:nil]; + } + + return 0; +} + +- (void)_disableRefreshSheetDidEnd:(NSAlert*)alert returnCode:(NSInteger)returnCode contextInfo:(void*)contextInfo { + if (returnCode == NSOKButton) { + _refreshDisabled = YES; + [self updateMenuItem]; + _refreshReenableTimer = [NSTimer scheduledTimerWithTimeInterval:3600 target:[WorklistsNonretainingTimerInvoker invokerWithTarget:self selector:@selector(_timedReenableRefresh:)] selector:@selector(fire:) userInfo:nil repeats:NO]; + } +} + +- (void)_timedReenableRefresh:(NSTimer*)timer { + _refreshReenableTimer = nil; + _refreshDisabled = NO; + [self updateMenuItem]; +} + #pragma mark BrowserController - (void)_BrowserController:(BrowserController*)bc tableView:(NSTableView*)table willDisplayCell:(PrettyCell*)cell forTableColumn:(NSTableColumn*)column row:(NSInteger)row { @@ -456,6 +491,33 @@ - (void)_Worklists_BrowserController_outlineView:(NSOutlineView*)outlineView wil [WorklistsPluginInstance _BrowserController:(id)self outlineView:outlineView willDisplayCell:cell forTableColumn:column item:item]; } +- (void)_PluginManager_setMenus:(NSMenu*)filtersMenu :(NSMenu*)roisMenu :(NSMenu*)othersMenu :(NSMenu*)dbMenu { + NSBundle* bundle = [NSBundle bundleForClass:[self class]]; + + _pluginMenuItem = nil; + + for (NSMenuItem* mi in dbMenu.itemArray) { + if (mi.representedObject) { // we recently started setting the NSMenuItem's representedObject to the plugin's NSBundle instance + if (mi.representedObject != bundle) + continue; + } else // previously, the only way to identify the menus was by their title + if (![mi.title isEqualToString:@"Temporarily disable Worklists refresh"]) + continue; + + // mi is our menu item + _pluginMenuItem = mi; + + break; // we don't have other menu items + } + + [self updateMenuItem]; +} + ++ (void)_Worklists_PluginManager_setMenus:(NSMenu*)filtersMenu :(NSMenu*)roisMenu :(NSMenu*)othersMenu :(NSMenu*)dbMenu { + [self _Worklists_PluginManager_setMenus:filtersMenu :roisMenu :othersMenu :dbMenu]; + [WorklistsPluginInstance _PluginManager_setMenus:filtersMenu :roisMenu :othersMenu :dbMenu]; +} + @end