From 47cf66c5dd108b7ddac46fcd58d0a9172ab471a7 Mon Sep 17 00:00:00 2001 From: sheaf Date: Sat, 12 Oct 2024 16:48:21 +0200 Subject: [PATCH] rename recomputeStrokes -> redrawStrokes --- src/app/MetaBrush/Application.hs | 8 ++++---- src/app/MetaBrush/Application/Action.hs | 12 ++++++------ src/app/MetaBrush/Application/Context.hs | 2 +- src/app/MetaBrush/Application/UpdateDocument.hs | 2 +- src/app/MetaBrush/UI/ToolBar.hs | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/app/MetaBrush/Application.hs b/src/app/MetaBrush/Application.hs index a395d82..ce73565 100644 --- a/src/app/MetaBrush/Application.hs +++ b/src/app/MetaBrush/Application.hs @@ -202,7 +202,7 @@ runApplication application = do testDocuments = newHistory <$> Map.fromList [ ( docUnique, testDoc ) ] - recomputeStrokesTVar <- STM.newTVarIO False + redrawStrokesTVar <- STM.newTVarIO False documentRenderTVar <- STM.newTVarIO ( const $ pure () ) activeDocumentTVar <- STM.newTVarIO Nothing openDocumentsTVar <- STM.newTVarIO testDocuments @@ -344,8 +344,8 @@ runApplication application = do -- Update the document render data in a separate thread. _ <- forkIO $ forever do getRenderDoc <- STM.atomically do - needsRecomputation <- STM.readTVar recomputeStrokesTVar - case needsRecomputation of + needsRedraw <- STM.readTVar redrawStrokesTVar + case needsRedraw of False -> STM.retry True -> do mbDocNow <- fmap ( present . snd ) <$> activeDocument variables @@ -362,7 +362,7 @@ runApplication application = do fitParameters <- STM.readTVar fitParametersTVar rootsAlgo <- STM.readTVar rootsAlgoTVar mbCuspOptions <- STM.readTVar cuspFindingOptionsTVar - STM.writeTVar recomputeStrokesTVar False + STM.writeTVar redrawStrokesTVar False let addRulers :: ( ( Int32, Int32 ) -> Cairo.Render () ) -> ( ( Int32, Int32 ) -> Cairo.Render () ) addRulers newRender viewportSize = do diff --git a/src/app/MetaBrush/Application/Action.hs b/src/app/MetaBrush/Application/Action.hs index f057449..bf350a6 100644 --- a/src/app/MetaBrush/Application/Action.hs +++ b/src/app/MetaBrush/Application/Action.hs @@ -678,7 +678,7 @@ data ToggleGuides = ToggleGuides deriving stock Show 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.readTVar showGuidesTVar STM.writeTVar showGuidesTVar ( not guidesWereShown ) @@ -692,7 +692,7 @@ instance HandleAction ToggleGuides where -- toggleGuidesWidget = menuItemWidget . toggleGuides . sectionItems . viewMenu4 . menuItemSubmenu . view -- $ menuObject --GTK.buttonSetLabel toggleGuidesWidget newText - STM.atomically ( STM.writeTVar recomputeStrokesTVar True ) + STM.atomically ( STM.writeTVar redrawStrokesTVar True ) for_ [ rulerCornerDrawingArea, topRulerDrawingArea, leftRulerDrawingArea ] \ drawingArea -> do GTK.widgetQueueDraw drawingArea @@ -714,7 +714,7 @@ instance HandleAction Confirm where -- End ongoing drawing on pressing enter key. Pen -> do STM.writeTVar partialPathTVar Nothing - STM.writeTVar recomputeStrokesTVar True + STM.writeTVar redrawStrokesTVar True _ -> pure () ---------------- @@ -812,7 +812,7 @@ instance HandleAction MouseMove where tool <- STM.readTVar toolTVar mbPartialPath <- STM.readTVar partialPathTVar 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 | Pen <- tool , Just pp <- mbPartialPath @@ -1041,7 +1041,7 @@ instance HandleAction MouseClick where -- Right mouse button: end partial path. 3 -> STM.atomically do STM.writeTVar partialPathTVar Nothing - STM.writeTVar recomputeStrokesTVar True + STM.writeTVar redrawStrokesTVar True -- Other mouse buttons: ignored (for the moment at least). _ -> pure () @@ -1370,7 +1370,7 @@ instance HandleAction KeyboardPress where , Just pp <- mbPartialPath -> STM.atomically do STM.writeTVar partialPathTVar ( Just $ pp { partialControlPoint = Just mp } ) - STM.writeTVar recomputeStrokesTVar True + STM.writeTVar redrawStrokesTVar True _ -> pure () _ -> pure () diff --git a/src/app/MetaBrush/Application/Context.hs b/src/app/MetaBrush/Application/Context.hs index 337392e..7336a62 100644 --- a/src/app/MetaBrush/Application/Context.hs +++ b/src/app/MetaBrush/Application/Context.hs @@ -99,7 +99,7 @@ data UIElements data Variables = Variables { uniqueSupply :: !UniqueSupply - , recomputeStrokesTVar :: !( STM.TVar Bool ) + , redrawStrokesTVar :: !( STM.TVar Bool ) , documentRenderTVar :: !( STM.TVar ( ( Int32, Int32 ) -> Cairo.Render () ) ) , activeDocumentTVar :: !( STM.TVar ( Maybe Unique ) ) , openDocumentsTVar :: !( STM.TVar ( Map Unique DocumentHistory ) ) diff --git a/src/app/MetaBrush/Application/UpdateDocument.hs b/src/app/MetaBrush/Application/UpdateDocument.hs index aad7bba..e119d00 100644 --- a/src/app/MetaBrush/Application/UpdateDocument.hs +++ b/src/app/MetaBrush/Application/UpdateDocument.hs @@ -231,7 +231,7 @@ updateUIAction _docChange uiElts@( UIElements { viewport = Viewport {..}, .. } ) GTK.widgetQueueDraw fileBarTab GTK.widgetQueueDraw fileBarTabCloseArea 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 window titleLabel mbTitleText = do diff --git a/src/app/MetaBrush/UI/ToolBar.hs b/src/app/MetaBrush/UI/ToolBar.hs index 1ea6a66..449bb3f 100644 --- a/src/app/MetaBrush/UI/ToolBar.hs +++ b/src/app/MetaBrush/UI/ToolBar.hs @@ -56,7 +56,7 @@ createToolBar ( Variables {..} ) colours toolBar = do ( second \ toolVal -> STM.atomically do STM.writeTVar toolTVar toolVal STM.writeTVar partialPathTVar Nothing - STM.writeTVar recomputeStrokesTVar True + STM.writeTVar redrawStrokesTVar True ) [ ( selectionTool, Selection ), ( penTool, Pen ) ] GTK.toggleButtonSetActive selectionTool True @@ -73,7 +73,7 @@ createToolBar ( Variables {..} ) colours toolBar = do ( second \ modeVal -> STM.atomically do STM.writeTVar modeTVar modeVal STM.writeTVar partialPathTVar Nothing - STM.writeTVar recomputeStrokesTVar True + STM.writeTVar redrawStrokesTVar True ) [ ( pathTool, PathMode ), ( brushTool, BrushMode ), ( metaTool, MetaMode ) ] GTK.toggleButtonSetActive pathTool True @@ -87,7 +87,7 @@ createToolBar ( Variables {..} ) colours toolBar = do STM.atomically do STM.writeTVar debugTVar clicked STM.writeTVar partialPathTVar Nothing - STM.writeTVar recomputeStrokesTVar True + STM.writeTVar redrawStrokesTVar True GTK.boxAppend toolBar selectionTool GTK.boxAppend toolBar penTool