usbdmx.com Home of the opto isolated, bus powered, DMX512 interface with both in and out universes. Cheap and simple to build. USBDMX logo

LOFixtureLibrary.h

00001 /*
00002  *
00003  * Copyright (c) 2006, Ben Suffolk <ben@usbdmx.com>
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without 
00007  * modification, are permitted provided that the following conditions are met:
00008  *
00009  * 1. Redistributions of source code must retain the above copyright notice,
00010  *    this list of conditions and the following disclaimer.
00011  *
00012  * 2. Redistributions in binary form must reproduce the above copyright notice,
00013  *    this list of conditions and the following disclaimer in the documentation
00014  *    and/or other materials provided with the distribution.
00015  *
00016  * 3. Neither the name of the usbdmx.com web site nor the names of its 
00017  *    contributors may be used to endorse or promote products derived from this
00018  *    software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
00021  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
00022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
00023  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
00024  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00025  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
00026  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00027  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00028  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
00029  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00030  * POSSIBILITY OF SUCH DAMAGE.
00031  *
00032  * $Id: LOFixtureLibrary.h 180 2007-09-16 17:27:42Z ben.suffolk $
00033  *
00034  */
00035 
00036 #import <Cocoa/Cocoa.h>
00037 
00038 @class LOFixture;
00039 @class LOFixtureLibrary;
00040 
00046 @interface NSObject (LOFixtureLibraryDelegate)
00047 
00048 
00054 - (void)unableToParseFixtureXML:(NSXMLElement *)XML withError:(NSError *)error inLibrary:(LOFixtureLibrary *)library;
00055 
00056 
00065 - (BOOL)loadFixture:(LOFixture *)newFixture withDuplicateFixture:(LOFixture *)existingFixture inLibrary:(LOFixtureLibrary *)library;
00066 
00067 
00080 - (BOOL)shouldRenameFixture:(LOFixture *)newFixture inLibrary:(LOFixtureLibrary *)library;
00081 
00082 
00093 - (NSString *)newNameForFixture:(LOFixture *)newFixture suggestedName:(NSString *)suggested inLibrary:(LOFixtureLibrary *)library;
00094 
00095 @end;
00096 
00097 
00109 @interface LOFixtureLibrary : NSObject
00110 {
00111  NSMutableDictionary *manufacturers;    
00112  NSMutableArray *sortedManufacturers;   
00113  NSMutableArray *allFixtures;           
00114  id delegate;                           
00115  
00116  NSString *searchFilter;                
00117  NSArray *filteredAllFixtures;          
00118  NSArray *filteredManufacturers;        
00119 }
00120 
00121 
00129 - (id)initWithDelegate:(id)aDelegate;
00130 
00131 
00139 + (LOFixtureLibrary *)defaultLibrary;
00140 
00141 
00152 - (id)delegate;
00153 
00154 
00165 - (void)setDelegate:(id)aDelegate;
00166 
00167 
00175 - (NSXMLElement *)exportLibraryXML;
00176 
00177 
00186 - (NSXMLElement *)exportLibraryXMLForManufacturer:(NSString *)theManufacturer;
00187 
00188 
00206 - (BOOL)importFixtureXML:(NSXMLElement *)XMLElement;
00207 
00208 
00229 - (int)importLibraryXML:(NSXMLElement *)XMLElement;
00230 
00231 
00239 - (LOFixture *)fixtureNamed:(NSString *)name fromManufacturer:(NSString *)manufacturer;
00240 
00241 
00251 - (LOFixture *)fixtureMatching:(LOFixture *)theFixture;
00252 
00253 
00263 - (LOFixture *)fixtureMatchingXML:(NSXMLElement *)XMLElement;
00264 
00265 
00273 - (NSArray *)manufacturers;
00274 
00275 
00283 - (NSArray *)namesForManufacturer:(NSString *)manufacturer;
00284 
00285 
00293 - (NSString *)commentForFixtureNamed:(NSString *)name fromManufacturer:(NSString *)manufacturer;
00294 
00295 
00302 - (LOFixture *)fixtureSelectedInBrowser:(NSBrowser *)browser;
00303 
00304 
00312 - (NSString *)searchFilter;
00313 
00314 
00323 - (void)setSearchFilter:(NSString *)search;
00324 
00325 
00333 - (void)filter;
00334 
00335 
00336 @end
00337 
00338 
00339 static int caseInsensativeStringSort(NSString *str1, NSString *str2, void *context);
00340 static int fixtureNameSort(LOFixture *fix1, LOFixture *fix2, void *context);
00341 static int fixtureXMLNameSort(NSXMLElement *XML1, NSXMLElement *XML2, void *context);
00342 
00343 
00350 static BOOL __XML_Entries_Match(NSXMLElement *e1XML, NSXMLElement *e2XML);
00351 
00352 
00353 
00354 
00355 
00356 
00357 
00358 
00359 
00360 
00361 
00362 
00363