source: cprs/trunk/CPRS-Chart/uGraphs.pas@ 1166

Last change on this file since 1166 was 830, checked in by Kevin Toppenberg, 14 years ago

Upgrading to version 27

File size: 12.0 KB
RevLine 
[456]1unit uGraphs;
2
3interface
4
5uses
6 SysUtils, Classes, Graphics, ORFn;
7
8type
9 TGraphSetting = class
10 public
11 ClearBackground: boolean;
[830]12 DateRangeInpatient: string;
13 DateRangeOutpatient: string;
[456]14 Dates: boolean;
15 FixedDateRange: boolean;
16 FMStartDate: double;
17 FMStopDate: double;
18 Gradient: boolean;
19 HighTime: TDateTime;
20 Hints: boolean;
21 HorizontalZoom: boolean;
22 ItemsDisplayed: TStrings;
23 ItemsForDisplay: TStrings;
24 Legend: boolean;
25 Lines: boolean;
26 LowTime: TDateTime;
27 MaxGraphs: integer;
28 MaxSelect: integer;
29 MaxSelectMin: integer;
30 MaxSelectMax: integer;
31 MinGraphHeight: integer;
32 OptionSettings: string; // only used for storage
33 Points: boolean;
34 SortByType: boolean;
35 SortColumn: integer;
36 Sources: TStrings;
37 StayOnTop: boolean;
[830]38 Turbo: boolean;
[456]39 Values: boolean;
40 VerticalZoom: boolean;
41 View3D: boolean;
42 end;
43
[830]44 TGraphActivity = class
45 public
46 CurrentSetting: string;
47 DefaultInpatientDate: string;
48 DefaultOutpatientDate: string;
49 OldDFN: string;
50 PublicSetting: string;
51 PersonalSetting: string;
52 PublicEditor: boolean;
53 Status: string;
54 TurboOn: boolean;
55 Cache: boolean;
56 end;
57
[456]58const
59 BIG_NUMBER = 9999999;
60 BIG_SPACES = ' ';
61 FM_START_DATE = 2500101;
62 FM_STOP_DATE = 3500101;
63 MAX_ITEM_DISCLAIMER = 10;
64 NUM_COLORS = 16;
65 PROB_HEIGHT = 2;
66 RX_HEIGHT_IN = 12;
67 RX_HEIGHT_NVA = 9;
68 RX_HEIGHT_OUT = 15;
69 ZOOM_PERCENT = 95;
70 GRAPH_FLOAT = 'F';
71 GRAPH_REPORT = 'R';
[830]72 POINT_PADDING = 0.03; // assume a point height of 3%
73 LLS_FRONT = '^____[';
74 LLS_BACK = ']___________________________________________________________________________________________________________';
[456]75
[830]76
[456]77 // settings use single character
78 SETTING_3D = 'A';
79 SETTING_CLEAR = 'B';
80 SETTING_DATES = 'C';
81 SETTING_GRADIENT = 'D';
82 SETTING_HINTS = 'E';
83 SETTING_LEGEND = 'F';
84 SETTING_LINES = 'G';
85 SETTING_SORT = 'H';
86 SETTING_TOP = 'I';
87 SETTING_VALUES = 'J';
88 SETTING_HZOOM = 'K';
89 SETTING_VZOOM = 'L';
90 SETTING_FIXED = 'M';
[830]91 SETTING_TURBO = 'N';
[456]92
93 // keypress flags
94 KEYPRESS_ON = 'YES';
95 KEYPRESS_OFF = 'NO';
96
97 // format date/time axis
98 DFORMAT_MDY = 'm/d/yyyy';
99 DFORMAT_MYY = 'm/yy';
100 DFORMAT_YY = 'yy';
101 DWIDTH_MDY = 66;
102 DWIDTH_MYY = 30;
103 DWIDTH_YY = 18;
104
105 // text messages
[830]106 TXT_COMMENTS = '** comments';
107 TXT_COPY_DISCLAIMER = 'Note: Graphs display limited data, view details for more information.';
[456]108 TXT_DISCLAIMER = 'Due to number of items and size restrictions on your display, '
109 + 'all items may not be visible.';
110 TXT_INFO = 'Select multiple items using Ctrl-click or Shift-click.';
[830]111 TXT_NONNUMERICS = 'free-text values:';
112 TXT_NOGRAPHING = 'CPRS is not configured for graphing.';
[456]113 TXT_PRINTING = 'Graphs are being printed';
[830]114 TXT_REPORT_DISCLAIMER = 'Note: Listing displays limited data, view details for more information.';
115 TXT_VIEW_DEFINITION = 'View Definition';
[456]116 TXT_WARNING = 'Warning: You are using graph settings with a Special Function.';
117 TXT_WARNING_SAME_TIME = 'Warning: Items have multiple occurrences at the same time.';
118 TXT_ZOOMED = 'Zoomed Date Range: ';
119
[830]120 // views
121 VIEW_CURRENT = '-999';
122 VIEW_LABS = '-3';
123 VIEW_PERSONAL = '-1';
124 VIEW_PUBLIC = '-2';
125 VIEW_TEMPORARY = '-888';
126
[456]127 COLOR_INFO = clCream;
128 COLOR_PRINTING = clMoneyGreen; //$CCFFFF; $CCCCFF; $CCFFCC; $FFCCCC; $FFCCFF; $FFFFCC;
129 COLOR_WARNING = clCream; //clFuchsia;
130 COLOR_ZOOM = clCream; //clSkyBlue;
131
132 // hint messages for view definition
133 HINT_PAT_SOURCE = 'Only items where the patient has data are displayed.'
134 + #13 + 'Use this for selecting items to display on the graph.';
135 HINT_ALL_SOURCE = 'All possible items are displayed.'
136 + #13 + 'Use this for defining items to be displayed/saved as Views.'
137 + #13 + 'Note: For easy use, select Views for graphing.';
138 HINT_SELECTION_INFO = 'This form is primarily used for defining views.'
139 + #13 + 'Usually selection is done by selecting Views or Items to graph.'
140 + #13 + 'This form defines views.'
141 + #13 + 'The Settings form defines items that are always selectable for graphing.';
142 HINT_SOURCE = 'These are the different types of data.'
143 + #13 + 'Types are followed by a section showing your Personal Views, then Public Views.'
144 + #13 + 'Click a type and then select individual items'
145 + #13 + 'Double-click a type to select all items of this type - <any>';
[830]146 HINT_OTHER_SOURCE = 'These are Views and Lab Groups of other users.'
147 + #13 + 'Use these for defining items to be displayed/saved as Views.'
148 + #13 + 'Note: Select a Person to display their views and lab groups.';
149 HINT_OTHERS = 'Select other users to see their views or lab groups.'
150 + #13 + 'Use these for defining items to be displayed/saved as Views.';
151 HINT_BTN_DEFINITION = 'Click to display the definitions of all selections.'
152 + #13 + 'Definitions show the items that make up a view or lab group.'
153 + #13 + 'This includes views and lab groups of another user you have selected.';
[456]154 HINT_SELECTION = 'Select specific items and move them to the right.'
155 + #13 + 'Use the arrow buttons or double click.'
156 + #13 + 'Selecting a type <any> will use all patients for that type.';
157 HINT_DISPLAY = 'This is the list of items, types, and/or views that compose the View that will be graphed.'
158 + #13 + 'You can save this as a personal view by clicking the Save Personal button.';
159 HINT_BTN_ADDALL = 'Click to add all items for display.';
160 HINT_BTN_ADD1 = 'Click to add this item for display (or double-click item).';
161 HINT_BTN_REMOVE1 = 'Click to remove this item from display (or double-click item).';
162 HINT_BTN_REMOVEALL = 'Click to remove all items from display.';
163 HINT_BTN_CLEAR = 'Click to clear the Items and Items for Graphing lists.';
164 HINT_BTN_DELETE = 'Click to delete the selected view.';
165 HINT_BTN_RENAME = 'Click to rename the selected view.';
166 HINT_BTN_SAVE = 'Click to save your view.'
167 + #13 + 'You will give this view a name that can be selected from the graph.';
168 HINT_BTN_SAVE_PUB = 'Click to save a public view (available to editors only).'
169 + #13 + 'Public views can be selected by all users.';
170 HINT_APPLY = 'Select the section you where you want to display the graph.';
171 HINT_BTN_CLOSE = 'Click to display items for graphing.'
172 + #13 + 'Note: If you are using this from the Options menu, '
173 + #13 + 'items are not displayed (multiple graphs may be in use).'
174 + #13 + 'You should save any view definitions before closing this form.';
175
176 // hint messages for settings
177 SHINT_SOURCES = 'This is a list of all the types of data that can be graphed.'
178 + #13 + 'Check the types you wish to be selectable on the graph.'
179 + #13 + 'It is best to only check the types that you frequently use.'
180 + #13 + 'If you select a view on the graph that has types defined that are not checked,'
181 + #13 + 'that type of data will become automatically checked.'
182 + #13 + 'Note: Data is only selectable if the patient has that type of data';
183 SHINT_OPTIONS = 'Check options to change the appearance and behavior of the graph.'
184 + #13 + 'Common options are also available on the graph''s right-click menu';
185 SHINT_MAX = 'Enter the maximum number of graphs to appear on the screen.'
186 + #13 + 'This is used when individual graphs are displayed and'
187 + #13 + 'applies to both the top and bottom sections.'
188 + #13 + 'When the number of graphs exceeds this limited, the graphs are available by scrolling.';
189 SHINT_MIN = 'Enter the minimum height of a graph (this is in pixels).'
190 + #13 + 'This will depend on the size of your display.'
191 + #13 + 'This setting assures that at least this amount of height will appear on the graph.'
192 + #13 + 'Use in combination with Max Graphs in Display.';
193 SHINT_MAX_ITEMS = 'Enter the maximum number of items that can be graphed at one time.'
194 + #13 + 'This setting prevents you from mistakenly selecting a large number of items.';
[830]195 SHINT_OUTPT = 'Select the default date range when initially opening graphs.'
196 + #13 + 'This setting is used if the patient is currently an outpatient.';
197 SHINT_INPT = 'Select the default date range when initially opening graphs.'
198 + #13 + 'This setting is used if the patient is currently an inpatient.';
[456]199 SHINT_FUNCTIONS = 'These functions are restricted to editors for evaluation.';
200 SHINT_BTN_SHOW = 'Click these buttons to display default settings.';
201 SHINT_BTN_PER = 'Click to display your personal settings.';
202 SHINT_BTN_PUB = 'Click to display the default settings.'
203 + #13 + 'These settings are used when you have not saved a personal setting.';
204 SHINT_BTN_SAVE = 'Click these buttons to save default settings.';
205 SHINT_BTN_PERSAVE = 'Click to save your personal defaults';
206 SHINT_BTN_PUBSAVE = 'Click to save the public default (available to editors only).';
207 SHINT_BTN_ALL = 'Click to check all sources.';
208 SHINT_BTN_CLEAR = 'Click to uncheck all sources.';
209 SHINT_BTN_CLOSE = 'Click to display these settings for graphing.'
210 + #13 + 'To cancel any unsaved changes you''ve made, click the upper-right x box.'
211 + #13 + 'Note: If you are using this from the Options menu, '
212 + #13 + 'settings will not change your display (multiple graphs may be in use).'
213 + #13 + 'You should save any settings before closing this form.';
214
215function GraphSettingsInit(settings: string): TGraphSetting;
216
217implementation
218
219function GraphSettingsInit(settings: string): TGraphSetting;
220var
221 FGraphSetting: TGraphSetting;
222begin
223 FGraphSetting := TGraphSetting.Create;
224 with FGraphSetting do
225 begin
226 OptionSettings := Piece(settings, '|', 2);
227 SortColumn := strtointdef(Piece(settings, '|', 3), 0);
228 MaxGraphs := strtointdef(Piece(settings, '|', 4), 5);
229 MinGraphHeight := strtointdef(Piece(settings, '|', 5), 90);
230 MaxSelect := strtointdef(Piece(settings, '|', 7), 100);
231 MaxSelectMin := 1;
232 MaxSelectMax := strtointdef(Piece(settings, '|', 8), 1000);
233 Values := Pos(SETTING_VALUES, OptionSettings) > 0;
234 VerticalZoom := Pos(SETTING_VZOOM, OptionSettings) > 0;
235 HorizontalZoom := Pos(SETTING_HZOOM, OptionSettings) > 0;
236 View3D := Pos(SETTING_3D, OptionSettings) > 0;
237 Legend := Pos(SETTING_LEGEND, OptionSettings) > 0;
238 Dates := Pos(SETTING_DATES, OptionSettings) > 0;
239 Lines := Pos(SETTING_LINES, OptionSettings) > 0;
240 StayOnTop := Pos(SETTING_TOP, OptionSettings) > 0;
241 SortByType := Pos(SETTING_SORT, OptionSettings) > 0;
242 ClearBackground := Pos(SETTING_CLEAR, OptionSettings) > 0;
243 Gradient := Pos(SETTING_GRADIENT, OptionSettings) > 0;
244 Hints := Pos(SETTING_HINTS, OptionSettings) > 0;
245 FixedDateRange := Pos(SETTING_FIXED, OptionSettings) > 0;
246 HighTime := 0;
247 LowTime := BIG_NUMBER;
248 FMStartDate := FM_START_DATE;
249 FMStopDate := FM_STOP_DATE;
250 if SortByType then SortColumn := 1 else SortColumn := 0;
[830]251 DateRangeOutpatient := Piece(settings, '|', 9);
252 if DateRangeOutpatient = '' then DateRangeOutpatient := '8';
253 DateRangeInpatient := Piece(settings, '|', 10);
254 if DateRangeInpatient = '' then DateRangeInpatient := '8';
255 Turbo := Pos(SETTING_TURBO, OptionSettings) > 0;
256 if Piece(settings, '|', 6) = '0' then Turbo := false; // a 0 in 6th piece shuts down turbo for everyone
[456]257 end;
258 Result := FGraphSetting;
259end;
260
261end.
Note: See TracBrowser for help on using the repository browser.