Browse files

v0.5.1 - with interpret and full module menues

  • Loading branch information...
1 parent 276a353 commit d671701c21da4a6c8925c345893c7e1c1d1c64e1 Fernando Benavides committed Dec 11, 2009
Showing with 40 additions and 13 deletions.
  1. +1 −1 hpage.cabal
  2. +25 −3 src/HPage/GUI/Dialogs.hs
  3. +12 −8 src/HPage/GUI/FreeTextWindow.hs
  4. +2 −1 src/HPage/GUI/IDs.hs
View
2 hpage.cabal
@@ -1,5 +1,5 @@
name: hpage
-version: 0.5
+version: 0.5.1
cabal-version: >=1.6
build-type: Custom
license: BSD3
View
28 src/HPage/GUI/Dialogs.hs
@@ -15,10 +15,32 @@ data Preferences = Prefs {languageExtensions :: [HP.Extension],
ghcOptions :: String}
deriving (Eq, Show)
-hayooDialog :: Window a -> String -> String -> IO ()
-hayooDialog win caption query =
+hayooDialog :: Window a -> String -> IO ()
+hayooDialog win query =
do
- warningDialog win caption query
+ dlg <- dialog win [text := "Hayoo! - work in progress"]
+ htmlw <- htmlWindowCreate dlg idAny (rect (point 0 0) (sz 640 480)) 0 ""
+ htmlWindowSetPage htmlw $ "<body>Waiting for Timo & Sebastian to integrate" ++
+ " \955Page and <a target=\"_blank\"" ++
+ " href=\"http://holumbus.fh-wedel.de/hayoo/hayoo.html\">Hayoo!</a> :)" ++
+ "</body>"
+ set dlg [layout := fill $ widget htmlw,
+ visible := True,
+ clientSize := sz 640 480]
+ return ()
+--TODO: Use this or something similar:
+-- htmlDialog win "Hayoo!" $ "http://holumbus.fh-wedel.de/hayoo/hayoo.html#0:" ++ query
+
+htmlDialog :: Window a -> String -> String -> IO ()
+htmlDialog win caption url =
+ do
+ dlg <- dialog win [text := caption]
+ htmlw <- htmlWindowCreate dlg idAny (rect (point 0 0) (sz 640 480)) 0 ""
+ htmlWindowLoadPage htmlw url
+ set dlg [layout := fill $ widget htmlw,
+ visible := True,
+ clientSize := sz 640 480]
+ return ()
preferencesDialog :: Window a -> String -> Preferences -> IO (Maybe Preferences)
preferencesDialog win caption currentPrefs =
View
20 src/HPage/GUI/FreeTextWindow.hs
@@ -187,6 +187,7 @@ gui =
menuAppend mnuHask wxId_HASK_RELOAD "&Reload\tCtrl-r" "Reload Modules" False
menuAppendSeparator mnuHask
menuAppend mnuHask wxId_HASK_INTERPRET "&Interpret\tCtrl-i" "Interpret the Current Expression" False
+ menuAppend mnuHask wxId_HASK_NAVIGATE "Search on Ha&yoo!\tCtrl-y" "Search the Current Selection on Hayoo!" False
mnuHelp <- menuHelp []
menuAppend mnuHelp wxId_HELP "&Help page\tCtrl-h" "Open the Help Page" False
@@ -216,6 +217,7 @@ gui =
evtHandlerOnMenuCommand win wxId_HASK_RELOAD $ onCmd "reloadModules" reloadModules
evtHandlerOnMenuCommand win wxId_PREFERENCES $ onCmd "preferences" configure
evtHandlerOnMenuCommand win wxId_HASK_INTERPRET $ onCmd "interpret" interpret
+ evtHandlerOnMenuCommand win wxId_HASK_NAVIGATE $ onCmd "hayoo" hayoo
evtHandlerOnMenuCommand win wxId_HASK_COPY $ onCmd "copyResult" copyResult
evtHandlerOnMenuCommand win wxId_HASK_COPY_TYPE $ onCmd "copyType" copyType
evtHandlerOnMenuCommand win wxId_HASK_EXPLAIN $ onCmd "explain" explain
@@ -271,7 +273,7 @@ refreshPage, savePageAs, savePage, openPage,
pageChange, copy, copyResult, copyType, cut, paste,
justFind, justFindNext, justFindPrev, findReplace,
textContextMenu, moduleContextMenu, valueContextMenu,
- restartTimer, killTimer, interpret, explain,
+ restartTimer, killTimer, interpret, hayoo, explain,
loadPackage, loadModules, importModules, loadModulesByName, loadModulesByNameFast, reloadModules,
configure, openHelpPage :: HPS.ServerHandle -> GUIContext -> IO ()
@@ -308,6 +310,8 @@ moduleContextMenu model guiCtx@GUICtx{guiWin = win, guiModules = (varModsSel, ls
flip mapM_ mes $ createMenuItem browseMenu
menuItem contextMenu [text := "To Clipboard",
on command := addToClipboard mn]
+ menuItem contextMenu [text := "Search on Hayoo!",
+ on command := hayooDialog win mn]
menuAppendSeparator contextMenu
menuAppendSub contextMenu wxId_HASK_BROWSE "&Browse" browseMenu ""
addToClipboard txt =
@@ -334,9 +338,7 @@ moduleContextMenu model guiCtx@GUICtx{guiWin = win, guiModules = (varModsSel, ls
menuAppendSub m wxId_HASK_MENUELEM ("class " ++ cn) itemMenu ""
createMenuItem m HP.MEClass{HP.clsName = cn, HP.clsFuns = cfs} =
do
- subMenu <- menuPane []
- menuItem subMenu [text := "To Clipboard",
- on command := addToClipboard cn]
+ subMenu <- createBasicMenuItem cn
menuAppendSeparator subMenu
flip mapM_ cfs $ createMenuItem subMenu
menuAppendSub m wxId_HASK_MENUELEM ("class " ++ cn) subMenu ""
@@ -346,9 +348,7 @@ moduleContextMenu model guiCtx@GUICtx{guiWin = win, guiModules = (varModsSel, ls
menuAppendSub m wxId_HASK_MENUELEM ("data " ++ dn) itemMenu ""
createMenuItem m HP.MEData{HP.datName = dn, HP.datCtors = dcs} =
do
- subMenu <- menuPane []
- menuItem subMenu [text := "To Clipboard",
- on command := addToClipboard dn]
+ subMenu <- createBasicMenuItem dn
menuAppendSeparator subMenu
flip mapM_ dcs $ createMenuItem subMenu
menuAppendSub m wxId_HASK_MENUELEM ("data " ++ dn) subMenu ""
@@ -358,7 +358,7 @@ moduleContextMenu model guiCtx@GUICtx{guiWin = win, guiModules = (varModsSel, ls
menuItem itemMenu [text := "To Clipboard",
on command := addToClipboard name]
menuItem itemMenu [text := "Search on Hayoo!",
- on command := hayooDialog win ("Hayoo! - " ++ name) name]
+ on command := hayooDialog win name]
return itemMenu
@@ -375,6 +375,7 @@ textContextMenu model guiCtx@GUICtx{guiWin = win, guiCode = txtCode} =
menuAppend contextMenu wxId_COPY "&Copy\tCtrl-c" "Copy" False
menuAppend contextMenu wxId_PASTE "&Paste\tCtrl-v" "Paste" False
menuAppendSeparator contextMenu
+ menuAppend contextMenu wxId_HASK_NAVIGATE "Search on Ha&yoo!\tCtrl-y" "Search the Current Selection on Hayoo!" False
menuAppend contextMenu wxId_HASK_INTERPRET "&Interpret\tCtrl-i" "Interpret the Current Expression" False
propagateEvent
pointWithinWindow <- windowGetMousePosition win
@@ -695,6 +696,9 @@ explain model guiCtx@GUICtx{guiWin = win,
else errorDialog win "Bottom String" err
else return ()
+hayoo model guiCtx@GUICtx{guiCode = txtCode, guiWin = win} =
+ textCtrlGetStringSelection txtCode >>= hayooDialog win
+
interpret model guiCtx@GUICtx{guiResults = GUIRes{resLabel = lblInterpret,
resButton = btnInterpret,
resValue = txtValue,
View
3 src/HPage/GUI/IDs.hs
@@ -32,7 +32,7 @@ wxId_PREFERENCES = 5022
wxId_CLOSE_ALL = 5018
wxId_HASK_LOAD, wxId_HASK_LOADNAME, wxId_HASK_LOAD_FAST, wxId_HASK_RELOAD,
- wxId_HASK_INTERPRET,
+ wxId_HASK_INTERPRET, wxId_HASK_NAVIGATE,
wxId_HASK_ADD, wxId_HASK_LOAD_PKG, wxId_HASK_MENUELEM, wxId_HASK_BROWSE,
wxId_HASK_COPY, wxId_HASK_COPY_TYPE, wxId_HASK_EXPLAIN :: Int
wxId_HASK_LOAD = 5300
@@ -46,4 +46,5 @@ wxId_HASK_BROWSE = 5307
wxId_HASK_COPY = 5308
wxId_HASK_COPY_TYPE = 5309
wxId_HASK_EXPLAIN = 5310
+wxId_HASK_NAVIGATE = 5311
wxId_HASK_MENUELEM = 5320

0 comments on commit d671701

Please sign in to comment.