Show
Ignore:
Timestamp:
07.01.2009 14:11:49 (11 months ago)
Author:
rpascanu
Message:

Changes to GUI to use common datatypes in Interfaces

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/GUI/GraphDisplay.hs

    r11173 r11229  
    4444import Control.Concurrent.MVar 
    4545 
     46import Interfaces.DataTypes 
     47 
    4648initializeConverter :: IO (GInfo,HTk.HTk) 
    4749initializeConverter = do 
     
    5456    graphInfo it is contained in and the conversion maps. -} 
    5557convertGraph :: ConvFunc 
    56 convertGraph gInfo@(GInfo { libEnvIORef = ioRefProofStatus 
    57                           , gi_GraphInfo = actGraphInfo 
    58                           , gi_LIB_NAME = libname 
     58convertGraph gInfo@(GInfo { gi_GraphInfo = actGraphInfo 
    5959                          , windowCount = wc 
    6060                          }) title showLib = do 
    61   libEnv <- readIORef ioRefProofStatus 
    62   case Map.lookup libname libEnv of 
     61 ost <- readIORef $ intState gInfo 
     62 case i_state ost of  
     63  Nothing -> error "Something went wrong, no library loaded" 
     64  Just ist -> do 
     65   let libEnv = i_libEnv ist 
     66       libname = i_ln ist 
     67   case Map.lookup libname libEnv of 
    6368    Just dgraph -> do 
    6469      case openlock dgraph of 
     
    8792        Nothing -> do 
    8893          lock <- newEmptyMVar 
    89           writeIORef ioRefProofStatus 
    90             $ Map.insert libname dgraph{openlock = Just lock} libEnv 
     94          let nwle = Map.insert libname dgraph{openlock = Just lock} libEnv 
     95              nwst = ost { i_state = Just $ ist { i_libEnv = nwle}} 
     96          writeIORef (intState gInfo) nwst 
    9197          convertGraph gInfo title showLib 
    9298    Nothing -> error $ "development graph with libname " ++ show libname 
     
    96102-- return type equals the one of convertGraph 
    97103initializeGraph :: GInfo -> String -> LibFunc -> IO () 
    98 initializeGraph gInfo@(GInfo { gi_LIB_NAME = ln }) title showLib = do 
    99   let title' = (title ++ " for " ++ show ln) 
    100   createGraph gInfo title' (convertGraph) (showLib) 
     104initializeGraph gInfo title showLib = do 
     105 ost <- readIORef $ intState gInfo 
     106 case i_state ost of  
     107  Nothing -> return () 
     108  Just ist -> do 
     109   let ln = i_ln ist 
     110       title' = (title ++ " for " ++ show ln) 
     111   createGraph gInfo title' (convertGraph) (showLib)