Changeset 12783
- Timestamp:
- 05.11.2009 16:19:05 (2 weeks ago)
- Location:
- trunk/GUI
- Files:
-
- 5 modified
-
GraphTypes.hs (modified) (1 diff)
-
GtkGenericATP.hs (modified) (5 diffs)
-
GtkProverGUI.hs (modified) (4 diffs)
-
HTkProverGUI.hs (modified) (2 diffs)
-
HTkUtils.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/GUI/GraphTypes.hs
r12755 r12783 26 26 27 27 import GUI.GraphAbstraction(GraphInfo, initGraph) 28 import GUI.HTk ProverGUI(GUIMVar)28 import GUI.HTkUtils (GUIMVar) 29 29 import GUI.UDGUtils 30 30 -
trunk/GUI/GtkGenericATP.hs
r12779 r12783 22 22 import Interfaces.GenericATPState 23 23 24 import Control.Concurrent (forkIO, killThread, myThreadId)24 import Control.Concurrent (forkIO, killThread, yield) 25 25 import Control.Concurrent.MVar 26 import Control.Monad (unless, when) 26 27 27 28 import Common.AS_Annotation as AS_Anno … … 95 96 96 97 stateMVar <- newMVar initState 97 t id' <- myThreadId98 threadId <- newMVar tid'98 threadId <- newEmptyMVar 99 finished <- newEmptyMVar 99 100 100 101 -- setting up lists … … 176 177 -- show details of selected goal 177 178 onClicked btnStop $ do 178 tryTakeMVar threadId >>= maybe (return ()) killThread179 putMVar threadId tid'179 tryTakeMVar threadId >>= maybe (error "MVar 'tId' not set") killThread 180 putMVar finished () 180 181 181 182 -- show details of selected goal … … 227 228 $ map AS_Anno.senAttr $ goalsList s 228 229 opts = words opts' 229 afterEachProofAttempt = (\ gPSF nSen nextSen cfg@(retval,_) -> do230 afterEachProofAttempt = \ gPSF nSen nextSen cfg@(retval,_) -> do 230 231 cont <- goalProcessed stateMVar timeout opts numGoals prName 231 232 gPSF nSen False cfg … … 233 234 ATPError m -> errorDialog "Error" m 234 235 _ -> return () 235 postGUIAsync $ do 236 let progress = fromIntegral gPSF / fromIntegral numGoals 237 if cont then updat progress $ AS_Anno.senAttr $ fromJust nextSen 238 else do 239 switchAll True 240 takeMVar threadId 241 return () 236 postGUISync $ do 242 237 s' <- readMVar stateMVar 243 238 update' s' 244 return cont) 239 let progress = fromIntegral gPSF / fromIntegral numGoals 240 when cont $ updat progress $ AS_Anno.senAttr $ fromJust nextSen 241 return cont 245 242 updat 0 firstGoalName 246 switchAll False247 mtid <- tryTakeMVar threadId248 maybe (error "MVar was not set.") (\ _ -> return ()) mtid249 243 tid <- forkIO $ do 244 yield 250 245 genericProveBatch False timeout opts inclProven saveBatch 251 246 afterEachProofAttempt (atpInsertSentence atpFun) (runProver atpFun) 252 247 prName thName s Nothing 253 return () 254 putMVar threadId tid 248 b <- isEmptyMVar threadId 249 unless b $ putMVar finished () 250 b <- tryPutMVar threadId tid 251 unless b $ error "MVar 'threadId' already set" 252 switchAll False 255 253 forkIO_ $ do 256 putMVar threadId tid' 257 postGUISync $ do 254 takeMVar finished 255 tryTakeMVar threadId 256 postGUIAsync $ do 258 257 switchAll True 259 258 exit -
trunk/GUI/GtkProverGUI.hs
r12779 r12783 158 158 159 159 onClicked btnGoalsSelectOpen $ modifyMVar_ state $ \ s -> do 160 model <- treeViewGetModel trvGoals161 160 sel <- treeViewGetSelection trvGoals 162 let isOpen st = let thst = thmStatus st in163 null thst || case maximum $ map snd thst of164 BasicProof _ pst -> isOpenGoal $ goalStatus pst165 _ -> False166 treeModelForeach (fromJust model) $ \ i -> do167 (row:[]) <- treeModelGetPath (fromJust model) i168 key <- listStoreGetValue listGoals row169 (if isOpen $ fromJust $ OMap.lookup (gName key) $ goalMap s170 then treeSelectionSelectIter else treeSelectionUnselectIter) sel i171 return False161 treeSelectionSelectAll sel 162 rs <- treeSelectionGetSelectedRows sel 163 mapM_ ( \ p@(row:[]) -> do 164 i <- listStoreGetValue listGoals row 165 let isOpen st = let thst = thmStatus st in 166 null thst || case maximum $ map snd thst of 167 BasicProof _ pst -> isOpenGoal $ goalStatus pst 168 _ -> False 169 (if isOpen $ fromJust $ OMap.lookup (gName i) $ goalMap s 170 then treeSelectionSelectPath else treeSelectionUnselectPath) sel p) rs 172 171 update s 173 172 … … 175 174 setListSelectorMultiple trvAxioms btnAxiomsAll btnAxiomsNone btnAxiomsInvert 176 175 $ modifyMVar_ state update 176 177 177 onClicked btnAxiomsFormer $ modifyMVar_ state $ \ s -> do 178 aM <- axiomMap s179 model <- treeViewGetModel trvAxioms180 178 sel <- treeViewGetSelection trvAxioms 181 treeModelForeach (fromJust model) $ \ i -> do 182 (row:[]) <- treeModelGetPath (fromJust model) i 183 key <- listStoreGetValue listAxioms row 184 k <- case stripPrefix "(Th) " key of 185 Just k -> return k 186 Nothing -> return key 187 (if not $ wasTheorem $ fromJust $ OMap.lookup k aM 188 then treeSelectionSelectIter else treeSelectionUnselectIter) sel i 189 return False 179 treeSelectionSelectAll sel 180 rs <- treeSelectionGetSelectedRows sel 181 mapM_ ( \ p@(row:[]) -> do 182 i <- listStoreGetValue listAxioms row 183 (if wasTheorem $ fromJust $ OMap.lookup (stripPrefixAxiom i) axioms 184 then treeSelectionUnselectPath else treeSelectionSelectPath) sel p) rs 190 185 update s 191 186 … … 199 194 onClicked btnClose $ widgetDestroy window 200 195 201 onClicked btnShowTheory $ 202 displayTheoryWithWarning "Theory" thName warn th 203 204 onClicked btnShowSelectedTheory $ do 205 s <- readMVar state 206 displayTheoryWithWarning "Selected Theory" thName warn $ selectedTheory s 196 onClicked btnShowTheory $ displayTheoryWithWarning "Theory" thName warn th 197 198 onClicked btnShowSelectedTheory $ readMVar state >>= 199 displayTheoryWithWarning "Selected Theory" thName warn . selectedTheory 207 200 208 201 onClicked btnDisplay $ readMVar state >>= displayGoals 209 202 210 onClicked btnProofDetails $ do 211 s <- readMVar state 212 forkIO_ $ doShowProofDetails s 203 onClicked btnProofDetails $ forkIO_ $ readMVar state >>= doShowProofDetails 213 204 214 205 onClicked btnProve $ do … … 351 342 axioms <- getSelectedMultiple axs listAxs 352 343 theorems <- getSelectedMultiple ths listThs 353 return s { includedAxioms = map sndaxioms344 return s { includedAxioms = map (stripPrefixAxiom . snd) axioms 354 345 , includedTheorems = map snd theorems } 346 347 stripPrefixAxiom :: String -> String 348 stripPrefixAxiom a = case stripPrefix "(Th) " a of 349 Just a' -> a' 350 Nothing -> a 355 351 356 352 -- | Called whenever a prover is selected from the "Pick Theorem Prover" list. -
trunk/GUI/HTkProverGUI.hs
r12755 r12783 43 43 44 44 -- * Proof Management GUI 45 46 -- ** some types47 48 -- | Type for storing the proof management window49 type GUIMVar = Conc.MVar (Maybe Toplevel)50 45 51 46 -- ** Defining the view … … 331 326 closing the window; while the window is open it is filled with 332 327 the Toplevel -} 333 -> IO (Result.Result G_theory)328 -> IO (Result.Result G_theory) 334 329 proofManagementGUI lid prGuiAcs 335 330 thName warningTxt th -
trunk/GUI/HTkUtils.hs
r12739 r12783 15 15 , LBStatusIndicator (..) 16 16 , EnableWid (..) 17 , GUIMVar 17 18 , listBox 18 19 , errorMess … … 51 52 52 53 import Common.DocUtils 54 55 import Control.Concurrent.MVar 56 57 58 -- ** some types 59 60 -- | Type for storing the proof management window 61 type GUIMVar = MVar (Maybe Toplevel) 53 62 54 63 -- | create a window with title and list of options, return selected option