Improve haddock documentation
This commit is contained in:
parent
545c5365e9
commit
5e5408422b
@ -6,6 +6,7 @@ import Meshparser
|
||||
import Util
|
||||
|
||||
|
||||
-- |Holds the properties for a Diagram, like thickness of 2d points etc.
|
||||
data DiagProp = MkProp {
|
||||
-- |Get the thickness of the dot.
|
||||
getThickness :: Double
|
||||
|
7
Gtk.hs
7
Gtk.hs
@ -10,6 +10,7 @@ import Graphics.UI.Gtk.Windows.MessageDialog
|
||||
import System.Directory
|
||||
|
||||
|
||||
-- |Handle the whole GTK gui.
|
||||
startGUI :: FilePath -> IO ()
|
||||
startGUI startFile = do
|
||||
homedir <- getHomeDirectory
|
||||
@ -84,6 +85,7 @@ startGUI startFile = do
|
||||
mainGUI
|
||||
|
||||
|
||||
-- |Callback when the "Draw" Button is clicked.
|
||||
onClickedDrawButton :: (WidgetClass widget, RangeClass scale)
|
||||
=> FileChooserButton
|
||||
-> widget
|
||||
@ -98,6 +100,7 @@ onClickedDrawButton fcb da scale' = do
|
||||
showErrorDialog "No valid Mesh file!"
|
||||
|
||||
|
||||
-- |Callback when the "Save" Button is clicked.
|
||||
onClickedSaveButton :: FileChooserButton
|
||||
-> IO ()
|
||||
onClickedSaveButton fcb = do
|
||||
@ -109,6 +112,7 @@ onClickedSaveButton fcb = do
|
||||
showErrorDialog "No valid Mesh file!"
|
||||
|
||||
|
||||
-- |Pops up an error Dialog with the given String.
|
||||
showErrorDialog :: String -> IO ()
|
||||
showErrorDialog str = do
|
||||
errorDialog <- messageDialogNew Nothing
|
||||
@ -120,6 +124,8 @@ showErrorDialog str = do
|
||||
widgetDestroy errorDialog
|
||||
|
||||
|
||||
-- |Draws a Diagram which is built from a given file to
|
||||
-- the gtk DrawingArea.
|
||||
drawDiag' :: (WidgetClass widget, RangeClass scale)
|
||||
=> FilePath
|
||||
-> widget
|
||||
@ -136,6 +142,7 @@ drawDiag' fp da scale' = do
|
||||
renderWithDrawable dw r
|
||||
|
||||
|
||||
-- |Saves a Diagram which is built from a given file as an SVG.
|
||||
saveDiag' :: FilePath -> IO ()
|
||||
saveDiag' fp = do
|
||||
mesh <- readFile fp
|
||||
|
7
Util.hs
7
Util.hs
@ -11,11 +11,13 @@ inRange min' max' (x, y)
|
||||
| otherwise = False
|
||||
|
||||
|
||||
-- |Compare the extension of a file with the given String.
|
||||
cmpExt :: String -> FilePath -> Bool
|
||||
cmpExt _ [] = False
|
||||
cmpExt ext fp = ext == getExt fp
|
||||
|
||||
|
||||
-- |Get the extension of a file.
|
||||
getExt :: FilePath -> String
|
||||
getExt = last .
|
||||
splitBy (== '.') .
|
||||
@ -23,7 +25,10 @@ getExt = last .
|
||||
splitBy (== '/')
|
||||
|
||||
|
||||
splitBy :: (a -> Bool) -> [a] -> [[a]]
|
||||
-- |Split an array into subarrays depending on a given condition.
|
||||
splitBy :: (a -> Bool) -- ^ condition
|
||||
-> [a] -- ^ array to split
|
||||
-> [[a]] -- ^ splitted array
|
||||
splitBy f s = case dropWhile f s of
|
||||
[] -> []
|
||||
s' -> w : splitBy f s''
|
||||
|
Loading…
Reference in New Issue
Block a user