home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / sun / volume1 / contool2.2 / part02 / default.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-26  |  3.6 KB  |  95 lines

  1. /************************************************************************/
  2. /*    Copyright 1988, 1989 by Chuck Musciano and Harris Corporation    */
  3. /*                                    */
  4. /*    Permission to use, copy, modify, and distribute this software    */
  5. /*    and its documentation for any purpose and without fee is    */
  6. /*    hereby granted, provided that the above copyright notice    */
  7. /*    appear in all copies and that both that copyright notice and    */
  8. /*    this permission notice appear in supporting documentation, and    */
  9. /*    that the name of Chuck Musciano and Harris Corporation not be    */
  10. /*    used in advertising or publicity pertaining to distribution    */
  11. /*    of the software without specific, written prior permission.    */
  12. /*    Chuck Musciano and Harris Corporation make no representations    */
  13. /*    about the suitability of this software for any purpose.  It is    */
  14. /*    provided "as is" without express or implied warranty.  This     */
  15. /*    software may not be sold without the prior explicit permission    */
  16. /*    of Harris Corporation.                        */
  17. /************************************************************************/
  18.  
  19. #include    <stdio.h>
  20.  
  21. #include    <suntool/sunview.h>
  22. #include    <suntool/panel.h>
  23. #include    <suntool/scrollbar.h>
  24.  
  25. #include    "contool.h"
  26. #include    "entry.h"
  27.  
  28. #define        shift(item, amt)        panel_set(item, PANEL_ITEM_X, (int) panel_get(item, PANEL_ITEM_X) + amt, 0)
  29.  
  30. PUBLIC    Panel    other;
  31.  
  32. PRIVATE    e_rec    defaults = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, FALSE};
  33.  
  34. /************************************************************************/
  35. EXPORT    update_defaults()
  36.  
  37. {    int    x, y, amt;
  38.     Pixrect    *image;
  39.     Scrollbar    temp;
  40.  
  41.     if (!defaults.created) {
  42.        create_entry(other, &defaults, 0);
  43.        panel_set(other, WIN_VERTICAL_SCROLLBAR, temp = scrollbar_create(0), 0);
  44.        if ((Scrollbar_setting) scrollbar_get(temp, SCROLL_PLACEMENT) == SCROLL_WEST) {
  45.           amt = (int) scrollbar_get(temp, SCROLL_WIDTH);
  46.           shift(defaults.handle, amt);
  47.           shift(defaults.save, amt);
  48.           shift(defaults.stamp, amt);
  49.           shift(defaults.open, amt);
  50.           shift(defaults.flash, amt);
  51.           shift(defaults.beep, amt);
  52.           shift(defaults.lines, amt);
  53.           shift(defaults.start, amt);
  54.           shift(defaults.end, amt);
  55.           }
  56.        panel_set(other, WIN_VERTICAL_SCROLLBAR, NULL, 0);
  57.        scrollbar_destroy(temp);
  58.        eliminate(defaults.handle);
  59.        eliminate(defaults.lines);
  60.        eliminate(defaults.end);
  61.        x = (int) panel_get(defaults.save, PANEL_ITEM_X);
  62.        y = (int) panel_get(defaults.save, PANEL_ITEM_Y);
  63.        eliminate(defaults.save);
  64.        defaults.save = panel_create_item(other, PANEL_MESSAGE,
  65.                             PANEL_LABEL_IMAGE, &save_pix,
  66.                             PANEL_ITEM_X, x,
  67.                             PANEL_ITEM_Y, y,
  68.                              0);
  69.        x = (int) panel_get(defaults.start, PANEL_ITEM_X);
  70.        y = (int) panel_get(defaults.start, PANEL_ITEM_Y);
  71.        eliminate(defaults.start);
  72.        defaults.start = panel_create_item(other, PANEL_MESSAGE,
  73.                             PANEL_LABEL_STRING, "All other messages",
  74.                             PANEL_LABEL_FONT, bold,
  75.                             PANEL_ITEM_X, x,
  76.                             PANEL_ITEM_Y, y,
  77.                              0);
  78.        defaults.created = TRUE;
  79.        }
  80.     panel_set(defaults.beep, PANEL_VALUE, beep_amount, 0);
  81.     panel_set(defaults.flash, PANEL_VALUE, blink_icon, 0);
  82.     panel_set(defaults.open, PANEL_VALUE, pop_open, 0);
  83.     panel_set(defaults.stamp, PANEL_VALUE, do_time_stamp, 0);
  84. }
  85.  
  86. /************************************************************************/
  87. EXPORT    install_defaults()
  88.  
  89. {
  90.     beep_amount   = (int) panel_get(defaults.beep, PANEL_VALUE);
  91.     blink_icon    = (int) panel_get(defaults.flash, PANEL_VALUE);
  92.     pop_open      = (int) panel_get(defaults.open, PANEL_VALUE);
  93.     do_time_stamp = (int) panel_get(defaults.stamp, PANEL_VALUE);
  94. }
  95.