Skip to content

Commit

Permalink
Show only TRZ path in tab when opening TRK zipped inside
Browse files Browse the repository at this point in the history
  • Loading branch information
dobrown committed May 2, 2019
1 parent 7ad5dbc commit fca5b3e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/org/opensourcephysics/cabrillo/tracker/TrackerIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ public void run() {
if (!VideoIO.isCanceled()) {
monitorDialog.close();
open(trkFiles, frame, tempFiles); // this also adds tempFile paths to trackerPanel
// add TRZ, ZIP and JAR paths to recent files
Tracker.addRecent(nonURIPath, false); // add at beginning
return;
}
Expand Down Expand Up @@ -908,8 +909,6 @@ public void run() {
trackerPanel = (TrackerPanel)control.loadObject(trackerPanel);

trackerPanel.frame = frame;
trackerPanel.defaultFileName = XML.getName(path);
trackerPanel.openedFromPath = path;

// find page view files and add to TrackerPanel.pageViewFilePaths
findPageViewFiles(control, trackerPanel.pageViewFilePaths);
Expand All @@ -919,7 +918,19 @@ public void run() {
trackerPanel.supplementalFilePaths.add(s);
}
}
trackerPanel.setDataFile(new File(ResourceLoader.getNonURIPath(path)));
boolean isZippedTRK = xmlPath!=null &&
(xmlPath.contains(".zip!") || xmlPath.contains(".trz!") || xmlPath.contains(".jar!")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (isZippedTRK) {
String parent = Tracker.recentFiles.get(0);
trackerPanel.openedFromPath = parent;
trackerPanel.defaultFileName = XML.getName(parent);
}
else {
trackerPanel.defaultFileName = XML.getName(path);
trackerPanel.openedFromPath = path;
trackerPanel.setDataFile(new File(ResourceLoader.getNonURIPath(path)));
}

if (monitorDialog.isVisible())
monitorDialog.setProgress(80);
if (VideoIO.isCanceled()) return;
Expand Down Expand Up @@ -962,12 +973,12 @@ else if(!control.failedToRead()) {
monitorDialog.close();
rawPath = XML.forwardSlash(rawPath);
if (xmlPath!=null &&
(xmlPath.contains(".zip!") || //$NON-NLS-1$
xmlPath.contains(".trz!") || //$NON-NLS-1$
xmlPath.contains(".jar!"))) { //$NON-NLS-1$
!xmlPath.contains(".zip!") && //$NON-NLS-1$
!xmlPath.contains(".trz!") && //$NON-NLS-1$
!xmlPath.contains(".jar!")) { //$NON-NLS-1$
rawPath = XML.forwardSlash(xmlPath);
Tracker.addRecent(ResourceLoader.getNonURIPath(rawPath), false); // add at beginning
}
Tracker.addRecent(ResourceLoader.getNonURIPath(rawPath), false); // add at beginning
TMenuBar.getMenuBar(trackerPanel).refresh();
TTrackBar.refreshMemoryButton();
trackerPanel.changed = panelChanged;
Expand Down
3 changes: 3 additions & 0 deletions src/org/opensourcephysics/cabrillo/tracker/TrackerPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ public String getToolTipPath() {
if (getDataFile() != null) {
return XML.forwardSlash(getDataFile().getPath());
}
if (openedFromPath != null) {
return openedFromPath;
}
if (getVideo() != null) {
String path = (String) getVideo().getProperty("absolutePath"); //$NON-NLS-1$
if (path != null) {
Expand Down

0 comments on commit fca5b3e

Please sign in to comment.