mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Improve caption slightly more
This commit is contained in:
@@ -45,7 +45,7 @@ public class FDeckChooser extends FScreen {
|
|||||||
public FDeckChooser(boolean isAi0) {
|
public FDeckChooser(boolean isAi0) {
|
||||||
super(true, "", false);
|
super(true, "", false);
|
||||||
isAi = isAi0;
|
isAi = isAi0;
|
||||||
|
|
||||||
lstDecks.setItemActivateHandler(new FEventHandler() {
|
lstDecks.setItemActivateHandler(new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
@@ -303,8 +303,6 @@ public class FDeckChooser extends FScreen {
|
|||||||
}
|
}
|
||||||
if (deckType == null) { return; }
|
if (deckType == null) { return; }
|
||||||
|
|
||||||
lstDecks.setCaption(deckType.toString());
|
|
||||||
|
|
||||||
switch (deckType) {
|
switch (deckType) {
|
||||||
case CUSTOM_DECK:
|
case CUSTOM_DECK:
|
||||||
updateCustom();
|
updateCustom();
|
||||||
|
|||||||
@@ -40,35 +40,37 @@ public final class DeckManager extends ItemManager<DeckProxy> {
|
|||||||
*/
|
*/
|
||||||
public DeckManager(final GameType gt) {
|
public DeckManager(final GameType gt) {
|
||||||
super(DeckProxy.class, true);
|
super(DeckProxy.class, true);
|
||||||
this.gametype = gt;
|
gametype = gt;
|
||||||
|
|
||||||
this.setItemActivateHandler(new FEventHandler() {
|
setItemActivateHandler(new FEventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(FEvent e) {
|
public void handleEvent(FEvent e) {
|
||||||
editDeck(getSelectedItem());
|
editDeck(getSelectedItem());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setCaption("Decks");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup(ItemManagerConfig config0) {
|
public void setup(ItemManagerConfig config0) {
|
||||||
boolean wasStringOnly = (this.getConfig() == ItemManagerConfig.STRING_ONLY);
|
boolean wasStringOnly = (getConfig() == ItemManagerConfig.STRING_ONLY);
|
||||||
boolean isStringOnly = (config0 == ItemManagerConfig.STRING_ONLY);
|
boolean isStringOnly = (config0 == ItemManagerConfig.STRING_ONLY);
|
||||||
|
|
||||||
super.setup(config0, null);
|
super.setup(config0, null);
|
||||||
|
|
||||||
if (isStringOnly != wasStringOnly) {
|
if (isStringOnly != wasStringOnly) {
|
||||||
this.restoreDefaultFilters();
|
restoreDefaultFilters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeleteCommand(final FEventHandler c0) {
|
public void setDeleteCommand(final FEventHandler c0) {
|
||||||
this.cmdDelete = c0;
|
cmdDelete = c0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addDefaultFilters() {
|
protected void addDefaultFilters() {
|
||||||
if (this.getConfig() == ItemManagerConfig.STRING_ONLY) { return; }
|
if (getConfig() == ItemManagerConfig.STRING_ONLY) { return; }
|
||||||
|
|
||||||
addFilter(new DeckColorFilter(this));
|
addFilter(new DeckColorFilter(this));
|
||||||
}
|
}
|
||||||
@@ -164,7 +166,7 @@ public final class DeckManager extends ItemManager<DeckProxy> {
|
|||||||
|
|
||||||
/*FScreen screen = null;
|
/*FScreen screen = null;
|
||||||
|
|
||||||
switch (this.gametype) {
|
switch (gametype) {
|
||||||
case Quest:
|
case Quest:
|
||||||
screen = FScreen.DECK_EDITOR_QUEST;
|
screen = FScreen.DECK_EDITOR_QUEST;
|
||||||
editorCtrl = new CEditorQuest(FModel.getQuest());
|
editorCtrl = new CEditorQuest(FModel.getQuest());
|
||||||
@@ -208,7 +210,7 @@ public final class DeckManager extends ItemManager<DeckProxy> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// consider using deck proxy's method to delete deck
|
// consider using deck proxy's method to delete deck
|
||||||
switch(this.gametype) {
|
switch(gametype) {
|
||||||
case Constructed:
|
case Constructed:
|
||||||
case Draft:
|
case Draft:
|
||||||
case Sealed:
|
case Sealed:
|
||||||
@@ -222,10 +224,10 @@ public final class DeckManager extends ItemManager<DeckProxy> {
|
|||||||
throw new UnsupportedOperationException("Delete not implemneted for game type = " + gametype.toString());
|
throw new UnsupportedOperationException("Delete not implemneted for game type = " + gametype.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.removeItem(deck, 1);
|
removeItem(deck, 1);
|
||||||
|
|
||||||
if (this.cmdDelete != null) {
|
if (cmdDelete != null) {
|
||||||
this.cmdDelete.handleEvent(new FEvent(this, FEventType.DELETE));
|
cmdDelete.handleEvent(new FEvent(this, FEventType.DELETE));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,12 +283,15 @@ public abstract class ItemManager<T extends InventoryItem> extends FContainer im
|
|||||||
float ratioWidth = lblRatio.getAutoSizeBounds().width;
|
float ratioWidth = lblRatio.getAutoSizeBounds().width;
|
||||||
float viewButtonWidth = fieldHeight;
|
float viewButtonWidth = fieldHeight;
|
||||||
float viewButtonCount = views.size() + 1;
|
float viewButtonCount = views.size() + 1;
|
||||||
float availableCaptionWidth = helper.getParentWidth() - viewButtonWidth * viewButtonCount - ratioWidth - helper.getX() - (viewButtonCount + 2) * helper.getGapX();
|
float availableCaptionWidth = helper.getParentWidth() - viewButtonWidth * viewButtonCount - ratioWidth - helper.getX() - (viewButtonCount + 1) * helper.getGapX();
|
||||||
if (captionWidth > availableCaptionWidth) { //truncate caption if not enough room for it
|
if (captionWidth > availableCaptionWidth) { //truncate caption if not enough room for it
|
||||||
captionWidth = availableCaptionWidth;
|
captionWidth = availableCaptionWidth;
|
||||||
}
|
}
|
||||||
|
helper.offset(0, 1); //shift caption downward
|
||||||
helper.include(lblCaption, captionWidth, fieldHeight);
|
helper.include(lblCaption, captionWidth, fieldHeight);
|
||||||
|
helper.offset(-helper.getGapX(), 0);
|
||||||
helper.fillLine(lblRatio, fieldHeight, (viewButtonWidth + helper.getGapX()) * viewButtonCount - viewButtonCount + 1); //leave room for view buttons
|
helper.fillLine(lblRatio, fieldHeight, (viewButtonWidth + helper.getGapX()) * viewButtonCount - viewButtonCount + 1); //leave room for view buttons
|
||||||
|
helper.offset(0, -1);
|
||||||
for (ItemView<T> view : views) {
|
for (ItemView<T> view : views) {
|
||||||
helper.include(view.getButton(), viewButtonWidth, fieldHeight);
|
helper.include(view.getButton(), viewButtonWidth, fieldHeight);
|
||||||
helper.offset(-1, 0);
|
helper.offset(-1, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user