mirror of
https://gitlab.com/sheaf/metabrush.git
synced 2024-11-05 14:53:37 +00:00
rename recomputeStrokes -> redrawStrokes
This commit is contained in:
parent
1a8f4b5f5d
commit
47cf66c5dd
|
@ -202,7 +202,7 @@ runApplication application = do
|
||||||
testDocuments = newHistory <$> Map.fromList
|
testDocuments = newHistory <$> Map.fromList
|
||||||
[ ( docUnique, testDoc ) ]
|
[ ( docUnique, testDoc ) ]
|
||||||
|
|
||||||
recomputeStrokesTVar <- STM.newTVarIO False
|
redrawStrokesTVar <- STM.newTVarIO False
|
||||||
documentRenderTVar <- STM.newTVarIO ( const $ pure () )
|
documentRenderTVar <- STM.newTVarIO ( const $ pure () )
|
||||||
activeDocumentTVar <- STM.newTVarIO Nothing
|
activeDocumentTVar <- STM.newTVarIO Nothing
|
||||||
openDocumentsTVar <- STM.newTVarIO testDocuments
|
openDocumentsTVar <- STM.newTVarIO testDocuments
|
||||||
|
@ -344,8 +344,8 @@ runApplication application = do
|
||||||
-- Update the document render data in a separate thread.
|
-- Update the document render data in a separate thread.
|
||||||
_ <- forkIO $ forever do
|
_ <- forkIO $ forever do
|
||||||
getRenderDoc <- STM.atomically do
|
getRenderDoc <- STM.atomically do
|
||||||
needsRecomputation <- STM.readTVar recomputeStrokesTVar
|
needsRedraw <- STM.readTVar redrawStrokesTVar
|
||||||
case needsRecomputation of
|
case needsRedraw of
|
||||||
False -> STM.retry
|
False -> STM.retry
|
||||||
True -> do
|
True -> do
|
||||||
mbDocNow <- fmap ( present . snd ) <$> activeDocument variables
|
mbDocNow <- fmap ( present . snd ) <$> activeDocument variables
|
||||||
|
@ -362,7 +362,7 @@ runApplication application = do
|
||||||
fitParameters <- STM.readTVar fitParametersTVar
|
fitParameters <- STM.readTVar fitParametersTVar
|
||||||
rootsAlgo <- STM.readTVar rootsAlgoTVar
|
rootsAlgo <- STM.readTVar rootsAlgoTVar
|
||||||
mbCuspOptions <- STM.readTVar cuspFindingOptionsTVar
|
mbCuspOptions <- STM.readTVar cuspFindingOptionsTVar
|
||||||
STM.writeTVar recomputeStrokesTVar False
|
STM.writeTVar redrawStrokesTVar False
|
||||||
let
|
let
|
||||||
addRulers :: ( ( Int32, Int32 ) -> Cairo.Render () ) -> ( ( Int32, Int32 ) -> Cairo.Render () )
|
addRulers :: ( ( Int32, Int32 ) -> Cairo.Render () ) -> ( ( Int32, Int32 ) -> Cairo.Render () )
|
||||||
addRulers newRender viewportSize = do
|
addRulers newRender viewportSize = do
|
||||||
|
|
|
@ -678,7 +678,7 @@ data ToggleGuides = ToggleGuides
|
||||||
deriving stock Show
|
deriving stock Show
|
||||||
|
|
||||||
instance HandleAction ToggleGuides where
|
instance HandleAction ToggleGuides where
|
||||||
handleAction ( UIElements { viewport = Viewport {..} } ) ( Variables { recomputeStrokesTVar, showGuidesTVar } ) _ = do
|
handleAction ( UIElements { viewport = Viewport {..} } ) ( Variables { redrawStrokesTVar, showGuidesTVar } ) _ = do
|
||||||
_guidesWereShown <- STM.atomically do
|
_guidesWereShown <- STM.atomically do
|
||||||
guidesWereShown <- STM.readTVar showGuidesTVar
|
guidesWereShown <- STM.readTVar showGuidesTVar
|
||||||
STM.writeTVar showGuidesTVar ( not guidesWereShown )
|
STM.writeTVar showGuidesTVar ( not guidesWereShown )
|
||||||
|
@ -692,7 +692,7 @@ instance HandleAction ToggleGuides where
|
||||||
-- toggleGuidesWidget = menuItemWidget . toggleGuides . sectionItems . viewMenu4 . menuItemSubmenu . view
|
-- toggleGuidesWidget = menuItemWidget . toggleGuides . sectionItems . viewMenu4 . menuItemSubmenu . view
|
||||||
-- $ menuObject
|
-- $ menuObject
|
||||||
--GTK.buttonSetLabel toggleGuidesWidget newText
|
--GTK.buttonSetLabel toggleGuidesWidget newText
|
||||||
STM.atomically ( STM.writeTVar recomputeStrokesTVar True )
|
STM.atomically ( STM.writeTVar redrawStrokesTVar True )
|
||||||
for_ [ rulerCornerDrawingArea, topRulerDrawingArea, leftRulerDrawingArea ] \ drawingArea -> do
|
for_ [ rulerCornerDrawingArea, topRulerDrawingArea, leftRulerDrawingArea ] \ drawingArea -> do
|
||||||
GTK.widgetQueueDraw drawingArea
|
GTK.widgetQueueDraw drawingArea
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ instance HandleAction Confirm where
|
||||||
-- End ongoing drawing on pressing enter key.
|
-- End ongoing drawing on pressing enter key.
|
||||||
Pen -> do
|
Pen -> do
|
||||||
STM.writeTVar partialPathTVar Nothing
|
STM.writeTVar partialPathTVar Nothing
|
||||||
STM.writeTVar recomputeStrokesTVar True
|
STM.writeTVar redrawStrokesTVar True
|
||||||
_ -> pure ()
|
_ -> pure ()
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
|
@ -812,7 +812,7 @@ instance HandleAction MouseMove where
|
||||||
tool <- STM.readTVar toolTVar
|
tool <- STM.readTVar toolTVar
|
||||||
mbPartialPath <- STM.readTVar partialPathTVar
|
mbPartialPath <- STM.readTVar partialPathTVar
|
||||||
mode <- STM.readTVar modeTVar
|
mode <- STM.readTVar modeTVar
|
||||||
STM.writeTVar recomputeStrokesTVar True -- need to keep updating for mouse hover updates
|
STM.writeTVar redrawStrokesTVar True -- need to keep updating for mouse hover updates
|
||||||
if
|
if
|
||||||
| Pen <- tool
|
| Pen <- tool
|
||||||
, Just pp <- mbPartialPath
|
, Just pp <- mbPartialPath
|
||||||
|
@ -1041,7 +1041,7 @@ instance HandleAction MouseClick where
|
||||||
-- Right mouse button: end partial path.
|
-- Right mouse button: end partial path.
|
||||||
3 -> STM.atomically do
|
3 -> STM.atomically do
|
||||||
STM.writeTVar partialPathTVar Nothing
|
STM.writeTVar partialPathTVar Nothing
|
||||||
STM.writeTVar recomputeStrokesTVar True
|
STM.writeTVar redrawStrokesTVar True
|
||||||
|
|
||||||
-- Other mouse buttons: ignored (for the moment at least).
|
-- Other mouse buttons: ignored (for the moment at least).
|
||||||
_ -> pure ()
|
_ -> pure ()
|
||||||
|
@ -1370,7 +1370,7 @@ instance HandleAction KeyboardPress where
|
||||||
, Just pp <- mbPartialPath
|
, Just pp <- mbPartialPath
|
||||||
-> STM.atomically do
|
-> STM.atomically do
|
||||||
STM.writeTVar partialPathTVar ( Just $ pp { partialControlPoint = Just mp } )
|
STM.writeTVar partialPathTVar ( Just $ pp { partialControlPoint = Just mp } )
|
||||||
STM.writeTVar recomputeStrokesTVar True
|
STM.writeTVar redrawStrokesTVar True
|
||||||
_ -> pure ()
|
_ -> pure ()
|
||||||
|
|
||||||
_ -> pure ()
|
_ -> pure ()
|
||||||
|
|
|
@ -99,7 +99,7 @@ data UIElements
|
||||||
data Variables
|
data Variables
|
||||||
= Variables
|
= Variables
|
||||||
{ uniqueSupply :: !UniqueSupply
|
{ uniqueSupply :: !UniqueSupply
|
||||||
, recomputeStrokesTVar :: !( STM.TVar Bool )
|
, redrawStrokesTVar :: !( STM.TVar Bool )
|
||||||
, documentRenderTVar :: !( STM.TVar ( ( Int32, Int32 ) -> Cairo.Render () ) )
|
, documentRenderTVar :: !( STM.TVar ( ( Int32, Int32 ) -> Cairo.Render () ) )
|
||||||
, activeDocumentTVar :: !( STM.TVar ( Maybe Unique ) )
|
, activeDocumentTVar :: !( STM.TVar ( Maybe Unique ) )
|
||||||
, openDocumentsTVar :: !( STM.TVar ( Map Unique DocumentHistory ) )
|
, openDocumentsTVar :: !( STM.TVar ( Map Unique DocumentHistory ) )
|
||||||
|
|
|
@ -231,7 +231,7 @@ updateUIAction _docChange uiElts@( UIElements { viewport = Viewport {..}, .. } )
|
||||||
GTK.widgetQueueDraw fileBarTab
|
GTK.widgetQueueDraw fileBarTab
|
||||||
GTK.widgetQueueDraw fileBarTabCloseArea
|
GTK.widgetQueueDraw fileBarTabCloseArea
|
||||||
updateHistoryState uiElts ( fmap snd mbDocHist )
|
updateHistoryState uiElts ( fmap snd mbDocHist )
|
||||||
STM.atomically ( STM.writeTVar recomputeStrokesTVar True )
|
STM.atomically ( STM.writeTVar redrawStrokesTVar True )
|
||||||
|
|
||||||
updateTitle :: GTK.IsWindow window => window -> GTK.Label -> Maybe ( Text, Bool ) -> IO ()
|
updateTitle :: GTK.IsWindow window => window -> GTK.Label -> Maybe ( Text, Bool ) -> IO ()
|
||||||
updateTitle window titleLabel mbTitleText = do
|
updateTitle window titleLabel mbTitleText = do
|
||||||
|
|
|
@ -56,7 +56,7 @@ createToolBar ( Variables {..} ) colours toolBar = do
|
||||||
( second \ toolVal -> STM.atomically do
|
( second \ toolVal -> STM.atomically do
|
||||||
STM.writeTVar toolTVar toolVal
|
STM.writeTVar toolTVar toolVal
|
||||||
STM.writeTVar partialPathTVar Nothing
|
STM.writeTVar partialPathTVar Nothing
|
||||||
STM.writeTVar recomputeStrokesTVar True
|
STM.writeTVar redrawStrokesTVar True
|
||||||
)
|
)
|
||||||
[ ( selectionTool, Selection ), ( penTool, Pen ) ]
|
[ ( selectionTool, Selection ), ( penTool, Pen ) ]
|
||||||
GTK.toggleButtonSetActive selectionTool True
|
GTK.toggleButtonSetActive selectionTool True
|
||||||
|
@ -73,7 +73,7 @@ createToolBar ( Variables {..} ) colours toolBar = do
|
||||||
( second \ modeVal -> STM.atomically do
|
( second \ modeVal -> STM.atomically do
|
||||||
STM.writeTVar modeTVar modeVal
|
STM.writeTVar modeTVar modeVal
|
||||||
STM.writeTVar partialPathTVar Nothing
|
STM.writeTVar partialPathTVar Nothing
|
||||||
STM.writeTVar recomputeStrokesTVar True
|
STM.writeTVar redrawStrokesTVar True
|
||||||
)
|
)
|
||||||
[ ( pathTool, PathMode ), ( brushTool, BrushMode ), ( metaTool, MetaMode ) ]
|
[ ( pathTool, PathMode ), ( brushTool, BrushMode ), ( metaTool, MetaMode ) ]
|
||||||
GTK.toggleButtonSetActive pathTool True
|
GTK.toggleButtonSetActive pathTool True
|
||||||
|
@ -87,7 +87,7 @@ createToolBar ( Variables {..} ) colours toolBar = do
|
||||||
STM.atomically do
|
STM.atomically do
|
||||||
STM.writeTVar debugTVar clicked
|
STM.writeTVar debugTVar clicked
|
||||||
STM.writeTVar partialPathTVar Nothing
|
STM.writeTVar partialPathTVar Nothing
|
||||||
STM.writeTVar recomputeStrokesTVar True
|
STM.writeTVar redrawStrokesTVar True
|
||||||
|
|
||||||
GTK.boxAppend toolBar selectionTool
|
GTK.boxAppend toolBar selectionTool
|
||||||
GTK.boxAppend toolBar penTool
|
GTK.boxAppend toolBar penTool
|
||||||
|
|
Loading…
Reference in a new issue