add track height preferences

This commit is contained in:
Eyck Jentzsch 2020-11-28 20:44:33 +01:00
parent 754a61e989
commit 179d40ac8d
6 changed files with 14 additions and 3 deletions

View File

@ -23,6 +23,7 @@ public class Messages extends NLS {
public static String ResourceManager_0; public static String ResourceManager_0;
public static String SCViewerPreferencesPage_0; public static String SCViewerPreferencesPage_0;
public static String SCViewerPreferencesPage_1; public static String SCViewerPreferencesPage_1;
public static String SCViewerPreferencesPage_2;
public static String StatusBarControl_1; public static String StatusBarControl_1;
public static String StatusBarControl_2; public static String StatusBarControl_2;
public static String StatusBarControl_3; public static String StatusBarControl_3;

View File

@ -17,6 +17,7 @@ RelationTypeToolControl_1=Select
ResourceManager_0=Wrong decorate corner ResourceManager_0=Wrong decorate corner
SCViewerPreferencesPage_0=Check for changed database SCViewerPreferencesPage_0=Check for changed database
SCViewerPreferencesPage_1=Show hover window in waveform SCViewerPreferencesPage_1=Show hover window in waveform
SCViewerPreferencesPage_2=Waveform track height
StatusBarControl_1=Currently running: StatusBarControl_1=Currently running:
StatusBarControl_2=\nLast task: StatusBarControl_2=\nLast task:
StatusBarControl_3=Currently running: StatusBarControl_3=Currently running:

View File

@ -29,7 +29,8 @@ public class WaveformStyleProvider implements IWaveformStyleProvider {
// list of random colors // list of random colors
private static Color[][] randomColors; private static Color[][] randomColors;
private int trackHeigth=25;
public WaveformStyleProvider() { public WaveformStyleProvider() {
setupDefaults(); setupDefaults();
} }
@ -91,7 +92,8 @@ public class WaveformStyleProvider implements IWaveformStyleProvider {
RGB rgb = StringConverter.asRGB(prefValue); RGB rgb = StringConverter.asRGB(prefValue);
colorPref.put(c, rgb); colorPref.put(c, rgb);
} }
} trackHeigth = store.getInt(PreferenceConstants.TRACK_HEIGHT, defaultPrefs.getInt(PreferenceConstants.TRACK_HEIGHT, 25)); //$NON-NLS-1$
}
/** /**
* needs redraw() afterwards * needs redraw() afterwards
* @param colourMap * @param colourMap
@ -118,7 +120,7 @@ public class WaveformStyleProvider implements IWaveformStyleProvider {
@Override @Override
public int getTrackHeight() { public int getTrackHeight() {
return 25; return trackHeigth;
} }
@Override @Override
public Color getColor(WaveformColors type) { public Color getColor(WaveformColors type) {

View File

@ -68,6 +68,7 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
store.putBoolean(PreferenceConstants.DATABASE_RELOAD, true); store.putBoolean(PreferenceConstants.DATABASE_RELOAD, true);
store.putBoolean(PreferenceConstants.SHOW_HOVER, true); store.putBoolean(PreferenceConstants.SHOW_HOVER, true);
store.putInt(PreferenceConstants.TRACK_HEIGHT, 30);
for (WaveformColors c : WaveformColors.values()) { for (WaveformColors c : WaveformColors.values()) {
store.put(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$ store.put(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
} }

View File

@ -24,6 +24,9 @@ public class PreferenceConstants {
/** The Constant DATABASE_RELOAD. */ /** The Constant DATABASE_RELOAD. */
public static final String SHOW_HOVER="showWaveformHover"; //$NON-NLS-1$ public static final String SHOW_HOVER="showWaveformHover"; //$NON-NLS-1$
/** The Constant TRACK_HEIGHT. */
public static final String TRACK_HEIGHT="trackHeigth"; //$NON-NLS-1$
/** The Constant LINE_COLOR. */ /** The Constant LINE_COLOR. */
public static final String LINE_COLOR="LINE_COLOR"; //$NON-NLS-1$ public static final String LINE_COLOR="LINE_COLOR"; //$NON-NLS-1$

View File

@ -12,6 +12,7 @@ package com.minres.scviewer.e4.application.preferences;
import org.eclipse.jface.preference.BooleanFieldEditor; import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IntegerFieldEditor;
import com.minres.scviewer.e4.application.Messages; import com.minres.scviewer.e4.application.Messages;
@ -38,6 +39,8 @@ public class SCViewerPreferencesPage extends FieldEditorPreferencePage {
getFieldEditorParent())); getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.SHOW_HOVER, Messages.SCViewerPreferencesPage_1, addField(new BooleanFieldEditor(PreferenceConstants.SHOW_HOVER, Messages.SCViewerPreferencesPage_1,
getFieldEditorParent())); getFieldEditorParent()));
addField(new IntegerFieldEditor(PreferenceConstants.TRACK_HEIGHT, Messages.SCViewerPreferencesPage_2,
getFieldEditorParent()));
} }