Reorder your entire project! with RedorderTabs a multi-tab reordering plugin for AutoGist!

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!

Features

  • 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 :slight_smile: ), 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


  1. Backup your project if you are saving back to the same project or create a new project
  2. Open AutoGist ReorderTabs
  3. Tap Plugins button followed by Reorder Project Tabs button
  4. Enter Codea project Name and tap Load button
  5. Double tap tab names to select and deselect
  6. With some tabs selected tap Move Up or Move Down buttons
  7. When you have your order set optionally enter a blank project name to save into and click Save
  8. 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):

http://gist.github.com/XanDDemoX/5846363

ReorderTabs Source (Including AutoGist 2.14):

http://gist.github.com/XanDDemoX/5846359

Edit: Fixed scroll bug removed the following line of code :wink: :

if (height of tabs + project header) < HEIGHT then
    doScrollAndBeDodgyJumpyAndUnusable()
end

@XanDDemoX very cool plugin setup, impressive! I’m going to tinker around with it a bit and I’ll get back to you with my impressions!

Thanks @Briarfox. I’m looking forward to it :slight_smile: