diff --git a/Source/mesquite/Mesquite.java b/Source/mesquite/Mesquite.java index 3e971bc6c..b5c2d8ae5 100644 --- a/Source/mesquite/Mesquite.java +++ b/Source/mesquite/Mesquite.java @@ -350,7 +350,7 @@ else if (prefsFile.exists() || prefsFileXML.exists()) { try { equiv = ImageIO.read(new File(MesquiteModule.getRootPath() + "images/equivocal.gif")); } catch (IOException e) { - Debugg.println(" IOException trying to read equivocal texture "); + MesquiteMessage.println(" IOException trying to read equivocal texture "); } GraphicsUtil.missingDataTexture = new TexturePaint(equiv, new Rectangle(0, 0, 16, 16)); @@ -748,7 +748,7 @@ private void findMesquiteDirectory(){ String manualString = mesquiteDirectory + sep + "docs/mesquite" + sep + "manual.html"; File manual = new File(manualString); - storedManualString = manualString; //Debugg.println get rid of this stuff! + storedManualString = manualString; } setMesquiteDirectoryPath(); @@ -1479,6 +1479,18 @@ public void searchData(String s, MesquiteWindow window){ if (helpSearchManager != null) helpSearchManager.searchData(s, window); } + + public String getNumModuleStarts() { + StringBuffer sb=new StringBuffer(); + for (int i= 0; i0) + sb.append(mmi.getClassName() + "\t" + starts+StringUtil.lineEnding()); + } + return sb.toString(); + } + /*.................................................................................................................*/ MesquiteInteger pos = new MesquiteInteger(); String noticeLocation = "http://"; //before release, change URL to "http://" @@ -1820,7 +1832,11 @@ else if (checker.compare(this.getClass(), "Quits Mesquite", null, commandName, " reportMemory(); logln("==^^^^^^^^^^^^^^^^^^^^=="); } + } + logln("\n"); + logln("All modules that have been started at least once, and the number of times they have been started:"); + logln(getNumModuleStarts()); /* if (Listened.listenersRemaining>0) { for (int i = 0; i " + StringUtil.protectForUnix(outFilePath)); else - shellScript.append(" --out " + StringUtil.protectForUnix(outFilePath) + " " + StringUtil.protectForUnix(inFilePath)); //Debugg.println need to check MAFFT windows format + shellScript.append(" --out " + StringUtil.protectForUnix(outFilePath) + " " + StringUtil.protectForUnix(inFilePath)); } diff --git a/Source/mesquite/align/lib/ExternalSequenceAligner.java b/Source/mesquite/align/lib/ExternalSequenceAligner.java index 665bc94ef..9bff08ca3 100644 --- a/Source/mesquite/align/lib/ExternalSequenceAligner.java +++ b/Source/mesquite/align/lib/ExternalSequenceAligner.java @@ -111,7 +111,7 @@ public String getQueryProgramOptions() { } /*.................................................................................................................*/ public boolean queryOptions() { - if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) //Debugg.println needs to check that options set well enough to proceed anyway + if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) return true; MesquiteInteger buttonPressed = new MesquiteInteger(1); ExtensibleDialog dialog = new ExtensibleDialog(containerOfModule(), getProgramName() + " Locations & Options",buttonPressed); //MesquiteTrunk.mesquiteTrunk.containerOfModule() diff --git a/Source/mesquite/basic/PrefixedStringMatcher/PrefixedStringMatcher.java b/Source/mesquite/basic/PrefixedStringMatcher/PrefixedStringMatcher.java index 7919d39c4..c82a8ed5f 100644 --- a/Source/mesquite/basic/PrefixedStringMatcher/PrefixedStringMatcher.java +++ b/Source/mesquite/basic/PrefixedStringMatcher/PrefixedStringMatcher.java @@ -29,7 +29,7 @@ public boolean startJob(String arguments, Object condition, boolean hiredByName) } /** returns true if the options are set and accepted.*/ public boolean queryOptions(){ - if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) //Debugg.println needs to check that options set well enough to proceed anyway + if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) return true; MesquiteInteger buttonPressed = new MesquiteInteger(1); @@ -64,7 +64,6 @@ public boolean stringsMatch(String s1, String s2) { catch (Exception e) { return false; } - //Debugg.println("nextChars1: " + nextChars1 + ", nextChars2: " + nextChars2 + " " + nextChars1.equalsIgnoreCase(nextChars2)); if (StringUtil.blank(nextChars1) || StringUtil.blank(nextChars2)) return false; return nextChars1.equalsIgnoreCase(nextChars2); diff --git a/Source/mesquite/categ/ManageCategoricalChars/ManageCategoricalChars.java b/Source/mesquite/categ/ManageCategoricalChars/ManageCategoricalChars.java index e74d9b94a..d155b42a6 100644 --- a/Source/mesquite/categ/ManageCategoricalChars/ManageCategoricalChars.java +++ b/Source/mesquite/categ/ManageCategoricalChars/ManageCategoricalChars.java @@ -84,6 +84,8 @@ public CharacterData processFormat(MesquiteFile file, Taxa taxa, String dataType data.setName(title); //because otherwise titles are not set for fused matrices within ManageCharacters, since on the outside they don't know if it's new } else { + if (fuse) + data.setSuppressSpecssetReading(true); if (taxa == null) taxa = data.getTaxa(); data.suppressChecksum = true; diff --git a/Source/mesquite/categ/ManageDNARNAChars/ManageDNARNAChars.java b/Source/mesquite/categ/ManageDNARNAChars/ManageDNARNAChars.java index d0267a1fe..9bf604658 100644 --- a/Source/mesquite/categ/ManageDNARNAChars/ManageDNARNAChars.java +++ b/Source/mesquite/categ/ManageDNARNAChars/ManageDNARNAChars.java @@ -10,7 +10,7 @@ This source code and its compiled class files are free and modifiable under the terms of GNU Lesser General Public License. (http://www.gnu.org/copyleft/lesser.html) -*/ + */ package mesquite.categ.ManageDNARNAChars; import java.util.*; @@ -24,11 +24,11 @@ /* ======================================================================== Manages DNA and RNA data matrices */ public class ManageDNARNAChars extends CategMatrixManager { - + /*.................................................................................................................*/ public boolean startJob(String arguments, Object condition, boolean hiredByName) { return true; - } + } public Class getDataClass(){ return DNAData.class; } @@ -64,7 +64,7 @@ public CharacterData processFormat(MesquiteFile file, Taxa taxa, String dataType else proj = getProject(); CategoricalData data= null; - + //@@@@@@@@@@@@@@@@@@@@ boolean fuse = parser.hasFileReadingArgument(fileReadingArguments, "fuseTaxaCharBlocks"); @@ -82,8 +82,11 @@ public CharacterData processFormat(MesquiteFile file, Taxa taxa, String dataType if (fuse) data.setName(title); //because otherwise titles are not set for fused matrices within ManageCharacters, since on the outside they don't know if it's new } - else + else { + if (fuse) + data.setSuppressSpecssetReading(true); data.suppressChecksum = true; + } ((DNAData)data).setDisplayAsRNA(true); } else { @@ -100,8 +103,11 @@ public CharacterData processFormat(MesquiteFile file, Taxa taxa, String dataType if (fuse) data.setName(title); //because otherwise titles are not set for fused matrices within ManageCharacters, since on the outside they don't know if it's new } - else - data.suppressChecksum = true; + else{ + if (fuse) + data.setSuppressSpecssetReading(true); + data.suppressChecksum = true; + } } data.interleaved = false; //reset default in case this is fused //@@@@@@@@@@@@@@@@@@@@ @@ -117,7 +123,7 @@ else if (tok.equalsIgnoreCase("interleave")) { if ("=".equals(e)){ String y = ParseUtil.getToken(formatCommand, stringPos); //yes or no ? data.interleaved = ("yes".equalsIgnoreCase(y)); - + } else { stringPos.setValue(sp); @@ -301,7 +307,7 @@ else if (file.writeOnlySelectedTaxa) blocks.append(getCharStateLabels(data)); writeNexusMatrix(data, cB, blocks, file, progIndicator); - + blocks.append( StringUtil.lineEnding()); if (!file.useSimplifiedNexus){ String idsCommand = null; @@ -313,23 +319,23 @@ else if (file.writeOnlySelectedTaxa) if (cB !=null) blocks.append(cB.getUnrecognizedCommands() + StringUtil.lineEnding()); blocks.append("END;" + StringUtil.lineEnding()); - // MesquiteModule.mesquiteTrunk.mesquiteMessage("DNA matrix composed", 1, 0); + // MesquiteModule.mesquiteTrunk.mesquiteMessage("DNA matrix composed", 1, 0); file.writeLine( blocks.toString()); } /*.................................................................................................................*/ - public String getName() { + public String getName() { return "Manage DNA/RNA matrices"; - } - + } + /*.................................................................................................................*/ - /** returns an explanation of what the module does.*/ - public String getExplanation() { - return "Manages DNA/RNA data matrices (including read/write in NEXUS file)." ; - } + /** returns an explanation of what the module does.*/ + public String getExplanation() { + return "Manages DNA/RNA data matrices (including read/write in NEXUS file)." ; + } } - - + + diff --git a/Source/mesquite/categ/ManageProteinChars/ManageProteinChars.java b/Source/mesquite/categ/ManageProteinChars/ManageProteinChars.java index b5a60076b..e5b1fdb40 100644 --- a/Source/mesquite/categ/ManageProteinChars/ManageProteinChars.java +++ b/Source/mesquite/categ/ManageProteinChars/ManageProteinChars.java @@ -76,8 +76,11 @@ public CharacterData processFormat(MesquiteFile file, Taxa taxa, String dataType if (fuse) data.setName(title); //because otherwise titles are not set for fused matrices within ManageCharacters, since on the outside they don't know if it's new } - else + else { + if (fuse) + data.setSuppressSpecssetReading(true); data.suppressChecksum = true; + } //@@@@@@@@@@@@@@@@@@@@ String tok = ParseUtil.getToken(formatCommand, stringPos); while (!tok.equals(";")) { diff --git a/Source/mesquite/charMatrices/AlterAllMatrices/AlterAllMatrices.java b/Source/mesquite/charMatrices/AlterAllMatrices/AlterAllMatrices.java index 348237007..7ca1261c3 100644 --- a/Source/mesquite/charMatrices/AlterAllMatrices/AlterAllMatrices.java +++ b/Source/mesquite/charMatrices/AlterAllMatrices/AlterAllMatrices.java @@ -93,12 +93,11 @@ public boolean processFile(MesquiteFile file){ if (proj == null) return false; boolean success = true; + CompatibilityTest test = alterTask.getCompatibilityTest(); for (int im = 0; im < proj.getNumberCharMatrices(file); im++){ CharacterData data = proj.getCharacterMatrix(file, im); - //Debugg.println checkCompatibility - - Debugg.println("Altering matrix " + im + " (" + data.getName() + ", id = " + data.getID() + ")"); - success = success && alterTask.alterData(data, null, null); + if (test.isCompatible(data.getStateClass(), getProject(), this)) + success = success && alterTask.alterData(data, null, null); } return success; diff --git a/Source/mesquite/charMatrices/BasicDataWindowMaker/BasicDataWindowMaker.java b/Source/mesquite/charMatrices/BasicDataWindowMaker/BasicDataWindowMaker.java index 06f16e477..ffc6c059c 100644 --- a/Source/mesquite/charMatrices/BasicDataWindowMaker/BasicDataWindowMaker.java +++ b/Source/mesquite/charMatrices/BasicDataWindowMaker/BasicDataWindowMaker.java @@ -2246,7 +2246,7 @@ public boolean requestCellColorer(MesquiteModule mb, int ic, int it, String mess if (ic >= 0 && it >= 0) { // matrix cells if (table.cellColorer == mb) return true; - if ((table.cellColorer == null || table.cellColorer instanceof mesquite.charMatrices.NoColor.NoColor) || (message != null && AlertDialog.query(this, "Cell colors", message, "Yes", "No"))) { + if ((table.cellColorer == null || table.cellColorer instanceof mesquite.charMatrices.NoColor.NoColor) && (message != null && AlertDialog.query(this, "Cell colors", message, "Yes", "No"))) { setCellColorer(mb); table.repaintAll(); return true; @@ -2255,7 +2255,7 @@ public boolean requestCellColorer(MesquiteModule mb, int ic, int it, String mess else if (ic < 0 && it >= 0) { // row names if (table.rowNamesColorer == mb) return true; - if ((table.rowNamesColorer == null || table.rowNamesColorer instanceof mesquite.charMatrices.NoColor.NoColor) || (message != null && AlertDialog.query(this, "Row name colors", message, "Yes", "No"))) { + if ((table.rowNamesColorer == null || table.rowNamesColorer instanceof mesquite.charMatrices.NoColor.NoColor) && (message != null && AlertDialog.query(this, "Row name colors", message, "Yes", "No"))) { setRowNamesColorer(mb); table.repaintAll(); return true; @@ -2264,7 +2264,7 @@ else if (ic < 0 && it >= 0) { // row names else if (ic >= 0 && it < 0) { // column names if (table.columnNamesColorer == mb) return true; - if ((table.columnNamesColorer == null || table.columnNamesColorer instanceof mesquite.charMatrices.NoColor.NoColor) || (message != null && AlertDialog.query(this, "Column name colors", message, "Yes", "No"))) { + if ((table.columnNamesColorer == null || table.columnNamesColorer instanceof mesquite.charMatrices.NoColor.NoColor) && (message != null && AlertDialog.query(this, "Column name colors", message, "Yes", "No"))) { setColumnNamesColorer(mb); table.repaintAll(); return true; diff --git a/Source/mesquite/charMatrices/StoredMatrices/StoredMatrices.java b/Source/mesquite/charMatrices/StoredMatrices/StoredMatrices.java index 6db0ce2f7..918d725b0 100644 --- a/Source/mesquite/charMatrices/StoredMatrices/StoredMatrices.java +++ b/Source/mesquite/charMatrices/StoredMatrices/StoredMatrices.java @@ -157,20 +157,20 @@ public void disposing(Object obj){ if (taxa !=null && taxa.isDoomed()) { taxa = null; - if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Taxa block that is in use has been deleted")) //Debugg.println needs to check that options set well enough to proceed anyway + if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Taxa block that is in use has been deleted")) return; - logln("Taxa null or being disposed; StoredMatrices will quit.");//Debugg.println + logln("Taxa null or being disposed; StoredMatrices will quit."); iQuit(); return; } data = null; dataName.setValue("No matrix is currently in use"); - if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Character matrix that is in use has been deleted")) //Debugg.println needs to check that options set well enough to proceed anyway + if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Character matrix that is in use has been deleted")) return; - discreetAlert("A character data matrix in use (for " + getEmployer().getName() + ") has been deleted. Another matrix will be sought."); //Debugg.println + discreetAlert("A character data matrix in use (for " + getEmployer().getName() + ") has been deleted. Another matrix will be sought."); if (dataClass!=null) { if (getProject().getNumberCharMatricesVisible(taxa, dataClass)<=0) { alert("No compatible character matrices were found, and so Stored Matrices cannot be used."); diff --git a/Source/mesquite/cont/lib/ManageContCharsA.java b/Source/mesquite/cont/lib/ManageContCharsA.java index 6ef0d5ea5..a9ccd08e8 100644 --- a/Source/mesquite/cont/lib/ManageContCharsA.java +++ b/Source/mesquite/cont/lib/ManageContCharsA.java @@ -84,8 +84,11 @@ public CharacterData processFormat(MesquiteFile file, Taxa taxa, String dataType if (fuse) data.setName(title); //because otherwise titles are not set for fused matrices within ManageCharacters, since on the outside they don't know if it's new } - else + else { + if (fuse) + data.setSuppressSpecssetReading(true); data.suppressChecksum = true; + } data.interleaved = false; //reset default in case this is fused //@@@@@@@@@@@@@@@@@@@@ diff --git a/Source/mesquite/correl/lib/PagelMatrixModel.java b/Source/mesquite/correl/lib/PagelMatrixModel.java index 5ff2df1b4..7e7637850 100644 --- a/Source/mesquite/correl/lib/PagelMatrixModel.java +++ b/Source/mesquite/correl/lib/PagelMatrixModel.java @@ -385,7 +385,7 @@ private double[] prepareQList(double[] values){ for (int i=0;i= values.length) - Debugg.println("values length " + values.length + " [qMapping[i] " + qMapping[i]); + MesquiteMessage.println("values length " + values.length + " [qMapping[i] " + qMapping[i]); qList[i] = values[qMapping[i]]; } return qList; diff --git a/Source/mesquite/lib/EmployerEmployee.java b/Source/mesquite/lib/EmployerEmployee.java index 84a73cea7..c5a00615a 100644 --- a/Source/mesquite/lib/EmployerEmployee.java +++ b/Source/mesquite/lib/EmployerEmployee.java @@ -1040,11 +1040,15 @@ private boolean startupEmployee(MesquiteModule mb, Class dutyClass, Object condi started = mb.superStartJob(null, null, false); if (started) started = mb.startJob(null, null, false); + if (started) + mb.incrementNumStarts(); } else { started = mb.superStartJob(arguments, condition, false); if (started) started = mb.startJob(arguments, condition, false); + if (started) + mb.incrementNumStarts(); } } catch (Exception e) { diff --git a/Source/mesquite/lib/GraphicsUtil.java b/Source/mesquite/lib/GraphicsUtil.java index df3dd0448..ae7f40645 100644 --- a/Source/mesquite/lib/GraphicsUtil.java +++ b/Source/mesquite/lib/GraphicsUtil.java @@ -15,6 +15,7 @@ import java.awt.*; import java.awt.event.*; +import java.awt.geom.*; import java.awt.image.*; @@ -23,6 +24,45 @@ /** This class provides general graphics utilities */ public class GraphicsUtil { public static TexturePaint missingDataTexture = null; + /*_________________________________________________*/ + public static void drawArrow(Graphics2D g2, int fromX, int fromY, int toX, int toY, int thickness) { + // based on Vincent Reig's stackoverflow answer http://stackoverflow.com/a/3094933 + // create an AffineTransform + // and a triangle centered on (0,0) and pointing downward + // somewhere outside Swing's paint loop + Stroke stroke = g2.getStroke(); + g2.setStroke(new BasicStroke(thickness)); + g2.drawLine(fromX, fromY, toX, toY); + g2.setStroke(stroke); + AffineTransform tx = new AffineTransform(); + Line2D.Double line = new Line2D.Double(fromX, fromY, toX, toY); + + Polygon arrowHead = new Polygon(); + int size = thickness*3; + arrowHead.addPoint( 0,size); + arrowHead.addPoint( -size, -size); + arrowHead.addPoint( size,-size); + + // [...] + tx.setToIdentity(); + double angle = Math.atan2(line.y2-line.y1, line.x2-line.x1); + tx.translate(line.x2, line.y2); + tx.rotate((angle-Math.PI/2d)); + + Graphics2D g = (Graphics2D) g2.create(); + g.setTransform(tx); + g.fill(arrowHead); + g.dispose(); + } + /*_________________________________________________*/ + public static void drawCross(Graphics g, int x, int y, int size) { + Shape oldClip = g.getClip(); + g.setClip(x-size, y-size, size*2, size*2); + g.drawLine(x, y-size, x, y+size); + g.drawLine(x-size, y, x+size, y); + g.setClip(oldClip); + } + /* ............................................................................................................... */ /** Given the coordinates of the start and end of a line, returns how far along the line (x,y) is */ public static double fractionAlongLine(int x, int y, int xStart, int yStart, int xEnd, int yEnd, boolean xBias, boolean yBias) { @@ -203,7 +243,7 @@ public static boolean useXORMode(Graphics g, boolean sensitive){ public static void fillTransparentSelectionRectangle (Graphics g, int x, int y, int w, int h) { Composite composite = ColorDistribution.getComposite(g); ColorDistribution.setTransparentGraphics(g,0.3f); - g.setColor(Color.black); + g.setColor(Color.gray); g.fillRect(x,y,w, h); ColorDistribution.setComposite(g, composite); } @@ -211,11 +251,49 @@ public static void fillTransparentSelectionRectangle (Graphics g, int x, int y, public static void fillTransparentSelectionPolygon (Graphics g, Polygon poly) { Composite composite = ColorDistribution.getComposite(g); ColorDistribution.setTransparentGraphics(g,0.3f); - g.setColor(Color.black); + g.setColor(Color.gray); g.fillPolygon(poly); ColorDistribution.setComposite(g, composite); } /* -------------------------------------------------*/ + public static void fillTransparentSelectionArea (Graphics2D g, Area area) { + Composite composite = ColorDistribution.getComposite(g); + ColorDistribution.setTransparentGraphics(g,0.3f); + g.setColor(Color.gray); + g.fill(area); + ColorDistribution.setComposite(g, composite); + } + /* -------------------------------------------------*/ + public static void fillTransparentBorderedSelectionRectangle (Graphics g, int x, int y, int w, int h) { + if (w < 0){ + int nx = x + w; + x = nx; + w = -w; + } + if (h < 0){ + int ny = y + h; + y = ny; + h = -h; + } + Composite composite = ColorDistribution.getComposite(g); + ColorDistribution.setTransparentGraphics(g,0.3f); + g.setColor(Color.gray); + g.fillRect(x,y,w,h); + ColorDistribution.setComposite(g, composite); + g.setColor(Color.gray); + g.drawRect(x,y,w,h); + } + /* -------------------------------------------------*/ + public static void fillTransparentBorderedSelectionPolygon (Graphics g, Polygon poly) { + Composite composite = ColorDistribution.getComposite(g); + ColorDistribution.setTransparentGraphics(g,0.3f); + g.setColor(Color.gray); + g.fillPolygon(poly); + ColorDistribution.setComposite(g, composite); + g.setColor(Color.gray); + g.drawPolygon(poly); + } + /* -------------------------------------------------*/ public static void shadeRectangle (Graphics g, int x, int y, int w, int h, Color color) { Composite composite = ColorDistribution.getComposite(g); ColorDistribution.setTransparentGraphics(g,0.2f); @@ -235,6 +313,20 @@ public static void darkenRectangle (Graphics g, int x, int y, int w, int h, floa public static void darkenRectangle (Graphics g, int x, int y, int w, int h) { darkenRectangle(g,x,y,w,h,0.2f); } + /* -------------------------------------------------*/ + public static void fixRectangle (Rectangle rect) { + if (rect.width < 0){ + int nx = rect.x + rect.width; + rect.x = nx; + rect.width = -rect.width; + } + if (rect.height < 0){ + int ny = rect.y + rect.height; + rect.y = ny; + rect.height = -rect.height; + } + } + /* -------------------------------------------------*/ public static void drawRect (Graphics g, int x, int y, int w, int h) { if (w < 0){ diff --git a/Source/mesquite/lib/HelpSearchManager.java b/Source/mesquite/lib/HelpSearchManager.java index d17a7e5ff..a4b2e954c 100644 --- a/Source/mesquite/lib/HelpSearchManager.java +++ b/Source/mesquite/lib/HelpSearchManager.java @@ -178,8 +178,8 @@ private String searchComponents(String s, Component c) { String expl = ((Explainable) c).getExplanation(); if (stringsFound(expl, s)) { result += "
  • "; + + MesquiteFile.massageFilePathToURL(((ImageOwner) c) + .getImagePath()) + "\"> "; result += expl+ "
  • "; } } @@ -192,7 +192,7 @@ private String searchComponents(String s, Component c) { return result; } /* - + String searchManual(String s, boolean useBrowser){ String results = ""; String arefStart = "showPage:"; @@ -274,7 +274,7 @@ public void loadManual(){ MesquiteTrunk.mesquiteTrunk.logln(".. manual ready."); manualLoading = 0; } - */ + */ String menuResults = null; String controlResults = null; @@ -299,22 +299,22 @@ String searchModules(String s, boolean useBrowser){ /*.................................................................................................................*/ public void searchKeyword(String s, boolean useBrowser){ String results = ""; - - //ADDING RESULTS FROM CURRENT MENUS - menuResults = searchMenus(s, useBrowser); - - //ADDING RESULTS FROM CURRENT Controls - controlResults = searchControls(s); - - if (!StringUtil.blank(menuResults) || !StringUtil.blank(controlResults)){ - results += "

    Menu items and controls in current windows matching search criteria

      "; - if (!StringUtil.blank(menuResults)) - results += "
    •  Menu items in current windows
    • "; - if (!StringUtil.blank(controlResults)) - results += "
    •  Buttons and tools in current windows
    • "; - results += "
    "; + if (!useBrowser){ + //ADDING RESULTS FROM CURRENT MENUS + menuResults = searchMenus(s, useBrowser); + + //ADDING RESULTS FROM CURRENT Controls + controlResults = searchControls(s); + + if (!StringUtil.blank(menuResults) || !StringUtil.blank(controlResults)){ + results += "

    Menu items and controls in current windows matching search criteria

      "; + if (!StringUtil.blank(menuResults)) + results += "
    •  Menu items in current windows
    • "; + if (!StringUtil.blank(controlResults)) + results += "
    •  Buttons and tools in current windows
    • "; + results += "
    "; + } } - //ADDING RESULTS FROM MODULE INFORMATION String smod = searchModules(s, useBrowser); if (!StringUtil.blank(smod)) @@ -336,7 +336,7 @@ else if (manualLoading == 2){ String sman = searchManual(s, useBrowser); if (!StringUtil.blank(sman)) results += "

    Manual Pages

      " + sman + "
    "; - */ + */ if (StringUtil.blank(results)) @@ -599,7 +599,7 @@ private void showModuleUse(MesquiteHTMLWindow w, MesquiteModuleInfo mmi, int whi if (paths.size() > 0) nextPrevString =" "; - + else nextPrevString =" "; /* @@ -630,8 +630,8 @@ private void showModuleUse(MesquiteHTMLWindow w, MesquiteModuleInfo mmi, int whi } } String intro = "" + searchColoursString + "" + - "

    " + name + "

    " + explanation + "" + - "

    " + mmi.getClassName() + "
    "; + "

    " + name + "

    " + explanation + "" + + "

    " + mmi.getClassName() + "
    "; if (countUses < maxCount){ if (paths.size() > 0) nextPrevString = pageString + "[Last page] " + nextPrevString + " "; @@ -997,7 +997,7 @@ private String keywordInfo(MesquiteModuleInfo mmi, FunctionExplainable func, int if (!StringUtil.blank(func.getURLString())) if (func.URLinPackageIntro()) nameString += "More Information."; -// nameString += "More Information."; + // nameString += "More Information."; else nameString += "More Information."; return nameString+StringUtil.lineEnding(); diff --git a/Source/mesquite/lib/InfoBar.java b/Source/mesquite/lib/InfoBar.java index 36aecfb70..db83ef1cf 100644 --- a/Source/mesquite/lib/InfoBar.java +++ b/Source/mesquite/lib/InfoBar.java @@ -305,7 +305,6 @@ public void paint (Graphics g) { int rel = getWidth() - preReleaseLoc; if (mod != null) { - //Debugg.println : this has been deleted from infobar; hint that there are prerelease needs to be placed elsewhere if (prereleaseImage !=null && releaseImage!=null){ if (mod.anySubstantivePrereleases()) diff --git a/Source/mesquite/lib/Listened.java b/Source/mesquite/lib/Listened.java index 4fca16ad3..550c272d4 100644 --- a/Source/mesquite/lib/Listened.java +++ b/Source/mesquite/lib/Listened.java @@ -188,7 +188,6 @@ public void notifyListeners(Object caller, Notification notification, Class cls } else { try { ls[m].changed(caller, this, notification); - //Debugg.println(" listener: " + ls[m]); } catch (Throwable e){ //added 2. 72 to avoid crash in changed from stopping all other listeners from hearing try { diff --git a/Source/mesquite/lib/MenuOwner.java b/Source/mesquite/lib/MenuOwner.java index f21bdc1bd..40d0195db 100644 --- a/Source/mesquite/lib/MenuOwner.java +++ b/Source/mesquite/lib/MenuOwner.java @@ -703,7 +703,7 @@ else if (menuBar==null) spot.add(new MenuItem(" refer to current window")); menuBar.add(spot); int numBeforeSpecificMenus = menuBar.getMenuCount(); - MesquiteMenu menu; //Debugg.println if no menus added delete white and black boxes + MesquiteMenu menu; if (moduleMenuSpec!=null) { menu = MesquiteMenu.getMenu(moduleMenuSpec); } @@ -999,7 +999,7 @@ public final synchronized void recomposeWindowsMenu(MesquiteMenuBar menuBar, Mes private MesquitePopup fillWindowMenu(Vector menuBar, MesquiteWindow whichWindow){ MesquitePopup wMenu = MesquitePopup.getPopupMenu(new MesquiteMenuSpec(null, "Window", module), whichWindow.infoBar); if (whichWindow!=null) { - if (whichWindow.permitViewMode()){ //Debugg.println menuchange these should belong to window itself + if (whichWindow.permitViewMode()){ MesquiteSubmenu setViewModeMenu = MesquiteSubmenu.getSubmenu("View Mode", wMenu, module); setViewModeMenu.add(new MesquiteMenuItem("Graphics (Standard)", module, MesquiteModule.makeCommand("showPage", whichWindow), Integer.toString(0))); //commandArgument setViewModeMenu.add(new MesquiteMenuItem("Text", module, module.makeCommand("showPage", whichWindow), Integer.toString(1))); //commandArgument @@ -1044,7 +1044,7 @@ private MesquitePopup fillWindowMenu(Vector menuBar, MesquiteWindow whichWindow) private MesquiteMenu fillWindowMenu(MesquiteMenuBar menuBar, MesquiteWindow whichWindow){ MesquiteMenu wMenu = MesquiteMenu.getMenu(new MesquiteMenuSpec(null, "Window", module)); if (whichWindow!=null) { - if (whichWindow.permitViewMode()){ //Debugg.println menuchange these should belong to window itself + if (whichWindow.permitViewMode()){ MesquiteSubmenu setViewModeMenu = MesquiteSubmenu.getSubmenu("View Mode", wMenu, module); setViewModeMenu.add(new MesquiteMenuItem("Graphics (Standard)", module, MesquiteModule.makeCommand("showPage", whichWindow), Integer.toString(0))); //commandArgument setViewModeMenu.add(new MesquiteMenuItem("Text", module, module.makeCommand("showPage", whichWindow), Integer.toString(1))); //commandArgument diff --git a/Source/mesquite/lib/MesquiteFile.java b/Source/mesquite/lib/MesquiteFile.java index 4c5883c81..e3ca83eeb 100644 --- a/Source/mesquite/lib/MesquiteFile.java +++ b/Source/mesquite/lib/MesquiteFile.java @@ -2098,7 +2098,7 @@ public static boolean deleteDirectory(String directoryPath){ public static long fileOrDirectoryLastModified(String path) { if (path != null) { if (path.indexOf("//")>=0) - MesquiteMessage.printStackTrace("double // in path " + path); //Debugg.printStackTrace temporarily printStackTrace to force us to fix things + MesquiteMessage.printStackTrace("double // in path " + path); File testing = new File(path); return testing.lastModified(); } @@ -2109,7 +2109,7 @@ public static long fileOrDirectoryLastModified(String path) { public static boolean fileOrDirectoryExists(String path) { if (path != null) { if (path.indexOf("//")>=0) - MesquiteMessage.printStackTrace("double // in path " + path); //Debugg.printStackTrace temporarily printStackTrace to force us to fix things + MesquiteMessage.printStackTrace("double // in path " + path); File testing = new File(path); if (testing.exists()) return true; @@ -2133,7 +2133,7 @@ else if (!(directoryName.endsWith(fileSeparator) || directoryName.endsWith("/")) public static boolean fileExists(String path) { if (path != null) { if (path.indexOf("//")>=0) - MesquiteMessage.printStackTrace("double // in path " + path); //Debugg.printStackTrace temporarily printStackTrace to force us to fix things + MesquiteMessage.printStackTrace("double // in path " + path); File testing = new File(path); if (testing.exists() && !testing.isDirectory()) return true; diff --git a/Source/mesquite/lib/MesquiteModule.java b/Source/mesquite/lib/MesquiteModule.java index e0bfa7ae4..002697ac6 100644 --- a/Source/mesquite/lib/MesquiteModule.java +++ b/Source/mesquite/lib/MesquiteModule.java @@ -68,7 +68,7 @@ public abstract class MesquiteModule extends EmployerEmployee implements Command /*.................................................................................................................*/ /** returns build date of the Mesquite system (e.g., "22 September 2003") */ public final static String getBuildDate() { - return "21 August 2014"; + return "23 August 2014"; } /*.................................................................................................................*/ /** returns version of the Mesquite system */ @@ -89,7 +89,7 @@ public final static String getBuildLetter() { public final static int getBuildNumber() { //as of 26 Dec 08, build naming changed from letter + number to just number. Accordingly j105 became 473, based on // highest build numbers of d51+e81+g97+h66+i69+j105 + 3 for a, b, c - return 625; + return 630; } //0.95.80 14 Mar 01 - first beta release //0.96 2 April 01 beta - second beta release @@ -253,6 +253,10 @@ public void broadCastAssignedID(MesquiteModule module, String assignedID){ } } + /*.................................................................................................................*/ + public void incrementNumStarts(){ + getModuleInfo().incrementNumStarts(); + } /*.................................................................................................................*/ /** superStartJob is called automatically when an employee is hired. This is intended for use by superclasses of modules that need their own constructor-like call, without relying on the subclass to be polite enough to call super.startJob().*/ @@ -2234,6 +2238,10 @@ public static void showWebPage(String path, boolean autoCompose, boolean removeP uri=file.toURI(); } else uri = new URI(path); + if (!remote && !CommandChecker.documentationComposed && autoCompose) { + CommandChecker checker = new CommandChecker(); + checker.composeDocumentation(); + } d.browse(uri); } catch (IOException e) { @@ -2255,6 +2263,10 @@ else if (MesquiteTrunk.isMacOSX()){ //Mac OS X return; } else { + if (!remote && !CommandChecker.documentationComposed && autoCompose) { + CommandChecker checker = new CommandChecker(); + checker.composeDocumentation(); + } File testing = new File(pathToCheck); if (!testing.exists()) { MesquiteTrunk.mesquiteTrunk.alert("The requested page could not be shown, because the file could not be found. (" + pathToCheck + ")" ); @@ -2288,10 +2300,7 @@ else if (MesquiteTrunk.isMacOSX()){ //Mac OS X } } else { - if (!remote && !CommandChecker.documentationComposed && autoCompose) { - CommandChecker checker = new CommandChecker(); - checker.composeDocumentation(); - } + try { BrowserLauncher.openURL(path); return; diff --git a/Source/mesquite/lib/MesquiteModuleInfo.java b/Source/mesquite/lib/MesquiteModuleInfo.java index 550746dc4..fc379ff79 100644 --- a/Source/mesquite/lib/MesquiteModuleInfo.java +++ b/Source/mesquite/lib/MesquiteModuleInfo.java @@ -76,6 +76,7 @@ public class MesquiteModuleInfo implements Listable, CompatibilityChecker, Funct boolean hideable = true; int versionOfFirstRelease = 0; boolean def = false; + int numStarts = 0; NexusBlockTest nexusBlockTest; NexusCommandTest nexusCommandTest; CompatibilityTest compatibilityTest; @@ -278,6 +279,16 @@ public void removeMacro(MesquiteMacro macro){ public Vector getMacros(){ return macros; } + public int getNumStarts() { + return numStarts; + } + public void setNumStarts(int numStarts) { + this.numStarts = numStarts; + } + public void incrementNumStarts() { + numStarts++; + } + /** returns name to be used in menu item to hire the module. By default this is the same as the name of the module, but can be different if the module overrides its own getNameForMenuItem method.*/ diff --git a/Source/mesquite/lib/MesquiteProject.java b/Source/mesquite/lib/MesquiteProject.java index 8b0c45ffe..b17bd6bff 100644 --- a/Source/mesquite/lib/MesquiteProject.java +++ b/Source/mesquite/lib/MesquiteProject.java @@ -1531,7 +1531,7 @@ public int getNumberTaxas() { return taxas.size(); } - public TreeVector storeTree(MesquiteWindow parent, Tree tree){ + public TreeVector storeTree(MesquiteWindow parent, Tree tree, boolean askIfSingleBlock){ if (ownerModule == null || tree == null) return null; TreeVector trees=null; @@ -1543,7 +1543,7 @@ public TreeVector storeTree(MesquiteWindow parent, Tree tree){ MesquiteFile f = ownerModule.getProject().chooseFile("In which file should new tree block be placed?"); trees = manager.makeNewTreeBlock(tree.getTaxa(), treesListName, f); } - else if (numLists == 1){ + else if (numLists == 1 && !askIfSingleBlock){ trees = manager.getTreeBlock(tree.getTaxa(), 0); } else { @@ -1553,7 +1553,9 @@ else if (numLists == 1){ lists[numLists] = new MesquiteString("New Trees Block...", "New Trees Block..."); Object obj = ListDialog.queryList(parent, "Where to store tree?", "Choose tree block in which to store tree:",MesquiteString.helpString, lists, 0); if (obj instanceof MesquiteString){ - String treesListName = MesquiteString.queryString(parent, "New Tree Block" , "Name of new Tree Block: ", "Trees"); + ListableVector v = manager.getTreeBlockVector(); + String suggestedName = v.getUniqueName("Trees"); + String treesListName = MesquiteString.queryString(parent, "New Tree Block" , "Name of new Tree Block: ", suggestedName); MesquiteFile f = ownerModule.getProject().chooseFile("In which file should new tree block be placed?"); trees = manager.makeNewTreeBlock(tree.getTaxa(), treesListName, f); } diff --git a/Source/mesquite/lib/MesquiteThread.java b/Source/mesquite/lib/MesquiteThread.java index 8432bb7d3..4bcfc82ec 100644 --- a/Source/mesquite/lib/MesquiteThread.java +++ b/Source/mesquite/lib/MesquiteThread.java @@ -441,9 +441,9 @@ public String getCurrentCommandExplanation(){ } /*.................................................................................................................*/ - public static void pauseForSeconds(int seconds){ + public static void pauseForSeconds(double seconds){ try { - Thread.sleep(1000*seconds); + Thread.sleep((int)(1000*seconds)); } catch (InterruptedException e) { return; diff --git a/Source/mesquite/lib/MesquiteWindow.java b/Source/mesquite/lib/MesquiteWindow.java index 5d3ad53ba..1fdf021ba 100644 --- a/Source/mesquite/lib/MesquiteWindow.java +++ b/Source/mesquite/lib/MesquiteWindow.java @@ -353,7 +353,9 @@ public void popOut(boolean setVisible){ } } public void popIn(){ - if ((getPopAsTile() || isLoneWindow()) && parentFrame!=null){ + if (isLoneWindow()) + getOwnerModule().getFileCoordinator().getModuleWindow().getParentFrame().popIn(this); + else if ((getPopAsTile()) && parentFrame!=null){ parentFrame.popIn(this); } ownerModule.resetEmbeddedMenus(this); diff --git a/Source/mesquite/lib/SelectionRectangle.java b/Source/mesquite/lib/SelectionRectangle.java new file mode 100644 index 000000000..78ea6bc1b --- /dev/null +++ b/Source/mesquite/lib/SelectionRectangle.java @@ -0,0 +1,63 @@ +package mesquite.lib; + +import java.awt.*; +import java.awt.geom.*; + +// not yet used; only partially built +/* ======================================================================== */ +public class SelectionRectangle { + Rectangle selectionRect; + + public SelectionRectangle(Graphics2D g2, int x, int y, int w, int h){ + this.selectionRect = new Rectangle(x,y,w,h); + GraphicsUtil.fillTransparentSelectionRectangle(g2, x,y,w,h); + } + public Rectangle setRectangle() { + return selectionRect; + } + public void setRectangle(Rectangle selectionRect) { + this.selectionRect = selectionRect; + } + public void zeroRectangle(Rectangle selectionRect) { + this.selectionRect = null; + } + public void setRectangle(int x, int y, int w, int h) { + this.selectionRect = new Rectangle(x,y,w,h); + GraphicsUtil.fixRectangle(selectionRect); + } + + public static Area createAreaFromRectangle(Rectangle rect) { + Path2D.Float path = new Path2D.Float(); + path.moveTo(rect.x, rect.y); + path.lineTo(rect.x+rect.width, rect.y); + path.lineTo(rect.x+rect.width, rect.y+rect.height); + path.lineTo(rect.x, rect.y+rect.height); + path.lineTo(rect.x, rect.y); + path.closePath(); + return new Area(path); + } + public void drawSelectionDifference(Graphics2D g2, Component comp, int x, int y, int w, int h) { + Rectangle newRect = new Rectangle(x,y,w,h); + GraphicsUtil.fixRectangle(newRect); + Area newArea = createAreaFromRectangle(newRect); + Area differenceArea = createAreaFromRectangle(selectionRect); + + if (differenceArea!=null) { + differenceArea.exclusiveOr(newArea); + Shape oldClip = g2.getClip(); + g2.setClip(differenceArea); + if (selectionRect.contains(newRect)) { // original rect is bigger + comp.repaint(selectionRect.x, selectionRect.y, selectionRect.width, selectionRect.height); + GraphicsUtil.fillTransparentSelectionRectangle(g2, x,y,w,h); + } else if (newRect.contains(selectionRect)) { // new rect is bigger + GraphicsUtil.fillTransparentSelectionArea(g2, differenceArea); + } + g2.setClip(oldClip); + } + + + selectionRect.setRect(newRect); + + + } +} \ No newline at end of file diff --git a/Source/mesquite/lib/Taxa.java b/Source/mesquite/lib/Taxa.java index 6894b003a..3dada2913 100644 --- a/Source/mesquite/lib/Taxa.java +++ b/Source/mesquite/lib/Taxa.java @@ -45,6 +45,7 @@ public class Taxa extends FileElement { private boolean inFlux = false; private boolean duplicate = false; + public Taxa(int numTaxa) { super(numTaxa); // For associable @@ -81,7 +82,6 @@ void notifyOfChangeLowLevel(int code, int i1, int i2, int i3){ } } } - /* ................................................................................................................. */ public String searchData(String s, MesquiteString commandResult) { if (commandResult != null) diff --git a/Source/mesquite/lib/TaxaTreeDisplay.java b/Source/mesquite/lib/TaxaTreeDisplay.java index 6b1e043cc..e69c471ab 100644 --- a/Source/mesquite/lib/TaxaTreeDisplay.java +++ b/Source/mesquite/lib/TaxaTreeDisplay.java @@ -15,6 +15,7 @@ import java.awt.*; import java.util.*; + import mesquite.lib.duties.*; /* ======================================================================== */ @@ -234,6 +235,8 @@ public void paint(Graphics g) { } public void fillTaxon(Graphics g, int m){} + public void redrawTaxa(Graphics g, int M) {} + public boolean pointInTaxon(int m, int x, int y){return false;} public boolean taxonInRectangle(Taxa taxa, int it, int x1, int y1, int x2, int y2){ return false;} diff --git a/Source/mesquite/lib/TreeDrawing.java b/Source/mesquite/lib/TreeDrawing.java index 8986f3a96..24ba29aa5 100644 --- a/Source/mesquite/lib/TreeDrawing.java +++ b/Source/mesquite/lib/TreeDrawing.java @@ -142,10 +142,11 @@ public int getNodeValueTextBaseY(int node, int edgewidth, int stringwidth, int f /*_________________________________________________*/ /** Does the basic inverting of the color of a branch **/ public void fillBranchInverted (Tree tree, int N, Graphics g) { - if (GraphicsUtil.useXORMode(g, true)) { + // if (GraphicsUtil.useXORMode(g, true)) { g.setColor(Color.black); - g.setXORMode(Color.white); //for some reason color makes no difference in MacOS, but is inversion color in Win95 + //g.setXORMode(Color.white); //for some reason color makes no difference in MacOS, but is inversion color in Win95 //GraphicsUtil.setToXOR(g); + g.setColor(Color.yellow); try{ fillBranch(tree, N, g); } @@ -154,7 +155,7 @@ public void fillBranchInverted (Tree tree, int N, Graphics g) { } g.setPaintMode(); g.setColor(Color.black); - } +// } } /** Fill branch N to indicate missing data */ diff --git a/Source/mesquite/lib/characters/CharacterData.java b/Source/mesquite/lib/characters/CharacterData.java index 03162a362..9355f32cb 100644 --- a/Source/mesquite/lib/characters/CharacterData.java +++ b/Source/mesquite/lib/characters/CharacterData.java @@ -188,14 +188,15 @@ public boolean getCharNumChanging() { public void setCharNumChanging(boolean charNumChanging) { this.charNumChanging = charNumChanging; } - /*.................................................................................................................* - public UndoInstructions getUndoInstructions(){ - return undoInstructions; + /*.................................................................................................................*/ + private boolean suppressSpecsetReading = false; //for fuse taxa & matrices, so that on merge the subsequent specsets don't take over + public void setSuppressSpecssetReading(boolean s){ + suppressSpecsetReading = s; } - /*.................................................................................................................* - public void setUndoInstructions(UndoInstructions undoInstructions){ - this.undoInstructions=undoInstructions; + public boolean getSuppressSpecssetReading(){ + return suppressSpecsetReading; } + /*.................................................................................................................*/ public UndoInstructions getUndoInstructionsAllData(){ //undoInstructions = new UndoInstructions (UndoInstructions.ALLDATACELLS, this, this); diff --git a/Source/mesquite/lib/duties/CharSpecsSetManager.java b/Source/mesquite/lib/duties/CharSpecsSetManager.java index deff760d7..844c4b7e0 100644 --- a/Source/mesquite/lib/duties/CharSpecsSetManager.java +++ b/Source/mesquite/lib/duties/CharSpecsSetManager.java @@ -221,7 +221,8 @@ else if (project.getNumberCharMatrices(file)>0) //should use first in this file MesquiteMessage.discreetNotifyUser("Sorry, a " + lowerCaseTypeName() + " could not be read because its associated data set was not found. This can occur if you are fusing files, or if you have edited files by hand or with another program. Another possible cause is that your current Mesquite configuration doesn't include packages to read matrices of that type. Try restarting Mesquite after selecting \"Use all installed packages\" in the Activate/Deactivate submenu of the File menu.\n\nCommand: " + command); return false; } - + if (data.getSuppressSpecssetReading()) + return true; //acting as everything is fine, but in fact specset was ignored if ("=".equals(token)) token = ParseUtil.getToken(command, startCharT); //getting name of first model diff --git a/Source/mesquite/lib/duties/TreeBlockFiller.java b/Source/mesquite/lib/duties/TreeBlockFiller.java index 673f1b5e0..f0e697211 100644 --- a/Source/mesquite/lib/duties/TreeBlockFiller.java +++ b/Source/mesquite/lib/duties/TreeBlockFiller.java @@ -119,9 +119,6 @@ public void fillTreeBlock(TreeVector treeList, int numberIfUnlimited){ fillTreeBlock(treeList,numberIfUnlimited, false); } - //TEMPORARY Debugg.println Should be only in disconnectable tree block fillers - public void retrieveTreeBlock(TreeVector treeList, int numberIfUnlimited){ - } } diff --git a/Source/mesquite/lib/duties/TreeSearcher.java b/Source/mesquite/lib/duties/TreeSearcher.java index 28dcbb75b..f31151ba8 100644 --- a/Source/mesquite/lib/duties/TreeSearcher.java +++ b/Source/mesquite/lib/duties/TreeSearcher.java @@ -52,9 +52,7 @@ public void setNumberTask(NumberForTree numTask){ public boolean isReconnectable(){ return false; } - //TEMPORARY Debugg.println Should be only in disconnectable tree block fillers - public void retrieveTreeBlock(TreeVector treeList){ - } + public boolean canGiveIntermediateResults(){ return false; } diff --git a/Source/mesquite/lists/CharGroupListColor/CharGroupListColor.java b/Source/mesquite/lists/CharGroupListColor/CharGroupListColor.java index 6da669890..bc2063d11 100644 --- a/Source/mesquite/lists/CharGroupListColor/CharGroupListColor.java +++ b/Source/mesquite/lists/CharGroupListColor/CharGroupListColor.java @@ -89,7 +89,7 @@ public Color getBackgroundColorOfCell(int ic, boolean selected){ Color newColor = null; /*.................................................................................................................*/ public boolean chooseColor(Color oldColor){ //so assistant can do something in response to arrow touch; return true if the event is to stop there, i.e. be intercepted - if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) //Debugg.println needs to check that options set well enough to proceed anyway + if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) return true; JFrame guiFrame = new JFrame(); newColor = JColorChooser.showDialog(guiFrame, "Pick a Color", oldColor); diff --git a/Source/mesquite/lists/TaxonGroupListColor/TaxonGroupListColor.java b/Source/mesquite/lists/TaxonGroupListColor/TaxonGroupListColor.java index dde54fb6c..e52471e64 100644 --- a/Source/mesquite/lists/TaxonGroupListColor/TaxonGroupListColor.java +++ b/Source/mesquite/lists/TaxonGroupListColor/TaxonGroupListColor.java @@ -90,7 +90,7 @@ public void drawInCell(int ic, Graphics g, int x, int y, int w, int h, boolean Color newColor = null; /*.................................................................................................................*/ public boolean chooseColor(Color oldColor){ //so assistant can do something in response to arrow touch; return true if the event is to stop there, i.e. be intercepted - if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) //Debugg.println needs to check that options set well enough to proceed anyway + if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) return true; JFrame guiFrame = new JFrame(); newColor = JColorChooser.showDialog(guiFrame, "Pick a Color", oldColor); diff --git a/Source/mesquite/lists/TaxonGroupListSymbol/TaxonGroupListSymbol.java b/Source/mesquite/lists/TaxonGroupListSymbol/TaxonGroupListSymbol.java index 2ab1d8f0c..0c9ffcdf0 100644 --- a/Source/mesquite/lists/TaxonGroupListSymbol/TaxonGroupListSymbol.java +++ b/Source/mesquite/lists/TaxonGroupListSymbol/TaxonGroupListSymbol.java @@ -68,7 +68,7 @@ public void setTableAndData(MesquiteTable table, CharacterData data){ /*.................................................................................................................*/ public boolean queryOptions(MesquiteSymbol oldSymbol) { - if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) //Debugg.println needs to check that options set well enough to proceed anyway + if (!okToInteractWithUser(CAN_PROCEED_ANYWAY, "Querying Options")) return true; GroupSymbolsDialog symbolsDialog = new GroupSymbolsDialog(getProject(), containerOfModule(), "Symbol Options", "", oldSymbol); symbolsDialog.completeAndShowDialog(); diff --git a/Source/mesquite/lists/lib/ListTable.java b/Source/mesquite/lists/lib/ListTable.java index ef5c913c8..2b4011d77 100644 --- a/Source/mesquite/lists/lib/ListTable.java +++ b/Source/mesquite/lists/lib/ListTable.java @@ -102,8 +102,6 @@ public void selectedRowsDropped(int after){ undoInstructions.recordPreviousOrder(assoc); UndoReference undoReference = new UndoReference(undoInstructions, ownerModule); - Debugg.println("ASSOC " + assoc.getClass()); - while (i\n"); } buff.append("\n"); - MesquiteFile.createDirectory(getInstallationSettingsPath() ); //Debugg.println : this is a problem if user doesn't have write permission + MesquiteFile.createDirectory(getInstallationSettingsPath() ); MesquiteFile.putFileContents(getInstallationSettingsPath() + "receipts.xml", buff.toString(), true, false); } diff --git a/Source/mesquite/minimal/ManageTaxa/ManageTaxa.java b/Source/mesquite/minimal/ManageTaxa/ManageTaxa.java index 159d64a12..4ebdd3b86 100644 --- a/Source/mesquite/minimal/ManageTaxa/ManageTaxa.java +++ b/Source/mesquite/minimal/ManageTaxa/ManageTaxa.java @@ -986,7 +986,7 @@ else if (!(commandName.equalsIgnoreCase("BEGIN") || commandName.equalsIgnoreCase if (t==null) { - if (fuse) + if (fuse && merging) t = newTaxa.getNexusBlock(); else t = newTaxa.addToFile(file, getProject(), this); diff --git a/Source/mesquite/minimal/Simplicity/SimplifyControlWindow.java b/Source/mesquite/minimal/Simplicity/SimplifyControlWindow.java index 27f9832b7..b804c854f 100644 --- a/Source/mesquite/minimal/Simplicity/SimplifyControlWindow.java +++ b/Source/mesquite/minimal/Simplicity/SimplifyControlWindow.java @@ -205,6 +205,7 @@ public MovePanel(SimplifyControlWindow window){ setCursor(new Cursor(Cursor.N_RESIZE_CURSOR)); this.window = window; setBackground(Color.darkGray); + setBackground(Color.blue); } public void mouseDown(int modifiers, int clickCount, long when, int x, int y, MesquiteTool tool) { if (MesquiteWindow.checkDoomed(this)) @@ -593,7 +594,7 @@ public SaveRenameDeleteButton(){ setForeground(ColorTheme.getExtInterfaceTextContrast()); //ColorTheme.getExtInterfaceElement()); } - void redoMenu() {//Debugg.println don't use this if can't save because don't have permissions + void redoMenu() {// don't use this if can't save because don't have permissions if (popup==null) popup = new MesquitePopup(this); popup.removeAll(); @@ -619,7 +620,7 @@ public void resetSize(){ class LoadButton extends LoadSaveDeleteButton { public LoadButton(){ super("Load Simplification"); - setForeground(ColorTheme.getExtInterfaceBackground()); + setForeground(Color.darkGray); } void redoMenu() { if (popup==null) @@ -764,6 +765,7 @@ public ModePanel(SimplifyControlWindow w){ loadButton.setFont(fontBig); loadButton.setVisible(true); add(loadButton); + saveRenameDeleteButton = new SaveRenameDeleteButton(); saveRenameDeleteButton.setFont(fontBig); saveRenameDeleteButton.setVisible(true); diff --git a/Source/mesquite/molec/TaxaListHasData/TaxaListHasData.java b/Source/mesquite/molec/TaxaListHasData/TaxaListHasData.java index 25769e5ca..f0ddfbd9b 100644 --- a/Source/mesquite/molec/TaxaListHasData/TaxaListHasData.java +++ b/Source/mesquite/molec/TaxaListHasData/TaxaListHasData.java @@ -51,8 +51,8 @@ public boolean startJob(String arguments, Object condition, boolean hiredByName) matrixSourceTask = (MatrixSourceCoord)hireEmployee(MatrixSourceCoord.class, "Source of character matrix (for " + getName() + ")"); if (matrixSourceTask==null) return sorry(getName() + " couldn't start because no source of character matrices was obtained."); - addMenuItem("Delete Prepended Length", makeCommand("deletePrepended", this)); //Debugg.println temporary for Wayne!!!!!! - addMenuItem("Delete *", makeCommand("deleteStar", this)); //Debugg.println temporary for Wayne!!!!!! + // addMenuItem("Delete Prepended Length", makeCommand("deletePrepended", this)); // for Wayne!!!!!! + // addMenuItem("Delete *", makeCommand("deleteStar", this)); // for Wayne!!!!!! addMenuItem("Delete Data For Selected Taxa", makeCommand("deleteData", this)); addMenuItem("Prepend Sequence Length", makeCommand("prependLength", this)); addMenuItem("Prepend Number of Non-missing Sites", makeCommand("prependNumSites", this)); diff --git a/Source/mesquite/ornamental/NodeLocsCircular/NodeLocsCircular.java b/Source/mesquite/ornamental/NodeLocsCircular/NodeLocsCircular.java index 98e322bb4..e71d035a6 100644 --- a/Source/mesquite/ornamental/NodeLocsCircular/NodeLocsCircular.java +++ b/Source/mesquite/ornamental/NodeLocsCircular/NodeLocsCircular.java @@ -441,8 +441,8 @@ public String writeOnTree(Tree tree, int drawnRoot) { public void drawOnTree(Tree tree, int drawnRoot, Graphics g) { if (locsModule.showScale.getValue() && locsModule.showBranchLengths.getValue()) locsModule.drawGrid(g, tree.tallestPathAboveNode(drawnRoot, 1.0), locsModule.scaling, locsModule.treeCenter); - g.setColor(Color.green); - g.fillOval(locsModule.centerx-8, locsModule.centery-8, 16, 16); + //g.setColor(Color.green); + //g.fillOval(locsModule.centerx-8, locsModule.centery-8, 16, 16); } /*.................................................................................................................*/ public void printOnTree(Tree tree, int drawnRoot, Graphics g) { diff --git a/Source/mesquite/search/TreeSearch/TreeSearch.java b/Source/mesquite/search/TreeSearch/TreeSearch.java index 5af0bfc75..00ef6d099 100644 --- a/Source/mesquite/search/TreeSearch/TreeSearch.java +++ b/Source/mesquite/search/TreeSearch/TreeSearch.java @@ -156,10 +156,6 @@ public void fillTreeBlock(TreeVector treeList, int numberIfUnlimited){ searchTask.fillTreeBlock(treeList); } - //TEMPORARY Debugg.println Should be only in disconnectable tree block fillers - public void retrieveTreeBlock(TreeVector treeList, int numberIfUnlimited){ - searchTask.retrieveTreeBlock(treeList); - } /*.................................................................................................................*/ public String getParameters() { if (searchTask==null) diff --git a/Source/mesquite/trees/BallsNSticks/BallsNSticks.java b/Source/mesquite/trees/BallsNSticks/BallsNSticks.java index 83eec15a3..4c235c858 100644 --- a/Source/mesquite/trees/BallsNSticks/BallsNSticks.java +++ b/Source/mesquite/trees/BallsNSticks/BallsNSticks.java @@ -620,13 +620,11 @@ private void fillSpot(Graphics g, int node){ /*_________________________________________________*/ public void fillTerminalBox(Tree tree, int node, Graphics g) { fillBranch(tree, node, g); - //Debugg.println ???take this over to fill terminal spot rather than box, to avoid predicted/reconstructed being confused with observed // need to show more informative terminal information } /*_________________________________________________*/ public void fillTerminalBoxWithColors(Tree tree, int node, ColorDistribution colors, Graphics g){ fillBranchWithColors(tree, node, colors, g); - //Debugg.println ???take this over to fill terminal spot rather than box, to avoid predicted/reconstructed being confused with observed } /*_________________________________________________*/ private boolean ancestorIsTriangled(Tree tree, int node) { diff --git a/Source/mesquite/trees/BasicDrawTaxonNames/BasicDrawTaxonNames.java b/Source/mesquite/trees/BasicDrawTaxonNames/BasicDrawTaxonNames.java index c6d19ba43..aa2f90b1d 100644 --- a/Source/mesquite/trees/BasicDrawTaxonNames/BasicDrawTaxonNames.java +++ b/Source/mesquite/trees/BasicDrawTaxonNames/BasicDrawTaxonNames.java @@ -715,11 +715,12 @@ else if (treeDisplay.getOrientation()==TreeDisplay.FREEFORM) { textRotator.assignBackground(null); gL.setColor(Color.black); ColorDistribution.setComposite(gL,composite); - if (selected && GraphicsUtil.useXORMode(gL, false) && !namePolys[taxonNumber].isHidden()){ - gL.setXORMode(Color.white); - gL.fillPolygon(namePolys[taxonNumber]); + if (selected && !namePolys[taxonNumber].isHidden()){ //&& GraphicsUtil.useXORMode(gL, false) + //gL.setXORMode(Color.white); + //gL.fillPolygon(namePolys[taxonNumber]); + GraphicsUtil.fillTransparentBorderedSelectionPolygon(gL, namePolys[taxonNumber]); - gL.setPaintMode(); + // gL.setPaintMode(); } } @@ -983,7 +984,7 @@ public int findTaxon(Tree tree, int drawnRoot, int x, int y) { public void fillTaxon(Graphics g, int M) { try { if ((namePolys!=null) && (namePolys[M]!=null) && !namePolys[M].isHidden()) { - g.fillPolygon(namePolys[M]); + GraphicsUtil.fillTransparentBorderedSelectionPolygon(g,namePolys[M]); } } catch (ArrayIndexOutOfBoundsException e) { diff --git a/Source/mesquite/trees/BasicTreeDrawCoordinator/BasicTreeDrawCoordinator.java b/Source/mesquite/trees/BasicTreeDrawCoordinator/BasicTreeDrawCoordinator.java index d3464f800..727f3053e 100644 --- a/Source/mesquite/trees/BasicTreeDrawCoordinator/BasicTreeDrawCoordinator.java +++ b/Source/mesquite/trees/BasicTreeDrawCoordinator/BasicTreeDrawCoordinator.java @@ -967,6 +967,11 @@ public void drawBranchLengthsOnTree(Tree tree, int drawnRoot, Graphics g) { /*_________________________________________________*/ public void fillTaxon(Graphics g, int M) { ((DrawTreeCoordinator)ownerModule).getNamesTask().fillTaxon(g, M); + } + /*_________________________________________________*/ + public void redrawTaxa(Graphics g, int M) { + ((DrawTreeCoordinator)ownerModule).getNamesTask().drawNames(this, tree, getTreeDrawing().getDrawnRoot(), g); + } /*_________________________________________________*/ private boolean responseOK(){ diff --git a/Source/mesquite/trees/BasicTreeWindowMaker/BasicTreeWindowMaker.java b/Source/mesquite/trees/BasicTreeWindowMaker/BasicTreeWindowMaker.java index 504cbc1dd..23288e2c6 100644 --- a/Source/mesquite/trees/BasicTreeWindowMaker/BasicTreeWindowMaker.java +++ b/Source/mesquite/trees/BasicTreeWindowMaker/BasicTreeWindowMaker.java @@ -17,6 +17,10 @@ import java.util.*; import java.awt.*; import java.awt.event.*; +import java.awt.geom.AffineTransform; +import java.awt.geom.Area; +import java.awt.geom.Line2D; +import java.awt.geom.Path2D; import mesquite.categ.lib.CategDataEditorInitD; import mesquite.lib.*; @@ -241,7 +245,9 @@ public boolean treeIsEdited(){ public void showTree(Tree tree){ if (basicTreeWindow==null) return; - basicTreeWindow.setCloneOfTree(tree, true); + MesquiteBoolean editStatusToSet = new MesquiteBoolean(); + basicTreeWindow.setCloneOfTree(tree, true, editStatusToSet); + basicTreeWindow.treeEdited = editStatusToSet.getValue(); } /*.................................................................................................................*/ /** return whether or not this module should have snapshot saved when saving a macro given the current snapshot mode.*/ @@ -446,6 +452,7 @@ else if (Notification.getCode(notification) == MesquiteListener.NUM_ITEMS_CHANGE basicTreeWindow.numTreesChanged(); } else if (Notification.getCode(notification) != MesquiteListener.SELECTION_CHANGED){ + basicTreeWindow.originalTree = null; basicTreeWindow.resetForTreeSource(false, false); //if switching between tree blocks, should reset to zero! If storing tree in tree block, shouldn't! basicTreeWindow.contentsChanged(); } @@ -854,7 +861,7 @@ public BasicTreeWindow ( BasicTreeWindowMaker ownerModule, TreeSource tsT, Taxa if (tempTree == null) { tree = taxa.getDefaultTree(); usingDefaultBush = true; - ownerModule.discreetAlert(MesquiteThread.isScripting() || warningGivenForTreeSource,"Tree source \"" +treeSourceTask.getName() + "\" is not supplying a tree; a default tree will be shown in Tree Window (c)."); + ownerModule.discreetAlert(MesquiteThread.isScripting() || warningGivenForTreeSource,"Tree source \"" +treeSourceTask.getName() + "\" is not supplying a tree; a default tree may be shown in Tree Window (c)."); if (!MesquiteThread.isScripting()) warningGivenForTreeSource = true; } @@ -1048,7 +1055,7 @@ public BasicTreeWindow ( BasicTreeWindowMaker ownerModule, TreeSource tsT, Taxa XMLUtil.readXMLPreferences(ownerModule, this, xmlPrefsString); - setTreeName(); + setTreeName(tree); sizeDisplay(); ownerModule.hireAllEmployees(TreeWindowAssistantI.class); Enumeration em = ownerModule.getEmployeeVector().elements(); @@ -1720,7 +1727,7 @@ else if (treeEdited) + "Tree scroll in the upper left of the tree window.", "Discard", "Retain", 0); - if (retainTree) + if (retainTree & treeEdited) editedTree = tree; // if this is done, and the tree is unot disposed, then it will be remembered unhookPreviousTree(); if (!retainTree) @@ -2049,7 +2056,7 @@ else if (checker.compare(this.getClass(), "Saves a macro to redo the analysis of else if (checker.compare(this.getClass(), "Sets the tree as having been edited (e.g. so that it can be treated as \"untitled\")", null, commandName, "treeEdited")) { treeEdited(true); treeChanged( true); - setTreeName(); + setTreeName(tree); setExplanation(baseExplanation, true); if (getMode()>0) updateTextPage(); @@ -2071,16 +2078,17 @@ else if (checker.compare(this.getClass(), "Sets the tree to that described by th Tree t = setTree(descr); // process the tree fully, including [%color = 4] if (t!=null){ treeEdited(true); - setTreeName(); + setTreeName(t); return t; } } else if (checker.compare(this.getClass(), "Sets the tree to a recently edited tree", "[number of edited tree]", commandName, "showRecentEdited")) { int r = MesquiteInteger.fromFirstToken(arguments, pos); if (MesquiteInteger.isCombinable(r) && r < recentEditedTrees.size()) { - setCloneOfTree(recentEditedTrees.getTree(r), false); - treeEdited(false); - setTreeName(); + MesquiteBoolean editStatusToSet = new MesquiteBoolean(); + Tree t = setCloneOfTree(recentEditedTrees.getTree(r), false, editStatusToSet); + treeEdited(editStatusToSet.getValue()); + setTreeName(t); } } @@ -2127,7 +2135,7 @@ else if (checker.compare(this.getClass(), "Stores the current tree as a new stor s = MesquiteString.queryString(this, "Store Tree As" , "Name of tree: ", tree.getName() ); if (s!=null) { tree.setName(s); - TreeVector trees = ownerModule.getProject().storeTree(this, tree); + TreeVector trees = ownerModule.getProject().storeTree(this, tree, !treeSourceTask.nameMatches("StoredTrees")); if (trees!=null) { TreesManager manager = (TreesManager)ownerModule.findElementManager(TreeVector.class); @@ -2195,13 +2203,14 @@ else if (checker.compare(this.getClass(), "Stores the current tree back into the return null; if (originalTree!=null && treeEdited) { ((MesquiteTree)originalTree).setToClone(tree); - ((MesquiteTree)originalTree).notifyListeners(this, new Notification(MesquiteListener.BRANCHES_REARRANGED)); - if (((MesquiteTree)originalTree).getTreeVector() !=null) + if (originalTree!=null) + ((MesquiteTree)originalTree).notifyListeners(this, new Notification(MesquiteListener.BRANCHES_REARRANGED)); + if (originalTree!=null && ((MesquiteTree)originalTree).getTreeVector() !=null) ((MesquiteTree)originalTree).getTreeVector().notifyListeners(this, new Notification(MesquiteListener.PARTS_CHANGED)); - messagePanel.setHighlighted(false, !treeSourceLocked()); - if (treeInfoPanel != null) - treeInfoPanel.setHighlighted(false, !treeSourceLocked()); treeEdited=false; + messagePanel.setHighlighted(false, !treeSourceLocked()); + if (treeInfoPanel != null) + treeInfoPanel.setHighlighted(!treeSourceLocked()); resetBaseExplanation(); } return originalTree; @@ -2225,8 +2234,9 @@ else if (checker.compare(this.getClass(), "Goes to the next tree in the tree sou } else if (checker.compare(this.getClass(), "Undoes the previous tree change", null, commandName, "undo")) { if (undoTree !=null && canUndo && undoTree.upToDateWithTaxa()) { - setCloneOfTree(undoTree, false); - treeEdited(false); + MesquiteBoolean editStatusToSet = new MesquiteBoolean(); + setCloneOfTree(undoTree, false, editStatusToSet); + treeEdited(editStatusToSet.getValue()); return tree; } } @@ -2861,7 +2871,7 @@ public void treeEdited(boolean rememberEditedTree){ } messagePanel.setHighlighted(true, !treeSourceLocked()); if (treeInfoPanel != null) - treeInfoPanel.setHighlighted(true, !treeSourceLocked()); + treeInfoPanel.setHighlighted(!treeSourceLocked()); palette.paletteScroll.setEnableEnter(true); if (tree!=null) treeVersion = tree.getVersionNumber(); @@ -2925,18 +2935,19 @@ public Tree goToTreeNumber(int index){ } } - Tree t = setCloneOfTree(treeT, true); - treeEdited=false; - messagePanel.setHighlighted(false, !treeSourceLocked()); + MesquiteBoolean editStatusToSet = new MesquiteBoolean(); + Tree t = setCloneOfTree(treeT, true, editStatusToSet); + treeEdited=editStatusToSet.getValue(); + setTreeName(t); + messagePanel.setHighlighted(treeEdited, !treeSourceLocked()); if (treeInfoPanel != null) - treeInfoPanel.setHighlighted(false, !treeSourceLocked()); + treeInfoPanel.setHighlighted(!treeSourceLocked()); palette.paletteScroll.setCurrentValue(MesquiteTree.toExternal(currentTreeNumber)); //resetLockImage(); storeTreeMenuItem.setEnabled(!treeSourceLocked()); resetBaseExplanation(); checkPanelPositionsLegal(); - setTreeName(); return t; } @@ -3009,17 +3020,17 @@ public void unfit(Object o){ public void InvertTaxon(Graphics g, int M) { if (findTaxon(treeDisplay.getMouseX(), treeDisplay.getMouseY()) == M){ //still in taxon - g.setColor(Color.black); - if (GraphicsUtil.useXORMode(g, true)) { - g.setXORMode(Color.white); - try{ - treeDisplay.fillTaxon(g, M); - } - catch (InternalError e){ //workaround to bug in Windows Java 1.7_45 - } - g.setPaintMode(); - g.setColor(Color.black); + // g.setColor(Color.black); + // if (GraphicsUtil.useXORMode(g, true)) { + //g.setXORMode(Color.white); + try{ + treeDisplay.fillTaxon(g, M); + } + catch (InternalError e){ //workaround to bug in Windows Java 1.7_45 } + // g.setPaintMode(); + g.setColor(Color.black); + // } highlightedTaxon=M; } Tree t = treeDisplay.getTree(); @@ -3038,15 +3049,16 @@ public void InvertTaxon(Graphics g, int M) { public void RevertTaxon(Graphics g, int M) { if (highlightedTaxon >= 0){ g.setColor(Color.black); - if (GraphicsUtil.useXORMode(g, true)) { - g.setXORMode(Color.white); - try{ - treeDisplay.fillTaxon(g, highlightedTaxon); - } - catch (InternalError e){ //workaround to bug in Windows Java 1.7_45 - } - g.setPaintMode(); + // if (GraphicsUtil.useXORMode(g, true)) { + // g.setXORMode(Color.white); + try{ + // treeDisplay.redrawTaxa(g, highlightedTaxon); + } + catch (InternalError e){ //workaround to bug in Windows Java 1.7_45 } + // g.setPaintMode(); + treeDisplay.repaint(); //TODO: just redraw the taxon + // } highlightedTaxon=-1; g.setColor(Color.black); } @@ -3070,10 +3082,13 @@ private int findTaxon(int x, int y){ NameReference branchNotesRef = NameReference.getNameReference("note"); private int countinvert = 0; public void InvertBranch(Graphics g, int N, MesquiteInteger highlight) { + InvertBranch(g,N,highlight, true); + } + public void InvertBranch(Graphics g, int N, MesquiteInteger highlight, boolean onlyIfStillInBranch) { Tree t = treeDisplay.getTree(); if (t!=null){ MesquiteDouble fraction = new MesquiteDouble(); - if (findBranch(treeDisplay.getMouseX(), treeDisplay.getMouseY(), fraction) == N){ //still in N + if (!onlyIfStillInBranch || findBranch(treeDisplay.getMouseX(), treeDisplay.getMouseY(), fraction) == N){ //still in N TreeDrawing treeDrawing = treeDisplay.getTreeDrawing(); highlight.setValue(N); // sets the highlighed branch if (treeDrawing!=null && !treeDisplay.repaintPending()){ @@ -3118,7 +3133,8 @@ public void RevertBranch(Graphics g, MesquiteInteger highlight) { int wasHighlighted = highlight.getValue(); highlight.setValue(0); if (wasHighlighted> 0 && !treeDisplay.repaintPending()){ - treeDisplay.getTreeDrawing().fillBranchInverted(treeDisplay.getTree(), wasHighlighted, g); + treeDisplay.repaint(); // need to do it this way as XOR mode no good + // treeDisplay.getTreeDrawing().fillBranchInverted(treeDisplay.getTree(), wasHighlighted, g); //treeDisplay.getTreeDrawing().fillBranchInverted(t, N, g); } showTreeAnnotation(); @@ -3147,7 +3163,7 @@ public void ScanFlash(Graphics g, int x, int y, int modifiers) { RevertBranch(g, highlightedBranch); notifyExtrasOfBranchExit(g, wasHighlighted); - setTreeName(); + setTreeName(tree); setExplanation(baseExplanation, false); } else if (branchFound!=highlightedBranch.getValue()) { @@ -3214,6 +3230,17 @@ else if (nameFound!=-1) { } + /*_________________________________________________*/ + public void drawBranchTouchSpot(Graphics g, int x, int y) { + int spotSize=8; + Color oldColor = g.getColor(); + g.setColor(Color.yellow); + GraphicsUtil.fillOval(g,x-spotSize/2, y-spotSize/2, spotSize, spotSize,false); + g.setColor(Color.black); + GraphicsUtil.drawOval(g,x-spotSize/2, y-spotSize/2, spotSize, spotSize); + g.setColor(oldColor); + } + /*_________________________________________________*/ public boolean ScanTouch(Graphics g, int x, int y, int modifiers) { if (treeDisplay == null || tree == null || treeDrawCoordTask == null || treeDrawCoordTask.getNamesTask() == null || treeDisplay.getTreeDrawing()==null) @@ -3240,9 +3267,10 @@ public boolean ScanTouch(Graphics g, int x, int y, int modifiers) { xTo=x; yTo= y; if (GraphicsUtil.useXORMode(g, true)){ - g.setXORMode(Color.white); - g.setColor(Color.black); - g.drawLine(xFrom,yFrom,xTo,yTo); + // g.setXORMode(Color.white); + //g.setColor(Color.black); + //g.drawLine(xFrom,yFrom,xTo,yTo); + drawBranchTouchSpot(g,xFrom,yFrom); } } else { @@ -3272,6 +3300,7 @@ public boolean ScanTouch(Graphics g, int x, int y, int modifiers) { fieldTouchY = y; lastFieldDragX = x; lastFieldDragY = y; + GraphicsUtil.drawCross(g,fieldTouchX, fieldTouchY, 10); } boolean fieldTouchAccepted = currentTreeTool.fieldTouched(x,y,tree,modifiers); @@ -3290,9 +3319,12 @@ public void ScanDrop(Graphics g, int x, int y, int modifiers) { if (currentTreeTool.isArrowTool() && fieldTouchX >= 0 && fieldTouchY >=0){ g.setColor(Color.blue); if (GraphicsUtil.useXORMode(g, false)){ - g.setXORMode(Color.white); //for some reason color doesn't matter in MacOS, but does in Win95 - GraphicsUtil.drawRect(g, fieldTouchX,fieldTouchY,lastFieldDragX-fieldTouchX,lastFieldDragY-fieldTouchY); + //g.setXORMode(Color.white); //for some reason color doesn't matter in MacOS, but does in Win95 + //GraphicsUtil.drawRect(g, fieldTouchX,fieldTouchY,lastFieldDragX-fieldTouchX,lastFieldDragY-fieldTouchY); } + highlightedNodes = null; + highlightedTaxa = null; + if (!dragSelect(modifiers, fieldTouchX, fieldTouchY, x-fieldTouchX,y-fieldTouchY)){ if (taxa.anySelected()){ taxa.deselectAll(); @@ -3309,11 +3341,22 @@ public void ScanDrop(Graphics g, int x, int y, int modifiers) { fieldTouchX = -1; fieldTouchY = -1; + lastFieldDragX = -1; lastFieldDragY = -1; return; } if ((!treeDisplay.getTree().isLocked()) && (branchFrom!=0)) { + MesquiteDouble fraction = new MesquiteDouble(); + if (currentTreeTool.informTransfer()) { + int branchTo=findBranch(x, y, fraction); + if (branchTo != 0) { + GraphicsUtil.drawArrow((Graphics2D)g,xFrom,yFrom,xTo,yTo,2); //only if drawn + drawBranchTouchSpot(g,xFrom,yFrom); + MesquiteThread.pauseForSeconds(0.5); + } + + } if (highlightedBranch.getValue() != 0) { notifyExtrasOfBranchExit(g, highlightedBranch.getValue()); RevertBranch(g, highlightedBranch); @@ -3322,23 +3365,24 @@ else if (highlightedTaxon >=0) RevertTaxon(g, highlightedTaxon); g.setColor(Color.black); if (GraphicsUtil.useXORMode(g, false)){ - g.setXORMode(Color.white); + //g.setXORMode(Color.white); - g.drawLine(xFrom,yFrom,xTo,yTo); //only if drawn + //g.drawLine(xFrom,yFrom,xTo,yTo); //only if drawn } if (currentTreeTool.informTransfer()) { - MesquiteDouble fraction = new MesquiteDouble(); int branchTo=findBranch(x, y, fraction); if (branchTo != 0) { if (branchTo == branchFrom && currentTreeTool.isArrowTool()){ selectBranch(modifiers, branchTo); } - else + else { currentTreeTool.branchTransferred(branchFrom, branchTo, tree, modifiers); + } } } else if (currentTreeTool.informDrop()) { + // g.drawLine(xFrom,yFrom,xTo,yTo); //only if drawn currentTreeTool.branchDropped(branchFrom, x, y, tree, modifiers); } branchFrom = 0; @@ -3367,11 +3411,11 @@ public void ScanDrag(Graphics g, int x, int y, int modifiers) { if (treeDisplay.getInvalid()) return; if (currentTreeTool.isArrowTool() && fieldTouchX >= 0 && fieldTouchY >=0){ - g.setColor(Color.blue); + dragHighlight(g,modifiers, fieldTouchX,fieldTouchY,x-fieldTouchX,y-fieldTouchY); if (GraphicsUtil.useXORMode(g, false)){ - g.setXORMode(Color.white); //for some reason color doesn't matter in MacOS, but does in Win95 - GraphicsUtil.drawRect(g, fieldTouchX,fieldTouchY,lastFieldDragX-fieldTouchX,lastFieldDragY-fieldTouchY); - GraphicsUtil.drawRect(g, fieldTouchX,fieldTouchY,x-fieldTouchX,y-fieldTouchY); + // g.setXORMode(Color.black); //for some reason color doesn't matter in MacOS, but does in Win95 + // GraphicsUtil.drawRect(g, fieldTouchX,fieldTouchY,lastFieldDragX-fieldTouchX,lastFieldDragY-fieldTouchY); + // GraphicsUtil.drawRect(g, fieldTouchX,fieldTouchY,x-fieldTouchX,y-fieldTouchY); //g.drawRect(fieldTouchX,fieldTouchY,lastFieldDragX-fieldTouchX,lastFieldDragY-fieldTouchY); //g.drawRect(fieldTouchX,fieldTouchY,x-fieldTouchX,y-fieldTouchY); } @@ -3394,13 +3438,13 @@ else if (dropHighlightedBranch.getValue()>0) if (currentTreeTool.informTransfer()) { g.setColor(Color.black); if (GraphicsUtil.useXORMode(g, false)){ - g.setXORMode(Color.white); //for some reason color doesn't matter in MacOS, but does in Win95 - g.drawLine(xFrom,yFrom,xTo,yTo); + //g.setXORMode(Color.white); //for some reason color doesn't matter in MacOS, but does in Win95 + //g.drawLine(xFrom,yFrom,xTo,yTo); } xTo=x; yTo= y; - if (GraphicsUtil.useXORMode(g, false)) - g.drawLine(xFrom,yFrom,xTo,yTo); + // if (GraphicsUtil.useXORMode(g, false)) + // g.drawLine(xFrom,yFrom,xTo,yTo); } else if (currentTreeTool.informDrag()) { currentTreeTool.branchDragged(branchFrom, x, y, tree, modifiers); @@ -3458,6 +3502,80 @@ public boolean shrinkWrapTaxa(MesquiteTree tree, int N) { return pathsSelAbove>0 || thisIsSelected; } + /*-----------------------------------------*/ + Vector highlightedNodes = new Vector(); + Vector highlightedTaxa = new Vector(); + + private Vector vectorElementsInFirstButNotSecond(Vector firstVector, Vector secondVector){ + if (secondVector==null) + return firstVector; + if (firstVector==null) + return null; + Vector vector = new Vector(); + for (int i=0; i0) || (taxaToUnselect!=null && taxaToUnselect.size()>0)){ + treeDisplay.update(g); + //GraphicsUtil.drawCross(g,fieldTouchX, fieldTouchY, 10); + nodesToSelect= nodes; + taxaToSelect= taxons; + } else { + nodesToSelect= vectorElementsInFirstButNotSecond(nodes, highlightedNodes); + taxaToSelect= vectorElementsInFirstButNotSecond(taxons, highlightedTaxa); + } + if (nodesToSelect.size()>0){ + for (int i=0; i0){ + for (int i=0; i