Ignore:
Timestamp:
05/10/18 16:04:51 (6 years ago)
Author:
davidb
Message:

Reworking of the code-base to separate logic from graphics. This version of Expeditee now supports a JFX graphics as an alternative to SWING

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/apollo/audio/structure/AudioStructureModel.java

    r903 r1102  
    33import java.io.FileNotFoundException;
    44import java.io.IOException;
    5 import java.lang.reflect.InvocationTargetException;
    65import java.util.HashMap;
    76import java.util.HashSet;
     
    1413
    1514import javax.sound.sampled.UnsupportedAudioFileException;
    16 import javax.swing.SwingUtilities;
    1715
    1816import org.apollo.audio.ApolloSubjectChangedEvent;
     
    2725import org.apollo.widgets.SampledTrack;
    2826import org.apollo.widgets.TrackWidgetCommons;
    29 import org.expeditee.gui.DisplayIO;
     27import org.expeditee.core.BlockingRunnable;
     28import org.expeditee.gio.EcosystemManager;
     29import org.expeditee.gui.DisplayController;
    3030import org.expeditee.gui.Frame;
    31 import org.expeditee.gui.FrameGraphics;
    3231import org.expeditee.gui.FrameIO;
    33 import org.expeditee.settings.UserSettings;
    3432import org.expeditee.io.Conversion;
    3533import org.expeditee.items.ItemUtils;
    36 import org.expeditee.items.widgets.InteractiveWidget;
     34import org.expeditee.items.widgets.Widget;
    3735import org.expeditee.settings.folders.FolderSettings;
    3836
    3937/**
    40  * A thread safe model of the heirarchical structure of a track graph...
     38 * A thread safe model of the hierarchical structure of a track graph...
    4139 * abstracted from Expeditee frames and audio widgets.
    4240 *
    43  * The track widgets notifty this model for keeping the structure consistent with
    44  * expeditees data.
     41 * The track widgets notify this model for keeping the structure consistent with
     42 * Expeditee's data.
    4543 *
    4644 *
     
    199197                NewGraphCommitor commit = new NewGraphCommitor(rootODFrame, newGraph);
    200198                try {
    201                         SwingUtilities.invokeAndWait(commit);
    202                 } catch (InvocationTargetException e) {
     199                        EcosystemManager.getMiscManager().runOnGIOThread(commit);
     200                } catch (Exception e) {
    203201                        e.printStackTrace();
    204202                        assert(false);
     
    264262               
    265263                try {
    266                         SwingUtilities.invokeAndWait(cacheFetch);
    267                 } catch (InvocationTargetException e) {
     264                        EcosystemManager.getMiscManager().runOnGIOThread(cacheFetch);
     265                } catch (Exception e) {
    268266                        e.printStackTrace();
    269267                        assert(false);
     
    562560         *
    563561         */
    564         private class ExpediteeCachedTrackInfoFetcher implements Runnable
     562        private class ExpediteeCachedTrackInfoFetcher extends BlockingRunnable
    565563        {
    566564                private String rootFrameName;
     
    578576                }
    579577               
    580                 public void run()
     578                public void execute()
    581579                {
    582580                        assert(rootFrameName != null);
     
    584582                        // Check if the current frame
    585583                        Frame rootFrame = null;
    586                         if (DisplayIO.getCurrentFrame() != null && DisplayIO.getCurrentFrame().getName() != null
    587                                         && DisplayIO.getCurrentFrame().getName().equals(rootFrameName)) {
    588                                 rootFrame = DisplayIO.getCurrentFrame();
     584                        if (DisplayController.getCurrentFrame() != null && DisplayController.getCurrentFrame().getName() != null
     585                                        && DisplayController.getCurrentFrame().getName().equals(rootFrameName)) {
     586                                rootFrame = DisplayController.getCurrentFrame();
    589587                        } else {
    590588                                // Check if in cache
     
    597595                                linkedTracks =  new HashMap<String, LinkedTrackModelData>();
    598596                               
    599                                 for (InteractiveWidget iw : rootFrame.getInteractiveWidgets()) {
     597                                for (Widget iw : rootFrame.getInteractiveWidgets()) {
    600598                                       
    601599                                        if (iw instanceof SampledTrack) {
     
    668666         *
    669667         */
    670         private class NewGraphCommitor implements Runnable
     668        private class NewGraphCommitor extends BlockingRunnable
    671669        {
    672670                private final OverdubbedFrame rootODFrame;
     
    687685                }
    688686               
    689                 public void run()
     687                public void execute()
    690688                {
    691689                       
     
    10831081                synchronized(sharedResourceLocker) { // IMPORTANT: Must wait for new graphs to be added to the shared resources
    10841082
    1085                         if (FrameGraphics.isXRayMode()) { // discard whole model
     1083                        if (DisplayController.isXRayMode()) { // discard whole model
    10861084
    10871085                                // Neccessary because if the user goes into xray then moves to a new frame
     
    14221420
    14231421       
    1424                         if (FrameGraphics.isXRayMode()) { // discard whole model
     1422                        if (DisplayController.isXRayMode()) { // discard whole model
    14251423
    14261424                                // Neccessary because if the user goes into xray then moves to a new frame
     
    16101608                                               
    16111609                                                try {
    1612                                                         SwingUtilities.invokeAndWait(new Runnable() {
     1610                                                        EcosystemManager.getMiscManager().runOnGIOThread(new BlockingRunnable() {
    16131611                                                               
    1614                                                                 public void run() { // on swing thread
     1612                                                                public void execute() { // on swing thread
    16151613
    16161614                                                                        synchronized(sharedResourceLocker) {
     
    16721670                                                                }
    16731671                                                        });
    1674                                                 } catch (InvocationTargetException e) {
     1672                                                } catch (Exception e) {
    16751673                                                        e.printStackTrace();
    16761674                                                        assert(false);
Note: See TracChangeset for help on using the changeset viewer.