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-2015 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) {
89  PREFERENCES.putBoolean(GRID_VISIBLE_KEY, 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) {
99  PREFERENCES.putBoolean(LIGHT_VISIBLE_KEY, 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) {
119  PREFERENCES.putBoolean(TILE_STRETCHING_KEY, 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) {
129  PREFERENCES.putBoolean(DOUBLE_FACES_KEY, 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) {
139  PREFERENCES.putInt(ALPHA_TYPE_KEY, 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 }
static final String ALPHA_TYPE_KEY
Key for saving alphaType state in preferences.
static final String GRID_VISIBLE_KEY
Key for saving gridVisible state in preferences.
static final String AUTOJOIN_KEY
Key for saving autojoin state in preferences.
Abstract base class for MapViewSettings implementations.
static final String TILE_STRETCHING_KEY
Key for saving tileStretching state in preferences.
boolean doubleFaces
Whether double faces should be drawn double height.
Base package of all Gridarta classes.
boolean tileStretching
Whether tile-stretching display is active.
static final String LIGHT_VISIBLE_KEY
Key for saving lightVisible state in preferences.
static final String DOUBLE_FACES_KEY
Key for saving doubleFaces state in preferences.
static final String SMOOTHING_KEY
Key for saving smoothing state in preferences.
Interface used as preferences location.
int alphaType
Bit field of edit types to show transparent.