MobileSheets Forums
SQLite and SmartButtons - Printable Version

+- MobileSheets Forums (https://www.zubersoft.com/mobilesheets/forum)
+-- Forum: General Discussion (https://www.zubersoft.com/mobilesheets/forum/forum-7.html)
+--- Forum: MobileSheets (Android) Discussion (https://www.zubersoft.com/mobilesheets/forum/forum-22.html)
+--- Thread: SQLite and SmartButtons (/thread-13409.html)



SQLite and SmartButtons - jtoon86 - 05-28-2025

I'm a pianist and have two copies of music (instrumental and choral) for a particular collection (800+ songs). I wrote a small Python script to create SmartButtons between the two songs so I can quickly switch between them (ie in a rehearsal scenario, need to quickly pull up the choral version so I can play a part for the singers).

I was able to link the files, insert the fields into the table and cloud sync it back to my tablet, but noticed some songs didn't have the buttons showing and when I sync'd back, it looked like quite a few of the table entries were missing (??).

I'm guessing I might have been placing the button outside of the crop area (?) or similar? Not really sure. 

Is there a way to know what I should enter for the XPos/YPos/ZoomX/ZoomY values (I'm guessing these have something to do with how the page is cropped?). Right now I was using some static values (150, 150, 2.5 and 2.5) and this does work on some of the songs, but doesn't seem to hold for all songs.

I also noticed that old setting seem to persist on the tablet --- was curious if the "Version" field needed to be incremented to indicate a revised row version? 

Is there any available database documentation that outlines how to correctly enter information into these fields? 

Joe


RE: SQLite and SmartButtons - Zubersoft - 05-29-2025

It's not documented as it's not really something that most users would need to mess with (and the database can constantly change, and I don't want another form of documentation that I need to maintain). The zoom values are the amount the file was scaled up or down to fit the screen in each dimension when the button was created. You would need to figure that value out (or estimate it). MobileSheets determines the delta between the current zoom level for the file and what was saved to figure out how to scale the button rendering. That delta is applied to scale the button up or down as needed.

The x and y values are the center point of the button on the screen in scaled coordinates (meaning whatever the coordinates were on the image in the scaled dimensions). So if the button was in the center of a 1200x1600 page, the original file was 600x800 (meaning it was scaled up by a factor of 2), the zoomX and zoomY would be 2.0 and the x and y would be 600 and 800 respectively. You could also just set the zoom factor to 1.0 and use the raw file coordinates for the button placement, and MobileSheets will then just scale the button up. In the past, the scaling was just applied to the canvas, which resulted in a less crisp rendering quality. Later on, the rendering code was modified to change the font size and rounded rect dimensions based on the scaling factor to maintain the better quality, so in theory, the code could be changed to store values in terms of the raw page size with zoomX and zoomY of 1. However, there is no raw page size with text or ChordPro files, which is why it was originally implemented the way it was.

Mike


RE: SQLite and SmartButtons - jtoon86 - 05-30-2025

Hi Mike,

Thanks for the info. This will help me dial in the settings a bit tighter. Thanks for making such a great app! 

Joe


RE: SQLite and SmartButtons - Zubersoft - 05-30-2025

You are welcome - happy to help!

Mike