Skip to content

Commit

Permalink
Enable buffered selection by default except on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mailaender committed Sep 3, 2024
1 parent 87ce9e6 commit 3c80577
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,8 @@ public class PreferenceConstants {

public static final int MIN_MOVE_LEGEND = 1;
public static final int MAX_MOVE_LEGEND = 100;
/*
* The buffered selection creates a screenshot and sets it in the background
* while doing the data selection. This prevents to redraw the series while
* doing the selection event. Known limitations:
* ---
* macOS - https://github.com/eclipse/swtchart/issues/150
* GTK3 - https://github.com/eclipse/swtchart/issues/166
*/
//
public static final String P_BUFFER_SELECTION = "bufferSelection";
public static final boolean DEF_BUFFER_SELECTION = false;
public static final String P_KEEP_SERIES_DESCRIPTION = "keepSeriesDescription";
public static final boolean DEF_KEEP_SERIES_DESCRIPTION = false;
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2023 Lablicate GmbH.
* Copyright (c) 2020, 2024 Lablicate GmbH.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand All @@ -15,6 +15,7 @@
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swtchart.extensions.core.ResourceSupport;
import org.eclipse.swtchart.extensions.internal.support.OS;

public class PreferenceInitializer extends AbstractPreferenceInitializer {

Expand All @@ -23,7 +24,7 @@ public void initializeDefaultPreferences() {

IPreferenceStore preferenceStore = ResourceSupport.getPreferenceStore();
if(preferenceStore != null) {
preferenceStore.setDefault(PreferenceConstants.P_BUFFER_SELECTION, PreferenceConstants.DEF_BUFFER_SELECTION);
preferenceStore.setDefault(PreferenceConstants.P_BUFFER_SELECTION, getDefaultBufferedSelection());
preferenceStore.setDefault(PreferenceConstants.P_KEEP_SERIES_DESCRIPTION, PreferenceConstants.DEF_KEEP_SERIES_DESCRIPTION);
preferenceStore.setDefault(PreferenceConstants.P_MOVE_LEGEND_X, PreferenceConstants.DEF_MOVE_LEGEND_X);
preferenceStore.setDefault(PreferenceConstants.P_MOVE_LEGEND_Y, PreferenceConstants.DEF_MOVE_LEGEND_Y);
Expand All @@ -42,4 +43,16 @@ public void initializeDefaultPreferences() {
preferenceStore.setDefault(PreferenceConstants.P_HELP_POPUP_TIME_TO_CLOSE, PreferenceConstants.DEF_HELP_POPUP_TIME_TO_CLOSE);
}
}

/*
* The buffered selection creates a screenshot and sets it in the background
* while doing the data selection. This prevents to redraw the series while
* doing the selection event. Known limitations:
* ---
* macOS - https://github.com/eclipse/swtchart/issues/150
*/
private boolean getDefaultBufferedSelection() {

return OS.isWindows() || OS.isUnix();
}
}

0 comments on commit 3c80577

Please sign in to comment.