()
| 28 | } |
| 29 | |
| 30 | private void showDialog() { |
| 31 | ImagePlus imp = WindowManager.getCurrentImage(); |
| 32 | Roi roi = imp!=null?imp.getRoi():null; |
| 33 | TextRoi textRoi = roi!=null&&(roi instanceof TextRoi)?(TextRoi)roi:null; |
| 34 | String fillc = "None"; |
| 35 | TextRoi.setDefaultFillColor(null); |
| 36 | TextRoi.setDefaultAngle(0.0); |
| 37 | if (textRoi!=null) { |
| 38 | Font font = textRoi.getCurrentFont(); |
| 39 | fontSize = font.getSize(); |
| 40 | angle = (int)textRoi.getAngle(); |
| 41 | style = font.getStyle(); |
| 42 | justification = textRoi.getJustification(); |
| 43 | Color c = textRoi.getStrokeColor(); |
| 44 | if (c!=null) color=c; |
| 45 | fillc = Colors.colorToString2(textRoi.getFillColor()); |
| 46 | antialiased = textRoi.getAntiAlias(); |
| 47 | } |
| 48 | colorName = Colors.colorToString2(color); |
| 49 | gd =GUI.newNonBlockingDialog("Fonts"); |
| 50 | gd.addChoice("Font:", getFonts(), font); |
| 51 | gd.addChoice("Style:", styles, styles[style]); |
| 52 | gd.addChoice("Just:", justifications, justifications[justification]); |
| 53 | gd.addChoice("Color:", Colors.getColors(colorName), colorName); |
| 54 | gd.addChoice("Bkgd:", Colors.getColors("None",!"None".equals(fillc)?fillc:null), fillc); |
| 55 | gd.addSlider("Size:", 9, 200, fontSize); |
| 56 | gd.addSlider("Angle:", -90, 90, angle); |
| 57 | gd.addCheckbox("Antialiased text", antialiased); |
| 58 | Point loc = Prefs.getLocation(LOC_KEY); |
| 59 | if (IJ.debugMode) { |
| 60 | Dimension screen = IJ.getScreenSize(); |
| 61 | IJ.log("Fonts: "+loc+" "+screen); |
| 62 | } |
| 63 | if (loc!=null) { |
| 64 | gd.centerDialog(false); |
| 65 | gd.setLocation (loc); |
| 66 | } |
| 67 | gd.addDialogListener(this); |
| 68 | gd.setOKLabel("Close"); |
| 69 | gd.hideCancelButton(); |
| 70 | gd.showDialog(); |
| 71 | Prefs.saveLocation(LOC_KEY, gd.getLocation()); |
| 72 | } |
| 73 | |
| 74 | String[] getFonts() { |
| 75 | GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); |
no test coverage detected