-- | Creates the graph. Runs makegraph
createGraph :: GInfo -> String -> ConvFunc -> LibFunc -> IO ()
createGraph gi title convGraph showLib = do
  ost <- readIORef $ intState gi
  case i_state ost of
    Nothing -> return ()
    Just _ -> do
      let ln = libName gi
          opts = options gi
          file = libNameToFile ln ++ prfSuffix
      deselectEdgeTypes <- newIORef []
      globMenu <- createGlobalMenu gi showLib deselectEdgeTypes
      GA.makeGraph (graphInfo gi)
                   title
                   (createOpen gi file convGraph showLib)
                   (createSave gi file)
                   (createSaveAs gi file)
                   (createClose gi)
                   (Just (exitGInfo gi))
                   globMenu
                   (createNodeTypes gi convGraph showLib)
                   (createEdgeTypes gi)
                   (getColor (hetcatsOpts gi) Purple False False)
                   $ runAndLock gi $ do
                       flags <- readIORef opts
                       writeIORef opts $ flags { flagHideNodes = False}
                       updateGraph gi []

-- | Returns the open-function
createGraph :: GInfo -> String -> ConvFunc -> LibFunc -> IO ()
createGraph gi title convGraph showLib = do
  ost <- readIORef $ intState gi
  case i_state ost of
    Nothing -> return ()
    Just _ -> do
      let ln = libName gi
          opts = options gi
          file = libNameToFile ln ++ prfSuffix
      deselectEdgeTypes <- newIORef []
      globMenu <- createGlobalMenu gi showLib deselectEdgeTypes
      GA.makeGraph (graphInfo gi)
                   title
                   (createOpen gi file convGraph showLib)
                   (createSave gi file)
                   (createSaveAs gi file)
                   (createClose gi)
                   (Just (exitGInfo gi))
                   globMenu
                   (createNodeTypes gi convGraph showLib)
                   (createEdgeTypes gi)
                   (getColor (hetcatsOpts gi) Purple False False)
                   $ runAndLock gi $ do
                       flags <- readIORef opts
                       writeIORef opts $ flags { flagHideNodes = False}
                       updateGraph gi []

-- | Returns the open-function
createGraph gi title convGraph showLib = do
  ost <- readIORef $ intState gi
  case i_state ost of
    Nothing -> return ()
    Just _ -> do
      let ln = libName gi
          opts = options gi
          file = libNameToFile ln ++ prfSuffix
      deselectEdgeTypes <- newIORef []
      globMenu <- createGlobalMenu gi showLib deselectEdgeTypes
      GA.makeGraph (graphInfo gi)
                   title
                   (createOpen gi file convGraph showLib)
                   (createSave gi file)
                   (createSaveAs gi file)
                   (createClose gi)
                   (Just (exitGInfo gi))
                   globMenu
                   (createNodeTypes gi convGraph showLib)
                   (createEdgeTypes gi)
                   (getColor (hetcatsOpts gi) Purple False False)
                   $ runAndLock gi $ do
                       flags <- readIORef opts
                       writeIORef opts $ flags { flagHideNodes = False}
                       updateGraph gi []

-- | Returns the open-function