Skip to content

Commit

Permalink
Hold shift to resize all events in selection; #23
Browse files Browse the repository at this point in the history
  • Loading branch information
vanjac committed Dec 30, 2023
1 parent 4778214 commit a62283a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions Aodix/AodixCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ class CAodixCore
void edit_insert(int const all_tracks);
void edit_back(int const all_tracks);
void edit_resize(int const all_tracks);
void edit_adjust_size(int amt,int ignore_event);
void edit_copy(int const cut);
void edit_paste(void);
void edit_select_all(void);
Expand Down
27 changes: 27 additions & 0 deletions Aodix/AodixCoreEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,33 @@ void CAodixCore::edit_resize(int const all_tracks)
SetCursor(hcursor_arro);
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CAodixCore::edit_adjust_size(int const amt,int const ignore_event)
{
// get block length
int const user_block_pos_len=user_block_pos_end-user_block_pos_sta;
int const user_block_trk_len=user_block_trk_end-user_block_trk_sta;

// range selected
if(user_block_pos_len>0 && user_block_trk_len>0)
{
// scan sequencer events
for(int e=0; e<seq_num_events;e++)
{
// get event pointer
ADX_EVENT* pe=&seq_event[e];

// check if event is in block range and resizable
if(e!=ignore_event && pe->pat==user_pat && pe->pos>=user_block_pos_sta && pe->pos<user_block_pos_end
&& pe->trk>=user_block_trk_sta && pe->trk<user_block_trk_end && pe->szd)
{
// resize event
pe->par=arg_tool_clipped_assign(pe->par+amt,0,MAX_SIGNED_INT);
}
}
}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CAodixCore::edit_copy(int const cut)
{
Expand Down
5 changes: 5 additions & 0 deletions Aodix/AodixCoreGuiMouseMove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,13 @@ void CAodixCore::gui_mouse_move(HWND const hwnd)
ADX_EVENT* pe=&seq_event[user_event_drag];

// set new event duration
int old_size=pe->par;
pe->par=arg_tool_clipped_assign((ym_seq_pos+user_drag_offset)-pe->pos,0,MAX_SIGNED_INT);

// resize all events in selection
if(GetKeyState(VK_SHIFT)<0)
edit_adjust_size(pe->par-old_size,user_event_drag);

// scroll iterate
gui_scroll_iterate(hwnd,ym,seq_area_y,h);

Expand Down

0 comments on commit a62283a

Please sign in to comment.