Changeset 5711
- Timestamp:
- 05/01/09 19:56:36 (3 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 removed
- 13 modified
-
ARBDB/ad_prot.h (modified) (1 diff)
-
ARBDB/adsocket.c (modified) (2 diffs)
-
HELP_SOURCE/arb_help2xml.cxx (modified) (1 diff)
-
HELP_SOURCE/oldhelp/arb.hlp (modified) (1 diff)
-
HELP_SOURCE/oldhelp/arb.pdf.gz (added)
-
HELP_SOURCE/oldhelp/arb.ps.gz (deleted)
-
HELP_SOURCE/oldhelp/arb_envar.hlp (modified) (2 diffs)
-
HELP_SOURCE/oldhelp/consensus.ps.gz (modified) (1 prop) (previous)
-
HELP_SOURCE/oldhelp/pos_variability.ps.gz (modified) (1 prop) (previous)
-
HELP_SOURCE/oldhelp/rna3d_general.hlp (modified) (1 diff)
-
HELP_SOURCE/oldhelp/rna3d_manual.pdf.gz (modified) (1 prop) (previous)
-
HELP_SOURCE/oldhelp/rna3d_manual.ps.gz (deleted)
-
HELP_SOURCE/to_help.xsl (modified) (2 diffs)
-
HELP_SOURCE/to_html.xsl (modified) (2 diffs)
-
WINDOW/AW_status.cxx (modified) (6 diffs)
-
WINDOW/aw_window.hxx (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ARBDB/ad_prot.h
r5708 r5711 291 291 GB_CSTR GB_getenvPATH P_((void)); 292 292 GB_CSTR GB_getenvARB_GS P_((void)); 293 GB_CSTR GB_getenvARB_PDFVIEW P_((void)); 293 294 GB_CSTR GB_getenvARB_TEXTEDIT P_((void)); 294 295 GB_CSTR GB_getenvDOCPATH P_((void)); -
trunk/ARBDB/adsocket.c
r5708 r5711 1048 1048 } 1049 1049 1050 GB_CSTR GB_getenvARB_PDFVIEW(void) { 1051 static const char *pdfview = 0; 1052 if (!pdfview) { 1053 pdfview = getenv_executable("ARB_PDFVIEW"); // doc in arb_envar.hlp 1054 if (!pdfview) pdfview = GB_find_executable("PDF viewer", "epdfview", "xpdf", "kpdf", "acroread", "gv", NULL); 1055 } 1056 return pdfview; 1057 } 1058 1050 1059 GB_CSTR GB_getenvARB_TEXTEDIT(void) { 1051 1060 static const char *editor = 0; … … 1087 1096 if (strcmp(env, "ARBHOME") == 0) return GB_getenvARBHOME(); 1088 1097 if (strcmp(env, "ARB_GS") == 0) return GB_getenvARB_GS(); 1098 if (strcmp(env, "ARB_PDFVIEW") == 0) return GB_getenvARB_PDFVIEW(); 1089 1099 if (strcmp(env, "ARB_DOC") == 0) return GB_getenvDOCPATH(); 1090 1100 if (strcmp(env, "ARB_TEXTEDIT") == 0) return GB_getenvARB_TEXTEDIT(); -
trunk/HELP_SOURCE/arb_help2xml.cxx
r5708 r5711 373 373 // cuts off the '.hlp' 374 374 size_t pos = s.find(".hlp"); 375 if ((pos+4) != s.length()) { 376 pos = s.find(".ps"); 377 if ((pos+3) == s.length()) return s; // accept .ps 378 throw string("Expected extension .hlp"); 379 } 380 return string(s, 0, s.length()-4); 375 if ((pos+4) == s.length()) { 376 return string(s, 0, s.length()-4); 377 } 378 379 pos = s.find(".ps"); 380 if ((pos+3) == s.length()) { 381 return s; // accept .ps 382 } 383 384 pos = s.find(".pdf"); 385 if ((pos+4) == s.length()) { 386 return s; // accept .pdf 387 } 388 389 throw string("Expected extension .hlp"); 381 390 } 382 391 inline void check_duplicates(const string& link, const char */*where*/, const Links& existing, bool add_warnings) { -
trunk/HELP_SOURCE/oldhelp/arb.hlp
r5260 r5711 6 6 UP arb_commands.hlp 7 7 UP copyright.hlp 8 UP arb.p s8 UP arb.pdf 9 9 UP changes.hlp 10 10 -
trunk/HELP_SOURCE/oldhelp/arb_envar.hlp
r2986 r5711 64 64 (default: 'gv' or 'ghostview') 65 65 66 ARB_PDFVIEW 67 68 name of pdf viewer used by ARB 69 (default: 'epdfview' or 'acroread' or 'gv') 70 66 71 ARB_WORKDIR 67 72 … … 71 76 ARB_DOC 72 77 73 directory where ARB searches for *.ps or *.ps.gz74 (default: $ARBHOME/lib/help)78 directory where ARB searches for *.ps, *.ps.gz, *.pdf 79 and *.pdf.gz (default: $ARBHOME/lib/help) 75 80 76 81 NOTES Short description of how to set an environment variable: -
trunk/HELP_SOURCE/oldhelp/consensus.ps.gz
- Property svn:mime-type changed from application/octet-stream to application/x-gzip
-
trunk/HELP_SOURCE/oldhelp/pos_variability.ps.gz
- Property svn:mime-type changed from application/octet-stream to application/x-gzip
-
trunk/HELP_SOURCE/oldhelp/rna3d_general.hlp
r4186 r5711 2 2 UP arb.hlp 3 3 UP glossary.hlp 4 UP rna3d_manual.ps4 UP rna3d_manual.pdf 5 5 6 6 #Please insert subtopic references (line starts with keyword SUB) 7 7 #SUB subtopic.hlp 8 SUB rna3d_dispMolecule.hlp9 SUB rna3d_dispBases.hlp10 SUB rna3d_dispHelices.hlp11 SUB rna3d_mapSeqData.hlp8 SUB rna3d_dispMolecule.hlp 9 SUB rna3d_dispBases.hlp 10 SUB rna3d_dispHelices.hlp 11 SUB rna3d_mapSeqData.hlp 12 12 13 13 # Hypertext links in helptext can be added like this: LINK{ref.hlp|http://add|bla@domain} -
trunk/HELP_SOURCE/oldhelp/rna3d_manual.pdf.gz
- Property svn:mime-type changed from application/octet-stream to application/x-gzip
-
trunk/HELP_SOURCE/to_help.xsl
r3414 r5711 96 96 <xsl:choose> 97 97 <xsl:when test="string-length(substring-before($doc,'.ps'))>0"> <!--it's a postscript link--> 98 <value-of select="{concat($postscriptpath,$doc,'.gz')}"/> 98 <xsl:text>Postscript: </xsl:text> 99 <xsl:value-of select="$doc"/> 100 </xsl:when> 101 <xsl:when test="string-length(substring-before($doc,'.pdf'))>0"> <!--it's a PDF link--> 102 <xsl:text>PDF: </xsl:text> 103 <xsl:value-of select="$doc"/> 99 104 </xsl:when> 100 105 <xsl:otherwise> … … 121 126 122 127 <xsl:value-of select="$dest"/> 123 <xsl:if test="substring-before($dest,'.ps')=''"> <!-- not postscript: add .hlp --> 124 <xsl:text>.hlp</xsl:text> 128 <xsl:if test="substring-before($dest,'.ps')=''"> <!-- not postscript .. --> 129 <xsl:if test="substring-before($dest,'.pdf')=''"> <!-- .. or pdf .. --> 130 <xsl:text>.hlp</xsl:text> <!-- .. -> add .hlp --> 131 </xsl:if> 125 132 </xsl:if> 126 133 <xsl:text>&br;</xsl:text> -
trunk/HELP_SOURCE/to_html.xsl
r5504 r5711 37 37 <xsl:value-of select="$rootpath"/><xsl:text>../help/</xsl:text> 38 38 </xsl:variable> 39 <xsl:variable name="pdfpath"><xsl:value-of select="$postscriptpath"/></xsl:variable> 39 40 40 41 <xsl:variable name="tableBorder">0</xsl:variable> … … 147 148 <A href="{concat($postscriptpath,$doc,'.gz')}"> 148 149 <xsl:value-of select="$doc"/> (Postscript) 150 </A> 151 </xsl:when> 152 <xsl:when test="string-length(substring-before($doc,'.pdf'))>0"> <!--it's a pdf link--> 153 <A href="{concat($pdfpath,$doc,'.gz')}"> 154 <xsl:value-of select="$doc"/> (PDF) 149 155 </A> 150 156 </xsl:when> -
trunk/WINDOW/AW_status.cxx
r5710 r5711 1519 1519 if (!rel_path) rel_path = helpfile; 1520 1520 1521 if (path_for_edit) { 1521 if (rel_path[0]) { 1522 if (path_for_edit) { 1522 1523 #if defined(DEBUG) 1523 char *gen_doc_path = GB_strdup(GB_path_in_ARBHOME("HELP_SOURCE/genhelp", NULL)); 1524 1525 char *devel_source = GBS_global_string_copy("%s/%s", devel_doc_path, rel_path); 1526 char *gen_source = GBS_global_string_copy("%s/%s", gen_doc_path, rel_path); 1527 1528 int devel_size = GB_size_of_file(devel_source); 1529 int gen_size = GB_size_of_file(gen_source); 1530 1531 gb_assert(devel_size <= 0 || gen_size <= 0); // only one of them shall exist 1532 1533 if (gen_size>0) { 1534 result = GBS_global_string("%s", gen_source); // edit generated doc 1524 char *gen_doc_path = GB_strdup(GB_path_in_ARBHOME("HELP_SOURCE/genhelp", NULL)); 1525 1526 char *devel_source = GBS_global_string_copy("%s/%s", devel_doc_path, rel_path); 1527 char *gen_source = GBS_global_string_copy("%s/%s", gen_doc_path, rel_path); 1528 1529 int devel_size = GB_size_of_file(devel_source); 1530 int gen_size = GB_size_of_file(gen_source); 1531 1532 gb_assert(devel_size <= 0 || gen_size <= 0); // only one of them shall exist 1533 1534 if (gen_size>0) { 1535 result = GBS_global_string("%s", gen_source); // edit generated doc 1536 } 1537 else { 1538 result = GBS_global_string("%s", devel_source); // use normal help source (may be non-existing) 1539 } 1540 1541 free(gen_source); 1542 free(devel_source); 1543 free(gen_doc_path); 1544 #else 1545 result = GBS_global_string("%s/%s", GB_getenvDOCPATH(), rel_path); // use real help file in RELEASE 1546 #endif // DEBUG 1535 1547 } 1536 1548 else { 1537 result = GBS_global_string("%s", devel_source); // use normal help source (may be non-existing) 1538 } 1539 1540 free(gen_source); 1541 free(devel_source); 1542 free(gen_doc_path); 1543 #else 1544 result = GBS_global_string("%s/%s", GB_getenvDOCPATH(), rel_path); // use real help file in RELEASE 1545 #endif // DEBUG 1549 result = GBS_global_string("%s/%s", GB_getenvDOCPATH(), rel_path); 1550 } 1546 1551 } 1547 1552 else { 1548 result = GBS_global_string("%s/%s", GB_getenvDOCPATH(), rel_path); 1549 } 1550 } 1551 1552 #if defined(DEBUG) 1553 printf("Helpfile='%s'\n", result); 1554 #endif // DEBUG 1553 result = ""; 1554 } 1555 } 1555 1556 1556 1557 free(devel_doc_path); … … 1651 1652 } 1652 1653 1653 static void aw_help_new_helpfile(AW_root *awr) { 1654 static void aw_help_select_newest_in_history(AW_root *aw_root) { 1655 char *history = aw_help_global.history; 1656 if (history) { 1657 const char *sep = strchr(history, '#'); 1658 char *lastHelp = sep ? GB_strpartdup(history, sep-1) : strdup(history); 1659 1660 aw_root->awar("tmp/aw_window/helpfile")->write_string(lastHelp); 1661 free(lastHelp); 1662 } 1663 } 1664 1665 static void aw_help_back(AW_root *aw_root) { 1666 char *history = aw_help_global.history; 1667 if (history) { 1668 const char *sep = strchr(history, '#'); 1669 if (sep) { 1670 char *first = GB_strpartdup(history, sep-1); 1671 char *newhist = GBS_global_string_copy("%s#%s", sep+1, first); // wrap first to end 1672 1673 free(aw_help_global.history); 1674 aw_help_global.history = newhist; 1675 1676 free(first); 1677 1678 aw_help_select_newest_in_history(aw_root); 1679 } 1680 } 1681 } 1682 static void aw_help_back(AW_window *aww) { aw_help_back(aww->get_root()); } 1683 1684 static GB_ERROR aw_help_show_external_format(const char *help_file, const char *viewer) { 1685 // Called to show *.ps or *.pdf in external viewer. 1686 // Can as well show *.suffix.gz (decompresses to temporary *.suffix) 1687 1688 struct stat st; 1689 GB_ERROR error = NULL; 1690 char sys[1024]; 1691 1692 sys[0] = 0; 1693 1694 if (stat(help_file, &st) == 0) { // *.ps exists 1695 GBS_global_string_to_buffer(sys, sizeof(sys), "%s %s &", viewer, help_file); 1696 } 1697 else { 1698 char *compressed = GBS_global_string_copy("%s.gz", help_file); 1699 1700 if (stat(compressed, &st) == 0) { // *.ps.gz exists 1701 char *name_ext; 1702 GB_split_full_path(compressed, NULL, NULL, &name_ext, NULL); 1703 // 'name_ext' contains xxx.ps or xxx.pdf 1704 char *name, *suffix; 1705 GB_split_full_path(name_ext, NULL, NULL, &name, &suffix); 1706 1707 char *tempname = GB_unique_filename(name, suffix); 1708 char *uncompressed = GB_create_tempfile(tempname); 1709 1710 GBS_global_string_to_buffer(sys, sizeof(sys), 1711 "(gunzip <%s >%s ; %s %s ; rm %s) &", 1712 compressed, uncompressed, 1713 viewer, uncompressed, 1714 uncompressed); 1715 1716 free(uncompressed); 1717 free(tempname); 1718 free(name); 1719 free(suffix); 1720 free(name_ext); 1721 } 1722 else { 1723 error = GBS_global_string("Neither %s nor %s exists", help_file, compressed); 1724 } 1725 free(compressed); 1726 } 1727 1728 if (sys[0] && !error) error = GB_system(sys); 1729 1730 return error; 1731 } 1732 1733 static void aw_help_helpfile_changed_cb(AW_root *awr) { 1654 1734 char *help_file = get_full_qualified_help_file_name(awr); 1655 1735 … … 1658 1738 } 1659 1739 else if (GBS_string_matches(help_file,"*.ps",GB_IGNORE_CASE) ){ // Postscript file 1660 struct stat st; 1661 GB_ERROR error = 0; 1662 char sys[1024]; 1663 1664 sys[0] = 0; 1665 1666 if (stat(help_file, &st) == 0) { // *.ps exists 1667 GBS_global_string_to_buffer(sys, sizeof(sys), "%s %s &", GB_getenvARB_GS(), help_file); 1668 } 1669 else { 1670 char *compressed = GBS_global_string_copy("%s.gz", help_file); 1671 1672 if (stat(compressed, &st) == 0) { // *.ps.gz exists 1673 char *name_ps; 1674 GB_split_full_path(compressed, NULL, NULL, &name_ps, NULL); 1675 // 'name_ps' contains xxx.ps 1676 char *name, *suffix; 1677 GB_split_full_path(name_ps, NULL, NULL, &name, &suffix); 1678 1679 char *tempname = GB_unique_filename(name, suffix); 1680 char *uncompressed = GB_create_tempfile(tempname); 1681 1682 GBS_global_string_to_buffer(sys, sizeof(sys), 1683 "(gunzip <%s >%s ; %s %s ; rm %s) &", 1684 compressed, uncompressed, 1685 GB_getenvARB_GS(), uncompressed, 1686 uncompressed); 1687 1688 free(uncompressed); 1689 free(tempname); 1690 free(name); 1691 free(suffix); 1692 free(name_ps); 1693 } 1694 else { 1695 sprintf(AW_ERROR_BUFFER, "Neither %s nor %s where found", help_file, compressed); 1696 aw_message(); 1697 } 1698 free(compressed); 1699 } 1700 1701 if (sys[0] && !error) error = GB_system(sys); 1740 GB_ERROR error = aw_help_show_external_format(help_file, GB_getenvARB_GS()); 1702 1741 if (error) aw_message(error); 1742 aw_help_select_newest_in_history(awr); 1743 } 1744 else if (GBS_string_matches(help_file,"*.pdf",GB_IGNORE_CASE) ){ // PDF file 1745 GB_ERROR error = aw_help_show_external_format(help_file, GB_getenvARB_PDFVIEW()); 1746 if (error) aw_message(error); 1747 aw_help_select_newest_in_history(awr); 1703 1748 } 1704 1749 else{ 1705 1750 if (aw_help_global.history){ 1706 if (strncmp(help_file,aw_help_global.history,strlen(help_file))){ 1707 char comm[1024]; 1708 char *h; 1709 sprintf(comm,"*=%s#*1",help_file); 1710 h = GBS_string_eval(aw_help_global.history,comm,0); 1751 if (strncmp(help_file,aw_help_global.history,strlen(help_file)) != 0) { 1752 // remove current help from history (if present) and prefix it to history 1753 char *comm = GBS_global_string_copy("*#%s*=*1*2:*=%s#*1", help_file, help_file); 1754 char *h = GBS_string_eval(aw_help_global.history,comm,0); 1755 1756 aw_assert(h); 1757 1711 1758 free(aw_help_global.history); 1712 1759 aw_help_global.history = h; 1760 1761 free(comm); 1713 1762 } 1714 1763 } … … 1766 1815 } 1767 1816 free(help_file); 1768 }1769 1770 static void aw_help_back(AW_window *aww) {1771 if (!aw_help_global.history) return;1772 if (!strchr(aw_help_global.history,'#') ) return;1773 char *newhist = GBS_string_eval(aw_help_global.history,"*#*=*2",0); // delete first1774 free(aw_help_global.history);1775 aw_help_global.history = newhist;1776 char *helpfile = GBS_string_eval(aw_help_global.history,"*#*=*1",0); // first word1777 aww->get_root()->awar("tmp/aw_window/helpfile")->write_string(helpfile);1778 free(helpfile);1779 1817 } 1780 1818 … … 1888 1926 } 1889 1927 1890 void AW_POPUP_HELP(AW_window *aw,AW_CL /*char */ helpcd) 1891 { 1892 AW_root *awr=aw->get_root(); 1893 static AW_window_simple *helpwindow=0; 1894 1895 1896 char *help_file= (char*)helpcd; 1897 1898 1899 if(!helpwindow) { 1928 void AW_POPUP_HELP(AW_window *aw,AW_CL /*char */ helpcd) { 1929 static AW_window_simple *helpwindow = 0; 1930 1931 AW_root *awr = aw->get_root(); 1932 char *help_file = (char*)helpcd; 1933 1934 if (!helpwindow) { 1900 1935 awr->awar_string( "tmp/aw_window/helptext", "" , AW_ROOT_DEFAULT); 1901 1936 awr->awar_string( "tmp/aw_window/search_expression", "" , AW_ROOT_DEFAULT); 1902 1937 awr->awar_string( "tmp/aw_window/helpfile", "" , AW_ROOT_DEFAULT); 1903 awr->awar("tmp/aw_window/helpfile")->add_callback(aw_help_ new_helpfile);1904 1905 helpwindow =new AW_window_simple;1938 awr->awar("tmp/aw_window/helpfile")->add_callback(aw_help_helpfile_changed_cb); 1939 1940 helpwindow = new AW_window_simple; 1906 1941 helpwindow->init(awr,"HELP","HELP WINDOW"); 1907 1942 helpwindow->load_xfig("help.fig"); … … 1949 1984 1950 1985 } 1951 free(aw_help_global.history); 1952 aw_help_global.history = 0; 1953 1954 awr->awar("tmp/aw_window/helpfile")->write_string(""); 1955 if(help_file) awr->awar("tmp/aw_window/helpfile")->write_string(help_file); 1956 if (GBS_string_matches(help_file,"*.ps",GB_IGNORE_CASE)) return;// dont open help if postscript file 1957 helpwindow->show(); 1986 1987 aw_assert(help_file); 1988 1989 awr->awar("tmp/aw_window/helpfile")->write_string(help_file); 1990 1991 if (!GBS_string_matches(help_file,"*.ps",GB_IGNORE_CASE) && 1992 !GBS_string_matches(help_file,"*.pdf",GB_IGNORE_CASE)) 1993 { // dont open help if postscript or pdf file 1994 helpwindow->show(); 1995 } 1958 1996 } 1959 1997 -
trunk/WINDOW/aw_window.hxx
r5625 r5711 278 278 // -------------------------------- 279 279 280 AW_root *get_root(void) { return root; } ;280 AW_root *get_root(void) { return root; } 281 281 282 282 //******************* Global layout functions **********************
