<NME> lib.js
<BEF> @import 'actions/view-inventory.cocoascript'
@import 'actions/statistics-inventory.cocoascript'
@import 'actions/demo-inventory.cocoascript'
@import 'run-actions.cocoascript'


function ToolbarInventory (panel) {
    this.panel = panel
    this.images = ViewInventory.returnButtonsImages()
    this.contentViewEmpty = ViewInventory.createEmptyPanel()


    var importViews = ViewInventory.createImportPanel()
    this.contentViewImport = importViews[0]
    this.pathLabel = importViews[1]
    this.selectionLabel = importViews[2]
    this.layersButton = importViews[3]
    this.statesButton = importViews[4]
    this.relativeButton = importViews[5]
    this.deviceAccessory = importViews[6]
function ToolbarInventory (panel) {
    this.panel = panel
    this.images = ViewInventory.returnButtonsImages()
    // content views to help
    var views = ViewInventory.createImportPanel()
    this.contentViewImport = views[0]
    this.pathLabel = views[1]
    this.selectionLabel = views[2]
    this.layersButton = views[3]
    this.statesButton = views[4]
    this.relativeDropdown = views[5]


    this.contentViewEmpty = ViewInventory.createEmptyPanel()

    this.contentViewScene = ViewInventory.createScenePanel()[0]

}

}


ToolbarInventory.setContentView = function() {
    var toolbar = ToolbarInventory.returnInstance()
    if (toolbar != nil) {
      var panel = toolbar.panel
      if (userDefaults.exportFramerFolder == "") {
        var view = toolbar.contentViewEmpty
        [panel setContentView:view]
      }
      else {
        if (panel.contentView() == toolbar.contentViewScene) {
          var view = toolbar.contentViewScene
          [panel setContentView:view]
        }
        else {
          var view = toolbar.contentViewImport
          [panel setContentView:view]
          SelectionInventory.asyncSelectionHandler(false)
        }
        ToolbarInventory.updateAccessoryControls();
      }
      ToolbarInventory.updatePathLabelStringValue()
    }
}

ToolbarInventory.changeContentView = function() {
    if (userDefaults.exportFramerFolder == "") { return }

    var toolbar = ToolbarInventory.returnInstance()
    if (toolbar != nil) {
      var panel = toolbar.panel

      if (panel.contentView() == toolbar.contentViewScene) {
        var view = toolbar.contentViewImport
        [panel setContentView:view]
      }
      else {
        var view = toolbar.contentViewScene
        [panel setContentView:view]
      }
      SelectionInventory.asyncSelectionHandler(false)
    }
}


ToolbarInventory.toolbarMode = function() {
      var toolbar = ToolbarInventory.returnInstance()
      if (toolbar != nil) {
          var panel = toolbar.panel
          if (panel.contentView() == toolbar.contentViewScene) { return Status.toolbarModeScene() }
          else if (panel.contentView() == toolbar.contentViewImport) { return Status.toolbarModeImport() }
          else { return Status.toolbarModeEmpty() }
      }
}


ToolbarInventory.removeInstance = function() {
    var threadIdentifier = "com.tilllur.framer-inventory"
    var threadDictionary = NSThread.mainThread().threadDictionary()
    threadDictionary.removeObjectForKey(threadIdentifier);
}

ToolbarInventory.returnInstance = function() {
    var threadIdentifier = "com.tilllur.framer-inventory"
    var threadDictionary = NSThread.mainThread().threadDictionary()
    return threadDictionary[threadIdentifier]
}

ToolbarInventory.updateClassInstance = function(toolbar) {
    if (toolbar != nil) { log(toolbar.returnPanel()) }
    var threadIdentifier = "com.tilllur.framer-inventory"
    var threadDictionary = NSThread.mainThread().threadDictionary()
    threadDictionary[threadIdentifier] = toolbar
}

// ToolbarInventory.setPathLabel = function(label) {
ToolbarInventory.updatePathLabelStringValue = function() {
  var toolbar = ToolbarInventory.returnInstance()
  if (toolbar != nil) {
    var localLabel = toolbar.pathLabel
    var localValue = ViewInventory.optimiseFramerPath()
    [localLabel setStringValue:localValue]
  }
}

ToolbarInventory.updateImportButtons = function(adoptID) {
  var toolbar = ToolbarInventory.returnInstance()
  if (toolbar != nil) {
ToolbarInventory.updatePathLabelStringValue = function() {
  var toolbar = ToolbarInventory.returnInstance()
  if (toolbar != nil) {
    var localValue = PathInventory.returnProjectNameFromPath(userDefaults.exportFramerFolder)

    var localLabel = toolbar.pathLabel
    [localLabel setStringValue:localValue]

    var localLabelScene = toolbar.pathLabelScene
    [localLabelScene setStringValue:localValue]
  }
}


ToolbarInventory.updateAccessoryControls = function() {
  var toolbar = ToolbarInventory.returnInstance()
  if (toolbar != nil) {
      ViewInventory.updateRelativeButton(toolbar.relativeButton, toolbar.images)

      var localDeviceDropdown = toolbar.deviceAccessory
      localDeviceDropdown.selectItemAtIndex(ScaleInventory.deviceToSelect(userDefaults.myDevice))

      var localDeviceSceneDropdown = toolbar.deviceAccessoryScene
      localDeviceSceneDropdown.selectItemAtIndex(ScaleInventory.deviceToSelect(userDefaults.myDevice))

  }
}


ToolbarInventory.updateImportButtons = function(adoptID) {
  var toolbar = ToolbarInventory.returnInstance()
  if (toolbar != nil) {
      if (adoptID == 0) { ViewInventory.adoptButtonsNone(toolbar.layersButton, toolbar.statesButton, toolbar.images) }
      else if (adoptID == 1) { ViewInventory.adaptButtonsBase(toolbar.layersButton, toolbar.statesButton, toolbar.images) }
      else if (adoptID == 3) { ViewInventory.adaptButtonsSeveral(toolbar.layersButton, toolbar.statesButton, toolbar.images) }
      else if (adoptID == 2) { ViewInventory.adaptButtonsSelected(toolbar.layersButton, toolbar.statesButton, toolbar.images) }
      else if (adoptID == 4) { ViewInventory.adaptButtonsSelectedSeveral(toolbar.layersButton, toolbar.statesButton, toolbar.images) }

      if (adoptID == 0) {
        ViewInventory.adoptMoreNone(toolbar.moreButtonImage, toolbar.moreButton)
        ViewInventory.adoptEmptySelection(toolbar.emptySelectionView)
      }
      else {
        ViewInventory.adoptMore(toolbar.moreButtonImage, toolbar.moreButton)
        ViewInventory.adoptEmptySelectionNone(toolbar.emptySelectionView)
      }

      if (adoptID == 7) {
        ViewInventory.adoptMoreNone(toolbar.moreButtonImage, toolbar.moreButton)
        ViewInventory.adoptEmptySelectionNone(toolbar.emptySelectionView)
        UIBar.makeKeyAndOrderFront(nil)
    }
}



ToolbarInventory.updateAccessoryControls = function() {
    // if (relativeAccessory != nil) {
    //     relativeAccessory.selectItemAtIndex(userDefaults.myRelativeGroup)
    // }
    // if (densityAccessory != nil) {
    //     densityAccessory.selectItemAtIndex(userDefaults.myRetinaEnabled)
    // }
    // if (deviceAccessory != nil) {
    //     deviceAccessory.selectItemAtIndex(ScaleInventory.deviceToSelect(userDefaults.myDevice))
    // }
}
      else {
        ViewInventory.adoptExpiredSelectionNone(toolbar.expiredSelectionView)
      }
  }
}

ToolbarInventory.updateSceneButtons = function(adoptID) {
    var toolbar = ToolbarInventory.returnInstance()
    if (toolbar != nil) {
        if (adoptID == 5) { ViewInventory.adoptSceneButtons(toolbar.sceneButton, toolbar.images) }
        else if (adoptID == 6) { ViewInventory.adoptSceneButtonsSelected(toolbar.sceneButton, toolbar.images) }

        if (adoptID == 7) {
          // log("adoptation")
          ViewInventory.adoptExpiredScene(toolbar.expiredSceneView)
          ToolbarInventory.updateSceneLabelStringValue("")
        }
        else {
          ViewInventory.adoptExpiredSceneNone(toolbar.expiredSceneView)
          ToolbarInventory.updateSceneLabelStringValue(ViewInventory.placeHolderScene())
        }
    }
}


ToolbarInventory.updateContext = function() {
    methodStartTime = [NSDate date]
    if (NSDocumentController.sharedDocumentController() != nil && NSDocumentController.sharedDocumentController().currentDocument() != nil) {
      currentDocument = NSDocumentController.sharedDocumentController().currentDocument();
      currentSelection = NSDocumentController.sharedDocumentController().currentDocument().selectedLayers().layers();
      scaleInstance = new ScaleInventory()
    }
}









ToolbarInventory.createUIBar = function() {

    StatisticsInventory.setStatus(Status.waitingID())

    coscript.setShouldKeepAround(true);
    var toolbar = ToolbarInventory.returnInstance()

    if(!toolbar){

        var UIBar = NSPanel.alloc().init();
        UIBar.setStyleMask(NSTitledWindowMask + NSFullSizeContentViewWindowMask);
        UIBar.setBackgroundColor(ViewInventory.colorWindow())
        UIBar.setTitleVisibility(NSWindowTitleHidden);
        UIBar.setTitlebarAppearsTransparent(true);
        UIBar.setFrame_display(NSMakeRect(0, 0, ViewInventory.sizeWindowWidth(), ViewInventory.sizeWindowHeight()), false);
        UIBar.setMovableByWindowBackground(true);
        UIBar.setHasShadow(true);
        UIBar.setLevel(NSFloatingWindowLevel);


        toolbar = new ToolbarInventory(UIBar);
        ToolbarInventory.updateClassInstance(toolbar)
        ToolbarInventory.setContentView()

        UIBar.center()
        UIBar.makeKeyAndOrderFront(nil)

        ViewInventory.adoptButtonsNone(toolbar.layersButton, toolbar.statesButton, toolbar.images)
        SelectionInventory.asyncSelectionHandler(false)
    }
}

<MSG> Linked path label & relative dropdown

– Now we show actual path in both modes (import & scene)
– We sync relative dropdown after settings were changed

<DFF> @@ -21,19 +21,21 @@ var measureRoundButtonsBottom = measureWindowHeight - 6 * 3
 function ToolbarInventory (panel) {
     this.panel = panel
     this.images = ViewInventory.returnButtonsImages()
-    // content views to help
-    var views = ViewInventory.createImportPanel()
-    this.contentViewImport = views[0]
-    this.pathLabel = views[1]
-    this.selectionLabel = views[2]
-    this.layersButton = views[3]
-    this.statesButton = views[4]
-    this.relativeDropdown = views[5]
+    this.contentViewEmpty = ViewInventory.createEmptyPanel()
 
 
-    this.contentViewEmpty = ViewInventory.createEmptyPanel()
+    var importViews = ViewInventory.createImportPanel()
+    this.contentViewImport = importViews[0]
+    this.pathLabel = importViews[1]
+    this.selectionLabel = importViews[2]
+    this.layersButton = importViews[3]
+    this.statesButton = importViews[4]
+    this.relativeAccessory = importViews[5]
+
 
-    this.contentViewScene = ViewInventory.createScenePanel()[0]
+    var sceneView = ViewInventory.createScenePanel()
+    this.contentViewScene = sceneView[0]
+    this.pathLabelScene = sceneView[1]
 
 }
 
@@ -118,12 +120,26 @@ ToolbarInventory.updateSelectionLabelStringValue = function(value) {
 ToolbarInventory.updatePathLabelStringValue = function() {
   var toolbar = ToolbarInventory.returnInstance()
   if (toolbar != nil) {
-    var localLabel = toolbar.pathLabel
     var localValue = ViewInventory.optimiseFramerPath()
+
+    var localLabel = toolbar.pathLabel
     [localLabel setStringValue:localValue]
+
+    var localLabelScene = toolbar.pathLabelScene
+    [localLabelScene setStringValue:localValue]
+  }
+}
+
+
+ToolbarInventory.updateAccessoryControls = function() {
+  var toolbar = ToolbarInventory.returnInstance()
+  if (toolbar != nil) {
+      var localRelativeDropdown = toolbar.relativeAccessory
+      localRelativeDropdown.selectItemAtIndex(userDefaults.myRelativeGroup)
   }
 }
 
+
 ToolbarInventory.updateImportButtons = function(adoptID) {
   var toolbar = ToolbarInventory.returnInstance()
   if (toolbar != nil) {
@@ -180,17 +196,3 @@ ToolbarInventory.createUIBar = function() {
         UIBar.makeKeyAndOrderFront(nil)
     }
 }
-
-
-
-ToolbarInventory.updateAccessoryControls = function() {
-    // if (relativeAccessory != nil) {
-    //     relativeAccessory.selectItemAtIndex(userDefaults.myRelativeGroup)
-    // }
-    // if (densityAccessory != nil) {
-    //     densityAccessory.selectItemAtIndex(userDefaults.myRetinaEnabled)
-    // }
-    // if (deviceAccessory != nil) {
-    //     deviceAccessory.selectItemAtIndex(ScaleInventory.deviceToSelect(userDefaults.myDevice))
-    // }
-}

Linked path label & relative dropdown