comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Adding libraries to online help
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Adding libraries to online help [message #8720] Wed, 16 April 1997 00:00 Go to next message
Eric Williams is currently offline  Eric Williams
Messages: 14
Registered: April 1997
Junior Member
Hi,

I have recently installed IDL 4.01 on a Sun running Solaris 2.5.1.
I have also downloaded many of the great libraries available from
numerous sources. My question is does anyone know what I need to do
to add the new procedures to the IDL online help. I know most of
them are available on the web but I know users will want to be able
to look them up with the online help function.

Thanks for any advice.
Eric Williams
ewilliams@wesleyan.edu
Re: Adding libraries to online help [message #8753 is a reply to message #8720] Wed, 23 April 1997 00:00 Go to previous messageGo to next message
alpha is currently offline  alpha
Messages: 49
Registered: September 1996
Member
David Foster <foster@bial1.ucsd.edu> writes:


hey, David, where is the ASK() Routine?


> ; LHELP.PRO 1-12-95
> ;

...

> ret = ask(msg, 'Ok', parent=d.base)
^^^-----------------------------
...


> XMANAGER, "lhelp", d.base

> return
> END

Panther


--
Panther in the Jungle __..--''``\--....___ _..,_
-BELIEVE AND DECEIVE- _.-' .-/"; ` ``<._ ``-+'~=.
http://www.ang-physik _.-' _..--.'_ \ `(^) )
.uni-kiel.de/~hendrik ((..-' (< _ ;_..__ ; `'
Re: Adding libraries to online help [message #8770 is a reply to message #8720] Tue, 22 April 1997 00:00 Go to previous messageGo to next message
Andrew Cool is currently offline  Andrew Cool
Messages: 219
Registered: January 1996
Senior Member
Hi all.

David Foster wrote:

snip.............


> One alternative that might cause some controversy: we document our
> routines in .doc files which are located in the same directories as
> the .pro files. Then we use a program I wrote called LHELP.PRO which
> finds all such .doc files and allows you to choose from among them
> and display their contents. Text search capabilities make it easier
> to find topics. Also, you can use it to look at the source code.
>
> files for each routine, but I thought I'd mention it. I've been flamed
> for this method before, but it is *very* convenient.
>
> Dave

I agree whole heartedly!

Why is it that I've written a similiar GUI program, as has
Bill Thompson (XDOC), and no doubt quite a few others?

I know that if you buy the right software from a third party, you
can add your own Help info to RSI's wonderful (?) GUI Help, but
*why* should we fork out more money? I know what my employer thinks
of the idea!

C'mon RSI, give us a useful, IDL-coded GUI Help utility that we can
tailor to suit our own sites with respect to printer names and any
other customisations that the user might care to make.

The same goes for a colour scale/legend routine. Let's face it, every
colour plot needs one, yet we're all forced to design our own routine
or find one on the Web.

I wonder who else feels that they're doing RSI's job for them?

Ciao,

Andrew Cool

------------------------------------------------------------ ------------
Andrew Cool |andrew.cool@dsto.defence.gov.au
High Frequency Radar Division |phone : +61 8 259 5740
Defence Science & Technology Organisation | fax : +61 8 259 6673
PO Box 1500 Salisbury, South Australia, 5108 |
------------------------------------------------------------ ------------
"When I die, I want to go out just like my Grandfather, in his sleep,
peaceful and quiet... not kicking and screaming like the rest of the
guys in his car."
Re: Adding libraries to online help [message #8785 is a reply to message #8720] Mon, 21 April 1997 00:00 Go to previous messageGo to next message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
This is a multi-part message in MIME format.

--------------7278777A3E7F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

David Foster wrote:
>

Sorry, it's Monday. Here is the attached LHELP.PRO that I forgot
in the previous post!

Dave
>>
>
> One alternative that might cause some controversy: we document our
> routines in .doc files which are located in the same directories as
> the .pro files. Then we use a program I wrote called LHELP.PRO which
> finds all such .doc files and allows you to choose from among them
> and display their contents. Text search capabilities make it easier
> to find topics. Also, you can use it to look at the source code.
>
> This might not be an option for software you download from external
> sources, as you'd have to extract the headers and paste into .doc
> files for each routine, but I thought I'd mention it. I've been flamed
> for this method before, but it is *very* convenient.
>


--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2200
La Jolla, CA 92037
[ UCSD Mail Code 0949 ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~

--------------7278777A3E7F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="lhelp.pro"

;
; LHELP.PRO 1-12-95
;
; This routine allows the user to get help information on local
; routines written as general-purpose utility functions. The user
; enters LHELP, ROUTINE_NAME and the documentation file
; ROUTINE_NAME.DOC is displayed.
;
; Alternatively, if no parameter is given then a list widget is
; displayed, from which the user can choose a documentation help
; file to display.
;
; 10-25-93 DF Use EXPAND_PATH to find .DOC file in !PATH .
; 11-04-93 DF Keyword /ALL to display file listing available routines.
; 5-12-94 DF Add widget interface with list/choose capablility.
; 7-15-94 DF Add text search capability.
; 10-31-94 DF Prevent selection of first element of list from crashing
; program (its just a title).
; 11-22-94 DF Calling LHELP with command-line argument will invoke
; LHELP widget with argument as current help file displayed
; (instead of XDISPLAYFILE as before). Add GROUP keyword
; for when calling from a widget.


;----------------------------------------------------------- ----------------
; Procedure LHELP_FIND_FILES
;
; Procedure to create lists of help filenames, their corresponding
; names, .pro routines in directories where these help files exist,
; and their corresponding names.
;----------------------------------------------------------- ----------------

PRO lhelp_find_files

common lhelp_common, d,help_files, proc_files, help_names, proc_names, text

help_files = ''
proc_files = ''

dir_list = EXPAND_PATH(!PATH,/ARRAY,COUNT=dirs) ; Find .doc files
FOR i = 0, dirs-1 DO BEGIN
filespec = dir_list(i) + '/*.doc'
found = file_find(filespec, files)
if (found gt 0) then begin
if (help_files(0) eq '') then help_files = files else $
help_files = [help_files, files]
filespec = dir_list(i) + '/*.pro' ; Find .pro files in
found = file_find(filespec, files) ; these directories
if (found gt 0) then begin
if (proc_files(0) eq '') then proc_files = files else $
proc_files = [proc_files, files]
endif
endif
ENDFOR

if (help_files(0) eq '') then begin
help_files = 'None found'
proc_files = help_files
endif

np = n_elements(proc_files)
proc_names = strarr(np)
for i = 0, np-1 do begin
proc_names(i) = strupcase(filename(proc_files(i)))
pos = strpos(proc_names(i), '.PRO')
proc_names(i) = strmid(proc_names(i), 0, pos)
endfor
order = sort(proc_names)
proc_files = proc_files(order)
proc_names = proc_names(order)

nr = n_elements(help_files)
help_names = strarr(nr)
for i = 0, nr-1 do begin
help_names(i) = strupcase(filename(help_files(i)))
pos = strpos(help_names(i), '.DOC')
help_names(i) = strmid(help_names(i), 0, pos)
endfor
order = sort(help_names)
help_files = help_files(order)
help_names = help_names(order)

return
END



;----------------------------------------------------------- ----------------
; Procedure LHELP_POSITION
;
; Procedure to position the text in the text widget.
;----------------------------------------------------------- ----------------

PRO lhelp_position

common lhelp_common, d,help_files, proc_files, help_names, proc_names, text

if (d.cur_line lt d.top_line or d.cur_line gt d.bot_line) then begin
line = FIX( ( (d.cur_line - (d.ypage_size/2)) > 0 ) $
< (n_elements(text) - d.ypage_size/2) )
widget_control, d.page, set_text_top_line=line
d.top_line = line
d.bot_line = line + d.ypage_size - 1
endif

return
END


;----------------------------------------------------------- ----------------
; Procedure LHELP_HIGHLIGHT
;
; Procedure to highlight current text found.
;----------------------------------------------------------- ----------------

PRO LHELP_HIGHLIGHT

common lhelp_common, d,help_files, proc_files, help_names, proc_names, text

chrs = 0
for i = 0, d.cur_line - 1 do chrs = chrs + strlen(text(i)) + 1
chrs = chrs + d.cur_pos
widget_control, d.page, set_text_select=[chrs, strlen(d.search_text)]

return
END


;----------------------------------------------------------- ----------------
; Function LHELP_SEARCH
;
; Function to search for a text string in the current listing.
;----------------------------------------------------------- ----------------

FUNCTION lhelp_search, NEXT=next, PREV=prev

common lhelp_common, d,help_files, proc_files, help_names, proc_names, text


text_lines = n_elements(text)
lines_checked = 0
len = strlen(d.search_text)

if (keyword_set(NEXT)) then begin
line = d.cur_line
last = text_lines - 1
restart = 0
incr = 1
endif else if (keyword_set(PREV)) then begin
line = d.cur_line
last = 0
restart = text_lines - 1
incr = -1
endif

while (1) do begin
lines_checked = lines_checked + 1 ; Break if not found
if (lines_checked eq text_lines + 2) then goto, NOT_FOUND
text_uc = strupcase(text(line))
search_text_uc = strupcase(d.search_text)
if (line eq d.cur_line and d.searched ne 0) then begin ; Repeated searches
if (keyword_set(NEXT)) then begin ; in same line
pos = strpos(text_uc, search_text_uc, d.cur_pos)
endif else if (keyword_set(PREV)) then begin
text_uc = strmid(text_uc, 0, d.cur_pos - (len + 1))
pos = strpos_last(text_uc, search_text_uc, 0)
endif
endif else begin
if (keyword_set(NEXT)) then begin
pos = strpos(text_uc, search_text_uc, 0)
endif else if (keyword_set(PREV)) then begin
pos = strpos_last(text_uc, search_text_uc, 0)
endif
endelse
if (pos ge 0) then begin
d.cur_line = line
d.cur_pos = pos
lhelp_position ; Reposition text in widget
lhelp_highlight ; Highlight search string found
d.cur_pos = pos + len ; Move past current selection
goto, FOUND
endif
line = line + incr
if (line eq last + incr) then line = restart ; Wrap to beginning/end
endwhile

NOT_FOUND:
beep & return, -1

FOUND:
d.searched = 1
return,0

END


;----------------------------------------------------------- ----------------
; Procedure LHELP_EVENT
;
; Event handler.
;----------------------------------------------------------- ----------------

PRO lhelp_event, event

common lhelp_common, d,help_files, proc_files, help_names, proc_names, text

name = strmid(tag_names(event, /structure), 7, 1000)
widget_control, event.id, get_uvalue=value

case (name) of
"BUTTON": begin
case (value) of
"QUIT": widget_control, event.top, /destroy
"CLOSE": widget_control, event.top, /iconify
"PROCEDURE":begin
widget_control, d.list, set_value=proc_names
widget_control, d.list, set_uvalue=proc_files
end
"NEXT": begin
if (d.search_text eq '' or text(0) eq '') then begin
beep & return
endif
widget_control, d.base, /hourglass
ret = lhelp_search( /next)
widget_control, d.base, hourglass=0
end
"PREV": begin
if (d.search_text eq '' or text(0) eq '') then begin
beep & return
endif
widget_control, d.base, /hourglass
ret = lhelp_search( /prev)
widget_control, d.base, hourglass=0
end
"HELP": begin
widget_control, d.list, set_value=help_names
widget_control, d.list, set_uvalue=help_files
end
else:
endcase
end
"LIST": begin
if (event.index eq 0) then return ; Cant select first element (label!)
routine = value(event.index-1) ; Get routine name
text = file_strarr(routine)
widget_control, d.page, set_value=text
d.searched = 0
d.cur_line = 0
d.top_line = 0
d.bot_line = d.ypage_size - 1
end
"TEXT_CH": goto, UPDATE_TEXT
"TEXT_STR": goto, UPDATE_TEXT
"TEXT_DEL": begin
UPDATE_TEXT:
widget_control, d.text, get_value=txt
d.search_text = txt(0)
d.searched = 0
if (name eq "TEXT_CH") then begin ; ENTER begins search (next)
if (event.ch eq 10B) then begin
if (d.search_text eq '' or text(0) eq '') then begin
beep & return
endif
widget_control, d.base, /hourglass
ret = lhelp_search( /next)
widget_control, d.base, hourglass=0
endif
endif
end
else:
endcase

END


;----------------------------------------------------------- ----------------
; Procedure LHELP
;
; Procedure to display documentation file, or allow user to choose a
; routine from a list.
;----------------------------------------------------------- ----------------

PRO lhelp, routine, GROUP=group

common lhelp_common, d,help_files, proc_files, help_names, proc_names, text

d = { base: 0L, $ ; Main widget base ID
list: 0L, $ ; Routine widget list ID
page: 0L, $ ; Info text widget ID
text: 0L, $ ; Search text widget
search_text: '', $ ; Search text
searched: 0, $ ; Has current text been searched (1=yes)
cur_line: 0, $ ; Current line of text
cur_pos: 0, $ ; Current position in current line
top_line: 0, $ ; Line number at top of text widget
bot_line: 0, $ ; Line number at bottom
ext: '.doc', $ ; Do you want '.pro' or '.doc' ?
max_lines: 5000, $ ; Maximum # lines in file
xpage_size: 100, $ ; Size of text page
ypage_size: 40 }


if (keyword_set(GROUP)) then begin
if (widget_info(group, /valid_id) eq 0) then group = 0
endif else begin
group = 0
endelse


LHELP_FIND_FILES ; Get filename lists
if (help_files(0) eq '') then message, 'No local *.doc files found in !PATH'


; Initialize variables

text = ''
d.bot_line = d.ypage_size - 1
help_names = ['< Overview >', help_names]
proc_names = ['< Overview >', proc_names]


d.base = WIDGET_BASE(/row, xpad=5, ypad=5, title="Local Help", $
group_leader=group)
d.list = WIDGET_LIST(d.base, /frame, ysize=d.ypage_size - 10, $
uvalue=help_files, value=help_names)

right_main = WIDGET_BASE(d.base, xpad=5, ypad=5, /column)
menu = WIDGET_BASE(right_main, xpad = 10, ypad=5, /row, /frame)
quit = WIDGET_BUTTON(menu, value=' Quit ', uvalue='QUIT')
clos = WIDGET_BUTTON(menu, value=' Close ', uvalue='CLOSE')

excl = WIDGET_BASE(menu, /row, xpad=5, ypad=5, /frame, /exclusive)
proc = WIDGET_BUTTON(excl, value='Procedures', uvalue='PROCEDURE')
help = WIDGET_BUTTON(excl, value='Help Files', uvalue='HELP')

junk = WIDGET_BASE(menu)
sear = WIDGET_BASE(menu, /row, xpad=5, ypad=5, /frame)
prev = WIDGET_BUTTON(sear, value='Prev', uvalue='PREV')
next = WIDGET_BUTTON(sear, value='Next', uvalue='NEXT')
d.text = WIDGET_TEXT(sear, xsize=24, ysize=1, /editable, /all_events)
d.page = WIDGET_TEXT(right_main, xsize=d.xpage_size, ysize=d.ypage_size, $
/scroll)

widget_control, help, /set_button
widget_control, d.base, /realize

; Help info for only one routine (command-line argument)

if (n_elements(routine) gt 0) then begin
if (strpos(routine, '.doc') lt 0) then $
routine = routine + '.doc'
pos = strpos_last(routine, '/')
if (pos ge 0) then $
routine = strmid(routine, pos+1, strlen(routine)-(pos+1))
file = find_procedure(routine)
if (file eq '') then begin
beep
msg = 'Cannot find help file ' + routine
message, msg, /continue
if (keyword_set(GROUP)) then begin
ret = ask(msg, 'Ok', parent=d.base)
widget_control, d.base, /destroy
return
endif
endif else begin
text = file_strarr(file)
widget_control, d.page, set_value=text
d.searched = 0
d.cur_line = 0
d.top_line = 0
d.bot_line = d.ypage_size - 1
endelse
endif

XMANAGER, "lhelp", d.base

return
END

--------------7278777A3E7F--
Re: Adding libraries to online help [message #8786 is a reply to message #8720] Mon, 21 April 1997 00:00 Go to previous messageGo to next message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Dave Burridge wrote:
>
> Eric Williams wrote:
>>
>> Hi,
>>
>> I have recently installed IDL 4.01 on a Sun running Solaris 2.5.1.
>> I have also downloaded many of the great libraries available from
>> numerous sources. My question is does anyone know what I need to do
>> to add the new procedures to the IDL online help. I know most of
>> them are available on the web but I know users will want to be able
>> to look them up with the online help function.
>>
> Eric,
>
> The IDL online help libraries are "compiled" on both the Windows and
> Solaris platforms as far as I know. The only way you can add to them is
> make a complete textual copy (say, for an HTML editor) and distribute
> that.
>

One alternative that might cause some controversy: we document our
routines in .doc files which are located in the same directories as
the .pro files. Then we use a program I wrote called LHELP.PRO which
finds all such .doc files and allows you to choose from among them
and display their contents. Text search capabilities make it easier
to find topics. Also, you can use it to look at the source code.

This might not be an option for software you download from external
sources, as you'd have to extract the headers and paste into .doc
files for each routine, but I thought I'd mention it. I've been flamed
for this method before, but it is *very* convenient.

Dave
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2200
La Jolla, CA 92037
[ UCSD Mail Code 0949 ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
Re: Adding libraries to online help [message #8814 is a reply to message #8720] Sun, 27 April 1997 00:00 Go to previous message
alpha is currently offline  alpha
Messages: 49
Registered: September 1996
Member
David Foster <foster@bial1.ucsd.edu> writes:
> HSR Sys-Admin wrote:
>> David Foster <foster@bial1.ucsd.edu> writes:
>>
>> hey, David, where is the ASK() Routine?
>>
> Sorry, I must have been brain-dead that day. I am mailing an
> attachment that includes the 6 functions necessary to compile
> LHELP.PRO . If anyone else would like them, send me an email.
> I should also point out that this program was written for UNIX
> systems, and will take some work to use under Windoze or Mac.

oh, so as an VMS user... i will rewrite some code ;-) :-(


Hendrik


--
Panther in the Jungle __..--''``\--....___ _..,_
-BELIEVE AND DECEIVE- _.-' .-/"; ` ``<._ ``-+'~=.
http://www.ang-physik _.-' _..--.'_ \ `(^) )
.uni-kiel.de/~hendrik ((..-' (< _ ;_..__ ; `'
Re: Adding libraries to online help [message #8832 is a reply to message #8720] Thu, 24 April 1997 00:00 Go to previous message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
HSR Sys-Admin wrote:
>
> David Foster <foster@bial1.ucsd.edu> writes:
>
> hey, David, where is the ASK() Routine?
>

Sorry, I must have been brain-dead that day. I am mailing an
attachment that includes the 6 functions necessary to compile
LHELP.PRO . If anyone else would like them, send me an email.
I should also point out that this program was written for UNIX
systems, and will take some work to use under Windoze or Mac.

Dave

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2200
La Jolla, CA 92037
[ UCSD Mail Code 0949 ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
Re: Adding libraries to online help [message #8840 is a reply to message #8720] Thu, 24 April 1997 00:00 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
Andrew Cool <andrew.cool@dsto.defence.gov.au> writes:

> Hi all.

> David Foster wrote:

...

> Why is it that I've written a similiar GUI program, as has
> Bill Thompson (XDOC), and no doubt quite a few others?

Just to set the record straight, the XDOC program was written by my colleague
Dominic Zarro. I just think it's excellent, and have always recommended it to
others. One of the advantages is that it works directly from the .pro files
themselves, and doesn't depend on keeping other files up-to-date with the
software. It also allows one to look directly at the source code.

Bill Thompson
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: "Numerical Recipes" implementation complaints
Next Topic: connectability

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:40:41 PDT 2025

Total time taken to generate the page: 0.00656 seconds