-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report inserting media, including items with adjusted playrate #1104
Open
ScottChesworth
wants to merge
1
commit into
jcsteh:master
Choose a base branch
from
ScottChesworth:reportInsertingMedia
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3389,7 +3389,10 @@ void cmdSplitItems(Command* command) { | |
void cmdPaste(Command* command) { | ||
MediaItem* item = GetSelectedMediaItem(0, 0); | ||
int oldTakes = CountTakes(item); | ||
int oldItems = CountMediaItems(0); | ||
set<MediaItem*> oldItems; | ||
for (int i = 0; i < CountMediaItems(0); i++) { | ||
oldItems.insert(GetMediaItem(0, i)); | ||
} | ||
int oldTracks = CountTracks(0); | ||
TrackEnvelope* envelope = GetSelectedEnvelope(0); | ||
int oldPoints = 0; | ||
|
@@ -3409,7 +3412,7 @@ void cmdPaste(Command* command) { | |
// {} will be replaced with the number of tracks; e.g. "2 tracks". | ||
s << format(translate_plural("{} track", "{} tracks", added), added); | ||
} | ||
if ((added = CountMediaItems(0) - oldItems) > 0) { | ||
if ((added = CountMediaItems(0) - oldItems.size()) > 0) { | ||
if (s.tellp() > 0) { | ||
s << " "; | ||
} | ||
|
@@ -3422,6 +3425,15 @@ void cmdPaste(Command* command) { | |
// Translators: Reported after the number of tracks and/or items added. | ||
s << " " << translate("added"); | ||
maybeAddRippleMessage(s, command->gaccel.accel.cmd); | ||
int rateAdjusted = 0; | ||
for (int i = 0; i < CountMediaItems(0); i++) { | ||
MediaItem* item = GetMediaItem(0, i); | ||
if (!oldItems.contains(item) && | ||
*(double*)GetSetMediaItemTakeInfo(GetActiveTake(item), "D_PLAYRATE", nullptr) != 1.0) | ||
rateAdjusted++; | ||
} | ||
if (rateAdjusted > 0) | ||
s << ", " << format(translate_plural("{} item rate adjusted", "{} items rate adjusted", rateAdjusted), rateAdjusted); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Translators comment please. |
||
outputMessage(s); | ||
return; | ||
} | ||
|
@@ -4901,6 +4913,7 @@ Command COMMANDS[] = { | |
{MAIN_SECTION, {{0, 0, 42398}, nullptr}, nullptr, cmdPaste}, // Item: Paste items/tracks | ||
{MAIN_SECTION, {{0, 0, 40603}, nullptr}, nullptr, cmdPaste}, // Take: Paste as takes in items | ||
{MAIN_SECTION, {{0, 0, 40062}, nullptr}, nullptr, cmdPaste}, // Track: Duplicate tracks | ||
{MAIN_SECTION, {{0, 0, 40018}, nullptr}, nullptr, cmdPaste}, // Insert media files... | ||
{MAIN_SECTION, {{0, 0, 40005}, nullptr}, nullptr, cmdRemoveTracks}, // Track: Remove tracks | ||
{MAIN_SECTION, {{0, 0, 40337}, nullptr}, nullptr, cmdRemoveTracks}, // Track: Cut tracks | ||
{MAIN_SECTION, {{0, 0, 40006}, nullptr}, nullptr, cmdRemoveItems}, // Item: Remove items | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worry that this (and the loop below) could cause performance problems in really large projects. This isn't just walking selected media items or items on the current track; it's walking through every item in the entire project. While I understand why that is the case, walking through potentially thousands of items twice every time one pastes seems like it might become problematic. It's not necessarily a show stopper, but I'd like some assurance that this has been verified to be snappy in a massive project before we consider merging.