Skip to content

Commit

Permalink
Added volume control.
Browse files Browse the repository at this point in the history
General cleanup.
  • Loading branch information
antscode committed Dec 11, 2018
1 parent d4da7af commit 07731be
Show file tree
Hide file tree
Showing 23 changed files with 216 additions and 33 deletions.
2 changes: 1 addition & 1 deletion DarkListDef.cpp → CDEF/DarkListDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <ToolUtils.h>
#include <Resources.h>
#include <string.h>
#include "Util.h"
#include "../Util.h"
#include "DarkListDef.h"

extern "C"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions CDEF/DarkSliderDef.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions CDEF/DarkSliderDef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//------------------------- © 1995 by James G. Stout -------------------------------// File : cdefSlider.h// Date : April 8, 1995// Author : Jim Stout// Purpose : A slider CDEF// :// : If you find a use for this, I'd love to know about it. Bug reports// : are always interesting.// :// : Internet : [email protected](work hours, PST)// : AppleLink : WRQ (daily)// : CompuServe : 73240,2052 (weekly or so)// : AOL : JasG (weekly or so)// : eWorld : Jim Stout (weekly or so)//----------------------------------------------------------------------------------//----------------------------------------------------------------------------------// variation codes//----------------------------------------------------------------------------------#define narrowScale 0x0001 // inset 2 pixels along each edge, thumb is 4 larger#define narrowScale2 0x0002 // inset 4 pixels along each edge, thumb is 8 larger#define filledScale 0x0004 // low end of scale filled with cTingeDark#define snapToScale 0x0008 // click on scale moves thumb to that point//----------------------------------------------------------------------------------// partCodes returned to actionProc//----------------------------------------------------------------------------------#define inThumb 0x0001#define inUpScale 0x0002#define inDnScale 0x0003//----------------------------------------------------------------------------------// CDEF private data structure //----------------------------------------------------------------------------------typedef struct {CGrafPtr offPort;short qdVers;}CDEFData,**CDEFHandle;//----------------------------------------------------------------------------------// Function prototypes//----------------------------------------------------------------------------------pascal long DarkSliderDef(short varCode, ControlHandle theCtl, short message, long param);static long doInit (ControlHandle theCtl);static long doDisp (ControlHandle theCtl);static long doTest (ControlHandle theCtl, short varCode, long param);static void doDraw (ControlHandle cHdl, short varCode);pascal void drawControl (short depth, short dFlags, GDHandle theDevice, long userData);static void dragThumb (ControlHandle theCtl, short varCode, long param);static void scaleClick (ControlHandle theCtl, short varCode, short partCode, Point p);static void getThumbRect (ControlHandle theCtl, Rect * rThumb, Rect * rScale, Boolean vert);static short getThumbOffset (ControlHandle theCtl, Boolean vert, short thumbSize);static short checkLimits (Boolean vert, Rect *rThumb, Rect *rScale);static short getNewValue (ControlHandle theCtl, Boolean vert, short thumbPos);static void adjustControl (ControlHandle theCtl, short varCode, short partCode, short newVal);static Boolean drawParts (ControlHandle theCtl, short varCode, Boolean inColor, Rect * offRect);
Expand Down
1 change: 1 addition & 0 deletions CDEF/colorCDEF.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//------------------------- © 1994-1995 by James G. Stout --------------------------// File : colorCDEF.c// Date : March 14, 1994// Author : Jim Stout// Purpose : Color support routines for CDEF's//----------------------------------------------------------------------------------#include <Controls.h>#include <ToolUtils.h>#include <Types.h>#include <Windows.h>#include "colorCDEF.h"//==================================================================================// Set an RGBColor for a control part - DOES NOT CHECK FOR COLOR SUPPORT//==================================================================================void setPartColor(ControlHandle theControl, short part, Boolean fore){ short inx; AuxCtlHandle aux; CCTabHandle ccTab; GetAuxiliaryControlRecord(theControl, &aux); if(aux) { ccTab = (**aux).acCTable; for(inx=0;inx<=(**ccTab).ctSize;inx++) { if((**ccTab).ctTable[inx].value == part) { if(fore) RGBForeColor(&(**ccTab).ctTable[inx].rgb); else RGBBackColor(&(**ccTab).ctTable[inx].rgb); break; } } }}//==================================================================================// Get RGBColor for foreground and background - DOES NOT CHECK FOR COLOR SUPPORT//==================================================================================void saveColors(RGBColor * saveFore, RGBColor * saveBack){ GetForeColor(saveFore); GetBackColor(saveBack);}//==================================================================================// Set RGBColor for foreground and background - DOES NOT CHECK FOR COLOR SUPPORT//==================================================================================void restoreColors(RGBColor * saveFore, RGBColor * saveBack){ RGBForeColor(saveFore); RGBBackColor(saveBack);}
Expand Down
1 change: 1 addition & 0 deletions CDEF/colorCDEF.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//------------------------- © 1994-1995 by James G. Stout --------------------------// File : colorCDEF.h// Date : March 14, 1994// Author : Jim Stout// Purpose : Color support routines for CDEF's//----------------------------------------------------------------------------------#ifndef cTingeLight#define cFillPatColor 4#define cTingeLight 13#define cTingeDark 14#endifextern void setPartColor (ControlHandle theControl, short part, Boolean fore);extern void saveColors (RGBColor * saveFore, RGBColor * saveBack);extern void restoreColors (RGBColor * saveFore, RGBColor * saveBack);
Expand Down
1 change: 1 addition & 0 deletions CDEF/grayCDEF.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//------------------------- © 1994-1995 by James G. Stout --------------------------// File : grayCDEF.c// Date : September 26, 1994// Author : Jim Stout// Purpose : support routines for CDEF's that can be disabled//----------------------------------------------------------------------------------#include <Gestalt.h>#include <ToolUtils.h>#include <Palettes.h>#include <Traps.h>#include "grayCDEF.h"#include "miscCDEF.h"//==================================================================================// Returns true if a System 7 style gray color was available and returns the // grayish color in theGray - DOES NOT CHECK FOR COLOR SUPPORT//==================================================================================extern Boolean getGray(RGBColor *rgbGray){ RGBColor rgbBack; GDHandle hThisDevice; GetForeColor(rgbGray); if(getOSVers() >= 0x0700) { GetBackColor(&rgbBack); hThisDevice = GetGDevice(); if(GetGray(hThisDevice,&rgbBack,rgbGray)) return true; } return false;}//==================================================================================// Return true if Gestalt says GrayishTextOr mode is present //==================================================================================Boolean haveGrayText (void){ OSErr err; short bit = gestaltHasGrayishTextOr; long gResult; Boolean result = false; if(trapAvailable(_Gestalt)) { err = Gestalt(gestaltQuickdrawFeatures,&gResult); if(err == noErr) { if(BitTst(&gResult, 31-bit)) result = true; } } return(result);}
Expand Down
1 change: 1 addition & 0 deletions CDEF/grayCDEF.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//------------------------- © 1994-1995 by James G. Stout --------------------------// File : grayCDEF.c// Date : September 26, 1994// Author : Jim Stout// Purpose : support routines for CDEF's that can be disabled//----------------------------------------------------------------------------------extern Boolean getGray (RGBColor *theGray);extern Boolean haveGrayText (void);
Expand Down
1 change: 1 addition & 0 deletions CDEF/miscCDEF.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//------------------------- © 1994-1995 by James G. Stout --------------------------// File : miscCDEF.c// Date : November 2,1991// Author : Jim Stout// Purpose : support routines for CDEFs.//----------------------------------------------------------------------------------#include <Controls.h>#include <Gestalt.h>#include <OSUtils.h>#include <QDOffscreen.h>#include <ToolUtils.h>#include <Traps.h>#include <Types.h>#include "miscCDEF.h"//==================================================================================// Get the lowest pixel depth of any GDevice for rect 'r'//==================================================================================short getPixDepth(Rect *r){ Rect gRect, iRect; GDHandle gDev; short thisDepth, pixDepth = 32; GrafPtr thisPort; GetPort(&thisPort); if((thisPort->portBits.rowBytes & 0x8000) == 0) // b&w port return(1); if(!trapAvailable(_GetDeviceList)) // Must have Device Mgr return(1); // or we draw in 1 bit mode. gRect = *r; LocalToGlobal((Point *)&gRect.top); LocalToGlobal((Point *)&gRect.bottom); gDev = GetDeviceList(); // walk device list looking while(gDev) { // for lowest pixDepth if(SectRect(&gRect, &(*gDev)->gdRect, &iRect) && TestDeviceAttribute(gDev,screenDevice) && TestDeviceAttribute(gDev,screenActive)) { thisDepth = (*(*gDev)->gdPMap)->pixelSize; if(thisDepth < pixDepth) pixDepth = thisDepth; } gDev = GetNextDevice(gDev); } return(pixDepth);}//==================================================================================// A "simple minded" version of DeviceLoop that will suffice for these CDEFs//==================================================================================extern void sys6DeviceLoop(RgnHandle drawingRgn, DeviceLoopDrawingUPP drawingProc, long userData, DeviceLoopFlags flags){ Rect gRect, intersect; GDHandle gDev=0; RgnHandle oldClip; short thisDepth; devLoopHandle hDl; if(trapAvailable(_GetDeviceList)) { // Must have Device Mgr oldClip = NewRgn(); GetClip(oldClip); hDl = (devLoopHandle)userData; gRect = (**hDl).controlRect; // need control rect in LocalToGlobal((Point *)&gRect.top); // global coords LocalToGlobal((Point *)&gRect.bottom); gDev = GetDeviceList(); // walk device list while(gDev) { // and find any that // intersect with control if(SectRect(&gRect, &(*gDev)->gdRect, &intersect) && TestDeviceAttribute(gDev,screenDevice) && TestDeviceAttribute(gDev,screenActive)) { GlobalToLocal((Point *)&intersect.top); GlobalToLocal((Point *)&intersect.bottom); ClipRect(&intersect); // clip to intersection thisDepth = (*(*gDev)->gdPMap)->pixelSize; CallDeviceLoopDrawingProc(drawingProc, thisDepth, 0, gDev, userData); } gDev = GetNextDevice(gDev); } SetClip(oldClip); DisposeRgn(oldClip); } else // draw 1 bit version CallDeviceLoopDrawingProc(drawingProc, 1, 0, gDev, userData);}//==================================================================================// Use Gestalt to find out the MacOS version. //==================================================================================short getOSVers(){ OSErr err; short ret=0x0600; long gResult; if(trapAvailable(_Gestalt)) { // is Gestalt available ? err = Gestalt(gestaltSystemVersion,&gResult); if(err == noErr) ret = LoWord(gResult); } return(ret);}//==================================================================================// Generic routine to see if a given trap is available//==================================================================================Boolean trapAvailable(short theTrap){ TrapType tType; tType = getTrapType(theTrap); if(tType == ToolTrap) { theTrap &= 0x07ff; if(theTrap >= numToolBoxTraps()) theTrap = _Unimplemented; } return(( NGetTrapAddress(theTrap, tType) != NGetTrapAddress(_Unimplemented, ToolTrap) ));}//==================================================================================// Needed for "trapAvailable" routine//==================================================================================TrapType getTrapType(short theTrap){ if((theTrap &= 0x0800)) return(ToolTrap); return(OSTrap);}//==================================================================================// Needed for "trapAvailable" routine//==================================================================================short numToolBoxTraps(){ if(NGetTrapAddress(_InitGraf, ToolTrap) == NGetTrapAddress(0xaa6e, ToolTrap)) return(0x0200); return(0x0400);}
Expand Down
1 change: 1 addition & 0 deletions CDEF/miscCDEF.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <Controls.h>//------------------------- © 1994-1995 by James G. Stout --------------------------// File : miscCDEF.h// Date : November 2,1991// Author : Jim Stout// Purpose : #defines, typedefs and prototypes for miscCDEF.c//----------------------------------------------------------------------------------#ifndef calcCntlRgn #define calcCntlRgn 10 #define calcThumbRgn 11#endif#ifndef useWindFont #define useWindFont 0x08#endif//----------------------------------------------------------------------------------// data passed to DeviceLoop//----------------------------------------------------------------------------------typedef struct {ControlHandle theCtl;short varCode;Rect controlRect;}devLoopData,**devLoopHandle;//----------------------------------------------------------------------------------// Function prototypes//----------------------------------------------------------------------------------short getPixDepth (Rect * r);void sys6DeviceLoop (RgnHandle drawingRgn, DeviceLoopDrawingUPP drawingProc, long userData, DeviceLoopFlags flags);short getOSVers (void);Boolean trapAvailable (short trapNum);short numToolBoxTraps (void);TrapType getTrapType (short trapType);//----------------------------------------------------------------------------------// low-memory globals - I knowÉ, but Apple's popUp CDEF 63 uses theseÉ//----------------------------------------------------------------------------------#ifdef THINK_Cextern long LastSpExtra : 0x0B4C;extern short SysFontFam : 0x0BA6;extern short SysFontSize : 0x0BA8;#endif//----------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions CDEF/qdCDEF.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//------------------------- © 1994-1995 by James G. Stout --------------------------// File : qdCDEF.c// Purpose : CDEF quickDraw routines for offScreen drawing and quickdraw version// Date : 23 June 1992////----------------------------------------------------------------------------------#include <Gestalt.h>#include <Memory.h>#include <OSUtils.h>#include <QDOffscreen.h>#include <ToolUtils.h>#include <Traps.h>#include <Types.h>#include <Windows.h>#include "miscCDEF.h"#include "qdCDEF.h"#define NOPIXELS 0//==================================================================================// Get an offscreen drawing port, either GWorld or Bitmap for specified localRect.// If 32 Bit ColorQuickdraw if found, we try for a GWorld, otherwise, just create// an offscreen bitmap.//// Returns : depth of offPort and a filled in GWorld or Bitmap//==================================================================================extern short getOff(CGrafPtr * offPort, Rect * localRect){ short wid, ht; Rect globalRect; BitMap newBits; QDErr err; GrafPtr savePort; RgnHandle grayRgn = GetGrayRgn(); //----------------------------------------------------------------------------------// get an offscreen bitmap/GWorld to minimize flicker when drawing //---------------------------------------------------------------------------------- if(getQDVers() >= gestalt32BitQD12) { // try to use a GWorld globalRect = *localRect; LocalToGlobal((Point *)&globalRect.top); LocalToGlobal((Point *)&globalRect.bottom); if(!RectInRgn(&globalRect, grayRgn)) // avoid crash with v1.2 cQD return NOPIXELS; if(*offPort == 0) { // create a new GWorld err = NewGWorld((CGrafPtr *)offPort,0,&globalRect,0,0,0); } else { // update existing GWorld err = UpdateGWorld((CGrafPtr *)offPort,0,&globalRect,0,0,0); } if(err == noErr) return (**((*offPort)->portPixMap)).pixelSize; return NOPIXELS; // something is seriously amissÉ } else if(*offPort == 0) { // create a bitmap wid = (*localRect).right - (*localRect).left; ht = (*localRect).bottom - (*localRect).top; SetRect(&newBits.bounds,0,0,wid,ht); newBits.rowBytes = ((wid + 31)/32) * 4; newBits.baseAddr = NewPtr(ht * newBits.rowBytes); if(MemError()) return NOPIXELS; CopyBits(&newBits,&newBits, // clear the new bitmap &newBits.bounds,&newBits.bounds, srcXor,nil); GetPort(&savePort); *offPort = (CGrafPtr)NewPtr(sizeof(GrafPort)); if(MemError()) return NOPIXELS; OpenPort((GrafPtr)*offPort); SetPort((GrafPtr)*offPort); (**offPort).portRect = newBits.bounds; RectRgn((**offPort).visRgn,&newBits.bounds); SetPortBits(&newBits); SetPort(savePort); return 1; }}//==================================================================================// Lock down the offPort pixels and return a locked handle to the locked pixels//==================================================================================extern PixMapHandle getLockedPixels(CGrafPtr * offPort, short qdVers){ PixMapHandle pmHdl; if(qdVers >= gestalt32BitQD13) { // no bug in the pmHdl = GetGWorldPixMap(*offPort); // GetGWorldPixMap routine if(!LockPixels(pmHdl)) { pmHdl = 0; } } else pmHdl = (*offPort)->portPixMap; if(pmHdl) HLock((Handle)pmHdl); return(pmHdl);}//==================================================================================// Unlock PixMapHandle & pixels//==================================================================================extern void unlockPixels(PixMapHandle pmHdl, short qdVers){ if(pmHdl) { HUnlock((Handle)pmHdl); if(qdVers >= gestalt32BitQD13) { // no bug in the UnlockPixels(pmHdl); // GetGWorldPixMap routine } }}//==================================================================================// Return QD version number from Gestalt //==================================================================================short getQDVers() { OSErr err; long gResult; if(trapAvailable(_Gestalt)) { err = Gestalt(gestaltQuickdrawVersion,&gResult); if(err == noErr) return(LoWord(gResult)); } return(gestaltOriginalQD);}
Expand Down
1 change: 1 addition & 0 deletions CDEF/qdCDEF.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//------------------------- © 1994-1995 by James G. Stout --------------------------// File : qdCDEF.h// Purpose : prototypes for routines in qdCDEF.c//// Date : 23 June 1992//----------------------------------------------------------------------------------extern short getOff (CGrafPtr * offPort, Rect * r);extern PixMapHandle getLockedPixels (CGrafPtr * offPort, short qdVers);extern void unlockPixels (PixMapHandle pmHdl, short qdVers);extern short getQDVers (void);
Expand Down
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ add_application(MacPlayer
Keys.cpp
MacAuth.r
base64.cpp
DarkListDef.cpp
DarkScrollbarDef.cpp
CDEF/DarkListDef.cpp
CDEF/DarkScrollbarDef.cpp
CDEF/DarkSliderDef.cpp
CDEF/colorCDEF.cpp
CDEF/grayCDEF.cpp
CDEF/miscCDEF.cpp
CDEF/qdCDEF.cpp
SpotifyClient.cpp

CREATOR "MPLY"
Expand Down
Loading

0 comments on commit 07731be

Please sign in to comment.