Changeset 1561


Ignore:
Timestamp:
05/19/21 09:01:33 (3 years ago)
Author:
davidb
Message:

A set of changes that spans three things: beat detection, time stretching; and a debug class motivated by the need to look at a canvas redraw issue most notable when a waveform widget is playing

Location:
trunk/src/org
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/apollo/audio/util/SoundDesk.java

    r1434 r1561  
    747747               
    748748                // Create the (new) track sequence to associate the mix with
     749                // **** Look for TimeStretchFactor
     750                // **** Apply 'factor' to generate new version of Audio (WAV file??)
     751                // **** Feed to audio bytes from that into a TrackSequence
     752               
    749753                TrackSequence ts = new TrackSequence(
    750754                                tmodel.getAllAudioBytes(),
  • trunk/src/org/apollo/gui/PlaybackControlPopup.java

    r1102 r1561  
    3939        public JToggleButton muteButton;
    4040        public JToggleButton soloButton;
     41        public JToggleButton beatDetectButton;
    4142        public JButton miscButton;
    4243        public JSlider volumeSlider;
     
    100101                });
    101102               
     103                beatDetectButton = new JToggleButton();
     104                SwingMiscManager.setJButtonIcon(beatDetectButton,IconRepository.getIcon("beatDetect.png"));
     105                SwingMiscManager.setJButtonSelectedIcon(beatDetectButton,IconRepository.getIcon("beatDetect-no-sticks.png"));
     106                beatDetectButton.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
     107                beatDetectButton.setToolTipText("Toggle beat detection in track");
     108
     109                beatDetectButton.addChangeListener(new ChangeListener() {
     110                        public void stateChanged(ChangeEvent e) {
     111                                if (!PlaybackControlPopup.this.isUpdatingGUI) {
     112                                        beatDetectChanged();
     113                                }
     114                        }
     115                });
     116
    102117                miscButton = new JButton();
    103118                miscButton.addActionListener(this);
     
    155170                c.gridy = 0;
    156171                c.fill = GridBagConstraints.BOTH;
     172                panel.add(beatDetectButton, c);
     173               
     174                c = new GridBagConstraints();
     175                c.gridx = 6;
     176                c.gridy = 0;
     177                c.fill = GridBagConstraints.BOTH;
    157178                c.insets = new Insets(0,VOLUME_SPACING,0,VOLUME_SPACING);
    158179                panel.add(volumeSlider, c);
    159180               
    160181                c = new GridBagConstraints();
    161                 c.gridx = 7;
     182                c.gridx = 8;
    162183                c.gridy = 0;
    163184                c.fill = GridBagConstraints.BOTH;
     
    211232//              this.setSize(BUTTON_SIZE * 4, BUTTON_SIZE * 2);
    212233               
    213                 panel.setSize(BUTTON_SIZE * 8, BUTTON_SIZE);
     234                panel.setSize(BUTTON_SIZE * 9, BUTTON_SIZE);
    214235               
    215236                panel.doLayout();
     
    270291        protected abstract void soloChanged();
    271292       
     293        protected abstract void beatDetectChanged();
     294
    272295       
    273296        /**
  • trunk/src/org/apollo/gui/SampledTrackGraphView.java

    r1102 r1561  
    7070        private int timescaleFrameLength = 0; // in frames
    7171       
     72        private double timeStretchFactor = 1.0;
     73       
    7274        private final Font RENDER_MESSAGE_FONT = new Font("Arial", Font.BOLD | Font.ITALIC, 14);
    7375       
     
    8082        private Color backColorHighlights = DEFAULT_BACKGROUND_HIGHTLIGHTS_COLOR;
    8183       
    82         public static final Color PLAYBACK_BAR_COLOR = new Color(225, 187, 15);
     84        public static final Color PLAYBACK_BAR_COLOR = new Color(225, 187, 15); // ******
    8385       
    8486        /** The stroke used for drawing graph bars. E.G: The selection Start bar. */
     
    546548        }
    547549       
     550       
     551        public void setTimeStretchFactor(double time_stretch_factor) {
     552                timeStretchFactor = time_stretch_factor;
     553        }
     554       
     555        public double getTimeStretchFactor()
     556        {
     557                return timeStretchFactor;
     558        }
     559
    548560        /**
    549561         * Re-renders the waveform buffers to match the graph size if it needs to.
     
    623635                                trackModel.getAllAudioBytes(),
    624636                                trackModel.getFormat(),
     637                                trackModel.getBeats(),
    625638                                timescaleFrameStart,
    626639                                timescaleFrameLength,
     
    743756                       
    744757                        int x = getPlaybackXPos(currentPlaybackFramePosition);
     758                        //System.out.println("*** playback x = " + x);
     759                       
     760                        x = (int)Math.rint(((double)x) * getTimeStretchFactor()); // ******
    745761                       
    746762                        if (x >= 0 && x <= getWidth()) {
    747                                
     763                                       
    748764                                ((Graphics2D)g).setStroke(GRAPH_BAR_STROKE);
    749765                                g.setColor(PLAYBACK_BAR_COLOR);
  • trunk/src/org/apollo/gui/WaveFormRenderProccessingUnit.java

    r1146 r1561  
    33import java.awt.Graphics2D;
    44import java.util.LinkedList;
     5import java.util.List;
    56
    67import javax.sound.sampled.AudioFormat;
     
    269270                                                        for (int i = 0; i < amps.length; i+=2) {
    270271                                                               
     272                                                                g.setColor(SwingConversions.toSwingColor(ApolloColorIndexedModels.WAVEFORM_COLOR));
     273                                                               
    271274                                                                float peak = amps[i];
    272275                                                                float trough = amps[i + 1];
     
    293296                                                                }
    294297                                                               
     298                                                                int frameSize = 4;
     299                                                                int bi_start = (currentTask.startFrame + renderStart);
     300                                                                int bi_end = bi_start + (renderLength);
     301
     302                                                                for (int bi = bi_start; bi<bi_end; bi++) {
     303                                                                        if (currentTask.frameIsBeat[bi]) {
     304                                                                                g.setColor(SwingConversions.toSwingColor(ApolloColorIndexedModels.WAVEFORM_SELECTION_COLOR));
     305                                                                                g.drawLine(x, halfMaxHeight, x, -halfMaxHeight);
     306                                                                                break;
     307                                                                        }
     308                                                                }
     309
    295310                                                                currentAmplitude ++;
    296311                                                        }
     
    303318                                } // next pass
    304319                               
    305                                 // Lession learnt: do not request lots of requests to repaint
    306                                 // later on the AWT Event queu otherwise it will get congested
     320                                // Lesson learnt: do not request lots of requests to repaint
     321                                // later on the AWT Event queue otherwise it will get congested
    307322                                // and will freeze up the interact for annoying periods of time.
    308323                                currentTask.setState(WaveFormRenderTask.STATE_STOPPED);
     
    348363                private Image imageBuffer; // nullified when stopped.
    349364                private byte[] audioBytes; // nullified when stopped. - Arrays (not contents) are immutable so no need to worry about threading issues with indexes
     365                private boolean[] frameIsBeat;
     366               
    350367                private final int startFrame;
    351368                private final int frameLength; // in frames
     
    357374                                byte[] audioBytes,
    358375                                AudioFormat format,
     376                                List<Double> detectedBeats,
    359377                                int startFrame,
    360378                                int frameLength,
     
    371389                        this.frameLength = frameLength;
    372390                        this.recommendInvalidations = recommendInvalidations;
     391                                               
     392                        this.frameIsBeat = new boolean[frameLength];
     393                        if (detectedBeats != null) {
     394                                for (double beat_in_secs: detectedBeats){
     395                                        int frame_pos = (int)Math.round(beat_in_secs * format.getSampleRate());
     396                                        frameIsBeat[frame_pos] = true;
     397                                }
     398                        }
     399
    373400                        renderer = new DualPeakTroughWaveFormRenderer(format);
    374401                }
     
    384411                        if (state == STATE_STOPPED) {
    385412                                audioBytes = null;
     413                                frameIsBeat = null;
    386414                                imageBuffer = null;
    387415                        }
  • trunk/src/org/apollo/widgets/LinkedTrack.java

    r1142 r1561  
    15041504        {
    15051505                public PlaybackPopup() {
     1506                        super();
     1507                       
    15061508                        miscButton.setActionCommand("goto");
    15071509                        SwingMiscManager.setJButtonIcon(miscButton, IconRepository.getIcon("goto.png"));
     
    15541556                }
    15551557
     1558                @Override
     1559                protected void beatDetectChanged() {
     1560
     1561                        System.err.println("*** Need to implement beat detection for linked tracks");
     1562                        /*boolean toggleDetectBeat = beatDetectButton.isSelected();
     1563
     1564                        updateData(TrackWidgetCommons.META_BEAT_DETECT_TAG, TrackWidgetCommons.META_BEAT_DETECT_TAG + toggleDetectBeat);
     1565
     1566                        if (toggleDetectBeat) {
     1567                                runDetectBeats();
     1568                                // cause refresh
     1569                        }*/
     1570                }
    15561571        }
    15571572
  • trunk/src/org/apollo/widgets/SampledTrack.java

    r1557 r1561  
    2727import javax.sound.sampled.LineUnavailableException;
    2828import javax.sound.sampled.UnsupportedAudioFileException;
     29import javax.swing.ButtonModel;
    2930import javax.swing.JSlider;
    3031import javax.swing.SwingUtilities;
     
    7273import org.expeditee.gio.swing.SwingConversions;
    7374import org.expeditee.gio.swing.SwingMiscManager;
     75import org.expeditee.gui.Browser;
    7476import org.expeditee.gui.DisplayController;
    7577import org.expeditee.gui.Frame;
    7678import org.expeditee.gui.FrameIO;
    7779import org.expeditee.gui.PopupManager;
     80import org.expeditee.gui.PopupManager.ExpandShrinkAnimator;
    7881import org.expeditee.gui.management.ResourceManager;
    7982import org.expeditee.items.ItemParentStateChangedEvent;
     
    101104import be.tarsos.dsp.io.jvm.WaveformWriter;
    102105
     106
     107
    103108/**
    104109 * The sampled track widgets in apollo.
     
    109114public class SampledTrack extends HeavyDutyInteractiveWidget implements TrackModelHandler, EffecientInvalidator, Observer {
    110115
    111         /** The observered subject. Can be null */
     116        /** The observed subject. Can be null */
     117        private SampledTrackModel unityTrackModel = null;
    112118        private SampledTrackModel trackModel = null;
    113119       
     
    144150       
    145151       
    146         /** If a track widget has a data string thaty contains META_SHOULD_INDEX_AUDIO_TAG, then
    147          * the track should not be indexed for searching the audio.... default isdoes not exist
     152        /** If a track widget has a data string that contains META_SHOULD_INDEX_AUDIO_TAG, then
     153         * the track should not be indexed for searching the audio.... default is that it does not exist
    148154         */
    149155        public static final String META_DONT_INDEX_AUDIO_TAG = "dontindexaudio";
     
    170176                                true);
    171177
     178                if (Browser.DEBUG) {
     179                        System.out.println("**** SampleTrack(source,audiobytes,format,mixTemplate): source="+ source);
     180                }               
    172181                // Must set upon construction - always
    173182                localFileName = AudioPathManager.generateLocateFileName("wav");
    174183                updateData(META_LOCALNAME_TAG, META_LOCALNAME_TAG + localFileName);
    175184               
    176                 trackModel = new SampledTrackModel(audioBytes, format, localFileName);
    177                
     185                unityTrackModel = new SampledTrackModel(audioBytes, format, localFileName);
     186                trackModel = unityTrackModel;
     187               
     188                boolean detectBeat = getStrippedDataBool(TrackWidgetCommons.META_BEAT_DETECT_TAG,false);
     189                if (detectBeat) {
     190                        runDetectBeats();
     191                }
     192
    178193                // Ensure that the model is marked as modified so that it will save
    179194                trackModel.setAudioModifiedFlag(true);
    180195               
    181196                trackModel.setName(getStrippedDataString(TrackWidgetCommons.META_NAME_TAG));
    182 
     197               
     198               
    183199                // Create the immutable mix subject
    184200                if (mixTemplate == null) {
     
    222238                                TrackWidgetCommons.CACHE_DEPTH);
    223239               
     240                if (Browser.DEBUG) {
     241                        System.out.println("**** SampleTrack(source,args): source=" + source);
     242                }
     243               
    224244                // Read the metadata
    225245                localFileName = getStrippedDataString(META_LOCALNAME_TAG);
     
    261281                }
    262282        }
     283
     284        private void runDetectBeats()
     285        {
     286                if (Browser.DEBUG) {
     287                        System.out.println("*** runDetectBeats()");
     288                }
     289                try {
     290                        // consider adding support for parameters from data statement
     291                        int size = 512;
     292                        int overlap = 256;
     293                        trackModel.detectBeats(size,overlap);
     294                }
     295                catch (Exception ex) {
     296                        ex.printStackTrace();
     297                }
     298        }
     299
    263300
    264301        private void createGUI() {
     
    281318               
    282319                shouldOmitAudioIndexing = containsDataTrimmedIgnoreCase(META_DONT_INDEX_AUDIO_TAG);
    283 
     320               
     321                boolean beatDetect=getStrippedDataBool(TrackWidgetCommons.META_BEAT_DETECT_TAG,false);
     322                               
    284323                playbackControlPopup = new PlaybackPopup();
     324                playbackControlPopup.beatDetectButton.setSelected(beatDetect);
    285325               
    286326                fulltrackView = (EditableSampledTrackGraphView)_swingComponent;
     
    317357                                if (playbackControlPopup == null) {
    318358                                        playbackControlPopup = new PlaybackPopup();
     359                                                       
    319360                                }
    320361
     
    329370                                       
    330371                                        // Determine where popup should show
    331                                         //int x = SampledTrack.this.getX();
     372                                        int x = SampledTrack.this.getX();
    332373                                        int y = SampledTrack.this.getY() - playbackControlPopup.getFullBounds().getHeight() - 2; // by default show above
    333374                                       
     
    340381                                                animationSource.y = y - 2;
    341382                                        }
    342 
     383                                        animationSource.x = x;
     384                                       
    343385                                        // Animate the popup
    344386                                        playbackControlPopup.getAutoHideTime().setLifetime(TrackWidgetCommons.POPUP_LIFETIME);
    345387                                        PopupManager.getInstance().add(playbackControlPopup);
     388                                       
    346389                                        playbackControlPopup.show();
    347390                                } else {
     
    459502                                }
    460503                               
     504                                else if (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_S) {
     505                                        // Stop
     506                                        TrackSequence ts = SoundDesk.getInstance().getTrackSequence(trackMix.getChannelID());
     507
     508                                        // reset any paused mark
     509                                        SoundDesk.getInstance().setPaused(trackMix.getChannelID(), false);
     510
     511                                        if (ts != null &&
     512                                                        ts.isPlaying()) {
     513                                                // Stop playback
     514                                                ApolloPlaybackMixer.getInstance().stop(ts);
     515                                        }
     516
     517                                } else if (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_R) {
     518                                        // rewind
     519
     520                                        trackModel.setSelection(0, 0);
     521                                        SoundDesk.getInstance().setPaused(trackMix.getChannelID(), false);
     522                                }
     523                                else if (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_B) {
     524
     525                                        boolean detectBeat = getStrippedDataBool(TrackWidgetCommons.META_BEAT_DETECT_TAG,false);
     526                                        boolean toggleDetectBeat = (detectBeat) ? false : true;
     527
     528                                        updateData(TrackWidgetCommons.META_BEAT_DETECT_TAG, TrackWidgetCommons.META_BEAT_DETECT_TAG + toggleDetectBeat);
     529
     530                                        if (toggleDetectBeat) {
     531                                                runDetectBeats();
     532                                        }
     533                                }                       
    461534                                // Toggle pitch-track indexing
    462535                                else if (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_I) {
     
    753826                data.add(TrackWidgetCommons.META_RUNNINGMSTIME_TAG + getRunningMSTimeFromRawAudio());
    754827
     828                boolean beatDetect=getStrippedDataBool(TrackWidgetCommons.META_BEAT_DETECT_TAG,false);
     829                if (beatDetect) {
     830                        data.add(TrackWidgetCommons.META_BEAT_DETECT_TAG + "true");
     831                }
     832
    755833                return data;
    756834        }
     
    844922                        try {
    845923                               
    846                                 trackModel = TrackModelLoadManager.getInstance().load(f.getPath(), localFileName, this, false);
     924                                unityTrackModel = TrackModelLoadManager.getInstance().load(f.getPath(), localFileName, this, false);
     925                                trackModel = unityTrackModel;
    847926                               
    848927                                if (trackModel == null) { // load operation canceled
     
    850929                                        return LOAD_STATE_INCOMPLETED;
    851930                                       
    852                                 } else if(isImporting) { // ensure that file path is null - since not yet saved
     931                                } else if (isImporting) { // ensure that file path is null - since not yet saved
    853932                                        trackModel.setFilepath(null);
    854933                                       
     
    889968                }
    890969               
     970                boolean beatDetect = getStrippedDataBool(TrackWidgetCommons.META_BEAT_DETECT_TAG, false);
     971                if (beatDetect) {
     972                        runDetectBeats();
     973                }
     974
    891975                initObservers(); // sets default name if non set
    892976               
     
    913997                                        if (tinf == null) {
    914998
    915                                                 // Determine new initation time according to position
     999                                                // Determine new initiation time according to position
    9161000                                                long initTime = (parent != null) ?
    9171001                                                                FrameLayoutDaemon.getInstance().getMSAtX(getX(), parent)
    9181002                                                                : 0;
    9191003
    920                                                 // Keep TrackGraphModel consistant
     1004                                                // Keep TrackGraphModel consistent
    9211005                                                AudioStructureModel.getInstance().onTrackWidgetAnchored(
    9221006                                                                localFileName,
     
    9381022               
    9391023                // Notify layout manager - not really needed but to be extra safe force the daemon
    940                 // to be super consistant
     1024                // to be super consistent
    9411025                FrameLayoutDaemon.getInstance().forceRecheck();
    9421026
     
    11441228        /**
    11451229         * To be called by the swing thread only
    1146          * This is nessessary to avoid runtime memory leaks!!
     1230         * This is necessary to avoid runtime memory leaks!!
    11471231         */
    11481232        private void releaseMemory(boolean onlyIfExpired) {
     
    13211405                                        parent = getParentFrame();
    13221406                                       
    1323                                         // Keep TrackGraphModel consistant
     1407                                        // Keep TrackGraphModel consistent
    13241408                                        AudioStructureModel.getInstance().onTrackWidgetAudioEdited(
    13251409                                                        localFileName,
     
    17491833         * @return
    17501834         *              The initiation time or this track in MS.
    1751          *              null if unavilable.
     1835         *              null if unavailable.
    17521836         */
    17531837        public Mutable.Long getInitiationTimeFromMeta() {
     
    20262110                public PlaybackPopup()
    20272111                {
     2112                        super();
     2113                       
    20282114                        miscButton.setActionCommand("expand");
    20292115                        SwingMiscManager.setJButtonIcon(miscButton, IconRepository.getIcon("expand.png"));
     
    20442130                public void onShow()
    20452131                {
     2132                        // Make sure the popup is in the most up to date position,
     2133                        // relative to the SampledTrack
     2134                        ExpandShrinkAnimator es_animator = (ExpandShrinkAnimator)this.getAnimator();
     2135                       
     2136                        int pcp_x_dim = this.getFullBounds().getWidth();
     2137                        int pcp_y_dim = this.getFullBounds().getHeight();
     2138                       
     2139                        int pcp_x_org = SampledTrack.this.getX();
     2140                        int pcp_y_org = SampledTrack.this.getY() - pcp_y_dim - 2; // by default show above
     2141                       
     2142                        if (pcp_y_org < 0) {
     2143                                // if doesn't fit above, show below
     2144                                pcp_y_org = SampledTrack.this.getY() + SampledTrack.this.getHeight() + 2;
     2145                        }
     2146                       
     2147                        AxisAlignedBoxBounds initial_bounds = new AxisAlignedBoxBounds(pcp_x_org,pcp_y_org,pcp_x_dim,pcp_y_dim);
     2148                       
     2149                        es_animator.setInitialBounds(initial_bounds);
     2150                       
    20462151                        // Listen for volume or mute changed events
    20472152                        trackMix.addObserver(this);
     
    20882193                                SoundDesk.getInstance().setPaused(trackMix.getChannelID(), false);
    20892194                               
    2090                         } else if (e.getSource() == miscButton) {
     2195                        }       
     2196                        else if (e.getSource() == beatDetectButton) {
     2197
     2198                                boolean detectBeat = getStrippedDataBool(TrackWidgetCommons.META_BEAT_DETECT_TAG,false);
     2199                                boolean toggleDetectBeat = (detectBeat) ? false : true;
     2200
     2201                                updateData(TrackWidgetCommons.META_BEAT_DETECT_TAG, TrackWidgetCommons.META_BEAT_DETECT_TAG + toggleDetectBeat);
     2202
     2203                                if (toggleDetectBeat) {
     2204                                        runDetectBeats();
     2205                                }
     2206                        }
     2207                        else if (e.getSource() == miscButton) {
    20912208                                expand(false);
    20922209                        }
     
    22862403                                                        if (stretched_track_model != null) {
    22872404                                                                trackModel = stretched_track_model;
     2405                                                                fulltrackView.setTimeStretchFactor(time_stretch);
    22882406                                                        }
    22892407                                                }
     2408                                                else {
     2409                                                        double prev_time_stretch_factor = fulltrackView.getTimeStretchFactor();
     2410                                                        if (prev_time_stretch_factor != 1.0) {
     2411                                                                trackModel = unityTrackModel;
     2412                                                                fulltrackView.setTimeStretchFactor(1.0);
     2413                                                        }
     2414                                                }
     2415                                        }
     2416                                        else {
     2417                                                trackModel = unityTrackModel;
     2418                                                fulltrackView.setTimeStretchFactor(1.0);
    22902419                                        }
    22912420                                       
     
    24322561                                        );
    24332562                }
     2563               
     2564               
     2565                @Override
     2566                protected void beatDetectChanged() {
     2567
     2568                        ButtonModel buttonModel = beatDetectButton.getModel();
     2569                        boolean isSelected = buttonModel.isSelected();
     2570                        boolean isPressed  = buttonModel.isPressed();
     2571
     2572                        if (Browser.DEBUG) {
     2573                                System.out.println("**** isPressed=" + isPressed + ", isSelected=" + isSelected);
     2574                        }
     2575                       
     2576                        if (isPressed) {
     2577
     2578                                boolean newBeatDetectState = isSelected;
     2579                                boolean curBeatDetectState = getStrippedDataBool(TrackWidgetCommons.META_BEAT_DETECT_TAG,false);
     2580
     2581                                if (Browser.DEBUG) {
     2582                                        System.out.println("**** curBeatDetectState=" + curBeatDetectState + ",  newBeatDetectState=" + newBeatDetectState);
     2583                                }
     2584                               
     2585                                if (newBeatDetectState != curBeatDetectState) {
     2586
     2587                                        // change of state has occurred
     2588                                        updateData(TrackWidgetCommons.META_BEAT_DETECT_TAG, TrackWidgetCommons.META_BEAT_DETECT_TAG + newBeatDetectState);
     2589
     2590                                        if (newBeatDetectState==true) {
     2591                                                runDetectBeats();
     2592                                        }
     2593                                        else {
     2594                                                trackModel.clearBeats();
     2595                                        }
     2596
     2597                                        EditableSampledTrackGraphView thisTrackView = (EditableSampledTrackGraphView)_swingComponent;
     2598                                        thisTrackView.releaseBuffer();
     2599                                        thisTrackView.updateBuffer();
     2600                                }
     2601                        }
     2602                }
    24342603        }
    24352604
  • trunk/src/org/apollo/widgets/TrackWidgetCommons.java

    r1102 r1561  
    1717        public static final String META_LAST_WIDTH_TAG = "lw=";
    1818        public static final String META_OMIT_LAYOUT_TAG = "dontlayout";
     19        public static final String META_BEAT_DETECT_TAG="beatDetect=";
     20
    1921       
    2022        public static final int CACHE_DEPTH = 1;
  • trunk/src/org/expeditee/gio/swing/MouseEventRouter.java

    r1187 r1561  
    176176        private void routeMouseEvent(MouseEvent e) {
    177177                _currentMouseEvent = e;
    178 
     178               
    179179                // First convert the point to expeditee space
    180180                Point containerPoint = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), _contentPane);
     
    218218                        // whether an expeditee item is currently picked up
    219219                        boolean forwardToExpeditee = false;
    220                         boolean isOverPopup = PopupManager.getInstance()
    221                                         .isPointOverPopup(SwingConversions.fromSwingPoint(containerPoint));
     220                        boolean isOverPopup = PopupManager.getInstance().isPointOverPopup(SwingConversions.fromSwingPoint(containerPoint));
     221                       
    222222                        if (isOverPopup) {
    223223                                // Popups have highest preference
  • trunk/src/org/expeditee/gui/Browser.java

    r1552 r1561  
    144144public class Browser implements SaveStateChangedEventListener {
    145145       
    146         public static final boolean DEBUG = true;
     146        public static final boolean DEBUG = false;
    147147       
    148148        public static final Ecosystem ECOSYSTEM_TYPE = Ecosystem.Swing;
  • trunk/src/org/expeditee/gui/FrameGraphics.java

    r1553 r1561  
    5353        private static Item _lastToolTippedItem = null;
    5454       
    55         private static HashSet<Item> itemsPaintedRecently = new HashSet<Item>();
     55        private static HashSet<Item> _itemsPaintedRecently = null;
    5656
    5757        /** Static-only class. */
     
    111111        public static void paintFrame(Frame toPaint, boolean isActualFrame, boolean createVolitile)     {
    112112               
    113                 Browser.debugMessage("FrameGraphics", "paintFrame", "Debug Job: Trying to detect Items being painted multiple times");
    114                 itemsPaintedRecently = new HashSet<Item>();
    115                
     113                if (Browser.DEBUG) {
     114                        Browser.debugMessage("FrameGraphics", "paintFrame", "Debug Job: Trying to detect Items being painted multiple times");
     115                        _itemsPaintedRecently = new HashSet<Item>();
     116                }       
    116117               
    117118                Clip clip = EcosystemManager.getGraphicsManager().peekClip();
     
    467468                        i.paint();
    468469                       
    469                         if (itemsPaintedRecently.contains(i)) {
    470                                 Browser.debugMessage("FrameGraphics", "PaintItem", "Repaining Item Between Clears: " + i);
    471                         } else {
    472                                 itemsPaintedRecently.add(i);
     470                        if (Browser.DEBUG) {
     471                                if (_itemsPaintedRecently.contains(i)) {
     472                                        Browser.debugMessage("FrameGraphics", "PaintItem", "Repaining Item Between Clears: " + i);
     473                                } else {
     474                                        _itemsPaintedRecently.add(i);
     475                                }
    473476                        }
    474477                }
  • trunk/src/org/expeditee/gui/FrameIO.java

    r1540 r1561  
    952952                                while ((titleItem.getSize() > Text.MINIMUM_FONT_SIZE) && title_item_xr > frame_name_xl) {
    953953                                        titleItem.setSize(titleItem.getSize() - 1);
    954                                         System.err.println("**** shrunk titleItem: " + titleItem + " to font size: " + titleItem.getSize());
     954                                        if (Browser.DEBUG) {
     955                                                System.err.println("**** shrunk titleItem: " + titleItem + " to font size: " + titleItem.getSize());
     956                                        }
    955957                                }
    956958                        } else {
     
    12061208                        boolean versionConflict = savedVersion > toSave.getVersion() && !isBayFrameset;
    12071209                       
    1208                         System.err.println("FrameIO::SaveFrame::Checking for conflicts for frame:" + toSave.getName());
     1210                        if (Browser.DEBUG) {
     1211                                System.err.println("FrameIO::SaveFrame::Checking for conflicts for frame:" + toSave.getName());
     1212                        }
    12091213                       
    12101214                        if ((fileModifyConflict || versionConflict) && savedVersion > 0) {
  • trunk/src/org/expeditee/gui/FrameMouseActions.java

    r1102 r1561  
    17121712        public void mouseDragged(MouseEvent e) {
    17131713                _lastMouseDragged = e;
    1714                 // System.out.println("MouseDragged");
     1714                //System.out.println("MouseDragged");
    17151715
    17161716                // Stop the longDepress mouse timer if the user drags above a threshold
  • trunk/src/org/expeditee/gui/PopupManager.java

    r1175 r1561  
    118118                synchronized(_popups) {
    119119                        for (Popup popup : _popups) {
    120                                 if (popup.getBounds().contains(p)) {
    121                                         return true;
     120                                if (popup.getBounds().contains(p) && popup.isShowing()) {
     121                                                return true;
    122122                                }
    123123                        }
     
    199199        public void paint()
    200200        {
    201                 //Bryce: popups temporarly disabled due to them not working and interfering in things.
    202 //              synchronized (_popups) {
    203 //                      for (Popup popup : _popups) {
    204 //                              popup.update();
    205 //                              popup.paint();
    206 //                      }
    207 //              }
     201                /*
     202                if (Browser.DEBUG) {
     203                        System.out.println("**** PopupManger::paint() -- num popups in arraylist: " + _popups.size());
     204                }
     205                */
     206               
     207                //Bryce: popups temporarily disabled due to them not working and interfering in things.
     208                //David: block of code now reintroduced: still some issue but working through them.
     209               
     210                synchronized (_popups) {
     211                        for (Popup popup : _popups) {
     212                                popup.update();
     213                                popup.paint();
     214                        }
     215                }
     216               
    208217        }
    209218       
     
    252261                        }
    253262                       
     263                        if (Browser.DEBUG) {
     264                                System.out.println("*** PopupManager::upate() updating animationCurrentTime: " + currentTime);
     265                        }
    254266                        _animationCurrentTime = currentTime;
    255267                       
     
    353365                                setInitialBounds(fullBounds.clone());
    354366                                _initialBounds.getTopLeft().setY(_initialBounds.getTopLeft().getY() + _initialBounds.getSize().height);
     367                                //System.out.println("**** PopupManager::getAnimateBounds() forcing height to be fullBoundsHeight: ");
    355368                                _initialBounds.getSize().height = 0;
     369                                //_initialBounds.getSize().height = fullBounds.getHeight(); // used to be 0
    356370                        }
    357371                       
     
    360374                                percentShown = 1 - percentShown;
    361375                        }
    362                        
     376                        if (Browser.DEBUG) {
     377                                System.out.println("Percentage = " + percentShown + " " + fullBounds);
     378                        }
    363379                        return AxisAlignedBoxBounds.lerp(_initialBounds, fullBounds, percentShown);
    364380                }
  • trunk/src/org/expeditee/items/Text.java

    r1527 r1561  
    24692469                        int model_frame_name_x = modelFrame.getNameItem().getX();
    24702470                        if (model_frame_name_x < DisplayController.MINIMUM_FRAME_WIDTH) {
    2471                                 System.err.println("**** Text::resetTitlePostion(): value to be used as right margin from position of frameName < 512");
    2472                                 System.err.println("  Overriding to ensure reasonable width for title");
     2471                                if (org.expeditee.gui.Browser.DEBUG) {
     2472                                        System.err.println("**** Text::resetTitlePostion(): value to be used as right margin from position of frameName < 512");
     2473                                        System.err.println("  Overriding to ensure reasonable width for title");
     2474                                }
    24732475                                model_frame_name_x = DisplayController.MINIMUM_FRAME_WIDTH;
    24742476                        }
  • trunk/src/org/expeditee/items/widgets/SwingWidget.java

    r1511 r1561  
    1515
    1616import javax.swing.JComponent;
     17import javax.swing.JPopupMenu;
    1718
    1819import org.expeditee.core.bounds.AxisAlignedBoxBounds;
  • trunk/src/org/expeditee/items/widgets/Widget.java

    r1525 r1561  
    11171117                        case ItemParentStateChangedEvent.EVENT_TYPE_ADDED:
    11181118                        case ItemParentStateChangedEvent.EVENT_TYPE_ADDED_VIA_OVERLAY:
    1119                                 System.err.println("Widget::onParentStateChanged: Added but not yet shown widget.");
     1119                                if (org.expeditee.gui.Browser.DEBUG) {
     1120                                        System.err.println("Widget::onParentStateChanged: Added but not yet shown widget.");
     1121                                }
    11201122                                break;
    11211123                        case ItemParentStateChangedEvent.EVENT_TYPE_SHOWN:
    11221124                        case ItemParentStateChangedEvent.EVENT_TYPE_SHOWN_VIA_OVERLAY:
    1123                                 System.err.println("Widget::onParentStateChanged: Shown widget.");
     1125                                if (org.expeditee.gui.Browser.DEBUG) {
     1126                                        System.err.println("Widget::onParentStateChanged: Shown widget.");
     1127                                }
    11241128                                EcosystemManager.addInteractiveWidget(this);
    11251129                                addWidgetContent(e);
Note: See TracChangeset for help on using the changeset viewer.