Working on tokenTool

Thoughts, Help, Feature Requests

Moderators: dorpond, trevor, Azhrei

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Working on tokenTool

Post by CoveredInFish »

Hiho,

I'm working currently on two tokenTool features.

- incremental numbering for the file name (used by drag&drop)
- paste image from clipboard

Most if it already works fine, i have to invest more time in finetuning though. But before I do so ... has such a patch have any chance to be applied? Who has to be contacted?

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: Working on tokenTool

Post by jfrazierjr »

CoveredInFish wrote:Hiho,

I'm working currently on two tokenTool features.

- incremental numbering for the file name (used by drag&drop)
- paste image from clipboard

Most if it already works fine, i have to invest more time in finetuning though. But before I do so ... has such a patch have any chance to be applied? Who has to be contacted?
Azhrei, and I don't see any reason why not.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

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

Re: Working on tokenTool

Post by Azhrei »

Those both sound like useful features, so yeah, I'd be willing to look at yoru patches.

One thing that has always bothered me about TT is how long it takes to start up?! :? I don't know what it's doing (that would be my first step) but on my Mac it takes about 20 seconds before the window opens. I can understand that with MT because I know of all the background stuff going on, but TT doesn't have any background stuff (that I know of)...

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Working on tokenTool

Post by CoveredInFish »

Azhrei wrote:One thing that has always bothered me about TT is how long it takes to start up?! :?
I'm afraid I'm the wrong guy to hunt that down. I'm really pretty new to java and swing and stuff...

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

Re: Working on tokenTool

Post by Azhrei »

Yeah, no problem. I was just mentioning it in case you were in there looking around and noticed something...

Glock-9mm
Giant
Posts: 178
Joined: Fri Jan 05, 2007 7:53 pm
Location: Wgtn, New Zealand

Re: Working on tokenTool

Post by Glock-9mm »

CoveredInFish wrote:Hiho,

I'm working currently on two tokenTool features.

- incremental numbering for the file name (used by drag&drop)
- paste image from clipboard

Most if it already works fine, i have to invest more time in finetuning though. But before I do so ... has such a patch have any chance to be applied? Who has to be contacted?
If you were not CoveredInFish. Id almost consider hugging you!

I look "super foward" to these updates!
---
Glock-9mm (Wgtn, NZ)
Shooting from the hip... Never the lip!

User avatar
jay
RPTools Team
Posts: 1767
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx

Re: Working on tokenTool

Post by jay »

I'm guessing the startup slowness is for loading all of the token borders since they would be displayed immediately in the dropdown list.

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Working on tokenTool

Post by CoveredInFish »

Okay, here is the patch.

New features:

- user can select to either name the dragged file ".token.drag" or "<fileNamePrefix>_<fileNumber>" with file number incrementing by 1 each *DRAG* action. Note that if you cancel a drag-drop the file number still does get increased - i dont think you can check if the drop-action actually succeeded or not?!

- user can paste an image (like a win-screenshot made with PRINT key) from clipboard to tokentool)

- user can copy token-image to clipboard. (I think the transpareny gets lost with this but I dont see exactly why or have experience to handle it)
Attachments
tokentool_patch_cif_v1.txt
(53.56 KiB) Downloaded 122 times

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

Re: Working on tokenTool

Post by Azhrei »

CoveredInFish wrote:- user can select to either name the dragged file ".token.drag" or "<fileNamePrefix>_<fileNumber>" with file number incrementing by 1 each *DRAG* action. Note that if you cancel a drag-drop the file number still does get increased - i dont think you can check if the drop-action actually succeeded or not?!
Yes, you can.

Check the TransferableHelper code that is part of MapTool. In particular, the importData() method, IIRC.
- user can paste an image (like a win-screenshot made with PRINT key) from clipboard to tokentool)
This will be very handy. :)
- user can copy token-image to clipboard. (I think the transpareny gets lost with this but I dont see exactly why or have experience to handle it)
This might be because the clipboard supports JPEG and not PNG? It may work on a Unix system but someone will need to test that.

I'll try applying your patch some time over the weekend and playing with it.

@Jay: Thanks for the hint. If I get time I'll take a look at it. That's something that could be deferred to a separate thread as long as the first one is loaded synchronously (so it appears correctly in the dropdown list).

Hm, what happens if the data model for the dropdown list were to use file: URLs? Then Swing would ask for the images and they could be loaded as-needed. In the meantime a separate thread could be loading them. If the ImageIO cache were turned on that should work out...

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Working on tokenTool

Post by CoveredInFish »

Azhrei wrote: Yes, you can.
Hah! Ineed I can. In fact all i had to do was using DragSourceDropEvent and its getDropSuccess() method. So easy if you know where to look. :-D

Anyway, now the counting works even better, increasing only on successful drops.

New patch attached..

PS: i just realized that I executed a Source->CleanUp on the token tool source so the patch contains some classes I didnt changed manually. Hope this is a robust feature not causing trouble ..
Attachments
tokentool_patch_cif_v2.txt
(53.97 KiB) Downloaded 170 times

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Working on tokenTool

Post by CoveredInFish »

jay wrote:...the startup slowness is for loading all of the token borders ...
This would be OverListModel.refresh()
Its called on startup and when you end the "manage overlays" dialog.

It takes roughly 2 .. 2.5 sec on my machine with some custom overlays.

User avatar
jay
RPTools Team
Posts: 1767
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx

Re: Working on tokenTool

Post by jay »

Azhrei wrote:@Jay: Thanks for the hint. If I get time I'll take a look at it. That's something that could be deferred to a separate thread as long as the first one is loaded synchronously (so it appears correctly in the dropdown list).

Hm, what happens if the data model for the dropdown list were to use file: URLs? Then Swing would ask for the images and they could be loaded as-needed. In the meantime a separate thread could be loading them. If the ImageIO cache were turned on that should work out...
I updated TokenTool to load this code in the background. It's checked in if you would like to try it. It was written to rplib b87, so that is where some of those changes came from. The code needs some better error handling, but otherwise should be OK. Not sure how much faster it got :? You need to have rplib checked out since I made the TT project rely on it instead of the checked in lib.

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

Re: Working on tokenTool

Post by Azhrei »

jay wrote:I updated TokenTool to load this code in the background. It's checked in if you would like to try it. It was written to rplib b87, so that is where some of those changes came from.
Okay, cool. Thanks, jay. :)

@CiF: You'll probably need to generate a new patch for me. Since Jay has checked in updated code your patch (which changes a lot of files) likely won't apply cleanly (although I haven't tried, to be honest :(). When you generate the patch, you can uncheck all of the class files that you didn't modify to make your change. Then generate the patch. Now you can resynchronize from SVN and apply your newly created patch back to that project. Resynchronizing with SVN will give you exactly the same setup as what I'm going to have, so if your patch reapplies and works then I know it will with mine too. :)
The code needs some better error handling, but otherwise should be OK. Not sure how much faster it got :? You need to have rplib checked out since I made the TT project rely on it instead of the checked in lib.
Hm. I think it was more than just 2 seconds (like about 5-6) but it could have something to do with it being a Web Start app. I don't start timing it until the icon shows up in the Mac's docking bar though, which means the check for newer network resources has already been accomplished. I'm obviously going to need to profile it, I think.

Thanks again, Jay. I'll take a look tomorrow as today is going to be pretty busy.

User avatar
jay
RPTools Team
Posts: 1767
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx

Re: Working on tokenTool

Post by jay »

I only checked in 3, so it shouldn't be too bad (OverlayListModel, OverlayPanelModel & TokenCompositionPanel) You also now need to checkout the latest rplib into Eclipse, I made the TT project rely on it.

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Working on tokenTool

Post by CoveredInFish »

Azhrei wrote:You'll probably need to generate a new patch for me.
No problem, I'll do that. Not sure I find time to do so on sunday ..

Post Reply

Return to “TokenTool”