Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Hess <me@harkyman.com>2007-06-26 21:46:12 +0400
committerRoland Hess <me@harkyman.com>2007-06-26 21:46:12 +0400
commita7a5e5c6cba0b1ba7a8d696a290c661b1468b1d5 (patch)
tree4a2a205ce0786ddebdf8c2c640d9408cd964061c /source/blender/src/editseq.c
parent5bfefc68175d1f85bd2ef6719330fa152b53bc9e (diff)
Adds the following selection methods to the Sequence Editor:
Ctrl-RMB and Alt-RMB now call for different selection methods that are helpful when working within a single channel that holds several strips. The Ctrl modifier signals "Right" and the Alt modifier signals "Left". Ctrl-RMB clicking a strip will select that strips left handle and the adjacent handle of any strip that abuts it on the left, allowing you to move the boundary between the strips without changing their outer endpoints. Ctrl-RMB clicking again on that strip will add to the selection all strips to the left of it, allowing you to slide the entire set of strips out of the way for a new one. Alt-RMB works the same, but to the right. Ctrl-Alt-RMB on a strip selects the surrounding handles only, allowing you to move the targeted strip and have the surrounding two strips adjust to follow.
Diffstat (limited to 'source/blender/src/editseq.c')
-rw-r--r--source/blender/src/editseq.c179
1 files changed, 176 insertions, 3 deletions
diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c
index 968d1965ef4..cfc8ef6517d 100644
--- a/source/blender/src/editseq.c
+++ b/source/blender/src/editseq.c
@@ -201,6 +201,46 @@ int sequence_is_free_transformable(Sequence * seq)
|| (get_sequence_effect_num_inputs(seq->type) == 0);
}
+Sequence *find_neighboring_sequence(Sequence *test, int lr) {
+/* looks to the left on lr==1, to the right on lr==2 */
+ Sequence *seq,*foundneighbor;
+ int found=0;
+ Editing *ed;
+
+ ed= G.scene->ed;
+ if(ed==0) return 0;
+
+ seq= ed->seqbasep->first;
+ while(seq) {
+ if(seq!=test) {
+ if (test->machine==seq->machine) {
+ if(test->depth==seq->depth) {
+ switch (lr) {
+ case 1:
+ if (test->startdisp == (seq->enddisp)) {
+ foundneighbor=seq;
+ found=1;
+ }
+ break;
+ case 2:
+ if (test->enddisp == (seq->startdisp)) {
+ foundneighbor=seq;
+ found=1;
+ }
+ break;
+ }
+ }
+ }
+ }
+ seq= seq->next;
+ }
+ if (found==1) {
+ return foundneighbor;
+ } else {
+ return 0;
+ }
+}
+
Sequence *find_nearest_seq(int *hand)
{
Sequence *seq;
@@ -441,14 +481,100 @@ void swap_select_seq(void)
}
+void select_channel_direction(Sequence *test,int lr) {
+/* selects all strips in a channel to one direction of the passed strip */
+ Sequence *seq;
+ Editing *ed;
+
+ ed= G.scene->ed;
+ if(ed==0) return;
+
+ seq= ed->seqbasep->first;
+ while(seq) {
+ if(seq!=test) {
+ if (test->machine==seq->machine) {
+ if(test->depth==seq->depth) {
+ if (((lr==1)&&(test->startdisp > (seq->startdisp)))||((lr==2)&&(test->startdisp < (seq->startdisp)))) {
+ seq->flag |= SELECT;
+ recurs_sel_seq(seq);
+ }
+ }
+ }
+ }
+ seq= seq->next;
+ }
+ test->flag |= SELECT;
+ recurs_sel_seq(test);
+}
+
+void select_dir_from_last(int lr)
+{
+ Sequence *seq=get_last_seq();
+
+ if (seq) select_channel_direction(seq,lr);
+}
+
+void select_surrounding_handles(Sequence *test)
+{
+ Sequence *neighbor;
+
+ neighbor=find_neighboring_sequence(test, 1);
+ if (neighbor) {
+ neighbor->flag |= SELECT;
+ recurs_sel_seq(neighbor);
+ neighbor->flag |= SEQ_RIGHTSEL;
+ }
+ neighbor=find_neighboring_sequence(test, 2);
+ if (neighbor) {
+ neighbor->flag |= SELECT;
+ recurs_sel_seq(neighbor);
+ neighbor->flag |= SEQ_LEFTSEL;
+ }
+ test->flag |= SELECT;
+}
+
+void select_surround_from_last()
+{
+ Sequence *seq=get_last_seq();
+
+ if (seq) select_surrounding_handles(seq);
+}
+
+void select_neighbor_from_last(int lr)
+{
+ Sequence *seq=get_last_seq();
+ Sequence *neighbor;
+
+ if (seq) {
+ neighbor=find_neighboring_sequence(seq, lr);
+ if (neighbor) {
+ switch (lr) {
+ case 1:
+ neighbor->flag |= SELECT;
+ recurs_sel_seq(neighbor);
+ neighbor->flag |= SEQ_RIGHTSEL;
+ seq->flag |= SEQ_LEFTSEL;
+ break;
+ case 2:
+ neighbor->flag |= SELECT;
+ recurs_sel_seq(neighbor);
+ neighbor->flag |= SEQ_LEFTSEL;
+ seq->flag |= SEQ_RIGHTSEL;
+ break;
+ }
+ seq->flag |= SELECT;
+ }
+ }
+}
+
void mouse_select_seq(void)
{
- Sequence *seq;
- int hand;
+ Sequence *seq,*neighbor;
+ int hand,seldir;
seq= find_nearest_seq(&hand);
- if(!(G.qual & LR_SHIFTKEY)) deselect_all_seq();
+ if(!(G.qual & LR_SHIFTKEY)&&!(G.qual & LR_ALTKEY)&&!(G.qual & LR_CTRLKEY)) deselect_all_seq();
if(seq) {
set_last_seq(seq);
@@ -482,6 +608,53 @@ void mouse_select_seq(void)
if(hand==1) seq->flag |= SEQ_LEFTSEL;
if(hand==2) seq->flag |= SEQ_RIGHTSEL;
}
+
+ /* On Ctrl-Alt selection, select the strip and bordering handles */
+ if ((G.qual & LR_CTRLKEY) && (G.qual & LR_ALTKEY)) {
+ if (!(G.qual & LR_SHIFTKEY)) deselect_all_seq();
+ seq->flag |= SELECT;
+ select_surrounding_handles(seq);
+
+ /* Ctrl signals Left, Alt signals Right
+ First click selects adjacent handles on that side.
+ Second click selects all strips in that direction.
+ If there are no adjacent strips, it just selects all in that direction. */
+ } else if (((G.qual & LR_CTRLKEY) || (G.qual & LR_ALTKEY)) && (seq->flag & SELECT)) {
+
+ if (G.qual & LR_CTRLKEY) seldir=1;
+ else seldir=2;
+ neighbor=find_neighboring_sequence(seq, seldir);
+ if (neighbor) {
+ switch (seldir) {
+ case 1:
+ if ((seq->flag & SEQ_LEFTSEL)&&(neighbor->flag & SEQ_RIGHTSEL)) {
+ if (!(G.qual & LR_SHIFTKEY)) deselect_all_seq();
+ select_channel_direction(seq,1);
+ } else {
+ neighbor->flag |= SELECT;
+ recurs_sel_seq(neighbor);
+ neighbor->flag |= SEQ_RIGHTSEL;
+ seq->flag |= SEQ_LEFTSEL;
+ }
+ break;
+ case 2:
+ if ((seq->flag & SEQ_RIGHTSEL)&&(neighbor->flag & SEQ_LEFTSEL)) {
+ if (!(G.qual & LR_SHIFTKEY)) deselect_all_seq();
+ select_channel_direction(seq,2);
+ } else {
+ neighbor->flag |= SELECT;
+ recurs_sel_seq(neighbor);
+ neighbor->flag |= SEQ_LEFTSEL;
+ seq->flag |= SEQ_RIGHTSEL;
+ }
+ break;
+ }
+ } else {
+ if (!(G.qual & LR_SHIFTKEY)) deselect_all_seq();
+ select_channel_direction(seq,seldir);
+ }
+ }
+
recurs_sel_seq(seq);
}