1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-20 15:41:18 +01:00

Appearance on OSX is now back to normal or better

Some additional wx3 cleanup as well.
This commit is contained in:
Leland Lucius
2015-08-23 20:25:01 -05:00
parent 1878a0ddd0
commit 6a9dae20f5
35 changed files with 876 additions and 924 deletions

View File

@@ -15,28 +15,30 @@
#ifndef __AUDACITY_SNAP__
#define __AUDACITY_SNAP__
#include <vector>
#include <wx/defs.h>
#include <wx/dynarray.h>
#include <wx/string.h>
#include "Project.h"
#include "Track.h"
#include "ViewInfo.h"
#include "WaveClip.h"
#include "widgets/NumericTextCtrl.h"
class LabelTrack;
class Track;
class WaveClip;
class TrackList;
class ZoomInfo;
class TrackClip
{
public:
TrackClip(Track *t, WaveClip *c) { track = origTrack = t; clip = c; }
TrackClip(Track *t, WaveClip *c)
{
track = origTrack = t;
clip = c;
}
Track *track;
Track *origTrack;
WaveClip *clip;
};
typedef std::vector<TrackClip> TrackClipArray;
WX_DECLARE_USER_EXPORTED_OBJARRAY(TrackClip, TrackClipArray, AUDACITY_DLL_API);
enum
{
@@ -45,9 +47,13 @@ enum
SNAP_PRIOR
};
class SnapPoint {
public:
SnapPoint(double t, Track *track) {
const int kPixelTolerance = 4;
class SnapPoint
{
public:
SnapPoint(double t, Track *track)
{
this->t = t;
this->track = track;
}
@@ -57,12 +63,15 @@ class SnapPoint {
WX_DEFINE_SORTED_ARRAY(SnapPoint *, SnapPointArray);
class SnapManager {
class SnapManager
{
public:
SnapManager(TrackList *tracks, TrackClipArray *exclusions,
const std::vector<Track*> *pLabelTrackExclusions,
const ZoomInfo &zoomInfo, int pixelTolerance, bool noTimeSnap = false);
SnapManager(TrackList *tracks,
const ZoomInfo *zoomInfo,
const TrackClipArray *clipExclusions = NULL,
const TrackArray *trackExclusions = NULL,
bool noTimeSnap = false,
int pixelTolerance = kPixelTolerance);
~SnapManager();
// The track may be NULL.
@@ -70,11 +79,11 @@ public:
// Pass rightEdge=true if this is the right edge of a selection,
// and false if it's the left edge.
bool Snap(Track *currentTrack,
double t,
bool rightEdge,
double *out_t,
bool *snappedPoint,
bool *snappedTime);
double t,
bool rightEdge,
double *outT,
bool *snappedPoint,
bool *snappedTime);
static wxArrayString GetSnapLabels();
static wxArrayString GetSnapValues();
@@ -82,23 +91,35 @@ public:
static int GetSnapIndex(const wxString & value);
private:
void CondListAdd(double t, Track *tr);
double Get(int index);
wxInt64 PixelDiff(double t, int index);
int Find(double t, int i0, int i1);
int Find(double t);
bool SnapToPoints(Track *currentTrack, double t, bool rightEdge,
double *out_t);
double mEpsilon;
SnapPointArray *mSnapPoints;
void Reinit();
void CondListAdd(double t, Track *track);
double Get(size_t index);
wxInt64 PixelDiff(double t, size_t index);
size_t Find(double t, size_t i0, size_t i1);
size_t Find(double t);
bool SnapToPoints(Track *currentTrack, double t, bool rightEdge, double *outT);
private:
const AudacityProject *mProject;
TrackList *mTracks;
const TrackClipArray *mClipExclusions;
const TrackArray *mTrackExclusions;
const ZoomInfo *mZoomInfo;
int mPixelTolerance;
bool mNoTimeSnap;
double mEpsilon;
SnapPointArray mSnapPoints;
// Info for snap-to-time
NumericConverter mConverter;
bool mSnapToTime;
NumericConverter mConverter;
bool mSnapToTime;
const wxInt64 mPixelTolerance;
const ZoomInfo &mZoomInfo;
int mSnapTo;
double mRate;
wxString mFormat;
};
#endif