home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / µSim 1.0.5 / source / SimAsm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-09  |  2.8 KB  |  138 lines  |  [TEXT/CWIE]

  1. /*
  2. Copyright © 1993,1994,1995 Fabrizio Oddone
  3. ••• ••• ••• ••• ••• ••• ••• ••• ••• •••
  4. This source code is distributed as freeware:
  5. you may copy, exchange, modify this code.
  6. You may include this code in any kind of application: freeware,
  7. shareware, or commercial, provided that full credits are given.
  8. You may not sell or distribute this code for profit.
  9. */
  10.  
  11. #include    "ControlStore.h"
  12. #include    "Globals.h"
  13. #include    "Microprogram_Ed.h"
  14. #include    "SimAsm.h"
  15.  
  16.  
  17. Boolean instrClikLoop(void)
  18. {
  19. Rect tempRect = *keyrects[kKEY_LIST];
  20. Point    tempPt;
  21.  
  22. tempRect.right -= kScrollbarAdjust;
  23. GetMouse(&tempPt);
  24. draggedOnComments = PtInRect(tempPt, &tempRect);
  25.  
  26. #if GENERATINGCFM
  27. return draggedOnComments;
  28. #else
  29. return draggedOnComments == false;
  30. #endif
  31. }
  32.  
  33. Boolean commentClikLoop(void)
  34. {
  35. union u_mir tmpmir;
  36. Rect    clkRect, destRect;
  37. Point    curPt;
  38. register short    cellMid, temp;
  39.  
  40. curPt = LLastClick(Lists[kL_COMMENTS]);
  41. tmpmir = *(gCsMemory + curPt.v);
  42. if (tmpmir.bits.cond) {
  43.     LRect(&clkRect, curPt, Lists[kL_COMMENTS]);
  44.     GetMouse(&curPt);
  45.     if (PtInRect(curPt, &clkRect)) {
  46.         if (arrowDrawn == false) {
  47.             cellMid = (clkRect.top + clkRect.bottom) >> 1;
  48.             temp = clkRect.left - klateralCellTweek;
  49.             MoveTo(temp, cellMid);
  50.             temp -= karrowDistFromList;
  51.             LineTo(temp, cellMid);
  52.             curPt.h = 0;
  53.             curPt.v = tmpmir.bits.addr;
  54.             LRect(&destRect, curPt, Lists[kL_COMMENTS]);
  55.             cellMid = (destRect.top + destRect.bottom) >> 1;
  56.             LineTo(temp, cellMid);
  57.             temp += karrowDistFromList;
  58.             LineTo(temp, cellMid);
  59.             LineTo(temp, cellMid);
  60.             LineTo(temp - karrowHead, cellMid - karrowHead);
  61.             MoveTo(temp, cellMid);
  62.             LineTo(temp - karrowHead, cellMid + karrowHead);
  63.             arrowDrawn = true;
  64.             }
  65.         }
  66.     else if (arrowDrawn) {
  67.         EraseArrowRect();
  68. //        UnloadSeg(EraseArrowRect);
  69.         }
  70.     }
  71. return kListClickLoopTrue;
  72. }
  73.  
  74. #if defined(powerc) || defined (__powerc)
  75.  
  76. Boolean switchCursClikLoop(void)
  77. {
  78. Rect tempRect = *keyrects[kKEY_LIST];
  79. Point    tempPt;
  80. Boolean d7;
  81.  
  82. tempRect.right -= kScrollbarAdjust;
  83. GetMouse(&tempPt);
  84. d7 = PtInRect(tempPt, &tempRect);
  85. if (d7 != draggedOnComments) {
  86.     SetCursor(d7 ? *GetCursor(kSheetsCursor) : &qd.arrow);
  87.     draggedOnComments = d7;
  88.     }
  89.  
  90. return kListClickLoopTrue;
  91. }
  92.  
  93. #else
  94.  
  95. asm Boolean switchCursClikLoop(void)
  96. {
  97.     LINK    A6,#-8
  98.     MOVEA.L    keyrects+(kKEY_LIST*4),A0
  99.     LEA        -8(A6),A1
  100.     MOVE.L    (A0)+,(A1)+
  101.     MOVE.L    (A0),(A1)+
  102.     SUBI.W    #kScrollbarAdjust,-(A1)
  103.  
  104.     MOVE.L    D7,-(SP)
  105.     SUBQ.L    #2,SP
  106.     MOVE.L    D5,-(SP)    //we must not overwrite D5 (contains mouse location)
  107.     PEA        -8(A6)
  108.     _PtInRect
  109.     MOVE.B    (SP)+,D7
  110.     CMP.B    draggedOnComments,D7
  111.     BEQ.S    exitasm
  112.     
  113.     TST.B    D7
  114.     BEQ.S    restoreplus
  115.     
  116.     SUBQ.L    #4,SP
  117.     MOVE.W    #kSheetsCursor,-(SP)
  118.     _GetCursor
  119.     MOVEA.L    (SP),A0
  120.     MOVE.L    (A0),(SP)
  121.     _SetCursor
  122.     BRA.S    goodexit
  123. restoreplus:
  124.     PEA        qd.arrow
  125.     _SetCursor
  126. goodexit:
  127.     MOVE.B    D7,draggedOnComments
  128. exitasm:
  129.     MOVE.L    (SP)+,D7
  130.     MOVEQ    #1,D0
  131. //    MOVE.B    D0,8(A6)    //    true    (actually is not needed)!
  132.     
  133.     UNLK    A6
  134.     RTS
  135. }
  136.  
  137. #endif
  138.