source: golgotha/src/maxtool/sdk_inc/units.h @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 12 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
  • Property svn:keywords set to Id
File size: 3.9 KB
Line 
1/**********************************************************************
2 *<
3        FILE: units.h
4
5        DESCRIPTION: Include file for real-world units support
6
7        CREATED BY: Tom Hudson
8
9        HISTORY:
10
11 *>     Copyright (c) 1995, All Rights Reserved.
12 **********************************************************************/
13
14#ifndef _UNITS_H_
15
16#define _UNITS_H_
17
18// The unit types we support
19#define UNITS_INCHES            0
20#define UNITS_FEET                      1
21#define UNITS_MILES                     2
22#define UNITS_MILLIMETERS       3
23#define UNITS_CENTIMETERS       4
24#define UNITS_METERS            5
25#define UNITS_KILOMETERS        6
26
27#define MAX_UNIT_TYPES 7
28
29// The unit display types
30#define UNITDISP_GENERIC        0
31#define UNITDISP_METRIC         1
32#define UNITDISP_US                     2
33#define UNITDISP_CUSTOM         3
34
35#define MAX_UNITDISP_TYPES 4
36
37// Metric display options
38#define UNIT_METRIC_DISP_MM     0
39#define UNIT_METRIC_DISP_CM     1
40#define UNIT_METRIC_DISP_M      2
41#define UNIT_METRIC_DISP_KM     3
42
43#define MAX_METRIC_DISP_TYPES 4
44
45// US display options
46#define UNIT_US_DISP_FRAC_IN    0
47#define UNIT_US_DISP_DEC_IN             1
48#define UNIT_US_DISP_FRAC_FT    2
49#define UNIT_US_DISP_DEC_FT             3
50#define UNIT_US_DISP_FT_FRAC_IN 4
51#define UNIT_US_DISP_FT_DEC_IN  5
52
53#define MAX_US_DISP_TYPES 6
54
55// US display options
56#define UNIT_FRAC_1_1   0
57#define UNIT_FRAC_1_2   1
58#define UNIT_FRAC_1_4   2
59#define UNIT_FRAC_1_8   3
60#define UNIT_FRAC_1_10  4
61#define UNIT_FRAC_1_16  5
62#define UNIT_FRAC_1_32  6
63#define UNIT_FRAC_1_64  7
64#define UNIT_FRAC_1_100 8
65
66#define MAX_FRAC_TYPES 9
67
68// Units designator types
69#define UNIT_DESIG_MM           0
70#define UNIT_DESIG_CM           1
71#define UNIT_DESIG_M            2
72#define UNIT_DESIG_KM           3
73#define UNIT_DESIG_IN           4
74#define UNIT_DESIG_FT           5
75#define UNIT_DESIG_CUSTOM       6
76
77#define UNIT_DESIG_TYPES         7
78
79// Display information structure
80
81typedef struct {
82        int dispType;                           // Display type (UNITDISP_GENERIC, UNITDISP_METRIC, UNITDISP_US, UNITDISP_CUSTOM)
83        int metricDisp;                         // Metric display option
84        int usDisp;                                     // US display option
85        int usFrac;                                     // US fraction option
86        const TCHAR *customName;        // Custom unit name
87        float customValue;                      // Custom unit value
88        int customUnit;                         // Custom unit reference
89        } DispInfo;
90
91// Get the master scale in terms of the specified unit type
92// i.e. GetMasterScale(UNITS_INCHES) gives number of inches per unit
93// Returns -1.0 if invalid unit type supplied
94double CoreExport GetMasterScale(int type);
95
96void CoreExport GetMasterUnitInfo(int *type,float *scale);
97int CoreExport SetMasterUnitInfo(int type,float scale);
98void CoreExport GetUnitDisplayInfo(DispInfo *info);
99int CoreExport SetUnitDisplayInfo(DispInfo *info);
100int CoreExport GetUnitDisplayType();
101int CoreExport SetUnitDisplayType(int type);
102BOOL CoreExport IsValidUnitCharacter(int ch);   // Returns TRUE if character valid for unit type
103
104TCHAR CoreExport *GetFirstUnitName();
105TCHAR CoreExport *GetNextUnitName();
106TCHAR CoreExport *GetFirstMetricDisp();
107TCHAR CoreExport *GetNextMetricDisp();
108TCHAR CoreExport *GetFirstUSDisp();
109TCHAR CoreExport *GetNextUSDisp();
110TCHAR CoreExport *GetFirstFraction();
111TCHAR CoreExport *GetNextFraction();
112TCHAR CoreExport *FormatUniverseValue(float value);
113float CoreExport DecodeUniverseValue(TCHAR *string, BOOL *valid = NULL);
114
115
116//
117// Time units
118//
119
120// Ways to display time
121enum TimeDisp {
122        DISPTIME_FRAMES,
123        DISPTIME_SMPTE,
124        DISPTIME_FRAMETICKS,
125        DISPTIME_TIMETICKS
126        };
127
128// Formats a time value into a string based on the current frame rate, etc.
129void CoreExport TimeToString(TimeValue t,TSTR &string);
130BOOL CoreExport StringToTime(TSTR string,TimeValue &t);
131
132CoreExport int GetFrameRate();
133CoreExport void SetFrameRate(int rate);
134CoreExport int GetTicksPerFrame();
135CoreExport void SetTicksPerFrame(int ticks);
136CoreExport TimeDisp GetTimeDisplayMode();
137CoreExport void SetTimeDisplayMode(TimeDisp m);
138CoreExport int LegalFrameRate(int r);
139
140#endif // _UNITS_H_
Note: See TracBrowser for help on using the repository browser.