[85] | 1 | ;+ |
---|
| 2 | ; NAME: |
---|
| 3 | ; FSC_PSCONFIG__DEFINE |
---|
| 4 | ; |
---|
| 5 | ; PURPOSE: |
---|
| 6 | ; |
---|
| 7 | ; The purpose of this program is to implement an object that |
---|
| 8 | ; can keep track of--and allow the user to change--the current |
---|
| 9 | ; configuration of the PostScript device. |
---|
| 10 | ; |
---|
| 11 | ; AUTHOR: |
---|
| 12 | ; |
---|
| 13 | ; FANNING SOFTWARE CONSULTING |
---|
| 14 | ; David Fanning, Ph.D. |
---|
| 15 | ; 1645 Sheely Drive |
---|
| 16 | ; Fort Collins, CO 80526 USA |
---|
| 17 | ; Phone: 970-221-0438 |
---|
| 18 | ; E-mail: davidf@dfanning.com |
---|
| 19 | ; Coyote's Guide to IDL Programming: http://www.dfanning.com/ |
---|
| 20 | ; |
---|
| 21 | ; CATEGORY: |
---|
| 22 | ; |
---|
| 23 | ; General programming. |
---|
| 24 | ; |
---|
| 25 | ; DOCUMENTATION: |
---|
| 26 | ; |
---|
| 27 | ; Complete documentation for the FSC_PSCONFIG object, including |
---|
| 28 | ; keyword and method descriptions, and example programs using the object |
---|
| 29 | ; can be found on the Coyote's Guide to IDL Programming web page: |
---|
| 30 | ; |
---|
| 31 | ; http://www.dfanning.com/programs/docs/fsc_psconfig.html |
---|
| 32 | ; |
---|
| 33 | ; Or, if you would prefer, you can download a self-contained PDF file: |
---|
| 34 | ; |
---|
| 35 | ; http://www.dfanning.com/programs/docs/fsc_psconfig.pdf |
---|
| 36 | ; |
---|
| 37 | ; KEYWORDS: |
---|
| 38 | ; |
---|
| 39 | ; Any keyword accepted by the FSC_PSCONFIG object can be used with |
---|
| 40 | ; this program. Here are a few of the most popular keywords. |
---|
| 41 | ; |
---|
| 42 | ; Bits_per_Pixel - The number of image bits saved for each image pixel: 2, 4, or 8. The default is 8. |
---|
| 43 | ; Color - Set this keyword to select Color PostScript output. Turned on by default. |
---|
| 44 | ; DefaultSetup - Set this keyword to the "name" of a default style. Current styles (you can easily |
---|
| 45 | ; create and add your own to the source code) are the following: |
---|
| 46 | ; |
---|
| 47 | ; "System (Portrait)" - The normal "default" system set-up. Also, "System". |
---|
| 48 | ; "System (Landscape)" - The normal "default" landscape system set-up. |
---|
| 49 | ; "Centered (Portrait)" - The window centered on the page. Also, "Center" or "Centered". |
---|
| 50 | ; "Centered (Landscape)" - The window centered on the landscape page. Also, "Landscape". |
---|
| 51 | ; "Square (Portrait)" - A square plot, centered on the page. |
---|
| 52 | ; "Square (Landscape)" - A square plot, centered on the landscape page. |
---|
| 53 | ; "Figure (Small)" - A small encapsulated figure size, centered on page. Also, "Encapsulated" or "Encapsulate". |
---|
| 54 | ; "Figure (Large)" - A larger encapsulated figure size, centered on page. Also, "Figure". |
---|
| 55 | ; "Color (Portrait)" - A "centered" plot, with color turned on. Also, "Color". |
---|
| 56 | ; "Color (Landscape)" - A "centered" landscape plot, with color turned on. |
---|
| 57 | ; |
---|
| 58 | ; Directory - Set this keyword to the name of the starting directory. The current directory is used by default. |
---|
| 59 | ; Encapsulate - Set this keyword to select Encapsulated PostScript output. Turned off by default. |
---|
| 60 | ; European - Set this keyword to indicate "european" mode (i.e., A4 page and centimeter units). Turned off by default. |
---|
| 61 | ; Filename - Set thie keyword to the name of the PostScript file. The default is "idl.ps". |
---|
| 62 | ; Inches - Set this keyword to indicate sizes and offsets are in inches as opposed to centimeters. Set by European keyword by default. |
---|
| 63 | ; Landscape - Set this keyword to select Landscape page output. Portrait page output is the default. |
---|
| 64 | ; PageType - Set this keyword to the "type" of page. Possible values are: |
---|
| 65 | ; "Letter" - 8.5 by 11 inches. (Default, unless the European keyword is set.) |
---|
| 66 | ; "Legal" - 8.5 by 14 inches. |
---|
| 67 | ; "Ledger" - 11 by 17 inches. |
---|
| 68 | ; "A4" - 21.0 by 29.7 centimeters. (Default, if the European keyword is set.) |
---|
| 69 | ; XOffset - Set this keyword to the X Offset. Uses "System (Portrait)" defaults. (Note: offset calculated from lower-left corner of page.) |
---|
| 70 | ; XSize - Set this keyword to the X size of the PostScript "window". Uses "System (Portrait)" defaults. |
---|
| 71 | ; YOffset - Set this keyword to the Y Offset. Uses "System (Portrait)" defaults. (Note: offset calculated from lower-left corner of page.) |
---|
| 72 | ; YSize - Set this keyword to the Y size of the PostScript "window". Uses "System (Portrait)" defaults. |
---|
| 73 | ; |
---|
| 74 | ; In addition, the following keywords can be used: |
---|
| 75 | ; |
---|
| 76 | ; CANCEL -- An output keyword that will be set to 1 if the user |
---|
| 77 | ; chooses the Cancel button on the form. It will be 0 otherwise. |
---|
| 78 | ; |
---|
| 79 | ; FONTINFO -- Set this keyword is you wish to have font information |
---|
| 80 | ; appear on the form. The default is to not include font information. |
---|
| 81 | ; |
---|
| 82 | ; FONTTYPE -- Set this keyword to a named variable that will indicate |
---|
| 83 | ; the user's preference for font type. Values will be -1 (Hershey fonts), |
---|
| 84 | ; 0 (hardware fonts), and 1 (true-type fonts). This keyword will always |
---|
| 85 | ; return -1 unless the FONTINFO keyword has also been set. |
---|
| 86 | ; |
---|
| 87 | ; GROUP_LEADER -- Set this keyword to a widget identifier of the widget |
---|
| 88 | ; you wish to be a group leader for this program. |
---|
| 89 | ; |
---|
| 90 | ; EXAMPLE: |
---|
| 91 | ; |
---|
| 92 | ; A simple sequence of using the object would look something like this: |
---|
| 93 | ; |
---|
| 94 | ; psObject = Obj_New("FSC_PSCONFIG") |
---|
| 95 | ; psObject->GUI |
---|
| 96 | ; psKeywords = psObject->GetKeywords() |
---|
| 97 | ; thisDevice = !D.Name |
---|
| 98 | ; Set_Plot, 'PS' |
---|
| 99 | ; Device, _Extra=psKeywords |
---|
| 100 | ; TVImage, image |
---|
| 101 | ; Device, /Close_File |
---|
| 102 | ; Set_Plot, thisDevice |
---|
| 103 | ; Obj_Destroy, psObject |
---|
| 104 | ; |
---|
| 105 | ; Note that the object can also be called from the PS_CONFIG interface: |
---|
| 106 | ; |
---|
| 107 | ; psKeywords = PSConfig() |
---|
| 108 | ; |
---|
| 109 | ; OTHER PROGRAMS NEEDED: |
---|
| 110 | ; |
---|
| 111 | ; The following programs are required to run this one: |
---|
| 112 | ; |
---|
| 113 | ; fsc_droplist.pro |
---|
| 114 | ; fsc_fileselect.pro |
---|
| 115 | ; fsc_field.pro |
---|
| 116 | ; fsc_plotwindow |
---|
| 117 | ; |
---|
| 118 | ; MODIFICATIONS: |
---|
| 119 | ; |
---|
| 120 | ; Written by David W. Fanning, 31 January 2000. |
---|
| 121 | ; Added capability to call GUI methods when the current graphics device |
---|
| 122 | ; doesn't support windows. Device is restored when the GUI exits. 11 May 2000. DWF. |
---|
| 123 | ; Changed the default value for the Color keyword to 1. 16 May 2000. DWF. |
---|
| 124 | ; Fixed a bug where filename changed when switching Setups. 8 AUG 2000. DWF. |
---|
| 125 | ; Fixed a bug when saving setup in Landscape mode. 8 AUG 2000. DWF. |
---|
| 126 | ; Added the ability to Get and Set the object's name via the SetProperty |
---|
| 127 | ; and a very abbreviated GetProperty method. Also added a GetName method. 26 SEP 2000. DWF. |
---|
| 128 | ; Fixed a problem in which the proper configuration was not restored if in Landscape mode. 20 Nov 2000. DWF. |
---|
| 129 | ; Made a number of modifications at the request of Martin Schultz. 4 Dec 2000. DWF. |
---|
| 130 | ; Fixed a bug when setting file and directory names with the SetProperty method. 18 Dec 2000. DWF. |
---|
| 131 | ; Fixed a small problem in initializing the page size properly. 3 Jan 2001. DWF. |
---|
| 132 | ; Corrected a problem that resulted from a change to FSC_DROPLIST. 6 Jan 2001. DWF. |
---|
| 133 | ; Added the ability to restore the font type instead of always reverting to !P.Font. 7 Jan 2001. DWF. |
---|
| 134 | ; Increased the length of the file/directory name fields. 7 Jan 2001. DWF. |
---|
| 135 | ; Fixed another problem with Landscape mode interacting with A4 paper size. 7 Jan 2001. DWF. |
---|
| 136 | ; Seems I only half fixed the previous problem. :-( 26 April 2001. DWF. |
---|
| 137 | ; Forgot to update program to reflect change in FSC_FIELD. Fixed 26 April 2001. DWF. |
---|
| 138 | ; Changed BOOKMAN keyword to BKMAN to avoid conflict with BOOKSTYLE keyword. 26 April 2001. DWF. |
---|
| 139 | ; Modified the System Defaults to say "None" if none is used. Improved documentation. 10 September 2001. DWF. |
---|
| 140 | ; Added the ability to specify a filename at the same time as a Default Setup. 10 September 2001. DWF. |
---|
| 141 | ; Fixed a small problem in not setting new page sizes appropriately. 22 May 2002. DWF. |
---|
| 142 | ; Fixed a problem that occurred when the Accept button was not named "Accept". 6 May 2003.DWF. |
---|
| 143 | ; Whoops! I was a bit overly agressive on that last fix. :-( 17 July 2003. DWF. |
---|
| 144 | ; Fixed a problem with setting page types when using the DEFAULTSETUP keyword. 31 July 2003. DWF. |
---|
| 145 | ; Fixed a problem with turning encapsulation on in the GUI. Renamed ENCAPSULATE keyword ENCAPSULATED |
---|
| 146 | ; to avoid obvious errors. 31 July 2003. DWF. |
---|
| 147 | ; Removed obsolete STR_SEP and replaced with STRSPLIT. 27 Oct 2004. DWF. |
---|
| 148 | ; Now honoring EUROPEAN keyword when setting system default setups in the INIT method. 12 Nov 2004. DWF. |
---|
| 149 | ; Added CMYK output option 24 August 2007. Assumes LANGUAGE_LEVEL=2 printer. L. Anderson. |
---|
| 150 | ; Fixed a problem with the filename on WINDOWS computers coming back with forward slashes instead of |
---|
| 151 | ; backward slashes. 20 May 2008. DWF. |
---|
| 152 | ;- |
---|
| 153 | ;########################################################################### |
---|
| 154 | ; |
---|
| 155 | ; LICENSE |
---|
| 156 | ; |
---|
| 157 | ; This software is OSI Certified Open Source Software. |
---|
| 158 | ; OSI Certified is a certification mark of the Open Source Initiative. |
---|
| 159 | ; |
---|
| 160 | ; Copyright (c) 2000-2008 Fanning Software Consulting |
---|
| 161 | ; |
---|
| 162 | ; This software is provided "as-is", without any express or |
---|
| 163 | ; implied warranty. In no event will the authors be held liable |
---|
| 164 | ; for any damages arising from the use of this software. |
---|
| 165 | ; |
---|
| 166 | ; Permission is granted to anyone to use this software for any |
---|
| 167 | ; purpose, including commercial applications, and to alter it and |
---|
| 168 | ; redistribute it freely, subject to the following restrictions: |
---|
| 169 | ; |
---|
| 170 | ; 1. The origin of this software must not be misrepresented; you must |
---|
| 171 | ; not claim you wrote the original software. If you use this software |
---|
| 172 | ; in a product, an acknowledgment in the product documentation |
---|
| 173 | ; would be appreciated, but is not required. |
---|
| 174 | ; |
---|
| 175 | ; 2. Altered source versions must be plainly marked as such, and must |
---|
| 176 | ; not be misrepresented as being the original software. |
---|
| 177 | ; |
---|
| 178 | ; 3. This notice may not be removed or altered from any source distribution. |
---|
| 179 | ; |
---|
| 180 | ; For more information on Open Source Software, visit the Open Source |
---|
| 181 | ; web site: http://www.opensource.org. |
---|
| 182 | ; |
---|
| 183 | ;########################################################################### |
---|
| 184 | ; |
---|
| 185 | |
---|
| 186 | |
---|
| 187 | FUNCTION FSC_PSCONFIG_RStrPos, Expr, SubStr, Pos |
---|
| 188 | |
---|
| 189 | ; This function finds the last occurance of a substring |
---|
| 190 | ; in a string. It was made obsolete in IDL 5.3. It is |
---|
| 191 | ; provided here for backwards compatibility. It normally |
---|
| 192 | ; resides in the IDL obsolete directory. |
---|
| 193 | |
---|
| 194 | ; PURPOSE: |
---|
| 195 | ; This function finds the last occurrence of a substring within |
---|
| 196 | ; an object string. If the substring is found in the expression, |
---|
| 197 | ; RSTRPOS returns the character position of the match, otherwise |
---|
| 198 | ; it returns -1. |
---|
| 199 | ; |
---|
| 200 | ; CATEGORY: |
---|
| 201 | ; String processing. |
---|
| 202 | ; |
---|
| 203 | ; CALLING SEQUENCE: |
---|
| 204 | ; Result = RSTRPOS(Expr, SubStr [, Pos]) |
---|
| 205 | ; |
---|
| 206 | ; INPUTS: |
---|
| 207 | ; Expr: The expression string in which to search for the substring. |
---|
| 208 | ; SubStr: The substring to search for. |
---|
| 209 | ; |
---|
| 210 | ; OPTIONAL INPUTS: |
---|
| 211 | ; Pos: The character position before which the search is begun. |
---|
| 212 | ; If Pos is omitted, the search begins at the last character |
---|
| 213 | ; of Expr. |
---|
| 214 | ; |
---|
| 215 | ; OUTPUTS: |
---|
| 216 | ; Returns the position of the substring, or -1 if the |
---|
| 217 | ; substring was not found within Expr. |
---|
| 218 | ; |
---|
| 219 | |
---|
| 220 | ON_ERROR, 2 |
---|
| 221 | N = N_PARAMS() |
---|
| 222 | if (n lt 2) then message, 'Incorrect number of arguments.' |
---|
| 223 | |
---|
| 224 | ; Is expr an array or a scalar? In either case, make a result |
---|
| 225 | ; that matches. |
---|
| 226 | if (size(expr, /n_dimensions) eq 0) then result = 0 $ |
---|
| 227 | else result = make_array(dimension=size(expr,/dimensions), /INT) |
---|
| 228 | |
---|
| 229 | RSubStr = STRING(REVERSE(BYTE(SubStr))) ; Reverse the substring |
---|
| 230 | |
---|
| 231 | for i = 0, n_elements(expr) - 1 do begin |
---|
| 232 | Len = STRLEN(Expr[i]) |
---|
| 233 | IF (N_ELEMENTS(Pos) EQ 0) THEN Start=0 ELSE Start = Len - Pos |
---|
| 234 | |
---|
| 235 | RString = STRING(REVERSE(BYTE(Expr[i]))) ; Reverse the string |
---|
| 236 | |
---|
| 237 | SubPos = STRPOS(RString, RSubStr, Start) |
---|
| 238 | IF SubPos NE -1 THEN SubPos = Len - SubPos - STRLEN(SubStr) |
---|
| 239 | result[i] = SubPos |
---|
| 240 | endfor |
---|
| 241 | |
---|
| 242 | RETURN, result |
---|
| 243 | END ;------------------------------------------------------------------------- |
---|
| 244 | |
---|
| 245 | |
---|
| 246 | |
---|
| 247 | PRO FSC_PSCONFIG_CenterTLB, tlb |
---|
| 248 | |
---|
| 249 | ; This procedure centers the given top-level base on the display. |
---|
| 250 | |
---|
| 251 | ; Get the screen size and find its center. |
---|
| 252 | |
---|
| 253 | screenSize = Get_Screen_Size() |
---|
| 254 | IF screenSize[0] GT 2000 THEN screenSize[0] = screenSize[0]/2 ; Dual monitors. |
---|
| 255 | xCenter = screenSize(0) / 2 |
---|
| 256 | yCenter = screenSize(1) / 2 |
---|
| 257 | |
---|
| 258 | ; Get the size of the widget program and calculate a half-size. |
---|
| 259 | |
---|
| 260 | geom = Widget_Info(tlb, /Geometry) |
---|
| 261 | xHalfSize = geom.Scr_XSize / 2 |
---|
| 262 | yHalfSize = geom.Scr_YSize / 2 |
---|
| 263 | |
---|
| 264 | ; Position the widget program on the display. |
---|
| 265 | |
---|
| 266 | Widget_Control, tlb, XOffset = xCenter-xHalfSize, $ |
---|
| 267 | YOffset = yCenter-yHalfSize |
---|
| 268 | |
---|
| 269 | END ;------------------------------------------------------------------------- |
---|
| 270 | |
---|
| 271 | |
---|
| 272 | |
---|
| 273 | FUNCTION FSC_PSCONFIG_Error_Message, theMessage, Traceback=traceback, $ |
---|
| 274 | NoName=noName |
---|
| 275 | |
---|
| 276 | ; Handles program errors. |
---|
| 277 | |
---|
| 278 | On_Error, 2 |
---|
| 279 | |
---|
| 280 | ; Check for presence and type of message. |
---|
| 281 | |
---|
| 282 | IF N_Elements(theMessage) EQ 0 THEN theMessage = !Error_State.Msg |
---|
| 283 | s = Size(theMessage) |
---|
| 284 | messageType = s[s[0]+1] |
---|
| 285 | IF messageType NE 7 THEN BEGIN |
---|
| 286 | Message, "The message parameter must be a string." |
---|
| 287 | ENDIF |
---|
| 288 | |
---|
| 289 | ; Get the call stack and the calling routine's name. |
---|
| 290 | |
---|
| 291 | Help, Calls=callStack |
---|
| 292 | callingRoutine = (StrSplit(StrCompress(callStack[1])," ", /Extract))[0] |
---|
| 293 | |
---|
| 294 | ; Are widgets supported? Doesn't matter in IDL 5.3 and higher. |
---|
| 295 | |
---|
| 296 | widgetsSupported = ((!D.Flags AND 65536L) NE 0) OR Float(!Version.Release) GE 5.3 |
---|
| 297 | IF widgetsSupported THEN BEGIN |
---|
| 298 | IF Keyword_Set(noName) THEN answer = Dialog_Message(theMessage) ELSE BEGIN |
---|
| 299 | IF StrUpCase(callingRoutine) EQ "$MAIN$" THEN answer = Dialog_Message(theMessage) ELSE $ |
---|
| 300 | answer = Dialog_Message(StrUpCase(callingRoutine) + ": " + theMessage) |
---|
| 301 | ENDELSE |
---|
| 302 | ENDIF ELSE BEGIN |
---|
| 303 | Message, theMessage, /Continue, /NoPrint, /NoName, /NoPrefix |
---|
| 304 | Print, '%' + callingRoutine + ': ' + theMessage |
---|
| 305 | answer = 'OK' |
---|
| 306 | ENDELSE |
---|
| 307 | |
---|
| 308 | ; Provide traceback information if requested. |
---|
| 309 | |
---|
| 310 | IF Keyword_Set(traceback) THEN BEGIN |
---|
| 311 | Help, /Last_Message, Output=traceback |
---|
| 312 | FOR j=0,N_Elements(traceback)-1 DO Print, traceback[j] |
---|
| 313 | ENDIF |
---|
| 314 | |
---|
| 315 | RETURN, answer |
---|
| 316 | END ;--------------------------------------------------------------------------------------------- |
---|
| 317 | |
---|
| 318 | |
---|
| 319 | |
---|
| 320 | PRO FSC_PSCONFIG_Events, event |
---|
| 321 | |
---|
| 322 | ; This is the main event hander for the program. Its purpose |
---|
| 323 | ; is to dispatch events to the appropriate event handler |
---|
| 324 | ; methods by parsing the user value of the widget causing |
---|
| 325 | ; the event. |
---|
| 326 | |
---|
| 327 | Catch, theError |
---|
| 328 | IF theError NE 0 THEN BEGIN |
---|
| 329 | Catch, /Cancel |
---|
| 330 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 331 | RETURN |
---|
| 332 | ENDIF |
---|
| 333 | |
---|
| 334 | ; Get the instructions from the widget causing the event and |
---|
| 335 | ; act on them. |
---|
| 336 | |
---|
| 337 | thisEvent = Tag_Names(event, /Structure_Name) |
---|
| 338 | CASE thisEvent OF |
---|
| 339 | |
---|
| 340 | 'FSC_DROPLIST_EVENT' : BEGIN |
---|
| 341 | Widget_Control, event.id, Get_UValue=instructions |
---|
| 342 | ENDCASE |
---|
| 343 | |
---|
| 344 | 'FSC_FIELD_EVENT': BEGIN |
---|
| 345 | Widget_Control, event.id, Get_UValue=instructions |
---|
| 346 | ENDCASE |
---|
| 347 | |
---|
| 348 | 'WIDGET_BUTTON': BEGIN |
---|
| 349 | Widget_Control, event.id, Get_UValue=instructions |
---|
| 350 | ENDCASE |
---|
| 351 | |
---|
| 352 | 'WIDGET_DRAW': BEGIN |
---|
| 353 | Widget_Control, event.id, Get_UValue=instructions |
---|
| 354 | ENDCASE |
---|
| 355 | |
---|
| 356 | ELSE: BEGIN ; FSC_PLOTWINDOW events. |
---|
| 357 | Widget_Control, event.id, Get_UValue=object |
---|
| 358 | instructions = object->GetUValue() |
---|
| 359 | ENDCASE |
---|
| 360 | |
---|
| 361 | ENDCASE |
---|
| 362 | |
---|
| 363 | ; Turn the status light to OFF, if necessary. |
---|
| 364 | |
---|
| 365 | IF instructions.method NE 'HELP' AND instructions.method NE 'REVERT' $ |
---|
| 366 | AND instructions.method NE 'ACCEPT' THEN instructions.object->StatusLight, 0 |
---|
| 367 | IF instructions.method NE 'NULL' THEN $ |
---|
| 368 | Call_Method, instructions.method, instructions.object, event |
---|
| 369 | |
---|
| 370 | END ;-------------------------------------------------------------------------------- |
---|
| 371 | |
---|
| 372 | |
---|
| 373 | |
---|
| 374 | FUNCTION FSC_PSCONFIG_Normalize, range, Position=position |
---|
| 375 | |
---|
| 376 | ; The program creates a scaling and translating factor for |
---|
| 377 | ; positioning objects in the view coordinate system. |
---|
| 378 | |
---|
| 379 | On_Error, 1 |
---|
| 380 | IF N_Params() EQ 0 THEN Message, 'Please pass range vector as argument.' |
---|
| 381 | |
---|
| 382 | IF (N_Elements(position) EQ 0) THEN position = [0.0, 1.0] ELSE $ |
---|
| 383 | position=Float(position) |
---|
| 384 | range = Float(range) |
---|
| 385 | |
---|
| 386 | scale = [((position[0]*range[1])-(position[1]*range[0])) / $ |
---|
| 387 | (range[1]-range[0]), (position[1]-position[0])/(range[1]-range[0])] |
---|
| 388 | |
---|
| 389 | RETURN, scale |
---|
| 390 | END ;------------------------------------------------------------------------- |
---|
| 391 | |
---|
| 392 | |
---|
| 393 | |
---|
| 394 | PRO FSC_PSCONFIG_Help_Event, event |
---|
| 395 | |
---|
| 396 | ; Destroy the HELP widget window. |
---|
| 397 | |
---|
| 398 | Widget_Control, event.top, /Destroy |
---|
| 399 | END ;-------------------------------------------------------------------------------- |
---|
| 400 | |
---|
| 401 | |
---|
| 402 | |
---|
| 403 | PRO FSC_PSCONFIG_Restore_Device, id |
---|
| 404 | Widget_Control, id, Get_UValue=thisDevice |
---|
| 405 | Set_Plot, thisDevice |
---|
| 406 | END ;-------------------------------------------------------------------------------- |
---|
| 407 | |
---|
| 408 | |
---|
| 409 | |
---|
| 410 | PRO FSC_PSCONFIG::Accept, event |
---|
| 411 | |
---|
| 412 | ; This method handles the event from the ACCEPT or APPLY buttons. |
---|
| 413 | |
---|
| 414 | Catch, theError |
---|
| 415 | IF theError NE 0 THEN BEGIN |
---|
| 416 | Catch, /Cancel |
---|
| 417 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 418 | RETURN |
---|
| 419 | ENDIF |
---|
| 420 | |
---|
| 421 | ; Get all the values from the form and load the appropriate |
---|
| 422 | ; self fields. |
---|
| 423 | |
---|
| 424 | self.cancel = 0 |
---|
| 425 | self.pageTypeSet = self.pageTypeID->GetSelection() |
---|
| 426 | self.landscapeSet = self.orientationID->GetIndex() |
---|
| 427 | self.inchesSet = self.unitsID->GetIndex() |
---|
| 428 | self.cmykSet = self.cmykID->GetIndex() |
---|
| 429 | self.colorSet = self.colorID->GetIndex() |
---|
| 430 | self.encapsulationSet = self.encapsulationID->GetIndex() |
---|
| 431 | self.previewSet = self.previewID->GetIndex() |
---|
| 432 | IF self.encapsulationSet EQ 0 THEN self.previewSet = 0 |
---|
| 433 | self.bitsSet = self.bitsID->GetSelection() |
---|
| 434 | |
---|
| 435 | IF N_Elements(self.xsizeID->Get_Value()) EQ 0 THEN BEGIN |
---|
| 436 | IF self.inchesSet THEN xsize = 1.0 ELSE xsize = 2.54 |
---|
| 437 | self.xsizeID->Set_Value, xsize |
---|
| 438 | ENDIF ELSE xsize = self.xsizeID->Get_Value() |
---|
| 439 | self.xsizeSet = xsize |
---|
| 440 | |
---|
| 441 | IF N_Elements(self.ysizeID->Get_Value()) EQ 0 THEN BEGIN |
---|
| 442 | IF self.inchesSet THEN ysize = 1.0 ELSE ysize = 2.54 |
---|
| 443 | self.ysizeID->Set_Value, ysize |
---|
| 444 | ENDIF ELSE ysize = self.ysizeID->Get_Value() |
---|
| 445 | self.ysizeSet = ysize |
---|
| 446 | |
---|
| 447 | IF N_Elements(self.xoffsetID->Get_Value()) EQ 0 THEN BEGIN |
---|
| 448 | xoffset = 0.0 |
---|
| 449 | self.xoffsetID->Set_Value, xoffset |
---|
| 450 | ENDIF ELSE xoffset = self.xoffsetID->Get_Value() |
---|
| 451 | self.xoffsetSet = xoffset |
---|
| 452 | |
---|
| 453 | IF N_Elements(self.yoffsetID->Get_Value()) EQ 0 THEN BEGIN |
---|
| 454 | yoffset = 0.0 |
---|
| 455 | self.yoffsetID->Set_Value, yoffset |
---|
| 456 | ENDIF ELSE yoffset = self.yoffsetID->Get_Value() |
---|
| 457 | self.yoffsetSet = yoffset |
---|
| 458 | |
---|
| 459 | self.plotID->SetWindowLocation, xsize, ysize, xoffset, yoffset |
---|
| 460 | |
---|
| 461 | ; Get the font information if it is on the form. |
---|
| 462 | |
---|
| 463 | IF self.fontInfo THEN BEGIN |
---|
| 464 | ;fonttype = self.fontTypeID->GetIndex() |
---|
| 465 | ;self.fonttypeSet = fonttype - 1 |
---|
| 466 | self.fontsizeSet = self.fontsizeID->GetSelection() |
---|
| 467 | |
---|
| 468 | values = self.fontnameID->GetValues() |
---|
| 469 | selection = self.fontnameID->GetSelection() |
---|
| 470 | index = Where(StrUpCase(values) EQ StrUpCase(selection)) |
---|
| 471 | FOR j=1,7 DO BEGIN |
---|
| 472 | cmd = "self." + values[j] + " = 0" |
---|
| 473 | ok = Execute(cmd) |
---|
| 474 | IF NOT ok THEN ok = Dialog_Message("Problem executing statment: " + cmd) |
---|
| 475 | ENDFOR |
---|
| 476 | IF index[0] NE 0 THEN ok = Execute("self." + values[index[0]] + " = 1") |
---|
| 477 | self.fontnameSet = values[index[0]] |
---|
| 478 | |
---|
| 479 | self.isolatinSet = self.isolatinID->GetIndex() |
---|
| 480 | IF Obj_Valid(self.set_fontID) THEN self.set_fontSet = self.Set_FontID->Get_Value() |
---|
| 481 | self.truetypeSet = self.truetypeID->GetIndex() |
---|
| 482 | self.fontTypeSet = self.fontTypeID->GetIndex() - 1 |
---|
| 483 | ENDIF |
---|
| 484 | |
---|
| 485 | ; Get the filename information. |
---|
| 486 | |
---|
| 487 | self.filenameID->GetProperty, File=filename, Directory=directory |
---|
| 488 | self.filenameSet = filename |
---|
| 489 | self.directorySet = directory |
---|
| 490 | self.fullFilenameSet=self.filenameID->GetFileName() |
---|
| 491 | |
---|
| 492 | ; If this is WINDOWS, then forward slashes need to be converted to backward slashes. |
---|
| 493 | |
---|
| 494 | IF StrUpCase(!Version.OS_FAMILY) EQ 'WINDOWS' THEN BEGIN |
---|
| 495 | self.directorySet = StrJoin( StrSplit(self.directorySet, '/', /Regex, /Extract, /Preserve_Null), '\') |
---|
| 496 | self.fullFilenameSet = StrJoin( StrSplit(self.fullFilenameSet, '/', /Regex, /Extract, /Preserve_Null), '\') |
---|
| 497 | ENDIF |
---|
| 498 | |
---|
| 499 | ; Set the status light if this is the APPLY button |
---|
| 500 | |
---|
| 501 | Widget_Control, event.id, Get_UValue=buttonInfo |
---|
| 502 | IF N_Elements(buttonInfo) NE 0 THEN $ |
---|
| 503 | IF buttonInfo.method EQ 'APPLY' THEN self->StatusLight, 1 |
---|
| 504 | |
---|
| 505 | ; Save this configuration. |
---|
| 506 | |
---|
| 507 | self->SaveConfiguration |
---|
| 508 | |
---|
| 509 | ; Destroy the widget if this is a modal widget. |
---|
| 510 | |
---|
| 511 | IF N_Elements(buttonInfo) NE 0 THEN $ |
---|
| 512 | IF buttonInfo.method EQ 'ACCEPT' AND Widget_Info(self.tlb, /Valid_ID) THEN BEGIN |
---|
| 513 | Widget_Control, self.tlb, /Destroy |
---|
| 514 | self.noblock = 0 |
---|
| 515 | ENDIF |
---|
| 516 | |
---|
| 517 | END ;-------------------------------------------------------------------------------- |
---|
| 518 | |
---|
| 519 | |
---|
| 520 | |
---|
| 521 | PRO FSC_PSCONFIG::Cancel, event |
---|
| 522 | |
---|
| 523 | ; If the cancel button was clicked, set the cancel flag to 1 and |
---|
| 524 | ; destroy the widget. |
---|
| 525 | |
---|
| 526 | self.cancel = 1 |
---|
| 527 | self.noblock = 0 |
---|
| 528 | Widget_Control, event.top, /Destroy |
---|
| 529 | END ;-------------------------------------------------------------------------------- |
---|
| 530 | |
---|
| 531 | |
---|
| 532 | |
---|
| 533 | PRO FSC_PSCONFIG::ClearStyles, event |
---|
| 534 | |
---|
| 535 | ; This event handler method responds to the Clear button by setting |
---|
| 536 | ; turning all the font style buttons off.. |
---|
| 537 | |
---|
| 538 | self->UpDateFontStyle, /Clear |
---|
| 539 | END ;-------------------------------------------------------------------------------- |
---|
| 540 | |
---|
| 541 | |
---|
| 542 | |
---|
| 543 | PRO FSC_PSCONFIG::Color, event |
---|
| 544 | |
---|
| 545 | ; This event handler method responds to changes in the Color droplist. |
---|
| 546 | |
---|
| 547 | |
---|
| 548 | self.plotID->SetColor, event.index |
---|
| 549 | |
---|
| 550 | ; Set sensitivity of cmyk button |
---|
| 551 | |
---|
| 552 | self.cmykID->Sensitive, event.index |
---|
| 553 | END ;-------------------------------------------------------------------------------- |
---|
| 554 | |
---|
| 555 | |
---|
| 556 | |
---|
| 557 | FUNCTION FSC_PSCONFIG::Construct_Full_Filename |
---|
| 558 | |
---|
| 559 | ; This method returns the fully-qualified filename. Checks to be |
---|
| 560 | ; sure the last character in the directory name is not a directory |
---|
| 561 | ; specifier. |
---|
| 562 | |
---|
| 563 | Catch, theError |
---|
| 564 | IF theError NE 0 THEN BEGIN |
---|
| 565 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 566 | RETURN, "" |
---|
| 567 | ENDIF |
---|
| 568 | |
---|
| 569 | ; Get the correct directory separator. |
---|
| 570 | |
---|
| 571 | CASE StrUpCase(!Version.OS_Family) OF |
---|
| 572 | 'WINDOWS' : sep = '\' ; PCs |
---|
| 573 | 'MACOS' : sep = ':' ; Macintoshes |
---|
| 574 | 'VMS' : sep = ']' ; VMS machines |
---|
| 575 | ELSE : sep = '/' ; Unix machines |
---|
| 576 | ENDCASE |
---|
| 577 | |
---|
| 578 | IF StrUpCase(!Version.OS_Family) NE "VMS" THEN BEGIN |
---|
| 579 | length = StrLen(self.directorySet) |
---|
| 580 | WHILE StrMid(self.directorySet, length-1, 1) EQ sep DO BEGIN |
---|
| 581 | self.directorySet = StrMid(self.directorySet, 0, length-1) |
---|
| 582 | length = StrLen(self.directorySet) |
---|
| 583 | ENDWHILE |
---|
| 584 | ENDIF |
---|
| 585 | |
---|
| 586 | RETURN, Filepath(Root_Dir=self.directorySet, self.filenameSet) |
---|
| 587 | END ;------------------------------------------------------------------------------- |
---|
| 588 | |
---|
| 589 | |
---|
| 590 | |
---|
| 591 | FUNCTION FSC_PSCONFIG::DefaultList |
---|
| 592 | |
---|
| 593 | ; This method defines the default settings values in the Defaults droplist. |
---|
| 594 | ; To add your own defaults, start by adding the new default name here. Then |
---|
| 595 | ; add your default setup to the SetDefault method below. |
---|
| 596 | |
---|
| 597 | defaultlist = [ 'None', $ |
---|
| 598 | 'System (Portrait)', $ |
---|
| 599 | 'System (Landscape)', $ |
---|
| 600 | 'Centered (Portrait)', $ |
---|
| 601 | 'Centered (Landscape)', $ |
---|
| 602 | 'Square (Portrait)', $ |
---|
| 603 | 'Square (Landscape)', $ |
---|
| 604 | 'Figure (Small)', $ |
---|
| 605 | 'Figure (Large)', $ |
---|
| 606 | 'Color (Portrait)', $ |
---|
| 607 | 'Color (Landscape)' ] |
---|
| 608 | |
---|
| 609 | RETURN, defaultList |
---|
| 610 | END ;-------------------------------------------------------------------------------- |
---|
| 611 | |
---|
| 612 | |
---|
| 613 | |
---|
| 614 | PRO FSC_PSCONFIG::Defaults, event |
---|
| 615 | |
---|
| 616 | ; This event handler method responds to changes in the Defaults droplist. |
---|
| 617 | |
---|
| 618 | self->SetDefault, *event.selection |
---|
| 619 | END ;-------------------------------------------------------------------------------- |
---|
| 620 | |
---|
| 621 | |
---|
| 622 | |
---|
| 623 | PRO FSC_PSCONFIG::Encapsulate, event |
---|
| 624 | |
---|
| 625 | ; This method responds to a change in the Encapsulation droplist widget. |
---|
| 626 | |
---|
| 627 | IF event.index THEN self.previewID->Sensitive, 1 ELSE self.previewID->Sensitive, 0 |
---|
| 628 | END ;-------------------------------------------------------------------------------- |
---|
| 629 | |
---|
| 630 | |
---|
| 631 | |
---|
| 632 | PRO FSC_PSCONFIG::FontType, event |
---|
| 633 | |
---|
| 634 | ; This event handler method responds to changes in the Font Type droplist. |
---|
| 635 | |
---|
| 636 | Catch, theError |
---|
| 637 | IF theError NE 0 THEN BEGIN |
---|
| 638 | Catch, /Cancel |
---|
| 639 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 640 | RETURN |
---|
| 641 | ENDIF |
---|
| 642 | |
---|
| 643 | ; Font styles, etc. can only be on if hardware or |
---|
| 644 | ; true-type fonts are selected. |
---|
| 645 | |
---|
| 646 | CASE event.index OF |
---|
| 647 | |
---|
| 648 | 0: BEGIN |
---|
| 649 | Widget_Control, self.fontnameID->GetID(), Sensitive=0 |
---|
| 650 | Widget_Control, self.stylebaseID, Sensitive=0 |
---|
| 651 | Widget_Control, self.clearbuttonID, Sensitive=0 |
---|
| 652 | Widget_Control, self.fontSizeID->GetID(), Sensitive=0 |
---|
| 653 | Widget_Control, self.truetypeID->GetID(), Sensitive=0 |
---|
| 654 | Widget_Control, self.isolatinID->GetID(), Sensitive=0 |
---|
| 655 | IF Obj_Valid(self.set_fontID) THEN Widget_Control, self.set_fontID->GetID(), Sensitive=0 |
---|
| 656 | ENDCASE |
---|
| 657 | |
---|
| 658 | ELSE: BEGIN |
---|
| 659 | Widget_Control, self.fontnameID->GetID(), Sensitive=1 |
---|
| 660 | Widget_Control, self.stylebaseID, Sensitive=1 |
---|
| 661 | Widget_Control, self.clearbuttonID, Sensitive=1 |
---|
| 662 | Widget_Control, self.fontSizeID->GetID(), Sensitive=1 |
---|
| 663 | Widget_Control, self.truetypeID->GetID(), Sensitive=1 |
---|
| 664 | Widget_Control, self.isolatinID->GetID(), Sensitive=1 |
---|
| 665 | IF Obj_Valid(self.set_fontID) THEN Widget_Control, self.set_fontID->GetID(), Sensitive=1 |
---|
| 666 | ENDCASE |
---|
| 667 | |
---|
| 668 | ENDCASE |
---|
| 669 | |
---|
| 670 | fontname = *event.selection |
---|
| 671 | CASE StrUpCase(fontname) OF |
---|
| 672 | "TRUE-TYPE": BEGIN |
---|
| 673 | self.truetypeID->SetIndex, 1 |
---|
| 674 | self.trueTypeSet = 1 |
---|
| 675 | self.fontTypeSet = 1 |
---|
| 676 | ENDCASE |
---|
| 677 | "HARDWARE" : BEGIN |
---|
| 678 | self.trueTypeSet = 0 |
---|
| 679 | self.fontTypeSet = 0 |
---|
| 680 | ENDCASE |
---|
| 681 | ELSE: BEGIN |
---|
| 682 | self.trueTypeSet = 0 |
---|
| 683 | self.fontTypeSet = -1 |
---|
| 684 | self.truetypeID->SetIndex, 0 |
---|
| 685 | ENDCASE |
---|
| 686 | ENDCASE |
---|
| 687 | |
---|
| 688 | END ;-------------------------------------------------------------------------------- |
---|
| 689 | |
---|
| 690 | |
---|
| 691 | |
---|
| 692 | PRO FSC_PSCONFIG::EuroStyle, event |
---|
| 693 | |
---|
| 694 | ; This event handler sets and unset the "European Style" button. |
---|
| 695 | |
---|
| 696 | IF event.select EQ 1 THEN BEGIN |
---|
| 697 | |
---|
| 698 | Widget_Control, event.top, Update=0 |
---|
| 699 | self.european = 1 |
---|
| 700 | IF self.inchesSet EQ 1 THEN BEGIN |
---|
| 701 | sizes = self->GetSizes() |
---|
| 702 | self.xsizeSet = sizes[0] * 2.54 |
---|
| 703 | self.ysizeSet = sizes[1] * 2.54 |
---|
| 704 | self.xoffsetSet = sizes[2] * 2.54 |
---|
| 705 | self.yoffsetSet = sizes[3] * 2.54 |
---|
| 706 | ENDIF |
---|
| 707 | self.inchesSet = 0 |
---|
| 708 | self.pageTypeSet = 'A4' |
---|
| 709 | self.plotID->SetUnits, 'Centimeters' |
---|
| 710 | Widget_Control, event.top, Update=1 |
---|
| 711 | |
---|
| 712 | ENDIF ELSE BEGIN |
---|
| 713 | |
---|
| 714 | Widget_Control, event.top, Update=0 |
---|
| 715 | self.european = 0 |
---|
| 716 | IF self.inchesSet EQ 0 THEN BEGIN |
---|
| 717 | sizes = self->GetSizes() |
---|
| 718 | self.xsizeSet = sizes[0] / 2.54 |
---|
| 719 | self.ysizeSet = sizes[1] / 2.54 |
---|
| 720 | self.xoffsetSet = sizes[2] / 2.54 |
---|
| 721 | self.yoffsetSet = sizes[3] / 2.54 |
---|
| 722 | self.inchesSet = 1 |
---|
| 723 | self.pageTypeSet = 'LETTER' |
---|
| 724 | self.plotID->SetUnits, 'Inches' |
---|
| 725 | Widget_Control, event.top, Update=1 |
---|
| 726 | |
---|
| 727 | ENDIF |
---|
| 728 | |
---|
| 729 | ENDELSE |
---|
| 730 | self->UpdateDisplay |
---|
| 731 | self.plotID->CenterPlot |
---|
| 732 | END ;-------------------------------------------------------------------------------- |
---|
| 733 | |
---|
| 734 | |
---|
| 735 | |
---|
| 736 | FUNCTION FSC_PSCONFIG::GetKeywords, FontType=fonttype |
---|
| 737 | |
---|
| 738 | ; This method creates and returns a structure with the PostScript Device |
---|
| 739 | ; keywords as fields in the structure. |
---|
| 740 | |
---|
| 741 | Catch, theError |
---|
| 742 | IF theError NE 0 THEN BEGIN |
---|
| 743 | Catch, /Cancel |
---|
| 744 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 745 | RETURN, {Cancel:1} |
---|
| 746 | ENDIF |
---|
| 747 | |
---|
| 748 | ; I am shielding the user from the strangeness of PostScript |
---|
| 749 | ; Landscape mode, in which the X and Y offsets are rotated |
---|
| 750 | ; 180 degrees. Thus, in the form, the offsets are calculated from |
---|
| 751 | ; the lower-left corner in both Landscape and Portrait mode. |
---|
| 752 | ; This means I have to monkey around to get the proper offsets |
---|
| 753 | ; if the form is in Landscape mode. |
---|
| 754 | |
---|
| 755 | IF self.landscapeSet EQ 1 THEN BEGIN |
---|
| 756 | pageDims = self->PageDimensions() |
---|
| 757 | ; Switch x and y offsets |
---|
| 758 | yoffset = pageDims[1] - self.xoffsetSet |
---|
| 759 | xoffset = self.yoffsetSet |
---|
| 760 | ENDIF ELSE BEGIN |
---|
| 761 | xoffset = self.xoffsetSet |
---|
| 762 | yoffset = self.yoffsetSet |
---|
| 763 | ENDELSE |
---|
| 764 | |
---|
| 765 | ; Create the basic structure. |
---|
| 766 | |
---|
| 767 | struct = { $ |
---|
| 768 | bits_per_pixel: Fix(self.bitsSet), $ |
---|
| 769 | cmyk: self.cmykSet, $ |
---|
| 770 | color: self.colorSet, $ |
---|
| 771 | encapsulated: self.encapsulationSet, $ |
---|
| 772 | filename: self.fullfilenameSet, $ |
---|
| 773 | font_size: Fix(self.fontSizeSet), $ |
---|
| 774 | inches: self.inchesSet, $ |
---|
| 775 | isolatin1: self.isolatinSet, $ |
---|
| 776 | preview: self.previewSet, $ |
---|
| 777 | tt_font: self.truetypeSet, $ |
---|
| 778 | xoffset: xoffset, $ |
---|
| 779 | xsize: self.xsizeSet, $ |
---|
| 780 | yoffset: yoffset, $ |
---|
| 781 | ysize: self.ysizeSet } |
---|
| 782 | |
---|
| 783 | ; Addition of CMYK keyword implies LANGUAGE_LEVEL keyword set to 2. |
---|
| 784 | |
---|
| 785 | IF self.cmykSet THEN struct = Create_Struct(struct, 'language_level', 2) $ |
---|
| 786 | ELSE struct = Create_Struct(struct, 'language_level', 1) |
---|
| 787 | |
---|
| 788 | ; Return the font type information to the user. |
---|
| 789 | |
---|
| 790 | fonttype = self.fonttypeSet |
---|
| 791 | |
---|
| 792 | ; Depending upon which widgets are set, we have to add |
---|
| 793 | ; additional fields to the structure. |
---|
| 794 | |
---|
| 795 | IF self.landscapeSet THEN BEGIN |
---|
| 796 | struct = Create_Struct(struct, 'landscape', 1) |
---|
| 797 | struct = Create_Struct(struct, 'portrait', 0) |
---|
| 798 | ENDIF ELSE BEGIN |
---|
| 799 | struct = Create_Struct(struct, 'portrait', 1) |
---|
| 800 | struct = Create_Struct(struct, 'landscape', 0) |
---|
| 801 | ENDELSE |
---|
| 802 | IF self.set_fontSet NE "" THEN struct = Create_Struct(struct, 'set_font', self.set_font) |
---|
| 803 | |
---|
| 804 | ; What about font keywords? |
---|
| 805 | |
---|
| 806 | IF self.avantgarde THEN struct = Create_Struct(struct, 'avantgarde', 1) |
---|
| 807 | IF self.bookman THEN struct = Create_Struct(struct, 'bkman', 1) |
---|
| 808 | IF self.courier THEN struct = Create_Struct(struct, 'courier', 1) |
---|
| 809 | IF self.helvetica THEN struct = Create_Struct(struct, 'helvetica', 1) |
---|
| 810 | IF self.palatino THEN struct = Create_Struct(struct, 'palatino', 1) |
---|
| 811 | IF self.schoolbook THEN struct = Create_Struct(struct, 'schoolbook', 1) |
---|
| 812 | IF self.symbol THEN struct = Create_Struct(struct, 'symbol', 1) |
---|
| 813 | IF self.times THEN struct = Create_Struct(struct, 'times', 1) |
---|
| 814 | IF self.zapfdingbats THEN struct = Create_Struct(struct, 'zapfdingbats', 1) |
---|
| 815 | IF self.zapfchancery THEN struct = Create_Struct(struct, 'zapfchancery', 1) |
---|
| 816 | |
---|
| 817 | ; What about style keywords? |
---|
| 818 | |
---|
| 819 | IF self.fontStyleSet[0] THEN struct = Create_Struct(struct, 'bold', 1) ELSE struct = Create_Struct(struct, 'bold', 0) |
---|
| 820 | IF self.fontStyleSet[1] THEN struct = Create_Struct(struct, 'book', 1) ELSE struct = Create_Struct(struct, 'book', 0) |
---|
| 821 | IF self.fontStyleSet[2] THEN struct = Create_Struct(struct, 'demi', 1) ELSE struct = Create_Struct(struct, 'demi', 0) |
---|
| 822 | IF self.fontStyleSet[3] THEN struct = Create_Struct(struct, 'italic', 1) ELSE struct = Create_Struct(struct, 'italic', 0) |
---|
| 823 | IF self.fontStyleSet[4] THEN struct = Create_Struct(struct, 'light', 1) ELSE struct = Create_Struct(struct, 'light', 0) |
---|
| 824 | IF self.fontStyleSet[5] THEN struct = Create_Struct(struct, 'medium', 1) ELSE struct = Create_Struct(struct, 'medium', 0) |
---|
| 825 | IF self.fontStyleSet[6] THEN struct = Create_Struct(struct, 'narrow', 1) ELSE struct = Create_Struct(struct, 'narrow', 0) |
---|
| 826 | IF self.fontStyleSet[7] THEN struct = Create_Struct(struct, 'oblique', 1) ELSE struct = Create_Struct(struct, 'oblique', 0) |
---|
| 827 | |
---|
| 828 | ; Return the keyword stucture. |
---|
| 829 | |
---|
| 830 | RETURN, struct |
---|
| 831 | END ;-------------------------------------------------------------------------------- |
---|
| 832 | |
---|
| 833 | |
---|
| 834 | |
---|
| 835 | |
---|
| 836 | FUNCTION FSC_PSConfig::GetName |
---|
| 837 | |
---|
| 838 | ; This method returns the "name" of the object. |
---|
| 839 | |
---|
| 840 | RETURN, self.name |
---|
| 841 | END ;-------------------------------------------------------------------------------- |
---|
| 842 | |
---|
| 843 | |
---|
| 844 | |
---|
| 845 | PRO FSC_PSConfig::GetProperty, Name=name, _Extra=extra |
---|
| 846 | |
---|
| 847 | ; This GetProperty method is set up only to be able to obtain |
---|
| 848 | ; the name of the object. This makes the object compatible with |
---|
| 849 | ; Martin Shultz's container object. All other keywords are swallowed |
---|
| 850 | ; silently. Note that the GetName method can also be used. |
---|
| 851 | |
---|
| 852 | name = self.name |
---|
| 853 | END ;-------------------------------------------------------------------------------- |
---|
| 854 | |
---|
| 855 | |
---|
| 856 | |
---|
| 857 | FUNCTION FSC_PSCONFIG::GetSizes |
---|
| 858 | |
---|
| 859 | RETURN, [self.xsizeID->Get_Value(), self.ysizeID->Get_Value(), $ |
---|
| 860 | self.xoffsetID->Get_Value(), self.yoffsetID->Get_Value()] |
---|
| 861 | END ;-------------------------------------------------------------------------------- |
---|
| 862 | |
---|
| 863 | |
---|
| 864 | |
---|
| 865 | PRO FSC_PSCONFIG::GUI, Group_Leader=leader, NoBlock=noblock, Cancel=cancel, $ |
---|
| 866 | FontInfo=fontinfo, Accept_Button_Name=acceptButtonName, FontType=fonttype |
---|
| 867 | |
---|
| 868 | ; This method displays the graphical user interface without font information. |
---|
| 869 | |
---|
| 870 | Catch, theError |
---|
| 871 | IF theError NE 0 THEN BEGIN |
---|
| 872 | Catch, /Cancel |
---|
| 873 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 874 | RETURN |
---|
| 875 | ENDIF |
---|
| 876 | |
---|
| 877 | ; Can't run this program in a device that doesn't support windows. |
---|
| 878 | |
---|
| 879 | self.thisDevice = !D.Name |
---|
| 880 | IF (!D.Flags AND 256) EQ 0 THEN BEGIN |
---|
| 881 | thisOS = StrUpCase(!Version.OS_Family) |
---|
| 882 | CASE thisOS OF |
---|
| 883 | 'MACOS': Set_Plot, 'Mac' |
---|
| 884 | 'WINDOWS': Set_Plot, 'Win' |
---|
| 885 | ELSE: Set_Plot, 'X' |
---|
| 886 | ENDCASE |
---|
| 887 | ENDIF |
---|
| 888 | |
---|
| 889 | ; If the user wants font information, then call the GUIFont method. |
---|
| 890 | |
---|
| 891 | IF Keyword_Set(fontinfo) THEN BEGIN |
---|
| 892 | self->GUIFont, Group_Leader=leader, NoBlock=noblock, Cancel=cancel, $ |
---|
| 893 | Accept_Button_Name=acceptButtonName, FontType=fonttype |
---|
| 894 | RETURN |
---|
| 895 | ENDIF |
---|
| 896 | |
---|
| 897 | IF N_Elements(acceptButtonName) EQ 0 THEN BEGIN |
---|
| 898 | IF Keyword_Set(noblock) THEN BEGIN |
---|
| 899 | acceptButtonName = 'Apply' |
---|
| 900 | ENDIF ELSE BEGIN |
---|
| 901 | acceptButtonName = 'Accept' |
---|
| 902 | ENDELSE |
---|
| 903 | ENDIF |
---|
| 904 | |
---|
| 905 | ; Only one GUI at a time with the same name. |
---|
| 906 | |
---|
| 907 | IF XRegistered('fsc_psconfig_' + self.name) GT 0 THEN RETURN |
---|
| 908 | |
---|
| 909 | ;Set default values. |
---|
| 910 | |
---|
| 911 | self.fontInfo = 0 |
---|
| 912 | CW_FIELD_SIZE = 5 |
---|
| 913 | IF Keyword_Set(noblock) THEN BEGIN |
---|
| 914 | cancelButVal = 'Dismiss' |
---|
| 915 | ENDIF ELSE BEGIN |
---|
| 916 | cancelButVal = 'Cancel' |
---|
| 917 | ENDELSE |
---|
| 918 | |
---|
| 919 | self.fontTypeSet = !P.Font |
---|
| 920 | IF Keyword_Set(noblock) THEN self.cancel = 0 ELSE self.cancel = 1 |
---|
| 921 | |
---|
| 922 | ; Modal TLB if possible. |
---|
| 923 | |
---|
| 924 | IF self.name NE "" THEN tlbTitle = self.name + ": Configure PostScript Device" ELSE $ |
---|
| 925 | tlbTitle = "Configure PostScript Device" |
---|
| 926 | |
---|
| 927 | IF N_Elements(leader) EQ 0 OR Keyword_Set(noblock) THEN BEGIN |
---|
| 928 | tlb = Widget_Base(Title=tlbTitle, Column=1, Base_Align_Center=1) |
---|
| 929 | ENDIF ELSE BEGIN |
---|
| 930 | tlb = Widget_Base(Title=tlbTitle, Column=1, $ |
---|
| 931 | Base_Align_Center=1, Group_Leader=leader, /Modal) |
---|
| 932 | ENDELSE |
---|
| 933 | |
---|
| 934 | self.tlb = tlb |
---|
| 935 | |
---|
| 936 | ; Widget sub-bases. |
---|
| 937 | |
---|
| 938 | topBase = Widget_Base(tlb, Row=1, UValue=self.thisDevice, Kill_Notify='FSC_PSConfig_Restore_Device') |
---|
| 939 | leftTopBase = Widget_Base(topBase, Column=1) |
---|
| 940 | controlBase = Widget_Base(leftTopBase, Column=1, /Frame) |
---|
| 941 | euroBase = Widget_Base(leftTopBase, row=1, /NonExclusive) |
---|
| 942 | rightTopBase = Widget_Base(topBase, Column=1, Base_Align_Center=1, Frame=1) |
---|
| 943 | sizebase = Widget_Base(rightTopBase, Column=2) |
---|
| 944 | middleTopBase = Widget_Base(topBase, Column=1, Base_Align_Center=1) |
---|
| 945 | actionBase = Widget_Base(tlb, Row=1, Base_Align_Center=1) |
---|
| 946 | |
---|
| 947 | ; Create droplist widgets. |
---|
| 948 | |
---|
| 949 | values = ['Letter', 'A4', 'Legal', 'Ledger'] |
---|
| 950 | self.pageTypeID = FSC_Droplist(controlBase, Value=values, Title='Page Size:', $ |
---|
| 951 | UValue={Method:'PageSize', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 952 | self.pageTypeID->SetSelection, self.pageTypeSet |
---|
| 953 | self.pagetype = self.pageTypeSet |
---|
| 954 | |
---|
| 955 | values = ['Portrait', 'Landscape'] |
---|
| 956 | self.orientationID = FSC_Droplist(controlBase, Value=values, Title='Orientation:', $ |
---|
| 957 | UValue={Method:'Orientation', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 958 | self.orientationID->SetIndex, self.landscapeSet |
---|
| 959 | |
---|
| 960 | values = ['Centimeters', 'Inches'] |
---|
| 961 | self.unitsID = FSC_Droplist(controlBase, Value=values, Title='Units:', $ |
---|
| 962 | UValue={Method:'Units', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 963 | self.unitsID->SetIndex, self.inchesSet |
---|
| 964 | |
---|
| 965 | values = ['Off', 'On'] |
---|
| 966 | self.encapsulationID = FSC_Droplist(controlBase, Value=values, Title='Encapsulation:', $ |
---|
| 967 | UValue={Method:'ENCAPSULATE', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 968 | self.encapsulationID->SetIndex, self.encapsulationSet |
---|
| 969 | |
---|
| 970 | values = ['None', 'EPSI', 'EPSF'] |
---|
| 971 | self.previewID = FSC_Droplist(controlBase, Value=values, Title='Preview Mode:', $ |
---|
| 972 | UValue={Method:'NULL', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 973 | self.previewID->SetIndex, self.previewSet |
---|
| 974 | |
---|
| 975 | values = ['Off', 'On'] |
---|
| 976 | self.colorID = FSC_Droplist(controlBase, Value=values, Title='Color Output:', $ |
---|
| 977 | UValue={Method:'COLOR', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 978 | self.colorID->SetIndex, self.colorSet |
---|
| 979 | |
---|
| 980 | values = ['Off', 'On'] |
---|
| 981 | self.cmykID = FSC_Droplist(controlBase, Value=values, Title = 'CMYK Output', $ |
---|
| 982 | UValue={Method:'NULL', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 983 | self.cmykID->SetIndex, self.cmykSet |
---|
| 984 | IF ~self.colorset THEN self.cmykID->Sensitive, 0 |
---|
| 985 | |
---|
| 986 | values = ['8', '4', '2'] |
---|
| 987 | self.bitsID = FSC_Droplist(controlBase, Value=values, Title='Bits Per Image Pixel:', $ |
---|
| 988 | UValue={Method:'NULL', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 989 | self.bitsID->SetSelection, self.bitsSet |
---|
| 990 | |
---|
| 991 | values = self->DefaultList() |
---|
| 992 | self.defaultsID = FSC_Droplist(controlBase, Value=values, Title='Setups:', $ |
---|
| 993 | UValue={Method:'DEFAULTS', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 994 | self.defaultsID->SetSelection, self.defaultsSet |
---|
| 995 | |
---|
| 996 | euroSetUPID = Widget_Button(euroBase, Value='European Style', UValue={Method:'EUROSTYLE', Object:self}) |
---|
| 997 | IF self.european THEN Widget_Control, euroSetUpID, /Set_Button |
---|
| 998 | IF self.inchesSet THEN unit = 'INCHES' ELSE unit = 'CENTIMETERS' |
---|
| 999 | |
---|
| 1000 | windowDims = self->PageDimensions() |
---|
| 1001 | shortside = Min(windowDims, Max=longside) |
---|
| 1002 | IF self.landscapeSet THEN BEGIN |
---|
| 1003 | windowsize = [self.xoffsetSet/longside, self.yoffsetSet/shortside, $ |
---|
| 1004 | self.xsizeSet/longside + self.xoffsetSet/longside, self.ysizeSet/shortside + self.yoffsetSet/shortside] |
---|
| 1005 | ENDIF ELSE BEGIN |
---|
| 1006 | windowsize = [self.xoffsetSet/shortside, self.yoffsetSet/longside, $ |
---|
| 1007 | self.xsizeSet/shortside + self.xoffsetSet/shortside, self.ysizeSet/longside + self.yoffsetSet/longside] |
---|
| 1008 | ENDELSE |
---|
| 1009 | |
---|
| 1010 | ; Create the plot window. |
---|
| 1011 | |
---|
| 1012 | self.plotID = FSC_PlotWindow(middleTopBase, Units=unit, PageSize=self.pagetypeSet, $ |
---|
| 1013 | Landscape=self.landscapeSet, WindowSize=windowsize, Event_Pro='FSC_PSCONFIG_Events', $ |
---|
| 1014 | UValue={Method:'PLOTWINDOW', Object:self}) |
---|
| 1015 | |
---|
| 1016 | ; Create size and offset windows. |
---|
| 1017 | |
---|
| 1018 | xsizeID = FSC_Field(sizebase, Title=' X Size: ', Value=self.xsizeSet, Object=xsizeObj, $ |
---|
| 1019 | /Float, XSize=CW_FIELD_SIZE, Decimal=2, /CR_Only, Event_Pro='FSC_PSCONFIG_Events', $ |
---|
| 1020 | UValue={Method:'WINDOWSIZE', Object:self}, /Positive, /Label_Left) |
---|
| 1021 | self.xsizeID = xsizeObj |
---|
| 1022 | ysizeID = FSC_Field(sizebase, Title=' Y Size: ', Value=self.ysizeSet, Object=ysizeObj, $ |
---|
| 1023 | /Float, XSize=CW_FIELD_SIZE, Decimal=2, /CR_Only, Event_Pro='FSC_PSCONFIG_Events', $ |
---|
| 1024 | UValue={Method:'WINDOWSIZE', Object:self}, /Positive, /Label_Left) |
---|
| 1025 | self.ysizeID = ysizeObj |
---|
| 1026 | |
---|
| 1027 | xoffsetID = FSC_Field(sizebase, Title=' X Offset: ', Value=self.xoffsetSet, Object=xoffsetObj, $ |
---|
| 1028 | /Float, XSize=CW_FIELD_SIZE, Decimal=2, /CR_Only, Event_Pro='FSC_PSCONFIG_Events', $ |
---|
| 1029 | UValue={Method:'WINDOWSIZE', Object:self}, /Positive, /Label_Left) |
---|
| 1030 | self.xoffsetID = xoffsetObj |
---|
| 1031 | |
---|
| 1032 | yoffsetID = FSC_Field(sizebase, Title=' Y Offset: ', Value=self.yoffsetSet, Object=yoffsetObj, $ |
---|
| 1033 | /Float, XSize=CW_FIELD_SIZE, Decimal=2, /CR_Only, Event_Pro='FSC_PSCONFIG_Events', $ |
---|
| 1034 | UValue={Method:'WINDOWSIZE', Object:self}, /Positive, /Label_Left) |
---|
| 1035 | self.yoffsetID = yoffsetObj |
---|
| 1036 | |
---|
| 1037 | ; Set up TABing between fields. |
---|
| 1038 | |
---|
| 1039 | self.xsizeID->SetTabNext, self.ysizeID->GetTextID() |
---|
| 1040 | self.ysizeID->SetTabNext, self.xoffsetID->GetTextID() |
---|
| 1041 | self.xoffsetID->SetTabNext, self.yoffsetID->GetTextID() |
---|
| 1042 | self.yoffsetID->SetTabNext, self.xsizeID->GetTextID() |
---|
| 1043 | |
---|
| 1044 | ; Create directions widgets. |
---|
| 1045 | |
---|
| 1046 | labelBase = Widget_Base(rightTopBase, Column=1, Base_Align_Center=1) |
---|
| 1047 | label = Widget_Label(labelBase, Value='Directions') |
---|
| 1048 | label = Widget_Label(labelBase, Value='Move or resize the PostScript "plot" on the', /Align_Left) |
---|
| 1049 | label = Widget_Label(labelBase, Value='page with left or right buttons. Click the middle', /Align_Left) |
---|
| 1050 | label = Widget_Label(labelBase, Value='button in the window to center plot on the page.', /Align_Left) |
---|
| 1051 | |
---|
| 1052 | ; Create filename widgets. |
---|
| 1053 | |
---|
| 1054 | dummy = FSC_FileSelect(rightTopBase, Filename=self.filenameSet, $ |
---|
| 1055 | Directory=self.directorySet, XSIZE=40, ObjectRef=filenameID) |
---|
| 1056 | self.filenameID = filenameID |
---|
| 1057 | |
---|
| 1058 | ; Create bottom button widgets. |
---|
| 1059 | |
---|
| 1060 | cancel = Widget_Button(actionBase, Value=cancelButVal, UValue={Method:'CANCEL', Object:self}) |
---|
| 1061 | self.revertID = Widget_Button(actionBase, Value='Revert', UValue={Method:'REVERT', Object:self}, Sensitive=0) |
---|
| 1062 | helper = Widget_Button(actionBase, Value='Help', UValue={Method:'HELP', Object:self}) |
---|
| 1063 | self.acceptID = Widget_Button(actionBase, Value=acceptButtonName, UValue={Method:'ACCEPT', Object:self}) |
---|
| 1064 | |
---|
| 1065 | ; Size the widgets. |
---|
| 1066 | |
---|
| 1067 | t = Widget_Info(leftTopBase, /Geometry) |
---|
| 1068 | targetSize = t.scr_xsize |
---|
| 1069 | self.pageTypeID->Resize, ParentSize=targetsize |
---|
| 1070 | self.orientationID->Resize, targetsize |
---|
| 1071 | self.unitsID->Resize, targetsize |
---|
| 1072 | self.encapsulationID->Resize, targetsize |
---|
| 1073 | self.previewID->Resize, targetsize |
---|
| 1074 | self.cmykID->Resize, targetsize |
---|
| 1075 | self.colorID->Resize, targetsize |
---|
| 1076 | self.bitsID->Resize, targetsize |
---|
| 1077 | self.defaultsID->Resize, targetsize |
---|
| 1078 | |
---|
| 1079 | IF self.encapsulationID->GetIndex() THEN self.previewID->Sensitive, 1 ELSE self.previewID->Sensitive, 0 |
---|
| 1080 | self.plotID->SetColor, self.colorSet |
---|
| 1081 | |
---|
| 1082 | ; Center and realize TLB. |
---|
| 1083 | |
---|
| 1084 | FSC_PSConfig_CenterTLB, tlb |
---|
| 1085 | Widget_Control, tlb, /Realize |
---|
| 1086 | |
---|
| 1087 | self.noblock = Keyword_Set(noblock) |
---|
| 1088 | |
---|
| 1089 | ; Save the current configuration. |
---|
| 1090 | |
---|
| 1091 | self->SaveConfiguration |
---|
| 1092 | |
---|
| 1093 | XManager, 'fsc_psconfig_' + self.name, tlb, Event_Handler='FSC_PSCONFIG_EVENTS', $ |
---|
| 1094 | No_Block=Keyword_Set(noblock) |
---|
| 1095 | IF Keyword_Set(noblock) THEN cancel = 0 ELSE cancel = self.cancel |
---|
| 1096 | END ;-------------------------------------------------------------------------------- |
---|
| 1097 | |
---|
| 1098 | |
---|
| 1099 | |
---|
| 1100 | PRO FSC_PSCONFIG::GUIFont, Cancel=cancel, Group_Leader=leader, NoBlock=noblock, $ |
---|
| 1101 | NoFont=nofont, Accept_Button_Name=acceptButtonName, FontType=fonttype |
---|
| 1102 | |
---|
| 1103 | ; This method displays the graphical user interface with font information |
---|
| 1104 | ; in place. |
---|
| 1105 | |
---|
| 1106 | Catch, theError |
---|
| 1107 | IF theError NE 0 THEN BEGIN |
---|
| 1108 | Catch, /Cancel |
---|
| 1109 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 1110 | RETURN |
---|
| 1111 | ENDIF |
---|
| 1112 | |
---|
| 1113 | ; Can't run this program in a device that doesn't support windows. |
---|
| 1114 | |
---|
| 1115 | self.thisDevice = !D.Name |
---|
| 1116 | IF (!D.Flags AND 256) EQ 0 THEN BEGIN |
---|
| 1117 | thisOS = StrUpCase(!Version.OS_Family) |
---|
| 1118 | CASE thisOS OF |
---|
| 1119 | 'MACOS': Set_Plot, 'Mac' |
---|
| 1120 | 'WINDOWS': Set_Plot, 'Win' |
---|
| 1121 | ELSE: Set_Plot, 'X' |
---|
| 1122 | ENDCASE |
---|
| 1123 | ENDIF |
---|
| 1124 | |
---|
| 1125 | ; If the NoFont keyword is set, call the non-font GUI method. |
---|
| 1126 | |
---|
| 1127 | IF Keyword_Set(nofont) THEN BEGIN |
---|
| 1128 | self->Gui, Cancel=cancel, Group_Leader=leader, NoBlock=Keyword_Set(noblock), $ |
---|
| 1129 | Accept_Button_Name=acceptButtonName, FontType=fonttype |
---|
| 1130 | RETURN |
---|
| 1131 | ENDIF |
---|
| 1132 | |
---|
| 1133 | IF N_Elements(acceptButtonName) EQ 0 THEN BEGIN |
---|
| 1134 | IF Keyword_Set(noblock) THEN BEGIN |
---|
| 1135 | acceptButtonName = 'Apply' |
---|
| 1136 | ENDIF ELSE BEGIN |
---|
| 1137 | acceptButtonName = 'Accept' |
---|
| 1138 | ENDELSE |
---|
| 1139 | ENDIF |
---|
| 1140 | |
---|
| 1141 | ; Only one GUI at a time with the same name. |
---|
| 1142 | |
---|
| 1143 | IF XRegistered('fsc_psconfig_' + self.name) GT 0 THEN RETURN |
---|
| 1144 | |
---|
| 1145 | ;Set default values. |
---|
| 1146 | |
---|
| 1147 | self.fontInfo = 1 |
---|
| 1148 | CW_FIELD_SIZE = 5 |
---|
| 1149 | IF Keyword_Set(noblock) THEN BEGIN |
---|
| 1150 | cancelButVal = 'Dismiss' |
---|
| 1151 | ENDIF ELSE BEGIN |
---|
| 1152 | cancelButVal = 'Cancel' |
---|
| 1153 | ENDELSE |
---|
| 1154 | |
---|
| 1155 | IF N_Elements(fonttype) EQ 0 THEN fonttype = self.fontTypeSet |
---|
| 1156 | self.fontTypeSet = fonttype |
---|
| 1157 | |
---|
| 1158 | IF self.fontTypeSet EQ 1 THEN self.trueTypeSet = 1 |
---|
| 1159 | IF Keyword_Set(noblock) THEN self.cancel = 0 ELSE self.cancel = 1 |
---|
| 1160 | |
---|
| 1161 | IF self.name NE "" THEN tlbTitle = self.name + ": Configure PostScript Device" ELSE $ |
---|
| 1162 | tlbTitle = "Configure PostScript Device" |
---|
| 1163 | |
---|
| 1164 | ; Modal TLB if possible. |
---|
| 1165 | |
---|
| 1166 | IF N_Elements(leader) EQ 0 OR Keyword_Set(noblock) THEN BEGIN |
---|
| 1167 | tlb = Widget_Base(Title=tlbTitle, Column=1, Base_Align_Center=1) |
---|
| 1168 | ENDIF ELSE BEGIN |
---|
| 1169 | tlb = Widget_Base(Title=tlbTitle, Column=1, $ |
---|
| 1170 | Base_Align_Center=1, Group_Leader=leader, /Modal) |
---|
| 1171 | ENDELSE |
---|
| 1172 | |
---|
| 1173 | self.tlb = tlb |
---|
| 1174 | |
---|
| 1175 | ; Sub-base hierarchy. |
---|
| 1176 | |
---|
| 1177 | topBase = Widget_Base(tlb, Row=1, UValue=self.thisDevice, Kill_Notify='FSC_PSConfig_Restore_Device') |
---|
| 1178 | leftTopBase = Widget_Base(topBase, Column=1) |
---|
| 1179 | controlBase = Widget_Base(leftTopBase, Column=1, /Frame) |
---|
| 1180 | euroBase = Widget_Base(leftTopBase, row=1, /NonExclusive) |
---|
| 1181 | rightTopBase = Widget_Base(topBase, Column=1) |
---|
| 1182 | sizebase = Widget_Base(rightTopBase, Row=1, /Frame) |
---|
| 1183 | fontbase = Widget_Base(rightTopBase, Column=1, Base_Align_Left=1, Frame=1) |
---|
| 1184 | firstRow = Widget_Base(fontbase, Row=1) |
---|
| 1185 | secondRow = Widget_Base(fontbase, Row=1) |
---|
| 1186 | thirdRow = Widget_Base(fontbase, Row=1) |
---|
| 1187 | fourthRow = Widget_Base(fontbase, Row=1) |
---|
| 1188 | middleTopBase = Widget_Base(topBase, Column=1, Base_Align_Center=1) |
---|
| 1189 | actionBase = Widget_Base(tlb, Row=1, Base_Align_Center=1) |
---|
| 1190 | |
---|
| 1191 | ; Create droplist widgets. |
---|
| 1192 | |
---|
| 1193 | values = ['Letter', 'A4', 'Legal', 'Ledger'] |
---|
| 1194 | self.pageTypeID = FSC_Droplist(controlBase, Value=values, Title='Page Size:', $ |
---|
| 1195 | UValue={Method:'PageSize', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 1196 | self.pageTypeID->SetSelection, self.pageTypeSet |
---|
| 1197 | self.pagetype = self.pageTypeSet |
---|
| 1198 | |
---|
| 1199 | values = ['Portrait', 'Landscape'] |
---|
| 1200 | self.orientationID = FSC_Droplist(controlBase, Value=values, Title='Orientation:', $ |
---|
| 1201 | UValue={Method:'Orientation', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 1202 | self.orientationID->SetIndex, self.landscapeSet |
---|
| 1203 | |
---|
| 1204 | values = ['Centimeters', 'Inches'] |
---|
| 1205 | self.unitsID = FSC_Droplist(controlBase, Value=values, Title='Units:', $ |
---|
| 1206 | UValue={Method:'Units', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 1207 | self.unitsID->SetIndex, self.inchesSet |
---|
| 1208 | |
---|
| 1209 | values = ['Off', 'On'] |
---|
| 1210 | self.encapsulationID = FSC_Droplist(controlBase, Value=values, Title='Encapsulation:', $ |
---|
| 1211 | UValue={Method:'ENCAPSULATE', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 1212 | self.encapsulationID->SetIndex, self.encapsulationSet |
---|
| 1213 | |
---|
| 1214 | values = ['None', 'EPSI', 'EPSF'] |
---|
| 1215 | self.previewID = FSC_Droplist(controlBase, Value=values, Title='Preview Mode:', $ |
---|
| 1216 | UValue={Method:'NULL', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 1217 | self.previewID->SetIndex, self.previewSet |
---|
| 1218 | |
---|
| 1219 | values = ['Off', 'On'] |
---|
| 1220 | self.colorID = FSC_Droplist(controlBase, Value=values, Title='Color Output:', $ |
---|
| 1221 | UValue={Method:'COLOR', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 1222 | self.colorID->SetIndex, self.colorSet |
---|
| 1223 | |
---|
| 1224 | values = ['Off', 'On'] |
---|
| 1225 | self.cmykID = FSC_Droplist(controlBase, Value=values, Title = 'CMYK Output', $ |
---|
| 1226 | UValue={Method:'CMYK', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 1227 | self.cmykID->SetIndex, self.cmykSet |
---|
| 1228 | |
---|
| 1229 | values = ['8', '4', '2'] |
---|
| 1230 | self.bitsID = FSC_Droplist(controlBase, Value=values, Title='Bits Per Image Pixel:', $ |
---|
| 1231 | UValue={Method:'NULL', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 1232 | self.bitsID->SetSelection, self.bitsSet |
---|
| 1233 | |
---|
| 1234 | values = self->DefaultList() |
---|
| 1235 | self.defaultsID = FSC_Droplist(controlBase, Value=values, Title='Setups:', $ |
---|
| 1236 | UValue={Method:'DEFAULTS', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 1237 | self.defaultsID->SetSelection, self.defaultsSet |
---|
| 1238 | |
---|
| 1239 | euroSetUpID = Widget_Button(euroBase, Value='European Style', UValue={Method:'EUROSTYLE', Object:self}) |
---|
| 1240 | IF self.european THEN Widget_Control, euroSetUpID, /Set_Button |
---|
| 1241 | IF self.inchesSet THEN unit = 'INCHES' ELSE unit = 'CENTIMETERS' |
---|
| 1242 | |
---|
| 1243 | windowDims = self->PageDimensions() |
---|
| 1244 | shortside = Min(windowDims, Max=longside) |
---|
| 1245 | IF self.landscapeSet THEN BEGIN |
---|
| 1246 | windowsize = [self.xoffsetSet/longside, self.yoffsetSet/shortside, $ |
---|
| 1247 | self.xsizeSet/longside + self.xoffsetSet/longside, self.ysizeSet/shortside + self.yoffsetSet/shortside] |
---|
| 1248 | ENDIF ELSE BEGIN |
---|
| 1249 | windowsize = [self.xoffsetSet/shortside, self.yoffsetSet/longside, $ |
---|
| 1250 | self.xsizeSet/shortside + self.xoffsetSet/shortside, self.ysizeSet/longside + self.yoffsetSet/longside] |
---|
| 1251 | ENDELSE |
---|
| 1252 | |
---|
| 1253 | ; Create the plot window. |
---|
| 1254 | |
---|
| 1255 | self.plotID = FSC_PlotWindow(middleTopBase, Units=unit, PageSize=self.pagetypeSet, $ |
---|
| 1256 | Landscape=self.landscapeSet, WindowSize=windowsize, Event_Pro='FSC_PSCONFIG_Events', $ |
---|
| 1257 | UValue={Method:'PLOTWINDOW', Object:self}) |
---|
| 1258 | |
---|
| 1259 | ; Create size and offset windows. |
---|
| 1260 | |
---|
| 1261 | xsizeID = FSC_Field(sizebase, Title=' X Size: ', Value=self.xsizeSet, Object=xsizeObj, $ |
---|
| 1262 | /Float, XSize=CW_FIELD_SIZE, Decimal=2, /CR_Only, Event_Pro='FSC_PSCONFIG_Events', $ |
---|
| 1263 | UValue={Method:'WINDOWSIZE', Object:self}, /Positive, /Label_Left) |
---|
| 1264 | self.xsizeID = xsizeObj |
---|
| 1265 | ysizeID = FSC_Field(sizebase, Title=' Y Size: ', Value=self.ysizeSet, Object=ysizeObj, $ |
---|
| 1266 | /Float, XSize=CW_FIELD_SIZE, Decimal=2, /CR_Only, Event_Pro='FSC_PSCONFIG_Events', $ |
---|
| 1267 | UValue={Method:'WINDOWSIZE', Object:self}, /Positive, /Label_Left) |
---|
| 1268 | self.ysizeID = ysizeObj |
---|
| 1269 | |
---|
| 1270 | xoffsetID = FSC_Field(sizebase, Title=' X Offset: ', Value=self.xoffsetSet, Object=xoffsetObj, $ |
---|
| 1271 | /Float, XSize=CW_FIELD_SIZE, Decimal=2, /CR_Only, Event_Pro='FSC_PSCONFIG_Events', $ |
---|
| 1272 | UValue={Method:'WINDOWSIZE', Object:self}, /Positive, /Label_Left) |
---|
| 1273 | self.xoffsetID = xoffsetObj |
---|
| 1274 | |
---|
| 1275 | yoffsetID = FSC_Field(sizebase, Title=' Y Offset: ', Value=self.yoffsetSet, Object=yoffsetObj, $ |
---|
| 1276 | /Float, XSize=CW_FIELD_SIZE, Decimal=2, /CR_Only, Event_Pro='FSC_PSCONFIG_Events', $ |
---|
| 1277 | UValue={Method:'WINDOWSIZE', Object:self}, /Positive, /Label_Left) |
---|
| 1278 | self.yoffsetID = yoffsetObj |
---|
| 1279 | |
---|
| 1280 | ; Set up TABing between fields. |
---|
| 1281 | |
---|
| 1282 | self.xsizeID->SetTabNext, self.ysizeID->GetTextID() |
---|
| 1283 | self.ysizeID->SetTabNext, self.xoffsetID->GetTextID() |
---|
| 1284 | self.xoffsetID->SetTabNext, self.yoffsetID->GetTextID() |
---|
| 1285 | self.yoffsetID->SetTabNext, self.xsizeID->GetTextID() |
---|
| 1286 | |
---|
| 1287 | ; Create the font widgets. |
---|
| 1288 | |
---|
| 1289 | values = ['Vector (Hershey)', 'Hardware', 'True-Type'] |
---|
| 1290 | self.fontTypeID = FSC_Droplist(firstRow, Value=values, Title='Font Type: ', $ |
---|
| 1291 | UValue={Method:'FONTTYPE', Object:self}, Event_Pro='FSC_PSCONFIG_Events') ;, UName='Font Type') |
---|
| 1292 | self.fontTypeID->SetIndex, (0 > (self.fonttypeSet + 1) < 2) |
---|
| 1293 | |
---|
| 1294 | self.fontnameID = FSC_Droplist(firstrow, Value=*self.fontnames, Title='Font: ', $ |
---|
| 1295 | UValue={Method:'NULL', Object:self}, Event_Pro='FSC_PSCONFIG_Events') ;, UName='Font Name') |
---|
| 1296 | self.fontnameID->SetSelection, self.fontNameSet |
---|
| 1297 | |
---|
| 1298 | values = ['Bold','Book', 'Demi', 'Italic', 'Light', 'Medium', 'Narrow', 'Oblique'] |
---|
| 1299 | self.styleBaseID = Widget_Base(secondRow, Column=4, /Nonexclusive, /Frame) |
---|
| 1300 | FOR j=0,7 DO BEGIN |
---|
| 1301 | self.fontStyleButtonID[j] = Widget_Button(self.styleBaseID, Value=values[j], $ |
---|
| 1302 | UValue={Method:'STYLEBUTTONS', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 1303 | Widget_Control, self.fontStylebuttonID[j], Set_Button=self.fontStyleSet[j] |
---|
| 1304 | ENDFOR |
---|
| 1305 | FOR j=0,7 DO IF self.fontStyleSet[j] THEN Widget_Control, self.fontStyleButtonID[j], Set_Button=1 |
---|
| 1306 | |
---|
| 1307 | clearBaseID = Widget_Base(secondRow) |
---|
| 1308 | self.clearButtonID = Widget_Button(clearBaseID, Value='Clear Font Styles', YOffset=15, XOffset=6, $ |
---|
| 1309 | UValue={Method:'CLEARSTYLES', Object:self}, Event_Pro='FSC_PSCONFIG_Events') |
---|
| 1310 | |
---|
| 1311 | ; More droplist widgets. |
---|
| 1312 | |
---|
| 1313 | values = Indgen(31) + 6 |
---|
| 1314 | self.fontSizeID = FSC_Droplist(thirdrow, Value=StrTrim(values,2), Title='Font Size: ', $ |
---|
| 1315 | UValue={Method:'NULL', Object:self}, Event_Pro='FSC_PSCONFIG_Events') ;, UName='Font Size') |
---|
| 1316 | self.fontSizeID->SetSelection, StrTrim(self.fontsizeSet,2) |
---|
| 1317 | |
---|
| 1318 | self.truetypeID = FSC_Droplist(thirdrow, Value=['No', 'Yes'], Title='True-Type: ', $ |
---|
| 1319 | UValue={Method:'NULL', Object:self}, Event_Pro='FSC_PSCONFIG_Events') ;, UName='True-Type Fonts') |
---|
| 1320 | self.truetypeID->SetIndex, self.truetypeSet |
---|
| 1321 | |
---|
| 1322 | self.isolatinID = FSC_Droplist(thirdrow, Value=['Off', 'On'], Title='ISOlatin1: ', $ |
---|
| 1323 | UValue={Method:'NULL', Object:self}, Event_Pro='FSC_PSCONFIG_Events') ;, UName='Isolatin Encoding') |
---|
| 1324 | self.isolatinID->SetIndex, self.isolatinSet |
---|
| 1325 | |
---|
| 1326 | ;self.set_fontID = FSC_InputField(fourthRow, Value=self.set_fontSet, $ |
---|
| 1327 | ; UValue={Method:'NULL', Object:self}, Event_Pro='FSC_PSCONFIG_Events', $ |
---|
| 1328 | ; Title='Set_Font Name: ', XSize=35, /StringValue) |
---|
| 1329 | |
---|
| 1330 | ; The directions widgets. |
---|
| 1331 | |
---|
| 1332 | labelBase = Widget_Base(middleTopBase, Column=1, Base_Align_Center=1) |
---|
| 1333 | label = Widget_Label(labelBase, Value='Directions') |
---|
| 1334 | label = Widget_Label(labelBase, Value='Move or resize the PostScript "plot" on the', /Align_Left) |
---|
| 1335 | label = Widget_Label(labelBase, Value='page with left or right buttons. Click the middle', /Align_Left) |
---|
| 1336 | label = Widget_Label(labelBase, Value='button in the window to center plot on the page.', /Align_Left) |
---|
| 1337 | |
---|
| 1338 | ; The file name widgets. |
---|
| 1339 | |
---|
| 1340 | dummy = FSC_FileSelect(rightTopBase, Filename=self.filenameSet, $ |
---|
| 1341 | Directory=self.directorySet, XSIZE=40, ObjectRef=filenameID) |
---|
| 1342 | self.filenameID = filenameID |
---|
| 1343 | |
---|
| 1344 | ; The bottom button widgets. |
---|
| 1345 | |
---|
| 1346 | cancel = Widget_Button(actionBase, Value=cancelButVal, UValue={Method:'CANCEL', Object:self}) |
---|
| 1347 | self.revertID = Widget_Button(actionBase, Value='Revert', UValue={Method:'REVERT', Object:self}, Sensitive=0) |
---|
| 1348 | helper = Widget_Button(actionBase, Value='Help', UValue={Method:'HELP', Object:self}) |
---|
| 1349 | self.acceptID = Widget_Button(actionBase, Value=acceptButtonName, UValue={Method:'ACCEPT', Object:self}) |
---|
| 1350 | |
---|
| 1351 | ; Size the widgets for layout. |
---|
| 1352 | |
---|
| 1353 | t = Widget_Info(leftTopBase, /Geometry) |
---|
| 1354 | targetSize = t.scr_xsize |
---|
| 1355 | self.pageTypeID->Resize, ParentSize=targetsize |
---|
| 1356 | self.orientationID->Resize, targetsize |
---|
| 1357 | self.unitsID->Resize, targetsize |
---|
| 1358 | self.encapsulationID->Resize, targetsize |
---|
| 1359 | self.previewID->Resize, targetsize |
---|
| 1360 | self.cmykID->Resize, targetsize |
---|
| 1361 | self.colorID->Resize, targetsize |
---|
| 1362 | self.bitsID->Resize, targetsize |
---|
| 1363 | self.defaultsID->Resize, targetsize |
---|
| 1364 | |
---|
| 1365 | t = Widget_Info(fontbase, /Geometry) |
---|
| 1366 | targetsize = t.scr_xsize / 2 |
---|
| 1367 | self.fontTypeID->Resize, targetsize |
---|
| 1368 | self.fontnameID[0]->Resize, targetsize |
---|
| 1369 | |
---|
| 1370 | targetsize = t.scr_xsize / 3 |
---|
| 1371 | self.truetypeID->Resize, targetsize |
---|
| 1372 | self.isoLatinID->Resize, targetsize |
---|
| 1373 | self.fontSizeID->Resize, targetsize |
---|
| 1374 | |
---|
| 1375 | targetsize = t.scr_xsize |
---|
| 1376 | IF Obj_Valid(self.set_fontID) THEN self.set_fontID->Resize, targetsize |
---|
| 1377 | |
---|
| 1378 | ; Some widgets need to be turned off. |
---|
| 1379 | |
---|
| 1380 | IF self.encapsulationID->GetIndex() THEN self.previewID->Sensitive, 1 ELSE self.previewID->Sensitive, 0 |
---|
| 1381 | self.plotID->SetColor, self.colorSet |
---|
| 1382 | IF self.fontTypeSet EQ -1 THEN BEGIN |
---|
| 1383 | Widget_Control, self.fontnameID->GetID(), Sensitive=0 |
---|
| 1384 | Widget_Control, self.stylebaseID, Sensitive=0 |
---|
| 1385 | Widget_Control, self.clearbuttonID, Sensitive=0 |
---|
| 1386 | Widget_Control, self.fontSizeID->GetID(), Sensitive=0 |
---|
| 1387 | Widget_Control, self.truetypeID->GetID(), Sensitive=0 |
---|
| 1388 | Widget_Control, self.isolatinID->GetID(), Sensitive=0 |
---|
| 1389 | IF Obj_Valid(self.set_fontID) THEN Widget_Control, self.set_fontID->GetID(), Sensitive=0 |
---|
| 1390 | ENDIF |
---|
| 1391 | |
---|
| 1392 | ; Center and realize the top-level base. |
---|
| 1393 | |
---|
| 1394 | FSC_PSConfig_CenterTLB, tlb |
---|
| 1395 | Widget_Control, tlb, /Realize |
---|
| 1396 | |
---|
| 1397 | self.noblock = Keyword_Set(noblock) |
---|
| 1398 | |
---|
| 1399 | ; Save the current configuration. |
---|
| 1400 | |
---|
| 1401 | self->SaveConfiguration |
---|
| 1402 | |
---|
| 1403 | XManager, 'fsc_psconfig_' + self.name, tlb, Event_Handler='FSC_PSCONFIG_EVENTS', $ |
---|
| 1404 | No_Block=Keyword_Set(noblock) |
---|
| 1405 | IF Keyword_Set(noblock) THEN cancel = 0 ELSE cancel = self.cancel |
---|
| 1406 | END ;-------------------------------------------------------------------------------- |
---|
| 1407 | |
---|
| 1408 | |
---|
| 1409 | |
---|
| 1410 | PRO FSC_PSCONFIG::Help, event |
---|
| 1411 | |
---|
| 1412 | ; This is the text that pops up in the HELP WINDOW when the |
---|
| 1413 | ; Help button is selected. Feel free to change it to whatever |
---|
| 1414 | ; you like. The "textsize" variable below the help text should |
---|
| 1415 | ; be set to the number of lines of textual information. |
---|
| 1416 | |
---|
| 1417 | Catch, theError |
---|
| 1418 | IF theError NE 0 THEN BEGIN |
---|
| 1419 | Catch, /Cancel |
---|
| 1420 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 1421 | RETURN |
---|
| 1422 | ENDIF |
---|
| 1423 | |
---|
| 1424 | helptext = [ $ |
---|
| 1425 | " ", $ |
---|
| 1426 | " The FSC_PSConfig object is a Open Source program written ", $ |
---|
| 1427 | " by David Fanning of Fanning Software Consulting. Complete ", $ |
---|
| 1428 | " program documenation is available on the FSC web page: ", $ |
---|
| 1429 | " ", $ |
---|
| 1430 | " http://www.dfanning.com/programs/docs/fsc_psconfig.html ", $ |
---|
| 1431 | " ", $ |
---|
| 1432 | " Other IDL programs, as well as many IDL programming tips ", $ |
---|
| 1433 | " and techniques can be found on the Coyote's Guide to IDL ", $ |
---|
| 1434 | " Programming web page. Please take a moment to look around. ", $ |
---|
| 1435 | " ", $ |
---|
| 1436 | " Fanning Software Consulting ", $ |
---|
| 1437 | " 1645 Sheely Drive ", $ |
---|
| 1438 | " Fort Collins, CO 80526 ", $ |
---|
| 1439 | " Phone: 970-221-0438 Fax: 970-221-4762 ", $ |
---|
| 1440 | " E-Mail: david@dfanning.com ", $ |
---|
| 1441 | " IDL Book Orders: 1-888-461-0155 ", $ |
---|
| 1442 | " Coyote's Guide: http://www.dfanning.com/ ", $ |
---|
| 1443 | " " ] |
---|
| 1444 | textsize = 19 |
---|
| 1445 | |
---|
| 1446 | ; Only one help display at a time, please. |
---|
| 1447 | |
---|
| 1448 | IF XRegistered('fsc_psconfig_help') GT 0 THEN RETURN |
---|
| 1449 | |
---|
| 1450 | ; Creat the widgets for the HELP WINDOW. |
---|
| 1451 | |
---|
| 1452 | base = Widget_Base(Column=1, Group_Leader=self.acceptID) |
---|
| 1453 | textID = Widget_Text(base, Value=helptext, Scr_XSize=500, YSize=textsize) |
---|
| 1454 | IF NOT Widget_Info(self.tlb, /Modal) THEN button = Widget_Button(base, Value='Dismiss') |
---|
| 1455 | FSC_PSConfig_CenterTLB, base |
---|
| 1456 | Widget_Control, base, /Realize |
---|
| 1457 | XManager, 'fsc_psconfig_help', base, /Just_Reg |
---|
| 1458 | END ;-------------------------------------------------------------------------------- |
---|
| 1459 | |
---|
| 1460 | |
---|
| 1461 | |
---|
| 1462 | FUNCTION FSC_PSCONFIG::PageDimensions |
---|
| 1463 | |
---|
| 1464 | ; This method sets up the page size. If you add a new page size, |
---|
| 1465 | ; you must add its dimensions (in inches) to the CASE statement below. |
---|
| 1466 | |
---|
| 1467 | ; Letter 8.5 x 11. |
---|
| 1468 | ; Ledger 11 x 17. |
---|
| 1469 | ; Legal 8.5 x 14. |
---|
| 1470 | ; A4 8.27 x 11.7. |
---|
| 1471 | |
---|
| 1472 | Catch, theError |
---|
| 1473 | IF theError NE 0 THEN BEGIN |
---|
| 1474 | Catch, /Cancel |
---|
| 1475 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 1476 | RETURN, [0,0] |
---|
| 1477 | ENDIF |
---|
| 1478 | |
---|
| 1479 | CASE StrUpCase(self.pagetype) OF |
---|
| 1480 | 'LETTER': BEGIN |
---|
| 1481 | shortside = 8.5 |
---|
| 1482 | longside = 11.0 |
---|
| 1483 | ENDCASE |
---|
| 1484 | 'LEDGER': BEGIN |
---|
| 1485 | shortside = 11.0 |
---|
| 1486 | longside = 17.0 |
---|
| 1487 | ENDCASE |
---|
| 1488 | 'LEGAL': BEGIN |
---|
| 1489 | shortside = 8.5 |
---|
| 1490 | longside = 14.0 |
---|
| 1491 | ENDCASE |
---|
| 1492 | 'A4': BEGIN |
---|
| 1493 | shortside = 8.27 |
---|
| 1494 | longside = 11.70 |
---|
| 1495 | ENDCASE |
---|
| 1496 | ; ELSE: BEGIN |
---|
| 1497 | ; shortside = 8.5 |
---|
| 1498 | ; longside = 11.0 |
---|
| 1499 | ; ENDCASE |
---|
| 1500 | ENDCASE |
---|
| 1501 | |
---|
| 1502 | IF self.inchesSet EQ 0 THEN BEGIN |
---|
| 1503 | shortside = shortside * 2.54 |
---|
| 1504 | longside = longside * 2.54 |
---|
| 1505 | ENDIF |
---|
| 1506 | |
---|
| 1507 | RETURN, [shortside, longside] |
---|
| 1508 | END ;-------------------------------------------------------------------------------- |
---|
| 1509 | |
---|
| 1510 | |
---|
| 1511 | |
---|
| 1512 | PRO FSC_PSCONFIG::Orientation, event |
---|
| 1513 | |
---|
| 1514 | ; This event handler method responds to changes in the Orientation droplist. |
---|
| 1515 | |
---|
| 1516 | Catch, theError |
---|
| 1517 | IF theError NE 0 THEN BEGIN |
---|
| 1518 | Catch, /Cancel |
---|
| 1519 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 1520 | RETURN |
---|
| 1521 | ENDIF |
---|
| 1522 | |
---|
| 1523 | pagetype = self.pageTypeID->GetSelection() |
---|
| 1524 | Widget_Control, event.top, Update=0 |
---|
| 1525 | self.plotID->SetPageSize, pagetype, Landscape=event.index, TLB=self.tlb |
---|
| 1526 | self.plotID->GetWindowLocation, xsize, ysize, xoffset, yoffset |
---|
| 1527 | self->UpdateSizes, xsize, ysize, xoffset, yoffset |
---|
| 1528 | self.landscapeSet = event.index |
---|
| 1529 | Widget_Control, event.top, Update=1 |
---|
| 1530 | END ;-------------------------------------------------------------------------------- |
---|
| 1531 | |
---|
| 1532 | |
---|
| 1533 | |
---|
| 1534 | PRO FSC_PSCONFIG::PageSize, event |
---|
| 1535 | |
---|
| 1536 | ; This event handler method responds to changes in the Page Size droplist. |
---|
| 1537 | |
---|
| 1538 | Catch, theError |
---|
| 1539 | IF theError NE 0 THEN BEGIN |
---|
| 1540 | Catch, /Cancel |
---|
| 1541 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 1542 | RETURN |
---|
| 1543 | ENDIF |
---|
| 1544 | |
---|
| 1545 | ; Landscape is the default orientation for LEDGER output. |
---|
| 1546 | |
---|
| 1547 | IF StrUpCase(*event.selection) EQ "LEDGER" THEN BEGIN |
---|
| 1548 | landscapeValue = 1 |
---|
| 1549 | self.orientationID->SetIndex, 1 |
---|
| 1550 | ENDIF ELSE landscapeValue = self.orientationID->GetIndex() |
---|
| 1551 | |
---|
| 1552 | ; Change the page size. Get the window location and update the display. |
---|
| 1553 | |
---|
| 1554 | Widget_Control, event.top, Update=0 |
---|
| 1555 | self.plotID->SetPageSize, *event.selection, Landscape=landscapeValue, TLB=self.tlb |
---|
| 1556 | self.plotID->GetWindowLocation, xsize, ysize, xoffset, yoffset |
---|
| 1557 | self->UpdateSizes, xsize, ysize, xoffset, yoffset |
---|
| 1558 | self.pagetype = *event.selection |
---|
| 1559 | Widget_Control, event.top, Update=1 |
---|
| 1560 | END ;-------------------------------------------------------------------------------- |
---|
| 1561 | |
---|
| 1562 | |
---|
| 1563 | |
---|
| 1564 | PRO FSC_PSCONFIG::PlotWindow, event |
---|
| 1565 | |
---|
| 1566 | ; The plot window moved or changed size. Update the size and offset widgets. |
---|
| 1567 | |
---|
| 1568 | self->UpdateSizes, event.xsize, event.ysize, event.xoffset, event.yoffset |
---|
| 1569 | END ;-------------------------------------------------------------------------------- |
---|
| 1570 | |
---|
| 1571 | |
---|
| 1572 | |
---|
| 1573 | PRO FSC_PSCONFIG::Revert, event |
---|
| 1574 | |
---|
| 1575 | ; This method allows the user to revert to the previously |
---|
| 1576 | ; saved configuration. All buttons, droplists, etc. are set |
---|
| 1577 | ; to their previously saved values. |
---|
| 1578 | |
---|
| 1579 | Catch, theError |
---|
| 1580 | IF theError NE 0 THEN BEGIN |
---|
| 1581 | Catch, /Cancel |
---|
| 1582 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 1583 | RETURN |
---|
| 1584 | ENDIF |
---|
| 1585 | |
---|
| 1586 | ; Reset the widget setting variables. |
---|
| 1587 | |
---|
| 1588 | self.bitsSet = self.bitsRevert |
---|
| 1589 | self.defaultsSet = self.defaultsRevert |
---|
| 1590 | self.directorySet = self.directoryRevert |
---|
| 1591 | self.encapsulationSet = self.encapsulationRevert |
---|
| 1592 | self.filenameSet = self.filenameRevert |
---|
| 1593 | self.fontsizeSet = self.fontsizeRevert |
---|
| 1594 | self.fontstyleSet = self.fontstyleRevert |
---|
| 1595 | self.fonttypeSet = self.fonttypeRevert |
---|
| 1596 | self.fontnameSet = self.fontnameRevert |
---|
| 1597 | self.inchesSet = self.inchesRevert |
---|
| 1598 | self.isolatinSet = self.isolatinRevert |
---|
| 1599 | self.landscapeSet = self.landscapeRevert |
---|
| 1600 | self.pagetypeSet = self.pagetypeRevert |
---|
| 1601 | self.previewSet = self.previewRevert |
---|
| 1602 | self.set_fontSet = self.set_fontRevert |
---|
| 1603 | self.truetypeSet = self.truetypeRevert |
---|
| 1604 | self.cmykSet = self.cmykRevert |
---|
| 1605 | self.colorSet = self.colorRevert |
---|
| 1606 | self.xoffsetSet = self.xoffsetRevert |
---|
| 1607 | self.xsizeSet = self.xsizeRevert |
---|
| 1608 | self.yoffsetSet = self.yoffsetRevert |
---|
| 1609 | self.ysizeSet = self.ysizeRevert |
---|
| 1610 | |
---|
| 1611 | IF Obj_Valid(self.plotID) THEN BEGIN |
---|
| 1612 | IF self.inchesSet THEN plotUnits = 'INCHES' ELSE plotUnits = 'CENTIMETERS' |
---|
| 1613 | self.plotID->SetUnits, plotUnits |
---|
| 1614 | ENDIF |
---|
| 1615 | |
---|
| 1616 | ; Turn off updating while you update the plot window. |
---|
| 1617 | |
---|
| 1618 | Widget_Control, event.top, Update=0 |
---|
| 1619 | self.plotID->SetPageSize, self.pagetypeSet, Landscape=self.landscapeSet, TLB=self.tlb |
---|
| 1620 | self.plotID->SetWindowLocation, self.xsizeSet, self.ysizeSet, self.xoffsetSet, self.yoffsetSet |
---|
| 1621 | self.plotID->SetColor, self.colorSet |
---|
| 1622 | |
---|
| 1623 | ; Make sure the Preview droplist is set correctly. |
---|
| 1624 | |
---|
| 1625 | IF self.encapsulationSet THEN self.previewID->Sensitive, 1 ELSE self.previewID->Sensitive, 0 |
---|
| 1626 | |
---|
| 1627 | ; The statuslight should be set to SAFE. |
---|
| 1628 | |
---|
| 1629 | self->StatusLight, 1 |
---|
| 1630 | |
---|
| 1631 | ; Update the display. |
---|
| 1632 | |
---|
| 1633 | self->UpdateDisplay |
---|
| 1634 | Widget_Control, event.top, Update=1 |
---|
| 1635 | self.plotID->Refresh |
---|
| 1636 | |
---|
| 1637 | END ;-------------------------------------------------------------------------------- |
---|
| 1638 | |
---|
| 1639 | |
---|
| 1640 | |
---|
| 1641 | PRO FSC_PSCONFIG::SaveConfiguration |
---|
| 1642 | |
---|
| 1643 | ; This method saves the current configuration. Reversion |
---|
| 1644 | ; variables are set so the REVERT button can be used to |
---|
| 1645 | ; return to the previously saved configuration. |
---|
| 1646 | |
---|
| 1647 | Catch, theError |
---|
| 1648 | IF theError NE 0 THEN BEGIN |
---|
| 1649 | Catch, /Cancel |
---|
| 1650 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 1651 | RETURN |
---|
| 1652 | ENDIF |
---|
| 1653 | |
---|
| 1654 | self.bitsRevert = self.bitsSet |
---|
| 1655 | self.cmykRevert = self.cmykSet |
---|
| 1656 | self.colorRevert = self.colorSet |
---|
| 1657 | self.defaultsRevert = self.defaultsSet |
---|
| 1658 | self.directoryRevert = self.directorySet |
---|
| 1659 | self.encapsulationRevert = self.encapsulationSet |
---|
| 1660 | self.filenameRevert = self.filenameSet |
---|
| 1661 | self.fontnameRevert = self.fontnameSet |
---|
| 1662 | self.fontsizeRevert = self.fontsizeSet |
---|
| 1663 | self.fontstyleRevert = self.fontstyleSet |
---|
| 1664 | self.fonttypeRevert = self.fonttypeSet |
---|
| 1665 | self.inchesRevert = self.inchesSet |
---|
| 1666 | self.isolatinRevert = self.isolatinSet |
---|
| 1667 | self.landscapeRevert = self.landscapeSet |
---|
| 1668 | self.pagetypeRevert = self.pagetypeSet |
---|
| 1669 | self.previewRevert = self.previewSet |
---|
| 1670 | self.truetypeRevert = self.truetypeSet |
---|
| 1671 | self.set_fontRevert = self.set_fontSet |
---|
| 1672 | self.xoffsetRevert = self.xoffSetSet |
---|
| 1673 | self.yoffsetRevert = self.yoffSetSet |
---|
| 1674 | self.xsizeRevert = self.xsizeSet |
---|
| 1675 | self.ysizeRevert = self.ysizeSet |
---|
| 1676 | |
---|
| 1677 | END ;-------------------------------------------------------------------------------- |
---|
| 1678 | |
---|
| 1679 | |
---|
| 1680 | |
---|
| 1681 | PRO FSC_PSCONFIG::SetDefault, defaultname |
---|
| 1682 | |
---|
| 1683 | ; This method implements the default setups. To add your own default |
---|
| 1684 | ; setups, add the new default name to the list in the DefaultList method |
---|
| 1685 | ; above. Then add the default settings in the CASE statement below. |
---|
| 1686 | |
---|
| 1687 | Catch, theError |
---|
| 1688 | IF theError NE 0 THEN BEGIN |
---|
| 1689 | Catch, /Cancel |
---|
| 1690 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 1691 | RETURN |
---|
| 1692 | ENDIF |
---|
| 1693 | |
---|
| 1694 | ; Set the page type and page units here, based on EUROPEAN setting. |
---|
| 1695 | |
---|
| 1696 | IF self.european THEN BEGIN |
---|
| 1697 | pagetype = 'A4' |
---|
| 1698 | units = 0 |
---|
| 1699 | ENDIF ELSE BEGIN |
---|
| 1700 | pagetype = 'LETTER' |
---|
| 1701 | units = 1 |
---|
| 1702 | ENDELSE |
---|
| 1703 | |
---|
| 1704 | ; Get the directory name. |
---|
| 1705 | |
---|
| 1706 | IF Obj_Valid(self.filenameID) THEN BEGIN |
---|
| 1707 | self.filenameID->GetProperty, Directory=directoryName |
---|
| 1708 | ENDIF ELSE BEGIN |
---|
| 1709 | CD, Current=directoryName |
---|
| 1710 | ENDELSE |
---|
| 1711 | |
---|
| 1712 | ; Get the file name. |
---|
| 1713 | |
---|
| 1714 | IF Obj_Valid(self.filenameID) THEN BEGIN |
---|
| 1715 | self.filenameID->GetProperty, Filename=defaultFileName |
---|
| 1716 | index = FSC_PSConfig_RStrPos( defaultFileName, "." ) |
---|
| 1717 | IF index GE 0 THEN defaultFileName = StrMid(defaultFileName, 0, index) |
---|
| 1718 | ENDIF ELSE BEGIN |
---|
| 1719 | IF self.filenameSet NE "" THEN defaultFilename = self.filenameSet ELSE defaultFileName = "idl" |
---|
| 1720 | ENDELSE |
---|
| 1721 | |
---|
| 1722 | ; Get the names of the defaults on the default list. |
---|
| 1723 | |
---|
| 1724 | defaultlist = self->DefaultList() |
---|
| 1725 | |
---|
| 1726 | ; If the defaultname variable is undefined, choose the first one |
---|
| 1727 | ; in the list. |
---|
| 1728 | |
---|
| 1729 | IF N_Elements(defaultname) EQ 0 THEN defaultname = defaultlist[0] |
---|
| 1730 | defaultname = String(defaultname) |
---|
| 1731 | |
---|
| 1732 | ; Define synonyms. |
---|
| 1733 | |
---|
| 1734 | IF StrUpCase(defaultname) EQ 'SYSTEM' THEN defaultname = 'System (Portrait)' |
---|
| 1735 | IF StrUpCase(defaultname) EQ 'PORTRAIT' THEN defaultname = 'Centered (Portrait)' |
---|
| 1736 | IF StrUpCase(defaultname) EQ 'LANDSCAPE' THEN defaultname = 'Centered (Landscape)' |
---|
| 1737 | IF StrUpCase(defaultname) EQ 'CENTER' THEN defaultname = 'Centered (Portrait)' |
---|
| 1738 | IF StrUpCase(defaultname) EQ 'CENTERED' THEN defaultname = 'Centered (Portrait)' |
---|
| 1739 | IF StrUpCase(defaultname) EQ 'FIGURE' THEN defaultname = 'Figure (Large)' |
---|
| 1740 | IF StrUpCase(defaultname) EQ 'ENCAPSULATED' THEN defaultname = 'Figure (Small)' |
---|
| 1741 | IF StrUpCase(defaultname) EQ 'ENCAPSULATE' THEN defaultname = 'Figure (Small)' |
---|
| 1742 | IF StrUpCase(defaultname) EQ 'COLOR' THEN defaultname = 'Color (Portrait)' |
---|
| 1743 | IF StrUpCase(defaultname) EQ 'NONE' THEN defaultname = 'None' |
---|
| 1744 | |
---|
| 1745 | |
---|
| 1746 | index = Where(StrUpCase(defaultlist) EQ StrUpCase(defaultname), count) |
---|
| 1747 | IF count EQ 0 THEN BEGIN |
---|
| 1748 | ok = Dialog_Message(['Default set-up "' + defaultname + '" is', $ |
---|
| 1749 | 'unknown. Using system defaults.']) |
---|
| 1750 | defaultname = 'System (Portrait)' |
---|
| 1751 | ENDIF |
---|
| 1752 | |
---|
| 1753 | thisDefault = defaultlist[index[0]] |
---|
| 1754 | |
---|
| 1755 | ; The default setups. Add your setups to this CASE statement if you are |
---|
| 1756 | ; adding a new default setup. |
---|
| 1757 | |
---|
| 1758 | CASE thisDefault OF |
---|
| 1759 | |
---|
| 1760 | 'System (Portrait)': BEGIN |
---|
| 1761 | self.bitsSet = '8' ; Sets the Bits-per-Pixels keyword. |
---|
| 1762 | self.colorSet = 0 ; Sets the Color keyword. |
---|
| 1763 | self.directorySet = directoryName ; Sets the directory name of the PostScript file. |
---|
| 1764 | self.encapsulationSet = 0 ; Sets the Encapsulation keyword. |
---|
| 1765 | self.filenameSet = defaultFilename + ".ps" ; Sets the filename of the PostScript file. |
---|
| 1766 | self.fonttypeSet = !P.Font ; Sets the Font keyword. |
---|
| 1767 | self.fontsizeSet = 12 ; Sets the Font_Size keyword. |
---|
| 1768 | self.fontStyleSet = Replicate(0, 8) ; Sets the font style keywords in this order: Bold, Book, Demi, Italic, Light, Medium, Narrow, and Oblique. |
---|
| 1769 | self.fontnameSet = "Helvetica" ; Sets the PostScript font name. All PostScript font names acceptable. |
---|
| 1770 | self.inchesSet = units ; Sets the Inches keyword. |
---|
| 1771 | self.landscapeSet = 0 ; Sets the Landscape keyword. |
---|
| 1772 | self.isolatinSet = 0 ; Sets the Isolatin1 keyword. |
---|
| 1773 | self.pagetypeSet = pagetype ; Sets the page type. Possible values include "Letter", "A4", etc. |
---|
| 1774 | self.pagetype = pagetype ; Sets the page type. Possible values include "Letter", "A4", etc. |
---|
| 1775 | self.previewSet = 0 ; Sets the Preview keyword. |
---|
| 1776 | self.truetypeSet = 0 ; Sets the TT_Font keyword. |
---|
| 1777 | IF self.european THEN self.xoffsetSet = 1.61 ELSE self.xoffsetSet = 0.75 ; Sets the XOffset keyword. |
---|
| 1778 | IF self.european THEN self.yoffsetSet = 14.65 ELSE self.yoffsetSet = 5.0 ; Sets the YOffset keyword. |
---|
| 1779 | IF self.european THEN self.xsizeSet = 17.80 ELSE self.xsizeSet = 7.0 ; Sets the XSize keyword. |
---|
| 1780 | IF self.european THEN self.ysizeSet = 12.70 ELSE self.ysizeSet = 5.0 ; Sets the YSize keyword. |
---|
| 1781 | self.defaultsSet = 'System (Portrait)' |
---|
| 1782 | ENDCASE |
---|
| 1783 | |
---|
| 1784 | 'System (Landscape)': BEGIN |
---|
| 1785 | self.bitsSet = '8' |
---|
| 1786 | self.colorSet = 0 |
---|
| 1787 | self.directorySet = directoryName |
---|
| 1788 | self.encapsulationSet = 0 |
---|
| 1789 | self.filenameSet = defaultFilename + ".ps" |
---|
| 1790 | self.fonttypeSet = !P.Font |
---|
| 1791 | self.fontsizeSet = 12 |
---|
| 1792 | self.fontstyleSet = Replicate(0, 8) |
---|
| 1793 | self.fontnameSet = "Helvetica" |
---|
| 1794 | self.inchesSet = units |
---|
| 1795 | self.landscapeSet = 1 |
---|
| 1796 | self.isolatinSet = 0 |
---|
| 1797 | self.pagetypeSet = pagetype |
---|
| 1798 | self.pagetype = pagetype |
---|
| 1799 | self.previewSet = 0 |
---|
| 1800 | self.truetypeSet = 0 |
---|
| 1801 | IF self.european THEN self.xoffsetSet = 1.76 ELSE self.xoffsetSet = 0.75 |
---|
| 1802 | IF self.european THEN self.yoffsetSet = 1.69 ELSE self.yoffsetSet = 0.75 |
---|
| 1803 | IF self.european THEN self.xsizeSet = 26.25 ELSE self.xsizeSet = 9.5 |
---|
| 1804 | IF self.european THEN self.ysizeSet = 17.63 ELSE self.ysizeSet = 7.0 |
---|
| 1805 | self.defaultsSet = 'System (Landscape)' |
---|
| 1806 | ENDCASE |
---|
| 1807 | |
---|
| 1808 | 'Centered (Portrait)': BEGIN |
---|
| 1809 | self.bitsSet = '8' |
---|
| 1810 | self.colorSet = 1 |
---|
| 1811 | self.directorySet = directoryName |
---|
| 1812 | self.encapsulationSet = 0 |
---|
| 1813 | self.filenameSet = defaultFilename + ".ps" |
---|
| 1814 | self.fonttypeSet = !P.Font |
---|
| 1815 | self.fontsizeSet = 12 |
---|
| 1816 | self.fontstyleSet = Replicate(0, 8) |
---|
| 1817 | self.fontnameSet = "Helvetica" |
---|
| 1818 | self.inchesSet = units |
---|
| 1819 | self.landscapeSet = 0 |
---|
| 1820 | self.isolatinSet = 0 |
---|
| 1821 | self.pagetypeSet = pagetype |
---|
| 1822 | self.pagetype = pagetype |
---|
| 1823 | self.previewSet = 0 |
---|
| 1824 | self.truetypeSet = 0 |
---|
| 1825 | IF self.european THEN self.xoffsetSet = 3.51 ELSE self.xoffsetSet = 1.5 |
---|
| 1826 | IF self.european THEN self.yoffsetSet = 3.68 ELSE self.yoffsetSet = 1.5 |
---|
| 1827 | IF self.european THEN self.xsizeSet = 14.00 ELSE self.xsizeSet = 5.5 |
---|
| 1828 | IF self.european THEN self.ysizeSet = 22.40 ELSE self.ysizeSet = 8.0 |
---|
| 1829 | self.defaultsSet = 'Centered (Portrait)' |
---|
| 1830 | ENDCASE |
---|
| 1831 | |
---|
| 1832 | 'Centered (Landscape)': BEGIN |
---|
| 1833 | self.bitsSet = '8' |
---|
| 1834 | self.colorSet = 1 |
---|
| 1835 | self.directorySet = directoryName |
---|
| 1836 | self.encapsulationSet = 0 |
---|
| 1837 | self.filenameSet = defaultFilename + ".ps" |
---|
| 1838 | self.fonttypeSet = !P.Font |
---|
| 1839 | self.fontsizeSet = 12 |
---|
| 1840 | self.fontstyleSet = Replicate(0, 8) |
---|
| 1841 | self.fontnameSet = "Helvetica" |
---|
| 1842 | self.inchesSet = units |
---|
| 1843 | self.landscapeSet = 1 |
---|
| 1844 | self.isolatinSet = 0 |
---|
| 1845 | self.pagetypeSet = pagetype |
---|
| 1846 | self.pagetype = pagetype |
---|
| 1847 | self.previewSet = 0 |
---|
| 1848 | self.truetypeSet = 0 |
---|
| 1849 | IF self.european THEN self.xoffsetSet = 3.66 ELSE self.xoffsetSet = 1.5 |
---|
| 1850 | IF self.european THEN self.yoffsetSet = 3.52 ELSE self.yoffsetSet = 1.5 |
---|
| 1851 | IF self.european THEN self.xsizeSet = 22.43 ELSE self.xsizeSet = 8.0 |
---|
| 1852 | IF self.european THEN self.ysizeSet = 13.97 ELSE self.ysizeSet = 5.5 |
---|
| 1853 | self.defaultsSet = 'Centered (Landscape)' |
---|
| 1854 | ENDCASE |
---|
| 1855 | |
---|
| 1856 | 'Square (Portrait)': BEGIN |
---|
| 1857 | self.bitsSet = '8' |
---|
| 1858 | self.colorSet = 1 |
---|
| 1859 | self.directorySet = directoryName |
---|
| 1860 | self.encapsulationSet = 0 |
---|
| 1861 | self.filenameSet = defaultFilename + ".ps" |
---|
| 1862 | self.fonttypeSet = !P.Font |
---|
| 1863 | self.fontsizeSet = 12 |
---|
| 1864 | self.fontstyleSet = Replicate(0, 8) |
---|
| 1865 | self.fontnameSet = "Helvetica" |
---|
| 1866 | self.inchesSet = units |
---|
| 1867 | self.landscapeSet = 0 |
---|
| 1868 | self.isolatinSet = 0 |
---|
| 1869 | self.pagetypeSet = pagetype |
---|
| 1870 | self.pagetype = pagetype |
---|
| 1871 | self.previewSet = 0 |
---|
| 1872 | self.truetypeSet = 0 |
---|
| 1873 | IF self.european THEN self.xoffsetSet = 2.26 ELSE self.xoffsetSet = 1.0 |
---|
| 1874 | IF self.european THEN self.yoffsetSet = 6.63 ELSE self.yoffsetSet = 2.25 |
---|
| 1875 | IF self.european THEN self.xsizeSet = 16.50 ELSE self.xsizeSet = 6.5 |
---|
| 1876 | IF self.european THEN self.ysizeSet = 16.50 ELSE self.ysizeSet = 6.5 |
---|
| 1877 | self.defaultsSet = 'Square (Portrait)' |
---|
| 1878 | ENDCASE |
---|
| 1879 | |
---|
| 1880 | 'Square (Landscape)': BEGIN |
---|
| 1881 | self.bitsSet = '8' |
---|
| 1882 | self.colorSet = 1 |
---|
| 1883 | self.directorySet = directoryName |
---|
| 1884 | self.encapsulationSet = 0 |
---|
| 1885 | self.filenameSet = defaultFilename + ".ps" |
---|
| 1886 | self.fonttypeSet = !P.Font |
---|
| 1887 | self.fontsizeSet = 12 |
---|
| 1888 | self.fontstyleSet = Replicate(0, 8) |
---|
| 1889 | self.fontnameSet = "Helvetica" |
---|
| 1890 | self.inchesSet = units |
---|
| 1891 | self.landscapeSet = 1 |
---|
| 1892 | self.isolatinSet = 0 |
---|
| 1893 | self.pagetypeSet = pagetype |
---|
| 1894 | self.pagetype = pagetype |
---|
| 1895 | self.previewSet = 0 |
---|
| 1896 | self.truetypeSet = 0 |
---|
| 1897 | IF self.european THEN self.xoffsetSet = 6.63 ELSE self.xoffsetSet = 2.25 |
---|
| 1898 | IF self.european THEN self.yoffsetSet = 2.26 ELSE self.yoffsetSet = 1.0 |
---|
| 1899 | IF self.european THEN self.xsizeSet = 16.50 ELSE self.xsizeSet = 6.5 |
---|
| 1900 | IF self.european THEN self.ysizeSet = 16.50 ELSE self.ysizeSet = 6.5 |
---|
| 1901 | self.defaultsSet = 'Square (Landscape)' |
---|
| 1902 | ENDCASE |
---|
| 1903 | |
---|
| 1904 | 'Figure (Small)': BEGIN |
---|
| 1905 | self.bitsSet = '8' |
---|
| 1906 | self.colorSet = 1 |
---|
| 1907 | self.directorySet = directoryName |
---|
| 1908 | self.encapsulationSet = 1 |
---|
| 1909 | self.filenameSet = defaultFilename + ".eps" |
---|
| 1910 | self.fonttypeSet = !P.Font |
---|
| 1911 | self.fontsizeSet = 12 |
---|
| 1912 | self.fontstyleSet = Replicate(0, 8) |
---|
| 1913 | self.fontnameSet = "Helvetica" |
---|
| 1914 | self.inchesSet = units |
---|
| 1915 | self.landscapeSet = 0 |
---|
| 1916 | self.isolatinSet = 0 |
---|
| 1917 | self.pagetypeSet = pagetype |
---|
| 1918 | self.pagetype = pagetype |
---|
| 1919 | self.previewSet = 2 |
---|
| 1920 | self.truetypeSet = 0 |
---|
| 1921 | IF self.european THEN self.xoffsetSet = 6.06 ELSE self.xoffsetSet = 2.5 |
---|
| 1922 | IF self.european THEN self.yoffsetSet = 11.71 ELSE self.yoffsetSet = 4.25 |
---|
| 1923 | IF self.european THEN self.xsizeSet = 8.89 ELSE self.xsizeSet = 3.5 |
---|
| 1924 | IF self.european THEN self.ysizeSet = 6.35 ELSE self.ysizeSet = 2.5 |
---|
| 1925 | self.defaultsSet = 'Figure (Small)' |
---|
| 1926 | ENDCASE |
---|
| 1927 | |
---|
| 1928 | 'Figure (Large)': BEGIN |
---|
| 1929 | self.bitsSet = '8' |
---|
| 1930 | self.colorSet = 1 |
---|
| 1931 | self.directorySet = directoryName |
---|
| 1932 | self.encapsulationSet = 1 |
---|
| 1933 | self.filenameSet = defaultFilename + ".eps" |
---|
| 1934 | self.fonttypeSet = 0 |
---|
| 1935 | self.fontsizeSet = 12 |
---|
| 1936 | self.fontstyleSet = Replicate(0, 8) |
---|
| 1937 | self.fontnameSet = "Helvetica" |
---|
| 1938 | self.inchesSet = units |
---|
| 1939 | self.landscapeSet = 0 |
---|
| 1940 | self.isolatinSet = 0 |
---|
| 1941 | self.pagetypeSet = pagetype |
---|
| 1942 | self.pagetype = pagetype |
---|
| 1943 | self.previewSet = 2 |
---|
| 1944 | self.truetypeSet = 0 |
---|
| 1945 | IF self.european THEN self.xoffsetSet = 4.16 ELSE self.xoffsetSet = 1.75 |
---|
| 1946 | IF self.european THEN self.yoffsetSet = 9.8 ELSE self.yoffsetSet = 3.5 |
---|
| 1947 | IF self.european THEN self.xsizeSet = 12.70 ELSE self.xsizeSet = 5.0 |
---|
| 1948 | IF self.european THEN self.ysizeSet = 10.16 ELSE self.ysizeSet = 4.0 |
---|
| 1949 | self.defaultsSet = 'Figure (Large)' |
---|
| 1950 | ENDCASE |
---|
| 1951 | |
---|
| 1952 | 'Color (Portrait)': BEGIN |
---|
| 1953 | self.bitsSet = '8' |
---|
| 1954 | self.colorSet = 1 |
---|
| 1955 | self.directorySet = directoryName |
---|
| 1956 | self.encapsulationSet = 0 |
---|
| 1957 | self.filenameSet = defaultFilename + ".ps" |
---|
| 1958 | self.fonttypeSet = !P.Font |
---|
| 1959 | self.fontsizeSet = 12 |
---|
| 1960 | self.fontstyleSet = Replicate(0, 8) |
---|
| 1961 | self.fontnameSet = "Helvetica" |
---|
| 1962 | self.inchesSet = units |
---|
| 1963 | self.landscapeSet = 0 |
---|
| 1964 | self.isolatinSet = 0 |
---|
| 1965 | self.pagetypeSet = pagetype |
---|
| 1966 | self.pagetype = pagetype |
---|
| 1967 | self.previewSet = 0 |
---|
| 1968 | self.truetypeSet = 0 |
---|
| 1969 | IF self.european THEN self.xoffsetSet = 3.51 ELSE self.xoffsetSet = 1.5 |
---|
| 1970 | IF self.european THEN self.yoffsetSet = 3.68 ELSE self.yoffsetSet = 1.5 |
---|
| 1971 | IF self.european THEN self.xsizeSet = 14.00 ELSE self.xsizeSet = 5.5 |
---|
| 1972 | IF self.european THEN self.ysizeSet = 22.40 ELSE self.ysizeSet = 8.0 |
---|
| 1973 | self.defaultsSet = 'Color (Portrait)' |
---|
| 1974 | ENDCASE |
---|
| 1975 | |
---|
| 1976 | 'Color (Landscape)': BEGIN |
---|
| 1977 | self.bitsSet = '8' |
---|
| 1978 | self.colorSet = 1 |
---|
| 1979 | self.directorySet = directoryName |
---|
| 1980 | self.encapsulationSet = 0 |
---|
| 1981 | self.filenameSet = defaultFilename + ".ps" |
---|
| 1982 | self.fonttypeSet = !P.Font |
---|
| 1983 | self.fontsizeSet = 12 |
---|
| 1984 | self.fontstyleSet = Replicate(0, 8) |
---|
| 1985 | self.fontnameSet = "Helvetica" |
---|
| 1986 | self.inchesSet = units |
---|
| 1987 | self.landscapeSet = 1 |
---|
| 1988 | self.isolatinSet = 0 |
---|
| 1989 | self.pagetypeSet = pagetype |
---|
| 1990 | self.pagetype = pagetype |
---|
| 1991 | self.previewSet = 0 |
---|
| 1992 | self.truetypeSet = 0 |
---|
| 1993 | IF self.european THEN self.xoffsetSet = 3.66 ELSE self.xoffsetSet = 1.5 |
---|
| 1994 | IF self.european THEN self.yoffsetSet = 3.52 ELSE self.yoffsetSet = 1.5 |
---|
| 1995 | IF self.european THEN self.xsizeSet = 22.43 ELSE self.xsizeSet = 8.0 |
---|
| 1996 | IF self.european THEN self.ysizeSet = 13.97 ELSE self.ysizeSet = 5.5 |
---|
| 1997 | self.defaultsSet = 'Color (Landscape)' |
---|
| 1998 | ENDCASE |
---|
| 1999 | |
---|
| 2000 | ELSE: self.defaultsSet = 'None' |
---|
| 2001 | ENDCASE |
---|
| 2002 | |
---|
| 2003 | |
---|
| 2004 | IF Obj_Valid(self.plotID) THEN BEGIN |
---|
| 2005 | IF self.inchesSet THEN plotUnits = 'INCHES' ELSE plotUnits = 'CENTIMETERS' |
---|
| 2006 | self.plotID->SetUnits, plotUnits |
---|
| 2007 | ENDIF |
---|
| 2008 | |
---|
| 2009 | ; If the font information is on the display, update it. |
---|
| 2010 | |
---|
| 2011 | IF self.fontInfo THEN BEGIN |
---|
| 2012 | |
---|
| 2013 | IF self.fontTypeSet EQ -1 THEN BEGIN |
---|
| 2014 | Widget_Control, self.fontnameID->GetID(), Sensitive=0 |
---|
| 2015 | Widget_Control, self.stylebaseID, Sensitive=0 |
---|
| 2016 | Widget_Control, self.clearbuttonID, Sensitive=0 |
---|
| 2017 | Widget_Control, self.fontSizeID->GetID(), Sensitive=0 |
---|
| 2018 | Widget_Control, self.truetypeID->GetID(), Sensitive=0 |
---|
| 2019 | Widget_Control, self.isolatinID->GetID(), Sensitive=0 |
---|
| 2020 | IF Obj_Valid(self.set_fontID) THEN Widget_Control, self.set_fontID->GetID(), Sensitive=0 |
---|
| 2021 | ENDIF ELSE BEGIN |
---|
| 2022 | Widget_Control, self.fontnameID->GetID(), Sensitive=1 |
---|
| 2023 | Widget_Control, self.stylebaseID, Sensitive=1 |
---|
| 2024 | Widget_Control, self.clearbuttonID, Sensitive=1 |
---|
| 2025 | Widget_Control, self.fontSizeID->GetID(), Sensitive=1 |
---|
| 2026 | Widget_Control, self.truetypeID->GetID(), Sensitive=1 |
---|
| 2027 | Widget_Control, self.isolatinID->GetID(), Sensitive=1 |
---|
| 2028 | IF Obj_Valid(self.set_fontID) THEN Widget_Control, self.set_fontID->GetID(), Sensitive=1 |
---|
| 2029 | |
---|
| 2030 | ENDELSE |
---|
| 2031 | |
---|
| 2032 | ENDIF |
---|
| 2033 | |
---|
| 2034 | ; Update the display. |
---|
| 2035 | |
---|
| 2036 | self->UpDateDisplay |
---|
| 2037 | |
---|
| 2038 | END ;-------------------------------------------------------------------------------- |
---|
| 2039 | |
---|
| 2040 | |
---|
| 2041 | |
---|
| 2042 | PRO FSC_PSCONFIG::StatusLight, safe |
---|
| 2043 | |
---|
| 2044 | ; This method sets the status light (the background color of the |
---|
| 2045 | ; page window). Safe equal 1 means the current configuration is saved. |
---|
| 2046 | ; Safe equal 0 means the current configuration is not saved. The |
---|
| 2047 | ; REVERT button is turned on or off to reflect the current SAFE state. |
---|
| 2048 | |
---|
| 2049 | Catch, theError |
---|
| 2050 | IF theError NE 0 THEN BEGIN |
---|
| 2051 | Catch, /Cancel |
---|
| 2052 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 2053 | RETURN |
---|
| 2054 | ENDIF |
---|
| 2055 | |
---|
| 2056 | safe = Keyword_Set(safe) |
---|
| 2057 | |
---|
| 2058 | ; Different colors based on depth of visual class. |
---|
| 2059 | |
---|
| 2060 | Device, Get_Visual_Depth=theDepth |
---|
| 2061 | IF safe THEN BEGIN |
---|
| 2062 | IF theDepth GT 8 THEN windowColor = [60, 140, 140] ELSE windowColor = [80, 80, 80] |
---|
| 2063 | Widget_Control, self.revertID, Sensitive=0 |
---|
| 2064 | ENDIF ELSE BEGIN |
---|
| 2065 | IF theDepth GT 8 THEN windowColor = [200, 133, 133] ELSE windowColor = [140, 140, 140] |
---|
| 2066 | Widget_Control, self.revertID, Sensitive=1 |
---|
| 2067 | ENDELSE |
---|
| 2068 | |
---|
| 2069 | ; Update the background window color. Done only in NOBLOCK conditions. |
---|
| 2070 | |
---|
| 2071 | IF self.noblock THEN self.plotID->SetWindowColor, windowColor |
---|
| 2072 | END ;-------------------------------------------------------------------------------- |
---|
| 2073 | |
---|
| 2074 | |
---|
| 2075 | |
---|
| 2076 | PRO FSC_PSCONFIG::StyleButtons, event |
---|
| 2077 | |
---|
| 2078 | ; This event handler method responds to changes in the font style buttons. |
---|
| 2079 | |
---|
| 2080 | Catch, theError |
---|
| 2081 | IF theError NE 0 THEN BEGIN |
---|
| 2082 | Catch, /Cancel |
---|
| 2083 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 2084 | RETURN |
---|
| 2085 | ENDIF |
---|
| 2086 | |
---|
| 2087 | index = Where(self.fontStyleButtonID EQ event.id) |
---|
| 2088 | index = index[0] |
---|
| 2089 | self.fontStyleSet[index] = event.select |
---|
| 2090 | END ;-------------------------------------------------------------------------------- |
---|
| 2091 | |
---|
| 2092 | |
---|
| 2093 | |
---|
| 2094 | PRO FSC_PSCONFIG::Units, event |
---|
| 2095 | |
---|
| 2096 | ; This event handler method responds to changes in the Units droplist. |
---|
| 2097 | |
---|
| 2098 | Catch, theError |
---|
| 2099 | IF theError NE 0 THEN BEGIN |
---|
| 2100 | Catch, /Cancel |
---|
| 2101 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 2102 | RETURN |
---|
| 2103 | ENDIF |
---|
| 2104 | |
---|
| 2105 | units = self.unitsID->GetSelection() |
---|
| 2106 | self.plotID->SetUnits, units |
---|
| 2107 | self.plotID->GetWindowLocation, xsize, ysize, xoffset, yoffset |
---|
| 2108 | self->UpdateSizes, xsize, ysize, xoffset, yoffset |
---|
| 2109 | END ;-------------------------------------------------------------------------------- |
---|
| 2110 | |
---|
| 2111 | |
---|
| 2112 | |
---|
| 2113 | PRO FSC_PSCONFIG::UpdateDisplay |
---|
| 2114 | |
---|
| 2115 | ; This method updates the GUI display with the current object settings. |
---|
| 2116 | |
---|
| 2117 | Catch, theError |
---|
| 2118 | IF theError NE 0 THEN BEGIN |
---|
| 2119 | Catch, /Cancel |
---|
| 2120 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 2121 | RETURN |
---|
| 2122 | ENDIF |
---|
| 2123 | |
---|
| 2124 | ; Can only update if widget is valid and realized. |
---|
| 2125 | |
---|
| 2126 | IF Widget_Info(self.tlb, /Valid_ID) EQ 0 THEN RETURN |
---|
| 2127 | IF Widget_Info(self.tlb, /Realized) EQ 0 THEN RETURN |
---|
| 2128 | |
---|
| 2129 | ; Set the normal GUI widgets. |
---|
| 2130 | |
---|
| 2131 | self.bitsID->SetSelection, self.bitsSet |
---|
| 2132 | self.cmykID->SetIndex, self.cmykSet |
---|
| 2133 | self.colorID->SetIndex, self.colorSet |
---|
| 2134 | self.filenameID->SetProperty, Directory=self.directorySet, Filename=self.filenameSet |
---|
| 2135 | self.encapsulationID->SetIndex, self.encapsulationSet |
---|
| 2136 | self.unitsID->SetIndex, self.inchesSet |
---|
| 2137 | self.orientationID->SetIndex, self.landscapeSet |
---|
| 2138 | self.pagetypeID->SetSelection, self.pagetypeSet |
---|
| 2139 | self.previewID->SetIndex, self.previewSet |
---|
| 2140 | self.xsizeID->Set_Value, self.xsizeSet |
---|
| 2141 | self.ysizeID->Set_Value, self.ysizeSet |
---|
| 2142 | self.xoffsetID->Set_Value, self.xoffsetSet |
---|
| 2143 | self.yoffsetID->Set_Value, self.yoffsetSet |
---|
| 2144 | self.defaultsID->SetSelection, self.defaultsSet |
---|
| 2145 | |
---|
| 2146 | ; If font information is on the display, set that too. |
---|
| 2147 | |
---|
| 2148 | IF self.fontInfo THEN BEGIN |
---|
| 2149 | self.fontTypeID->SetIndex, (0 > (self.fonttypeSet + 1) < 2) |
---|
| 2150 | self.fontsizeID->SetSelection, StrTrim(self.fontsizeSet,2) |
---|
| 2151 | self.isolatinID->SetIndex, self.isolatinSet |
---|
| 2152 | self->UpDateFontStyle |
---|
| 2153 | self.fontnameID->SetSelection, self.fontnameSet |
---|
| 2154 | IF Obj_Valid(self.set_fontID) THEN self.set_fontID->Set_Value, self.set_fontSet |
---|
| 2155 | self.truetypeID->SetIndex, self.truetypeSet |
---|
| 2156 | ENDIF |
---|
| 2157 | |
---|
| 2158 | ; Update the plot window and set the size and offset widgets. |
---|
| 2159 | |
---|
| 2160 | self.plotID->SetPageSize, self.pagetypeSet, Landscape=self.landscapeSet, TLB=self.tlb |
---|
| 2161 | self.plotID->SetWindowLocation, self.xsizeSet, self.ysizeSet, self.xoffsetSet, self.yoffsetSet |
---|
| 2162 | self.plotID->GetWindowLocation, xsize, ysize, xoffset, yoffset |
---|
| 2163 | self.xsizeID->Set_Value, xsize |
---|
| 2164 | self.ysizeID->Set_Value, ysize |
---|
| 2165 | self.xoffsetID->Set_Value, xoffset |
---|
| 2166 | self.yoffsetID->Set_Value, yoffset |
---|
| 2167 | self.plotID->SetColor, self.colorSet |
---|
| 2168 | |
---|
| 2169 | IF self.encapsulationSet THEN self.previewID->Sensitive, 1 ELSE self.previewID->Sensitive, 0 |
---|
| 2170 | |
---|
| 2171 | END ;-------------------------------------------------------------------------------- |
---|
| 2172 | |
---|
| 2173 | |
---|
| 2174 | |
---|
| 2175 | PRO FSC_PSCONFIG::UpdateFontStyle, Clear = Clear |
---|
| 2176 | |
---|
| 2177 | ; This method updates the font style box. If the CLEAR keyword |
---|
| 2178 | ; is set, all the widgets are turned OFF. |
---|
| 2179 | |
---|
| 2180 | Catch, theError |
---|
| 2181 | IF theError NE 0 THEN BEGIN |
---|
| 2182 | Catch, /Cancel |
---|
| 2183 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 2184 | RETURN |
---|
| 2185 | ENDIF |
---|
| 2186 | |
---|
| 2187 | IF Keyword_Set(clear) THEN BEGIN |
---|
| 2188 | FOR j=0,7 DO BEGIN |
---|
| 2189 | Widget_Control, self.fontstyleButtonID[j], Set_Button=0 |
---|
| 2190 | self.fontStyleSet[j] = 0 |
---|
| 2191 | ENDFOR |
---|
| 2192 | ENDIF ELSE BEGIN |
---|
| 2193 | FOR j=0,7 DO Widget_Control, self.fontstyleButtonID[j], Set_Button=self.fontStyleSet[j] |
---|
| 2194 | ENDELSE |
---|
| 2195 | |
---|
| 2196 | END ;-------------------------------------------------------------------------------- |
---|
| 2197 | |
---|
| 2198 | |
---|
| 2199 | |
---|
| 2200 | PRO FSC_PSCONFIG::UpdateSizes, xsize, ysize, xoffset, yoffset |
---|
| 2201 | |
---|
| 2202 | ; This method updates the size and offset widgets. |
---|
| 2203 | |
---|
| 2204 | Catch, theError |
---|
| 2205 | IF theError NE 0 THEN BEGIN |
---|
| 2206 | Catch, /Cancel |
---|
| 2207 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 2208 | RETURN |
---|
| 2209 | ENDIF |
---|
| 2210 | |
---|
| 2211 | self.xsizeID->Set_Value, xsize |
---|
| 2212 | self.ysizeID->Set_Value, ysize |
---|
| 2213 | self.xoffsetID->Set_Value, xoffset |
---|
| 2214 | self.yoffsetID->Set_Value, yoffset |
---|
| 2215 | END ;-------------------------------------------------------------------------------- |
---|
| 2216 | |
---|
| 2217 | |
---|
| 2218 | |
---|
| 2219 | PRO FSC_PSCONFIG::WindowSize, event |
---|
| 2220 | |
---|
| 2221 | ; This is the event handler method that responds to events |
---|
| 2222 | ; in the XSize, YSize, XOffset, and YOffset text widgets. |
---|
| 2223 | |
---|
| 2224 | Catch, theError |
---|
| 2225 | IF theError NE 0 THEN BEGIN |
---|
| 2226 | Catch, /Cancel |
---|
| 2227 | ok = FSC_PSConfig_Error_Message(Traceback=self.debug) |
---|
| 2228 | RETURN |
---|
| 2229 | ENDIF |
---|
| 2230 | |
---|
| 2231 | ; Get the values in the appropriate widgets. |
---|
| 2232 | |
---|
| 2233 | IF N_Elements(self.xsizeID->Get_Value()) EQ 0 THEN BEGIN |
---|
| 2234 | IF self.inchesSet THEN xsize = 1.0 ELSE xsize = 2.54 |
---|
| 2235 | ENDIF ELSE xsize = self.xsizeID->Get_Value() |
---|
| 2236 | IF N_Elements(self.ysizeID->Get_Value()) EQ 0 THEN BEGIN |
---|
| 2237 | IF self.inchesSet THEN ysize = 1.0 ELSE ysize = 2.54 |
---|
| 2238 | ENDIF ELSE ysize = self.ysizeID->Get_Value() |
---|
| 2239 | IF N_Elements(self.xoffsetID->Get_Value()) EQ 0 THEN xoffset = 0.0 $ |
---|
| 2240 | ELSE xoffset = self.xoffsetID->Get_Value() |
---|
| 2241 | IF N_Elements(self.yoffsetID->Get_Value()) EQ 0 THEN yoffset = 0.0 $ |
---|
| 2242 | ELSE yoffset = self.yoffsetID->Get_Value() |
---|
| 2243 | |
---|
| 2244 | ; Change the plot window to these sizes and offsets. |
---|
| 2245 | |
---|
| 2246 | self.plotID->SetWindowLocation, xsize, ysize, xoffset, yoffset |
---|
| 2247 | |
---|
| 2248 | ; The input values may be bogus. Get the "real" values from the |
---|
| 2249 | ; plot object and update the size and offset widgets. |
---|
| 2250 | |
---|
| 2251 | self.plotID->GetWindowLocation, xsize, ysize, xoffset, yoffset |
---|
| 2252 | self.xsizeID->Set_Value, xsize |
---|
| 2253 | self.ysizeID->Set_Value, ysize |
---|
| 2254 | self.xoffsetID->Set_Value, xoffset |
---|
| 2255 | self.yoffsetID->Set_Value, yoffset |
---|
| 2256 | END ;-------------------------------------------------------------------------------- |
---|
| 2257 | |
---|
| 2258 | |
---|
| 2259 | |
---|
| 2260 | |
---|
| 2261 | PRO FSC_PSCONFIG::SetProperty, $ ; The SetProperty method of the object. |
---|
| 2262 | AvantGarde=avantgarde, $ ; Set this keyword to select the AvantGarde font. |
---|
| 2263 | Bits_per_Pixel=bits_per_pixel, $ ; The number of image bits saved for each image pixel: 2, 4, or 8. |
---|
| 2264 | Bold=bold, $ ; Set this keyword to select the Bold font style. |
---|
| 2265 | BookStyle=book, $ ; Set this keyword to select the Book font style. |
---|
| 2266 | Bkman=bookman, $ ; Set this keyword to select the Bookman font. |
---|
| 2267 | CMYK=cmyk, $ ; Set this keywprd to use CMYK colors instead of RGB. |
---|
| 2268 | Color=color, $ ; Set this keyword to select Color PostScript output. |
---|
| 2269 | Courier=courier, $ ; Set this keyword to select the Courier font. |
---|
| 2270 | DefaultSetup=defaultsetup, $ ; Set this keyword to the "name" of a default style. |
---|
| 2271 | Demi=demi, $ ; Set this keyword to select the Demi font style. |
---|
| 2272 | Directory=directory, $ ; Set thie keyword to the name of the starting directory. Current directory by default. |
---|
| 2273 | Encapsulated=encapsulated, $ ; Set this keyword to select Encapsulated PostScript output. |
---|
| 2274 | European=european, $ ; Set this keyword to indicate "european" mode (i.e., A4 page and centimeter units). |
---|
| 2275 | Filename=filename, $ ; Set this keyword to the name of the file. Default: 'idl.ps' |
---|
| 2276 | FontSize=fontsize, $ ; Set this keyword to the font size. Between 6 and 36. Default is 12. |
---|
| 2277 | FontType=fonttype, $ ; Set this keyword to select the font type: -1 is Hershey, 0 is hardward, 1 is true-type. |
---|
| 2278 | Helvetica=helvetica, $ ; Set this keyword to select the Helvetica font. |
---|
| 2279 | Inches=inches, $ ; Set this keyword to indicate sizes and offsets are in inches as opposed to centimeters. |
---|
| 2280 | Italic=italic, $ ; Set this keyword to select the Italic font style. |
---|
| 2281 | Isolatin=isolatin, $ ; Set this keyword to select ISOlatin1 encoding. |
---|
| 2282 | Landscape=landscape, $ ; Set this keyword to select Landscape output. |
---|
| 2283 | Light=light, $ ; Set this keyword to select the Light font style. |
---|
| 2284 | Medium=medium, $ ; Set this keyword to select the Medium font style. |
---|
| 2285 | Name=name, $ ; This is the "name" of the object. |
---|
| 2286 | Narrow=narrow, $ ; Set this keyword to select the Narrow font style. |
---|
| 2287 | Oblique=oblique, $ $ ; Set this keyword to select the Oblique font style. |
---|
| 2288 | PageType=pagetype, $ ; Set this keyword to the "type" of page: 'Letter', 'Legal', 'Ledger', or 'A4'. |
---|
| 2289 | Palatino=palatino, $ ; Set this keyword to select the Palatino font. |
---|
| 2290 | Preview=preview, $ ; Set this keyword to select Preview mode: 0, 1, or 2. |
---|
| 2291 | Schoolbook=schoolbook, $ ; Set this keyword to select the Schoolbook font. |
---|
| 2292 | Set_Font=set_font, $ ; Set this keyword to the name of a font passed to PostScript with Set_Plot keyword. |
---|
| 2293 | Symbol=symbol, $ ; Set this keyword to select the Symbol font. |
---|
| 2294 | Times=times, $ ; Set this keyword to select the Times font. |
---|
| 2295 | TrueType=truetype, $ ; Set this keyword to select True-Type fonts. |
---|
| 2296 | UpDate=update, $ $ ; Set this keyword to update the GUI if it is on the display. |
---|
| 2297 | XOffset=xoffset, $ ; Set this keyword to the XOffset. (Note: offset calculated from lower-left corner of page.) |
---|
| 2298 | XSize=xsize, $ ; Set this keyword to the X size of the PostScript "window". |
---|
| 2299 | YOffset=yoffset, $ ; Set this keyword to the YOffset. (Note: offset calculated from lower-left corner of page.) |
---|
| 2300 | YSize=ysize, $ ; Set this keyword to the Y size of the PostScript "window". |
---|
| 2301 | ZapfChancery=zapfchancery, $ ; Set this keyword to select the ZapfChancery font. |
---|
| 2302 | ZapfDingbats=zapfdingbats ; Set this keyword to select the ZapfDingbats font. |
---|
| 2303 | |
---|
| 2304 | Catch, theError |
---|
| 2305 | IF theError NE 0 THEN BEGIN |
---|
| 2306 | Catch, /Cancel |
---|
| 2307 | ok = FSC_PSConfig_Error_Message(Traceback=Keyword_Set(self.debug)) |
---|
| 2308 | RETURN |
---|
| 2309 | ENDIF |
---|
| 2310 | |
---|
| 2311 | ; Check for undefined variables. |
---|
| 2312 | |
---|
| 2313 | IF N_Elements(bits_per_pixel) NE 0 THEN BEGIN |
---|
| 2314 | IF bits_per_pixel EQ 2 OR bits_per_pixel EQ 4 OR bits_per_pixel EQ 8 THEN $ |
---|
| 2315 | self.bitsSet = StrTrim(bits_per_pixel,2) ELSE self.bitsSet = '8' |
---|
| 2316 | ENDIF |
---|
| 2317 | IF N_Elements(color) NE 0 THEN self.colorSet = color |
---|
| 2318 | IF N_Elements(directory) NE 0 THEN self.directorySet = directory |
---|
| 2319 | IF N_Elements(filename) NE 0 THEN self.filenameSet = filename |
---|
| 2320 | self.fullfilenameSet = self->Construct_Full_Filename() |
---|
| 2321 | IF N_Elements(fontsize) NE 0 THEN self.fontsizeSet = fontsize |
---|
| 2322 | IF N_Elements(fonttype) NE 0 THEN self.fonttypeSet = fonttype |
---|
| 2323 | IF N_Elements(encapsulated) NE 0 THEN self.encapsulationSet = encapsulated |
---|
| 2324 | IF Keyword_Set(inches) NE 0 THEN self.inchesSet = inches |
---|
| 2325 | IF N_Elements(landscape) NE 0 THEN self.landscape = landscape |
---|
| 2326 | IF Keyword_Set(name) NE 0 THEN self.name = name |
---|
| 2327 | IF N_Elements(pagetype) NE 0 THEN BEGIN |
---|
| 2328 | self.pagetypeSet = pagetype |
---|
| 2329 | self.pagetype = pagetype |
---|
| 2330 | ENDIF |
---|
| 2331 | IF N_Elements(preview) NE 0 THEN self.previewSet = 0 > preview < 2 |
---|
| 2332 | |
---|
| 2333 | IF N_Elements(set_font) NE 0 THEN self.set_fontSet = set_font |
---|
| 2334 | IF N_Elements(xsize) NE 0 THEN self.xsizeSet = xsize |
---|
| 2335 | IF N_Elements(ysize) NE 0 THEN self.ysizeSet = ysize |
---|
| 2336 | |
---|
| 2337 | ; Offsets are weird. |
---|
| 2338 | |
---|
| 2339 | dims = self->PageDimensions() |
---|
| 2340 | IF N_Elements(xoffset) NE 0 THEN IF self.landscape THEN self.xoffsetSet = dims[1] - yoffset ELSE self.xoffsetSet = xoffset |
---|
| 2341 | IF N_Elements(yoffset) NE 0 THEN IF self.landscape THEN self.yoffsetSet = xoffset ELSE self.yoffsetSet = yoffset |
---|
| 2342 | |
---|
| 2343 | |
---|
| 2344 | avantgarde = Keyword_Set(avantgarde) |
---|
| 2345 | bold = Keyword_Set(bold) |
---|
| 2346 | book = Keyword_Set(book) |
---|
| 2347 | bookman = Keyword_Set(bookman) |
---|
| 2348 | cmyk = Keyword_Set(cmyk) |
---|
| 2349 | courier = Keyword_Set(courier) |
---|
| 2350 | demi = Keyword_Set(demi) |
---|
| 2351 | encapsulated = Keyword_Set(encapsulated) |
---|
| 2352 | european = Keyword_Set(european) |
---|
| 2353 | helvetica = Keyword_Set(helvetica) |
---|
| 2354 | isolatin = Keyword_Set(isolatin) |
---|
| 2355 | italic = Keyword_Set(italic) |
---|
| 2356 | landscape = Keyword_Set(landscape) |
---|
| 2357 | light = Keyword_Set(light) |
---|
| 2358 | medium = Keyword_Set(medium) |
---|
| 2359 | narrow = Keyword_Set(narrow) |
---|
| 2360 | oblique = Keyword_Set(oblique) |
---|
| 2361 | palatino = Keyword_Set(palatino) |
---|
| 2362 | schoolbook = Keyword_Set(schoolbook) |
---|
| 2363 | symbol = Keyword_Set(symbol) |
---|
| 2364 | times = Keyword_Set(times) |
---|
| 2365 | truetype = Keyword_Set(truetype) |
---|
| 2366 | zapfchancery = Keyword_Set(zapfchancery) |
---|
| 2367 | zapfdingbats = Keyword_Set(zapfdingbats) |
---|
| 2368 | |
---|
| 2369 | fontset = [avantgarde, bookman, courier, helvetica, palatino, schoolbook, symbol, times, zapfchancery, zapfdingbats] |
---|
| 2370 | index = Where(fontset EQ 1, count) |
---|
| 2371 | IF count EQ 0 THEN self.fontnameSet = 'Helvetica' ELSE self.fontnameSet = (*self.fontnames)[index[0]] |
---|
| 2372 | IF self.fontnameSet EQ 'AvantGarde' THEN self.avantgarde = 1 ELSE self.avantgarde = 0 |
---|
| 2373 | IF self.fontnameSet EQ 'Bookman' THEN self.bookman = 1 ELSE self.bookman = 0 |
---|
| 2374 | IF self.fontnameSet EQ 'Courier' THEN self.courier = 1 ELSE self.courier = 0 |
---|
| 2375 | IF self.fontnameSet EQ 'Helvetica' THEN self.helvetica = 1 ELSE self.helvetica = 0 |
---|
| 2376 | IF self.fontnameSet EQ 'Palatino' THEN self.palatino = 1 ELSE self.palatino = 0 |
---|
| 2377 | IF self.fontnameSet EQ 'Schoolbook' THEN self.schoolbook = 1 ELSE self.schoolbook = 0 |
---|
| 2378 | IF self.fontnameSet EQ 'Symbol' THEN self.symbol = 1 ELSE self.symbol = 0 |
---|
| 2379 | IF self.fontnameSet EQ 'Times' THEN self.times = 1 ELSE self.times = 0 |
---|
| 2380 | IF self.fontnameSet EQ 'ZapfChancery' THEN self.zapfchancery = 1 ELSE self.zapfchancery = 0 |
---|
| 2381 | IF self.fontnameSet EQ 'ZapfDingbats' THEN self.zapfdingbats = 1 ELSE self.zapfdingbats = 0 |
---|
| 2382 | self.fontstyleSet = [bold, book, demi, italic, light, medium, narrow, oblique] |
---|
| 2383 | |
---|
| 2384 | ; Populate the self object by saving the configuration. |
---|
| 2385 | |
---|
| 2386 | self->SaveConfiguration |
---|
| 2387 | |
---|
| 2388 | ; Update the display if required. |
---|
| 2389 | |
---|
| 2390 | IF Keyword_Set(update) THEN self->UpdateDisplay |
---|
| 2391 | |
---|
| 2392 | END ;-------------------------------------------------------------------------------- |
---|
| 2393 | |
---|
| 2394 | |
---|
| 2395 | |
---|
| 2396 | PRO FSC_PSCONFIG::CLEANUP |
---|
| 2397 | Ptr_Free, self.fontnames |
---|
| 2398 | END ;-------------------------------------------------------------------------------- |
---|
| 2399 | |
---|
| 2400 | |
---|
| 2401 | |
---|
| 2402 | FUNCTION FSC_PSCONFIG::INIT, $ ; The INIT method of the FSC_PSCONFIG object. |
---|
| 2403 | AvantGarde=avantgarde, $ ; Set this keyword to select the AvantGarde font. |
---|
| 2404 | Bits_per_Pixel=bits_per_pixel, $ ; The number of image bits saved for each image pixel: 2, 4, or 8. |
---|
| 2405 | Bold=bold, $ ; Set this keyword to select the Bold font style. |
---|
| 2406 | BookStyle=book, $ ; Set this keyword to select the Book font style. |
---|
| 2407 | Bkman=bookman, $ ; Set this keyword to select the Bookman font. |
---|
| 2408 | CMYK=cmyk, $ ; Set this keywprd to use CMYK colors instead of RGB. |
---|
| 2409 | Color=color, $ ; Set this keyword to select Color PostScript output. |
---|
| 2410 | Courier=courier, $ ; Set this keyword to select the Courier font. |
---|
| 2411 | Debug=debug, $ ; Set this keyword to get traceback information when errors are encountered. |
---|
| 2412 | DefaultSetup=defaultsetup, $ ; Set this keyword to the "name" of a default style. |
---|
| 2413 | Demi=demi, $ ; Set this keyword to select the Demi font style. |
---|
| 2414 | Directory=directory, $ ; Set thie keyword to the name of the starting directory. Current directory by default. |
---|
| 2415 | Encapsulated=encapsulated, $ ; Set this keyword to select Encapsulated PostScript output. |
---|
| 2416 | European=european, $ ; Set this keyword to indicate "european" mode (i.e., A4 page and centimeter units). |
---|
| 2417 | Filename=filename, $ ; Set this keyword to the name of the file. Default: 'idl.ps' |
---|
| 2418 | FontSize=fontsize, $ ; Set this keyword to the font size. Between 6 and 36. Default is 12. |
---|
| 2419 | FontType=fonttype, $ ; Set this keyword to select the font type: -1 is Hershey, 0 is hardward, 1 is true-type. |
---|
| 2420 | Helvetica=helvetica, $ ; Set this keyword to select the Helvetica font. |
---|
| 2421 | Inches=inches, $ ; Set this keyword to indicate sizes and offsets are in inches as opposed to centimeters. |
---|
| 2422 | Italic=italic, $ ; Set this keyword to select the Italic font style. |
---|
| 2423 | Isolatin=isolatin, $ ; Set this keyword to select ISOlatin1 encoding. |
---|
| 2424 | Landscape=landscape, $ ; Set this keyword to select Landscape output. |
---|
| 2425 | Light=light, $ ; Set this keyword to select the Light font style. |
---|
| 2426 | Medium=medium, $ ; Set this keyword to select the Medium font style. |
---|
| 2427 | Name=name, $ ; The "name" of the object. Objects with different names can have their |
---|
| 2428 | ; graphical user interfaces appear simultaneously on the display. |
---|
| 2429 | Narrow=narrow, $ ; Set this keyword to select the Narrow font style. |
---|
| 2430 | Oblique=oblique, $ $ ; Set this keyword to select the Oblique font style. |
---|
| 2431 | PageType=pagetype, $ ; Set this keyword to the "type" of page: 'Letter', 'Legal', 'Ledger', or 'A4'. |
---|
| 2432 | Palatino=palatino, $ ; Set this keyword to select the Palatino font. |
---|
| 2433 | Preview=preview, $ ; Set this keyword to select Preview mode: 0, 1, or 2. |
---|
| 2434 | Schoolbook=schoolbook, $ ; Set this keyword to select the Schoolbook font. |
---|
| 2435 | Set_Font=set_font, $ ; Set this keyword to the name of a font passed to PostScript with Set_Plot keyword. |
---|
| 2436 | Symbol=symbol, $ ; Set this keyword to select the Symbol font. |
---|
| 2437 | Times=times, $ ; Set this keyword to select the Times font. |
---|
| 2438 | TrueType=truetype, $ ; Set this keyword to select True-Type fonts. |
---|
| 2439 | XOffset=xoffset, $ ; Set this keyword to the XOffset. (Note: offset calculated from lower-left corner of page.) |
---|
| 2440 | XSize=xsize, $ ; Set this keyword to the X size of the PostScript "window". |
---|
| 2441 | YOffset=yoffset, $ ; Set this keyword to the YOffset. (Note: offset calculated from lower-left corner of page.) |
---|
| 2442 | YSize=ysize, $ ; Set this keyword to the Y size of the PostScript "window". |
---|
| 2443 | ZapfChancery=zapfchancery, $ ; Set this keyword to select the ZapfChancery font. |
---|
| 2444 | ZapfDingbats=zapfdingbats ; Set this keyword to select the ZapfDingbats font. |
---|
| 2445 | |
---|
| 2446 | ; Error handling. |
---|
| 2447 | |
---|
| 2448 | Catch, theError |
---|
| 2449 | IF theError NE 0 THEN BEGIN |
---|
| 2450 | Catch, /Cancel |
---|
| 2451 | ok = FSC_PSConfig_Error_Message(Traceback=Keyword_Set(debug)) |
---|
| 2452 | RETURN, 1 |
---|
| 2453 | ENDIF |
---|
| 2454 | |
---|
| 2455 | self.debug = Keyword_Set(debug) |
---|
| 2456 | |
---|
| 2457 | |
---|
| 2458 | ; Set the available PostScript fonts. |
---|
| 2459 | |
---|
| 2460 | availableFonts = [ $ |
---|
| 2461 | 'AvantGarde', $ |
---|
| 2462 | 'Bookman', $ |
---|
| 2463 | 'Courier', $ |
---|
| 2464 | 'Helvetica', $ |
---|
| 2465 | 'Palatino', $ |
---|
| 2466 | 'Schoolbook', $ |
---|
| 2467 | 'Symbol', $ |
---|
| 2468 | 'Times', $ |
---|
| 2469 | 'ZapfChancery', $ |
---|
| 2470 | 'ZapfDingbats'] |
---|
| 2471 | |
---|
| 2472 | self.fontnames = Ptr_New(availableFonts) |
---|
| 2473 | |
---|
| 2474 | ; Default font and font type. |
---|
| 2475 | |
---|
| 2476 | fontname = "Helvetica" |
---|
| 2477 | IF N_Elements(fonttype) EQ 0 THEN fonttype = !P.Font |
---|
| 2478 | IF N_Elements(filename) NE 0 THEN self.filenameSet = filename |
---|
| 2479 | |
---|
| 2480 | ; European style |
---|
| 2481 | self.european = Keyword_Set(european) |
---|
| 2482 | |
---|
| 2483 | ; Set default values if a default setup was not asked for. |
---|
| 2484 | |
---|
| 2485 | IF N_Elements(defaultsetup) EQ 0 THEN BEGIN |
---|
| 2486 | |
---|
| 2487 | self.defaultsSet = 'None' |
---|
| 2488 | IF N_Elements(bits_per_pixel) EQ 0 THEN bits_per_pixel = 8 |
---|
| 2489 | IF N_Elements(bits_per_pixel) NE 0 THEN BEGIN |
---|
| 2490 | IF bits_per_pixel EQ 2 OR bits_per_pixel EQ 4 OR bits_per_pixel EQ 8 THEN $ |
---|
| 2491 | self.bitsSet = StrTrim(bits_per_pixel,2) ELSE self.bitsSet = '8' |
---|
| 2492 | ENDIF |
---|
| 2493 | IF N_Elements(color) EQ 0 THEN color = 1 ELSE color = 0 > color < color |
---|
| 2494 | IF N_Elements(directory) EQ 0 THEN CD, Current=directory |
---|
| 2495 | IF N_Elements(filename) EQ 0 THEN filename = "idl.ps" |
---|
| 2496 | IF N_Elements(fontsize) EQ 0 THEN fontsize = 12 |
---|
| 2497 | IF Keyword_Set(inches) EQ 0 THEN IF Keyword_Set(european) THEN inches = 0 ELSE inches = 1 |
---|
| 2498 | IF N_Elements(name) EQ 0 THEN name = "" |
---|
| 2499 | IF N_Elements(pagetype) EQ 0 THEN IF Keyword_Set(european) THEN pagetype = "A4" ELSE pagetype = "LETTER" |
---|
| 2500 | IF N_Elements(preview) EQ 0 THEN preview = 0 |
---|
| 2501 | IF N_Elements(set_font) EQ 0 THEN set_font = "" |
---|
| 2502 | IF N_Elements(xoffset) EQ 0 THEN IF inches THEN xoffset = 1.75 ELSE xoffset = 1.75 * 2.54 |
---|
| 2503 | IF N_Elements(xsize) EQ 0 THEN IF inches THEN xsize = 5 ELSE xsize = 5.0 * 2.54 |
---|
| 2504 | IF N_Elements(yoffset) EQ 0 THEN IF inches THEN yoffset = 3.5 ELSE yoffset = 3.5 * 2.54 |
---|
| 2505 | IF N_Elements(ysize) EQ 0 THEN IF inches THEN ysize = 4 ELSE ysize = 4.0 * 2.54 |
---|
| 2506 | |
---|
| 2507 | avantgarde = Keyword_Set(avantgarde) |
---|
| 2508 | bold = Keyword_Set(bold) |
---|
| 2509 | book = Keyword_Set(book) |
---|
| 2510 | bookman = Keyword_Set(bookman) |
---|
| 2511 | cmyk = Keyword_Set(cmyk) |
---|
| 2512 | courier = Keyword_Set(courier) |
---|
| 2513 | demi = Keyword_Set(demi) |
---|
| 2514 | encapsulated = Keyword_Set(encapsulated) |
---|
| 2515 | european = Keyword_Set(european) |
---|
| 2516 | helvetica = Keyword_Set(helvetica) |
---|
| 2517 | isolatin = Keyword_Set(isolatin) |
---|
| 2518 | italic = Keyword_Set(italic) |
---|
| 2519 | landscape = Keyword_Set(landscape) |
---|
| 2520 | light = Keyword_Set(light) |
---|
| 2521 | medium = Keyword_Set(medium) |
---|
| 2522 | narrow = Keyword_Set(narrow) |
---|
| 2523 | oblique = Keyword_Set(oblique) |
---|
| 2524 | palatino = Keyword_Set(palatino) |
---|
| 2525 | schoolbook = Keyword_Set(schoolbook) |
---|
| 2526 | symbol = Keyword_Set(symbol) |
---|
| 2527 | times = Keyword_Set(times) |
---|
| 2528 | truetype = Keyword_Set(truetype) |
---|
| 2529 | zapfchancery = Keyword_Set(zapfchancery) |
---|
| 2530 | zapfdingbats = Keyword_Set(zapfdingbats) |
---|
| 2531 | |
---|
| 2532 | fontset = [avantgarde, bookman, courier, helvetica, palatino, schoolbook, symbol, times, zapfchancery, zapfdingbats] |
---|
| 2533 | index = Where(fontset EQ 1, count) |
---|
| 2534 | IF count EQ 0 THEN self.fontnameSet = 'Helvetica' ELSE self.fontnameSet = (*self.fontnames)[index[0]] |
---|
| 2535 | IF self.fontnameSet EQ 'AvantGarde' THEN self.avantgarde = 1 ELSE self.avantgarde = 0 |
---|
| 2536 | IF self.fontnameSet EQ 'Bookman' THEN self.bookman = 1 ELSE self.bookman = 0 |
---|
| 2537 | IF self.fontnameSet EQ 'Courier' THEN self.courier = 1 ELSE self.courier = 0 |
---|
| 2538 | IF self.fontnameSet EQ 'Helvetica' THEN self.helvetica = 1 ELSE self.helvetica = 0 |
---|
| 2539 | IF self.fontnameSet EQ 'Palatino' THEN self.palatino = 1 ELSE self.palatino = 0 |
---|
| 2540 | IF self.fontnameSet EQ 'Schoolbook' THEN self.schoolbook = 1 ELSE self.schoolbook = 0 |
---|
| 2541 | IF self.fontnameSet EQ 'Symbol' THEN self.symbol = 1 ELSE self.symbol = 0 |
---|
| 2542 | IF self.fontnameSet EQ 'Times' THEN self.times = 1 ELSE self.times = 0 |
---|
| 2543 | IF self.fontnameSet EQ 'ZapfChancery' THEN self.zapfchancery = 1 ELSE self.zapfchancery = 0 |
---|
| 2544 | IF self.fontnameSet EQ 'ZapfDingbats' THEN self.zapfdingbats = 1 ELSE self.zapfdingbats = 0 |
---|
| 2545 | |
---|
| 2546 | self.bitsSet = StrTrim(bits_per_pixel, 2) |
---|
| 2547 | self.cmykSet = cmyk |
---|
| 2548 | self.colorSet = color |
---|
| 2549 | self.directorySet = directory |
---|
| 2550 | self.european = european |
---|
| 2551 | self.encapsulationSet = encapsulated |
---|
| 2552 | self.filenameSet = filename |
---|
| 2553 | self.fonttypeSet = -1 > fonttype < 1 |
---|
| 2554 | self.fontsizeSet = Strtrim( 6 > Fix(fontsize) < 36, 2) |
---|
| 2555 | self.fontstyleSet = [bold, book, demi, italic, light, medium, narrow, oblique] |
---|
| 2556 | self.inchesSet = inches |
---|
| 2557 | self.isolatinSet = isolatin |
---|
| 2558 | self.landscapeSet = landscape |
---|
| 2559 | self.name = name |
---|
| 2560 | self.pagetype = pagetype |
---|
| 2561 | self.pagetypeSet = pagetype |
---|
| 2562 | self.previewSet = preview |
---|
| 2563 | self.truetypeSet = truetype |
---|
| 2564 | self.set_fontSet = set_font |
---|
| 2565 | |
---|
| 2566 | ; Offsets are harder to set because I am trying to shield the |
---|
| 2567 | ; user from PostScript weirdness. |
---|
| 2568 | |
---|
| 2569 | IF landscape THEN BEGIN |
---|
| 2570 | dims = self->PageDimensions() |
---|
| 2571 | self.xoffsetSet = dims[1] - yoffset |
---|
| 2572 | self.xsizeSet = xsize |
---|
| 2573 | self.yoffsetSet = xoffset |
---|
| 2574 | self.ysizeSet = ysize |
---|
| 2575 | ENDIF ELSE BEGIN |
---|
| 2576 | self.xoffsetSet = xoffset |
---|
| 2577 | self.xsizeSet = xsize |
---|
| 2578 | self.yoffsetSet = yoffset |
---|
| 2579 | self.ysizeSet = ysize |
---|
| 2580 | ENDELSE |
---|
| 2581 | |
---|
| 2582 | ; Get the correct directory separator. |
---|
| 2583 | |
---|
| 2584 | CASE StrUpCase(!Version.OS_Family) OF |
---|
| 2585 | 'WINDOWS' : sep = '\' ; PCs |
---|
| 2586 | 'MACOS' : sep = ':' ; Macintoshes |
---|
| 2587 | 'VMS' : sep = ']' ; VMS machines |
---|
| 2588 | ELSE : sep = '/' ; Unix machines |
---|
| 2589 | ENDCASE |
---|
| 2590 | |
---|
| 2591 | index = FSC_PSCONFIG_RStrPos(directory, sep) |
---|
| 2592 | IF index EQ - 1 THEN BEGIN |
---|
| 2593 | self.fullFilenameSet = directory + sep + filename |
---|
| 2594 | ENDIF ELSE BEGIN |
---|
| 2595 | IF index EQ (StrLen(directory) - 1) THEN self.fullFilenameSet = directory + filename ELSE $ |
---|
| 2596 | self.fullFilenameSet = directory + sep + filename |
---|
| 2597 | ENDELSE |
---|
| 2598 | |
---|
| 2599 | ENDIF ELSE self->SetDefault, defaultsetup |
---|
| 2600 | |
---|
| 2601 | ; Save this configuration. |
---|
| 2602 | |
---|
| 2603 | self->SaveConfiguration |
---|
| 2604 | |
---|
| 2605 | RETURN, 1 |
---|
| 2606 | END ;-------------------------------------------------------------------------------- |
---|
| 2607 | |
---|
| 2608 | |
---|
| 2609 | PRO FSC_PSCONFIG__DEFINE |
---|
| 2610 | |
---|
| 2611 | struct = { FSC_PSCONFIG, $ |
---|
| 2612 | |
---|
| 2613 | ; Font specifiers. |
---|
| 2614 | |
---|
| 2615 | avantgarde: 0, $ |
---|
| 2616 | bkman: 0, $ |
---|
| 2617 | bookman: 0, $ |
---|
| 2618 | courier: 0, $ |
---|
| 2619 | helvetica: 0, $ |
---|
| 2620 | palatino: 0, $ |
---|
| 2621 | portrait: 0, $ |
---|
| 2622 | schoolbook: 0, $ |
---|
| 2623 | symbol: 0, $ |
---|
| 2624 | times: 0, $ |
---|
| 2625 | zapfchancery: 0, $ |
---|
| 2626 | zapfdingbats: 0, $ |
---|
| 2627 | |
---|
| 2628 | ; Widget identifiers. |
---|
| 2629 | |
---|
| 2630 | clearbuttonID: 0L, $ ; Clear Font Style settings button. |
---|
| 2631 | tlb: 0L, $ ; The top-level base of the GUI. |
---|
| 2632 | acceptID: 0L, $ ; The Accept or Apply button ID. |
---|
| 2633 | revertID: 0L, $ ; The Revert button ID. |
---|
| 2634 | pagetypeID: Obj_New(), $ ; The pagetype droplist ID. |
---|
| 2635 | orientationID: Obj_New(), $ ; The orientation droplist ID. |
---|
| 2636 | unitsID: Obj_New(), $ ; The units droplist ID. |
---|
| 2637 | encapsulationID: Obj_New(), $ ; The encapsulation droplist ID. |
---|
| 2638 | previewID: Obj_New(), $ ; The preview droplist ID. |
---|
| 2639 | colorID: Obj_New(), $ ; The color droplist ID. |
---|
| 2640 | cmykID: Obj_New(), $ ; The cmyk droplist ID. |
---|
| 2641 | bitsID: Obj_New(), $ ; The bits droplist ID. |
---|
| 2642 | defaultsID: Obj_New(), $ ; The defaults droplist ID. |
---|
| 2643 | plotID: Obj_New(), $ ; The plot window ID. |
---|
| 2644 | filenameID: Obj_New(), $ ; The filename widget ID. |
---|
| 2645 | fontnameID: Obj_New(), $ ; The font name droplist ID. |
---|
| 2646 | fontsizeID: Obj_New(), $ ; The font size droplist ID. |
---|
| 2647 | fontstyleID: Obj_New(), $ ; The font style droplist ID. |
---|
| 2648 | fontstyleButtonID: LonArr(8), $ ; The pagetype droplist ID. |
---|
| 2649 | fonttypeID: Obj_New(), $ ; The font style button IDs. |
---|
| 2650 | isolatinID: Obj_New(), $ ; The isolatin1 droplist ID. |
---|
| 2651 | set_fontID: Obj_New(), $ ; The set font text widget ID. |
---|
| 2652 | stylebaseID: 0L, $ ; The style base widget ID. |
---|
| 2653 | truetypeID: Obj_New(), $ ; The true-type droplist ID. |
---|
| 2654 | xsizeID: Obj_New(), $ ; The xsize field ID. |
---|
| 2655 | ysizeID: Obj_New(), $ ; The ysize field ID. |
---|
| 2656 | xoffsetID: Obj_New(), $ ; The xoffset field ID. |
---|
| 2657 | yoffsetID: Obj_New(), $ ; The yoffset field ID. |
---|
| 2658 | |
---|
| 2659 | ; Data values and flags. |
---|
| 2660 | |
---|
| 2661 | debug: 0, $ ; Set if debugging in turned on. |
---|
| 2662 | fontInfo: 0, $ ; Set if the user wants font information on GUI. |
---|
| 2663 | fontnames: Ptr_New(), $ ; The allowed font names. |
---|
| 2664 | european: 0, $ ; Set if European units and page size are in effect. |
---|
| 2665 | pagetype: "", $ ; The current page size or type. |
---|
| 2666 | name: "", $ ; The "name" of the object. |
---|
| 2667 | noblock: 0, $ ; A flag that tells whether the GUI is in NOBLOCK state. |
---|
| 2668 | cancel: 0, $ ; A flag that tells the status of the Cancel button. |
---|
| 2669 | thisDevice: "", $ ; The entry graphics device. Will be restored. |
---|
| 2670 | |
---|
| 2671 | ; GUI property identifiers. |
---|
| 2672 | |
---|
| 2673 | bitsSet: "", $ ; Sets the bits_per_pixel value. |
---|
| 2674 | cmykSet:0, $ ; Sets the CMYK on/off value. |
---|
| 2675 | colorSet: 0, $ ; Sets the color on/off value. |
---|
| 2676 | defaultsSet: "", $ ; Sets the default setup value. |
---|
| 2677 | directorySet: "", $ ; Sets the directory name value. |
---|
| 2678 | inchesSet: 0, $ ; Sets the units value. |
---|
| 2679 | isolatinSet: 0, $ ; Sets the isolatin1 value. |
---|
| 2680 | encapsulationSet: 0, $ ; Sets the encapsulation value. |
---|
| 2681 | filenameSet: "", $ ; Sets the file name value. |
---|
| 2682 | fullFilenameSet: "", $ ; Sets the fully-qualified filename. |
---|
| 2683 | fontsizeSet: "", $ ; Sets the font size value. |
---|
| 2684 | fontstyleSet: IntArr(8), $ ; Sets the font style values. |
---|
| 2685 | fontnameSet: "", $ ; Sets the font name value. |
---|
| 2686 | fonttypeSet: 0, $ ; Sets the font type value. |
---|
| 2687 | landscapeSet: 0, $ ; Sets the orientation value. |
---|
| 2688 | pagetypeSet: "", $ ; Sets the page type or size value. |
---|
| 2689 | previewSet: 0, $ ; Sets the preview value. |
---|
| 2690 | set_fontSet: "", $ ; Sets the Set_Font font name value. |
---|
| 2691 | truetypeSet: 0, $ ; Sets the true-type font value. |
---|
| 2692 | xoffsetSet: 0.0, $ ; Sets the xoffset value. |
---|
| 2693 | xsizeSet: 0.0, $ ; Sets the xsize value. |
---|
| 2694 | yoffsetSet: 0.0, $ ; Sets the yoffset value. |
---|
| 2695 | ysizeSet: 0.0, $ ; Sets the ysize value. |
---|
| 2696 | |
---|
| 2697 | ; GUI revert property identifiers. Mirrors of GUI property identifiers above. |
---|
| 2698 | |
---|
| 2699 | bitsRevert: "", $ |
---|
| 2700 | cmykRevert:0, $ |
---|
| 2701 | colorRevert: 0, $ |
---|
| 2702 | defaultsRevert: "", $ |
---|
| 2703 | directoryRevert: "", $ |
---|
| 2704 | inchesRevert: 0, $ |
---|
| 2705 | isolatinRevert: 0, $ |
---|
| 2706 | encapsulationRevert: 0, $ |
---|
| 2707 | filenameRevert: "", $ |
---|
| 2708 | fontsizeRevert: "", $ |
---|
| 2709 | fontstyleRevert: IntArr(8), $ |
---|
| 2710 | fontnameRevert: "", $ |
---|
| 2711 | fonttypeRevert: 0, $ |
---|
| 2712 | landscapeRevert: 0, $ |
---|
| 2713 | pagetypeRevert: "", $ |
---|
| 2714 | previewRevert: 0, $ |
---|
| 2715 | set_fontRevert: "", $ |
---|
| 2716 | truetypeRevert: 0, $ |
---|
| 2717 | xoffsetRevert: 0.0, $ |
---|
| 2718 | xsizeRevert: 0.0, $ |
---|
| 2719 | yoffsetRevert: 0.0, $ |
---|
| 2720 | ysizeRevert: 0.0 $ |
---|
| 2721 | |
---|
| 2722 | } |
---|
| 2723 | |
---|
| 2724 | END |
---|