Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.class
*.jar
1 change: 1 addition & 0 deletions buildtools/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set -e
# Build script
# Version number
PRUNENAME=gpsprune_19.2
Expand Down
13 changes: 13 additions & 0 deletions src/tim/prune/function/edit/PointEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,23 @@ private void confirmEdit()
if (_model.getChanged(i))
{
Field field = fieldList.getField(i);
if (field == field.WAYPT_NAME) {
if (wasNameAdded(_model.getValue(i))) {
_app.createPoint(_point.clonePoint());
}
}
editList.addEdit(new FieldEdit(field, _model.getValue(i)));
undoList.addEdit(new FieldEdit(field, _point.getFieldValue(field)));
}
}
_app.completePointEdit(editList, undoList);
}

private boolean wasNameAdded(String newName)
{
String prevName = _point.getWaypointName();
boolean prevNull = (prevName == null || prevName.equals(""));
boolean newNull = (newName == null || newName.equals(""));
return (prevNull && !newNull);
}
}
22 changes: 21 additions & 1 deletion src/tim/prune/function/edit/PointNameEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,14 @@ private void confirmEdit()
// Check whether name has really changed
if (hasNameChanged())
{
// Make lists for edit and undo, and add the changed field
// If a new name has been added, changing the point
// from trackpoint to waypoint, duplicate it
if (wasNameAdded())
{
_app.createPoint(_point.clonePoint());
}

// make lists for edit and undo, and add the changed field
FieldEditList editList = new FieldEditList();
FieldEditList undoList = new FieldEditList();
editList.addEdit(new FieldEdit(Field.WAYPT_NAME, _nameField.getText().trim()));
Expand All @@ -231,4 +238,17 @@ private boolean hasNameChanged()
|| (!prevNull && newNull)
|| (!prevNull && !newNull && !prevName.equals(newName));
}

/**
* Check whether a new name has been added
* @return true if it has indeed
*/
private boolean wasNameAdded()
{
String prevName = _point.getWaypointName();
String newName = _nameField.getText().trim();
boolean prevNull = (prevName == null || prevName.equals(""));
boolean newNull = (newName == null || newName.equals(""));
return (prevNull && !newNull);
}
}
3 changes: 2 additions & 1 deletion src/tim/prune/gui/DisplayUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public static String buildDurationString(long inNumSecs)
if (inNumSecs < 86400L) return "" + (inNumSecs / 60 / 60) + I18nManager.getText("display.range.time.hours")
+ " " + ((inNumSecs / 60) % 60) + I18nManager.getText("display.range.time.mins");
if (inNumSecs < 432000L) return "" + (inNumSecs / 86400L) + I18nManager.getText("display.range.time.days")
+ " " + (inNumSecs / 60 / 60) % 24 + I18nManager.getText("display.range.time.hours");
+ " " + (inNumSecs / 60 / 60) % 24 + I18nManager.getText("display.range.time.hours")
+ " " + ((inNumSecs / 60) % 60) + I18nManager.getText("display.range.time.mins");
if (inNumSecs < 86400000L) return "" + (inNumSecs / 86400L) + I18nManager.getText("display.range.time.days");
return "big";
}
Expand Down
2 changes: 1 addition & 1 deletion src/tim/prune/gui/map/MapCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class MapCanvas extends JPanel implements MouseListener, MouseMotionListe
WpIconDefinition _waypointIconDefinition = null;

/** Constant for click sensitivity when selecting nearest point */
private static final int CLICK_SENSITIVITY = 10;
private static final int CLICK_SENSITIVITY = 30;
/** Constant for pan distance from key presses */
private static final int PAN_DISTANCE = 20;
/** Constant for pan distance from autopan */
Expand Down