mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-29 07:50:29 -04:00
added dpi setting under linux
This commit is contained in:
parent
93a576c2e1
commit
5783cf6a82
@ -11,6 +11,8 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import static de.neemann.digital.gui.Settings.isLinux;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a fitter to create a JEDEC file.
|
* Starts a fitter to create a JEDEC file.
|
||||||
* Created by hneemann on 10.03.17.
|
* Created by hneemann on 10.03.17.
|
||||||
@ -62,11 +64,6 @@ public class StartATF1502Fitter implements ExpressionToFileExporter.PostProcess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isLinux() {
|
|
||||||
String name = System.getProperty("os.name").toLowerCase();
|
|
||||||
return name.contains("linux");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Lang.get("msg_startExternalFitter");
|
return Lang.get("msg_startExternalFitter");
|
||||||
|
@ -361,4 +361,20 @@ public final class Keys {
|
|||||||
= new Key<>("inverterConfig", new InverterConfig());
|
= new Key<>("inverterConfig", new InverterConfig());
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the screen resolution
|
||||||
|
*/
|
||||||
|
public static final Key<Integer> SETTINGS_SCREEN_RESOLUTION =
|
||||||
|
new Key.KeyInteger("screenResolution", getDefaultScreenResolution())
|
||||||
|
.setComboBoxValues(new Integer[]{95, 120, 150, 180, 200, 250, 300})
|
||||||
|
.setMin(95)
|
||||||
|
.setMax(400);
|
||||||
|
|
||||||
|
private static int getDefaultScreenResolution() {
|
||||||
|
try {
|
||||||
|
return Toolkit.getDefaultToolkit().getScreenResolution();
|
||||||
|
} catch (HeadlessException e) {
|
||||||
|
return 95;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,8 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
if (modified != null) {
|
if (modified != null) {
|
||||||
FormatToExpression.setDefaultFormat(modified.get(Keys.SETTINGS_EXPRESSION_FORMAT));
|
FormatToExpression.setDefaultFormat(modified.get(Keys.SETTINGS_EXPRESSION_FORMAT));
|
||||||
if (!Settings.getInstance().getAttributes().equalsKey(Keys.SETTINGS_LANGUAGE, modified)
|
if (!Settings.getInstance().getAttributes().equalsKey(Keys.SETTINGS_LANGUAGE, modified)
|
||||||
|| !Settings.getInstance().getAttributes().equalsKey(Keys.SETTINGS_IEEE_SHAPES, modified)) {
|
|| !Settings.getInstance().getAttributes().equalsKey(Keys.SETTINGS_IEEE_SHAPES, modified)
|
||||||
|
|| !Settings.getInstance().getAttributes().equalsKey(Keys.SETTINGS_SCREEN_RESOLUTION, modified)) {
|
||||||
Lang.setLanguage(modified.get(Keys.SETTINGS_LANGUAGE));
|
Lang.setLanguage(modified.get(Keys.SETTINGS_LANGUAGE));
|
||||||
JOptionPane.showMessageDialog(Main.this, Lang.get("msg_restartNeeded"));
|
JOptionPane.showMessageDialog(Main.this, Lang.get("msg_restartNeeded"));
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@ public final class Settings implements AttributeListener {
|
|||||||
INT_LIST.add(Keys.SETTINGS_EXPRESSION_FORMAT);
|
INT_LIST.add(Keys.SETTINGS_EXPRESSION_FORMAT);
|
||||||
INT_LIST.add(Keys.SETTINGS_DEFAULT_TREESELECT);
|
INT_LIST.add(Keys.SETTINGS_DEFAULT_TREESELECT);
|
||||||
INT_LIST.add(Keys.SETTINGS_ATF1502_FITTER);
|
INT_LIST.add(Keys.SETTINGS_ATF1502_FITTER);
|
||||||
|
if (isLinux())
|
||||||
|
INT_LIST.add(Keys.SETTINGS_SCREEN_RESOLUTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class SettingsHolder {
|
private static final class SettingsHolder {
|
||||||
@ -99,5 +101,14 @@ public final class Settings implements AttributeListener {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if running on a windows system
|
||||||
|
*/
|
||||||
|
public static boolean isLinux() {
|
||||||
|
String name = System.getProperty("os.name").toLowerCase();
|
||||||
|
return name.contains("linux");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@ package de.neemann.gui;
|
|||||||
* Linux : getScreenResolution() = 95
|
* Linux : getScreenResolution() = 95
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import de.neemann.digital.core.element.Keys;
|
||||||
|
import de.neemann.digital.gui.Settings;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
@ -36,8 +39,8 @@ public final class Screen {
|
|||||||
Font font = new JLabel().getFont();
|
Font font = new JLabel().getFont();
|
||||||
float scaling = 1;
|
float scaling = 1;
|
||||||
int size = 12;
|
int size = 12;
|
||||||
try {
|
int screenResolution = Settings.getInstance().get(Keys.SETTINGS_SCREEN_RESOLUTION);
|
||||||
int s = Math.round(Toolkit.getDefaultToolkit().getScreenResolution() * 12 / 96f);
|
int s = Math.round(screenResolution * 12 / 96f);
|
||||||
if (s > 12) {
|
if (s > 12) {
|
||||||
scaling = s / 12f;
|
scaling = s / 12f;
|
||||||
size = s;
|
size = s;
|
||||||
@ -53,9 +56,6 @@ public final class Screen {
|
|||||||
}
|
}
|
||||||
UIManager.put("ScrollBar.width", size * 17 / 12);
|
UIManager.put("ScrollBar.width", size * 17 / 12);
|
||||||
}
|
}
|
||||||
} catch (HeadlessException e) {
|
|
||||||
// run with defaults if headless
|
|
||||||
}
|
|
||||||
this.scaling = scaling;
|
this.scaling = scaling;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.font = font;
|
this.font = font;
|
||||||
|
@ -661,6 +661,9 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
|
|||||||
<string name="key_defTreeSelect_tt">Wenn gesetzt, wird die Baumansicht beim Start automatisch aktiviert.</string>
|
<string name="key_defTreeSelect_tt">Wenn gesetzt, wird die Baumansicht beim Start automatisch aktiviert.</string>
|
||||||
<string name="key_inverterConfig">inverse Eingänge</string>
|
<string name="key_inverterConfig">inverse Eingänge</string>
|
||||||
<string name="key_inverterConfig_tt">Es können die Eingänge ausgewählt werden, welche invertiert werden sollen.</string>
|
<string name="key_inverterConfig_tt">Es können die Eingänge ausgewählt werden, welche invertiert werden sollen.</string>
|
||||||
|
<string name="key_screenResolution">Bildschirmauflösung [DPI]</string>
|
||||||
|
<string name="key_screenResolution_tt">Es kommt vor, dass das OS eine falsche Bildschirmauflösung liefert.
|
||||||
|
In diesem Fall kann hier ein eigener Wert gesetzt werden.</string>
|
||||||
|
|
||||||
<string name="mod_insertWire">Leitung eingefügt.</string>
|
<string name="mod_insertWire">Leitung eingefügt.</string>
|
||||||
<string name="mod_insertCopied">Aus Zwischenablage eingefügt.</string>
|
<string name="mod_insertCopied">Aus Zwischenablage eingefügt.</string>
|
||||||
|
@ -651,6 +651,9 @@ The names of the variables may not be unique.</string>
|
|||||||
<string name="key_defTreeSelect_tt">If set, the component tree view is enabled at startup.</string>
|
<string name="key_defTreeSelect_tt">If set, the component tree view is enabled at startup.</string>
|
||||||
<string name="key_inverterConfig">inverted Inputs</string>
|
<string name="key_inverterConfig">inverted Inputs</string>
|
||||||
<string name="key_inverterConfig_tt">You can select the inputs that are to be inverted.</string>
|
<string name="key_inverterConfig_tt">You can select the inputs that are to be inverted.</string>
|
||||||
|
<string name="key_screenResolution">Screen Resolution [DPI]</string>
|
||||||
|
<string name="key_screenResolution_tt">Sometimes the OS reports a wrong screen resolution.
|
||||||
|
In this case, a different value can be set here.</string>
|
||||||
|
|
||||||
<string name="mod_insertWire">Inserted wire.</string>
|
<string name="mod_insertWire">Inserted wire.</string>
|
||||||
<string name="mod_insertCopied">Insert from clipboard.</string>
|
<string name="mod_insertCopied">Insert from clipboard.</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user