sci-libs/idlcoyote: initial import
[gentoo.git] / sci-libs / idlcoyote / files / idlcoyote-cgloadct.patch
1 Author: Ole Streicher <olebole@debian.org>
2 Description: Use loadct in cgloadct if no file is specified.
3  GDL does not shipt with a color table "colors1.tbl", so in the case
4  that no file name is specified, fall back to loadct instead of trying to
5  load this file.
6 --- a/cgloadct.pro
7 +++ b/cgloadct.pro
8 @@ -86,8 +86,8 @@
9  ;       If this keyword is set to a named variable, the color table is returned as an \r
10  ;       [NCOLORS,3] array and no colors are loaded in the display.\r
11  ;    filename: in, optional, type='string'\r
12 -;       The name of a color table file to open. By default colors1.tbl in the IDL \r
13 -;       resource directory.\r
14 +;       The name of a color table file to open. By default the gdl standard
15 +;color table\r
16  ;    get_names: out, optional, type='string'\r
17  ;       If set to a named variable, the names of the color tables are returned\r
18  ;       and no colors are loaded in the display. Note that RGB_TABLE cannot be\r
19 @@ -192,9 +192,8 @@
20        Catch, /CANCEL\r
21        Help, LAST_MESSAGE=1, OUTPUT=traceback\r
22        Help, Calls=callStack\r
23 -      callingRoutine = (StrSplit(StrCompress(callStack[1])," ", /Extract))[0]\r
24 -      Print,''\r
25 -      Print, 'Traceback Report from ' + StrUpCase(callingRoutine) + ':'\r
26 +      Print,''+callStack\r
27 +      Print, 'Traceback Report from:'\r
28        Print, ''\r
29        FOR j=0,N_Elements(traceback)-1 DO Print, "     " + traceback[j]\r
30        void = Dialog_Message(traceback[0], /Error, TITLE='Trapped Error')\r
31 @@ -236,11 +235,9 @@
32     IF N_Elements(clip) EQ 0 THEN clip = [0,255]\r
33     IF N_Elements(clip) EQ 1 THEN clip = [clip, 255]\r
34     clip = 0 > clip < 255\r
35 -   IF N_Elements(file) EQ 0 THEN file = Filepath('colors1.tbl', SUBDIRECTORY=['resource', 'colors'])\r
36 -   \r
37     ; Try to locate the brewer file. \r
38     IF Keyword_Set(brewer) THEN BEGIN\r
39 -       brewerfilepath = Filepath( ROOT_DIR=cgSourceDir(), 'fsc_brewer.tbl')\r
40 +       brewerfilepath = Filepath( ROOT_DIR='/usr/share/gnudatalanguage/coyote', 'fsc_brewer.tbl')\r
41         brewerFile = File_Search(brewerfilepath, Count=count)\r
42         IF count EQ 0 THEN BEGIN\r
43              Message, 'Cannot find the Brewer color table file "fsc_brewer.tbl."' + $\r
44 @@ -257,6 +254,14 @@
45     IF N_Elements(ncolors) EQ 0 THEN ncolors = !D.TABLE_SIZE - bottom\r
46     reverse = KEYWORD_SET(reverse)\r
47  \r
48 +   IF N_Elements(file) EQ 0 THEN BEGIN
49 +      loadct, table, get_names=get_names, ncolors=ncolors, bottom=bottom, $
50 +              silent=silent, rgb_table=ltable
51 +      len = N_Elements(ltable)/3
52 +      r = ltable[0:len-1]
53 +      g = ltable[len:2*len-1]
54 +      b = ltable[2*len:3*len-1]
55 +   ENDIF ELSE BEGIN
56     ; Open and read the color table files.\r
57     OPENR, lun, file, /GET_LUN\r
58     ntables = 0B\r
59 @@ -284,6 +289,7 @@
60  \r
61     ; Close the file.\r
62     FREE_LUN, lun\r
63 +   ENDELSE
64  \r
65     ; Clip the colors.\r
66     r = r[clip[0]:clip[1]]\r
67 --- a/xcolors.pro
68 +++ b/xcolors.pro
69 @@ -838,7 +838,7 @@
70             END\r
71  \r
72          'BREWER': BEGIN\r
73 -           info.file = cgFindPathTo('fsc_brewer.tbl')\r
74 +           info.file = '/usr/share/gnudatalanguage/fsc_brewer.tbl'\r
75             info.brewer = 1\r
76             END\r
77     ENDCASE\r