mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Remove adjust parameter.
This commit is contained in:
parent
6dde3e7374
commit
981665bcd0
1 changed files with 7 additions and 15 deletions
|
@ -55,12 +55,10 @@ public class RatioAdjustingSliderPanel extends JPanel {
|
|||
|
||||
// Slider stores its initial value to revert to when reset
|
||||
private int defaultValue;
|
||||
private boolean adjust;
|
||||
|
||||
public JStorageSlider(int min, int max, int value, boolean adjust) {
|
||||
public JStorageSlider(int min, int max, int value) {
|
||||
super(min, max, value);
|
||||
defaultValue = value;
|
||||
this.adjust = adjust;
|
||||
setMinorTickSpacing(5);
|
||||
setMajorTickSpacing(10);
|
||||
setPaintTicks(true);
|
||||
|
@ -72,10 +70,6 @@ public class RatioAdjustingSliderPanel extends JPanel {
|
|||
this.setValue(defaultValue);
|
||||
}
|
||||
|
||||
public boolean isAdjust() {
|
||||
return adjust;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class AdjustingSliderGroup {
|
||||
|
@ -92,10 +86,8 @@ public class RatioAdjustingSliderPanel extends JPanel {
|
|||
fireSliderChangedEvent((JStorageSlider) e.getSource());
|
||||
}
|
||||
});
|
||||
if (slider.isAdjust()) {
|
||||
adjustableCount++;
|
||||
}
|
||||
}
|
||||
adjustableCount = storageSliders.size() - 1;
|
||||
}
|
||||
|
||||
public void fireSliderChangedEvent(JStorageSlider source) {
|
||||
|
@ -108,7 +100,7 @@ public class RatioAdjustingSliderPanel extends JPanel {
|
|||
|
||||
private void updateSliderPosition(JStorageSlider source) {
|
||||
int maximum = MAXIMUM;
|
||||
int excess = 100;
|
||||
int excess = MAXIMUM;
|
||||
int sign = 0;
|
||||
for (JStorageSlider slider : storageSliders) {
|
||||
excess -= slider.getValue();
|
||||
|
@ -122,7 +114,7 @@ public class RatioAdjustingSliderPanel extends JPanel {
|
|||
for (int i = storageSliders.size() - 1; i >= 0; i--) {
|
||||
JStorageSlider slider = storageSliders.get(i);
|
||||
int value = slider.getValue();
|
||||
if (slider != source && slider.isAdjust()) {
|
||||
if (slider != source && maximum < MAXIMUM) {
|
||||
slider.setMaximum(maximum);
|
||||
if (excess >= addition) {
|
||||
value += addition * sign;
|
||||
|
@ -154,9 +146,9 @@ public class RatioAdjustingSliderPanel extends JPanel {
|
|||
private void initPanel() {
|
||||
|
||||
// Create three sliders with default values
|
||||
creatureSlider = new JStorageSlider(0, MAXIMUM, DeckGeneratorPool.DEFAULT_CREATURE_PERCENTAGE, true);
|
||||
nonCreatureSlider = new JStorageSlider(0, MAXIMUM, DeckGeneratorPool.DEFAULT_NON_CREATURE_PERCENTAGE, true);
|
||||
landSlider = new JStorageSlider(0, MAXIMUM, DeckGeneratorPool.DEFAULT_LAND_PERCENTAGE, false);
|
||||
creatureSlider = new JStorageSlider(0, MAXIMUM, DeckGeneratorPool.DEFAULT_CREATURE_PERCENTAGE);
|
||||
nonCreatureSlider = new JStorageSlider(0, MAXIMUM, DeckGeneratorPool.DEFAULT_NON_CREATURE_PERCENTAGE);
|
||||
landSlider = new JStorageSlider(0, MAXIMUM, DeckGeneratorPool.DEFAULT_LAND_PERCENTAGE);
|
||||
|
||||
sg = new AdjustingSliderGroup(creatureSlider, nonCreatureSlider, landSlider);
|
||||
|
||||
|
|
Loading…
Reference in a new issue