I was working on one of my codea projects (completely unrelated to this one) on Friday and found myself wanting to do some tab reordering and suddenly found myself diverted onto a massive tangent after remembering that AutoGist by @Briarfox saves your tab order to GitHub.
So here’s the result a very mini plugin system for AutoGist and ReorderTabs a full ui based multi-tab reordering plugin. Before I talk a little bit about it I’ll be upfront and say this first:
Before using on any project make sure you backup your project with AutoGist or annother form of backup first!
This is because if you are saving back to the same project, the project must be cleared to guarentee the correct tab order when the new tab order is saved!
- Reorder/shift single tabs or groups of tabs up and down your projects tab order!
- Save back to the same project.
- Save back to a blank project leaving your original project untouched
- Progress feedback when project save is in progress! (So its slightly less boring waiting for a large project to save :) )
How it works
There’s three components core to this mod, firstly the wonderful AutoGist by @Briarfox, used to get project information (why reinvent the wheel when AutoGist is so good at this ), a tiny mod to the main file for AutoGist to create the mod manager and forward Codeas draw, touched and orientationChanged calls and add a Plugins button to AutoGists UI.
function setup() autoGist = AutoGist("AutoGist","AutoGist your Codea projects!",VERSION)--Do not edit this one -- create plugin manager and add ReorderTabs Plugin autoPlugins=createAutoPlugins() autoPlugins.plugins[ReorderTabs.name] = ReorderTabs(autoGist) --Below used in AutoGist UI only ---------------------------- authParams() end function createAutoPlugins() -- omitted see source end -- forward draw and touched to plugin manager function draw() autoPlugins:draw() end function touched(touch) autoPlugins:touched(touch) end function orientationChanged(new) if autoPlugins ~= nil then autoPlugins:orientationChanged(new) end end function authParams() if autoGist.agData.authtoken ~=nil then -- omitted params -- add plugins button parameter.action("Plugins",function() autoPlugins:setup() end) else -- omitted params end end
Then finally the ReorderTabs plugin itself which is essentially a decorator for AutoGist. Excluding the Main file no AutoGist code is modified.
ReorderTabs uses the tab order file and project files which it gets via AutoGist and then allows the user to reorganise them and then Save them back in the set order to the same project or a blank project.
Im going to release this as self cotained demo bundled with AutoGist 2.14 because ultimately its up to @Briarfox, who i hope doesnt mind :), whether this makes it into AutoGist :).
How to use
- Backup your project if you are saving back to the same project or create a new project
- Open AutoGist ReorderTabs
- Tap Plugins button followed by Reorder Project Tabs button
- Enter Codea project Name and tap Load button
- Double tap tab names to select and deselect
- With some tabs selected tap Move Up or Move Down buttons
- When you have your order set optionally enter a blank project name to save into and click Save
- Always Wait for saving to complete before closing! (There will be a progress bar and output messages)
Source Code and AutoInstall
ReorderTabs Auto Install (Including AutoGist 2.14):
ReorderTabs Source (Including AutoGist 2.14):
Edit: Fixed scroll bug removed the following line of code :
if (height of tabs + project header) < HEIGHT then doScrollAndBeDodgyJumpyAndUnusable() end