PDA

View Full Version : Question about editing the Sidebar Frame (aka desktop_shortcut)



Wookiee420
June 12th, 2017, 20:19
Hey folks, i am working on my extension still, and i am running into an issue, no matter what properties i put in here, it doesnt change anything

<framedef name="shortcuts"> -->
<!-- <bitmap file="graphics/frames/desktop_sidebar.png" /> -->
<!-- <middle rect="0,0,400,512" /> -->
<!-- </framedef>

if i put the other lines in it will 9slice it, which is too much for this, i just want to make it wider

Trenloe
June 12th, 2017, 20:30
We'll, for a start most of that framedef is commented out! So, if that's the case in your extension/ruleset, FG won't read it.

Secondly, the framedef itself doesn't determine the width of the final control frame, just how the frame will be built.

Look for the shortcuts framedef being used in a <frame> statement. It's here where the initial width will be set, but then the width will be further set based off the number of shortcuts and the height of the FG desktop window.

Wookiee420
June 12th, 2017, 20:56
yeah the comment out was to see a comparison with the "stock" image, i forgot to remove it when i posted it here...ok so where is that frame located? do you know off hand?

Wookiee420
June 12th, 2017, 21:08
so now this is what i have and the results, if i could pester you for the proper <frame> location i can probably figure it out...the commented out makes it so that it still shows the "torn edge" on when less shortcuts used...with it that left edge is a flat line

<framedef name="shortcuts">
<bitmap file="graphics/frames/desktop_sidebar.png" />
<middle rect="0,0,400,800" />
<!-- <offset>0,0,200,0</offset> -->
</framedef>
19338

Trenloe
June 12th, 2017, 21:48
Do "Find in Files" in the rulesets (I'm assuming SavageWorlds and CoreRPG?) for <frame>shortcuts</frame> You'll find it in CoreRPG desktop\desktop_common.xml

This is in the shortcutbar windowclass:

<windowclass name="shortcutbar">
<frame>shortcuts</frame>
<sheetdata />
</windowclass>

This is then used within the shortcuts windowclass:

<windowclass name="shortcuts">
<script>
function onInit()
DesktopManager.registerContainerWindow(self);
end
</script>
<sheetdata>
<subwindow name="shortcutbar">
<anchored position="insideright" width="100" />
<class>shortcutbar</class>
<activate />
<fastinit />
</subwindow>
</sheetdata>
</windowclass>

This has a default width of 100 - but this is overridden in scripts\manager_desktop.lua in the updateControls() function, which is the result of some previous complex mathematics to calculate a number of desktop areas:

m_wShortcuts.shortcutbar.setAnchoredWidth(szBar.w) ;

But, I'm not sure what you're trying to do? As I mentioned, the <framedef> does not control the size of the end control - the actual control the framedef is used in (where the <frame> tag is) will control the size of the control, and what you specify in <framedef> will define the 9 different components that will be used to dynamically build up the frame (based off the size of the control).

You mention torn edges, etc.. What are you trying to accomplish?

Wookiee420
June 13th, 2017, 02:49
this is what i was going for
19342
see how you can now see the "torn edge" of the paper underneath?
it was in the desktop_classes.lua if i remember correctly

Trenloe
June 13th, 2017, 03:13
The offsets for the "stack" (the are that the buttons can be placed within right hand ribbon when the campaign buttons are) is stored in scripts\manager_desktop.lua in the m_rcStackOffset LUA table.

You can adjust this using DesktopManager.setStackOffset(l, t, r, b) from your own code. The default is (6, 2, 4, 0) - with the first number being the left offset.

So you could use the following to offset 50 pixels more than usual from the left edge of the sidebar graphic:

DesktopManager.setStackOffset(56, 2, 4, 0)

You might want to play around with the left offset number to fit your graphic nicely.