-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMainController.h
More file actions
executable file
·191 lines (151 loc) · 5.17 KB
/
MainController.h
File metadata and controls
executable file
·191 lines (151 loc) · 5.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
//
// MainController.h - Main Application Controller Class
//
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
#import "MemoryInfo.h"
#import "ProcessorInfo.h"
#import "LoadInfo.h"
#import "NetworkInfo.h"
#import "DiskInfo.h"
#import "PowerInfo.h"
#import "TemperatureInfo.h"
#import "AirportInfo.h"
#import "Preferences.h"
#import "GraphView.h"
#import "InfoView.h"
#import "TranslucentWindow.h"
#define OPTION_INCLUDE_MATRIX_ORBITAL 0
#define OPTION_RESIZE_INFO 0
#define OPTION_MOON_TEST 0
#define OPTION_REPLACE_TOKEN_TEST 0
#define DISK_LIST_SIZE 14
#define PROCESS_LIST_SIZE 13
struct processEntry {
int pid;
float average;
float current;
BOOL isCurrent;
};
#define SWAPPING_LIST_SIZE 2048
struct swappingEntry {
int pid;
int lastPageins;
int pageins;
int lastFaults;
int faults;
BOOL isCurrent;
};
@interface MainController : NSObject
{
IBOutlet id aboutBox; // the about box
IBOutlet id versionNumber; // the version number in the about box
IBOutlet id contextMenu; // the context menu
Preferences *preferences; // the preferences
// data sources
MemoryInfo *memoryInfo;
ProcessorInfo *processorInfo;
LoadInfo *loadInfo;
NetworkInfo *networkInfo;
DiskInfo *diskInfo;
PowerInfo *powerInfo;
TemperatureInfo *temperatureInfo;
AirportInfo *airportInfo;
time_t startTime;
time_t now;
NSImage *backgroundImage; // the image used as a background
NSImage *statusBackgroundImage; // the image used as a background on the menubar
NSImage *iconImage; // the image used in the dock
NSImage *graphImage; // the image used in the window
NSImage *statusImage; // the image used in the menubar
TranslucentWindow *graphWindow; // window for the graph
GraphView *graphView; // view for the graph window
TranslucentWindow *infoWindow; // window for the gauge info
InfoView *infoView;
NSStatusItem *statusItem; // menubar status item
NSTimer *refreshTimer; // timer for graph refreshs
NSTimer *registrationTimer; // timer for registration checks
NSTimer *curtainTimer; // timer for opening curtain
NSTimer *fadeTimer; // timer for fading info window
NSTimer *delayTimer; // timer for delaying display of info window
int lastHour; // last hour displayed in graph
int lastMinute; // last minute displayed in graph
int curtain; // curtain increment
int fade; // info window fade
int fadeIncrement; // positive when fading in, negative when fading out
NSString *applicationVersion; // version number for application
int majorVersion; // version number for Mac OS X
int minorVersion;
int updateVersion;
UInt64 peakPacketsInBytes; // peak indicators
time_t timePeakPacketsInBytes;
UInt64 peakPacketsOutBytes;
time_t timePeakPacketsOutBytes;
UInt64 peakReadBytes;
time_t timePeakReadBytes;
UInt64 peakWriteBytes;
time_t timePeakWriteBytes;
struct processEntry processList[PROCESS_LIST_SIZE]; // process monitoring lists
struct swappingEntry swappingList[SWAPPING_LIST_SIZE];
int selfPid;
BOOL alternativeActivity;
BOOL plotArea;
float infoDelay;
float statusAlertThreshold;
BOOL applicationIconIsDefault;
NSAttributedString *processorInfoString;
NSAttributedString *mobilityInfoString;
NSAttributedString *memoryInfoString;
NSAttributedString *swappingInfoString;
NSAttributedString *diskInfoString;
NSAttributedString *networkInfoString;
NSAttributedString *clockInfoString;
NSAttributedString *generalInfoString;
NSAttributedString *registerInfoString;
#if OPTION_INCLUDE_MATRIX_ORBITAL
int serialDevice;
#endif
// for sleep & wake notifications
io_connect_t root_port;
io_object_t notifier;
BOOL infoWindowIsLocked;
GraphPoint lockedGraphPoint;
BOOL haveAuthorizedTaskPort;
}
- (NSPoint)pointAtCenter:(NSPoint)center atAngle:(float)angle atRadius:(float)radius;
- (float) angleAtCenter:(NSPoint)center ofPoint:(NSPoint)point;
- (float) radiusAtCenter:(NSPoint)center ofPoint:(NSPoint)point;
- (NSString *)stringForValue:(float)value;
- (NSString *)stringForValue:(float)value withBytes:(BOOL)withBytes;
- (NSString *)stringForValue:(float)value withBytes:(BOOL)withBytes withDecimal:(BOOL)withDecimal;
- (NSString *)stringForValue:(float)value powerOf10:(BOOL)isPowerOf10 withBytes:(BOOL)withBytes;
- (NSString *)stringForValue:(float)value powerOf10:(BOOL)isPowerOf10 withBytes:(BOOL)withBytes withDecimal:(BOOL)withDecimal;
- (void)updateInfo;
- (void)drawInfo;
- (void)setInfoLocation;
#if OPTION_RESIZE_INFO
- (void)setInfoSize:(NSString *)infoText;
#endif
- (void)resetGraphLocation;
- (void)setGraphLocation;
- (IBAction)checkForUpdates:(id)sender;
- (void)showPreferences:(id)sender;
- (void)openIconfactory:(id)sender;
- (void)openHomePage:(id)sender;
- (void)openGallery:(id)sender;
- (void)openFAQ:(id)sender;
- (void)mailSupport:(id)sender;
- (void)launchProcessViewer:(id)sender;
- (void)launchTerminal:(id)sender;
- (void)launchNetworkUtility:(id)sender;
- (void)showAboutBox:(id)sender;
- (void)toggleFloatingWindow:(id)sender;
- (void)toggleIgnoreMouse:(id)sender;
- (void)lockInfoWindow:(id)sender;
- (void)updateIconAndWindow;
#if OPTION_INCLUDE_MATRIX_ORBITAL
- (void)deregisterForSleepWakeNotification;
- (void)powerMessageReceived:(natural_t)messageType withArgument:(void *) messageArgument;
- (void)registerForSleepWakeNotification;
#endif
@end