mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-17 08:40:27 +02:00
Tilt the sync-lock tiles!
This commit is contained in:
parent
9797923fd5
commit
cb51d71099
@ -217,7 +217,7 @@ from there. Audacity will look for a file called "Pause.png".
|
|||||||
|
|
||||||
//v These are currently a chain-link image.
|
//v These are currently a chain-link image.
|
||||||
// Might want to turn it into a lock or, clockface, or some combination (clock-in-lock?).
|
// Might want to turn it into a lock or, clockface, or some combination (clock-in-lock?).
|
||||||
DEFINE_IMAGE( bmpSyncLockSelTile, wxImage(27, 27), wxT("SyncLockSelTile"));
|
DEFINE_IMAGE( bmpSyncLockSelTile, wxImage(20, 22), wxT("SyncLockSelTile"));
|
||||||
DEFINE_IMAGE( bmpSyncLockIcon, wxImage(12, 12), wxT("SyncLockIcon"));
|
DEFINE_IMAGE( bmpSyncLockIcon, wxImage(12, 12), wxT("SyncLockIcon"));
|
||||||
|
|
||||||
#ifdef OLD_COLOURS
|
#ifdef OLD_COLOURS
|
||||||
|
@ -416,7 +416,6 @@ bool NoteTrack::Trim(double t0, double t1)
|
|||||||
{
|
{
|
||||||
if (t1 <= t0)
|
if (t1 <= t0)
|
||||||
return false;
|
return false;
|
||||||
double len = t1 - t0;
|
|
||||||
mSeq->convert_to_seconds();
|
mSeq->convert_to_seconds();
|
||||||
// delete way beyond duration just in case something is out there:
|
// delete way beyond duration just in case something is out there:
|
||||||
mSeq->clear(t1 - GetOffset(), mSeq->get_dur() + 10000.0, false);
|
mSeq->clear(t1 - GetOffset(), mSeq->get_dur() + 10000.0, false);
|
||||||
|
8073
src/ThemeAsCeeCode.h
8073
src/ThemeAsCeeCode.h
File diff suppressed because it is too large
Load Diff
@ -441,7 +441,6 @@ void TrackArtist::DrawVRuler(Track *t, wxDC * dc, wxRect & r)
|
|||||||
}
|
}
|
||||||
// draw lines delineating the out-of-bounds margins
|
// draw lines delineating the out-of-bounds margins
|
||||||
dc->SetPen(*wxBLACK_PEN);
|
dc->SetPen(*wxBLACK_PEN);
|
||||||
int m = track->GetNoteMargin();
|
|
||||||
// you would think the -1 offset here should be -2 to match the
|
// you would think the -1 offset here should be -2 to match the
|
||||||
// adjustment to r.y (see above), but -1 produces correct output
|
// adjustment to r.y (see above), but -1 produces correct output
|
||||||
AColor::Line(*dc, r.x, r.y + marg - 1, r.x + r.width, r.y + marg - 1);
|
AColor::Line(*dc, r.x, r.y + marg - 1, r.x + r.width, r.y + marg - 1);
|
||||||
@ -2056,7 +2055,7 @@ static long LookupIntAttribute(Alg_note_ptr note, Alg_attribute attr, long def);
|
|||||||
static bool LookupLogicalAttribute(Alg_note_ptr note, Alg_attribute attr, bool def);
|
static bool LookupLogicalAttribute(Alg_note_ptr note, Alg_attribute attr, bool def);
|
||||||
static const char *LookupStringAttribute(Alg_note_ptr note, Alg_attribute attr, const char *def);
|
static const char *LookupStringAttribute(Alg_note_ptr note, Alg_attribute attr, const char *def);
|
||||||
static const char *LookupAtomAttribute(Alg_note_ptr note, Alg_attribute attr, char *def);
|
static const char *LookupAtomAttribute(Alg_note_ptr note, Alg_attribute attr, char *def);
|
||||||
static int PITCH_TO_Y(double p, int bottom);
|
//static int PITCH_TO_Y(double p, int bottom);
|
||||||
|
|
||||||
|
|
||||||
// returns NULL if note is not a shape,
|
// returns NULL if note is not a shape,
|
||||||
@ -2316,9 +2315,6 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track,
|
|||||||
int numPitches = (r.height) / track->GetPitchHeight();
|
int numPitches = (r.height) / track->GetPitchHeight();
|
||||||
if (numPitches < 0) numPitches = 0; // cannot be negative
|
if (numPitches < 0) numPitches = 0; // cannot be negative
|
||||||
|
|
||||||
// bottomNote is the pitch of the note at the bottom of the track
|
|
||||||
// default is 24 (C1)
|
|
||||||
int bottomNote = track->GetBottomNote();
|
|
||||||
// bottom is the hypothetical location of the bottom of pitch 0 relative to
|
// bottom is the hypothetical location of the bottom of pitch 0 relative to
|
||||||
// the top of the clipping region r: r.height - PITCH_HEIGHT/2 is where the
|
// the top of the clipping region r: r.height - PITCH_HEIGHT/2 is where the
|
||||||
// bottomNote is displayed, and to that
|
// bottomNote is displayed, and to that
|
||||||
@ -2408,7 +2404,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track,
|
|||||||
iterator.begin();
|
iterator.begin();
|
||||||
//for every event
|
//for every event
|
||||||
Alg_event_ptr evt;
|
Alg_event_ptr evt;
|
||||||
while (evt = iterator.next()) {
|
while ((evt = iterator.next())) {
|
||||||
if (evt->get_type() == 'n') { // 'n' means a note
|
if (evt->get_type() == 'n') { // 'n' means a note
|
||||||
Alg_note_ptr note = (Alg_note_ptr) evt;
|
Alg_note_ptr note = (Alg_note_ptr) evt;
|
||||||
// if the note's channel is visible
|
// if the note's channel is visible
|
||||||
@ -2765,26 +2761,85 @@ void TrackArtist::SetSpectrumLogMaxFreq(int freq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draws the sync-lock bitmap, tiled; always draws stationary relative to the DC
|
// Draws the sync-lock bitmap, tiled; always draws stationary relative to the DC
|
||||||
|
//
|
||||||
|
// AWD: now that the tiles don't link together, we're drawing a tilted grid, at
|
||||||
|
// two steps down for every one across. This creates a pattern that repeats in
|
||||||
|
// 5-step by 5-step boxes. Because we're only drawing in 5/25 possible positions
|
||||||
|
// we have a grid spacing somewhat smaller than the image dimensions. Thus we
|
||||||
|
// acheive lower density than with a square grid and eliminate edge cases where
|
||||||
|
// no tiles are displayed.
|
||||||
|
//
|
||||||
|
// The pattern draws in tiles at (0,0), (2,1), (4,2), (1,3), and (3,4) in each
|
||||||
|
// 5x5 box.
|
||||||
|
//
|
||||||
|
// There may be a better way to do this, or a more appealing pattern.
|
||||||
void TrackArtist::DrawSyncLockTiles(wxDC *dc, wxRect r)
|
void TrackArtist::DrawSyncLockTiles(wxDC *dc, wxRect r)
|
||||||
{
|
{
|
||||||
wxBitmap syncLockBitmap(theTheme.Image(bmpSyncLockSelTile));
|
wxBitmap syncLockBitmap(theTheme.Image(bmpSyncLockSelTile));
|
||||||
|
|
||||||
int xOffset = r.x % syncLockBitmap.GetWidth();
|
// Grid spacing is a bit smaller than actual image size
|
||||||
if (xOffset < 0) xOffset += syncLockBitmap.GetWidth();
|
int gridW = syncLockBitmap.GetWidth() - 6;
|
||||||
int width;
|
int gridH = syncLockBitmap.GetHeight() - 8;
|
||||||
for (int x = 0; x < r.width; x += width) {
|
|
||||||
width = syncLockBitmap.GetWidth() - xOffset;
|
// Horizontal position within the grid, modulo its period
|
||||||
|
int blockX = (r.x / gridW) % 5;
|
||||||
|
|
||||||
|
// Amount to offset drawing of first column
|
||||||
|
int xOffset = r.x % gridW;
|
||||||
|
if (xOffset < 0) xOffset += gridW;
|
||||||
|
|
||||||
|
// Check if we're missing an extra column to the left (this can happen
|
||||||
|
// because the tiles are bigger than the grid spacing)
|
||||||
|
bool extraCol = false;
|
||||||
|
if (syncLockBitmap.GetWidth() - gridW > xOffset) {
|
||||||
|
extraCol = true;
|
||||||
|
xOffset += gridW;
|
||||||
|
blockX = (blockX - 1) % 5;
|
||||||
|
}
|
||||||
|
// Make sure blockX is non-negative
|
||||||
|
if (blockX < 0) blockX += 5;
|
||||||
|
|
||||||
|
int x = 0;
|
||||||
|
while (x < r.width) {
|
||||||
|
int width = syncLockBitmap.GetWidth() - xOffset;
|
||||||
if (x + width > r.width)
|
if (x + width > r.width)
|
||||||
width = r.width - x;
|
width = r.width - x;
|
||||||
|
|
||||||
int yOffset = r.y % syncLockBitmap.GetHeight();
|
//
|
||||||
if (yOffset < 0) yOffset += syncLockBitmap.GetWidth();
|
// Draw each row in this column
|
||||||
int height;
|
//
|
||||||
for (int y = 0; y < r.height; y += height) {
|
|
||||||
height = syncLockBitmap.GetHeight() - yOffset;
|
// Vertical position in the grid, modulo its period
|
||||||
|
int blockY = (r.y / gridH) % 5;
|
||||||
|
|
||||||
|
// Amount to offset drawing of first row
|
||||||
|
int yOffset = r.y % gridH;
|
||||||
|
if (yOffset < 0) yOffset += gridH;
|
||||||
|
|
||||||
|
// Check if we're missing an extra row on top (this can happen because
|
||||||
|
// the tiles are bigger than the grid spacing)
|
||||||
|
bool extraRow = false;
|
||||||
|
if (syncLockBitmap.GetHeight() - gridH > yOffset) {
|
||||||
|
extraRow = true;
|
||||||
|
yOffset += gridH;
|
||||||
|
blockY = (blockY - 1) % 5;
|
||||||
|
}
|
||||||
|
// Make sure blockY is non-negative
|
||||||
|
if (blockY < 0) blockY += 5;
|
||||||
|
|
||||||
|
int y = 0;
|
||||||
|
while (y < r.height)
|
||||||
|
{
|
||||||
|
int height = syncLockBitmap.GetHeight() - yOffset;
|
||||||
if (y + height > r.height)
|
if (y + height > r.height)
|
||||||
height = r.height - y;
|
height = r.height - y;
|
||||||
|
|
||||||
|
// AWD: draw blocks according to our pattern
|
||||||
|
if ((blockX == 0 && blockY == 0) || (blockX == 2 && blockY == 1) ||
|
||||||
|
(blockX == 4 && blockY == 2) || (blockX == 1 && blockY == 3) ||
|
||||||
|
(blockX == 3 && blockY == 4))
|
||||||
|
{
|
||||||
|
|
||||||
// Do we need to get a sub-bitmap?
|
// Do we need to get a sub-bitmap?
|
||||||
if (width != syncLockBitmap.GetWidth() || height != syncLockBitmap.GetHeight()) {
|
if (width != syncLockBitmap.GetWidth() || height != syncLockBitmap.GetHeight()) {
|
||||||
wxBitmap subSyncLockBitmap =
|
wxBitmap subSyncLockBitmap =
|
||||||
@ -2794,13 +2849,35 @@ void TrackArtist::DrawSyncLockTiles(wxDC *dc, wxRect r)
|
|||||||
else {
|
else {
|
||||||
dc->DrawBitmap(syncLockBitmap, r.x + x, r.y + y, true);
|
dc->DrawBitmap(syncLockBitmap, r.x + x, r.y + y, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Only offset first row
|
// Updates for next row
|
||||||
|
if (extraRow) {
|
||||||
|
// Second offset row, still at y = 0; no more extra rows
|
||||||
|
yOffset -= gridH;
|
||||||
|
extraRow = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Move on in y, no more offset rows
|
||||||
|
y += gridH - yOffset;
|
||||||
yOffset = 0;
|
yOffset = 0;
|
||||||
}
|
}
|
||||||
// Only offset first column
|
blockY = (blockY + 1) % 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Updates for next column
|
||||||
|
if (extraCol) {
|
||||||
|
// Second offset column, still at x = 0; no more extra columns
|
||||||
|
xOffset -= gridW;
|
||||||
|
extraCol = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Move on in x, no more offset rows
|
||||||
|
x += gridW - xOffset;
|
||||||
xOffset = 0;
|
xOffset = 0;
|
||||||
}
|
}
|
||||||
|
blockX = (blockX + 1) % 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackArtist::DrawBackgroundWithSelection(wxDC *dc, const wxRect &r,
|
void TrackArtist::DrawBackgroundWithSelection(wxDC *dc, const wxRect &r,
|
||||||
|
@ -871,7 +871,6 @@ void TrackPanel::OnTimer()
|
|||||||
wxCommandEvent dummyEvent;
|
wxCommandEvent dummyEvent;
|
||||||
AudacityProject *p = GetProject();
|
AudacityProject *p = GetProject();
|
||||||
|
|
||||||
static int rptcnt = 0;
|
|
||||||
if ((p->GetAudioIOToken() > 0) &&
|
if ((p->GetAudioIOToken() > 0) &&
|
||||||
gAudioIO->IsStreamActive(p->GetAudioIOToken()))
|
gAudioIO->IsStreamActive(p->GetAudioIOToken()))
|
||||||
{
|
{
|
||||||
@ -5178,7 +5177,6 @@ bool TrackPanel::HitTestStretch(Track *track, wxRect &r, wxMouseEvent & event)
|
|||||||
gAudioIO->IsStreamActive( GetProject()->GetAudioIOToken())) {
|
gAudioIO->IsStreamActive( GetProject()->GetAudioIOToken())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
NoteTrack *nt = (NoteTrack *) track;
|
|
||||||
int center = r.y + r.height / 2;
|
int center = r.y + r.height / 2;
|
||||||
int distance = abs(event.m_y - center);
|
int distance = abs(event.m_y - center);
|
||||||
const int yTolerance = 10;
|
const int yTolerance = 10;
|
||||||
|
@ -345,7 +345,6 @@ void ExtImportPrefs::OnRuleTableKeyDown(wxKeyEvent& event)
|
|||||||
|
|
||||||
void ExtImportPrefs::DoOnRuleTableKeyDown (int keycode)
|
void ExtImportPrefs::DoOnRuleTableKeyDown (int keycode)
|
||||||
{
|
{
|
||||||
ExtImportItems *items = wxGetApp().mImporter->GetImportItems();
|
|
||||||
int selrow = RuleTable->GetGridCursorRow ();
|
int selrow = RuleTable->GetGridCursorRow ();
|
||||||
wxString ts;
|
wxString ts;
|
||||||
if (keycode == WXK_UP)
|
if (keycode == WXK_UP)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user