File: MacHandleEv.c

package info (click to toggle)
audacity 2.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 86,844 kB
  • sloc: ansic: 225,005; cpp: 221,240; sh: 27,327; python: 16,896; makefile: 8,186; lisp: 8,002; perl: 317; xml: 307; sed: 16
file content (64 lines) | stat: -rw-r--r-- 2,232 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <MacTypes.h>
#include <Quickdraw.h>
#include <Windows.h>
#include <Controls.h>
#include <ToolUtils.h>
#include "macint.h"

extern WindowPtr gCommandWin, gGraphicsWin;
extern Boolean gCommandWinResized;
extern Rect dragRect, sizeRect;

//=============================================================================
// Hanlde Mouse Down Events
//=============================================================================

void DoMouseDown (EventRecord *theEvent) {
    WindowPtr whichWindow;
    short int thePart = FindWindow (theEvent->where, &whichWindow);

    switch (thePart) {
        case inSysWindow:
            SystemClick (theEvent, whichWindow);
            break;
        case inDrag:
            DragWindow (whichWindow, theEvent->where, &dragRect);
            break;
        case inMenuBar: {
            long choice;
            AdjustMenus ();
            choice = MenuSelect (theEvent->where);
            if (choice) DoMenu (choice);
            break;
        }
        case inGoAway:
            if ((whichWindow == gGraphicsWin)
                    && (TrackGoAway (whichWindow, theEvent->where)))
                HideGrafWin ();
            break;
        case inContent:
            if ((FrontWindow () == gCommandWin) && (whichWindow == gCommandWin))
                DoContent (theEvent);
            else SelectWindow (whichWindow);
            break;
        case inGrow:
        case inZoomIn:
        case inZoomOut: {
            long newSize;
            GrafPtr oldPort;
            if (thePart == inGrow) newSize = GrowWindow (whichWindow, theEvent->where, &sizeRect);
            if (((thePart == inGrow) && newSize)
                || ((thePart != inGrow) && TrackBox (whichWindow, theEvent->where, thePart))) {
                GetPort (&oldPort);
                SetPort (whichWindow);
                EraseRect (&whichWindow->portRect);
                if (thePart == inGrow) SizeWindow (whichWindow, LoWord (newSize), HiWord (newSize), -1);
                else ZoomWindow (whichWindow, thePart, 0);
                gCommandWinResized = true;
                InvalRect (&whichWindow->portRect);
                SetPort (oldPort);
            }
            break;
        }
    }
}