diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/diagram/actions/FontAction.java b/com.archimatetool.editor/src/com/archimatetool/editor/diagram/actions/FontAction.java index f8ca8a843..c8ca56398 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/diagram/actions/FontAction.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/diagram/actions/FontAction.java @@ -72,7 +72,10 @@ public void run() { // Set default font on first selected object FontData fontData = FontFactory.getDefaultUserViewFontData(); - String fontValue = FontFactory.getPlatformDependentFontString(model.getFont()); + String rgbValue = null; + + rgbValue = model.getFontColor(); + String fontValue = model.getFont(); if(fontValue != null) { try { fontData = new FontData(fontValue); @@ -86,7 +89,7 @@ public void run() { dialog.setText(Messages.FontAction_1); dialog.setEffectsVisible(false); // Don't allow underline/strikeout on Windows. See https://github.com/archimatetool/archi/issues/851 dialog.setFontList(new FontData[] { fontData } ); - dialog.setRGB(ColorFactory.convertStringToRGB(model.getFontColor())); + dialog.setRGB(ColorFactory.convertStringToRGB(rgbValue)); FontData selectedFontData = dialog.open(); if(selectedFontData != null) { diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/diagram/editparts/AbstractBaseEditPart.java b/com.archimatetool.editor/src/com/archimatetool/editor/diagram/editparts/AbstractBaseEditPart.java index fdb4d2ab2..0c9881cfa 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/diagram/editparts/AbstractBaseEditPart.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/diagram/editparts/AbstractBaseEditPart.java @@ -76,11 +76,10 @@ public IDiagramModelObjectFigure getFigure() { */ @Override protected void applicationPreferencesChanged(PropertyChangeEvent event) { - // Default font or colour preferences changed, or font scaling changed + // Default font or colour preferences changed if(IPreferenceConstants.DEFAULT_VIEW_FONT.equals(event.getProperty()) || event.getProperty().startsWith(IPreferenceConstants.DEFAULT_FILL_COLOR_PREFIX) || - event.getProperty().equals(IPreferenceConstants.DEFAULT_ELEMENT_LINE_COLOR) || - event.getProperty().equals(IPreferenceConstants.PLATFORM_FONT_SCALING)) { + event.getProperty().equals(IPreferenceConstants.DEFAULT_ELEMENT_LINE_COLOR)) { refreshFigure(); } diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/diagram/editparts/DiagramConnectionEditPart.java b/com.archimatetool.editor/src/com/archimatetool/editor/diagram/editparts/DiagramConnectionEditPart.java index 39280b642..558b3cb4b 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/diagram/editparts/DiagramConnectionEditPart.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/diagram/editparts/DiagramConnectionEditPart.java @@ -191,9 +191,6 @@ else if(IPreferenceConstants.CONNECTION_LABEL_STRATEGY.equals(property)) { else if(IPreferenceConstants.VIEWPOINTS_GHOST_DIAGRAM_ELEMENTS.equals(property)) { getFigure().refreshVisuals(); } - else if(IPreferenceConstants.PLATFORM_FONT_SCALING.equals(property)) { - getFigure().refreshVisuals(); - } } @Override diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/AbstractDiagramModelObjectFigure.java b/com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/AbstractDiagramModelObjectFigure.java index d179a9b63..4141aec78 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/AbstractDiagramModelObjectFigure.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/AbstractDiagramModelObjectFigure.java @@ -153,7 +153,7 @@ protected void setDisabledState(Graphics graphics) { * Set the font to that in the model, or failing that, as per user's default */ protected void setFont() { - String fontName = FontFactory.getPlatformDependentFontString(fDiagramModelObject.getFont()); + String fontName = fDiagramModelObject.getFont(); setFont(FontFactory.get(fontName)); // Need to do this after font change diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/connections/AbstractDiagramConnectionFigure.java b/com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/connections/AbstractDiagramConnectionFigure.java index a760bca80..723321b4f 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/connections/AbstractDiagramConnectionFigure.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/diagram/figures/connections/AbstractDiagramConnectionFigure.java @@ -178,7 +178,7 @@ protected void setConnectionText() { * Set the font in the label to that in the model, or failing that, as per user's default */ protected void setLabelFont() { - String fontName = FontFactory.getPlatformDependentFontString(getModelConnection().getFont()); + String fontName = getModelConnection().getFont(); Font font = FontFactory.get(fontName); // Possible font scaling for non 96 DPI on Windows or if property set diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/preferences/GeneralPreferencePage.java b/com.archimatetool.editor/src/com/archimatetool/editor/preferences/GeneralPreferencePage.java index 7359d26e1..9df50dd58 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/preferences/GeneralPreferencePage.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/preferences/GeneralPreferencePage.java @@ -44,9 +44,9 @@ public class GeneralPreferencePage private Button fWarnOnDeleteButton; private Button fShowSpecializationsModelTreeButton; - private Button fAddDocumentationNoteButton; private Button fScaleImagesButton; - private Button fScaleFontsButton; + + private Button fAddDocumentationNoteButton; private Button fUseEdgeBrowserButton; @@ -146,11 +146,6 @@ protected Control createContents(Composite parent) { fScaleImagesButton.setLayoutData(createHorizontalGridData(2)); fScaleImagesButton.setToolTipText(Messages.GeneralPreferencePage_14); - fScaleFontsButton = new Button(otherGroup, SWT.CHECK); - fScaleFontsButton.setText(Messages.GeneralPreferencePage_25); - fScaleFontsButton.setLayoutData(createHorizontalGridData(2)); - fScaleFontsButton.setToolTipText(Messages.GeneralPreferencePage_26); - // Internal Browser Group browserGroup = new Group(client, SWT.NULL); browserGroup.setText(Messages.GeneralPreferencePage_19); @@ -227,8 +222,6 @@ private void setValues() { fAddDocumentationNoteButton.setSelection(getPreferenceStore().getBoolean(ADD_DOCUMENTATION_NOTE_ON_RELATION_CHANGE)); - fScaleFontsButton.setSelection(getPreferenceStore().getBoolean(PLATFORM_FONT_SCALING)); - if(fUseEdgeBrowserButton != null) { fUseEdgeBrowserButton.setSelection(getPreferenceStore().getBoolean(EDGE_BROWSER)); } @@ -261,8 +254,6 @@ public boolean performOk() { getPreferenceStore().setValue(ADD_DOCUMENTATION_NOTE_ON_RELATION_CHANGE, fAddDocumentationNoteButton.getSelection()); - getPreferenceStore().setValue(PLATFORM_FONT_SCALING, fScaleFontsButton.getSelection()); - if(fUseEdgeBrowserButton != null) { getPreferenceStore().setValue(EDGE_BROWSER, fUseEdgeBrowserButton.getSelection()); } @@ -297,8 +288,6 @@ protected void performDefaults() { fAddDocumentationNoteButton.setSelection(getPreferenceStore().getDefaultBoolean(ADD_DOCUMENTATION_NOTE_ON_RELATION_CHANGE)); - fScaleFontsButton.setSelection(getPreferenceStore().getDefaultBoolean(PLATFORM_FONT_SCALING)); - if(fUseEdgeBrowserButton != null) { fUseEdgeBrowserButton.setSelection(getPreferenceStore().getDefaultBoolean(EDGE_BROWSER)); } diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/preferences/IPreferenceConstants.java b/com.archimatetool.editor/src/com/archimatetool/editor/preferences/IPreferenceConstants.java index a153fcbf6..48e81f6a7 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/preferences/IPreferenceConstants.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/preferences/IPreferenceConstants.java @@ -103,6 +103,9 @@ public interface IPreferenceConstants { // Whether to use a line offset in all cases for figures drawn on hi-res screens String USE_FIGURE_LINE_OFFSET = "figureLineOffset"; + // Whether to add a note to the documentation field of relationships that have been changed to Association when setting a new concept type + String ADD_DOCUMENTATION_NOTE_ON_RELATION_CHANGE = "addDocumentationNoteOnRelationChange"; + // Appearance String DEFAULT_ARCHIMATE_FIGURE_WIDTH = "defaultArchiMateFigureWidth"; @@ -132,10 +135,7 @@ public interface IPreferenceConstants { String USE_LABEL_EXPRESSIONS_IN_ANALYSIS_TABLE = "useLabelExpressionInAnalysisTable"; - // Whether to add a note to the documentation field of relationships that have been changed to Association when setting a new concept type - String ADD_DOCUMENTATION_NOTE_ON_RELATION_CHANGE = "addDocumentationNoteOnRelationChange"; String SCALE_IMAGE_EXPORT = "scaleImageExport"; - String PLATFORM_FONT_SCALING = "platformFontScaling"; // Animation String ANIMATE_VIEW = "animateView"; diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/preferences/Messages.java b/com.archimatetool.editor/src/com/archimatetool/editor/preferences/Messages.java index 84f518156..f63a71ea0 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/preferences/Messages.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/preferences/Messages.java @@ -287,10 +287,6 @@ public class Messages extends NLS { public static String GeneralPreferencePage_24; - public static String GeneralPreferencePage_25; - - public static String GeneralPreferencePage_26; - public static String GeneralPreferencePage_3; public static String GeneralPreferencePage_4; diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/preferences/PreferenceInitializer.java b/com.archimatetool.editor/src/com/archimatetool/editor/preferences/PreferenceInitializer.java index d41f9831c..f3cd7f924 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/preferences/PreferenceInitializer.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/preferences/PreferenceInitializer.java @@ -104,6 +104,8 @@ public void initializeDefaultPreferences() { // Windows at hi-res needs this set to true store.setDefault(USE_FIGURE_LINE_OFFSET, PlatformUtils.isWindows() && ImageFactory.getDeviceZoom() > 100); + store.setDefault(ADD_DOCUMENTATION_NOTE_ON_RELATION_CHANGE, false); + // Appearance store.setDefault(DEFAULT_ARCHIMATE_FIGURE_WIDTH, 120); @@ -129,10 +131,8 @@ public void initializeDefaultPreferences() { store.setDefault(USE_LABEL_EXPRESSIONS_IN_ANALYSIS_TABLE, true); - store.setDefault(ADD_DOCUMENTATION_NOTE_ON_RELATION_CHANGE, false); // Windows hi-res and Mac Retina use 200 zoom, Linux is 100 store.setDefault(SCALE_IMAGE_EXPORT, (!PlatformUtils.isLinux() && ImageFactory.getDeviceZoom() > 100) ? true : false); - store.setDefault(PLATFORM_FONT_SCALING, true); // Animation store.setDefault(ANIMATE_VIEW, false); diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/preferences/messages.properties b/com.archimatetool.editor/src/com/archimatetool/editor/preferences/messages.properties index 8dc2acb35..6a138d750 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/preferences/messages.properties +++ b/com.archimatetool.editor/src/com/archimatetool/editor/preferences/messages.properties @@ -144,8 +144,6 @@ GeneralPreferencePage_21=Enable JavaScript in Hints GeneralPreferencePage_22=Allow External Hosts in Hints GeneralPreferencePage_23=If a connected relation type is changed as a result of changing an Element's type,\na note will be added to the Relation's documentation field. GeneralPreferencePage_24=Show Specializations in "New" menu -GeneralPreferencePage_25=Adjust font height for each platform -GeneralPreferencePage_26=Adjust font height when a font height has been set on another operating system platform GeneralPreferencePage_3=Animation GeneralPreferencePage_4=Animate Views GeneralPreferencePage_5=Automatically create a backup file (*.bak) when saving diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/FontSection.java b/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/FontSection.java index 6a8522249..1db332a2a 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/FontSection.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/propertysections/FontSection.java @@ -131,12 +131,14 @@ else if(event.getProperty() == ColorChooser.PROP_COLORDEFAULT) { }; /** - * Listen to default font change and font scaling in Prefs + * Listen to default font change in Prefs */ - private IPropertyChangeListener prefsListener = event -> { - if(event.getProperty().startsWith(IPreferenceConstants.DEFAULT_VIEW_FONT) - || IPreferenceConstants.PLATFORM_FONT_SCALING.equals(event.getProperty())) { - update(); + private IPropertyChangeListener prefsListener = new IPropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent event) { + if(event.getProperty().startsWith(IPreferenceConstants.DEFAULT_VIEW_FONT)) { + update(); + } } }; diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/ui/FontFactory.java b/com.archimatetool.editor/src/com/archimatetool/editor/ui/FontFactory.java index 31df0925f..31a1f9b28 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/ui/FontFactory.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/ui/FontFactory.java @@ -168,39 +168,6 @@ public static Font getScaledFont96DPI(Font font) { return font; } - /** - * Return a FontData string with adjusted font height if the FontData string is not for the current platform. - * @param fontDataString The FontData string - * @return The Font Data String for the current platform or the same string if there is no change. - */ - public static String getPlatformDependentFontString(String fontDataString) { - if(StringUtils.isSet(fontDataString) && ArchiPlugin.PREFERENCES.getBoolean(IPreferenceConstants.PLATFORM_FONT_SCALING)) { - float factor = 0; - - // On Mac but fontdata contains Windows or Linux - if(PlatformUtils.isMac() && (fontDataString.contains("|WINDOWS|") || fontDataString.contains("|GTK|"))) { - factor = (float)96 / 72; - } - // On Windows or Linux but font came from Mac - else if(!PlatformUtils.isMac() && fontDataString.contains("|COCOA|")) { - factor = (float)72 / 96; - } - - if(factor != 0) { - try { - FontData fd = new FontData(fontDataString); - int newHeight = Math.round(fd.getHeight() * factor); // round up in this case - fd.setHeight(newHeight); - fontDataString = fd.toString(); - } - catch(Exception ex) { - } - } - } - - return fontDataString; - } - /** * @param font * @return The italic variant of the given font diff --git a/com.archimatetool.editor/src/com/archimatetool/editor/ui/components/FontChooser.java b/com.archimatetool.editor/src/com/archimatetool/editor/ui/components/FontChooser.java index 752a2adb8..374fb5f9f 100644 --- a/com.archimatetool.editor/src/com/archimatetool/editor/ui/components/FontChooser.java +++ b/com.archimatetool.editor/src/com/archimatetool/editor/ui/components/FontChooser.java @@ -240,7 +240,7 @@ public void chooseFont() { protected void updateFont() { fFontData = FontFactory.getDefaultUserViewFontData(); - String fontValue = FontFactory.getPlatformDependentFontString(fFontObject.getFont()); + String fontValue = fFontObject.getFont(); if(fontValue != null) { try { fFontData = new FontData(fontValue); @@ -275,16 +275,24 @@ protected void updateButtonText() { } /** - * Adds a property change listener to listen for font change events. - * @param listener a property change listener + * Adds a property change listener to this ColorSelector. + * Events are fired when the color in the control changes via the user + * clicking an selecting a new one in the color dialog. No event is fired in + * the case where setColorValue(RGB) is invoked. + * + * @param listener + * a property change listener */ public void addListener(IPropertyChangeListener listener) { addListenerObject(listener); } /** - * Removes the given listener. Has no effect if the listener is not registered. - * @param listener a property change listener + * Removes the given listener from this ColorSelector. Has + * no effect if the listener is not registered. + * + * @param listener + * a property change listener */ public void removeListener(IPropertyChangeListener listener) { removeListenerObject(listener); @@ -292,6 +300,9 @@ public void removeListener(IPropertyChangeListener listener) { /** * Fire the given event to listeners + * @param propertyName + * @param oldValue + * @param newValue */ private void fireActionListenerEvent(String propertyName, Object oldValue, Object newValue) { final Object[] finalListeners = getListeners(); diff --git a/com.archimatetool.help/help/Text/prefs_general.html b/com.archimatetool.help/help/Text/prefs_general.html index e71383617..158d93a42 100644 --- a/com.archimatetool.help/help/Text/prefs_general.html +++ b/com.archimatetool.help/help/Text/prefs_general.html @@ -56,10 +56,7 @@

Other

When this is selected, images are exported and copied to the clipboard at twice their normal size. This is set on by default for Windows operating systems where display scaling is greater than 100%, and on Mac Retina devices. This is so that the exported image quality is not compromised since it is not possible to set a higher DPI in the image. This setting is usually not needed on Linux displays.

If the resulting image needs to be at its logical size you could edit it in an image editor and set the DPI to double its value. For example, on Mac change the DPI from to 72 to 144.

-
-

Adjust font height for each platform
- When this is selected, fonts are adjusted to match the DPI (dots per inch) setting for the current platform. For example, you might work on an Archi model on Windows and set the font height for an object to 10. However, when opening the model on Mac the font will appear too small because Mac uses 72 DPI while Windows uses 96 DPI. Conversely, you might set the font height on Mac but it appears too big on Windows. This setting adjusts for this difference so that font heights are the same on all platforms.


Internal Web Browser

diff --git a/org.opengroup.archimate.xmlexchange/src/org/opengroup/archimate/xmlexchange/XMLModelExporter.java b/org.opengroup.archimate.xmlexchange/src/org/opengroup/archimate/xmlexchange/XMLModelExporter.java index d1407c19c..ef8f97e8b 100644 --- a/org.opengroup.archimate.xmlexchange/src/org/opengroup/archimate/xmlexchange/XMLModelExporter.java +++ b/org.opengroup.archimate.xmlexchange/src/org/opengroup/archimate/xmlexchange/XMLModelExporter.java @@ -1033,7 +1033,7 @@ Element writeFont(IFontAttribute fontObject, Element styleElement) { try { FontData fontData = null; - String fontString = FontFactory.getPlatformDependentFontString(fontObject.getFont()); + String fontString = fontObject.getFont(); if(fontString != null) { fontData = new FontData(fontString); }