home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / xaes_new / sliders.c < prev    next >
C/C++ Source or Header  |  1994-12-06  |  20KB  |  519 lines

  1. /********************************************************************
  2.  *                                                                1.00*
  3.  *    XAES: Sliders (active redraw)                                    *
  4.  *    Code by Tom Hudson                                                *
  5.  *    Greatly optimized and updated by Ken Hollis                        *
  6.  *                                                                    *
  7.  *    Copyright (c) 1994, Bitgate Software.  All Rights Reserved.        *
  8.  *                                                                    *
  9.  *    Active dragging sliders that have a personality all their own.    *
  10.  *    It's unfortunately got a strange bug in the slider track click,    *
  11.  *    but this will change soon.                                        *
  12.  *                                                                    *
  13.  ********************************************************************/
  14.  
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include "xaes.h"
  18.  
  19. LOCAL int mousex, mousey, dum, moved;
  20. LOCAL int tbasex, tbasey, sbasex, sbasey;
  21.  
  22. GLOBAL void WUpdateWindowDlgLevel(WINDOW *win, int x, int y, int w, int h, int obj, int level)
  23. {
  24.     if (win->tree) {
  25.         GRECT own, temp;
  26.         int top;
  27.  
  28.         own.g_x = x;
  29.         own.g_y = y;
  30.         own.g_w = w;
  31.         own.g_h = h;
  32.  
  33.         WWindGet(win, WF_TOP, &top);
  34.  
  35.         if (win->handle != top) {
  36.             wind_update(BEG_UPDATE);
  37.             wind_update(BEG_MCTRL);
  38.  
  39.             WWindGet(win, WF_FIRSTXYWH, &temp.g_x, &temp.g_y, &temp.g_w, &temp.g_h);
  40.             while (temp.g_w && temp.g_h) {
  41.                 if (rc_intersect(&temp, &own))
  42.                     objc_draw(win->tree, obj, level, temp.g_x, temp.g_y, temp.g_w, temp.g_h);
  43.  
  44.                 WWindGet(win, WF_NEXTXYWH, &temp.g_x, &temp.g_y, &temp.g_w, &temp.g_h);
  45.             }
  46.  
  47.             wind_update(END_MCTRL);
  48.             wind_update(END_UPDATE);
  49.         } else
  50.             objc_draw(win->tree, obj, level, x, y, w, h); 
  51.     }
  52. }
  53.  
  54. GLOBAL void WHandleSlider(WINDOW *win, int object)
  55. {
  56.     register int ix;
  57.     int tempx, tempy, temp, xx, yy, deltaw, deltah, origx, origy;
  58.     int lastpos;
  59.     BOOL moved;
  60.     GRECT work;
  61.  
  62.     if (win)
  63.         if ((win->tree[object].ob_type & 0xFF) == G_USERDEF) {
  64.             EXTINFO *ex = (EXTINFO *)(win->tree[object].ob_spec.userblk->ub_parm);
  65.             SLIDER slider = ex->te_slider;
  66.  
  67.             WWindGet(win, WF_WORKXYWH, &work.g_x, &work.g_y, &work.g_w, &work.g_h);
  68.             moved = FALSE;
  69.  
  70.             if (ex->te_slider.slide_type == SLIDER_HOR) {
  71.                 temp = lastpos = ex->te_slider.slide_pos;
  72.                 graf_mkstate(&mousex,&mousey,&dum,&dum);
  73.  
  74.                 objc_offset(win->tree,ex->te_slider.slide_track,&xx,&yy);
  75.                 objc_offset(win->tree,ex->te_slider.slide_slider,&origx,&origy);
  76.  
  77.                 if(object == ex->te_slider.slide_track) {
  78.                     objc_offset(win->tree,ex->te_slider.slide_slider,&sbasex,&dum);
  79.  
  80.                     if(mousex > sbasex)
  81.                         for(ix = 0; ix < ex->te_slider.slide_tstep; ++ix)
  82.                             if(ex->te_slider.slide_pos < ex->te_slider.slide_max) {
  83.                                 ex->te_slider.slide_acc += ex->te_slider.slide_step;
  84.                                 ex->te_slider.slide_pos++;
  85.                                 moved = TRUE;
  86.                             } else
  87.                                 break;
  88.                     else for(ix = 0; ix < ex->te_slider.slide_tstep; ++ix)
  89.                         if(ex->te_slider.slide_pos > 0) {
  90.                             ex->te_slider.slide_acc -= ex->te_slider.slide_step;
  91.                             ex->te_slider.slide_pos--;
  92.                             moved = TRUE;
  93.                         } else
  94.                             break;
  95.                 }
  96.  
  97.                 if(object == ex->te_slider.slide_increase)
  98.                     if(ex->te_slider.slide_pos < ex->te_slider.slide_max) {
  99.                         ex->te_slider.slide_acc += ex->te_slider.slide_step;
  100.                         ex->te_slider.slide_pos++;
  101.                         moved = TRUE;
  102.                     }
  103.  
  104.                 if(object == ex->te_slider.slide_decrease)
  105.                     if(ex->te_slider.slide_pos > 0) {
  106.                         ex->te_slider.slide_acc -= ex->te_slider.slide_step;
  107.                         ex->te_slider.slide_pos--;
  108.                         moved = TRUE;
  109.                     }
  110.                 
  111.                 if(object == ex->te_slider.slide_slider) {
  112.                     objc_offset(win->tree,ex->te_slider.slide_slider,&sbasex,&sbasey);
  113.                     objc_offset(win->tree,ex->te_slider.slide_track,&tbasex,&tbasey);
  114.  
  115.                     tempx = (mousex-((win->tree[ex->te_slider.slide_slider].ob_width)/2)+3);
  116.  
  117.                     if(tempx!=sbasex) {
  118.                         ex->te_slider.slide_acc = (long)(tempx-tbasex)<<16;
  119.                         ex->te_slider.slide_pos = (int)(ex->te_slider.slide_acc / ex->te_slider.slide_step);
  120.                         ex->te_slider.slide_acc = (long)ex->te_slider.slide_pos * ex->te_slider.slide_step;
  121.                         moved = TRUE;
  122.                     }
  123.                 }
  124.  
  125.                 if(moved) {
  126.                     if (ex->te_slider.slide_acc < 0)
  127.                         ex->te_slider.slide_acc = ex->te_slider.slide_pos = 0;
  128.  
  129.                     win->tree[ex->te_slider.slide_slider].ob_x = (int)(ex->te_slider.slide_acc >> 16);
  130.  
  131.                     if ((win->tree[ex->te_slider.slide_slider].ob_x + win->tree[ex->te_slider.slide_slider].ob_width) > win->tree[ex->te_slider.slide_track].ob_width) {
  132.                         win->tree[ex->te_slider.slide_slider].ob_x = (win->tree[ex->te_slider.slide_track].ob_width - win->tree[ex->te_slider.slide_slider].ob_width);
  133.                         ex->te_slider.slide_pos = (int)ex->te_slider.slide_max;
  134.                         ex->te_slider.slide_acc = (long)(win->tree[ex->te_slider.slide_track].ob_width - win->tree[ex->te_slider.slide_slider].ob_width) << 16;
  135.                     }
  136.  
  137.                     if (ex->te_slider.slide_pos < 0)
  138.                         ex->te_slider.slide_pos = 0;
  139.  
  140.                     if (ex->te_slider.slide_pos > ex->te_slider.slide_max)
  141.                         ex->te_slider.slide_pos = ex->te_slider.slide_max;
  142.  
  143.                     if (temp != ex->te_slider.slide_pos) {
  144.                         int newx,newy;
  145.  
  146.                         objc_offset(win->tree,ex->te_slider.slide_slider,&newx,&newy);
  147.  
  148.                         if (origx>newx)
  149.                             deltaw = (origx + win->tree[ex->te_slider.slide_slider].ob_width) - (newx + win->tree[ex->te_slider.slide_slider].ob_width);
  150.                         else
  151.                             deltaw = -((origx + win->tree[ex->te_slider.slide_slider].ob_width) - (newx + win->tree[ex->te_slider.slide_slider].ob_width));
  152.  
  153.                         if (deltaw != 0)
  154.                             WUpdateWindowDlgLevel(win, (origx > newx) ? newx - 1 : origx - 1, yy,
  155.                             (deltaw + win->tree[ex->te_slider.slide_slider].ob_width) + 2, win->tree[ex->te_slider.slide_track].ob_height,
  156.                             ex->te_slider.slide_track, 2);
  157.                     }
  158.                 }
  159.  
  160.                 slider = ex->te_slider;
  161.  
  162.                 if ((deltaw == 0) & (temp != slider.slide_pos))
  163.                     WUpdateWindowDlgLevel(win, desk.g_x, desk.g_y, desk.g_w, desk.g_h, ex->te_slider.slide_slider, 1);
  164.  
  165.                 ex = (EXTINFO *)(win->tree[slider.slide_increase].ob_spec.userblk->ub_parm);
  166.                 ex->te_slider = slider;
  167.                 ex = (EXTINFO *)(win->tree[slider.slide_decrease].ob_spec.userblk->ub_parm);
  168.                 ex->te_slider = slider;
  169.                 ex = (EXTINFO *)(win->tree[slider.slide_slider].ob_spec.userblk->ub_parm);
  170.                 ex->te_slider = slider;
  171.                 ex = (EXTINFO *)(win->tree[slider.slide_track].ob_spec.userblk->ub_parm);
  172.                 ex->te_slider = slider;
  173.  
  174.                 WCallSliderDispatcher(win, object, ex->te_slider.slide_pos, lastpos);
  175.             }
  176.  
  177.             if (ex->te_slider.slide_type == SLIDER_VER) {
  178.                 temp = lastpos = ex->te_slider.slide_pos;
  179.                 graf_mkstate(&mousex,&mousey,&dum,&dum);
  180.  
  181.                 objc_offset(win->tree,ex->te_slider.slide_track,&xx,&yy);
  182.                 objc_offset(win->tree,ex->te_slider.slide_slider,&origx,&origy);
  183.  
  184.                 if(object == ex->te_slider.slide_track) {
  185.                     objc_offset(win->tree,ex->te_slider.slide_slider,&dum,&sbasey);
  186.  
  187.                     if(mousey > sbasey)
  188.                         for(ix = 0; ix < ex->te_slider.slide_tstep; ++ix)
  189.                             if(ex->te_slider.slide_pos < ex->te_slider.slide_max) {
  190.                                 ex->te_slider.slide_acc += ex->te_slider.slide_step;
  191.                                 ex->te_slider.slide_pos++;
  192.                                 moved = TRUE;
  193.                             } else
  194.                                 break;
  195.                     else for(ix = 0; ix < ex->te_slider.slide_tstep; ++ix)
  196.                         if(ex->te_slider.slide_pos > 0) {
  197.                             ex->te_slider.slide_acc -= ex->te_slider.slide_step;
  198.                             ex->te_slider.slide_pos--;
  199.                             moved = TRUE;
  200.                         } else
  201.                             break;
  202.                 }
  203.  
  204.                 if(object == ex->te_slider.slide_increase)
  205.                     if(ex->te_slider.slide_pos < ex->te_slider.slide_max) {
  206.                         ex->te_slider.slide_acc += ex->te_slider.slide_step;
  207.                         ex->te_slider.slide_pos++;
  208.                         moved = TRUE;
  209.                     }
  210.  
  211.                 if(object == ex->te_slider.slide_decrease)
  212.                     if(ex->te_slider.slide_pos > 0) {
  213.                         ex->te_slider.slide_acc -= ex->te_slider.slide_step;
  214.                         ex->te_slider.slide_pos--;
  215.                         moved = TRUE;
  216.                     }
  217.  
  218.                 if(object == ex->te_slider.slide_slider) {
  219.                     objc_offset(win->tree,ex->te_slider.slide_slider,&sbasex,&sbasey);
  220.                     objc_offset(win->tree,ex->te_slider.slide_track,&tbasex,&tbasey);
  221.  
  222.                     tempy = (mousey - ((win->tree[ex->te_slider.slide_slider].ob_height)/2)+1);
  223.  
  224.                     if(tempy!=sbasey) {
  225.                         ex->te_slider.slide_acc = (long)(tempy-tbasey)<<16;
  226.                         ex->te_slider.slide_pos = (int)(ex->te_slider.slide_acc / ex->te_slider.slide_step);
  227.                         ex->te_slider.slide_acc = (long)ex->te_slider.slide_pos * ex->te_slider.slide_step;
  228.                         moved = TRUE;
  229.                     }
  230.                 }
  231.  
  232.                 if(moved) {
  233.                     if (ex->te_slider.slide_acc < 0) {
  234.                         ex->te_slider.slide_acc = win->tree[ex->te_slider.slide_slider].ob_y << 16;
  235.                         ex->te_slider.slide_pos = 0;
  236.                     }
  237.  
  238.                     win->tree[ex->te_slider.slide_slider].ob_y = (int)(ex->te_slider.slide_acc >> 16);
  239.  
  240.                     if ((win->tree[ex->te_slider.slide_slider].ob_y + win->tree[ex->te_slider.slide_slider].ob_height) > win->tree[ex->te_slider.slide_track].ob_height) {
  241.                         win->tree[ex->te_slider.slide_slider].ob_y = (win->tree[ex->te_slider.slide_track].ob_height - win->tree[ex->te_slider.slide_slider].ob_height);
  242.                         ex->te_slider.slide_pos = (int)ex->te_slider.slide_max;
  243.                         ex->te_slider.slide_acc = (long)(win->tree[ex->te_slider.slide_track].ob_height - win->tree[ex->te_slider.slide_slider].ob_height) << 16;
  244.                     }
  245.  
  246.                     if (ex->te_slider.slide_pos < 0)
  247.                         ex->te_slider.slide_pos = 0;
  248.  
  249.                     if (ex->te_slider.slide_pos > ex->te_slider.slide_max)
  250.                         ex->te_slider.slide_pos = ex->te_slider.slide_max;
  251.  
  252.                     if (temp != ex->te_slider.slide_pos) {
  253.                         int newx,newy;
  254.  
  255.                         objc_offset(win->tree,ex->te_slider.slide_slider,&newx,&newy);
  256.  
  257.                         if (origy>newy)
  258.                             deltah = (origy + win->tree[ex->te_slider.slide_slider].ob_height) - (newy + win->tree[ex->te_slider.slide_slider].ob_height);
  259.                         else
  260.                             deltah = -((origy + win->tree[ex->te_slider.slide_slider].ob_height) - (newy + win->tree[ex->te_slider.slide_slider].ob_height));
  261.  
  262.                         if (deltah != 0)
  263.                             WUpdateWindowDlgLevel(win, xx, (origy>newy) ? newy - 1 : origy - 1,
  264.                                 win->tree[ex->te_slider.slide_slider].ob_width, (deltah + win->tree[ex->te_slider.slide_slider].ob_height) + 2,
  265.                                 ex->te_slider.slide_track, 2);
  266.                     }
  267.                 }
  268.  
  269.                 slider = ex->te_slider;
  270.  
  271.                 if ((deltah == 0) && (temp != slider.slide_pos))
  272.                     WUpdateWindowDlgLevel(win, desk.g_x, desk.g_y, desk.g_w, desk.g_h, ex->te_slider.slide_slider, 1);
  273.  
  274.                 ex = (EXTINFO *)(win->tree[slider.slide_increase].ob_spec.userblk->ub_parm);
  275.                 ex->te_slider = slider;
  276.                 ex = (EXTINFO *)(win->tree[slider.slide_decrease].ob_spec.userblk->ub_parm);
  277.                 ex->te_slider = slider;
  278.                 ex = (EXTINFO *)(win->tree[slider.slide_slider].ob_spec.userblk->ub_parm);
  279.                 ex->te_slider = slider;
  280.                 ex = (EXTINFO *)(win->tree[slider.slide_track].ob_spec.userblk->ub_parm);
  281.                 ex->te_slider = slider;
  282.  
  283.                 WCallSliderDispatcher(win, object, ex->te_slider.slide_pos, lastpos);
  284.             }
  285.         }
  286. }
  287.  
  288. GLOBAL void WHandleSlider_Window(WINDOW *win, int object)
  289. {
  290.     register int ix;
  291.     int tempx, tempy, temp, xx, yy, deltaw, deltah, origx, origy;
  292.     int lastpos;
  293.     GRECT work;
  294.  
  295.     if (win)
  296.         if ((win->wind[object].ob_type & 0xFF) == G_USERDEF) {
  297.             EXTINFO *ex = (EXTINFO *)(win->wind[object].ob_spec.userblk->ub_parm);
  298.             SLIDER slider;
  299.  
  300.             WWindGet(win, WF_WORKXYWH, &work.g_x, &work.g_y, &work.g_w, &work.g_h);
  301.             moved = FALSE;
  302.  
  303.             if (ex->te_slider.slide_type == SLIDER_HOR) {
  304.                 temp = lastpos = ex->te_slider.slide_pos;
  305.                 graf_mkstate(&mousex,&mousey,&dum,&dum);
  306.  
  307.                 objc_offset(win->wind,ex->te_slider.slide_track,&xx,&yy);
  308.                 objc_offset(win->wind,ex->te_slider.slide_slider,&origx,&origy);
  309.  
  310.                 if(object == ex->te_slider.slide_track) {
  311.                     objc_offset(win->wind,ex->te_slider.slide_slider,&sbasex,&dum);
  312.  
  313.                     if(mousex > sbasex)
  314.                         for(ix = 0; ix < ex->te_slider.slide_tstep; ++ix)
  315.                             if(ex->te_slider.slide_pos < ex->te_slider.slide_max) {
  316.                                 ex->te_slider.slide_acc += ex->te_slider.slide_step;
  317.                                 ex->te_slider.slide_pos++;
  318.                                 moved = TRUE;
  319.                             } else
  320.                                 break;
  321.                     else for(ix = 0; ix < ex->te_slider.slide_tstep; ++ix)
  322.                         if(ex->te_slider.slide_pos > 0) {
  323.                             ex->te_slider.slide_acc -= ex->te_slider.slide_step;
  324.                             ex->te_slider.slide_pos--;
  325.                             moved = TRUE;
  326.                         } else
  327.                             break;
  328.                 }
  329.  
  330.                 if(object == ex->te_slider.slide_increase)
  331.                     if(ex->te_slider.slide_pos < ex->te_slider.slide_max) {
  332.                         ex->te_slider.slide_acc += ex->te_slider.slide_step;
  333.                         ex->te_slider.slide_pos++;
  334.                         moved = TRUE;
  335.                     }
  336.  
  337.                 if(object == ex->te_slider.slide_decrease)
  338.                     if(ex->te_slider.slide_pos > 0) {
  339.                         ex->te_slider.slide_acc -= ex->te_slider.slide_step;
  340.                         ex->te_slider.slide_pos--;
  341.                         moved = TRUE;
  342.                     }
  343.                 
  344.                 if(object == ex->te_slider.slide_slider) {
  345.                     objc_offset(win->wind,ex->te_slider.slide_slider,&sbasex,&sbasey);
  346.                     objc_offset(win->wind,ex->te_slider.slide_track,&tbasex,&tbasey);
  347.  
  348.                     tempx = (mousex-((win->wind[ex->te_slider.slide_slider].ob_width)/2)+3);
  349.  
  350.                     if(tempx!=sbasex) {
  351.                         ex->te_slider.slide_acc = (long)(tempx-tbasex)<<16;
  352.                         ex->te_slider.slide_pos = (int)(ex->te_slider.slide_acc / ex->te_slider.slide_step);
  353.                         ex->te_slider.slide_acc = (long)ex->te_slider.slide_pos * ex->te_slider.slide_step;
  354.                         moved = TRUE;
  355.                     }
  356.                 }
  357.  
  358.                 if(moved) {
  359.                     if (ex->te_slider.slide_acc < 0)
  360.                         ex->te_slider.slide_acc = ex->te_slider.slide_pos = 0;
  361.  
  362.                     win->wind[ex->te_slider.slide_slider].ob_x = (int)(ex->te_slider.slide_acc >> 16);
  363.  
  364.                     if ((win->wind[ex->te_slider.slide_slider].ob_x + win->wind[ex->te_slider.slide_slider].ob_width) > win->wind[ex->te_slider.slide_track].ob_width) {
  365.                         win->wind[ex->te_slider.slide_slider].ob_x = (win->wind[ex->te_slider.slide_track].ob_width - win->wind[ex->te_slider.slide_slider].ob_width);
  366.                         ex->te_slider.slide_pos = (int)ex->te_slider.slide_max;
  367.                         ex->te_slider.slide_acc = (long)(win->wind[ex->te_slider.slide_track].ob_width - win->wind[ex->te_slider.slide_slider].ob_width) << 16;
  368.                     }
  369.  
  370.                     if (ex->te_slider.slide_pos < 0)
  371.                         ex->te_slider.slide_pos = 0;
  372.  
  373.                     if (ex->te_slider.slide_pos > ex->te_slider.slide_max)
  374.                         ex->te_slider.slide_pos = ex->te_slider.slide_max;
  375.  
  376.                     if (temp != ex->te_slider.slide_pos) {
  377.                         int newx,newy;
  378.  
  379.                         objc_offset(win->wind,ex->te_slider.slide_slider,&newx,&newy);
  380.  
  381.                         if (origx>newx)
  382.                             deltaw = (origx + win->wind[ex->te_slider.slide_slider].ob_width) - (newx + win->wind[ex->te_slider.slide_slider].ob_width);
  383.                         else
  384.                             deltaw = -((origx + win->wind[ex->te_slider.slide_slider].ob_width) - (newx + win->wind[ex->te_slider.slide_slider].ob_width));
  385.  
  386.                         if (deltaw != 0)
  387.                             WUpdateWindowDlgLevel(win, (origx > newx) ? newx - 1 : origx - 1, yy,
  388.                             (deltaw + win->wind[ex->te_slider.slide_slider].ob_width) + 2, win->wind[ex->te_slider.slide_track].ob_height,
  389.                             ex->te_slider.slide_track, 2);
  390.                     }
  391.                 }
  392.  
  393.                 slider = ex->te_slider;
  394.  
  395.                 if ((deltaw == 0) & (temp != slider.slide_pos))
  396.                     WUpdateWindowDlgLevel(win, desk.g_x, desk.g_y, desk.g_w, desk.g_h, ex->te_slider.slide_slider, 1);
  397.  
  398.                 ex = (EXTINFO *)(win->wind[slider.slide_increase].ob_spec.userblk->ub_parm);
  399.                 ex->te_slider = slider;
  400.                 ex = (EXTINFO *)(win->wind[slider.slide_decrease].ob_spec.userblk->ub_parm);
  401.                 ex->te_slider = slider;
  402.                 ex = (EXTINFO *)(win->wind[slider.slide_slider].ob_spec.userblk->ub_parm);
  403.                 ex->te_slider = slider;
  404.                 ex = (EXTINFO *)(win->wind[slider.slide_track].ob_spec.userblk->ub_parm);
  405.                 ex->te_slider = slider;
  406.  
  407.                 WCallSliderDispatcher(win, object, ex->te_slider.slide_pos, lastpos);
  408.             }
  409.  
  410.             if (ex->te_slider.slide_type == SLIDER_VER) {
  411.                 temp = lastpos  = ex->te_slider.slide_pos;
  412.                 graf_mkstate(&mousex,&mousey,&dum,&dum);
  413.  
  414.                 objc_offset(win->wind,ex->te_slider.slide_track,&xx,&yy);
  415.                 objc_offset(win->wind,ex->te_slider.slide_slider,&origx,&origy);
  416.  
  417.                 if(object == ex->te_slider.slide_track) {
  418.                     objc_offset(win->wind,ex->te_slider.slide_slider,&dum,&sbasey);
  419.  
  420.                     if(mousey > sbasey)
  421.                         for(ix = 0; ix < ex->te_slider.slide_tstep; ++ix)
  422.                             if(ex->te_slider.slide_pos < ex->te_slider.slide_max) {
  423.                                 ex->te_slider.slide_acc += ex->te_slider.slide_step;
  424.                                 ex->te_slider.slide_pos++;
  425.                                 moved = TRUE;
  426.                             } else
  427.                                 break;
  428.                     else for(ix = 0; ix < ex->te_slider.slide_tstep; ++ix)
  429.                         if(ex->te_slider.slide_pos > 0) {
  430.                             ex->te_slider.slide_acc -= ex->te_slider.slide_step;
  431.                             ex->te_slider.slide_pos--;
  432.                             moved = TRUE;
  433.                         } else
  434.                             break;
  435.                 }
  436.  
  437.                 if(object == ex->te_slider.slide_increase)
  438.                     if(ex->te_slider.slide_pos < ex->te_slider.slide_max) {
  439.                         ex->te_slider.slide_acc += ex->te_slider.slide_step;
  440.                         ex->te_slider.slide_pos++;
  441.                         moved = TRUE;
  442.                     }
  443.  
  444.                 if(object == ex->te_slider.slide_decrease)
  445.                     if(ex->te_slider.slide_pos > 0) {
  446.                         ex->te_slider.slide_acc -= ex->te_slider.slide_step;
  447.                         ex->te_slider.slide_pos--;
  448.                         moved = TRUE;
  449.                     }
  450.  
  451.                 if(object == ex->te_slider.slide_slider) {
  452.                     objc_offset(win->wind,ex->te_slider.slide_slider,&sbasex,&sbasey);
  453.                     objc_offset(win->wind,ex->te_slider.slide_track,&tbasex,&tbasey);
  454.  
  455.                     tempy = (mousey - ((win->wind[ex->te_slider.slide_slider].ob_height)/2)+1);
  456.  
  457.                     if(tempy!=sbasey) {
  458.                         ex->te_slider.slide_acc = (long)(tempy-tbasey)<<16;
  459.                         ex->te_slider.slide_pos = (int)(ex->te_slider.slide_acc / ex->te_slider.slide_step);
  460.                         ex->te_slider.slide_acc = (long)ex->te_slider.slide_pos * ex->te_slider.slide_step;
  461.                         moved = TRUE;
  462.                     }
  463.                 }
  464.  
  465.                 if(moved) {
  466.                     if (ex->te_slider.slide_acc < 0) {
  467.                         ex->te_slider.slide_acc = win->wind[ex->te_slider.slide_slider].ob_y << 16;
  468.                         ex->te_slider.slide_pos = 0;
  469.                     }
  470.  
  471.                     win->wind[ex->te_slider.slide_slider].ob_y = (int)(ex->te_slider.slide_acc >> 16);
  472.  
  473.                     if ((win->wind[ex->te_slider.slide_slider].ob_y + win->wind[ex->te_slider.slide_slider].ob_height) > win->wind[ex->te_slider.slide_track].ob_height) {
  474.                         win->wind[ex->te_slider.slide_slider].ob_y = (win->wind[ex->te_slider.slide_track].ob_height - win->wind[ex->te_slider.slide_slider].ob_height);
  475.                         ex->te_slider.slide_pos = (int)ex->te_slider.slide_max;
  476.                         ex->te_slider.slide_acc = (long)(win->wind[ex->te_slider.slide_track].ob_height - win->wind[ex->te_slider.slide_slider].ob_height) << 16;
  477.                     }
  478.  
  479.                     if (ex->te_slider.slide_pos < 0)
  480.                         ex->te_slider.slide_pos = 0;
  481.  
  482.                     if (ex->te_slider.slide_pos > ex->te_slider.slide_max)
  483.                         ex->te_slider.slide_pos = ex->te_slider.slide_max;
  484.  
  485.                     if (temp != ex->te_slider.slide_pos) {
  486.                         int newx,newy;
  487.  
  488.                         objc_offset(win->wind,ex->te_slider.slide_slider,&newx,&newy);
  489.  
  490.                         if (origy>newy)
  491.                             deltah = (origy + win->wind[ex->te_slider.slide_slider].ob_height) - (newy + win->wind[ex->te_slider.slide_slider].ob_height);
  492.                         else
  493.                             deltah = -((origy + win->wind[ex->te_slider.slide_slider].ob_height) - (newy + win->wind[ex->te_slider.slide_slider].ob_height));
  494.  
  495.                         if (deltah != 0)
  496.                             WUpdateWindowDlgLevel(win, xx, (origy>newy) ? newy - 1 : origy - 1,
  497.                                 win->wind[ex->te_slider.slide_slider].ob_width, (deltah + win->wind[ex->te_slider.slide_slider].ob_height) + 2,
  498.                                 ex->te_slider.slide_track, 2);
  499.                     }
  500.                 }
  501.  
  502.                 slider = ex->te_slider;
  503.  
  504.                 if ((deltah == 0) && (temp != slider.slide_pos))
  505.                     WUpdateWindowDlgLevel(win, desk.g_x, desk.g_y, desk.g_w, desk.g_h, ex->te_slider.slide_slider, 1);
  506.  
  507.                 ex = (EXTINFO *)(win->wind[slider.slide_increase].ob_spec.userblk->ub_parm);
  508.                 ex->te_slider = slider;
  509.                 ex = (EXTINFO *)(win->wind[slider.slide_decrease].ob_spec.userblk->ub_parm);
  510.                 ex->te_slider = slider;
  511.                 ex = (EXTINFO *)(win->wind[slider.slide_slider].ob_spec.userblk->ub_parm);
  512.                 ex->te_slider = slider;
  513.                 ex = (EXTINFO *)(win->wind[slider.slide_track].ob_spec.userblk->ub_parm);
  514.                 ex->te_slider = slider;
  515.  
  516.                 WCallSliderDispatcher(win, object, ex->te_slider.slide_pos, lastpos);
  517.             }
  518.         }
  519. }