~ubuntu-branches/ubuntu/oneiric/ncbi-tools6/oneiric

« back to all changes in this revision

Viewing changes to desktop/dlgutil2.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2005-03-27 12:00:15 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050327120015-embhesp32nj73p9r
Tags: 6.1.20041020-3
* Fix FTBFS under GCC 4.0 caused by inconsistent use of "static" on
  functions.  (Closes: #295110.)
* Add a watch file, now that we can.  (Upstream's layout needs version=3.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
*
30
30
* Version Creation Date:   1/22/95
31
31
*
32
 
* $Revision: 6.29 $
 
32
* $Revision: 6.49 $
33
33
*
34
34
* File Description: 
35
35
*
916
916
  ButtoN             PNTR boxes;
917
917
} FieldPage, PNTR FieldPagePtr;
918
918
 
919
 
static Boolean ShouldBeAGBQual (Int2 qual, Boolean allowProductGBQual)
 
919
static Boolean ShouldBeAGBQual (SeqFeatPtr sfp, Int2 qual, Boolean allowProductGBQual)
920
920
 
921
921
{
922
922
  if (qual < 0) return FALSE;
923
923
  if (allowProductGBQual && qual == GBQUAL_product) return TRUE;
924
 
  if (qual == GBQUAL_citation || qual == GBQUAL_db_xref || qual == GBQUAL_evidence ||
925
 
      qual == GBQUAL_exception || qual == GBQUAL_gene || qual == GBQUAL_label ||
926
 
      qual == GBQUAL_map || qual == GBQUAL_note || qual == GBQUAL_partial ||
927
 
      qual == GBQUAL_product || qual == GBQUAL_pseudo) {
 
924
  if (qual == GBQUAL_citation ||
 
925
      qual == GBQUAL_db_xref ||
 
926
      qual == GBQUAL_evidence ||
 
927
      qual == GBQUAL_exception ||
 
928
      qual == GBQUAL_gene ||
 
929
      qual == GBQUAL_label ||
 
930
      qual == GBQUAL_locus_tag ||
 
931
      qual == GBQUAL_note ||
 
932
      qual == GBQUAL_partial ||
 
933
      qual == GBQUAL_product ||
 
934
      qual == GBQUAL_pseudo) {
928
935
    return FALSE;
929
936
  }
 
937
  if (qual == GBQUAL_map && (sfp == NULL || sfp->idx.subtype != FEATDEF_repeat_region)) return FALSE;
 
938
  if (qual == GBQUAL_operon && (sfp == NULL || sfp->idx.subtype != FEATDEF_operon)) return FALSE;
930
939
  if (Nlm_GetAppProperty ("SequinUseEMBLFeatures") == NULL) {
931
940
    if (qual == GBQUAL_usedin) {
932
941
      return FALSE;
1115
1124
 
1116
1125
        for (i = 0; i < sefp->mand_num; i++) {
1117
1126
          qual = sefp->mand_qual [i];
1118
 
          if (qual > -1 && ShouldBeAGBQual (qual, allowProductGBQual)) {
 
1127
          if (qual > -1 && ShouldBeAGBQual (sfp, qual, allowProductGBQual)) {
1119
1128
            seen [qual] = LEGAL_FEATURE;
1120
1129
          }
1121
1130
        }
 
1131
        if (StringCmp (name, "repeat_region") == 0) {
 
1132
          seen [GBQUAL_map] = TRUE;
 
1133
        }
 
1134
        if (StringCmp (name, "operon") == 0) {
 
1135
          seen [GBQUAL_operon] = TRUE;
 
1136
        }
1122
1137
        for (i = 0; i < sefp->opt_num; i++) {
1123
1138
          qual = sefp->opt_qual [i];
1124
 
          if (qual > -1 && ShouldBeAGBQual (qual, allowProductGBQual)) {
 
1139
          if (qual > -1 && ShouldBeAGBQual (sfp, qual, allowProductGBQual)) {
1125
1140
            seen [qual] = LEGAL_FEATURE;
1126
1141
          }
1127
1142
        }
1249
1264
      SetStatus (ffp->exception, TRUE);
1250
1265
      break;
1251
1266
    case 5 :
1252
 
      SetTitle (ffp->exceptText, "trans splicing");
 
1267
      SetTitle (ffp->exceptText, "trans-splicing");
1253
1268
      SetStatus (ffp->exception, TRUE);
1254
1269
      break;
1255
1270
    case 6 :
1256
1271
      SetTitle (ffp->exceptText, "artificial frameshift");
1257
1272
      SetStatus (ffp->exception, TRUE);
 
1273
      break;
 
1274
    case 7 :
 
1275
      SetTitle (ffp->exceptText, "nonconsensus splice site");
 
1276
      SetStatus (ffp->exception, TRUE);
 
1277
      break;
 
1278
    case 8 :
 
1279
      SetTitle (ffp->exceptText, "rearrangement required for product");
 
1280
      SetStatus (ffp->exception, TRUE);
 
1281
      break;
 
1282
    case 9 :
 
1283
      SetTitle (ffp->exceptText, "alternative start codon");
 
1284
      SetStatus (ffp->exception, TRUE);
 
1285
      break;
1258
1286
    default :
1259
1287
      break;
1260
1288
  }
1273
1301
 
1274
1302
{
1275
1303
  Int2  val;
 
1304
  Boolean indexerVersion;
 
1305
 
 
1306
  indexerVersion = (Boolean) (GetAppProperty ("InternalNcbiSequin") != NULL);
 
1307
  if (indexerVersion) return;
1276
1308
 
1277
1309
  val = GetValue (g);
1278
1310
  if (val == 2) {
1387
1419
      PopupItem (canned, "RNA editing");
1388
1420
      PopupItem (canned, "reasons given in citation");
1389
1421
      PopupItem (canned, "ribosomal slippage");
1390
 
      PopupItem (canned, "trans splicing");
 
1422
      PopupItem (canned, "trans-splicing");
1391
1423
      PopupItem (canned, "artificial frameshift");
 
1424
      PopupItem (canned, "nonconsensus splice site");
 
1425
      PopupItem (canned, "rearrangement required");
 
1426
      PopupItem (canned, "alternative start codon");
1392
1427
      if (sfp != NULL && sfp->excpt) {
1393
1428
        if (StringICmp (sfp->except_text, "RNA editing") == 0) {
1394
1429
          SetValue (canned, 2);
1395
1430
        } else if (StringICmp (sfp->except_text, "reasons given in citation") == 0 ||
1396
1431
                   StringICmp (sfp->except_text, "reasons cited in publication") == 0) {
1397
1432
          SetValue (canned, 3);
1398
 
        } else if (StringICmp (sfp->except_text, "ribosomal slippage") == 0) {
1399
 
          SetValue (canned, 4);
1400
 
        } else if (StringICmp (sfp->except_text, "ribosome slippage") == 0) {
1401
 
          SetValue (canned, 4);
1402
 
        } else if (StringICmp (sfp->except_text, "trans splicing") == 0) {
1403
 
          SetValue (canned, 5);
1404
 
        } else if (StringICmp (sfp->except_text, "trans-splicing") == 0) {
 
1433
        } else if (StringICmp (sfp->except_text, "ribosomal slippage") == 0 ||
 
1434
                   StringICmp (sfp->except_text, "ribosome slippage") == 0) {
 
1435
          SetValue (canned, 4);
 
1436
        } else if (StringICmp (sfp->except_text, "trans-splicing") == 0 ||
 
1437
                   StringICmp (sfp->except_text, "trans splicing") == 0) {
1405
1438
          SetValue (canned, 5);
1406
1439
        } else if (StringICmp (sfp->except_text, "artificial frameshift") == 0) {
1407
1440
          SetValue (canned, 6);
 
1441
        } else if (StringICmp (sfp->except_text, "non-consensus splice site") == 0 ||
 
1442
                   StringICmp (sfp->except_text, "nonconsensus splice site") == 0) {
 
1443
          SetValue (canned, 7);
 
1444
        } else if (StringICmp (sfp->except_text, "rearrangement required for product") == 0) {
 
1445
          SetValue (canned, 8);
 
1446
        } else if (StringICmp (sfp->except_text, "alternative start codon") == 0) {
 
1447
          SetValue (canned, 9);
1408
1448
        }
1409
1449
      } else {
1410
1450
        SetValue (canned, 1);
1426
1466
    ffp->useGeneXref = NULL;
1427
1467
    ffp->newGeneGrp = NULL;
1428
1468
    ffp->geneSymbol = NULL;
 
1469
    ffp->geneAllele = NULL;
1429
1470
    ffp->geneDesc = NULL;
 
1471
    ffp->locusTag = NULL;
1430
1472
    for (page = 0; page < 5; page++) {
1431
1473
      ffp->commonSubGrp [page] = NULL;
1432
1474
    }
1460
1502
      ffp->newGeneGrp = HiddenGroup (y, 2, 0, NULL);
1461
1503
      StaticPrompt (ffp->newGeneGrp, "Gene Symbol", 0, dialogTextHeight, programFont, 'l');
1462
1504
      ffp->geneSymbol = DialogText (ffp->newGeneGrp, "", 20, NULL);
 
1505
      StaticPrompt (ffp->newGeneGrp, "Allele", 0, dialogTextHeight, programFont, 'l');
 
1506
      ffp->geneAllele = DialogText (ffp->newGeneGrp, "", 20, NULL);
1463
1507
      StaticPrompt (ffp->newGeneGrp, "Description", 0, dialogTextHeight, programFont, 'l');
1464
1508
      ffp->geneDesc = DialogText (ffp->newGeneGrp, "", 20, NULL);
 
1509
      StaticPrompt (ffp->newGeneGrp, "Locus Tag", 0, dialogTextHeight, programFont, 'l');
 
1510
      ffp->locusTag = DialogText (ffp->newGeneGrp, "", 20, NULL);
1465
1511
      Hide (ffp->newGeneGrp);
1466
1512
      ffp->editGeneBtn = PushButton (y, "Edit Gene Feature", Nlm_LaunchGeneFeatEd);
1467
1513
      SetObjectExtra (ffp->editGeneBtn, ffp, NULL);
1623
1669
{
1624
1670
  FILE     *fp;
1625
1671
  Int4     len;
 
1672
  Int4     read_len;
1626
1673
  Int4     max;
1627
1674
  CharPtr  str;
1628
1675
#ifdef WIN_MAC
1635
1682
 
1636
1683
  if (t != NULL && path != NULL && *path != '\0') {
1637
1684
    len = FileLength (path);
 
1685
    max = (Int4) INT2_MAX;
1638
1686
#ifdef WIN_MOTIF
1639
1687
    max = INT4_MAX;
1640
 
#else
1641
 
    max = (Int4) INT2_MAX;
 
1688
#endif
 
1689
#ifdef WIN_MSWIN
 
1690
    max = INT4_MAX;
 
1691
#endif
 
1692
#ifdef WIN_MAC
 
1693
#ifdef OS_UNIX_DARWIN
 
1694
    max = INT4_MAX;
 
1695
#endif
1642
1696
#endif
1643
1697
    if (len > 0 && len < max - 4) {
1644
1698
      str = MemNew (sizeof (char) * (len + 3));
1645
1699
      if (str != NULL) {
1646
1700
        fp = FileOpen (path, "r");
1647
1701
        if (fp != NULL) {
1648
 
          FileRead (str, sizeof (char), (size_t) len, fp);
 
1702
          read_len = FileRead (str, sizeof (char), (size_t) len, fp);
 
1703
          str [ read_len ] = 0;
1649
1704
#if (defined(OS_DOS) || defined (OS_NT))
1650
1705
          p = str;
1651
1706
          q = str;
1685
1740
{
1686
1741
  FILE     *fp;
1687
1742
  size_t   len;
1688
 
  Int4     max;
1689
1743
  CharPtr  str;
1690
1744
#ifdef WIN_MAC
1691
1745
  CharPtr  p;
1693
1747
 
1694
1748
  if (t != NULL && path != NULL && *path != '\0') {
1695
1749
    len = TextLength (t);
1696
 
#ifdef WIN_MOTIF
1697
 
    max = INT4_MAX;
1698
 
#else
1699
 
    max = (Int4) INT2_MAX;
1700
 
#endif
1701
 
    if (len > 0 && (Int4) len < max - 4) {
 
1750
    if (len > 0) {
1702
1751
#ifdef WIN_MAC
1703
1752
      fp = FileOpen (path, "r");
1704
1753
      if (fp != NULL) {
1795
1844
 
1796
1845
  DoC              doc;
1797
1846
  TexT             text;
 
1847
 
 
1848
  TexT             find;
1798
1849
} TextViewForm, PNTR TextViewFormPtr;
1799
1850
 
1800
1851
static ParData txtParFmt = {FALSE, FALSE, FALSE, FALSE, TRUE, 0, 0};
1924
1975
  }
1925
1976
}
1926
1977
 
1927
 
extern void LaunchGeneralTextViewer (CharPtr path, CharPtr title)
1928
 
 
1929
 
{
 
1978
 
 
1979
static void FindInGeneralText (ButtoN b)
 
1980
 
 
1981
{
 
1982
  Int2             actual;
 
1983
  Char             buf [1030];
 
1984
  Char             ch;
 
1985
  Int2             cnt;
 
1986
  Int4             cntr;
 
1987
  Int2             first;
 
1988
  FILE             *fp;
 
1989
  Char             lastch;
 
1990
  Int4             line;
 
1991
  ValNodePtr       matches;
 
1992
  Int2             next;
 
1993
  Int2             offset = 0;
 
1994
  Char             path [PATH_MAX];
 
1995
  CharPtr          ptr;
 
1996
  Int2             state;
 
1997
  CharPtr          str;
 
1998
  TextFsaPtr       tbl;
 
1999
  TextViewFormPtr  tfp;
 
2000
  Int4             max;
 
2001
 
 
2002
  tfp = (TextViewFormPtr) GetObjectExtra (b);
 
2003
  if (tfp == NULL) return;
 
2004
  if (tfp->doc != NULL) {
 
2005
    GetOffset (tfp->doc, NULL, &offset);
 
2006
  } else if (tfp->text != NULL) {
 
2007
    GetOffset (tfp->text, NULL, &offset);
 
2008
  }
 
2009
  first = -1;
 
2010
  next = -1;
 
2011
  max = INT2_MAX;
 
2012
 
 
2013
  str = SaveStringFromText (tfp->find);
 
2014
 
 
2015
  if (StringDoesHaveText) {
 
2016
    TmpNam (path);
 
2017
    if (ExportForm (tfp->form, path)) {
 
2018
      tbl = TextFsaNew ();
 
2019
      if (tbl != NULL) {
 
2020
        TextFsaAdd (tbl, str);
 
2021
        fp = FileOpen (path, "r");
 
2022
        if (fp != NULL) {
 
2023
          line = 0;
 
2024
          state = 0;
 
2025
          cntr = FileLength (path);
 
2026
          cnt = (Int2) MIN (cntr, 1024L);
 
2027
          lastch = '\0';
 
2028
          while (cnt > 0 && cntr > 0 && line <= max && 
 
2029
                 ((next == -1 && offset > first) || first == -1)) {
 
2030
            actual = (Int2) FileRead (buf, 1, cnt, fp);
 
2031
            if (actual > 0) {
 
2032
              cnt = actual;
 
2033
              buf [cnt] = '\0';
 
2034
              ptr = buf;
 
2035
              ch = *ptr;
 
2036
              while (ch != '\0') {
 
2037
                if (ch == '\n' || ch == '\r') {
 
2038
                  if (ch == '\n' && lastch == '\r') {
 
2039
                    /* do not increment line */
 
2040
                  } else if (ch == '\r' && lastch == '\n') {
 
2041
                    /* do not increment line */
 
2042
                  } else {
 
2043
                    line++;
 
2044
                  }
 
2045
                }
 
2046
                state = TextFsaNext (tbl, state, ch, &matches);
 
2047
                if (matches != NULL) {
 
2048
                  if (first == -1) {
 
2049
                    first = line;
 
2050
                  }
 
2051
                  if (next == -1 && line > offset) {
 
2052
                    next = line;
 
2053
                  }
 
2054
                }
 
2055
                lastch = ch;
 
2056
                ptr++;
 
2057
                ch = *ptr;
 
2058
              }
 
2059
              cntr -= cnt;
 
2060
              cnt = (Int2) MIN (cntr, 1024L);
 
2061
            } else {
 
2062
              cnt = 0;
 
2063
              cntr = 0;
 
2064
            }
 
2065
          }
 
2066
        }
 
2067
        FileClose (fp);
 
2068
      }
 
2069
      TextFsaFree (tbl);
 
2070
    }
 
2071
    FileRemove (path);
 
2072
  }
 
2073
  MemFree (str);
 
2074
  if (line > max) {
 
2075
    Message (MSG_ERROR, "Too many lines for search");
 
2076
  }
 
2077
 
 
2078
  if (next >= 0) {
 
2079
    offset = next;
 
2080
  } else if (first >= 0) {
 
2081
    offset = first;
 
2082
  } else return;
 
2083
  if (tfp->doc != NULL) {
 
2084
    SetOffset (tfp->doc, 0, offset);
 
2085
    Update ();
 
2086
  } else if (tfp->text != NULL) {
 
2087
    SetOffset (tfp->text, 0, offset);
 
2088
    Update ();
 
2089
  }
 
2090
}
 
2091
 
 
2092
static void LaunchGeneralTextViewerEx (CharPtr path, CharPtr title, Boolean useScrollText)
 
2093
 
 
2094
{
 
2095
  ButtoN             b;
1930
2096
  FonT               fnt;
 
2097
  GrouP              g;
1931
2098
  Int2               pixheight;
1932
2099
  Int2               pixwidth;
1933
2100
  StdEditorProcsPtr  sepp;
1939
2106
#endif
1940
2107
 
1941
2108
  tfp = (TextViewFormPtr) MemNew (sizeof (TextViewForm));
1942
 
  if (tfp != NULL) {
1943
 
    w = DocumentWindow (-50, -33, -10, -10, title, StdCloseWindowProc, ResizeTextViewer);
1944
 
    SetObjectExtra (w, tfp, StdCleanupFormProc);
1945
 
    tfp->form = (ForM) w;
1946
 
    tfp->exportform = ExportTextViewForm;
1947
 
    tfp->formmessage = TextViewFormMessage;
1948
 
 
1949
 
    sepp = (StdEditorProcsPtr) GetAppProperty ("StdEditorForm");
1950
 
    if (sepp != NULL) {
1951
 
      SetActivate (w, sepp->activateForm);
1952
 
      tfp->appmessage = sepp->handleMessages;
1953
 
    }
1954
 
 
1955
 
    fnt = programFont;
1956
 
    pixwidth = 35 * stdCharWidth + 17;
1957
 
    pixheight = 20 * stdLineHeight;
1958
 
 
1959
 
    tvpp = (TextViewProcsPtr) GetAppProperty ("TextDisplayForm");
1960
 
    if (tvpp != NULL) {
1961
 
      pixwidth = MAX (pixwidth, tvpp->minPixelWidth);
1962
 
      pixheight = MAX (pixheight, tvpp->minPixelHeight);
1963
 
      if (tvpp->displayFont != NULL) {
1964
 
        fnt = tvpp->displayFont;
1965
 
      }
1966
 
      if (tvpp->activateForm != NULL) {
1967
 
        SetActivate (w, tvpp->activateForm);
1968
 
      }
1969
 
    }
 
2109
  if (tfp == NULL) return;
 
2110
 
 
2111
  w = DocumentWindow (-50, -33, -10, -10, title, StdCloseWindowProc, ResizeTextViewer);
 
2112
  SetObjectExtra (w, tfp, StdCleanupFormProc);
 
2113
  tfp->form = (ForM) w;
 
2114
  tfp->exportform = ExportTextViewForm;
 
2115
  tfp->formmessage = TextViewFormMessage;
 
2116
 
 
2117
  sepp = (StdEditorProcsPtr) GetAppProperty ("StdEditorForm");
 
2118
  if (sepp != NULL) {
 
2119
    SetActivate (w, sepp->activateForm);
 
2120
    tfp->appmessage = sepp->handleMessages;
 
2121
  }
 
2122
 
 
2123
  fnt = programFont;
 
2124
  pixwidth = 35 * stdCharWidth + 17;
 
2125
  pixheight = 20 * stdLineHeight;
 
2126
 
 
2127
  tvpp = (TextViewProcsPtr) GetAppProperty ("TextDisplayForm");
 
2128
  if (tvpp != NULL) {
 
2129
    pixwidth = MAX (pixwidth, tvpp->minPixelWidth);
 
2130
    pixheight = MAX (pixheight, tvpp->minPixelHeight);
 
2131
    if (tvpp->displayFont != NULL) {
 
2132
      fnt = tvpp->displayFont;
 
2133
    }
 
2134
    if (tvpp->activateForm != NULL) {
 
2135
      SetActivate (w, tvpp->activateForm);
 
2136
    }
 
2137
  }
1970
2138
 
1971
2139
#ifndef WIN_MAC
1972
 
    m = PulldownMenu (w, "File");
1973
 
    FormCommandItem (m, "Export...", (BaseFormPtr) tfp, VIB_MSG_EXPORT);
1974
 
    SeparatorItem (m);
1975
 
    FormCommandItem (m, "Close", (BaseFormPtr) tfp, VIB_MSG_CLOSE);
1976
 
    if (tvpp != NULL && tvpp->useScrollText) {
1977
 
      m = PulldownMenu (w, "Edit");
1978
 
      FormCommandItem (m, CUT_MENU_ITEM, (BaseFormPtr) tfp, VIB_MSG_CUT);
1979
 
      FormCommandItem (m, COPY_MENU_ITEM, (BaseFormPtr) tfp, VIB_MSG_COPY);
1980
 
      FormCommandItem (m, PASTE_MENU_ITEM, (BaseFormPtr) tfp, VIB_MSG_PASTE);
1981
 
      FormCommandItem (m, CLEAR_MENU_ITEM, (BaseFormPtr) tfp, VIB_MSG_DELETE);
1982
 
    }
 
2140
  m = PulldownMenu (w, "File");
 
2141
  FormCommandItem (m, "Export...", (BaseFormPtr) tfp, VIB_MSG_EXPORT);
 
2142
  SeparatorItem (m);
 
2143
  FormCommandItem (m, "Close", (BaseFormPtr) tfp, VIB_MSG_CLOSE);
 
2144
  if (tvpp != NULL && tvpp->useScrollText) {
 
2145
    m = PulldownMenu (w, "Edit");
 
2146
    FormCommandItem (m, CUT_MENU_ITEM, (BaseFormPtr) tfp, VIB_MSG_CUT);
 
2147
    FormCommandItem (m, COPY_MENU_ITEM, (BaseFormPtr) tfp, VIB_MSG_COPY);
 
2148
    FormCommandItem (m, PASTE_MENU_ITEM, (BaseFormPtr) tfp, VIB_MSG_PASTE);
 
2149
    FormCommandItem (m, CLEAR_MENU_ITEM, (BaseFormPtr) tfp, VIB_MSG_DELETE);
 
2150
  }
1983
2151
#endif
1984
2152
 
1985
 
    if (tvpp != NULL && tvpp->useScrollText) {
1986
 
      tfp->text = ScrollText (w, (pixwidth + stdCharWidth - 1) / stdCharWidth,
1987
 
                              (pixheight + stdLineHeight - 1) / stdLineHeight,
1988
 
                              fnt, FALSE, NULL);
1989
 
      SetObjectExtra (tfp->text, tfp, NULL);
1990
 
      RealizeWindow (w);
1991
 
      if (! FileToScrollText (tfp->text, path)) {
1992
 
        SetTitle (tfp->text, "(Text is too large to be displayed in this control.)");
1993
 
      }
1994
 
    } else {
1995
 
      tfp->doc = DocumentPanel (w, pixwidth, pixheight);
1996
 
      SetObjectExtra (tfp->doc, tfp, NULL);
1997
 
      RealizeWindow (w);
1998
 
      txtColFmt.pixWidth = screenRect.right - screenRect.left;
1999
 
      txtColFmt.pixInset = 8;
2000
 
      DisplayFancy (tfp->doc, path, &txtParFmt, &txtColFmt, fnt, 0);
2001
 
      /* document.c: SaveTableItem does not strip preceeding tabs if tabCount is 0 */
 
2153
  /* right now Find button is only in indexer Sequin */
 
2154
  if (useScrollText) {
 
2155
    g = HiddenGroup (w, 5, 0, NULL);
 
2156
    b = PushButton (g, "Find", FindInGeneralText);
 
2157
    SetObjectExtra (b, tfp, NULL);
 
2158
    tfp->find = DialogText (g, "", 10, NULL);
 
2159
  }
 
2160
 
 
2161
  if (useScrollText) {
 
2162
    tfp->text = ScrollText (w, (pixwidth + stdCharWidth - 1) / stdCharWidth,
 
2163
                            (pixheight + stdLineHeight - 1) / stdLineHeight,
 
2164
                            fnt, FALSE, NULL);
 
2165
    SetObjectExtra (tfp->text, tfp, NULL);
 
2166
    RealizeWindow (w);
 
2167
    if (! FileToScrollText (tfp->text, path)) {
 
2168
      /* SetTitle (tfp->text, "(Text is too large to be displayed in this control.)"); */
 
2169
      Remove (w);
 
2170
      LaunchGeneralTextViewerEx (path, title, FALSE);
 
2171
      return;
2002
2172
    }
2003
 
    Show (w);
2004
 
    Select (w);
2005
 
    Update ();
2006
 
  } 
 
2173
  } else {
 
2174
    tfp->doc = DocumentPanel (w, pixwidth, pixheight);
 
2175
    SetObjectExtra (tfp->doc, tfp, NULL);
 
2176
    RealizeWindow (w);
 
2177
    txtColFmt.pixWidth = screenRect.right - screenRect.left;
 
2178
    txtColFmt.pixInset = 8;
 
2179
    DisplayFancy (tfp->doc, path, &txtParFmt, &txtColFmt, fnt, 0);
 
2180
    /* document.c: SaveTableItem does not strip preceeding tabs if tabCount is 0 */
 
2181
  }
 
2182
  Show (w);
 
2183
  Select (w);
 
2184
  Update ();
 
2185
}
 
2186
 
 
2187
extern void LaunchGeneralTextViewer (CharPtr path, CharPtr title)
 
2188
 
 
2189
{
 
2190
  TextViewProcsPtr tvpp;
 
2191
 
 
2192
  tvpp = (TextViewProcsPtr) GetAppProperty ("TextDisplayForm");
 
2193
  if (tvpp != NULL && tvpp->useScrollText) {
 
2194
    LaunchGeneralTextViewerEx (path, title, TRUE);
 
2195
  } else {
 
2196
    LaunchGeneralTextViewerEx (path, title, FALSE);
 
2197
  }
2007
2198
}
2008
2199
 
2009
2200
#ifndef WIN_MAC