- Timestamp:
- 10/02/19 14:19:48 (5 years ago)
- Location:
- trunk/src/org
- Files:
-
- 4 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/apollo/agents/MelodySearch.java
r1244 r1434 11 11 12 12 import org.apollo.ApolloSystem; 13 import org.apollo.io.AudioPathManager;14 13 import org.apollo.meldex.DynamicProgrammingAlgorithm; 15 14 import org.apollo.meldex.McNabMongeauSankoffAlgorithm; … … 28 27 import org.expeditee.gui.Frame; 29 28 import org.expeditee.gui.FrameIO; 30 import org.expeditee. settings.folders.FolderSettings;29 import org.expeditee.gui.management.ResourceManager; 31 30 import org.expeditee.items.Item; 32 31 import org.expeditee.items.ItemUtils; … … 34 33 import org.expeditee.items.widgets.WidgetCorner; 35 34 import org.expeditee.items.widgets.WidgetEdge; 35 import org.expeditee.settings.folders.FolderSettings; 36 36 37 37 /** … … 278 278 279 279 // Get cached melody from file if it is up to date 280 String metaFilePath = 281 AudioPathManager.AUDIO_HOME_DIRECTORY 282 + MELODY_METAFILE_PREFIX 283 + localFilename 284 + MELODY_METAFILE_SUFFIX; 285 286 File localFile = new File(AudioPathManager.AUDIO_HOME_DIRECTORY + localFilename); 280 String metaFileRelativePath = MELODY_METAFILE_PREFIX + localFilename + MELODY_METAFILE_SUFFIX; 281 String metaFilePath = ResourceManager.getAudioResource(metaFileRelativePath, DisplayController.getCurrentFrame()).getAbsolutePath(); 282 283 //File localFile = new File(AudioPathManager.AUDIO_HOME_DIRECTORY + localFilename); 284 File localFile = ResourceManager.getAudioResource(localFilename, DisplayController.getCurrentFrame()); 287 285 if (!localFile.exists()) continue; 288 286 -
trunk/src/org/apollo/audio/structure/AudioStructureModel.java
r1244 r1434 16 16 import org.apollo.audio.ApolloSubjectChangedEvent; 17 17 import org.apollo.io.AudioIO; 18 import org.apollo.io.AudioPathManager;19 18 import org.apollo.mvc.AbstractSubject; 20 19 import org.apollo.mvc.SubjectChangedEvent; … … 30 29 import org.expeditee.gui.Frame; 31 30 import org.expeditee.gui.FrameIO; 31 import org.expeditee.gui.management.ResourceManager; 32 32 import org.expeditee.io.Conversion; 33 33 import org.expeditee.items.ItemUtils; … … 433 433 try { 434 434 435 tmodel.runningTimeMS = AudioIO.getRunningTime(AudioPathManager.AUDIO_HOME_DIRECTORY + localFilename); 435 String localFilePath = ResourceManager.getAudioResource(localFilename, DisplayController.getCurrentFrame()).getAbsolutePath(); 436 tmodel.runningTimeMS = AudioIO.getRunningTime(localFilePath); 436 437 437 438 } catch (IOException e) { -
trunk/src/org/apollo/audio/util/MultiTrackPlaybackController.java
r1102 r1434 20 20 import org.apollo.audio.structure.TrackGraphLoopException; 21 21 import org.apollo.audio.structure.TrackGraphNode; 22 import org.apollo.io.AudioPathManager;23 22 import org.apollo.io.AudioIO.AudioFileLoader; 24 23 import org.apollo.mvc.AbstractSubject; … … 34 33 import org.expeditee.gui.DisplayController; 35 34 import org.expeditee.gui.DisplayObserver; 35 import org.expeditee.gui.management.ResourceManager; 36 36 37 37 public class MultiTrackPlaybackController … … 1004 1004 1005 1005 try { 1006 String filepath = ResourceManager.getAudioResource(absNode.getTrackNode().getLocalFilename(), DisplayController.getCurrentFrame()).getAbsolutePath(); 1006 1007 stm = TrackModelLoadManager.getInstance().load( 1007 AudioPathManager.AUDIO_HOME_DIRECTORY + absNode.getTrackNode().getLocalFilename(),1008 filepath, 1008 1009 absNode.getTrackNode().getLocalFilename(), 1009 1010 new Observer() { // opps, my confusing design pattern gone wrong! -
trunk/src/org/apollo/audio/util/SoundDesk.java
r375 r1434 71 71 72 72 /** Where the mixes are saved to. */ 73 private static final String MIX_BANKS_FILEPATH = AudioPathManager.AUDIO_ HOME_DIRECTORY + ".banks";74 75 private static final String MASTER_MIX_FILEPATH = AudioPathManager.AUDIO_ HOME_DIRECTORY + ".mastermix";73 private static final String MIX_BANKS_FILEPATH = AudioPathManager.AUDIO_USERNAME_HOME_DIRECTORY + ".banks"; 74 75 private static final String MASTER_MIX_FILEPATH = AudioPathManager.AUDIO_USERNAME_HOME_DIRECTORY + ".mastermix"; 76 76 77 77 private static final String NO_SOLO_PREFIX = "~#SOLOOFF#~"; -
trunk/src/org/apollo/gui/FrameLayoutDaemon.java
r1258 r1434 15 15 import org.apollo.audio.util.Timeline; 16 16 import org.apollo.io.AudioIO; 17 import org.apollo.io.AudioPathManager;18 17 import org.apollo.mvc.AbstractSubject; 19 18 import org.apollo.mvc.Observer; … … 32 31 import org.expeditee.gui.Frame; 33 32 import org.expeditee.gui.FreeItems; 33 import org.expeditee.gui.management.ResourceManager; 34 34 import org.expeditee.items.Item; 35 35 import org.expeditee.items.ItemUtils; … … 766 766 // so cann afford to hang the thread a little for checking the actual time... 767 767 if (runningTime <= 0) { 768 File f = new File(AudioPathManager.AUDIO_HOME_DIRECTORY + 769 sampledTrackWidget.getLocalFileName()); 768 //File f = new File(AudioPathManager.AUDIO_HOME_DIRECTORY + 769 // sampledTrackWidget.getLocalFileName()); 770 File f = ResourceManager.getAudioResource(sampledTrackWidget.getLocalFileName(), DisplayController.getCurrentFrame()); 770 771 if (f.exists()) { 771 772 try { -
trunk/src/org/apollo/io/AudioPathManager.java
r1327 r1434 7 7 import java.io.IOException; 8 8 import java.io.UnsupportedEncodingException; 9 import java.util.ArrayList; 10 import java.util.List; 9 11 import java.util.Random; 12 import java.util.function.Predicate; 10 13 11 14 import org.apollo.audio.structure.AudioStructureModel; 12 15 import org.apollo.util.ApolloSystemLog; 13 16 import org.apollo.util.RegExpFileFilter; 14 import org.expeditee. auth.AuthenticatorBrowser;17 import org.expeditee.gui.DisplayController; 15 18 import org.expeditee.gui.FrameIO; 19 import org.expeditee.gui.management.ResourceManager; 16 20 import org.expeditee.settings.UserSettings; 17 21 … … 29 33 30 34 /** Suffixed with the native file separator */ 31 public static String AUDIO_ HOME_DIRECTORY = null;35 public static String AUDIO_USERNAME_HOME_DIRECTORY = null; 32 36 33 37 /** Stores all virtual names created by this repository. */ … … 39 43 40 44 private static Random rand = new Random(System.currentTimeMillis()); 41 42 // **** DB 43 // Some work to be done here => remove dependency in code on 'AUDIO_HOME_DIRECTORY' 44 // and change it to use audio dir list from UserSettings 45 public static void changeParentAndSubFolders(String newFolder) { 46 47 if (AuthenticatorBrowser.isAuthenticationRequired() && System.getProperty("user.name").equals(AuthenticatorBrowser.USER_NOBODY)) { 48 System.err.println("**** AudioPathManager::changeParentAndSubFolder(): Nothing to do for user '" + AuthenticatorBrowser.USER_NOBODY + "'"); 49 return; 50 } 51 52 if (UserSettings.PublicAndPrivateResources) { 53 //String resourcesPublicPath = FrameIO.PARENT_FOLDER + "resources-public" + File.separator; 54 String userName = UserSettings.UserName.get(); 55 //String resourcesPrivateIndividualPath = FrameIO.PARENT_FOLDER + "resources-" + userName + File.separator; 56 if (AuthenticatorBrowser.isAuthenticationRequired()) { 57 System.err.println("**** AudioPathManager::changeParentAndSubFolder(): Setting 'audio' folder to resources-" + userName); 58 } 59 //AUDIO_HOME_DIRECTORY = resourcesPrivateIndividualPath + "audio" + File.separatorChar; 60 AUDIO_HOME_DIRECTORY = FrameIO.AUDIO_PRIVATE_PATH; 61 } 62 else { 63 AUDIO_HOME_DIRECTORY = FrameIO.PARENT_FOLDER + "audio" + File.separatorChar;; 64 } 65 } 66 67 public static void activateAndScanAudioDir() 68 { 69 changeParentAndSubFolders(FrameIO.PARENT_FOLDER); 70 71 // Ensure audio directory exists 72 File dir = new File(AUDIO_HOME_DIRECTORY); 73 if (!dir.exists()) { 74 if (!dir.mkdir()) { 75 ApolloSystemLog.println("Unable to create missing audio home directory"); 76 } 77 } 78 45 46 // TODO: this function called during startup? In browser construction? When FrameIO.changeParentAndSubFolders() is called? Separation of apollo from expeditee core? 47 public static void activateAndScanAudioDirs() { 48 // If we are in old regime then there is no AUDIO_USERNAME_PRIVATE_PATH. 49 AUDIO_USERNAME_HOME_DIRECTORY = FrameIO.AUDIO_USERNAME_PRIVATE_PATH == null ? FrameIO.AUDIO_PATH : FrameIO.AUDIO_USERNAME_PRIVATE_PATH; 50 79 51 // Load counter 80 loadCounter(AUDIO_HOME_DIRECTORY); 81 } 82 52 loadCounter(); 53 } 83 54 84 55 /** 85 56 * Loads the counter 86 * @param dir The dir where the audio files live. 87 */ 88 private static void loadCounter(String audio_dir_str) { 89 File audio_dir = new File(audio_dir_str); 90 91 String[] files = getAudioFileNames(audio_dir); 92 if (files == null) { // Due to IO exception 93 ApolloSystemLog.printError("Failed to read audio directory"); 94 return; 95 } 57 */ 58 private static void loadCounter() { 59 List<String> audioFileNames = getAudioFileNames(); 60 96 61 long count = 0; 97 if (files != null) { 98 for (String f : files) { 99 100 int start = -1, end = -1; 101 for (int i = 0; i < f.length(); i++) { 102 if (Character.isDigit(f.charAt(i)) && start == -1) { 103 start = i; 104 } else if (!Character.isDigit(f.charAt(i)) && start != -1) { 105 end = i; 106 break; 107 } 108 } 109 110 if (start >= 0 && end == -1) { 111 end = f.length(); 112 } 113 114 if (start > 0 && end >= start) { // not start >= 0 since missing preable 115 116 String tmp = f.substring(start, end); 117 long l = Long.parseLong(tmp); 118 if (l >= count) 119 count = l + 1; 120 } 121 } 122 } 123 62 for (String f : audioFileNames) { 63 64 int start = -1, end = -1; 65 for (int i = 0; i < f.length(); i++) { 66 if (Character.isDigit(f.charAt(i)) && start == -1) { 67 start = i; 68 } else if (!Character.isDigit(f.charAt(i)) && start != -1) { 69 end = i; 70 break; 71 } 72 } 73 74 if (start >= 0 && end == -1) { 75 end = f.length(); 76 } 77 78 if (start > 0 && end >= start) { // not start >= 0 since missing preable 79 80 String tmp = f.substring(start, end); 81 long l = Long.parseLong(tmp); 82 if (l >= count) 83 count = l + 1; 84 } 85 } 124 86 counter = count; 125 }126 127 /**128 * @param dir129 * @return130 * Null if an IO exception occurs131 */132 private static String[] getAudioFileNames(File dir) {133 return dir.list(new RegExpFileFilter("^[A-Z]+\\d+.*$"));134 87 } 135 88 … … 140 93 * read list of files. 141 94 */ 142 public static String[] getAudioFileNames() { 143 File audioDir = new File(AUDIO_HOME_DIRECTORY); 144 if (!audioDir.exists() || !audioDir.isDirectory()) return null; 145 return getAudioFileNames(audioDir); 95 public static List<String> getAudioFileNames() { 96 Predicate<File> isFile = file -> { 97 File dirForFile = file.toPath().getParent().toFile(); 98 if (!dirForFile.exists()) { 99 if (!dirForFile.mkdir()) { 100 ApolloSystemLog.println("Unable to create missing audio directory: " + dirForFile.toString()); 101 } 102 } 103 if (file.isFile()) { 104 return true; 105 } 106 return false; 107 }; 108 List<File> allFilesInAudioDirectories = ResourceManager.gatherAudioResources(isFile, DisplayController.getCurrentFrame()); 109 List<String> audioFileNames = new ArrayList<String>(); 110 RegExpFileFilter regExpFileFilter = new RegExpFileFilter("^[A-Z]+\\d+.*$"); 111 for (File file: allFilesInAudioDirectories) { 112 if (regExpFileFilter.accept(file, file.getAbsolutePath())) { 113 audioFileNames.add(file.getName()); 114 } 115 } 116 return audioFileNames; 146 117 } 147 118 … … 168 139 String filename = generateRandomFilenameBase() + "." + extension; 169 140 170 File f = new File(AUDIO_ HOME_DIRECTORY + filename);141 File f = new File(AUDIO_USERNAME_HOME_DIRECTORY + filename); 171 142 172 143 if (AudioStructureModel.getInstance().getTrackGraphInfo(filename, null) != null || … … 206 177 207 178 // Build the filename string 208 return preamble + counter;179 return UserSettings.UserName.get() + preamble + counter; 209 180 210 181 } … … 222 193 223 194 // Ensure that the name base file exists. Assumes the audio home directory exists. 224 File vnameBase = new File(AUDIO_ HOME_DIRECTORY + VIRTUAL_NAME_BASEFILE);195 File vnameBase = new File(AUDIO_USERNAME_HOME_DIRECTORY + VIRTUAL_NAME_BASEFILE); 225 196 if (!vnameBase.exists()) { 226 197 try { -
trunk/src/org/apollo/util/AudioPurger.java
r1244 r1434 11 11 import org.apollo.widgets.SampledTrack; 12 12 import org.expeditee.settings.folders.FolderSettings; 13 import org.expeditee.gui.DisplayController; 14 import org.expeditee.gui.management.ResourceManager; 13 15 import org.expeditee.items.ItemUtils; 14 16 … … 26 28 public static void purgeLocalAudio() { 27 29 28 String[]audioFiles = AudioPathManager.getAudioFileNames();29 if (audioFiles == null || audioFiles. length== 0) return;30 List<String> audioFiles = AudioPathManager.getAudioFileNames(); 31 if (audioFiles == null || audioFiles.size() == 0) return; 30 32 31 33 … … 50 52 for (String audioFile : audioFiles) { 51 53 if (!referencedAudio.contains(audioFile)) { 52 53 File unreferencedFile = new File(AudioPathManager.AUDIO_HOME_DIRECTORY + audioFile);54 File unreferencedFile = ResourceManager.getAudioResource(audioFile, DisplayController.getCurrentFrame()); 55 //File unreferencedFile = new File(AudioPathManager.AUDIO_HOME_DIRECTORY + audioFile); 54 56 ApolloSystemLog.println("Deleting unreference audio file \"" + audioFile + "\""); 55 57 unreferencedFile.delete(); 56 58 57 59 // Also delete any melody meta 58 File melodyMetaFile = new File( 59 AudioPathManager.AUDIO_HOME_DIRECTORY + 60 MelodySearch.MELODY_METAFILE_PREFIX + 61 audioFile + 62 MelodySearch.MELODY_METAFILE_SUFFIX); 60 String melodyFileName = MelodySearch.MELODY_METAFILE_PREFIX + audioFile + MelodySearch.MELODY_METAFILE_SUFFIX; 61 File melodyMetaFile = ResourceManager.getAudioResource(melodyFileName, DisplayController.getCurrentFrame()); 63 62 64 63 if (melodyMetaFile.exists()) melodyMetaFile.delete(); -
trunk/src/org/apollo/widgets/FramePlayer.java
r1102 r1434 107 107 108 108 // Read typed frames 109 File f = new File(AudioPathManager.AUDIO_ HOME_DIRECTORY + TYPED_FRAMED_HISTORY_FILE);109 File f = new File(AudioPathManager.AUDIO_USERNAME_HOME_DIRECTORY + TYPED_FRAMED_HISTORY_FILE); 110 110 if (f.exists()) { 111 111 BufferedReader in = null; … … 147 147 try { 148 148 // Open the vbase for appending 149 out = new FileWriter(AudioPathManager.AUDIO_ HOME_DIRECTORY + TYPED_FRAMED_HISTORY_FILE, false);149 out = new FileWriter(AudioPathManager.AUDIO_USERNAME_HOME_DIRECTORY + TYPED_FRAMED_HISTORY_FILE, false); 150 150 for (String str : typedFrameNames) { 151 151 out.write(str + "\n"); … … 802 802 } 803 803 804 ComboBoxModel<String> model = new DefaultComboBoxModel<String>((String[]) orderedModelData.toArray()); 804 ComboBoxModel<String> model = new DefaultComboBoxModel<String>((String[]) orderedModelData.toArray(new String[] {})); 805 //ComboBoxModel model = new DefaultComboBoxModel(orderedModelData.toArray()); 805 806 806 807 // Remove helper tags from model data -
trunk/src/org/apollo/widgets/SampledTrack.java
r1179 r1434 23 23 import javax.sound.sampled.LineUnavailableException; 24 24 import javax.sound.sampled.UnsupportedAudioFileException; 25 import javax.swing.JSlider; 25 26 import javax.swing.SwingUtilities; 26 27 … … 70 71 import org.expeditee.gui.FrameIO; 71 72 import org.expeditee.gui.PopupManager; 73 import org.expeditee.gui.management.ResourceManager; 72 74 import org.expeditee.items.ItemParentStateChangedEvent; 73 75 import org.expeditee.items.ItemUtils; … … 401 403 402 404 }); 403 405 404 406 fulltrackView.addKeyListener(new KeyListener() { 405 407 406 408 @Override 407 public void keyPressed(KeyEvent e) 408 { 409 public void keyPressed(KeyEvent e) { 409 410 } 410 411 411 412 @Override 412 public void keyReleased(KeyEvent e) 413 { 413 public void keyReleased(KeyEvent e) { 414 415 // On 26th September, Bryce added P M + - keys to play/pause/resume, mute and adjust volume. 416 if (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_P) { 417 try { 418 playbackControlPopup.playPauseResume(); 419 } catch (LineUnavailableException e1) { 420 e1.printStackTrace(); 421 } 422 } else if (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_M) { 423 boolean selected = playbackControlPopup.muteButton.isSelected(); 424 playbackControlPopup.muteButton.setSelected(!selected); 425 playbackControlPopup.muteChanged(); 426 } else if (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_SUBTRACT) { 427 JSlider volumeSlider = playbackControlPopup.volumeSlider; 428 int delta = Math.round(((float) (volumeSlider.getMaximum() - volumeSlider.getMinimum())) / 10f); 429 int newVolume = Math.max(volumeSlider.getValue() - delta, volumeSlider.getMinimum()); 430 volumeSlider.setValue(newVolume); 431 playbackControlPopup.volumeChanged(); 432 } else if (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_ADD) { 433 JSlider volumeSlider = playbackControlPopup.volumeSlider; 434 int delta = Math.round(((float) (volumeSlider.getMaximum() - volumeSlider.getMinimum())) / 10f); 435 int newVolume = Math.min(volumeSlider.getValue() + delta, volumeSlider.getMaximum()); 436 volumeSlider.setValue(newVolume); 437 playbackControlPopup.volumeChanged(); 438 } 439 414 440 // Toggle pitch-track indexing 415 if (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_I) {441 else if (e.isControlDown() && e.getKeyCode() == KeyEvent.VK_I) { 416 442 setShouldOmitIndexAudio(!shouldOmitIndexAudio()); 417 443 DisplayController.requestRefresh(true); … … 765 791 setLoadScreenMessage("Loading audio file..."); 766 792 767 f = new File( 768 AudioPathManager.AUDIO_HOME_DIRECTORY + localFileName); 793 //f = new File( 794 // AudioPathManager.AUDIO_HOME_DIRECTORY + localFileName); 795 f = ResourceManager.getAudioResource(localFileName, getParentFrame()); 769 796 } 770 797 … … 809 836 // If recovering - might be recovering an existing track that had been 810 837 // saved to the repository .. thus re-use the old file 811 trackModel.setFilepath(AudioPathManager.AUDIO_HOME_DIRECTORY + localFileName); 838 File audioResource = ResourceManager.getAudioResource(localFileName, getParentFrame()); 839 trackModel.setFilepath(audioResource.getAbsolutePath()); 812 840 } 813 841 … … 940 968 // If saving for the file time then get a filename 941 969 if (trackModel.getFilepath() == null) { 942 trackModel.setFilepath(AudioPathManager.AUDIO_HOME_DIRECTORY + localFileName); 970 File audioResource = ResourceManager.getAudioResource(localFileName, DisplayController.getCurrentFrame()); 971 trackModel.setFilepath(audioResource.getAbsolutePath()); 943 972 loadFilenameArgument = localFileName; // set to now local, next load will be local 944 973 } … … 1029 1058 1030 1059 // Get rid of local file 1031 File oldLocalFile = new File(AudioPathManager.AUDIO_HOME_DIRECTORY + localFileName); 1060 //File oldLocalFile = new File(AudioPathManager.AUDIO_HOME_DIRECTORY + localFileName); 1061 File oldLocalFile = ResourceManager.getAudioResource(localFileName, getParentFrame()); 1032 1062 if (oldLocalFile.isFile() && oldLocalFile.exists()) { 1033 1063 try { … … 1157 1187 return recoveryFile.getAbsolutePath(); 1158 1188 } 1159 1160 return AudioPathManager.AUDIO_HOME_DIRECTORY + localFileName; 1189 1190 File audioResource = ResourceManager.getAudioResource(localFileName, getParentFrame()); 1191 return audioResource.getAbsolutePath(); 1161 1192 1162 1193 … … 2005 2036 try { 2006 2037 2007 if (!SoundDesk.getInstance().isPlaying(trackMix.getChannelID())) { // play / resume 2008 2009 int startFrame = -1, endFrame = -1; 2010 2011 // Resume playback? 2012 if (SoundDesk.getInstance().isPaused(trackMix.getChannelID())) { 2013 startFrame = SoundDesk.getInstance().getLastPlayedFramePosition(trackMix.getChannelID()); 2014 if (startFrame >= 0 && startFrame < trackModel.getFrameCount()) { 2015 2016 // The user may have edited the audio track and reselected it 2017 // since the last pause. Thus select an appropriate end frame 2018 endFrame = (trackModel.getSelectionLength() > 1) ? 2019 trackModel.getSelectionStart() + trackModel.getSelectionLength(): 2020 trackModel.getFrameCount() - 1; 2021 2022 // Changed selection? it play range invalid? 2023 if (endFrame <= startFrame || startFrame < trackModel.getSelectionStart()) { 2024 startFrame = -1; // Play new selection (see below) 2025 2026 } else if (endFrame >= trackModel.getFrameCount()) { 2027 endFrame = trackModel.getFrameCount() - 1; 2028 } 2029 2030 } 2031 } 2032 2033 // Play from beginning of selection to end of selection 2034 if (startFrame < 0) { 2035 startFrame = trackModel.getSelectionStart(); 2036 endFrame = (trackModel.getSelectionLength() > 1) ? 2037 startFrame + trackModel.getSelectionLength(): 2038 trackModel.getFrameCount() - 1; 2039 } 2040 2041 // Safety clamp: 2042 if (endFrame >= trackModel.getFrameCount()) { 2043 endFrame = trackModel.getFrameCount() - 1; 2044 } 2045 2046 if (startFrame < endFrame) { 2047 SoundDesk.getInstance().playSampledTrackModel( 2048 trackModel, 2049 trackMix.getChannelID(), 2050 startFrame, 2051 endFrame, 2052 0); 2053 } 2054 2055 } else { // pause 2056 2057 TrackSequence ts = SoundDesk.getInstance().getTrackSequence(trackMix.getChannelID()); 2058 2059 if (ts != null && 2060 ts.isPlaying()) { 2061 2062 // Mark channel as paused. 2063 SoundDesk.getInstance().setPaused(trackMix.getChannelID(), true); 2064 2065 // Stop playback for this channel 2066 ApolloPlaybackMixer.getInstance().stop(ts); 2067 2068 } 2069 2070 } 2038 playPauseResume(); 2071 2039 2072 2040 } catch (LineUnavailableException e1) { … … 2094 2062 } else if (e.getSource() == miscButton) { 2095 2063 expand(false); 2064 } 2065 } 2066 2067 private void playPauseResume() throws LineUnavailableException { 2068 if (!SoundDesk.getInstance().isPlaying(trackMix.getChannelID())) { // play / resume 2069 2070 int startFrame = -1, endFrame = -1; 2071 2072 // Resume playback? 2073 if (SoundDesk.getInstance().isPaused(trackMix.getChannelID())) { 2074 startFrame = SoundDesk.getInstance().getLastPlayedFramePosition(trackMix.getChannelID()); 2075 if (startFrame >= 0 && startFrame < trackModel.getFrameCount()) { 2076 2077 // The user may have edited the audio track and reselected it 2078 // since the last pause. Thus select an appropriate end frame 2079 endFrame = (trackModel.getSelectionLength() > 1) ? 2080 trackModel.getSelectionStart() + trackModel.getSelectionLength(): 2081 trackModel.getFrameCount() - 1; 2082 2083 // Changed selection? it play range invalid? 2084 if (endFrame <= startFrame || startFrame < trackModel.getSelectionStart()) { 2085 startFrame = -1; // Play new selection (see below) 2086 2087 } else if (endFrame >= trackModel.getFrameCount()) { 2088 endFrame = trackModel.getFrameCount() - 1; 2089 } 2090 2091 } 2092 } 2093 2094 // Play from beginning of selection to end of selection 2095 if (startFrame < 0) { 2096 startFrame = trackModel.getSelectionStart(); 2097 endFrame = (trackModel.getSelectionLength() > 1) ? 2098 startFrame + trackModel.getSelectionLength(): 2099 trackModel.getFrameCount() - 1; 2100 } 2101 2102 // Safety clamp: 2103 if (endFrame >= trackModel.getFrameCount()) { 2104 endFrame = trackModel.getFrameCount() - 1; 2105 } 2106 2107 if (startFrame < endFrame) { 2108 SoundDesk.getInstance().playSampledTrackModel( 2109 trackModel, 2110 trackMix.getChannelID(), 2111 startFrame, 2112 endFrame, 2113 0); 2114 } 2115 2116 } else { // pause 2117 2118 TrackSequence ts = SoundDesk.getInstance().getTrackSequence(trackMix.getChannelID()); 2119 2120 if (ts != null && 2121 ts.isPlaying()) { 2122 2123 // Mark channel as paused. 2124 SoundDesk.getInstance().setPaused(trackMix.getChannelID(), true); 2125 2126 // Stop playback for this channel 2127 ApolloPlaybackMixer.getInstance().stop(ts); 2128 2129 } 2130 2096 2131 } 2097 2132 } -
trunk/src/org/expeditee/auth/AuthenticatorBrowser.java
r1389 r1434 81 81 82 82 private KeyStore keyStore = KeyStore.getInstance(KeystoreType); 83 public static String USER_NOBODY = " nobody";83 public static String USER_NOBODY = "${USER.NAME}"; 84 84 85 85 private static final byte[] TRUE = "yes".getBytes(); … … 124 124 g.setWindowSize(new Dimension(UserSettings.InitialWidth.get(), UserSettings.InitialHeight.get())); 125 125 setInputManagerWindowRoutines(); 126 126 127 127 // Load documentation and start pages 128 128 FrameUtils.extractResources(false); … … 133 133 // initialing settings does not require a user profile established 134 134 Settings.Init(); 135 136 // Ensure messages go to public directory whilst we are not logged into an account. 137 FrameIO.MESSAGES_PATH = Paths.get(FrameIO.PARENT_FOLDER).resolve("resources-public").resolve("messages").toString() + File.separator; 135 138 136 139 // navigate to authentication frame -
trunk/src/org/expeditee/auth/account/Authenticate.java
r1401 r1434 32 32 import org.expeditee.gui.Frame; 33 33 import org.expeditee.gui.FrameIO; 34 import org.expeditee.gui.FrameUtils; 34 35 import org.expeditee.gui.MessageBay; 35 36 import org.expeditee.items.Item; … … 96 97 97 98 // Parse the users profile to refresh settings. 98 Text settingsLink = new Text("settings"); 99 settingsLink.setLink(oneFrame.getFramesetName() + "2"); 100 Settings.parseSettings(settingsLink); 99 //Text settingsLink = new Text("settings"); 100 //settingsLink.setLink(oneFrame.getFramesetName() + "2"); 101 //Settings.parseSettings(settingsLink); 102 FrameUtils.ParseProfile(oneFrame); 101 103 102 104 // At this point we at least login, but maybe with problems. -
trunk/src/org/expeditee/auth/account/Create.java
r1402 r1434 36 36 import org.expeditee.gui.MessageBay; 37 37 import org.expeditee.gui.MessageBay.Progress; 38 import org.expeditee.gui.management.ProfileManager; 38 39 import org.expeditee.io.ExpReader; 39 40 import org.expeditee.items.Item; … … 85 86 86 87 // Update in memory settings 88 ProfileManager.ensureDefaultProfile(); 87 89 System.setProperty("user.name", username); 88 90 UserSettings.UserName.set(username); … … 119 121 120 122 System.err.println("**** Hardwired call in Apollo's AuthioPathManager"); 121 AudioPathManager.activateAndScanAudioDir (); // ****123 AudioPathManager.activateAndScanAudioDirs(); // **** 122 124 123 125 progress = progress(message + "Done.", progress, step, progressBar); -
trunk/src/org/expeditee/gui/Browser.java
r1415 r1434 269 269 Text.InitFonts(); 270 270 271 Settings.Init();272 Frame userProfile = loadProfiles();273 274 271 if (!AuthenticatorBrowser.isAuthenticationRequired() && UserSettings.PublicAndPrivateResources) { 275 String userName = UserSettings.ProfileName.get();272 String userName = System.getProperty("user.name"); //UserSettings.ProfileName.get(); 276 273 if (!FrameIO.personalResourcesExist(userName)) { 277 274 FrameIO.setupPersonalResources(userName); 278 275 } 279 276 } 277 278 Settings.Init(); 279 Frame userProfile = loadInitialProfiles(); 280 FrameIO.changeParentAndSubFolders(FrameIO.PARENT_FOLDER); 281 280 282 // Listen for save status to display during and after runtime 281 283 EntitySaveManager.getInstance().addSaveStateChangedEventListener(this); … … 285 287 286 288 // Go to the start frame if specified, otherwise go to the profile frame 287 Frame start = null;288 289 if (getStartFrame() == null) { 289 290 setStartFrame(UserSettings.StartFrame.get()); … … 293 294 } 294 295 296 Frame start = null; 295 297 if ((start = FrameIO.LoadFrame(getStartFrame())) != null) { 296 298 // Make sure HomeFrame gets set … … 527 529 * @return The user's profile frame. 528 530 */ 529 public static Frame load Profiles()531 public static Frame loadInitialProfiles() 530 532 { 531 533 String defaultProfileName = UserSettings.DEFAULT_PROFILE_NAME; 532 String userName = UserSettings.ProfileName.get(); 533 534 String userName = System.getProperty("user.name"); 535 536 Frame defaultProfile = loadProfile(defaultProfileName); 534 537 Frame userProfile = loadProfile(userName); 535 Frame defaultProfile = loadProfile(defaultProfileName);536 538 537 539 MessageBay.warningMessages(FrameUtils.ParseProfile(defaultProfile)); … … 544 546 } 545 547 546 MessageBay.warningMessages(FrameUtils.ParseProfile(userProfile));548 //MessageBay.warningMessages(FrameUtils.ParseProfile(userProfile)); 547 549 548 550 if (cursor != null && !FreeItems.hasCursor()) { 549 551 FreeItems.setCursor(cursor); 550 552 } 553 554 FrameUtils.ParseProfile(userProfile); 551 555 552 556 return userProfile; -
trunk/src/org/expeditee/gui/Frame.java
r1430 r1434 20 20 21 21 import java.io.File; 22 import java.nio.file.Paths; 22 23 import java.sql.Time; 23 24 import java.util.ArrayList; … … 41 42 import org.expeditee.core.bounds.PolygonBounds; 42 43 import org.expeditee.encryption.items.EncryptionPermissionTriple; 44 import org.expeditee.encryption.items.surrogates.Label; 43 45 import org.expeditee.gio.EcosystemManager; 44 46 import org.expeditee.gio.gesture.Gesture; … … 190 192 private String _groupFrameName; 191 193 private Frame _groupFrame = null; 194 195 private List<String> labelsOnLastBodySet; 192 196 193 197 public enum BodyType { … … 353 357 */ 354 358 public List<Item> getSortedItems(boolean requireVisible) { 355 ItemsList listToLoopOver = _body;359 ItemsList listToLoopOver = getBody(true); 356 360 listToLoopOver.sort(); 357 361 return getItems(requireVisible, listToLoopOver); … … 389 393 throw new NullPointerException("i"); 390 394 } 391 return _body.contains(i);395 return getBody(true).contains(i); 392 396 } 393 397 … … 404 408 * @return the list of body text items. 405 409 */ 406 public List<Text> getBodyTextItems(boolean includeAnnotations) 407 { 410 public List<Text> getBodyTextItems(boolean includeAnnotations) { 411 ensureBody(); 412 408 413 List<Text> bodyTextItems = new ArrayList<Text>(); 409 414 … … 467 472 * found. 468 473 */ 469 public Item getItemWithID(int id) 470 { 471 for (Item i : _body) { 474 public Item getItemWithID(int id) { 475 for (Item i : getAllFrameItemsRaw()) { 472 476 if (i.getID() == id) { 473 477 return i; … … 761 765 _permissionTriple = new PermissionTriple(permission); 762 766 763 if ( _body.size() > 0) {767 if (getBody(false).size() > 0) { 764 768 refreshItemPermissions(permission.getPermission(_owner, groupMembers)); 765 769 } … … 787 791 _creationDate = date; 788 792 _modifiedDate = date; 789 for (Item i : _body) {793 for (Item i : getAllFrameItemsRaw()) { 790 794 i.setDateCreated(date); 791 795 } … … 855 859 856 860 public void invalidateSorted() { 857 _body.invalidateSorted();861 getBody(false).invalidateSorted(); 858 862 } 859 863 … … 871 875 if (item == null) { return; } 872 876 873 addItem(item, recalculate, _body);877 addItem(item, recalculate, getBody(false)); 874 878 if (item.isSurrogate()) { 875 addItem(item, recalculate, _surrogateItemsBody);879 addItem(item, recalculate, getSurrogateBody()); 876 880 } else { 877 addItem(item, recalculate, _primaryItemsBody);881 addItem(item, recalculate, getPrimaryBody()); 878 882 } 879 883 } … … 988 992 989 993 public void addAllItems(Collection<Item> toAdd) { 990 addAllItems(toAdd, _body);991 addAllItems(toAdd, _primaryItemsBody);994 addAllItems(toAdd, getBody(false)); 995 addAllItems(toAdd, getPrimaryBody()); 992 996 } 993 997 … … 1018 1022 1019 1023 public void removeItem(Item item, boolean recalculate) { 1020 removeItem(item, recalculate, _body);1024 removeItem(item, recalculate, getBody(false)); 1021 1025 if (item.isSurrogate()) { 1022 removeItem(item, recalculate, _surrogateItemsBody);1026 removeItem(item, recalculate, getSurrogateBody()); 1023 1027 Set<Item> primariesSurrogates = item.getPrimary().getSurrogates(); 1024 1028 primariesSurrogates.remove(item); 1025 1029 } else { 1026 removeItem(item, recalculate, _primaryItemsBody);1030 removeItem(item, recalculate, getPrimaryBody()); 1027 1031 } 1028 1032 } … … 1075 1079 } 1076 1080 1077 public void undo() 1078 { 1079 boolean bReparse = false; 1080 boolean bRecalculate = false; 1081 public void undo() { 1082 boolean reparse = false; 1083 boolean recalculate = false; 1081 1084 1082 1085 if (_undo.size() <= 0) { … … 1092 1095 _redo.push(undo); 1093 1096 for(Item i : undo.items) { 1094 _body.add(i);1095 bReparse |= i.hasOverlay();1096 bRecalculate |= i.recalculateWhenChanged();1097 this.addItem(i); 1098 reparse |= i.hasOverlay(); 1099 recalculate |= i.recalculateWhenChanged(); 1097 1100 if (i instanceof Line) { 1098 1101 Line line = (Line) i; … … 1105 1108 break; 1106 1109 case movement: 1107 ItemsList changed = new ItemsList(_body); 1108 changed.retainHistory(undo.items); 1110 ItemsList body = getBody(true); 1111 ItemsList changed = new ItemsList(body); 1112 changed.retainAll(undo.items); 1109 1113 _redo.push(new History(changed, History.Type.movement)); 1110 1114 for(Item i : undo.items) { 1111 1115 int index; 1112 if(i.isVisible() && (index = _body.indexOf(i)) != -1) {1113 _body.set(index, i);1116 if(i.isVisible() && (index = body.indexOf(i)) != -1) { 1117 body.set(index, i); 1114 1118 } 1115 1119 } … … 1121 1125 StandardGestureActions.refreshHighlights(); 1122 1126 1123 if ( bReparse) {1127 if (reparse) { 1124 1128 FrameUtils.Parse(this, false, false); 1125 1129 } else { 1126 notifyObservers( bRecalculate);1130 notifyObservers(recalculate); 1127 1131 } 1128 1132 … … 1152 1156 _undo.push(redo); 1153 1157 for(Item i : redo.items) { 1154 _body.remove(i); 1158 this.removeItem(i); 1159 //_body.remove(i); 1155 1160 bReparse |= i.hasOverlay(); 1156 1161 bRecalculate |= i.recalculateWhenChanged(); … … 1165 1170 break; 1166 1171 case movement: 1167 ItemsList changed = new ItemsList(_body); 1168 changed.retainHistory(redo.items); 1172 ItemsList body = getBody(true); 1173 ItemsList changed = new ItemsList(body); 1174 changed.retainAll(redo.items); 1169 1175 _undo.push(new History(changed, History.Type.movement)); 1170 1176 for(Item i : redo.items) { 1171 1177 int index; 1172 if(i.isVisible() && (index = _body.indexOf(i)) != -1) {1173 _body.set(index, i);1178 if(i.isVisible() && (index = body.indexOf(i)) != -1) { 1179 body.set(index, i); 1174 1180 } 1175 1181 } … … 1335 1341 // s.append(String.format("Last Mod. User: %s%n", _modifiedUser)); 1336 1342 // s.append(String.format("Last Mod. Date: %s%n", _modifiedDate)); 1337 s.append(String.format("Items: %d%n", _body.size()));1343 s.append(String.format("Items: %d%n", getAllFrameItemsRaw().size())); 1338 1344 return s.toString(); 1339 1345 } … … 1379 1385 { 1380 1386 // Check that this item is on the current frame 1381 if (! _body.contains(from)) {1387 if (!getBody(true).contains(from)) { 1382 1388 return null; 1383 1389 } … … 1789 1795 * Removes all non-title non-annotation items from this Frame. All removed 1790 1796 * items are added to the backup-stack. 1791 */ 1792 public void clear(boolean keepAnnotations) 1797 */ 1798 @Deprecated 1799 public void clearDeprecated(boolean keepAnnotations) 1793 1800 { 1794 1801 ItemsList newBody = new ItemsList(); … … 1814 1821 change(); 1815 1822 1823 if (!keepAnnotations && _annotations != null) { 1824 _annotations.clear(); 1825 } 1826 } 1827 1828 /** 1829 * Removes all items from the Frame except the Title Item and optionally the annotations. 1830 * All removed items are added to the backup-stack. 1831 * 1832 * @param keepAnnotations true is annotations are not to be removed from the frame. 1833 */ 1834 public void clear(boolean keepAnnotations) { 1835 ItemsList body = getBody(true); 1836 ItemsList deleted = new ItemsList(); 1837 1838 for (Item bodyItem: body) { 1839 boolean isAnnotationToKeep = bodyItem.isAnnotation() && keepAnnotations; 1840 boolean isFrameTitle = bodyItem.isFrameTitle(); 1841 boolean isToBeRetained = isFrameTitle || isAnnotationToKeep; 1842 if (isToBeRetained) { 1843 continue; 1844 } 1845 1846 this.removeItem(bodyItem); 1847 deleted.add(bodyItem); 1848 } 1849 1850 addToUndoDelete(deleted); 1851 change(); 1852 1816 1853 if (!keepAnnotations && _annotations != null) { 1817 1854 _annotations.clear(); … … 1950 1987 */ 1951 1988 public String getFramesetPath() { 1952 return this.getPath() + File.separator + this.getFramesetName() + File.separator;1989 return Paths.get(this.getPath()).resolve(this.getFramesetName()).toString() + File.separator; 1953 1990 } 1954 1991 … … 2290 2327 2291 2328 for (Overlay o : getOverlays()) { 2292 for(Item i : o.Frame. _body) {2329 for(Item i : o.Frame.getBody(false)) { 2293 2330 i.setOverlayPermission(o.permission); 2294 2331 } … … 2568 2605 } 2569 2606 2607 /** 2608 * Returns a list of items for the specified BodyType. 2609 * 2610 * Asking for the primary or surrogate items gives you exactly those. 2611 * 2612 * Asking for the body items is a weird case because the body list is 2613 * transitory. Therefore, when asking for the body items, this 2614 * function assumes that you want all items, reguardless of if they 2615 * are primaries or surrogates. As of 20/08/2019, there are no places 2616 * in the code that asks for the body items to save. 2617 * @param type 2618 * @return 2619 */ 2570 2620 public List<Item> getItemsToSave(BodyType type) { 2571 2621 assert(!type.equals(BodyType.BodyDisplay)); … … 2574 2624 return getItemsToSave(_surrogateItemsBody); 2575 2625 case BodyDisplay: 2576 return getItemsToSave( _body);2626 return getItemsToSave(new ItemsList(getAllFrameItemsRaw())); 2577 2627 case PrimaryBody: 2578 2628 default: … … 2632 2682 2633 2683 public Collection<Item> getAllItems() { 2634 ItemsList allItems = new ItemsList( _body);2684 ItemsList allItems = new ItemsList(getBody(true)); 2635 2685 2636 2686 allItems.addAll(_overlayItems); … … 2721 2771 } 2722 2772 2723 public void dispose()2724 {2773 @Deprecated 2774 public void disposeDeprecated() { 2725 2775 clearObservers(); 2726 2776 … … 2732 2782 _body = null; 2733 2783 _frameName = null; 2784 } 2785 2786 /** 2787 * Disposes off all references associated with this frame. 2788 * This operation is NOT REVERSEABLE through the history. 2789 */ 2790 public void dispose() { 2791 clearObservers(); 2792 2793 List<Item> allFrameItems = getAllFrameItemsRaw(); 2794 2795 for (Item i: allFrameItems) { 2796 i.dispose(); 2797 } 2798 2799 _frameName.dispose(); 2800 _frameName = null; 2801 getBody(false).clear(); 2802 getPrimaryBody().clear(); 2803 getSurrogateBody().clear(); 2734 2804 } 2735 2805 … … 2800 2870 2801 2871 public void moveItemToBodyHiddenDueToPermission(final Item i) { 2802 _body.remove(i);2872 getBody(true).remove(i); 2803 2873 _bodyHiddenDueToPermissions.add(i); 2804 2874 } … … 2808 2878 _bodyHiddenDueToPermissions.remove(i); 2809 2879 i.setPermission(newPermission); 2810 _body.add(i);2880 getBody(true).add(i); 2811 2881 } 2812 2882 } … … 2821 2891 } 2822 2892 2823 for (Item i : _body) {2893 for (Item i : getBody(false)) { 2824 2894 if (i == null) { 2825 2895 continue; … … 2950 3020 } 2951 3021 2952 public ItemsList getBody() { 3022 public ItemsList getBody(boolean respectSurrogateMode) { 3023 if (respectSurrogateMode) { ensureBody(); } 2953 3024 return _body; 2954 3025 } 3026 3027 private void ensureBody() { 3028 List<String> accessibleLabelsNames = Label.getAccessibleLabelsNames(getPrimaryBody()); 3029 if (!accessibleLabelsNames.equals(labelsOnLastBodySet)) { 3030 this.parse(); 3031 } 3032 } 3033 3034 protected void setBody(List<Item> newBody, List<String> labelsOnSet) { 3035 _body.clear(); 3036 _body.addAll(newBody); 3037 this.labelsOnLastBodySet = labelsOnSet; 3038 } 3039 2955 3040 protected ItemsList getPrimaryBody() { 2956 3041 return _primaryItemsBody; … … 2959 3044 return _surrogateItemsBody; 2960 3045 } 3046 3047 3048 /** 3049 * Gets all the items on the frame, regardless of whether they are primary or surrogate items. 3050 * 3051 * Bryce says: This function will likely only ever be used inside Frame itself, as callers from 3052 * outside Frame should care about what the state of the Frame. 3053 * @return 3054 */ 3055 private List<Item> getAllFrameItemsRaw() { 3056 Collection<Item> primaries = getPrimaryBody().underlying(); 3057 Collection<Item> surrogateBody = getSurrogateBody().underlying(); 3058 primaries.addAll(surrogateBody); 3059 List<Item> allFrameItems = primaries.stream().distinct().collect(Collectors.toList()); 3060 return allFrameItems; 3061 } 2961 3062 } -
trunk/src/org/expeditee/gui/FrameIO.java
r1433 r1434 57 57 import org.expeditee.encryption.io.EncryptedExpWriter; 58 58 import org.expeditee.gio.EcosystemManager; 59 import org.expeditee.gui.management.ProfileManager; 60 import org.expeditee.gui.management.ResourceManager; 59 61 import org.expeditee.io.Conversion; 60 62 import org.expeditee.io.ExpReader; … … 110 112 public static String SHARED_FRAMESETS_PATH; 111 113 public static String CONTACTS_PATH; 112 public static String RESOURCES_PRIVATE_PATH;113 public static String RESOURCES_PATH;114 public static String FRAME_PRIVATE_PATH;115 public static String IMAGES_PRIVATE_PATH;116 public static String AUDIO_PRIVATE_PATH;117 public static String HELP_PRIVATE_PATH;118 114 public static String HELP_PATH; 119 115 public static String DEAD_DROPS_PATH; 120 116 public static String GROUP_PATH; 117 public static String RESOURCES_PRIVATE_PATH; 118 public static String RESOURCES_PATH; 119 public static String FRAME_USERNAME_PRIVATE_PATH; 120 public static String IMAGES_USERNAME_PRIVATE_PATH; 121 public static String AUDIO_USERNAME_PRIVATE_PATH; 122 public static String HELP_USERNAME_PRIVATE_PATH; 121 123 122 124 // Paths that appear to be unused. … … 144 146 145 147 String resourcesPublicPath = PARENT_FOLDER + "resources-public" + File.separator; 146 String resourcesPrivate IndividualPath = PARENT_FOLDER + "resources-" + UserSettings.UserName.get() + File.separator;148 String resourcesPrivateUserPath = PARENT_FOLDER + "resources-" + UserSettings.UserName.get() + File.separator; 147 149 148 150 if (UserSettings.PublicAndPrivateResources) { … … 151 153 DICT_PATH = resourcesPublicPath + "dict" + File.separator; 152 154 HELP_PATH = resourcesPublicPath + "documentation" + File.separator; 153 HELP_ PRIVATE_PATH = resourcesPrivateIndividualPath + "documentation" + File.separator;155 HELP_USERNAME_PRIVATE_PATH = resourcesPrivateUserPath + "documentation" + File.separator; 154 156 FRAME_PATH = resourcesPublicPath + "framesets" + File.separator; 155 FRAME_ PRIVATE_PATH = resourcesPrivateIndividualPath + "framesets" + File.separator;156 MESSAGES_PATH = resourcesPrivate IndividualPath + "messages" + File.separator;157 FRAME_USERNAME_PRIVATE_PATH = resourcesPrivateUserPath + "framesets" + File.separator; 158 MESSAGES_PATH = resourcesPrivateUserPath + "messages" + File.separator; 157 159 IMAGES_PATH = resourcesPublicPath + "images" + File.separator; 158 IMAGES_ PRIVATE_PATH = resourcesPrivateIndividualPath + "images" + File.separator;160 IMAGES_USERNAME_PRIVATE_PATH = resourcesPrivateUserPath + "images" + File.separator; 159 161 AUDIO_PATH = resourcesPublicPath + "audio" + File.separator; 160 AUDIO_ PRIVATE_PATH = resourcesPrivateIndividualPath + "audio" + File.separator;161 GROUP_PATH = resourcesPrivate IndividualPath + "groups" + File.separator;162 AUDIO_USERNAME_PRIVATE_PATH = resourcesPrivateUserPath + "audio" + File.separator; 163 GROUP_PATH = resourcesPrivateUserPath + "groups" + File.separator; 162 164 163 165 // Used only when extracting resources (when expeditee is run for first time) … … 166 168 if (AuthenticatorBrowser.isAuthenticated()) { 167 169 // Paths for the new regime while authenticated 168 SHARED_FRAMESETS_PATH = resourcesPrivate IndividualPath + "framesets-shared" + File.separator;169 DEAD_DROPS_PATH = resourcesPrivate IndividualPath + "deaddrops" + File.separator;170 CONTACTS_PATH = resourcesPrivate IndividualPath + "contacts" + File.separator;171 MAIL_PATH = resourcesPrivate IndividualPath + "mail" + File.separator;170 SHARED_FRAMESETS_PATH = resourcesPrivateUserPath + "framesets-shared" + File.separator; 171 DEAD_DROPS_PATH = resourcesPrivateUserPath + "deaddrops" + File.separator; 172 CONTACTS_PATH = resourcesPrivateUserPath + "contacts" + File.separator; 173 MAIL_PATH = resourcesPrivateUserPath + "mail" + File.separator; 172 174 } else { 173 175 SHARED_FRAMESETS_PATH = null; … … 188 190 189 191 // These paths are not used by old regime. 190 HELP_ PRIVATE_PATH = null;191 FRAME_ PRIVATE_PATH = null;192 IMAGES_ PRIVATE_PATH = null;193 AUDIO_ PRIVATE_PATH = null;192 HELP_USERNAME_PRIVATE_PATH = null; 193 FRAME_USERNAME_PRIVATE_PATH = null; 194 IMAGES_USERNAME_PRIVATE_PATH = null; 195 AUDIO_USERNAME_PRIVATE_PATH = null; 194 196 // - This last one is never used because old regime is never extracted. If we are going to FrameUtils.extractResources then we are doing new regime. 195 197 RESOURCES_PRIVATE_PATH = null; … … 209 211 } 210 212 211 System.err.println("**** FrameIO::changeParentAndSubFolder(): Calling AudioPathManger.changeParentAndSubFolder()");212 AudioPathManager.changeParentAndSubFolders(newFolder);213 //System.err.println("**** FrameIO::changeParentAndSubFolder(): Calling AudioPathManger.changeParentAndSubFolder()"); 214 //AudioPathManager.changeParentAndSubFolders(newFolder); 213 215 } 214 216 … … 370 372 return null; 371 373 } 372 373 private static Frame LoadFromDisk(String framename, String knownPath, 374 boolean ignoreAnnotations) { 375 Frame loaded = null; 376 377 if (knownPath != null) { 378 loaded = LoadKnownPath(knownPath, framename); 379 } else { 380 List<String> directoriesToSearch = FolderSettings.FrameDirs.getAbsoluteDirs(); 381 382 for (String path : directoriesToSearch) { 383 loaded = LoadKnownPath(path, framename); 384 if (loaded != null) { 385 break; 386 } 387 } 388 } 389 390 if (loaded == null && FrameShare.getInstance() != null) { 391 loaded = FrameShare.getInstance().loadFrame(framename, knownPath); 392 } 393 394 if (loaded != null) { 395 FrameUtils.Parse(loaded, true, ignoreAnnotations); 396 FrameIO.setSavedProperties(loaded); 397 } 398 399 return loaded; 400 } 374 375 private static Frame LoadFromDisk(String frameName, String knownPath, boolean ignoreAnnotationsOnParse) { 376 return ResourceManager.getExpediteeFrame(frameName, knownPath, ignoreAnnotationsOnParse); 377 } 378 379 // private static Frame LoadFromDisk(String framename, String knownPath, 380 // boolean ignoreAnnotations) { 381 // Frame loaded = null; 382 // 383 // if (knownPath != null) { 384 // loaded = LoadKnownPath(knownPath, framename); 385 // } else { 386 // List<String> directoriesToSearch = FolderSettings.FrameDirs.getAbsoluteDirs(); 387 // 388 // for (String path : directoriesToSearch) { 389 // loaded = LoadKnownPath(path, framename); 390 // if (loaded != null) { 391 // break; 392 // } 393 // } 394 // } 395 // 396 // if (loaded == null && FrameShare.getInstance() != null) { 397 // loaded = FrameShare.getInstance().loadFrame(framename, knownPath); 398 // } 399 // 400 // if (loaded != null) { 401 // FrameUtils.Parse(loaded, true, ignoreAnnotations); 402 // FrameIO.setSavedProperties(loaded); 403 // } 404 // 405 // return loaded; 406 // } 401 407 402 408 /** … … 563 569 } 564 570 565 p rivatestatic Frame LoadKnownPath(String path, String frameName) {571 public static Frame LoadKnownPath(String path, String frameName) { 566 572 String fullPath = getFrameFullPathName(path, frameName); 567 573 if (fullPath == null) { … … 1381 1387 public static boolean isProfileFrame(Frame toCheck) 1382 1388 { 1383 if (toCheck.getNumber() == 0 ) {1389 if (toCheck.getNumber() == 0 || toCheck.getFramesetName().equals(UserSettings.DEFAULT_PROFILE_NAME)) { 1384 1390 return false; 1385 1391 } … … 1401 1407 1402 1408 public static Frame CreateNewProfile(String username, Map<String, Setting> initialSettings, Map<String, Consumer<Frame>> toNotifyOnSet) throws InvalidFramesetNameException, ExistingFramesetException { 1403 Frame profile = CreateFrameset(username, PROFILE_PATH, true); 1404 if (profile != null) { 1405 FrameUtils.CreateDefaultProfile(username, profile, initialSettings, toNotifyOnSet); 1409 // Frame profile = CreateFrameset(username, PROFILE_PATH, true); 1410 // if (profile != null) { 1411 // FrameUtils.CreateDefaultProfile(username, profile, initialSettings, toNotifyOnSet); 1412 // } else { 1413 // System.err.println("An error occured while attempting to create the profile named: " + username); 1414 // System.err.println("Unable to proceed."); 1415 // System.exit(1); 1416 // } 1417 // return profile; 1418 if (username.equals(UserSettings.DEFAULT_PROFILE_NAME)) { 1419 ProfileManager.ensureDefaultProfile(); 1420 return FrameIO.LoadFrame(UserSettings.DEFAULT_PROFILE_NAME + "1"); 1406 1421 } else { 1407 System.err.println("An error occured while attempting to create the profile named: " + username); 1408 System.err.println("Unable to proceed."); 1409 System.exit(1); 1410 } 1411 return profile; 1422 return ProfileManager.createProfile(username, initialSettings, toNotifyOnSet); 1423 } 1412 1424 } 1413 1425 -
trunk/src/org/expeditee/gui/FrameUtils.java
r1424 r1434 63 63 import org.expeditee.gio.EcosystemManager; 64 64 import org.expeditee.gio.gesture.StandardGestureActions; 65 import org.expeditee.gui.management.ResourceManager; 66 import org.expeditee.gui.management.ResourceUtil; 65 67 import org.expeditee.items.Circle; 66 68 import org.expeditee.items.Dot; … … 86 88 import org.expeditee.settings.Settings; 87 89 import org.expeditee.settings.UserSettings; 88 import org.expeditee.settings.templates.TemplateSettings;89 90 import org.expeditee.stats.Logger; 90 91 import org.expeditee.stats.SessionStats; … … 666 667 667 668 private static boolean createPictureInBody(Frame frame, Text txt) { 668 return createPicture(frame, txt, frame.getBody( ));669 return createPicture(frame, txt, frame.getBody(false)); 669 670 } 670 671 … … 726 727 727 728 private static boolean createWidgetInBody(Frame frame, Text txt) { 728 return createWidget(frame, txt, frame.getBody( ));729 } 730 731 public static List<String> ParseProfile(Frame profile) { 729 return createWidget(frame, txt, frame.getBody(false)); 730 } 731 732 public static List<String> ParseProfile(Frame profile) { 732 733 List<String> errors = new LinkedList<String>(); 733 734 734 735 if (profile == null) { 736 return errors; 737 } 738 739 if (profile.getFramesetName().equals(UserSettings.DEFAULT_PROFILE_NAME)) { 735 740 return errors; 736 741 } … … 771 776 } 772 777 778 // Tell the resource manager that it needs to refresh its context. 779 ResourceManager.invalidateAllResourceDirectories(); 780 773 781 return errors; 774 782 } … … 792 800 DisplayController.setCurrentFrame(firstFrame, true); 793 801 } 794 795 802 } 796 803 … … 843 850 throw new RuntimeException("Missing value for profile attribute" + name); 844 851 } 845 846 public static ArrayList<String> getDirs(Item item) { 847 ArrayList<String> dirsToAdd = new ArrayList<String>(); 852 853 public static List<String> getDirs(Item item) { 854 List<String> dirsToAdd = new ArrayList<String>(); 855 String currentFramesetFlag = ResourceUtil.CURRENT_FRAMESET_FLAG; 856 boolean need_file_sep_replace = (!File.separator.equals("/")); 857 848 858 String dirListFrameName = item.getAbsoluteLink(); 849 if (dirListFrameName != null) { 850 Frame dirListFrame = FrameIO.LoadFrame(dirListFrameName); 851 if (dirListFrame != null) { 852 for (Text t : dirListFrame.getBodyTextItems(false)) { 853 String dirName = t.getText().trim(); 854 File tester = new File(dirName); 855 if (tester.exists() && tester.isDirectory()) { 856 if (dirName.endsWith(File.separator)) { 857 dirsToAdd.add(dirName); 858 } else { 859 dirsToAdd.add(dirName + File.separator); 860 } 861 } 862 } 863 } 864 } 865 859 if (dirListFrameName == null) { 860 return dirsToAdd; 861 } 862 Frame dirListFrame = FrameIO.LoadFrame(dirListFrameName); 863 if (dirListFrame == null) { 864 return dirsToAdd; 865 } 866 867 List<Text> bodyTextItems = dirListFrame.getBodyTextItems(false); 868 for (Text t: bodyTextItems) { 869 String dirName = t.getText().trim(); 870 871 if (need_file_sep_replace) { 872 dirName = dirName.replace("/",File.separator); 873 } 874 875 boolean isSpecialCase = dirName.startsWith(currentFramesetFlag); 876 File filePath = Paths.get(FrameIO.PARENT_FOLDER).resolve(dirName).toFile(); 877 boolean locationExists = filePath.exists() && filePath.isDirectory(); 878 if (isSpecialCase || locationExists) { 879 if (dirName.endsWith(File.separator)) { 880 dirsToAdd.add(dirName); 881 } else { 882 dirsToAdd.add(dirName + File.separator); 883 } 884 } 885 } 886 866 887 return dirsToAdd; 867 888 } … … 1140 1161 */ 1141 1162 public static void Parse(Frame toParse, boolean firstParse, boolean ignoreAnnotations) { 1142 List<String> accessList = Label.getAccessibleLabelsNames( new ItemsList(toParse.getPrimaryBody()));1163 List<String> accessList = Label.getAccessibleLabelsNames(toParse.getPrimaryBody()); 1143 1164 1144 1165 ItemsList primaries = toParse.getPrimaryBody(); … … 1150 1171 toParse.getInteractableItems().clear(); 1151 1172 List<Item> newBody = parseFromPrimary(primaries, accessList); 1152 toParse.getBody().clear(); 1153 toParse.getBody().addAll(newBody); 1154 generatingSupportingItems(toParse, toParse.getBody(), ignoreAnnotations); 1173 toParse.setBody(newBody, accessList); 1174 generatingSupportingItems(toParse, toParse.getBody(false), ignoreAnnotations); 1155 1175 1156 1176 if (firstParse) { … … 1587 1607 CreateDefaultProfile(profileFor, profile, null, null); 1588 1608 } 1589 1609 1590 1610 /** 1591 1611 * Copies the content from the default profile to the specified profile. … … 1610 1630 try { 1611 1631 // If we do not have a default to copy, create one. 1632 String existingUsername = UserSettings.UserName.get(); 1633 UserSettings.UserName.set("default"); 1634 FrameIO.changeParentAndSubFolders(FrameIO.PARENT_FOLDER); 1635 UserSettings.setupDefaultFolders(); 1612 1636 defaultFrame = FrameIO.CreateNewProfile(UserSettings.DEFAULT_PROFILE_NAME, null, null); 1637 UserSettings.UserName.set(existingUsername); 1638 FrameIO.changeParentAndSubFolders(FrameIO.PARENT_FOLDER); 1639 UserSettings.setupDefaultFolders(); 1613 1640 } catch (InvalidFramesetNameException invalidNameEx) { 1614 1641 MessageBay.errorMessage("Failed to create default profile named: " … … 1685 1712 } 1686 1713 MessageBay.suppressMessages(false); 1687 } else { 1688 title.setText("Default Profile Frame"); 1689 int xPos = 300; 1690 int yPos = 100; 1691 Text t; 1692 1693 // Add documentation links 1694 File helpDirectory = new File(FrameIO.HELP_PATH); 1695 if (helpDirectory != null) { 1696 File[] helpFramesets = helpDirectory.listFiles(); 1697 if (helpFramesets != null) { 1698 1699 // Add the title for the help index 1700 Text help = profile.addText(xPos, yPos, "@Expeditee Help", null); 1701 help.setSize(25); 1702 help.setFontStyle("Bold"); 1703 help.setFamily("SansSerif"); 1704 help.setColor(TemplateSettings.ColorWheel.get()[3]); 1705 1706 xPos += 25; 1707 System.out.println("Installing frameset: "); 1708 1709 boolean first_item = true; 1710 for (File helpFrameset : helpFramesets) { 1711 String framesetName = helpFrameset.getName(); 1712 if (!FrameIO.isValidFramesetName(framesetName)) { 1713 continue; 1714 } 1715 1716 if (first_item) { 1717 System.out.print(" " + framesetName); 1718 first_item = false; 1719 } else { 1720 System.out.print(", " + framesetName); 1721 } 1722 System.out.flush(); 1723 1724 Frame indexFrame = FrameIO.LoadFrame(framesetName + '1'); 1725 // Look through the folder for help index pages 1726 if (indexFrame != null && ItemUtils.FindTag(indexFrame.getSortedItems(), "@HelpIndex") != null) { 1727 // yPos += spacing; 1728 yPos += 30; 1729 t = profile.addText(xPos, yPos, '@' + indexFrame.getFramesetName(), null); 1730 t.setLink(indexFrame.getName()); 1731 t.setColor(Colour.GREY); 1732 } 1733 } 1734 System.out.println(); 1735 } 1736 } 1737 1738 xPos = 50; 1739 yPos = 100; 1740 1741 // Populate Start Pages and Settings 1742 File framesetDirectory = new File(FrameIO.FRAME_PATH); 1743 1744 if (framesetDirectory.exists()) { 1745 File[] startpagesFramesets = framesetDirectory.listFiles(); 1746 1747 if (startpagesFramesets != null) { 1748 // Add Start Page title 1749 Text templates = profile.addText(xPos, yPos, "@Start Pages", null); 1750 templates.setSize(25); 1751 templates.setFontStyle("Bold"); 1752 templates.setFamily("SansSerif"); 1753 templates.setColor(TemplateSettings.ColorWheel.get()[3]); 1754 1755 xPos += 25; 1756 1757 // Start Pages should be the first frame in its own frameset + 1758 // frameset name should be present in FrameUtils.startPages[]. 1759 for (File startpagesFrameset : startpagesFramesets) { 1760 String framesetName = startpagesFrameset.getName(); 1761 1762 // Only add link if frameset is a startpage 1763 for (int i = 0; i < startPages.length; i++) { 1764 if (framesetName.equals(startPages[i])) { 1765 Frame indexFrame = FrameIO.LoadFrame(framesetName + '1'); 1766 1767 // Add start page link 1768 if (indexFrame != null) { 1769 yPos += 30; 1770 t = profile.addText(xPos, yPos, '@' + indexFrame.getFramesetName(), null); 1771 t.setLink(indexFrame.getName()); 1772 t.setColor(Colour.GREY); 1773 } 1774 } 1775 } 1776 } 1777 } 1778 } 1779 1780 FrameIO.SaveFrame(profile); 1781 1782 // Populate settings frameset 1783 Settings.Init(); 1784 t = profile.addText(550, 100, "@Settings", null); 1785 t.setSize((float) 25.0); 1786 t.setFamily("SansSerif"); 1787 t.setFontStyle("Bold"); 1788 t.setColor(Colour.GREY); 1789 Settings.generateSettingsTree(t); 1790 System.out.println("@Settings: Default settings generation complete."); 1791 1792 FrameIO.SaveFrame(profile); 1793 } 1714 } 1794 1715 } 1795 1716 -
trunk/src/org/expeditee/gui/ItemsList.java
r1415 r1434 71 71 } 72 72 73 public void retain History(ItemsList historyItems) {73 public void retainAll(ItemsList historyItems) { 74 74 items.retainAll(historyItems.items); 75 75 } -
trunk/src/org/expeditee/gui/MessageBay.java
r1415 r1434 222 222 /** TODO: Comment. cts16 */ 223 223 public synchronized static Text displayMessage(String message, String link, Colour color, boolean displayAlways, 224 String action) { 224 String action) { 225 225 List<String> actions = new LinkedList<String>(); 226 226 if (action != null) { -
trunk/src/org/expeditee/items/ItemUtils.java
r1426 r1434 39 39 import org.expeditee.gui.FreeItems; 40 40 import org.expeditee.gui.Vector; 41 import org.expeditee.gui.management.ResourceManager; 41 42 import org.expeditee.items.Item.HighlightMode; 42 43 import org.expeditee.items.widgets.InteractiveWidgetInitialisationFailedException; … … 376 377 */ 377 378 public static Picture CreatePicture(Text source, boolean tryRemote) { 378 String text = source.getText(); 379 String path = ""; 380 String fileName = ""; 381 String size = ""; 382 383 try { 384 // remove @i tag 385 text = text.replaceFirst("@i:", ""); 386 text = text.replaceAll("\n", ""); 387 text = text.trim(); 388 389 int fileSuffixChar = text.indexOf('.'); 390 if (fileSuffixChar < 0) { 391 return null; 392 } 393 int endOfFileName = text.indexOf(' ', fileSuffixChar); 394 if (endOfFileName < 0) { 395 path = text; 396 size = ""; 397 } else { 398 path = text.substring(0, endOfFileName); 399 size = text.substring(endOfFileName).trim(); 400 } 401 fileName = path; 402 403 if (!fileName.equals(Picture.REDACTED_IMAGE_NAME)) { 404 // try images subdirectory 405 File file = null; 406 407 for (String dir : FolderSettings.ImageDirs.getAbsoluteDirs()) { 408 file = new File(dir + path); 409 if (file.exists() && !file.isDirectory()) { 410 break; 411 } 412 } 413 414 if (file == null || !file.exists() || file.isDirectory()) { 415 file = new File(path); 416 } 417 418 // try relative path 419 if (!file.exists() || file.isDirectory()) { 420 URL picture = new Object().getClass().getResource(path); 421 422 // decode to remove %20 in windows folder names 423 if (picture != null) { 424 try { 425 path = URLDecoder.decode(picture.getFile(), "UTF-8"); 426 } catch (UnsupportedEncodingException e) { 427 // TODO Auto-generated catch block 428 e.printStackTrace(); 429 } 430 } 431 432 } else { 433 path = file.getPath(); 434 } 435 436 // if the image isn't found by now, try remote servers 437 file = new File(path); 438 if (!file.exists() || file.isDirectory()) { 439 if(tryRemote && FrameShare.getInstance().loadImage(fileName, null)) { 440 // call CreatePicture again, but with tryRemote set to false so we won't get into an infinite loop 441 // if something goes wrong with finding the downloaded image 442 return CreatePicture(source, false); 443 } 444 return null; 445 } 446 } 447 } catch (Exception e) { 448 return null; 449 } 450 451 try { 452 Picture pic = new Picture(source, fileName, path, size); 453 454 return pic; 455 } catch (Exception e) { 456 e.printStackTrace(); 457 return null; 458 } 459 460 } 379 return ResourceManager.getExpediteePicture(source, tryRemote); 380 } 381 // public static Picture CreatePicture(Text source, boolean tryRemote) { 382 // String text = source.getText(); 383 // String path = ""; 384 // String fileName = ""; 385 // String size = ""; 386 // 387 // try { 388 // // remove @i tag 389 // text = text.replaceFirst("@i:", ""); 390 // text = text.replaceAll("\n", ""); 391 // text = text.trim(); 392 // 393 // int fileSuffixChar = text.indexOf('.'); 394 // if (fileSuffixChar < 0) { 395 // return null; 396 // } 397 // int endOfFileName = text.indexOf(' ', fileSuffixChar); 398 // if (endOfFileName < 0) { 399 // path = text; 400 // size = ""; 401 // } else { 402 // path = text.substring(0, endOfFileName); 403 // size = text.substring(endOfFileName).trim(); 404 // } 405 // fileName = path; 406 // 407 // if (!fileName.equals(Picture.REDACTED_IMAGE_NAME)) { 408 // // try images subdirectory 409 // File file = null; 410 // 411 // List<String> absoluteDirs = FolderSettings.ImageDirs.getAbsoluteDirs(); 412 // for (String dir : absoluteDirs) { 413 // file = new File(dir + path); 414 // if (file.exists() && !file.isDirectory()) { 415 // break; 416 // } 417 // } 418 // 419 // if (file == null || !file.exists() || file.isDirectory()) { 420 // file = new File(path); 421 // } 422 // 423 // // try relative path 424 // if (!file.exists() || file.isDirectory()) { 425 // URL picture = new Object().getClass().getResource(path); 426 // 427 // // decode to remove %20 in windows folder names 428 // if (picture != null) { 429 // try { 430 // path = URLDecoder.decode(picture.getFile(), "UTF-8"); 431 // } catch (UnsupportedEncodingException e) { 432 // // TODO Auto-generated catch block 433 // e.printStackTrace(); 434 // } 435 // } 436 // 437 // } else { 438 // path = file.getPath(); 439 // } 440 // 441 // // if the image isn't found by now, try remote servers 442 // file = new File(path); 443 // if (!file.exists() || file.isDirectory()) { 444 // if(tryRemote && FrameShare.getInstance().loadImage(fileName, null)) { 445 // // call CreatePicture again, but with tryRemote set to false so we won't get into an infinite loop 446 // // if something goes wrong with finding the downloaded image 447 // return CreatePicture(source, false); 448 // } 449 // return null; 450 // } 451 // } 452 // } catch (Exception e) { 453 // return null; 454 // } 455 // 456 // try { 457 // Picture pic = new Picture(source, fileName, path, size); 458 // 459 // return pic; 460 // } catch (Exception e) { 461 // e.printStackTrace(); 462 // return null; 463 // } 464 // 465 // } 461 466 462 467 public static Picture CreatePicture(Text source) { -
trunk/src/org/expeditee/items/XRayable.java
r1431 r1434 27 27 import org.expeditee.encryption.items.surrogates.Label; 28 28 import org.expeditee.gui.DisplayController; 29 import org.expeditee.gui.Frame; 29 30 30 31 public abstract class XRayable extends Item { … … 59 60 return true; 60 61 } else { 61 List<String> accessibleLabelsNames = Label.getAccessibleLabelsNames(this.getParent().getBody()); 62 Frame parent = this.getParent(); 63 List<String> accessibleLabelsNames = Label.getAccessibleLabelsNames(parent.getBody(true)); 62 64 return accessibleLabelsNames.contains(encryptionLabel); 63 65 } -
trunk/src/org/expeditee/setting/DirectoryListSetting.java
r1245 r1434 3 3 import java.io.File; 4 4 import java.util.ArrayList; 5 import java.util.HashMap; 5 6 import java.util.LinkedList; 6 7 import java.util.List; 8 import java.util.Map; 7 9 10 import org.expeditee.gui.DisplayController; 8 11 import org.expeditee.gui.FrameIO; 9 12 import org.expeditee.gui.FrameUtils; … … 11 14 12 15 public class DirectoryListSetting extends ListSetting<String> { 13 16 14 17 /* 15 18 public DirectoryListSetting(String tooltip, String name, List<String> value) { … … 23 26 @Override 24 27 public boolean setSetting(Text text) { 25 _value.addAll(FrameUtils.getDirs(text)); 28 List<String> dirs = FrameUtils.getDirs(text); 29 if (!dirs.isEmpty()) { 30 _value.clear(); 31 _value.addAll(dirs); 32 } 26 33 return true; 27 34 } 28 35 29 36 public List<String> getAbsoluteDirs() { 30 37 String parent_folder = FrameIO.PARENT_FOLDER; … … 44 51 // => use it 'as is' 45 52 abs = rel; 46 } 47 else { 48 abs = parent_folder + rel; 49 53 } else { 54 abs = parent_folder + rel; 50 55 } 51 56 value_absolute_dir.add(abs); -
trunk/src/org/expeditee/setting/ListSetting.java
r1242 r1434 26 26 import org.expeditee.gui.FrameIO; 27 27 import org.expeditee.items.Text; 28 import org.expeditee.settings.UserSettings; 28 29 29 30 public abstract class ListSetting<T> extends VariableSetting { … … 68 69 listFrame.getTitleItem().delete(); 69 70 70 int x = 100;71 int y = 100;71 int x = UserSettings.TitlePosition.get(); 72 int y = UserSettings.TitlePosition.get(); 72 73 for (T v: _value) { 73 74 if (v == null) continue; -
trunk/src/org/expeditee/settings/Settings.java
r1415 r1434 21 21 import java.lang.reflect.Field; 22 22 import java.lang.reflect.Method; 23 import java.util.ArrayList; 23 24 import java.util.Collection; 24 25 import java.util.HashMap; … … 30 31 import org.expeditee.gui.Frame; 31 32 import org.expeditee.gui.FrameCreator; 33 import org.expeditee.gui.FrameIO; 32 34 import org.expeditee.gui.MessageBay; 33 35 import org.expeditee.items.Item; … … 145 147 List<VariableSetting> set = new LinkedList<VariableSetting>(); 146 148 147 Frame child = text.getChild(); 149 String linkForChild = text.getAbsoluteLink(); 150 Frame child = FrameIO.LoadFrame(linkForChild, FrameIO.PROFILE_PATH); 148 151 149 152 if(child == null) return set; -
trunk/src/org/expeditee/settings/UserSettings.java
r1415 r1434 35 35 import org.expeditee.gui.FrameUtils; 36 36 import org.expeditee.gui.MessageBay; 37 import org.expeditee.gui.management.ProfileManager; 37 38 import org.expeditee.items.Text; 38 39 import org.expeditee.setting.BooleanSetting; … … 42 43 import org.expeditee.setting.IntegerSetting; 43 44 import org.expeditee.setting.ListSetting; 45 import org.expeditee.setting.Setting; 44 46 import org.expeditee.setting.StringSetting; 45 47 import org.expeditee.settings.folders.FolderSettings; … … 52 54 public abstract class UserSettings { 53 55 54 public static String DEFAULT_PROFILE_NAME = "default";56 public static final String DEFAULT_PROFILE_NAME = "default"; 55 57 56 58 public static Boolean PublicAndPrivateResources; … … 66 68 @Override 67 69 public boolean setSetting(Text text) { 68 if(text.getText().indexOf(':') == -1 || !text.hasLink()) { 69 text.setLink(UserSettings.ProfileName.get() + "1"); 70 String profileName = UserSettings.ProfileName.get(); 71 if(text.getText().indexOf(':') == -1 || !text.hasLink()) { 72 if (!profileName.equals(ProfileManager.USER_NAME_PATTERN)) { 73 text.setLink(profileName + "1"); 74 } 70 75 //text.setLink(FrameIO.LoadProfile(UserSettings.ProfileName.get()).getName()); 71 76 } … … 79 84 // MessageBay.warningMessage("Home frame: " + first 80 85 // + " is not a valid frame."); 81 _value = FrameIO.LoadProfile(UserSettings.ProfileName.get()).getName();86 _value = profileName + "1";//FrameIO.LoadProfile(UserSettings.ProfileName.get()).getName(); 82 87 } 83 88 return true; … … 104 109 public static final IntegerSetting TitlePosition = new IntegerSetting("Position of title item in frame (TODO: find whether this is x-offset or y-offset)", "TitlePosition", 150); 105 110 106 public static final StringSetting UserName = new StringSetting(" Profile name", FrameIO.ConvertToValidFramesetName(System.getProperty("user.name")));107 108 public static final StringSetting ProfileName = new StringSetting("Profile name", UserName.get());111 public static final StringSetting UserName = new StringSetting("User name", "${USER.NAME}"); // FrameIO.ConvertToValidFramesetName(System.getProperty("user.name")) 112 113 public static final StringSetting ProfileName = new StringSetting("Profile name", "${USER.NAME}"); 109 114 110 115 public static final BooleanSetting AntiAlias = new BooleanSetting("Whether anti-aliasing should be enabled", "AntiAlias", false); … … 246 251 if (PublicAndPrivateResources) { 247 252 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.HELP_PATH); 248 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.HELP_ PRIVATE_PATH);253 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.HELP_USERNAME_PRIVATE_PATH); 249 254 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.FRAME_PATH); 250 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.FRAME_ PRIVATE_PATH);255 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.FRAME_USERNAME_PRIVATE_PATH); 251 256 FolderSettings.FrameDirs.addAbsoluteDir(FrameIO.MESSAGES_PATH); 252 257 if (AuthenticatorBrowser.isAuthenticated()) { … … 258 263 259 264 FolderSettings.ImageDirs.addAbsoluteDir(FrameIO.IMAGES_PATH); 260 FolderSettings.ImageDirs.addAbsoluteDir(FrameIO.IMAGES_ PRIVATE_PATH);265 FolderSettings.ImageDirs.addAbsoluteDir(FrameIO.IMAGES_USERNAME_PRIVATE_PATH); 261 266 FolderSettings.ImageDirs.setDefault(FolderSettings.ImageDirs.get()); 262 267 263 268 FolderSettings.AudioDirs.addAbsoluteDir(FrameIO.AUDIO_PATH); 264 FolderSettings.AudioDirs.addAbsoluteDir(FrameIO.AUDIO_ PRIVATE_PATH);269 FolderSettings.AudioDirs.addAbsoluteDir(FrameIO.AUDIO_USERNAME_PRIVATE_PATH); 265 270 FolderSettings.AudioDirs.setDefault(FolderSettings.AudioDirs.get()); 266 271 } else {
Note:
See TracChangeset
for help on using the changeset viewer.