packages feed

manatee-editor 0.0.7 → 0.0.8

raw patch · 2 files changed

+36/−24 lines, 2 filesdep ~manatee-core

Dependency ranges changed: manatee-core

Files

Manatee/Extension/Editor/SourceView.hs view
@@ -31,6 +31,7 @@ import Graphics.UI.Gtk.SourceView.SourceLanguage import Graphics.UI.Gtk.SourceView.SourceLanguageManager import Manatee.Core.DBus+import Manatee.Core.PageFrame import Manatee.Core.PageView import Manatee.Core.Types import Manatee.Extension.Editor.SourceBuffer@@ -39,7 +40,6 @@ import Manatee.Toolkit.General.STM import Manatee.Toolkit.Gtk.Gtk import Manatee.Toolkit.Gtk.Multiline-import Manatee.Toolkit.Gtk.ScrolledWindow import Paths_manatee_editor import System.FilePath import Text.Printf@@ -50,7 +50,7 @@  data SourceView =     SourceView {sourceViewPlugId          :: TVar PagePlugId-               ,sourceViewScrolledWindow  :: ScrolledWindow+               ,sourceViewFrame           :: PageFrame                ,sourceViewView            :: SV.SourceView                ,sourceViewBuffer          :: SourceBuffer                }@@ -67,11 +67,12 @@ instance PageView SourceView where     pageViewBuffer              = PageBufferWrap . sourceViewBuffer     pageViewPlugId              = sourceViewPlugId+    pageViewBox                 = pageFrameBox . sourceViewFrame+    pageViewScrolledWindow      = sourceViewScrolledWindow     pageViewFocus               = widgetGrabFocus . sourceViewView     pageViewCut                 = sourceViewCut     pageViewCopy                = sourceViewCopy     pageViewPaste               = sourceViewPaste-    pageViewScrolledWindow      = sourceViewScrolledWindow     pageViewHandleKeyAction     = sourceViewHandleKeyAction     pageViewScrollToTop         = sourceViewScrollToTop     pageViewScrollToBottom      = sourceViewScrollToBottom@@ -85,16 +86,16 @@   pId <- newTVarIO plugId    -- Create UI frame.-  scrolledWindow <- scrolledWindowNew_+  pFrame <- pageFrameNewWithModeName (pageModeName $ sourceBufferMode sb)    sourceView <- SV.sourceViewNewWithBuffer (sourceBufferBuffer sb)-  scrolledWindow `containerAdd` sourceView+  pageFrameAddChild pFrame sourceView    -- Set default font of source view.   fontDescr <- fontDescriptionFromString "Monospace"   widgetModifyFont sourceView (Just fontDescr) -  let sv = SourceView pId scrolledWindow sourceView sb+  let sv = SourceView pId pFrame sourceView sb    -- Load syntax highlight.   sourceViewSyntaxHighlight sv@@ -105,8 +106,10 @@   SV.sourceViewSetShowLineNumbers sourceView True           -- show line number   textViewSetCursorVisible sourceView True                  -- make cursor visible -  -- Update position status.-  sourceViewHandlePositionDisplay sv -- display position with user action+  -- Update status after expose.+  sourceViewView sv `afterExposeRect` \ _ -> do+    sourceViewDisplayPositionStatus sv -- display position+    sourceViewDisplayPercentStatus sv  -- display percent    -- Handle selection mark.   sourceViewHandleSelectionMark sv@@ -130,6 +133,10 @@ sourceViewGetLine :: SourceView -> IO Int sourceViewGetLine = textViewGetLine . sourceViewView +-- | Get line count.+sourceViewGetLineCount :: SourceView -> IO Int+sourceViewGetLineCount = textViewGetLineCount . sourceViewView+ -- | Get current column. sourceViewGetColumn :: SourceView -> IO Int sourceViewGetColumn = textViewGetColumn . sourceViewView@@ -138,14 +145,15 @@ sourceViewDisplayPositionStatus :: SourceView -> IO () sourceViewDisplayPositionStatus sb =    liftM2 (printf "Pos (%d, %d)") (sourceViewGetLine sb) (sourceViewGetColumn sb)-         >>= pageViewUpdateInfoStatus sb "Pos"---- | Update position information.-sourceViewHandlePositionDisplay :: SourceView -> IO ()-sourceViewHandlePositionDisplay sv = do-  sourceViewView sv `afterExposeRect` (\_ -> sourceViewDisplayPositionStatus sv)-  return ()+         >>= pageFrameUpdateStatusbar (sourceViewFrame sb) "Pos" +-- | Display percent information.+sourceViewDisplayPercentStatus :: SourceView -> IO ()+sourceViewDisplayPercentStatus sv = do+  line <- sourceViewGetLine sv+  lineCount <- sourceViewGetLineCount sv+  pageFrameUpdateStatusbar (sourceViewFrame sv) "Percent" ("(" ++ show (floor (i2d (line * 100) / i2d lineCount)) ++ "%)")+   -- | Handle selection mark. sourceViewHandleSelectionMark :: SourceView -> IO ()   sourceViewHandleSelectionMark sv = do@@ -190,7 +198,7 @@   string <- sourceViewGetText a   writeFile filepath string   name <- sourceViewName a-  pageViewUpdateOutputStatus a ("Save " ++ name) Nothing+  pageFrameShowOutputbar (sourceViewFrame a) ("Save " ++ name) Nothing  -- | Get buffer name. sourceViewName :: SourceView -> IO String@@ -204,8 +212,8 @@   ifM (SB.sourceBufferGetCanUndo sb)           (do             SB.sourceBufferUndo sb-            pageViewUpdateOutputStatus a "Undo!" Nothing)-          (pageViewUpdateOutputStatus a "No further undo information." Nothing)+            pageFrameShowOutputbar (sourceViewFrame a) "Undo!" Nothing)+          (pageFrameShowOutputbar (sourceViewFrame a) "No further undo information." Nothing)  -- | Redo. sourceViewRedo :: SourceView -> IO ()@@ -214,8 +222,8 @@   ifM (SB.sourceBufferGetCanRedo sb)           (do             SB.sourceBufferRedo sb-            pageViewUpdateOutputStatus a "Redo!" Nothing)-          (pageViewUpdateOutputStatus a "No further redo information." Nothing)+            pageFrameShowOutputbar (sourceViewFrame a) "Redo!" Nothing)+          (pageFrameShowOutputbar (sourceViewFrame a) "No further redo information." Nothing)  -- | String view wrap user action for undo/redo. sourceViewWrapAction :: SourceView -> IO () -> IO ()  @@ -452,8 +460,8 @@ sourceViewToggleSelectionMark :: SourceView -> IO () sourceViewToggleSelectionMark view =    ifM (textViewToggleSelectionMark $ sourceViewView view )-      (pageViewUpdateInfoStatus view "Selection" "Selection (Active)")-      (pageViewUpdateInfoStatus view "Selection" "Selection (Inactive)")+      (pageFrameUpdateStatusbar (sourceViewFrame view) "Selection" "Selection (Active)")+      (pageFrameUpdateStatusbar (sourceViewFrame view) "Selection" "Selection (Inactive)")  -- | Exchange selection mark. sourceViewExchangeSelectionMark :: SourceView -> IO ()@@ -492,3 +500,7 @@     -- Otherwise propagate event.     Nothing -> widgetPropagateEvent (sourceViewView view) sEvent  +-- | Source view scrolled window.+sourceViewScrolledWindow :: SourceView -> ScrolledWindow    +sourceViewScrolledWindow =+  pageFrameScrolledWindow . sourceViewFrame
manatee-editor.cabal view
@@ -1,5 +1,5 @@ name:			manatee-editor-version:		0.0.7+version:		0.0.8 Cabal-Version:	>= 1.6 license:		GPL-3 license-file:	LICENSE@@ -30,7 +30,7 @@   location:     http://patch-tag.com/r/AndyStewart/manatee-editor    Library-     build-depends: base >= 4 && < 5, manatee-core >= 0.0.7, dbus-client >= 0.3 && < 0.4, stm >= 2.1.2.0,+     build-depends: base >= 4 && < 5, manatee-core >= 0.0.8, dbus-client >= 0.3 && < 0.4, stm >= 2.1.2.0,                     containers >= 0.3.0.0, gtk-serialized-event >= 0.12.0, gtk >= 0.12.0, gtksourceview2 >= 0.12.0,                     text >= 0.7.1.0, bytestring >= 0.9.1.5, dbus-core, regex-tdfa, filepath      exposed-modules: