home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / i / iv26_w_3.zip / EXAMPLES / SQUARES / SQUARES.DSK (.txt) < prev    next >
Turbo C Context File  |  1992-03-27  |  32KB  |  930 lines

  1. Turbo C Context File 
  2. SQUARES.DEF
  3. VIEW.C
  4. SQUARES.C
  5. SFRAME.C
  6. METAVIEW.C
  7. MAIN.C
  8. GLUE.C
  9. WINIVWIN.LIB
  10. WINIV.LIB
  11. SQUARES\*.*
  12. INTERVIE\*.H
  13. A:\LIB\*.C
  14. ::nviews
  15. nviews
  16. inline
  17. SetPattern
  18. lword
  19. d:\modulex
  20. SQUARES\VIEW.C
  21. SQUARES\SFRAME.C
  22. SQUARES\METAVIEW.C
  23. SQUARES\SQUARES.C
  24. SQUARES\MAIN.C
  25. MAIN.C
  26. VIEW.C
  27. SFRAME.C
  28. METAVIEW.C
  29. SQUARES.C
  30. SQUARES.DEF
  31. WINIV.LIB
  32. WINIVWIN.LIB
  33. ffblk
  34. arraya
  35. strlen
  36. arrayb
  37. D:\BORLANDC\IV\SQUARES\METAVIEW.C
  38. A:\LIB\XPAINTER.C
  39. D:\BORLANDC\IV\PAINTERR.C
  40. D:\BORLANDC\IV\WPAINTER.C
  41. D:\BORLANDC\IV\PANNER.C
  42. D:\BORLANDC\IV\CONTROL.C
  43. A:\LIB\XPAINTER.C
  44. D:\BORLANDC\IV\PAINTERR.C
  45. D:\BORLANDC\IV\EXAMPLES\SQUARES\SQUARES.DEF
  46. D:\BORLANDC\IV\PAINTERR.C
  47. D:\BORLANDC\IV\WINTER.C
  48. D:\BORLANDC\IV\WPAINTER.C
  49. D:\BORLANDC\IV\PANNER.C
  50. D:\BORLANDC\IV\EXAMPLES\SQUARES\MAIN.C
  51. D:\BORLANDC\IV\EXAMPLES\SQUARES\METAVIEW.C
  52. pu      findstr(wrk,inter,FotName);
  53.       DispOneFoto(FotName);
  54.       freestrlst(&inter);
  55.     }
  56. /*    } while((res = ask_mess("back to form?")) != 0);*/
  57.     for (wrk = 0;wrk < N_OF_ITEMS;wrk++)
  58.       free((void *)vals[wrk]);
  59. static int fot_sho(int mode,int Opt)
  60. char *err ="Documents not found in fot_sho";  /*  0 */
  61. int  rc;
  62.      clrscr();
  63.      $get foto record;
  64.      if (info.error_status)
  65.        {
  66.      err_mess(err);
  67.      return 1;
  68.        }
  69.      else
  70.      {
  71.        switch (Opt)
  72.         case 0:  ShowForm(mode); break;
  73.         case 1:  ShowText(); break;
  74.         case 2:  ShowPicture(); break;
  75.         case 3:  ShowForm(mode);
  76.              ShowText();
  77.              ShowPicture();
  78.              break;
  79.         case 4:  ShowPicture();
  80.              ShowText();
  81.              break;
  82.         case 5:/********  documented picure *********/
  83.            break;
  84.       }/************      End of Switch   *******/
  85.     return 0;
  86.     }
  87. static int fot_sho(int mode,int Opt)
  88. static char *err ="Documents not found in fot_sho";  /*  0 */
  89. int  rc;
  90.      clrscr();
  91.      $get foto record;
  92.      if (info.error_status) {
  93.         err_mess(err);
  94.         return 1;
  95.      }
  96.      else  {
  97.        switch (Opt)
  98.          {
  99.           case 0:  ShowForm(mode); break;
  100.           case 1:  ShowText(); break;
  101.           case 2:  ShowPicture(); break;
  102.           case 3:
  103.                ShowForm(mode);
  104.                ShowText();
  105.                ShowPicture();
  106.              break;
  107.         case 4:  ShowPicture();
  108.              ShowText();
  109.              break;
  110.         case 5:/********  documented picure *********/
  111.            break;
  112.       }/************      End of Switch   *******/
  113.     }
  114.     return 1;
  115. void ShowForm(int mode)
  116.  /*  This function is used for creating the form and displaying it on screen*/
  117. static char bn[5], ft[2], et[3], sw[61];
  118. static char *list[10];
  119. int qty,ind = 0;
  120.     $find current of foto record;
  121.     $get foto record;
  122.     $find owner of mak_fots set;
  123.     if ( info.error_status ) {
  124.        err_mess("Owner of photo not found");
  125.        return;
  126.     /* ------------------------------------------- */
  127.     $get maker record;
  128.     list[ind] = (char *)calloc(sizeof(maker.mak_name),sizeof(char));
  129.     strcpy(list[ind++],maker.mak_name);
  130.     /* ------------------------------------------- */
  131.     itoa(foto.fot_numb,bn,10);
  132.     list[ind] = (char *)calloc(sizeof(bn),sizeof(char));
  133.     strcpy(list[ind++],bn);
  134.     /* ------------------------------------------- */
  135.     setmem(ft, sizeof(ft), '\0');
  136.     ft[0] = foto.fot_type;
  137.     list[ind] = (char *)calloc(sizeof(ft),sizeof(char));
  138.     strcpy(list[ind++],ft);
  139.     /*  ------------------------------------------- */
  140.     $find owner of dat_fots record;
  141.     $get date record;
  142.     if ((date.dat_num > 0) && (date.dat_num < 32)) {
  143.       setmem(bn,sizeof(bn),'\0');
  144.       itoa(date.dat_num,bn);
  145.       list[ind] = (char *)calloc(strlen(bn),sizeof(char));
  146.       strcpy(list[ind++],bn);
  147.     }
  148.     else list[ind++] = NULL;
  149.     $find owner of mon_dats record;
  150.     $get month record;
  151.     if ((month.mon_num > 0) && (month.mon_num < 13)) {
  152.        setmem(bn,sizeof(bn),'\0');
  153.       itoa(month.mon_num,bn);
  154.       list[ind] = (char *)calloc(strlen(bn),sizeof(char));
  155.       strcpy(list[ind++],bn);
  156.     }
  157.     else list[ind++] = NULL;
  158.     $find owner of yer_mons record;
  159.     $get year record;
  160.     list[ind] = (char *)calloc(strlen(year.yer_num),sizeof(char));
  161.     strcpy(list[ind++],year.yer_num);
  162.    /* ------------------------------------------- */
  163.     setmem(class2.cl2_full, 6, '\0');
  164.     $find owner of cl2_fots set;
  165.     $get class2;
  166.     list[ind] = (char *)calloc(strlen(class2.cl2_full),sizeof(char));
  167.     strcpy(list[ind++],class2.cl2_full);
  168.    /* ------------------------------------------- */
  169.     $find owner of pl3_fots set;
  170.     $get place3 record;
  171.     $find owner of pl2_pl3s set;
  172.     $get place2 record;
  173.     $find owner of pl1_pl2s set;
  174.     $get place1 record;
  175.     setmem(et,sizeof(et),'\0');
  176.     itoa(place1.pl1_code, et, 10);
  177.     list[ind] = (char *)calloc(sizeof(et),sizeof(char));
  178.     strcpy(list[ind++],et);
  179.     list[ind] = (char *)calloc(strlen(place2.pl2_name),sizeof(char));
  180.     strcpy(list[ind++],place2.pl2_name);
  181.     list[ind] = (char *)calloc(strlen(place3.pl3_name),sizeof(char));
  182.     strcpy(list[ind++],place3.pl3_name);
  183.    /* ------------------------------------------- */
  184.      setmem(sw, sizeof(sw), '\0');
  185.      $find first keylink of fot_keys set;
  186.      while (!info.error_status) {
  187.           $find owner of key_fots set;
  188.           $get keyword;
  189.           strcat(sw, keyword.txt_srch);
  190.           strcat(sw, " ");
  191.           $find next keylink of fot_keys set;
  192.      list[ind] = (char *)calloc(strlen(sw),sizeof(char));
  193.      strcpy(list[ind++],sw);
  194. #include "d:\infotemp\foto.h"
  195. void edform(char *list[N_OF_ITEMS],int attr[],int qty,formtype type)
  196.   colorpak maincolors = {2,52,52,53,79,112};
  197. /*  static char *list[N_OF_ITEMS];            to store all the attributes */
  198.   wptr wp[14];
  199.   constvals items[N_OF_ITEMS] =
  200.           {NULL,"PHOTOGRAPHER NAME", "mak_name",20,23,compulsory,typein,5,3,string},      /*  0  */
  201.           {NULL,"No.","fot_numb",5,10,compulsory,typein,34,3,digchk},              /*  1  */
  202.           {NULL,"Type","fot_type",2,6,optional,typein,46,3,digital},                /*  2  */
  203.           {NULL,"YY","fot_dyer",3,6,optional,typein,56,3,digital},                /*  3  */
  204.           {NULL,"MM","fot_dmon",3,6,optional,typein,62,3,digital},                  /*  4  */
  205.           {NULL,"DD","fot_ddat",3,6,optional,typein,68,3,digital},                   /*  5  */
  206.           {NULL,"PHOTO NAME","fot_name",38,45,compulsory,typein,5,7,strchk},           /*  6  */
  207.           {NULL,"CLASS. CODE","cl2_full",6,15,compulsory,help,60,7,strchk},        /*  7  */
  208.           {NULL,"CONTINENT","pl1_code",3,20,optional,help,5,11,digital},        /*  8  */
  209.           {NULL,"COUNTRY NAME","pl2_name",20,25,optional,typein,25,11,string},           /*  9  */
  210.           {NULL,"CITY NAME","pl3_name",20,25,optional,typein,50,11,string},        /* 10  */
  211.           {NULL,"KEY WORDS","txt_srch",64,70,optional,typein,5,15,string},              /* 11  */
  212.           {NULL,"PICT. FILE NAME","fot_pict",20,35,compulsory,dirhelp,5,19,string},     /* 12  */
  213.           {NULL,"TEXT FILE NAME","fot_text",20,35,optional,dirhelp,40,19,string}        /* 13  */
  214.   unsigned int i;
  215.   char name[F_WIDTH];
  216.      clrscr();
  217.   /*---------------------------------------------------------*/
  218.    for (i = 0;i < qty;i++)  {
  219.       items[attr[i]].content  = list[attr[i]];
  220.       popupwindow(items[attr[i]].x,items[attr[i]].y,items[attr[i]].winwd,1,items[attr[i]].header,overlap,&maincolors,&wp[i]);
  221.   /*---------------------------------------------------------*/
  222.   if (type == document) {
  223.      for (i = 0; i < qty, i++) {
  224.         selectwindow(wp[i]);
  225.         putstratr(0,0,items[atrnum[i]].content,15,items[atrnum[i]].width);
  226.      }
  227.      getch();
  228.      rmvwindow(&wp[0]);
  229.   /*---------------------------------------------------------*/
  230.   if (type == search) {
  231.      for (i = 0; i < N_OF_ITEMS; i++) {
  232.         strcpy(items[attr[i]].content,"");
  233.      }
  234.   /*---------------------------------------------------------*/
  235.      goaround(wp,items,attr,qty,type );
  236.   /*---------------------------------------------------------*/
  237.      rmvwindow(&wp[0]);
  238.      for (i = 0;i < qty; i++) {
  239.       printf("list[%d] = %s\n",attr[i],items[attr[i]].content);
  240. void goaround(wptr w[],constvals items[],int atrnum[],int qty,formtype type)
  241.   goaround edits a certain form. It moves from one edit field to
  242.   another until F10 is pressed. TAB key moves the cursor form one
  243.   window to another in a cyclic fashion. The cursor shows the
  244.   active window. Returns the return code. (see smenu.h)
  245.         parameters:
  246.             w    -    pointer to the array of window structures
  247.             outlist[]-      pointer to the array of attributes
  248.             qty    -    amount of fields to be entered
  249.   unsigned char i,retkey;
  250.   char selatr = ACTIVE_ATTR,norm,*mkname;
  251.      norm = w[0]->wndatr;
  252.     selectwindow(w[0]);
  253.    /*---------------------------------------------------------------------------*/
  254.    /*     filling the form                             */
  255.     i = 0;
  256.     do  {
  257.       w[i]->wndatr = selatr;
  258.       selectwindow(w[i]);
  259.       prthz(0,0,"",w[i]->wndatr,items[atrnum[i]].width);
  260.       retkey = getfield(w[i],items[atrnum[i]].content,items[atrnum[i]].width);
  261.           if ((retkey == F1_PRESSED)) {
  262.           disphelp(items,atrnum,i,0);
  263.           }
  264.       if ( (type == search) && (i == (qty - 1)) )
  265.         break;
  266.    /*-----------------------------------------------------------------------*/
  267.       if (( retkey == TAB_PRESSED ) || (retkey == 1) || (retkey == F10_PRESSED)) {
  268.           w[i]->wndatr = norm;
  269.           prthz(0,0," ",norm,w[i]->xw-2);
  270.           putstratr(0,0,items[atrnum[i]].content,norm,items[atrnum[i]].width);
  271.           if (i == (qty - 1)) i = 0;
  272.           else i++;
  273.       }
  274.     } while (retkey != F10_PRESSED);
  275.  /*-----------------------------------------------------------------------*/
  276.  /*                 checking the entered values                  */
  277.  if (type  == store) {
  278.    for (i = 0;i < qty;i++)  {
  279.     while ((items[atrnum[i]].status == compulsory)
  280.         && (!strcmp(items[atrnum[i]].content,"")))  {
  281.       disphelp(items,atrnum,i,1);
  282.       repeat(items,atrnum,i,w);
  283.     while ((strcmp(items[atrnum[i]].content,"")) &&
  284.         ((items[atrnum[i]].value == digital)||(items[atrnum[i]].value == digchk))
  285.         && (num_str(items[atrnum[i]].content) == 0)) {
  286.       disphelp(items,atrnum,i,2);
  287.       repeat(items,atrnum,i,w);
  288.       do {
  289.       if (items[atrnum[i]].value != digchk)
  290.         break;
  291.       if (strcmp(items[atrnum[i]].codname,"fot_numb") == 0) {
  292.         if (chknumb(items[atrnum[i]].content,items[0].content))
  293.           break;
  294.        }
  295.          if (!(strcmp(items[atrnum[i]].content,""))
  296.            && ((strcmp(items[atrnum[i]].codname,"fot_type") == 0)))
  297.              if ((items[atrnum[i]].content[1] == '1') ||(items[atrnum[i]].content[1] == '2')
  298.               ||(items[atrnum[i]].content[1] == '3') ||(items[atrnum[i]].content[1] == '4'))
  299.                break;
  300.       disphelp(items,atrnum,i,3);
  301.       repeat(items,atrnum,i,w);
  302.     } while (1);
  303.     do {
  304.       if (items[atrnum[i]].value != strchk)
  305.         break;
  306.        if (strcmp(items[atrnum[i]].codname,"fot_name") == 0) {
  307.         if (!chkname(items[atrnum[i]].content))
  308.           break;
  309.           }
  310.           if (strcmp(items[atrnum[i]].codname,"cl2_full") == 0) {
  311.             if (chkclass(items[atrnum[i]].content))
  312.                break;
  313.           }
  314.       disphelp(items,atrnum,i,4);
  315.       repeat(items,atrnum,i,w);
  316.     } while (1);
  317. char repeat(constvals items[],int atrnum[],int i,wptr w[])
  318.   int retkey;
  319.   unsigned char atrb = 95;
  320.       selectwindow(w[atrnum[i]]);
  321.       prthz(0,0,"",atrb,items[atrnum[i]].width);
  322.       do {
  323.          retkey = getfield(w[atrnum[i]],items[atrnum[i]].content,items[atrnum[i]].width);
  324.          if (retkey == F1_PRESSED) {
  325.            disphelp(items,atrnum,i,0);
  326.          }
  327.       while (retkey != 1);
  328.       prthz(0,0," ",w[atrnum[i]]->wndatr,w[atrnum[i]]->xw-2);
  329.       putstratr(0,0,items[atrnum[i]].content,w[atrnum[i]]->wndatr,items[atrnum[i]].width);
  330.       return 1;
  331. char getfield(wptr wp1,char attr[],int width)
  332.  This function fetches the field and binds it with attr
  333.  the field width is windows width MINUS 3. Returns 0 if
  334.  nothing is entered.
  335.     parameters:
  336.         wp1    -    pointer to the window
  337.         attr[]    -    pointer to attribute
  338.  char c,winx=0,winy=0;
  339.  char letcount = 0,i;
  340.  int key,done,ins;
  341.      setcursor(12,13);
  342.      done = FALSE;
  343.      ins = INS_ON;
  344.      if (strcmp(attr,"") != NULL)
  345.        {            /* The string is not empty */
  346.      letcount = strlen(attr);
  347.      putstratr(0,0,attr,wp1->wndatr,letcount);
  348.      winx = letcount;
  349.      gotoxy(winx,winy);
  350.      c = getkey(&key);
  351.      if ((isprint(c)) &&(key != TAB))
  352.        {
  353.          setmem(attr,width,'\0');
  354.          prthz(0,0," ",wp1->wndatr,width);
  355.          letcount = 0; winx = 0; winy = 0;
  356.          gotoxy(winx,winy);
  357.        }
  358.        }
  359.      else
  360.        {
  361.      gotoxy(winx,winy);
  362.      c = getkey(&key);
  363.        }
  364.      while(!done)
  365.        {
  366.         switch (key)
  367.           {
  368.          case L_ARROW:
  369.             if ((winx > 0) && (winy == 0))
  370.               winx--;
  371.             break;
  372.          case R_ARROW:
  373.             if ((winx < width) && (winy == 0)
  374.                  && (winx < letcount))
  375.               winx++;
  376.             break;
  377.          case BKSP:
  378.             if ((winx > 0) && (winy == 0)
  379.                  && (letcount > 0) && (winx <= letcount))
  380.               {
  381.                 for (i=winx-1;(i < letcount);i++)
  382.                    attr[i] = attr[i+1];
  383.                 attr[letcount--] = '\0';
  384.                 prthz(0,0," ",0,width);
  385.                 putstratr(0,0,attr,wp1->wndatr,letcount);
  386.                 if ( winx > 0) winx--;
  387.               }
  388.             break;
  389.          case DEL :
  390.             if ((winx >= 0) && (winy == 0)
  391.                  && (letcount > 0) && (winx < letcount))
  392.               {
  393.                 for (i=winx;(i < letcount);i++)
  394.                    attr[i] = attr[i+1];
  395.                 attr[letcount--] = '\0';
  396.                 prthz(0,0," ",0,width);
  397.                 putstratr(0,0,attr,wp1->wndatr,letcount);
  398.               }
  399.             break;
  400.          case INS:
  401.             if (ins)
  402.               {
  403.                ins = INS_OFF;
  404.                setcursor(4,13);
  405.               }
  406.             else
  407.              {
  408.                ins = INS_ON;
  409.                setcursor(12,13);
  410.              }
  411.             break;
  412.          case UP_ARROW:
  413.          case HOME:
  414.             winx = 0;
  415.             break;
  416.          case DN_ARROW:
  417.          case END:
  418.             winx = letcount;
  419.             break;
  420.          case RET:
  421.             done = TRUE;
  422.             gotoxy(0,0);
  423.             attr[letcount] = '\0';
  424.             if (letcount == 0)
  425.                return 0;
  426.             else return 1;
  427.          case TAB:
  428.             return TAB_PRESSED;    /* tab key pressed */
  429.          case F10:
  430.             return F10_PRESSED;
  431.          case F1:
  432.             return F1_PRESSED;
  433.          default:
  434.             if ((isprint(c)) && (winx <= letcount) && (letcount < width))
  435.               {
  436.                 if ((ins) && (letcount != 0))
  437.                   {
  438.                 if ((winx != letcount) && (letcount < (width-1) ))
  439.                   {
  440.                     for (i = letcount;(i > winx);i--)
  441.                       {
  442.                     attr[i] = attr[i-1];
  443.                     putchatr(i,winy,attr[i],wp1->wndatr);
  444.                       }
  445.                      attr[i] = c;
  446.                      putchatr(winx,winy,attr[i],wp1->wndatr);
  447.                      winx++;
  448.                      letcount++;
  449.                      break;
  450.                   }
  451.                   }
  452.                 if ((winx<=letcount)&&(winx < (width - 1)))
  453.                   {
  454.                 putchatr(winx,winy,c,wp1->wndatr);
  455.                 attr[winx++] = c;
  456.                   }
  457.                 if ((winx == letcount + 1) && (letcount < (width - 1)))
  458.                   letcount++;
  459.                 if (letcount == (width - 1))
  460.                   {
  461.                 ins = INS_OFF;
  462.                 setcursor(4,13);
  463.                   }
  464.               }
  465.       gotoxy(winx,winy);
  466.       c = getkey(&key);
  467.        }
  468.      if (letcount == 0)  return 0;
  469.      else return 1;
  470. void disphelp(constvals items[],int atrnum[],int i,int how)
  471.  colorpak hlpclrs = {2,53,75,53,95,117};
  472.  wptr hw;
  473.  char *fn;
  474.  char *msg[4] ={"type in characters",
  475.         "Filling  OBLIGATORY",
  476.         "only DIGITS",
  477.         "NOT FOUND IN DATABASE"
  478.     if (how == 0) {
  479.         switch (items[atrnum[i]].message) {
  480.              case typein:
  481.                   popupwindow(items[atrnum[i]].x,items[atrnum[i]].y+2,30,4,"help",overlap,&hlpclrs,&hw);
  482.                   putstratr(0,0,msg[how],hw->wndatr,hw->xw-2);
  483.                   putstratr(0,1,"press any key",hw->wndatr,hw->xw-2);
  484.                   getch();
  485.                   rmvwindow(&hw);
  486.                   break;
  487.              case help:
  488.                 if ((strcmp(items[atrnum[i]].codname,"cl2_full")) == 0) {
  489.                    clhelp(1,items[atrnum[i]].content);
  490.                 }
  491.                 else {
  492.                    clhelp(2,items[atrnum[i]].content);
  493.                 }
  494.                 break;
  495.              case dirhelp:
  496.                 if (strcmp(items[atrnum[i]].codname,"fot_pict") == 0) {
  497.                     fn = getdir("*.hbv","choose any file",142);
  498.                     strncpy(items[atrnum[i]].content,fn,items[atrnum[i]].width-1);
  499.                 }
  500.                 else {
  501.                     fn = getdir("*.txt","choose any file",142);
  502.                     strncpy(items[atrnum[i]].content,fn,items[atrnum[i]].width-1);
  503.                 }
  504.                 break;
  505.           }
  506.     else {
  507.        popupwindow(items[atrnum[i]].x,items[atrnum[i]].y+2,30,4,"help",overlap,&hlpclrs,&hw);
  508.        putstratr(0,0,msg[how],hw->wndatr,hw->xw-2);
  509.        putstratr(0,1,"press any key",hw->wndatr,hw->xw-2);
  510.        getch();
  511.        rmvwindow(&hw);
  512. int clhelp(int type,char *cl)
  513.  cl1menu creates classificator code 1 menu, when  the user chooses one
  514.  option, it returns the code, so the program which calls generates the
  515.  second list corresponding to the chosen option. returns 0 if nothing is chosen
  516.         parameters:
  517.             type    -    whether it is for pl1 or cl2_full
  518.             cl    -    in pointer to items.content
  519.   char *help1 = "MOUNTAINS/SEAS/LAKES/RIVERS";
  520.   char *help2 = "PALACES/CATHEDRALS/HOUSES/STREETS";
  521.   char *help3 = "EXHIBITIONS/HALLS";
  522.   colorpak maincolors = {2,25,25,47,91,112};
  523.   strlist sl1,sl2;
  524.   menudesc cl1,cl2;
  525.   char buf[4],*cn;
  526.    if ((type !=1) && (type !=2))
  527.      return 0;
  528.    setmem(buf,4,'\0');
  529.    setcursor(0,0);
  530.    if (type == 1) {
  531.       sl1 = stol("LANDSCAPES/CITIES/MUSEUMS",0);
  532.       popupmenu(45,7,1,3,sl1->hn.maxlen,sl1,"CL1",&cl1,&maincolors);
  533.    else {
  534.       sl1 = stol("EUROPE/N_AMERICA/S_AMERICA/ASIA/AFRICA/AUSTRALIA_OCEANIA",0);
  535.       popupmenu(8,13,1,3,sl1->hn.maxlen,sl1,"CL1",&cl1,&maincolors);
  536.       movearound(&cl1);
  537.       cn = itoa(cl1.ans,buf,10);
  538.       strncpy(cl,cn,2);
  539.       rmvmenu(&cl1);
  540.       return 1;
  541.    movearound(&cl1);
  542.    if (cl1.rcode == abortit)    {
  543.      rmvmenu(&cl1);
  544.       return(0);
  545.    switch (cl1.ans) {
  546.      case 1:
  547.         sl2 =stol(help1,0);
  548.          break;
  549.      case 2:
  550.          sl2 =stol(help2,0);
  551.          break;
  552.      case 3:
  553.          sl2 =stol(help3,0);
  554.          break;
  555.     popupmenu(45+sl1->hn.maxlen,MAX(sl1->hn.numelem+cl1.ans,9),1,
  556.         MIN(sl2->hn.numelem,10),sl2->hn.maxlen,sl2,"CL2",&cl2,&maincolors);
  557.     movearound(&cl2);
  558.     if (cl2.rcode == abortit) {
  559.        rmvmenu(&cl2);
  560.        rmvmenu(&cl1);
  561.        return 0;
  562.     cn = itoa(cl1.ans,buf,10);
  563.     strcpy(cl,cn);
  564.     strcat(cl,".");
  565.     cn = itoa(cl2.ans,buf,10);
  566.     strcat(cl,cn);
  567.     rmvmenu(&cl2);
  568.     rmvmenu(&cl1);
  569.     return 1;
  570. int num_str(char *str)
  571. char *cp;
  572.       cp = str;
  573.       do  {
  574.         if (!isdigit(*cp))
  575.            return 0;
  576.       } while(*++cp);
  577.       return 1;
  578. /*void getstr(strlist strl,strlist *strl2)
  579. strlist tl,st = NULL;
  580. int key = 1;
  581.   if (strl != NULL)  {
  582.        tl = strl->hn.first;
  583.        while (tl != NULL) {
  584.          appendstrlst(tl->dn.elem.data,0,key++,&st);
  585.          printf("list in getstr\n");
  586.          prtstrlst(strl);
  587.          prtstrlst(st);
  588.          getch();
  589.          tl = tl->dn.next;
  590.        }
  591.   *strl2 = st;
  592. }     */
  593. char findstr(int key,strlist strl,char foto[])
  594. strlist tl;
  595.   if (strl != NULL)  {
  596.      tl = strl->hn.first;
  597.      while (tl != NULL) {
  598.        if (tl->dn.elem.key == key) {
  599.           strcpy(foto,tl->dn.elem.data);
  600.           return 1;
  601.        }
  602.        tl = tl->dn.next;
  603.      }
  604.   return 0;
  605. int crform(int attr[],char formname[])
  606.   formcreate function creates a form and stores it in the data base
  607.   returns the number of attributes if entered otherwise 0.
  608.     parameters:
  609.         formname    -    pointer to name of the form
  610.         *list[9]    -    pointer to the list of form attributes
  611. colorpak maincolors = {2,52,52,53,79,112};
  612. char *Attrs = "PHOTOGRAPHER NAME/YEAR/MONTH/DATE/PHOTO NAME/CLASS.CODE/CONT.NAME/COUNTRY/CITY/KEY WORDS/END FORMATION";
  613.   strlist s1;                /* string list for the form attributes*/
  614.   wptr wfname;                /* window for the form name */
  615.   unsigned char count = 0;        /* This counts the number of choices*/
  616.   int i,cont,ans,done;            /* listmem[9] is for match form     */
  617.    clrscr();
  618.    cont = TRUE;
  619.    popupwindow(-1,-1,30,1,"FORM NAME",overlap,&maincolors,&wfname);
  620.    if (getfield(wfname,formname,F_WIDTH) == 0) {
  621.        rmvwindow(&wfname);
  622.        return 0;
  623.    rmvwindow(&wfname);
  624.    do {
  625.       s1 = stol(Attrs,0);
  626.       if ((ans = formselect(s1,"Form  Names")) == 0)
  627.     break;
  628.       else if (ans != 11) {
  629.           if (count > 0) {
  630.          done = FALSE;
  631.          for (i = 0; i < count ;i++) {
  632.           if ((attr[i] == ans + 1) || ((attr[i]) == 0) && (ans == 1))
  633.             done = TRUE;
  634.          if (done == FALSE) {
  635.            if (ans == 1)  attr[count++] = ans -1;
  636.            else attr[count++] = ans + 1;
  637.          else beep();
  638.           }
  639.           else  {
  640.         if (ans == 1) attr[count++] = ans - 1;
  641.         else attr[count++] = ans + 1;
  642.           }
  643.          }
  644.        else cont = FALSE;
  645.    } while((count < 11) && (cont == TRUE));
  646.    setcursor(12,13);
  647.    return count;
  648. int formselect(strlist sl,char *Title)
  649.   formselect returns one choice (attribute) chosen by the user.
  650.   It returns 0 if exit or ESC is pressed, otherwise the choice
  651.         parameters:
  652.             sl    -    pointer to the string list
  653.             choice    -    pointer to string (chosen item)
  654.  menudesc fcreate;            /* menu for the user to enter the form name*/
  655.  colorpak maincolors = {2,52,52,53,79,112};
  656.    setcursor(0,0);
  657.    popupmenu(25,5,1,10,sl->hn.maxlen,sl,Title,&fcreate,&maincolors);
  658.    movearound(&fcreate);
  659.    rmvmenu(&fcreate);
  660.    setcursor(12,13);
  661.    if (fcreate.rcode == abortit) return 0;
  662.    else return fcreate.ans;
  663. int select(strlist sl,char *Title)
  664.   select returns one choice (attribute) chosen by the user.
  665.   It returns 0 if exit or ESC is pressed, otherwise the choice
  666.      NOTE: select does NOT delete the string list
  667.         parameters:
  668.             sl    -    pointer to the string list
  669.             choice    -    pointer to string (chosen item)
  670.  menudesc fcreate;            /* menu for the user to enter the form name*/
  671.  colorpak maincolors = {2,52,52,53,79,112};
  672.    setcursor(0,0);
  673.    popupmenu(25,5,1,10,sl->hn.maxlen,sl,Title,&fcreate,&maincolors);
  674.    movearound(&fcreate);
  675.    rmvwindow(&(fcreate.w));
  676.    setcursor(12,13);
  677.    if (fcreate.rcode == abortit) return 0;
  678.    else return fcreate.ans;
  679. int ChooseMainMenu(void)
  680.   strlist sl;
  681.   char *menu1 = "STORE DOCUMENT/SELECT DOCUMENT/STORE FORM/STORE LINKS/";
  682.   char *menu2 = "STORE ROUTE/SELECT ROUTE/SERVICE FUNCTIONS/EXIT PROGRAM";
  683.   char *menuitems;
  684.    clrscr();
  685.    menuitems = (char *)calloc((strlen(menu1)+strlen(menu2)+1),sizeof(char));
  686.    strcpy(menuitems,menu1);
  687.    strcat(menuitems,menu2);
  688.    sl = stol(menuitems,0);
  689.    free((void *)menuitems);
  690.    return (formselect(sl,"Main menu"));
  691. void DispOneFoto(char *Foto)
  692.  fot_sho(0);
  693.  printf("Photo = %s\n",Foto);
  694.  getch();
  695. void sto_rou(void)
  696.    unsigned int Mode = 3,fotnum,key = 1;
  697.    char RouName[20],fname[38];
  698.    char *menu = "ENTER NEW PHOTO/SEE PHOTOS/END ROUTE";
  699.    strlst sl = NULL,fotlist = NULL;
  700.    wptr rwin;
  701.         setmem(RouName,sizeof(route.rou_name),'\0');
  702.         popup();
  703.         if (!getfield(rwinf,RouName,sizeof(route.rou_name))) {
  704.            rmvwindow(&rwin);
  705.            return;
  706.         }
  707.         rmvwindow(&rwin);
  708.         setmem(route.rou_name,sizeof(route.rou_name),'\0');
  709.         strcpy( route.rou_name,RouName );
  710.         $find route record using rou_key key;
  711.         if (!info.error_status)   {
  712.            err_mess("Such a Route Exists");
  713.            return;
  714.         }
  715.         setmem(route.rou_name, sizeof(route.rou_name), '\0');
  716.         strcpy( route.rou_name,RouName );
  717.         strupr( route.rou_name );
  718.         $store route record;
  719.         if (info.error_status) {
  720.              err_mess("Not Possible to store this route in sto_rou");
  721.              printf("info.err_status = %d\n",info.error_status);
  722.              getch();
  723.              return;
  724.         sl = stol(menu);
  725.         Mode = select(sl,"Route Creation");
  726.         do {
  727.           switch (Mode) {
  728.             case 1:
  729.                popupwin();
  730.                setmem(fname,sizeof(foto.fot_name),'\0');
  731.                if (!getfield(rwin,fname,sizeof(foto.fot_name)))
  732.                  break;
  733.                if (!chkname(fname)) {
  734.                   err_mess("No such photo");
  735.                   break;
  736.                }
  737.                appendstrlst(fname,0,key++,&fotlist);
  738.                setmem(foto.fot_name,sizeof(foto.fot_name),'\0');
  739.                strcpy(foto.fot_name,fname);
  740.                $find foto record using fot_key key;
  741.                if ( info.error_status ) {
  742.                   printf("info.err_status = %d\n",info.error_status);
  743.                   getch();
  744.                   return;
  745.                }
  746.                $store roulink;
  747.                if ( info.error_status ) {
  748.                   printf("cannot store the roulink for %s photo",foto.fot_name);
  749.                   printf("info.err_status = %d\n",info.error_status);
  750.                   getch();
  751.                   return;
  752.                }
  753.                break;
  754.             case 2:
  755.                 if (fotlist != NULL) {
  756.                    fotnum = select(fotlist,RouName);
  757.                    setmem(fname,sizeof(foto.fot_name),'\0');
  758.                    findstr(fotnum,fotlist,fname);
  759.                    DispOneFoto(fname);
  760.                 }
  761.                 else err_mess("Nothing to show");
  762.                 break;
  763.         }
  764.        } while (Mode != 3);
  765. void sel_rou(void)
  766.   unsigned int option;
  767.   char RouName[20];
  768.         option=DispRouMenu();
  769.         if (option ==0)
  770.            {
  771.             setmem(RouName,sizeof(route.rou_name),'\0');
  772.             setmem( route.rou_name,sizeof(route.rou_name),'\0' );
  773.             GetRouteName(RouName);
  774.             strcpy( route.rou_name,RouName );
  775.             $find route record using rou_key key;
  776.             if ( info.error_status )
  777.               {
  778.              err_mess("No such Route available in Data Base ");
  779.              return;
  780.               }
  781.              $get route record;
  782.              $find first roulink record of rou_links set;
  783.              if ( info.error_status )
  784.                {
  785.              err_mess("NO PHOTOS AVAILABLE");
  786.              return;
  787.                }
  788.              while ( !info.error_status )
  789.                {
  790.              $find owner of links_fots set;
  791.              if ( info.error_status )
  792.                {
  793.                  err_mess("NO PHOTOS AVAILABLE");
  794.                  return;
  795.                }
  796.                  fot_sho(1,Opt);
  797.                  $find next roulink record of rou_links set;
  798. void goaround(wptr w[],constvals items[],int atrnum[],int qty,formtype type)
  799.   goaround edits a certain form. It moves from one edit field to
  800.   another until F10 is pressed. TAB key moves the cursor form one
  801.   window to another in a cyclic fashion. The cursor shows the
  802.   active window. Returns the return code. (see smenu.h)
  803.         parameters:
  804.             w    -    pointer to the array of window structures
  805.             outlist[]-      pointer to the array of attributes
  806.             qty    -    amount of fields to be entered
  807.   unsigned char i,retkey;
  808.   char selatr = ACTIVE_ATTR,norm,*mkname;
  809.      norm = w[0]->wndatr;
  810.     selectwindow(w[0]);
  811.    /*---------------------------------------------------------------------------*/
  812.    /*     filling the form                             */
  813.     i = 0;
  814.     do  {
  815.       w[i]->wndatr = selatr;
  816.       selectwindow(w[i]);
  817.       prthz(0,0,"",w[i]->wndatr,items[atrnum[i]].width);
  818.       retkey = getfield(w[i],items[atrnum[i]].content,items[atrnum[i]].width);
  819.           if ((retkey == F1_PRESSED)) {
  820.           disphelp(items,atrnum,i,0);
  821.           }
  822.       if ( (type == search) && (i == (qty - 1)) )
  823.         break;
  824.    /*-----------------------------------------------------------------------*/
  825.       if (( retkey == TAB_PRESSED ) || (retkey == 1) || (retkey == F10_PRESSED)) {
  826.           w[i]->wndatr = norm;
  827.           prthz(0,0," ",norm,w[i]->xw-2);
  828.           putstratr(0,0,items[atrnum[i]].content,norm,items[atrnum[i]].width);
  829.           if (i == (qty - 1)) i = 0;
  830.           else i++;
  831.       }
  832.     } while (retkey != F10_PRESSED);
  833.  /*-----------------------------------------------------------------------*/
  834.  /*                 checking the entered values                  */
  835.  if (type  == store) {
  836.    for (i = 0;i < qty;i++)  {
  837.     while ((items[atrnum[i]].status == compulsory)
  838.         && (!strcmp(items[atrnum[i]].content,"")))  {
  839.       disphelp(items,atrnum,i,1);
  840.       repeat(items,atrnum,i,w);
  841.     while ((strcmp(items[atrnum[i]].content,"")) &&
  842.         ((items[atrnum[i]].value == digital)||(items[atrnum[i]].value == digchk))
  843.         && (num_str(items[atrnum[i]].content) == 0)) {
  844.       disphelp(items,atrnum,i,2);
  845.       repeat(items,atrnum,i,w);
  846.       do {
  847.       if (items[atrnum[i]].value != digchk)
  848.         break;
  849.       if (strcmp(items[atrnum[i]].codname,"fot_numb") == 0) {
  850.         if (chknumb(items[atrnum[i]].content,items[0].content))
  851.           break;
  852.        }
  853.          if (!(strcmp(items[atrnum[i]].content,""))
  854.            && ((strcmp(items[atrnum[i]].codname,"fot_type") == 0)))
  855.              if ((items[atrnum[i]].content[1] == '1') ||(items[atrnum[i]].content[1] == '2')
  856.               ||(items[atrnum[i]].content[1] == '3') ||(items[atrnum[i]].content[1] == '4'))
  857.                break;
  858.       disphelp(items,atrnum,i,3);
  859.       repeat(items,atrnum,i,w);
  860.     } while (1);
  861.     do {
  862.       if (items[atrnum[i]].value != strchk)
  863.         break;
  864.        if (strcmp(items[atrnum[i]].codname,"fot_name") == 0) {
  865.         if (!chkname(items[atrnum[i]].content))
  866.           break;
  867.           }
  868.           if (strcmp(items[atrnum[i]].codname,"cl2_full") == 0) {
  869.             if (chkclass(items[atrnum[i]].content))
  870.                break;
  871.           }
  872.       disphelp(items,atrnum,i,4);
  873.       repeat(items,atrnum,i,w);
  874.     } while (1);
  875. #include <stdio.h>
  876. #include <stdlib.h>
  877. #include <io.h>
  878. #include <fcntl.h>
  879. #include <dos.h>
  880. #include <alloc.h>
  881. #include <string.h>
  882. #include <mem.h>
  883. #include <ctype.h>
  884. #include <stdio.h>
  885. #include <stdlib.h>
  886. #include <io.h>
  887. #include <fcntl.h>
  888. #include <dos.h>
  889. #include <alloc.h>
  890. #include <string.h>
  891. #include <mem.h>
  892. #include <ctype.h>
  893.         rep->Get_DC(c);
  894.         HDC hMemDC = CreateCompatibleDC(rep->hDC);
  895.         SelectObject(hMemDC, (HBITMAP)d->Map());
  896.         HDC hMemDC1 = CreateCompatibleDC(rep->hDC);
  897.         SelectObject(hMemDC1, (HBITMAP)m->Map());
  898.         BitBlt(
  899.         hMemDC, 0, 0, m->Width(), m->Height(), hMemDC1, 0, 0, SRCAND
  900.         );
  901.         BitBlt(
  902.         rep->hDC, dx, dy, d->Width(), d->Height(), hMemDC, 0, 0, SRCAND
  903.         );
  904.         DeleteDC(hMemDC1);
  905.         DeleteDC(hMemDC);
  906.         rep->Release_DC(c);
  907.         HDC hDC = GetDC((HWND)src->id);
  908.         HDC hMemDC = CreateCompatibleDC(hDC);
  909.         HBITMAP hBitmap = CreateCompatibleBitmap(hDC, w, h);
  910.         SelectObject(hMemDC, hBitmap);
  911.         BitBlt(hMemDC, 0, 0, w, h, hDC, sx, sy, SRCCOPY);
  912.         ReleaseDC((HWND)src->id, hDC);
  913.         hDC = GetDC((HWND)dst->id);
  914.         BitBlt(hDC, dx, dy, w, h, hMemDC, 0, 0, SRCCOPY);
  915.         ReleaseDC((HWND)dst->id, hDC);
  916.         DeleteDC(hMemDC);
  917.         DeleteObject(hBitmap);
  918. black                0   0   0
  919. DarkSlateGray       47  79  79
  920. DarkSlateGrey       47  79  79
  921. DimGray            105 105 105
  922. DimGrey            105 105 105
  923. SlateGray          112 128 144
  924. SlateGrey          112 128 144
  925. LightSlateGray     119 136 153
  926. LightSlateGrey     119 136 153
  927. gray               192 192 192
  928. grey               192 192 192
  929. "d:\\borlandc\\iv\\temp"
  930.