Request a new command, feature, or improvement
Moderator: MSandro
-
Calloway
- Posts: 100
- Joined: Apr 30th, '18, 00:28
- Location: Eastern United States
Post
by Calloway » May 19th, '18, 21:53
I don't know seems to organize things in categories of similarity, any thoughts?
Code for ProjectEditor.gp:
Code: Select all
method addTopBarParts ProjectEditor {
scale = (global 'scale')
page = (global 'page')
space = (15 * scale)
title = (newText '' 'Arial Bold' (14 * scale))
addPart morph (morph title)
connectorLabel = (newText 'Show arrows:' 'Arial' (11 * scale))
connectorToggle = (toggleButton
(action 'toggleConnectors' page) (action 'isShowingConnectors' page)
(scale * 20) (scale * 13) (scale * 5) (max 1 (scale / 2)) false)
addPart morph (morph connectorLabel)
addPart morph (morph connectorToggle)
stealthSlider = (slider 'horizontal' (* scale 50) (action 'setBlocksStealthLevel' this) nil -50 110 (global 'stealthLevel'))
addPart morph (morph stealthSlider)
leftItems = (list)
add leftItems (textButton this 'New' 'newProject')
add leftItems (textButton this 'Open' 'openProjectMenu')
add leftItems (textButton this 'Save' 'saveProject')
rightItems = (list)
if (not (isOneOf (platform) 'Browser' 'iOS')) {
add rightItems (textButton this 'Export as App' 'exportProjectAsApp')
add rightItems (textButton this 'Export to Web' 'exportProjectToWeb')
}
add rightItems space
add rightItems (textButton this 'Go' (action 'broadcastGo' page))
add rightItems (textButton this 'Stop' (action 'stopAll' page))
add rightItems (textButton this 'Present' 'enterPresentation')
leftItemsRow2 = (list)
rightItemsRow2 = (list)
add rightItemsRow2 connectorLabel
add rightItemsRow2 connectorToggle
add rightItemsRow2 (clickLabel this 'Blocks' 'slideToBlocks')
add rightItemsRow2 stealthSlider
add rightItemsRow2 (clickLabel this 'Text' 'slideToText')
add rightItemsRow2 space
add rightItemsRow2 (addFPSReadout this)
}
-
MSandro
- Posts: 162
- Joined: Jul 26th, '17, 21:12
Post
by MSandro » May 20th, '18, 08:13
"organize things in categories", maybe you could use menus
Code ProjectEdtor:
Code: Select all
method openSettings ProjectEditor {
menu = (menu 'GP Settings' (global 'page'))
addItem menu 'stage ratio' 'confStageRatio'
addItem menu 'stage resolution'
addItem menu 'keyboard hotfix'
addItem menu 'defaults'
addLine menu
addItem menu 'Help' 'showSettingsHelp'
popUp menu (global 'page') 150 -50 1
}
...
-
Calloway
- Posts: 100
- Joined: Apr 30th, '18, 00:28
- Location: Eastern United States
Post
by Calloway » May 20th, '18, 13:59
Oo you're right that's a lot better
Do you know how (or if it's possible) to change the top bar colour?
-
MSandro
- Posts: 162
- Joined: Jul 26th, '17, 21:12
Post
by MSandro » May 20th, '18, 14:55
In the ProjectEditor you should find a "drawTopBar" method. If I remember correctly you should be able to set the background color there.
-
Calloway
- Posts: 100
- Joined: Apr 30th, '18, 00:28
- Location: Eastern United States
Post
by Calloway » May 20th, '18, 15:22
Oo thank you, wouldn't have ever found it without that.
Would you think it'd be good for GP to have an INI or TXT file for themeing or styling the editor (or the sidebars if the project's in presentation mode/exported)?
-
MSandro
- Posts: 162
- Joined: Jul 26th, '17, 21:12
Post
by MSandro » May 20th, '18, 15:27
Yes I think this would be grate. I've already thought to add styling functionalities to my settings menu. I would suggest you to use json files because GP already has a json en/decoder.
-
Calloway
- Posts: 100
- Joined: Apr 30th, '18, 00:28
- Location: Eastern United States
Post
by Calloway » May 20th, '18, 15:35
I'm still trying to piece together the different parts of the lib together and figure out the code, but do you think it would be possible by setting some global variables from a file at startup time and then have those variables act as the 'color R G B' and 'gray 'Amount'' (maybe just take out gray in general and use purely color for more customization)
I don't really know if this would be possible but maybe through tinkering we could figure something out, you seem far more ahead though hehe
-
MSandro
- Posts: 162
- Joined: Jul 26th, '17, 21:12
Post
by MSandro » May 20th, '18, 15:39
For my settings I proceed as follows:
> in the startup.gp class I call a methode "applySettings"
> The method reads my "settings.json"
> seperate the values using "jsonParse"
> finaly it saves those values into global variables
-
Calloway
- Posts: 100
- Joined: Apr 30th, '18, 00:28
- Location: Eastern United States
Post
by Calloway » May 20th, '18, 15:43
That sounds good, and GP already has a JSON decoder/encoder doesn't it?
-
MSandro
- Posts: 162
- Joined: Jul 26th, '17, 21:12
Post
by MSandro » May 20th, '18, 15:46
yes, it is available under the category network, but only in developer mode