Solution to 0000659: Left panel on main launcher screen is n
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
10 posts
• Page 1 of 1
Solution to 0000659: Left panel on main launcher screen is n
by spr » 08 Jul 2013, 00:51
Hi,
Here is a possible solution (unified diff) to issue "0000659: Left panel on main launcher screen is not scrollable when items expand past bottom of window" in the bug tracker (sorry, it will not let me post the actual link
).
Basically, I have made a few minor alterations which prevent two menu groups from being open at the same time which makes the overall display more compact. For example, if the Sanctioned Formats section is open and you click on Game Settings, the Sanctioned section will automatically collapse.
I have also moved the Exit Form and Deck Editor buttons to the top of the menu options (underneath the logo) so that they are not constantly moving up and down as menu selections are made.
Steve.
Here is a possible solution (unified diff) to issue "0000659: Left panel on main launcher screen is not scrollable when items expand past bottom of window" in the bug tracker (sorry, it will not let me post the actual link

Basically, I have made a few minor alterations which prevent two menu groups from being open at the same time which makes the overall display more compact. For example, if the Sanctioned Formats section is open and you click on Game Settings, the Sanctioned section will automatically collapse.
I have also moved the Exit Form and Deck Editor buttons to the top of the menu options (underneath the logo) so that they are not constantly moving up and down as menu selections are made.
- Code: Select all
e8e9215ab75040689daf64cfd3c7613d805581ea
trunk/src/main/java/forge/gui/home/LblGroup.java | 24 ++++++++++++----------
trunk/src/main/java/forge/gui/home/VHomeUI.java | 11 ++++++----
.../java/forge/properties/ForgePreferences.java | 2 +-
3 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/trunk/src/main/java/forge/gui/home/LblGroup.java b/trunk/src/main/java/forge/gui/home/LblGroup.java
index cc47180..5b40bdc 100644
--- a/trunk/src/main/java/forge/gui/home/LblGroup.java
+++ b/trunk/src/main/java/forge/gui/home/LblGroup.java
@@ -22,8 +22,10 @@ import forge.properties.ForgePreferences.FPref;
*/
@SuppressWarnings("serial")
public class LblGroup extends JLabel implements ILocalRepaint {
+
+ private static EMenuGroup activeMenuGroup = null;
+
private boolean hovered = false;
- private boolean collapsed = true;
private final Color clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
private final Color l20 = FSkin.stepColor(clrTheme, 20);
@@ -39,7 +41,7 @@ public class LblGroup extends JLabel implements ILocalRepaint {
* @param e0 {@link forge.gui.home.EMenuGroup}
*/
public LblGroup(final EMenuGroup e0) {
- super(" + " + e0.getTitle());
+ super(" " + e0.getTitle());
this.setFont(FSkin.getBoldFont(14));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
@@ -68,6 +70,15 @@ public class LblGroup extends JLabel implements ILocalRepaint {
* @param e0 {@link forge.gui.home.EMenuGroup}
*/
public void groupClick(final EMenuGroup e0) {
+ if (e0 != activeMenuGroup) {
+ if (activeMenuGroup != null) {
+ toggleCollapseState(activeMenuGroup);
+ }
+ toggleCollapseState(e0);
+ activeMenuGroup = e0;
+ }
+ }
+ private void toggleCollapseState(final EMenuGroup e0) {
final Component[] menuObjects = this.getParent().getComponents();
// Toggle label items in this group
@@ -88,15 +99,6 @@ public class LblGroup extends JLabel implements ILocalRepaint {
break;
}
}
-
- if (this.collapsed) {
- this.collapsed = false;
- this.setText(" - " + e0.getTitle());
- }
- else {
- this.collapsed = true;
- this.setText(" + " + e0.getTitle());
- }
}
@Override
diff --git a/trunk/src/main/java/forge/gui/home/VHomeUI.java b/trunk/src/main/java/forge/gui/home/VHomeUI.java
index 32c78f0..c4a2597 100644
--- a/trunk/src/main/java/forge/gui/home/VHomeUI.java
+++ b/trunk/src/main/java/forge/gui/home/VHomeUI.java
@@ -98,6 +98,8 @@ public enum VHomeUI implements IVTopLevelUI {
private VHomeUI() {
pnlMenu.add(lblLogo, "w 150px!, h 150px!, gap 0 0 5px 10px, ax center");
+ layoutMainMenuButtons();
+
// Add new menu items here (order doesn't matter).
allSubmenus.add(VSubmenuConstructed.SINGLETON_INSTANCE);
allSubmenus.add(VSubmenuDraft.SINGLETON_INSTANCE);
@@ -152,7 +154,10 @@ public enum VHomeUI implements IVTopLevelUI {
allGroupLabels.get(e).groupClick(e);
}
}
-
+ pnlDisplay.setBackground(FSkin.alphaColor(l00, 100));
+ }
+
+ private void layoutMainMenuButtons() {
JPanel pnlButtons = new JPanel(new MigLayout("insets 0, gap 0, wrap 3"));
pnlButtons.setOpaque(false);
@@ -163,10 +168,8 @@ public enum VHomeUI implements IVTopLevelUI {
pnlButtons.add(lblStartServer, "w 170px!, h 25px!, gap 0 10px 10px 0, sx 2 ");
pnlButtons.add(lblStopServer, "w 50px!, h 25px!, gap 0 0 10px 0");
lblStopServer.setEnabled(false);
- }
-
+ }
pnlMenu.add(pnlButtons, "w 230px!, gap 10px 0 10px 10px");
- pnlDisplay.setBackground(FSkin.alphaColor(l00, 100));
}
/** @return {@link forge.gui.toolbox.ExperimentalLabel} */
diff --git a/trunk/src/main/java/forge/properties/ForgePreferences.java b/trunk/src/main/java/forge/properties/ForgePreferences.java
index f97360b..3d8b682 100644
--- a/trunk/src/main/java/forge/properties/ForgePreferences.java
+++ b/trunk/src/main/java/forge/properties/ForgePreferences.java
@@ -59,7 +59,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_FOR_TOUCHSCREN("false"),
SUBMENU_CURRENTMENU (EMenuItem.CONSTRUCTED.toString()),
- SUBMENU_SANCTIONED ("false"),
+ SUBMENU_SANCTIONED ("true"),
SUBMENU_GAUNTLET ("false"),
SUBMENU_VARIANT ("false"),
SUBMENU_QUEST ("false"),
Steve.
Re: Solution to 0000659: Left panel on main launcher screen
by Sloth » 09 Jul 2013, 14:53
Welcome Steve,
i'm not very proficient in our UI code and i don't care about the UI so much, but we could definitely use a helping hand for improving it. Be aware though, that some people can be very picky about UI changes.
Your patch looks like a good move to me. So if nobody objects i will grant you commit rights tomorrow.
i'm not very proficient in our UI code and i don't care about the UI so much, but we could definitely use a helping hand for improving it. Be aware though, that some people can be very picky about UI changes.
Your patch looks like a good move to me. So if nobody objects i will grant you commit rights tomorrow.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Solution to 0000659: Left panel on main launcher screen
by jsv » 09 Jul 2013, 18:10
Well, speaking of picky...
I think moving the Exit Forge and Deck Editor buttons to the top is a good idea, but I'm not sure I want that radio-collapse behavior. Most of the time I keep the first 3 menu groups open and the remaining 2 closed. If the proposed change is accepted I can get used to making an extra click here and there, sure... but still in my opinion it would be making extra clicks for no good reason.

Re: Solution to 0000659: Left panel on main launcher screen
by Sloth » 10 Jul 2013, 13:45
Membership approved for spr.
Welcome aboard. You should now be able to commit.
Welcome aboard. You should now be able to commit.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Solution to 0000659: Left panel on main launcher screen
by spr » 11 Jul 2013, 03:44
Hi Sloth,
Many thanks for the commit access. Now I just need to see if I can remember how to do this in Subversion!
I am very interested in the AI aspects of Forge but it is through the UI that I am kind of finding my way through the code so I tend to notice things there first. Being relatively new to the world of MTG I find using Forge and examing the code behind a great way to learn.
I also hear where you are coming from about treading carefully when it comes to UI changes. I will try to avoid any Windows 8 experiences!
JSV - good point. It is simple enough to add a setting to switch this behaviour on or off.
Currently, these are the main changes I have made to Forge and hope to commit in future -
1. The more compact menu as mentioned above.
2. New settings to let you toggle the Card Name, P/T and mana cost overlays. I find the P/T and mana cost very useful but could do without the Card Name.
3. A new Game Log verbosity setting that lets you change how much info is displayed in the Game Log.
4. Fixed up the Game Log so that each new entry is added to the top of the list rather than the bottom (and usually hidden as well
) and made it a bit easier to read. There does seem to be quite a lot of white text on slightly less white background.
I hope I can be of help and can contribute to a great piece of software.
Cheers,
Steve.
Many thanks for the commit access. Now I just need to see if I can remember how to do this in Subversion!
I am very interested in the AI aspects of Forge but it is through the UI that I am kind of finding my way through the code so I tend to notice things there first. Being relatively new to the world of MTG I find using Forge and examing the code behind a great way to learn.
I also hear where you are coming from about treading carefully when it comes to UI changes. I will try to avoid any Windows 8 experiences!

JSV - good point. It is simple enough to add a setting to switch this behaviour on or off.
Currently, these are the main changes I have made to Forge and hope to commit in future -
1. The more compact menu as mentioned above.
2. New settings to let you toggle the Card Name, P/T and mana cost overlays. I find the P/T and mana cost very useful but could do without the Card Name.
3. A new Game Log verbosity setting that lets you change how much info is displayed in the Game Log.
4. Fixed up the Game Log so that each new entry is added to the top of the list rather than the bottom (and usually hidden as well

I hope I can be of help and can contribute to a great piece of software.
Cheers,
Steve.
Re: Solution to 0000659: Left panel on main launcher screen
by jsv » 11 Jul 2013, 05:31
Welcome to the group, spr!

Oh, just remember there is no separate svn push. Once you've done svn commit, it takes effect immediately: each other developer will be losing 1 life at beginning of his update. Not sure you'll get that many life though, this part may be buggedspr wrote: Now I just need to see if I can remember how to do this in Subversion!

Re: Solution to 0000659: Left panel on main launcher screen
by squee1968 » 11 Jul 2013, 06:13
That's not a bug, it's a feature.spr wrote: Not sure you'll get that many life though, this part may be bugged

Re: Solution to 0000659: Left panel on main launcher screen
by Sloth » 11 Jul 2013, 06:19
I recommend using TortoiseSVN. It's much easier to handle being integrated into the explorer and has a ton of useful features.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Solution to 0000659: Left panel on main launcher screen
by spr » 11 Jul 2013, 15:55
I agree. I tried using the subversion Eclipse plugins but ended up returning to TortoiseSVN which has been around for ever and just works in Windows (I still think the ripple effect in the about box is cool!). But then I installed TortoiseGit and TortoiseHg. And GitExtensions. Now my context menu is a bit of a cluttered nightmare!Sloth wrote:I recommend using TortoiseSVN.

Re: Solution to 0000659: Left panel on main launcher screen
by spr » 12 Jul 2013, 01:44
I have now committed the changes (r22546) including a new "Compact Menu" setting that is off by default so the menu behaviour will stay the same as it is now.
Cheers,
Steve.
Cheers,
Steve.
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 69 guests