Gridarta Editor
DefaultMapViewSettings.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.model.mapviewsettings;
21 
22 import java.util.prefs.Preferences;
23 import net.sf.gridarta.MainControl;
24 import org.jetbrains.annotations.NotNull;
25 
33 
37  @NotNull
38  private static final String GRID_VISIBLE_KEY = "mapViewSettings.gridVisible";
39 
43  @NotNull
44  private static final String LIGHT_VISIBLE_KEY = "mapViewSettings.lightVisible";
45 
49  @NotNull
50  private static final String SMOOTHING_KEY = "mapViewSettings.smoothing";
51 
55  @NotNull
56  private static final String TILE_STRETCHING_KEY = "mapViewSettings.tileStretching";
57 
61  @NotNull
62  private static final String DOUBLE_FACES_KEY = "mapViewSettings.doubleFaces";
63 
67  @NotNull
68  private static final String ALPHA_TYPE_KEY = "mapViewSettings.alphaType";
69 
73  @NotNull
74  private static final String AUTOJOIN_KEY = "mapViewSettings.autojoin";
75 
79  @NotNull
80  private static final Preferences PREFERENCES = Preferences.userNodeForPackage(MainControl.class);
81 
82  @Override
83  protected boolean loadGridVisible() {
84  return PREFERENCES.getBoolean(GRID_VISIBLE_KEY, false);
85  }
86 
87  @Override
88  protected void saveGridVisible(final boolean gridVisible) {
90  }
91 
92  @Override
93  protected boolean loadLightVisible() {
94  return PREFERENCES.getBoolean(LIGHT_VISIBLE_KEY, false);
95  }
96 
97  @Override
98  protected void saveLightVisible(final boolean lightVisible) {
100  }
101 
102  @Override
103  protected boolean loadSmoothing() {
104  return PREFERENCES.getBoolean(SMOOTHING_KEY, false);
105  }
106 
107  @Override
108  protected void saveSmoothing(final boolean smoothing) {
109  PREFERENCES.putBoolean(SMOOTHING_KEY, smoothing);
110  }
111 
112  @Override
113  protected boolean loadTileStretching() {
114  return PREFERENCES.getBoolean(TILE_STRETCHING_KEY, false);
115  }
116 
117  @Override
118  protected void saveTileStretching(final boolean tileStretching) {
120  }
121 
122  @Override
123  protected boolean loadDoubleFaces() {
124  return PREFERENCES.getBoolean(DOUBLE_FACES_KEY, false);
125  }
126 
127  @Override
128  protected void saveDoubleFaces(final boolean doubleFaces) {
130  }
131 
132  @Override
133  protected int loadAlphaType() {
134  return PREFERENCES.getInt(ALPHA_TYPE_KEY, 0);
135  }
136 
137  @Override
138  protected void saveAlphaType(final int alphaType) {
140  }
141 
142  @Override
143  protected int loadEditType() {
144  return 0;
145  }
146 
147  @Override
148  protected boolean loadAutojoin() {
149  return PREFERENCES.getBoolean(AUTOJOIN_KEY, false);
150  }
151 
152  @Override
153  protected void saveAutojoin(final boolean autojoin) {
154  PREFERENCES.putBoolean(AUTOJOIN_KEY, autojoin);
155  }
156 
157 }
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.saveAutojoin
void saveAutojoin(final boolean autojoin)
Saves the autojoin value.
Definition: DefaultMapViewSettings.java:153
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.LIGHT_VISIBLE_KEY
static final String LIGHT_VISIBLE_KEY
Key for saving isLightVisible() state in preferences.
Definition: DefaultMapViewSettings.java:44
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.loadAutojoin
boolean loadAutojoin()
Loads the default value for autojoin.
Definition: DefaultMapViewSettings.java:148
net.sf.gridarta.model.mapviewsettings.AbstractMapViewSettings.lightVisible
boolean lightVisible
The visibility of the light.
Definition: AbstractMapViewSettings.java:43
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.saveAlphaType
void saveAlphaType(final int alphaType)
Saves the alphaType value.
Definition: DefaultMapViewSettings.java:138
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.loadTileStretching
boolean loadTileStretching()
Loads the default value for tileStretching.
Definition: DefaultMapViewSettings.java:113
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.saveSmoothing
void saveSmoothing(final boolean smoothing)
Saves the smoothing value.
Definition: DefaultMapViewSettings.java:108
net.sf.gridarta
Base package of all Gridarta classes.
net.sf.gridarta.model.mapviewsettings.AbstractMapViewSettings.tileStretching
boolean tileStretching
Whether tile-stretching display is active.
Definition: AbstractMapViewSettings.java:53
net.sf.gridarta.model.mapviewsettings.AbstractMapViewSettings.smoothing
boolean smoothing
Whether smoothing display is active.
Definition: AbstractMapViewSettings.java:48
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.saveGridVisible
void saveGridVisible(final boolean gridVisible)
Saves the gridVisible value.
Definition: DefaultMapViewSettings.java:88
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.SMOOTHING_KEY
static final String SMOOTHING_KEY
Key for saving isSmoothing() state in preferences.
Definition: DefaultMapViewSettings.java:50
net.sf
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.AUTOJOIN_KEY
static final String AUTOJOIN_KEY
Key for saving isAutojoin() state in preferences.
Definition: DefaultMapViewSettings.java:74
net.sf.gridarta.model.mapviewsettings.AbstractMapViewSettings.gridVisible
boolean gridVisible
The visibility of the grid.
Definition: AbstractMapViewSettings.java:38
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.saveTileStretching
void saveTileStretching(final boolean tileStretching)
Saves the tileStretching value.
Definition: DefaultMapViewSettings.java:118
net.sf.gridarta.model.mapviewsettings.AbstractMapViewSettings
Abstract base class for MapViewSettings implementations.
Definition: AbstractMapViewSettings.java:33
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.loadSmoothing
boolean loadSmoothing()
Loads the default value for smoothing.
Definition: DefaultMapViewSettings.java:103
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.loadEditType
int loadEditType()
Loads the default value for editType.
Definition: DefaultMapViewSettings.java:143
net.sf.gridarta.model.mapviewsettings.AbstractMapViewSettings.doubleFaces
boolean doubleFaces
Whether double faces should be drawn double height.
Definition: AbstractMapViewSettings.java:58
net
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.saveDoubleFaces
void saveDoubleFaces(final boolean doubleFaces)
Saves the doubleFaces value.
Definition: DefaultMapViewSettings.java:128
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.loadAlphaType
int loadAlphaType()
Loads the default value for alphaType.
Definition: DefaultMapViewSettings.java:133
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.ALPHA_TYPE_KEY
static final String ALPHA_TYPE_KEY
Key for saving isAlphaType(int) state in preferences.
Definition: DefaultMapViewSettings.java:68
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings
Default MapViewSettings implementation.
Definition: DefaultMapViewSettings.java:32
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.saveLightVisible
void saveLightVisible(final boolean lightVisible)
Saves the lightVisible value.
Definition: DefaultMapViewSettings.java:98
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.GRID_VISIBLE_KEY
static final String GRID_VISIBLE_KEY
Key for saving isGridVisible() state in preferences.
Definition: DefaultMapViewSettings.java:38
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.TILE_STRETCHING_KEY
static final String TILE_STRETCHING_KEY
Key for saving isTileStretching() state in preferences.
Definition: DefaultMapViewSettings.java:56
net.sf.gridarta.model.mapviewsettings.AbstractMapViewSettings.alphaType
int alphaType
Bit field of edit types to show transparent.
Definition: AbstractMapViewSettings.java:63
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.loadGridVisible
boolean loadGridVisible()
Loads the default value for gridVisible.
Definition: DefaultMapViewSettings.java:83
net.sf.gridarta.model.mapviewsettings.AbstractMapViewSettings.autojoin
boolean autojoin
Whether autojoining is on/off.
Definition: AbstractMapViewSettings.java:73
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.DOUBLE_FACES_KEY
static final String DOUBLE_FACES_KEY
Key for saving isDoubleFaces() state in preferences.
Definition: DefaultMapViewSettings.java:62
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.loadLightVisible
boolean loadLightVisible()
Loads the default value for lightVisible.
Definition: DefaultMapViewSettings.java:93
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.PREFERENCES
static final Preferences PREFERENCES
Preferences.
Definition: DefaultMapViewSettings.java:80
net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings.loadDoubleFaces
boolean loadDoubleFaces()
Loads the default value for doubleFaces.
Definition: DefaultMapViewSettings.java:123
net.sf.gridarta.MainControl
Interface used as preferences location.
Definition: MainControl.java:27