[1.3b56] Clear Group not working in Global Macros Frame
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice, MapTool BugReport Manager
[1.3b56] Clear Group not working in Global Macros Frame
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.
Currently playing Savage Worlds in the home-brew world of Shadora.
We are looking for players! PM me if interested.
Re: [1.3b56] Clear Group not working in Global Macros Frame
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?
I'm wondering if whatever was done with this bug, introduced the bug mentioned in this bug report?
Re: [1.3b56] Clear Group not working in Global Macros Frame
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
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
Re: [1.3b56] Clear Group not working in Global Macros Frame
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:
And the bugged Global panel looks like this:
So far, the main difference i'm seeing is that the working code has
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...
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();
}
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();
}
Code: Select all
List<MacroButtonProperties> campProps = MapTool.getCampaign().getMacroButtonPropertiesArray();
Anyways, im still not really sure where i'm going with this yet, just some mad ramblings...
Re: [1.3b56] Clear Group not working in Global Macros Frame
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.
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.
Re: [1.3b56] Clear Group not working in Global Macros Frame
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.
Re: [1.3b56] Clear Group not working in Global Macros Frame
aku,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.
Thank you for working on this!!! It is a real thorn in the side of my group.
Best.
Re: [1.3b56] Clear Group not working in Global Macros Frame
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.Elorebaen wrote:aku,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.
Thank you for working on this!!! It is a real thorn in the side of my group.
Best.
Re: [1.3b56] Clear Group not working in Global Macros Frame
aku wrote: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.Elorebaen wrote:aku,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.
Thank you for working on this!!! It is a real thorn in the side of my group.
Best.
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.
Re: [1.3b56] Clear Group not working in Global Macros Frame
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...
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...
Re: [1.3b56] Clear Group not working in Global Macros Frame
with a bit of help from trevor, i managed to get this finally and completely squashed, emailed it to him tonight
Re: [1.3b56] Clear Group not working in Global Macros Frame
Hey, very cool! I look forward to trying this out.
Re: [1.3b56] Clear Group not working in Global Macros Frame
haha so much excitement for being able to delete macros. Awesomeness!Azhrei wrote:Hey, very cool! I look forward to trying this out.
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
Re: [1.3b56] Clear Group not working in Global Macros Frame
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
"Just" is the second biggest word in the English language.
What I'm working on
- 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
Fixed for 1.3b58
Dreaming of a 1.3 release