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 SCViewerPreferencesPage_0;
public static String SCViewerPreferencesPage_1;
public static String SCViewerPreferencesPage_2;
public static String StatusBarControl_1;
public static String StatusBarControl_2;
public static String StatusBarControl_3;

View File

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

View File

@ -29,7 +29,8 @@ public class WaveformStyleProvider implements IWaveformStyleProvider {
// list of random colors
private static Color[][] randomColors;
private int trackHeigth=25;
public WaveformStyleProvider() {
setupDefaults();
}
@ -91,7 +92,8 @@ public class WaveformStyleProvider implements IWaveformStyleProvider {
RGB rgb = StringConverter.asRGB(prefValue);
colorPref.put(c, rgb);
}
}
trackHeigth = store.getInt(PreferenceConstants.TRACK_HEIGHT, defaultPrefs.getInt(PreferenceConstants.TRACK_HEIGHT, 25)); //$NON-NLS-1$
}
/**
* needs redraw() afterwards
* @param colourMap
@ -118,7 +120,7 @@ public class WaveformStyleProvider implements IWaveformStyleProvider {
@Override
public int getTrackHeight() {
return 25;
return trackHeigth;
}
@Override
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.SHOW_HOVER, true);
store.putInt(PreferenceConstants.TRACK_HEIGHT, 30);
for (WaveformColors c : WaveformColors.values()) {
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. */
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. */
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.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IntegerFieldEditor;
import com.minres.scviewer.e4.application.Messages;
@ -38,6 +39,8 @@ public class SCViewerPreferencesPage extends FieldEditorPreferencePage {
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.SHOW_HOVER, Messages.SCViewerPreferencesPage_1,
getFieldEditorParent()));
addField(new IntegerFieldEditor(PreferenceConstants.TRACK_HEIGHT, Messages.SCViewerPreferencesPage_2,
getFieldEditorParent()));
}