[1.3b56] Clear Group not working in Global Macros Frame

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice, MapTool BugReport Manager

Post Reply
pelwer
Cave Troll
Posts: 36
Joined: Sat Jan 24, 2009 2:31 pm
Location: Portland, OR
Contact:

[1.3b56] Clear Group not working in Global Macros Frame

Post by pelwer »

Clear Group right mouse menu item is ignored in the Global Macros frame. Works fine on the Campaign Macros frame.
A little nonsense, now and then, is relished by the wisest men. - Willy Wonka

Currently playing Savage Worlds in the home-brew world of Shadora.
We are looking for players! PM me if interested.

Elorebaen
Dragon
Posts: 365
Joined: Sat Dec 22, 2007 5:37 pm

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by Elorebaen »

I too have noticed this bug. Makes it impossible for PCs to swap out Macrosets.

I'm wondering if whatever was done with this bug, introduced the bug mentioned in this bug report?

User avatar
aku
Dragon
Posts: 856
Joined: Wed Nov 15, 2006 9:03 am
Contact:

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by aku »

Looks like neither the group clear, nor the panel clear work in the global macro panel.

EDIT: I found the section of code controlling this, but it almost seems like the code was written by two different people, as the style of it is very different, and in my newbishness, i'm having a hard time trying to figure out why one works, and the other doesnt... for anyone else that might be looking, it's in macrobuttons.panels. GlobalPanel.java, and CampaignPanel.java, respectfully

User avatar
aku
Dragon
Posts: 856
Joined: Wed Nov 15, 2006 9:03 am
Contact:

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by aku »

ok, so on further digging, it actually looks like both bits were written by trevor, and i'm still confused. Here's what i've deduced so far, The campaign panel versions of both commands, work. The delete group function looks like this:

Code: Select all

public static void deleteButtonGroup(String macroGroup) {
		
		AbstractButtonGroup.clearHotkeys(MapTool.getFrame().getCampaignPanel(), macroGroup);
		
		List<MacroButtonProperties> campProps = MapTool.getCampaign().getMacroButtonPropertiesArray();
		
		List<MacroButtonProperties> startingProps = new ArrayList<MacroButtonProperties>(MapTool.getCampaign().getMacroButtonPropertiesArray());
		
		campProps.clear();
		
		for (MacroButtonProperties nextProp : startingProps) {
		
			if (!macroGroup.equals(nextProp.getGroup())) {
				MapTool.getCampaign().saveMacroButtonProperty(nextProp);
			}
		}
		MapTool.getFrame().getCampaignPanel().reset();
	}
And the bugged Global panel looks like this:

Code: Select all

public static void deleteButtonGroup(String macroGroup) {
		AbstractButtonGroup.clearHotkeys(MapTool.getFrame().getGlobalPanel(), macroGroup);
		List<MacroButtonProperties> finalProps = new ArrayList<MacroButtonProperties>();
		for(MacroButtonProperties nextProp : MacroButtonPrefs.getButtonProperties()) {
			if(!macroGroup.equals(nextProp.getGroup())) {
				finalProps.add(nextProp);
			}
		}
		MacroButtonPrefs.getButtonProperties().clear();
		for(MacroButtonProperties nextProp : finalProps) {
			MacroButtonPrefs.savePreferences(nextProp);
		}
		MapTool.getFrame().getGlobalPanel().reset();
	}
So far, the main difference i'm seeing is that the working code has

Code: Select all

List<MacroButtonProperties> campProps = MapTool.getCampaign().getMacroButtonPropertiesArray();
And i'm not able to find the comparable line in the bugged code.

Anyways, im still not really sure where i'm going with this yet, just some mad ramblings...

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by Azhrei »

They have different code because the macros are stored in different places.

Campaign macros are stored in the CampaignProperties object (surprise!) while Global macros are stored in the (OS=Windows: registry, OS=OSX: ~/Library/Java directory). Hence the functions to manage where they are stored is different.

Beyond that I can't help as I've never looked into macro storage in detail.

User avatar
aku
Dragon
Posts: 856
Joined: Wed Nov 15, 2006 9:03 am
Contact:

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by aku »

I guess i'll go ahead and publicly commit that i'm working on this one. i got the second portion of it fixed i think, with the global panel delete not working, but the first portion, with the group delete, is still just a tad out of my reach.

Elorebaen
Dragon
Posts: 365
Joined: Sat Dec 22, 2007 5:37 pm

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by Elorebaen »

aku wrote:I guess i'll go ahead and publicly commit that i'm working on this one. i got the second portion of it fixed i think, with the global panel delete not working, but the first portion, with the group delete, is still just a tad out of my reach.
aku,
Thank you for working on this!!! It is a real thorn in the side of my group.

Best.

User avatar
aku
Dragon
Posts: 856
Joined: Wed Nov 15, 2006 9:03 am
Contact:

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by aku »

Elorebaen wrote:
aku wrote:I guess i'll go ahead and publicly commit that i'm working on this one. i got the second portion of it fixed i think, with the global panel delete not working, but the first portion, with the group delete, is still just a tad out of my reach.
aku,
Thank you for working on this!!! It is a real thorn in the side of my group.

Best.
Not a problem, i'm still wrangling with it, it's sort of an odd implementation, imo, because the groups arent saved as part of the macro name, but are instead, just a property on the token, so i'm still not certain how i can step through the properties, and delete just the ones that are in that group lots of ideas, none successful, so far.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by Rumble »

aku wrote:
Elorebaen wrote:
aku wrote:I guess i'll go ahead and publicly commit that i'm working on this one. i got the second portion of it fixed i think, with the global panel delete not working, but the first portion, with the group delete, is still just a tad out of my reach.
aku,
Thank you for working on this!!! It is a real thorn in the side of my group.

Best.
Not a problem, i'm still wrangling with it, it's sort of an odd implementation, imo, because the groups arent saved as part of the macro name, but are instead, just a property on the token, so i'm still not certain how i can step through the properties, and delete just the ones that are in that group lots of ideas, none successful, so far.

When I looked at it, it looked like the procedure adopted was to step through the properties and save the ones that were being kept (i.e., the ones that were not in the group about to be deleted) in a temporary variable, then delete all the buttons/properties/preferences, and then restore the ones that were housed in the temporary variable. On the repaint, it appears as if you deleted the one group.

Admittedly, it's only on a cursory examination of the code, but that seemed to be what was done.

User avatar
aku
Dragon
Posts: 856
Joined: Wed Nov 15, 2006 9:03 am
Contact:

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by aku »

i think you're right, but the problem, i encountered, was that globalPanel.java was not importing java.util.prefs.Preferences;

which, if i understand correctly, means that the class can't actually DO anything with any macros stored in the registry. In my revised Clear Panel class (the second option for removing a batch of macros from the panel) i had to use removeNode() to remove all of the macros from the local preferences (registry in windows' case). Like i said, that wont work here, because the group name isnt something that is saved local (for example, you dont get a registry entry that is like maptools-preferences-macros-<groupname>-<macroname>, it ends at the macro entry, and then all of the macros are listed.

so i wonder if a search, similar to what is being done already in the non-functioning version, combined with getting the macro id (like the single delete does) to delete the individual macros in the group might work...

User avatar
aku
Dragon
Posts: 856
Joined: Wed Nov 15, 2006 9:03 am
Contact:

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by aku »

with a bit of help from trevor, i managed to get this finally and completely squashed, emailed it to him tonight

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by Azhrei »

Hey, very cool! I look forward to trying this out. :)

User avatar
aku
Dragon
Posts: 856
Joined: Wed Nov 15, 2006 9:03 am
Contact:

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by aku »

Azhrei wrote:Hey, very cool! I look forward to trying this out. :)
haha so much excitement for being able to delete macros. Awesomeness!

now, for the next big project, (actually ADDING something!) that right click functionality to the zone selection icon to be able to add a map... gimme a few builds to get that one in :D

User avatar
applekor
Giant
Posts: 154
Joined: Thu Jul 03, 2008 3:52 pm
Location: Not Here

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by applekor »

Thanks for finally squishing it. I was waiting for trevor to come back from RL before playing with the code again. RL was killing me, as well. It would have been my third? attempt at killing this one.
"Should" is the biggest word in the English language.

"Just" is the second biggest word in the English language.

What I'm working on

User avatar
trevor
Codeum Arcanum (RPTools Founder)
Posts: 11311
Joined: Mon Jan 09, 2006 4:16 pm
Location: Austin, Tx
Contact:

Re: [1.3b56] Clear Group not working in Global Macros Frame

Post by trevor »

Fixed for 1.3b58
Dreaming of a 1.3 release

Post Reply

Return to “Resolved”