|
|
|
@ -85,206 +85,206 @@
|
|
|
|
|
<a name="line-76"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>GUI</span><span class='hs-varop'>.</span><span class='hs-conid'>Gtk</span><span class='hs-varop'>.</span><span class='hs-conid'>Data</span>
|
|
|
|
|
<a name="line-77"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>GUI</span><span class='hs-varop'>.</span><span class='hs-conid'>Gtk</span><span class='hs-varop'>.</span><span class='hs-conid'>Dialogs</span>
|
|
|
|
|
<a name="line-78"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>GUI</span><span class='hs-varop'>.</span><span class='hs-conid'>Gtk</span><span class='hs-varop'>.</span><span class='hs-conid'>MyView</span>
|
|
|
|
|
<a name="line-79"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>GUI</span><span class='hs-varop'>.</span><span class='hs-conid'>Gtk</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span>
|
|
|
|
|
<a name="line-80"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>History</span>
|
|
|
|
|
<a name="line-81"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span><span class='hs-varop'>.</span><span class='hs-conid'>IO</span>
|
|
|
|
|
<a name="line-82"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Prelude</span> <span class='hs-varid'>hiding</span><span class='hs-layout'>(</span><span class='hs-varid'>readFile</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-83"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>System</span><span class='hs-varop'>.</span><span class='hs-conid'>Glib</span><span class='hs-varop'>.</span><span class='hs-conid'>UTFString</span>
|
|
|
|
|
<a name="line-84"></a> <span class='hs-layout'>(</span>
|
|
|
|
|
<a name="line-85"></a> <span class='hs-varid'>glibToString</span>
|
|
|
|
|
<a name="line-86"></a> <span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-87"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>System</span><span class='hs-varop'>.</span><span class='hs-conid'>Posix</span><span class='hs-varop'>.</span><span class='hs-conid'>Env</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span>
|
|
|
|
|
<a name="line-88"></a> <span class='hs-layout'>(</span>
|
|
|
|
|
<a name="line-89"></a> <span class='hs-varid'>getEnv</span>
|
|
|
|
|
<a name="line-90"></a> <span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-91"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>System</span><span class='hs-varop'>.</span><span class='hs-conid'>Posix</span><span class='hs-varop'>.</span><span class='hs-conid'>Process</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>SPP</span>
|
|
|
|
|
<a name="line-92"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>System</span><span class='hs-varop'>.</span><span class='hs-conid'>Posix</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span>
|
|
|
|
|
<a name="line-93"></a> <span class='hs-layout'>(</span>
|
|
|
|
|
<a name="line-94"></a> <span class='hs-conid'>ProcessID</span>
|
|
|
|
|
<a name="line-95"></a> <span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-96"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Concurrent</span><span class='hs-varop'>.</span><span class='hs-conid'>MVar</span>
|
|
|
|
|
<a name="line-97"></a> <span class='hs-layout'>(</span>
|
|
|
|
|
<a name="line-98"></a> <span class='hs-varid'>putMVar</span>
|
|
|
|
|
<a name="line-99"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>readMVar</span>
|
|
|
|
|
<a name="line-100"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>takeMVar</span>
|
|
|
|
|
<a name="line-101"></a> <span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-79"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>GUI</span><span class='hs-varop'>.</span><span class='hs-conid'>Gtk</span><span class='hs-varop'>.</span><span class='hs-conid'>Settings</span>
|
|
|
|
|
<a name="line-80"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>GUI</span><span class='hs-varop'>.</span><span class='hs-conid'>Gtk</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span>
|
|
|
|
|
<a name="line-81"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>History</span>
|
|
|
|
|
<a name="line-82"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>Settings</span>
|
|
|
|
|
<a name="line-83"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span><span class='hs-varop'>.</span><span class='hs-conid'>IO</span>
|
|
|
|
|
<a name="line-84"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Prelude</span> <span class='hs-varid'>hiding</span><span class='hs-layout'>(</span><span class='hs-varid'>readFile</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-85"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>System</span><span class='hs-varop'>.</span><span class='hs-conid'>Glib</span><span class='hs-varop'>.</span><span class='hs-conid'>UTFString</span>
|
|
|
|
|
<a name="line-86"></a> <span class='hs-layout'>(</span>
|
|
|
|
|
<a name="line-87"></a> <span class='hs-varid'>glibToString</span>
|
|
|
|
|
<a name="line-88"></a> <span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-89"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>System</span><span class='hs-varop'>.</span><span class='hs-conid'>Posix</span><span class='hs-varop'>.</span><span class='hs-conid'>Process</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>SPP</span>
|
|
|
|
|
<a name="line-90"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>System</span><span class='hs-varop'>.</span><span class='hs-conid'>Posix</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span>
|
|
|
|
|
<a name="line-91"></a> <span class='hs-layout'>(</span>
|
|
|
|
|
<a name="line-92"></a> <span class='hs-conid'>ProcessID</span>
|
|
|
|
|
<a name="line-93"></a> <span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-94"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Concurrent</span><span class='hs-varop'>.</span><span class='hs-conid'>MVar</span>
|
|
|
|
|
<a name="line-95"></a> <span class='hs-layout'>(</span>
|
|
|
|
|
<a name="line-96"></a> <span class='hs-varid'>putMVar</span>
|
|
|
|
|
<a name="line-97"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>readMVar</span>
|
|
|
|
|
<a name="line-98"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>takeMVar</span>
|
|
|
|
|
<a name="line-99"></a> <span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-100"></a>
|
|
|
|
|
<a name="line-101"></a>
|
|
|
|
|
<a name="line-102"></a>
|
|
|
|
|
<a name="line-103"></a>
|
|
|
|
|
<a name="line-104"></a>
|
|
|
|
|
<a name="line-105"></a>
|
|
|
|
|
<a name="line-106"></a>
|
|
|
|
|
<a name="line-105"></a> <span class='hs-comment'>-----------------</span>
|
|
|
|
|
<a name="line-106"></a> <span class='hs-comment'>--[ Callbacks ]--</span>
|
|
|
|
|
<a name="line-107"></a> <span class='hs-comment'>-----------------</span>
|
|
|
|
|
<a name="line-108"></a> <span class='hs-comment'>--[ Callbacks ]--</span>
|
|
|
|
|
<a name="line-109"></a> <span class='hs-comment'>-----------------</span>
|
|
|
|
|
<a name="line-108"></a>
|
|
|
|
|
<a name="line-109"></a>
|
|
|
|
|
<a name="line-110"></a>
|
|
|
|
|
<a name="line-111"></a>
|
|
|
|
|
<a name="line-112"></a>
|
|
|
|
|
<a name="line-112"></a><span class='hs-comment'>---- MAIN CALLBACK ENTRYPOINT ----</span>
|
|
|
|
|
<a name="line-113"></a>
|
|
|
|
|
<a name="line-114"></a><span class='hs-comment'>---- MAIN CALLBACK ENTRYPOINT ----</span>
|
|
|
|
|
<a name="line-115"></a>
|
|
|
|
|
<a name="line-116"></a>
|
|
|
|
|
<a name="line-117"></a><a name="setGUICallbacks"></a><span class='hs-comment'>-- |Set callbacks for the whole gui, on hotkeys, events and stuff.</span>
|
|
|
|
|
<a name="line-118"></a><span class='hs-definition'>setGUICallbacks</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-119"></a><span class='hs-definition'>setGUICallbacks</span> <span class='hs-varid'>mygui</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-120"></a>
|
|
|
|
|
<a name="line-121"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>clearStatusBar</span> <span class='hs-varid'>mygui</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>buttonActivated</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-122"></a> <span class='hs-varid'>popStatusbar</span> <span class='hs-varid'>mygui</span>
|
|
|
|
|
<a name="line-123"></a> <span class='hs-varid'>writeTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>operationBuffer</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-conid'>None</span>
|
|
|
|
|
<a name="line-124"></a>
|
|
|
|
|
<a name="line-125"></a> <span class='hs-comment'>-- menubar-file</span>
|
|
|
|
|
<a name="line-126"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-layout'>(</span><span class='hs-varid'>menubarFileQuit</span> <span class='hs-varop'>.</span> <span class='hs-varid'>menubar</span><span class='hs-layout'>)</span> <span class='hs-varid'>mygui</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>menuItemActivated</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-127"></a> <span class='hs-varid'>mainQuit</span>
|
|
|
|
|
<a name="line-128"></a>
|
|
|
|
|
<a name="line-129"></a> <span class='hs-comment'>-- menubar-help</span>
|
|
|
|
|
<a name="line-130"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-layout'>(</span><span class='hs-varid'>menubarHelpAbout</span> <span class='hs-varop'>.</span> <span class='hs-varid'>menubar</span><span class='hs-layout'>)</span> <span class='hs-varid'>mygui</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>menuItemActivated</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-131"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varid'>showAboutDialog</span>
|
|
|
|
|
<a name="line-132"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-133"></a>
|
|
|
|
|
<a name="line-134"></a> <span class='hs-comment'>-- key events</span>
|
|
|
|
|
<a name="line-135"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>rootWin</span> <span class='hs-varid'>mygui</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-136"></a> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Control</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-137"></a> <span class='hs-str'>"q"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-138"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varid'>mainQuit</span>
|
|
|
|
|
<a name="line-114"></a>
|
|
|
|
|
<a name="line-115"></a><a name="setGUICallbacks"></a><span class='hs-comment'>-- |Set callbacks for the whole gui, on hotkeys, events and stuff.</span>
|
|
|
|
|
<a name="line-116"></a><span class='hs-definition'>setGUICallbacks</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-117"></a><span class='hs-definition'>setGUICallbacks</span> <span class='hs-varid'>mygui</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-118"></a>
|
|
|
|
|
<a name="line-119"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>clearStatusBar</span> <span class='hs-varid'>mygui</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>buttonActivated</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-120"></a> <span class='hs-varid'>popStatusbar</span> <span class='hs-varid'>mygui</span>
|
|
|
|
|
<a name="line-121"></a> <span class='hs-varid'>writeTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>operationBuffer</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-conid'>None</span>
|
|
|
|
|
<a name="line-122"></a>
|
|
|
|
|
<a name="line-123"></a> <span class='hs-comment'>-- menubar-file</span>
|
|
|
|
|
<a name="line-124"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-layout'>(</span><span class='hs-varid'>menubarFileQuit</span> <span class='hs-varop'>.</span> <span class='hs-varid'>menubar</span><span class='hs-layout'>)</span> <span class='hs-varid'>mygui</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>menuItemActivated</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-125"></a> <span class='hs-varid'>mainQuit</span>
|
|
|
|
|
<a name="line-126"></a>
|
|
|
|
|
<a name="line-127"></a> <span class='hs-comment'>-- menubar-help</span>
|
|
|
|
|
<a name="line-128"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-layout'>(</span><span class='hs-varid'>menubarHelpAbout</span> <span class='hs-varop'>.</span> <span class='hs-varid'>menubar</span><span class='hs-layout'>)</span> <span class='hs-varid'>mygui</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>menuItemActivated</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-129"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varid'>showAboutDialog</span>
|
|
|
|
|
<a name="line-130"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-131"></a>
|
|
|
|
|
<a name="line-132"></a> <span class='hs-comment'>-- key events</span>
|
|
|
|
|
<a name="line-133"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>rootWin</span> <span class='hs-varid'>mygui</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-134"></a> <span class='hs-conid'>QuitModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-135"></a> <span class='hs-conid'>QuitKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-136"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varid'>mainQuit</span>
|
|
|
|
|
<a name="line-137"></a>
|
|
|
|
|
<a name="line-138"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-139"></a>
|
|
|
|
|
<a name="line-140"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-141"></a>
|
|
|
|
|
<a name="line-142"></a>
|
|
|
|
|
<a name="line-143"></a><a name="setViewCallbacks"></a><span class='hs-comment'>-- |Set callbacks specific to a given view, on hotkeys, events and stuff.</span>
|
|
|
|
|
<a name="line-144"></a><span class='hs-definition'>setViewCallbacks</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-145"></a><span class='hs-definition'>setViewCallbacks</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-146"></a> <span class='hs-varid'>view'</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>readTVarIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>view</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-147"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>view'</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-148"></a> <span class='hs-varid'>fmv</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-conid'>FMTreeView</span> <span class='hs-varid'>treeView</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-149"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeView</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>rowActivated</span>
|
|
|
|
|
<a name="line-150"></a> <span class='hs-varop'>$</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>open</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-151"></a>
|
|
|
|
|
<a name="line-152"></a> <span class='hs-comment'>-- drag events</span>
|
|
|
|
|
<a name="line-153"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeView</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>dragBegin</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-154"></a> <span class='hs-keyglyph'>\</span><span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>moveInit</span>
|
|
|
|
|
<a name="line-155"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeView</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>dragDrop</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-156"></a> <span class='hs-keyglyph'>\</span><span class='hs-varid'>dc</span> <span class='hs-varid'>p</span> <span class='hs-varid'>ts</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-157"></a> <span class='hs-varid'>p'</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeViewConvertWidgetToTreeCoords</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>p</span>
|
|
|
|
|
<a name="line-158"></a> <span class='hs-varid'>mpath</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeViewGetPathAtPos</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>p'</span>
|
|
|
|
|
<a name="line-159"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>mpath</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-160"></a> <span class='hs-conid'>Nothing</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-161"></a> <span class='hs-varid'>dragFinish</span> <span class='hs-varid'>dc</span> <span class='hs-conid'>False</span> <span class='hs-conid'>False</span> <span class='hs-varid'>ts</span>
|
|
|
|
|
<a name="line-162"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>False</span>
|
|
|
|
|
<a name="line-163"></a> <span class='hs-conid'>Just</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-164"></a> <span class='hs-varid'>atom</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>atomNew</span> <span class='hs-layout'>(</span><span class='hs-str'>"HSFM"</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>String</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-165"></a> <span class='hs-varid'>dragGetData</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>dc</span> <span class='hs-varid'>atom</span> <span class='hs-varid'>ts</span>
|
|
|
|
|
<a name="line-166"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>True</span>
|
|
|
|
|
<a name="line-167"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeView</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>dragDataReceived</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-168"></a> <span class='hs-keyglyph'>\</span><span class='hs-varid'>dc</span> <span class='hs-varid'>p</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>ts</span> <span class='hs-keyglyph'>-></span>
|
|
|
|
|
<a name="line-169"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-170"></a> <span class='hs-varid'>signalStopEmission</span> <span class='hs-varid'>treeView</span> <span class='hs-str'>"drag_data_received"</span>
|
|
|
|
|
<a name="line-171"></a> <span class='hs-varid'>p'</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeViewConvertWidgetToTreeCoords</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>p</span>
|
|
|
|
|
<a name="line-172"></a> <span class='hs-varid'>mpath</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeViewGetPathAtPos</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>p'</span>
|
|
|
|
|
<a name="line-173"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>mpath</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-174"></a> <span class='hs-conid'>Nothing</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>dragFinish</span> <span class='hs-varid'>dc</span> <span class='hs-conid'>False</span> <span class='hs-conid'>False</span> <span class='hs-varid'>ts</span>
|
|
|
|
|
<a name="line-175"></a> <span class='hs-conid'>Just</span> <span class='hs-layout'>(</span><span class='hs-varid'>tp</span><span class='hs-layout'>,</span> <span class='hs-keyword'>_</span><span class='hs-layout'>,</span> <span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-176"></a> <span class='hs-varid'>mitem</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>rawPathToItem</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>tp</span>
|
|
|
|
|
<a name="line-177"></a> <span class='hs-varid'>forM_</span> <span class='hs-varid'>mitem</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>item</span> <span class='hs-keyglyph'>-></span>
|
|
|
|
|
<a name="line-178"></a> <span class='hs-varid'>operationFinal</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-layout'>(</span><span class='hs-conid'>Just</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-179"></a> <span class='hs-varid'>dragFinish</span> <span class='hs-varid'>dc</span> <span class='hs-conid'>True</span> <span class='hs-conid'>False</span> <span class='hs-varid'>ts</span>
|
|
|
|
|
<a name="line-180"></a>
|
|
|
|
|
<a name="line-181"></a> <span class='hs-varid'>commonGuiEvents</span> <span class='hs-varid'>fmv</span>
|
|
|
|
|
<a name="line-182"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-183"></a> <span class='hs-varid'>fmv</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-conid'>FMIconView</span> <span class='hs-varid'>iconView</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-184"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>iconView</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>itemActivated</span>
|
|
|
|
|
<a name="line-185"></a> <span class='hs-varop'>$</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>open</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-186"></a> <span class='hs-varid'>commonGuiEvents</span> <span class='hs-varid'>fmv</span>
|
|
|
|
|
<a name="line-187"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-188"></a> <span class='hs-keyword'>where</span>
|
|
|
|
|
<a name="line-189"></a> <span class='hs-varid'>commonGuiEvents</span> <span class='hs-varid'>fmv</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-190"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>view</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fmViewToContainer</span> <span class='hs-varid'>fmv</span>
|
|
|
|
|
<a name="line-191"></a>
|
|
|
|
|
<a name="line-192"></a> <span class='hs-comment'>-- GUI events</span>
|
|
|
|
|
<a name="line-193"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>backViewB</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>buttonPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-194"></a> <span class='hs-varid'>eb</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventButton</span>
|
|
|
|
|
<a name="line-195"></a> <span class='hs-varid'>t</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventTime</span>
|
|
|
|
|
<a name="line-196"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>eb</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-197"></a> <span class='hs-conid'>LeftButton</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-198"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>goHistoryBack</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-199"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>True</span>
|
|
|
|
|
<a name="line-200"></a> <span class='hs-conid'>RightButton</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-201"></a> <span class='hs-varid'>his</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>readMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>history</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-202"></a> <span class='hs-varid'>menu</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>mkHistoryMenuB</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-203"></a> <span class='hs-layout'>(</span><span class='hs-varid'>backwardsHistory</span> <span class='hs-varid'>his</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-204"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>menuPopup</span> <span class='hs-varid'>menu</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Just</span> <span class='hs-layout'>(</span><span class='hs-conid'>RightButton</span><span class='hs-layout'>,</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-205"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>True</span>
|
|
|
|
|
<a name="line-206"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>return</span> <span class='hs-conid'>False</span>
|
|
|
|
|
<a name="line-207"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>forwardViewB</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>buttonPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-208"></a> <span class='hs-varid'>eb</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventButton</span>
|
|
|
|
|
<a name="line-209"></a> <span class='hs-varid'>t</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventTime</span>
|
|
|
|
|
<a name="line-210"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>eb</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-211"></a> <span class='hs-conid'>LeftButton</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-212"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>goHistoryForward</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-213"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>True</span>
|
|
|
|
|
<a name="line-214"></a> <span class='hs-conid'>RightButton</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-215"></a> <span class='hs-varid'>his</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>readMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>history</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-216"></a> <span class='hs-varid'>menu</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>mkHistoryMenuF</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-217"></a> <span class='hs-layout'>(</span><span class='hs-varid'>forwardHistory</span> <span class='hs-varid'>his</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-218"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>menuPopup</span> <span class='hs-varid'>menu</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Just</span> <span class='hs-layout'>(</span><span class='hs-conid'>RightButton</span><span class='hs-layout'>,</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-219"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>True</span>
|
|
|
|
|
<a name="line-220"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>return</span> <span class='hs-conid'>False</span>
|
|
|
|
|
<a name="line-221"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>urlBar</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>entryActivated</span> <span class='hs-varop'>$</span> <span class='hs-varid'>urlGoTo</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-222"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>upViewB</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>buttonActivated</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-223"></a> <span class='hs-varid'>upDir</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-224"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>homeViewB</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>buttonActivated</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-225"></a> <span class='hs-varid'>goHome</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-226"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>refreshViewB</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>buttonActivated</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-227"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-228"></a> <span class='hs-varid'>refreshView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>cdir</span>
|
|
|
|
|
<a name="line-229"></a>
|
|
|
|
|
<a name="line-230"></a> <span class='hs-comment'>-- key events</span>
|
|
|
|
|
<a name="line-231"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-232"></a> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Control</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-233"></a> <span class='hs-str'>"h"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-234"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-235"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>modifyTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>settings</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-236"></a> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>x</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>x</span> <span class='hs-layout'>{</span> <span class='hs-varid'>showHidden</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>not</span> <span class='hs-varop'>.</span> <span class='hs-varid'>showHidden</span> <span class='hs-varop'>$</span> <span class='hs-varid'>x</span><span class='hs-layout'>}</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-237"></a> <span class='hs-varop'>>></span> <span class='hs-varid'>refreshView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>cdir</span>
|
|
|
|
|
<a name="line-238"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-239"></a> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Alt</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-240"></a> <span class='hs-str'>"Up"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-241"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>upDir</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-242"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-243"></a> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Alt</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-244"></a> <span class='hs-str'>"Left"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-245"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>goHistoryBack</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-246"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-247"></a> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Alt</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-248"></a> <span class='hs-str'>"Right"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-249"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>goHistoryForward</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-250"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>view</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-251"></a> <span class='hs-str'>"Delete"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-252"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>del</span>
|
|
|
|
|
<a name="line-253"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>view</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-254"></a> <span class='hs-conid'>[]</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-255"></a> <span class='hs-str'>"Return"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-256"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>open</span>
|
|
|
|
|
<a name="line-257"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>view</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-258"></a> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Control</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-259"></a> <span class='hs-str'>"c"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-260"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>copyInit</span>
|
|
|
|
|
<a name="line-261"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>view</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-262"></a> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Control</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-263"></a> <span class='hs-str'>"x"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-264"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>moveInit</span>
|
|
|
|
|
<a name="line-265"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-266"></a> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Control</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-267"></a> <span class='hs-str'>"v"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-268"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>operationFinal</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-conid'>Nothing</span>
|
|
|
|
|
<a name="line-269"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-270"></a> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Control</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-271"></a> <span class='hs-str'>"t"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-272"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>newTab'</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-273"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-274"></a> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Control</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-275"></a> <span class='hs-str'>"w"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-276"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>closeTab</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-277"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-278"></a> <span class='hs-str'>"F4"</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-140"></a>
|
|
|
|
|
<a name="line-141"></a><a name="setViewCallbacks"></a><span class='hs-comment'>-- |Set callbacks specific to a given view, on hotkeys, events and stuff.</span>
|
|
|
|
|
<a name="line-142"></a><span class='hs-definition'>setViewCallbacks</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-143"></a><span class='hs-definition'>setViewCallbacks</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-144"></a> <span class='hs-varid'>view'</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>readTVarIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>view</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-145"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>view'</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-146"></a> <span class='hs-varid'>fmv</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-conid'>FMTreeView</span> <span class='hs-varid'>treeView</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-147"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeView</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>rowActivated</span>
|
|
|
|
|
<a name="line-148"></a> <span class='hs-varop'>$</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>open</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-149"></a>
|
|
|
|
|
<a name="line-150"></a> <span class='hs-comment'>-- drag events</span>
|
|
|
|
|
<a name="line-151"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeView</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>dragBegin</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-152"></a> <span class='hs-keyglyph'>\</span><span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>moveInit</span>
|
|
|
|
|
<a name="line-153"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeView</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>dragDrop</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-154"></a> <span class='hs-keyglyph'>\</span><span class='hs-varid'>dc</span> <span class='hs-varid'>p</span> <span class='hs-varid'>ts</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-155"></a> <span class='hs-varid'>p'</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeViewConvertWidgetToTreeCoords</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>p</span>
|
|
|
|
|
<a name="line-156"></a> <span class='hs-varid'>mpath</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeViewGetPathAtPos</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>p'</span>
|
|
|
|
|
<a name="line-157"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>mpath</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-158"></a> <span class='hs-conid'>Nothing</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-159"></a> <span class='hs-varid'>dragFinish</span> <span class='hs-varid'>dc</span> <span class='hs-conid'>False</span> <span class='hs-conid'>False</span> <span class='hs-varid'>ts</span>
|
|
|
|
|
<a name="line-160"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>False</span>
|
|
|
|
|
<a name="line-161"></a> <span class='hs-conid'>Just</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-162"></a> <span class='hs-varid'>atom</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>atomNew</span> <span class='hs-layout'>(</span><span class='hs-str'>"HSFM"</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>String</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-163"></a> <span class='hs-varid'>dragGetData</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>dc</span> <span class='hs-varid'>atom</span> <span class='hs-varid'>ts</span>
|
|
|
|
|
<a name="line-164"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>True</span>
|
|
|
|
|
<a name="line-165"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeView</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>dragDataReceived</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-166"></a> <span class='hs-keyglyph'>\</span><span class='hs-varid'>dc</span> <span class='hs-varid'>p</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>ts</span> <span class='hs-keyglyph'>-></span>
|
|
|
|
|
<a name="line-167"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-168"></a> <span class='hs-varid'>signalStopEmission</span> <span class='hs-varid'>treeView</span> <span class='hs-str'>"drag_data_received"</span>
|
|
|
|
|
<a name="line-169"></a> <span class='hs-varid'>p'</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeViewConvertWidgetToTreeCoords</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>p</span>
|
|
|
|
|
<a name="line-170"></a> <span class='hs-varid'>mpath</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>treeViewGetPathAtPos</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>p'</span>
|
|
|
|
|
<a name="line-171"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>mpath</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-172"></a> <span class='hs-conid'>Nothing</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>dragFinish</span> <span class='hs-varid'>dc</span> <span class='hs-conid'>False</span> <span class='hs-conid'>False</span> <span class='hs-varid'>ts</span>
|
|
|
|
|
<a name="line-173"></a> <span class='hs-conid'>Just</span> <span class='hs-layout'>(</span><span class='hs-varid'>tp</span><span class='hs-layout'>,</span> <span class='hs-keyword'>_</span><span class='hs-layout'>,</span> <span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-174"></a> <span class='hs-varid'>mitem</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>rawPathToItem</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>tp</span>
|
|
|
|
|
<a name="line-175"></a> <span class='hs-varid'>forM_</span> <span class='hs-varid'>mitem</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>item</span> <span class='hs-keyglyph'>-></span>
|
|
|
|
|
<a name="line-176"></a> <span class='hs-varid'>operationFinal</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-layout'>(</span><span class='hs-conid'>Just</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-177"></a> <span class='hs-varid'>dragFinish</span> <span class='hs-varid'>dc</span> <span class='hs-conid'>True</span> <span class='hs-conid'>False</span> <span class='hs-varid'>ts</span>
|
|
|
|
|
<a name="line-178"></a>
|
|
|
|
|
<a name="line-179"></a> <span class='hs-varid'>commonGuiEvents</span> <span class='hs-varid'>fmv</span>
|
|
|
|
|
<a name="line-180"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-181"></a> <span class='hs-varid'>fmv</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-conid'>FMIconView</span> <span class='hs-varid'>iconView</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-182"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>iconView</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>itemActivated</span>
|
|
|
|
|
<a name="line-183"></a> <span class='hs-varop'>$</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>open</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-184"></a> <span class='hs-varid'>commonGuiEvents</span> <span class='hs-varid'>fmv</span>
|
|
|
|
|
<a name="line-185"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-186"></a> <span class='hs-keyword'>where</span>
|
|
|
|
|
<a name="line-187"></a> <span class='hs-varid'>commonGuiEvents</span> <span class='hs-varid'>fmv</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-188"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>view</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fmViewToContainer</span> <span class='hs-varid'>fmv</span>
|
|
|
|
|
<a name="line-189"></a>
|
|
|
|
|
<a name="line-190"></a> <span class='hs-comment'>-- GUI events</span>
|
|
|
|
|
<a name="line-191"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>backViewB</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>buttonPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-192"></a> <span class='hs-varid'>eb</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventButton</span>
|
|
|
|
|
<a name="line-193"></a> <span class='hs-varid'>t</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventTime</span>
|
|
|
|
|
<a name="line-194"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>eb</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-195"></a> <span class='hs-conid'>LeftButton</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-196"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>goHistoryBack</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-197"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>True</span>
|
|
|
|
|
<a name="line-198"></a> <span class='hs-conid'>RightButton</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-199"></a> <span class='hs-varid'>his</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>readMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>history</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-200"></a> <span class='hs-varid'>menu</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>mkHistoryMenuB</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-201"></a> <span class='hs-layout'>(</span><span class='hs-varid'>backwardsHistory</span> <span class='hs-varid'>his</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-202"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>menuPopup</span> <span class='hs-varid'>menu</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Just</span> <span class='hs-layout'>(</span><span class='hs-conid'>RightButton</span><span class='hs-layout'>,</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-203"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>True</span>
|
|
|
|
|
<a name="line-204"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>return</span> <span class='hs-conid'>False</span>
|
|
|
|
|
<a name="line-205"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>forwardViewB</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>buttonPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-206"></a> <span class='hs-varid'>eb</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventButton</span>
|
|
|
|
|
<a name="line-207"></a> <span class='hs-varid'>t</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventTime</span>
|
|
|
|
|
<a name="line-208"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>eb</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-209"></a> <span class='hs-conid'>LeftButton</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-210"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>goHistoryForward</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-211"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>True</span>
|
|
|
|
|
<a name="line-212"></a> <span class='hs-conid'>RightButton</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-213"></a> <span class='hs-varid'>his</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>readMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>history</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-214"></a> <span class='hs-varid'>menu</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>mkHistoryMenuF</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-215"></a> <span class='hs-layout'>(</span><span class='hs-varid'>forwardHistory</span> <span class='hs-varid'>his</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-216"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>menuPopup</span> <span class='hs-varid'>menu</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Just</span> <span class='hs-layout'>(</span><span class='hs-conid'>RightButton</span><span class='hs-layout'>,</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-217"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>True</span>
|
|
|
|
|
<a name="line-218"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>return</span> <span class='hs-conid'>False</span>
|
|
|
|
|
<a name="line-219"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>urlBar</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>entryActivated</span> <span class='hs-varop'>$</span> <span class='hs-varid'>urlGoTo</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-220"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>upViewB</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>buttonActivated</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-221"></a> <span class='hs-varid'>upDir</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-222"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>homeViewB</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>buttonActivated</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-223"></a> <span class='hs-varid'>goHome</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-224"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>refreshViewB</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>buttonActivated</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-225"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-226"></a> <span class='hs-varid'>refreshView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>cdir</span>
|
|
|
|
|
<a name="line-227"></a>
|
|
|
|
|
<a name="line-228"></a> <span class='hs-comment'>-- key events</span>
|
|
|
|
|
<a name="line-229"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-230"></a> <span class='hs-conid'>ShowHiddenModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-231"></a> <span class='hs-conid'>ShowHiddenKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-232"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-233"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>modifyTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>settings</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-234"></a> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>x</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>x</span> <span class='hs-layout'>{</span> <span class='hs-varid'>showHidden</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>not</span> <span class='hs-varop'>.</span> <span class='hs-varid'>showHidden</span> <span class='hs-varop'>$</span> <span class='hs-varid'>x</span><span class='hs-layout'>}</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-235"></a> <span class='hs-varop'>>></span> <span class='hs-varid'>refreshView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>cdir</span>
|
|
|
|
|
<a name="line-236"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-237"></a> <span class='hs-conid'>UpDirModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-238"></a> <span class='hs-conid'>UpDirKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-239"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>upDir</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-240"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-241"></a> <span class='hs-conid'>HistoryBackModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-242"></a> <span class='hs-conid'>HistoryBackKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-243"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>goHistoryBack</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-244"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-245"></a> <span class='hs-conid'>HistoryForwardModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-246"></a> <span class='hs-conid'>HistoryForwardKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-247"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>goHistoryForward</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-248"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>view</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-249"></a> <span class='hs-conid'>DeleteModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-250"></a> <span class='hs-conid'>DeleteKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-251"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>del</span>
|
|
|
|
|
<a name="line-252"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>view</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-253"></a> <span class='hs-conid'>OpenModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-254"></a> <span class='hs-conid'>OpenKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-255"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>open</span>
|
|
|
|
|
<a name="line-256"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>view</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-257"></a> <span class='hs-conid'>CopyModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-258"></a> <span class='hs-conid'>CopyKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-259"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>copyInit</span>
|
|
|
|
|
<a name="line-260"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>view</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-261"></a> <span class='hs-conid'>MoveModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-262"></a> <span class='hs-conid'>MoveKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-263"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>withItems</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>moveInit</span>
|
|
|
|
|
<a name="line-264"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-265"></a> <span class='hs-conid'>PasteModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-266"></a> <span class='hs-conid'>PasteKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-267"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>operationFinal</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-conid'>Nothing</span>
|
|
|
|
|
<a name="line-268"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-269"></a> <span class='hs-conid'>NewTabModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-270"></a> <span class='hs-conid'>NewTabKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-271"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>newTab'</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-272"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-273"></a> <span class='hs-conid'>CloseTabModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-274"></a> <span class='hs-conid'>CloseTabKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-275"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>closeTab</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-276"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>keyPressEvent</span> <span class='hs-varop'>$</span> <span class='hs-varid'>tryEvent</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-277"></a> <span class='hs-conid'>OpenTerminalModifier</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>eventModifier</span>
|
|
|
|
|
<a name="line-278"></a> <span class='hs-conid'>OpenTerminalKey</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>glibToString</span> <span class='hs-varid'>eventKeyName</span>
|
|
|
|
|
<a name="line-279"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>openTerminalHere</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-280"></a>
|
|
|
|
|
<a name="line-281"></a> <span class='hs-comment'>-- mouse button click</span>
|
|
|
|
@ -383,259 +383,258 @@
|
|
|
|
|
<a name="line-374"></a><a name="openTerminalHere"></a><span class='hs-definition'>openTerminalHere</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>ProcessID</span>
|
|
|
|
|
<a name="line-375"></a><span class='hs-definition'>openTerminalHere</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-376"></a> <span class='hs-varid'>cwd</span> <span class='hs-keyglyph'><-</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span><span class='hs-layout'>)</span> <span class='hs-varop'><$></span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-377"></a> <span class='hs-comment'>-- TODO: make terminal configurable</span>
|
|
|
|
|
<a name="line-378"></a> <span class='hs-conid'>SPP</span><span class='hs-varop'>.</span><span class='hs-varid'>forkProcess</span> <span class='hs-varop'>$</span> <span class='hs-conid'>SPP</span><span class='hs-varop'>.</span><span class='hs-varid'>executeFile</span> <span class='hs-str'>"sakura"</span> <span class='hs-conid'>True</span> <span class='hs-keyglyph'>[</span><span class='hs-str'>"-d"</span><span class='hs-layout'>,</span> <span class='hs-varid'>cwd</span><span class='hs-keyglyph'>]</span> <span class='hs-conid'>Nothing</span>
|
|
|
|
|
<a name="line-377"></a> <span class='hs-conid'>SPP</span><span class='hs-varop'>.</span><span class='hs-varid'>forkProcess</span> <span class='hs-varop'>$</span> <span class='hs-varid'>terminalCommand</span> <span class='hs-varid'>cwd</span>
|
|
|
|
|
<a name="line-378"></a>
|
|
|
|
|
<a name="line-379"></a>
|
|
|
|
|
<a name="line-380"></a>
|
|
|
|
|
<a name="line-381"></a>
|
|
|
|
|
<a name="line-382"></a>
|
|
|
|
|
<a name="line-383"></a><span class='hs-comment'>---- TAB OPERATIONS ----</span>
|
|
|
|
|
<a name="line-382"></a><span class='hs-comment'>---- TAB OPERATIONS ----</span>
|
|
|
|
|
<a name="line-383"></a>
|
|
|
|
|
<a name="line-384"></a>
|
|
|
|
|
<a name="line-385"></a>
|
|
|
|
|
<a name="line-386"></a><a name="closeTab"></a><span class='hs-comment'>-- |Closes the current tab, but only if there is more than one tab.</span>
|
|
|
|
|
<a name="line-387"></a><span class='hs-definition'>closeTab</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-388"></a><span class='hs-definition'>closeTab</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-389"></a> <span class='hs-varid'>n</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>notebookGetNPages</span> <span class='hs-layout'>(</span><span class='hs-varid'>notebook</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-390"></a> <span class='hs-varid'>when</span> <span class='hs-layout'>(</span><span class='hs-varid'>n</span> <span class='hs-varop'>></span> <span class='hs-num'>1</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>destroyView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-385"></a><a name="closeTab"></a><span class='hs-comment'>-- |Closes the current tab, but only if there is more than one tab.</span>
|
|
|
|
|
<a name="line-386"></a><span class='hs-definition'>closeTab</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-387"></a><span class='hs-definition'>closeTab</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-388"></a> <span class='hs-varid'>n</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>notebookGetNPages</span> <span class='hs-layout'>(</span><span class='hs-varid'>notebook</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-389"></a> <span class='hs-varid'>when</span> <span class='hs-layout'>(</span><span class='hs-varid'>n</span> <span class='hs-varop'>></span> <span class='hs-num'>1</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>destroyView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-390"></a>
|
|
|
|
|
<a name="line-391"></a>
|
|
|
|
|
<a name="line-392"></a>
|
|
|
|
|
<a name="line-393"></a><a name="newTab'"></a><span class='hs-definition'>newTab'</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-394"></a><span class='hs-definition'>newTab'</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-395"></a> <span class='hs-varid'>cwd</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-396"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-varid'>newTab</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>createTreeView</span> <span class='hs-varid'>cwd</span> <span class='hs-layout'>(</span><span class='hs-comment'>-</span><span class='hs-num'>1</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-392"></a><a name="newTab'"></a><span class='hs-definition'>newTab'</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-393"></a><span class='hs-definition'>newTab'</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-394"></a> <span class='hs-varid'>cwd</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-395"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-varid'>newTab</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>createTreeView</span> <span class='hs-varid'>cwd</span> <span class='hs-layout'>(</span><span class='hs-comment'>-</span><span class='hs-num'>1</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-396"></a>
|
|
|
|
|
<a name="line-397"></a>
|
|
|
|
|
<a name="line-398"></a>
|
|
|
|
|
<a name="line-399"></a><a name="opeInNewTab"></a><span class='hs-definition'>opeInNewTab</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Item</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-400"></a><span class='hs-definition'>opeInNewTab</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>item</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-conid'>DirOrSym</span> <span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span>
|
|
|
|
|
<a name="line-401"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-varid'>newTab</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>createTreeView</span> <span class='hs-varid'>item</span> <span class='hs-layout'>(</span><span class='hs-comment'>-</span><span class='hs-num'>1</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-402"></a><span class='hs-definition'>opeInNewTab</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-398"></a><a name="opeInNewTab"></a><span class='hs-definition'>opeInNewTab</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Item</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-399"></a><span class='hs-definition'>opeInNewTab</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>item</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-conid'>DirOrSym</span> <span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span>
|
|
|
|
|
<a name="line-400"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-varid'>newTab</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>createTreeView</span> <span class='hs-varid'>item</span> <span class='hs-layout'>(</span><span class='hs-comment'>-</span><span class='hs-num'>1</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-401"></a><span class='hs-definition'>opeInNewTab</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-402"></a>
|
|
|
|
|
<a name="line-403"></a>
|
|
|
|
|
<a name="line-404"></a>
|
|
|
|
|
<a name="line-405"></a>
|
|
|
|
|
<a name="line-406"></a><span class='hs-comment'>---- FILE OPERATION CALLBACKS (COPY, MOVE, ...) ----</span>
|
|
|
|
|
<a name="line-405"></a><span class='hs-comment'>---- FILE OPERATION CALLBACKS (COPY, MOVE, ...) ----</span>
|
|
|
|
|
<a name="line-406"></a>
|
|
|
|
|
<a name="line-407"></a>
|
|
|
|
|
<a name="line-408"></a>
|
|
|
|
|
<a name="line-409"></a><a name="del"></a><span class='hs-comment'>-- |Supposed to be used with 'withRows'. Deletes a file or directory.</span>
|
|
|
|
|
<a name="line-410"></a><span class='hs-definition'>del</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-411"></a><span class='hs-definition'>del</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-412"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>cmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"Really delete \""</span> <span class='hs-varop'>++</span> <span class='hs-varid'>getFPasStr</span> <span class='hs-varid'>item</span> <span class='hs-varop'>++</span> <span class='hs-str'>"\"?"</span>
|
|
|
|
|
<a name="line-413"></a> <span class='hs-varid'>withConfirmationDialog</span> <span class='hs-varid'>cmsg</span>
|
|
|
|
|
<a name="line-414"></a> <span class='hs-varop'>$</span> <span class='hs-varid'>easyDelete</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-415"></a><span class='hs-comment'>-- this throws on the first error that occurs</span>
|
|
|
|
|
<a name="line-416"></a><span class='hs-definition'>del</span> <span class='hs-varid'>items</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-keyword'>_</span><span class='hs-conop'>:</span><span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-417"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>cmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"Really delete "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-layout'>(</span><span class='hs-varid'>length</span> <span class='hs-varid'>items</span><span class='hs-layout'>)</span> <span class='hs-varop'>++</span> <span class='hs-str'>" files?"</span>
|
|
|
|
|
<a name="line-418"></a> <span class='hs-varid'>withConfirmationDialog</span> <span class='hs-varid'>cmsg</span>
|
|
|
|
|
<a name="line-419"></a> <span class='hs-varop'>$</span> <span class='hs-varid'>forM_</span> <span class='hs-varid'>items</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>item</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>easyDelete</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-420"></a><span class='hs-definition'>del</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span>
|
|
|
|
|
<a name="line-421"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>throwIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>InvalidOperation</span>
|
|
|
|
|
<a name="line-422"></a> <span class='hs-str'>"Operation not supported on multiple files"</span>
|
|
|
|
|
<a name="line-408"></a><a name="del"></a><span class='hs-comment'>-- |Supposed to be used with 'withRows'. Deletes a file or directory.</span>
|
|
|
|
|
<a name="line-409"></a><span class='hs-definition'>del</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-410"></a><span class='hs-definition'>del</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-411"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>cmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"Really delete \""</span> <span class='hs-varop'>++</span> <span class='hs-varid'>getFPasStr</span> <span class='hs-varid'>item</span> <span class='hs-varop'>++</span> <span class='hs-str'>"\"?"</span>
|
|
|
|
|
<a name="line-412"></a> <span class='hs-varid'>withConfirmationDialog</span> <span class='hs-varid'>cmsg</span>
|
|
|
|
|
<a name="line-413"></a> <span class='hs-varop'>$</span> <span class='hs-varid'>easyDelete</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-414"></a><span class='hs-comment'>-- this throws on the first error that occurs</span>
|
|
|
|
|
<a name="line-415"></a><span class='hs-definition'>del</span> <span class='hs-varid'>items</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-keyword'>_</span><span class='hs-conop'>:</span><span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-416"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>cmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"Really delete "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-layout'>(</span><span class='hs-varid'>length</span> <span class='hs-varid'>items</span><span class='hs-layout'>)</span> <span class='hs-varop'>++</span> <span class='hs-str'>" files?"</span>
|
|
|
|
|
<a name="line-417"></a> <span class='hs-varid'>withConfirmationDialog</span> <span class='hs-varid'>cmsg</span>
|
|
|
|
|
<a name="line-418"></a> <span class='hs-varop'>$</span> <span class='hs-varid'>forM_</span> <span class='hs-varid'>items</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>item</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>easyDelete</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-419"></a><span class='hs-definition'>del</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span>
|
|
|
|
|
<a name="line-420"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>throwIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>InvalidOperation</span>
|
|
|
|
|
<a name="line-421"></a> <span class='hs-str'>"Operation not supported on multiple files"</span>
|
|
|
|
|
<a name="line-422"></a>
|
|
|
|
|
<a name="line-423"></a>
|
|
|
|
|
<a name="line-424"></a>
|
|
|
|
|
<a name="line-425"></a><a name="moveInit"></a><span class='hs-comment'>-- |Initializes a file move operation.</span>
|
|
|
|
|
<a name="line-426"></a><span class='hs-definition'>moveInit</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-427"></a><span class='hs-definition'>moveInit</span> <span class='hs-varid'>items</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-keyword'>_</span><span class='hs-conop'>:</span><span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-varid'>mygui</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-428"></a> <span class='hs-varid'>writeTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>operationBuffer</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>FMove</span> <span class='hs-varop'>.</span> <span class='hs-conid'>PartialMove</span> <span class='hs-varop'>.</span> <span class='hs-varid'>map</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>items</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-429"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>sbmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>items</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-430"></a> <span class='hs-layout'>(</span><span class='hs-varid'>item</span><span class='hs-conop'>:</span><span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"Move buffer: "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>getFPasStr</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-431"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"Move buffer: "</span> <span class='hs-varop'>++</span> <span class='hs-layout'>(</span><span class='hs-varid'>show</span> <span class='hs-varop'>.</span> <span class='hs-varid'>length</span> <span class='hs-varop'>$</span> <span class='hs-varid'>items</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-432"></a> <span class='hs-varop'>++</span> <span class='hs-str'>" items"</span>
|
|
|
|
|
<a name="line-433"></a> <span class='hs-varid'>popStatusbar</span> <span class='hs-varid'>mygui</span>
|
|
|
|
|
<a name="line-434"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>pushStatusBar</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>sbmsg</span>
|
|
|
|
|
<a name="line-435"></a><span class='hs-definition'>moveInit</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span>
|
|
|
|
|
<a name="line-436"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>throwIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>InvalidOperation</span>
|
|
|
|
|
<a name="line-437"></a> <span class='hs-str'>"No file selected!"</span>
|
|
|
|
|
<a name="line-438"></a>
|
|
|
|
|
<a name="line-439"></a><a name="copyInit"></a><span class='hs-comment'>-- |Supposed to be used with 'withRows'. Initializes a file copy operation.</span>
|
|
|
|
|
<a name="line-440"></a><span class='hs-definition'>copyInit</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-441"></a><span class='hs-definition'>copyInit</span> <span class='hs-varid'>items</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-keyword'>_</span><span class='hs-conop'>:</span><span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-varid'>mygui</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-442"></a> <span class='hs-varid'>writeTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>operationBuffer</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>FCopy</span> <span class='hs-varop'>.</span> <span class='hs-conid'>PartialCopy</span> <span class='hs-varop'>.</span> <span class='hs-varid'>map</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>items</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-443"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>sbmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>items</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-444"></a> <span class='hs-layout'>(</span><span class='hs-varid'>item</span><span class='hs-conop'>:</span><span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"Copy buffer: "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>getFPasStr</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-445"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"Copy buffer: "</span> <span class='hs-varop'>++</span> <span class='hs-layout'>(</span><span class='hs-varid'>show</span> <span class='hs-varop'>.</span> <span class='hs-varid'>length</span> <span class='hs-varop'>$</span> <span class='hs-varid'>items</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-446"></a> <span class='hs-varop'>++</span> <span class='hs-str'>" items"</span>
|
|
|
|
|
<a name="line-447"></a> <span class='hs-varid'>popStatusbar</span> <span class='hs-varid'>mygui</span>
|
|
|
|
|
<a name="line-448"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>pushStatusBar</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>sbmsg</span>
|
|
|
|
|
<a name="line-449"></a><span class='hs-definition'>copyInit</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span>
|
|
|
|
|
<a name="line-450"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>throwIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>InvalidOperation</span>
|
|
|
|
|
<a name="line-451"></a> <span class='hs-str'>"No file selected!"</span>
|
|
|
|
|
<a name="line-424"></a><a name="moveInit"></a><span class='hs-comment'>-- |Initializes a file move operation.</span>
|
|
|
|
|
<a name="line-425"></a><span class='hs-definition'>moveInit</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-426"></a><span class='hs-definition'>moveInit</span> <span class='hs-varid'>items</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-keyword'>_</span><span class='hs-conop'>:</span><span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-varid'>mygui</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-427"></a> <span class='hs-varid'>writeTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>operationBuffer</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>FMove</span> <span class='hs-varop'>.</span> <span class='hs-conid'>PartialMove</span> <span class='hs-varop'>.</span> <span class='hs-varid'>map</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>items</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-428"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>sbmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>items</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-429"></a> <span class='hs-layout'>(</span><span class='hs-varid'>item</span><span class='hs-conop'>:</span><span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"Move buffer: "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>getFPasStr</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-430"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"Move buffer: "</span> <span class='hs-varop'>++</span> <span class='hs-layout'>(</span><span class='hs-varid'>show</span> <span class='hs-varop'>.</span> <span class='hs-varid'>length</span> <span class='hs-varop'>$</span> <span class='hs-varid'>items</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-431"></a> <span class='hs-varop'>++</span> <span class='hs-str'>" items"</span>
|
|
|
|
|
<a name="line-432"></a> <span class='hs-varid'>popStatusbar</span> <span class='hs-varid'>mygui</span>
|
|
|
|
|
<a name="line-433"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>pushStatusBar</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>sbmsg</span>
|
|
|
|
|
<a name="line-434"></a><span class='hs-definition'>moveInit</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span>
|
|
|
|
|
<a name="line-435"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>throwIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>InvalidOperation</span>
|
|
|
|
|
<a name="line-436"></a> <span class='hs-str'>"No file selected!"</span>
|
|
|
|
|
<a name="line-437"></a>
|
|
|
|
|
<a name="line-438"></a><a name="copyInit"></a><span class='hs-comment'>-- |Supposed to be used with 'withRows'. Initializes a file copy operation.</span>
|
|
|
|
|
<a name="line-439"></a><span class='hs-definition'>copyInit</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-440"></a><span class='hs-definition'>copyInit</span> <span class='hs-varid'>items</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-keyword'>_</span><span class='hs-conop'>:</span><span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-varid'>mygui</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-441"></a> <span class='hs-varid'>writeTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>operationBuffer</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>FCopy</span> <span class='hs-varop'>.</span> <span class='hs-conid'>PartialCopy</span> <span class='hs-varop'>.</span> <span class='hs-varid'>map</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>items</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-442"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>sbmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>items</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-443"></a> <span class='hs-layout'>(</span><span class='hs-varid'>item</span><span class='hs-conop'>:</span><span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"Copy buffer: "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>getFPasStr</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-444"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"Copy buffer: "</span> <span class='hs-varop'>++</span> <span class='hs-layout'>(</span><span class='hs-varid'>show</span> <span class='hs-varop'>.</span> <span class='hs-varid'>length</span> <span class='hs-varop'>$</span> <span class='hs-varid'>items</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-445"></a> <span class='hs-varop'>++</span> <span class='hs-str'>" items"</span>
|
|
|
|
|
<a name="line-446"></a> <span class='hs-varid'>popStatusbar</span> <span class='hs-varid'>mygui</span>
|
|
|
|
|
<a name="line-447"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>pushStatusBar</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>sbmsg</span>
|
|
|
|
|
<a name="line-448"></a><span class='hs-definition'>copyInit</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span>
|
|
|
|
|
<a name="line-449"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>throwIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>InvalidOperation</span>
|
|
|
|
|
<a name="line-450"></a> <span class='hs-str'>"No file selected!"</span>
|
|
|
|
|
<a name="line-451"></a>
|
|
|
|
|
<a name="line-452"></a>
|
|
|
|
|
<a name="line-453"></a>
|
|
|
|
|
<a name="line-454"></a><a name="operationFinal"></a><span class='hs-comment'>-- |Finalizes a file operation, such as copy or move.</span>
|
|
|
|
|
<a name="line-455"></a><span class='hs-definition'>operationFinal</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Maybe</span> <span class='hs-conid'>Item</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-456"></a><span class='hs-definition'>operationFinal</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>mitem</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-457"></a> <span class='hs-varid'>op</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>readTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>operationBuffer</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-458"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'><-</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>mitem</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-459"></a> <span class='hs-conid'>Nothing</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>path</span> <span class='hs-varop'><$></span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-460"></a> <span class='hs-conid'>Just</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>path</span> <span class='hs-varid'>x</span>
|
|
|
|
|
<a name="line-461"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>op</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-462"></a> <span class='hs-conid'>FMove</span> <span class='hs-layout'>(</span><span class='hs-conid'>PartialMove</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-463"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>cmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"Really move "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>imsg</span> <span class='hs-varid'>s</span>
|
|
|
|
|
<a name="line-464"></a> <span class='hs-varop'>++</span> <span class='hs-str'>" to \""</span> <span class='hs-varop'>++</span> <span class='hs-varid'>toString</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varid'>cdir</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-465"></a> <span class='hs-varop'>++</span> <span class='hs-str'>"\"?"</span>
|
|
|
|
|
<a name="line-466"></a> <span class='hs-varid'>withConfirmationDialog</span> <span class='hs-varid'>cmsg</span> <span class='hs-varop'>$</span> <span class='hs-varid'>doFileOperation</span> <span class='hs-layout'>(</span><span class='hs-conid'>FMove</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Move</span> <span class='hs-varid'>s</span> <span class='hs-varid'>cdir</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-467"></a> <span class='hs-varid'>popStatusbar</span> <span class='hs-varid'>mygui</span>
|
|
|
|
|
<a name="line-468"></a> <span class='hs-varid'>writeTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>operationBuffer</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-conid'>None</span>
|
|
|
|
|
<a name="line-469"></a> <span class='hs-conid'>FCopy</span> <span class='hs-layout'>(</span><span class='hs-conid'>PartialCopy</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-470"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>cmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"Really copy "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>imsg</span> <span class='hs-varid'>s</span>
|
|
|
|
|
<a name="line-471"></a> <span class='hs-varop'>++</span> <span class='hs-str'>" to \""</span> <span class='hs-varop'>++</span> <span class='hs-varid'>toString</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varid'>cdir</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-472"></a> <span class='hs-varop'>++</span> <span class='hs-str'>"\"?"</span>
|
|
|
|
|
<a name="line-473"></a> <span class='hs-varid'>withConfirmationDialog</span> <span class='hs-varid'>cmsg</span> <span class='hs-varop'>$</span> <span class='hs-varid'>doFileOperation</span> <span class='hs-layout'>(</span><span class='hs-conid'>FCopy</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Copy</span> <span class='hs-varid'>s</span> <span class='hs-varid'>cdir</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-474"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-475"></a> <span class='hs-keyword'>where</span>
|
|
|
|
|
<a name="line-476"></a> <span class='hs-varid'>imsg</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>s</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-477"></a> <span class='hs-layout'>(</span><span class='hs-varid'>item</span><span class='hs-conop'>:</span><span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"\""</span> <span class='hs-varop'>++</span> <span class='hs-varid'>toString</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span> <span class='hs-varop'>++</span> <span class='hs-str'>"\""</span>
|
|
|
|
|
<a name="line-478"></a> <span class='hs-varid'>items</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>show</span> <span class='hs-varop'>.</span> <span class='hs-varid'>length</span> <span class='hs-varop'>$</span> <span class='hs-varid'>items</span><span class='hs-layout'>)</span> <span class='hs-varop'>++</span> <span class='hs-str'>" items"</span>
|
|
|
|
|
<a name="line-453"></a><a name="operationFinal"></a><span class='hs-comment'>-- |Finalizes a file operation, such as copy or move.</span>
|
|
|
|
|
<a name="line-454"></a><span class='hs-definition'>operationFinal</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Maybe</span> <span class='hs-conid'>Item</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-455"></a><span class='hs-definition'>operationFinal</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>mitem</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-456"></a> <span class='hs-varid'>op</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>readTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>operationBuffer</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-457"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'><-</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>mitem</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-458"></a> <span class='hs-conid'>Nothing</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>path</span> <span class='hs-varop'><$></span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-459"></a> <span class='hs-conid'>Just</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>path</span> <span class='hs-varid'>x</span>
|
|
|
|
|
<a name="line-460"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>op</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-461"></a> <span class='hs-conid'>FMove</span> <span class='hs-layout'>(</span><span class='hs-conid'>PartialMove</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-462"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>cmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"Really move "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>imsg</span> <span class='hs-varid'>s</span>
|
|
|
|
|
<a name="line-463"></a> <span class='hs-varop'>++</span> <span class='hs-str'>" to \""</span> <span class='hs-varop'>++</span> <span class='hs-varid'>toString</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varid'>cdir</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-464"></a> <span class='hs-varop'>++</span> <span class='hs-str'>"\"?"</span>
|
|
|
|
|
<a name="line-465"></a> <span class='hs-varid'>withConfirmationDialog</span> <span class='hs-varid'>cmsg</span> <span class='hs-varop'>$</span> <span class='hs-varid'>doFileOperation</span> <span class='hs-layout'>(</span><span class='hs-conid'>FMove</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Move</span> <span class='hs-varid'>s</span> <span class='hs-varid'>cdir</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-466"></a> <span class='hs-varid'>popStatusbar</span> <span class='hs-varid'>mygui</span>
|
|
|
|
|
<a name="line-467"></a> <span class='hs-varid'>writeTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>operationBuffer</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-conid'>None</span>
|
|
|
|
|
<a name="line-468"></a> <span class='hs-conid'>FCopy</span> <span class='hs-layout'>(</span><span class='hs-conid'>PartialCopy</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-469"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>cmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"Really copy "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>imsg</span> <span class='hs-varid'>s</span>
|
|
|
|
|
<a name="line-470"></a> <span class='hs-varop'>++</span> <span class='hs-str'>" to \""</span> <span class='hs-varop'>++</span> <span class='hs-varid'>toString</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varid'>cdir</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-471"></a> <span class='hs-varop'>++</span> <span class='hs-str'>"\"?"</span>
|
|
|
|
|
<a name="line-472"></a> <span class='hs-varid'>withConfirmationDialog</span> <span class='hs-varid'>cmsg</span> <span class='hs-varop'>$</span> <span class='hs-varid'>doFileOperation</span> <span class='hs-layout'>(</span><span class='hs-conid'>FCopy</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Copy</span> <span class='hs-varid'>s</span> <span class='hs-varid'>cdir</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-473"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-474"></a> <span class='hs-keyword'>where</span>
|
|
|
|
|
<a name="line-475"></a> <span class='hs-varid'>imsg</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>s</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-476"></a> <span class='hs-layout'>(</span><span class='hs-varid'>item</span><span class='hs-conop'>:</span><span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-str'>"\""</span> <span class='hs-varop'>++</span> <span class='hs-varid'>toString</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span> <span class='hs-varop'>++</span> <span class='hs-str'>"\""</span>
|
|
|
|
|
<a name="line-477"></a> <span class='hs-varid'>items</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>show</span> <span class='hs-varop'>.</span> <span class='hs-varid'>length</span> <span class='hs-varop'>$</span> <span class='hs-varid'>items</span><span class='hs-layout'>)</span> <span class='hs-varop'>++</span> <span class='hs-str'>" items"</span>
|
|
|
|
|
<a name="line-478"></a>
|
|
|
|
|
<a name="line-479"></a>
|
|
|
|
|
<a name="line-480"></a>
|
|
|
|
|
<a name="line-481"></a><a name="newFile"></a><span class='hs-comment'>-- |Create a new file.</span>
|
|
|
|
|
<a name="line-482"></a><span class='hs-definition'>newFile</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-483"></a><span class='hs-definition'>newFile</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-484"></a> <span class='hs-varid'>mfn</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>textInputDialog</span> <span class='hs-str'>"Enter file name"</span> <span class='hs-layout'>(</span><span class='hs-str'>""</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>String</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-485"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>pmfn</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>parseFn</span> <span class='hs-varop'>=<<</span> <span class='hs-varid'>fromString</span> <span class='hs-varop'><$></span> <span class='hs-varid'>mfn</span>
|
|
|
|
|
<a name="line-486"></a> <span class='hs-varid'>for_</span> <span class='hs-varid'>pmfn</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>fn</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-487"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-488"></a> <span class='hs-varid'>createRegularFile</span> <span class='hs-varid'>newFilePerms</span> <span class='hs-layout'>(</span><span class='hs-varid'>path</span> <span class='hs-varid'>cdir</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</></span> <span class='hs-varid'>fn</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-480"></a><a name="newFile"></a><span class='hs-comment'>-- |Create a new file.</span>
|
|
|
|
|
<a name="line-481"></a><span class='hs-definition'>newFile</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-482"></a><span class='hs-definition'>newFile</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-483"></a> <span class='hs-varid'>mfn</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>textInputDialog</span> <span class='hs-str'>"Enter file name"</span> <span class='hs-layout'>(</span><span class='hs-str'>""</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>String</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-484"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>pmfn</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>parseFn</span> <span class='hs-varop'>=<<</span> <span class='hs-varid'>fromString</span> <span class='hs-varop'><$></span> <span class='hs-varid'>mfn</span>
|
|
|
|
|
<a name="line-485"></a> <span class='hs-varid'>for_</span> <span class='hs-varid'>pmfn</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>fn</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-486"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-487"></a> <span class='hs-varid'>createRegularFile</span> <span class='hs-varid'>newFilePerms</span> <span class='hs-layout'>(</span><span class='hs-varid'>path</span> <span class='hs-varid'>cdir</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</></span> <span class='hs-varid'>fn</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-488"></a>
|
|
|
|
|
<a name="line-489"></a>
|
|
|
|
|
<a name="line-490"></a>
|
|
|
|
|
<a name="line-491"></a><a name="newDir"></a><span class='hs-comment'>-- |Create a new directory.</span>
|
|
|
|
|
<a name="line-492"></a><span class='hs-definition'>newDir</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-493"></a><span class='hs-definition'>newDir</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-494"></a> <span class='hs-varid'>mfn</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>textInputDialog</span> <span class='hs-str'>"Enter directory name"</span> <span class='hs-layout'>(</span><span class='hs-str'>""</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>String</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-495"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>pmfn</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>parseFn</span> <span class='hs-varop'>=<<</span> <span class='hs-varid'>fromString</span> <span class='hs-varop'><$></span> <span class='hs-varid'>mfn</span>
|
|
|
|
|
<a name="line-496"></a> <span class='hs-varid'>for_</span> <span class='hs-varid'>pmfn</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>fn</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-497"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-498"></a> <span class='hs-varid'>createDir</span> <span class='hs-varid'>newDirPerms</span> <span class='hs-layout'>(</span><span class='hs-varid'>path</span> <span class='hs-varid'>cdir</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</></span> <span class='hs-varid'>fn</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-490"></a><a name="newDir"></a><span class='hs-comment'>-- |Create a new directory.</span>
|
|
|
|
|
<a name="line-491"></a><span class='hs-definition'>newDir</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-492"></a><span class='hs-definition'>newDir</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-493"></a> <span class='hs-varid'>mfn</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>textInputDialog</span> <span class='hs-str'>"Enter directory name"</span> <span class='hs-layout'>(</span><span class='hs-str'>""</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>String</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-494"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>pmfn</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>parseFn</span> <span class='hs-varop'>=<<</span> <span class='hs-varid'>fromString</span> <span class='hs-varop'><$></span> <span class='hs-varid'>mfn</span>
|
|
|
|
|
<a name="line-495"></a> <span class='hs-varid'>for_</span> <span class='hs-varid'>pmfn</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>fn</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-496"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-497"></a> <span class='hs-varid'>createDir</span> <span class='hs-varid'>newDirPerms</span> <span class='hs-layout'>(</span><span class='hs-varid'>path</span> <span class='hs-varid'>cdir</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</></span> <span class='hs-varid'>fn</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-498"></a>
|
|
|
|
|
<a name="line-499"></a>
|
|
|
|
|
<a name="line-500"></a>
|
|
|
|
|
<a name="line-501"></a><a name="renameF"></a><span class='hs-definition'>renameF</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-502"></a><span class='hs-definition'>renameF</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-503"></a> <span class='hs-varid'>iname</span> <span class='hs-keyglyph'><-</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromRel</span> <span class='hs-varop'><$></span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>basename</span> <span class='hs-varop'>$</span> <span class='hs-varid'>path</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-504"></a> <span class='hs-varid'>mfn</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>textInputDialog</span> <span class='hs-str'>"Enter new file name"</span> <span class='hs-layout'>(</span><span class='hs-varid'>iname</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ByteString</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-505"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>pmfn</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>parseFn</span> <span class='hs-varop'>=<<</span> <span class='hs-varid'>fromString</span> <span class='hs-varop'><$></span> <span class='hs-varid'>mfn</span>
|
|
|
|
|
<a name="line-506"></a> <span class='hs-varid'>for_</span> <span class='hs-varid'>pmfn</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>fn</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-507"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>cmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"Really rename \""</span> <span class='hs-varop'>++</span> <span class='hs-varid'>getFPasStr</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-508"></a> <span class='hs-varop'>++</span> <span class='hs-str'>"\""</span> <span class='hs-varop'>++</span> <span class='hs-str'>" to \""</span>
|
|
|
|
|
<a name="line-509"></a> <span class='hs-varop'>++</span> <span class='hs-varid'>toString</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varop'>$</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>dirname</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-510"></a> <span class='hs-conid'>P</span><span class='hs-varop'>.</></span> <span class='hs-varid'>fn</span><span class='hs-layout'>)</span> <span class='hs-varop'>++</span> <span class='hs-str'>"\"?"</span>
|
|
|
|
|
<a name="line-511"></a> <span class='hs-varid'>withConfirmationDialog</span> <span class='hs-varid'>cmsg</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-512"></a> <span class='hs-conid'>HPath</span><span class='hs-varop'>.</span><span class='hs-conid'>IO</span><span class='hs-varop'>.</span><span class='hs-varid'>renameFile</span> <span class='hs-layout'>(</span><span class='hs-varid'>path</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-513"></a> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>dirname</span> <span class='hs-varop'>$</span> <span class='hs-varid'>path</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</></span> <span class='hs-varid'>fn</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-514"></a><span class='hs-definition'>renameF</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span>
|
|
|
|
|
<a name="line-515"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>throwIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>InvalidOperation</span>
|
|
|
|
|
<a name="line-516"></a> <span class='hs-str'>"Operation not supported on multiple files"</span>
|
|
|
|
|
<a name="line-500"></a><a name="renameF"></a><span class='hs-definition'>renameF</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-501"></a><span class='hs-definition'>renameF</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-502"></a> <span class='hs-varid'>iname</span> <span class='hs-keyglyph'><-</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromRel</span> <span class='hs-varop'><$></span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>basename</span> <span class='hs-varop'>$</span> <span class='hs-varid'>path</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-503"></a> <span class='hs-varid'>mfn</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>textInputDialog</span> <span class='hs-str'>"Enter new file name"</span> <span class='hs-layout'>(</span><span class='hs-varid'>iname</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ByteString</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-504"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>pmfn</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>parseFn</span> <span class='hs-varop'>=<<</span> <span class='hs-varid'>fromString</span> <span class='hs-varop'><$></span> <span class='hs-varid'>mfn</span>
|
|
|
|
|
<a name="line-505"></a> <span class='hs-varid'>for_</span> <span class='hs-varid'>pmfn</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>fn</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-506"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>cmsg</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"Really rename \""</span> <span class='hs-varop'>++</span> <span class='hs-varid'>getFPasStr</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-507"></a> <span class='hs-varop'>++</span> <span class='hs-str'>"\""</span> <span class='hs-varop'>++</span> <span class='hs-str'>" to \""</span>
|
|
|
|
|
<a name="line-508"></a> <span class='hs-varop'>++</span> <span class='hs-varid'>toString</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varop'>$</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>dirname</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-509"></a> <span class='hs-conid'>P</span><span class='hs-varop'>.</></span> <span class='hs-varid'>fn</span><span class='hs-layout'>)</span> <span class='hs-varop'>++</span> <span class='hs-str'>"\"?"</span>
|
|
|
|
|
<a name="line-510"></a> <span class='hs-varid'>withConfirmationDialog</span> <span class='hs-varid'>cmsg</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-511"></a> <span class='hs-conid'>HPath</span><span class='hs-varop'>.</span><span class='hs-conid'>IO</span><span class='hs-varop'>.</span><span class='hs-varid'>renameFile</span> <span class='hs-layout'>(</span><span class='hs-varid'>path</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-512"></a> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>dirname</span> <span class='hs-varop'>$</span> <span class='hs-varid'>path</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</></span> <span class='hs-varid'>fn</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-513"></a><span class='hs-definition'>renameF</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span>
|
|
|
|
|
<a name="line-514"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>throwIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>InvalidOperation</span>
|
|
|
|
|
<a name="line-515"></a> <span class='hs-str'>"Operation not supported on multiple files"</span>
|
|
|
|
|
<a name="line-516"></a>
|
|
|
|
|
<a name="line-517"></a>
|
|
|
|
|
<a name="line-518"></a>
|
|
|
|
|
<a name="line-519"></a>
|
|
|
|
|
<a name="line-520"></a>
|
|
|
|
|
<a name="line-521"></a><span class='hs-comment'>---- DIRECTORY TRAVERSAL AND FILE OPENING CALLBACKS ----</span>
|
|
|
|
|
<a name="line-520"></a><span class='hs-comment'>---- DIRECTORY TRAVERSAL AND FILE OPENING CALLBACKS ----</span>
|
|
|
|
|
<a name="line-521"></a>
|
|
|
|
|
<a name="line-522"></a>
|
|
|
|
|
<a name="line-523"></a>
|
|
|
|
|
<a name="line-524"></a><a name="urlGoTo"></a><span class='hs-comment'>-- |Go to the url given at the 'urlBar' and visualize it in the given</span>
|
|
|
|
|
<a name="line-525"></a><span class='hs-comment'>-- treeView.</span>
|
|
|
|
|
<a name="line-526"></a><span class='hs-comment'>--</span>
|
|
|
|
|
<a name="line-527"></a><span class='hs-comment'>-- If the url is invalid, does nothing.</span>
|
|
|
|
|
<a name="line-528"></a><span class='hs-definition'>urlGoTo</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-529"></a><span class='hs-definition'>urlGoTo</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-530"></a> <span class='hs-varid'>fp</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>entryGetText</span> <span class='hs-layout'>(</span><span class='hs-varid'>urlBar</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-531"></a> <span class='hs-varid'>forM_</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>parseAbs</span> <span class='hs-varid'>fp</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Maybe</span> <span class='hs-layout'>(</span><span class='hs-conid'>Path</span> <span class='hs-conid'>Abs</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>fp'</span> <span class='hs-keyglyph'>-></span>
|
|
|
|
|
<a name="line-532"></a> <span class='hs-varid'>whenM</span> <span class='hs-layout'>(</span><span class='hs-varid'>canOpenDirectory</span> <span class='hs-varid'>fp'</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-533"></a> <span class='hs-layout'>(</span><span class='hs-varid'>goDir</span> <span class='hs-conid'>True</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>=<<</span> <span class='hs-layout'>(</span><span class='hs-varid'>readFile</span> <span class='hs-varid'>getFileInfo</span> <span class='hs-varop'>$</span> <span class='hs-varid'>fp'</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-523"></a><a name="urlGoTo"></a><span class='hs-comment'>-- |Go to the url given at the 'urlBar' and visualize it in the given</span>
|
|
|
|
|
<a name="line-524"></a><span class='hs-comment'>-- treeView.</span>
|
|
|
|
|
<a name="line-525"></a><span class='hs-comment'>--</span>
|
|
|
|
|
<a name="line-526"></a><span class='hs-comment'>-- If the url is invalid, does nothing.</span>
|
|
|
|
|
<a name="line-527"></a><span class='hs-definition'>urlGoTo</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-528"></a><span class='hs-definition'>urlGoTo</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-529"></a> <span class='hs-varid'>fp</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>entryGetText</span> <span class='hs-layout'>(</span><span class='hs-varid'>urlBar</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-530"></a> <span class='hs-varid'>forM_</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>parseAbs</span> <span class='hs-varid'>fp</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Maybe</span> <span class='hs-layout'>(</span><span class='hs-conid'>Path</span> <span class='hs-conid'>Abs</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>fp'</span> <span class='hs-keyglyph'>-></span>
|
|
|
|
|
<a name="line-531"></a> <span class='hs-varid'>whenM</span> <span class='hs-layout'>(</span><span class='hs-varid'>canOpenDirectory</span> <span class='hs-varid'>fp'</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-532"></a> <span class='hs-layout'>(</span><span class='hs-varid'>goDir</span> <span class='hs-conid'>True</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>=<<</span> <span class='hs-layout'>(</span><span class='hs-varid'>readFile</span> <span class='hs-varid'>getFileInfo</span> <span class='hs-varop'>$</span> <span class='hs-varid'>fp'</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-533"></a>
|
|
|
|
|
<a name="line-534"></a>
|
|
|
|
|
<a name="line-535"></a>
|
|
|
|
|
<a name="line-536"></a><a name="goHome"></a><span class='hs-definition'>goHome</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-537"></a><span class='hs-definition'>goHome</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-538"></a> <span class='hs-varid'>mhomedir</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>getEnv</span> <span class='hs-str'>"HOME"</span>
|
|
|
|
|
<a name="line-539"></a> <span class='hs-varid'>forM_</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>parseAbs</span> <span class='hs-varop'>=<<</span> <span class='hs-varid'>mhomedir</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Maybe</span> <span class='hs-layout'>(</span><span class='hs-conid'>Path</span> <span class='hs-conid'>Abs</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>fp'</span> <span class='hs-keyglyph'>-></span>
|
|
|
|
|
<a name="line-540"></a> <span class='hs-varid'>whenM</span> <span class='hs-layout'>(</span><span class='hs-varid'>canOpenDirectory</span> <span class='hs-varid'>fp'</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-541"></a> <span class='hs-layout'>(</span><span class='hs-varid'>goDir</span> <span class='hs-conid'>True</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>=<<</span> <span class='hs-layout'>(</span><span class='hs-varid'>readFile</span> <span class='hs-varid'>getFileInfo</span> <span class='hs-varop'>$</span> <span class='hs-varid'>fp'</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-535"></a><a name="goHome"></a><span class='hs-definition'>goHome</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-536"></a><span class='hs-definition'>goHome</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-537"></a> <span class='hs-varid'>homedir</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>home</span>
|
|
|
|
|
<a name="line-538"></a> <span class='hs-varid'>forM_</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>parseAbs</span> <span class='hs-varid'>homedir</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Maybe</span> <span class='hs-layout'>(</span><span class='hs-conid'>Path</span> <span class='hs-conid'>Abs</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>fp'</span> <span class='hs-keyglyph'>-></span>
|
|
|
|
|
<a name="line-539"></a> <span class='hs-varid'>whenM</span> <span class='hs-layout'>(</span><span class='hs-varid'>canOpenDirectory</span> <span class='hs-varid'>fp'</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-540"></a> <span class='hs-layout'>(</span><span class='hs-varid'>goDir</span> <span class='hs-conid'>True</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varop'>=<<</span> <span class='hs-layout'>(</span><span class='hs-varid'>readFile</span> <span class='hs-varid'>getFileInfo</span> <span class='hs-varop'>$</span> <span class='hs-varid'>fp'</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-541"></a>
|
|
|
|
|
<a name="line-542"></a>
|
|
|
|
|
<a name="line-543"></a>
|
|
|
|
|
<a name="line-544"></a><a name="execute"></a><span class='hs-comment'>-- |Execute a given file.</span>
|
|
|
|
|
<a name="line-545"></a><span class='hs-definition'>execute</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-546"></a><span class='hs-definition'>execute</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-547"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>executeFile</span> <span class='hs-layout'>(</span><span class='hs-varid'>path</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span> <span class='hs-conid'>[]</span>
|
|
|
|
|
<a name="line-548"></a><span class='hs-definition'>execute</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span>
|
|
|
|
|
<a name="line-549"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>throwIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>InvalidOperation</span>
|
|
|
|
|
<a name="line-550"></a> <span class='hs-str'>"Operation not supported on multiple files"</span>
|
|
|
|
|
<a name="line-543"></a><a name="execute"></a><span class='hs-comment'>-- |Execute a given file.</span>
|
|
|
|
|
<a name="line-544"></a><span class='hs-definition'>execute</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-545"></a><span class='hs-definition'>execute</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-546"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>executeFile</span> <span class='hs-layout'>(</span><span class='hs-varid'>path</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span> <span class='hs-conid'>[]</span>
|
|
|
|
|
<a name="line-547"></a><span class='hs-definition'>execute</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span>
|
|
|
|
|
<a name="line-548"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>throwIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>InvalidOperation</span>
|
|
|
|
|
<a name="line-549"></a> <span class='hs-str'>"Operation not supported on multiple files"</span>
|
|
|
|
|
<a name="line-550"></a>
|
|
|
|
|
<a name="line-551"></a>
|
|
|
|
|
<a name="line-552"></a>
|
|
|
|
|
<a name="line-553"></a><a name="open"></a><span class='hs-comment'>-- |Supposed to be used with 'withRows'. Opens a file or directory.</span>
|
|
|
|
|
<a name="line-554"></a><span class='hs-definition'>open</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-555"></a><span class='hs-definition'>open</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>item</span><span class='hs-keyglyph'>]</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-556"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>item</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-557"></a> <span class='hs-conid'>DirOrSym</span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-558"></a> <span class='hs-varid'>nv</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>readFile</span> <span class='hs-varid'>getFileInfo</span> <span class='hs-varop'>$</span> <span class='hs-varid'>path</span> <span class='hs-varid'>r</span>
|
|
|
|
|
<a name="line-559"></a> <span class='hs-varid'>goDir</span> <span class='hs-conid'>True</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>nv</span>
|
|
|
|
|
<a name="line-560"></a> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span>
|
|
|
|
|
<a name="line-561"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>openFile</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>r</span>
|
|
|
|
|
<a name="line-562"></a><span class='hs-definition'>open</span> <span class='hs-varid'>items</span> <span class='hs-varid'>mygui</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-563"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>dirs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>filter</span> <span class='hs-layout'>(</span><span class='hs-varid'>fst</span> <span class='hs-varop'>.</span> <span class='hs-varid'>sdir</span><span class='hs-layout'>)</span> <span class='hs-varid'>items</span>
|
|
|
|
|
<a name="line-564"></a> <span class='hs-varid'>files</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>filter</span> <span class='hs-layout'>(</span><span class='hs-varid'>fst</span> <span class='hs-varop'>.</span> <span class='hs-varid'>sfileLike</span><span class='hs-layout'>)</span> <span class='hs-varid'>items</span>
|
|
|
|
|
<a name="line-565"></a> <span class='hs-varid'>forM_</span> <span class='hs-varid'>dirs</span> <span class='hs-layout'>(</span><span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>.</span> <span class='hs-varid'>opeInNewTab</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-566"></a> <span class='hs-varid'>forM_</span> <span class='hs-varid'>files</span> <span class='hs-layout'>(</span><span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>.</span> <span class='hs-varid'>openFile</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-552"></a><a name="open"></a><span class='hs-comment'>-- |Supposed to be used with 'withRows'. Opens a file or directory.</span>
|
|
|
|
|
<a name="line-553"></a><span class='hs-definition'>open</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Item</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-554"></a><span class='hs-definition'>open</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>item</span><span class='hs-keyglyph'>]</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-555"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>item</span> <span class='hs-keyword'>of</span>
|
|
|
|
|
<a name="line-556"></a> <span class='hs-conid'>DirOrSym</span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-557"></a> <span class='hs-varid'>nv</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>readFile</span> <span class='hs-varid'>getFileInfo</span> <span class='hs-varop'>$</span> <span class='hs-varid'>path</span> <span class='hs-varid'>r</span>
|
|
|
|
|
<a name="line-558"></a> <span class='hs-varid'>goDir</span> <span class='hs-conid'>True</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>nv</span>
|
|
|
|
|
<a name="line-559"></a> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span>
|
|
|
|
|
<a name="line-560"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>openFile</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>r</span>
|
|
|
|
|
<a name="line-561"></a><span class='hs-definition'>open</span> <span class='hs-varid'>items</span> <span class='hs-varid'>mygui</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-562"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>dirs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>filter</span> <span class='hs-layout'>(</span><span class='hs-varid'>fst</span> <span class='hs-varop'>.</span> <span class='hs-varid'>sdir</span><span class='hs-layout'>)</span> <span class='hs-varid'>items</span>
|
|
|
|
|
<a name="line-563"></a> <span class='hs-varid'>files</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>filter</span> <span class='hs-layout'>(</span><span class='hs-varid'>fst</span> <span class='hs-varop'>.</span> <span class='hs-varid'>sfileLike</span><span class='hs-layout'>)</span> <span class='hs-varid'>items</span>
|
|
|
|
|
<a name="line-564"></a> <span class='hs-varid'>forM_</span> <span class='hs-varid'>dirs</span> <span class='hs-layout'>(</span><span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>.</span> <span class='hs-varid'>opeInNewTab</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-565"></a> <span class='hs-varid'>forM_</span> <span class='hs-varid'>files</span> <span class='hs-layout'>(</span><span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>.</span> <span class='hs-varid'>openFile</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-566"></a>
|
|
|
|
|
<a name="line-567"></a>
|
|
|
|
|
<a name="line-568"></a>
|
|
|
|
|
<a name="line-569"></a><a name="upDir"></a><span class='hs-comment'>-- |Go up one directory and visualize it in the treeView.</span>
|
|
|
|
|
<a name="line-570"></a><span class='hs-definition'>upDir</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-571"></a><span class='hs-definition'>upDir</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-572"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-573"></a> <span class='hs-varid'>nv</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>goUp</span> <span class='hs-varid'>cdir</span>
|
|
|
|
|
<a name="line-574"></a> <span class='hs-varid'>goDir</span> <span class='hs-conid'>True</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>nv</span>
|
|
|
|
|
<a name="line-568"></a><a name="upDir"></a><span class='hs-comment'>-- |Go up one directory and visualize it in the treeView.</span>
|
|
|
|
|
<a name="line-569"></a><span class='hs-definition'>upDir</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
|
|
|
|
|
<a name="line-570"></a><span class='hs-definition'>upDir</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withErrorDialog</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-571"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
|
|
|
|
|
<a name="line-572"></a> <span class='hs-varid'>nv</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>goUp</span> <span class='hs-varid'>cdir</span>
|
|
|
|
|
<a name="line-573"></a> <span class='hs-varid'>goDir</span> <span class='hs-conid'>True</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>nv</span>
|
|
|
|
|
<a name="line-574"></a>
|
|
|
|
|
<a name="line-575"></a>
|
|
|
|
|
<a name="line-576"></a>
|
|
|
|
|
<a name="line-577"></a>
|
|
|
|
|
<a name="line-578"></a>
|
|
|
|
|
<a name="line-579"></a><span class='hs-comment'>---- HISTORY CALLBACKS ----</span>
|
|
|
|
|
<a name="line-578"></a><span class='hs-comment'>---- HISTORY CALLBACKS ----</span>
|
|
|
|
|
<a name="line-579"></a>
|
|
|
|
|
<a name="line-580"></a>
|
|
|
|
|
<a name="line-581"></a>
|
|
|
|
|
<a name="line-582"></a><a name="goHistoryBack"></a><span class='hs-comment'>-- |Go "back" in the history.</span>
|
|
|
|
|
<a name="line-583"></a><span class='hs-definition'>goHistoryBack</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>Path</span> <span class='hs-conid'>Abs</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-584"></a><span class='hs-definition'>goHistoryBack</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-585"></a> <span class='hs-varid'>hs</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>takeMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>history</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-586"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>nhs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>historyBack</span> <span class='hs-varid'>hs</span>
|
|
|
|
|
<a name="line-587"></a> <span class='hs-varid'>putMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>history</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span> <span class='hs-varid'>nhs</span>
|
|
|
|
|
<a name="line-588"></a> <span class='hs-varid'>nv</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>readFile</span> <span class='hs-varid'>getFileInfo</span> <span class='hs-varop'>$</span> <span class='hs-varid'>currentDir</span> <span class='hs-varid'>nhs</span>
|
|
|
|
|
<a name="line-589"></a> <span class='hs-varid'>goDir</span> <span class='hs-conid'>False</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>nv</span>
|
|
|
|
|
<a name="line-590"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>currentDir</span> <span class='hs-varid'>nhs</span>
|
|
|
|
|
<a name="line-581"></a><a name="goHistoryBack"></a><span class='hs-comment'>-- |Go "back" in the history.</span>
|
|
|
|
|
<a name="line-582"></a><span class='hs-definition'>goHistoryBack</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>Path</span> <span class='hs-conid'>Abs</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-583"></a><span class='hs-definition'>goHistoryBack</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-584"></a> <span class='hs-varid'>hs</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>takeMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>history</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-585"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>nhs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>historyBack</span> <span class='hs-varid'>hs</span>
|
|
|
|
|
<a name="line-586"></a> <span class='hs-varid'>putMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>history</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span> <span class='hs-varid'>nhs</span>
|
|
|
|
|
<a name="line-587"></a> <span class='hs-varid'>nv</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>readFile</span> <span class='hs-varid'>getFileInfo</span> <span class='hs-varop'>$</span> <span class='hs-varid'>currentDir</span> <span class='hs-varid'>nhs</span>
|
|
|
|
|
<a name="line-588"></a> <span class='hs-varid'>goDir</span> <span class='hs-conid'>False</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>nv</span>
|
|
|
|
|
<a name="line-589"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>currentDir</span> <span class='hs-varid'>nhs</span>
|
|
|
|
|
<a name="line-590"></a>
|
|
|
|
|
<a name="line-591"></a>
|
|
|
|
|
<a name="line-592"></a>
|
|
|
|
|
<a name="line-593"></a><a name="goHistoryForward"></a><span class='hs-comment'>-- |Go "forward" in the history.</span>
|
|
|
|
|
<a name="line-594"></a><span class='hs-definition'>goHistoryForward</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>Path</span> <span class='hs-conid'>Abs</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-595"></a><span class='hs-definition'>goHistoryForward</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-596"></a> <span class='hs-varid'>hs</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>takeMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>history</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-597"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>nhs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>historyForward</span> <span class='hs-varid'>hs</span>
|
|
|
|
|
<a name="line-598"></a> <span class='hs-varid'>putMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>history</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span> <span class='hs-varid'>nhs</span>
|
|
|
|
|
<a name="line-599"></a> <span class='hs-varid'>nv</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>readFile</span> <span class='hs-varid'>getFileInfo</span> <span class='hs-varop'>$</span> <span class='hs-varid'>currentDir</span> <span class='hs-varid'>nhs</span>
|
|
|
|
|
<a name="line-600"></a> <span class='hs-varid'>goDir</span> <span class='hs-conid'>False</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>nv</span>
|
|
|
|
|
<a name="line-601"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>currentDir</span> <span class='hs-varid'>nhs</span>
|
|
|
|
|
<a name="line-592"></a><a name="goHistoryForward"></a><span class='hs-comment'>-- |Go "forward" in the history.</span>
|
|
|
|
|
<a name="line-593"></a><span class='hs-definition'>goHistoryForward</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>Path</span> <span class='hs-conid'>Abs</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-594"></a><span class='hs-definition'>goHistoryForward</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-595"></a> <span class='hs-varid'>hs</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>takeMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>history</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-596"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>nhs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>historyForward</span> <span class='hs-varid'>hs</span>
|
|
|
|
|
<a name="line-597"></a> <span class='hs-varid'>putMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>history</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span> <span class='hs-varid'>nhs</span>
|
|
|
|
|
<a name="line-598"></a> <span class='hs-varid'>nv</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>readFile</span> <span class='hs-varid'>getFileInfo</span> <span class='hs-varop'>$</span> <span class='hs-varid'>currentDir</span> <span class='hs-varid'>nhs</span>
|
|
|
|
|
<a name="line-599"></a> <span class='hs-varid'>goDir</span> <span class='hs-conid'>False</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>nv</span>
|
|
|
|
|
<a name="line-600"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>currentDir</span> <span class='hs-varid'>nhs</span>
|
|
|
|
|
<a name="line-601"></a>
|
|
|
|
|
<a name="line-602"></a>
|
|
|
|
|
<a name="line-603"></a>
|
|
|
|
|
<a name="line-604"></a><a name="mkHistoryMenuB"></a><span class='hs-comment'>-- |Show backwards history in a drop-down menu, depending on the input.</span>
|
|
|
|
|
<a name="line-605"></a><span class='hs-definition'>mkHistoryMenuB</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Path</span> <span class='hs-conid'>Abs</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Menu</span>
|
|
|
|
|
<a name="line-606"></a><span class='hs-definition'>mkHistoryMenuB</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>hs</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-607"></a> <span class='hs-varid'>menu</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>menuNew</span>
|
|
|
|
|
<a name="line-608"></a> <span class='hs-varid'>menuitems</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>forM</span> <span class='hs-varid'>hs</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>p</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-609"></a> <span class='hs-varid'>item</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>menuItemNewWithLabel</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromAbs</span> <span class='hs-varid'>p</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-610"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>item</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>menuItemActivated</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-611"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>iterateUntil</span> <span class='hs-layout'>(</span><span class='hs-varop'>==</span> <span class='hs-varid'>p</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>goHistoryBack</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-612"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-613"></a> <span class='hs-varid'>forM_</span> <span class='hs-varid'>menuitems</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>item</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>menuShellAppend</span> <span class='hs-varid'>menu</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-614"></a> <span class='hs-varid'>widgetShowAll</span> <span class='hs-varid'>menu</span>
|
|
|
|
|
<a name="line-615"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>menu</span>
|
|
|
|
|
<a name="line-603"></a><a name="mkHistoryMenuB"></a><span class='hs-comment'>-- |Show backwards history in a drop-down menu, depending on the input.</span>
|
|
|
|
|
<a name="line-604"></a><span class='hs-definition'>mkHistoryMenuB</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Path</span> <span class='hs-conid'>Abs</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Menu</span>
|
|
|
|
|
<a name="line-605"></a><span class='hs-definition'>mkHistoryMenuB</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>hs</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-606"></a> <span class='hs-varid'>menu</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>menuNew</span>
|
|
|
|
|
<a name="line-607"></a> <span class='hs-varid'>menuitems</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>forM</span> <span class='hs-varid'>hs</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>p</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-608"></a> <span class='hs-varid'>item</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>menuItemNewWithLabel</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromAbs</span> <span class='hs-varid'>p</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-609"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>item</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>menuItemActivated</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-610"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>iterateUntil</span> <span class='hs-layout'>(</span><span class='hs-varop'>==</span> <span class='hs-varid'>p</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>goHistoryBack</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-611"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-612"></a> <span class='hs-varid'>forM_</span> <span class='hs-varid'>menuitems</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>item</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>menuShellAppend</span> <span class='hs-varid'>menu</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-613"></a> <span class='hs-varid'>widgetShowAll</span> <span class='hs-varid'>menu</span>
|
|
|
|
|
<a name="line-614"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>menu</span>
|
|
|
|
|
<a name="line-615"></a>
|
|
|
|
|
<a name="line-616"></a>
|
|
|
|
|
<a name="line-617"></a>
|
|
|
|
|
<a name="line-618"></a><a name="mkHistoryMenuF"></a><span class='hs-comment'>-- |Show forward history in a drop-down menu, depending on the input.</span>
|
|
|
|
|
<a name="line-619"></a><span class='hs-definition'>mkHistoryMenuF</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Path</span> <span class='hs-conid'>Abs</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Menu</span>
|
|
|
|
|
<a name="line-620"></a><span class='hs-definition'>mkHistoryMenuF</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>hs</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-621"></a> <span class='hs-varid'>menu</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>menuNew</span>
|
|
|
|
|
<a name="line-622"></a> <span class='hs-varid'>menuitems</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>forM</span> <span class='hs-varid'>hs</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>p</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-623"></a> <span class='hs-varid'>item</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>menuItemNewWithLabel</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromAbs</span> <span class='hs-varid'>p</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-624"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>item</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>menuItemActivated</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-625"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>iterateUntil</span> <span class='hs-layout'>(</span><span class='hs-varop'>==</span> <span class='hs-varid'>p</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>goHistoryForward</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-626"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-627"></a> <span class='hs-varid'>forM_</span> <span class='hs-varid'>menuitems</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>item</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>menuShellAppend</span> <span class='hs-varid'>menu</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-628"></a> <span class='hs-varid'>widgetShowAll</span> <span class='hs-varid'>menu</span>
|
|
|
|
|
<a name="line-629"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>menu</span>
|
|
|
|
|
<a name="line-630"></a>
|
|
|
|
|
<a name="line-617"></a><a name="mkHistoryMenuF"></a><span class='hs-comment'>-- |Show forward history in a drop-down menu, depending on the input.</span>
|
|
|
|
|
<a name="line-618"></a><span class='hs-definition'>mkHistoryMenuF</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Path</span> <span class='hs-conid'>Abs</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Menu</span>
|
|
|
|
|
<a name="line-619"></a><span class='hs-definition'>mkHistoryMenuF</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>hs</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-620"></a> <span class='hs-varid'>menu</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>menuNew</span>
|
|
|
|
|
<a name="line-621"></a> <span class='hs-varid'>menuitems</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>forM</span> <span class='hs-varid'>hs</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>p</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
|
|
|
|
|
<a name="line-622"></a> <span class='hs-varid'>item</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>menuItemNewWithLabel</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromAbs</span> <span class='hs-varid'>p</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-623"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>item</span> <span class='hs-varop'>`on`</span> <span class='hs-varid'>menuItemActivated</span> <span class='hs-varop'>$</span>
|
|
|
|
|
<a name="line-624"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>iterateUntil</span> <span class='hs-layout'>(</span><span class='hs-varop'>==</span> <span class='hs-varid'>p</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>goHistoryForward</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
|
|
|
|
|
<a name="line-625"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-626"></a> <span class='hs-varid'>forM_</span> <span class='hs-varid'>menuitems</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>item</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>menuShellAppend</span> <span class='hs-varid'>menu</span> <span class='hs-varid'>item</span>
|
|
|
|
|
<a name="line-627"></a> <span class='hs-varid'>widgetShowAll</span> <span class='hs-varid'>menu</span>
|
|
|
|
|
<a name="line-628"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>menu</span>
|
|
|
|
|
<a name="line-629"></a>
|
|
|
|
|
</pre></body>
|
|
|
|
|
</html>
|
|
|
|
|