parent
ee9056c130
commit
c05bb51b86
@ -442,6 +442,95 @@ void Commands_clearLoopmarks(TrackData* trackData)
|
|||||||
|
|
||||||
Commands_endMulti();
|
Commands_endMulti();
|
||||||
}
|
}
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
struct MuteData
|
||||||
|
{
|
||||||
|
Track* track;
|
||||||
|
struct sync_track* syncTrack;
|
||||||
|
int row;
|
||||||
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static void toggleMute(void* userData)
|
||||||
|
{
|
||||||
|
struct MuteData* data = (struct MuteData*)userData;
|
||||||
|
|
||||||
|
// if we have mute data we should toggle back the track to it's old form
|
||||||
|
|
||||||
|
if (data->track->muteBackup)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
sync_del_key(data->syncTrack, 0);
|
||||||
|
RemoteConnection_sendDeleteKeyCommand(data->syncTrack->name, 0);
|
||||||
|
|
||||||
|
for (i = 0; i < data->track->muteKeyCount; ++i)
|
||||||
|
{
|
||||||
|
struct track_key* key = &data->track->muteBackup[i];
|
||||||
|
|
||||||
|
sync_set_key(data->syncTrack, key);
|
||||||
|
RemoteConnection_sendSetKeyCommand(data->syncTrack->name, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(data->track->muteBackup);
|
||||||
|
|
||||||
|
data->track->muteBackup = 0;
|
||||||
|
data->track->muteKeyCount = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
struct track_key defKey;
|
||||||
|
int i, keysSize = sizeof(struct track_key) * data->syncTrack->num_keys;
|
||||||
|
float currentValue = (float)sync_get_val(data->syncTrack, data->row);
|
||||||
|
|
||||||
|
// No muteBackup, this means that we want to mute the channel
|
||||||
|
|
||||||
|
data->track->muteBackup = malloc(keysSize);
|
||||||
|
data->track->muteKeyCount = data->syncTrack->num_keys;
|
||||||
|
|
||||||
|
memcpy(data->track->muteBackup, data->syncTrack->keys, keysSize);
|
||||||
|
|
||||||
|
for (i = 0; i < data->syncTrack->num_keys; ++i)
|
||||||
|
{
|
||||||
|
int row = data->track->muteBackup[i].row;
|
||||||
|
|
||||||
|
sync_del_key(data->syncTrack, row);
|
||||||
|
RemoteConnection_sendDeleteKeyCommand(data->syncTrack->name, row);
|
||||||
|
}
|
||||||
|
|
||||||
|
defKey.row = 0;
|
||||||
|
defKey.value = currentValue;
|
||||||
|
defKey.type = KEY_STEP;
|
||||||
|
|
||||||
|
// insert key with the current value
|
||||||
|
|
||||||
|
sync_set_key(data->syncTrack, &defKey);
|
||||||
|
RemoteConnection_sendSetKeyCommand(data->syncTrack->name, &defKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void Commands_toggleMute(struct Track* track, struct sync_track* syncTrack, int row)
|
||||||
|
{
|
||||||
|
struct MuteData* data;
|
||||||
|
Command* command;
|
||||||
|
|
||||||
|
command = malloc(sizeof(Command));
|
||||||
|
memset(command, 0, sizeof(Command));
|
||||||
|
|
||||||
|
command->userData = data = malloc(sizeof(struct MuteData));
|
||||||
|
command->exec = toggleMute;
|
||||||
|
command->undo = toggleMute;
|
||||||
|
|
||||||
|
data->track = track;
|
||||||
|
data->syncTrack = syncTrack;
|
||||||
|
data->row = row;
|
||||||
|
|
||||||
|
execCommand(command);
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
struct sync_track;
|
struct sync_track;
|
||||||
struct track_key;
|
struct track_key;
|
||||||
struct TrackData;
|
struct TrackData;
|
||||||
|
struct Track;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ void Commands_redo();
|
|||||||
|
|
||||||
void Commands_deleteKey(int track, int row);
|
void Commands_deleteKey(int track, int row);
|
||||||
void Commands_addOrUpdateKey(int track, struct track_key* key);
|
void Commands_addOrUpdateKey(int track, struct track_key* key);
|
||||||
|
void Commands_toggleMute(struct Track* track, struct sync_track* syncTrack, int row);
|
||||||
void Commands_toggleBookmark(struct TrackData* trackData, int row);
|
void Commands_toggleBookmark(struct TrackData* trackData, int row);
|
||||||
void Commands_clearBookmarks(struct TrackData* trackData);
|
void Commands_clearBookmarks(struct TrackData* trackData);
|
||||||
void Commands_toggleLoopmark(struct TrackData* trackData, int row);
|
void Commands_toggleLoopmark(struct TrackData* trackData, int row);
|
||||||
|
|||||||
@ -1319,6 +1319,24 @@ static void onEnterCurrentValue()
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static void onMuteToggle()
|
||||||
|
{
|
||||||
|
struct sync_track** tracks = getTracks();
|
||||||
|
const int activeTrack = getActiveTrack();
|
||||||
|
TrackData* trackData = getTrackData();
|
||||||
|
Track* t = &trackData->tracks[activeTrack];
|
||||||
|
|
||||||
|
if (!tracks)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (tracks[activeTrack]->num_keys < 2 && !t->muteBackup)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Commands_toggleMute(t, tracks[activeTrack], getRowPos());
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static void onPlay()
|
static void onPlay()
|
||||||
{
|
{
|
||||||
RemoteConnection_sendPauseCommand(!RemoteConnection_isPaused());
|
RemoteConnection_sendPauseCommand(!RemoteConnection_isPaused());
|
||||||
@ -1682,6 +1700,7 @@ void Editor_menuEvent(int menuItem)
|
|||||||
case EDITOR_MENU_INTERPOLATION : onInterpolation(); break;
|
case EDITOR_MENU_INTERPOLATION : onInterpolation(); break;
|
||||||
case EDITOR_MENU_INVERT_SELECTION: onInvertSelection(); break;
|
case EDITOR_MENU_INVERT_SELECTION: onInvertSelection(); break;
|
||||||
case EDITOR_MENU_ENTER_CURRENT_V : onEnterCurrentValue(); break;
|
case EDITOR_MENU_ENTER_CURRENT_V : onEnterCurrentValue(); break;
|
||||||
|
case EDITOR_MENU_MUTE_TRACK : onMuteToggle(); break;
|
||||||
|
|
||||||
// View
|
// View
|
||||||
|
|
||||||
|
|||||||
@ -58,6 +58,8 @@ MenuDescriptor g_editMenu[] =
|
|||||||
{ _T("Interpolation"), EDITOR_MENU_INTERPOLATION, 'i', 0, 0 },
|
{ _T("Interpolation"), EDITOR_MENU_INTERPOLATION, 'i', 0, 0 },
|
||||||
{ _T("Invert Selection"), EDITOR_MENU_INVERT_SELECTION, 'i', EMGUI_KEY_COMMAND, EMGUI_KEY_CTRL },
|
{ _T("Invert Selection"), EDITOR_MENU_INVERT_SELECTION, 'i', EMGUI_KEY_COMMAND, EMGUI_KEY_CTRL },
|
||||||
{ _T("Insert current value"), EDITOR_MENU_ENTER_CURRENT_V,EMGUI_KEY_ENTER,0, 0 },
|
{ _T("Insert current value"), EDITOR_MENU_ENTER_CURRENT_V,EMGUI_KEY_ENTER,0, 0 },
|
||||||
|
{ _T(""), EDITOR_MENU_SEPARATOR, 0, 0, 0 },
|
||||||
|
{ _T("Mute/Unmute track"), EDITOR_MENU_MUTE_TRACK, 'm', 0, 0 },
|
||||||
{ 0 },
|
{ 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,7 @@ enum
|
|||||||
EDITOR_MENU_INTERPOLATION,
|
EDITOR_MENU_INTERPOLATION,
|
||||||
EDITOR_MENU_INVERT_SELECTION,
|
EDITOR_MENU_INVERT_SELECTION,
|
||||||
EDITOR_MENU_ENTER_CURRENT_V,
|
EDITOR_MENU_ENTER_CURRENT_V,
|
||||||
|
EDITOR_MENU_MUTE_TRACK,
|
||||||
|
|
||||||
// View
|
// View
|
||||||
|
|
||||||
|
|||||||
@ -27,11 +27,13 @@ typedef struct Track
|
|||||||
{
|
{
|
||||||
char* displayName;
|
char* displayName;
|
||||||
struct Group* group;
|
struct Group* group;
|
||||||
|
struct track_key* muteBackup;
|
||||||
uint32_t color;
|
uint32_t color;
|
||||||
|
|
||||||
int width; // width in pixels of the track
|
int width; // width in pixels of the track
|
||||||
int index;
|
int index;
|
||||||
int groupIndex;
|
int groupIndex;
|
||||||
|
int muteKeyCount;
|
||||||
bool hidden;
|
bool hidden;
|
||||||
bool folded;
|
bool folded;
|
||||||
bool selected;
|
bool selected;
|
||||||
|
|||||||
@ -387,6 +387,7 @@ static int renderChannel(struct TrackInfo* info, int startX, Track* trackData, b
|
|||||||
const int endPos = info->endPos;
|
const int endPos = info->endPos;
|
||||||
struct sync_track* track = 0;
|
struct sync_track* track = 0;
|
||||||
const uint32_t color = trackData->color;
|
const uint32_t color = trackData->color;
|
||||||
|
bool renderTrack = true;
|
||||||
bool folded = false;
|
bool folded = false;
|
||||||
const int yEnd = (info->endSizeY - info->startY) + 40;
|
const int yEnd = (info->endSizeY - info->startY) + 40;
|
||||||
|
|
||||||
@ -433,6 +434,11 @@ static int renderChannel(struct TrackInfo* info, int startX, Track* trackData, b
|
|||||||
folded = valuesOnly ? true : folded;
|
folded = valuesOnly ? true : folded;
|
||||||
size = valuesOnly ? track_size_folded : size;
|
size = valuesOnly ? track_size_folded : size;
|
||||||
|
|
||||||
|
// don't render anything if it's muted
|
||||||
|
|
||||||
|
if (trackData->muteBackup)
|
||||||
|
renderTrack = false;
|
||||||
|
|
||||||
if (valuesOnly)
|
if (valuesOnly)
|
||||||
{
|
{
|
||||||
Emgui_fill(border_color, startX + size, info->startY - font_size * 4, 2, yEnd);
|
Emgui_fill(border_color, startX + size, info->startY - font_size * 4, 2, yEnd);
|
||||||
@ -475,8 +481,11 @@ static int renderChannel(struct TrackInfo* info, int startX, Track* trackData, b
|
|||||||
|
|
||||||
renderInterpolation(info, track, size, idx, offset, y_offset, folded);
|
renderInterpolation(info, track, size, idx, offset, y_offset, folded);
|
||||||
|
|
||||||
if (!(trackData->selected && info->viewInfo->rowPos == y && info->editText))
|
if (renderTrack)
|
||||||
renderText(info, track, y, idx, offset, y_offset, folded);
|
{
|
||||||
|
if (!(trackData->selected && info->viewInfo->rowPos == y && info->editText))
|
||||||
|
renderText(info, track, y, idx, offset, y_offset, folded);
|
||||||
|
}
|
||||||
|
|
||||||
selected = (trackIndex >= info->selectLeft && trackIndex <= info->selectRight) &&
|
selected = (trackIndex >= info->selectLeft && trackIndex <= info->selectRight) &&
|
||||||
(y >= info->selectTop && y <= info->selectBottom);
|
(y >= info->selectTop && y <= info->selectBottom);
|
||||||
|
|||||||
@ -543,6 +543,7 @@ LRESULT CALLBACK WndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
case EDITOR_MENU_SCALE_01:
|
case EDITOR_MENU_SCALE_01:
|
||||||
case EDITOR_MENU_INTERPOLATION:
|
case EDITOR_MENU_INTERPOLATION:
|
||||||
case EDITOR_MENU_INVERT_SELECTION:
|
case EDITOR_MENU_INVERT_SELECTION:
|
||||||
|
case EDITOR_MENU_MUTE_TRACK:
|
||||||
case EDITOR_MENU_ENTER_CURRENT_V:
|
case EDITOR_MENU_ENTER_CURRENT_V:
|
||||||
case EDITOR_MENU_TAB:
|
case EDITOR_MENU_TAB:
|
||||||
case EDITOR_MENU_PLAY:
|
case EDITOR_MENU_PLAY:
|
||||||
|
|||||||
@ -49,7 +49,7 @@ StaticLibrary {
|
|||||||
Sources = {
|
Sources = {
|
||||||
FGlob {
|
FGlob {
|
||||||
Dir = "emgui/src",
|
Dir = "emgui/src",
|
||||||
Extensions = { ".c" },
|
Extensions = { ".c", ".h" },
|
||||||
Filters = {
|
Filters = {
|
||||||
{ Pattern = "macosx"; Config = "linux-*-*" },
|
{ Pattern = "macosx"; Config = "linux-*-*" },
|
||||||
{ Pattern = "macosx"; Config = "macosx-*-*" },
|
{ Pattern = "macosx"; Config = "macosx-*-*" },
|
||||||
@ -96,7 +96,7 @@ Program {
|
|||||||
Sources = {
|
Sources = {
|
||||||
FGlob {
|
FGlob {
|
||||||
Dir = "src",
|
Dir = "src",
|
||||||
Extensions = { ".c", ".m" },
|
Extensions = { ".c", ".m", ".h" },
|
||||||
Filters = {
|
Filters = {
|
||||||
{ Pattern = "linux"; Config = "linux-*-*" },
|
{ Pattern = "linux"; Config = "linux-*-*" },
|
||||||
{ Pattern = "macosx"; Config = "macosx-*-*" },
|
{ Pattern = "macosx"; Config = "macosx-*-*" },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user