1 /* functions.h
2  * Common Cenon functions
3  *
4  * Copyright (C) 1996-2012 by vhf interservice GmbH
5  * Author:   Georg Fleischmann
6  *
7  * created:  1996-01-25
8  * modified: 2012-01-05 (NSMenuItem)
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the vhf Public License as
12  * published by vhf interservice GmbH. Among other things, the
13  * License requires that the copyright notices and this notice
14  * be preserved on all copies.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  * See the vhf Public License for more details.
20  *
21  * You should have received a copy of the vhf Public License along
22  * with this program; see the file LICENSE. If not, write to vhf.
23  *
24  * vhf interservice GmbH, Im Marxle 3, 72119 Altingen, Germany
25  * eMail: info@vhf.de
26  * http://www.vhf.de
27  */
28 
29 #ifndef VHF_H_FUNCTIONS
30 #define VHF_H_FUNCTIONS
31 
32 #include <AppKit/AppKit.h>
33 
34 typedef enum
35 {
36     UNIT_MM      = 0,	// millimeter       internal x 25.4 / 72
37     UNIT_INCH    = 1,	// inch             internal x  1 / 72
38     UNIT_POINT   = 2, 	// 1/72 inch        internal x  1
39     UNIT_NONE    = -1   // use preferences
40 } CenonUnit;
41 
42 NSString *localLibrary(void);
43 NSString *userLibrary(void);
44 NSString *localBundlePath(void);
45 NSString *systemBundlePath(void);
46 NSString *userBundlePath(void);
47 
48 void fillPopup(NSPopUpButton *popupButton, NSString *folder, NSString *ext, int removeIx, BOOL searchSubFolders);
49 NSDictionary *dictionaryFromFolder(NSString *folder, NSString *name);
50 
51 BOOL vhfUpdateMenuItem(NSMenuItem *menuItem, NSString *zeroItem, NSString *oneItem, BOOL state);
52 
53 /* functions using base unit from 'unit' default */
54 float convertToUnit(float value);   // DEPRECATED: use [document convertToUnit:]
55 float convertFromUnit(float value); // DEPRECATED: use [document convertFrUnit:]
56 float convertMMToUnit(float value); // DEPRECATED: use [document convertMMToUnit:]
57 float convertUnitToMM(float value); // DEPRECATED: use [document convertUnitToMM:]
58 
59 /* functions using base unit from parameter */
60 //float convertToUnit  (float value, CenonUnit unit);
61 //float convertFromUnit(float value, CenonUnit unit);
62 /* return factor for base unit * num/denom */
63 //float factorToUnit  (CenonUnit unit, int num, int denom);
64 //float factorFromUnit(CenonUnit unit, int num, int denom);
65 
66 NSString *vhfStringFromRGBColor(NSColor *color);
67 NSColor  *vhfRGBColorFromString(NSString *string);
68 
69 #endif	// VHF_H_FUNCTIONS
70