Ignore:
Timestamp:
10/05/08 14:30:01 (16 years ago)
Author:
bjn8
Message:

Improve mouse interactions a little with accurate audio placement

Location:
trunk/src_apollo/org/apollo/widgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src_apollo/org/apollo/widgets/LinkedTrack.java

    r343 r344  
    3131
    3232import org.apollo.ApolloSystem;
     33import org.apollo.AudioFrameMouseActions;
    3334import org.apollo.audio.ApolloSubjectChangedEvent;
    3435import org.apollo.audio.SampledAudioManager;
     
    5758import org.apollo.util.AudioMath;
    5859import org.apollo.util.AudioSystemLog;
     60import org.apollo.util.NullableLong;
    5961import org.apollo.util.ODFrameHeirarchyFetcher;
    6062import org.apollo.util.PopupReaper;
     
    645647                        String link = getAbsoluteLink();
    646648
    647                         // Determine new initation time according to anchored position
    648                         long initTime = (parent != null) ?
    649                                                 FrameLayoutDaemon.getInstance().getMSAtX(getX(), parent)
    650                                                 : 0;
     649
     650                        // Determine new initation time according to anchored position...
     651                        long initTime = getInitiationTimeFromMeta();
     652                       
     653                        // If the user is restricting-y-axis movement then they might be moving
     654                        // this tracks Y-position only for layout reasons as opposed to repositioning
     655                        // where in the audio timeline the track should be. This must be accurate and
     656                        // avoid loosing the exact initiation time due to pixel-resolutoin issues
     657                        if (parent != null) {
     658                               
     659                                boolean inferInitTime = true;
     660                               
     661                                if (AudioFrameMouseActions.isYAxisRestictionOn()) {
     662                                        Long ms = getInitiationTimeFromMeta();
     663                                        if (ms != null) {
     664                                                NullableLong timex = FrameLayoutDaemon.getInstance().getXAtMS(
     665                                                                ms,
     666                                                                parent);
     667                                                if (timex != null && timex.getLongValue() == getX()) {
     668                                                        initTime = ms;
     669                                                        inferInitTime = false;
     670                                                }
     671                                        }
     672                                }
     673
     674                                if (inferInitTime)
     675                                        initTime = FrameLayoutDaemon.getInstance().getMSAtX(getX(), parent);
     676                        }
    651677
    652678                        if (link != null) {
  • trunk/src_apollo/org/apollo/widgets/SampledTrack.java

    r342 r344  
    2828import javax.swing.SwingUtilities;
    2929
     30import org.apollo.AudioFrameMouseActions;
    3031import org.apollo.audio.ApolloPlaybackMixer;
    3132import org.apollo.audio.ApolloSubjectChangedEvent;
     
    5354import org.apollo.mvc.SubjectChangedEvent;
    5455import org.apollo.util.AudioMath;
     56import org.apollo.util.NullableLong;
    5557import org.apollo.util.PopupReaper;
    5658import org.apollo.util.TrackModelHandler;
     
    13611363                                        parent = getParentFrame();
    13621364
    1363                                         // Determine new initation time according to anchored position
    1364                                         long initTime = (parent != null) ?
    1365                                                         FrameLayoutDaemon.getInstance().getMSAtX(getX(), parent)
    1366                                                         : 0;
    1367                                        
     1365                                        // Determine new initation time according to anchored position...
     1366                                        long initTime = getInitiationTimeFromMeta();
     1367                                       
     1368                                        // If the user is restricting-y-axis movement then they might be moving
     1369                                        // this tracks Y-position only for layout reasons as opposed to repositioning
     1370                                        // where in the audio timeline the track should be. This must be accurate and
     1371                                        // avoid loosing the exact initiation time due to pixel-resolutoin issues
     1372                                        if (parent != null) {
     1373                                               
     1374                                                boolean inferInitTime = true;
     1375                                               
     1376                                                if (AudioFrameMouseActions.isYAxisRestictionOn()) {
     1377                                                        Long ms = getInitiationTimeFromMeta();
     1378                                                        if (ms != null) {
     1379                                                                NullableLong timex = FrameLayoutDaemon.getInstance().getXAtMS(
     1380                                                                                ms,
     1381                                                                                parent);
     1382                                                                if (timex != null && timex.getLongValue() == getX()) {
     1383                                                                        initTime = ms;
     1384                                                                        inferInitTime = false;
     1385                                                                }
     1386                                                        }
     1387                                                }
     1388
     1389                                                if (inferInitTime)
     1390                                                        initTime = FrameLayoutDaemon.getInstance().getMSAtX(getX(), parent);
     1391                                        }
     1392
    13681393                                        // Keep TrackGraphModel consistant
    13691394                                        AudioStructureModel.getInstance().onTrackWidgetAnchored(
Note: See TracChangeset for help on using the changeset viewer.