From f97b2830039d5217536a815e08b987c783501975 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sun, 11 May 2003 19:00:15 +0000 Subject: [PATCH] some restructuring.. --- MooGUI.java | 15 ++++++++++++--- MooView.java | 16 +++++++++++----- To Do.txt | 9 ++++++--- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/MooGUI.java b/MooGUI.java index ce67d69..7019828 100644 --- a/MooGUI.java +++ b/MooGUI.java @@ -39,7 +39,7 @@ public class MooGUI extends JFrame { pane.add(toolbar, BorderLayout.NORTH); // Adds main view. - view = new MooView(seq.getTracks()); + view = new MooView(seq); pane.add(view, BorderLayout.CENTER); // Adds status bar. @@ -81,7 +81,7 @@ public class MooGUI extends JFrame { */ public void setSequence(Sequence sequence) { seq = sequence; - view.update(seq.getTracks()); + view.setSequence(seq); } /** @@ -91,10 +91,19 @@ public class MooGUI extends JFrame { public void setStatus(String text) { statusBar.setText(text); } + + /** + * Update the view. + */ + public void update(){ + view.update(); + // Calls on the toolbar to update the progress indicator. + //toolbar.updateProgInd(); + } class MooGUICloser extends WindowAdapter { public void windowClosing(WindowEvent e) { Moosique.quit(); } } -} \ No newline at end of file +} diff --git a/MooView.java b/MooView.java index 620478c..4f36de3 100644 --- a/MooView.java +++ b/MooView.java @@ -18,10 +18,10 @@ public class MooView extends JScrollPane { /** * Creates the main view */ - public MooView(Track[] tracks) { + public MooView(Sequence seq) { super(VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED); + tracks = seq.getTracks(); - this.tracks = tracks; trackPanel = new JPanel(new GridLayout(1,3), true); createTrackViews(); @@ -42,11 +42,17 @@ public class MooView extends JScrollPane { trackPanel.validate(); } - public void update(Track[] tracks) { - this.tracks = tracks; + public void setSequence(Sequence seq) { + tracks = seq.getTracks(); createTrackViews(); } + public void update() { + // Calls on each track view to update itself. + for (int i = 0; i < trackViews.length; i++) { + //trackViews[i].update(); + } + } /** * Creates a view for the given track and adds it to the main view. * @param track the track for which to add a view @@ -62,4 +68,4 @@ public class MooView extends JScrollPane { public void removeTrackView(Track track) { } -} \ No newline at end of file +} diff --git a/To Do.txt b/To Do.txt index a43a560..73c80d9 100644 --- a/To Do.txt +++ b/To Do.txt @@ -14,15 +14,18 @@ VIKTIGT! Implementera playfunktionens beteende. N Moosique.getGUI().update(); } - i GUI: - Bör vara i MooView.. MooGUI bör bara ha en update som kör MooView's - updatefunktion.. + i View: public void update() { // Calls on each track view to update itself. for (int i = 0; i < trackViews.length; i++) { trackViews[i].update(); } + } + + i GUI: + public void update(){ + view.update(); // Calls on the toolbar to update the progress indicator. toolbar.updateProgInd(); } -- 2.39.2