summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
Diffstat (limited to 'frontends')
-rw-r--r--frontends/amiga/Makefile17
-rw-r--r--frontends/amiga/arexx.c6
-rw-r--r--frontends/amiga/bitmap.c58
-rwxr-xr-xfrontends/amiga/bitmap.h6
-rw-r--r--frontends/amiga/cookies.c6
-rw-r--r--frontends/amiga/corewindow.c65
-rw-r--r--frontends/amiga/corewindow.h4
-rw-r--r--frontends/amiga/ctxmenu.c10
-rwxr-xr-xfrontends/amiga/dist/NetSurf.guide3
-rw-r--r--frontends/amiga/download.c87
-rwxr-xr-xfrontends/amiga/download.h2
-rw-r--r--frontends/amiga/drag.c5
-rw-r--r--frontends/amiga/dt_anim.c23
-rw-r--r--frontends/amiga/dt_picture.c8
-rw-r--r--frontends/amiga/dt_sound.c40
-rw-r--r--frontends/amiga/filetype.c8
-rw-r--r--frontends/amiga/font.c14
-rw-r--r--frontends/amiga/font_bullet.c25
-rw-r--r--frontends/amiga/font_cache.c14
-rw-r--r--frontends/amiga/font_diskfont.c28
-rw-r--r--frontends/amiga/font_scan.c24
-rw-r--r--frontends/amiga/gui.c403
-rw-r--r--frontends/amiga/gui.h12
-rw-r--r--frontends/amiga/gui_menu.c11
-rw-r--r--frontends/amiga/gui_menu.h1
-rwxr-xr-xfrontends/amiga/gui_options.c22
-rw-r--r--frontends/amiga/history.c8
-rw-r--r--[-rwxr-xr-x]frontends/amiga/history_local.c523
-rw-r--r--[-rwxr-xr-x]frontends/amiga/history_local.h23
-rw-r--r--frontends/amiga/hotlist.c7
-rw-r--r--frontends/amiga/icon.c30
-rw-r--r--frontends/amiga/libs.c72
-rwxr-xr-xfrontends/amiga/memory.c73
-rw-r--r--frontends/amiga/menu.c6
-rwxr-xr-xfrontends/amiga/misc.c2
-rw-r--r--frontends/amiga/options.h2
-rw-r--r--frontends/amiga/os3support.c25
-rw-r--r--frontends/amiga/os3support.h1
-rwxr-xr-xfrontends/amiga/pkg/makereslinks24
-rw-r--r--frontends/amiga/plotters.c1004
-rw-r--r--frontends/amiga/plotters.h74
-rw-r--r--frontends/amiga/plugin_hack.c45
-rw-r--r--frontends/amiga/print.c18
l---------frontends/amiga/resources/AdBlock.css2
l---------frontends/amiga/resources/ca-bundle2
l---------frontends/amiga/resources/de1
l---------frontends/amiga/resources/en1
l---------frontends/amiga/resources/fr1
l---------frontends/amiga/resources/it1
l---------frontends/amiga/resources/nl1
l---------frontends/amiga/resources/nsdefault.css2
l---------frontends/amiga/resources/quirks.css2
-rw-r--r--frontends/amiga/schedule.c19
-rw-r--r--frontends/amiga/selectmenu.c3
-rw-r--r--frontends/amiga/sslcert.c6
-rwxr-xr-xfrontends/amiga/stringview/stringview.c3
-rwxr-xr-xfrontends/amiga/stringview/stringview.h5
-rw-r--r--frontends/amiga/stringview/urlhistory.c3
-rw-r--r--frontends/amiga/stringview/urlhistory.h5
-rw-r--r--frontends/amiga/theme.c8
-rw-r--r--frontends/amiga/version.c2
-rw-r--r--frontends/atari/Makefile35
-rw-r--r--frontends/atari/bitmap.c32
-rw-r--r--frontends/atari/certview.c16
-rw-r--r--frontends/atari/cookies.c15
-rw-r--r--frontends/atari/ctxmenu.c13
-rw-r--r--frontends/atari/deskmenu.c68
-rw-r--r--frontends/atari/download.c14
-rw-r--r--frontends/atari/filetype.c4
-rw-r--r--frontends/atari/findfile.c18
-rw-r--r--frontends/atari/gui.c171
-rw-r--r--frontends/atari/history.c15
-rw-r--r--frontends/atari/hotlist.c25
-rw-r--r--frontends/atari/misc.h10
-rw-r--r--frontends/atari/osspec.c6
-rw-r--r--frontends/atari/plot/font_freetype.c25
-rw-r--r--frontends/atari/plot/font_internal.c2
-rw-r--r--frontends/atari/plot/font_vdi.c16
-rw-r--r--frontends/atari/plot/plot.c2269
-rw-r--r--frontends/atari/plot/plot.h29
-rw-r--r--frontends/atari/rootwin.c67
-rw-r--r--frontends/atari/schedule.c32
-rw-r--r--frontends/atari/search.c12
-rw-r--r--frontends/atari/settings.c34
-rw-r--r--frontends/atari/statusbar.c4
-rw-r--r--frontends/atari/toolbar.c21
-rw-r--r--frontends/atari/treeview.c926
-rw-r--r--frontends/atari/treeview.h2
-rw-r--r--frontends/atari/verify_ssl.c27
-rw-r--r--frontends/beos/bitmap.cpp7
-rw-r--r--frontends/beos/fetch_rsrc.cpp22
-rw-r--r--frontends/beos/filetype.cpp1
-rw-r--r--frontends/beos/font.cpp9
-rw-r--r--frontends/beos/gui.cpp39
-rw-r--r--frontends/beos/plotters.cpp1128
l---------frontends/beos/res/adblock.css2
l---------frontends/beos/res/ca-bundle.txt2
l---------frontends/beos/res/de/welcome.html2
l---------frontends/beos/res/default.css2
l---------frontends/beos/res/en/credits.html2
l---------frontends/beos/res/en/licence.html2
l---------frontends/beos/res/en/maps.html2
l---------frontends/beos/res/en/welcome.html2
l---------frontends/beos/res/icons2
l---------frontends/beos/res/internal.css2
l---------frontends/beos/res/it/credits.html2
l---------frontends/beos/res/it/licence.html2
l---------frontends/beos/res/it/welcome.html2
l---------frontends/beos/res/ja/welcome.html2
l---------frontends/beos/res/netsurf.png2
l---------frontends/beos/res/quirks.css2
-rw-r--r--frontends/beos/scaffolding.cpp20
-rw-r--r--frontends/beos/schedule.cpp27
-rw-r--r--frontends/beos/throbber.cpp18
-rw-r--r--frontends/beos/window.cpp179
-rw-r--r--frontends/cocoa/ArrowBox.h34
-rw-r--r--frontends/cocoa/ArrowBox.m163
-rw-r--r--frontends/cocoa/ArrowWindow.h32
-rw-r--r--frontends/cocoa/ArrowWindow.m239
-rw-r--r--frontends/cocoa/BlackScroller.h20
-rw-r--r--frontends/cocoa/BlackScroller.m154
-rw-r--r--frontends/cocoa/BookmarksController.h41
-rw-r--r--frontends/cocoa/BookmarksController.m224
-rw-r--r--frontends/cocoa/BrowserView.h53
-rw-r--r--frontends/cocoa/BrowserView.m760
-rw-r--r--frontends/cocoa/BrowserViewController.h75
-rw-r--r--frontends/cocoa/BrowserViewController.m377
-rw-r--r--frontends/cocoa/BrowserWindow.h26
-rw-r--r--frontends/cocoa/BrowserWindow.m29
-rw-r--r--frontends/cocoa/BrowserWindowController.h57
-rw-r--r--frontends/cocoa/BrowserWindowController.m266
-rw-r--r--frontends/cocoa/DownloadWindowController.h53
-rw-r--r--frontends/cocoa/DownloadWindowController.m415
-rw-r--r--frontends/cocoa/FormSelectMenu.h32
-rw-r--r--frontends/cocoa/FormSelectMenu.m114
-rw-r--r--frontends/cocoa/HistoryView.h35
-rw-r--r--frontends/cocoa/HistoryView.m151
-rw-r--r--frontends/cocoa/HistoryWindowController.h31
-rw-r--r--frontends/cocoa/HistoryWindowController.m52
-rw-r--r--frontends/cocoa/LocalHistoryController.h40
-rw-r--r--frontends/cocoa/LocalHistoryController.m119
-rw-r--r--frontends/cocoa/Makefile250
-rw-r--r--frontends/cocoa/Makefile.defaults30
-rw-r--r--frontends/cocoa/NetSurf.xcodeproj/project.pbxproj1023
-rw-r--r--frontends/cocoa/NetSurfAppDelegate.h42
-rw-r--r--frontends/cocoa/NetSurfAppDelegate.m200
-rw-r--r--frontends/cocoa/NetsurfApp.h31
-rw-r--r--frontends/cocoa/NetsurfApp.m303
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front.pngbin292 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front_Pressed.pngbin292 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front_Rollover.pngbin297 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front.pngbin307 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front_Pressed.pngbin310 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front_Rollover.pngbin317 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabNew.pngbin371 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabNewPressed.pngbin380 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/AquaTabNewRollover.pngbin380 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/overflowImage.pngbin256 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/overflowImagePressed.pngbin250 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/Images/pi.pngbin564 -> 0 bytes
-rw-r--r--frontends/cocoa/PSMTabBarControl/NSBezierPath_AMShading.h23
-rw-r--r--frontends/cocoa/PSMTabBarControl/NSBezierPath_AMShading.m119
-rw-r--r--frontends/cocoa/PSMTabBarControl/NSString_AITruncation.h12
-rw-r--r--frontends/cocoa/PSMTabBarControl/NSString_AITruncation.m32
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.h28
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.m152
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.h15
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.m40
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMRolloverButton.h28
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMRolloverButton.m170
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarCell.h116
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m489
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarControl.h241
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarControl.m1995
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarController.h38
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabBarController.m643
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.h101
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.m834
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragView.h21
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragView.m62
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.h20
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.m48
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.h33
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.m111
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMTabStyle.h57
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.h29
-rw-r--r--frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.m573
-rw-r--r--frontends/cocoa/PSMTabBarControl/ReadMe.rtfd/TXT.rtf186
-rw-r--r--frontends/cocoa/PSMTabBarControl/ReadMe.rtfd/startpage.gifbin11246 -> 0 bytes
-rw-r--r--frontends/cocoa/PreferencesWindowController.h29
-rw-r--r--frontends/cocoa/PreferencesWindowController.m56
-rw-r--r--frontends/cocoa/Prefix.pch11
-rw-r--r--frontends/cocoa/ScrollableView.h31
-rw-r--r--frontends/cocoa/ScrollableView.m71
-rw-r--r--frontends/cocoa/SearchWindowController.h54
-rw-r--r--frontends/cocoa/SearchWindowController.m119
-rw-r--r--frontends/cocoa/Tree.h56
-rw-r--r--frontends/cocoa/Tree.m147
-rw-r--r--frontends/cocoa/TreeView.h34
-rw-r--r--frontends/cocoa/TreeView.m249
-rw-r--r--frontends/cocoa/URLFieldCell.h31
-rw-r--r--frontends/cocoa/URLFieldCell.m209
-rw-r--r--frontends/cocoa/apple_image.m257
-rw-r--r--frontends/cocoa/bitmap.h28
-rw-r--r--frontends/cocoa/bitmap.m281
-rwxr-xr-xfrontends/cocoa/compile-xib.sh20
-rw-r--r--frontends/cocoa/coordinates.h105
-rw-r--r--frontends/cocoa/desktop-tree.h88
-rw-r--r--frontends/cocoa/desktop-tree.m353
-rwxr-xr-xfrontends/cocoa/extract-strings.sh11
-rw-r--r--frontends/cocoa/fetch.h19
-rw-r--r--frontends/cocoa/fetch.m113
-rw-r--r--frontends/cocoa/font.h28
-rw-r--r--frontends/cocoa/font.m243
-rw-r--r--frontends/cocoa/gui.h35
-rw-r--r--frontends/cocoa/gui.m333
-rw-r--r--frontends/cocoa/plotter.h33
-rw-r--r--frontends/cocoa/plotter.m335
-rw-r--r--frontends/cocoa/res/BookmarksWindow.xib610
-rw-r--r--frontends/cocoa/res/Browser.xib399
-rw-r--r--frontends/cocoa/res/BrowserWindow.xib1395
-rw-r--r--frontends/cocoa/res/DownloadWindow.xib493
-rw-r--r--frontends/cocoa/res/HistoryWindow.xib338
-rw-r--r--frontends/cocoa/res/HomeTemplate.pdf106
l---------frontends/cocoa/res/Icons1
-rw-r--r--frontends/cocoa/res/LocalHistoryPanel.xib357
-rw-r--r--frontends/cocoa/res/MainMenu.xib2369
-rw-r--r--frontends/cocoa/res/NetSurf-Info.plist111
-rw-r--r--frontends/cocoa/res/NetSurf.icnsbin203268 -> 0 bytes
-rw-r--r--frontends/cocoa/res/PreferencesWindow.xib512
-rw-r--r--frontends/cocoa/res/SearchWindow.xib614
l---------frontends/cocoa/res/adblock.css1
l---------frontends/cocoa/res/ca-bundle1
-rw-r--r--frontends/cocoa/res/de.lproj/BookmarksWindow.xib.stringsbin366 -> 0 bytes
-rw-r--r--frontends/cocoa/res/de.lproj/BrowserWindow.xib.stringsbin1892 -> 0 bytes
-rw-r--r--frontends/cocoa/res/de.lproj/DownloadWindow.xib.stringsbin536 -> 0 bytes
-rw-r--r--frontends/cocoa/res/de.lproj/HistoryWindow.xib.stringsbin172 -> 0 bytes
-rw-r--r--frontends/cocoa/res/de.lproj/Localizable.strings78
-rw-r--r--frontends/cocoa/res/de.lproj/MainMenu.xib.stringsbin11982 -> 0 bytes
l---------frontends/cocoa/res/de.lproj/Messages1
-rw-r--r--frontends/cocoa/res/de.lproj/PreferencesWindow.xib.stringsbin1206 -> 0 bytes
-rw-r--r--frontends/cocoa/res/de.lproj/SearchWindow.xib.stringsbin1148 -> 0 bytes
l---------frontends/cocoa/res/default.css1
-rw-r--r--frontends/cocoa/res/en.lproj/Localizable.stringsbin3322 -> 0 bytes
l---------frontends/cocoa/res/en.lproj/Messages1
-rw-r--r--frontends/cocoa/res/fr.lproj/Localizable.stringsbin3322 -> 0 bytes
l---------frontends/cocoa/res/fr.lproj/Messages1
l---------frontends/cocoa/res/internal.css1
-rw-r--r--frontends/cocoa/res/it.lproj/Localizable.stringsbin3496 -> 0 bytes
l---------frontends/cocoa/res/it.lproj/Messages1
l---------frontends/cocoa/res/netsurf.png1
-rw-r--r--frontends/cocoa/res/nl.lproj/Localizable.stringsbin3322 -> 0 bytes
l---------frontends/cocoa/res/nl.lproj/Messages1
l---------frontends/cocoa/res/quirks.css1
-rw-r--r--frontends/cocoa/schedule.h19
-rw-r--r--frontends/cocoa/schedule.m90
-rw-r--r--frontends/cocoa/selection.h19
-rw-r--r--frontends/cocoa/selection.m104
-rw-r--r--frontends/framebuffer/Makefile11
-rw-r--r--frontends/framebuffer/bitmap.c21
-rw-r--r--frontends/framebuffer/clipboard.c4
-rw-r--r--frontends/framebuffer/corewindow.c262
-rw-r--r--frontends/framebuffer/corewindow.h107
-rw-r--r--frontends/framebuffer/fbtk.h6
-rw-r--r--frontends/framebuffer/fbtk/event.c4
-rw-r--r--frontends/framebuffer/fbtk/fbtk.c46
-rw-r--r--frontends/framebuffer/fbtk/scroll.c4
-rw-r--r--frontends/framebuffer/fbtk/text.c46
-rw-r--r--frontends/framebuffer/fetch.c2
-rw-r--r--frontends/framebuffer/font_freetype.c21
-rw-r--r--frontends/framebuffer/font_internal.c6
-rw-r--r--frontends/framebuffer/framebuffer.c612
-rw-r--r--frontends/framebuffer/gui.c143
-rw-r--r--frontends/framebuffer/gui.h18
-rw-r--r--frontends/framebuffer/local_history.c248
-rw-r--r--frontends/framebuffer/local_history.h49
-rw-r--r--frontends/framebuffer/localhistory.c144
l---------frontends/framebuffer/res/Messages1
l---------frontends/framebuffer/res/adblock.css2
l---------frontends/framebuffer/res/credits.html2
l---------frontends/framebuffer/res/default.css2
l---------frontends/framebuffer/res/internal.css2
l---------frontends/framebuffer/res/licence.html2
l---------frontends/framebuffer/res/maps.html2
l---------frontends/framebuffer/res/netsurf.png2
l---------frontends/framebuffer/res/quirks.css2
l---------frontends/framebuffer/res/welcome.html2
-rw-r--r--frontends/framebuffer/schedule.c23
-rw-r--r--frontends/gtk/Makefile10
-rw-r--r--frontends/gtk/accelerator.c79
-rw-r--r--frontends/gtk/accelerator.h2
-rw-r--r--frontends/gtk/bitmap.c4
-rw-r--r--frontends/gtk/cookies.c9
-rw-r--r--frontends/gtk/corewindow.c53
-rw-r--r--frontends/gtk/corewindow.h2
-rw-r--r--frontends/gtk/download.c4
-rw-r--r--frontends/gtk/fetch.c6
-rw-r--r--frontends/gtk/gdk.c2
-rw-r--r--frontends/gtk/global_history.c17
-rw-r--r--frontends/gtk/gui.c160
-rw-r--r--frontends/gtk/hotlist.c9
-rw-r--r--frontends/gtk/layout_pango.c33
-rw-r--r--frontends/gtk/layout_pango.h2
-rw-r--r--frontends/gtk/local_history.c269
-rw-r--r--frontends/gtk/local_history.h49
-rw-r--r--frontends/gtk/login.c2
-rw-r--r--frontends/gtk/menu.c44
-rw-r--r--frontends/gtk/plotters.c601
-rw-r--r--frontends/gtk/plotters.h6
-rw-r--r--frontends/gtk/preferences.c13
-rw-r--r--frontends/gtk/print.c265
-rw-r--r--frontends/gtk/res/accelerators40
l---------frontends/gtk/res/adblock.css2
l---------frontends/gtk/res/ca-bundle.txt2
l---------frontends/gtk/res/de/welcome.html2
l---------frontends/gtk/res/default.css2
l---------frontends/gtk/res/en/credits.html2
l---------frontends/gtk/res/en/licence.html2
l---------frontends/gtk/res/en/maps.html2
l---------frontends/gtk/res/en/welcome.html2
-rw-r--r--frontends/gtk/res/globalhistory.gtk2.ui (renamed from frontends/gtk/res/history.gtk2.ui)0
-rw-r--r--frontends/gtk/res/globalhistory.gtk3.ui (renamed from frontends/gtk/res/history.gtk3.ui)0
l---------frontends/gtk/res/icons2
l---------frontends/gtk/res/internal.css2
l---------frontends/gtk/res/it/credits.html2
l---------frontends/gtk/res/it/licence.html2
l---------frontends/gtk/res/it/welcome.html2
l---------frontends/gtk/res/ja/welcome.html2
-rw-r--r--frontends/gtk/res/localhistory.gtk2.ui45
-rw-r--r--frontends/gtk/res/localhistory.gtk3.ui45
-rw-r--r--frontends/gtk/res/netsurf.gresource.xml43
l---------frontends/gtk/res/netsurf.png2
l---------frontends/gtk/res/nl/credits.html2
l---------frontends/gtk/res/nl/licence.html2
l---------frontends/gtk/res/nl/welcome.html2
-rw-r--r--frontends/gtk/res/options.gtk2.ui589
l---------frontends/gtk/res/quirks.css2
-rw-r--r--frontends/gtk/res/toolbar.gtk2.ui183
-rw-r--r--frontends/gtk/res/toolbar.gtk3.ui242
-rw-r--r--frontends/gtk/resources.c82
-rw-r--r--frontends/gtk/scaffolding.c445
-rw-r--r--frontends/gtk/schedule.c16
-rw-r--r--frontends/gtk/ssl_cert.c2
-rw-r--r--frontends/gtk/tabs.c8
-rw-r--r--frontends/gtk/throbber.c6
-rw-r--r--frontends/gtk/toolbar.c131
-rw-r--r--frontends/gtk/viewdata.c23
-rw-r--r--frontends/gtk/viewsource.c6
-rw-r--r--frontends/gtk/window.c152
-rw-r--r--frontends/monkey/401login.c32
-rw-r--r--frontends/monkey/bitmap.c112
-rw-r--r--frontends/monkey/browser.c596
-rw-r--r--frontends/monkey/browser.h14
-rw-r--r--frontends/monkey/cert.c32
-rw-r--r--frontends/monkey/dispatch.c110
-rw-r--r--frontends/monkey/download.c46
-rw-r--r--frontends/monkey/farmer.py363
-rw-r--r--frontends/monkey/fetch.c12
-rw-r--r--frontends/monkey/filetype.c4
-rw-r--r--frontends/monkey/layout.c62
-rw-r--r--frontends/monkey/main.c486
-rw-r--r--frontends/monkey/plot.c258
-rw-r--r--frontends/monkey/schedule.c288
-rw-r--r--frontends/riscos/401login.c5
-rw-r--r--frontends/riscos/Makefile31
-rw-r--r--frontends/riscos/appdir/!Boot,feb90
-rw-r--r--frontends/riscos/appdir/!Sprites,ff9bin0 -> 1580 bytes
-rw-r--r--frontends/riscos/appdir/!Sprites22,ff9bin0 -> 11528 bytes
-rwxr-xr-xfrontends/riscos/appdir/5Sprites,ff9bin0 -> 30964 bytes
-rwxr-xr-xfrontends/riscos/appdir/5Sprites11,ff9bin0 -> 64228 bytes
-rwxr-xr-xfrontends/riscos/appdir/5Sprites22,ff9bin0 -> 40800 bytes
-rwxr-xr-xfrontends/riscos/appdir/ASprites,ff9bin0 -> 3664 bytes
-rwxr-xr-xfrontends/riscos/appdir/ASprites11,ff9bin0 -> 15892 bytes
-rwxr-xr-xfrontends/riscos/appdir/ASprites22,ff9bin0 -> 12668 bytes
-rw-r--r--frontends/riscos/appdir/ChkSprites,ffbbin0 -> 2029 bytes
-rwxr-xr-xfrontends/riscos/appdir/Docs/online,b60bin0 -> 165 bytes
-rw-r--r--frontends/riscos/appdir/FixFonts,ffb147
-rw-r--r--frontends/riscos/appdir/KickNS,ffbbin0 -> 1511 bytes
-rwxr-xr-xfrontends/riscos/appdir/OpenChoices,feb1
-rw-r--r--frontends/riscos/appdir/OpenHelp,ffbbin0 -> 925 bytes
-rwxr-xr-xfrontends/riscos/appdir/OpenScrap,feb1
l---------frontends/riscos/appdir/Resources/AdBlock,f791
-rw-r--r--frontends/riscos/appdir/Resources/Aletheia,ffdbin0 -> 15237 bytes
l---------frontends/riscos/appdir/Resources/CSS,f791
-rw-r--r--frontends/riscos/appdir/Resources/Fonts/NSSymbol/Encoding39
-rw-r--r--frontends/riscos/appdir/Resources/Fonts/NSSymbol/IntMetrics,ff6bin0 -> 344 bytes
-rw-r--r--frontends/riscos/appdir/Resources/Fonts/NSSymbol/Outlines,ff6bin0 -> 904 bytes
l---------frontends/riscos/appdir/Resources/Icons1
-rwxr-xr-xfrontends/riscos/appdir/Resources/Image,ff9bin0 -> 111972 bytes
-rw-r--r--frontends/riscos/appdir/Resources/LangNames52
l---------frontends/riscos/appdir/Resources/Quirks,f791
-rw-r--r--frontends/riscos/appdir/Resources/SearchEngines22
-rwxr-xr-xfrontends/riscos/appdir/Resources/Sprites,ff9bin0 -> 77336 bytes
l---------frontends/riscos/appdir/Resources/ca-bundle1
l---------frontends/riscos/appdir/Resources/de/Messages1
l---------frontends/riscos/appdir/Resources/de/welcome.html,faf1
-rw-r--r--frontends/riscos/appdir/Resources/en/!Help14
l---------frontends/riscos/appdir/Resources/en/Messages1
l---------frontends/riscos/appdir/Resources/en/credits.html,faf1
l---------frontends/riscos/appdir/Resources/en/licence.html,faf1
l---------frontends/riscos/appdir/Resources/en/maps.html,faf1
l---------frontends/riscos/appdir/Resources/en/welcome.html,faf1
l---------frontends/riscos/appdir/Resources/fr/Messages1
l---------frontends/riscos/appdir/Resources/internal.css,f791
l---------frontends/riscos/appdir/Resources/it/Messages1
l---------frontends/riscos/appdir/Resources/it/credits.html,faf1
l---------frontends/riscos/appdir/Resources/it/licence.html,faf1
l---------frontends/riscos/appdir/Resources/it/welcome.html,faf1
l---------frontends/riscos/appdir/Resources/ja/welcome.html,faf1
l---------frontends/riscos/appdir/Resources/netsurf.png,b601
-rw-r--r--frontends/riscos/appdir/Resources/nl/!Help15
l---------frontends/riscos/appdir/Resources/nl/Messages1
l---------frontends/riscos/appdir/Resources/nl/credits.html,faf1
l---------frontends/riscos/appdir/Resources/nl/licence.html,faf1
l---------frontends/riscos/appdir/Resources/nl/welcome.html,faf1
-rw-r--r--frontends/riscos/bitmap.c32
-rw-r--r--frontends/riscos/buffer.c36
-rw-r--r--frontends/riscos/configure.c32
-rw-r--r--frontends/riscos/configure/con_image.c5
-rw-r--r--frontends/riscos/configure/con_language.c6
-rw-r--r--frontends/riscos/configure/con_theme.c23
-rw-r--r--frontends/riscos/content-handlers/artworks.c48
-rw-r--r--frontends/riscos/content-handlers/draw.c10
-rw-r--r--frontends/riscos/content-handlers/sprite.c11
-rw-r--r--frontends/riscos/cookies.c6
-rw-r--r--frontends/riscos/corewindow.c190
-rw-r--r--frontends/riscos/corewindow.h4
-rw-r--r--frontends/riscos/dialog.c70
-rw-r--r--frontends/riscos/dialog.h1
-rw-r--r--frontends/riscos/download.c152
-rw-r--r--frontends/riscos/filetype.c37
-rw-r--r--frontends/riscos/font.c77
-rw-r--r--frontends/riscos/global_history.c6
-rw-r--r--frontends/riscos/gui.c154
-rw-r--r--frontends/riscos/gui.h34
-rw-r--r--frontends/riscos/gui/button_bar.c30
-rw-r--r--frontends/riscos/gui/progress_bar.c33
-rw-r--r--frontends/riscos/gui/status_bar.c83
-rw-r--r--frontends/riscos/gui/throbber.c11
-rw-r--r--frontends/riscos/gui/url_bar.c48
-rw-r--r--frontends/riscos/help.c22
-rw-r--r--frontends/riscos/history.c336
-rw-r--r--frontends/riscos/hotlist.c11
-rw-r--r--frontends/riscos/iconbar.c6
-rw-r--r--frontends/riscos/image.c20
-rw-r--r--frontends/riscos/local_history.c442
-rw-r--r--frontends/riscos/local_history.h46
-rw-r--r--frontends/riscos/menus.c31
-rw-r--r--frontends/riscos/message.c8
-rw-r--r--frontends/riscos/mouse.c5
-rw-r--r--frontends/riscos/plotters.c824
-rw-r--r--frontends/riscos/print.c316
-rw-r--r--frontends/riscos/query.c21
-rw-r--r--frontends/riscos/save.c117
-rw-r--r--frontends/riscos/save_draw.c638
-rw-r--r--frontends/riscos/save_draw.h7
-rw-r--r--frontends/riscos/schedule.c2
-rw-r--r--frontends/riscos/sslcert.c36
-rw-r--r--frontends/riscos/textarea.c127
-rw-r--r--frontends/riscos/textselection.c41
-rw-r--r--frontends/riscos/theme.c55
-rw-r--r--frontends/riscos/theme_install.c5
-rw-r--r--frontends/riscos/toolbar.c48
-rw-r--r--frontends/riscos/ucstables.c7
-rw-r--r--frontends/riscos/uri.c6
-rw-r--r--frontends/riscos/url_complete.c67
-rw-r--r--frontends/riscos/url_protocol.c19
-rw-r--r--frontends/riscos/wimp.c135
-rw-r--r--frontends/riscos/wimp_event.c76
-rw-r--r--frontends/riscos/window.c5961
-rw-r--r--frontends/riscos/window.h207
-rw-r--r--frontends/windows/Makefile5
-rw-r--r--frontends/windows/about.c8
-rw-r--r--frontends/windows/bitmap.c34
-rw-r--r--frontends/windows/cookies.c19
-rw-r--r--frontends/windows/corewindow.c154
-rw-r--r--frontends/windows/corewindow.h2
-rw-r--r--frontends/windows/download.c8
-rw-r--r--frontends/windows/drawable.c71
-rw-r--r--frontends/windows/filetype.c13
-rw-r--r--frontends/windows/findfile.c4
-rw-r--r--frontends/windows/font.c113
-rw-r--r--frontends/windows/font.h13
-rw-r--r--frontends/windows/global_history.c6
-rw-r--r--frontends/windows/gui.c20
-rw-r--r--frontends/windows/hotlist.c6
-rw-r--r--frontends/windows/local_history.c255
-rw-r--r--frontends/windows/local_history.h (renamed from frontends/cocoa/apple_image.h)34
-rw-r--r--frontends/windows/localhistory.c413
-rw-r--r--frontends/windows/localhistory.h32
-rw-r--r--frontends/windows/main.c22
-rw-r--r--frontends/windows/plot.c1246
-rw-r--r--frontends/windows/prefs.c126
l---------frontends/windows/res/adblock.css2
l---------frontends/windows/res/ca-bundle.crt2
l---------frontends/windows/res/credits.html2
l---------frontends/windows/res/default.css2
l---------frontends/windows/res/internal.css2
l---------frontends/windows/res/licence.html2
l---------frontends/windows/res/netsurf.png2
l---------frontends/windows/res/quirks.css2
l---------frontends/windows/res/welcome.html2
-rw-r--r--frontends/windows/schedule.c38
-rw-r--r--frontends/windows/ssl_cert.c110
-rw-r--r--frontends/windows/windbg.h14
-rw-r--r--frontends/windows/window.c372
-rw-r--r--frontends/windows/window.h15
507 files changed, 18019 insertions, 35310 deletions
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index f57b4ef8a..ac05d1bf0 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -5,7 +5,7 @@
CFLAGS += -std=c99 -Dnsamiga
ifneq ($(SUBTARGET),os3)
- CFLAGS += -O2 -finline-functions -U__STRICT_ANSI__ -D__USE_INLINE__ -D__USE_BASETYPE__
+ CFLAGS += -O2 -mstrict-align -finline-functions -U__STRICT_ANSI__ -D__USE_INLINE__ -D__USE_BASETYPE__
else
CFLAGS += -O2 -DPATH_MAX=1024 -D__m68k__ -m68020
endif
@@ -67,8 +67,8 @@ package-amiga: netsurf.lha
AMIGA_LANGUAGES := de en it ja nl
AMIGA_PLATFORM_RESOURCES := Pointers Themes default.css default.css.info favicon.png LangNames mimetypes Resource.map splash.png
-AMIGA_GENERIC_RESOURCES := $(AMIGA_LANGUAGES) ca-bundle Icons
-AMIGA_RESOURCES := $(addprefix $(FRONTEND_SOURCE_DIR)/resources/,$(AMIGA_PLATFORM_RESOURCES)) $(addprefix \!NetSurf/Resources/,$(AMIGA_GENERIC_RESOURCES))
+AMIGA_GENERIC_RESOURCES := $(AMIGA_LANGUAGES) ca-bundle icons
+AMIGA_RESOURCES := $(addprefix $(FRONTEND_SOURCE_DIR)/resources/,$(AMIGA_PLATFORM_RESOURCES)) $(addprefix resources/,$(AMIGA_GENERIC_RESOURCES))
AMIGA_DISTRIBUTION_FILES := $(FRONTEND_SOURCE_DIR)/dist/*
AMIGA_PKG_DIR := $(FRONTEND_SOURCE_DIR)/pkg
AMIGA_INSTALL_TARGET_DIR := NetSurf_Amiga
@@ -80,13 +80,14 @@ netsurf.lha: $(EXETARGET)
$(Q)cp -p $(EXETARGET) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
$(Q)$(MKDIR) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
$(Q)cp -rp $(AMIGA_RESOURCES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
+ $(Q)mv $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/icons $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/Icons
$(Q)cp -rp $(AMIGA_DISTRIBUTION_FILES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
$(Q)cat resources/SearchEngines $(AMIGA_PKG_DIR)/SearchEngines >$(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/SearchEngines
- $(Q)cp -p \!NetSurf/Resources/AdBlock,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/adblock.css
- $(Q)cp -p \!NetSurf/Resources/CSS,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/nsdefault.css
- $(Q)cp -p \!NetSurf/Resources/internal.css,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/internal.css
- $(Q)cp -p \!NetSurf/Resources/Quirks,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/quirks.css
- $(Q)cp -p \!NetSurf/Resources/netsurf.png,b60 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/netsurf.png
+ $(Q)cp -p resources/adblock.css $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/adblock.css
+ $(Q)cp -p resources/default.css $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/nsdefault.css
+ $(Q)cp -p resources/internal.css $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/internal.css
+ $(Q)cp -p resources/quirks.css $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/quirks.css
+ $(Q)cp -p resources/netsurf.png $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/netsurf.png
$(Q)cp -p $(AMIGA_PKG_DIR)/drawer.info $(AMIGA_INSTALL_TARGET_DIR)/NetSurf.info
$(Q)cp -p $(AMIGA_PKG_DIR)/AutoInstall $(AMIGA_INSTALL_TARGET_DIR)
ifeq ($(SUBTARGET),os3)
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 7bb2f5882..acb0348fd 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -173,7 +173,7 @@ void ami_arexx_execute(char *script)
if((lock = Lock(script, ACCESS_READ))) {
DevNameFromLock(lock, full_script_path, 1024, DN_FULLPATH);
- LOG("Executing script: %s", full_script_path);
+ NSLOG(netsurf, INFO, "Executing script: %s", full_script_path);
ami_arexx_command(full_script_path, NULL);
UnLock(lock);
}
@@ -366,7 +366,7 @@ RXHOOKF(rx_save)
FWrite(fh, source_data, 1, source_size);
FClose(fh);
- SetComment((char *)cmd->ac_ArgList[0], nsurl_access(browser_window_get_url(gw->bw)));
+ SetComment((char *)cmd->ac_ArgList[0], nsurl_access(browser_window_access_url(gw->bw)));
}
ami_reset_pointer(gw->shared);
@@ -395,7 +395,7 @@ RXHOOKF(rx_geturl)
if(gw && gw->bw)
{
- strcpy(result, nsurl_access(browser_window_get_url(gw->bw)));
+ strcpy(result, nsurl_access(browser_window_access_url(gw->bw)));
}
else
{
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 5fc772ba3..0fde677ae 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -161,7 +161,10 @@ static void amiga_bitmap_unmap_buffer(void *p)
struct bitmap *bm = p;
if((nsoption_bool(use_extmem) == true) && (bm->pixdata != NULL)) {
- LOG("Unmapping ExtMem object %p for bitmap %p", bm->iextmem, bm);
+ NSLOG(netsurf, INFO,
+ "Unmapping ExtMem object %p for bitmap %p",
+ bm->iextmem,
+ bm);
bm->iextmem->Unmap(bm->pixdata, bm->size);
bm->pixdata = NULL;
}
@@ -176,7 +179,10 @@ unsigned char *amiga_bitmap_get_buffer(void *bitmap)
#ifdef __amigaos4__
if(nsoption_bool(use_extmem) == true) {
if(bm->pixdata == NULL) {
- LOG("Mapping ExtMem object %p for bitmap %p", bm->iextmem, bm);
+ NSLOG(netsurf, INFO,
+ "Mapping ExtMem object %p for bitmap %p",
+ bm->iextmem,
+ bm);
bm->pixdata = bm->iextmem->Map(NULL, bm->size, 0LL, 0);
}
@@ -596,8 +602,12 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
TAG_DONE);
if (err != COMPERR_Success) {
- LOG("Composite error %ld - falling back", err);
- /* If it failed, do it again the way which works in software */
+ NSLOG(netsurf, INFO,
+ "Composite error %ld - falling back",
+ err);
+ /* If it failed, do it again the way
+ * which works in software
+ */
#else
{
#endif
@@ -611,7 +621,8 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
TAG_DONE);
/* If it still fails... it's non-fatal */
- LOG("Fallback returned error %ld", err);
+ NSLOG(netsurf, INFO,
+ "Fallback returned error %ld", err);
}
} else /* Do it the old-fashioned way. This is pretty slow, even on OS4.1 */
#endif
@@ -703,11 +714,11 @@ static inline struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap,
}
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
- int width, int height, struct BitMap *friendbm)
+ int width, int height, bool palette_mapped, struct BitMap *friendbm)
{
if(bitmap == NULL) return NULL;
- if(__builtin_expect(ami_plot_screen_is_palettemapped() == true, 0)) {
+ if(__builtin_expect(palette_mapped == true, 0)) {
return ami_bitmap_get_palettemapped(bitmap, width, height, friendbm);
} else {
return ami_bitmap_get_truecolour(bitmap, width, height, friendbm);
@@ -723,28 +734,25 @@ void ami_bitmap_fini(void)
static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content)
{
#ifdef __amigaos4__
- LOG("Entering bitmap_render");
-
- struct redraw_context ctx = {
- .interactive = false,
- .background_images = true,
- .plot = &amiplot
- };
+ NSLOG(netsurf, INFO, "Entering bitmap_render");
int plot_width;
int plot_height;
- struct gui_globals bm_globals;
- struct gui_globals *temp_gg = glob;
+ struct gui_globals *bm_globals;
plot_width = MIN(content_get_width(content), bitmap->width);
plot_height = ((plot_width * bitmap->height) + (bitmap->width / 2)) /
bitmap->width;
- ami_init_layers(&bm_globals, bitmap->width, bitmap->height, true);
- bm_globals.shared_pens = NULL;
+ bm_globals = ami_plot_ra_alloc(bitmap->width, bitmap->height, true, false);
+ ami_clearclipreg(bm_globals);
- glob = &bm_globals;
- ami_clearclipreg(&bm_globals);
+ struct redraw_context ctx = {
+ .interactive = false,
+ .background_images = true,
+ .plot = &amiplot,
+ .priv = bm_globals
+ };
content_scaled_redraw(content, plot_width, plot_height, &ctx);
@@ -752,7 +760,7 @@ static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *conte
BLITA_SrcY, 0,
BLITA_Width, bitmap->width,
BLITA_Height, bitmap->height,
- BLITA_Source, bm_globals.bm,
+ BLITA_Source, ami_plot_ra_get_bitmap(bm_globals),
BLITA_SrcType, BLITT_BITMAP,
BLITA_Dest, amiga_bitmap_get_buffer(bitmap),
BLITA_DestType, BLITT_ARGB32,
@@ -766,14 +774,8 @@ static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *conte
/**\todo In theory we should be able to move the bitmap to our native area
to try to avoid re-conversion (at the expense of memory) */
- ami_free_layers(&bm_globals);
+ ami_plot_ra_free(bm_globals);
amiga_bitmap_set_opaque(bitmap, true);
-
- /* Restore previous render area. This is set when plotting starts,
- * but if bitmap_render is called *during* a browser render then
- * having an invalid pointer here causes NetSurf to crash.
- */
- glob = temp_gg;
#else
#warning FIXME for OS3 (in current state none of bitmap_render can work!)
#endif
diff --git a/frontends/amiga/bitmap.h b/frontends/amiga/bitmap.h
index a32d740df..aaec26ac2 100755
--- a/frontends/amiga/bitmap.h
+++ b/frontends/amiga/bitmap.h
@@ -31,9 +31,10 @@
extern struct gui_bitmap_table *amiga_bitmap_table;
struct bitmap;
struct nsurl;
+struct gui_globals;
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
- int width, int height, struct BitMap *friendbm);
+ int width, int height, bool palette_mapped, struct BitMap *friendbm);
PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
int height, struct BitMap *n_bm);
@@ -75,8 +76,7 @@ void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata);
/**
* Free an icondata pointer
*
- * \param bm a bitmap, as returned by bitmap_create()
- * \param icondata a pointer to memory
+ * \param bm a bitmap, as returned by bitmap_create()
*
* This function probably shouldn't be here!
*/
diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
index 877805cda..45e883fde 100644
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -136,7 +136,7 @@ ami_cookies_mouse(struct ami_corewindow *ami_cw,
/**
* callback for keypress for cookies viewer on core window
*
- * \param example_cw The Amiga core window structure.
+ * \param ami_cw The Amiga core window structure.
* \param nskey The netsurf key code
* \return NSERROR_OK on success otherwise apropriate error code
*/
@@ -153,6 +153,8 @@ ami_cookies_key(struct ami_corewindow *ami_cw, uint32_t nskey)
* callback on draw event for cookies viewer on core window
*
* \param ami_cw The Amiga core window structure.
+ * \param x The x cordinate to plot at
+ * \param y The y cordinate to plot at
* \param r The rectangle of the window that needs updating.
* \param ctx The drawing context
* \return NSERROR_OK on success otherwise apropriate error code
@@ -362,7 +364,7 @@ nserror ami_cookies_present(void)
res = ami_cookies_create_window(ncwin);
if (res != NSERROR_OK) {
- LOG("SSL UI builder init failed");
+ NSLOG(netsurf, INFO, "SSL UI builder init failed");
ami_utf8_free(ncwin->core.wintitle);
free(ncwin);
return res;
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 0ed16d1ee..42ee866ea 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -47,6 +47,7 @@
#include "netsurf/plot_style.h"
#include <proto/exec.h>
+#include <proto/graphics.h>
#include <proto/intuition.h>
#include <proto/layout.h>
#include <proto/utility.h>
@@ -202,15 +203,16 @@ ami_cw_key(struct ami_corewindow *ami_cw, int nskey)
/**
* Redraw functions
*
- * This is slightly over-engineered as it was taken from the main browser/old tree redraws
- * and supports deferred drawing of rectangles and tiling
+ * This is slightly over-engineered as it was taken from the main
+ * browser/old tree redraws and supports deferred drawing of
+ * rectangles and tiling
*/
/**
* Redraw an area of a core window
*
- * \param g a struct ami_corewindow
- * \param r rect (in document co-ordinates)
+ * \param ami_cw An Amiga core window structure
+ * \param r rect (in document co-ordinates)
*/
static void
@@ -219,8 +221,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
struct IBox *bbox;
ULONG pos_x, pos_y;
struct rect draw_rect;
- int tile_size_x = ami_cw->gg.width;
- int tile_size_y = ami_cw->gg.height;
+ int tile_size_x;
+ int tile_size_y;
int tile_x, tile_y, tile_w, tile_h;
int x = r->x0;
int y = r->y0;
@@ -230,7 +232,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
- .plot = &amiplot
+ .plot = &amiplot,
+ .priv = ami_cw->gg
};
if(ami_gui_get_space_box((Object *)ami_cw->objects[GID_CW_DRAW], &bbox) != NSERROR_OK) {
@@ -240,8 +243,6 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
ami_cw_scroller_top(ami_cw, &pos_x, &pos_y);
- glob = &ami_cw->gg;
-
if(x - pos_x + width > bbox->Width) width = bbox->Width - (x - pos_x);
if(y - pos_y + height > bbox->Height) height = bbox->Height - (y - pos_y);
@@ -255,6 +256,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
y = pos_y;
}
+ ami_plot_ra_get_size(ami_cw->gg, &tile_size_x, &tile_size_y);
+
for(tile_y = y; tile_y < (y + height); tile_y += tile_size_y) {
tile_h = tile_size_y;
if(((y + height) - tile_y) < tile_size_y)
@@ -274,7 +277,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
#ifdef __amigaos4__
BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
- BLITA_Source, ami_cw->gg.bm,
+ BLITA_Source, ami_plot_ra_get_bitmap(ami_cw->gg),
BLITA_SrcX, 0,
BLITA_SrcY, 0,
BLITA_DestType, BLITT_RASTPORT,
@@ -285,7 +288,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
BLITA_Height, tile_h,
TAG_DONE);
#else
- BltBitMapRastPort(ami_cw->gg.bm, 0, 0,
+ BltBitMapRastPort(ami_plot_ra_get_bitmap(ami_cw->gg), 0, 0,
ami_cw->win->RPort, bbox->Left + tile_x - pos_x, bbox->Top + tile_y - pos_y,
tile_w, tile_h, 0xC0);
#endif
@@ -293,15 +296,15 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
}
ami_gui_free_space_box(bbox);
- ami_clearclipreg(glob);
- ami_gui_set_default_gg();
+ ami_clearclipreg(ami_cw->gg);
}
/**
* Draw the deferred rectangles
*
- * @param draw set to false to just delete the queue
+ * \param ami_cw An Amiga core window structure to queue redraw
+ * \param draw set to false to just delete the queue
*/
static void ami_cw_redraw_queue(struct ami_corewindow *ami_cw, bool draw)
{
@@ -312,7 +315,7 @@ static void ami_cw_redraw_queue(struct ami_corewindow *ami_cw, bool draw)
if(IsMinListEmpty(ami_cw->deferred_rects)) return;
if(draw == false) {
- LOG("Ignoring deferred box redraw queue");
+ NSLOG(netsurf, INFO, "Ignoring deferred box redraw queue");
} // else should probably show busy pointer
node = (struct nsObject *)GetHead((struct List *)ami_cw->deferred_rects);
@@ -375,7 +378,8 @@ ami_cw_redraw(struct ami_corewindow *ami_cw, const struct rect *restrict r)
nsobj = AddObject(ami_cw->deferred_rects, AMINS_RECT);
nsobj->objstruct = deferred_rect;
} else {
- LOG("Ignoring duplicate or subset of queued box redraw");
+ NSLOG(netsurf, INFO,
+ "Ignoring duplicate or subset of queued box redraw");
}
ami_schedule(1, ami_cw_redraw_cb, ami_cw);
}
@@ -522,7 +526,8 @@ HOOKF(void, ami_cw_idcmp_hook, Object *, object, struct IntuiMessage *)
break;
default:
- LOG("IDCMP hook unhandled event: %ld", msg->Class);
+ NSLOG(netsurf, INFO,
+ "IDCMP hook unhandled event: %ld", msg->Class);
break;
}
}
@@ -794,15 +799,26 @@ static const struct ami_win_event_table ami_cw_table = {
ami_cw_close,
};
+
/**
- * callback from core to request a redraw
+ * callback from core to request an invalidation of a amiga core window area.
+ *
+ * The specified area of the window should now be considered
+ * out of date. If the area is NULL the entire window must be
+ * invalidated.
+ *
+ * \param[in] cw The core window to invalidate.
+ * \param[in] r area to redraw or NULL for the entire window area.
+ * \return NSERROR_OK on success or appropriate error code.
*/
-static void
-ami_cw_redraw_request(struct core_window *cw, const struct rect *r)
+static nserror
+ami_cw_invalidate_area(struct core_window *cw, const struct rect *r)
{
struct ami_corewindow *ami_cw = (struct ami_corewindow *)cw;
ami_cw_redraw(ami_cw, r);
+
+ return NSERROR_OK;
}
@@ -894,7 +910,7 @@ ami_cw_drag_status(struct core_window *cw, core_window_drag_status ds)
struct core_window_callback_table ami_cw_cb_table = {
- .redraw_request = ami_cw_redraw_request,
+ .invalidate = ami_cw_invalidate_area,
.update_size = ami_cw_update_size,
.scroll_visible = ami_cw_scroll_visible,
.get_window_dimensions = ami_cw_get_window_dimensions,
@@ -906,6 +922,7 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
{
/* setup the core window callback table */
ami_cw->cb_table = &ami_cw_cb_table;
+ ami_cw->drag_status = CORE_WINDOW_DRAG_NONE;
/* clear some vars */
ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
@@ -917,8 +934,7 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
ami_cw->dragging = false;
/* allocate drawing area etc */
- ami_init_layers(&ami_cw->gg, 100, 100, false); // force tiles to save memory
- ami_cw->gg.shared_pens = ami_AllocMinList();
+ ami_cw->gg = ami_plot_ra_alloc(100, 100, false, true); // force tiles to save memory
ami_cw->deferred_rects = NewObjList();
ami_cw->deferred_rects_pool = ami_memory_itempool_create(sizeof(struct rect));
@@ -988,8 +1004,7 @@ nserror ami_corewindow_fini(struct ami_corewindow *ami_cw)
#endif
/* release off-screen bitmap stuff */
- ami_plot_release_pens(ami_cw->gg.shared_pens);
- ami_free_layers(&ami_cw->gg);
+ ami_plot_ra_free(ami_cw->gg);
/* free the window title */
ami_utf8_free(ami_cw->wintitle);
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index cfcd7fc5e..ea01f67f1 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -76,7 +76,7 @@ struct ami_corewindow {
char *wintitle;
/** stuff for our off-screen render bitmap */
- struct gui_globals gg;
+ struct gui_globals *gg;
struct MinList *shared_pens;
/** drag status set by core */
@@ -171,7 +171,7 @@ struct ami_corewindow {
*
* As a pre-requisite the draw, key and mouse callbacks must be defined
*
- * \param example_cw An Amiga core window structure to initialise
+ * \param ami_cw An Amiga core window structure to initialise
* \return NSERROR_OK on successful initialisation otherwise error code.
*/
nserror ami_corewindow_init(struct ami_corewindow *ami_cw);
diff --git a/frontends/amiga/ctxmenu.c b/frontends/amiga/ctxmenu.c
index 717096f52..a6755e610 100644
--- a/frontends/amiga/ctxmenu.c
+++ b/frontends/amiga/ctxmenu.c
@@ -146,7 +146,7 @@ HOOKF(void, ami_ctxmenu_item_urlopentab, APTR, window, struct IntuiMessage *)
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
nserror error = browser_window_create(BW_CREATE_CLONE | BW_CREATE_HISTORY | BW_CREATE_TAB,
url,
- browser_window_get_url(gwin->gw->bw),
+ browser_window_access_url(gwin->gw->bw),
gwin->gw->bw,
&bw);
@@ -163,7 +163,7 @@ HOOKF(void, ami_ctxmenu_item_urlopenwin, APTR, window, struct IntuiMessage *)
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
nserror error = browser_window_create(BW_CREATE_CLONE | BW_CREATE_HISTORY,
url,
- browser_window_get_url(gwin->gw->bw),
+ browser_window_access_url(gwin->gw->bw),
gwin->gw->bw,
&bw);
@@ -180,7 +180,7 @@ HOOKF(void, ami_ctxmenu_item_urldownload, APTR, window, struct IntuiMessage *)
browser_window_navigate(gwin->gw->bw,
url,
- browser_window_get_url(gwin->gw->bw),
+ browser_window_access_url(gwin->gw->bw),
BW_NAVIGATE_DOWNLOAD,
NULL,
NULL,
@@ -200,7 +200,7 @@ HOOKF(void, ami_ctxmenu_item_objshow, APTR, window, struct IntuiMessage *)
browser_window_navigate(gwin->gw->bw,
hlcache_handle_get_url(hook->h_Data),
- browser_window_get_url(gwin->gw->bw),
+ browser_window_access_url(gwin->gw->bw),
BW_NAVIGATE_HISTORY,
NULL,
NULL,
@@ -240,7 +240,7 @@ HOOKF(void, ami_ctxmenu_item_frameshow, APTR, window, struct IntuiMessage *)
browser_window_navigate(gwin->gw->bw,
hlcache_handle_get_url(hook->h_Data),
- browser_window_get_url(gwin->gw->bw),
+ browser_window_access_url(gwin->gw->bw),
BW_NAVIGATE_HISTORY,
NULL,
NULL,
diff --git a/frontends/amiga/dist/NetSurf.guide b/frontends/amiga/dist/NetSurf.guide
index 512a264e6..0bdd90076 100755
--- a/frontends/amiga/dist/NetSurf.guide
+++ b/frontends/amiga/dist/NetSurf.guide
@@ -144,8 +144,9 @@ There are a couple of Amiga-specific options which can only be changed directly
@{b}redraw_tile_size_x@{ub}/@{b}redraw_tile_size_y@{ub} Specify the size of the off-screen bitmap. Higher will speed up redraws at the expense of memory. 0 disables tiling (will use a bitmap at least the size of the screen NetSurf is running on)
@{b}web_search_width@{ub} Defaults to 0. Larger values will increase the size of the web search gadget next to the URL bar.
@{b}mask_alpha@{ub} Threshold to use when determining which alpha values to convert to full transparency (0 - 255, where 255 will convert even opaque pixels to transparent). Defaults to 0. This is only used in palette-mapped modes where alpha blending is not currently supported.
-@{b}tab_new_session{ub} If NetSurf is already running, this will cause any passed URLs to open in a new tab rather than a new window.
+@{b}tab_new_session@{ub} If NetSurf is already running, this will cause any passed URLs to open in a new tab rather than a new window.
@{b}use_extmem@{ub} Defaults to 1 (enabled). Setting to 0 will prevent NetSurf using Extended Memory to store uncompressed images - this may have a performance benefit and no disadvantage for <2GB configurations. OS4.1FEU1 only.
+@{b}download_notify_progress@{ub} Defaults to 0 (disabled). Display download progress in a Ringhio notification. Requires Enhancer Pack (Ringhio 53.65+), behaviour without it is undefined.
@{b}url_file@{ub} Path to URL database file
@{b}hotlist_file@{ub} Path to Hotlist file
@{b}arexx_dir@{ub} Path to ARexx scripts dir
diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c
index 47485e0da..41ff6a689 100644
--- a/frontends/amiga/download.c
+++ b/frontends/amiga/download.c
@@ -68,6 +68,18 @@
#include "amiga/theme.h"
#include "amiga/utf8.h"
+#ifndef APPNOTIFY_DisplayTime
+#define APPNOTIFY_DisplayTime ( TAG_USER + 13 )
+#endif
+
+#ifndef APPNOTIFY_Percentage
+#define APPNOTIFY_Percentage ( TAG_USER + 14 )
+#endif
+
+#ifndef APPNOTIFY_StopBackMsg
+#define APPNOTIFY_StopBackMsg ( TAG_USER + 17 )
+#endif
+
struct gui_download_window {
struct ami_generic_window w;
struct Window *win;
@@ -75,6 +87,7 @@ struct gui_download_window {
BPTR fh;
uint32 size;
uint32 downloaded;
+ uint32 progress;
struct dlnode *dln;
struct browser_window *bw;
struct download_context *ctx;
@@ -84,7 +97,8 @@ struct gui_download_window {
};
enum {
- AMINS_DLOAD_OK = 0,
+ AMINS_DLOAD_PROGRESS = 0,
+ AMINS_DLOAD_OK,
AMINS_DLOAD_ERROR,
AMINS_DLOAD_ABORT,
};
@@ -157,7 +171,19 @@ static struct gui_download_window *gui_download_window_create(download_context *
return NULL;
}
- dw->objects[OID_MAIN] = WindowObj,
+ if((nsoption_bool(download_notify_progress) == true)) {
+ char bkm[1030];
+ snprintf(bkm, 1030, "STOP %p", dw);
+
+ Notify(ami_gui_get_app_id(), APPNOTIFY_Title, messages_get("amiDownloading"),
+ APPNOTIFY_PubScreenName, "FRONT",
+ APPNOTIFY_Text, dw->fname,
+ APPNOTIFY_DisplayTime, TRUE,
+ APPNOTIFY_Percentage, 0,
+ APPNOTIFY_StopBackMsg, bkm,
+ TAG_DONE);
+ } else {
+ dw->objects[OID_MAIN] = WindowObj,
WA_ScreenTitle, ami_gui_get_screen_title(),
WA_Title, dw->url,
WA_Activate, TRUE,
@@ -195,8 +221,11 @@ static struct gui_download_window *gui_download_window_create(download_context *
EndGroup,
EndWindow;
- dw->win = (struct Window *)RA_OpenWindow(dw->objects[OID_MAIN]);
+ dw->win = (struct Window *)RA_OpenWindow(dw->objects[OID_MAIN]);
+ }
+
dw->ctx = ctx;
+ dw->result = AMINS_DLOAD_PROGRESS;
ami_gui_win_list_add(dw, AMINS_DLWINDOW, &ami_download_table);
@@ -219,21 +248,35 @@ static nserror gui_download_window_data(struct gui_download_window *dw,
va[1] = (APTR)dw->size;
va[2] = 0;
- if(dw->size)
- {
- RefreshSetGadgetAttrs((struct Gadget *)dw->objects[GID_STATUS], dw->win, NULL,
+ if(dw->size) {
+ if((nsoption_bool(download_notify_progress) == true) &&
+ (((dw->downloaded * 100) / dw->size) > dw->progress)) {
+ dw->progress = (uint32)((dw->downloaded * 100) / dw->size);
+ Notify(ami_gui_get_app_id(),
+ APPNOTIFY_Percentage, dw->progress,
+ TAG_DONE);
+ } else {
+ RefreshSetGadgetAttrs((struct Gadget *)dw->objects[GID_STATUS], dw->win, NULL,
FUELGAUGE_Level, dw->downloaded,
GA_Text, messages_get("amiDownload"),
FUELGAUGE_VarArgs, va,
TAG_DONE);
+ }
}
else
{
- RefreshSetGadgetAttrs((struct Gadget *)dw->objects[GID_STATUS], dw->win, NULL,
+ if((nsoption_bool(download_notify_progress) == true)) {
+ /* unknown size, not entirely sure how to deal with this atm... */
+ Notify(ami_gui_get_app_id(),
+ APPNOTIFY_Percentage, 100,
+ TAG_DONE);
+ } else {
+ RefreshSetGadgetAttrs((struct Gadget *)dw->objects[GID_STATUS], dw->win, NULL,
FUELGAUGE_Level, dw->downloaded,
GA_Text, messages_get("amiDownloadU"),
FUELGAUGE_VarArgs, va,
TAG_DONE);
+ }
}
return NSERROR_OK;
@@ -248,11 +291,23 @@ static void gui_download_window_done(struct gui_download_window *dw)
if(!dw) return;
bw = dw->bw;
+ if(dw->result == AMINS_DLOAD_PROGRESS)
+ dw->result = AMINS_DLOAD_OK;
+
+ if((nsoption_bool(download_notify_progress) == true)) {
+ Notify(ami_gui_get_app_id(),
+ APPNOTIFY_Update, TRUE,
+ TAG_DONE);
+ }
+
if((nsoption_bool(download_notify)) && (dw->result == AMINS_DLOAD_OK))
{
+ char bkm[1030];
+ snprintf(bkm, 1030, "OPEN %s", dw->fname);
+
Notify(ami_gui_get_app_id(), APPNOTIFY_Title, messages_get("amiDownloadComplete"),
APPNOTIFY_PubScreenName, "FRONT",
- APPNOTIFY_BackMsg, dw->fname,
+ APPNOTIFY_BackMsg, bkm,
APPNOTIFY_CloseOnDC, TRUE,
APPNOTIFY_Text, dw->fname,
TAG_DONE);
@@ -275,7 +330,10 @@ static void gui_download_window_done(struct gui_download_window *dw)
downloads_in_progress--;
- DisposeObject(dw->objects[OID_MAIN]);
+ if(dw->objects[OID_MAIN] != NULL) {
+ DisposeObject(dw->objects[OID_MAIN]);
+ }
+
ami_gui_win_list_remove(dw);
if(queuedl) {
nsurl *url;
@@ -305,7 +363,7 @@ static void gui_download_window_error(struct gui_download_window *dw,
static void ami_download_window_abort(void *w)
{
- struct gui_download_window *dw = (struct gui_download_window *)dw;
+ struct gui_download_window *dw = (struct gui_download_window *)w;
download_context_abort(dw->ctx);
dw->result = AMINS_DLOAD_ABORT;
gui_download_window_done(dw);
@@ -318,6 +376,8 @@ static BOOL ami_download_window_event(void *w)
ULONG result;
uint16 code;
+ if(dw == NULL) return FALSE; /* We may not have a real window */
+
while((result = RA_HandleInput(dw->objects[OID_MAIN], &code)) != WMHI_LASTMSG)
{
switch(result & WMHI_CLASSMASK) // class
@@ -449,6 +509,13 @@ BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG si
else return FALSE;
}
+void ami_download_parse_backmsg(const char *backmsg)
+{
+ if((backmsg[0] == 'O') && (backmsg[1] == 'P') && (backmsg[2] == 'E') && (backmsg[3] == 'N')) {
+ OpenWorkbenchObjectA((backmsg + 5), NULL);
+ }
+}
+
static struct gui_download_table download_table = {
.create = gui_download_window_create,
.data = gui_download_window_data,
diff --git a/frontends/amiga/download.h b/frontends/amiga/download.h
index b60b4f002..1c2a3d010 100755
--- a/frontends/amiga/download.h
+++ b/frontends/amiga/download.h
@@ -36,7 +36,7 @@ struct dlnode
void ami_free_download_list(struct List *dllist);
BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG size);
+void ami_download_parse_backmsg(const char *backmsg);
nserror gui_window_save_link(struct gui_window *g, struct nsurl *url, const char *title);
-
#endif
diff --git a/frontends/amiga/drag.c b/frontends/amiga/drag.c
index 92617dd13..ec0ee3c6a 100644
--- a/frontends/amiga/drag.c
+++ b/frontends/amiga/drag.c
@@ -110,6 +110,8 @@ void ami_drag_save(struct Window *win)
ULONG which = WBO_NONE, type;
char path[1025], dpath[1025];
+ path[0] = 0; /* ensure path is terminated */
+
ami_drag_icon_close(NULL);
ami_autoscroll = true;
@@ -186,7 +188,8 @@ void ami_drag_save(struct Window *win)
break;
default:
- LOG("Unsupported drag save operation %d", drag_save);
+ NSLOG(netsurf, INFO,
+ "Unsupported drag save operation %d", drag_save);
break;
}
diff --git a/frontends/amiga/dt_anim.c b/frontends/amiga/dt_anim.c
index a48633403..bd049206c 100644
--- a/frontends/amiga/dt_anim.c
+++ b/frontends/amiga/dt_anim.c
@@ -162,7 +162,7 @@ nserror amiga_dt_anim_create(const content_handler *handler,
bool amiga_dt_anim_convert(struct content *c)
{
- LOG("amiga_dt_anim_convert");
+ NSLOG(netsurf, INFO, "amiga_dt_anim_convert");
amiga_dt_anim_content *plugin = (amiga_dt_anim_content *) c;
union content_msg_data msg_data;
@@ -190,7 +190,7 @@ bool amiga_dt_anim_convert(struct content *c)
plugin->bitmap = amiga_bitmap_create(width, height, bm_flags);
if (!plugin->bitmap) {
msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -246,7 +246,7 @@ void amiga_dt_anim_destroy(struct content *c)
{
amiga_dt_anim_content *plugin = (amiga_dt_anim_content *) c;
- LOG("amiga_dt_anim_destroy");
+ NSLOG(netsurf, INFO, "amiga_dt_anim_destroy");
if (plugin->bitmap != NULL)
amiga_bitmap_destroy(plugin->bitmap);
@@ -263,15 +263,18 @@ bool amiga_dt_anim_redraw(struct content *c,
amiga_dt_anim_content *plugin = (amiga_dt_anim_content *) c;
bitmap_flags_t flags = BITMAPF_NONE;
- LOG("amiga_dt_anim_redraw");
+ NSLOG(netsurf, INFO, "amiga_dt_anim_redraw");
if (data->repeat_x)
flags |= BITMAPF_REPEAT_X;
if (data->repeat_y)
flags |= BITMAPF_REPEAT_Y;
- return ctx->plot->bitmap(data->x, data->y, data->width, data->height,
- plugin->bitmap, data->background_colour, flags);
+ return (ctx->plot->bitmap(ctx, plugin->bitmap,
+ data->x, data->y,
+ data->width, data->height,
+ data->background_colour,
+ flags) == NSERROR_OK);
}
/**
@@ -287,20 +290,20 @@ bool amiga_dt_anim_redraw(struct content *c,
void amiga_dt_anim_open(struct content *c, struct browser_window *bw,
struct content *page, struct object_params *params)
{
- LOG("amiga_dt_anim_open");
+ NSLOG(netsurf, INFO, "amiga_dt_anim_open");
return;
}
void amiga_dt_anim_close(struct content *c)
{
- LOG("amiga_dt_anim_close");
+ NSLOG(netsurf, INFO, "amiga_dt_anim_close");
return;
}
void amiga_dt_anim_reformat(struct content *c, int width, int height)
{
- LOG("amiga_dt_anim_reformat");
+ NSLOG(netsurf, INFO, "amiga_dt_anim_reformat");
return;
}
@@ -309,7 +312,7 @@ nserror amiga_dt_anim_clone(const struct content *old, struct content **newc)
amiga_dt_anim_content *plugin;
nserror error;
- LOG("amiga_dt_anim_clone");
+ NSLOG(netsurf, INFO, "amiga_dt_anim_clone");
plugin = calloc(1, sizeof(amiga_dt_anim_content));
if (plugin == NULL)
diff --git a/frontends/amiga/dt_picture.c b/frontends/amiga/dt_picture.c
index e7f1c9724..88ce1c834 100644
--- a/frontends/amiga/dt_picture.c
+++ b/frontends/amiga/dt_picture.c
@@ -174,7 +174,7 @@ static char *amiga_dt_picture_datatype(struct content *c)
static struct bitmap *amiga_dt_picture_cache_convert(struct content *c)
{
- LOG("amiga_dt_picture_cache_convert");
+ NSLOG(netsurf, INFO, "amiga_dt_picture_cache_convert");
union content_msg_data msg_data;
UBYTE *bm_buffer;
@@ -187,7 +187,7 @@ static struct bitmap *amiga_dt_picture_cache_convert(struct content *c)
bitmap = amiga_bitmap_create(c->width, c->height, BITMAP_NEW);
if (!bitmap) {
msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return NULL;
}
@@ -210,7 +210,7 @@ static struct bitmap *amiga_dt_picture_cache_convert(struct content *c)
bool amiga_dt_picture_convert(struct content *c)
{
- LOG("amiga_dt_picture_convert");
+ NSLOG(netsurf, INFO, "amiga_dt_picture_convert");
int width, height;
char *title;
@@ -256,7 +256,7 @@ nserror amiga_dt_picture_clone(const struct content *old, struct content **newc)
struct content *adt;
nserror error;
- LOG("amiga_dt_picture_clone");
+ NSLOG(netsurf, INFO, "amiga_dt_picture_clone");
adt = calloc(1, sizeof(struct content));
if (adt == NULL)
diff --git a/frontends/amiga/dt_sound.c b/frontends/amiga/dt_sound.c
index 55fc60d61..f3b365ddb 100644
--- a/frontends/amiga/dt_sound.c
+++ b/frontends/amiga/dt_sound.c
@@ -33,7 +33,7 @@
#include "utils/messages.h"
#include "netsurf/plotters.h"
#include "netsurf/content.h"
-#include "render/box.h"
+#include "html/box.h"
#include "content/llcache.h"
#include "content/content_protected.h"
@@ -76,7 +76,7 @@ static const content_handler amiga_dt_sound_content_handler = {
static void amiga_dt_sound_play(Object *dto)
{
- LOG("Playing...");
+ NSLOG(netsurf, INFO, "Playing...");
IDoMethod(dto, DTM_TRIGGER, NULL, STM_PLAY, NULL);
}
@@ -126,7 +126,7 @@ nserror amiga_dt_sound_create(const content_handler *handler,
amiga_dt_sound_content *plugin;
nserror error;
- LOG("amiga_dt_sound_create");
+ NSLOG(netsurf, INFO, "amiga_dt_sound_create");
plugin = calloc(1, sizeof(amiga_dt_sound_content));
if (plugin == NULL)
@@ -146,7 +146,7 @@ nserror amiga_dt_sound_create(const content_handler *handler,
bool amiga_dt_sound_convert(struct content *c)
{
- LOG("amiga_dt_sound_convert");
+ NSLOG(netsurf, INFO, "amiga_dt_sound_convert");
amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
int width = 50, height = 50;
@@ -180,7 +180,7 @@ void amiga_dt_sound_destroy(struct content *c)
{
amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
- LOG("amiga_dt_sound_destroy");
+ NSLOG(netsurf, INFO, "amiga_dt_sound_destroy");
DisposeDTObject(plugin->dto);
@@ -195,20 +195,27 @@ bool amiga_dt_sound_redraw(struct content *c,
.fill_type = PLOT_OP_TYPE_SOLID,
.fill_colour = 0xffffff,
.stroke_colour = 0x000000,
- .stroke_width = 1,
+ .stroke_width = plot_style_int_to_fixed(1),
};
+ struct rect rect;
- LOG("amiga_dt_sound_redraw");
+ NSLOG(netsurf, INFO, "amiga_dt_sound_redraw");
+
+ rect.x0 = data->x;
+ rect.y0 = data->y;
+ rect.x1 = data->x + data->width;
+ rect.y1 = data->y + data->height;
/* this should be some sort of play/stop control */
- ctx->plot->rectangle(data->x, data->y, data->x + data->width,
- data->y + data->height, &pstyle);
+ ctx->plot->rectangle(ctx, &pstyle, &rect);
- return ctx->plot->text(data->x, data->y+20,
- lwc_string_data(content__get_mime_type(c)),
- lwc_string_length(content__get_mime_type(c)),
- plot_style_font);
+ return (ctx->plot->text(ctx,
+ plot_style_font,
+ data->x,
+ data->y+20,
+ lwc_string_data(content__get_mime_type(c)),
+ lwc_string_length(content__get_mime_type(c))) == NSERROR_OK);
}
@@ -219,7 +226,7 @@ void amiga_dt_sound_open(struct content *c, struct browser_window *bw,
amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
struct object_param *param;
- LOG("amiga_dt_sound_open");
+ NSLOG(netsurf, INFO, "amiga_dt_sound_open");
plugin->immediate = false;
@@ -227,7 +234,8 @@ void amiga_dt_sound_open(struct content *c, struct browser_window *bw,
{
do
{
- LOG("%s = %s", param->name, param->value);
+ NSLOG(netsurf, INFO, "%s = %s", param->name,
+ param->value);
if((strcmp(param->name, "autoplay") == 0) &&
(strcmp(param->value, "true") == 0)) plugin->immediate = true;
if((strcmp(param->name, "autoStart") == 0) &&
@@ -248,7 +256,7 @@ nserror amiga_dt_sound_clone(const struct content *old, struct content **newc)
amiga_dt_sound_content *plugin;
nserror error;
- LOG("amiga_dt_sound_clone");
+ NSLOG(netsurf, INFO, "amiga_dt_sound_clone");
plugin = calloc(1, sizeof(amiga_dt_sound_content));
if (plugin == NULL)
diff --git a/frontends/amiga/filetype.c b/frontends/amiga/filetype.c
index a0449d848..0e535de07 100644
--- a/frontends/amiga/filetype.c
+++ b/frontends/amiga/filetype.c
@@ -185,7 +185,7 @@ nserror ami_mime_init(const char *mimefile)
struct nsObject *node;
struct ami_mime_entry *mimeentry;
- LOG("mimetypes file: %s", mimefile);
+ NSLOG(netsurf, INFO, "mimetypes file: %s", mimefile);
if(ami_mime_list == NULL)
ami_mime_list = NewObjList();
@@ -642,6 +642,10 @@ void ami_mime_dump(void)
struct ami_mime_entry *mimeentry;
while((mimeentry = ami_mime_entry_locate(NULL, AMI_MIME_MIMETYPE, &node))) {
- LOG("%s DT=\"%s\" TYPE=\"%s\" CMD=\"%s\"", mimeentry->mimetype ? lwc_string_data(mimeentry->mimetype) : "", mimeentry->datatype ? lwc_string_data(mimeentry->datatype) : "", mimeentry->filetype ? lwc_string_data(mimeentry->filetype) : "", mimeentry->plugincmd ? lwc_string_data(mimeentry->plugincmd) : "");
+ NSLOG(netsurf, INFO, "%s DT=\"%s\" TYPE=\"%s\" CMD=\"%s\"",
+ mimeentry->mimetype ? lwc_string_data(mimeentry->mimetype) : "",
+ mimeentry->datatype ? lwc_string_data(mimeentry->datatype) : "",
+ mimeentry->filetype ? lwc_string_data(mimeentry->filetype) : "",
+ mimeentry->plugincmd ? lwc_string_data(mimeentry->plugincmd) : "");
};
}
diff --git a/frontends/amiga/font.c b/frontends/amiga/font.c
index 22a0f4a4a..e69ff55f0 100644
--- a/frontends/amiga/font.c
+++ b/frontends/amiga/font.c
@@ -37,7 +37,7 @@ static ULONG ami_xdpi = 72;
ULONG ami_font_dpi_get_devicedpi(void)
{
- return ami_devicedpi;
+ return (ami_xdpi << 16) | ami_devicedpi;
}
ULONG ami_font_dpi_get_xdpi(void)
@@ -51,7 +51,8 @@ void ami_font_setdevicedpi(int id)
struct DisplayInfo dinfo;
if(nsoption_bool(bitmap_fonts) == true) {
- LOG("WARNING: Using diskfont.library for text. Forcing DPI to 72.");
+ NSLOG(netsurf, INFO,
+ "WARNING: Using diskfont.library for text. Forcing DPI to 72.");
nsoption_set_int(screen_ydpi, 72);
}
@@ -79,7 +80,14 @@ void ami_font_setdevicedpi(int id)
xdpi = (yres * ydpi) / xres;
- LOG("XDPI = %ld, YDPI = %ld (DisplayInfo resolution %d x %d, corrected %d x %d)", xdpi, ydpi, dinfo.Resolution.x, dinfo.Resolution.y, xres, yres);
+ NSLOG(netsurf, INFO,
+ "XDPI = %ld, YDPI = %ld (DisplayInfo resolution %d x %d, corrected %d x %d)",
+ xdpi,
+ ydpi,
+ dinfo.Resolution.x,
+ dinfo.Resolution.y,
+ xres,
+ yres);
}
}
}
diff --git a/frontends/amiga/font_bullet.c b/frontends/amiga/font_bullet.c
index fd41c29a2..62c2dde08 100644
--- a/frontends/amiga/font_bullet.c
+++ b/frontends/amiga/font_bullet.c
@@ -63,7 +63,7 @@
#define NSA_VALUE_SHEARSIN (1 << 14)
#define NSA_VALUE_SHEARCOS (1 << 16)
-#define NSA_FONT_EMWIDTH(s) (s / FONT_SIZE_SCALE) * (ami_font_dpi_get_xdpi() / 72.0)
+#define NSA_FONT_EMWIDTH(s) (s / PLOT_STYLE_SCALE) * (ami_font_dpi_get_xdpi() / 72.0)
const uint16 sc_table[] = {
0x0061, 0x1D00, /* a */
@@ -361,7 +361,7 @@ static struct ami_font_cache_node *ami_font_open(const char *font, bool critical
if(!nodedata->font)
{
- LOG("Requested font not found: %s", font);
+ NSLOG(netsurf, INFO, "Requested font not found: %s", font);
if(critical == true) amiga_warn_user("CompError", font);
free(nodedata);
return NULL;
@@ -369,21 +369,28 @@ static struct ami_font_cache_node *ami_font_open(const char *font, bool critical
nodedata->bold = (char *)GetTagData(OT_BName, 0, nodedata->font->olf_OTagList);
if(nodedata->bold)
- LOG("Bold font defined for %s is %s", font, nodedata->bold);
+ NSLOG(netsurf, INFO, "Bold font defined for %s is %s", font,
+ nodedata->bold);
else
- LOG("Warning: No designed bold font defined for %s", font);
+ NSLOG(netsurf, INFO,
+ "Warning: No designed bold font defined for %s", font);
nodedata->italic = (char *)GetTagData(OT_IName, 0, nodedata->font->olf_OTagList);
if(nodedata->italic)
- LOG("Italic font defined for %s is %s", font, nodedata->italic);
+ NSLOG(netsurf, INFO, "Italic font defined for %s is %s",
+ font, nodedata->italic);
else
- LOG("Warning: No designed italic font defined for %s", font);
+ NSLOG(netsurf, INFO,
+ "Warning: No designed italic font defined for %s", font);
nodedata->bolditalic = (char *)GetTagData(OT_BIName, 0, nodedata->font->olf_OTagList);
if(nodedata->bolditalic)
- LOG("Bold-italic font defined for %s is %s", font, nodedata->bolditalic);
+ NSLOG(netsurf, INFO, "Bold-italic font defined for %s is %s",
+ font, nodedata->bolditalic);
else
- LOG("Warning: No designed bold-italic font defined for %s", font);
+ NSLOG(netsurf, INFO,
+ "Warning: No designed bold-italic font defined for %s",
+ font);
ami_font_cache_insert(nodedata, font);
return nodedata;
@@ -505,7 +512,7 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle
}
/* Scale to 16.16 fixed point */
- ysize = fstyle->size * ((1 << 16) / FONT_SIZE_SCALE);
+ ysize = fstyle->size * ((1 << 16) / PLOT_STYLE_SCALE);
if(designed_node == NULL) {
ofont = node->font;
diff --git a/frontends/amiga/font_cache.c b/frontends/amiga/font_cache.c
index 3d8330979..86e2381c0 100644
--- a/frontends/amiga/font_cache.c
+++ b/frontends/amiga/font_cache.c
@@ -69,7 +69,10 @@ static void ami_font_cache_cleanup(struct SkipList *skiplist)
SubTime(&curtime, &node->lastused);
if(curtime.Seconds > 300)
{
- LOG("Freeing font %p not used for %ld seconds", node->skip_node.sn_Key, curtime.Seconds);
+ NSLOG(netsurf, INFO,
+ "Freeing font %p not used for %ld seconds",
+ node->skip_node.sn_Key,
+ curtime.Seconds);
ami_font_bullet_close(node);
RemoveSkipNode(skiplist, node->skip_node.sn_Key);
}
@@ -98,7 +101,10 @@ static void ami_font_cache_cleanup(struct MinList *ami_font_cache_list)
SubTime(&curtime, &fnode->lastused);
if(curtime.Seconds > 300)
{
- LOG("Freeing %s not used for %ld seconds", node->dtz_Node.ln_Name, curtime.Seconds);
+ NSLOG(netsurf, INFO,
+ "Freeing %s not used for %ld seconds",
+ node->dtz_Node.ln_Name,
+ curtime.Seconds);
DelObject(node);
}
} while((node=nnode));
@@ -146,7 +152,7 @@ struct ami_font_cache_node *ami_font_cache_locate(const char *font)
return nodedata;
}
- LOG("Font cache miss: %s (%lx)", font, hash);
+ NSLOG(netsurf, INFO, "Font cache miss: %s (%lx)", font, hash);
return NULL;
}
@@ -180,7 +186,7 @@ void ami_font_cache_insert(struct ami_font_cache_node *nodedata, const char *fon
void ami_font_cache_fini(void)
{
- LOG("Cleaning up font cache");
+ NSLOG(netsurf, INFO, "Cleaning up font cache");
ami_schedule(-1, (void *)ami_font_cache_cleanup, ami_font_cache_list);
#ifdef __amigaos4__
ami_font_cache_del_skiplist(ami_font_cache_list);
diff --git a/frontends/amiga/font_diskfont.c b/frontends/amiga/font_diskfont.c
index 8593f81b2..a587d6eaf 100644
--- a/frontends/amiga/font_diskfont.c
+++ b/frontends/amiga/font_diskfont.c
@@ -41,6 +41,7 @@
static plot_font_style_t *prev_fstyle = NULL;
static struct TextFont *prev_font = NULL;
+static struct RastPort temp_rp;
static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_style_t *fstyle)
{
@@ -54,7 +55,6 @@ static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_st
(fstyle->size == prev_fstyle->size) &&
(fstyle->flags == prev_fstyle->flags) &&
(fstyle->weight == prev_fstyle->weight)) {
- LOG("(using current font)");
return prev_font;
}
@@ -97,8 +97,8 @@ static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_st
snprintf(font, MAX_FONT_NAME_SIZE, "%s.font", fontname);
tattr.ta_Name = font;
- tattr.ta_YSize = fstyle->size / FONT_SIZE_SCALE;
- LOG("font: %s/%d", tattr.ta_Name, tattr.ta_YSize);
+ tattr.ta_YSize = fstyle->size / PLOT_STYLE_SCALE;
+ NSLOG(netsurf, INFO, "font: %s/%d", tattr.ta_Name, tattr.ta_YSize);
if(prev_font != NULL) CloseFont(prev_font);
@@ -133,17 +133,16 @@ static nserror amiga_bm_nsfont_width(const plot_font_style_t *fstyle,
{
char *localtext = NULL;
- if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID;
*width = length;
- struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle);
+ struct TextFont *bmfont = ami_font_bm_open(&temp_rp, fstyle);
if(bmfont == NULL) return NSERROR_INVALID;
if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) {
return NSERROR_INVALID;
}
- *width = TextLength(glob->rp, localtext, (UWORD)strlen(localtext));
+ *width = TextLength(&temp_rp, localtext, (UWORD)strlen(localtext));
free(localtext);
return NSERROR_OK;
@@ -170,16 +169,14 @@ static nserror amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyl
char *localtext = NULL;
UWORD co = 0;
- if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID;
-
- bmfont = ami_font_bm_open(glob->rp, fstyle);
+ bmfont = ami_font_bm_open(&temp_rp, fstyle);
if(bmfont == NULL) return NSERROR_INVALID;
if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) {
return NSERROR_INVALID;
}
- co = TextFit(glob->rp, localtext, (UWORD)strlen(localtext),
+ co = TextFit(&temp_rp, localtext, (UWORD)strlen(localtext),
&extent, NULL, 1, x, 32767);
*char_offset = ami_font_bm_convert_local_to_utf8_offset(string, length, co);
*actual_x = extent.te_Extent.MaxX;
@@ -222,16 +219,14 @@ static nserror amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
char *charp;
char *localtext;
- if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID;
-
- struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle);
+ struct TextFont *bmfont = ami_font_bm_open(&temp_rp, fstyle);
if(bmfont == NULL) return NSERROR_INVALID;
if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) {
return NSERROR_INVALID;
}
- offset = TextFit(glob->rp, localtext, (UWORD)strlen(localtext),
+ offset = TextFit(&temp_rp, localtext, (UWORD)strlen(localtext),
&extent, NULL, 1, (UWORD)x, 32767);
co = offset;
@@ -253,7 +248,7 @@ static nserror amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
}
if((co > 0) && (co < strlen(localtext))) {
- *actual_x = TextLength(glob->rp, localtext, co);
+ *actual_x = TextLength(&temp_rp, localtext, co);
*char_offset = ami_font_bm_convert_local_to_utf8_offset(string, length, co);
} else {
*actual_x = x;
@@ -298,6 +293,9 @@ void ami_font_diskfont_init(void)
/* Alloc space to hold currently open font - doesn't matter if this fails */
prev_fstyle = calloc(1, sizeof(plot_font_style_t));
+
+ /* Init temp RastPort */
+ InitRastPort(&temp_rp);
}
void ami_font_diskfont_fini(void)
diff --git a/frontends/amiga/font_scan.c b/frontends/amiga/font_scan.c
index 932179e3e..cb37f97fa 100644
--- a/frontends/amiga/font_scan.c
+++ b/frontends/amiga/font_scan.c
@@ -255,7 +255,8 @@ static ULONG ami_font_scan_font(const char *fontname, lwc_string **glypharray)
#ifdef __amigaos4__
if(EObtainInfo(AMI_OFONT_ENGINE, OT_UnicodeRanges, &unicoderanges, TAG_END) == 0) {
if(unicoderanges & UCR_SURROGATES) {
- LOG("%s supports UTF-16 surrogates", fontname);
+ NSLOG(netsurf, INFO, "%s supports UTF-16 surrogates",
+ fontname);
if (nsoption_charp(font_surrogate) == NULL) {
nsoption_set_charp(font_surrogate, (char *)strdup(fontname));
}
@@ -292,10 +293,11 @@ static ULONG ami_font_scan_fonts(struct MinList *list,
do {
nnode = (struct nsObject *)GetSucc((struct Node *)node);
ami_font_scan_gui_update(win, node->dtz_Node.ln_Name, font_num, total);
- LOG("Scanning %s", node->dtz_Node.ln_Name);
+ NSLOG(netsurf, INFO, "Scanning %s", node->dtz_Node.ln_Name);
found = ami_font_scan_font(node->dtz_Node.ln_Name, glypharray);
total += found;
- LOG("Found %ld new glyphs (total = %ld)", found, total);
+ NSLOG(netsurf, INFO, "Found %ld new glyphs (total = %ld)",
+ found, total);
font_num++;
} while((node = nnode));
@@ -344,7 +346,9 @@ static ULONG ami_font_scan_list(struct MinList *list)
if(node) {
node->dtz_Node.ln_Name = strdup(af[i].af_Attr.ta_Name);
found++;
- LOG("Added %s", af[i].af_Attr.ta_Name);
+ NSLOG(netsurf, INFO,
+ "Added %s",
+ af[i].af_Attr.ta_Name);
}
}
}
@@ -382,7 +386,8 @@ static ULONG ami_font_scan_load(const char *filename, lwc_string **glypharray)
rargs = AllocDosObjectTags(DOS_RDARGS, TAG_DONE);
if((fh = FOpen(filename, MODE_OLDFILE, 0))) {
- LOG("Loading font glyph cache from %s", filename);
+ NSLOG(netsurf, INFO, "Loading font glyph cache from %s",
+ filename);
while(FGets(fh, (STRPTR)&buffer, 256) != 0)
{
@@ -423,7 +428,8 @@ void ami_font_scan_save(const char *filename, lwc_string **glypharray)
BPTR fh = 0;
if((fh = FOpen(filename, MODE_NEWFILE, 0))) {
- LOG("Writing font glyph cache to %s", filename);
+ NSLOG(netsurf, INFO, "Writing font glyph cache to %s",
+ filename);
FPrintf(fh, "; This file is auto-generated. To re-create the cache, delete this file.\n");
FPrintf(fh, "; This file is parsed using ReadArgs() with the following template:\n");
FPrintf(fh, "; CODE/A,FONT/A\n;\n");
@@ -482,7 +488,7 @@ void ami_font_scan_init(const char *filename, bool force_scan, bool save,
found = ami_font_scan_load(filename, glypharray);
if(found == 0) {
- LOG("Creating new font glyph cache");
+ NSLOG(netsurf, INFO, "Creating new font glyph cache");
if((list = NewObjList())) {
/* add preferred fonts list */
@@ -504,7 +510,7 @@ void ami_font_scan_init(const char *filename, bool force_scan, bool save,
if(nsoption_bool(font_unicode_only) == false)
entries += ami_font_scan_list(list);
- LOG("Found %ld fonts", entries);
+ NSLOG(netsurf, INFO, "Found %ld fonts", entries);
win = ami_font_scan_gui_open(entries);
found = ami_font_scan_fonts(list, win, glypharray);
@@ -517,6 +523,6 @@ void ami_font_scan_init(const char *filename, bool force_scan, bool save,
}
}
- LOG("Initialised with %ld glyphs", found);
+ NSLOG(netsurf, INFO, "Initialised with %ld glyphs", found);
}
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index b2a489e72..e337ede0c 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -17,10 +17,11 @@
*/
-
+#ifdef __amigaos4__
/* Custom StringView class */
#include "amiga/stringview/stringview.h"
#include "amiga/stringview/urlhistory.h"
+#endif
/* AmigaOS libraries */
#ifdef __amigaos4__
@@ -89,6 +90,7 @@
#include <math.h>
#include <string.h>
#include <stdlib.h>
+#include <limits.h>
/* NetSurf core includes */
#include "utils/log.h"
@@ -114,7 +116,6 @@
#include "desktop/hotlist.h"
#include "desktop/version.h"
#include "desktop/save_complete.h"
-#include "desktop/scrollbar.h"
#include "desktop/searchweb.h"
/* NetSurf Amiga platform includes */
@@ -157,6 +158,11 @@
#define NSA_KBD_SCROLL_PX 10
#define NSA_MAX_HOTLIST_BUTTON_LEN 20
+#define SCROLL_TOP INT_MIN
+#define SCROLL_PAGE_UP (INT_MIN + 1)
+#define SCROLL_PAGE_DOWN (INT_MAX - 1)
+#define SCROLL_BOTTOM (INT_MAX)
+
/* Extra mouse button defines to match those in intuition/intuition.h */
#define SIDEDOWN (IECODE_4TH_BUTTON)
#define SIDEUP (IECODE_4TH_BUTTON | IECODE_UP_PREFIX)
@@ -196,13 +202,15 @@ static bool ami_quit = false;
static struct MsgPort *schedulermsgport = NULL;
static struct MsgPort *appport;
+#ifdef __amigaos4__
static Class *urlStringClass;
+#endif
static BOOL locked_screen = FALSE;
static int screen_signal = -1;
static bool win_destroyed;
static STRPTR nsscreentitle;
-static struct gui_globals browserglob;
+static struct gui_globals *browserglob = NULL;
static struct MsgPort *applibport = NULL;
static uint32 ami_appid = 0;
@@ -239,10 +247,10 @@ static void ami_do_redraw(struct gui_window_2 *g);
static void ami_schedule_redraw_remove(struct gui_window_2 *gwin);
static bool gui_window_get_scroll(struct gui_window *g, int *restrict sx, int *restrict sy);
-static void gui_window_set_scroll(struct gui_window *g, int sx, int sy);
+static nserror gui_window_set_scroll(struct gui_window *g, const struct rect *rect);
static void gui_window_remove_caret(struct gui_window *g);
static void gui_window_place_caret(struct gui_window *g, int x, int y, int height, const struct rect *clip);
-static void gui_window_update_box(struct gui_window *g, const struct rect *restrict rect);
+//static void amiga_window_invalidate_area(struct gui_window *g, const struct rect *restrict rect);
/* accessors for default options - user option is updated if it is set as per default */
@@ -334,7 +342,9 @@ bool ami_gui_map_filename(char **remapped, const char *restrict path,
}
if(found == false) *remapped = strdup(file);
- else LOG("Remapped %s to %s in path %s using %s", file, *remapped, path, map);
+ else NSLOG(netsurf, INFO,
+ "Remapped %s to %s in path %s using %s", file,
+ *remapped, path, map);
free(mapfile);
@@ -357,7 +367,7 @@ static bool ami_gui_check_resource(char *fullpath, const char *file)
found = true;
}
- if(found) LOG("Found %s", fullpath);
+ if(found) NSLOG(netsurf, INFO, "Found %s", fullpath);
free(remapped);
return found;
@@ -439,7 +449,9 @@ static void ami_gui_resources_free(void)
static bool ami_gui_resources_open(void)
{
+#ifdef __amigaos4__
urlStringClass = MakeStringClass();
+#endif
if(!(appport = AllocSysObjectTags(ASOT_PORT,
ASO_NoTrack, FALSE,
@@ -832,7 +844,7 @@ static void ami_openscreen(void)
}
if(screen_signal == -1) screen_signal = AllocSignal(-1);
- LOG("Screen signal %d", screen_signal);
+ NSLOG(netsurf, INFO, "Screen signal %d", screen_signal);
scrn = OpenScreenTags(NULL,
/**\todo specify screen depth */
SA_DisplayID, id,
@@ -885,7 +897,7 @@ static void ami_openscreen(void)
static void ami_openscreenfirst(void)
{
ami_openscreen();
- if(!browserglob.bm) ami_init_layers(&browserglob, 0, 0, false);
+ if(browserglob == NULL) browserglob = ami_plot_ra_alloc(0, 0, false, false);
ami_theme_throbber_setup();
}
@@ -908,19 +920,22 @@ static struct RDArgs *ami_gui_commandline(int *restrict argc, char ** argv,
if((args = ReadArgs(template, rarray, NULL))) {
if(rarray[A_URL]) {
- LOG("URL %s specified on command line",
- (char *)rarray[A_URL]);
+ NSLOG(netsurf, INFO,
+ "URL %s specified on command line",
+ (char *)rarray[A_URL]);
temp_homepage_url = strdup((char *)rarray[A_URL]); /**\todo allow IDNs */
}
if(rarray[A_USERSDIR]) {
- LOG("USERSDIR %s specified on command line",
- (char *)rarray[A_USERSDIR]);
+ NSLOG(netsurf, INFO,
+ "USERSDIR %s specified on command line",
+ (char *)rarray[A_USERSDIR]);
users_dir = ASPrintf("%s", rarray[A_USERSDIR]);
}
if(rarray[A_FORCE]) {
- LOG("FORCE specified on command line");
+ NSLOG(netsurf, INFO,
+ "FORCE specified on command line");
cli_force = true;
}
@@ -940,7 +955,7 @@ static struct RDArgs *ami_gui_commandline(int *restrict argc, char ** argv,
*/
}
} else {
- LOG("ReadArgs failed to parse command line");
+ NSLOG(netsurf, INFO, "ReadArgs failed to parse command line");
}
FreeArgs(args);
@@ -993,11 +1008,6 @@ static STRPTR ami_gui_read_all_tooltypes(int argc, char **argv)
return current_user;
}
-void ami_gui_set_default_gg(void)
-{
- glob = &browserglob;
-}
-
static void gui_init2(int argc, char** argv)
{
struct Screen *screen;
@@ -1008,9 +1018,6 @@ static void gui_init2(int argc, char** argv)
notalreadyrunning = ami_arexx_init(&rxsig);
- /* Treeview init code ends up calling a font function which needs this */
- ami_gui_set_default_gg();
-
/* ...and this ensures the treeview at least gets the WB colour palette to work with */
if(scrn == NULL) {
if((screen = LockPubScreen("Workbench"))) {
@@ -1022,7 +1029,8 @@ static void gui_init2(int argc, char** argv)
}
/**/
- hotlist_init(nsoption_charp(hotlist_file));
+ hotlist_init(nsoption_charp(hotlist_file),
+ nsoption_charp(hotlist_file));
search_web_select_provider(nsoption_int(search_provider));
if (notalreadyrunning &&
@@ -1043,6 +1051,7 @@ static void gui_init2(int argc, char** argv)
amiga_warn_user(messages_get_errorcode(error), 0);
}
free(temp_homepage_url);
+ temp_homepage_url = NULL;
}
if(cli_force == true) {
@@ -1123,6 +1132,7 @@ static void gui_init2(int argc, char** argv)
if(temp_homepage_url) {
sendcmd = ASPrintf("OPEN \"%s\" NEW%s", temp_homepage_url, newtab);
free(temp_homepage_url);
+ temp_homepage_url = NULL;
} else {
sendcmd = ASPrintf("OPEN \"%s\" NEW%s", nsoption_charp(homepage_url), newtab);
}
@@ -1215,12 +1225,10 @@ static void ami_update_buttons(struct gui_window_2 *gwin)
}
}
-#ifdef __amigaos4__
GetAttr(GA_Disabled, gwin->objects[GID_BACK], (uint32 *)&s_back);
GetAttr(GA_Disabled, gwin->objects[GID_FORWARD], (uint32 *)&s_forward);
GetAttr(GA_Disabled, gwin->objects[GID_RELOAD], (uint32 *)&s_reload);
GetAttr(GA_Disabled, gwin->objects[GID_STOP], (uint32 *)&s_stop);
-#endif
if(BOOL_MISMATCH(s_back, back))
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_BACK],
@@ -1240,9 +1248,9 @@ static void ami_update_buttons(struct gui_window_2 *gwin)
if(ClickTabBase->lib_Version < 53) {
if(gwin->tabs <= 1) tabclose = TRUE;
-#ifdef __amigaos4__
+
GetAttr(GA_Disabled, gwin->objects[GID_CLOSETAB], (uint32 *)&s_tabclose);
-#endif
+
if(BOOL_MISMATCH(s_tabclose, tabclose))
SetGadgetAttrs((struct Gadget *)gwin->objects[GID_CLOSETAB],
gwin->win, NULL, GA_Disabled, tabclose, TAG_DONE);
@@ -1494,6 +1502,7 @@ static void ami_gui_scroll_internal(struct gui_window_2 *gwin, int xs, int ys)
{
struct IBox *bbox;
int x, y;
+ struct rect rect;
if(ami_mouse_to_ns_coords(gwin, &x, &y, -1, -1) == true)
{
@@ -1560,8 +1569,9 @@ static void ami_gui_scroll_internal(struct gui_window_2 *gwin, int xs, int ys)
}
ami_gui_free_space_box(bbox);
-
- gui_window_set_scroll(gwin->gw, xs, ys);
+ rect.x0 = rect.x1 = xs;
+ rect.y0 = rect.y1 = ys;
+ gui_window_set_scroll(gwin->gw, &rect);
}
}
}
@@ -1574,6 +1584,7 @@ static struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct
if(ibox == NULL) return NULL;
if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
+ free(ibox);
amiga_warn_user("NoMemory", "");
return NULL;
}
@@ -1642,15 +1653,26 @@ static void ami_gui_menu_update_all(void)
} while((node = nnode));
}
-static void gui_window_get_dimensions(struct gui_window *g,
+/**
+ * Find the current dimensions of a amiga browser window content area.
+ *
+ * \param gw The gui window to measure content area of.
+ * \param width receives width of window
+ * \param height receives height of window
+ * \param scaled whether to return scaled values
+ * \return NSERROR_OK on sucess and width and height updated
+ * else error code.
+ */
+static nserror gui_window_get_dimensions(struct gui_window *gw,
int *restrict width, int *restrict height, bool scaled)
{
struct IBox *bbox;
- if(!g) return;
+ nserror res;
- if(ami_gui_get_space_box((Object *)g->shared->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
+ res = ami_gui_get_space_box((Object *)gw->shared->objects[GID_BROWSER], &bbox);
+ if(res != NSERROR_OK) {
amiga_warn_user("NoMemory", "");
- return;
+ return res;
}
*width = bbox->Width;
@@ -1658,11 +1680,12 @@ static void gui_window_get_dimensions(struct gui_window *g,
ami_gui_free_space_box(bbox);
- if(scaled)
- {
- *width /= g->scale;
- *height /= g->scale;
+ if(scaled) {
+ *width /= gw->scale;
+ *height /= gw->scale;
}
+
+ return NSERROR_OK;
}
/* Add a horizontal scroller, if not already present
@@ -1818,7 +1841,7 @@ static void gui_window_set_icon(struct gui_window *g, struct hlcache_handle *ico
if ((icon != NULL) && ((icon_bitmap = content_get_bitmap(icon)) != NULL))
{
- bm = ami_bitmap_get_native(icon_bitmap, 16, 16,
+ bm = ami_bitmap_get_native(icon_bitmap, 16, 16, ami_plot_screen_is_palettemapped(),
g->shared->win->RPort->BitMap);
}
@@ -2502,10 +2525,9 @@ static BOOL ami_gui_event(void *w)
#ifdef __amigaos4__
case WMHI_ICONIFY:
{
- struct bitmap *bm;
-
- bm = urldb_get_thumbnail(browser_window_get_url(gwin->gw->bw));
- if(!bm) bm = content_get_bitmap(browser_window_get_content(gwin->gw->bw));
+ struct bitmap *bm = NULL;
+ browser_window_history_get_thumbnail(gwin->gw->bw,
+ &bm);
gwin->dobj = amiga_icon_from_bitmap(bm);
amiga_icon_superimpose_favicon_internal(gwin->gw->favicon,
gwin->dobj);
@@ -2548,12 +2570,15 @@ static BOOL ami_gui_event(void *w)
if(drag_x_move || drag_y_move)
{
+ struct rect rect;
+
gui_window_get_scroll(gwin->gw,
&gwin->gw->scrollx, &gwin->gw->scrolly);
- gui_window_set_scroll(gwin->gw,
- gwin->gw->scrollx + drag_x_move,
- gwin->gw->scrolly + drag_y_move);
+ rect.x0 = rect.x1 = gwin->gw->scrollx + drag_x_move;
+ rect.y0 = rect.y1 = gwin->gw->scrolly + drag_y_move;
+
+ gui_window_set_scroll(gwin->gw, &rect);
}
// ReplyMsg((struct Message *)message);
@@ -2767,8 +2792,11 @@ static void ami_handle_applib(void)
{
struct ApplicationCustomMsg *applibcustmsg =
(struct ApplicationCustomMsg *)applibmsg;
- LOG("Ringhio BackMsg received: %s", applibcustmsg->customMsg);
- OpenWorkbenchObjectA(applibcustmsg->customMsg, NULL);
+ NSLOG(netsurf, INFO,
+ "Ringhio BackMsg received: %s",
+ applibcustmsg->customMsg);
+
+ ami_download_parse_backmsg(applibcustmsg->customMsg);
}
break;
}
@@ -2802,7 +2830,7 @@ void ami_get_msg(void)
NULL, (unsigned int *)&signalmask) != -1) {
signal = signalmask;
} else {
- LOG("waitselect() returned error");
+ NSLOG(netsurf, INFO, "waitselect() returned error");
/* \todo Fix Ctrl-C handling.
* WaitSelect() from bsdsocket.library returns -1 if the task was
* signalled with a Ctrl-C. waitselect() from newlib.library does not.
@@ -2907,11 +2935,15 @@ void ami_switch_tab(struct gui_window_2 *gwin, bool redraw)
if(redraw)
{
+ struct rect rect;
+
ami_plot_clear_bbox(gwin->win->RPort, bbox);
browser_window_update(gwin->gw->bw, false);
- gui_window_set_scroll(gwin->gw,
- gwin->gw->scrollx, gwin->gw->scrolly);
+ rect.x0 = rect.x1 = gwin->gw->scrollx;
+ rect.y0 = rect.y1 = gwin->gw->scrolly;
+
+ gui_window_set_scroll(gwin->gw, &rect);
gwin->redraw_scroll = false;
browser_window_refresh_url_bar(gwin->gw->bw);
@@ -3007,11 +3039,13 @@ static void ami_gui_close_screen(struct Screen *scrn, BOOL locked_screen, BOOL d
if(donotwait == TRUE) return;
ULONG scrnsig = 1 << screen_signal;
- LOG("Waiting for visitor windows to close... (signal)");
+ NSLOG(netsurf, INFO,
+ "Waiting for visitor windows to close... (signal)");
Wait(scrnsig);
while (CloseScreen(scrn) == FALSE) {
- LOG("Waiting for visitor windows to close... (polling)");
+ NSLOG(netsurf, INFO,
+ "Waiting for visitor windows to close... (polling)");
Delay(50);
}
@@ -3041,35 +3075,37 @@ static void gui_quit(void)
urldb_save(nsoption_charp(url_file));
urldb_save_cookies(nsoption_charp(cookie_file));
- hotlist_fini(nsoption_charp(hotlist_file));
+ hotlist_fini();
#ifdef __amigaos4__
if(IApplication && ami_appid)
UnregisterApplication(ami_appid, NULL);
#endif
ami_arexx_cleanup();
- ami_free_layers(&browserglob);
+ ami_plot_ra_free(browserglob);
ami_font_fini();
ami_help_free();
- LOG("Freeing menu items");
+ NSLOG(netsurf, INFO, "Freeing menu items");
ami_ctxmenu_free();
ami_menu_free_glyphs();
- LOG("Freeing mouse pointers");
+ NSLOG(netsurf, INFO, "Freeing mouse pointers");
ami_mouse_pointers_free();
ami_file_req_free();
ami_openurl_close();
+#ifdef __amigaos4__
FreeStringClass(urlStringClass);
+#endif
FreeObjList(window_list);
ami_clipboard_free();
ami_gui_resources_free();
- LOG("Closing screen");
+ NSLOG(netsurf, INFO, "Closing screen");
ami_gui_close_screen(scrn, locked_screen, FALSE);
if(nsscreentitle) FreeVec(nsscreentitle);
}
@@ -3079,7 +3115,7 @@ char *ami_gui_get_cache_favicon_name(nsurl *url, bool only_if_avail)
STRPTR filename = NULL;
if ((filename = ASPrintf("%s/%x", current_user_faviconcache, nsurl_hash(url)))) {
- LOG("favicon cache location: %s", filename);
+ NSLOG(netsurf, INFO, "favicon cache location: %s", filename);
if (only_if_avail == true) {
BPTR lock = 0;
@@ -3529,15 +3565,18 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
int left, int top, int width, int height,
int sx, int sy, struct IBox *bbox, struct redraw_context *ctx)
{
+ struct gui_globals *glob = (struct gui_globals *)ctx->priv;
int x, y;
struct rect clip;
- int tile_size_x = glob->width;
- int tile_size_y = glob->height;
+ int tile_size_x;
+ int tile_size_y;
+
+ ami_plot_ra_get_size(glob, &tile_size_x, &tile_size_y);
int tile_x_scale = (int)(tile_size_x / gwin->gw->scale);
int tile_y_scale = (int)(tile_size_y / gwin->gw->scale);
- browserglob.shared_pens = gwin->shared_pens; /* do we need this?? */
+ ami_plot_ra_set_pen_list(glob, gwin->shared_pens);
if(top < 0) {
height += top;
@@ -3588,10 +3627,10 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
clip.y0 - (int)y,
&clip, ctx))
{
- ami_clearclipreg(&browserglob);
+ ami_clearclipreg(glob);
#ifdef __amigaos4__
BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
- BLITA_Source, browserglob.bm,
+ BLITA_Source, ami_plot_ra_get_bitmap(glob),
BLITA_SrcX, 0,
BLITA_SrcY, 0,
BLITA_DestType, BLITT_RASTPORT,
@@ -3602,7 +3641,7 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
BLITA_Height, (int)(clip.y1),
TAG_DONE);
#else
- BltBitMapRastPort(browserglob.bm, 0, 0, gwin->win->RPort,
+ BltBitMapRastPort(ami_plot_ra_get_bitmap(glob), 0, 0, gwin->win->RPort,
bbox->Left + (int)((x - sx) * gwin->gw->scale),
bbox->Top + (int)((y - sy) * gwin->gw->scale),
(int)(clip.x1), (int)(clip.y1), 0xC0);
@@ -3636,7 +3675,8 @@ static void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
- .plot = &amiplot
+ .plot = &amiplot,
+ .priv = browserglob
};
if(!g) return;
@@ -3660,6 +3700,45 @@ static void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw
return;
}
+
+/**
+ * Invalidates an area of an amiga browser window
+ *
+ * \param g gui_window
+ * \param rect area to redraw or NULL for the entire window area
+ * \return NSERROR_OK on success or appropriate error code
+ */
+static nserror amiga_window_invalidate_area(struct gui_window *g,
+ const struct rect *restrict rect)
+{
+ struct nsObject *nsobj;
+ struct rect *restrict deferred_rect;
+
+ if(!g) return NSERROR_BAD_PARAMETER;
+
+ if (rect == NULL) {
+ if (g != g->shared->gw) {
+ return NSERROR_OK;
+ }
+ } else {
+ if (ami_gui_window_update_box_deferred_check(g->deferred_rects, rect,
+ g->deferred_rects_pool)) {
+ deferred_rect = ami_memory_itempool_alloc(g->deferred_rects_pool,
+ sizeof(struct rect));
+ CopyMem(rect, deferred_rect, sizeof(struct rect));
+ nsobj = AddObject(g->deferred_rects, AMINS_RECT);
+ nsobj->objstruct = deferred_rect;
+ } else {
+ NSLOG(netsurf, INFO,
+ "Ignoring duplicate or subset of queued box redraw");
+ }
+ }
+ ami_schedule_redraw(g->shared, false);
+
+ return NSERROR_OK;
+}
+
+
static void ami_refresh_window(struct gui_window_2 *gwin)
{
/* simplerefresh only */
@@ -3692,7 +3771,7 @@ static void ami_refresh_window(struct gui_window_2 *gwin)
regrect = gwin->win->RPort->Layer->DamageList->RegionRectangle;
- gui_window_update_box(gwin->gw, &r);
+ amiga_window_invalidate_area(gwin->gw, &r);
while(regrect)
{
@@ -3707,7 +3786,7 @@ static void ami_refresh_window(struct gui_window_2 *gwin)
regrect = regrect->Next;
- gui_window_update_box(gwin->gw, &r);
+ amiga_window_invalidate_area(gwin->gw, &r);
}
EndRefresh(gwin->win, TRUE);
@@ -3781,7 +3860,8 @@ HOOKF(void, ami_scroller_hook, Object *, object, struct IntuiMessage *)
break;
default:
- LOG("IDCMP hook unhandled event: %ld", msg->Class);
+ NSLOG(netsurf, INFO,
+ "IDCMP hook unhandled event: %ld", msg->Class);
break;
}
// ReplyMsg((struct Message *)msg);
@@ -3840,7 +3920,7 @@ gui_window_create(struct browser_window *bw,
ULONG defer_layout = TRUE;
ULONG idcmp_sizeverify = IDCMP_SIZEVERIFY;
- LOG("Creating window");
+ NSLOG(netsurf, INFO, "Creating window");
if (!scrn) ami_openscreenfirst();
@@ -3979,12 +4059,14 @@ gui_window_create(struct browser_window *bw,
ULONG addtabclosegadget = TAG_IGNORE;
ULONG iconifygadget = FALSE;
+#ifdef __amigaos4__
if (nsoption_charp(pubscreen_name) &&
(locked_screen == TRUE) &&
(strcmp(nsoption_charp(pubscreen_name), "Workbench") == 0))
iconifygadget = TRUE;
+#endif
- LOG("Creating menu");
+ NSLOG(netsurf, INFO, "Creating menu");
struct Menu *menu = ami_gui_menu_create(g->shared);
NewList(&g->shared->tab_list);
@@ -4106,7 +4188,7 @@ gui_window_create(struct browser_window *bw,
BitMapEnd;
}
- LOG("Creating window object");
+ NSLOG(netsurf, INFO, "Creating window object");
g->shared->objects[OID_MAIN] = WindowObj,
WA_ScreenTitle, ami_gui_get_screen_title(),
@@ -4384,11 +4466,11 @@ gui_window_create(struct browser_window *bw,
EndWindow;
}
- LOG("Opening window");
+ NSLOG(netsurf, INFO, "Opening window");
g->shared->win = (struct Window *)RA_OpenWindow(g->shared->objects[OID_MAIN]);
- LOG("Window opened, adding border gadgets");
+ NSLOG(netsurf, INFO, "Window opened, adding border gadgets");
if(!g->shared->win)
{
@@ -4459,8 +4541,6 @@ gui_window_create(struct browser_window *bw,
ami_gui_win_list_add(g->shared, AMINS_WINDOW, &ami_gui_table);
- ami_gui_set_default_gg();
-
if(locked_screen) {
UnlockPubScreen(NULL,scrn);
locked_screen = FALSE;
@@ -4480,9 +4560,7 @@ static void ami_gui_close_tabs(struct gui_window_2 *gwin, bool other_tabs)
struct gui_window *gw;
if((gwin->tabs > 1) && (nsoption_bool(tab_close_warn) == true)) {
- char *req_body = ami_utf8_easy(messages_get("MultiTabClose"));
- int32 res = amiga_warn_user_multi(req_body, "Yes", "No", gwin->win);
- free(req_body);
+ int32 res = amiga_warn_user_multi(messages_get("MultiTabClose"), "Yes", "No", gwin->win);
if(res == 0) return;
}
@@ -4531,7 +4609,7 @@ static void gui_window_destroy(struct gui_window *g)
if(g->hw)
{
- ami_history_close(g->hw);
+ ami_history_local_destroy(g->hw);
win_destroyed = true;
}
@@ -4701,7 +4779,7 @@ static void ami_redraw_callback(void *p)
*
* \param gwin a struct gui_window_2
* \param full_redraw set to true to schedule a full redraw,
- should only be set to false when called from gui_window_update_box()
+ should only be set to false when called from amiga_window_invalidate_area()
*/
void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw)
{
@@ -4716,14 +4794,6 @@ static void ami_schedule_redraw_remove(struct gui_window_2 *gwin)
ami_schedule(-1, ami_redraw_callback, gwin);
}
-static void gui_window_redraw_window(struct gui_window *g)
-{
- if(!g) return;
-
- if(g == g->shared->gw)
- ami_schedule_redraw(g->shared, true);
-}
-
static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw)
{
struct nsObject *node;
@@ -4736,7 +4806,7 @@ static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw)
if(draw == true) {
ami_set_pointer(g->shared, GUI_POINTER_WAIT, false);
} else {
- LOG("Ignoring deferred box redraw queue");
+ NSLOG(netsurf, INFO, "Ignoring deferred box redraw queue");
}
node = (struct nsObject *)GetHead((struct List *)g->deferred_rects);
@@ -4781,7 +4851,8 @@ bool ami_gui_window_update_box_deferred_check(struct MinList *deferred_rects,
(new_rect->y0 <= rect->y0) &&
(new_rect->x1 >= rect->x1) &&
(new_rect->y1 >= rect->y1)) {
- LOG("Removing queued redraw that is a subset of new box redraw");
+ NSLOG(netsurf, INFO,
+ "Removing queued redraw that is a subset of new box redraw");
ami_memory_itempool_free(mempool, node->objstruct, sizeof(struct rect));
DelObjectNoFree(node);
/* Don't return - we might find more */
@@ -4791,50 +4862,12 @@ bool ami_gui_window_update_box_deferred_check(struct MinList *deferred_rects,
return true;
}
-static void gui_window_update_box(struct gui_window *g, const struct rect *restrict rect)
-{
- struct nsObject *nsobj;
- struct rect *restrict deferred_rect;
- if(!g) return;
-
- if(ami_gui_window_update_box_deferred_check(g->deferred_rects, rect,
- g->deferred_rects_pool)) {
- deferred_rect = ami_memory_itempool_alloc(g->deferred_rects_pool, sizeof(struct rect));
- CopyMem(rect, deferred_rect, sizeof(struct rect));
- nsobj = AddObject(g->deferred_rects, AMINS_RECT);
- nsobj->objstruct = deferred_rect;
- } else {
- LOG("Ignoring duplicate or subset of queued box redraw");
- }
- ami_schedule_redraw(g->shared, false);
-}
-
-/**
- * callback from core to reformat a window.
- */
-static void amiga_window_reformat(struct gui_window *gw)
-{
- struct IBox *bbox;
-
- LOG("reformat window %p", gw);
-
- if (gw != NULL) {
- if(ami_gui_get_space_box((Object *)gw->shared->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
- browser_window_reformat(gw->bw, false, bbox->Width, bbox->Height);
- gw->shared->redraw_scroll = false;
- ami_gui_free_space_box(bbox);
- }
-}
static void ami_do_redraw(struct gui_window_2 *gwin)
{
ULONG hcurrent,vcurrent,xoffset,yoffset,width=800,height=600;
struct IBox *bbox;
ULONG oldh = gwin->oldh, oldv=gwin->oldv;
- struct RastPort *temprp;
if(browser_window_redraw_ready(gwin->gw->bw) == false) return;
@@ -4879,63 +4912,39 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
{
ami_spacebox_to_ns_coords(gwin, &rect.x0, &rect.y0, 0, height - (vcurrent - oldv) - 1);
ami_spacebox_to_ns_coords(gwin, &rect.x1, &rect.y1, width + 1, height + 1);
- gui_window_update_box(gwin->gw, &rect);
+ amiga_window_invalidate_area(gwin->gw, &rect);
}
else if(vcurrent<oldv) /* Going up */
{
ami_spacebox_to_ns_coords(gwin, &rect.x0, &rect.y0, 0, 0);
ami_spacebox_to_ns_coords(gwin, &rect.x1, &rect.y1, width + 1, oldv - vcurrent + 1);
- gui_window_update_box(gwin->gw, &rect);
+ amiga_window_invalidate_area(gwin->gw, &rect);
}
if(hcurrent>oldh) /* Going right */
{
ami_spacebox_to_ns_coords(gwin, &rect.x0, &rect.y0, width - (hcurrent - oldh), 0);
ami_spacebox_to_ns_coords(gwin, &rect.x1, &rect.y1, width + 1, height + 1);
- gui_window_update_box(gwin->gw, &rect);
+ amiga_window_invalidate_area(gwin->gw, &rect);
}
else if(hcurrent<oldh) /* Going left */
{
ami_spacebox_to_ns_coords(gwin, &rect.x0, &rect.y0, 0, 0);
ami_spacebox_to_ns_coords(gwin, &rect.x1, &rect.y1, oldh - hcurrent + 1, height + 1);
- gui_window_update_box(gwin->gw, &rect);
+ amiga_window_invalidate_area(gwin->gw, &rect);
}
}
else
{
- struct rect clip;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
- .plot = &amiplot
+ .plot = &amiplot,
+ .priv = browserglob
};
- ami_gui_set_default_gg();
+ ami_do_redraw_tiled(gwin, true, hcurrent, vcurrent, width, height, hcurrent, vcurrent, bbox, &ctx);
- if(nsoption_bool(direct_render) == false)
- {
- ami_do_redraw_tiled(gwin, true, hcurrent, vcurrent, width, height, hcurrent, vcurrent, bbox, &ctx);
- }
- else
- {
- browserglob.shared_pens = gwin->shared_pens;
- temprp = browserglob.rp;
- browserglob.rp = gwin->win->RPort;
- clip.x0 = bbox->Left;
- clip.y0 = bbox->Top;
- clip.x1 = bbox->Left + bbox->Width;
- clip.y1 = bbox->Top + bbox->Height;
-
- ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
-
- if(browser_window_redraw(gwin->gw->bw, clip.x0 - hcurrent, clip.y0 - vcurrent, &clip, &ctx))
- {
- ami_clearclipreg(&browserglob);
- browserglob.rp = temprp;
- }
-
- ami_reset_pointer(gwin);
- }
/* Tell NetSurf not to bother with the next queued box redraw, as we've redrawn everything. */
ami_gui_window_update_box_deferred(gwin->gw, false);
}
@@ -4952,27 +4961,26 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
ami_gui_free_space_box(bbox);
}
+
void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs)
{
if(gwin->objects[GID_HSCROLL])
{
GetAttr(SCROLLER_Top, (Object *)gwin->objects[GID_HSCROLL], xs);
+ *xs /= gwin->gw->scale;
} else {
*xs = 0;
}
-
- *xs /= gwin->gw->scale;
}
void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys)
{
if(gwin->objects[GID_VSCROLL]) {
GetAttr(SCROLLER_Top, gwin->objects[GID_VSCROLL], ys);
+ *ys /= gwin->gw->scale;
} else {
*ys = 0;
}
-
- *ys /= gwin->gw->scale;
}
static bool gui_window_get_scroll(struct gui_window *g, int *restrict sx, int *restrict sy)
@@ -4983,21 +4991,44 @@ static bool gui_window_get_scroll(struct gui_window *g, int *restrict sx, int *r
return true;
}
-static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
+/**
+ * Set the scroll position of a amiga browser window.
+ *
+ * Scrolls the viewport to ensure the specified rectangle of the
+ * content is shown. The amiga implementation scrolls the contents so
+ * the specified point in the content is at the top of the viewport.
+ *
+ * \param g gui_window to scroll
+ * \param rect The rectangle to ensure is shown.
+ * \return NSERROR_OK on success or apropriate error code.
+ */
+static nserror
+gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
{
struct IBox *bbox;
int width, height;
+ nserror res;
+ int sx = 0, sy = 0;
- if(!g) return;
- if(!g->bw || browser_window_has_content(g->bw) == false) return;
+ if(!g) {
+ return NSERROR_BAD_PARAMETER;
+ }
+ if(!g->bw || browser_window_has_content(g->bw) == false) {
+ return NSERROR_BAD_PARAMETER;
+ }
- if(ami_gui_get_space_box((Object *)g->shared->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
+ res = ami_gui_get_space_box((Object *)g->shared->objects[GID_BROWSER], &bbox);
+ if(res != NSERROR_OK) {
amiga_warn_user("NoMemory", "");
- return;
+ return res;
}
- if(sx < 0) sx=0;
- if(sy < 0) sy=0;
+ if (rect->x0 > 0) {
+ sx = rect->x0;
+ }
+ if (rect->y0 > 0) {
+ sy = rect->y0;
+ }
browser_window_get_extents(g->bw, false, &width, &height);
@@ -5035,6 +5066,7 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
g->scrollx = sx;
g->scrolly = sy;
}
+ return NSERROR_OK;
}
static void gui_window_update_extent(struct gui_window *g)
@@ -5166,7 +5198,7 @@ static nserror gui_search_web_provider_update(const char *provider_name,
if(nsoption_bool(kiosk_mode) == true) return NSERROR_BAD_PARAMETER;
if (ico_bitmap != NULL) {
- bm = ami_bitmap_get_native(ico_bitmap, 16, 16, NULL);
+ bm = ami_bitmap_get_native(ico_bitmap, 16, 16, ami_plot_screen_is_palettemapped(), NULL);
}
if(bm == NULL) return NSERROR_BAD_PARAMETER;
@@ -5282,7 +5314,7 @@ static void gui_window_new_content(struct gui_window *g)
c = browser_window_get_content(g->bw);
else return;
- ami_clearclipreg(&browserglob);
+ ami_clearclipreg(browserglob);
g->shared->new_content = true;
g->scrollx = 0;
g->scrolly = 0;
@@ -5391,20 +5423,20 @@ Object *ami_gui_splash_open(void)
EndWindow;
if(win_obj == NULL) {
- LOG("Splash window object not created");
+ NSLOG(netsurf, INFO, "Splash window object not created");
return NULL;
}
- LOG("Attempting to open splash window...");
+ NSLOG(netsurf, INFO, "Attempting to open splash window...");
win = RA_OpenWindow(win_obj);
if(win == NULL) {
- LOG("Splash window did not open");
+ NSLOG(netsurf, INFO, "Splash window did not open");
return NULL;
}
if(bm_obj == NULL) {
- LOG("BitMap object not created");
+ NSLOG(netsurf, INFO, "BitMap object not created");
return NULL;
}
@@ -5466,14 +5498,14 @@ void ami_gui_splash_close(Object *win_obj)
{
if(win_obj == NULL) return;
- LOG("Closing splash window");
+ NSLOG(netsurf, INFO, "Closing splash window");
DisposeObject(win_obj);
}
static void gui_file_gadget_open(struct gui_window *g, struct hlcache_handle *hl,
struct form_control *gadget)
{
- LOG("File open dialog request for %p/%p", g, gadget);
+ NSLOG(netsurf, INFO, "File open dialog request for %p/%p", g, gadget);
if(AslRequestTags(filereq,
ASLFR_Window, g->shared->win,
@@ -5508,7 +5540,7 @@ static char *ami_gui_get_user_dir(STRPTR current_user)
user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY);
current_user = ASPrintf("%s", (user == -1) ? "Default" : temp);
}
- LOG("User: %s", current_user);
+ NSLOG(netsurf, INFO, "User: %s", current_user);
if(users_dir == NULL) {
users_dir = ASPrintf("%s", USERS_DIR);
@@ -5560,7 +5592,7 @@ static char *ami_gui_get_user_dir(STRPTR current_user)
FreeVec(users_dir);
FreeVec(current_user);
- LOG("User dir: %s", current_user_dir);
+ NSLOG(netsurf, INFO, "User dir: %s", current_user_dir);
if((lock = CreateDirTree(current_user_dir)))
UnLock(lock);
@@ -5576,13 +5608,11 @@ static char *ami_gui_get_user_dir(STRPTR current_user)
static struct gui_window_table amiga_window_table = {
.create = gui_window_create,
.destroy = gui_window_destroy,
- .redraw = gui_window_redraw_window,
- .update = gui_window_update_box,
+ .invalidate = amiga_window_invalidate_area,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
- .reformat = amiga_window_reformat,
.set_icon = gui_window_set_icon,
.set_title = gui_window_set_title,
@@ -5789,7 +5819,7 @@ int main(int argc, char** argv)
AddPart(script, nsoption_charp(arexx_startup), 1024);
ami_arexx_execute(script);
- LOG("Entering main loop");
+ NSLOG(netsurf, INFO, "Entering main loop");
while (!ami_quit) {
ami_get_msg();
@@ -5808,6 +5838,9 @@ int main(int argc, char** argv)
free(current_user_dir);
FreeVec(current_user_faviconcache);
+ /* finalise logging */
+ nslog_finalise();
+
#ifndef __amigaos4__
/* OS3 low memory handler */
ami_memory_fini(memhandler);
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index 07ff922f7..bf4ec9139 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -87,7 +87,8 @@ enum
};
struct find_window;
-struct history_window;
+struct ami_history_local_window;
+struct ami_menu_data;
#define AMI_GUI_TOOLBAR_MAX 20
@@ -110,8 +111,6 @@ struct ami_generic_window {
const struct ami_win_event_table *tbl;
};
-struct ami_menu_data;
-
struct gui_window_2 {
struct ami_generic_window w;
struct Window *win;
@@ -174,7 +173,7 @@ struct gui_window
int c_h_temp;
int scrollx;
int scrolly;
- struct history_window *hw;
+ struct ami_history_local_window *hw;
struct List dllist;
struct hlcache_handle *favicon;
bool throbbing;
@@ -259,11 +258,6 @@ uint32 ami_gui_get_app_id(void);
STRPTR ami_gui_get_screen_title(void);
/**
- * Set gui_globals back to the default for the browser context
- */
-void ami_gui_set_default_gg(void);
-
-/**
* Switch to the most-recently-opened tab
*/
void ami_gui_switch_to_new_tab(struct gui_window_2 *gwin);
diff --git a/frontends/amiga/gui_menu.c b/frontends/amiga/gui_menu.c
index 6b9b2075d..6dbacf1ba 100644
--- a/frontends/amiga/gui_menu.c
+++ b/frontends/amiga/gui_menu.c
@@ -261,7 +261,7 @@ HOOKF(void, ami_menu_item_edit_copy, APTR, window, struct IntuiMessage *)
* the objects containing the values returned (and the
* constness cast away) is safe.
*/
- ami_bitmap_set_url(bm, browser_window_get_url(gwin->gw->bw));
+ ami_bitmap_set_url(bm, browser_window_access_url(gwin->gw->bw));
ami_bitmap_set_title(bm, browser_window_get_title(gwin->gw->bw));
ami_easy_clipboard_bitmap(bm);
}
@@ -326,7 +326,7 @@ HOOKF(void, ami_menu_item_browser_localhistory, APTR, window, struct IntuiMessag
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- ami_history_open(gwin->gw);
+ ami_history_local_present(gwin->gw);
}
HOOKF(void, ami_menu_item_browser_globalhistory, APTR, window, struct IntuiMessage *)
@@ -419,7 +419,7 @@ HOOKF(void, ami_menu_item_hotlist_add, APTR, window, struct IntuiMessage *)
if (bw == NULL || browser_window_has_content(bw) == false)
return;
- hotlist_add_url(browser_window_get_url(bw));
+ hotlist_add_url(browser_window_access_url(bw));
ami_gui_update_hotlist_button(gwin);
}
@@ -504,9 +504,9 @@ HOOKF(void, ami_menu_item_arexx_entries, APTR, window, struct IntuiMessage *)
DevNameFromLock(lock, temp, 1024, DN_FULLPATH);
AddPart(temp, script, 1024);
ami_arexx_execute(temp);
- free(temp);
UnLock(lock);
}
+ free(temp);
}
}
}
@@ -584,7 +584,8 @@ ULONG ami_gui_menu_number(int item)
break;
default:
- LOG("WARNING: Unrecognised menu item %d", item);
+ NSLOG(netsurf, INFO,
+ "WARNING: Unrecognised menu item %d", item);
menu_num = 0;
break;
}
diff --git a/frontends/amiga/gui_menu.h b/frontends/amiga/gui_menu.h
index 16fc72040..3490fe9c1 100644
--- a/frontends/amiga/gui_menu.h
+++ b/frontends/amiga/gui_menu.h
@@ -108,6 +108,7 @@ enum {
struct gui_window;
struct gui_window_2;
struct hlcache_handle;
+struct Window;
ULONG ami_gui_menu_number(int item);
struct Menu *ami_gui_menu_create(struct gui_window_2 *gwin);
diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c
index 78dea5820..fb214d0fb 100755
--- a/frontends/amiga/gui_options.c
+++ b/frontends/amiga/gui_options.c
@@ -270,9 +270,8 @@ static void ami_gui_opts_array_to_list(struct List *list, const char *array[], i
node = AllocChooserNode(CNA_Text, array[i], TAG_DONE);
break;
case NSA_LIST_RADIO:
- /* Note: RBNA_Labels is RBNA_Label in OS4
- * Also note: These labels don't work (FIXME) */
- node = AllocRadioButtonNode(RBNA_Labels, array[i], TAG_DONE);
+ /* Note: RBNA_Labels is RBNA_Label in OS4 */
+ node = AllocRadioButtonNode(0, RBNA_Labels, array[i], TAG_DONE);
break;
default:
break;
@@ -1107,8 +1106,8 @@ void ami_gui_opts_open(void)
GA_ID, GID_OPTS_DPI_Y,
GA_RelVerify, TRUE,
INTEGER_Number, nsoption_int(screen_ydpi),
- INTEGER_Minimum, 60,
- INTEGER_Maximum, 150,
+ INTEGER_Minimum, 20,
+ INTEGER_Maximum, 200,
INTEGER_Arrows, TRUE,
GA_Disabled, nsoption_bool(bitmap_fonts),
IntegerEnd,
@@ -1748,7 +1747,7 @@ static void ami_gui_opts_use(bool save)
switch(data)
{
case 0:
- nsoption_set_charp(pubscreen_name, strdup("\0"));
+ nsoption_set_charp(pubscreen_name, NULL);
break;
case 1:
@@ -1898,6 +1897,15 @@ static void ami_gui_opts_use(bool save)
#ifndef __amigaos4__
GetAttr(GA_Selected, gow->objects[GID_OPTS_FONT_BITMAP], (ULONG *)&data);
ami_font_fini();
+
+ if((nsoption_bool(bitmap_fonts) == true) && (data == false)) {
+ nsoption_set_charp(font_sans, (char *)strdup("CGTriumvirate"));
+ nsoption_set_charp(font_serif, (char *)strdup("CGTimes"));
+ nsoption_set_charp(font_mono, (char *)strdup("LetterGothic"));
+ nsoption_set_charp(font_cursive, (char *)strdup("CGTriumvirate"));
+ nsoption_set_charp(font_fantasy, (char *)strdup("CGTimes"));
+ }
+
if(data) {
nsoption_set_bool(bitmap_fonts, true);
} else {
@@ -2134,7 +2142,7 @@ static BOOL ami_gui_opts_event(void *w)
case GID_OPTS_HOMEPAGE_CURRENT:
if(cur_gw) RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_HOMEPAGE],
gow->win, NULL, STRINGA_TextVal,
- nsurl_access(browser_window_get_url(cur_gw->bw)), TAG_DONE);
+ nsurl_access(browser_window_access_url(cur_gw->bw)), TAG_DONE);
break;
case GID_OPTS_HOMEPAGE_BLANK:
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
index 12c306a9b..e724f3e70 100644
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -162,12 +162,16 @@ ami_history_global_key(struct ami_corewindow *ami_cw, uint32_t nskey)
* callback on draw event for history viewer on core window
*
* \param ami_cw The Amiga core window structure.
+ * \param x The x coordinate of global history area to redraw
+ * \param y The y coordinate of global history area to redraw
* \param r The rectangle of the window that needs updating.
* \param ctx The drawing context
* \return NSERROR_OK on success otherwise apropriate error code
*/
static nserror
-ami_history_global_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+ami_history_global_draw(struct ami_corewindow *ami_cw,
+ int x, int y, struct rect *r,
+ struct redraw_context *ctx)
{
global_history_redraw(x, y, r, ctx);
@@ -434,7 +438,7 @@ nserror ami_history_global_present(void)
res = ami_history_global_create_window(ncwin);
if (res != NSERROR_OK) {
- LOG("SSL UI builder init failed");
+ NSLOG(netsurf, INFO, "SSL UI builder init failed");
ami_utf8_free(ncwin->core.wintitle);
free(ncwin);
return res;
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index 3d1c6f39b..0ae9cc040 100755..100644
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2009, 2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,345 +16,300 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Browser history window (AmigaOS implementation).
- *
- * There is only one history window, not one per browser window.
+/**
+ * \file
+ * Implementation of Amiga local history using core windows.
*/
-#include "amiga/os3support.h"
-
-#include <stdbool.h>
+#include <stdint.h>
#include <stdlib.h>
-#include <string.h>
+
#include <proto/intuition.h>
-#include <proto/exec.h>
-#include <proto/graphics.h>
-#include <intuition/icclass.h>
-#include <proto/utility.h>
-#include <proto/window.h>
-#include <proto/space.h>
-#include <proto/layout.h>
+
#include <classes/window.h>
-#include <gadgets/space.h>
+#include <gadgets/button.h>
+#include <gadgets/layout.h>
#include <gadgets/scroller.h>
-#include <reaction/reaction.h>
+#include <gadgets/space.h>
+#include <images/label.h>
+
+#include <intuition/icclass.h>
#include <reaction/reaction_macros.h>
#include "utils/log.h"
-#include "utils/utils.h"
-#include "utils/messages.h"
-#include "desktop/browser_history.h"
-#include "netsurf/browser_window.h"
+#include "netsurf/keypress.h"
#include "netsurf/plotters.h"
-#include "netsurf/window.h"
-#include "graphics/rpattr.h"
+#include "desktop/local_history.h"
+#include "utils/messages.h"
+#include "utils/nsoption.h"
+#include "utils/nsurl.h"
-#include "amiga/libs.h"
-#include "amiga/misc.h"
-#include "amiga/object.h"
-#include "amiga/plotters.h"
+#include "amiga/corewindow.h"
#include "amiga/gui.h"
+#include "amiga/libs.h"
#include "amiga/history_local.h"
+#include "amiga/utf8.h"
-struct history_window {
- struct ami_generic_window w;
- struct Window *win;
- Object *objects[GID_LAST];
- struct gui_window *gw;
- struct Hook scrollerhook;
- struct gui_globals *gg;
-};
-static void ami_history_update_extent(struct history_window *hw);
-HOOKF(void, ami_history_scroller_hook, Object *, object, struct IntuiMessage *);
+/**
+ * Amiga local history viewing window context
+ */
+struct ami_history_local_window {
+ /** Amiga core window context */
+ struct ami_corewindow core;
-static BOOL ami_history_event(void *w);
+ /** Amiga GUI stuff */
+ struct gui_window *gw;
-static const struct ami_win_event_table ami_localhistory_table = {
- ami_history_event,
- NULL, /* we don't explicitly close the local history window on quit */
+ /** local history viewer context data */
+ struct local_history_session *session;
};
+static struct ami_history_local_window *history_local_window = NULL;
+
/**
- * Redraw history window.
+ * destroy a previously created local history view
*/
-
-static void ami_history_redraw(struct history_window *hw)
+nserror
+ami_history_local_destroy(struct ami_history_local_window *history_local_win)
{
- struct IBox *bbox;
- ULONG xs,ys;
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &amiplot
- };
-
- GetAttr(SCROLLER_Top,hw->objects[OID_HSCROLL],(ULONG *)&xs);
- GetAttr(SCROLLER_Top,hw->objects[OID_VSCROLL],(ULONG *)&ys);
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
+ nserror res;
- glob = hw->gg;
-
- SetRPAttrs(glob->rp, RPTAG_APenColor, 0xffffffff, TAG_DONE);
- RectFill(glob->rp, 0, 0, bbox->Width - 1, bbox->Height - 1);
-
- browser_window_history_redraw_rectangle(hw->gw->bw, xs, ys,
- bbox->Width + xs, bbox->Height + ys, 0, 0, &ctx);
+ if (history_local_win == NULL) {
+ return NSERROR_OK;
+ }
- ami_gui_set_default_gg();
+ res = local_history_fini(history_local_win->session);
+ if (res == NSERROR_OK) {
+ history_local_win->gw->hw = NULL;
+ res = ami_corewindow_fini(&history_local_win->core); /* closes the window for us */
+ history_local_window = NULL;
+ }
+ return res;
+}
- ami_clearclipreg(hw->gg);
- ami_history_update_extent(hw);
+/**
+ * callback for mouse action for local history on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_local_mouse(struct ami_corewindow *ami_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ struct ami_history_local_window *history_local_win;
+ /* technically degenerate container of */
+ history_local_win = (struct ami_history_local_window *)ami_cw;
+
+ nsurl *url;
+
+ if(local_history_get_url(history_local_win->session, x, y, &url) == NSERROR_OK) {
+ if (url == NULL) {
+ SetGadgetAttrs(
+ (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
+ ami_cw->win,
+ NULL,
+ GA_HintInfo,
+ NULL,
+ TAG_DONE);
+ } else {
+ SetGadgetAttrs(
+ (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
+ ami_cw->win,
+ NULL,
+ GA_HintInfo,
+ nsurl_access(url),
+ TAG_DONE);
+ nsurl_unref(url);
+ }
+ }
- BltBitMapRastPort(hw->gg->bm, 0, 0, hw->win->RPort,
- bbox->Left, bbox->Top, bbox->Width, bbox->Height, 0x0C0);
+ local_history_mouse_action(history_local_win->session, mouse_state, x, y);
- ami_gui_free_space_box(bbox);
+ return NSERROR_OK;
}
-
-/* exported interface documented in amiga/history_local.h */
-void ami_history_open(struct gui_window *gw)
+/**
+ * callback for keypress for local history on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_local_key(struct ami_corewindow *ami_cw, uint32_t nskey)
{
- struct history *history;
- int width, height;
+ struct ami_history_local_window *history_local_win;
- if (gw->bw == NULL)
- return;
-
- history = browser_window_get_history(gw->bw);
- if (history == NULL)
- return;
-
- if(!gw->hw)
- {
- gw->hw = calloc(1, sizeof(struct history_window));
- gw->hw->gg = calloc(1, sizeof(struct gui_globals));
-
- ami_init_layers(gw->hw->gg, scrn->Width, scrn->Height, false);
-
- gw->hw->gw = gw;
- browser_window_history_size(gw->bw, &width, &height);
-
- gw->hw->scrollerhook.h_Entry = (void *)ami_history_scroller_hook;
- gw->hw->scrollerhook.h_Data = gw->hw;
-
- gw->hw->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, messages_get("History"),
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_SizeGadget, TRUE,
- WA_PubScreen,scrn,
- WA_InnerWidth,width,
- WA_InnerHeight,height + 10,
- WINDOW_SharedPort,sport,
- WINDOW_UserData,gw->hw,
- WINDOW_IconifyGadget, FALSE,
- WINDOW_GadgetHelp, TRUE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_HorizProp,1,
- WINDOW_VertProp,1,
- WINDOW_IDCMPHook,&gw->hw->scrollerhook,
- WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE,
-// WA_ReportMouse,TRUE,
- WA_IDCMP,IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE, // | IDCMP_MOUSEMOVE,
- WINDOW_ParentGroup, gw->hw->objects[GID_MAIN] = LayoutVObj,
- LAYOUT_AddChild, gw->hw->objects[GID_BROWSER] = SpaceObj,
- GA_ID,GID_BROWSER,
-// SPACE_MinWidth,width,
-// SPACE_MinHeight,height,
- SpaceEnd,
- EndGroup,
- EndWindow;
-
- gw->hw->win = (struct Window *)RA_OpenWindow(gw->hw->objects[OID_MAIN]);
- ami_gui_win_list_add(gw->hw, AMINS_HISTORYWINDOW, &ami_localhistory_table);
-
- GetAttr(WINDOW_HorizObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_HSCROLL]);
- GetAttr(WINDOW_VertObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_VSCROLL]);
-
- RefreshSetGadgetAttrs((APTR)gw->hw->objects[OID_VSCROLL],gw->hw->win,NULL,
- GA_ID,OID_VSCROLL,
- SCROLLER_Top,0,
- ICA_TARGET,ICTARGET_IDCMP,
- TAG_DONE);
-
- RefreshSetGadgetAttrs((APTR)gw->hw->objects[OID_HSCROLL],gw->hw->win,NULL,
- GA_ID,OID_HSCROLL,
- SCROLLER_Top,0,
- ICA_TARGET,ICTARGET_IDCMP,
- TAG_DONE);
- }
+ /* technically degenerate container of */
+ history_local_win = (struct ami_history_local_window *)ami_cw;
- ami_history_redraw(gw->hw);
+ if (local_history_keypress(history_local_win->session, nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
}
-
/**
- * Handle mouse clicks in the history window.
+ * callback on draw event for certificate verify on core window
*
- * \return true if the event was handled, false to pass it on
+ * \param ami_cw The Amiga core window structure.
+ * \param x the x coordinate to draw
+ * \param y the y coordinate to draw
+ * \param r The rectangle of the window that needs updating.
+ * \param ctx The drawing context
+ * \return NSERROR_OK on success otherwise apropriate error code
*/
+static nserror
+ami_history_local_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+{
+ struct ami_history_local_window *history_local_win;
-static bool ami_history_click(struct history_window *hw, uint16 code)
+ /* technically degenerate container of */
+ history_local_win = (struct ami_history_local_window *)ami_cw;
+
+ //ctx->plot->clip(ctx, r); //??
+ local_history_redraw(history_local_win->session, x, y, r, ctx);
+
+ return NSERROR_OK;
+}
+
+static nserror
+ami_history_local_create_window(struct ami_history_local_window *history_local_win)
{
- int x, y;
- struct IBox *bbox;
- ULONG xs, ys;
+ struct ami_corewindow *ami_cw = (struct ami_corewindow *)&history_local_win->core;
+ ULONG refresh_mode = WA_SmartRefresh;
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return false;
+ if(nsoption_bool(window_simple_refresh) == true) {
+ refresh_mode = WA_SimpleRefresh;
}
- GetAttr(SCROLLER_Top,hw->objects[OID_HSCROLL],(ULONG *)&xs);
- x = hw->win->MouseX - bbox->Left +xs;
- GetAttr(SCROLLER_Top,hw->objects[OID_VSCROLL],(ULONG *)&ys);
- y = hw->win->MouseY - bbox->Top + ys;
-
- ami_gui_free_space_box(bbox);
-
- switch(code)
- {
- case SELECTUP:
- browser_window_history_click(hw->gw->bw, x, y, false);
- ami_history_redraw(hw);
- ami_schedule_redraw(hw->gw->shared, true);
- break;
-
- case MIDDLEUP:
- browser_window_history_click(hw->gw->bw, x, y, true);
- ami_history_redraw(hw);
- break;
+ ami_cw->objects[GID_CW_WIN] = WindowObj,
+ WA_ScreenTitle, ami_gui_get_screen_title(),
+ WA_Title, ami_cw->wintitle,
+ WA_Activate, TRUE,
+ WA_DepthGadget, TRUE,
+ WA_DragBar, TRUE,
+ WA_CloseGadget, TRUE,
+ WA_SizeGadget, TRUE,
+ WA_SizeBRight, TRUE,
+ WA_Width, 100,
+ WA_Height, 100,
+ WA_PubScreen, scrn,
+ WA_ReportMouse, TRUE,
+ refresh_mode, TRUE,
+ WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
+ IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
+ IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
+ WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE |
+ IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
+ WINDOW_SharedPort, sport,
+ WINDOW_HorizProp, 1,
+ WINDOW_VertProp, 1,
+ WINDOW_UserData, history_local_win,
+// WINDOW_MenuStrip, NULL,
+ WINDOW_MenuUserData, WGUD_HOOK,
+ WINDOW_IconifyGadget, FALSE,
+ WINDOW_Position, WPOS_CENTERSCREEN,
+ WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
+ LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
+ GA_ID, GID_CW_DRAW,
+ SPACE_Transparent, TRUE,
+ SPACE_BevelStyle, BVS_DISPLAY,
+ GA_RelVerify, TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
+
+ if(ami_cw->objects[GID_CW_WIN] == NULL) {
+ return NSERROR_NOMEM;
}
- return true;
+ return NSERROR_OK;
}
-void ami_history_close(struct history_window *hw)
+/* exported interface documented in amiga/history_local.h */
+nserror ami_history_local_present(struct gui_window *gw)
{
- ami_free_layers(hw->gg);
- free(hw->gg);
- hw->gw->hw = NULL;
- DisposeObject(hw->objects[OID_MAIN]);
- ami_gui_win_list_remove(hw);
-}
+ struct ami_history_local_window *ncwin;
+ nserror res;
+ int width, height;
-static BOOL ami_history_event(void *w)
-{
- /* return TRUE if window destroyed */
- struct history_window *hw = (struct history_window *)w;
- ULONG result = 0;
- uint16 code;
- const char *url;
- struct IBox *bbox;
- ULONG xs, ys;
-
- while((result = RA_HandleInput(hw->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
- {
- switch(result & WMHI_CLASSMASK) // class
- {
-/* no menus yet, copied in as will probably need it later
- case WMHI_MENUPICK:
- item = ItemAddress(gwin->win->MenuStrip,code);
- while (code != MENUNULL)
- {
- ami_menupick(code,gwin);
- if(win_destroyed) break;
- code = item->NextSelect;
- }
- break;
-*/
-
- case WMHI_MOUSEMOVE:
- GetAttr(SCROLLER_Top, hw->objects[OID_HSCROLL], (ULONG *)&xs);
- GetAttr(SCROLLER_Top, hw->objects[OID_VSCROLL], (ULONG *)&ys);
-
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- break;
- }
-
- url = browser_window_history_position_url(hw->gw->bw,
- hw->win->MouseX - bbox->Left + xs,
- hw->win->MouseY - bbox->Top + ys);
-
- ami_gui_free_space_box(bbox);
-
- RefreshSetGadgetAttrs((APTR)hw->objects[GID_BROWSER],
- hw->win, NULL,
- GA_HintInfo, url,
- TAG_DONE);
- break;
-
- case WMHI_NEWSIZE:
- ami_history_redraw(hw);
- break;
-
- case WMHI_MOUSEBUTTONS:
- ami_history_click(hw,code);
- break;
-
- case WMHI_CLOSEWINDOW:
- ami_history_close(hw);
- return TRUE;
- break;
+ if(history_local_window != NULL) {
+ //windowtofront()
+
+ if (gw->hw != NULL) {
+ res = local_history_set(gw->hw->session, gw->bw);
+ return res;
}
+
+ return NSERROR_OK;
}
- return FALSE;
-}
-static void ami_history_update_extent(struct history_window *hw)
-{
- struct IBox *bbox;
- int width, height;
+ ncwin = calloc(1, sizeof(struct ami_history_local_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
- browser_window_history_size(hw->gw->bw, &width, &height);
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("History"));
+
+ res = ami_history_local_create_window(ncwin);
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO, "SSL UI builder init failed");
+ ami_utf8_free(ncwin->core.wintitle);
+ free(ncwin);
+ return res;
}
- RefreshSetGadgetAttrs((APTR)hw->objects[OID_VSCROLL], hw->win, NULL,
- GA_ID, OID_VSCROLL,
- SCROLLER_Total, height,
- SCROLLER_Visible, bbox->Height,
- ICA_TARGET, ICTARGET_IDCMP,
- TAG_DONE);
+ /* initialise Amiga core window */
+ ncwin->core.draw = ami_history_local_draw;
+ ncwin->core.key = ami_history_local_key;
+ ncwin->core.mouse = ami_history_local_mouse;
+ ncwin->core.close = ami_history_local_destroy;
+ ncwin->core.event = NULL;
+ ncwin->core.drag_end = NULL;
+ ncwin->core.icon_drop = NULL;
+
+ res = ami_corewindow_init(&ncwin->core);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = local_history_init(ncwin->core.cb_table,
+ (struct core_window *)ncwin,
+ gw->bw,
+ &ncwin->session);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = local_history_get_size(ncwin->session,
+ &width,
+ &height);
- RefreshSetGadgetAttrs((APTR)hw->objects[OID_HSCROLL], hw->win, NULL,
- GA_ID, OID_HSCROLL,
- SCROLLER_Total, width,
- SCROLLER_Visible, bbox->Width,
- ICA_TARGET, ICTARGET_IDCMP,
+ /*TODO: Adjust these to account for window borders */
+
+ SetAttrs(ncwin->core.objects[GID_CW_WIN],
+ WA_Width, width,
+ WA_Height, height,
TAG_DONE);
- ami_gui_free_space_box(bbox);
+ ncwin->gw = gw;
+ history_local_window = ncwin;
+ gw->hw = ncwin;
+
+ return NSERROR_OK;
}
-HOOKF(void, ami_history_scroller_hook, Object *, object, struct IntuiMessage *)
-{
- ULONG gid;
- struct history_window *hw = hook->h_Data;
-
- if (msg->Class == IDCMP_IDCMPUPDATE)
- {
- gid = GetTagData( GA_ID, 0, msg->IAddress );
-
- switch( gid )
- {
- case OID_HSCROLL:
- case OID_VSCROLL:
- ami_history_redraw(hw);
- break;
- }
- }
-// ReplyMsg((struct Message *)msg);
-}
diff --git a/frontends/amiga/history_local.h b/frontends/amiga/history_local.h
index 97aea0579..72ba7fa8b 100755..100644
--- a/frontends/amiga/history_local.h
+++ b/frontends/amiga/history_local.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,23 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef AMIGA_HISTORY_LOCAL_H
-#define AMIGA_HISTORY_LOCAL_H
-
-#include <exec/types.h>
-#include <intuition/classusr.h>
+#ifndef AMIGA_HISTORY_GLOBAL_H
+#define AMIGA_HISTORY_GLOBAL_H
struct gui_window;
-struct gui_globals;
-struct history_window;
-
-/**
- * Open history window.
- *
- * \param gw gui_window to open history for
- */
-void ami_history_open(struct gui_window *gw);
+struct ami_history_local_window;
-void ami_history_close(struct history_window *hw);
+/** Open the global history viewer */
+nserror ami_history_local_present(struct gui_window *gw);
+nserror ami_history_local_destroy(struct ami_history_local_window *history_local_win);
#endif
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
index 008e45a24..c7efe9148 100644
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -213,12 +213,15 @@ ami_hotlist_key(struct ami_corewindow *ami_cw, uint32_t nskey)
* callback on draw event for hotlist viewer on core window
*
* \param ami_cw The Amiga core window structure.
+ * \param x The x coordinate of hotlist area to redraw
+ * \param y The y coordinate of hotlist area to redraw
* \param r The rectangle of the window that needs updating.
* \param ctx The drawing context
* \return NSERROR_OK on success otherwise apropriate error code
*/
static nserror
-ami_hotlist_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+ami_hotlist_draw(struct ami_corewindow *ami_cw,
+ int x, int y, struct rect *r, struct redraw_context *ctx)
{
hotlist_redraw(x, y, r, ctx);
@@ -560,7 +563,7 @@ nserror ami_hotlist_present(void)
res = ami_hotlist_create_window(ncwin);
if (res != NSERROR_OK) {
- LOG("SSL UI builder init failed");
+ NSLOG(netsurf, INFO, "SSL UI builder init failed");
ami_utf8_free(ncwin->core.wintitle);
free(ncwin);
return res;
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index 3f597a1ba..582d355b6 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -16,7 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Content for image/x-amiga-icon (icon.library implementation).
*
*/
@@ -154,7 +155,7 @@ bool amiga_icon_convert(struct content *c)
if(filename == NULL)
{
msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -166,7 +167,7 @@ bool amiga_icon_convert(struct content *c)
if(dobj == NULL)
{
msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -186,14 +187,14 @@ bool amiga_icon_convert(struct content *c)
icon_c->bitmap = amiga_bitmap_create(width, height, BITMAP_NEW);
if (!icon_c->bitmap) {
msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
if(dobj) FreeDiskObject(dobj);
return false;
}
imagebuf = (ULONG *) amiga_bitmap_get_buffer(icon_c->bitmap);
if (!imagebuf) {
msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
if(dobj) FreeDiskObject(dobj);
return false;
}
@@ -273,8 +274,14 @@ bool amiga_icon_redraw(struct content *c,
if (data->repeat_y)
flags |= BITMAPF_REPEAT_Y;
- return ctx->plot->bitmap(data->x, data->y, data->width, data->height,
- icon_c->bitmap, data->background_colour, flags);
+ return (ctx->plot->bitmap(ctx,
+ icon_c->bitmap,
+ data->x,
+ data->y,
+ data->width,
+ data->height,
+ data->background_colour,
+ flags) == NSERROR_OK);
}
@@ -329,7 +336,10 @@ static ULONG *amiga_icon_convertcolouricon32(UBYTE *icondata, ULONG width, ULONG
if (!argbicon) return(NULL);
cmap=GetColorMap(pals1);
- if(!cmap) return(NULL);
+ if(!cmap) {
+ free(argbicon);
+ return(NULL);
+ }
for(i=0;i<(width*height);i++)
{
@@ -378,7 +388,7 @@ void amiga_icon_superimpose_favicon_internal(struct hlcache_handle *icon, struct
if(format != IDFMT_DIRECTMAPPED) return;
#ifdef __amigaos4__
if ((icon != NULL) && (content_get_bitmap(icon) != NULL)) {
- bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16, NULL);
+ bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16, false, NULL);
}
if(bm) {
@@ -499,7 +509,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
if(bm)
{
bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
- THUMBNAIL_HEIGHT, NULL);
+ THUMBNAIL_HEIGHT, false, NULL);
icondata = malloc(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT);
ami_bitmap_set_icondata(bm, icondata);
diff --git a/frontends/amiga/libs.c b/frontends/amiga/libs.c
index 4c242d214..305818076 100644
--- a/frontends/amiga/libs.c
+++ b/frontends/amiga/libs.c
@@ -23,6 +23,7 @@
#include "utils/utils.h"
#include "utils/log.h"
+#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/utility.h>
@@ -56,11 +57,11 @@
#ifdef __amigaos4__
#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \
- LOG("Opening %s v%d", LIB, LIBVER); \
+ NSLOG(netsurf, INFO, "Opening %s v%d", LIB, LIBVER); \
if((PREFIX##Base = (struct PREFIX##Base *)OpenLibrary(LIB, LIBVER))) { \
I##PREFIX = (struct PREFIX##IFace *)GetInterface((struct Library *)PREFIX##Base, INTERFACE, INTVER, NULL); \
if(I##PREFIX == NULL) { \
- LOG("Failed to get %s interface v%d of %s", INTERFACE, INTVER, LIB); \
+ NSLOG(netsurf, INFO, "Failed to get %s interface v%d of %s", INTERFACE, INTVER, LIB); \
AMINS_LIB_CLOSE(PREFIX) \
if(FAIL == true) { \
STRPTR error = ASPrintf("Unable to open interface %s v%d\nof %s v%ld (fatal error - not an OS4 lib?)", INTERFACE, INTVER, LIB, LIBVER); \
@@ -70,7 +71,7 @@
} \
} \
} else { \
- LOG("Failed to open %s v%d", LIB, LIBVER); \
+ NSLOG(netsurf, INFO, "Failed to open %s v%d", LIB, LIBVER); \
if(FAIL == true) { \
STRPTR error = ASPrintf("Unable to open %s v%ld (fatal error)", LIB, LIBVER); \
ami_misc_fatal_error(error); \
@@ -90,13 +91,13 @@
struct PREFIX##IFace *I##PREFIX = NULL;
#define AMINS_CLASS_OPEN(CLASS, CLASSVER, PREFIX, CLASSGET, NEEDINTERFACE) \
- LOG("Opening %s v%d", CLASS, CLASSVER); \
+ NSLOG(netsurf, INFO, "Opening %s v%d", CLASS, CLASSVER); \
if((PREFIX##Base = OpenClass(CLASS, CLASSVER, &PREFIX##Class))) { \
if(NEEDINTERFACE == true) { \
- LOG(" + interface"); \
+ NSLOG(netsurf, INFO, " + interface"); \
I##PREFIX = (struct PREFIX##IFace *)GetInterface((struct Library *)PREFIX##Base, "main", 1, NULL); \
if(I##PREFIX == NULL) { \
- LOG("Failed to get main interface v1 of %s", CLASS); \
+ NSLOG(netsurf, INFO, "Failed to get main interface v1 of %s", CLASS); \
} \
} \
} \
@@ -118,10 +119,10 @@
#else
#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \
- LOG("Opening %s v%d", LIB, LIBVER); \
+ NSLOG(netsurf, INFO, "Opening %s v%d", LIB, LIBVER); \
if((PREFIX##Base = (struct PREFIX##Base *)OpenLibrary(LIB, LIBVER))) { \
} else { \
- LOG("Failed to open %s v%d", LIB, LIBVER); \
+ NSLOG(netsurf, INFO, "Failed to open %s v%d", LIB, LIBVER); \
if(FAIL == true) { \
STRPTR error = ASPrintf("Unable to open %s v%d (fatal error)", LIB, LIBVER); \
ami_misc_fatal_error(error); \
@@ -137,7 +138,7 @@
struct PREFIX##Base *PREFIX##Base = NULL;
#define AMINS_CLASS_OPEN(CLASS, CLASSVER, PREFIX, CLASSGET, NEEDINTERFACE) \
- LOG("Opening %s v%d", CLASS, CLASSVER); \
+ NSLOG(netsurf, INFO, "Opening %s v%d", CLASS, CLASSVER); \
if((PREFIX##Base = OpenLibrary(CLASS, CLASSVER))) { \
PREFIX##Class = CLASSGET##_GetClass(); \
} \
@@ -219,6 +220,7 @@ bool ami_libs_open(void)
AMINS_LIB_OPEN("asl.library", 37, Asl, "main", 1, true)
AMINS_LIB_OPEN("datatypes.library", 39, DataTypes, "main", 1, true)
AMINS_LIB_OPEN("diskfont.library", 40, Diskfont, "main", 1, true)
+ AMINS_LIB_OPEN("dos.library", 37, DOS, "main", 1, true)
AMINS_LIB_OPEN("gadtools.library", 37, GadTools, "main", 1, true)
AMINS_LIB_OPEN("graphics.library", 40, Graphics, "main", 1, true)
AMINS_LIB_OPEN("icon.library", 44, Icon, "main", 1, true)
@@ -254,29 +256,32 @@ bool ami_libs_open(void)
* NB: the last argument should be "true" only if the class also has
* library functions we use.
*/
- AMINS_CLASS_OPEN("arexx.class", 44, ARexx, AREXX, false)
- AMINS_CLASS_OPEN("images/bevel.image", 44, Bevel, BEVEL, false)
- AMINS_CLASS_OPEN("images/bitmap.image", 44, BitMap, BITMAP, false)
- AMINS_CLASS_OPEN("gadgets/button.gadget", 44, Button, BUTTON, false)
- AMINS_CLASS_OPEN("gadgets/checkbox.gadget", 44, CheckBox, CHECKBOX, false)
- AMINS_CLASS_OPEN("gadgets/chooser.gadget", 44, Chooser, CHOOSER, true)
- AMINS_CLASS_OPEN("gadgets/clicktab.gadget", 44, ClickTab, CLICKTAB, true)
- AMINS_CLASS_OPEN("gadgets/fuelgauge.gadget", 44, FuelGauge, FUELGAUGE, false)
- AMINS_CLASS_OPEN("gadgets/getfile.gadget", 44, GetFile, GETFILE, false)
- AMINS_CLASS_OPEN("gadgets/getfont.gadget", 44, GetFont, GETFONT, false)
- AMINS_CLASS_OPEN("gadgets/getscreenmode.gadget", 44, GetScreenMode, GETSCREENMODE, false)
- AMINS_CLASS_OPEN("gadgets/integer.gadget", 44, Integer, INTEGER, false)
- AMINS_CLASS_OPEN("images/label.image", 44, Label, LABEL, false)
- AMINS_CLASS_OPEN("gadgets/layout.gadget", 44, Layout, LAYOUT, true)
- AMINS_CLASS_OPEN("gadgets/listbrowser.gadget", 44, ListBrowser, LISTBROWSER, true)
- AMINS_CLASS_OPEN("gadgets/radiobutton.gadget", 44, RadioButton, RADIOBUTTON, false)
- AMINS_CLASS_OPEN("gadgets/scroller.gadget", 44, Scroller, SCROLLER, false)
- AMINS_CLASS_OPEN("gadgets/space.gadget", 44, Space, SPACE, false)
- AMINS_CLASS_OPEN("gadgets/speedbar.gadget", 44, SpeedBar, SPEEDBAR, true)
- AMINS_CLASS_OPEN("gadgets/string.gadget", 44, String, STRING, false)
- AMINS_CLASS_OPEN("window.class", 44, Window, WINDOW, false)
+ AMINS_CLASS_OPEN("arexx.class", 41, ARexx, AREXX, false)
+ AMINS_CLASS_OPEN("images/bevel.image", 41, Bevel, BEVEL, false)
+ AMINS_CLASS_OPEN("images/bitmap.image", 41, BitMap, BITMAP, false)
+ AMINS_CLASS_OPEN("gadgets/button.gadget", 42, Button, BUTTON, false)
+ AMINS_CLASS_OPEN("gadgets/checkbox.gadget", 41, CheckBox, CHECKBOX, false)
+ AMINS_CLASS_OPEN("gadgets/chooser.gadget", 41, Chooser, CHOOSER, true)
+ AMINS_CLASS_OPEN("gadgets/clicktab.gadget", 42, ClickTab, CLICKTAB, true)
+ AMINS_CLASS_OPEN("gadgets/fuelgauge.gadget", 41, FuelGauge, FUELGAUGE, false)
+ AMINS_CLASS_OPEN("gadgets/getfile.gadget", 41, GetFile, GETFILE, false)
+ AMINS_CLASS_OPEN("gadgets/getfont.gadget", 41, GetFont, GETFONT, false)
+ AMINS_CLASS_OPEN("gadgets/getscreenmode.gadget", 41, GetScreenMode, GETSCREENMODE, false)
+ AMINS_CLASS_OPEN("gadgets/integer.gadget", 41, Integer, INTEGER, false)
+ AMINS_CLASS_OPEN("images/label.image", 41, Label, LABEL, false)
+ AMINS_CLASS_OPEN("gadgets/layout.gadget", 43, Layout, LAYOUT, true)
+ AMINS_CLASS_OPEN("gadgets/radiobutton.gadget", 41, RadioButton, RADIOBUTTON, false)
+ AMINS_CLASS_OPEN("gadgets/scroller.gadget", 42, Scroller, SCROLLER, false)
+ AMINS_CLASS_OPEN("gadgets/space.gadget", 41, Space, SPACE, false)
+ AMINS_CLASS_OPEN("gadgets/speedbar.gadget", 41, SpeedBar, SPEEDBAR, true)
+ AMINS_CLASS_OPEN("gadgets/string.gadget", 41, String, STRING, false)
+ AMINS_CLASS_OPEN("window.class", 42, Window, WINDOW, false)
-#ifndef __amigaos4__
+#ifdef __amigaos4__
+ /* BOOPSI classes only required on OS4 */
+ AMINS_CLASS_OPEN("gadgets/listbrowser.gadget", 45, ListBrowser, LISTBROWSER, true)
+#else
+ /* BOOPSI classes only required prior to OS4 */
PageClass = PAGE_GetClass();
#endif
@@ -302,13 +307,15 @@ void ami_libs_close(void)
AMINS_CLASS_CLOSE(Integer)
AMINS_CLASS_CLOSE(Label)
AMINS_CLASS_CLOSE(Layout)
- AMINS_CLASS_CLOSE(ListBrowser)
AMINS_CLASS_CLOSE(RadioButton)
AMINS_CLASS_CLOSE(Scroller)
AMINS_CLASS_CLOSE(Space)
AMINS_CLASS_CLOSE(SpeedBar)
AMINS_CLASS_CLOSE(String)
AMINS_CLASS_CLOSE(Window)
+#ifdef __amigaos4__
+ AMINS_CLASS_CLOSE(ListBrowser)
+#endif
/* Libraries */
AMINS_LIB_CLOSE(GuiGFX)
@@ -316,6 +323,7 @@ void ami_libs_close(void)
AMINS_LIB_CLOSE(Asl)
AMINS_LIB_CLOSE(DataTypes)
AMINS_LIB_CLOSE(Diskfont)
+ AMINS_LIB_CLOSE(DOS)
AMINS_LIB_CLOSE(GadTools)
AMINS_LIB_CLOSE(Graphics)
AMINS_LIB_CLOSE(Icon)
diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c
index d371d2585..35ca9697f 100755
--- a/frontends/amiga/memory.c
+++ b/frontends/amiga/memory.c
@@ -50,23 +50,38 @@ void *ami_memory_clear_alloc(size_t size, UBYTE value)
static int ami_memory_slab_usage_cb(const struct __slab_usage_information * sui)
{
if(sui->sui_slab_index <= 1) {
- LOG("clib2 slab usage:");
- LOG(" The size of all slabs, in bytes: %ld", sui->sui_slab_size);
- LOG(" Number of allocations which are not managed by slabs: %ld",
- sui->sui_num_single_allocations);
- LOG(" Total number of bytes allocated for memory not managed by slabs: %ld",
- sui->sui_total_single_allocation_size);
- LOG(" Number of slabs currently in play: %ld", sui->sui_num_slabs);
- LOG(" Number of currently unused slabs: %ld", sui->sui_num_empty_slabs);
- LOG(" Number of slabs in use which are completely filled with data: %ld",
- sui->sui_num_full_slabs);
- LOG(" Total number of bytes allocated for all slabs: %ld",
- sui->sui_total_slab_allocation_size);
+ NSLOG(netsurf, INFO, "clib2 slab usage:");
+ NSLOG(netsurf, INFO,
+ " The size of all slabs, in bytes: %ld",
+ sui->sui_slab_size);
+ NSLOG(netsurf, INFO,
+ " Number of allocations which are not managed by slabs: %ld",
+ sui->sui_num_single_allocations);
+ NSLOG(netsurf, INFO,
+ " Total number of bytes allocated for memory not managed by slabs: %ld",
+ sui->sui_total_single_allocation_size);
+ NSLOG(netsurf, INFO,
+ " Number of slabs currently in play: %ld",
+ sui->sui_num_slabs);
+ NSLOG(netsurf, INFO,
+ " Number of currently unused slabs: %ld",
+ sui->sui_num_empty_slabs);
+ NSLOG(netsurf, INFO,
+ " Number of slabs in use which are completely filled with data: %ld",
+ sui->sui_num_full_slabs);
+ NSLOG(netsurf, INFO,
+ " Total number of bytes allocated for all slabs: %ld",
+ sui->sui_total_slab_allocation_size);
}
- LOG("Slab %d", sui->sui_slab_index);
- LOG(" Memory chunk size managed by this slab: %ld", sui->sui_chunk_size);
- LOG(" Number of memory chunks that fit in this slab: %ld", sui->sui_num_chunks);
- LOG(" Number of memory chunks used in this slab: %ld", sui->sui_num_chunks_used);
+ NSLOG(netsurf, INFO, "Slab %d", sui->sui_slab_index);
+ NSLOG(netsurf, INFO, " Memory chunk size managed by this slab: %ld",
+ sui->sui_chunk_size);
+ NSLOG(netsurf, INFO,
+ " Number of memory chunks that fit in this slab: %ld",
+ sui->sui_num_chunks);
+ NSLOG(netsurf, INFO,
+ " Number of memory chunks used in this slab: %ld",
+ sui->sui_num_chunks_used);
return 0;
}
@@ -74,16 +89,20 @@ static int ami_memory_slab_usage_cb(const struct __slab_usage_information * sui)
static int ami_memory_slab_alloc_cb(const struct __slab_allocation_information *sai)
{
if(sai->sai_allocation_index <= 1) {
- LOG("clib2 allocation usage:");
- LOG(" Number of allocations which are not managed by slabs: %ld",
- sai->sai_num_single_allocations);
- LOG(" Total number of bytes allocated for memory not managed by slabs: %ld",
- sai->sai_total_single_allocation_size);
+ NSLOG(netsurf, INFO, "clib2 allocation usage:");
+ NSLOG(netsurf, INFO,
+ " Number of allocations which are not managed by slabs: %ld",
+ sai->sai_num_single_allocations);
+ NSLOG(netsurf, INFO,
+ " Total number of bytes allocated for memory not managed by slabs: %ld",
+ sai->sai_total_single_allocation_size);
}
- LOG("Alloc %d", sai->sai_allocation_index);
- LOG(" Size of this allocation, as requested: %ld", sai->sai_allocation_size);
- LOG(" Total size of this allocation, including management data: %ld",
- sai->sai_total_allocation_size);
+ NSLOG(netsurf, INFO, "Alloc %d", sai->sai_allocation_index);
+ NSLOG(netsurf, INFO, " Size of this allocation, as requested: %ld",
+ sai->sai_allocation_size);
+ NSLOG(netsurf, INFO,
+ " Total size of this allocation, including management data: %ld",
+ sai->sai_total_allocation_size);
return 0;
}
@@ -111,13 +130,13 @@ void ami_memory_slab_dump(BPTR fh)
static void ami_memory_low_mem_handler(void *p)
{
if(low_mem_status == PURGE_STEP1) {
- LOG("Purging llcache");
+ NSLOG(netsurf, INFO, "Purging llcache");
llcache_clean(true);
low_mem_status = PURGE_DONE_STEP1;
}
if(low_mem_status == PURGE_STEP2) {
- LOG("Purging unused slabs");
+ NSLOG(netsurf, INFO, "Purging unused slabs");
__free_unused_slabs();
low_mem_status = PURGE_DONE_STEP2;
}
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 249ca0755..1f3f981ea 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -263,7 +263,9 @@ static int ami_menu_layout_mc_recursive(Object *menu_parent, struct ami_menu_dat
TAG_DONE);
}
- //LOG("Adding item %p ID %d (%s) to parent %p", menu_item, j, md[j]->menulab, menu_parent);
+ NSLOG(netsurf, DEEPDEBUG,
+ "Adding item %p ID %d (%s) to parent %p",
+ menu_item, j, md[j]->menulab, menu_parent);
IDoMethod(menu_parent, OM_ADDMEMBER, menu_item);
continue;
} else if (md[j]->menutype > level) {
@@ -389,7 +391,7 @@ static struct Menu *ami_menu_layout_gt(struct ami_menu_data **md, int max)
else
nm[i].nm_Label = md[i]->menulab;
- if((md[i]->menukey) && (strlen(md[i]->menukey) > 1)) {
+ if((md[i]->menukey) && (strlen(md[i]->menukey) == 1)) {
nm[i].nm_CommKey = md[i]->menukey;
}
nm[i].nm_Flags = md[i]->flags;
diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c
index 5ca4f906a..532d2f182 100755
--- a/frontends/amiga/misc.c
+++ b/frontends/amiga/misc.c
@@ -46,7 +46,7 @@ static LONG ami_misc_req(const char *message, uint32 type)
{
LONG ret = 0;
- LOG("%s", message);
+ NSLOG(netsurf, INFO, "%s", message);
#ifdef __amigaos4__
ret = TimedDosRequesterTags(
TDR_TitleString, messages_get("NetSurf"),
diff --git a/frontends/amiga/options.h b/frontends/amiga/options.h
index b5b2b3b07..a23435ca6 100644
--- a/frontends/amiga/options.h
+++ b/frontends/amiga/options.h
@@ -49,6 +49,7 @@ NSOPTION_STRING(arexx_startup, "Startup.nsrx")
NSOPTION_STRING(arexx_shutdown, "Shutdown.nsrx")
NSOPTION_STRING(download_dir, NULL)
NSOPTION_BOOL(download_notify, true)
+NSOPTION_BOOL(download_notify_progress, false)
NSOPTION_BOOL(faster_scroll, true)
NSOPTION_BOOL(scale_quality, false)
NSOPTION_INTEGER(dither_quality, 0)
@@ -79,7 +80,6 @@ NSOPTION_INTEGER(cookies_window_ypos, 0)
NSOPTION_INTEGER(cookies_window_xsize, 0)
NSOPTION_INTEGER(cookies_window_ysize, 0)
NSOPTION_INTEGER(web_search_width, 0)
-NSOPTION_BOOL(direct_render, false)
NSOPTION_BOOL(window_simple_refresh, false)
NSOPTION_BOOL(resize_with_contents, false)
NSOPTION_INTEGER(reformat_delay, 0)
diff --git a/frontends/amiga/os3support.c b/frontends/amiga/os3support.c
index c08260209..645496b73 100644
--- a/frontends/amiga/os3support.c
+++ b/frontends/amiga/os3support.c
@@ -216,13 +216,13 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
fh = Open(fontpath, MODE_OLDFILE);
if(fh == 0) {
- LOG("Unable to open FONT %s", fontpath);
+ NSLOG(netsurf, INFO, "Unable to open FONT %s", fontpath);
FreeVec(fontpath);
return NULL;
}
if(Read(fh, &fch, sizeof(struct FontContentsHeader)) != sizeof(struct FontContentsHeader)) {
- LOG("Unable to read FONT %s", fontpath);
+ NSLOG(netsurf, INFO, "Unable to read FONT %s", fontpath);
FreeVec(fontpath);
Close(fh);
return NULL;
@@ -231,7 +231,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
Close(fh);
if(fch.fch_FileID != OFCH_ID) {
- LOG("%s is not an outline font!", fontpath);
+ NSLOG(netsurf, INFO, "%s is not an outline font!", fontpath);
FreeVec(fontpath);
return NULL;
}
@@ -242,7 +242,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
if(p) *p = '.';
if(fh == 0) {
- LOG("Unable to open OTAG %s", otagpath);
+ NSLOG(netsurf, INFO, "Unable to open OTAG %s", otagpath);
FreeVec(otagpath);
return NULL;
}
@@ -250,7 +250,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
size = GetFileSize(fh);
buffer = (UBYTE *)malloc(size);
if(buffer == NULL) {
- LOG("Unable to allocate memory");
+ NSLOG(netsurf, INFO, "Unable to allocate memory");
Close(fh);
FreeVec(otagpath);
return NULL;
@@ -262,7 +262,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
/* The first tag is supposed to be OT_FileIdent and should equal 'size' */
struct TagItem *tag = (struct TagItem *)buffer;
if((tag->ti_Tag != OT_FileIdent) || (tag->ti_Data != (ULONG)size)) {
- LOG("Invalid OTAG file");
+ NSLOG(netsurf, INFO, "Invalid OTAG file");
free(buffer);
FreeVec(otagpath);
return NULL;
@@ -277,10 +277,10 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
/* Find OT_Engine and open the font engine */
if(ti = FindTagItem(OT_Engine, buffer)) {
- LOG("Using font engine %s", ti->ti_Data);
+ NSLOG(netsurf, INFO, "Using font engine %s", ti->ti_Data);
fname = ASPrintf("%s.library", ti->ti_Data);
} else {
- LOG("Cannot find OT_Engine tag");
+ NSLOG(netsurf, INFO, "Cannot find OT_Engine tag");
free(buffer);
FreeVec(otagpath);
return NULL;
@@ -289,7 +289,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
BulletBase = (struct BulletBase *)OpenLibrary(fname, 0L);
if(BulletBase == NULL) {
- LOG("Unable to open font engine %s", fname);
+ NSLOG(netsurf, INFO, "Unable to open font engine %s", fname);
free(buffer);
FreeVec(fname);
FreeVec(otagpath);
@@ -332,13 +332,13 @@ void CloseOutlineFont(struct OutlineFont *of, struct List *list)
int64 GetFileSize(BPTR fh)
{
int32 size = 0;
- struct FileInfoBlock *fib = malloc(sizeof(struct FileInfoBlock));
+ struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
if(fib == NULL) return 0;
ExamineFH(fh, fib);
size = fib->fib_Size;
- free(fib);
+ FreeDosObject(DOS_FIB, fib);
return (int64)size;
}
@@ -405,9 +405,10 @@ ULONG RefreshSetGadgetAttrsA(struct Gadget *g, struct Window *w, struct Requeste
ULONG retval;
BOOL changedisabled = FALSE;
BOOL disabled;
+ struct TagItem *ti;
if (w) {
- if (FindTagItem(GA_Disabled,tags)) {
+ if ((ti = FindTagItem(GA_Disabled,tags)) && (ti->ti_Data != FALSE)) {
changedisabled = TRUE;
disabled = g->Flags & GFLG_DISABLED;
}
diff --git a/frontends/amiga/os3support.h b/frontends/amiga/os3support.h
index 856439bd8..aa3027d36 100644
--- a/frontends/amiga/os3support.h
+++ b/frontends/amiga/os3support.h
@@ -116,6 +116,7 @@
#define BGBACKFILL JAM1
#define OFF_OPEN 0
#define AFF_OTAG 0
+#define ML_SEPARATOR NM_BARLABEL
/* Renamed structures */
#define AnchorPathOld AnchorPath
diff --git a/frontends/amiga/pkg/makereslinks b/frontends/amiga/pkg/makereslinks
index 4302dbd23..a9f7dfb94 100755
--- a/frontends/amiga/pkg/makereslinks
+++ b/frontends/amiga/pkg/makereslinks
@@ -3,26 +3,26 @@
failat 50
makedir Resources
cd Resources
-makelink AdBlock.css /!NetSurf/Resources/AdBlock,f79 soft
+makelink AdBlock.css /resources/adblock.css soft
makelink default.css /amiga/resources/default.css soft
-makelink ca-bundle /!NetSurf/Resources/ca-bundle soft
-makelink de /!NetSurf/Resources/de soft
-makelink nsdefault.css /!NetSurf/Resources/CSS,f79 soft
+makelink ca-bundle /resources/ca-bundle soft
+makelink de /resources/de soft
+makelink nsdefault.css /resources/default.css soft
makelink favicon.png /amiga/resources/favicon.png soft
makelink Resource.map /amiga/resources/Resource.map soft
-makelink en /!NetSurf/Resources/en soft
-makelink fr /!NetSurf/Resources/fr soft
-makelink internal.css /!NetSurf/Resources/internal.css,f79 soft
-makelink it /!NetSurf/Resources/it soft
+makelink en /resources/en soft
+makelink fr /resources/fr soft
+makelink internal.css /resources/internal.css soft
+makelink it /resources/it soft
makelink LangNames /amiga/resources/LangNames soft
-makelink netsurf.png /!NetSurf/Resources/netsurf.png,b60 soft
-makelink nl /!NetSurf/Resources/nl soft
+makelink netsurf.png /resources/netsurf.png soft
+makelink nl /resources/nl soft
makelink Pointers /amiga/resources/Pointers soft
-makelink quirks.css /!NetSurf/Resources/Quirks,f79 soft
+makelink quirks.css /resources/quirks.css soft
makelink SearchEngines /amiga/resources/SearchEngines soft
makelink splash.png /amiga/resources/splash.png soft
makelink Themes /amiga/resources/Themes soft
makelink mimetypes /amiga/resources/mimetypes soft
/
-makelink amiga/resources/nsdefault.css //!NetSurf/Resources/CSS,f79 soft
+makelink amiga/resources/nsdefault.css //resources/default.css soft
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 6bae6346a..4623afad2 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -20,6 +20,8 @@
#include <proto/exec.h>
#include <proto/intuition.h>
+#include <proto/layers.h>
+#include <proto/graphics.h>
#include <intuition/intuition.h>
#include <graphics/rpattr.h>
@@ -51,8 +53,6 @@
#include "amiga/rtg.h"
#include "amiga/utf8.h"
-//#define AMI_PLOTTER_DEBUG 1
-
HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage *);
struct bfbitmap {
@@ -62,6 +62,7 @@ struct bfbitmap {
int offsetx;
int offsety;
APTR mask;
+ bool palette_mapped;
};
struct ami_plot_pen {
@@ -74,10 +75,27 @@ struct bez_point {
float y;
};
-struct gui_globals *glob;
+struct gui_globals {
+ struct BitMap *bm;
+ struct RastPort *rp;
+ struct Layer_Info *layerinfo;
+ APTR areabuf;
+ APTR tmprasbuf;
+ struct Rectangle rect;
+ struct MinList *shared_pens;
+ bool managed_pen_list;
+ bool palette_mapped;
+ ULONG apen;
+ ULONG open;
+ LONG apen_num;
+ LONG open_num;
+ int width; /* size of bm and */
+ int height; /* associated memory */
+};
static int init_layers_count = 0;
static APTR pool_pens = NULL;
+static bool palette_mapped = true; /* palette-mapped state for the screen */
#ifndef M_PI /* For some reason we don't always get this from math.h */
#define M_PI 3.14159265358979323846
@@ -92,26 +110,24 @@ static APTR pool_pens = NULL;
*/
#define AREA_SIZE 25000
-/* Define the below to get additional debug */
-#undef AMI_PLOTTER_DEBUG
-
-void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool force32bit)
+struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit, bool alloc_pen_list)
{
- /* init shared bitmaps *
- * Height is set to screen width to give enough space for thumbnails *
- * Also applies to the further gfx/layers functions and memory below */
-
- int depth = 32;
+ /* init shared bitmaps */
+ int depth = 32;
struct BitMap *friend = NULL;
+ struct gui_globals *gg = malloc(sizeof(struct gui_globals));
+
if(force32bit == false) depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH);
- LOG("Screen depth = %d", depth);
+ NSLOG(netsurf, INFO, "Screen depth = %d", depth);
#ifdef __amigaos4__
if(depth < 16) {
gg->palette_mapped = true;
+ if(force32bit == false) palette_mapped = true;
} else {
gg->palette_mapped = false;
+ if(force32bit == false) palette_mapped = false;
}
#else
/* Friend BitMaps are weird.
@@ -135,6 +151,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
*/
#warning OS3 locked to palette-mapped modes
gg->palette_mapped = true;
+ palette_mapped = true;
if(depth > 8) depth = 8;
#endif
@@ -192,8 +209,18 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height);
- if((gg->palette_mapped == true) && (pool_pens == NULL)) {
- pool_pens = ami_memory_itempool_create(sizeof(struct ami_plot_pen));
+ gg->shared_pens = NULL;
+ gg->managed_pen_list = false;
+
+ if(gg->palette_mapped == true) {
+ if(pool_pens == NULL) {
+ pool_pens = ami_memory_itempool_create(sizeof(struct ami_plot_pen));
+ }
+
+ if(alloc_pen_list == true) {
+ gg->shared_pens = ami_AllocMinList();
+ gg->managed_pen_list = true;
+ }
}
gg->apen = 0x00000000;
@@ -202,20 +229,25 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
gg->open_num = -1;
init_layers_count++;
- LOG("Layer initialised (total: %d)", init_layers_count);
+ NSLOG(netsurf, INFO, "Layer initialised (total: %d)",
+ init_layers_count);
+
+ return gg;
}
-void ami_free_layers(struct gui_globals *gg)
+void ami_plot_ra_free(struct gui_globals *gg)
{
init_layers_count--;
+ if(init_layers_count < 0) return;
+
if((init_layers_count == 0) && (pool_pens != NULL)) {
ami_memory_itempool_delete(pool_pens);
pool_pens = NULL;
}
if(gg->rp) {
- DeleteLayer(0,gg->rp->Layer);
+ if(gg->rp->Layer != NULL) DeleteLayer(0, gg->rp->Layer);
free(gg->rp->TmpRas);
free(gg->rp->AreaInfo);
free(gg->rp);
@@ -229,6 +261,35 @@ void ami_free_layers(struct gui_globals *gg)
} else {
if(gg->bm) FreeBitMap(gg->bm);
}
+
+ if(gg->managed_pen_list == true) {
+ ami_plot_release_pens(gg->shared_pens);
+ free(gg->shared_pens);
+ gg->shared_pens = NULL;
+ }
+
+ free(gg);
+}
+
+struct RastPort *ami_plot_ra_get_rastport(struct gui_globals *gg)
+{
+ return gg->rp;
+}
+
+struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg)
+{
+ return gg->bm;
+}
+
+void ami_plot_ra_get_size(struct gui_globals *gg, int *width, int *height)
+{
+ *width = gg->width;
+ *height = gg->height;
+}
+
+void ami_plot_ra_set_pen_list(struct gui_globals *gg, struct MinList *pen_list)
+{
+ gg->shared_pens = pen_list;
}
void ami_clearclipreg(struct gui_globals *gg)
@@ -242,6 +303,11 @@ void ami_clearclipreg(struct gui_globals *gg)
gg->rect.MinY = 0;
gg->rect.MaxX = scrn->Width-1;
gg->rect.MaxY = scrn->Height-1;
+
+ gg->apen = 0x00000000;
+ gg->open = 0x00000000;
+ gg->apen_num = -1;
+ gg->open_num = -1;
}
static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr)
@@ -253,7 +319,8 @@ static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr)
(colr & 0x00ff0000) << 8,
NULL);
- if(pen == -1) LOG("WARNING: Cannot allocate pen for ABGR:%lx", colr);
+ if(pen == -1) NSLOG(netsurf, INFO,
+ "WARNING: Cannot allocate pen for ABGR:%lx", colr);
if((shared_pens != NULL) && (pool_pens != NULL)) {
if((node = (struct ami_plot_pen *)ami_memory_itempool_alloc(pool_pens, sizeof(struct ami_plot_pen)))) {
@@ -282,14 +349,9 @@ void ami_plot_release_pens(struct MinList *shared_pens)
Remove((struct Node *)node);
ami_memory_itempool_free(pool_pens, node, sizeof(struct ami_plot_pen));
} while((node = nnode));
-
- glob->apen = 0x00000000;
- glob->open = 0x00000000;
- glob->apen_num = -1;
- glob->open_num = -1;
}
-static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
+static void ami_plot_setapen(struct gui_globals *glob, struct RastPort *rp, ULONG colr)
{
if(glob->apen == colr) return;
@@ -308,7 +370,7 @@ static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
glob->apen = colr;
}
-static void ami_plot_setopen(struct RastPort *rp, ULONG colr)
+static void ami_plot_setopen(struct gui_globals *glob, struct RastPort *rp, ULONG colr)
{
if(glob->open == colr) return;
@@ -336,172 +398,7 @@ void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox)
}
-static bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_rectangle()");
- #endif
-
- if (style->fill_type != PLOT_OP_TYPE_NONE) {
- ami_plot_setapen(glob->rp, style->fill_colour);
- RectFill(glob->rp, x0, y0, x1-1, y1-1);
- }
-
- if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- glob->rp->PenWidth = style->stroke_width;
- glob->rp->PenHeight = style->stroke_width;
-
- switch (style->stroke_type) {
- case PLOT_OP_TYPE_SOLID: /**< Solid colour */
- default:
- glob->rp->LinePtrn = PATT_LINE;
- break;
-
- case PLOT_OP_TYPE_DOT: /**< Dotted plot */
- glob->rp->LinePtrn = PATT_DOT;
- break;
-
- case PLOT_OP_TYPE_DASH: /**< dashed plot */
- glob->rp->LinePtrn = PATT_DASH;
- break;
- }
-
- ami_plot_setapen(glob->rp, style->stroke_colour);
- Move(glob->rp, x0,y0);
- Draw(glob->rp, x1, y0);
- Draw(glob->rp, x1, y1);
- Draw(glob->rp, x0, y1);
- Draw(glob->rp, x0, y0);
-
- glob->rp->PenWidth = 1;
- glob->rp->PenHeight = 1;
- glob->rp->LinePtrn = PATT_LINE;
- }
-
- return true;
-}
-
-static bool ami_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_line()");
- #endif
-
- glob->rp->PenWidth = style->stroke_width;
- glob->rp->PenHeight = style->stroke_width;
-
- switch (style->stroke_type) {
- case PLOT_OP_TYPE_SOLID: /**< Solid colour */
- default:
- glob->rp->LinePtrn = PATT_LINE;
- break;
-
- case PLOT_OP_TYPE_DOT: /**< Doted plot */
- glob->rp->LinePtrn = PATT_DOT;
- break;
-
- case PLOT_OP_TYPE_DASH: /**< dashed plot */
- glob->rp->LinePtrn = PATT_DASH;
- break;
- }
-
- ami_plot_setapen(glob->rp, style->stroke_colour);
- Move(glob->rp,x0,y0);
- Draw(glob->rp,x1,y1);
-
- glob->rp->PenWidth = 1;
- glob->rp->PenHeight = 1;
- glob->rp->LinePtrn = PATT_LINE;
-
- return true;
-}
-
-static bool ami_polygon(const int *p, unsigned int n, const plot_style_t *style)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_polygon()");
- #endif
-
- ami_plot_setapen(glob->rp, style->fill_colour);
-
- if(AreaMove(glob->rp,p[0],p[1]) == -1)
- LOG("AreaMove: vector list full");
-
- for(uint32 k = 1; k < n; k++) {
- if(AreaDraw(glob->rp,p[k*2],p[(k*2)+1]) == -1)
- LOG("AreaDraw: vector list full");
- }
-
- if(AreaEnd(glob->rp) == -1)
- LOG("AreaEnd: error");
-
- return true;
-}
-
-
-static bool ami_clip(const struct rect *clip)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_clip()");
- #endif
-
- struct Region *reg = NULL;
-
- if(glob->rp->Layer)
- {
- reg = NewRegion();
-
- glob->rect.MinX = clip->x0;
- glob->rect.MinY = clip->y0;
- glob->rect.MaxX = clip->x1-1;
- glob->rect.MaxY = clip->y1-1;
-
- OrRectRegion(reg,&glob->rect);
-
- reg = InstallClipRegion(glob->rp->Layer,reg);
-
- if(reg) DisposeRegion(reg);
- }
-
- return true;
-}
-
-static bool ami_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_text()");
- #endif
-
- if(__builtin_expect(ami_nsfont == NULL, 0)) return false;
-
- ami_plot_setapen(glob->rp, fstyle->foreground);
- ami_nsfont->text(glob->rp, text, length, fstyle, x, y, nsoption_bool(font_antialiasing));
-
- return true;
-}
-
-static bool ami_disc(int x, int y, int radius, const plot_style_t *style)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_disc()");
- #endif
-
- if (style->fill_type != PLOT_OP_TYPE_NONE) {
- ami_plot_setapen(glob->rp, style->fill_colour);
- AreaCircle(glob->rp,x,y,radius);
- AreaEnd(glob->rp);
- }
-
- if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- ami_plot_setapen(glob->rp, style->stroke_colour);
- DrawEllipse(glob->rp,x,y,radius,radius);
- }
-
- return true;
-}
-
-static void ami_arc_gfxlib(int x, int y, int radius, int angle1, int angle2)
+static void ami_arc_gfxlib(struct RastPort *rp, int x, int y, int radius, int angle1, int angle2)
{
double angle1_r = (double)(angle1) * (M_PI / 180.0);
double angle2_r = (double)(angle2) * (M_PI / 180.0);
@@ -517,55 +414,45 @@ static void ami_arc_gfxlib(int x, int y, int radius, int angle1, int angle2)
x1 = (int)(cos(b) * (double)radius);
y1 = (int)(sin(b) * (double)radius);
- Move(glob->rp, x0 + x1, y0 - y1);
+ Move(rp, x0 + x1, y0 - y1);
for(angle = (b + step); angle <= c; angle += step) {
x1 = (int)(cos(angle) * (double)radius);
y1 = (int)(sin(angle) * (double)radius);
- Draw(glob->rp, x0 + x1, y0 - y1);
+ Draw(rp, x0 + x1, y0 - y1);
}
}
-static bool ami_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_arc()");
- #endif
-
- if (angle2 < angle1) angle2 += 360;
-
- ami_plot_setapen(glob->rp, style->fill_colour);
- ami_arc_gfxlib(x, y, radius, angle1, angle2);
-
- return true;
-}
-
-static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitmap)
+/**
+ */
+static nserror
+ami_bitmap(struct gui_globals *glob, int x, int y, int width, int height, struct bitmap *bitmap)
{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_bitmap()");
- #endif
+ NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_bitmap()");
struct BitMap *tbm;
- if(!width || !height) return true;
+ if (!width || !height) {
+ return NSERROR_OK;
+ }
- if(((x + width) < glob->rect.MinX) ||
- ((y + height) < glob->rect.MinY) ||
- (x > glob->rect.MaxX) ||
- (y > glob->rect.MaxY))
- return true;
+ if (((x + width) < glob->rect.MinX) ||
+ ((y + height) < glob->rect.MinY) ||
+ (x > glob->rect.MaxX) ||
+ (y > glob->rect.MaxY)) {
+ return NSERROR_OK;
+ }
- tbm = ami_bitmap_get_native(bitmap, width, height, glob->rp->BitMap);
- if(!tbm) return true;
+ tbm = ami_bitmap_get_native(bitmap, width, height, glob->palette_mapped, glob->rp->BitMap);
+ if (!tbm) {
+ return NSERROR_OK;
+ }
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] ami_bitmap() got native bitmap");
- #endif
+ NSLOG(plot, DEEPDEBUG, "[ami_plotter] ami_bitmap() got native bitmap");
#ifdef __amigaos4__
- if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) && (glob->palette_mapped == false) &&
- (nsoption_bool(direct_render) == false), 1)) {
+ if (__builtin_expect((GfxBase->LibNode.lib_Version >= 53) &&
+ (glob->palette_mapped == false), 1)) {
uint32 comptype = COMPOSITE_Src_Over_Dest;
uint32 compflags = COMPFLAG_IgnoreDestAlpha;
if(amiga_bitmap_get_opaque(bitmap)) {
@@ -585,19 +472,18 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
COMPTAG_OffsetY,y,
COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
TAG_DONE);
- }
- else
+ } else
#endif
{
ULONG tag, tag_data, minterm = 0xc0;
- if(glob->palette_mapped == false) {
+ if (glob->palette_mapped == false) {
tag = BLITA_UseSrcAlpha;
tag_data = !amiga_bitmap_get_opaque(bitmap);
minterm = 0xc0;
} else {
tag = BLITA_MaskPlane;
- if((tag_data = (ULONG)ami_bitmap_get_mask(bitmap, width, height, tbm)))
+ if ((tag_data = (ULONG)ami_bitmap_get_mask(bitmap, width, height, tbm)))
minterm = MINTERM_SRCMASK;
}
#ifdef __amigaos4__
@@ -613,7 +499,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
tag, tag_data,
TAG_DONE);
#else
- if(tag_data) {
+ if (tag_data) {
BltMaskBitMapRastPort(tbm, 0, 0, glob->rp, x, y, width, height, minterm, tag_data);
} else {
BltBitMapRastPort(tbm, 0, 0, glob->rp, x, y, width, height, 0xc0);
@@ -621,118 +507,13 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
#endif
}
- if((ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
+ if ((ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
ami_rtg_freebitmap(tbm);
}
- return true;
+ return NSERROR_OK;
}
-static bool ami_bitmap_tile(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags)
-{
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_bitmap_tile()");
- #endif
-
- int xf,yf,xm,ym,oy,ox;
- struct BitMap *tbm = NULL;
- struct Hook *bfh = NULL;
- struct bfbitmap bfbm;
- bool repeat_x = (flags & BITMAPF_REPEAT_X);
- bool repeat_y = (flags & BITMAPF_REPEAT_Y);
-
- if((width == 0) || (height == 0)) return true;
-
- if(!(repeat_x || repeat_y))
- return ami_bitmap(x, y, width, height, bitmap);
-
- /* If it is a one pixel transparent image, we are wasting our time */
- if((amiga_bitmap_get_opaque(bitmap) == false) &&
- (bitmap_get_width(bitmap) == 1) && (bitmap_get_height(bitmap) == 1))
- return true;
-
- tbm = ami_bitmap_get_native(bitmap,width,height,glob->rp->BitMap);
- if(!tbm) return true;
-
- ox = x;
- oy = y;
-
- /* get left most tile position */
- for (; ox > 0; ox -= width)
- ;
-
- /* get top most tile position */
- for (; oy > 0; oy -= height)
- ;
-
- if(ox<0) ox = -ox;
- if(oy<0) oy = -oy;
-
- if(repeat_x)
- {
- xf = glob->rect.MaxX;
- xm = glob->rect.MinX;
- }
- else
- {
- xf = x + width;
- xm = x;
- }
-
- if(repeat_y)
- {
- yf = glob->rect.MaxY;
- ym = glob->rect.MinY;
- }
- else
- {
- yf = y + height;
- ym = y;
- }
-#ifdef __amigaos4__
- if(amiga_bitmap_get_opaque(bitmap))
- {
- bfh = CreateBackFillHook(BFHA_BitMap,tbm,
- BFHA_Width,width,
- BFHA_Height,height,
- BFHA_OffsetX,ox,
- BFHA_OffsetY,oy,
- TAG_DONE);
- }
- else
-#endif
- {
- bfbm.bm = tbm;
- bfbm.width = width;
- bfbm.height = height;
- bfbm.offsetx = ox;
- bfbm.offsety = oy;
- bfbm.mask = ami_bitmap_get_mask(bitmap, width, height, tbm);
- bfh = calloc(1, sizeof(struct Hook));
- bfh->h_Entry = (HOOKFUNC)ami_bitmap_tile_hook;
- bfh->h_SubEntry = 0;
- bfh->h_Data = &bfbm;
- }
-
- InstallLayerHook(glob->rp->Layer,bfh);
- EraseRect(glob->rp,xm,ym,xf,yf);
- InstallLayerHook(glob->rp->Layer,LAYERS_NOBACKFILL);
-
-#ifdef __amigaos4__
- if(amiga_bitmap_get_opaque(bitmap)) DeleteBackFillHook(bfh);
- else
-#endif
- free(bfh);
-
- if((ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
- /**\todo is this logic logical? */
- ami_rtg_freebitmap(tbm);
- }
-
- return true;
-}
HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage *)
{
@@ -744,7 +525,7 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage
for (yf = -bfbm->offsety; yf < msg->Bounds.MaxY; yf += bfbm->height) {
#ifdef __amigaos4__
if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) &&
- (glob->palette_mapped == false), 1)) {
+ (bfbm->palette_mapped == false), 1)) {
CompositeTags(COMPOSITE_Src_Over_Dest, bfbm->bm, rp->BitMap,
COMPTAG_Flags, COMPFLAG_IgnoreDestAlpha,
COMPTAG_DestX, msg->Bounds.MinX,
@@ -757,13 +538,12 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage
COMPTAG_OffsetY, yf,
COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
TAG_DONE);
- }
- else
+ } else
#endif
{
ULONG tag, tag_data, minterm = 0xc0;
- if(glob->palette_mapped == false) {
+ if(bfbm->palette_mapped == false) {
tag = BLITA_UseSrcAlpha;
tag_data = TRUE;
minterm = 0xc0;
@@ -805,42 +585,336 @@ static void ami_bezier(struct bez_point *restrict a, struct bez_point *restrict
p->y = pow((1 - t), 3) * a->y + 3 * t * pow((1 -t), 2) * b->y + 3 * (1-t) * pow(t, 2)* c->y + pow (t, 3)* d->y;
}
-static bool ami_path(const float *p, unsigned int n, colour fill, float width,
- colour c, const float transform[6])
+
+bool ami_plot_screen_is_palettemapped(void)
+{
+ /* This may not be entirely correct - previously we returned the state of the current BitMap */
+ return palette_mapped;
+}
+
+
+/**
+ * \brief Sets a clip rectangle for subsequent plot operations.
+ *
+ * \param ctx The current redraw context.
+ * \param clip The rectangle to limit all subsequent plot
+ * operations within.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ami_clip(const struct redraw_context *ctx, const struct rect *clip)
+{
+ struct gui_globals *glob = (struct gui_globals *)ctx->priv;
+ struct Region *reg = NULL;
+
+ NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_clip()");
+
+ if (glob->rp->Layer) {
+ reg = NewRegion();
+
+ glob->rect.MinX = clip->x0;
+ glob->rect.MinY = clip->y0;
+ glob->rect.MaxX = clip->x1-1;
+ glob->rect.MaxY = clip->y1-1;
+
+ OrRectRegion(reg,&glob->rect);
+
+ reg = InstallClipRegion(glob->rp->Layer,reg);
+
+ if(reg) {
+ DisposeRegion(reg);
+ }
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plots an arc
+ *
+ * plot an arc segment around (x,y), anticlockwise from angle1
+ * to angle2. Angles are measured anticlockwise from
+ * horizontal, in degrees.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the arc plot.
+ * \param x The x coordinate of the arc.
+ * \param y The y coordinate of the arc.
+ * \param radius The radius of the arc.
+ * \param angle1 The start angle of the arc.
+ * \param angle2 The finish angle of the arc.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ami_arc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius, int angle1, int angle2)
+{
+ NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_arc()");
+
+ struct gui_globals *glob = (struct gui_globals *)ctx->priv;
+
+ if (angle2 < angle1) {
+ angle2 += 360;
+ }
+
+ ami_plot_setapen(glob, glob->rp, style->fill_colour);
+ ami_arc_gfxlib(glob->rp, x, y, radius, angle1, angle2);
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plots a circle
+ *
+ * Plot a circle centered on (x,y), which is optionally filled.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the circle plot.
+ * \param x x coordinate of circle centre.
+ * \param y y coordinate of circle centre.
+ * \param radius circle radius.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ami_disc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius)
+{
+ NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_disc()");
+
+ struct gui_globals *glob = (struct gui_globals *)ctx->priv;
+
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+ ami_plot_setapen(glob, glob->rp, style->fill_colour);
+ AreaCircle(glob->rp,x,y,radius);
+ AreaEnd(glob->rp);
+ }
+
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ ami_plot_setapen(glob, glob->rp, style->stroke_colour);
+ DrawEllipse(glob->rp,x,y,radius,radius);
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plots a line
+ *
+ * plot a line from (x0,y0) to (x1,y1). Coordinates are at
+ * centre of line width/thickness.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the line plot.
+ * \param line A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ami_line(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *line)
+{
+ NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_line()");
+
+ struct gui_globals *glob = (struct gui_globals *)ctx->priv;
+
+ glob->rp->PenWidth = plot_style_fixed_to_int(style->stroke_width);
+ glob->rp->PenHeight = plot_style_fixed_to_int(style->stroke_width);
+
+ switch (style->stroke_type) {
+ case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ default:
+ glob->rp->LinePtrn = PATT_LINE;
+ break;
+
+ case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ glob->rp->LinePtrn = PATT_DOT;
+ break;
+
+ case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ glob->rp->LinePtrn = PATT_DASH;
+ break;
+ }
+
+ ami_plot_setapen(glob, glob->rp, style->stroke_colour);
+ Move(glob->rp, line->x0, line->y0);
+ Draw(glob->rp, line->x1, line->y1);
+
+ glob->rp->PenWidth = 1;
+ glob->rp->PenHeight = 1;
+ glob->rp->LinePtrn = PATT_LINE;
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plots a rectangle.
+ *
+ * The rectangle can be filled an outline or both controlled
+ * by the plot style The line can be solid, dotted or
+ * dashed. Top left corner at (x0,y0) and rectangle has given
+ * width and height.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the rectangle plot.
+ * \param rect A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ami_rectangle(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *rect)
+{
+ NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_rectangle()");
+
+ struct gui_globals *glob = (struct gui_globals *)ctx->priv;
+
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+ ami_plot_setapen(glob, glob->rp, style->fill_colour);
+ RectFill(glob->rp, rect->x0, rect->y0, rect->x1- 1 , rect->y1 - 1);
+ }
+
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ glob->rp->PenWidth = plot_style_fixed_to_int(style->stroke_width);
+ glob->rp->PenHeight = plot_style_fixed_to_int(style->stroke_width);
+
+ switch (style->stroke_type) {
+ case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ default:
+ glob->rp->LinePtrn = PATT_LINE;
+ break;
+
+ case PLOT_OP_TYPE_DOT: /**< Dotted plot */
+ glob->rp->LinePtrn = PATT_DOT;
+ break;
+
+ case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ glob->rp->LinePtrn = PATT_DASH;
+ break;
+ }
+
+ ami_plot_setapen(glob, glob->rp, style->stroke_colour);
+ Move(glob->rp, rect->x0, rect->y0);
+ Draw(glob->rp, rect->x1, rect->y0);
+ Draw(glob->rp, rect->x1, rect->y1);
+ Draw(glob->rp, rect->x0, rect->y1);
+ Draw(glob->rp, rect->x0, rect->y0);
+
+ glob->rp->PenWidth = 1;
+ glob->rp->PenHeight = 1;
+ glob->rp->LinePtrn = PATT_LINE;
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plot a polygon
+ *
+ * Plots a filled polygon with straight lines between
+ * points. The lines around the edge of the ploygon are not
+ * plotted. The polygon is filled with the non-zero winding
+ * rule.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the polygon plot.
+ * \param p verticies of polygon
+ * \param n number of verticies.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ami_polygon(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const int *p,
+ unsigned int n)
+{
+ NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_polygon()");
+
+ struct gui_globals *glob = (struct gui_globals *)ctx->priv;
+
+ ami_plot_setapen(glob, glob->rp, style->fill_colour);
+
+ if (AreaMove(glob->rp,p[0],p[1]) == -1) {
+ NSLOG(netsurf, INFO, "AreaMove: vector list full");
+ }
+
+ for (uint32 k = 1; k < n; k++) {
+ if (AreaDraw(glob->rp,p[k*2],p[(k*2)+1]) == -1) {
+ NSLOG(netsurf, INFO, "AreaDraw: vector list full");
+ }
+ }
+
+ if (AreaEnd(glob->rp) == -1) {
+ NSLOG(netsurf, INFO, "AreaEnd: error");
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plots a path.
+ *
+ * Path plot consisting of cubic Bezier curves. Line and fill colour is
+ * controlled by the plot style.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the path plot.
+ * \param p elements of path
+ * \param n nunber of elements on path
+ * \param transform A transform to apply to the path.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ami_path(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const float *p,
+ unsigned int n,
+ const float transform[6])
{
unsigned int i;
struct bez_point start_p = {0, 0}, cur_p = {0, 0}, p_a, p_b, p_c, p_r;
-
- #ifdef AMI_PLOTTER_DEBUG
- LOG("[ami_plotter] Entered ami_path()");
- #endif
- if (n == 0)
- return true;
+ NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_path()");
+
+ struct gui_globals *glob = (struct gui_globals *)ctx->priv;
+
+ if (n == 0) {
+ return NSERROR_OK;
+ }
if (p[0] != PLOTTER_PATH_MOVE) {
- LOG("Path does not start with move");
- return false;
+ NSLOG(netsurf, INFO, "Path does not start with move");
+ return NSERROR_INVALID;
}
- if (fill != NS_TRANSPARENT) {
- ami_plot_setapen(glob->rp, fill);
- if (c != NS_TRANSPARENT)
- ami_plot_setopen(glob->rp, c);
+ if (pstyle->fill_colour != NS_TRANSPARENT) {
+ ami_plot_setapen(glob, glob->rp, pstyle->fill_colour);
+ if (pstyle->stroke_colour != NS_TRANSPARENT) {
+ ami_plot_setopen(glob, glob->rp, pstyle->stroke_colour);
+ }
} else {
- if (c != NS_TRANSPARENT) {
- ami_plot_setapen(glob->rp, c);
+ if (pstyle->stroke_colour != NS_TRANSPARENT) {
+ ami_plot_setapen(glob, glob->rp, pstyle->stroke_colour);
} else {
- return true; /* wholly transparent */
+ return NSERROR_OK; /* wholly transparent */
}
}
/* Construct path */
for (i = 0; i < n; ) {
if (p[i] == PLOTTER_PATH_MOVE) {
- if (fill != NS_TRANSPARENT) {
- if(AreaMove(glob->rp, p[i+1], p[i+2]) == -1)
- LOG("AreaMove: vector list full");
+ if (pstyle->fill_colour != NS_TRANSPARENT) {
+ if (AreaMove(glob->rp, p[i+1], p[i+2]) == -1) {
+ NSLOG(netsurf, INFO,
+ "AreaMove: vector list full");
+ }
} else {
Move(glob->rp, p[i+1], p[i+2]);
}
@@ -851,17 +925,20 @@ static bool ami_path(const float *p, unsigned int n, colour fill, float width,
cur_p.y = start_p.y;
i += 3;
} else if (p[i] == PLOTTER_PATH_CLOSE) {
- if (fill != NS_TRANSPARENT) {
- if(AreaEnd(glob->rp) == -1)
- LOG("AreaEnd: error");
+ if (pstyle->fill_colour != NS_TRANSPARENT) {
+ if (AreaEnd(glob->rp) == -1) {
+ NSLOG(netsurf, INFO, "AreaEnd: error");
+ }
} else {
Draw(glob->rp, start_p.x, start_p.y);
}
i++;
} else if (p[i] == PLOTTER_PATH_LINE) {
- if (fill != NS_TRANSPARENT) {
- if(AreaDraw(glob->rp, p[i+1], p[i+2]) == -1)
- LOG("AreaDraw: vector list full");
+ if (pstyle->fill_colour != NS_TRANSPARENT) {
+ if (AreaDraw(glob->rp, p[i+1], p[i+2]) == -1) {
+ NSLOG(netsurf, INFO,
+ "AreaDraw: vector list full");
+ }
} else {
Draw(glob->rp, p[i+1], p[i+2]);
}
@@ -876,11 +953,13 @@ static bool ami_path(const float *p, unsigned int n, colour fill, float width,
p_c.x = p[i+5];
p_c.y = p[i+6];
- for(double t = 0.0; t <= 1.0; t += 0.1) {
+ for (double t = 0.0; t <= 1.0; t += 0.1) {
ami_bezier(&cur_p, &p_a, &p_b, &p_c, t, &p_r);
- if (fill != NS_TRANSPARENT) {
- if(AreaDraw(glob->rp, p_r.x, p_r.y) == -1)
- LOG("AreaDraw: vector list full");
+ if (pstyle->fill_colour != NS_TRANSPARENT) {
+ if (AreaDraw(glob->rp, p_r.x, p_r.y) == -1) {
+ NSLOG(netsurf, INFO,
+ "AreaDraw: vector list full");
+ }
} else {
Draw(glob->rp, p_r.x, p_r.y);
}
@@ -889,27 +968,194 @@ static bool ami_path(const float *p, unsigned int n, colour fill, float width,
cur_p.y = p_c.y;
i += 7;
} else {
- LOG("bad path command %f", p[i]);
+ NSLOG(netsurf, INFO, "bad path command %f", p[i]);
/* End path for safety if using Area commands */
- if (fill != NS_TRANSPARENT) {
+ if (pstyle->fill_colour != NS_TRANSPARENT) {
AreaEnd(glob->rp);
BNDRYOFF(glob->rp);
}
- return false;
+ return NSERROR_INVALID;
}
}
- if (fill != NS_TRANSPARENT)
+ if (pstyle->fill_colour != NS_TRANSPARENT) {
BNDRYOFF(glob->rp);
+ }
- return true;
+ return NSERROR_OK;
}
-bool ami_plot_screen_is_palettemapped(void)
+
+/**
+ * Plot a bitmap
+ *
+ * Tiled plot of a bitmap image. (x,y) gives the top left
+ * coordinate of an explicitly placed tile. From this tile the
+ * image can repeat in all four directions -- up, down, left
+ * and right -- to the extents given by the current clip
+ * rectangle.
+ *
+ * The bitmap_flags say whether to tile in the x and y
+ * directions. If not tiling in x or y directions, the single
+ * image is plotted. The width and height give the dimensions
+ * the image is to be scaled to.
+ *
+ * \param ctx The current redraw context.
+ * \param bitmap The bitmap to plot
+ * \param x The x coordinate to plot the bitmap
+ * \param y The y coordiante to plot the bitmap
+ * \param width The width of area to plot the bitmap into
+ * \param height The height of area to plot the bitmap into
+ * \param bg the background colour to alpha blend into
+ * \param flags the flags controlling the type of plot operation
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ami_bitmap_tile(const struct redraw_context *ctx,
+ struct bitmap *bitmap,
+ int x, int y,
+ int width,
+ int height,
+ colour bg,
+ bitmap_flags_t flags)
+{
+ int xf,yf,xm,ym,oy,ox;
+ struct BitMap *tbm = NULL;
+ struct Hook *bfh = NULL;
+ struct bfbitmap bfbm;
+ bool repeat_x = (flags & BITMAPF_REPEAT_X);
+ bool repeat_y = (flags & BITMAPF_REPEAT_Y);
+
+ NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_bitmap_tile()");
+
+ struct gui_globals *glob = (struct gui_globals *)ctx->priv;
+
+ if ((width == 0) || (height == 0)) {
+ return NSERROR_OK;
+ }
+
+ if (!(repeat_x || repeat_y)) {
+ return ami_bitmap(glob, x, y, width, height, bitmap);
+ }
+
+ /* If it is a one pixel transparent image, we are wasting our time */
+ if ((amiga_bitmap_get_opaque(bitmap) == false) &&
+ (bitmap_get_width(bitmap) == 1) &&
+ (bitmap_get_height(bitmap) == 1)) {
+ return NSERROR_OK;
+ }
+
+ tbm = ami_bitmap_get_native(bitmap, width, height, glob->palette_mapped, glob->rp->BitMap);
+ if (!tbm) {
+ return NSERROR_OK;
+ }
+
+ ox = x;
+ oy = y;
+
+ /* get left most tile position */
+ for (; ox > 0; ox -= width)
+
+ /* get top most tile position */
+ for (; oy > 0; oy -= height);
+
+ if (ox < 0) {
+ ox = -ox;
+ }
+ if (oy < 0) {
+ oy = -oy;
+ }
+ if (repeat_x) {
+ xf = glob->rect.MaxX;
+ xm = glob->rect.MinX;
+ } else {
+ xf = x + width;
+ xm = x;
+ }
+
+ if (repeat_y) {
+ yf = glob->rect.MaxY;
+ ym = glob->rect.MinY;
+ } else {
+ yf = y + height;
+ ym = y;
+ }
+#ifdef __amigaos4__
+ if(amiga_bitmap_get_opaque(bitmap)) {
+ bfh = CreateBackFillHook(BFHA_BitMap,tbm,
+ BFHA_Width,width,
+ BFHA_Height,height,
+ BFHA_OffsetX,ox,
+ BFHA_OffsetY,oy,
+ TAG_DONE);
+ } else
+#endif
+ {
+ bfbm.bm = tbm;
+ bfbm.width = width;
+ bfbm.height = height;
+ bfbm.offsetx = ox;
+ bfbm.offsety = oy;
+ bfbm.mask = ami_bitmap_get_mask(bitmap, width, height, tbm);
+ bfbm.palette_mapped = glob->palette_mapped;
+ bfh = calloc(1, sizeof(struct Hook));
+ bfh->h_Entry = (HOOKFUNC)ami_bitmap_tile_hook;
+ bfh->h_SubEntry = 0;
+ bfh->h_Data = &bfbm;
+ }
+
+ InstallLayerHook(glob->rp->Layer,bfh);
+ EraseRect(glob->rp,xm,ym,xf,yf);
+ InstallLayerHook(glob->rp->Layer,LAYERS_NOBACKFILL);
+
+#ifdef __amigaos4__
+ if (amiga_bitmap_get_opaque(bitmap)) {
+ DeleteBackFillHook(bfh);
+ } else
+#endif
+ free(bfh);
+
+ if ((ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
+ /**\todo is this logic logical? */
+ ami_rtg_freebitmap(tbm);
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Text plotting.
+ *
+ * \param ctx The current redraw context.
+ * \param fstyle plot style for this text
+ * \param x x coordinate
+ * \param y y coordinate
+ * \param text UTF-8 string to plot
+ * \param length length of string, in bytes
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ami_text(const struct redraw_context *ctx,
+ const struct plot_font_style *fstyle,
+ int x,
+ int y,
+ const char *text,
+ size_t length)
{
- return glob->palette_mapped;
+ NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_text()");
+
+ struct gui_globals *glob = (struct gui_globals *)ctx->priv;
+
+ if (__builtin_expect(ami_nsfont == NULL, 0)) {
+ return NSERROR_OK;
+ }
+ ami_plot_setapen(glob, glob->rp, fstyle->foreground);
+ ami_nsfont->text(glob->rp, text, length, fstyle, x, y, nsoption_bool(font_antialiasing));
+
+ return NSERROR_OK;
}
-struct plotter_table plot;
+
const struct plotter_table amiplot = {
.rectangle = ami_rectangle,
.line = ami_line,
diff --git a/frontends/amiga/plotters.h b/frontends/amiga/plotters.h
index 7cb994f9d..94259234b 100644
--- a/frontends/amiga/plotters.h
+++ b/frontends/amiga/plotters.h
@@ -20,38 +20,64 @@
#define AMIGA_PLOTTERS_H
#include "netsurf/plotters.h"
-#include <proto/layers.h>
-#include <proto/graphics.h>
struct IBox;
-
-struct gui_globals
-{
- struct BitMap *bm;
- struct RastPort *rp;
- struct Layer_Info *layerinfo;
- APTR areabuf;
- APTR tmprasbuf;
- struct Rectangle rect;
- struct MinList *shared_pens;
- bool palette_mapped;
- ULONG apen;
- ULONG open;
- LONG apen_num;
- LONG open_num;
- int width; /* size of bm and */
- int height; /* associated memory */
-};
+struct gui_globals;
extern const struct plotter_table amiplot;
-extern struct gui_globals *glob;
-
-void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool force32bit);
-void ami_free_layers(struct gui_globals *gg);
void ami_clearclipreg(struct gui_globals *gg);
void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox);
void ami_plot_release_pens(struct MinList *shared_pens);
bool ami_plot_screen_is_palettemapped(void);
+/* Plotter render area management */
+
+/**
+ * Alloc a plotter render area
+ * \param width of render bitmap
+ * \param height of render bitmap
+ * \param force32bit allocate a 32-bit bitmap even if this does not match the screen
+ * \param alloc_pen_list set to false to use own pen list (eg. if multiple pen lists will be required)
+ * \returns pointer to render area
+ */
+struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit, bool alloc_pen_list);
+
+/**
+ * Free a plotter render area
+ * \param gg render area to free
+ */
+void ami_plot_ra_free(struct gui_globals *gg);
+
+/**
+ * Get RastPort associated with a render area
+ * \param gg render area
+ * \returns pointer to render area BitMap
+ */
+struct RastPort *ami_plot_ra_get_rastport(struct gui_globals *gg);
+
+/**
+ * Get a drawing BitMap associated with a render area
+ * \param gg render area
+ * \returns pointer to render area BitMap
+ */
+struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg);
+
+/**
+ * Get size of BitMap associated with a render area
+ * \param gg render area
+ * \param width updated to BitMap width
+ * \param height updated to BitMap height
+ */
+void ami_plot_ra_get_size(struct gui_globals *gg, int *width, int *height);
+
+/**
+ * Set a list of shared pens for a render area to use
+ * Only relevant for palette-mapped screens
+ * \param gg render area
+ * \param pen_list allocated by ami_AllocMinList()
+ */
+void ami_plot_ra_set_pen_list(struct gui_globals *gg, struct MinList *pen_list);
+
#endif
+
diff --git a/frontends/amiga/plugin_hack.c b/frontends/amiga/plugin_hack.c
index 7fe78b9b0..5d7ec19c1 100644
--- a/frontends/amiga/plugin_hack.c
+++ b/frontends/amiga/plugin_hack.c
@@ -82,7 +82,8 @@ nserror amiga_plugin_hack_init(void)
if(node)
{
- LOG("plugin_hack registered %s", lwc_string_data(type));
+ NSLOG(netsurf, INFO, "plugin_hack registered %s",
+ lwc_string_data(type));
error = content_factory_register_handler(
lwc_string_data(type),
@@ -123,7 +124,7 @@ nserror amiga_plugin_hack_create(const content_handler *handler,
bool amiga_plugin_hack_convert(struct content *c)
{
- LOG("amiga_plugin_hack_convert");
+ NSLOG(netsurf, INFO, "amiga_plugin_hack_convert");
content_set_ready(c);
content_set_done(c);
@@ -137,7 +138,7 @@ void amiga_plugin_hack_destroy(struct content *c)
{
amiga_plugin_hack_content *plugin = (amiga_plugin_hack_content *) c;
- LOG("amiga_plugin_hack_destroy %p", plugin);
+ NSLOG(netsurf, INFO, "amiga_plugin_hack_destroy %p", plugin);
return;
}
@@ -150,18 +151,29 @@ bool amiga_plugin_hack_redraw(struct content *c,
.fill_type = PLOT_OP_TYPE_SOLID,
.fill_colour = 0xffffff,
.stroke_colour = 0x000000,
- .stroke_width = 1,
+ .stroke_width = plot_style_int_to_fixed(1),
};
+ struct rect rect;
+ nserror res;
- LOG("amiga_plugin_hack_redraw");
+ NSLOG(netsurf, INFO, "amiga_plugin_hack_redraw");
- ctx->plot->rectangle(data->x, data->y, data->x + data->width,
- data->y + data->height, &pstyle);
+ rect.x0 = data->x;
+ rect.y0 = data->y;
+ rect.x1 = data->x + data->width;
+ rect.y1 = data->y + data->height;
- return ctx->plot->text(data->x, data->y+20,
- lwc_string_data(content__get_mime_type(c)),
- lwc_string_length(content__get_mime_type(c)),
- plot_style_font);
+ ctx->plot->rectangle(ctx, &pstyle, &rect);
+
+ res = ctx->plot->text(ctx,
+ plot_style_font,
+ data->x, data->y+20,
+ lwc_string_data(content__get_mime_type(c)),
+ lwc_string_length(content__get_mime_type(c)));
+ if (res != NSERROR_OK) {
+ return false;
+ }
+ return true;
}
/**
@@ -176,7 +188,8 @@ bool amiga_plugin_hack_redraw(struct content *c,
void amiga_plugin_hack_open(struct content *c, struct browser_window *bw,
struct content *page, struct object_params *params)
{
- LOG("amiga_plugin_hack_open %s", nsurl_access(content_get_url(c)));
+ NSLOG(netsurf, INFO, "amiga_plugin_hack_open %s",
+ nsurl_access(content_get_url(c)));
if(c)
{
@@ -190,13 +203,13 @@ void amiga_plugin_hack_open(struct content *c, struct browser_window *bw,
void amiga_plugin_hack_close(struct content *c)
{
- LOG("amiga_plugin_hack_close");
+ NSLOG(netsurf, INFO, "amiga_plugin_hack_close");
return;
}
void amiga_plugin_hack_reformat(struct content *c, int width, int height)
{
- LOG("amiga_plugin_hack_reformat");
+ NSLOG(netsurf, INFO, "amiga_plugin_hack_reformat");
c->width = width;
c->height = height;
@@ -209,7 +222,7 @@ nserror amiga_plugin_hack_clone(const struct content *old, struct content **newc
amiga_plugin_hack_content *plugin;
nserror error;
- LOG("amiga_plugin_hack_clone");
+ NSLOG(netsurf, INFO, "amiga_plugin_hack_clone");
plugin = calloc(1, sizeof(amiga_plugin_hack_content));
if (plugin == NULL)
@@ -256,7 +269,7 @@ void amiga_plugin_hack_execute(struct hlcache_handle *c)
if(full_cmd)
{
#ifdef __amigaos4__
- LOG("Attempting to execute %s", full_cmd);
+ NSLOG(netsurf, INFO, "Attempting to execute %s", full_cmd);
in = Open("NIL:", MODE_OLDFILE);
out = Open("NIL:", MODE_NEWFILE);
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 5fab0f968..8c8565478 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -436,6 +436,7 @@ void ami_print(struct hlcache_handle *c, int copies)
ami_print_info.ps->page_width = ami_print_info.PED->ped_MaxXDots;
ami_print_info.ps->page_height = ami_print_info.PED->ped_MaxYDots;
ami_print_info.ps->scale = scale;
+ ami_print_info.ps->priv = ami_print_info.gg;
if(!print_set_up(c, &amiprinter, ami_print_info.ps, &height))
{
@@ -459,10 +460,8 @@ bool ami_print_cont(void)
if(ami_print_info.page <= ami_print_info.pages)
{
- glob = ami_print_info.gg;
print_draw_next_page(&amiprinter, ami_print_info.ps);
ami_print_dump();
- ami_gui_set_default_gg();
ret = true;
}
else
@@ -496,13 +495,10 @@ struct MsgPort *ami_print_get_msgport(void)
bool ami_print_begin(struct print_settings *ps)
{
- ami_print_info.gg = calloc(1, sizeof(struct gui_globals));
- if(!ami_print_info.gg) return false;
-
- ami_init_layers(ami_print_info.gg,
- ami_print_info.PED->ped_MaxXDots,
+ ami_print_info.gg = ami_plot_ra_alloc(ami_print_info.PED->ped_MaxXDots,
ami_print_info.PED->ped_MaxYDots,
- true);
+ true, false);
+ if(!ami_print_info.gg) return false;
ami_print_info.page = 0;
@@ -522,10 +518,8 @@ bool ami_print_next_page(void)
void ami_print_end(void)
{
- ami_free_layers(ami_print_info.gg);
- free(ami_print_info.gg);
+ ami_plot_ra_free(ami_print_info.gg);
DisposeObject(ami_print_info.objects[OID_MAIN]);
- ami_gui_set_default_gg();
ami_print_close_device();
ami_print_free();
@@ -542,7 +536,7 @@ bool ami_print_dump(void)
ami_print_info.PReq->io_Command = PRD_DUMPRPORT;
ami_print_info.PReq->io_Flags = 0;
ami_print_info.PReq->io_Error = 0;
- ami_print_info.PReq->io_RastPort = ami_print_info.gg->rp;
+ ami_print_info.PReq->io_RastPort = ami_plot_ra_get_rastport(ami_print_info.gg);
ami_print_info.PReq->io_ColorMap = NULL;
ami_print_info.PReq->io_Modes = 0;
ami_print_info.PReq->io_SrcX = 0;
diff --git a/frontends/amiga/resources/AdBlock.css b/frontends/amiga/resources/AdBlock.css
index e3811f62b..0d12aaa7c 120000
--- a/frontends/amiga/resources/AdBlock.css
+++ b/frontends/amiga/resources/AdBlock.css
@@ -1 +1 @@
-../../!NetSurf/Resources/AdBlock,f79 \ No newline at end of file
+../../../resources/adblock.css \ No newline at end of file
diff --git a/frontends/amiga/resources/ca-bundle b/frontends/amiga/resources/ca-bundle
index ad2dd6b55..1187fa51a 120000
--- a/frontends/amiga/resources/ca-bundle
+++ b/frontends/amiga/resources/ca-bundle
@@ -1 +1 @@
-../../!NetSurf/Resources/ca-bundle \ No newline at end of file
+../../../resources/ca-bundle \ No newline at end of file
diff --git a/frontends/amiga/resources/de b/frontends/amiga/resources/de
deleted file mode 120000
index 38128816c..000000000
--- a/frontends/amiga/resources/de
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/de \ No newline at end of file
diff --git a/frontends/amiga/resources/en b/frontends/amiga/resources/en
deleted file mode 120000
index d1dfaa9d2..000000000
--- a/frontends/amiga/resources/en
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/en \ No newline at end of file
diff --git a/frontends/amiga/resources/fr b/frontends/amiga/resources/fr
deleted file mode 120000
index df1cbe3a1..000000000
--- a/frontends/amiga/resources/fr
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/fr \ No newline at end of file
diff --git a/frontends/amiga/resources/it b/frontends/amiga/resources/it
deleted file mode 120000
index 6177e9176..000000000
--- a/frontends/amiga/resources/it
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/it \ No newline at end of file
diff --git a/frontends/amiga/resources/nl b/frontends/amiga/resources/nl
deleted file mode 120000
index a07bd0469..000000000
--- a/frontends/amiga/resources/nl
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/nl \ No newline at end of file
diff --git a/frontends/amiga/resources/nsdefault.css b/frontends/amiga/resources/nsdefault.css
index 6d2d4da5b..fa3ae6c26 120000
--- a/frontends/amiga/resources/nsdefault.css
+++ b/frontends/amiga/resources/nsdefault.css
@@ -1 +1 @@
-../../!NetSurf/Resources/CSS,f79 \ No newline at end of file
+../../../resources/default.css \ No newline at end of file
diff --git a/frontends/amiga/resources/quirks.css b/frontends/amiga/resources/quirks.css
index d9fb80334..1e752cb9e 120000
--- a/frontends/amiga/resources/quirks.css
+++ b/frontends/amiga/resources/quirks.css
@@ -1 +1 @@
-../../!NetSurf/Resources/Quirks,f79 \ No newline at end of file
+../../../resources/quirks.css \ No newline at end of file
diff --git a/frontends/amiga/schedule.c b/frontends/amiga/schedule.c
index bfafe9c88..043edc7fe 100644
--- a/frontends/amiga/schedule.c
+++ b/frontends/amiga/schedule.c
@@ -218,22 +218,25 @@ static void ami_schedule_dump(void)
GetSysTime(&tv);
Amiga2Date(tv.Seconds, &clockdata);
- LOG("Current time = %d-%d-%d %d:%d:%d.%d", clockdata.mday, clockdata.month, clockdata.year,
- clockdata.hour, clockdata.min, clockdata.sec, tv.Microseconds);
- LOG("Events remaining in queue:");
+ NSLOG(netsurf, INFO, "Current time = %d-%d-%d %d:%d:%d.%d",
+ clockdata.mday, clockdata.month, clockdata.year,
+ clockdata.hour, clockdata.min, clockdata.sec, tv.Microseconds);
+ NSLOG(netsurf, INFO, "Events remaining in queue:");
iterator = pblHeapIterator(schedule_list);
while ((nscb = pblIteratorNext(iterator)) != -1)
{
Amiga2Date(nscb->tv.Seconds, &clockdata);
- LOG("nscb: %p, at %d-%d-%d %d:%d:%d.%d, callback: %p, %p",
- nscb, clockdata.mday, clockdata.month, clockdata.year, clockdata.hour, clockdata.min, clockdata.sec,
- nscb->tv.Microseconds, nscb->callback, nscb->p);
+ NSLOG(netsurf, INFO,
+ "nscb: %p, at %d-%d-%d %d:%d:%d.%d, callback: %p, %p",
+ nscb, clockdata.mday, clockdata.month, clockdata.year,
+ clockdata.hour, clockdata.min, clockdata.sec,
+ nscb->tv.Microseconds, nscb->callback, nscb->p);
if(CheckIO((struct IORequest *)nscb) == NULL) {
- LOG("-> ACTIVE");
+ NSLOG(netsurf, INFO, "-> ACTIVE");
} else {
- LOG("-> COMPLETE");
+ NSLOG(netsurf, INFO, "-> COMPLETE");
}
};
diff --git a/frontends/amiga/selectmenu.c b/frontends/amiga/selectmenu.c
index f3a11b67a..8a8614136 100644
--- a/frontends/amiga/selectmenu.c
+++ b/frontends/amiga/selectmenu.c
@@ -58,7 +58,8 @@ BOOL ami_selectmenu_is_safe(void)
BOOL popupmenu_lib_ok = FALSE;
if((PopupMenuBase = OpenLibrary("popupmenu.library", 53))) {
- LOG("popupmenu.library v%d.%d", PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision);
+ NSLOG(netsurf, INFO, "popupmenu.library v%d.%d",
+ PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision);
if(LIB_IS_AT_LEAST((struct Library *)PopupMenuBase, 53, 11))
popupmenu_lib_ok = TRUE;
CloseLibrary(PopupMenuBase);
diff --git a/frontends/amiga/sslcert.c b/frontends/amiga/sslcert.c
index 5929f7e89..136b918fc 100644
--- a/frontends/amiga/sslcert.c
+++ b/frontends/amiga/sslcert.c
@@ -172,7 +172,7 @@ ami_crtvrfy_mouse(struct ami_corewindow *ami_cw,
/**
* callback for keypress for certificate verify on core window
*
- * \param example_cw The Amiga core window structure.
+ * \param ami_cw The Amiga core window structure.
* \param nskey The netsurf key code
* \return NSERROR_OK on success otherwise apropriate error code
*/
@@ -194,6 +194,8 @@ ami_crtvrfy_key(struct ami_corewindow *ami_cw, uint32_t nskey)
* callback on draw event for certificate verify on core window
*
* \param ami_cw The Amiga core window structure.
+ * \param x the x coordinate to draw
+ * \param y the y coordinate to draw
* \param r The rectangle of the window that needs updating.
* \param ctx The drawing context
* \return NSERROR_OK on success otherwise apropriate error code
@@ -315,7 +317,7 @@ nserror ami_cert_verify(struct nsurl *url,
res = ami_crtvrfy_create_window(ncwin);
if (res != NSERROR_OK) {
- LOG("SSL UI builder init failed");
+ NSLOG(netsurf, INFO, "SSL UI builder init failed");
ami_utf8_free(ncwin->core.wintitle);
ami_utf8_free(ncwin->sslerr);
ami_utf8_free(ncwin->sslaccept);
diff --git a/frontends/amiga/stringview/stringview.c b/frontends/amiga/stringview/stringview.c
index e875f3b5a..245782b43 100755
--- a/frontends/amiga/stringview/stringview.c
+++ b/frontends/amiga/stringview/stringview.c
@@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef __amigaos4__
/// Include
#include <proto/dos.h>
@@ -32,7 +33,6 @@
#include <gadgets/layout.h>
#include <gadgets/listbrowser.h>
-#include "amiga/os3support.h"
#include "amiga/libs.h"
#include "stringview.h"
@@ -867,4 +867,5 @@ void FreeStringClass(Class *cl)
///
/* The End */
+#endif //__amigaos4__
diff --git a/frontends/amiga/stringview/stringview.h b/frontends/amiga/stringview/stringview.h
index f989b2a0f..776705f0f 100755
--- a/frontends/amiga/stringview/stringview.h
+++ b/frontends/amiga/stringview/stringview.h
@@ -17,7 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "amiga/os3support.h"
+#ifndef AMIGA_STRINGVIEW_H
+#define AMIGA_STRINGVIEW_H 1
#include <exec/semaphores.h>
#include <intuition/classes.h>
@@ -58,3 +59,5 @@ void FreeStringClass(Class *);
#ifdef __cplusplus
}
#endif
+#endif
+
diff --git a/frontends/amiga/stringview/urlhistory.c b/frontends/amiga/stringview/urlhistory.c
index 7405fbb57..c1e37ea7e 100644
--- a/frontends/amiga/stringview/urlhistory.c
+++ b/frontends/amiga/stringview/urlhistory.c
@@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef __amigaos4__
#include <stdio.h>
#include <ctype.h>
#include <string.h>
@@ -123,3 +124,5 @@ void URLHistory_AddPage( const char * urlString )
urldb_iterate_partial(urlString, URLHistoryFound);
}
}
+#endif //__amigaos4__
+
diff --git a/frontends/amiga/stringview/urlhistory.h b/frontends/amiga/stringview/urlhistory.h
index b72792db4..962713e9e 100644
--- a/frontends/amiga/stringview/urlhistory.h
+++ b/frontends/amiga/stringview/urlhistory.h
@@ -17,6 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifndef AMIGA_URLHISTORY_H
+#define AMIGA_URLHISTORY_H 1
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -31,3 +34,5 @@ void URLHistory_AddPage( const char * urlString );
#ifdef __cplusplus
}
#endif
+#endif
+
diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c
index 496fc5470..63982c879 100644
--- a/frontends/amiga/theme.c
+++ b/frontends/amiga/theme.c
@@ -47,13 +47,15 @@
#include "amiga/gui.h"
#include "amiga/drag.h"
#include "amiga/bitmap.h"
+#include "amiga/plotters.h"
#include "amiga/schedule.h"
#include "amiga/theme.h"
#include "amiga/misc.h"
static struct BitMap *throbber = NULL;
static struct bitmap *throbber_nsbm = NULL;
-static int throbber_frames, throbber_update_interval;
+static int throbber_frames = 1;
+static int throbber_update_interval;
static Object *mouseptrobj[AMI_LASTPOINTER+1];
static struct BitMap *mouseptrbm[AMI_LASTPOINTER+1];
@@ -175,11 +177,13 @@ void ami_theme_throbber_setup(void)
ami_get_theme_filename(throbberfile,"theme_throbber",false);
throbber_frames=atoi(messages_get("theme_throbber_frames"));
+ if(throbber_frames == 0) throbber_frames = 1;
throbber_update_interval = atoi(messages_get("theme_throbber_delay"));
if(throbber_update_interval == 0) throbber_update_interval = 250;
bm = ami_bitmap_from_datatype(throbberfile);
- throbber = ami_bitmap_get_native(bm, bitmap_get_width(bm), bitmap_get_height(bm), NULL);
+ throbber = ami_bitmap_get_native(bm, bitmap_get_width(bm), bitmap_get_height(bm),
+ ami_plot_screen_is_palettemapped(), NULL);
throbber_nsbm = bm;
}
diff --git a/frontends/amiga/version.c b/frontends/amiga/version.c
index c3cd9e2b5..61fbd7176 100644
--- a/frontends/amiga/version.c
+++ b/frontends/amiga/version.c
@@ -25,7 +25,7 @@
* problems created by "0" not being a valid AmigaOS revision number.
*/
#define NETSURF_VERSION_MAJOR "3"
-#define NETSURF_VERSION_MINOR_EXTERNAL "7"
+#define NETSURF_VERSION_MINOR_EXTERNAL "8"
#if defined(CI_BUILD)
#define NETSURF_VERSION_MINOR CI_BUILD
#else
diff --git a/frontends/atari/Makefile b/frontends/atari/Makefile
index 7bc441c33..585f0b217 100644
--- a/frontends/atari/Makefile
+++ b/frontends/atari/Makefile
@@ -47,6 +47,7 @@ CFLAGS += -U__STRICT_ANSI__ -std=c99 -Dsmall -Dnsatari \
-D_BSD_SOURCE \
-D_XOPEN_SOURCE=600 \
-D_POSIX_C_SOURCE=200112L \
+ -DNSLOG_LEVEL_0x0010=NSLOG_LEVEL_INFO \
$(shell $(PKG_CONFIG) --cflags openssl ) \
$(shell $(PKG_CONFIG) --cflags libcurl )
@@ -117,8 +118,8 @@ ATARI_FONT_SOURCE_URL := http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-ve
#ATARI_FONT_SOURCE_URL := http://localhost/$(ATARI_FONT_NAME).tar.gz
ATARI_FONT_TMP_DIR := $(DEPROOT)/../
ATARI_FONT_SOURCE_DIR := $(ATARI_FONT_TMP_DIR)$(ATARI_FONT_NAME)/
-ATARI_GENERIC_RESOURCES := de en it ja
-ATARI_RESOURCES := $(addprefix \!NetSurf/Resources/,$(ATARI_GENERIC_RESOURCES))
+ATARI_GENERIC_RESOURCES := de en it ja nl
+ATARI_RESOURCES := $(addprefix resources/,$(ATARI_GENERIC_RESOURCES))
# ----------------------------------------------------------------------------
# Install target
@@ -167,21 +168,21 @@ endif
$(Q)cp $(ATARI_RES_DIR)/netsurf.rsc $(ATARI_TARGET_DIR)res/netsurf.rsc
$(Q)cp $(ATARI_RES_DIR)/languages $(ATARI_TARGET_DIR)res/languages
$(Q)cp $(ATARI_RES_DIR)/icons/toolbar -R $(ATARI_TARGET_DIR)res/icons
- $(Q)cp \!NetSurf/Resources/Icons/* -R $(ATARI_TARGET_DIR)res/icons/
-
- $(Q)cp \!NetSurf/Resources/netsurf.png,b60 $(ATARI_TARGET_DIR)res/netsurf.png
- $(Q)cp \!NetSurf/Resources/AdBlock,f79 $(ATARI_TARGET_DIR)res/adblock.css
- $(Q)cp \!NetSurf/Resources/CSS,f79 $(ATARI_TARGET_DIR)res/default.css
- $(Q)cp \!NetSurf/Resources/Quirks,f79 $(ATARI_TARGET_DIR)res/quirks.css
- $(Q)cp \!NetSurf/Resources/internal.css,f79 $(ATARI_TARGET_DIR)res/internal.css
- $(Q)cp \!NetSurf/Resources/SearchEngines $(ATARI_TARGET_DIR)res/search
- $(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle
- $(Q)cp \!NetSurf/Resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle
- $(Q)$(SPLIT_MESSAGES) -l en -p atari -f messages resources/FatMessages > $(ATARI_TARGET_DIR)res/messages
- $(Q)cp \!NetSurf/Resources/en/welcome.html,faf $(ATARI_TARGET_DIR)res/welcome.html
- $(Q)cp \!NetSurf/Resources/en/maps.html,faf $(ATARI_TARGET_DIR)res/maps.html
- $(Q)cp \!NetSurf/Resources/en/licence.html,faf $(ATARI_TARGET_DIR)res/licence.html
- $(Q)cp \!NetSurf/Resources/en/credits.html,faf $(ATARI_TARGET_DIR)res/credits.html
+ $(Q)cp resources/icons/* -R $(ATARI_TARGET_DIR)res/icons/
+
+ $(Q)cp resources/netsurf.png $(ATARI_TARGET_DIR)res/netsurf.png
+ $(Q)cp resources/adblock.css $(ATARI_TARGET_DIR)res/adblock.css
+ $(Q)cp resources/default.css $(ATARI_TARGET_DIR)res/default.css
+ $(Q)cp resources/quirks.css $(ATARI_TARGET_DIR)res/quirks.css
+ $(Q)cp resources/internal.css $(ATARI_TARGET_DIR)res/internal.css
+ $(Q)cp resources/SearchEngines $(ATARI_TARGET_DIR)res/search
+ $(Q)cp resources/ca-bundle $(ATARI_TARGET_DIR)res/cabundle
+ $(Q)$(RM) $(ATARI_TARGET_DIR)res/messages
+ $(Q)$(SPLIT_MESSAGES) -l en -p atari -f messages -o $(ATARI_TARGET_DIR)res/messages resources/FatMessages
+ $(Q)cp resources/en/welcome.html $(ATARI_TARGET_DIR)res/welcome.html
+ $(Q)cp resources/en/maps.html $(ATARI_TARGET_DIR)res/maps.html
+ $(Q)cp resources/en/licence.html $(ATARI_TARGET_DIR)res/licence.html
+ $(Q)cp resources/en/credits.html $(ATARI_TARGET_DIR)res/credits.html
# copy "Bitstream Vera" font:
$(Q)cp $(ATARI_FONT_SOURCE_DIR)RELEASENOTES.TXT $(ATARI_TARGET_DIR)res/fonts/
diff --git a/frontends/atari/bitmap.c b/frontends/atari/bitmap.c
index cbb719586..ae42da837 100644
--- a/frontends/atari/bitmap.c
+++ b/frontends/atari/bitmap.c
@@ -81,7 +81,9 @@ static void *atari_bitmap_create_ex( int w, int h, short bpp, int rowstride, uns
{
struct bitmap * bitmap;
- LOG("width %d (rowstride: %d, bpp: %d), height %d, state %u", w, rowstride, bpp, h, state);
+ NSLOG(netsurf, INFO,
+ "width %d (rowstride: %d, bpp: %d), height %d, state %u", w,
+ rowstride, bpp, h, state);
if( rowstride == 0) {
rowstride = bpp * w;
@@ -107,10 +109,10 @@ static void *atari_bitmap_create_ex( int w, int h, short bpp, int rowstride, uns
} else {
free(bitmap);
bitmap=NULL;
- LOG("Out of memory!");
+ NSLOG(netsurf, INFO, "Out of memory!");
}
}
- LOG("bitmap %p", bitmap);
+ NSLOG(netsurf, INFO, "bitmap %p", bitmap);
return bitmap;
}
@@ -194,7 +196,7 @@ static unsigned char *bitmap_get_buffer(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return NULL;
}
@@ -218,7 +220,7 @@ size_t atari_bitmap_get_rowstride(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return 0;
}
return bm->rowstride;
@@ -231,7 +233,7 @@ void atari_bitmap_destroy(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return;
}
@@ -272,11 +274,12 @@ static void bitmap_set_opaque(void *bitmap, bool opaque)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return;
}
- LOG("setting bitmap %p to %s", bm, opaque ? "opaque" : "transparent");
+ NSLOG(netsurf, INFO, "setting bitmap %p to %s", bm,
+ opaque ? "opaque" : "transparent");
bm->opaque = opaque;
}
@@ -293,7 +296,7 @@ static bool bitmap_test_opaque(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return false;
}
@@ -305,11 +308,12 @@ static bool bitmap_test_opaque(void *bitmap)
while (tst-- > 0) {
if (bm->pixdata[(tst << 2) + 3] != 0xff) {
- LOG("bitmap %p has transparency", bm);
+ NSLOG(netsurf, INFO,
+ "bitmap %p has transparency", bm);
return false;
}
}
- LOG("bitmap %p is opaque", bm);
+ NSLOG(netsurf, INFO, "bitmap %p is opaque", bm);
return true;
}
@@ -320,7 +324,7 @@ bool atari_bitmap_get_opaque(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return false;
}
@@ -334,7 +338,7 @@ int atari_bitmap_get_width(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return 0;
}
@@ -348,7 +352,7 @@ int atari_bitmap_get_height(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return 0;
}
return(bm->height);
diff --git a/frontends/atari/certview.c b/frontends/atari/certview.c
index 6950d31f8..80d18a059 100644
--- a/frontends/atari/certview.c
+++ b/frontends/atari/certview.c
@@ -81,7 +81,7 @@ static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw,
assert(ssl_d);
- LOG("cw %p", cw);
+ NSLOG(netsurf, INFO, "cw %p", cw);
return(sslcert_viewer_init(cb_t, cw, ssl_d));
}
@@ -97,7 +97,7 @@ static void atari_sslcert_viewer_finish(struct core_window *cw)
/* This will also free the session data: */
sslcert_viewer_fini(cvwin->ssl_session_data);
- LOG("cw %p", cw);
+ NSLOG(netsurf, INFO, "cw %p", cw);
}
static void atari_sslcert_viewer_draw(struct core_window *cw, int x,
@@ -123,7 +123,7 @@ static void atari_sslcert_viewer_keypress(struct core_window *cw, uint32_t ucs4)
cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw);
- LOG("ucs4: %"PRIu32, ucs4);
+ NSLOG(netsurf, INFO, "ucs4: %"PRIu32, ucs4);
sslcert_viewer_keypress(cvwin->ssl_session_data, ucs4);
}
@@ -150,14 +150,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
short retval = 0;
OBJECT *toolbar;
- LOG("win %p", win);
+ NSLOG(netsurf, INFO, "win %p", win);
if(ev_out->emo_events & MU_MESAG){
switch (msg[0]) {
case WM_TOOLBAR:
toolbar = gemtk_obj_get_tree(TOOLBAR_SSL_CERT);
- LOG("CERTVIEWER WM_TOOLBAR");
+ NSLOG(netsurf, INFO, "CERTVIEWER WM_TOOLBAR");
tv = (struct core_window*) gemtk_wm_get_user_data(win);
assert(tv);
cvwin = (struct atari_sslcert_viewer_s *)
@@ -238,7 +238,7 @@ static void atari_sslcert_viewer_init(struct atari_sslcert_viewer_s * cvwin,
if (cvwin->tv == NULL) {
/* handle it properly, clean up previous allocs */
- LOG("Failed to allocate treeview");
+ NSLOG(netsurf, INFO, "Failed to allocate treeview");
return;
}
@@ -280,7 +280,7 @@ static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin)
assert(cvwin->init);
assert(cvwin->window);
- LOG("cvwin %p", cvwin);
+ NSLOG(netsurf, INFO, "cvwin %p", cvwin);
if (atari_treeview_is_open(cvwin->tv))
atari_treeview_close(cvwin->tv);
@@ -289,5 +289,5 @@ static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin)
cvwin->window = NULL;
atari_treeview_delete(cvwin->tv);
free(cvwin);
- LOG("done");
+ NSLOG(netsurf, INFO, "done");
}
diff --git a/frontends/atari/cookies.c b/frontends/atari/cookies.c
index 9045009fc..df2de0d4c 100644
--- a/frontends/atari/cookies.c
+++ b/frontends/atari/cookies.c
@@ -63,7 +63,7 @@ static nserror
atari_cookie_manager_init_phase2(struct core_window *cw,
struct core_window_callback_table *cb_t)
{
- LOG("cw %p",cw);
+ NSLOG(netsurf, INFO, "cw %p", cw);
return(cookie_manager_init(cb_t, cw));
}
@@ -71,7 +71,7 @@ atari_cookie_manager_init_phase2(struct core_window *cw,
static void
atari_cookie_manager_finish(struct core_window *cw)
{
- LOG("cw %p",cw);
+ NSLOG(netsurf, INFO, "cw %p", cw);
cookie_manager_fini();
}
@@ -89,7 +89,7 @@ atari_cookie_manager_draw(struct core_window *cw,
static void
atari_cookie_manager_keypress(struct core_window *cw, uint32_t ucs4)
{
- LOG("ucs4: %"PRIu32, ucs4);
+ NSLOG(netsurf, INFO, "ucs4: %"PRIu32, ucs4);
cookie_manager_keypress(ucs4);
}
@@ -108,13 +108,13 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
short retval = 0;
- LOG("win %p", win);
+ NSLOG(netsurf, INFO, "win %p", win);
if (ev_out->emo_events & MU_MESAG) {
switch (msg[0]) {
case WM_TOOLBAR:
- LOG("WM_TOOLBAR");
+ NSLOG(netsurf, INFO, "WM_TOOLBAR");
break;
case WM_CLOSED:
@@ -158,7 +158,8 @@ void atari_cookie_manager_init(void)
if (atari_cookie_manager.tv == NULL) {
/* handle it properly, clean up previous allocs */
- LOG("Failed to allocate treeview");
+ NSLOG(netsurf, INFO,
+ "Failed to allocate treeview");
return;
}
@@ -209,7 +210,7 @@ void atari_cookie_manager_destroy(void)
atari_treeview_delete(atari_cookie_manager.tv);
atari_cookie_manager.init = false;
}
- LOG("done");
+ NSLOG(netsurf, INFO, "done");
}
diff --git a/frontends/atari/ctxmenu.c b/frontends/atari/ctxmenu.c
index e25d8e522..eb6cc1611 100644
--- a/frontends/atari/ctxmenu.c
+++ b/frontends/atari/ctxmenu.c
@@ -216,7 +216,7 @@ void context_popup(struct gui_window * gw, short x, short y)
browser_window_navigate(
gw->browser->bw,
hlcache_handle_get_url(ctx->ccdata.object),
- browser_window_get_url(gw->browser->bw),
+ browser_window_access_url(gw->browser->bw),
BW_NAVIGATE_DOWNLOAD,
NULL,
NULL,
@@ -232,7 +232,7 @@ void context_popup(struct gui_window * gw, short x, short y)
error = browser_window_navigate(
gw->browser->bw,
ctx->ccdata.link,
- browser_window_get_url(gw->browser->bw),
+ browser_window_access_url(gw->browser->bw),
BW_NAVIGATE_DOWNLOAD,
NULL,
NULL,
@@ -269,7 +269,7 @@ void context_popup(struct gui_window * gw, short x, short y)
error = browser_window_create(
BW_CREATE_HISTORY | BW_CREATE_CLONE,
ctx->ccdata.link,
- browser_window_get_url(gw->browser->bw),
+ browser_window_access_url(gw->browser->bw),
gw->browser->bw,
NULL);
if (error != NSERROR_OK) {
@@ -288,7 +288,9 @@ void context_popup(struct gui_window * gw, short x, short y)
/* the GEMDOS cmdline contains the length of the commandline
in the first byte: */
cmdline[0] = (unsigned char)strlen(tempfile);
- LOG("Creating temporay source file: %s\n", tempfile);
+ NSLOG(netsurf, INFO,
+ "Creating temporay source file: %s\n",
+ tempfile);
fp_tmpfile = fopen(tempfile, "w");
if (fp_tmpfile != NULL){
fwrite(data, size, 1, fp_tmpfile);
@@ -306,7 +308,8 @@ void context_popup(struct gui_window * gw, short x, short y)
}
} else {
- LOG("Invalid content!");
+ NSLOG(netsurf, INFO,
+ "Invalid content!");
}
} else {
form_alert(0, "[1][Set option \"atari_editor\".][OK]");
diff --git a/frontends/atari/deskmenu.c b/frontends/atari/deskmenu.c
index addba2764..34d7be0b8 100644
--- a/frontends/atari/deskmenu.c
+++ b/frontends/atari/deskmenu.c
@@ -181,7 +181,7 @@ static void __CDECL menu_about(short item, short title, void *data)
nserror error;
char buf[PATH_MAX];
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "abort menu");
strcpy((char*)&buf, "file://");
strncat((char*)&buf, (char*)"./doc/README.TXT",
PATH_MAX - (strlen("file://")+1) );
@@ -208,7 +208,7 @@ static void __CDECL menu_new_win(short item, short title, void *data)
nserror error;
const char *addr;
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if (nsoption_charp(homepage_url) != NULL) {
addr = nsoption_charp(homepage_url);
@@ -236,7 +236,7 @@ static void __CDECL menu_open_url(short item, short title, void *data)
{
struct gui_window * gw;
struct browser_window * bw ;
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
gw = input_window;
if( gw == NULL ) {
@@ -251,7 +251,7 @@ static void __CDECL menu_open_url(short item, short title, void *data)
static void __CDECL menu_open_file(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
const char * filename = file_select(messages_get("OpenFile"), "");
if( filename != NULL ){
@@ -280,7 +280,7 @@ static void __CDECL menu_open_file(short item, short title, void *data)
static void __CDECL menu_close_win(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if( input_window == NULL )
return;
gui_window_destroy( input_window );
@@ -288,7 +288,7 @@ static void __CDECL menu_close_win(short item, short title, void *data)
static void __CDECL menu_save_page(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
static bool init = true;
bool is_folder=false;
const char * path;
@@ -319,7 +319,7 @@ static void __CDECL menu_quit(short item, short title, void *data)
{
short buff[8];
memset( &buff, 0, sizeof(short)*8 );
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
gemtk_wm_send_msg(NULL, AP_TERM, 0, 0, 0, 0);
}
@@ -331,21 +331,21 @@ static void __CDECL menu_cut(short item, short title, void *data)
static void __CDECL menu_copy(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if( input_window != NULL )
browser_window_key_press( input_window->browser->bw, NS_KEY_COPY_SELECTION);
}
static void __CDECL menu_paste(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if( input_window != NULL )
browser_window_key_press( input_window->browser->bw, NS_KEY_PASTE);
}
static void __CDECL menu_find(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if (input_window != NULL) {
if (input_window->search) {
window_close_search(input_window->root);
@@ -358,13 +358,13 @@ static void __CDECL menu_find(short item, short title, void *data)
static void __CDECL menu_choices(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
open_settings();
}
static void __CDECL menu_stop(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if( input_window == NULL )
return;
@@ -378,7 +378,7 @@ static void __CDECL menu_reload(short item, short title, void *data)
if(input_window == NULL)
return;
toolbar_reload_click(input_window->root->toolbar);
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
}
@@ -408,7 +408,7 @@ static void __CDECL menu_dec_scale(short item, short title, void *data)
static void __CDECL menu_toolbars(short item, short title, void *data)
{
static int state = 0;
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if( input_window != null && input_window->root->toolbar != null ){
state = !state;
// TODO: implement toolbar hide
@@ -418,7 +418,7 @@ static void __CDECL menu_toolbars(short item, short title, void *data)
static void __CDECL menu_savewin(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if (input_window && input_window->browser) {
GRECT rect;
wind_get_grect(gemtk_wm_get_handle(input_window->root->win), WF_CURRXYWH,
@@ -438,7 +438,7 @@ static void __CDECL menu_savewin(short item, short title, void *data)
static void __CDECL menu_debug_render(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
html_redraw_debug = !html_redraw_debug;
if( input_window != NULL ) {
if ( input_window->browser != NULL
@@ -469,7 +469,7 @@ static void __CDECL menu_bg_images(short item, short title, void *data)
static void __CDECL menu_back(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if( input_window == NULL )
return;
toolbar_back_click(input_window->root->toolbar);
@@ -477,7 +477,7 @@ static void __CDECL menu_back(short item, short title, void *data)
static void __CDECL menu_forward(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if( input_window == NULL )
return;
toolbar_forward_click(input_window->root->toolbar);
@@ -485,7 +485,7 @@ static void __CDECL menu_forward(short item, short title, void *data)
static void __CDECL menu_home(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if( input_window == NULL )
return;
toolbar_home_click(input_window->root->toolbar);
@@ -493,24 +493,24 @@ static void __CDECL menu_home(short item, short title, void *data)
static void __CDECL menu_lhistory(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if( input_window == NULL )
return;
}
static void __CDECL menu_ghistory(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
atari_global_history_open();
}
static void __CDECL menu_add_bookmark(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
if (input_window) {
if( browser_window_has_content(input_window->browser->bw) ){
atari_hotlist_add_page(
- nsurl_access(browser_window_get_url(input_window->browser->bw)),
+ nsurl_access(browser_window_access_url(input_window->browser->bw)),
NULL
);
}
@@ -519,26 +519,26 @@ static void __CDECL menu_add_bookmark(short item, short title, void *data)
static void __CDECL menu_bookmarks(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
atari_hotlist_open();
}
static void __CDECL menu_cookies(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
atari_cookie_manager_open();
}
static void __CDECL menu_vlog(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
verbose_log = !verbose_log;
menu_icheck(h_gem_menu, MAINMENU_M_VLOG, (verbose_log) ? 1 : 0);
}
static void __CDECL menu_help_content(short item, short title, void *data)
{
- LOG("%s", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s", __FUNCTION__);
}
/*
@@ -580,14 +580,16 @@ static void register_menu_str( struct s_menu_item_evnt * mi )
while (i > 2) {
if ((strncmp(" ", &str[i], 2) == 0) && (strlen(&str[i]) > 2)) {
// "Standard" Keyboard Shortcut Element found:
- LOG("Standard Keyboard Shortcut: \"%s\"\n", &str[i]);
+ NSLOG(netsurf, INFO,
+ "Standard Keyboard Shortcut: \"%s\"\n", &str[i]);
x = i+2;
is_std_shortcut = true;
break;
}
if( str[i] == '['){
- LOG("Keyboard Shortcut: \"%s\"\n", &str[i]);
+ NSLOG(netsurf, INFO, "Keyboard Shortcut: \"%s\"\n",
+ &str[i]);
// "Custom" Keyboard Shortcut Element found (identified by [):
x = i;
break;
@@ -662,8 +664,12 @@ static void register_menu_str( struct s_menu_item_evnt * mi )
}
}
- LOG("Registered keyboard shortcut for \"%s\" => mod: %d, ""keycode: %ld, ascii: %c\n",
- str, accel->mod, accel->keycode, accel->ascii);
+ NSLOG(netsurf, INFO,
+ "Registered keyboard shortcut for \"%s\" => mod: %d, ""keycode: %ld, ascii: %c\n",
+ str,
+ accel->mod,
+ accel->keycode,
+ accel->ascii);
}
}
diff --git a/frontends/atari/download.c b/frontends/atari/download.c
index d756e6694..7a1c7d2b7 100644
--- a/frontends/atari/download.c
+++ b/frontends/atari/download.c
@@ -194,7 +194,7 @@ static void on_close(struct gui_download_window * dw)
static void gui_download_window_destroy( struct gui_download_window * gdw)
{
- LOG("gdw %p", gdw);
+ NSLOG(netsurf, INFO, "gdw %p", gdw);
if (gdw->status == NSATARI_DOWNLOAD_WORKING) {
download_context_abort(gdw->ctx);
@@ -253,7 +253,8 @@ gui_download_window_create(download_context *ctx, struct gui_window *parent)
char alert[200];
- LOG("Creating download window for gui window: %p", parent);
+ NSLOG(netsurf, INFO, "Creating download window for gui window: %p",
+ parent);
/* TODO: Implement real form and use messages file strings! */
@@ -330,7 +331,8 @@ gui_download_window_create(download_context *ctx, struct gui_window *parent)
gemtk_wm_set_toolbar_redraw_func(gdw->guiwin, toolbar_redraw_cb);
strncpy((char*)&gdw->lbl_file, filename, MAX_SLEN_LBL_FILE-1);
- LOG("created download: %s (total size: %d)", gdw->destination, gdw->size_total);
+ NSLOG(netsurf, INFO, "created download: %s (total size: %d)",
+ gdw->destination, gdw->size_total);
GRECT work, curr;
work.g_x = 0;
@@ -357,7 +359,7 @@ static nserror gui_download_window_data(struct gui_download_window *dw,
uint32_t tnow = clck / (CLOCKS_PER_SEC>>3);
uint32_t sdiff = (clck / (CLOCKS_PER_SEC)) - dw->start;
- LOG("dw %p",dw);
+ NSLOG(netsurf, INFO, "dw %p", dw);
if (dw->abort == true){
dw->status = NSATARI_DOWNLOAD_CANCELED;
@@ -405,7 +407,7 @@ static nserror gui_download_window_data(struct gui_download_window *dw,
static void gui_download_window_error(struct gui_download_window *dw,
const char *error_msg)
{
- LOG("%s", error_msg);
+ NSLOG(netsurf, INFO, "%s", error_msg);
strncpy((char*)&dw->lbl_file, error_msg, MAX_SLEN_LBL_FILE-1);
dw->status = NSATARI_DOWNLOAD_ERROR;
@@ -416,7 +418,7 @@ static void gui_download_window_error(struct gui_download_window *dw,
static void gui_download_window_done(struct gui_download_window *dw)
{
- LOG("dw %p", dw);
+ NSLOG(netsurf, INFO, "dw %p", dw);
// TODO: change abort to close
dw->status = NSATARI_DOWNLOAD_COMPLETE;
diff --git a/frontends/atari/filetype.c b/frontends/atari/filetype.c
index d27076e9c..706347137 100644
--- a/frontends/atari/filetype.c
+++ b/frontends/atari/filetype.c
@@ -36,7 +36,7 @@ const char *fetch_filetype(const char *unix_path)
char * res = (char*)"text/html";
l = strlen(unix_path);
- LOG("unix path: %s", unix_path);
+ NSLOG(netsurf, INFO, "unix path: %s", unix_path);
/* This line is added for devlopment versions running from the root dir: */
if( strchr( unix_path, (int)'.' ) ){
@@ -85,6 +85,6 @@ const char *fetch_filetype(const char *unix_path)
}
}
- LOG("mime type: %s", res);
+ NSLOG(netsurf, INFO, "mime type: %s", res);
return( res );
}
diff --git a/frontends/atari/findfile.c b/frontends/atari/findfile.c
index 45ca6d916..8784727bc 100644
--- a/frontends/atari/findfile.c
+++ b/frontends/atari/findfile.c
@@ -31,7 +31,7 @@ char * local_file_to_url( const char * filename )
#define BACKSLASH 0x5C
char * url;
- LOG("in: %s", filename);
+ NSLOG(netsurf, INFO, "in: %s", filename);
if( strlen(filename) <= 2){
return( NULL );
@@ -55,7 +55,7 @@ char * local_file_to_url( const char * filename )
free(fname_local);
- LOG("out: %s", url);
+ NSLOG(netsurf, INFO, "out: %s", url);
return( url );
#undef BACKSLASH
@@ -81,10 +81,10 @@ char * atari_find_resource(char *buf, const char *filename, const char *def)
{
char *cdir = NULL;
char t[PATH_MAX];
- LOG("%s (def: %s)", filename, def);
+ NSLOG(netsurf, INFO, "%s (def: %s)", filename, def);
strcpy(t, NETSURF_GEM_RESPATH);
strcat(t, filename);
- LOG("checking %s", (char *)&t);
+ NSLOG(netsurf, INFO, "checking %s", (char *)&t);
if (gemdos_realpath(t, buf) != NULL) {
if (access(buf, R_OK) == 0) {
return buf;
@@ -92,7 +92,7 @@ char * atari_find_resource(char *buf, const char *filename, const char *def)
}
strcpy(t, "./");
strcat(t, filename);
- LOG("checking %s", (char *)&t);
+ NSLOG(netsurf, INFO, "checking %s", (char *)&t);
if (gemdos_realpath(t, buf) != NULL) {
if (access(buf, R_OK) == 0) {
return buf;
@@ -104,7 +104,7 @@ char * atari_find_resource(char *buf, const char *filename, const char *def)
strcpy(t, cdir);
strcat(t, "/.netsurf/");
strcat(t, filename);
- LOG("checking %s", (char *)&t);
+ NSLOG(netsurf, INFO, "checking %s", (char *)&t);
if (gemdos_realpath(t, buf) != NULL) {
if (access(buf, R_OK) == 0)
return buf;
@@ -116,19 +116,19 @@ char * atari_find_resource(char *buf, const char *filename, const char *def)
if (gemdos_realpath(cdir, buf) != NULL) {
strcat(buf, "/");
strcat(buf, filename);
- LOG("checking %s", (char *)&t);
+ NSLOG(netsurf, INFO, "checking %s", (char *)&t);
if (access(buf, R_OK) == 0)
return buf;
}
}
if (def[0] == '~') {
snprintf(t, PATH_MAX, "%s%s", getenv("HOME"), def + 1);
- LOG("checking %s", (char *)&t);
+ NSLOG(netsurf, INFO, "checking %s", (char *)&t);
if (gemdos_realpath(t, buf) == NULL) {
strcpy(buf, t);
}
} else {
- LOG("checking %s", (char *)def);
+ NSLOG(netsurf, INFO, "checking %s", (char *)def);
if (gemdos_realpath(def, buf) == NULL) {
strcpy(buf, def);
}
diff --git a/frontends/atari/gui.c b/frontends/atari/gui.c
index d4a6915cd..6ee63b301 100644
--- a/frontends/atari/gui.c
+++ b/frontends/atari/gui.c
@@ -39,6 +39,7 @@
#include "netsurf/content.h"
#include "netsurf/cookie_db.h"
#include "netsurf/url_db.h"
+#include "netsurf/plotters.h"
#include "content/backing_store.h"
#include "atari/gemtk/gemtk.h"
@@ -138,11 +139,11 @@ static void atari_poll(void)
evnt_multi_fast(&aes_event_in, aes_msg_out, &aes_event_out);
if(gemtk_wm_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out) == 0) {
if( (aes_event_out.emo_events & MU_MESAG) != 0 ) {
- LOG("WM: %d\n", aes_msg_out[0]);
+ NSLOG(netsurf, INFO, "WM: %d\n", aes_msg_out[0]);
switch(aes_msg_out[0]) {
case MN_SELECTED:
- LOG("Menu Item: %d\n", aes_msg_out[4]);
+ NSLOG(netsurf, INFO, "Menu Item: %d\n", aes_msg_out[4]);
deskmenu_dispatch_item(aes_msg_out[3], aes_msg_out[4]);
break;
@@ -194,13 +195,14 @@ gui_window_create(struct browser_window *bw,
gui_window_create_flags flags)
{
struct gui_window *gw=NULL;
- LOG("gw: %p, BW: %p, existing %p, flags: %d\n", gw, bw, existing, (int)flags);
+ NSLOG(netsurf, INFO, "gw: %p, BW: %p, existing %p, flags: %d\n", gw, bw,
+ existing, (int)flags);
gw = calloc(1, sizeof(struct gui_window));
if (gw == NULL)
return NULL;
- LOG("new window: %p, bw: %p\n", gw, bw);
+ NSLOG(netsurf, INFO, "new window: %p, bw: %p\n", gw, bw);
window_create(gw, bw, existing, WIDGET_STATUSBAR|WIDGET_TOOLBAR|WIDGET_RESIZE\
|WIDGET_SCROLL);
if (gw->root->win) {
@@ -252,7 +254,7 @@ void gui_window_destroy(struct gui_window *gw)
if (gw == NULL)
return;
- LOG("%s\n", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s\n", __FUNCTION__);
if (input_window == gw) {
gui_set_input_gui_window(NULL);
@@ -292,25 +294,27 @@ void gui_window_destroy(struct gui_window *gw)
}
/**
- * Find the current dimensions of a browser window's content area.
+ * Find the current dimensions of a atari browser window content area.
*
- * \param w gui_window to measure
- * \param width receives width of window
+ * \param gw The gui window to measure content area of.
+ * \param width receives width of window
* \param height receives height of window
* \param scaled whether to return scaled values
+ * \return NSERROR_OK on sucess and width and height updated
+ * else error code.
*/
-static void
-gui_window_get_dimensions(struct gui_window *w,
+static nserror
+gui_window_get_dimensions(struct gui_window *gw,
int *width,
int *height,
bool scaled)
{
- if (w == NULL)
- return;
GRECT rect;
- window_get_grect(w->root, BROWSER_AREA_CONTENT, &rect);
+ window_get_grect(gw->root, BROWSER_AREA_CONTENT, &rect);
*width = rect.g_w;
*height = rect.g_h;
+
+ return NSERROR_OK;
}
/**
@@ -374,44 +378,41 @@ void atari_window_set_status(struct gui_window *w, const char *text)
window_set_stauts(w->root, (char*)text);
}
-static void atari_window_reformat(struct gui_window *gw)
+
+/**
+ * Invalidates an area of an atari browser window
+ *
+ * \param gw gui_window
+ * \param rect area to redraw or NULL for the entire window area
+ * \return NSERROR_OK on success or appropriate error code
+ */
+static nserror
+atari_window_invalidate_area(struct gui_window *gw,
+ const struct rect *rect)
{
- int width = 0, height = 0;
+ GRECT area;
- if (gw != NULL) {
- gui_window_get_dimensions(gw, &width, &height, true);
- browser_window_reformat(gw->browser->bw, false, width, height);
+ if (gw == NULL) {
+ return NSERROR_BAD_PARAMETER;
}
-}
-static void gui_window_redraw_window(struct gui_window *gw)
-{
- //CMP_BROWSER b;
- GRECT rect;
- if (gw == NULL)
- return;
- //b = gw->browser;
- window_get_grect(gw->root, BROWSER_AREA_CONTENT, &rect);
- window_schedule_redraw_grect(gw->root, &rect);
-}
+ window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area);
-static void gui_window_update_box(struct gui_window *gw, const struct rect *rect)
-{
- GRECT area;
- struct gemtk_wm_scroll_info_s *slid;
+ if (rect != NULL) {
+ struct gemtk_wm_scroll_info_s *slid;
- if (gw == NULL)
- return;
+ slid = gemtk_wm_get_scroll_info(gw->root->win);
- slid = gemtk_wm_get_scroll_info(gw->root->win);
+ area.g_x += rect->x0 - (slid->x_pos * slid->x_unit_px);
+ area.g_y += rect->y0 - (slid->y_pos * slid->y_unit_px);
+ area.g_w = rect->x1 - rect->x0;
+ area.g_h = rect->y1 - rect->y0;
+ }
- window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area);
- area.g_x += rect->x0 - (slid->x_pos * slid->x_unit_px);
- area.g_y += rect->y0 - (slid->y_pos * slid->y_unit_px);
- area.g_w = rect->x1 - rect->x0;
- area.g_h = rect->y1 - rect->y0;
//dbg_grect("update box", &area);
window_schedule_redraw_grect(gw->root, &area);
+
+ return NSERROR_OK;
}
bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy)
@@ -424,17 +425,31 @@ bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy)
return( true );
}
-static void gui_window_set_scroll(struct gui_window *w, int sx, int sy)
+/**
+ * Set the scroll position of a atari browser window.
+ *
+ * Scrolls the viewport to ensure the specified rectangle of the
+ * content is shown. The atari implementation scrolls the contents so
+ * the specified point in the content is at the top of the viewport.
+ *
+ * \param gw gui window to scroll
+ * \param rect The rectangle to ensure is shown.
+ * \return NSERROR_OK on success or apropriate error code.
+ */
+static nserror
+gui_window_set_scroll(struct gui_window *gw, const struct rect *rect)
{
- if ( (w == NULL)
- || (w->browser->bw == NULL)
- || (!browser_window_has_content(w->browser->bw)))
- return;
+ if ((gw == NULL) ||
+ (gw->browser->bw == NULL) ||
+ (!browser_window_has_content(gw->browser->bw))) {
+ return NSERROR_BAD_PARAMETER;
+ }
- LOG("scroll (gui_window: %p) %d, %d\n", w, sx, sy);
- window_scroll_by(w->root, sx, sy);
- return;
+ NSLOG(netsurf, INFO, "scroll (gui_window: %p) %d, %d\n", gw, rect->x0,
+ rect->y0);
+ window_scroll_by(gw->root, rect->x0, rect->y0);
+ return NSERROR_OK;
}
/**
@@ -679,7 +694,7 @@ static void gui_window_new_content(struct gui_window *w)
slid->x_pos = 0;
slid->y_pos = 0;
gemtk_wm_update_slider(w->root->win, GEMTK_WM_VH_SLIDER);
- gui_window_redraw_window(w);
+ atari_window_invalidate_area(w, NULL);
}
@@ -758,7 +773,8 @@ static void gui_401login_open(nsurl *url, const char *realm,
char * out = NULL;
bres = login_form_do( url, (char*)realm, &out);
if (bres) {
- LOG("url: %s, realm: %s, auth: %s\n", nsurl_access(url), realm, out);
+ NSLOG(netsurf, INFO, "url: %s, realm: %s, auth: %s\n",
+ nsurl_access(url), realm, out);
urldb_set_auth_details(url, realm, out);
}
if (out != NULL) {
@@ -776,7 +792,7 @@ gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
void *cbpw)
{
struct sslcert_session_data *data;
- LOG("url %s", nsurl_access(url));
+ NSLOG(netsurf, INFO, "url %s", nsurl_access(url));
// TODO: localize string
int b = form_alert(1, "[2][SSL Verify failed, continue?][Continue|Abort|Details...]");
@@ -799,7 +815,8 @@ gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
void gui_set_input_gui_window(struct gui_window *gw)
{
- LOG("Setting input window from: %p to %p\n", input_window, gw);
+ NSLOG(netsurf, INFO, "Setting input window from: %p to %p\n",
+ input_window, gw);
input_window = gw;
}
@@ -810,7 +827,7 @@ struct gui_window * gui_get_input_window(void)
static void gui_quit(void)
{
- LOG("quitting");
+ NSLOG(netsurf, INFO, "quitting");
struct gui_window *gw = window_list;
struct gui_window *tmp = window_list;
@@ -839,9 +856,9 @@ static void gui_quit(void)
rsrc_free();
- LOG("Shutting down plotter");
+ NSLOG(netsurf, INFO, "Shutting down plotter");
plot_finalise();
- LOG("done");
+ NSLOG(netsurf, INFO, "done");
}
/**
@@ -853,7 +870,7 @@ process_cmdline(int argc, char** argv)
int opt;
bool set_default_dimensions = true;
- LOG("argc %d, argv %p", argc, argv);
+ NSLOG(netsurf, INFO, "argc %d, argv %p", argc, argv);
if ((nsoption_int(window_width) != 0) && (nsoption_int(window_height) != 0)) {
@@ -946,7 +963,7 @@ static nserror set_defaults(struct nsoption_s *defaults)
/* Set defaults for absent option strings */
nsoption_setnull_charp(cookie_file, strdup("cookies"));
if (nsoption_charp(cookie_file) == NULL) {
- LOG("Failed initialising string options");
+ NSLOG(netsurf, INFO, "Failed initialising string options");
return NSERROR_BAD_PARAMETER;
}
return NSERROR_OK;
@@ -963,7 +980,7 @@ static void gui_init(int argc, char** argv)
OBJECT * cursors;
atari_find_resource(buf, "netsurf.rsc", "./res/netsurf.rsc");
- LOG("Using RSC file: %s ", (char *)&buf);
+ NSLOG(netsurf, INFO, "Using RSC file: %s ", (char *)&buf);
if (rsrc_load(buf)==0) {
char msg[1024];
@@ -999,15 +1016,16 @@ static void gui_init(int argc, char** argv)
create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_HELP,
cursors, &gem_cursors.help);
- LOG("Enabling core select menu");
+ NSLOG(netsurf, INFO, "Enabling core select menu");
nsoption_set_bool(core_select_menu, true);
- LOG("Loading url.db from: %s", nsoption_charp(url_file));
+ NSLOG(netsurf, INFO, "Loading url.db from: %s", nsoption_charp(url_file));
if( strlen(nsoption_charp(url_file)) ) {
urldb_load(nsoption_charp(url_file));
}
- LOG("Loading cookies from: %s", nsoption_charp(cookie_file));
+ NSLOG(netsurf, INFO, "Loading cookies from: %s",
+ nsoption_charp(cookie_file));
if( strlen(nsoption_charp(cookie_file)) ) {
urldb_load_cookies(nsoption_charp(cookie_file));
}
@@ -1015,11 +1033,16 @@ static void gui_init(int argc, char** argv)
if (process_cmdline(argc,argv) != true)
die("unable to process command line.\n");
- LOG("Initializing NKC...");
+ NSLOG(netsurf, INFO, "Initializing NKC...");
nkc_init();
- LOG("Initializing plotters...");
- plot_init(nsoption_charp(atari_font_driver));
+ NSLOG(netsurf, INFO, "Initializing plotters...");
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &atari_plotters
+ };
+ plot_init(&ctx, nsoption_charp(atari_font_driver));
aes_event_in.emi_m1leave = MO_LEAVE;
aes_event_in.emi_m1.g_w = 1;
@@ -1045,13 +1068,11 @@ static void gui_init(int argc, char** argv)
static struct gui_window_table atari_window_table = {
.create = gui_window_create,
.destroy = gui_window_destroy,
- .redraw = gui_window_redraw_window,
- .update = gui_window_update_box,
+ .invalidate = atari_window_invalidate_area,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
- .reformat = atari_window_reformat,
.set_title = gui_window_set_title,
.set_url = gui_window_set_url,
@@ -1156,18 +1177,18 @@ int main(int argc, char** argv)
ret = messages_add_from_file(messages);
/* common initialisation */
- LOG("Initialising core...");
+ NSLOG(netsurf, INFO, "Initialising core...");
ret = netsurf_init(store);
if (ret != NSERROR_OK) {
die("NetSurf failed to initialise");
}
- LOG("Initializing GUI...");
+ NSLOG(netsurf, INFO, "Initializing GUI...");
gui_init(argc, argv);
graf_mouse( ARROW , NULL);
- LOG("Creating initial browser window...");
+ NSLOG(netsurf, INFO, "Creating initial browser window...");
addr = option_homepage_url;
if (strncmp(addr, "file://", 7) && strncmp(addr, "http://", 7)) {
if (stat(addr, &stat_buf) == 0) {
@@ -1189,7 +1210,7 @@ int main(int argc, char** argv)
if (ret != NSERROR_OK) {
atari_warn_user(messages_get_errorcode(ret), 0);
} else {
- LOG("Entering Atari event mainloop...");
+ NSLOG(netsurf, INFO, "Entering Atari event mainloop...");
while (!atari_quit) {
atari_poll();
}
@@ -1203,7 +1224,11 @@ int main(int argc, char** argv)
fclose(stdout);
fclose(stderr);
#endif
- LOG("exit_gem");
+ NSLOG(netsurf, INFO, "exit_gem");
+
+ /* finalise logging */
+ nslog_finalise();
+
exit_gem();
return 0;
diff --git a/frontends/atari/history.c b/frontends/atari/history.c
index 56aafd056..ec602684f 100644
--- a/frontends/atari/history.c
+++ b/frontends/atari/history.c
@@ -39,13 +39,13 @@ static nserror
atari_global_history_init_phase2(struct core_window *cw,
struct core_window_callback_table *cb_t)
{
- LOG("cw %p", cw);
+ NSLOG(netsurf, INFO, "cw %p", cw);
return(global_history_init(cb_t, cw));
}
static void atari_global_history_finish(struct core_window *cw)
{
- LOG("cw %p", cw);
+ NSLOG(netsurf, INFO, "cw %p", cw);
global_history_fini();
}
@@ -58,7 +58,7 @@ static void atari_global_history_draw(struct core_window *cw, int x,
static void atari_global_history_keypress(struct core_window *cw, uint32_t ucs4)
{
- LOG("ucs4: %"PRIu32, ucs4);
+ NSLOG(netsurf, INFO, "ucs4: %"PRIu32, ucs4);
global_history_keypress(ucs4);
}
@@ -67,7 +67,7 @@ atari_global_history_mouse_action(struct core_window *cw,
browser_mouse_state mouse,
int x, int y)
{
- LOG("x: %d, y: %d\n", x, y);
+ NSLOG(netsurf, INFO, "x: %d, y: %d\n", x, y);
global_history_mouse_action(mouse, x, y);
}
@@ -82,7 +82,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
short retval = 0;
- LOG("win %p", win);
+ NSLOG(netsurf, INFO, "win %p", win);
if (ev_out->emo_events & MU_MESAG) {
switch (msg[0]) {
@@ -134,7 +134,8 @@ void atari_global_history_init(void)
if (atari_global_history.tv == NULL) {
/* handle it properly, clean up previous allocs */
- LOG("Failed to allocate treeview");
+ NSLOG(netsurf, INFO,
+ "Failed to allocate treeview");
return;
}
}
@@ -181,7 +182,7 @@ void atari_global_history_destroy(void)
atari_treeview_delete(atari_global_history.tv);
atari_global_history.init = false;
}
- LOG("done");
+ NSLOG(netsurf, INFO, "done");
}
void atari_global_history_redraw(void)
diff --git a/frontends/atari/hotlist.c b/frontends/atari/hotlist.c
index da599161b..3a54c98eb 100644
--- a/frontends/atari/hotlist.c
+++ b/frontends/atari/hotlist.c
@@ -72,14 +72,14 @@ static struct atari_treeview_callbacks atari_hotlist_treeview_callbacks = {
static nserror atari_hotlist_init_phase2(struct core_window *cw,
struct core_window_callback_table *cb_t)
{
- LOG("cw:%p", cw);
+ NSLOG(netsurf, INFO, "cw:%p", cw);
return hotlist_manager_init(cb_t, cw);
}
static void atari_hotlist_finish(struct core_window *cw)
{
- LOG("cw:%p", cw);
- hotlist_fini(hl.path);
+ NSLOG(netsurf, INFO, "cw:%p", cw);
+ hotlist_fini();
}
static void atari_hotlist_draw(struct core_window *cw, int x,
@@ -93,7 +93,7 @@ static void atari_hotlist_keypress(struct core_window *cw, uint32_t ucs4)
{
//GUIWIN *gemtk_win;
//GRECT area;
- LOG("ucs4: %"PRIu32 , ucs4);
+ NSLOG(netsurf, INFO, "ucs4: %"PRIu32, ucs4);
hotlist_keypress(ucs4);
//gemtk_win = atari_treeview_get_gemtk_window(cw);
//atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &area);
@@ -104,7 +104,7 @@ static void atari_hotlist_mouse_action(struct core_window *cw,
browser_mouse_state mouse,
int x, int y)
{
- LOG("x: %d, y: %d\n", x, y);
+ NSLOG(netsurf, INFO, "x: %d, y: %d\n", x, y);
hotlist_mouse_action(mouse, x, y);
}
@@ -123,7 +123,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
GRECT tb_area;
GUIWIN * gemtk_win;
- LOG("gw:%p", win);
+ NSLOG(netsurf, INFO, "gw:%p", win);
tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win);
cw = (struct core_window *)tv;
@@ -132,7 +132,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
switch (msg[0]) {
case WM_TOOLBAR:
- LOG("WM_TOOLBAR");
+ NSLOG(netsurf, INFO, "WM_TOOLBAR");
toolbar = gemtk_obj_get_tree(TOOLBAR_HOTLIST);
@@ -198,8 +198,8 @@ void atari_hotlist_init(void)
strncpy( (char*)&hl.path, nsoption_charp(hotlist_file), PATH_MAX-1 );
}
- LOG("Hotlist: %s", (char *)&hl.path);
- hotlist_init(hl.path);
+ NSLOG(netsurf, INFO, "Hotlist: %s", (char *)&hl.path);
+ hotlist_init(hl.path, hl.path);
if( hl.window == NULL ){
int flags = ATARI_TREEVIEW_WIDGETS;
@@ -224,7 +224,8 @@ void atari_hotlist_init(void)
if (hl.tv == NULL) {
/* handle it properly, clean up previous allocs */
- LOG("Failed to allocate treeview");
+ NSLOG(netsurf, INFO,
+ "Failed to allocate treeview");
return;
}
@@ -276,7 +277,7 @@ void atari_hotlist_destroy(void)
atari_treeview_delete(hl.tv);
hl.init = false;
}
- LOG("done");
+ NSLOG(netsurf, INFO, "done");
}
void atari_hotlist_redraw(void)
@@ -299,7 +300,7 @@ void atari_hotlist_add_page( const char * url, const char * title )
return;
if (hotlist_has_url(nsurl)) {
- LOG("URL already added as Bookmark");
+ NSLOG(netsurf, INFO, "URL already added as Bookmark");
nsurl_unref(nsurl);
return;
}
diff --git a/frontends/atari/misc.h b/frontends/atari/misc.h
index e581c23b2..05fd1aeef 100644
--- a/frontends/atari/misc.h
+++ b/frontends/atari/misc.h
@@ -31,10 +31,12 @@
lbuf[7] = (long)sbuf[7];
#define RECT_TO_GRECT(r,g) \
- (g)->g_x = (r->x0 < r->x1) ? r->x0 : r->x1 ; \
- (g)->g_y = (r->y0 < r->y1) ? r->y0 : r->y1 ; \
- (g)->g_w = (r->x0 < r->x1) ? r->x1 - r->x0 : r->x0 - r->x1 ; \
- (g)->g_h = (r->y0 < r->y1) ? r->y1 - r->y0 : r->y0 - r->y1 ;
+ do { \
+ (g)->g_x = (r->x0 < r->x1) ? r->x0 : r->x1 ; \
+ (g)->g_y = (r->y0 < r->y1) ? r->y0 : r->y1 ; \
+ (g)->g_w = (r->x0 < r->x1) ? r->x1 - r->x0 : r->x0 - r->x1 ; \
+ (g)->g_h = (r->y0 < r->y1) ? r->y1 - r->y0 : r->y0 - r->y1 ; \
+ } while(0)
diff --git a/frontends/atari/osspec.c b/frontends/atari/osspec.c
index f64402e8d..ca042f164 100644
--- a/frontends/atari/osspec.c
+++ b/frontends/atari/osspec.c
@@ -119,14 +119,14 @@ char *gemdos_realpath(const char * path, char * rpath)
return(rpath);
}
- LOG("realpath in: %s\n", path);
+ NSLOG(netsurf, INFO, "realpath in: %s\n", path);
r = realpath(path, work);
if (r != NULL) {
unx2dos((const char *)r, rpath);
- LOG("realpath out: %s\n", rpath);
+ NSLOG(netsurf, INFO, "realpath out: %s\n", rpath);
return(rpath);
} else {
- LOG("realpath out: NULL!\n");
+ NSLOG(netsurf, INFO, "realpath out: NULL!\n");
}
return (NULL);
}
diff --git a/frontends/atari/plot/font_freetype.c b/frontends/atari/plot/font_freetype.c
index 17d3c3bfd..f8109f6f2 100644
--- a/frontends/atari/plot/font_freetype.c
+++ b/frontends/atari/plot/font_freetype.c
@@ -154,11 +154,12 @@ static FT_Error ft_face_requester(FTC_FaceID face_id, FT_Library library, FT_Po
error = FT_New_Face(library, ft_face->fontfile, ft_face->index, face);
if (error) {
- LOG("Could not find font (code %d)\n", error);
+ NSLOG(netsurf, INFO, "Could not find font (code %d)\n", error);
} else {
error = FT_Select_Charmap(*face, FT_ENCODING_UNICODE);
if (error) {
- LOG("Could not select charmap (code %d)\n", error);
+ NSLOG(netsurf, INFO,
+ "Could not select charmap (code %d)\n", error);
} else {
for (cidx = 0; cidx < (*face)->num_charmaps; cidx++) {
if ((*face)->charmap == (*face)->charmaps[cidx]) {
@@ -168,7 +169,7 @@ static FT_Error ft_face_requester(FTC_FaceID face_id, FT_Library library, FT_Po
}
}
}
- LOG("Loaded face from %s\n", ft_face->fontfile);
+ NSLOG(netsurf, INFO, "Loaded face from %s\n", ft_face->fontfile);
return error;
}
@@ -190,7 +191,9 @@ ft_new_face(const char *option, const char *resname, const char *fontfile)
}
error = FTC_Manager_LookupFace(ft_cmanager, (FTC_FaceID)newf, &aface);
if (error) {
- LOG("Could not find font face %s (code %d)\n", fontfile, error);
+ NSLOG(netsurf, INFO,
+ "Could not find font face %s (code %d)\n", fontfile,
+ error);
free(newf);
newf = font_faces[FONT_FACE_DEFAULT]; /* use default */
}
@@ -247,7 +250,7 @@ static void ft_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec)
srec->face_id = (FTC_FaceID)font_faces[selected_face];
- srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE;
+ srec->width = srec->height = (fstyle->size * 64) / PLOT_STYLE_SCALE;
srec->pixel = 0;
/* calculate x/y resolution, when browser_get_dpi() isn't available */
@@ -292,7 +295,8 @@ static bool ft_font_init(void)
/* freetype library initialise */
error = FT_Init_FreeType( &library );
if (error) {
- LOG("Freetype could not initialised (code %d)\n", error);
+ NSLOG(netsurf, INFO,
+ "Freetype could not initialised (code %d)\n", error);
return false;
}
@@ -311,7 +315,9 @@ static bool ft_font_init(void)
NULL,
&ft_cmanager);
if (error) {
- LOG("Freetype could not initialise cache manager (code %d)\n", error);
+ NSLOG(netsurf, INFO,
+ "Freetype could not initialise cache manager (code %d)\n",
+ error);
FT_Done_FreeType(library);
return false;
}
@@ -330,7 +336,8 @@ static bool ft_font_init(void)
FONT_PKG_PATH FONT_FILE_SANS
);
if (font_faces[FONT_FACE_SANS_SERIF] == NULL) {
- LOG("Could not find default font (code %d)\n", error);
+ NSLOG(netsurf, INFO,
+ "Could not find default font (code %d)\n", error);
FTC_Manager_Done(ft_cmanager);
FT_Done_FreeType(library);
return false;
@@ -688,7 +695,7 @@ int ctor_font_plotter_freetype( FONT_PLOTTER self )
self->draw_glyph = draw_glyph8;
}
- LOG("%s: %s\n", (char *)__FILE__, __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s: %s\n", (char *)__FILE__, __FUNCTION__);
if( !init ) {
ft_font_init();
fontbmp = atari_bitmap_create(48, 48, 0);
diff --git a/frontends/atari/plot/font_internal.c b/frontends/atari/plot/font_internal.c
index 3575bc3e1..709697f74 100644
--- a/frontends/atari/plot/font_internal.c
+++ b/frontends/atari/plot/font_internal.c
@@ -96,7 +96,7 @@ int ctor_font_plotter_internal( FONT_PLOTTER self )
self->str_split = str_split;
self->pixel_pos = pixel_pos;
self->text = text;
- LOG("%s: %s\n", (char *)__FILE__, __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s: %s\n", (char *)__FILE__, __FUNCTION__);
if( !init ) {
vdih = self->vdi_handle;
fontbmp = atari_bitmap_create(48, 48, 0);
diff --git a/frontends/atari/plot/font_vdi.c b/frontends/atari/plot/font_vdi.c
index ef5499207..556c08e82 100644
--- a/frontends/atari/plot/font_vdi.c
+++ b/frontends/atari/plot/font_vdi.c
@@ -70,7 +70,7 @@ int ctor_font_plotter_vdi( FONT_PLOTTER self )
self->str_split = str_split;
self->pixel_pos = pixel_pos;
self->text = text;
- LOG("%s: %s\n", (char *)__FILE__, __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s: %s\n", (char *)__FILE__, __FUNCTION__);
if( !init ) {
vdih = self->vdi_handle;
}
@@ -106,9 +106,9 @@ static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const c
fx |= 1;
vst_effects( self->vdi_handle, fx );
/* TODO: replace 90 with global dpi setting */
- //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
+ //pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 / 72 );
//vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
- pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 );
+ pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 );
vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
/*
if(slen != utf8_bounded_length(str, length)){
@@ -148,10 +148,10 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const
if( fstyle->weight > 450 )
fx |= 1;
vst_effects( self->vdi_handle, fx );
- //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
+ //pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 / 72 );
//vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
- pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 );
+ pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 );
vst_point( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh);
*actual_x = 0;
//*char_offset = 0;
@@ -216,7 +216,7 @@ static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const
if( fstyle->weight > 450 )
fx |= 1;
vst_effects(self->vdi_handle, fx);
- pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
+ pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 / 72 );
vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
*actual_x = 0;
*char_offset = 0;
@@ -283,8 +283,8 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
/* TODO: netsurf uses 90 as default dpi ( somewhere defined in libcss),
use that value or pass it as arg, to reduce netsurf dependency */
- //pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
- pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
+ //pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 / 72 );
+ pxsize = ceil( (fstyle->size/PLOT_STYLE_SCALE) * 90 / 72 );
plot_get_dimensions(&canvas);
x += canvas.g_x;
diff --git a/frontends/atari/plot/plot.c b/frontends/atari/plot/plot.c
index 0a0d7a494..4935b1776 100644
--- a/frontends/atari/plot/plot.c
+++ b/frontends/atari/plot/plot.c
@@ -45,38 +45,31 @@
void vq_scrninfo(VdiHdl handle, short *work_out);
struct s_view {
- short x; /* drawing (screen) offset x */
- short y; /* drawing (screen) offset y */
- short w; /* width of buffer, not in sync with vis_w */
- short h; /* height of buffer, not in sync with vis_w */
- short vis_x; /* visible rectangle of the screen buffer */
- short vis_y; /* coords are relative to plot location */
- short vis_w; /* clipped to screen dimensions */
- short vis_h; /* visible width */
- struct rect abs_clipping; /* The toplevel clipping rectangle */
- struct rect clipping; /* actual clipping rectangle */
+ short x; /**< drawing (screen) offset x */
+ short y; /**< drawing (screen) offset y */
+ short w; /**< width of buffer, not in sync with vis_w */
+ short h; /**< height of buffer, not in sync with vis_w */
+ short vis_x; /**< visible rectangle of the screen buffer */
+ short vis_y; /**< coords are relative to plot location */
+ short vis_w; /**< clipped to screen dimensions */
+ short vis_h; /**< visible width */
+ struct rect abs_clipping; /**< The toplevel clipping rectangle */
+ struct rect clipping; /**< actual clipping rectangle */
float scale;
};
-/*
- * Capture the screen at x,y location
- * param self instance
- * param x absolute screen coords
- * param y absolute screen coords
- * param w width
- * param h height
- *
- * This creates an snapshot in RGBA format (NetSurf's native format)
+/**
+ * Garbage collection of the snapshot routine
*
+ * this should be called after you are done with the data returned by
+ * snapshot_create don't access the screenshot after you called this
+ * function
*/
-static struct bitmap * snapshot_create(int x, int y, int w, int h);
-
-/* Garbage collection of the snapshot routine */
-/* this should be called after you are done with the data returned by snapshot_create */
-/* don't access the screenshot after you called this function */
static void snapshot_suspend(void);
-/* destroy memory used by screenshot */
+/**
+ * destroy memory used by screenshot
+ */
static void snapshot_destroy(void);
#ifdef WITH_8BPP_SUPPORT
@@ -86,42 +79,78 @@ static char rgb_lookup[256][4];
short web_std_colors[6] = {0, 51, 102, 153, 204, 255};
unsigned short vdi_web_pal[216][3] = {
- {0x000,0x000,0x000}, {0x0c8,0x000,0x000}, {0x190,0x000,0x000}, {0x258,0x000,0x000}, {0x320,0x000,0x000}, {0x3e8,0x000,0x000},
- {0x000,0x0c8,0x000}, {0x0c8,0x0c8,0x000}, {0x190,0x0c8,0x000}, {0x258,0x0c8,0x000}, {0x320,0x0c8,0x000}, {0x3e8,0x0c8,0x000},
- {0x000,0x190,0x000}, {0x0c8,0x190,0x000}, {0x190,0x190,0x000}, {0x258,0x190,0x000}, {0x320,0x190,0x000}, {0x3e8,0x190,0x000},
- {0x000,0x258,0x000}, {0x0c8,0x258,0x000}, {0x190,0x258,0x000}, {0x258,0x258,0x000}, {0x320,0x258,0x000}, {0x3e8,0x258,0x000},
- {0x000,0x320,0x000}, {0x0c8,0x320,0x000}, {0x190,0x320,0x000}, {0x258,0x320,0x000}, {0x320,0x320,0x000}, {0x3e8,0x320,0x000},
- {0x000,0x3e8,0x000}, {0x0c8,0x3e8,0x000}, {0x190,0x3e8,0x000}, {0x258,0x3e8,0x000}, {0x320,0x3e8,0x000}, {0x3e8,0x3e8,0x000},
- {0x000,0x000,0x0c8}, {0x0c8,0x000,0x0c8}, {0x190,0x000,0x0c8}, {0x258,0x000,0x0c8}, {0x320,0x000,0x0c8}, {0x3e8,0x000,0x0c8},
- {0x000,0x0c8,0x0c8}, {0x0c8,0x0c8,0x0c8}, {0x190,0x0c8,0x0c8}, {0x258,0x0c8,0x0c8}, {0x320,0x0c8,0x0c8}, {0x3e8,0x0c8,0x0c8},
- {0x000,0x190,0x0c8}, {0x0c8,0x190,0x0c8}, {0x190,0x190,0x0c8}, {0x258,0x190,0x0c8}, {0x320,0x190,0x0c8}, {0x3e8,0x190,0x0c8},
- {0x000,0x258,0x0c8}, {0x0c8,0x258,0x0c8}, {0x190,0x258,0x0c8}, {0x258,0x258,0x0c8}, {0x320,0x258,0x0c8}, {0x3e8,0x258,0x0c8},
- {0x000,0x320,0x0c8}, {0x0c8,0x320,0x0c8}, {0x190,0x320,0x0c8}, {0x258,0x320,0x0c8}, {0x320,0x320,0x0c8}, {0x3e8,0x320,0x0c8},
- {0x000,0x3e8,0x0c8}, {0x0c8,0x3e8,0x0c8}, {0x190,0x3e8,0x0c8}, {0x258,0x3e8,0x0c8}, {0x320,0x3e8,0x0c8}, {0x3e8,0x3e8,0x0c8},
- {0x000,0x000,0x190}, {0x0c8,0x000,0x190}, {0x190,0x000,0x190}, {0x258,0x000,0x190}, {0x320,0x000,0x190}, {0x3e8,0x000,0x190},
- {0x000,0x0c8,0x190}, {0x0c8,0x0c8,0x190}, {0x190,0x0c8,0x190}, {0x258,0x0c8,0x190}, {0x320,0x0c8,0x190}, {0x3e8,0x0c8,0x190},
- {0x000,0x190,0x190}, {0x0c8,0x190,0x190}, {0x190,0x190,0x190}, {0x258,0x190,0x190}, {0x320,0x190,0x190}, {0x3e8,0x190,0x190},
- {0x000,0x258,0x190}, {0x0c8,0x258,0x190}, {0x190,0x258,0x190}, {0x258,0x258,0x190}, {0x320,0x258,0x190}, {0x3e8,0x258,0x190},
- {0x000,0x320,0x190}, {0x0c8,0x320,0x190}, {0x190,0x320,0x190}, {0x258,0x320,0x190}, {0x320,0x320,0x190}, {0x3e8,0x320,0x190},
- {0x000,0x3e8,0x190}, {0x0c8,0x3e8,0x190}, {0x190,0x3e8,0x190}, {0x258,0x3e8,0x190}, {0x320,0x3e8,0x190}, {0x3e8,0x3e8,0x190},
- {0x000,0x000,0x258}, {0x0c8,0x000,0x258}, {0x190,0x000,0x258}, {0x258,0x000,0x258}, {0x320,0x000,0x258}, {0x3e8,0x000,0x258},
- {0x000,0x0c8,0x258}, {0x0c8,0x0c8,0x258}, {0x190,0x0c8,0x258}, {0x258,0x0c8,0x258}, {0x320,0x0c8,0x258}, {0x3e8,0x0c8,0x258},
- {0x000,0x190,0x258}, {0x0c8,0x190,0x258}, {0x190,0x190,0x258}, {0x258,0x190,0x258}, {0x320,0x190,0x258}, {0x3e8,0x190,0x258},
- {0x000,0x258,0x258}, {0x0c8,0x258,0x258}, {0x190,0x258,0x258}, {0x258,0x258,0x258}, {0x320,0x258,0x258}, {0x3e8,0x258,0x258},
- {0x000,0x320,0x258}, {0x0c8,0x320,0x258}, {0x190,0x320,0x258}, {0x258,0x320,0x258}, {0x320,0x320,0x258}, {0x3e8,0x320,0x258},
- {0x000,0x3e8,0x258}, {0x0c8,0x3e8,0x258}, {0x190,0x3e8,0x258}, {0x258,0x3e8,0x258}, {0x320,0x3e8,0x258}, {0x3e8,0x3e8,0x258},
- {0x000,0x000,0x320}, {0x0c8,0x000,0x320}, {0x190,0x000,0x320}, {0x258,0x000,0x320}, {0x320,0x000,0x320}, {0x3e8,0x000,0x320},
- {0x000,0x0c8,0x320}, {0x0c8,0x0c8,0x320}, {0x190,0x0c8,0x320}, {0x258,0x0c8,0x320}, {0x320,0x0c8,0x320}, {0x3e8,0x0c8,0x320},
- {0x000,0x190,0x320}, {0x0c8,0x190,0x320}, {0x190,0x190,0x320}, {0x258,0x190,0x320}, {0x320,0x190,0x320}, {0x3e8,0x190,0x320},
- {0x000,0x258,0x320}, {0x0c8,0x258,0x320}, {0x190,0x258,0x320}, {0x258,0x258,0x320}, {0x320,0x258,0x320}, {0x3e8,0x258,0x320},
- {0x000,0x320,0x320}, {0x0c8,0x320,0x320}, {0x190,0x320,0x320}, {0x258,0x320,0x320}, {0x320,0x320,0x320}, {0x3e8,0x320,0x320},
- {0x000,0x3e8,0x320}, {0x0c8,0x3e8,0x320}, {0x190,0x3e8,0x320}, {0x258,0x3e8,0x320}, {0x320,0x3e8,0x320}, {0x3e8,0x3e8,0x320},
- {0x000,0x000,0x3e8}, {0x0c8,0x000,0x3e8}, {0x190,0x000,0x3e8}, {0x258,0x000,0x3e8}, {0x320,0x000,0x3e8}, {0x3e8,0x000,0x3e8},
- {0x000,0x0c8,0x3e8}, {0x0c8,0x0c8,0x3e8}, {0x190,0x0c8,0x3e8}, {0x258,0x0c8,0x3e8}, {0x320,0x0c8,0x3e8}, {0x3e8,0x0c8,0x3e8},
- {0x000,0x190,0x3e8}, {0x0c8,0x190,0x3e8}, {0x190,0x190,0x3e8}, {0x258,0x190,0x3e8}, {0x320,0x190,0x3e8}, {0x3e8,0x190,0x3e8},
- {0x000,0x258,0x3e8}, {0x0c8,0x258,0x3e8}, {0x190,0x258,0x3e8}, {0x258,0x258,0x3e8}, {0x320,0x258,0x3e8}, {0x3e8,0x258,0x3e8},
- {0x000,0x320,0x3e8}, {0x0c8,0x320,0x3e8}, {0x190,0x320,0x3e8}, {0x258,0x320,0x3e8}, {0x320,0x320,0x3e8}, {0x3e8,0x320,0x3e8},
- {0x000,0x3e8,0x3e8}, {0x0c8,0x3e8,0x3e8}, {0x190,0x3e8,0x3e8}, {0x258,0x3e8,0x3e8}, {0x320,0x3e8,0x3e8}, {0x3e8,0x3e8,0x3e8}
+ {0x000,0x000,0x000}, {0x0c8,0x000,0x000}, {0x190,0x000,0x000},
+ {0x258,0x000,0x000}, {0x320,0x000,0x000}, {0x3e8,0x000,0x000},
+ {0x000,0x0c8,0x000}, {0x0c8,0x0c8,0x000}, {0x190,0x0c8,0x000},
+ {0x258,0x0c8,0x000}, {0x320,0x0c8,0x000}, {0x3e8,0x0c8,0x000},
+ {0x000,0x190,0x000}, {0x0c8,0x190,0x000}, {0x190,0x190,0x000},
+ {0x258,0x190,0x000}, {0x320,0x190,0x000}, {0x3e8,0x190,0x000},
+ {0x000,0x258,0x000}, {0x0c8,0x258,0x000}, {0x190,0x258,0x000},
+ {0x258,0x258,0x000}, {0x320,0x258,0x000}, {0x3e8,0x258,0x000},
+ {0x000,0x320,0x000}, {0x0c8,0x320,0x000}, {0x190,0x320,0x000},
+ {0x258,0x320,0x000}, {0x320,0x320,0x000}, {0x3e8,0x320,0x000},
+ {0x000,0x3e8,0x000}, {0x0c8,0x3e8,0x000}, {0x190,0x3e8,0x000},
+ {0x258,0x3e8,0x000}, {0x320,0x3e8,0x000}, {0x3e8,0x3e8,0x000},
+ {0x000,0x000,0x0c8}, {0x0c8,0x000,0x0c8}, {0x190,0x000,0x0c8},
+ {0x258,0x000,0x0c8}, {0x320,0x000,0x0c8}, {0x3e8,0x000,0x0c8},
+ {0x000,0x0c8,0x0c8}, {0x0c8,0x0c8,0x0c8}, {0x190,0x0c8,0x0c8},
+ {0x258,0x0c8,0x0c8}, {0x320,0x0c8,0x0c8}, {0x3e8,0x0c8,0x0c8},
+ {0x000,0x190,0x0c8}, {0x0c8,0x190,0x0c8}, {0x190,0x190,0x0c8},
+ {0x258,0x190,0x0c8}, {0x320,0x190,0x0c8}, {0x3e8,0x190,0x0c8},
+ {0x000,0x258,0x0c8}, {0x0c8,0x258,0x0c8}, {0x190,0x258,0x0c8},
+ {0x258,0x258,0x0c8}, {0x320,0x258,0x0c8}, {0x3e8,0x258,0x0c8},
+ {0x000,0x320,0x0c8}, {0x0c8,0x320,0x0c8}, {0x190,0x320,0x0c8},
+ {0x258,0x320,0x0c8}, {0x320,0x320,0x0c8}, {0x3e8,0x320,0x0c8},
+ {0x000,0x3e8,0x0c8}, {0x0c8,0x3e8,0x0c8}, {0x190,0x3e8,0x0c8},
+ {0x258,0x3e8,0x0c8}, {0x320,0x3e8,0x0c8}, {0x3e8,0x3e8,0x0c8},
+ {0x000,0x000,0x190}, {0x0c8,0x000,0x190}, {0x190,0x000,0x190},
+ {0x258,0x000,0x190}, {0x320,0x000,0x190}, {0x3e8,0x000,0x190},
+ {0x000,0x0c8,0x190}, {0x0c8,0x0c8,0x190}, {0x190,0x0c8,0x190},
+ {0x258,0x0c8,0x190}, {0x320,0x0c8,0x190}, {0x3e8,0x0c8,0x190},
+ {0x000,0x190,0x190}, {0x0c8,0x190,0x190}, {0x190,0x190,0x190},
+ {0x258,0x190,0x190}, {0x320,0x190,0x190}, {0x3e8,0x190,0x190},
+ {0x000,0x258,0x190}, {0x0c8,0x258,0x190}, {0x190,0x258,0x190},
+ {0x258,0x258,0x190}, {0x320,0x258,0x190}, {0x3e8,0x258,0x190},
+ {0x000,0x320,0x190}, {0x0c8,0x320,0x190}, {0x190,0x320,0x190},
+ {0x258,0x320,0x190}, {0x320,0x320,0x190}, {0x3e8,0x320,0x190},
+ {0x000,0x3e8,0x190}, {0x0c8,0x3e8,0x190}, {0x190,0x3e8,0x190},
+ {0x258,0x3e8,0x190}, {0x320,0x3e8,0x190}, {0x3e8,0x3e8,0x190},
+ {0x000,0x000,0x258}, {0x0c8,0x000,0x258}, {0x190,0x000,0x258},
+ {0x258,0x000,0x258}, {0x320,0x000,0x258}, {0x3e8,0x000,0x258},
+ {0x000,0x0c8,0x258}, {0x0c8,0x0c8,0x258}, {0x190,0x0c8,0x258},
+ {0x258,0x0c8,0x258}, {0x320,0x0c8,0x258}, {0x3e8,0x0c8,0x258},
+ {0x000,0x190,0x258}, {0x0c8,0x190,0x258}, {0x190,0x190,0x258},
+ {0x258,0x190,0x258}, {0x320,0x190,0x258}, {0x3e8,0x190,0x258},
+ {0x000,0x258,0x258}, {0x0c8,0x258,0x258}, {0x190,0x258,0x258},
+ {0x258,0x258,0x258}, {0x320,0x258,0x258}, {0x3e8,0x258,0x258},
+ {0x000,0x320,0x258}, {0x0c8,0x320,0x258}, {0x190,0x320,0x258},
+ {0x258,0x320,0x258}, {0x320,0x320,0x258}, {0x3e8,0x320,0x258},
+ {0x000,0x3e8,0x258}, {0x0c8,0x3e8,0x258}, {0x190,0x3e8,0x258},
+ {0x258,0x3e8,0x258}, {0x320,0x3e8,0x258}, {0x3e8,0x3e8,0x258},
+ {0x000,0x000,0x320}, {0x0c8,0x000,0x320}, {0x190,0x000,0x320},
+ {0x258,0x000,0x320}, {0x320,0x000,0x320}, {0x3e8,0x000,0x320},
+ {0x000,0x0c8,0x320}, {0x0c8,0x0c8,0x320}, {0x190,0x0c8,0x320},
+ {0x258,0x0c8,0x320}, {0x320,0x0c8,0x320}, {0x3e8,0x0c8,0x320},
+ {0x000,0x190,0x320}, {0x0c8,0x190,0x320}, {0x190,0x190,0x320},
+ {0x258,0x190,0x320}, {0x320,0x190,0x320}, {0x3e8,0x190,0x320},
+ {0x000,0x258,0x320}, {0x0c8,0x258,0x320}, {0x190,0x258,0x320},
+ {0x258,0x258,0x320}, {0x320,0x258,0x320}, {0x3e8,0x258,0x320},
+ {0x000,0x320,0x320}, {0x0c8,0x320,0x320}, {0x190,0x320,0x320},
+ {0x258,0x320,0x320}, {0x320,0x320,0x320}, {0x3e8,0x320,0x320},
+ {0x000,0x3e8,0x320}, {0x0c8,0x3e8,0x320}, {0x190,0x3e8,0x320},
+ {0x258,0x3e8,0x320}, {0x320,0x3e8,0x320}, {0x3e8,0x3e8,0x320},
+ {0x000,0x000,0x3e8}, {0x0c8,0x000,0x3e8}, {0x190,0x000,0x3e8},
+ {0x258,0x000,0x3e8}, {0x320,0x000,0x3e8}, {0x3e8,0x000,0x3e8},
+ {0x000,0x0c8,0x3e8}, {0x0c8,0x0c8,0x3e8}, {0x190,0x0c8,0x3e8},
+ {0x258,0x0c8,0x3e8}, {0x320,0x0c8,0x3e8}, {0x3e8,0x0c8,0x3e8},
+ {0x000,0x190,0x3e8}, {0x0c8,0x190,0x3e8}, {0x190,0x190,0x3e8},
+ {0x258,0x190,0x3e8}, {0x320,0x190,0x3e8}, {0x3e8,0x190,0x3e8},
+ {0x000,0x258,0x3e8}, {0x0c8,0x258,0x3e8}, {0x190,0x258,0x3e8},
+ {0x258,0x258,0x3e8}, {0x320,0x258,0x3e8}, {0x3e8,0x258,0x3e8},
+ {0x000,0x320,0x3e8}, {0x0c8,0x320,0x3e8}, {0x190,0x320,0x3e8},
+ {0x258,0x320,0x3e8}, {0x320,0x320,0x3e8}, {0x3e8,0x320,0x3e8},
+ {0x000,0x3e8,0x3e8}, {0x0c8,0x3e8,0x3e8}, {0x190,0x3e8,0x3e8},
+ {0x258,0x3e8,0x3e8}, {0x320,0x3e8,0x3e8}, {0x3e8,0x3e8,0x3e8}
};
#endif
@@ -180,15 +209,16 @@ VdiHdl atari_plot_vdi_handle = -1;
unsigned long atari_plot_flags;
unsigned long atari_font_flags;
-typedef bool (*bitmap_convert_fnc)( struct bitmap * img, int x, int y,
- GRECT * clip, uint32_t bg, uint32_t flags, MFDB *out );
+typedef bool (*bitmap_convert_fnc)(struct bitmap * img, int x, int y, GRECT * clip, uint32_t bg, uint32_t flags, MFDB *out );
static bitmap_convert_fnc bitmap_convert;
+/* exported interface documented in atari/plot.h */
const char* plot_err_str(int i)
{
- return(plot_error_codes[abs(i)]);
+ return (plot_error_codes[abs(i)]);
}
+
/**
* Set line drawing color by passing netsurf XBGR "colour" type.
*
@@ -200,21 +230,22 @@ inline static void vsl_rgbcolor(short vdih, colour cin)
#ifdef WITH_8BPP_SUPPORT
if( vdi_sysinfo.scr_bpp > 8 ) {
#endif
- RGB1000 c; /* a struct with three (RGB) shorts */
- rgb_to_vdi1000( (unsigned char*)&cin, &c);
- vs_color(vdih, OFFSET_CUSTOM_COLOR, (short *)&c);
- vsl_color(vdih, OFFSET_CUSTOM_COLOR);
+ RGB1000 c; /* a struct with three (RGB) shorts */
+ rgb_to_vdi1000( (unsigned char*)&cin, &c);
+ vs_color(vdih, OFFSET_CUSTOM_COLOR, (short *)&c);
+ vsl_color(vdih, OFFSET_CUSTOM_COLOR);
#ifdef WITH_8BPP_SUPPORT
} else {
- if( vdi_sysinfo.scr_bpp >= 4 ){
- vsl_color(vdih, RGB_TO_VDI(cin));
- }
- else
- vsl_color(vdih, BLACK);
+ if( vdi_sysinfo.scr_bpp >= 4 ){
+ vsl_color(vdih, RGB_TO_VDI(cin));
+ }
+ else
+ vsl_color(vdih, BLACK);
}
#endif
}
+
/**
* Set fill color by passing netsurf XBGR "colour" type.
*
@@ -226,23 +257,22 @@ inline static void vsf_rgbcolor(short vdih, colour cin)
#ifdef WITH_8BPP_SUPPORT
if( vdi_sysinfo.scr_bpp > 8 ) {
#endif
- RGB1000 c; /* a struct with three (RGB) shorts */
- rgb_to_vdi1000( (unsigned char*)&cin, &c);
- vs_color( vdih, OFFSET_CUSTOM_COLOR, (short *)&c);
- vsf_color( vdih, OFFSET_CUSTOM_COLOR );
+ RGB1000 c; /* a struct with three (RGB) shorts */
+ rgb_to_vdi1000( (unsigned char*)&cin, &c);
+ vs_color( vdih, OFFSET_CUSTOM_COLOR, (short *)&c);
+ vsf_color( vdih, OFFSET_CUSTOM_COLOR );
#ifdef WITH_8BPP_SUPPORT
} else {
- if( vdi_sysinfo.scr_bpp >= 4 ){
- vsf_color( vdih, RGB_TO_VDI(cin) );
- }
- else
- vsf_color( vdih, WHITE );
+ if( vdi_sysinfo.scr_bpp >= 4 ){
+ vsf_color( vdih, RGB_TO_VDI(cin) );
+ }
+ else
+ vsf_color( vdih, WHITE );
}
#endif
}
-
/**
* Get current visible coords
*/
@@ -255,7 +285,6 @@ inline static void plot_get_visible_grect(GRECT * out)
}
-
/* calculate visible area of framebuffer in coords relative to framebuffer */
/* position */
/* result: */
@@ -280,24 +309,29 @@ inline static void update_visible_rect(void)
common.g_h = frame.g_h = view.h;
if (rc_intersect(&screen, &common)) {
- view.vis_w = common.g_w;
- view.vis_h = common.g_h;
- if (view.x < screen.g_x)
- view.vis_x = frame.g_w - common.g_w;
- else
- view.vis_x = 0;
- if (view.y <screen.g_y)
- view.vis_y = frame.g_h - common.g_h;
- else
- view.vis_y = 0;
+ view.vis_w = common.g_w;
+ view.vis_h = common.g_h;
+ if (view.x < screen.g_x)
+ view.vis_x = frame.g_w - common.g_w;
+ else
+ view.vis_x = 0;
+ if (view.y <screen.g_y)
+ view.vis_y = frame.g_h - common.g_h;
+ else
+ view.vis_y = 0;
} else {
- view.vis_w = view.vis_h = 0;
- view.vis_x = view.vis_y = 0;
+ view.vis_w = view.vis_h = 0;
+ view.vis_x = view.vis_y = 0;
}
}
-/* Returns the visible parts of the box (relative coords within framebuffer),*/
-/* relative to screen coords (normally starting at 0,0 ) */
+
+/**
+ * Returns the visible parts of the box
+ *
+ * The returned values are relative coords within framebuffer,
+ * relative to screen coords (normally starting at 0,0 )
+ */
inline static bool fbrect_to_screen(GRECT box, GRECT * ret)
{
GRECT out, vis, screen;
@@ -314,14 +348,14 @@ inline static bool fbrect_to_screen(GRECT box, GRECT * ret)
vis.g_h = view.h;
if ( !rc_intersect( &screen, &vis ) ) {
- return( false );
+ return( false );
}
vis.g_x = view.w - vis.g_w;
vis.g_y = view.h - vis.g_h;
/* clip box to visible region: */
if( !rc_intersect(&vis, &box) ) {
- return( false );
+ return( false );
}
out.g_x = box.g_x + view.x;
out.g_y = box.g_y + view.y;
@@ -331,8 +365,12 @@ inline static bool fbrect_to_screen(GRECT box, GRECT * ret)
return ( true );
}
-/* copy an rectangle from the plot buffer to screen */
-/* because this is an on-screen plotter, this is an screen to screen copy. */
+
+/**
+ * copy an rectangle from the plot buffer to screen
+ *
+ * because this is an on-screen plotter, this is an screen to screen copy.
+ */
bool plot_copy_rect(GRECT src, GRECT dst)
{
MFDB devmf;
@@ -344,9 +382,9 @@ bool plot_copy_rect(GRECT src, GRECT dst)
plot_get_visible_grect(&vis );
if( !rc_intersect(&vis, &src) )
- return(true);
+ return(true);
if( !rc_intersect(&vis, &dst) )
- return(true);
+ return(true);
src.g_x = view.x + src.g_x;
src.g_y = view.y + src.g_y;
@@ -384,23 +422,25 @@ bool plot_copy_rect(GRECT src, GRECT dst)
return(true);
}
+
/**
* Fill the screen info structure.
*
* \param vdih The handle
* \param[out] info The infor structure to fill.
*/
-static void read_vdi_sysinfo(short vdih, struct s_vdi_sysinfo * info) {
-
- unsigned long cookie_EdDI=0; /** \todo this long is being cast to a pointer */
+static void read_vdi_sysinfo(short vdih, struct s_vdi_sysinfo * info)
+{
+ /** \todo this long is being cast to a pointer */
+ unsigned long cookie_EdDI=0;
short out[300];
memset( info, 0, sizeof(struct s_vdi_sysinfo) );
info->vdi_handle = vdih;
if ( tos_getcookie(C_EdDI, (long *)&cookie_EdDI) == C_NOTFOUND ) {
- info->EdDiVersion = 0;
+ info->EdDiVersion = 0;
} else {
- info->EdDiVersion = EdDI_version( (void *)cookie_EdDI );
+ info->EdDiVersion = EdDI_version( (void *)cookie_EdDI );
}
memset( &out, 0, sizeof(short)*300 );
@@ -408,10 +448,10 @@ static void read_vdi_sysinfo(short vdih, struct s_vdi_sysinfo * info) {
info->scr_w = out[0]+1;
info->scr_h = out[1]+1;
if( out[39] == 2 ) {
- info->scr_bpp = 1;
- info->colors = out[39];
+ info->scr_bpp = 1;
+ info->colors = out[39];
} else {
- info->colors = out[39];
+ info->colors = out[39];
}
memset( &out, 0, sizeof(short)*300 );
@@ -420,31 +460,31 @@ static void read_vdi_sysinfo(short vdih, struct s_vdi_sysinfo * info) {
info->maxpolycoords = out[14];
info->maxintin = out[15];
if( out[30] & 1 ) {
- info->rasterscale = true;
+ info->rasterscale = true;
} else {
- info->rasterscale = false;
+ info->rasterscale = false;
}
switch( info->scr_bpp ) {
case 8:
- info->pixelsize=1;
- break;
+ info->pixelsize=1;
+ break;
case 15:
case 16:
- info->pixelsize=2;
- break;
+ info->pixelsize=2;
+ break;
case 24:
- info->pixelsize=3;
- break;
+ info->pixelsize=3;
+ break;
case 32:
- info->pixelsize=4;
- break;
+ info->pixelsize=4;
+ break;
case 64:
- info->pixelsize=8;
- break;
+ info->pixelsize=8;
+ break;
default:
- info->pixelsize=1;
- break;
+ info->pixelsize=1;
+ break;
}
info->pitch = info->scr_w * info->pixelsize;
@@ -452,75 +492,75 @@ static void read_vdi_sysinfo(short vdih, struct s_vdi_sysinfo * info) {
info->screensize = ( info->scr_w * info->pixelsize ) * info->scr_h;
if( info->EdDiVersion >= EDDI_10 ) {
- memset( &out, 0, sizeof(short)*300 );
- vq_scrninfo(vdih, (short*)&out);
- info->vdiformat = out[0];
- info->clut = out[1];
- info->scr_bpp = out[2];
- info->hicolors = *((unsigned long*) &out[3]);
- if( info->EdDiVersion >= EDDI_11 ) {
- info->pitch = out[5];
- info->screen = (void *) *((unsigned long *) &out[6]);
- }
-
- switch( info->clut ) {
-
- case VDI_CLUT_HARDWARE: {
-
- }
- break;
-
- case VDI_CLUT_SOFTWARE: {
- int component; /* red, green, blue, alpha, overlay */
- int num_bit;
- unsigned short *tmp_p;
-
- /* We can build masks with info here */
- tmp_p = (unsigned short *) &out[16];
- for (component=0; component<5; component++) {
- for (num_bit=0; num_bit<16; num_bit++) {
- unsigned short val;
-
- val = *tmp_p++;
-
- if (val == 0xffff) {
- continue;
- }
-
- switch(component) {
- case 0:
- info->mask_r |= 1<< val;
- break;
- case 1:
- info->mask_g |= 1<< val;
- break;
- case 2:
- info->mask_b |= 1<< val;
- break;
- case 3:
- info->mask_a |= 1<< val;
- break;
- }
- }
- }
- }
-
- /* Remove lower green bits for Intel endian screen */
- if ((info->mask_g == ((7<<13)|3)) || (info->mask_g == ((7<<13)|7))) {
- info->mask_g &= ~(7<<13);
- }
- break;
-
- case VDI_CLUT_NONE:
- break;
- }
+ memset( &out, 0, sizeof(short)*300 );
+ vq_scrninfo(vdih, (short*)&out);
+ info->vdiformat = out[0];
+ info->clut = out[1];
+ info->scr_bpp = out[2];
+ info->hicolors = *((unsigned long*) &out[3]);
+ if( info->EdDiVersion >= EDDI_11 ) {
+ info->pitch = out[5];
+ info->screen = (void *) *((unsigned long *) &out[6]);
+ }
+
+ switch( info->clut ) {
+
+ case VDI_CLUT_HARDWARE:
+ break;
+
+ case VDI_CLUT_SOFTWARE:
+ {
+ int component; /* red, green, blue, alpha, overlay */
+ int num_bit;
+ unsigned short *tmp_p;
+
+ /* We can build masks with info here */
+ tmp_p = (unsigned short *) &out[16];
+ for (component=0; component<5; component++) {
+ for (num_bit=0; num_bit<16; num_bit++) {
+ unsigned short val;
+
+ val = *tmp_p++;
+
+ if (val == 0xffff) {
+ continue;
+ }
+
+ switch(component) {
+ case 0:
+ info->mask_r |= 1<< val;
+ break;
+ case 1:
+ info->mask_g |= 1<< val;
+ break;
+ case 2:
+ info->mask_b |= 1<< val;
+ break;
+ case 3:
+ info->mask_a |= 1<< val;
+ break;
+ }
+ }
+ }
+ }
+
+ /* Remove lower green bits for Intel endian screen */
+ if ((info->mask_g == ((7<<13)|3)) ||
+ (info->mask_g == ((7<<13)|7))) {
+ info->mask_g &= ~(7<<13);
+ }
+ break;
+
+ case VDI_CLUT_NONE:
+ break;
+ }
}
}
-/*
- Convert an RGB color to an VDI Color
-*/
+/**
+ * Convert an RGB color to an VDI Color
+ */
inline void rgb_to_vdi1000(unsigned char * in, RGB1000 *out)
{
double r = ((double)in[3]/255); /* prozentsatz red */
@@ -532,6 +572,7 @@ inline void rgb_to_vdi1000(unsigned char * in, RGB1000 *out)
return;
}
+
inline void vdi1000_to_rgb(unsigned short * in, unsigned char * out)
{
double r = ((double)in[0]/1000); /* prozentsatz red */
@@ -548,7 +589,8 @@ inline void vdi1000_to_rgb(unsigned short * in, unsigned char * out)
/**
* Set pixel within an 8 bit VDI standard bitmap.
*/
-inline static void set_stdpx( MFDB * dst, int wdplanesz, int x, int y, unsigned char val )
+inline static void
+set_stdpx( MFDB * dst, int wdplanesz, int x, int y, unsigned char val )
{
short * buf;
short whichbit = (1<<(15-(x%16)));
@@ -580,6 +622,7 @@ inline static void set_stdpx( MFDB * dst, int wdplanesz, int x, int y, unsigned
*buf = (val&(1<<7)) ? ((*buf)|(whichbit)) : ((*buf)&~(whichbit));
}
+
/**
* Read pixel from an 8 bit VDI standard bitmap.
*/
@@ -593,42 +636,42 @@ inline static unsigned char get_stdpx(MFDB * dst, int wdplanesz, int x, int y)
buf += ((dst->fd_wdwidth*(y))+(x>>4));
if( *buf & whichbit )
- ret |= 1;
+ ret |= 1;
buf += wdplanesz;
if( *buf & whichbit )
- ret |= 2;
+ ret |= 2;
buf += wdplanesz;
if( *buf & whichbit )
- ret |= 4;
+ ret |= 4;
buf += wdplanesz;
if( *buf & whichbit )
- ret |= 8;
+ ret |= 8;
buf += wdplanesz;
if( *buf & whichbit )
- ret |= 16;
+ ret |= 16;
buf += wdplanesz;
if( *buf & whichbit )
- ret |= 32;
+ ret |= 32;
buf += wdplanesz;
if( *buf & whichbit )
- ret |= 64;
+ ret |= 64;
buf += wdplanesz;
if( *buf & whichbit )
- ret |= 128;
+ ret |= 128;
return( ret );
}
-/*
- Convert an RGB color into an index into the 216 colors web pallette
-*/
+/**
+ * Convert an RGB color into an index into the 216 colors web pallette
+ */
inline short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b)
{
short i;
@@ -640,24 +683,24 @@ inline short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b)
diff_b = abs(r-b);
diff_c = abs(r-b);
if( diff_a < 2 && diff_b < 2 && diff_c < 2 ) {
- if( (r!=0XFF) && (g!=0XFF) && (b!=0XFF) ) {
- if( ((r&0xF0)>>4) != 0 )
- //printf("conv gray: %x -> %d\n", ((r&0xF0)>>4) , (OFFSET_CUST_PAL) + ((r&0xF0)>>4) );
- return( (OFFSET_CUST_PAL - OFFSET_WEB_PAL) + ((r&0xF0)>>4) );
- }
+ if( (r!=0XFF) && (g!=0XFF) && (b!=0XFF) ) {
+ if( ((r&0xF0)>>4) != 0 )
+ //printf("conv gray: %x -> %d\n", ((r&0xF0)>>4) , (OFFSET_CUST_PAL) + ((r&0xF0)>>4) );
+ return( (OFFSET_CUST_PAL - OFFSET_WEB_PAL) + ((r&0xF0)>>4) );
+ }
}
/* convert each 8bit color to 6bit web color: */
for( i=0; i<3; i++) {
- if(0 == rgb[i] % web_std_colors[1] ) {
- tval[i] = rgb[i] / web_std_colors[1];
- } else {
- int pos = ((short)rgb[i] / web_std_colors[1]);
- if( abs(rgb[i] - web_std_colors[pos]) > abs(rgb[i] - web_std_colors[pos+1]) )
- tval[i] = pos+1;
- else
- tval[i] = pos;
- }
+ if(0 == rgb[i] % web_std_colors[1] ) {
+ tval[i] = rgb[i] / web_std_colors[1];
+ } else {
+ int pos = ((short)rgb[i] / web_std_colors[1]);
+ if( abs(rgb[i] - web_std_colors[pos]) > abs(rgb[i] - web_std_colors[pos+1]) )
+ tval[i] = pos+1;
+ else
+ tval[i] = pos;
+ }
}
return(tval[2]*36+tval[1]*6+tval[0]);
}
@@ -692,6 +735,7 @@ static void dump_vdi_info(short vdih)
printf("};\n");
}
+
/**
* Create an snapshot of the screen image in device format.
*/
@@ -702,29 +746,29 @@ static MFDB * snapshot_create_native_mfdb(int x, int y, int w, int h)
/* allocate memory for the snapshot */
{
- int scr_stride = MFDB_STRIDE( w );
- int scr_size = ( ((scr_stride >> 3) * h) * vdi_sysinfo.scr_bpp );
- if(size_buf_scr == 0 ){
- /* init screen mfdb */
- buf_scr.fd_addr = malloc( scr_size );
- size_buf_scr = scr_size;
- } else {
- if( scr_size >size_buf_scr ) {
- buf_scr.fd_addr = realloc(
- buf_scr.fd_addr, scr_size
- );
- size_buf_scr = scr_size;
- }
- }
- if(buf_scr.fd_addr == NULL ) {
- size_buf_scr = 0;
- return( NULL );
- }
- buf_scr.fd_nplanes = vdi_sysinfo.scr_bpp;
- buf_scr.fd_w = scr_stride;
- buf_scr.fd_h = h;
- buf_scr.fd_wdwidth = scr_stride >> 4;
- assert(buf_scr.fd_addr != NULL );
+ int scr_stride = MFDB_STRIDE( w );
+ int scr_size = ( ((scr_stride >> 3) * h) * vdi_sysinfo.scr_bpp );
+ if(size_buf_scr == 0 ){
+ /* init screen mfdb */
+ buf_scr.fd_addr = malloc( scr_size );
+ size_buf_scr = scr_size;
+ } else {
+ if( scr_size >size_buf_scr ) {
+ buf_scr.fd_addr = realloc(
+ buf_scr.fd_addr, scr_size
+ );
+ size_buf_scr = scr_size;
+ }
+ }
+ if(buf_scr.fd_addr == NULL ) {
+ size_buf_scr = 0;
+ return( NULL );
+ }
+ buf_scr.fd_nplanes = vdi_sysinfo.scr_bpp;
+ buf_scr.fd_w = scr_stride;
+ buf_scr.fd_h = h;
+ buf_scr.fd_wdwidth = scr_stride >> 4;
+ assert(buf_scr.fd_addr != NULL );
}
init_mfdb( 0, w, h, 0, &scr );
pxy[0] = x;
@@ -736,18 +780,27 @@ static MFDB * snapshot_create_native_mfdb(int x, int y, int w, int h)
pxy[6] = w-1;
pxy[7] = h-1;
vro_cpyfm(
- atari_plot_vdi_handle, S_ONLY, (short*)&pxy,
- &scr, &buf_scr
- );
+ atari_plot_vdi_handle, S_ONLY, (short*)&pxy,
+ &scr, &buf_scr
+ );
return( &buf_scr );
}
-/*
+/**
* Create an snapshot of the screen in netsurf ABGR format
+ *
+ * This creates an snapshot in RGBA format (NetSurf's native format)
+ *
+ * Capture the screen at x,y location
+ *
+ * \param x absolute screen coords
+ * \param y absolute screen coords
+ * \param w width
+ * \param h height
*/
-static struct bitmap * snapshot_create(int x, int y, int w, int h)
+static struct bitmap *snapshot_create(int x, int y, int w, int h)
{
int err;
MFDB * native;
@@ -764,37 +817,37 @@ static struct bitmap * snapshot_create(int x, int y, int w, int h)
native = snapshot_create_native_mfdb(x, y, w, h );
if(vfmt.bits == 32 )
- goto no_copy;
+ goto no_copy;
/* allocate buffer for result bitmap: */
if(buf_scr_compat == NULL ) {
- buf_scr_compat = atari_bitmap_create(w, h, 0);
+ buf_scr_compat = atari_bitmap_create(w, h, 0);
} else {
- buf_scr_compat = atari_bitmap_realloc( w, h,
- buf_scr_compat->bpp,
- w *buf_scr_compat->bpp,
- BITMAP_GROW,
- buf_scr_compat );
+ buf_scr_compat = atari_bitmap_realloc( w, h,
+ buf_scr_compat->bpp,
+ w *buf_scr_compat->bpp,
+ BITMAP_GROW,
+ buf_scr_compat );
}
/* convert screen buffer to ns format: */
err = Hermes_ConverterRequest( hermes_cnv_h,
- &vfmt,
- &nsfmt
- );
+ &vfmt,
+ &nsfmt
+ );
assert( err != 0 );
err = Hermes_ConverterCopy( hermes_cnv_h,
- native->fd_addr,
- 0, /* x src coord of top left in pixel coords */
- 0, /* y src coord of top left in pixel coords */
- w, h,
- native->fd_w * vdi_sysinfo.pixelsize, /* stride as bytes */
- buf_scr_compat->pixdata,
- 0, /* x dst coord of top left in pixel coords */
- 0, /* y dst coord of top left in pixel coords */
- w, h,
- atari_bitmap_get_rowstride(buf_scr_compat) /* stride as bytes */
- );
+ native->fd_addr,
+ 0, /* x src coord of top left in pixel coords */
+ 0, /* y src coord of top left in pixel coords */
+ w, h,
+ native->fd_w * vdi_sysinfo.pixelsize, /* stride as bytes */
+ buf_scr_compat->pixdata,
+ 0, /* x dst coord of top left in pixel coords */
+ 0, /* y dst coord of top left in pixel coords */
+ w, h,
+ atari_bitmap_get_rowstride(buf_scr_compat) /* stride as bytes */
+ );
assert( err != 0 );
return( (struct bitmap * )buf_scr_compat );
@@ -808,59 +861,61 @@ no_copy:
uint32_t row, col;
for (row = 0; row<(uint32_t)h; row++) {
- // fd_w matches stride!
- uint32_t *rowptr = ((uint32_t*)native->fd_addr + ((row*native->fd_w)));
- for (col=0; col<(uint32_t)w; col++) {
- *(rowptr+col) = (*(rowptr+col)<<8);
- }
+ // fd_w matches stride!
+ uint32_t *rowptr = ((uint32_t*)native->fd_addr + ((row*native->fd_w)));
+ for (col=0; col<(uint32_t)w; col++) {
+ *(rowptr+col) = (*(rowptr+col)<<8);
+ }
}
return( &snapshot );
}
+
/**
* Notify the snapshot interface that the last snapshot is no longer in use.
*/
static void snapshot_suspend(void)
{
if(size_buf_scr > CONV_KEEP_LIMIT ) {
- buf_scr.fd_addr = realloc(
- buf_scr.fd_addr, CONV_KEEP_LIMIT
- );
- if(buf_scr.fd_addr != NULL ) {
- size_buf_scr = CONV_KEEP_LIMIT;
- } else {
- size_buf_scr = 0;
- }
+ buf_scr.fd_addr = realloc(
+ buf_scr.fd_addr, CONV_KEEP_LIMIT
+ );
+ if(buf_scr.fd_addr != NULL ) {
+ size_buf_scr = CONV_KEEP_LIMIT;
+ } else {
+ size_buf_scr = 0;
+ }
}
#ifdef WITH_8BPP_SUPPORT
if(size_buf_std > CONV_KEEP_LIMIT ) {
- buf_std.fd_addr = realloc(
- buf_std.fd_addr, CONV_KEEP_LIMIT
- );
- if(buf_std.fd_addr != NULL ) {
- size_buf_std = CONV_KEEP_LIMIT;
- } else {
- size_buf_std = 0;
- }
+ buf_std.fd_addr = realloc(
+ buf_std.fd_addr, CONV_KEEP_LIMIT
+ );
+ if(buf_std.fd_addr != NULL ) {
+ size_buf_std = CONV_KEEP_LIMIT;
+ } else {
+ size_buf_std = 0;
+ }
}
#endif
if(buf_scr_compat != NULL ) {
- size_t bs = atari_bitmap_buffer_size(buf_scr_compat );
- if( bs > CONV_KEEP_LIMIT ) {
- int w = 0;
- int h = 1;
- w = (CONV_KEEP_LIMIT /buf_scr_compat->bpp);
- assert( CONV_KEEP_LIMIT == w*buf_scr_compat->bpp );
- buf_scr_compat = atari_bitmap_realloc( w, h,
- buf_scr_compat->bpp,
- CONV_KEEP_LIMIT, BITMAP_SHRINK,buf_scr_compat
- );
- }
+ size_t bs = atari_bitmap_buffer_size(buf_scr_compat );
+ if( bs > CONV_KEEP_LIMIT ) {
+ int w = 0;
+ int h = 1;
+ w = (CONV_KEEP_LIMIT /buf_scr_compat->bpp);
+ assert( CONV_KEEP_LIMIT == w*buf_scr_compat->bpp );
+ buf_scr_compat = atari_bitmap_realloc( w, h,
+ buf_scr_compat->bpp,
+ CONV_KEEP_LIMIT, BITMAP_SHRINK,buf_scr_compat
+ );
+ }
}
}
+
/**
* Shut down the snapshot interface.
*/
@@ -869,7 +924,7 @@ static void snapshot_destroy(void)
free(buf_scr.fd_addr);
if( buf_scr_compat != NULL) {
- atari_bitmap_destroy(buf_scr_compat);
+ atari_bitmap_destroy(buf_scr_compat);
}
buf_scr.fd_addr = NULL;
@@ -890,17 +945,19 @@ inline static uint32_t ablend(uint32_t pixel, uint32_t scrpixel)
pixel >>= 8;
scrpixel >>= 8;
rb = ((pixel & 0xFF00FF) * opacity +
- (scrpixel & 0xFF00FF) * transp) >> 8;
+ (scrpixel & 0xFF00FF) * transp) >> 8;
g = ((pixel & 0x00FF00) * opacity +
- (scrpixel & 0x00FF00) * transp) >> 8;
+ (scrpixel & 0x00FF00) * transp) >> 8;
return ((rb & 0xFF00FF) | (g & 0xFF00)) << 8;
}
-/*
- Alpha blends an image, using one pixel as the background.
- The bitmap receives the result.
-*/
+
+/**
+ * Alpha blends an image, using one pixel as the background.
+ *
+ * The bitmap receives the result.
+ */
inline static bool ablend_pixel(struct bitmap * img, uint32_t bg, GRECT * clip)
{
uint32_t * imgrow;
@@ -909,22 +966,25 @@ inline static bool ablend_pixel(struct bitmap * img, uint32_t bg, GRECT * clip)
img_stride= atari_bitmap_get_rowstride(img);
for( img_y = 0; img_y < clip->g_h; img_y++) {
- imgrow = (uint32_t *)(img->pixdata + (img_stride * img_y));
- for( img_x = 0; img_x < clip->g_w; img_x++ ) {
- imgrow[img_x] = ablend( imgrow[img_x], bg );
- }
+ imgrow = (uint32_t *)(img->pixdata + (img_stride * img_y));
+ for( img_x = 0; img_x < clip->g_w; img_x++ ) {
+ imgrow[img_x] = ablend( imgrow[img_x], bg );
+ }
}
return(true);
}
-/*
- Aplha blends the foreground image (img) onto the
- background images (bg). The background receives the blended
- image pixels.
-*/
-inline static bool ablend_bitmap( struct bitmap * img, struct bitmap * bg,
- GRECT * img_clip, GRECT * bg_clip )
+/**
+ * Aplha blends the foreground image onto thebackground images.
+ *
+ * The background receives the blended image pixels.
+ */
+inline static bool
+ablend_bitmap(struct bitmap *img,
+ struct bitmap *bg,
+ GRECT *img_clip,
+ GRECT * bg_clip )
{
uint32_t * imgrow;
uint32_t * screenrow;
@@ -935,29 +995,29 @@ inline static bool ablend_bitmap( struct bitmap * img, struct bitmap * bg,
bg_stride = atari_bitmap_get_rowstride(bg);
for( img_y = img_clip->g_y, bg_y = 0; bg_y < img_clip->g_h; bg_y++, img_y++) {
- imgrow = (uint32_t *)(img->pixdata + (img_stride * img_y));
- screenrow = (uint32_t *)(bg->pixdata + (bg_stride * bg_y));
- for( img_x = img_clip->g_x, bg_x = 0; bg_x < img_clip->g_w; bg_x++, img_x++ ) {
-
- // when the pixel isn't fully transparent,...:
- if( (imgrow[img_x] & 0x0FF) != 0 ){
- screenrow[bg_x] = ablend( imgrow[img_x], screenrow[bg_x]);
- }
-
- // FIXME, maybe this loop would be faster??:
- // ---
- //if( (imgrow[img_x] & 0x0FF) != 0xFF ){
- // imgrow[bg_x] = ablend( imgrow[img_x], screenrow[bg_x]);
- //}
-
- // or maybe even this???
- // ---
- //if( (imgrow[img_x] & 0x0FF) == 0xFF ){
- // screenrow[bg_x] = imgrow[img_x];
- //} else if( (imgrow[img_x] & 0x0FF) != 0x00 ) {
- // screenrow[bg_x] = ablend( imgrow[img_x], screenrow[bg_x]);
- //}
- }
+ imgrow = (uint32_t *)(img->pixdata + (img_stride * img_y));
+ screenrow = (uint32_t *)(bg->pixdata + (bg_stride * bg_y));
+ for( img_x = img_clip->g_x, bg_x = 0; bg_x < img_clip->g_w; bg_x++, img_x++ ) {
+
+ // when the pixel isn't fully transparent,...:
+ if( (imgrow[img_x] & 0x0FF) != 0 ){
+ screenrow[bg_x] = ablend( imgrow[img_x], screenrow[bg_x]);
+ }
+
+ // FIXME, maybe this loop would be faster??:
+ // ---
+ //if( (imgrow[img_x] & 0x0FF) != 0xFF ){
+ // imgrow[bg_x] = ablend( imgrow[img_x], screenrow[bg_x]);
+ //}
+
+ // or maybe even this???
+ // ---
+ //if( (imgrow[img_x] & 0x0FF) == 0xFF ){
+ // screenrow[bg_x] = imgrow[img_x];
+ //} else if( (imgrow[img_x] & 0x0FF) != 0x00 ) {
+ // screenrow[bg_x] = ablend( imgrow[img_x], screenrow[bg_x]);
+ //}
+ }
}
return(false);
}
@@ -972,30 +1032,30 @@ static MFDB * snapshot_create_std_mfdb(int x, int y, int w, int h)
{
/* allocate memory for the snapshot */
{
- int scr_stride = MFDB_STRIDE( w );
- int scr_size = ( ((scr_stride >> 3) * h) * vdi_sysinfo.scr_bpp );
- if(size_buf_std == 0 ){
- /* init screen mfdb */
- buf_std.fd_addr = malloc( scr_size );
- size_buf_std = scr_size;
- } else {
- if( scr_size >size_buf_std ) {
- buf_std.fd_addr = realloc(
- buf_std.fd_addr, scr_size
- );
- size_buf_std = scr_size;
- }
- }
- if(buf_std.fd_addr == NULL ) {
- size_buf_std = 0;
- return( NULL );
- }
- buf_std.fd_nplanes = 8;
- buf_std.fd_w = scr_stride;
- buf_std.fd_h = h;
- buf_std.fd_stand = 1;
- buf_std.fd_wdwidth = scr_stride >> 4;
- assert(buf_std.fd_addr != NULL );
+ int scr_stride = MFDB_STRIDE( w );
+ int scr_size = ( ((scr_stride >> 3) * h) * vdi_sysinfo.scr_bpp );
+ if(size_buf_std == 0 ){
+ /* init screen mfdb */
+ buf_std.fd_addr = malloc( scr_size );
+ size_buf_std = scr_size;
+ } else {
+ if( scr_size >size_buf_std ) {
+ buf_std.fd_addr = realloc(
+ buf_std.fd_addr, scr_size
+ );
+ size_buf_std = scr_size;
+ }
+ }
+ if(buf_std.fd_addr == NULL ) {
+ size_buf_std = 0;
+ return( NULL );
+ }
+ buf_std.fd_nplanes = 8;
+ buf_std.fd_w = scr_stride;
+ buf_std.fd_h = h;
+ buf_std.fd_stand = 1;
+ buf_std.fd_wdwidth = scr_stride >> 4;
+ assert(buf_std.fd_addr != NULL );
}
MFDB * native = snapshot_create_native_mfdb(x,y,w,h );
assert( native );
@@ -1004,6 +1064,7 @@ static MFDB * snapshot_create_std_mfdb(int x, int y, int w, int h)
return( &buf_std );
}
+
/**
* Convert an bitmap to an 8 bit device dependant MFDB
* \param img the bitmap (only tested with 32bit bitmaps)
@@ -1015,9 +1076,14 @@ static MFDB * snapshot_create_std_mfdb(int x, int y, int w, int h)
* \param out receives the converted bitmap (still owned by the plot API)
*
*/
-static bool bitmap_convert_8(struct bitmap * img, int x,
- int y, GRECT * clip, uint32_t bg, uint32_t flags,
- MFDB *out )
+static bool
+bitmap_convert_8(struct bitmap *img,
+ int x,
+ int y,
+ GRECT *clip,
+ uint32_t bg,
+ uint32_t flags,
+ MFDB *out)
{
MFDB native;
MFDB stdform;
@@ -1029,11 +1095,11 @@ static bool bitmap_convert_8(struct bitmap * img, int x,
bool opaque = atari_bitmap_get_opaque( img );
if( opaque == false ){
- if( ( (atari_plot_flags & PLOT_FLAG_TRANS) == 0)
- &&
- ((flags & (BITMAPF_MONOGLYPH|BITMAPF_BUFFER_NATIVE))==0) ){
- opaque = true;
- }
+ if( ( (atari_plot_flags & PLOT_FLAG_TRANS) == 0)
+ &&
+ ((flags & (BITMAPF_MONOGLYPH|BITMAPF_BUFFER_NATIVE))==0) ){
+ opaque = true;
+ }
}
assert( clip->g_h > 0 );
@@ -1046,53 +1112,53 @@ static bool bitmap_convert_8(struct bitmap * img, int x,
// the bitmap is fully opaque
if( (opaque == true) || (flags & BITMAPF_BUFFER_NATIVE ) ){
- if( img->converted == true ){
- *out = img->native;
- return( 0 );
- }
- if( ( flags & BITMAPF_MONOGLYPH ) == 0 ){
- cache = true;
- }
+ if( img->converted == true ){
+ *out = img->native;
+ return( 0 );
+ }
+ if( ( flags & BITMAPF_MONOGLYPH ) == 0 ){
+ cache = true;
+ }
}
if( ( flags & BITMAPF_MONOGLYPH ) != 0 ){
- assert(cache == false);
+ assert(cache == false);
}
/* (re)allocate buffer for out image: */
/* altough the buffer is named "buf_packed" on 8bit systems */
/* it's not... */
if( cache == false ){
- // the size of the output will match the size of the clipping:
- dststride = MFDB_STRIDE( clip->g_w );
- dstsize = ( ((dststride >> 3) * clip->g_h) * atari_plot_bpp_virt);
- if (dstsize > size_buf_packed) {
- int blocks = (dstsize / (CONV_BLOCK_SIZE-1))+1;
- void *buf;
- if (buf_packed == NULL) {
- buf = malloc( blocks * CONV_BLOCK_SIZE);
- } else {
- buf = realloc(buf_packed, blocks * CONV_BLOCK_SIZE);
- }
- if (buf == NULL) {
- return( 0-ERR_NO_MEM );
- }
- buf_packed = buf;
- size_buf_packed = blocks * CONV_BLOCK_SIZE;
- }
- native.fd_addr = buf_packed;
+ // the size of the output will match the size of the clipping:
+ dststride = MFDB_STRIDE( clip->g_w );
+ dstsize = ( ((dststride >> 3) * clip->g_h) * atari_plot_bpp_virt);
+ if (dstsize > size_buf_packed) {
+ int blocks = (dstsize / (CONV_BLOCK_SIZE-1))+1;
+ void *buf;
+ if (buf_packed == NULL) {
+ buf = malloc( blocks * CONV_BLOCK_SIZE);
+ } else {
+ buf = realloc(buf_packed, blocks * CONV_BLOCK_SIZE);
+ }
+ if (buf == NULL) {
+ return( 0-ERR_NO_MEM );
+ }
+ buf_packed = buf;
+ size_buf_packed = blocks * CONV_BLOCK_SIZE;
+ }
+ native.fd_addr = buf_packed;
}
else {
- // the output image will be completly saved, so size of the output
- // image will match the input image size.
- dststride = MFDB_STRIDE( bw );
- dstsize = ( ((dststride >> 3) * bh) * atari_plot_bpp_virt);
- assert( out->fd_addr == NULL );
- native.fd_addr = malloc( dstsize );
- if (native.fd_addr == NULL){
- if (scrbuf != NULL)
- atari_bitmap_destroy(scrbuf);
- return( 0-ERR_NO_MEM );
- }
+ // the output image will be completly saved, so size of the output
+ // image will match the input image size.
+ dststride = MFDB_STRIDE( bw );
+ dstsize = ( ((dststride >> 3) * bh) * atari_plot_bpp_virt);
+ assert( out->fd_addr == NULL );
+ native.fd_addr = malloc( dstsize );
+ if (native.fd_addr == NULL){
+ if (scrbuf != NULL)
+ atari_bitmap_destroy(scrbuf);
+ return( 0-ERR_NO_MEM );
+ }
}
@@ -1103,29 +1169,29 @@ static bool bitmap_convert_8(struct bitmap * img, int x,
*/
// realloc mem for stdform
if( opaque == false ){
- // point image to snapshot buffer, otherwise allocate mem
- MFDB * bg = snapshot_create_std_mfdb(x, y, clip->g_w, clip->g_h);
- stdform.fd_addr = bg->fd_addr;
- bh = clip->g_h;
+ // point image to snapshot buffer, otherwise allocate mem
+ MFDB * bg = snapshot_create_std_mfdb(x, y, clip->g_w, clip->g_h);
+ stdform.fd_addr = bg->fd_addr;
+ bh = clip->g_h;
} else {
- if (dstsize > size_buf_planar) {
- int blocks = (dstsize / (CONV_BLOCK_SIZE-1))+1;
- void *buf;
- if (buf_planar == NULL) {
- buf = malloc(blocks * CONV_BLOCK_SIZE);
- } else {
- buf = realloc(buf_planar, blocks * CONV_BLOCK_SIZE);
- }
- if (buf == NULL ) {
- if (cache) {
- free(native.fd_addr);
- }
- return( 0-ERR_NO_MEM );
- }
- buf_planar = buf;
- size_buf_planar = blocks * CONV_BLOCK_SIZE;
- }
- stdform.fd_addr = buf_planar;
+ if (dstsize > size_buf_planar) {
+ int blocks = (dstsize / (CONV_BLOCK_SIZE-1))+1;
+ void *buf;
+ if (buf_planar == NULL) {
+ buf = malloc(blocks * CONV_BLOCK_SIZE);
+ } else {
+ buf = realloc(buf_planar, blocks * CONV_BLOCK_SIZE);
+ }
+ if (buf == NULL ) {
+ if (cache) {
+ free(native.fd_addr);
+ }
+ return( 0-ERR_NO_MEM );
+ }
+ buf_planar = buf;
+ size_buf_planar = blocks * CONV_BLOCK_SIZE;
+ }
+ stdform.fd_addr = buf_planar;
}
stdform.fd_w = dststride;
stdform.fd_h = bh;
@@ -1143,67 +1209,67 @@ static bool bitmap_convert_8(struct bitmap * img, int x,
int wdplanesize = stdform.fd_wdwidth*stdform.fd_h;
if( opaque == false ){
- // apply transparency and convert to vdi std format
- unsigned long bgcol = 0;
- unsigned char prev_col = 0;
- for( y=0; y<clip->g_h; y++ ){
- row = (uint32_t *)(img->pixdata + (img_stride * (y+clip->g_y)));
- for( x=0; x<clip->g_w; x++ ){
- pixel = row[x+clip->g_x];
- if( (pixel&0xFF) == 0 ){
- continue;
- }
- if( (pixel&0xFF) < 0xF0 ){
- col = get_stdpx( &stdform, wdplanesize,x,y );
- if( (col != prev_col) || (y == 0) )
- bgcol = (((rgb_lookup[col][2] << 16) | (rgb_lookup[col][1] << 8) | (rgb_lookup[col][0]))<<8);
- if( prev_col != col || prev_pixel != pixel ){
- prev_col = col;
- pixel = ablend( pixel, bgcol );
- prev_pixel = pixel;
- pixel = pixel >> 8;
- /* convert pixel value to vdi color index: */
- col = ( ((pixel&0xFF)<<16)
- | (pixel&0xFF00)
- | ((pixel&0xFF0000)>>16) );
- val = RGB_TO_VDI( col );
- }
- set_stdpx( &stdform, wdplanesize, x, y, val );
- } else {
- if( pixel != prev_pixel ){
- /* convert pixel value to vdi color index: */
- pixel = pixel >> 8;
- col = ( ((pixel&0xFF)<<16)
- | (pixel&0xFF00)
- | ((pixel&0xFF0000)>>16) );
- val = RGB_TO_VDI( col );
- prev_pixel = pixel;
- }
- set_stdpx( &stdform, wdplanesize, x, y, val );
- }
- }
- }
- // adjust output position:
- clip->g_x = 0;
- clip->g_y = 0;
+ // apply transparency and convert to vdi std format
+ unsigned long bgcol = 0;
+ unsigned char prev_col = 0;
+ for( y=0; y<clip->g_h; y++ ){
+ row = (uint32_t *)(img->pixdata + (img_stride * (y+clip->g_y)));
+ for( x=0; x<clip->g_w; x++ ){
+ pixel = row[x+clip->g_x];
+ if( (pixel&0xFF) == 0 ){
+ continue;
+ }
+ if( (pixel&0xFF) < 0xF0 ){
+ col = get_stdpx( &stdform, wdplanesize,x,y );
+ if( (col != prev_col) || (y == 0) )
+ bgcol = (((rgb_lookup[col][2] << 16) | (rgb_lookup[col][1] << 8) | (rgb_lookup[col][0]))<<8);
+ if( prev_col != col || prev_pixel != pixel ){
+ prev_col = col;
+ pixel = ablend( pixel, bgcol );
+ prev_pixel = pixel;
+ pixel = pixel >> 8;
+ /* convert pixel value to vdi color index: */
+ col = ( ((pixel&0xFF)<<16)
+ | (pixel&0xFF00)
+ | ((pixel&0xFF0000)>>16) );
+ val = RGB_TO_VDI( col );
+ }
+ set_stdpx( &stdform, wdplanesize, x, y, val );
+ } else {
+ if( pixel != prev_pixel ){
+ /* convert pixel value to vdi color index: */
+ pixel = pixel >> 8;
+ col = ( ((pixel&0xFF)<<16)
+ | (pixel&0xFF00)
+ | ((pixel&0xFF0000)>>16) );
+ val = RGB_TO_VDI( col );
+ prev_pixel = pixel;
+ }
+ set_stdpx( &stdform, wdplanesize, x, y, val );
+ }
+ }
+ }
+ // adjust output position:
+ clip->g_x = 0;
+ clip->g_y = 0;
} else {
- // convert the whole image data to vdi std format.
- for( y=0; y < bh; y++ ){
- row = (uint32_t *)(img->pixdata + (img_stride * y));
- for( x=0; x < bw; x++ ){
- pixel = row[x];
- if( pixel != prev_pixel ){
- /* convert pixel value to vdi color index: */
- pixel = pixel >> 8;
- col = ( ((pixel&0xFF)<<16)
- | (pixel&0xFF00)
- | ((pixel&0xFF0000)>>16) );
- val = RGB_TO_VDI( col );
- prev_pixel = pixel;
- }
- set_stdpx( &stdform, wdplanesize, x, y, val );
- }
- }
+ // convert the whole image data to vdi std format.
+ for( y=0; y < bh; y++ ){
+ row = (uint32_t *)(img->pixdata + (img_stride * y));
+ for( x=0; x < bw; x++ ){
+ pixel = row[x];
+ if( pixel != prev_pixel ){
+ /* convert pixel value to vdi color index: */
+ pixel = pixel >> 8;
+ col = ( ((pixel&0xFF)<<16)
+ | (pixel&0xFF00)
+ | ((pixel&0xFF0000)>>16) );
+ val = RGB_TO_VDI( col );
+ prev_pixel = pixel;
+ }
+ set_stdpx( &stdform, wdplanesize, x, y, val );
+ }
+ }
}
// convert into native format:
@@ -1216,8 +1282,8 @@ static bool bitmap_convert_8(struct bitmap * img, int x,
vr_trnfm(atari_plot_vdi_handle, &stdform, &native );
*out = native;
if( cache == true ){
- img->native = native;
- img->converted = true;
+ img->native = native;
+ img->converted = true;
}
return(0);
@@ -1225,24 +1291,30 @@ static bool bitmap_convert_8(struct bitmap * img, int x,
#endif
-/*
- *
+/**
* Convert bitmap to the native screen format
- * img: the bitmap
- * x: coordinate where the bitmap REGION (described in clip)
+ *
+ * \param img the bitmap
+ * \param x coordinate where the bitmap REGION (described in clip)
* shall be drawn (screen coords)
- * y: coordinate where the bitmap REGION (described in clip)
+ * \param y coordinate where the bitmap REGION (described in clip)
* shall be drawn (screen coords)
- * clip: which area of the bitmap shall be drawn
- * bg: background color
- * flags: blit flags
- * out: the result MFDB
+ * \param clip which area of the bitmap shall be drawn
+ * \param bg background color
+ * \param flags blit flags
+ * \param out the result MFDB
*/
-static bool bitmap_convert_tc(struct bitmap * img, int x, int y,
- GRECT * clip, uint32_t bg, uint32_t flags, MFDB *out )
+static bool
+bitmap_convert_tc(struct bitmap *img,
+ int x,
+ int y,
+ GRECT *clip,
+ uint32_t bg,
+ uint32_t flags,
+ MFDB *out)
{
- int dststride; /* stride of dest. image */
- int dstsize; /* size of dest. in byte */
+ int dststride; /* stride of dest. image */
+ int dstsize; /* size of dest. in byte */
int err;
int bw, bh;
struct bitmap * scrbuf = NULL;
@@ -1250,15 +1322,14 @@ static bool bitmap_convert_tc(struct bitmap * img, int x, int y,
bool cache = ( flags & BITMAPF_BUFFER_NATIVE );
bool opaque = atari_bitmap_get_opaque( img );
- if( opaque == false ){
- if( ( (atari_plot_flags & PLOT_FLAG_TRANS) == 0)
- &&
- ((flags & (BITMAPF_MONOGLYPH|BITMAPF_BUFFER_NATIVE))==0) ){
- opaque = true;
- }
+ if (opaque == false ) {
+ if( ( (atari_plot_flags & PLOT_FLAG_TRANS) == 0)
+ &&
+ ((flags & (BITMAPF_MONOGLYPH|BITMAPF_BUFFER_NATIVE))==0) ){
+ opaque = true;
+ }
}
-
assert( clip->g_h > 0 );
assert( clip->g_w > 0 );
@@ -1277,80 +1348,80 @@ static bool bitmap_convert_tc(struct bitmap * img, int x, int y,
// toolbar buttons right now.
if( (opaque == true) || (flags & BITMAPF_BUFFER_NATIVE ) ){
- if( img->converted == true ){
- *out = img->native;
- return( 0 );
- }
- if( ( flags & BITMAPF_MONOGLYPH ) == 0 ){
- cache = true;
- }
+ if( img->converted == true ){
+ *out = img->native;
+ return( 0 );
+ }
+ if( ( flags & BITMAPF_MONOGLYPH ) == 0 ){
+ cache = true;
+ }
}
/* rem. if eddi xy is installed, we could directly access the screen! */
/* apply transparency to the image: */
if (( opaque == false )) {
- /* copy the screen to an temp buffer: */
- if ((flags & BITMAPF_BUFFER_NATIVE) == 0) {
- scrbuf = snapshot_create(x, y, clip->g_w, clip->g_h);
- if( scrbuf != NULL ) {
-
- assert( clip->g_w <= bw );
- assert( clip->g_h <= bh );
-
- // copy blended pixels to the screen buffer:
- ablend_bitmap( img, scrbuf, clip, NULL );
- /* adjust size which gets converted: */
- bw = clip->g_w;
- bh = clip->g_h;
- /* adjust output position: */
- clip->g_x = 0;
- clip->g_y = 0;
- /* set the source of conversion: */
- source = scrbuf;
- }
- } else {
- /*
- The whole bitmap can be transformed to an mfdb
- (and get's cached)
- */
- GRECT region = { 0, 0, bw, bh };
- ablend_pixel( img, bg, &region );
- source = img;
- }
+ /* copy the screen to an temp buffer: */
+ if ((flags & BITMAPF_BUFFER_NATIVE) == 0) {
+ scrbuf = snapshot_create(x, y, clip->g_w, clip->g_h);
+ if( scrbuf != NULL ) {
+
+ assert( clip->g_w <= bw );
+ assert( clip->g_h <= bh );
+
+ // copy blended pixels to the screen buffer:
+ ablend_bitmap( img, scrbuf, clip, NULL );
+ /* adjust size which gets converted: */
+ bw = clip->g_w;
+ bh = clip->g_h;
+ /* adjust output position: */
+ clip->g_x = 0;
+ clip->g_y = 0;
+ /* set the source of conversion: */
+ source = scrbuf;
+ }
+ } else {
+ /*
+ The whole bitmap can be transformed to an mfdb
+ (and get's cached)
+ */
+ GRECT region = { 0, 0, bw, bh };
+ ablend_pixel( img, bg, &region );
+ source = img;
+ }
} else {
- source = img;
+ source = img;
}
/* (re)allocate buffer for converted image: */
dststride = MFDB_STRIDE(bw);
dstsize = ( ((dststride >> 3) * bh) * atari_plot_bpp_virt );
if (cache == false) {
- /* ensure cache buffer is large enough */
- if (dstsize > size_buf_packed) {
- int blocks = (dstsize / (CONV_BLOCK_SIZE-1))+1;
- void *buf;
- if (buf_packed == NULL) {
- buf = malloc(blocks * CONV_BLOCK_SIZE);
- } else {
- buf = realloc(buf_packed, blocks * CONV_BLOCK_SIZE);
- }
- if (buf == NULL ) {
- if (scrbuf != NULL) {
- atari_bitmap_destroy(scrbuf);
- }
- return( 0-ERR_NO_MEM );
- }
- buf_packed = buf;
- size_buf_packed = blocks * CONV_BLOCK_SIZE;
- }
- out->fd_addr = buf_packed;
+ /* ensure cache buffer is large enough */
+ if (dstsize > size_buf_packed) {
+ int blocks = (dstsize / (CONV_BLOCK_SIZE-1))+1;
+ void *buf;
+ if (buf_packed == NULL) {
+ buf = malloc(blocks * CONV_BLOCK_SIZE);
+ } else {
+ buf = realloc(buf_packed, blocks * CONV_BLOCK_SIZE);
+ }
+ if (buf == NULL ) {
+ if (scrbuf != NULL) {
+ atari_bitmap_destroy(scrbuf);
+ }
+ return( 0-ERR_NO_MEM );
+ }
+ buf_packed = buf;
+ size_buf_packed = blocks * CONV_BLOCK_SIZE;
+ }
+ out->fd_addr = buf_packed;
} else {
- assert( out->fd_addr == NULL );
- out->fd_addr = (void*)malloc( dstsize );
- if( out->fd_addr == NULL ){
- if( scrbuf != NULL )
- atari_bitmap_destroy( scrbuf );
- return( 0-ERR_NO_MEM );
- }
+ assert( out->fd_addr == NULL );
+ out->fd_addr = (void*)malloc( dstsize );
+ if( out->fd_addr == NULL ){
+ if( scrbuf != NULL )
+ atari_bitmap_destroy( scrbuf );
+ return( 0-ERR_NO_MEM );
+ }
}
out->fd_w = dststride;
@@ -1361,10 +1432,10 @@ static bool bitmap_convert_tc(struct bitmap * img, int x, int y,
out->fd_r1 = out->fd_r2 = out->fd_r3 = 0;
err = Hermes_ConverterRequest(
- hermes_cnv_h,
- &nsfmt,
- &vfmt
- );
+ hermes_cnv_h,
+ &nsfmt,
+ &vfmt
+ );
assert( err != 0 );
// FIXME: here we can use the same optimization which is used for
@@ -1372,43 +1443,44 @@ static bool bitmap_convert_tc(struct bitmap * img, int x, int y,
/* convert image to virtual format: */
err = Hermes_ConverterCopy( hermes_cnv_h,
- source->pixdata,
- 0, /* x src coord of top left in pixel coords */
- 0, /* y src coord of top left in pixel coords */
- bw, bh,
- source->rowstride, /* stride as bytes */
- out->fd_addr,
- 0, /* x dst coord of top left in pixel coords */
- 0, /* y dst coord of top left in pixel coords */
- bw, bh,
- (dststride >> 3) * atari_plot_bpp_virt /* stride as bytes */
- );
+ source->pixdata,
+ 0, /* x src coord of top left in pixel coords */
+ 0, /* y src coord of top left in pixel coords */
+ bw, bh,
+ source->rowstride, /* stride as bytes */
+ out->fd_addr,
+ 0, /* x dst coord of top left in pixel coords */
+ 0,/* y dst coord of top left in pixel coords */
+ bw, bh,
+ (dststride >> 3) * atari_plot_bpp_virt /* stride as bytes */
+ );
assert( err != 0 );
if( cache == true ){
- img->native = *out;
- img->converted = true;
+ img->native = *out;
+ img->converted = true;
}
return( 0 );
}
+
inline static void convert_bitmap_done(void)
{
if (size_buf_packed > CONV_KEEP_LIMIT) {
- void *buf;
- /* free the mem if it was an large allocation ... */
- buf = realloc(buf_packed, CONV_KEEP_LIMIT);
- if (buf != NULL) {
- buf_packed = buf;
- size_buf_packed = CONV_KEEP_LIMIT;
- }
+ void *buf;
+ /* free the mem if it was an large allocation ... */
+ buf = realloc(buf_packed, CONV_KEEP_LIMIT);
+ if (buf != NULL) {
+ buf_packed = buf;
+ size_buf_packed = CONV_KEEP_LIMIT;
+ }
}
}
bool plot_blit_bitmap(struct bitmap * bmp, int x, int y,
- unsigned long bg, unsigned long flags )
+ unsigned long bg, unsigned long flags )
{
MFDB src_mf;
MFDB scrmf;
@@ -1431,7 +1503,7 @@ bool plot_blit_bitmap(struct bitmap * bmp, int x, int y,
clip.g_h = view.clipping.y1 - view.clipping.y0;
if( !rc_intersect( &clip, &off) ) {
- return(true);
+ return(true);
}
// clip the visible rectangle of the plot area
@@ -1439,7 +1511,7 @@ bool plot_blit_bitmap(struct bitmap * bmp, int x, int y,
// screen region:
plot_get_visible_grect(&vis);
if( !rc_intersect( &vis, &off) ) {
- return(true);
+ return(true);
}
screen_x = view.x + off.g_x;
@@ -1453,8 +1525,8 @@ bool plot_blit_bitmap(struct bitmap * bmp, int x, int y,
/* Convert the Bitmap to native screen format - ready for output. */
/* This includes blending transparent pixels: */
if (bitmap_convert(bmp, screen_x, screen_y, &off, bg, flags, &src_mf)
- != 0 ) {
- return(true);
+ != 0 ) {
+ return(true);
}
// setup the src region:
@@ -1475,8 +1547,9 @@ bool plot_blit_bitmap(struct bitmap * bmp, int x, int y,
return(true);
}
+
bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor,
- uint32_t flags)
+ uint32_t flags)
{
MFDB screen;
// MFDB tran;
@@ -1487,7 +1560,7 @@ bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor,
plot_get_clip_grect(&off);
if( rc_intersect(loc, &off) == 0 ){
- return( 1 );
+ return( 1 );
}
init_mfdb( 0, loc->g_w, loc->g_h, 0, &screen );
@@ -1527,53 +1600,49 @@ bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor,
if( flags & PLOT_FLAG_TRANS && src->fd_nplanes == 1){
- vrt_cpyfm(atari_plot_vdi_handle, MD_REPLACE/*MD_TRANS*/, (short*)pxy, src, &screen, (short*)&c);
+ vrt_cpyfm(atari_plot_vdi_handle, MD_REPLACE/*MD_TRANS*/, (short*)pxy, src, &screen, (short*)&c);
} else {
- /* this method only plots transparent bitmaps, right now... */
+ /* this method only plots transparent bitmaps, right now... */
}
return( 1 );
}
-/*
- Init screen and font driver objects.
- Returns non-zero value > -1 when the objects could be succesfully created.
- Returns value < 0 to indicate an error
-*/
-int plot_init(char * fdrvrname)
+/* exported interface documented in atari/plot.h */
+int plot_init(const struct redraw_context *ctx, char *fdrvrname)
{
-
- GRECT loc_pos= {0,0,360,400};
+ GRECT loc_pos = { 0, 0, 360, 400 };
int err=0;
if( nsoption_int(atari_dither) == 1)
- atari_plot_flags |= PLOT_FLAG_DITHER;
+ atari_plot_flags |= PLOT_FLAG_DITHER;
if( nsoption_int(atari_transparency) == 1 )
- atari_plot_flags |= PLOT_FLAG_TRANS;
+ atari_plot_flags |= PLOT_FLAG_TRANS;
if( nsoption_int(atari_font_monochrom) == 1 )
- atari_font_flags |= FONTPLOT_FLAG_MONOGLYPH;
+ atari_font_flags |= FONTPLOT_FLAG_MONOGLYPH;
- if(atari_plot_vdi_handle == -1) {
+ if (atari_plot_vdi_handle == -1) {
- short dummy;
- short work_in[12] = {Getrez()+2,1,1,1,1,1,1,1,1,1,2,1};
- short work_out[57];
- atari_plot_vdi_handle=graf_handle(&dummy, &dummy, &dummy, &dummy);
- v_opnvwk(work_in, &atari_plot_vdi_handle, work_out);
- LOG("Plot VDI handle: %d", atari_plot_vdi_handle);
+ short dummy;
+ short work_in[12] = {Getrez()+2,1,1,1,1,1,1,1,1,1,2,1};
+ short work_out[57];
+ atari_plot_vdi_handle=graf_handle(&dummy, &dummy, &dummy, &dummy);
+ v_opnvwk(work_in, &atari_plot_vdi_handle, work_out);
+ NSLOG(netsurf, INFO, "Plot VDI handle: %d", atari_plot_vdi_handle);
}
read_vdi_sysinfo(atari_plot_vdi_handle, &vdi_sysinfo);
if(verbose_log) {
- dump_vdi_info(atari_plot_vdi_handle) ;
- dump_font_drivers();
+ dump_vdi_info(atari_plot_vdi_handle) ;
+ dump_font_drivers();
}
fplotter = new_font_plotter(atari_plot_vdi_handle, fdrvrname,
- atari_font_flags, &err);
- if(err) {
- const char * desc = plot_err_str(err);
- LOG("Unable to load font plotter %s -> %s", fdrvrname, desc );
- die("font plotter");
+ atari_font_flags, &err);
+ if (err) {
+ const char * desc = plot_err_str(err);
+ NSLOG(netsurf, INFO, "Unable to load font plotter %s -> %s",
+ fdrvrname, desc);
+ die("font plotter");
}
memset(&view, 0, sizeof(struct s_view));
@@ -1587,9 +1656,9 @@ int plot_init(char * fdrvrname)
buf_packed = NULL;
buf_planar = NULL;
if( vdi_sysinfo.vdiformat == VDI_FORMAT_PACK ) {
- atari_plot_bpp_virt = vdi_sysinfo.scr_bpp;
+ atari_plot_bpp_virt = vdi_sysinfo.scr_bpp;
} else {
- atari_plot_bpp_virt = 8;
+ atari_plot_bpp_virt = 8;
}
plot_set_scale(1.0);
@@ -1600,7 +1669,7 @@ int plot_init(char * fdrvrname)
clip.y0 = 0;
clip.x1 = view.w;
clip.y1 = view.h;
- plot_clip(&clip);
+ ctx->plot->clip(ctx, &clip);
assert(Hermes_Init());
@@ -1610,38 +1679,38 @@ int plot_init(char * fdrvrname)
/* Setup color lookup tables and palette */
unsigned char rgbcol[4];
if( vdi_sysinfo.scr_bpp <= 8 ){
- unsigned char graytone=0;
- int i;
- for( i=0; i<=255; i++ ) {
-
- // get the current color and save it for restore:
- vq_color(atari_plot_vdi_handle, i, 1, (unsigned short*)&sys_pal[i][0] );
- if( i<OFFSET_WEB_PAL ) {
- pal[i][0] = sys_pal[i][0];
- pal[i][1] = sys_pal[i][1];
- pal[i][2] = sys_pal[i][2];
- } else if( vdi_sysinfo.scr_bpp >= 8 ) {
- if ( i < OFFSET_CUST_PAL ){
- pal[i][0] = vdi_web_pal[i-OFFSET_WEB_PAL][0];
- pal[i][1] = vdi_web_pal[i-OFFSET_WEB_PAL][1];
- pal[i][2] = vdi_web_pal[i-OFFSET_WEB_PAL][2];
- //set the new palette color to websafe value:
- vs_color(atari_plot_vdi_handle, i, &pal[i][0]);
- }
- if( i >= OFFSET_CUST_PAL && i<OFFSET_CUST_PAL+16 ) {
- /* here we define 20 additional gray colors... */
- rgbcol[1] = rgbcol[2] = rgbcol[3] = ((graytone&0x0F) << 4);
- rgb_to_vdi1000( &rgbcol[0], &pal[i][0] );
- vs_color(atari_plot_vdi_handle, i, &pal[i][0]);
- graytone++;
- }
-
- }
- vdi1000_to_rgb( &pal[i][0], &rgb_lookup[i][0] );
- }
+ unsigned char graytone=0;
+ int i;
+ for( i=0; i<=255; i++ ) {
+
+ // get the current color and save it for restore:
+ vq_color(atari_plot_vdi_handle, i, 1, (unsigned short*)&sys_pal[i][0] );
+ if( i<OFFSET_WEB_PAL ) {
+ pal[i][0] = sys_pal[i][0];
+ pal[i][1] = sys_pal[i][1];
+ pal[i][2] = sys_pal[i][2];
+ } else if( vdi_sysinfo.scr_bpp >= 8 ) {
+ if ( i < OFFSET_CUST_PAL ){
+ pal[i][0] = vdi_web_pal[i-OFFSET_WEB_PAL][0];
+ pal[i][1] = vdi_web_pal[i-OFFSET_WEB_PAL][1];
+ pal[i][2] = vdi_web_pal[i-OFFSET_WEB_PAL][2];
+ //set the new palette color to websafe value:
+ vs_color(atari_plot_vdi_handle, i, &pal[i][0]);
+ }
+ if( i >= OFFSET_CUST_PAL && i<OFFSET_CUST_PAL+16 ) {
+ /* here we define 20 additional gray colors... */
+ rgbcol[1] = rgbcol[2] = rgbcol[3] = ((graytone&0x0F) << 4);
+ rgb_to_vdi1000( &rgbcol[0], &pal[i][0] );
+ vs_color(atari_plot_vdi_handle, i, &pal[i][0]);
+ graytone++;
+ }
+
+ }
+ vdi1000_to_rgb( &pal[i][0], &rgb_lookup[i][0] );
+ }
} else {
- /* no need to change the palette - its application specific */
+ /* no need to change the palette - its application specific */
}
#else
bitmap_convert = bitmap_convert_tc;
@@ -1675,6 +1744,7 @@ int plot_init(char * fdrvrname)
return( err );
}
+
int plot_finalise( void )
{
@@ -1682,10 +1752,10 @@ int plot_finalise( void )
#ifdef WITH_8BPP_SUPPORT
if (vfmt.indexed) {
- int i;
- for (i=OFFSET_WEB_PAL; i<OFFSET_CUST_PAL+16; i++) {
- vs_color(atari_plot_vdi_handle, i, &sys_pal[i][0]);
- }
+ int i;
+ for (i=OFFSET_WEB_PAL; i<OFFSET_CUST_PAL+16; i++) {
+ vs_color(atari_plot_vdi_handle, i, &sys_pal[i][0]);
+ }
}
#endif
@@ -1701,25 +1771,27 @@ int plot_finalise( void )
return 0;
}
+
bool plot_lock(void)
{
if ((atari_plot_flags & PLOT_FLAG_LOCKED) != 0)
- return(true);
+ return(true);
if( !wind_update(BEG_UPDATE|0x100) )
- return(false);
+ return(false);
if( !wind_update(BEG_MCTRL|0x100) ){
- wind_update(END_UPDATE);
- return(false);
+ wind_update(END_UPDATE);
+ return(false);
}
atari_plot_flags |= PLOT_FLAG_LOCKED;
graf_mouse(M_OFF, NULL);
return(true);
}
+
bool plot_unlock(void)
{
if( (atari_plot_flags & PLOT_FLAG_LOCKED) == 0 )
- return(true);
+ return(true);
wind_update(END_MCTRL);
wind_update(END_UPDATE);
graf_mouse(M_ON, NULL);
@@ -1728,214 +1800,40 @@ bool plot_unlock(void)
return(false);
}
-bool plot_rectangle(int x0, int y0, int x1, int y1,
- const plot_style_t *pstyle )
-{
- short pxy[4];
- GRECT r, rclip, sclip;
- int sw = pstyle->stroke_width;
- uint32_t lt;
-
- /* current canvas clip: */
- rclip.g_x = view.clipping.x0;
- rclip.g_y = view.clipping.y0;
- rclip.g_w = view.clipping.x1 - view.clipping.x0;
- rclip.g_h = view.clipping.y1 - view.clipping.y0;
-
- /* physical clipping: */
- sclip.g_x = rclip.g_x;
- sclip.g_y = rclip.g_y;
- sclip.g_w = view.vis_w;
- sclip.g_h = view.vis_h;
- rc_intersect(&sclip, &rclip);
- r.g_x = x0;
- r.g_y = y0;
- r.g_w = x1 - x0;
- r.g_h = y1 - y0;
-
- if (!rc_intersect( &rclip, &r )) {
- return(true);
- }
- if (pstyle->stroke_type != PLOT_OP_TYPE_NONE) {
- /*
- manually draw the line, because we do not need vdi clipping
- for vertical / horizontal line draws.
- */
- if( sw == 0)
- sw = 1;
-
- NSLT2VDI(lt, pstyle);
- vsl_type(atari_plot_vdi_handle, (lt&0x0F));
- /*
- if the line style is not available within VDI system,
- define own style:
- */
- if( (lt&0x0F) == 7 ){
- vsl_udsty(atari_plot_vdi_handle, ((lt&0xFFFF00) >> 8));
- }
- vsl_width(atari_plot_vdi_handle, (short)sw );
- vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
- /* top border: */
- if( r.g_y == y0){
- pxy[0] = view.x + r.g_x;
- pxy[1] = view.y + r.g_y ;
- pxy[2] = view.x + r.g_x + r.g_w;
- pxy[3] = view.y + r.g_y;
- v_pline(atari_plot_vdi_handle, 2, (short *)&pxy);
- }
-
- /* right border: */
- if( r.g_x + r.g_w == x1 ){
- pxy[0] = view.x + r.g_x + r.g_w;
- pxy[1] = view.y + r.g_y;
- pxy[2] = view.x + r.g_x + r.g_w;
- pxy[3] = view.y + r.g_y + r.g_h;
- v_pline(atari_plot_vdi_handle, 2, (short *)&pxy);
- }
-
- /* bottom border: */
- if( r.g_y+r.g_h == y1 ){
- pxy[0] = view.x + r.g_x;
- pxy[1] = view.y + r.g_y+r.g_h;
- pxy[2] = view.x + r.g_x+r.g_w;
- pxy[3] = view.y + r.g_y+r.g_h;
- v_pline(atari_plot_vdi_handle, 2, (short *)&pxy);
- }
-
- /* left border: */
- if( r.g_x == x0 ){
- pxy[0] = view.x + r.g_x;
- pxy[1] = view.y + r.g_y;
- pxy[2] = view.x + r.g_x;
- pxy[3] = view.y + r.g_y + r.g_h;
- v_pline(atari_plot_vdi_handle, 2, (short *)&pxy);
- }
- }
-
- if( pstyle->fill_type != PLOT_OP_TYPE_NONE ){
- short stroke_width = (short)(pstyle->stroke_type != PLOT_OP_TYPE_NONE) ?
- pstyle->stroke_width : 0;
-
- vsf_rgbcolor(atari_plot_vdi_handle, pstyle->fill_colour);
- vsf_perimeter(atari_plot_vdi_handle, 0);
- vsf_interior(atari_plot_vdi_handle, FIS_SOLID);
-
-
- pxy[0] = view.x + r.g_x + stroke_width;
- pxy[1] = view.y + r.g_y + stroke_width;
- pxy[2] = view.x + r.g_x + r.g_w -1 - stroke_width;
- pxy[3] = view.y + r.g_y + r.g_h -1 - stroke_width;
-
- vsf_style(atari_plot_vdi_handle, 1);
- v_bar(atari_plot_vdi_handle, (short*)&pxy);
- }
- return (true);
-}
-
-bool plot_line(int x0, int y0, int x1, int y1,
- const plot_style_t *pstyle )
-{
- short pxy[4];
- uint32_t lt;
- int sw = pstyle->stroke_width;
-
- if((x0 < 0 && x1 < 0) || (y0 < 0 && y1 < 0)){
- return(true);
- }
-
- pxy[0] = view.x + MAX(0,x0);
- pxy[1] = view.y + MAX(0,y0);
- pxy[2] = view.x + MAX(0,x1);
- pxy[3] = view.y + MAX(0,y1);
-
- if((y0 > view.h-1) && (y1 > view.h-1))
- return(true);
-
- //printf("view: %d,%d,%d,%d\n", view.x, view.y, view.w, view.h);
- //printf("line: %d,%d,%d,%d\n", x0, y0, x1, y1);
-
-
- //plot_vdi_clip(true);
- if( sw == 0)
- sw = 1;
- NSLT2VDI(lt, pstyle)
- vsl_type(atari_plot_vdi_handle, (lt&0x0F));
- /* if the line style is not available within VDI system,define own style: */
- if( (lt&0x0F) == 7 ){
- vsl_udsty(atari_plot_vdi_handle, ((lt&0xFFFF00) >> 8));
- }
- vsl_width(atari_plot_vdi_handle, (short)sw);
- vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
- v_pline(atari_plot_vdi_handle, 2, (short *)&pxy );
- //plot_vdi_clip(false);
- return (true);
-}
-
-static bool plot_polygon(const int *p, unsigned int n,
- const plot_style_t *pstyle)
-{
- short pxy[n*2];
- unsigned int i=0;
- if (vdi_sysinfo.maxpolycoords > 0)
- assert( (signed int)n < vdi_sysinfo.maxpolycoords);
-
- vsf_interior(atari_plot_vdi_handle, FIS_SOLID);
- vsf_style(atari_plot_vdi_handle, 1);
- for (i = 0; i<n*2; i=i+2) {
- pxy[i] = (short)view.x+p[i];
- pxy[i+1] = (short)view.y+p[i+1];
- }
- if (pstyle->fill_type == PLOT_OP_TYPE_SOLID) {
- vsf_rgbcolor(atari_plot_vdi_handle, pstyle->fill_colour);
- v_fillarea(atari_plot_vdi_handle, n, (short*)&pxy);
- } else {
- pxy[n*2]=pxy[0];
- pxy[n*2+1]=pxy[1];
- vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
- v_pline(atari_plot_vdi_handle, n+1, (short *)&pxy);
- }
-
- return ( true );
-}
-
-/***
- * Set plot origin and canvas size
- * \param x the x origin
- * \param y the y origin
- * \param w the width of the plot area
- * \param h the height of the plot area
- */
-bool plot_set_dimensions(int x, int y, int w, int h)
+/* exported interface documented in atari/plot.h */
+bool
+plot_set_dimensions(const struct redraw_context *ctx, int x, int y, int w, int h)
{
bool doupdate = false;
struct rect newclip = {0, 0, w, h};
GRECT absclip = {x, y, w, h};
if (!(w == view.w && h == view.h)) {
- view.w = (short)w;
- view.h = (short)h;
- doupdate = true;
+ view.w = (short)w;
+ view.h = (short)h;
+ doupdate = true;
}
if (!(x == view.x && y == view.y)) {
- view.x = (short)x;
- view.y = (short)y;
- doupdate = true;
+ view.x = (short)x;
+ view.y = (short)y;
+ doupdate = true;
}
if (doupdate==true)
- update_visible_rect();
+ update_visible_rect();
//dbg_rect("plot_set_dimensions", &newclip);
plot_set_abs_clipping(&absclip);
- plot_clip(&newclip);
+ ctx->plot->clip(ctx, &newclip);
return(true);
}
-/***
+
+/**
* Get current canvas size
- * \param dst the GRECT * which receives the canvas size
*
+ * \param dst the GRECT * which receives the canvas size
*/
bool plot_get_dimensions(GRECT *dst)
{
@@ -1946,6 +1844,7 @@ bool plot_get_dimensions(GRECT *dst)
return(true);
}
+
/**
* set scale of plotter.
* \param scale the new scale value
@@ -1961,6 +1860,7 @@ float plot_set_scale(float scale)
return(ret);
}
+
float plot_get_scale(void)
{
return(view.scale);
@@ -1968,10 +1868,9 @@ float plot_get_scale(void)
/**
- *
* Subsequent calls to plot_clip will be clipped by the absolute clip.
- * \param area the maximum clipping rectangle (absolute screen coords)
*
+ * \param area the maximum clipping rectangle (absolute screen coords)
*/
void plot_set_abs_clipping(const GRECT *area)
{
@@ -1980,21 +1879,20 @@ void plot_set_abs_clipping(const GRECT *area)
plot_get_dimensions(&canvas);
if(!rc_intersect(area, &canvas)){
- view.abs_clipping.x0 = 0;
- view.abs_clipping.x1 = 0;
- view.abs_clipping.y0 = 0;
- view.abs_clipping.y1 = 0;
- }
- else {
- view.abs_clipping.x0 = area->g_x;
- view.abs_clipping.x1 = area->g_x + area->g_w;
- view.abs_clipping.y0 = area->g_y;
- view.abs_clipping.y1 = area->g_y + area->g_h;
+ view.abs_clipping.x0 = 0;
+ view.abs_clipping.x1 = 0;
+ view.abs_clipping.y0 = 0;
+ view.abs_clipping.y1 = 0;
+ } else {
+ view.abs_clipping.x0 = area->g_x;
+ view.abs_clipping.x1 = area->g_x + area->g_w;
+ view.abs_clipping.y0 = area->g_y;
+ view.abs_clipping.y1 = area->g_y + area->g_h;
}
}
-/***
+/**
* Get the maximum clip extent, in absolute screen coords
* \param dst the structure that receives the absolute clipping
*/
@@ -2004,7 +1902,7 @@ void plot_get_abs_clipping(struct rect *dst)
}
-/***
+/**
* Get the maximum clip extent, in absolute screen coords
* \param dst the structure that receives the absolute clipping
*/
@@ -2016,7 +1914,64 @@ void plot_get_abs_clipping_grect(GRECT *dst)
dst->g_h = view.abs_clipping.y1 - view.abs_clipping.y0;
}
-bool plot_clip(const struct rect *clip)
+
+VdiHdl plot_get_vdi_handle(void)
+{
+ return(atari_plot_vdi_handle);
+}
+
+
+long plot_get_flags(void)
+{
+ return(atari_plot_flags);
+}
+
+
+bool plot_get_clip(struct rect * out)
+{
+ out->x0 = view.clipping.x0;
+ out->y0 = view.clipping.y0;
+ out->x1 = view.clipping.x1;
+ out->y1 = view.clipping.y1;
+ return( true );
+}
+
+
+void plot_get_clip_grect(GRECT * out)
+{
+ struct rect clip={0,0,0,0};
+
+ plot_get_clip(&clip);
+
+ out->g_x = clip.x0;
+ out->g_y = clip.y0;
+ out->g_w = clip.x1 - clip.x0;
+ out->g_h = clip.y1 - clip.y0;
+}
+
+
+FONT_PLOTTER plot_get_text_plotter()
+{
+ return(fplotter);
+}
+
+
+void plot_set_text_plotter(FONT_PLOTTER font_plotter)
+{
+ fplotter = font_plotter;
+}
+
+
+/**
+ * \brief Sets a clip rectangle for subsequent plot operations.
+ *
+ * \param ctx The current redraw context.
+ * \param clip The rectangle to limit all subsequent plot
+ * operations within.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+plot_clip(const struct redraw_context *ctx, const struct rect *clip)
{
GRECT canvas, screen, gclip, maxclip;
short pxy[4];
@@ -2041,14 +1996,14 @@ bool plot_clip(const struct rect *clip)
rc_intersect(&canvas, &gclip);
if(gclip.g_h < 0){
- gclip.g_h = 0;
+ gclip.g_h = 0;
}
if (!rc_intersect(&screen, &gclip)) {
- //dbg_rect("cliprect: ", &view.clipping);
- //dbg_grect("screen: ", &canvas);
- //dbg_grect("canvas clipped: ", &gclip);
- //assert(1 == 0);
+ //dbg_rect("cliprect: ", &view.clipping);
+ //dbg_grect("screen: ", &canvas);
+ //dbg_grect("canvas clipped: ", &gclip);
+ //assert(1 == 0);
}
// When setting VDI clipping, obey to maximum cliping rectangle:
@@ -2064,106 +2019,377 @@ bool plot_clip(const struct rect *clip)
vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy);
- return ( true );
+ return NSERROR_OK;
}
-VdiHdl plot_get_vdi_handle(void)
-{
- return(atari_plot_vdi_handle);
-}
-long plot_get_flags(void)
+/**
+ * Plots an arc
+ *
+ * plot an arc segment around (x,y), anticlockwise from angle1
+ * to angle2. Angles are measured anticlockwise from
+ * horizontal, in degrees.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the arc plot.
+ * \param x The x coordinate of the arc.
+ * \param y The y coordinate of the arc.
+ * \param radius The radius of the arc.
+ * \param angle1 The start angle of the arc.
+ * \param angle2 The finish angle of the arc.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+plot_arc(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ int x, int y, int radius, int angle1, int angle2)
{
- return(atari_plot_flags);
+ vswr_mode(atari_plot_vdi_handle, MD_REPLACE);
+ if (pstyle->fill_type == PLOT_OP_TYPE_NONE) {
+ return NSERROR_OK;
+ }
+
+ if (pstyle->fill_type != PLOT_OP_TYPE_SOLID) {
+ vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
+ vsf_perimeter(atari_plot_vdi_handle, 1);
+ vsf_interior(atari_plot_vdi_handle, 1 );
+ v_arc(atari_plot_vdi_handle,
+ view.x + x,
+ view.y + y,
+ radius,
+ angle1 * 10,
+ angle2 * 10);
+ } else {
+ vsf_rgbcolor(atari_plot_vdi_handle, pstyle->fill_colour);
+ vsl_width(atari_plot_vdi_handle, 1);
+ vsf_perimeter(atari_plot_vdi_handle, 1);
+ v_arc(atari_plot_vdi_handle,
+ view.x + x,
+ view.y + y, radius,
+ angle1 * 10,
+ angle2 * 10);
+ }
+
+ return NSERROR_OK;
}
-bool plot_get_clip(struct rect * out)
+/**
+ * Plots a circle
+ *
+ * Plot a circle centered on (x,y), which is optionally filled.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the circle plot.
+ * \param x x coordinate of circle centre.
+ * \param y y coordinate of circle centre.
+ * \param radius circle radius.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+plot_disc(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ int x, int y, int radius)
{
- out->x0 = view.clipping.x0;
- out->y0 = view.clipping.y0;
- out->x1 = view.clipping.x1;
- out->y1 = view.clipping.y1;
- return( true );
+ if (pstyle->fill_type != PLOT_OP_TYPE_SOLID) {
+ vsf_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
+ vsf_perimeter(atari_plot_vdi_handle, 1);
+ vsf_interior(atari_plot_vdi_handle, 0);
+ v_circle(atari_plot_vdi_handle, view.x + x, view.y + y, radius);
+ } else {
+ vsf_rgbcolor(atari_plot_vdi_handle, pstyle->fill_colour);
+ vsf_perimeter(atari_plot_vdi_handle, 0);
+ vsf_interior(atari_plot_vdi_handle, FIS_SOLID);
+ v_circle(atari_plot_vdi_handle, view.x + x, view.y + y, radius);
+ }
+ return NSERROR_OK;
}
-void plot_get_clip_grect(GRECT * out)
+
+/**
+ * Plots a line
+ *
+ * plot a line from (x0,y0) to (x1,y1). Coordinates are at
+ * centre of line width/thickness.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the line plot.
+ * \param line A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+plot_line(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const struct rect *line)
{
- struct rect clip={0,0,0,0};
+ short pxy[4];
+ uint32_t lt;
+ int sw = plot_style_fixed_to_int(pstyle->stroke_width);
- plot_get_clip(&clip);
+ if (((line->x0 < 0) && (line->x1 < 0)) ||
+ ((line->y0 < 0) && (line->y1 < 0))) {
+ return NSERROR_OK;
+ }
- out->g_x = clip.x0;
- out->g_y = clip.y0;
- out->g_w = clip.x1 - clip.x0;
- out->g_h = clip.y1 - clip.y0;
-}
+ pxy[0] = view.x + MAX(0, line->x0);
+ pxy[1] = view.y + MAX(0, line->y0);
+ pxy[2] = view.x + MAX(0, line->x1);
+ pxy[3] = view.y + MAX(0, line->y1);
-FONT_PLOTTER plot_get_text_plotter()
-{
- return(fplotter);
-}
+ if ((line->y0 > view.h-1) && (line->y1 > view.h-1)) {
+ return NSERROR_OK;
+ }
-void plot_set_text_plotter(FONT_PLOTTER font_plotter)
-{
- fplotter = font_plotter;
-}
+ //printf("view: %d,%d,%d,%d\n", view.x, view.y, view.w, view.h);
+ //printf("line: %d,%d,%d,%d\n", x0, y0, x1, y1);
-static bool plot_text(int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle )
-{
- if (view.scale != 1.0) {
- plot_font_style_t newstyle = *fstyle;
- newstyle.size = (int)((float)fstyle->size*view.scale);
- fplotter->text(fplotter, x, y, text, length, &newstyle);
- } else {
- fplotter->text(fplotter, x, y, text, length, fstyle);
+ //plot_vdi_clip(true);
+
+ if (sw == 0) {
+ sw = 1;
}
+ NSLT2VDI(lt, pstyle)
+ vsl_type(atari_plot_vdi_handle, (lt&0x0F));
+ /* if the line style is not available within VDI system,define own style: */
+ if ((lt&0x0F) == 7 ) {
+ vsl_udsty(atari_plot_vdi_handle, ((lt&0xFFFF00) >> 8));
+ }
+ vsl_width(atari_plot_vdi_handle, (short)sw);
+ vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
+ v_pline(atari_plot_vdi_handle, 2, (short *)&pxy );
+ //plot_vdi_clip(false);
- return ( true );
+ return NSERROR_OK;
}
-static bool plot_disc(int x, int y, int radius, const plot_style_t *pstyle)
+
+/**
+ * Plots a rectangle.
+ *
+ * The rectangle can be filled an outline or both controlled
+ * by the plot style The line can be solid, dotted or
+ * dashed. Top left corner at (x0,y0) and rectangle has given
+ * width and height.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the rectangle plot.
+ * \param rect A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+plot_rectangle(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const struct rect *rect)
{
- if (pstyle->fill_type != PLOT_OP_TYPE_SOLID) {
- vsf_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
- vsf_perimeter(atari_plot_vdi_handle, 1);
- vsf_interior(atari_plot_vdi_handle, 0);
- v_circle(atari_plot_vdi_handle, view.x + x, view.y + y, radius);
- } else {
- vsf_rgbcolor(atari_plot_vdi_handle, pstyle->fill_colour);
- vsf_perimeter(atari_plot_vdi_handle, 0);
- vsf_interior(atari_plot_vdi_handle, FIS_SOLID);
- v_circle(atari_plot_vdi_handle, view.x + x, view.y + y, radius);
+ short pxy[4];
+ GRECT r, rclip, sclip;
+ int sw = plot_style_fixed_to_int(pstyle->stroke_width);
+ uint32_t lt;
+
+ /* current canvas clip: */
+ rclip.g_x = view.clipping.x0;
+ rclip.g_y = view.clipping.y0;
+ rclip.g_w = view.clipping.x1 - view.clipping.x0;
+ rclip.g_h = view.clipping.y1 - view.clipping.y0;
+
+ /* physical clipping: */
+ sclip.g_x = rclip.g_x;
+ sclip.g_y = rclip.g_y;
+ sclip.g_w = view.vis_w;
+ sclip.g_h = view.vis_h;
+
+ rc_intersect(&sclip, &rclip);
+ r.g_x = rect->x0;
+ r.g_y = rect->y0;
+ r.g_w = rect->x1 - rect->x0;
+ r.g_h = rect->y1 - rect->y0;
+
+ if (!rc_intersect(&rclip, &r)) {
+ return NSERROR_OK;
}
- return(true);
+ if (pstyle->stroke_type != PLOT_OP_TYPE_NONE) {
+ /*
+ manually draw the line, because we do not need vdi clipping
+ for vertical / horizontal line draws.
+ */
+ if (sw == 0)
+ sw = 1;
+
+ NSLT2VDI(lt, pstyle);
+ vsl_type(atari_plot_vdi_handle, (lt&0x0F));
+ /*
+ if the line style is not available within VDI system,
+ define own style:
+ */
+ if ((lt&0x0F) == 7 ) {
+ vsl_udsty(atari_plot_vdi_handle, ((lt&0xFFFF00) >> 8));
+ }
+ vsl_width(atari_plot_vdi_handle, (short)sw );
+ vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
+ /* top border: */
+ if (r.g_y == rect->y0) {
+ pxy[0] = view.x + r.g_x;
+ pxy[1] = view.y + r.g_y ;
+ pxy[2] = view.x + r.g_x + r.g_w;
+ pxy[3] = view.y + r.g_y;
+ v_pline(atari_plot_vdi_handle, 2, (short *)&pxy);
+ }
+
+ /* right border: */
+ if (r.g_x + r.g_w == rect->x1 ) {
+ pxy[0] = view.x + r.g_x + r.g_w;
+ pxy[1] = view.y + r.g_y;
+ pxy[2] = view.x + r.g_x + r.g_w;
+ pxy[3] = view.y + r.g_y + r.g_h;
+ v_pline(atari_plot_vdi_handle, 2, (short *)&pxy);
+ }
+
+ /* bottom border: */
+ if ( r.g_y+r.g_h == rect->y1 ) {
+ pxy[0] = view.x + r.g_x;
+ pxy[1] = view.y + r.g_y+r.g_h;
+ pxy[2] = view.x + r.g_x+r.g_w;
+ pxy[3] = view.y + r.g_y+r.g_h;
+ v_pline(atari_plot_vdi_handle, 2, (short *)&pxy);
+ }
+
+ /* left border: */
+ if ( r.g_x == rect->x0 ) {
+ pxy[0] = view.x + r.g_x;
+ pxy[1] = view.y + r.g_y;
+ pxy[2] = view.x + r.g_x;
+ pxy[3] = view.y + r.g_y + r.g_h;
+ v_pline(atari_plot_vdi_handle, 2, (short *)&pxy);
+ }
+ }
+
+ if (pstyle->fill_type != PLOT_OP_TYPE_NONE ) {
+ short stroke_width = (short)(pstyle->stroke_type != PLOT_OP_TYPE_NONE) ?
+ plot_style_fixed_to_int(pstyle->stroke_width) : 0;
+
+ vsf_rgbcolor(atari_plot_vdi_handle, pstyle->fill_colour);
+ vsf_perimeter(atari_plot_vdi_handle, 0);
+ vsf_interior(atari_plot_vdi_handle, FIS_SOLID);
+
+
+ pxy[0] = view.x + r.g_x + stroke_width;
+ pxy[1] = view.y + r.g_y + stroke_width;
+ pxy[2] = view.x + r.g_x + r.g_w -1 - stroke_width;
+ pxy[3] = view.y + r.g_y + r.g_h -1 - stroke_width;
+
+ vsf_style(atari_plot_vdi_handle, 1);
+ v_bar(atari_plot_vdi_handle, (short*)&pxy);
+ }
+
+ return NSERROR_OK;
}
-static bool plot_arc(int x, int y, int radius, int angle1, int angle2,
- const plot_style_t *pstyle)
+
+/**
+ * Plot a polygon
+ *
+ * Plots a filled polygon with straight lines between
+ * points. The lines around the edge of the ploygon are not
+ * plotted. The polygon is filled with the non-zero winding
+ * rule.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the polygon plot.
+ * \param p verticies of polygon
+ * \param n number of verticies.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+plot_polygon(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const int *p,
+ unsigned int n)
{
+ short pxy[n*2];
+ unsigned int i = 0;
- vswr_mode(atari_plot_vdi_handle, MD_REPLACE );
- if (pstyle->fill_type == PLOT_OP_TYPE_NONE)
- return(true);
- if ( pstyle->fill_type != PLOT_OP_TYPE_SOLID) {
- vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
- vsf_perimeter(atari_plot_vdi_handle, 1);
- vsf_interior(atari_plot_vdi_handle, 1 );
- v_arc(atari_plot_vdi_handle, view.x + x, view.y + y, radius, angle1*10, angle2*10);
+ if (vdi_sysinfo.maxpolycoords > 0)
+ assert( (signed int)n < vdi_sysinfo.maxpolycoords);
+
+ vsf_interior(atari_plot_vdi_handle, FIS_SOLID);
+ vsf_style(atari_plot_vdi_handle, 1);
+ for (i = 0; i<n*2; i=i+2) {
+ pxy[i] = (short)view.x+p[i];
+ pxy[i+1] = (short)view.y+p[i+1];
+ }
+
+ if (pstyle->fill_type == PLOT_OP_TYPE_SOLID) {
+ vsf_rgbcolor(atari_plot_vdi_handle, pstyle->fill_colour);
+ v_fillarea(atari_plot_vdi_handle, n, (short*)&pxy);
} else {
- vsf_rgbcolor(atari_plot_vdi_handle, pstyle->fill_colour);
- vsl_width(atari_plot_vdi_handle, 1 );
- vsf_perimeter(atari_plot_vdi_handle, 1);
- v_arc(atari_plot_vdi_handle, view.x + x, view.y + y, radius, angle1*10, angle2*10);
+ pxy[n*2]=pxy[0];
+ pxy[n*2+1]=pxy[1];
+ vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
+ v_pline(atari_plot_vdi_handle, n+1, (short *)&pxy);
}
- return (true);
+ return NSERROR_OK;
}
-static bool plot_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags)
+
+/**
+ * Plots a path.
+ *
+ * Path plot consisting of cubic Bezier curves. Line and fill colour is
+ * controlled by the plot style.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the path plot.
+ * \param p elements of path
+ * \param n nunber of elements on path
+ * \param transform A transform to apply to the path.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+plot_path(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const float *p,
+ unsigned int n,
+ const float transform[6])
+{
+ /** \todo Implement atari path plot */
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plot a bitmap
+ *
+ * Tiled plot of a bitmap image. (x,y) gives the top left
+ * coordinate of an explicitly placed tile. From this tile the
+ * image can repeat in all four directions -- up, down, left
+ * and right -- to the extents given by the current clip
+ * rectangle.
+ *
+ * The bitmap_flags say whether to tile in the x and y
+ * directions. If not tiling in x or y directions, the single
+ * image is plotted. The width and height give the dimensions
+ * the image is to be scaled to.
+ *
+ * \param ctx The current redraw context.
+ * \param bitmap The bitmap to plot
+ * \param x The x coordinate to plot the bitmap
+ * \param y The y coordiante to plot the bitmap
+ * \param width The width of area to plot the bitmap into
+ * \param height The height of area to plot the bitmap into
+ * \param bg the background colour to alpha blend into
+ * \param flags the flags controlling the type of plot operation
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+plot_bitmap(const struct redraw_context *ctx,
+ struct bitmap *bitmap,
+ int x, int y,
+ int width,
+ int height,
+ colour bg,
+ bitmap_flags_t flags)
{
struct bitmap * bm = NULL;
bool repeat_x = (flags & BITMAPF_REPEAT_X);
@@ -2175,78 +2401,109 @@ static bool plot_bitmap(int x, int y, int width, int height,
bmph = atari_bitmap_get_height(bitmap);
if(view.scale != 1.0){
- width = (int)(((float)width)*view.scale);
- height = (int)(((float)height)*view.scale);
+ width = (int)(((float)width)*view.scale);
+ height = (int)(((float)height)*view.scale);
}
if ( repeat_x || repeat_y ) {
- plot_get_clip(&clip);
- if( repeat_x && width == 1 && repeat_y && height == 1 ) {
- width = MAX( width, clip.x1 - x );
- height = MAX( height, clip.y1 - y );
- } else if( repeat_x && width == 1 ) {
- width = MAX( width, clip.x1 - x);
- } else if( repeat_y && height == 1) {
- height = MAX( height, clip.y1 - y );
- }
- }
-
- if( width != bmpw || height != bmph ) {
- atari_bitmap_resize(bitmap, hermes_res_h, &nsfmt, width, height );
- if( bitmap->resized )
- bm = bitmap->resized;
- else
- bm = bitmap;
+ plot_get_clip(&clip);
+ if (repeat_x && width == 1 && repeat_y && height == 1 ) {
+ width = MAX( width, clip.x1 - x );
+ height = MAX( height, clip.y1 - y );
+ } else if (repeat_x && width == 1 ) {
+ width = MAX( width, clip.x1 - x);
+ } else if (repeat_y && height == 1) {
+ height = MAX( height, clip.y1 - y );
+ }
+ }
+
+ if (width != bmpw || height != bmph) {
+ atari_bitmap_resize(bitmap, hermes_res_h, &nsfmt, width, height );
+ if (bitmap->resized) {
+ bm = bitmap->resized;
+ } else {
+ bm = bitmap;
+ }
} else {
- bm = bitmap;
+ bm = bitmap;
}
/* out of memory? */
- if( bm == NULL ) {
- printf("plot: out of memory! bmp: %p, bmpres: %p\n", bitmap, bitmap->resized );
- return( true );
+ if (bm == NULL) {
+ printf("plot: out of memory! bmp: %p, bmpres: %p\n",
+ bitmap, bitmap->resized );
+ return NSERROR_NOMEM;
}
if (!(repeat_x || repeat_y) ) {
- plot_blit_bitmap(bm, x, y, bg, flags );
+ plot_blit_bitmap(bm, x, y, bg, flags);
} else {
- int xf,yf;
- int xoff = x;
- int yoff = y;
-
- if (yoff > clip.y0 )
- yoff = (clip.y0 - height) + ((yoff - clip.y0) % height);
- if (xoff > clip.x0 )
- xoff = (clip.x0 - width) + ((xoff - clip.x0) % width);
- /* for now, repeating just works in the rigth / down direction */
- /*
- if( repeat_x == true )
- xoff = clip.x0;
- if(repeat_y == true )
- yoff = clip.y0;
- */
-
- for( xf = xoff; xf < clip.x1; xf += width ) {
- for( yf = yoff; yf < clip.y1; yf += height ) {
- plot_blit_bitmap(bm, xf, yf, bg, flags );
- if (!repeat_y)
- break;
- }
- if (!repeat_x)
- break;
- }
- }
- return ( true );
+ int xf,yf;
+ int xoff = x;
+ int yoff = y;
+
+ if (yoff > clip.y0) {
+ yoff = (clip.y0 - height) + ((yoff - clip.y0) % height);
+ }
+ if (xoff > clip.x0) {
+ xoff = (clip.x0 - width) + ((xoff - clip.x0) % width);
+ }
+ /* for now, repeating just works in the rigth / down direction */
+ /*
+ if( repeat_x == true )
+ xoff = clip.x0;
+ if(repeat_y == true )
+ yoff = clip.y0;
+ */
+
+ for (xf = xoff; xf < clip.x1; xf += width ) {
+ for (yf = yoff; yf < clip.y1; yf += height ) {
+ plot_blit_bitmap(bm, xf, yf, bg, flags );
+ if (!repeat_y) {
+ break;
+ }
+ }
+ if (!repeat_x) {
+ break;
+ }
+ }
+ }
+
+ return NSERROR_OK;
}
-static bool plot_path(const float *p, unsigned int n, colour fill, float width,
- colour c, const float transform[6])
-{
- return ( true );
-}
+/**
+ * Text plotting.
+ *
+ * \param ctx The current redraw context.
+ * \param fstyle plot style for this text
+ * \param x x coordinate
+ * \param y y coordinate
+ * \param text UTF-8 string to plot
+ * \param length length of string, in bytes
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+plot_text(const struct redraw_context *ctx,
+ const struct plot_font_style *fstyle,
+ int x,
+ int y,
+ const char *text,
+ size_t length)
+{
+ if (view.scale != 1.0) {
+ plot_font_style_t newstyle = *fstyle;
+ newstyle.size = (int)((float)fstyle->size*view.scale);
+ fplotter->text(fplotter, x, y, text, length, &newstyle);
+ } else {
+ fplotter->text(fplotter, x, y, text, length, fstyle);
+ }
+ return NSERROR_OK;
+}
+/** atari plottr operation table */
const struct plotter_table atari_plotters = {
.rectangle = plot_rectangle,
.line = plot_line,
diff --git a/frontends/atari/plot/plot.h b/frontends/atari/plot/plot.h
index fd73a8c33..a827c008c 100644
--- a/frontends/atari/plot/plot.h
+++ b/frontends/atari/plot/plot.h
@@ -55,6 +55,7 @@
#define ERR_PLOTTER_NOT_AVAILABLE 3 /* invalid plotter driver name passed */
struct plot_style_s;
+struct redraw_context;
struct s_vdi_sysinfo {
short vdi_handle; /**< vdi handle */
@@ -83,7 +84,16 @@ struct rect;
extern const struct plotter_table atari_plotters;
-int plot_init(char *);
+/**
+ * Init screen and font driver objects.
+ *
+ * \param ctx The current redraw context.
+ * \param fdrvrname font driver name.
+ * \return value > 1 when the objects could be succesfully created or
+ * <= 0 to indicate an error.
+ */
+int plot_init(const struct redraw_context *ctx, char *fdrvrname);
+
int plot_finalise(void);
/**
@@ -93,7 +103,17 @@ const char* plot_err_str(int i) ;
bool plot_lock(void);
bool plot_unlock(void);
-bool plot_set_dimensions( int x, int y, int w, int h );
+
+/**
+ * Set plot origin and canvas size
+ *
+ * \param ctx The current redraw context.
+ * \param x the x origin
+ * \param y the y origin
+ * \param w the width of the plot area
+ * \param h the height of the plot area
+ */
+bool plot_set_dimensions(const struct redraw_context *ctx, int x, int y, int w, int h );
bool plot_get_dimensions(GRECT *dst);
float plot_get_scale(void);
float plot_set_scale(float);
@@ -101,13 +121,10 @@ void plot_set_abs_clipping(const GRECT *area);
void plot_get_abs_clipping(struct rect *dst);
void plot_get_abs_clipping_grect(GRECT *dst);
bool plot_get_clip(struct rect * out);
-/* Get clipping for current framebuffer as GRECT */
+/** Get clipping for current framebuffer as GRECT */
void plot_get_clip_grect(GRECT * out);
-bool plot_clip(const struct rect *clip);
VdiHdl plot_get_vdi_handle(void);
long plot_get_flags(void);
-bool plot_rectangle( int x0, int y0, int x1, int y1,const struct plot_style_s *style );
-bool plot_line( int x0, int y0, int x1, int y1, const struct plot_style_s *style );
bool plot_blit_bitmap(struct bitmap * bmp, int x, int y,
unsigned long bg, unsigned long flags);
bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor, uint32_t flags);
diff --git a/frontends/atari/rootwin.c b/frontends/atari/rootwin.c
index aa8e08047..6576eac77 100644
--- a/frontends/atari/rootwin.c
+++ b/frontends/atari/rootwin.c
@@ -105,7 +105,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
switch (msg[0]) {
case WM_REDRAW:
- LOG("WM_REDRAW");
+ NSLOG(netsurf, INFO, "WM_REDRAW");
on_redraw(data->rootwin, msg);
break;
@@ -113,7 +113,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case WM_SIZED:
case WM_MOVED:
case WM_FULLED:
- LOG("WM_SIZED");
+ NSLOG(netsurf, INFO, "WM_SIZED");
on_resized(data->rootwin);
break;
@@ -132,7 +132,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case WM_TOPPED:
case WM_NEWTOP:
case WM_UNICONIFY:
- LOG("WM_TOPPED");
+ NSLOG(netsurf, INFO, "WM_TOPPED");
gui_set_input_gui_window(data->rootwin->active_gui_window);
//window_restore_active_gui_window(data->rootwin);
// TODO: use something like "restore_active_gui_window_state()"
@@ -143,7 +143,8 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
// TODO: this needs to iterate through all gui windows and
// check if the rootwin is this window...
if (data->rootwin->active_gui_window != NULL) {
- LOG("WM_CLOSED initiated destroy for bw %p", data->rootwin->active_gui_window->browser->bw);
+ NSLOG(netsurf, INFO, "WM_CLOSED initiated destroy for bw %p",
+ data->rootwin->active_gui_window->browser->bw);
browser_window_destroy(
data->rootwin->active_gui_window->browser->bw);
}
@@ -166,13 +167,16 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
// handle key
uint16_t nkc = gem_to_norm( (short)ev_out->emo_kmeta,
(short)ev_out->emo_kreturn);
- LOG("rootwin MU_KEYBD input, nkc: %x\n", nkc);
+ NSLOG(netsurf, INFO, "rootwin MU_KEYBD input, nkc: %x\n", nkc);
retval = on_window_key_input(data->rootwin, nkc);
// printf("on_window_key_input: %d\n", retval);
}
if ((ev_out->emo_events & MU_BUTTON) != 0) {
- LOG("rootwin MU_BUTTON input, x: %d, y: %d\n", ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_x);
+ NSLOG(netsurf, INFO,
+ "rootwin MU_BUTTON input, x: %d, y: %d\n",
+ ev_out->emo_mouse.p_x,
+ ev_out->emo_mouse.p_x);
window_get_grect(data->rootwin, BROWSER_AREA_CONTENT,
&area);
if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y,
@@ -312,13 +316,13 @@ void window_unref_gui_window(ROOTWIN *rootwin, struct gui_window *gw)
struct gui_window *w;
input_window = NULL;
- LOG("window: %p, gui_window: %p", rootwin, gw);
+ NSLOG(netsurf, INFO, "window: %p, gui_window: %p", rootwin, gw);
w = window_list;
// find the next active tab:
while( w != NULL ) {
if(w->root == rootwin && w != gw) {
- LOG("activating next tab %p", w);
+ NSLOG(netsurf, INFO, "activating next tab %p", w);
gui_set_input_gui_window(w);
break;
}
@@ -338,7 +342,7 @@ int window_destroy(ROOTWIN *rootwin)
assert(rootwin != NULL);
- LOG("%p", rootwin);
+ NSLOG(netsurf, INFO, "%p", rootwin);
if (gemtk_wm_get_user_data(rootwin->win) != NULL) {
free(gemtk_wm_get_user_data(rootwin->win));
@@ -404,7 +408,7 @@ void window_restore_active_gui_window(ROOTWIN *rootwin)
GRECT tb_area;
struct gui_window *gw;
- LOG("rootwin %p", rootwin);
+ NSLOG(netsurf, INFO, "rootwin %p", rootwin);
assert(rootwin->active_gui_window);
@@ -499,7 +503,7 @@ void window_set_focus(struct s_gui_win_root *rootwin,
assert(rootwin != NULL);
if (rootwin->focus.type != type || rootwin->focus.element != element) {
- LOG("Set focus: %p (%d)\n", element, type);
+ NSLOG(netsurf, INFO, "Set focus: %p (%d)\n", element, type);
rootwin->focus.type = type;
rootwin->focus.element = element;
switch( type ) {
@@ -563,11 +567,11 @@ void window_set_active_gui_window(ROOTWIN *rootwin, struct gui_window *gw)
{
struct gui_window *old_gw = rootwin->active_gui_window;
- LOG("gw %p",gw);
+ NSLOG(netsurf, INFO, "gw %p", gw);
if (rootwin->active_gui_window != NULL) {
if(rootwin->active_gui_window == gw) {
- LOG("nothing to do...");
+ NSLOG(netsurf, INFO, "nothing to do...");
return;
}
}
@@ -576,7 +580,7 @@ void window_set_active_gui_window(ROOTWIN *rootwin, struct gui_window *gw)
rootwin->active_gui_window = gw;
if (old_gw != NULL) {
- LOG("restoring window...");
+ NSLOG(netsurf, INFO, "restoring window...");
window_restore_active_gui_window(rootwin);
}
}
@@ -651,7 +655,7 @@ void window_open_search(ROOTWIN *rootwin, bool reformat)
GRECT area;
OBJECT *obj;
- LOG("rootwin %p", rootwin);
+ NSLOG(netsurf, INFO, "rootwin %p", rootwin);
gw = rootwin->active_gui_window;
bw = gw->browser->bw;
@@ -758,8 +762,11 @@ void window_redraw_favicon(ROOTWIN *rootwin, GRECT *clip_ro)
xoff = ((work.g_w-work.g_h)/2);
work.g_w = work.g_h;
}
- plot_set_dimensions( work.g_x+xoff, work.g_y, work.g_w,
- work.g_h);
+ plot_set_dimensions(&rootwin_rdrw_ctx,
+ work.g_x+xoff,
+ work.g_y,
+ work.g_w,
+ work.g_h);
wind_get_grect(rootwin->aes_handle, WF_FIRSTXYWH, &visible);
while (visible.g_h > 0 && visible.g_w > 0) {
@@ -776,8 +783,14 @@ void window_redraw_favicon(ROOTWIN *rootwin, GRECT *clip_ro)
vs_clip(plot_vdi_handle, 1, (short*)&pxy);
//dbg_pxy("vdi clip", (short*)&pxy);
- atari_plotters.bitmap(0, 0, work.g_w, work.g_h,
- rootwin->icon, 0xffffff, 0);
+ rootwin_rdrw_ctx.plot->bitmap(&rootwin_rdrw_ctx,
+ rootwin->icon,
+ 0,
+ 0,
+ work.g_w,
+ work.g_h,
+ 0xffffff,
+ 0);
} else {
//dbg_grect("redraw vis area outside", &visible);
}
@@ -822,7 +835,8 @@ static void window_redraw_content(ROOTWIN *rootwin, GRECT *content_area,
//dbg_grect("browser redraw, content area", content_area);
//dbg_grect("browser redraw, content clip", clip);
- plot_set_dimensions(content_area->g_x, content_area->g_y,
+ plot_set_dimensions(&rootwin_rdrw_ctx,
+ content_area->g_x, content_area->g_y,
content_area->g_w, content_area->g_h);
oldscale = plot_set_scale(browser_window_get_scale(rootwin->active_gui_window->browser->bw));
@@ -849,7 +863,7 @@ static void window_redraw_content(ROOTWIN *rootwin, GRECT *content_area,
redraw_area.x1 = content_area_rel.g_x + content_area_rel.g_w;
redraw_area.y1 = content_area_rel.g_y + content_area_rel.g_h;
- plot_clip(&redraw_area);
+ rootwin_rdrw_ctx.plot->clip(&rootwin_rdrw_ctx, &redraw_area);
//dbg_rect("rdrw area", &redraw_area);
@@ -1468,7 +1482,13 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8])
buff[size] = 0;
- LOG("file: %s, ext: %s, size: %ld dropped at: %d,%d\n", (char *)buff, (char *)&ext, size, mx, my);
+ NSLOG(netsurf, INFO,
+ "file: %s, ext: %s, size: %ld dropped at: %d,%d\n",
+ (char *)buff,
+ (char *)&ext,
+ size,
+ mx,
+ my);
gui_window_get_scroll(gw, &sx, &sy);
@@ -1490,7 +1510,8 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8])
if (ret != NSERROR_OK) {
free(buff);
/* A bad encoding should never happen */
- LOG("utf8_from_local_encoding failed");
+ NSLOG(netsurf, INFO,
+ "utf8_from_local_encoding failed");
assert(ret != NSERROR_BAD_ENCODING);
/* no memory */
goto error;
diff --git a/frontends/atari/schedule.c b/frontends/atari/schedule.c
index 48980426d..9a7836b1f 100644
--- a/frontends/atari/schedule.c
+++ b/frontends/atari/schedule.c
@@ -23,15 +23,10 @@
#include "utils/sys_time.h"
#include "utils/errors.h"
+#include "utils/log.h"
#include "atari/schedule.h"
-#ifdef DEBUG_SCHEDULER
-#include "utils/log.h"
-#else
-#define LOG(x...)
-#endif
-
#define MS_NOW() ((clock() * 1000) / CLOCKS_PER_SEC)
/* linked list of scheduled callbacks */
@@ -71,7 +66,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
return NSERROR_OK;
}
- LOG("removing %p, %p", callback, p);
+ NSLOG(schedule, DEBUG, "removing %p, %p", callback, p);
cur_nscb = schedule_list;
prev_nscb = NULL;
@@ -80,7 +75,9 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
if ((cur_nscb->callback == callback) &&
(cur_nscb->p == p)) {
/* item to remove */
- LOG("callback entry %p removing %p(%p)", cur_nscb, cur_nscb->callback, cur_nscb->p);
+ NSLOG(schedule, DEBUG,
+ "callback entry %p removing %p(%p)", cur_nscb,
+ cur_nscb->callback, cur_nscb->p);
/* remove callback */
unlnk_nscb = cur_nscb;
@@ -118,7 +115,8 @@ nserror atari_schedule(int ival, void (*callback)(void *p), void *p)
nscb->timeout = MS_NOW() + ival;
- LOG("adding callback %p for %p(%p) at %d ms", nscb, callback, p, nscb->timeout);
+ NSLOG(schedule, DEBUG, "adding callback %p for %p(%p) at %d ms", nscb,
+ callback, p, nscb->timeout);
nscb->callback = callback;
nscb->p = p;
@@ -164,7 +162,9 @@ int schedule_run(void)
prev_nscb->next = unlnk_nscb->next;
}
- LOG("callback entry %p running %p(%p)", unlnk_nscb, unlnk_nscb->callback, unlnk_nscb->p);
+ NSLOG(schedule, DEBUG,
+ "callback entry %p running %p(%p)", unlnk_nscb,
+ unlnk_nscb->callback, unlnk_nscb->p);
/* call callback */
unlnk_nscb->callback(unlnk_nscb->p);
@@ -173,7 +173,7 @@ int schedule_run(void)
/* need to deal with callback modifying the list. */
if (schedule_list == NULL) {
- LOG("schedule_list == NULL");
+ NSLOG(schedule, DEBUG, "schedule_list == NULL");
return -1; /* no more callbacks scheduled */
}
@@ -198,7 +198,8 @@ int schedule_run(void)
/* make rettime relative to now and convert to ms */
nexttime = nexttime - now;
- LOG("returning time to next event as %ldms", nexttime);
+ NSLOG(schedule, DEBUG, "returning time to next event as %ldms",
+ nexttime);
/*return next event time in milliseconds (24days max wait) */
return nexttime;
@@ -210,14 +211,15 @@ void list_schedule(void)
{
struct nscallback *cur_nscb;
- LOG("schedule list at ms clock %ld", MS_NOW());
+ NSLOG(schedule, DEBUG, "schedule list at ms clock %ld", MS_NOW());
cur_nscb = schedule_list;
while (cur_nscb != NULL) {
- LOG("Schedule %p at %ld", cur_nscb, cur_nscb->timeout);
+ NSLOG(schedule, DEBUG, "Schedule %p at %ld", cur_nscb,
+ cur_nscb->timeout);
cur_nscb = cur_nscb->next;
}
- LOG("Maxmium callbacks scheduled: %d", max_scheduled);
+ NSLOG(schedule, DEBUG, "Maxmium callbacks scheduled: %d", max_scheduled);
}
diff --git a/frontends/atari/search.c b/frontends/atari/search.c
index 4da7f16a3..8df4ad676 100644
--- a/frontends/atari/search.c
+++ b/frontends/atari/search.c
@@ -67,7 +67,7 @@ struct gui_search_table *atari_search_table = &search_table;
*/
void nsatari_search_set_status(bool found, void *p)
{
- LOG("%p set status: %d\n", p, found);
+ NSLOG(netsurf, INFO, "%p set status: %d\n", p, found);
// TODO: maybe update GUI
}
@@ -80,7 +80,7 @@ void nsatari_search_set_status(bool found, void *p)
void nsatari_search_set_hourglass(bool active, void *p)
{
SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
- LOG("active: %d, session: %p", active, p);
+ NSLOG(netsurf, INFO, "active: %d, session: %p", active, p);
if (active) {
gui_window_set_pointer(s->g, GUI_POINTER_PROGRESS);
} else {
@@ -99,7 +99,7 @@ void nsatari_search_set_hourglass(bool active, void *p)
*/
void nsatari_search_add_recent(const char *string, void *p)
{
- LOG("%p add recent: %s\n", p, string);
+ NSLOG(netsurf, INFO, "%p add recent: %s\n", p, string);
}
@@ -115,7 +115,7 @@ void nsatari_search_set_forward_state(bool active, void *p)
GRECT area;
SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
/* deactivate back cb */
- LOG("%p: set forward state: %d\n", p, active);
+ NSLOG(netsurf, INFO, "%p: set forward state: %d\n", p, active);
gw = s->g;
@@ -142,7 +142,7 @@ void nsatari_search_set_back_state(bool active, void *p)
GRECT area;
SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p;
/* deactivate back cb */
- LOG("%p: set back state: %d\n", p, active);
+ NSLOG(netsurf, INFO, "%p: set back state: %d\n", p, active);
s->state.back_avail = active;
gw = s->g;
@@ -224,7 +224,7 @@ void nsatari_search_restore_form( struct s_search_form_session *s, OBJECT *obj)
void nsatari_search_session_destroy(struct s_search_form_session *s)
{
if (s != NULL) {
- LOG("session %p", s);
+ NSLOG(netsurf, INFO, "session %p", s);
browser_window_search_clear(s->g->browser->bw);
free(s);
}
diff --git a/frontends/atari/settings.c b/frontends/atari/settings.c
index ed1fb2e45..7084bacf7 100644
--- a/frontends/atari/settings.c
+++ b/frontends/atari/settings.c
@@ -172,7 +172,7 @@ static char **read_locales(void)
atari_warn_user("Failed to load locales: %s",buf);
return(NULL);
} else {
- LOG("Reading locales from: %s...", buf);
+ NSLOG(netsurf, INFO, "Reading locales from: %s...", buf);
}
/* Count items: */
@@ -257,15 +257,15 @@ static void display_settings(void)
/* "Cache" tab: */
tmp_option_memory_cache_size = nsoption_int(memory_cache_size) / (1024*1024);
- snprintf( spare, 255, "%d", tmp_option_memory_cache_size );
+ snprintf( spare, 255, "%u", tmp_option_memory_cache_size );
set_text( SETTINGS_STR_MAX_MEM_CACHE, spare, 4 );
tmp_option_disc_cache_size = nsoption_int(disc_cache_size) / (1024*1024);
- snprintf( spare, 255, "%d", tmp_option_disc_cache_size );
+ snprintf( spare, 255, "%u", tmp_option_disc_cache_size );
set_text( SETTINGS_STR_MAX_DISC_CACHE, spare, 4 );
tmp_option_disc_cache_age = nsoption_int(disc_cache_age);
- snprintf( spare, 255, "%02d", tmp_option_disc_cache_age );
+ snprintf( spare, 255, "%02u", tmp_option_disc_cache_age );
set_text( SETTINGS_EDIT_CACHE_AGE, spare, 3 );
/* "Paths" tab: */
@@ -303,7 +303,7 @@ static void display_settings(void)
// TODO: activate this option?
tmp_option_min_reflow_period = nsoption_int(min_reflow_period);
- snprintf( spare, 255, "%04d", tmp_option_min_reflow_period );
+ snprintf( spare, 255, "%04u", tmp_option_min_reflow_period );
set_text( SETTINGS_EDIT_MIN_REFLOW_PERIOD, spare,
INPUT_MIN_REFLOW_PERIOD_MAX_LEN );
@@ -597,7 +597,7 @@ static void form_event(int index, int external)
tmp_option_memory_cache_size = 1;
if( tmp_option_memory_cache_size > 999 )
tmp_option_memory_cache_size = 999;
- snprintf( spare, 255, "%02d", tmp_option_memory_cache_size );
+ snprintf( spare, 255, "%02u", tmp_option_memory_cache_size );
set_text( SETTINGS_STR_MAX_MEM_CACHE, spare, 5 );
is_button = true;
OBJ_REDRAW(SETTINGS_STR_MAX_MEM_CACHE);
@@ -614,7 +614,7 @@ static void form_event(int index, int external)
tmp_option_disc_cache_size = 1;
if( tmp_option_disc_cache_size > 9999 )
tmp_option_disc_cache_size = 9999;
- snprintf( spare, 255, "%02d", tmp_option_disc_cache_size );
+ snprintf( spare, 255, "%02u", tmp_option_disc_cache_size );
set_text( SETTINGS_STR_MAX_DISC_CACHE, spare, 5 );
is_button = true;
OBJ_REDRAW(SETTINGS_STR_MAX_DISC_CACHE);
@@ -630,7 +630,7 @@ static void form_event(int index, int external)
if( tmp_option_disc_cache_age > 99 )
tmp_option_disc_cache_age = 0;
- snprintf( spare, 255, "%02d", tmp_option_disc_cache_age );
+ snprintf( spare, 255, "%02u", tmp_option_disc_cache_age );
set_text( SETTINGS_EDIT_CACHE_AGE, spare, 2 );
is_button = true;
OBJ_REDRAW(SETTINGS_EDIT_CACHE_AGE);
@@ -645,7 +645,7 @@ static void form_event(int index, int external)
if( tmp_option_max_cached_fetch_handles > 31 )
tmp_option_max_cached_fetch_handles = 31;
- snprintf( spare, 255, "%02d", tmp_option_max_cached_fetch_handles );
+ snprintf( spare, 255, "%02u", tmp_option_max_cached_fetch_handles );
set_text( SETTINGS_EDIT_MAX_CACHED_CONNECTIONS, spare, 2 );
is_button = true;
OBJ_REDRAW(SETTINGS_EDIT_MAX_CACHED_CONNECTIONS);
@@ -660,7 +660,7 @@ static void form_event(int index, int external)
if( tmp_option_max_fetchers > 31 )
tmp_option_max_fetchers = 31;
- snprintf( spare, 255, "%02d", tmp_option_max_fetchers );
+ snprintf( spare, 255, "%02u", tmp_option_max_fetchers );
set_text( SETTINGS_EDIT_MAX_FETCHERS, spare, 2 );
is_button = true;
OBJ_REDRAW(SETTINGS_EDIT_MAX_FETCHERS);
@@ -675,7 +675,7 @@ static void form_event(int index, int external)
if( tmp_option_max_fetchers_per_host > 31 )
tmp_option_max_fetchers_per_host = 31;
- snprintf( spare, 255, "%02d", tmp_option_max_fetchers_per_host );
+ snprintf( spare, 255, "%02u", tmp_option_max_fetchers_per_host );
set_text( SETTINGS_EDIT_MAX_FETCHERS_PER_HOST, spare, 2 );
is_button = true;
OBJ_REDRAW(SETTINGS_EDIT_MAX_FETCHERS_PER_HOST);
@@ -691,7 +691,7 @@ static void form_event(int index, int external)
if( tmp_option_expire_url > 99 )
tmp_option_expire_url = 0;
- snprintf( spare, 255, "%02d", tmp_option_expire_url );
+ snprintf( spare, 255, "%02u", tmp_option_expire_url );
set_text( SETTINGS_EDIT_HISTORY_AGE, spare, 2 );
is_button = true;
OBJ_REDRAW(SETTINGS_EDIT_HISTORY_AGE);
@@ -726,7 +726,7 @@ static void form_event(int index, int external)
if( tmp_option_font_min_size < 10 )
tmp_option_font_min_size = 10;
- snprintf( spare, 255, "%03d", tmp_option_font_min_size );
+ snprintf( spare, 255, "%03u", tmp_option_font_min_size );
set_text( SETTINGS_EDIT_MIN_FONT_SIZE, spare, 3 );
is_button = true;
OBJ_REDRAW(SETTINGS_EDIT_MIN_FONT_SIZE);
@@ -744,7 +744,7 @@ static void form_event(int index, int external)
if( tmp_option_font_size < 50 )
tmp_option_font_size = 50;
- snprintf( spare, 255, "%03d", tmp_option_font_size );
+ snprintf( spare, 255, "%03u", tmp_option_font_size );
set_text( SETTINGS_EDIT_DEF_FONT_SIZE, spare, 3 );
is_button = true;
OBJ_REDRAW(SETTINGS_EDIT_DEF_FONT_SIZE);
@@ -760,7 +760,7 @@ static void form_event(int index, int external)
if( tmp_option_min_reflow_period > 9999 )
tmp_option_min_reflow_period = 10;
- snprintf( spare, 255, "%04d", tmp_option_min_reflow_period );
+ snprintf( spare, 255, "%04u", tmp_option_min_reflow_period );
set_text( SETTINGS_EDIT_MIN_REFLOW_PERIOD, spare, 4 );
is_button = true;
OBJ_REDRAW(SETTINGS_EDIT_MIN_REFLOW_PERIOD);
@@ -980,12 +980,12 @@ void open_settings(void)
void close_settings(void)
{
- LOG("closing");
+ NSLOG(netsurf, INFO, "closing");
gemtk_wm_remove(settings_guiwin);
settings_guiwin = NULL;
wind_close(h_aes_win);
wind_delete(h_aes_win);
h_aes_win = 0;
- LOG("Done");
+ NSLOG(netsurf, INFO, "Done");
}
diff --git a/frontends/atari/statusbar.c b/frontends/atari/statusbar.c
index 3a216f9a8..fe2008c82 100644
--- a/frontends/atari/statusbar.c
+++ b/frontends/atari/statusbar.c
@@ -166,7 +166,7 @@ CMP_STATUSBAR sb_create( struct gui_window * gw )
void sb_destroy( CMP_STATUSBAR s )
{
- LOG("%s\n", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s\n", __FUNCTION__);
if( s ) {
if( s->comp ){
mt_CompDelete( &app, s->comp );
@@ -206,7 +206,7 @@ CMP_STATUSBAR sb_create( struct gui_window * gw )
void sb_destroy( CMP_STATUSBAR s )
{
- LOG("%s\n", __FUNCTION__);
+ NSLOG(netsurf, INFO, "%s\n", __FUNCTION__);
if( s ) {
free( s );
}
diff --git a/frontends/atari/toolbar.c b/frontends/atari/toolbar.c
index 9ed87849c..b8f42267f 100644
--- a/frontends/atari/toolbar.c
+++ b/frontends/atari/toolbar.c
@@ -94,7 +94,7 @@ static float toolbar_url_scale = 1.0;
static plot_font_style_t font_style_url = {
.family = PLOT_FONT_FAMILY_SANS_SERIF,
- .size = 14*FONT_SIZE_SCALE,
+ .size = 14*PLOT_STYLE_SCALE,
.weight = 400,
.flags = FONTF_NONE,
.background = 0xffffff,
@@ -269,7 +269,7 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
int i;
struct s_toolbar *t;
- LOG("owner %p", owner);
+ NSLOG(netsurf, INFO, "owner %p", owner);
assert(init == true);
@@ -302,7 +302,7 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
/* create the url widget: */
font_style_url.size =
- toolbar_styles[t->style].font_height_pt * FONT_SIZE_SCALE;
+ toolbar_styles[t->style].font_height_pt * PLOT_STYLE_SCALE;
textarea_flags ta_flags = TEXTAREA_INTERNAL_CARET;
textarea_setup ta_setup;
@@ -327,8 +327,9 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
t->throbber.max_index = THROBBER_MAX_INDEX;
t->throbber.running = false;
- LOG("created toolbar: %p, root: %p, textarea: %p, throbber: %p",
- t, owner, t->url.textarea, &t->throbber);
+ NSLOG(netsurf, INFO,
+ "created toolbar: %p, root: %p, textarea: %p, throbber: %p", t,
+ owner, t->url.textarea, &t->throbber);
return( t );
}
@@ -435,7 +436,7 @@ void toolbar_redraw(struct s_toolbar *tb, GRECT *clip)
if (rc_intersect(clip, &area)) {
float old_scale;
- plot_set_dimensions(area_ro.g_x, area_ro.g_y, area_ro.g_w, area_ro.g_h);
+ plot_set_dimensions(&toolbar_rdrw_ctx, area_ro.g_x, area_ro.g_y, area_ro.g_w, area_ro.g_h);
struct rect r = {
.x0 = MAX(0,area.g_x - area_ro.g_x),
.y0 = MAX(0,area.g_y - area_ro.g_y),
@@ -458,7 +459,7 @@ toolbar_update_buttons(struct s_toolbar *tb,
struct browser_window *bw,
short button)
{
- LOG("tb %p", tb);
+ NSLOG(netsurf, INFO, "tb %p", tb);
struct s_tb_button * bt;
bool enable = false;
@@ -582,7 +583,7 @@ void toolbar_set_dimensions(struct s_toolbar *tb, GRECT *area)
void toolbar_set_url(struct s_toolbar *tb, const char *text)
{
- LOG("tb %p", tb);
+ NSLOG(netsurf, INFO, "tb %p", tb);
textarea_set_text(tb->url.textarea, text);
@@ -668,7 +669,7 @@ bool toolbar_text_input(struct s_toolbar *tb, char *text)
{
bool handled = true;
- LOG("tb %p", tb);
+ NSLOG(netsurf, INFO, "tb %p", tb);
return(handled);
}
@@ -757,7 +758,7 @@ void toolbar_mouse_input(struct s_toolbar *tb, short obj, short button)
short mx, my, mb, kstat;
struct gui_window * gw;
- LOG("tb %p", tb);
+ NSLOG(netsurf, INFO, "tb %p", tb);
if (obj==TOOLBAR_AREA_URL) {
diff --git a/frontends/atari/treeview.c b/frontends/atari/treeview.c
index 93aef6eb6..23db41309 100644
--- a/frontends/atari/treeview.c
+++ b/frontends/atari/treeview.c
@@ -16,21 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <sys/types.h>
-#include <string.h>
-
#include "assert.h"
-#include "cflib.h"
-#include "netsurf/inttypes.h"
-#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
-#include "utils/utils.h"
-#include "netsurf/plotters.h"
-#include "netsurf/mouse.h"
+#include "netsurf/inttypes.h"
#include "netsurf/core_window.h"
-#include "desktop/treeview.h"
+#include "netsurf/plotters.h"
#include "atari/gui.h"
#include "atari/plot/plot.h"
@@ -40,30 +32,6 @@
#include "atari/res/netsurf.rsh"
-/**
- * Declare Core Window Callbacks:
- */
-
-void atari_treeview_redraw_request(struct core_window *cw,
- const struct rect *r);
-void atari_treeview_update_size(struct core_window *cw, int width, int height);
-void atari_treeview_scroll_visible(struct core_window *cw,
- const struct rect *r);
-void atari_treeview_get_window_dimensions(struct core_window *cw,
- int *width, int *height);
- // TODO: implement drag status!
-void atari_treeview_drag_status(struct core_window *cw,
- core_window_drag_status ds);
-
-static struct core_window_callback_table cw_t = {
- .redraw_request = atari_treeview_redraw_request,
- .update_size = atari_treeview_update_size,
- .scroll_visible = atari_treeview_scroll_visible,
- .get_window_dimensions = atari_treeview_get_window_dimensions,
- .drag_status = atari_treeview_drag_status
-};
-
-
struct atari_treeview_window {
struct atari_treeview_window * prev_open;
struct atari_treeview_window * next_open;
@@ -81,23 +49,12 @@ struct atari_treeview_window {
static struct atari_treeview_window * treeviews_open;
-/* native GUI event handlers: */
-static void on_mbutton_event(struct core_window *cw, EVMULT_OUT *ev_out,
- short msg[8]);
-static void on_keybd_event(struct core_window *cw, EVMULT_OUT *ev_out,
- short msg[8]);
-static void on_redraw_event(struct core_window *cw, EVMULT_OUT *ev_out,
- short msg[8]);
-
-/* static utils: */
-//static void atari_treeview_dump_info(struct atari_treeview_window *tv, char *s);
-
/**
* Schedule a redraw of the treeview content
*
*/
-static void atari_treeview_redraw_grect_request(struct core_window *cw,
- GRECT *area)
+static void
+atari_treeview_redraw_grect_request(struct core_window *cw, GRECT *area)
{
struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
if (cw != NULL) {
@@ -115,260 +72,77 @@ static void atari_treeview_redraw_grect_request(struct core_window *cw,
int oldy1 = tv->rdw_area.g_y + tv->rdw_area.g_h;
tv->rdw_area.g_x = MIN(tv->rdw_area.g_x, area->g_x);
tv->rdw_area.g_y = MIN(tv->rdw_area.g_y, area->g_y);
- tv->rdw_area.g_w = ( oldx1 > newx1 ) ? oldx1 - tv->rdw_area.g_x : newx1 - tv->rdw_area.g_x;
- tv->rdw_area.g_h = ( oldy1 > newy1 ) ? oldy1 - tv->rdw_area.g_y : newy1 - tv->rdw_area.g_y;
- }
- //dbg_grect("atari_treeview_request_redraw_grect", &tv->rdw_area);
- }
-}
-
-
-void atari_treeview_get_grect(struct core_window *cw, enum treeview_area_e mode,
- GRECT *dest)
-{
- struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
+ if ( oldx1 > newx1 ) {
+ tv->rdw_area.g_w = oldx1 - tv->rdw_area.g_x;
+ } else {
+ tv->rdw_area.g_w = newx1 - tv->rdw_area.g_x;
+ }
- if (mode == TREEVIEW_AREA_CONTENT) {
- gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, dest);
- }
- else if (mode == TREEVIEW_AREA_TOOLBAR) {
- gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_TOOLBAR, dest);
+ if ( oldy1 > newy1 ) {
+ tv->rdw_area.g_h = oldy1 - tv->rdw_area.g_y;
+ } else {
+ tv->rdw_area.g_h = newy1 - tv->rdw_area.g_y;
+ }
+ }
+ //dbg_grect("atari_treeview_request_redraw_grect", &tv->rdw_area);
}
}
-GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw)
-{
- struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
- return(tv->window);
-}
-/*
-static void atari_treeview_dump_info(struct atari_treeview_window *tv,
- char * title)
+#ifdef ATARI_TREEVIEW_DUMP
+static void
+atari_treeview_dump_info(struct atari_treeview_window *tv, char * title)
{
printf("Treeview Dump (%s)\n", title);
printf("=================================\n");
gemtk_wm_dump_window_info(atari_treeview_get_gemtk_window((struct core_window *)tv));
GEMTK_DBG_GRECT("Redraw Area: \n", &tv->rdw_area)
- dbg_grect("Redraw Area2: \n", &tv->rdw_area);
+ dbg_grect("Redraw Area2: \n", &tv->rdw_area);
printf("Extent: x: %d, y: %d\n", tv->extent.x, tv->extent.y);
}
-*/
+#endif
-static bool atari_treeview_is_iconified(struct core_window *cw){
- struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
+static bool atari_treeview_is_iconified(struct core_window *cw)
+{
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
- return((gemtk_wm_get_state(tv->window)&GEMTK_WM_STATUS_ICONIFIED) != 0);
+ return((gemtk_wm_get_state(tv->window)&GEMTK_WM_STATUS_ICONIFIED) != 0);
}
-static void atari_treeview_redraw_icon(struct core_window *cw, GRECT *clip)
-{
- struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
- GRECT visible, work;
- OBJECT * tree = gemtk_obj_get_tree(ICONIFY);
- short aesh = gemtk_wm_get_handle(tv->window);
-
- gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_WORK, &work);
-
- tree->ob_x = work.g_x;
- tree->ob_y = work.g_y;
- tree->ob_width = work.g_w;
- tree->ob_height = work.g_h;
-
- wind_get_grect(aesh, WF_FIRSTXYWH, &visible);
- while (visible.g_h > 0 && visible.g_w > 0) {
-
- if (rc_intersect(&work, &visible)) {
- objc_draw(tree, 0, 8, visible.g_x, visible.g_y, visible.g_w,
- visible.g_h);
- } else {
- //dbg_grect("redraw vis area outside", &visible);
- }
-
- wind_get_grect(aesh, WF_NEXTXYWH, &visible);
- }
-}
-void atari_treeview_redraw(struct core_window *cw)
+static void atari_treeview_redraw_icon(struct core_window *cw, GRECT *clip)
{
struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
- short pxy[4];
-
- if (tv != NULL && tv->is_open) {
- if( tv->redraw && ((plot_get_flags() & PLOT_FLAG_OFFSCREEN) == 0) ) {
+ GRECT visible, work;
+ OBJECT * tree = gemtk_obj_get_tree(ICONIFY);
+ short aesh = gemtk_wm_get_handle(tv->window);
- short todo[4];
- GRECT work;
- short handle = gemtk_wm_get_handle(tv->window);
- struct gemtk_wm_scroll_info_s *slid;
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_WORK, &work);
- gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
- slid = gemtk_wm_get_scroll_info(tv->window);
+ tree->ob_x = work.g_x;
+ tree->ob_y = work.g_y;
+ tree->ob_width = work.g_w;
+ tree->ob_height = work.g_h;
-// // Debug code: this 3 lines help to inspect the redraw
-// // areas...
-// pxy[0] = work.g_x;
-// pxy[1] = work.g_y;
-// pxy[2] = pxy[0] + work.g_w-1;
-// pxy[3] = pxy[1] + work.g_h-1;
-//
-// vsf_color(plot_get_vdi_handle(), 0);
-// v_bar(plot_get_vdi_handle(), (short*)&pxy);
-// evnt_timer(500);
+ wind_get_grect(aesh, WF_FIRSTXYWH, &visible);
+ while (visible.g_h > 0 && visible.g_w > 0) {
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &atari_plotters
- };
- plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
- if (plot_lock() == false)
- return;
-
- if( wind_get(handle, WF_FIRSTXYWH,
- &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
- while (todo[2] && todo[3]) {
-
- if(!rc_intersect(&work, (GRECT*)&todo)){
- if (wind_get(handle, WF_NEXTXYWH,
- &todo[0], &todo[1], &todo[2], &todo[3])==0) {
- break;
- }
- continue;
- }
- pxy[0] = todo[0];
- pxy[1] = todo[1];
- pxy[2] = todo[0] + todo[2]-1;
- pxy[3] = todo[1] + todo[3]-1;
- vs_clip(plot_get_vdi_handle(), 1, (short*)&pxy);
-
- // Debug code: this 3 lines help to inspect the redraw
- // areas...
-
-// vsf_color(plot_get_vdi_handle(), 3);
-// v_bar(plot_get_vdi_handle(), (short*)&pxy);
-// evnt_timer(500);
-
-
- /* convert screen to treeview coords: */
- todo[0] = todo[0] - work.g_x ;//+ slid->x_pos*slid->x_unit_px;
- todo[1] = todo[1] - work.g_y ;//+ slid->y_pos*slid->y_unit_px;
- if( todo[0] < 0 ){
- todo[2] = todo[2] + todo[0];
- todo[0] = 0;
- }
- if( todo[1] < 0 ){
- todo[3] = todo[3] + todo[1];
- todo[1] = 0;
- }
-
- if (rc_intersect((GRECT *)&tv->rdw_area,(GRECT *)&todo)) {
- struct rect clip;
-
- clip.x0 = todo[0]+(slid->x_pos*slid->x_unit_px);
- clip.y0 = todo[1]+(slid->y_pos*slid->y_unit_px);
- clip.x1 = clip.x0 + todo[2]+(slid->x_pos*slid->x_unit_px);
- clip.y1 = clip.y0 + todo[3]+(slid->y_pos*slid->y_unit_px);
-
- tv->io->draw(cw, -(slid->x_pos*slid->x_unit_px),
- -(slid->y_pos*slid->y_unit_px),
- &clip, &ctx);
- }
- vs_clip(plot_get_vdi_handle(), 0, (short*)&pxy);
- if (wind_get(handle, WF_NEXTXYWH,
- &todo[0], &todo[1], &todo[2], &todo[3])==0) {
- break;
- }
- }
- } else {
- plot_unlock();
- return;
- }
- plot_unlock();
- tv->redraw = false;
- tv->rdw_area.g_x = 65000;
- tv->rdw_area.g_y = 65000;
- tv->rdw_area.g_w = -1;
- tv->rdw_area.g_h = -1;
+ if (rc_intersect(&work, &visible)) {
+ objc_draw(tree, 0, 8, visible.g_x, visible.g_y, visible.g_w,
+ visible.g_h);
} else {
- /* just copy stuff from the offscreen buffer */
+ //dbg_grect("redraw vis area outside", &visible);
}
- }
-}
-
-/**
- * GEMTK (netsurf's GEM toolkit) event sink
- *
-*/
-static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
-{
- short retval = 0;
- struct atari_treeview_window *tv = (struct atari_treeview_window *)
- gemtk_wm_get_user_data(win);
- struct core_window *cw = (struct core_window *)tv;
-
- if( (ev_out->emo_events & MU_MESAG) != 0 ) {
- // handle message
- switch (msg[0]) {
-
- case WM_REDRAW:
- on_redraw_event(cw, ev_out, msg);
- break;
-
- default:
- break;
- }
- }
- if( (ev_out->emo_events & MU_KEYBD) != 0 ) {
- on_keybd_event(cw, ev_out, msg);
- }
- if( (ev_out->emo_events & MU_BUTTON) != 0 ) {
- LOG("Treeview click at: %d,%d\n", ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y);
- on_mbutton_event(cw, ev_out, msg);
- }
-
- if(tv != NULL && tv->io->gemtk_user_func != NULL){
- tv->io->gemtk_user_func(win, ev_out, msg);
- }
-
- // TODO: evaluate return values of event handler functions and pass them on:
- return(retval);
-}
-
-
-static void __CDECL on_keybd_event(struct core_window *cw, EVMULT_OUT *ev_out,
- short msg[8])
-{
- long kstate = 0;
- long kcode = 0;
- long ucs4;
- long ik;
- unsigned short nkc = 0;
- unsigned char ascii;
- struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
-
- kstate = ev_out->emo_kmeta;
- kcode = ev_out->emo_kreturn;
- nkc= gem_to_norm( (short)kstate, (short)kcode );
- ascii = (nkc & 0xFF);
- ik = nkc_to_input_key(nkc, &ucs4);
-
- if (ik == 0) {
- if (ascii >= 9) {
- tv->io->keypress(cw, ucs4);
- }
- } else {
- tv->io->keypress(cw, ik);
+ wind_get_grect(aesh, WF_NEXTXYWH, &visible);
}
}
-static void __CDECL on_redraw_event(struct core_window *cw,
- EVMULT_OUT *ev_out,
- short msg[8])
+static void __CDECL
+on_redraw_event(struct core_window *cw, EVMULT_OUT *ev_out, short msg[8])
{
GRECT work, clip;
struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
@@ -425,9 +199,9 @@ static void __CDECL on_redraw_event(struct core_window *cw,
}
}
-static void __CDECL on_mbutton_event(struct core_window *cw,
- EVMULT_OUT *ev_out,
- short msg[8])
+
+static void __CDECL
+on_mbutton_event(struct core_window *cw, EVMULT_OUT *ev_out, short msg[8])
{
struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
struct gemtk_wm_scroll_info_s *slid;
@@ -444,26 +218,26 @@ static void __CDECL on_mbutton_event(struct core_window *cw,
/* mouse click relative origin: */
- short origin_rel_x = (mx-work.g_x) +
- (slid->x_pos*slid->x_unit_px);
- short origin_rel_y = (my-work.g_y) +
- (slid->y_pos*slid->y_unit_px);
+ short origin_rel_x = (mx-work.g_x) + (slid->x_pos*slid->x_unit_px);
+ short origin_rel_y = (my-work.g_y) + (slid->y_pos*slid->y_unit_px);
/* Only pass on events in the content area: */
- if( origin_rel_x >= 0 && origin_rel_y >= 0
- && mx < work.g_x + work.g_w
- && my < work.g_y + work.g_h )
- {
+ if ((origin_rel_x >= 0) &&
+ (origin_rel_y >= 0) &&
+ (mx < work.g_x + work.g_w) &&
+ (my < work.g_y + work.g_h)) {
if (ev_out->emo_mclicks == 2) {
tv->io->mouse_action(cw,
- BROWSER_MOUSE_CLICK_1|BROWSER_MOUSE_DOUBLE_CLICK,
- origin_rel_x, origin_rel_y);
+ BROWSER_MOUSE_CLICK_1 |
+ BROWSER_MOUSE_DOUBLE_CLICK,
+ origin_rel_x,
+ origin_rel_y);
return;
}
graf_mkstate(&cur_rel_x, &cur_rel_y, &mbut, &dummy);
/* check for click or hold: */
- if( (mbut&1) == 0 ){
+ if ((mbut & 1) == 0 ) {
int bms;
bms = BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1;
if(ev_out->emo_mclicks == 2 ) {
@@ -483,43 +257,282 @@ static void __CDECL on_mbutton_event(struct core_window *cw,
tv->startdrag.x = origin_rel_x;
tv->startdrag.y = origin_rel_y;
/* First, report mouse press, to trigger entry selection */
- tv->io->mouse_action(cw, BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1, cur_rel_x,
- cur_rel_y);
+ tv->io->mouse_action(cw,
+ BROWSER_MOUSE_CLICK_1 |
+ BROWSER_MOUSE_PRESS_1,
+ cur_rel_x,
+ cur_rel_y);
atari_treeview_redraw(cw);
- tv->io->mouse_action(cw, BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON,
- cur_rel_x, cur_rel_y);
- do{
- if (abs(prev_x-cur_rel_x) > 5 || abs(prev_y-cur_rel_y) > 5) {
+ tv->io->mouse_action(cw,
+ BROWSER_MOUSE_DRAG_1 |
+ BROWSER_MOUSE_DRAG_ON,
+ cur_rel_x,
+ cur_rel_y);
+ do {
+ if (abs(prev_x-cur_rel_x) > 5 ||
+ abs(prev_y-cur_rel_y) > 5) {
tv->io->mouse_action(cw,
- BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON,
- cur_rel_x, cur_rel_y);
+ BROWSER_MOUSE_HOLDING_1 |
+ BROWSER_MOUSE_DRAG_ON,
+ cur_rel_x,
+ cur_rel_y);
prev_x = cur_rel_x;
prev_y = cur_rel_y;
}
if (tv->redraw) {
// TODO: maybe GUI poll would fit better here?
- // ... is gui_poll re-entrance save?
+ // ... is gui_poll re-entrance save?
atari_treeview_redraw(cw);
}
/* sample mouse button state: */
- graf_mkstate(&cur_rel_x, &cur_rel_y, &mbut, &dummy);
- cur_rel_x = (cur_rel_x-work.g_x)+(slid->x_pos*slid->x_unit_px);
- cur_rel_y = (cur_rel_y-work.g_y)+(slid->y_pos*slid->y_unit_px);
- } while( mbut & 1 );
+ graf_mkstate(&cur_rel_x,
+ &cur_rel_y,
+ &mbut,
+ &dummy);
+ cur_rel_x = (cur_rel_x-work.g_x) +
+ (slid->x_pos*slid->x_unit_px);
+ cur_rel_y = (cur_rel_y-work.g_y) +
+ (slid->y_pos*slid->y_unit_px);
+ } while (mbut & 1);
/* End drag: */
- tv->io->mouse_action(cw, BROWSER_MOUSE_HOVER, cur_rel_x, cur_rel_y);
+ tv->io->mouse_action(cw,
+ BROWSER_MOUSE_HOVER,
+ cur_rel_x,
+ cur_rel_y);
gem_set_cursor(&gem_cursors.arrow);
}
}
}
+static void __CDECL
+on_keybd_event(struct core_window *cw, EVMULT_OUT *ev_out, short msg[8])
+{
+ long kstate = 0;
+ long kcode = 0;
+ long ucs4;
+ long ik;
+ unsigned short nkc = 0;
+ unsigned char ascii;
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
+
+ kstate = ev_out->emo_kmeta;
+ kcode = ev_out->emo_kreturn;
+ nkc= gem_to_norm( (short)kstate, (short)kcode );
+ ascii = (nkc & 0xFF);
+ ik = nkc_to_input_key(nkc, &ucs4);
+
+ if (ik == 0) {
+ if (ascii >= 9) {
+ tv->io->keypress(cw, ucs4);
+ }
+ } else {
+ tv->io->keypress(cw, ik);
+ }
+}
+
+
+/**
+ * GEMTK (netsurf's GEM toolkit) event sink
+ *
+ */
+static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
+{
+ short retval = 0;
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)
+ gemtk_wm_get_user_data(win);
+ struct core_window *cw = (struct core_window *)tv;
+
+ if( (ev_out->emo_events & MU_MESAG) != 0 ) {
+ // handle message
+ switch (msg[0]) {
+
+ case WM_REDRAW:
+ on_redraw_event(cw, ev_out, msg);
+ break;
+
+ default:
+ break;
+ }
+ }
+ if ((ev_out->emo_events & MU_KEYBD) != 0 ) {
+ on_keybd_event(cw, ev_out, msg);
+ }
+ if ((ev_out->emo_events & MU_BUTTON) != 0 ) {
+ NSLOG(netsurf, INFO, "Treeview click at: %d,%d\n",
+ ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y);
+ on_mbutton_event(cw, ev_out, msg);
+ }
+
+ if (tv != NULL && tv->io->gemtk_user_func != NULL){
+ tv->io->gemtk_user_func(win, ev_out, msg);
+ }
+
+ // TODO: evaluate return values of event handler functions and pass them on:
+ return(retval);
+}
+
+
+/**
+ * callback from core to request an invalidation of a window area.
+ *
+ * The specified area of the window should now be considered
+ * out of date. If the area is NULL the entire window must be
+ * invalidated.
+ *
+ * \param[in] cw The core window to invalidate.
+ * \param[in] r area to redraw or NULL for the entire window area.
+ * \return NSERROR_OK on success or appropriate error code.
+ */
+static nserror
+atari_treeview_invalidate_area(struct core_window *cw,
+ const struct rect *r)
+{
+ GRECT area;
+ struct gemtk_wm_scroll_info_s * slid;
+ struct atari_treeview_window * tv = (struct atari_treeview_window *)cw;
+
+ assert(tv);
+
+ if (r != NULL) {
+ RECT_TO_GRECT(r, &area);
+
+ slid = gemtk_wm_get_scroll_info(tv->window);
+
+ //dbg_rect("redraw rect request", r);
+
+ // treeview redraw is always full window width:
+ area.g_x = 0;
+ area.g_w = 8000;
+ // but vertical redraw region is clipped:
+ area.g_y = r->y0 - (slid->y_pos*slid->y_unit_px);
+ area.g_h = r->y1 - r->y0;
+ } else {
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &area);
+ }
+ atari_treeview_redraw_grect_request(cw, &area);
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Update the limits of the window
+ *
+ * \param cw the core window object
+ * \param width the width in px, or negative if don't care
+ * \param height the height in px, or negative if don't care
+ */
+static void
+atari_treeview_update_size(struct core_window *cw, int width, int height)
+{
+ GRECT area;
+ struct gemtk_wm_scroll_info_s *slid;
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
+
+ if (tv != NULL) {
+
+ if (tv->disposing)
+ return;
+
+ /* Get acces to the gemtk window slider settings: */
+ slid = gemtk_wm_get_scroll_info(tv->window);
+
+ /* recalculate and refresh sliders: */
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &area);
+ if (width > -1) {
+ slid->x_units = (width/slid->x_unit_px);
+ } else {
+ slid->x_units = 1;
+ }
+
+ if (height > -1) {
+ slid->y_units = (height/slid->y_unit_px);
+ } else {
+ slid->y_units = 1;
+ }
+
+ tv->extent.x = width;
+ tv->extent.y = height;
+
+
+ /* printf("units content: %d, units viewport: %d\n",
+ (height/slid->y_unit_px),
+ (area.g_h/slid->y_unit_px));
+ */
+ gemtk_wm_update_slider(tv->window, GEMTK_WM_VH_SLIDER);
+ }
+}
+
+
+/**
+ * Scroll the window to make area visible
+ *
+ * \param cw the core window object
+ * \param r rectangle to make visible
+ */
+static void
+atari_treeview_scroll_visible(struct core_window *cw, const struct rect *r)
+{
+ /* atari frontend doesn't support dragging outside the treeview */
+ /* so there is no need to implement this? */
+}
+
+
+/**
+ * Get window viewport dimensions
+ *
+ * \param cw the core window object
+ * \param width to be set to viewport width in px, if non NULL
+ * \param height to be set to viewport height in px, if non NULL
+ */
+static void
+atari_treeview_get_window_dimensions(struct core_window *cw,
+ int *width,
+ int *height)
+{
+ if ((cw != NULL) &&
+ (width != NULL || height != NULL)) {
+ GRECT work;
+ atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &work);
+ *width = work.g_w;
+ *height = work.g_h;
+ }
+}
+
+
+/**
+ * Inform corewindow owner of drag status
+ *
+ * \param cw the core window object
+ * \param ds the current drag status
+ */
+static void
+atari_treeview_drag_status(struct core_window *cw, core_window_drag_status ds)
+{
+
+}
+
+
+/**
+ * Declare Core Window Callbacks:
+ */
+static struct core_window_callback_table cw_t = {
+ .invalidate = atari_treeview_invalidate_area,
+ .update_size = atari_treeview_update_size,
+ .scroll_visible = atari_treeview_scroll_visible,
+ .get_window_dimensions = atari_treeview_get_window_dimensions,
+ .drag_status = atari_treeview_drag_status
+};
+
+
+/* exported interface documented in atari/treeview.h */
struct core_window *
atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
- void * user_data, uint32_t flags)
+ void * user_data, uint32_t flags)
{
/* allocate the core_window struct: */
@@ -528,7 +541,7 @@ atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
tv = calloc(1, sizeof(struct atari_treeview_window));
if (tv == NULL) {
- LOG("calloc failed");
+ NSLOG(netsurf, INFO, "calloc failed");
atari_warn_user(messages_get_errorcode(NSERROR_NOMEM), 0);
return NULL;
}
@@ -555,12 +568,12 @@ atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
assert(tv->io);
assert(tv->io->init_phase2);
- /* Now that the window is configured for treeview content, */
- /* call init_phase2 which must create the treeview */
- /* descriptor, and at least setup the the default */
- /* event handlers of the treeview: */
- /* It would be more simple to not pass around the callbacks */
- /* but the treeview constructor requires them for initialization... */
+ /* Now that the window is configured for treeview content, */
+ /* call init_phase2 which must create the treeview */
+ /* descriptor, and at least setup the the default */
+ /* event handlers of the treeview: */
+ /* It would be more simple to not pass around the callbacks */
+ /* but the treeview constructor requires them for initialization... */
nserror err = tv->io->init_phase2((struct core_window *)tv, &cw_t);
if (err != NSERROR_OK) {
free(tv);
@@ -570,6 +583,147 @@ atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks,
return((struct core_window *)tv);
}
+
+/* exported interface documented in atari/treeview.h */
+void
+atari_treeview_get_grect(struct core_window *cw,
+ enum treeview_area_e mode,
+ GRECT *dest)
+{
+
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
+
+ if (mode == TREEVIEW_AREA_CONTENT) {
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, dest);
+ }
+ else if (mode == TREEVIEW_AREA_TOOLBAR) {
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_TOOLBAR, dest);
+ }
+}
+
+
+/* exported interface documented in atari/treeview.h */
+GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw)
+{
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
+ return(tv->window);
+}
+
+
+/* exported interface documented in atari/treeview.h */
+void atari_treeview_redraw(struct core_window *cw)
+{
+ struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
+ short pxy[4];
+
+ if (tv != NULL && tv->is_open) {
+ if( tv->redraw && ((plot_get_flags() & PLOT_FLAG_OFFSCREEN) == 0) ) {
+
+ short todo[4];
+ GRECT work;
+ short handle = gemtk_wm_get_handle(tv->window);
+ struct gemtk_wm_scroll_info_s *slid;
+
+ gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work);
+ slid = gemtk_wm_get_scroll_info(tv->window);
+
+// // Debug code: this 3 lines help to inspect the redraw
+// // areas...
+// pxy[0] = work.g_x;
+// pxy[1] = work.g_y;
+// pxy[2] = pxy[0] + work.g_w-1;
+// pxy[3] = pxy[1] + work.g_h-1;
+//
+// vsf_color(plot_get_vdi_handle(), 0);
+// v_bar(plot_get_vdi_handle(), (short*)&pxy);
+// evnt_timer(500);
+
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &atari_plotters
+ };
+ plot_set_dimensions(&ctx,
+ work.g_x,
+ work.g_y,
+ work.g_w,
+ work.g_h);
+ if (plot_lock() == false)
+ return;
+
+ if( wind_get(handle, WF_FIRSTXYWH,
+ &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
+ while (todo[2] && todo[3]) {
+
+ if(!rc_intersect(&work, (GRECT*)&todo)){
+ if (wind_get(handle, WF_NEXTXYWH,
+ &todo[0], &todo[1], &todo[2], &todo[3])==0) {
+ break;
+ }
+ continue;
+ }
+ pxy[0] = todo[0];
+ pxy[1] = todo[1];
+ pxy[2] = todo[0] + todo[2]-1;
+ pxy[3] = todo[1] + todo[3]-1;
+ vs_clip(plot_get_vdi_handle(), 1, (short*)&pxy);
+
+ // Debug code: this 3 lines help to inspect the redraw
+ // areas...
+
+// vsf_color(plot_get_vdi_handle(), 3);
+// v_bar(plot_get_vdi_handle(), (short*)&pxy);
+// evnt_timer(500);
+
+
+ /* convert screen to treeview coords: */
+ todo[0] = todo[0] - work.g_x ;//+ slid->x_pos*slid->x_unit_px;
+ todo[1] = todo[1] - work.g_y ;//+ slid->y_pos*slid->y_unit_px;
+ if( todo[0] < 0 ){
+ todo[2] = todo[2] + todo[0];
+ todo[0] = 0;
+ }
+ if( todo[1] < 0 ){
+ todo[3] = todo[3] + todo[1];
+ todo[1] = 0;
+ }
+
+ if (rc_intersect((GRECT *)&tv->rdw_area,(GRECT *)&todo)) {
+ struct rect clip;
+
+ clip.x0 = todo[0]+(slid->x_pos*slid->x_unit_px);
+ clip.y0 = todo[1]+(slid->y_pos*slid->y_unit_px);
+ clip.x1 = clip.x0 + todo[2]+(slid->x_pos*slid->x_unit_px);
+ clip.y1 = clip.y0 + todo[3]+(slid->y_pos*slid->y_unit_px);
+
+ tv->io->draw(cw, -(slid->x_pos*slid->x_unit_px),
+ -(slid->y_pos*slid->y_unit_px),
+ &clip, &ctx);
+ }
+ vs_clip(plot_get_vdi_handle(), 0, (short*)&pxy);
+ if (wind_get(handle, WF_NEXTXYWH,
+ &todo[0], &todo[1], &todo[2], &todo[3])==0) {
+ break;
+ }
+ }
+ } else {
+ plot_unlock();
+ return;
+ }
+ plot_unlock();
+ tv->redraw = false;
+ tv->rdw_area.g_x = 65000;
+ tv->rdw_area.g_y = 65000;
+ tv->rdw_area.g_w = -1;
+ tv->rdw_area.g_h = -1;
+ } else {
+ /* just copy stuff from the offscreen buffer */
+ }
+ }
+}
+
+
+/* exported interface documented in atari/treeview.h */
void atari_treeview_delete(struct core_window * cw)
{
struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
@@ -583,6 +737,7 @@ void atari_treeview_delete(struct core_window * cw)
}
+/* exported interface documented in atari/treeview.h */
void atari_treeview_open(struct core_window *cw, GRECT *pos)
{
struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
@@ -607,25 +762,32 @@ void atari_treeview_open(struct core_window *cw, GRECT *pos)
}
}
+
+/* exported interface documented in atari/treeview.h */
bool atari_treeview_is_open(struct core_window *cw)
{
struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
return(tv->is_open);
}
-void atari_treeview_set_user_data(struct core_window * cw,
- void *user_data_ptr)
+
+/* exported interface documented in atari/treeview.h */
+void atari_treeview_set_user_data(struct core_window *cw, void *user_data_ptr)
{
struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
tv->user_data = user_data_ptr;
}
+
+/* exported interface documented in atari/treeview.h */
void * atari_treeview_get_user_data(struct core_window * cw)
{
struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
return(tv->user_data);
}
+
+/* exported interface documented in atari/treeview.h */
void atari_treeview_close(struct core_window *cw)
{
struct atari_treeview_window *tv = (struct atari_treeview_window*)cw;
@@ -646,150 +808,24 @@ void atari_treeview_close(struct core_window *cw)
}
-/**
- * Core Window Callbacks:
- */
-
-/**
- * Request a redraw of the window
- *
- * \param cw the core window object
- * \param r rectangle to redraw
- */
-void atari_treeview_redraw_request(struct core_window *cw, const struct rect *r)
-{
- GRECT area;
- struct gemtk_wm_scroll_info_s * slid;
- struct atari_treeview_window * tv = (struct atari_treeview_window *)cw;
-
- RECT_TO_GRECT(r, &area)
-
- assert(tv);
-
- slid = gemtk_wm_get_scroll_info(tv->window);
-
- //dbg_rect("redraw rect request", r);
-
- // treeview redraw is always full window width:
- area.g_x = 0;
- area.g_w = 8000;
- // but vertical redraw region is clipped:
- area.g_y = r->y0 - (slid->y_pos*slid->y_unit_px);
- area.g_h = r->y1 - r->y0;
- atari_treeview_redraw_grect_request(cw, &area);
-}
-
-/**
- * Update the limits of the window
- *
- * \param cw the core window object
- * \param width the width in px, or negative if don't care
- * \param height the height in px, or negative if don't care
- */
-void atari_treeview_update_size(struct core_window *cw, int width, int height)
-{
- GRECT area;
- struct gemtk_wm_scroll_info_s *slid;
- struct atari_treeview_window *tv = (struct atari_treeview_window *)cw;
-
- if (tv != NULL) {
-
- if (tv->disposing)
- return;
-
- /* Get acces to the gemtk window slider settings: */
- slid = gemtk_wm_get_scroll_info(tv->window);
-
- /* recalculate and refresh sliders: */
- atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &area);
- if (width > -1) {
- slid->x_units = (width/slid->x_unit_px);
- } else {
- slid->x_units = 1;
- }
-
- if (height > -1) {
- slid->y_units = (height/slid->y_unit_px);
- } else {
- slid->y_units = 1;
- }
-
- tv->extent.x = width;
- tv->extent.y = height;
-
-
- /*printf("units content: %d, units viewport: %d\n", (height/slid->y_unit_px),
- (area.g_h/slid->y_unit_px));*/
- gemtk_wm_update_slider(tv->window, GEMTK_WM_VH_SLIDER);
- }
-}
-
-
-/**
- * Scroll the window to make area visible
- *
- * \param cw the core window object
- * \param r rectangle to make visible
- */
-void atari_treeview_scroll_visible(struct core_window *cw, const struct rect *r)
-{
- /* atari frontend doesn't support dragging outside the treeview */
- /* so there is no need to implement this? */
-}
-
-
-/**
- * Get window viewport dimensions
- *
- * \param cw the core window object
- * \param width to be set to viewport width in px, if non NULL
- * \param height to be set to viewport height in px, if non NULL
- */
-void atari_treeview_get_window_dimensions(struct core_window *cw,
- int *width, int *height)
-{
- if (cw != NULL && (width != NULL || height != NULL)) {
- GRECT work;
- atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &work);
- *width = work.g_w;
- *height = work.g_h;
- }
-}
-
-
-/**
- * Inform corewindow owner of drag status
- *
- * \param cw the core window object
- * \param ds the current drag status
- */
-void atari_treeview_drag_status(struct core_window *cw,
- core_window_drag_status ds)
-{
-
-}
-
+/* exported interface documented in atari/treeview.h */
void atari_treeview_flush_redraws(void)
{
struct atari_treeview_window *tmp;
tmp = treeviews_open;
- if(tmp){
- while(tmp){
- assert(tmp->is_open);
- if(tmp->redraw){
- if (atari_treeview_is_iconified((struct core_window *)tmp)) {
- /* No content redraw for iconified windows */
- /* because otherwise the icon draw function would */
- /* have to deal with plot canvas coords */
- continue;
- }
-
- atari_treeview_redraw((struct core_window *)tmp);
- }
- tmp = tmp->next_open;
+ while (tmp != NULL) {
+ assert(tmp->is_open);
+ if (tmp->redraw &&
+ (!atari_treeview_is_iconified((struct core_window *)tmp))) {
+ /* Content redraw only for iconified windows
+ * because otherwise the icon draw function
+ * would have to deal with plot canvas coords
+ */
+ atari_treeview_redraw((struct core_window *)tmp);
}
+ tmp = tmp->next_open;
}
-}
+}
diff --git a/frontends/atari/treeview.h b/frontends/atari/treeview.h
index d10129eaa..fe267b122 100644
--- a/frontends/atari/treeview.h
+++ b/frontends/atari/treeview.h
@@ -68,7 +68,7 @@ struct atari_treeview_callbacks {
/**
* Initalize an window to be an treeview window.
*
-*/
+ */
struct core_window *atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks, void * user_data, uint32_t flags);
/**
diff --git a/frontends/atari/verify_ssl.c b/frontends/atari/verify_ssl.c
index 055fd3057..b099fe488 100644
--- a/frontends/atari/verify_ssl.c
+++ b/frontends/atari/verify_ssl.c
@@ -80,7 +80,9 @@ static void __CDECL cert_info_draw( WINDOW * win, short buf[8], void * data)
if( line == NULL )
return;
- LOG("Cert info draw, win: %p, data: %p, scrollx: %d", win, data, dp->scrollx );
+ NSLOG(netsurf, INFO,
+ "Cert info draw, win: %p, data: %p, scrollx: %d", win, data,
+ dp->scrollx);
WindGet( win, WF_WORKXYWH, &x, &y, &w, &h );
/*using static values here, as RsrcUserDraw has mem leaks & a very small stack */
@@ -158,7 +160,7 @@ static void do_popup( WINDOW *win, int index, int mode, void *data)
char * items[dp->num_certs];
short x, y;
unsigned int i;
- LOG("do_popup: num certs: %d", dp->num_certs);
+ NSLOG(netsurf, INFO, "do_popup: num certs: %d", dp->num_certs);
for( i = 0; i<dp->num_certs; i++) {
items[i] = malloc( 48 );
strncpy(items[i], (char*)&dp->cert_infos_n[i].issuer, 46 );
@@ -182,8 +184,10 @@ static void do_popup( WINDOW *win, int index, int mode, void *data)
-bool verify_ssl_form_do( const char * url, const struct ssl_cert_info * cert_infos_n ,
- unsigned long num_certs )
+bool
+verify_ssl_form_do(const char * url,
+ const struct ssl_cert_info * cert_infos_n,
+ unsigned long num_certs)
{
OBJECT *tree;
WINDOW * form;
@@ -191,6 +195,13 @@ bool verify_ssl_form_do( const char * url, const struct ssl_cert_info * cert_inf
bool bres = false;
bool cont = true;
int res = 0;
+
+ RsrcGaddr (h_gem_rsrc , R_TREE, VERIFY, &tree);
+ ObjcString( tree, VERIFY_LBL_HOST, (char*)url );
+ ObjcChange( OC_OBJC, tree, VERIFY_BT_ACCEPT, 0, 0 );
+ ObjcChange( OC_OBJC, tree, VERIFY_BT_REJECT, 0, 0 );
+ form = FormWindBegin( tree, (char*)"SSL Verify failed" );
+
dp.cert_infos_n = (struct ssl_cert_info *)cert_infos_n;
dp.num_certs = num_certs;
dp.scrollx = 0;
@@ -199,12 +210,6 @@ bool verify_ssl_form_do( const char * url, const struct ssl_cert_info * cert_inf
dp.cols = cert_display_width( &dp.cert_infos_n[dp.current] );
dp.rows = 8;
dp.tree = tree;
-
- RsrcGaddr (h_gem_rsrc , R_TREE, VERIFY, &tree);
- ObjcString( tree, VERIFY_LBL_HOST, (char*)url );
- ObjcChange( OC_OBJC, tree, VERIFY_BT_ACCEPT, 0, 0 );
- ObjcChange( OC_OBJC, tree, VERIFY_BT_REJECT, 0, 0 );
- form = FormWindBegin( tree, (char*)"SSL Verify failed" );
EvntDataAdd( form, WM_REDRAW, cert_info_draw, (void*)&dp, EV_BOT );
/* this results in some extended objects which can not be freed: :( */
/* RsrcUserDraw( OC_FORM, tree, VERIFY_BOX_DETAILS, cert_info_draw,(void*)&dp ) ; */
@@ -243,7 +248,7 @@ bool verify_ssl_form_do( const char * url, const struct ssl_cert_info * cert_inf
break;
case VERIFY_BT_SCROLL_R:
- LOG("scroll r!");
+ NSLOG(netsurf, INFO, "scroll r!");
cont = true;
dp.scrollx += 1;
if( dp.scrollx > (dp.cols - (272 / 8 )) )
diff --git a/frontends/beos/bitmap.cpp b/frontends/beos/bitmap.cpp
index 68d8442ab..c4b008755 100644
--- a/frontends/beos/bitmap.cpp
+++ b/frontends/beos/bitmap.cpp
@@ -377,7 +377,7 @@ nsbeos_bitmap_get_pretile_x(struct bitmap* bitmap)
if (!bitmap->pretile_x) {
int width = bitmap->primary->Bounds().Width() + 1;
int xmult = (MIN_PRETILE_WIDTH + width - 1)/width;
- LOG("Pretiling %p for X*%d", bitmap, xmult);
+ NSLOG(netsurf, INFO, "Pretiling %p for X*%d", bitmap, xmult);
bitmap->pretile_x = nsbeos_bitmap_generate_pretile(bitmap->primary, xmult, 1);
}
return bitmap->pretile_x;
@@ -396,7 +396,7 @@ nsbeos_bitmap_get_pretile_y(struct bitmap* bitmap)
if (!bitmap->pretile_y) {
int height = bitmap->primary->Bounds().Height() + 1;
int ymult = (MIN_PRETILE_HEIGHT + height - 1)/height;
- LOG("Pretiling %p for Y*%d", bitmap, ymult);
+ NSLOG(netsurf, INFO, "Pretiling %p for Y*%d", bitmap, ymult);
bitmap->pretile_y = nsbeos_bitmap_generate_pretile(bitmap->primary, 1, ymult);
}
return bitmap->pretile_y;
@@ -416,7 +416,8 @@ nsbeos_bitmap_get_pretile_xy(struct bitmap* bitmap)
int height = bitmap->primary->Bounds().Height() + 1;
int xmult = (MIN_PRETILE_WIDTH + width - 1)/width;
int ymult = (MIN_PRETILE_HEIGHT + height - 1)/height;
- LOG("Pretiling %p for X*%d Y*%d", bitmap, xmult, ymult);
+ NSLOG(netsurf, INFO, "Pretiling %p for X*%d Y*%d", bitmap,
+ xmult, ymult);
bitmap->pretile_xy = nsbeos_bitmap_generate_pretile(bitmap->primary, xmult, ymult);
}
return bitmap->pretile_xy;
diff --git a/frontends/beos/fetch_rsrc.cpp b/frontends/beos/fetch_rsrc.cpp
index e77f4c96e..ae3648354 100644
--- a/frontends/beos/fetch_rsrc.cpp
+++ b/frontends/beos/fetch_rsrc.cpp
@@ -71,13 +71,15 @@ BResources *gAppResources = NULL;
static bool fetch_rsrc_initialise(lwc_string *scheme)
{
- LOG("fetch_rsrc_initialise called for %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "fetch_rsrc_initialise called for %s",
+ lwc_string_data(scheme));
return true;
}
static void fetch_rsrc_finalise(lwc_string *scheme)
{
- LOG("fetch_rsrc_finalise called for %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "fetch_rsrc_finalise called for %s",
+ lwc_string_data(scheme));
}
static bool fetch_rsrc_can_fetch(const nsurl *url)
@@ -162,7 +164,7 @@ static bool fetch_rsrc_process(struct fetch_rsrc_context *c)
* rsrc://[TYPE][@NUM]/name[,mime]
*/
- LOG("*** Processing %s", c->url);
+ NSLOG(netsurf, INFO, "*** Processing %s", c->url);
if (strlen(c->url) < 7) {
/* 7 is the minimum possible length (rsrc://) */
@@ -199,11 +201,13 @@ static bool fetch_rsrc_process(struct fetch_rsrc_context *c)
uint8 c1, c2, c3, c4;
if (sscanf(params, "%c%c%c%c", &c1, &c2, &c3, &c4) > 3) {
type = c1 << 24 | c2 << 16 | c3 << 8 | c4;
- LOG("fetch_rsrc: type:%4.4s\n", (char *)&type);
+ NSLOG(netsurf, INFO, "fetch_rsrc: type:%4.4s\n",
+ (char *)&type);
}
}
- LOG("fetch_rsrc: 0x%08lx, %ld, '%s'\n", type, id, c->name);
+ NSLOG(netsurf, INFO, "fetch_rsrc: 0x%08lx, %ld, '%s'\n", type, id,
+ c->name);
bool found;
if (id)
@@ -278,7 +282,10 @@ static void fetch_rsrc_poll(lwc_string *scheme)
char header[64];
fetch_set_http_code(c->parent_fetch, 200);
- LOG("setting rsrc: MIME type to %s, length to %zd", c->mimetype, c->datalen);
+ NSLOG(netsurf, INFO,
+ "setting rsrc: MIME type to %s, length to %zd",
+ c->mimetype,
+ c->datalen);
/* Any callback can result in the fetch being aborted.
* Therefore, we _must_ check for this after _every_
* call to fetch_rsrc_send_callback().
@@ -308,7 +315,8 @@ static void fetch_rsrc_poll(lwc_string *scheme)
fetch_rsrc_send_callback(&msg, c);
}
} else {
- LOG("Processing of %s failed!", c->url);
+ NSLOG(netsurf, INFO, "Processing of %s failed!",
+ c->url);
/* Ensure that we're unlocked here. If we aren't,
* then fetch_rsrc_process() is broken.
diff --git a/frontends/beos/filetype.cpp b/frontends/beos/filetype.cpp
index 7a2ca97e5..bc988a8c7 100644
--- a/frontends/beos/filetype.cpp
+++ b/frontends/beos/filetype.cpp
@@ -18,6 +18,7 @@
#define __STDBOOL_H__ 1
#include <stdbool.h>
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
diff --git a/frontends/beos/font.cpp b/frontends/beos/font.cpp
index 407918f0c..5e7e78228 100644
--- a/frontends/beos/font.cpp
+++ b/frontends/beos/font.cpp
@@ -130,7 +130,7 @@ void nsbeos_style_to_font(BFont &font, const struct plot_font_style *fstyle)
}
//fprintf(stderr, "nsbeos_style_to_font: value %f unit %d\n", style->font_size.value.length.value, style->font_size.value.length.unit);
- size = fstyle->size / FONT_SIZE_SCALE;
+ size = fstyle->size / PLOT_STYLE_SCALE;
//fprintf(stderr, "nsbeos_style_to_font: %f %d\n", size, style->font_size.value.length.unit);
@@ -204,8 +204,8 @@ static nserror beos_font_position(const plot_font_style_t *fstyle,
const char *string, size_t length,
int x, size_t *char_offset, int *actual_x)
{
- //LOG("(, '%s', %d, %d, , )", string, length, x);
- //fprintf(stderr, "%s(, '%s', %d, %d, , )\n", __FUNCTION__, string, length, x);
+ NSLOG(netsurf, DEEPDEBUG, "(, '%s', %d, %d, , )", string, length, x);
+
int index;
BFont font;
@@ -261,8 +261,7 @@ static nserror beos_font_split(const plot_font_style_t *fstyle,
const char *string, size_t length,
int x, size_t *char_offset, int *actual_x)
{
- //fprintf(stderr, "%s(, '%s', %d, %d, , )\n", __FUNCTION__, string, length, x);
- //LOG("(, '%s', %d, %d, , )", string, length, x);
+ NSLOG(netsurf, DEEPDEBUG, "(, '%s', %d, %d, , )", string, length, x);
int index = 0;
BFont font;
diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp
index d3321b58d..19f8eac49 100644
--- a/frontends/beos/gui.cpp
+++ b/frontends/beos/gui.cpp
@@ -112,7 +112,7 @@ static int sEventPipe[2];
/* exported function defined in beos/gui.h */
nserror beos_warn_user(const char *warning, const char *detail)
{
- LOG("warn_user: %s (%s)", warning, detail);
+ NSLOG(netsurf, INFO, "warn_user: %s (%s)", warning, detail);
BAlert *alert;
BString text(warning);
if (detail)
@@ -354,14 +354,15 @@ static void check_homedir(void)
if (err < B_OK) {
/* we really can't continue without a home directory. */
- LOG("Can't find user settings directory - nowhere to store state!");
+ NSLOG(netsurf, INFO,
+ "Can't find user settings directory - nowhere to store state!");
die("NetSurf needs to find the user settings directory in order to run.\n");
}
path.Append("NetSurf");
err = create_directory(path.Path(), 0644);
if (err < B_OK) {
- LOG("Unable to create %s", path.Path());
+ NSLOG(netsurf, INFO, "Unable to create %s", path.Path());
die("NetSurf could not create its settings directory.\n");
}
}
@@ -387,7 +388,7 @@ static nsurl *gui_get_resource_url(const char *path)
path = "favicon.png";
u << path;
- LOG("(%s) -> '%s'\n", path, u.String());
+ NSLOG(netsurf, INFO, "(%s) -> '%s'\n", path, u.String());
nsurl_create(u.String(), &url);
return url;
}
@@ -588,7 +589,7 @@ static void gui_init(int argc, char** argv)
die("Unable to load throbber image.\n");
find_resource(buf, "Choices", "%/Choices");
- LOG("Using '%s' as Preferences file", buf);
+ NSLOG(netsurf, INFO, "Using '%s' as Preferences file", buf);
options_file_location = strdup(buf);
nsoption_read(buf, NULL);
@@ -631,12 +632,12 @@ static void gui_init(int argc, char** argv)
if (nsoption_charp(cookie_file) == NULL) {
find_resource(buf, "Cookies", "%/Cookies");
- LOG("Using '%s' as Cookies file", buf);
+ NSLOG(netsurf, INFO, "Using '%s' as Cookies file", buf);
nsoption_set_charp(cookie_file, strdup(buf));
}
if (nsoption_charp(cookie_jar) == NULL) {
find_resource(buf, "Cookies", "%/Cookies");
- LOG("Using '%s' as Cookie Jar file", buf);
+ NSLOG(netsurf, INFO, "Using '%s' as Cookie Jar file", buf);
nsoption_set_charp(cookie_jar, strdup(buf));
}
if ((nsoption_charp(cookie_file) == NULL) ||
@@ -645,13 +646,13 @@ static void gui_init(int argc, char** argv)
if (nsoption_charp(url_file) == NULL) {
find_resource(buf, "URLs", "%/URLs");
- LOG("Using '%s' as URL file", buf);
+ NSLOG(netsurf, INFO, "Using '%s' as URL file", buf);
nsoption_set_charp(url_file, strdup(buf));
}
if (nsoption_charp(ca_path) == NULL) {
find_resource(buf, "certs", "/etc/ssl/certs");
- LOG("Using '%s' as certificate path", buf);
+ NSLOG(netsurf, INFO, "Using '%s' as certificate path", buf);
nsoption_set_charp(ca_path, strdup(buf));
}
@@ -763,17 +764,21 @@ void nsbeos_gui_poll(void)
timeout.tv_sec = (long)(next_schedule / 1000000LL);
timeout.tv_usec = (long)(next_schedule % 1000000LL);
- //LOG("gui_poll: select(%d, ..., %Ldus", max_fd, next_schedule);
+ NSLOG(netsurf, DEEPDEBUG,
+ "gui_poll: select(%d, ..., %Ldus",
+ max_fd, next_schedule);
fd_count = select(max_fd, &read_fd_set, &write_fd_set, &exc_fd_set,
&timeout);
- //LOG("select: %d\n", fd_count);
+ NSLOG(netsurf, DEEPDEBUG, "select: %d\n", fd_count);
if (fd_count > 0 && FD_ISSET(sEventPipe[0], &read_fd_set)) {
BMessage *message;
int len = read(sEventPipe[0], &message, sizeof(void *));
- //LOG("gui_poll: BMessage ? %d read", len);
+ NSLOG(netsurf, DEEPDEBUG, "gui_poll: BMessage ? %d read", len);
if (len == sizeof(void *)) {
- //LOG("gui_poll: BMessage.what %-4.4s\n", &(message->what));
+ NSLOG(netsurf, DEEPDEBUG,
+ "gui_poll: BMessage.what %-4.4s\n",
+ &(message->what));
nsbeos_dispatch_event(message);
}
}
@@ -1038,7 +1043,7 @@ int main(int argc, char** argv)
char path[12];
sprintf(path,"%.2s/Messages", getenv("LC_MESSAGES"));
- LOG("Loading messages from resource %s\n", path);
+ NSLOG(netsurf, INFO, "Loading messages from resource %s\n", path);
const uint8_t* res = (const uint8_t*)resources.LoadResource('data', path, &size);
if (size > 0 && res != NULL) {
@@ -1061,6 +1066,12 @@ int main(int argc, char** argv)
netsurf_exit();
+ /* finalise options */
+ nsoption_finalise(nsoptions, nsoptions_default);
+
+ /* finalise logging */
+ nslog_finalise();
+
return 0;
}
diff --git a/frontends/beos/plotters.cpp b/frontends/beos/plotters.cpp
index 5ba3fbbcb..2c50f9497 100644
--- a/frontends/beos/plotters.cpp
+++ b/frontends/beos/plotters.cpp
@@ -18,8 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Target independent plotting (BeOS/Haiku implementation).
+/**
+ * \file
+ * BeOS/Haiku implementation target independent plotting.
*/
#define __STDBOOL_H__ 1
@@ -31,11 +32,11 @@
#include <View.h>
#include <Shape.h>
extern "C" {
-#include "netsurf/plotters.h"
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "utils/nsurl.h"
+#include "netsurf/plotters.h"
}
#include "beos/font.h"
#include "beos/gui.h"
@@ -50,581 +51,751 @@ extern "C" {
* the right-bottom pixel is actually part of the BRect!
*/
-static bool nsbeos_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
-static bool nsbeos_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style);
-static bool nsbeos_plot_polygon(const int *p, unsigned int n, const plot_style_t *style);
-static bool nsbeos_plot_path(const float *p, unsigned int n, colour fill, float width,
- colour c, const float transform[6]);
-static bool nsbeos_plot_clip(const struct rect *ns_clip);
-static bool nsbeos_plot_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle);
-static bool nsbeos_plot_disc(int x, int y, int radius, const plot_style_t *style);
-static bool nsbeos_plot_arc(int x, int y, int radius, int angle1, int angle2,
- const plot_style_t *style);
-static bool nsbeos_plot_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags);
-
-
#warning make patterns nicer
-static const pattern kDottedPattern = { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa };
-static const pattern kDashedPattern = { 0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0x33, 0x33 };
-
-static const rgb_color kBlackColor = { 0, 0, 0, 255 };
-
-struct plotter_table plot;
+static const pattern kDottedPattern = {
+ 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa
+};
+static const pattern kDashedPattern = {
+ 0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0x33, 0x33
+};
-const struct plotter_table nsbeos_plotters = {
- nsbeos_plot_clip,
- nsbeos_plot_arc,
- nsbeos_plot_disc,
- nsbeos_plot_line,
- nsbeos_plot_rectangle,
- nsbeos_plot_polygon,
- nsbeos_plot_path,
- nsbeos_plot_bitmap,
- nsbeos_plot_text,
- NULL, // Group Start
- NULL, // Group End
- NULL, // Flush
- true // option_knockout
+static const rgb_color kBlackColor = {
+ 0, 0, 0, 255
};
+//struct plotter_table plot;
// #pragma mark - implementation
-
BView *nsbeos_current_gc(void)
{
- return current_view;
+ return current_view;
}
+
BView *nsbeos_current_gc_lock(void)
{
- BView *view = current_view;
- if (view && view->LockLooper())
- return view;
- return NULL;
+ BView *view = current_view;
+ if (view && view->LockLooper())
+ return view;
+ return NULL;
}
+
void nsbeos_current_gc_unlock(void)
{
- if (current_view)
- current_view->UnlockLooper();
+ if (current_view) {
+ current_view->UnlockLooper();
+ }
}
+
void nsbeos_current_gc_set(BView *view)
{
- // XXX: (un)lock previous ?
- current_view = view;
+ // XXX: (un)lock previous ?
+ current_view = view;
}
-bool nsbeos_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
+
+static nserror
+nsbeos_plot_bbitmap(int x, int y, int width, int height, BBitmap *b, colour bg)
{
- if (style->fill_type != PLOT_OP_TYPE_NONE) {
- BView *view;
+ /* XXX: This currently ignores the background colour supplied.
+ * Does this matter?
+ */
+
+ if (width == 0 || height == 0) {
+ return NSERROR_OK;
+ }
+
+ BView *view;
+
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL) {
+ beos_warn_user("No GC", 0);
+ return NSERROR_INVALID;
+ }
+
+ drawing_mode oldmode = view->DrawingMode();
+ source_alpha alpha;
+ alpha_function func;
+ view->GetBlendingMode(&alpha, &func);
+ //view->SetDrawingMode(B_OP_OVER);
+ view->SetDrawingMode(B_OP_ALPHA);
+ view->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
+
+ // XXX DrawBitmap() resamples if rect doesn't match,
+ // but doesn't do any filtering
+ // XXX: use Zeta API if available ?
+
+ BRect rect(x, y, x + width - 1, y + height - 1);
+ /*
+ rgb_color old = view->LowColor();
+ if (bg != NS_TRANSPARENT) {
+ view->SetLowColor(nsbeos_rgb_colour(bg));
+ view->FillRect(rect, B_SOLID_LOW);
+ }
+ */
+ view->DrawBitmap(b, rect);
+ // maybe not needed?
+ //view->SetLowColor(old);
+ view->SetBlendingMode(alpha, func);
+ view->SetDrawingMode(oldmode);
+
+ //nsbeos_current_gc_unlock();
+
+ return NSERROR_OK;
+}
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL) {
- beos_warn_user("No GC", 0);
- return false;
- }
- nsbeos_set_colour(style->fill_colour);
+static BPoint transform_pt(float x, float y, const float transform[6])
+{
+#warning XXX: verify
+ //return BPoint(x, y);
+ BPoint pt;
+ pt.x = x * transform[0] + y * transform[1] + transform[4];
+ pt.y = x * transform[2] + y * transform[3] + transform[5];
+ /*
+ printf("TR: {%f, %f} { %f, %f, %f, %f, %f, %f} = { %f, %f }\n",
+ x, y,
+ transform[0], transform[1], transform[2],
+ transform[3], transform[4], transform[5],
+ pt.x, pt.y);
+ */
+ return pt;
+}
- BRect rect(x0, y0, x1 - 1, y1 - 1);
- view->FillRect(rect);
- //nsbeos_current_gc_unlock();
+rgb_color nsbeos_rgb_colour(colour c)
+{
+ rgb_color color;
+ if (c == NS_TRANSPARENT)
+ return B_TRANSPARENT_32_BIT;
+ color.red = c & 0x0000ff;
+ color.green = (c & 0x00ff00) >> 8;
+ color.blue = (c & 0xff0000) >> 16;
+ return color;
+}
- }
- if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- pattern pat;
- BView *view;
+void nsbeos_set_colour(colour c)
+{
+ rgb_color color = nsbeos_rgb_colour(c);
+ BView *view = nsbeos_current_gc();
+ view->SetHighColor(color);
+}
- switch (style->stroke_type) {
- case PLOT_OP_TYPE_SOLID: /**< Solid colour */
- default:
- pat = B_SOLID_HIGH;
- break;
- case PLOT_OP_TYPE_DOT: /**< Doted plot */
- pat = kDottedPattern;
- break;
+/**
+ * Plot a caret.
+ *
+ * It is assumed that the plotters have been set up.
+ */
+void nsbeos_plot_caret(int x, int y, int h)
+{
+ BView *view;
- case PLOT_OP_TYPE_DASH: /**< dashed plot */
- pat = kDashedPattern;
- break;
- }
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL)
+ /* TODO: report an error here */
+ return;
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL) {
- beos_warn_user("No GC", 0);
- return false;
- }
+ BPoint start(x, y);
+ BPoint end(x, y + h - 1);
+#if defined(__HAIKU__) || defined(B_BEOS_VERSION_DANO)
+ view->SetHighColor(ui_color(B_DOCUMENT_TEXT_COLOR));
+#else
+ view->SetHighColor(kBlackColor);
+#endif
+ view->StrokeLine(start, end);
- nsbeos_set_colour(style->stroke_colour);
+ //nsbeos_current_gc_unlock();
+}
- float pensize = view->PenSize();
- view->SetPenSize(style->stroke_width);
- BRect rect(x0, y0, x1, y1);
- view->StrokeRect(rect, pat);
+/**
+ * \brief Sets a clip rectangle for subsequent plot operations.
+ *
+ * \param ctx The current redraw context.
+ * \param ns_clip The rectangle to limit all subsequent plot
+ * operations within.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsbeos_plot_clip(const struct redraw_context *ctx, const struct rect *ns_clip)
+{
+ BView *view;
+ //fprintf(stderr, "%s(%d, %d, %d, %d)\n", __FUNCTION__, clip_x0, clip_y0, clip_x1, clip_y1);
- view->SetPenSize(pensize);
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL) {
+ beos_warn_user("No GC", 0);
+ return NSERROR_INVALID;
+ }
- //nsbeos_current_gc_unlock();
+ BRect rect(ns_clip->x0, ns_clip->y0, ns_clip->x1 - 1, ns_clip->y1 - 1);
+ BRegion clip(rect);
+ view->ConstrainClippingRegion(NULL);
+ if (view->Bounds() != rect) {
+ view->ConstrainClippingRegion(&clip);
+ }
- }
+ //nsbeos_current_gc_unlock();
- return true;
+ return NSERROR_OK;
}
-
-bool nsbeos_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
+/**
+ * Plots an arc
+ *
+ * plot an arc segment around (x,y), anticlockwise from angle1
+ * to angle2. Angles are measured anticlockwise from
+ * horizontal, in degrees.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the arc plot.
+ * \param x The x coordinate of the arc.
+ * \param y The y coordinate of the arc.
+ * \param radius The radius of the arc.
+ * \param angle1 The start angle of the arc.
+ * \param angle2 The finish angle of the arc.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsbeos_plot_arc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius, int angle1, int angle2)
{
- pattern pat;
- BView *view;
+ BView *view;
- switch (style->stroke_type) {
- case PLOT_OP_TYPE_SOLID: /**< Solid colour */
- default:
- pat = B_SOLID_HIGH;
- break;
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL) {
+ beos_warn_user("No GC", 0);
+ return NSERROR_INVALID;
+ }
- case PLOT_OP_TYPE_DOT: /**< Doted plot */
- pat = kDottedPattern;
- break;
+ nsbeos_set_colour(style->fill_colour);
- case PLOT_OP_TYPE_DASH: /**< dashed plot */
- pat = kDashedPattern;
- break;
- }
+ BPoint center(x, y);
+ float angle = angle1; // in degree
+ float span = angle2 - angle1; // in degree
+ view->StrokeArc(center, radius, radius, angle, span);
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL) {
- beos_warn_user("No GC", 0);
- return false;
- }
+ //nsbeos_current_gc_unlock();
- nsbeos_set_colour(style->stroke_colour);
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plots a circle
+ *
+ * Plot a circle centered on (x,y), which is optionally filled.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the circle plot.
+ * \param x x coordinate of circle centre.
+ * \param y y coordinate of circle centre.
+ * \param radius circle radius.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsbeos_plot_disc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius)
+{
+ BView *view;
- float pensize = view->PenSize();
- view->SetPenSize(style->stroke_width);
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL) {
+ beos_warn_user("No GC", 0);
+ return NSERROR_INVALID;
+ }
- BPoint start(x0, y0);
- BPoint end(x1, y1);
- view->StrokeLine(start, end, pat);
+ nsbeos_set_colour(style->fill_colour);
- view->SetPenSize(pensize);
+ BPoint center(x, y);
+ if (style->fill_type != PLOT_OP_TYPE_NONE)
+ view->FillEllipse(center, radius, radius);
+ else
+ view->StrokeEllipse(center, radius, radius);
- //nsbeos_current_gc_unlock();
+ //nsbeos_current_gc_unlock();
- return true;
+ return NSERROR_OK;
}
-bool nsbeos_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
+/**
+ * Plots a line
+ *
+ * plot a line from (x0,y0) to (x1,y1). Coordinates are at
+ * centre of line width/thickness.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the line plot.
+ * \param line A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsbeos_plot_line(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *line)
{
- unsigned int i;
- BView *view;
+ pattern pat;
+ BView *view;
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL) {
- beos_warn_user("No GC", 0);
- return false;
- }
+ switch (style->stroke_type) {
+ case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ default:
+ pat = B_SOLID_HIGH;
+ break;
- nsbeos_set_colour(style->fill_colour);
+ case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ pat = kDottedPattern;
+ break;
- BPoint points[n];
-
- for (i = 0; i < n; i++) {
- points[i] = BPoint(p[2 * i] - 0.5, p[2 * i + 1] - 0.5);
- }
+ case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ pat = kDashedPattern;
+ break;
+ }
- if (style->fill_colour == NS_TRANSPARENT)
- view->StrokePolygon(points, (int32)n);
- else
- view->FillPolygon(points, (int32)n);
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL) {
+ beos_warn_user("No GC", 0);
+ return NSERROR_OK;
+ }
- return true;
-}
+ nsbeos_set_colour(style->stroke_colour);
+ float pensize = view->PenSize();
+ view->SetPenSize(plot_style_fixed_to_float(style->stroke_width));
+ BPoint start(line->x0, line->y0);
+ BPoint end(line->x1, line->y1);
+ view->StrokeLine(start, end, pat);
+ view->SetPenSize(pensize);
-bool nsbeos_plot_clip(const struct rect *ns_clip)
-{
- BView *view;
- //fprintf(stderr, "%s(%d, %d, %d, %d)\n", __FUNCTION__, clip_x0, clip_y0, clip_x1, clip_y1);
-
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL) {
- beos_warn_user("No GC", 0);
- return false;
- }
-
- BRect rect(ns_clip->x0, ns_clip->y0, ns_clip->x1 - 1,
- ns_clip->y1 - 1);
- BRegion clip(rect);
- view->ConstrainClippingRegion(NULL);
- if (view->Bounds() != rect)
- view->ConstrainClippingRegion(&clip);
-
-
- //nsbeos_current_gc_unlock();
-
- return true;
+ //nsbeos_current_gc_unlock();
+
+ return NSERROR_OK;
}
-bool nsbeos_plot_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle)
+/**
+ * Plots a rectangle.
+ *
+ * The rectangle can be filled an outline or both controlled
+ * by the plot style The line can be solid, dotted or
+ * dashed. Top left corner at (x0,y0) and rectangle has given
+ * width and height.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the rectangle plot.
+ * \param nsrect A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsbeos_plot_rectangle(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *nsrect)
{
- return nsfont_paint(fstyle, text, length, x, y);
-}
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+ BView *view;
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL) {
+ beos_warn_user("No GC", 0);
+ return NSERROR_INVALID;
+ }
-bool nsbeos_plot_disc(int x, int y, int radius, const plot_style_t *style)
-{
- BView *view;
+ nsbeos_set_colour(style->fill_colour);
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL) {
- beos_warn_user("No GC", 0);
- return false;
- }
+ BRect rect(nsrect->x0, nsrect->y0, nsrect->x1 - 1, nsrect->y1 - 1);
+ view->FillRect(rect);
- nsbeos_set_colour(style->fill_colour);
+ //nsbeos_current_gc_unlock();
+ }
- BPoint center(x, y);
- if (style->fill_type != PLOT_OP_TYPE_NONE)
- view->FillEllipse(center, radius, radius);
- else
- view->StrokeEllipse(center, radius, radius);
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ pattern pat;
+ BView *view;
+
+ switch (style->stroke_type) {
+ case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ default:
+ pat = B_SOLID_HIGH;
+ break;
- //nsbeos_current_gc_unlock();
+ case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ pat = kDottedPattern;
+ break;
+
+ case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ pat = kDashedPattern;
+ break;
+ }
+
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL) {
+ beos_warn_user("No GC", 0);
+ return NSERROR_INVALID;
+ }
- return true;
+ nsbeos_set_colour(style->stroke_colour);
+
+ float pensize = view->PenSize();
+ view->SetPenSize(plot_style_fixed_to_float(style->stroke_width));
+
+ BRect rect(nsrect->x0, nsrect->y0, nsrect->x1, nsrect->y1);
+ view->StrokeRect(rect, pat);
+
+ view->SetPenSize(pensize);
+
+ //nsbeos_current_gc_unlock();
+ }
+
+ return NSERROR_OK;
}
-bool nsbeos_plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style)
+
+/**
+ * Plot a polygon
+ *
+ * Plots a filled polygon with straight lines between
+ * points. The lines around the edge of the ploygon are not
+ * plotted. The polygon is filled with the non-zero winding
+ * rule.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the polygon plot.
+ * \param p verticies of polygon
+ * \param n number of verticies.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsbeos_plot_polygon(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const int *p,
+ unsigned int n)
{
- BView *view;
+ unsigned int i;
+ BView *view;
+
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL) {
+ beos_warn_user("No GC", 0);
+ return NSERROR_INVALID;
+ }
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL) {
- beos_warn_user("No GC", 0);
- return false;
- }
+ nsbeos_set_colour(style->fill_colour);
- nsbeos_set_colour(style->fill_colour);
+ BPoint points[n];
- BPoint center(x, y);
- float angle = angle1; // in degree
- float span = angle2 - angle1; // in degree
- view->StrokeArc(center, radius, radius, angle, span);
+ for (i = 0; i < n; i++) {
+ points[i] = BPoint(p[2 * i] - 0.5, p[2 * i + 1] - 0.5);
+ }
- //nsbeos_current_gc_unlock();
+ if (style->fill_colour == NS_TRANSPARENT) {
+ view->StrokePolygon(points, (int32)n);
+ } else {
+ view->FillPolygon(points, (int32)n);
+ }
- return true;
+ return NSERROR_OK;
}
-static bool nsbeos_plot_bbitmap(int x, int y, int width, int height,
- BBitmap *b, colour bg)
+
+/**
+ * Plots a path.
+ *
+ * Path plot consisting of cubic Bezier curves. Line and fill colour is
+ * controlled by the plot style.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the path plot.
+ * \param p elements of path
+ * \param n nunber of elements on path
+ * \param transform A transform to apply to the path.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsbeos_plot_path(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const float *p,
+ unsigned int n,
+ const float transform[6])
{
- /* XXX: This currently ignores the background colour supplied.
- * Does this matter?
- */
-
- if (width == 0 || height == 0)
- return true;
-
- BView *view;
-
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL) {
- beos_warn_user("No GC", 0);
- return false;
- }
-
- drawing_mode oldmode = view->DrawingMode();
- source_alpha alpha;
- alpha_function func;
- view->GetBlendingMode(&alpha, &func);
- //view->SetDrawingMode(B_OP_OVER);
- view->SetDrawingMode(B_OP_ALPHA);
- view->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
-
- // XXX DrawBitmap() resamples if rect doesn't match,
- // but doesn't do any filtering
- // XXX: use Zeta API if available ?
-
- BRect rect(x, y, x + width - 1, y + height - 1);
- /*
- rgb_color old = view->LowColor();
- if (bg != NS_TRANSPARENT) {
- view->SetLowColor(nsbeos_rgb_colour(bg));
- view->FillRect(rect, B_SOLID_LOW);
- }
- */
- view->DrawBitmap(b, rect);
- // maybe not needed?
- //view->SetLowColor(old);
- view->SetBlendingMode(alpha, func);
- view->SetDrawingMode(oldmode);
-
- //nsbeos_current_gc_unlock();
-
- return true;
+ unsigned int i;
+ BShape shape;
+
+ if (n == 0) {
+ return NSERROR_OK;
+ }
+
+ if (p[0] != PLOTTER_PATH_MOVE) {
+ NSLOG(netsurf, INFO, "path doesn't start with a move");
+ return NSERROR_INVALID;
+ }
+
+ for (i = 0; i < n; ) {
+ if (p[i] == PLOTTER_PATH_MOVE) {
+ BPoint pt(transform_pt(p[i + 1], p[i + 2], transform));
+ shape.MoveTo(pt);
+ i += 3;
+ } else if (p[i] == PLOTTER_PATH_CLOSE) {
+ shape.Close();
+ i++;
+ } else if (p[i] == PLOTTER_PATH_LINE) {
+ BPoint pt(transform_pt(p[i + 1], p[i + 2], transform));
+ shape.LineTo(pt);
+ i += 3;
+ } else if (p[i] == PLOTTER_PATH_BEZIER) {
+ BPoint pt[3] = {
+ transform_pt(p[i + 1], p[i + 2], transform),
+ transform_pt(p[i + 3], p[i + 4], transform),
+ transform_pt(p[i + 5], p[i + 6], transform)
+ };
+ shape.BezierTo(pt);
+ i += 7;
+ } else {
+ NSLOG(netsurf, INFO, "bad path command %f", p[i]);
+ return NSERROR_INVALID;
+ }
+ }
+ shape.Close();
+
+ BView *view;
+
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL) {
+ return NSERROR_INVALID;
+ }
+
+ rgb_color old_high = view->HighColor();
+ float old_pen = view->PenSize();
+ view->SetPenSize(plot_style_fixed_to_float(pstyle->stroke_width));
+ view->MovePenTo(0, 0);
+ if (pstyle->fill_colour != NS_TRANSPARENT) {
+ view->SetHighColor(nsbeos_rgb_colour(pstyle->fill_colour));
+ view->FillShape(&shape);
+ }
+ if (pstyle->stroke_colour != NS_TRANSPARENT) {
+ view->SetHighColor(nsbeos_rgb_colour(pstyle->stroke_colour));
+ view->StrokeShape(&shape);
+ }
+ // restore
+ view->SetPenSize(old_pen);
+ view->SetHighColor(old_high);
+
+ //nsbeos_current_gc_unlock();
+
+ return NSERROR_OK;
}
-bool nsbeos_plot_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags)
+/**
+ * Plot a bitmap
+ *
+ * Tiled plot of a bitmap image. (x,y) gives the top left
+ * coordinate of an explicitly placed tile. From this tile the
+ * image can repeat in all four directions -- up, down, left
+ * and right -- to the extents given by the current clip
+ * rectangle.
+ *
+ * The bitmap_flags say whether to tile in the x and y
+ * directions. If not tiling in x or y directions, the single
+ * image is plotted. The width and height give the dimensions
+ * the image is to be scaled to.
+ *
+ * \param ctx The current redraw context.
+ * \param bitmap The bitmap to plot
+ * \param x The x coordinate to plot the bitmap
+ * \param y The y coordiante to plot the bitmap
+ * \param width The width of area to plot the bitmap into
+ * \param height The height of area to plot the bitmap into
+ * \param bg the background colour to alpha blend into
+ * \param flags the flags controlling the type of plot operation
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsbeos_plot_bitmap(const struct redraw_context *ctx,
+ struct bitmap *bitmap,
+ int x, int y,
+ int width,
+ int height,
+ colour bg,
+ bitmap_flags_t flags)
{
- int doneheight = 0, donewidth = 0;
- BBitmap *primary;
- BBitmap *pretiled;
+ int doneheight = 0, donewidth = 0;
+ BBitmap *primary;
+ BBitmap *pretiled;
bool repeat_x = (flags & BITMAPF_REPEAT_X);
bool repeat_y = (flags & BITMAPF_REPEAT_Y);
- if (!(repeat_x || repeat_y)) {
- /* Not repeating at all, so just plot it */
+ if (!(repeat_x || repeat_y)) {
+ /* Not repeating at all, so just plot it */
primary = nsbeos_bitmap_get_primary(bitmap);
return nsbeos_plot_bbitmap(x, y, width, height, primary, bg);
- }
-
- if (repeat_x && !repeat_y)
- pretiled = nsbeos_bitmap_get_pretile_x(bitmap);
- if (repeat_x && repeat_y)
- pretiled = nsbeos_bitmap_get_pretile_xy(bitmap);
- if (!repeat_x && repeat_y)
- pretiled = nsbeos_bitmap_get_pretile_y(bitmap);
- primary = nsbeos_bitmap_get_primary(bitmap);
-
- /* use the primary and pretiled widths to scale the w/h provided */
- width *= pretiled->Bounds().Width() + 1;
- width /= primary->Bounds().Width() + 1;
- height *= pretiled->Bounds().Height() + 1;
- height /= primary->Bounds().Height() + 1;
-
- BView *view;
-
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL) {
- beos_warn_user("No GC", 0);
- return false;
- }
-
- // XXX: do we really need to use clipping reg ?
- // I guess it's faster to not draw clipped out stuff...
-
- BRect cliprect;
- BRegion clipreg;
- view->GetClippingRegion(&clipreg);
- cliprect = clipreg.Frame();
-
- //XXX: FIXME
-
- if (y > cliprect.top)
- doneheight = ((int)cliprect.top - height) + ((y - (int)cliprect.top) % height);
- else
- doneheight = y;
-
- while (doneheight < ((int)cliprect.bottom)) {
- if (x > cliprect.left)
- donewidth = ((int)cliprect.left - width) + ((x - (int)cliprect.left) % width);
- else
- donewidth = x;
- while (donewidth < (cliprect.right)) {
- nsbeos_plot_bbitmap(donewidth, doneheight,
- width, height, pretiled, bg);
- donewidth += width;
- if (!repeat_x) break;
- }
- doneheight += height;
- if (!repeat_y) break;
- }
+ }
+
+ if (repeat_x && !repeat_y)
+ pretiled = nsbeos_bitmap_get_pretile_x(bitmap);
+ if (repeat_x && repeat_y)
+ pretiled = nsbeos_bitmap_get_pretile_xy(bitmap);
+ if (!repeat_x && repeat_y)
+ pretiled = nsbeos_bitmap_get_pretile_y(bitmap);
+ primary = nsbeos_bitmap_get_primary(bitmap);
+
+ /* use the primary and pretiled widths to scale the w/h provided */
+ width *= pretiled->Bounds().Width() + 1;
+ width /= primary->Bounds().Width() + 1;
+ height *= pretiled->Bounds().Height() + 1;
+ height /= primary->Bounds().Height() + 1;
+
+ BView *view;
+
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL) {
+ beos_warn_user("No GC", 0);
+ return NSERROR_INVALID;
+ }
+
+ // XXX: do we really need to use clipping reg ?
+ // I guess it's faster to not draw clipped out stuff...
+
+ BRect cliprect;
+ BRegion clipreg;
+ view->GetClippingRegion(&clipreg);
+ cliprect = clipreg.Frame();
+
+ //XXX: FIXME
+
+ if (y > cliprect.top) {
+ doneheight = ((int)cliprect.top - height) + ((y - (int)cliprect.top) % height);
+ } else {
+ doneheight = y;
+ }
+
+ while (doneheight < ((int)cliprect.bottom)) {
+ if (x > cliprect.left) {
+ donewidth = ((int)cliprect.left - width) + ((x - (int)cliprect.left) % width);
+ } else {
+ donewidth = x;
+ }
+
+ while (donewidth < (cliprect.right)) {
+ nsbeos_plot_bbitmap(donewidth, doneheight,
+ width, height, pretiled, bg);
+ donewidth += width;
+ if (!repeat_x) {
+ break;
+ }
+ }
+ doneheight += height;
+ if (!repeat_y) {
+ break;
+ }
+ }
#warning WRITEME
- return true;
-}
-static BPoint transform_pt(float x, float y, const float transform[6])
-{
-#warning XXX: verify
- //return BPoint(x, y);
- BPoint pt;
- pt.x = x * transform[0] + y * transform[1] + transform[4];
- pt.y = x * transform[2] + y * transform[3] + transform[5];
- /*
- printf("TR: {%f, %f} { %f, %f, %f, %f, %f, %f} = { %f, %f }\n",
- x, y,
- transform[0], transform[1], transform[2],
- transform[3], transform[4], transform[5],
- pt.x, pt.y);
- */
- return pt;
+ return NSERROR_OK;
}
-bool nsbeos_plot_path(const float *p, unsigned int n, colour fill, float width,
- colour c, const float transform[6])
-{
- unsigned int i;
-
- if (n == 0)
- return true;
-
- if (p[0] != PLOTTER_PATH_MOVE) {
- LOG("path doesn't start with a move");
- return false;
- }
-
- BShape shape;
-
- for (i = 0; i < n; ) {
- if (p[i] == PLOTTER_PATH_MOVE) {
- BPoint pt(transform_pt(p[i + 1], p[i + 2], transform));
- shape.MoveTo(pt);
- i += 3;
- } else if (p[i] == PLOTTER_PATH_CLOSE) {
- shape.Close();
- i++;
- } else if (p[i] == PLOTTER_PATH_LINE) {
- BPoint pt(transform_pt(p[i + 1], p[i + 2], transform));
- shape.LineTo(pt);
- i += 3;
- } else if (p[i] == PLOTTER_PATH_BEZIER) {
- BPoint pt[3] = {
- transform_pt(p[i + 1], p[i + 2], transform),
- transform_pt(p[i + 3], p[i + 4], transform),
- transform_pt(p[i + 5], p[i + 6], transform)
- };
- shape.BezierTo(pt);
- i += 7;
- } else {
- LOG("bad path command %f", p[i]);
- return false;
- }
- }
- shape.Close();
-
- BView *view;
-
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL)
- return false;
-
- rgb_color old_high = view->HighColor();
- float old_pen = view->PenSize();
- view->SetPenSize(width);
- view->MovePenTo(0, 0);
- if (fill != NS_TRANSPARENT) {
- view->SetHighColor(nsbeos_rgb_colour(fill));
- view->FillShape(&shape);
- }
- if (c != NS_TRANSPARENT) {
- view->SetHighColor(nsbeos_rgb_colour(c));
- view->StrokeShape(&shape);
- }
- // restore
- view->SetPenSize(old_pen);
- view->SetHighColor(old_high);
-
- //nsbeos_current_gc_unlock();
-
- return true;
-}
-rgb_color nsbeos_rgb_colour(colour c)
+/**
+ * Text plotting.
+ *
+ * \param ctx The current redraw context.
+ * \param fstyle plot style for this text
+ * \param x x coordinate
+ * \param y y coordinate
+ * \param text UTF-8 string to plot
+ * \param length length of string, in bytes
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsbeos_plot_text(const struct redraw_context *ctx,
+ const struct plot_font_style *fstyle,
+ int x,
+ int y,
+ const char *text,
+ size_t length)
{
- rgb_color color;
- if (c == NS_TRANSPARENT)
- return B_TRANSPARENT_32_BIT;
- color.red = c & 0x0000ff;
- color.green = (c & 0x00ff00) >> 8;
- color.blue = (c & 0xff0000) >> 16;
- return color;
-}
+ if (!nsfont_paint(fstyle, text, length, x, y)) {
+ return NSERROR_INVALID;
+ }
-void nsbeos_set_colour(colour c)
-{
- rgb_color color = nsbeos_rgb_colour(c);
- BView *view = nsbeos_current_gc();
- view->SetHighColor(color);
+ return NSERROR_OK;
}
-/** Plot a caret. It is assumed that the plotters have been set up. */
-void nsbeos_plot_caret(int x, int y, int h)
-{
- BView *view;
-
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL)
- /* TODO: report an error here */
- return;
-
- BPoint start(x, y);
- BPoint end(x, y + h - 1);
-#if defined(__HAIKU__) || defined(B_BEOS_VERSION_DANO)
- view->SetHighColor(ui_color(B_DOCUMENT_TEXT_COLOR));
-#else
- view->SetHighColor(kBlackColor);
-#endif
- view->StrokeLine(start, end);
- //nsbeos_current_gc_unlock();
+/**
+ * beos plotter operation table
+ */
+const struct plotter_table nsbeos_plotters = {
+ nsbeos_plot_clip,
+ nsbeos_plot_arc,
+ nsbeos_plot_disc,
+ nsbeos_plot_line,
+ nsbeos_plot_rectangle,
+ nsbeos_plot_polygon,
+ nsbeos_plot_path,
+ nsbeos_plot_bitmap,
+ nsbeos_plot_text,
+ NULL, // Group Start
+ NULL, // Group End
+ NULL, // Flush
+ true // option_knockout
+};
-}
#ifdef TEST_PLOTTERS
//
static void test_plotters(void)
{
- int x0, y0;
- int x1, y1;
- struct rect r;
-
- x0 = 5;
- y0 = 5;
- x1 = 35;
- y1 = 6;
-
- plot.line(x0, y0, x1, y1, 1, 0x0000ff00, false, false);
- y0+=2; y1+=2;
- plot.line(x0, y0, x1, y1, 1, 0x0000ff00, true, false);
- y0+=2; y1+=2;
- plot.line(x0, y0, x1, y1, 1, 0x0000ff00, false, true);
- y0+=2; y1+=2;
- plot.line(x0, y0, x1, y1, 1, 0x0000ff00, true, true);
- y0+=10; y1+=20;
-
- plot.fill(x0, y0, x1, y1, 0x00ff0000);
- plot.rectangle(x0+10, y0+10, x1-x0+1, y1-y0+1, 2, 0x00ffff00, true, false);
- y0+=30; y1+=30;
-
- r.x0 = x0 + 2;
- r.y0 = y0 + 2;
- r.x1 = x1 - 2;
- r.y1 = y1 - 2;
- plot.clip(&r);
-
- plot.fill(x0, y0, x1, y1, 0x00000000);
- plot.disc(x1, y1, 8, 0x000000ff, false);
-
- r.x0 = 0;
- r.y0 = 0;
- r.x1 = 300;
- r.y1 = 300;
- plot.clip(&r);
-
- y0+=30; y1+=30;
-
+ int x0, y0;
+ int x1, y1;
+ struct rect r;
+
+ x0 = 5;
+ y0 = 5;
+ x1 = 35;
+ y1 = 6;
+
+ plot.line(x0, y0, x1, y1, 1, 0x0000ff00, false, false);
+ y0+=2; y1+=2;
+ plot.line(x0, y0, x1, y1, 1, 0x0000ff00, true, false);
+ y0+=2; y1+=2;
+ plot.line(x0, y0, x1, y1, 1, 0x0000ff00, false, true);
+ y0+=2; y1+=2;
+ plot.line(x0, y0, x1, y1, 1, 0x0000ff00, true, true);
+ y0+=10; y1+=20;
+
+ plot.fill(x0, y0, x1, y1, 0x00ff0000);
+ plot.rectangle(x0+10, y0+10, x1-x0+1, y1-y0+1, 2, 0x00ffff00, true, false);
+ y0+=30; y1+=30;
+
+ r.x0 = x0 + 2;
+ r.y0 = y0 + 2;
+ r.x1 = x1 - 2;
+ r.y1 = y1 - 2;
+ plot.clip(&r);
+
+ plot.fill(x0, y0, x1, y1, 0x00000000);
+ plot.disc(x1, y1, 8, 0x000000ff, false);
+
+ r.x0 = 0;
+ r.y0 = 0;
+ r.x1 = 300;
+ r.y1 = 300;
+ plot.clip(&r);
+
+ y0+=30; y1+=30;
+
}
#include <Application.h>
@@ -632,28 +803,27 @@ static void test_plotters(void)
#include <Window.h>
class PTView : public BView {
public:
- PTView(BRect frame) : BView(frame, "view", B_FOLLOW_NONE, B_WILL_DRAW) {};
- virtual ~PTView() {};
- virtual void Draw(BRect update)
- {
- test_plotters();
- };
+ PTView(BRect frame) : BView(frame, "view", B_FOLLOW_NONE, B_WILL_DRAW) {};
+ virtual ~PTView() {};
+ virtual void Draw(BRect update)
+ {
+ test_plotters();
+ };
};
extern "C" void test_plotters_main(void);
void test_plotters_main(void)
{
- BApplication app("application/x-vnd.NetSurf");
- memcpy(&plot, &nsbeos_plotters, sizeof(plot));
- BRect frame(0,0,300,300);
- PTView *view = new PTView(frame);
- frame.OffsetBySelf(100,100);
- BWindow *win = new BWindow(frame, "NetSurfPlotterTest", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE);
- win->AddChild(view);
- nsbeos_current_gc_set(view);
- win->Show();
- app.Run();
+ BApplication app("application/x-vnd.NetSurf");
+ memcpy(&plot, &nsbeos_plotters, sizeof(plot));
+ BRect frame(0,0,300,300);
+ PTView *view = new PTView(frame);
+ frame.OffsetBySelf(100,100);
+ BWindow *win = new BWindow(frame, "NetSurfPlotterTest", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE);
+ win->AddChild(view);
+ nsbeos_current_gc_set(view);
+ win->Show();
+ app.Run();
}
#endif /* TEST_PLOTTERS */
-
diff --git a/frontends/beos/res/adblock.css b/frontends/beos/res/adblock.css
index ff2485622..0d12aaa7c 120000
--- a/frontends/beos/res/adblock.css
+++ b/frontends/beos/res/adblock.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/AdBlock,f79 \ No newline at end of file
+../../../resources/adblock.css \ No newline at end of file
diff --git a/frontends/beos/res/ca-bundle.txt b/frontends/beos/res/ca-bundle.txt
index 0b0e416ad..1187fa51a 120000
--- a/frontends/beos/res/ca-bundle.txt
+++ b/frontends/beos/res/ca-bundle.txt
@@ -1 +1 @@
-../../../!NetSurf/Resources/ca-bundle \ No newline at end of file
+../../../resources/ca-bundle \ No newline at end of file
diff --git a/frontends/beos/res/de/welcome.html b/frontends/beos/res/de/welcome.html
index 98a53b215..b77e23743 120000
--- a/frontends/beos/res/de/welcome.html
+++ b/frontends/beos/res/de/welcome.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/de/welcome.html,faf \ No newline at end of file
+../../../../resources/de/welcome.html \ No newline at end of file
diff --git a/frontends/beos/res/default.css b/frontends/beos/res/default.css
index a8579eb7c..fa3ae6c26 120000
--- a/frontends/beos/res/default.css
+++ b/frontends/beos/res/default.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/CSS,f79 \ No newline at end of file
+../../../resources/default.css \ No newline at end of file
diff --git a/frontends/beos/res/en/credits.html b/frontends/beos/res/en/credits.html
index 252516fd7..f73ecd4aa 120000
--- a/frontends/beos/res/en/credits.html
+++ b/frontends/beos/res/en/credits.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/en/credits.html,faf \ No newline at end of file
+../../../../resources/en/credits.html \ No newline at end of file
diff --git a/frontends/beos/res/en/licence.html b/frontends/beos/res/en/licence.html
index 79f73669b..0c3b430b7 120000
--- a/frontends/beos/res/en/licence.html
+++ b/frontends/beos/res/en/licence.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/en/licence.html,faf \ No newline at end of file
+../../../../resources/en/licence.html \ No newline at end of file
diff --git a/frontends/beos/res/en/maps.html b/frontends/beos/res/en/maps.html
index bb3ffcbe7..507a4b248 120000
--- a/frontends/beos/res/en/maps.html
+++ b/frontends/beos/res/en/maps.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/en/maps.html,faf \ No newline at end of file
+../../../../resources/en/maps.html \ No newline at end of file
diff --git a/frontends/beos/res/en/welcome.html b/frontends/beos/res/en/welcome.html
index 601099223..543f31ddd 120000
--- a/frontends/beos/res/en/welcome.html
+++ b/frontends/beos/res/en/welcome.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/en/welcome.html,faf \ No newline at end of file
+../../../../resources/en/welcome.html \ No newline at end of file
diff --git a/frontends/beos/res/icons b/frontends/beos/res/icons
index c7f860352..94d2dc0df 120000
--- a/frontends/beos/res/icons
+++ b/frontends/beos/res/icons
@@ -1 +1 @@
-../../../!NetSurf/Resources/Icons \ No newline at end of file
+../../../resources/icons \ No newline at end of file
diff --git a/frontends/beos/res/internal.css b/frontends/beos/res/internal.css
index 17f9f1504..5583a9811 120000
--- a/frontends/beos/res/internal.css
+++ b/frontends/beos/res/internal.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/internal.css,f79 \ No newline at end of file
+../../../resources/internal.css \ No newline at end of file
diff --git a/frontends/beos/res/it/credits.html b/frontends/beos/res/it/credits.html
index 64b78982e..2b7c99542 120000
--- a/frontends/beos/res/it/credits.html
+++ b/frontends/beos/res/it/credits.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/it/credits.html,faf \ No newline at end of file
+../../../../resources/it/credits.html \ No newline at end of file
diff --git a/frontends/beos/res/it/licence.html b/frontends/beos/res/it/licence.html
index 4abc825d3..92afce85b 120000
--- a/frontends/beos/res/it/licence.html
+++ b/frontends/beos/res/it/licence.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/it/licence.html,faf \ No newline at end of file
+../../../../resources/it/licence.html \ No newline at end of file
diff --git a/frontends/beos/res/it/welcome.html b/frontends/beos/res/it/welcome.html
index 59cef0551..2673ba948 120000
--- a/frontends/beos/res/it/welcome.html
+++ b/frontends/beos/res/it/welcome.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/it/welcome.html,faf \ No newline at end of file
+../../../../resources/it/welcome.html \ No newline at end of file
diff --git a/frontends/beos/res/ja/welcome.html b/frontends/beos/res/ja/welcome.html
index a2556ee4e..8b603f3df 120000
--- a/frontends/beos/res/ja/welcome.html
+++ b/frontends/beos/res/ja/welcome.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/ja/welcome.html,faf \ No newline at end of file
+../../../../resources/ja/welcome.html \ No newline at end of file
diff --git a/frontends/beos/res/netsurf.png b/frontends/beos/res/netsurf.png
index 905512c25..d0ab72a5e 120000
--- a/frontends/beos/res/netsurf.png
+++ b/frontends/beos/res/netsurf.png
@@ -1 +1 @@
-../../../!NetSurf/Resources/netsurf.png,b60 \ No newline at end of file
+../../../resources/netsurf.png \ No newline at end of file
diff --git a/frontends/beos/res/quirks.css b/frontends/beos/res/quirks.css
index 88aabe48c..1e752cb9e 120000
--- a/frontends/beos/res/quirks.css
+++ b/frontends/beos/res/quirks.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/Quirks,f79 \ No newline at end of file
+../../../resources/quirks.css \ No newline at end of file
diff --git a/frontends/beos/scaffolding.cpp b/frontends/beos/scaffolding.cpp
index 5e386bdaa..e6fb6e5a1 100644
--- a/frontends/beos/scaffolding.cpp
+++ b/frontends/beos/scaffolding.cpp
@@ -608,8 +608,10 @@ NSBaseView::Instantiate(BMessage *archive)
struct replicant_thread_info *info = new replicant_thread_info;
info->url = BString(url);
- if (nsbeos_find_app_path(info->app) < B_OK)
+ if (nsbeos_find_app_path(info->app) < B_OK) {
+ delete info;
return NULL;
+ }
info->args[0] = info->app;
info->args[1] = (char *)info->url.String();
info->args[2] = NULL;
@@ -794,7 +796,7 @@ int32 nsbeos_replicant_main_thread(void *_arg)
static void nsbeos_window_destroy_event(NSBrowserWindow *window, nsbeos_scaffolding *g, BMessage *event)
{
- LOG("Being Destroyed = %d", g->being_destroyed);
+ NSLOG(netsurf, INFO, "Being Destroyed = %d", g->being_destroyed);
if (--open_windows == 0)
nsbeos_done = true;
@@ -852,7 +854,9 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
bw = nsbeos_get_browser_for_gui(scaffold->top_level);
bool reloadAll = false;
- LOG("nsbeos_scaffolding_dispatch_event() what = 0x%08lx", message->what);
+ NSLOG(netsurf, INFO,
+ "nsbeos_scaffolding_dispatch_event() what = 0x%08lx",
+ message->what);
switch (message->what) {
case B_QUIT_REQUESTED:
nsbeos_scaffolding_destroy(scaffold);
@@ -995,7 +999,7 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
browser_window_key_press(bw, NS_KEY_PASTE);
break;
case B_SELECT_ALL:
- LOG("Selecting all text");
+ NSLOG(netsurf, INFO, "Selecting all text");
browser_window_key_press(bw, NS_KEY_SELECT_ALL);
break;
case B_NETPOSITIVE_BACK:
@@ -1357,7 +1361,8 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
void nsbeos_scaffolding_destroy(nsbeos_scaffolding *scaffold)
{
- LOG("Being Destroyed = %d", scaffold->being_destroyed);
+ NSLOG(netsurf, INFO, "Being Destroyed = %d",
+ scaffold->being_destroyed);
if (scaffold->being_destroyed) return;
scaffold->being_destroyed = 1;
nsbeos_window_destroy_event(scaffold->window, scaffold, NULL);
@@ -1442,7 +1447,7 @@ static void recursively_set_menu_items_target(BMenu *menu, BHandler *handler)
void nsbeos_attach_toplevel_view(nsbeos_scaffolding *g, BView *view)
{
- LOG("Attaching view to scaffolding %p", g);
+ NSLOG(netsurf, INFO, "Attaching view to scaffolding %p", g);
// this is a replicant,... and it went bad
if (!g->window) {
@@ -1720,7 +1725,8 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
{
struct beos_scaffolding *g = (struct beos_scaffolding *)malloc(sizeof(*g));
- LOG("Constructing a scaffold of %p for gui_window %p", g, toplevel);
+ NSLOG(netsurf, INFO,
+ "Constructing a scaffold of %p for gui_window %p", g, toplevel);
g->top_level = toplevel;
g->being_destroyed = 0;
diff --git a/frontends/beos/schedule.cpp b/frontends/beos/schedule.cpp
index e96e56d81..7877a838b 100644
--- a/frontends/beos/schedule.cpp
+++ b/frontends/beos/schedule.cpp
@@ -28,11 +28,7 @@ extern "C" {
#include "netsurf/content_type.h"
#include "netsurf/browser_window.h"
-#ifdef DEBUG_BEOS_SCHEDULE
#include "utils/log.h"
-#else
-#define LOG(x...)
-#endif
}
/** Killable callback closure embodiment. */
@@ -58,7 +54,10 @@ nsbeos_schedule_kill_callback(void *_target, void *_match)
_nsbeos_callback_t *match = (_nsbeos_callback_t *)_match;
if ((target->callback == match->callback) &&
(target->context == match->context)) {
- LOG("Found match for %p(%p), killing.", target->callback, target->context);
+ NSLOG(schedule, DEBUG,
+ "Found match for %p(%p), killing.",
+ target->callback,
+ target->context);
target->callback = NULL;
target->context = NULL;
target->callback_killed = true;
@@ -69,7 +68,9 @@ nsbeos_schedule_kill_callback(void *_target, void *_match)
static void
schedule_remove(void (*callback)(void *p), void *p)
{
- LOG("schedule_remove() for %p(%p)", cb->callback, cb->context);
+ NSLOG(schedule, DEBUG,
+ "schedule_remove() for %p(%p)",
+ callback, p);
if (callbacks == NULL)
return;
_nsbeos_callback_t cb_match;
@@ -81,7 +82,7 @@ schedule_remove(void (*callback)(void *p), void *p)
nserror beos_schedule(int t, void (*callback)(void *p), void *p)
{
- LOG("t:%d cb:%p p:%p", t, cb->callback, cb->context);
+ NSLOG(schedule, DEBUG, "t:%d cb:%p p:%p", t, callback, p);
if (callbacks == NULL) {
callbacks = new BList;
@@ -111,7 +112,7 @@ nserror beos_schedule(int t, void (*callback)(void *p), void *p)
bool
schedule_run(void)
{
- LOG("schedule_run()");
+ NSLOG(schedule, DEBUG, "schedule_run()");
earliest_callback_timeout = B_INFINITE_TIMEOUT;
if (callbacks == NULL)
@@ -120,7 +121,9 @@ schedule_run(void)
bigtime_t now = system_time();
int32 i;
- LOG("Checking %ld callbacks to for deadline.", this_run->CountItems());
+ NSLOG(schedule, DEBUG,
+ "Checking %ld callbacks to for deadline.",
+ callbacks->CountItems());
/* Run all the callbacks which made it this far. */
for (i = 0; i < callbacks->CountItems(); ) {
@@ -132,7 +135,11 @@ schedule_run(void)
i++;
continue;
}
- LOG("Running callbacks %p(%p).", cb->callback, cb->context);
+ NSLOG(schedule, DEBUG,
+ "Running callbacks %p(%p).",
+ cb->callback,
+ cb->context);
+
if (!cb->callback_killed)
cb->callback(cb->context);
callbacks->RemoveItem(cb);
diff --git a/frontends/beos/throbber.cpp b/frontends/beos/throbber.cpp
index fe40b3edc..315afef83 100644
--- a/frontends/beos/throbber.cpp
+++ b/frontends/beos/throbber.cpp
@@ -50,18 +50,21 @@ bool nsbeos_throbber_initialise_from_png(const int frames, ...)
if (frames < 2) {
/* we need at least two frames - one for idle, one for active */
- LOG("Insufficent number of frames in throbber animation!");
- LOG("(called with %d frames, where 2 is a minimum.)", frames);
+ NSLOG(netsurf, INFO,
+ "Insufficent number of frames in throbber animation!");
+ NSLOG(netsurf, INFO,
+ "(called with %d frames, where 2 is a minimum.)",
+ frames);
return false;
}
BResources *res = get_app_resources();
if (res == NULL) {
- LOG("Can't find resources for throbber!");
+ NSLOG(netsurf, INFO, "Can't find resources for throbber!");
return false;
}
- throb = (struct nsbeos_throbber *)malloc(sizeof(throb));
+ throb = (struct nsbeos_throbber *)malloc(sizeof(*throb));
throb->nframes = frames;
throb->framedata = (BBitmap **)malloc(sizeof(BBitmap *) * throb->nframes);
@@ -74,14 +77,17 @@ bool nsbeos_throbber_initialise_from_png(const int frames, ...)
data = res->LoadResource('data', fn, &size);
throb->framedata[i] = NULL;
if (!data) {
- LOG("Error when loading resource %s", fn);
+ NSLOG(netsurf, INFO, "Error when loading resource %s",
+ fn);
errors_when_loading = true;
continue;
}
BMemoryIO mem(data, size);
throb->framedata[i] = BTranslationUtils::GetBitmap(&mem);
if (throb->framedata[i] == NULL) {
- LOG("Error when loading %s: GetBitmap() returned NULL", fn);
+ NSLOG(netsurf, INFO,
+ "Error when loading %s: GetBitmap() returned NULL",
+ fn);
errors_when_loading = true;
}
}
diff --git a/frontends/beos/window.cpp b/frontends/beos/window.cpp
index fbf7b1652..f4229207b 100644
--- a/frontends/beos/window.cpp
+++ b/frontends/beos/window.cpp
@@ -354,7 +354,8 @@ static struct gui_window *gui_window_create(struct browser_window *bw,
return 0;
}
- LOG("Creating gui window %p for browser window %p", g, bw);
+ NSLOG(netsurf, INFO, "Creating gui window %p for browser window %p",
+ g, bw);
g->bw = bw;
g->mouse.state = 0;
@@ -436,25 +437,27 @@ void nsbeos_dispatch_event(BMessage *message)
continue;
if (gui && gui != z) {
- LOG("discarding event for destroyed gui_window");
+ NSLOG(netsurf, INFO,
+ "discarding event for destroyed gui_window");
delete message;
return;
}
if (scaffold && (!y || scaffold != y->scaffold)) {
- LOG("discarding event for destroyed scaffolding");
+ NSLOG(netsurf, INFO,
+ "discarding event for destroyed scaffolding");
delete message;
return;
}
// messages for top-level
if (scaffold) {
- LOG("dispatching to top-level");
+ NSLOG(netsurf, INFO, "dispatching to top-level");
nsbeos_scaffolding_dispatch_event(scaffold, message);
delete message;
return;
}
- //LOG("processing message");
+ NSLOG(netsurf, DEEPDEBUG, "processing message");
switch (message->what) {
case B_QUIT_REQUESTED:
// from the BApplication
@@ -763,7 +766,8 @@ void nsbeos_window_keypress_event(BView *view, gui_window *g, BMessage *event)
if (!numbytes)
numbytes = strlen(bytes);
- LOG("mods 0x%08lx key %ld raw %ld byte[0] %d", mods, key, raw_char, buff[0]);
+ NSLOG(netsurf, INFO, "mods 0x%08lx key %ld raw %ld byte[0] %d", mods,
+ key, raw_char, buff[0]);
char byte;
if (numbytes == 1) {
@@ -911,28 +915,6 @@ void nsbeos_reflow_all_windows(void)
}
-
-/**
- * callback from core to reformat a window.
- */
-static void beos_window_reformat(struct gui_window *g)
-{
- if (g == NULL) {
- return;
- }
-
- NSBrowserFrameView *view = g->view;
- if (view && view->LockLooper()) {
- BRect bounds = view->Bounds();
- view->UnlockLooper();
-#warning XXX why - 1 & - 2 !???
- browser_window_reformat(g->bw,
- false,
- bounds.Width() + 1 /* - 2*/,
- bounds.Height() + 1);
- }
-}
-
void nsbeos_window_destroy_browser(struct gui_window *g)
{
browser_window_destroy(g->bw);
@@ -952,10 +934,10 @@ static void gui_window_destroy(struct gui_window *g)
g->next->prev = g->prev;
- LOG("Destroying gui_window %p", g);
+ NSLOG(netsurf, INFO, "Destroying gui_window %p", g);
assert(g != NULL);
assert(g->bw != NULL);
- LOG(" Scaffolding: %p", g->scaffold);
+ NSLOG(netsurf, INFO, " Scaffolding: %p", g->scaffold);
if (g->view == NULL)
return;
@@ -1000,39 +982,39 @@ void nsbeos_redraw_caret(struct gui_window *g)
g->view->UnlockLooper();
}
-static void gui_window_redraw_window(struct gui_window *g)
-{
- if (g->view == NULL)
- return;
- if (!g->view->LockLooper())
- return;
-
- nsbeos_current_gc_set(g->view);
-
- g->view->Invalidate();
-
- nsbeos_current_gc_set(NULL);
- g->view->UnlockLooper();
-}
-
-static void gui_window_update_box(struct gui_window *g, const struct rect *rect)
+/**
+ * Invalidate an area of a beos browser window
+ *
+ * \param g The netsurf window being invalidated.
+ * \param rect area to redraw or NULL for entrire window area.
+ * \return NSERROR_OK or appropriate error code.
+ */
+static nserror
+beos_window_invalidate_area(struct gui_window *g, const struct rect *rect)
{
- if (browser_window_has_content(g->bw) == false)
- return;
+ if (browser_window_has_content(g->bw) == false) {
+ return NSERROR_OK;
+ }
- if (g->view == NULL)
- return;
- if (!g->view->LockLooper())
- return;
+ if (g->view == NULL) {
+ return NSERROR_OK;
+ }
- nsbeos_current_gc_set(g->view);
+ if (!g->view->LockLooper()) {
+ return NSERROR_OK;
+ }
-//XXX +1 ??
- g->view->Invalidate(BRect(rect->x0, rect->y0,
- rect->x1 - 1, rect->y1 - 1));
+ if (rect != NULL) {
+ //XXX +1 ??
+ g->view->Invalidate(BRect(rect->x0, rect->y0,
+ rect->x1 - 1, rect->y1 - 1));
+ } else {
+ g->view->Invalidate();
+ }
- nsbeos_current_gc_set(NULL);
g->view->UnlockLooper();
+
+ return NSERROR_OK;
}
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
@@ -1053,21 +1035,39 @@ static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
return true;
}
-static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
+/**
+ * Set the scroll position of a beos browser window.
+ *
+ * Scrolls the viewport to ensure the specified rectangle of the
+ * content is shown. The beos implementation scrolls the contents so
+ * the specified point in the content is at the top of the viewport.
+ *
+ * \param g gui window to scroll
+ * \param rect The rectangle to ensure is shown.
+ * \return NSERROR_OK on success or apropriate error code.
+ */
+static nserror
+gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
{
//CALLED();
- if (g->view == NULL)
- return;
- if (!g->view->LockLooper())
- return;
+ if (g->view == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+ if (!g->view->LockLooper()) {
+ return NSERROR_BAD_PARAMETER;
+ }
#warning XXX: report to view frame ?
- if (g->view->ScrollBar(B_HORIZONTAL))
- g->view->ScrollBar(B_HORIZONTAL)->SetValue(sx);
- if (g->view->ScrollBar(B_VERTICAL))
- g->view->ScrollBar(B_VERTICAL)->SetValue(sy);
+ if (g->view->ScrollBar(B_HORIZONTAL)) {
+ g->view->ScrollBar(B_HORIZONTAL)->SetValue(rect->x0);
+ }
+ if (g->view->ScrollBar(B_VERTICAL)) {
+ g->view->ScrollBar(B_VERTICAL)->SetValue(rect->y0);
+ }
g->view->UnlockLooper();
+
+ return NSERROR_OK;
}
@@ -1094,8 +1094,9 @@ static void gui_window_update_extent(struct gui_window *g)
x_max -= g->view->Bounds().Width() + 1;
y_max -= g->view->Bounds().Height() + 1;
- LOG("x_max = %d y_max = %d x_prop = %f y_prop = %f\n",
- x_max, y_max, x_prop, y_prop);
+ NSLOG(netsurf, INFO,
+ "x_max = %d y_max = %d x_prop = %f y_prop = %f\n", x_max,
+ y_max, x_prop, y_prop);
if (g->view->ScrollBar(B_HORIZONTAL)) {
g->view->ScrollBar(B_HORIZONTAL)->SetRange(0, x_max);
@@ -1331,31 +1332,42 @@ static struct gui_clipboard_table clipboard_table = {
struct gui_clipboard_table *beos_clipboard_table = &clipboard_table;
-static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
- bool scaled)
+/**
+ * Find the current dimensions of a beos browser window content area.
+ *
+ * \param g The gui window to measure content area of.
+ * \param width receives width of window
+ * \param height receives height of window
+ * \param scaled whether to return scaled values
+ * \return NSERROR_OK on sucess and width and height updated
+ * else error code.
+ */
+static nserror
+gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
+ bool scaled)
{
- if (g->view && g->view->LockLooper()) {
- *width = g->view->Bounds().Width() + 1;
- *height = g->view->Bounds().Height() + 1;
- g->view->UnlockLooper();
- }
-
- if (scaled) {
- *width /= g->scale;
- *height /= g->scale;
- }
+ if (g->view &&
+ g->view->LockLooper()) {
+ *width = g->view->Bounds().Width() + 1;
+ *height = g->view->Bounds().Height() + 1;
+ g->view->UnlockLooper();
+
+ if (scaled) {
+ *width /= g->scale;
+ *height /= g->scale;
+ }
+ }
+ return NSERROR_OK;
}
static struct gui_window_table window_table = {
gui_window_create,
gui_window_destroy,
- gui_window_redraw_window,
- gui_window_update_box,
+ beos_window_invalidate_area,
gui_window_get_scroll,
gui_window_set_scroll,
gui_window_get_dimensions,
gui_window_update_extent,
- beos_window_reformat,
/* from scaffold */
gui_window_set_title,
@@ -1369,7 +1381,6 @@ static struct gui_window_table window_table = {
gui_window_stop_throbber,
NULL, //drag_start
NULL, //save_link
- NULL, //scroll_visible
NULL, //scroll_start
gui_window_new_content,
NULL, //create_form_select_menu
diff --git a/frontends/cocoa/ArrowBox.h b/frontends/cocoa/ArrowBox.h
deleted file mode 100644
index c49fcb6e7..000000000
--- a/frontends/cocoa/ArrowBox.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (c) 1011 Sven Weidauer
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-
-#import <Cocoa/Cocoa.h>
-
-typedef enum {
- ArrowNone,
- ArrowTopEdge,
- ArrowBottomEdge,
- ArrowLeftEdge,
- ArrowRightEdge
-} ArrowEdge;
-
-
-@interface ArrowBox : NSView {
- CGFloat arrowPosition;
- CGFloat arrowSize;
- ArrowEdge arrowEdge;
- CGFloat cornerRadius;
- BOOL updateShadow;
-}
-
-@property (readwrite, assign, nonatomic) CGFloat arrowPosition;
-@property (readwrite, assign, nonatomic) CGFloat arrowSize;
-@property (readwrite, assign, nonatomic) ArrowEdge arrowEdge;
-@property (readwrite, assign, nonatomic) CGFloat cornerRadius;
-
-@end
diff --git a/frontends/cocoa/ArrowBox.m b/frontends/cocoa/ArrowBox.m
deleted file mode 100644
index 6605fcca9..000000000
--- a/frontends/cocoa/ArrowBox.m
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Copyright 2011 Sven Weidauer
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#import "ArrowBox.h"
-
-@implementation ArrowBox
-
-@synthesize arrowPosition;
-@synthesize arrowSize;
-@synthesize arrowEdge;
-@synthesize cornerRadius;
-
-- (void) setArrowEdge: (ArrowEdge)newEdge
-{
- if (arrowEdge == newEdge) {
- return;
- }
-
- arrowEdge = newEdge;
-
- [self setNeedsDisplay: YES];
- updateShadow = YES;
-}
-
-
-- (void) setArrowSize: (CGFloat)newSize
-{
- arrowSize = newSize;
- [self setNeedsDisplay: YES];
- updateShadow = YES;
-}
-
-
-- (void) setCornerRadius: (CGFloat)newRadius
-{
- cornerRadius = newRadius;
- [self setNeedsDisplay: YES];
- updateShadow = YES;
-}
-
-- (void) setArrowPosition: (CGFloat)newPosition
-{
- arrowPosition = newPosition;
-
- [self setNeedsDisplay: YES];
- updateShadow = YES;
-}
-
-
-- (id)initWithFrame:(NSRect)frame
-{
- self = [super initWithFrame:frame];
- if (self) {
- arrowPosition = 50;
- cornerRadius = 10;
- arrowSize = 15;
- }
- return self;
-}
-
-- (void)drawRect:(NSRect)dirtyRect
-{
- [[NSColor clearColor] set];
- [NSBezierPath fillRect: dirtyRect];
-
- NSBezierPath *path = [NSBezierPath bezierPath];
-
- NSRect bounds = [self convertRectToBase: NSInsetRect( [self bounds], 2, 2 )];
- bounds.origin.x = floor( bounds.origin.x );
- bounds.origin.y = floor( bounds.origin.y );
- bounds.size.width = floor( bounds.size.width );
- bounds.size.height = floor( bounds.size.height );
- bounds = [self convertRectFromBase: bounds];
-
- const CGFloat right = bounds.size.width - arrowSize;
- const CGFloat top = bounds.size.height - arrowSize;
- const CGFloat left = arrowSize;
- const CGFloat bottom = arrowSize;
-
- [path setLineJoinStyle:NSRoundLineJoinStyle];
-
- [path moveToPoint: NSMakePoint( right - cornerRadius, top )];
-
- if (arrowEdge == ArrowTopEdge) {
- [path lineToPoint: NSMakePoint( arrowPosition + arrowSize, top )];
- [path lineToPoint: NSMakePoint( arrowPosition, top + arrowSize )];
- [path lineToPoint: NSMakePoint( arrowPosition - arrowSize, top )];
- }
-
- [path appendBezierPathWithArcFromPoint: NSMakePoint( left, top )
- toPoint: NSMakePoint( left, top - cornerRadius )
- radius: cornerRadius];
-
- if (arrowEdge == ArrowLeftEdge) {
- [path lineToPoint: NSMakePoint( left, bottom + arrowPosition + arrowSize )];
- [path lineToPoint: NSMakePoint( left - arrowSize, bottom + arrowPosition )];
- [path lineToPoint: NSMakePoint( left, bottom + arrowPosition - arrowSize )];
- }
-
- [path appendBezierPathWithArcFromPoint: NSMakePoint( left, bottom )
- toPoint: NSMakePoint( left + cornerRadius, bottom )
- radius: cornerRadius];
-
- if (arrowEdge == ArrowBottomEdge) {
- [path lineToPoint: NSMakePoint( arrowPosition - arrowSize, bottom )];
- [path lineToPoint: NSMakePoint( arrowPosition, bottom - arrowSize )];
- [path lineToPoint: NSMakePoint( arrowPosition + arrowSize, bottom )];
- }
-
- [path appendBezierPathWithArcFromPoint: NSMakePoint( right, bottom )
- toPoint: NSMakePoint( right, bottom + cornerRadius )
- radius: cornerRadius];
-
- if (arrowEdge == ArrowRightEdge) {
- [path lineToPoint: NSMakePoint( right, bottom + arrowPosition - arrowSize )];
- [path lineToPoint: NSMakePoint( right + arrowSize, bottom + arrowPosition )];
- [path lineToPoint: NSMakePoint( right, bottom + arrowPosition + arrowSize )];
- }
-
- [path appendBezierPathWithArcFromPoint: NSMakePoint( right, top )
- toPoint: NSMakePoint( right - cornerRadius, top )
- radius: cornerRadius];
- [path closePath];
-
- [[NSColor colorWithDeviceWhite: 1.0 alpha: 0.4] set];
- [[NSColor colorWithDeviceWhite: 0.0 alpha: 0.75] setFill];
-
- NSAffineTransform *transform = [NSAffineTransform transform];
- [transform translateXBy: bounds.origin.x yBy: bounds.origin.y];
- [transform concat];
-
- [path setLineWidth: 2.0];
- [path fill];
- [path stroke];
-
- if (updateShadow) {
- [[self window] invalidateShadow];
- [[self window] update];
- updateShadow = NO;
- }
-}
-
-@end
diff --git a/frontends/cocoa/ArrowWindow.h b/frontends/cocoa/ArrowWindow.h
deleted file mode 100644
index 79f422f3e..000000000
--- a/frontends/cocoa/ArrowWindow.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (c) 1011 Sven Weidauer
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-
-#import <Cocoa/Cocoa.h>
-
-#import "ArrowBox.h"
-
-@interface ArrowWindow : NSWindow {
- ArrowBox *box;
- NSView *content;
- BOOL acceptsKey;
- NSWindow *attachedWindow;
-}
-
-@property (readwrite, assign, nonatomic) BOOL acceptsKey;
-
-@property (readwrite, assign, nonatomic) CGFloat arrowPosition;
-@property (readwrite, assign, nonatomic) CGFloat arrowSize;
-@property (readwrite, assign, nonatomic) ArrowEdge arrowEdge;
-@property (readwrite, assign, nonatomic) CGFloat cornerRadius;
-
-- (void) moveToPoint: (NSPoint) screenPoint;
-- (void) attachToView: (NSView *) view;
-- (void) detach;
-
-@end
diff --git a/frontends/cocoa/ArrowWindow.m b/frontends/cocoa/ArrowWindow.m
deleted file mode 100644
index 8edc32e9f..000000000
--- a/frontends/cocoa/ArrowWindow.m
+++ /dev/null
@@ -1,239 +0,0 @@
-/* Copyright 2011 Sven Weidauer
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#import "ArrowWindow.h"
-#import "ArrowBox.h"
-
-@implementation ArrowWindow
-
-@synthesize acceptsKey;
-
-- (id) initWithContentRect: (NSRect)contentRect styleMask: (NSUInteger)aStyle backing: (NSBackingStoreType)bufferingType defer: (BOOL)flag
-{
- if ((self = [super initWithContentRect: contentRect styleMask: NSBorderlessWindowMask backing: bufferingType defer: flag]) == nil) {
- return nil;
- }
-
- [self setBackgroundColor: [NSColor clearColor]];
- [self setOpaque: NO];
- [self setHasShadow: YES];
-
- return self;
-}
-
-- (void) setContentView: (NSView *)aView
-{
- if (aView == content) return;
-
- [content removeFromSuperview];
- content = aView;
-
- if (content == nil) return;
-
- if (box == nil) {
- box = [[ArrowBox alloc] initWithFrame: NSZeroRect];
- [box setArrowEdge: ArrowTopEdge];
- [super setContentView: box];
- [box release];
- }
-
- [box addSubview: content];
-
- NSRect frame = [self contentRectForFrameRect: [self frame]];
- frame.origin = [self convertScreenToBase: frame.origin];
- frame = [box convertRect: frame fromView: nil];
-
- [content setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
- [content setFrame: frame];
-}
-
-- (void) setContentSize: (NSSize)aSize
-{
- NSRect frame = [content frame];
- frame.size = aSize;
-
- frame = [box convertRect: frame toView: nil];
- frame.origin = [self convertBaseToScreen: frame.origin];
- frame = [self frameRectForContentRect: frame];
-
- [self setFrame: frame display: YES];
-}
-
-static const CGFloat padding = 0;
-
-- (NSRect) contentRectForFrameRect: (NSRect)frameRect
-{
- const CGFloat arrowSize = [box arrowSize];
- const CGFloat offset = 2 * (padding + arrowSize );
-
- return NSInsetRect( frameRect, offset, offset );
-}
-
-- (NSRect) frameRectForContentRect: (NSRect)contentRect
-{
- const CGFloat arrowSize = [box arrowSize];
- const CGFloat offset = -2 * (padding + arrowSize );
-
- return NSInsetRect( contentRect, offset, offset );
-}
-
-+ (NSRect) frameRectForContentRect: (NSRect)cRect styleMask: (NSUInteger)aStyle
-{
- const CGFloat DefaultArrowSize = 15;
- const CGFloat offset = -2 * (padding + DefaultArrowSize);
-
- return NSInsetRect( cRect, offset, offset );
-}
-
-- (BOOL) canBecomeKeyWindow
-{
- return acceptsKey;
-}
-
-- (void) moveToPoint: (NSPoint) screenPoint
-{
- switch ([box arrowEdge]) {
- case ArrowNone:
- screenPoint.x -= [box arrowSize];
- screenPoint.y += [box arrowSize];
- break;
-
- case ArrowTopEdge:
- screenPoint.x -= [box arrowPosition];
- break;
-
- case ArrowBottomEdge:
- screenPoint.x -= [box arrowPosition];
- screenPoint.y += NSHeight( [self frame] );
- break;
-
- case ArrowLeftEdge:
- screenPoint.y += NSHeight( [self frame] ) - [box arrowPosition] - [box arrowSize];
- break;
-
- case ArrowRightEdge:
- screenPoint.x -= NSWidth( [self frame] );
- screenPoint.y += NSHeight( [self frame] ) - [box arrowPosition] - [box arrowSize];
- break;
- }
-
- [self setFrameTopLeftPoint: screenPoint];
-}
-
-static NSRect ScreenRectForView( NSView *view )
-{
- NSRect viewRect = [view bounds]; // in View coordinate system
- viewRect = [view convertRect: viewRect toView: nil]; // translate to window coordinates
- viewRect.origin = [[view window] convertBaseToScreen: viewRect.origin]; // translate to screen coordinates
- return viewRect;
-}
-
-- (void) attachToView: (NSView *) view
-{
- if (nil != attachedWindow) [self detach];
-
- NSRect viewRect = ScreenRectForView( view );
- NSPoint arrowPoint;
-
- switch ([box arrowEdge]) {
- case ArrowLeftEdge:
- arrowPoint = NSMakePoint( NSMaxX( viewRect ),
- NSMidY( viewRect ) );
- break;
-
- case ArrowBottomEdge:
- arrowPoint = NSMakePoint( NSMidX( viewRect ),
- NSMaxY( viewRect ) );
- break;
-
- case ArrowRightEdge:
- arrowPoint = NSMakePoint( NSMinX( viewRect ),
- NSMidY( viewRect ) );
- break;
-
- case ArrowNone:
- case ArrowTopEdge:
- default:
- arrowPoint = NSMakePoint( NSMidX( viewRect ),
- NSMinY( viewRect ) );
- break;
-
- }
- attachedWindow = [view window];
- [self moveToPoint: arrowPoint];
- [attachedWindow addChildWindow: self ordered: NSWindowAbove];
-}
-
-- (void) detach
-{
- [attachedWindow removeChildWindow: self];
- [self close];
- attachedWindow = nil;
-}
-
-//MARK: -
-//MARK: Properties
-
-- (void) setArrowPosition: (CGFloat) newPosition
-{
- [box setArrowPosition: newPosition];
-}
-
-- (CGFloat) arrowPosition
-{
- return [box arrowPosition];
-}
-
-- (void) setArrowSize: (CGFloat)newSize
-{
- NSRect contentRect = [self contentRectForFrameRect: [self frame]];
- [box setArrowSize: newSize];
- [self setFrame: [self frameRectForContentRect: contentRect] display: [self isVisible]];
-}
-
-- (CGFloat) arrowSize
-{
- return [box arrowSize];
-}
-
-- (void) setArrowEdge: (ArrowEdge) newEdge
-{
- [box setArrowEdge: newEdge];
-}
-
-- (ArrowEdge) arrowEdge
-{
- return [box arrowEdge];
-}
-
-- (void) setCornerRadius: (CGFloat)newRadius
-{
- [box setCornerRadius: newRadius];
-}
-
-- (CGFloat) cornerRadius
-{
- return [box cornerRadius];
-}
-
-@end
diff --git a/frontends/cocoa/BlackScroller.h b/frontends/cocoa/BlackScroller.h
deleted file mode 100644
index 34110b035..000000000
--- a/frontends/cocoa/BlackScroller.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (c) 1011 Sven Weidauer
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface BlackScroller : NSScroller {
- BOOL drawTrack;
- NSTrackingRectTag tag;
-}
-
-@property (readonly, getter=isHorizontal) BOOL horizontal;
-
-@end
diff --git a/frontends/cocoa/BlackScroller.m b/frontends/cocoa/BlackScroller.m
deleted file mode 100644
index 2ee739f3a..000000000
--- a/frontends/cocoa/BlackScroller.m
+++ /dev/null
@@ -1,154 +0,0 @@
-/* Copyright (c) 1011 Sven Weidauer
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#import "BlackScroller.h"
-
-@implementation BlackScroller
-
-- (void) setFrame: (NSRect)frameRect
-{
- [super setFrame: frameRect];
- if (tag != 0) [self removeTrackingRect: tag];
- tag = [self addTrackingRect: [self bounds] owner: self userData: NULL assumeInside: NO];
-}
-
-- (void) drawRect: (NSRect)dirtyRect
-{
- [[NSColor clearColor] set];
- [NSBezierPath fillRect: dirtyRect];
-
- if (drawTrack) [self drawKnobSlotInRect: [self rectForPart: NSScrollerKnobSlot]
- highlight: NO];
- [self drawKnob];
-}
-
-- (void) drawKnobSlotInRect: (NSRect)slotRect highlight: (BOOL)flag
-{
- slotRect = NSInsetRect( slotRect, 2, 2 );
- slotRect = [self convertRectToBase: slotRect];
- slotRect.origin.x = floor( slotRect.origin.x ) + 0.5;
- slotRect.origin.y = floor( slotRect.origin.y ) + 0.5;
- slotRect.size.width = floor( slotRect.size.width );
- slotRect.size.height = floor( slotRect.size.height );
- slotRect = [self convertRectFromBase: slotRect];
-
- NSGradient *gradient = [[[NSGradient alloc] initWithColorsAndLocations:
- [NSColor clearColor], 0.0,
- [NSColor clearColor], 0.4,
- [NSColor whiteColor], 1.0,
- nil] autorelease];
- [[NSColor whiteColor] set];
- const float radius = 0.5 * ([self isHorizontal] ? NSHeight( slotRect ) : NSWidth( slotRect ));
- NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect: slotRect
- xRadius: radius
- yRadius: radius];
- [gradient drawInBezierPath: path angle: [self isHorizontal] ? 90 : 0];
-
- [path stroke];
-}
-
-
-- (NSUsableScrollerParts) usableParts
-{
- return NSScrollerKnob | NSScrollerKnobSlot;
-}
-
-- (void) drawKnob
-{
- NSRect rect = NSInsetRect( [self rectForPart: NSScrollerKnob], 2, 2 );
-
- rect = [self convertRectToBase: rect];
- rect.origin.x = floor( rect.origin.x ) + 0.5;
- rect.origin.y = floor( rect.origin.y ) + 0.5;
- rect.size.width = floor( rect.size.width );
- rect.size.height = floor( rect.size.height );
- rect = [self convertRectFromBase: rect];
-
- [[NSColor colorWithDeviceWhite: 1.0 alpha: drawTrack ? 1.0 : 0.6] set];
-
- const float radius = 0.5 * ([self isHorizontal] ? NSHeight( rect ) : NSWidth( rect ));
- NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect: rect
- xRadius: radius
- yRadius: radius];
- [path fill];
- [path stroke];
-}
-
-- (NSRect) rectForPart: (NSScrollerPart)partCode
-{
- const bool horizontal = [self isHorizontal];
-
- NSRect rect = horizontal ? NSInsetRect( [self bounds], 4, 0 ) : NSInsetRect( [self bounds], 0, 4 );
-
- switch (partCode) {
- case NSScrollerKnobSlot:
- return rect;
-
- case NSScrollerKnob: {
- const CGFloat len = horizontal ? NSWidth( rect ) : NSHeight( rect );
- CGFloat knobLen = [self knobProportion] * len;
- const CGFloat minKnobLen = horizontal ? NSHeight( rect ) : NSWidth( rect );
- if (knobLen < minKnobLen) knobLen = minKnobLen;
-
- const CGFloat start = [self doubleValue] * (len - knobLen);
-
- if (horizontal) {
- rect.origin.x += start;
- rect.size.width = knobLen;
- } else {
- rect.origin.y += start;
- rect.size.height = knobLen;
- }
-
- return rect;
- }
-
- default:
- return [super rectForPart: partCode];
- }
-}
-
-- (BOOL) isOpaque
-{
- return NO;
-}
-
-- (BOOL) isHorizontal
-{
- NSRect bounds = [self bounds];
- return NSWidth( bounds ) > NSHeight( bounds );
-}
-
-- (void) mouseEntered: (NSEvent *)theEvent
-{
- drawTrack = YES;
- [self setNeedsDisplay: YES];
-}
-
-- (void) mouseExited: (NSEvent *)theEvent
-{
- drawTrack = NO;
- [self setNeedsDisplay: YES];
-}
-
-@end
diff --git a/frontends/cocoa/BookmarksController.h b/frontends/cocoa/BookmarksController.h
deleted file mode 100644
index aa71a1ac0..000000000
--- a/frontends/cocoa/BookmarksController.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@class Tree;
-@class TreeView;
-
-@interface BookmarksController : NSWindowController {
- Tree *tree;
- TreeView *view;
- NSMapTable *nodeForMenu;
- NSMenu *defaultMenu;
-}
-
-@property (readwrite, assign, nonatomic) IBOutlet NSMenu *defaultMenu;
-@property (readwrite, assign, nonatomic) IBOutlet TreeView *view;
-
-- (IBAction) openBookmarkURL: (id) sender;
-- (IBAction) addBookmark: (id) sender;
-
-- (IBAction) editSelected: (id) sender;
-- (IBAction) deleteSelected: (id) sender;
-- (IBAction) addFolder: (id) sender;
-
-@end
diff --git a/frontends/cocoa/BookmarksController.m b/frontends/cocoa/BookmarksController.m
deleted file mode 100644
index d7918d9fc..000000000
--- a/frontends/cocoa/BookmarksController.m
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "utils/messages.h"
-#import "utils/utils.h"
-#import "utils/nsurl.h"
-#import "netsurf/browser_window.h"
-#import "netsurf/keypress.h"
-#import "desktop/hotlist.h"
-
-#import "cocoa/desktop-tree.h"
-#import "cocoa/BookmarksController.h"
-#import "cocoa/Tree.h"
-#import "cocoa/TreeView.h"
-#import "cocoa/NetsurfApp.h"
-#import "cocoa/BrowserViewController.h"
-#import "cocoa/gui.h"
-
-
-@interface BookmarksController ()
-- (void) noteAppWillTerminate: (NSNotification *) note;
-- (void) save;
-@end
-
-@implementation BookmarksController
-
-@synthesize defaultMenu;
-@synthesize view;
-
-static const char *cocoa_hotlist_path( void )
-{
- NSString *path = [[NSUserDefaults standardUserDefaults]
- stringForKey: kHotlistFileOption];
- return [path UTF8String];
-}
-
-- (id)init
-{
- if ((self = [super initWithWindowNibName: @"BookmarksWindow"]) == nil) {
- return nil;
- }
- tree_hotlist_path = cocoa_hotlist_path();
- tree = [[Tree alloc] initWithFlags: TREE_HOTLIST];
- nodeForMenu = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
- NSNonOwnedPointerMapValueCallBacks,
- 0);
-
- [[NSNotificationCenter defaultCenter]
- addObserver:self
- selector:@selector(noteAppWillTerminate:)
- name:NSApplicationWillTerminateNotification
- object:NSApp];
-
- return self;
-}
-
-- (void) noteAppWillTerminate: (NSNotification *)note
-{
- [self save];
-}
-
-- (void) save
-{
- hotlist_export( cocoa_hotlist_path(), NULL );
-}
-
-- (void) dealloc
-{
- [self setView: nil];
- NSFreeMapTable( nodeForMenu );
- [tree release];
-
- [[NSNotificationCenter defaultCenter] removeObserver: self];
-
- [super dealloc];
-}
-
-- (void) menuNeedsUpdate: (NSMenu *)menu
-{
-#if 0
- for (NSMenuItem *item in [menu itemArray]) {
- if ([item hasSubmenu]) NSMapRemove( nodeForMenu, [item submenu] );
- [menu removeItem: item];
- }
-
- bool hasSeparator = true;
- struct node *node = (struct node *)NSMapGet( nodeForMenu, menu );
- if (node == NULL) {
- for (NSMenuItem *item in [defaultMenu itemArray]) {
- [menu addItem: [[item copy] autorelease]];
- }
- hasSeparator = false;
- }
-
- for (struct node *child = tree_node_get_child( node );
- child != NULL;
- child = tree_node_get_next( child )) {
-
- if (tree_node_is_deleted( child )) continue;
-
- if (!hasSeparator) {
- [menu addItem: [NSMenuItem separatorItem]];
- hasSeparator = true;
- }
-
- NSString *title = [NSString stringWithUTF8String: tree_url_node_get_title( child )];
-
- NSMenuItem *item = [menu addItemWithTitle: title action: NULL keyEquivalent: @""];
- if (tree_node_is_folder( child )) {
- NSMenu *subMenu = [[[NSMenu alloc] initWithTitle: title] autorelease];
- NSMapInsert( nodeForMenu, subMenu, child );
- [subMenu setDelegate: self];
- [menu setSubmenu: subMenu forItem: item];
- } else {
- [item setRepresentedObject: [NSString stringWithUTF8String: tree_url_node_get_url( child )]];
- [item setTarget: self];
- [item setAction: @selector( openBookmarkURL: )];
- }
- }
-#endif
-}
-
-- (IBAction) openBookmarkURL: (id)sender
-{
- const char *urltxt = [[sender representedObject] UTF8String];
- NSParameterAssert( urltxt != NULL );
-
- nsurl *url;
- nserror error;
-
- error = nsurl_create(urltxt, &url);
- if (error == NSERROR_OK) {
- BrowserViewController *tab = [(NetSurfApp *)NSApp frontTab];
- if (tab != nil) {
- error = browser_window_navigate([tab browser],
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- } else {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
- }
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- cocoa_warning(messages_get_errorcode(error), 0);
- }
-}
-
-- (IBAction) addBookmark: (id)sender
-{
- struct browser_window *bw = [[(NetSurfApp *)NSApp frontTab] browser];
- if (bw != NULL) {
- hotlist_add_url(browser_window_get_url(bw));
- }
-}
-
-- (BOOL) validateUserInterfaceItem: (id)item
-{
- SEL action = [item action];
-
- if (action == @selector( addBookmark: )) {
- return [(NetSurfApp *)NSApp frontTab] != nil;
- }
-
- return YES;
-}
-
-- (void) windowDidLoad
-{
- hotlist_expand(false);
- hotlist_contract(true);
-
- [view setTree: tree];
-}
-
-
-+ (void) initialize
-{
- [[NSUserDefaults standardUserDefaults]
- registerDefaults:
- [NSDictionary
- dictionaryWithObjectsAndKeys:cocoa_get_user_path( @"Bookmarks.html" ),
- kHotlistFileOption,
- nil]];
-}
-
-- (IBAction) editSelected: (id)sender
-{
- hotlist_edit_selection();
-}
-
-- (IBAction) deleteSelected: (id)sender
-{
- hotlist_keypress(NS_KEY_DELETE_LEFT);
-}
-
-- (IBAction) addFolder: (id)sender
-{
- hotlist_add_folder(NULL, false, 0);
-}
-
-@end
diff --git a/frontends/cocoa/BrowserView.h b/frontends/cocoa/BrowserView.h
deleted file mode 100644
index c626c8c5b..000000000
--- a/frontends/cocoa/BrowserView.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "cocoa/ScrollableView.h"
-
-@class LocalHistoryController;
-
-@interface BrowserView : ScrollableView <NSTextInput> {
- struct browser_window *browser;
-
- NSPoint caretPoint;
- CGFloat caretHeight;
- BOOL caretVisible;
- BOOL hasCaret;
- NSTimer *caretTimer;
-
- BOOL isDragging;
- NSPoint dragStart;
-
- BOOL historyVisible;
- LocalHistoryController *history;
-
- NSString *markedText;
-}
-
-@property (readwrite, assign, nonatomic) struct browser_window *browser;
-@property (readwrite, retain, nonatomic) NSTimer *caretTimer;
-@property (readwrite, assign, nonatomic, getter=isHistoryVisible) BOOL historyVisible;
-
-- (void) removeCaret;
-- (void) addCaretAt: (NSPoint) point height: (CGFloat) height;
-
-- (void) reformat;
-- (void) updateHistory;
-
-@end
diff --git a/frontends/cocoa/BrowserView.m b/frontends/cocoa/BrowserView.m
deleted file mode 100644
index f1259d835..000000000
--- a/frontends/cocoa/BrowserView.m
+++ /dev/null
@@ -1,760 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "utils/nsoption.h"
-#import "utils/messages.h"
-#import "utils/nsurl.h"
-#import "utils/utils.h"
-#import "netsurf/browser_window.h"
-#import "netsurf/plotters.h"
-#import "netsurf/content.h"
-#import "netsurf/keypress.h"
-
-#import "cocoa/gui.h"
-#import "cocoa/BrowserView.h"
-#import "cocoa/HistoryView.h"
-#import "cocoa/font.h"
-#import "cocoa/coordinates.h"
-#import "cocoa/plotter.h"
-#import "cocoa/LocalHistoryController.h"
-#import "cocoa/BrowserWindowController.h"
-
-
-@interface BrowserView ()
-
-@property (readwrite, copy, nonatomic) NSString *markedText;
-
-- (void) scrollHorizontal: (CGFloat) amount;
-- (void) scrollVertical: (CGFloat) amount;
-- (CGFloat) pageScroll;
-
-- (void) reformat;
-
-- (void) popUpContextMenuForEvent: (NSEvent *) event;
-
-- (IBAction) cmOpenURLInTab: (id) sender;
-- (IBAction) cmOpenURLInWindow: (id) sender;
-- (IBAction) cmDownloadURL: (id) sender;
-
-- (IBAction) cmLinkCopy: (id) sender;
-- (IBAction) cmImageCopy: (id) sender;
-
-@end
-
-@implementation BrowserView
-
-@synthesize browser;
-@synthesize caretTimer;
-@synthesize markedText;
-
-static const CGFloat CaretWidth = 1.0;
-static const NSTimeInterval CaretBlinkTime = 0.8;
-
-- initWithFrame: (NSRect) frame
-{
- if ((self = [super initWithFrame: frame]) == nil) {
- return nil;
- }
-
- [self registerForDraggedTypes: [NSArray arrayWithObjects: NSURLPboardType, @"public.url", nil]];
-
- return self;
-}
-
-- (void) dealloc
-{
- [self setCaretTimer: nil];
- [self setMarkedText: nil];
- [history release];
-
- [super dealloc];
-}
-
-- (void) setCaretTimer: (NSTimer *)newTimer
-{
- if (newTimer != caretTimer) {
- [caretTimer invalidate];
- [caretTimer release];
- caretTimer = [newTimer retain];
- }
-}
-
-- (void) updateHistory
-{
- [history redraw];
-}
-
-static inline NSRect cocoa_get_caret_rect( BrowserView *view )
-{
- float bscale = browser_window_get_scale(view->browser);
-
- NSRect caretRect = {
- .origin = NSMakePoint( view->caretPoint.x * bscale, view->caretPoint.y * bscale ),
- .size = NSMakeSize( CaretWidth, view->caretHeight * bscale )
- };
-
- return caretRect;
-}
-
-- (void) removeCaret
-{
- hasCaret = NO;
- [self setNeedsDisplayInRect: cocoa_get_caret_rect( self )];
-
- [self setCaretTimer: nil];
-}
-
-- (void) addCaretAt: (NSPoint) point height: (CGFloat) height
-{
- if (hasCaret) {
- [self setNeedsDisplayInRect: cocoa_get_caret_rect( self )];
- }
-
- caretPoint = point;
- caretHeight = height;
- hasCaret = YES;
- caretVisible = YES;
-
- if (nil == caretTimer) {
- [self setCaretTimer: [NSTimer scheduledTimerWithTimeInterval: CaretBlinkTime target: self selector: @selector(caretBlink:) userInfo: nil repeats: YES]];
- } else {
- [caretTimer setFireDate: [NSDate dateWithTimeIntervalSinceNow: CaretBlinkTime]];
- }
-
- [self setNeedsDisplayInRect: cocoa_get_caret_rect( self )];
-}
-
-
-- (void) caretBlink: (NSTimer *)timer
-{
- if (hasCaret) {
- caretVisible = !caretVisible;
- [self setNeedsDisplayInRect: cocoa_get_caret_rect( self )];
- }
-}
-
-- (void)drawRect:(NSRect)dirtyRect
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &cocoa_plotters
- };
-
- const NSRect *rects = NULL;
- NSInteger count = 0;
- [self getRectsBeingDrawn: &rects count: &count];
-
- for (NSInteger i = 0; i < count; i++) {
- const struct rect clip = {
- .x0 = cocoa_pt_to_px( NSMinX( rects[i] ) ),
- .y0 = cocoa_pt_to_px( NSMinY( rects[i] ) ),
- .x1 = cocoa_pt_to_px( NSMaxX( rects[i] ) ),
- .y1 = cocoa_pt_to_px( NSMaxY( rects[i] ) )
- };
-
- browser_window_redraw(browser, 0, 0, &clip, &ctx);
- }
-
- NSRect caretRect = cocoa_get_caret_rect( self );
- if (hasCaret && caretVisible && [self needsToDrawRect: caretRect]) {
- [[NSColor blackColor] set];
- [NSBezierPath fillRect: caretRect];
- }
-
- [pool release];
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
-
-- (void) viewDidMoveToWindow
-{
- NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect: [self visibleRect]
- options: NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingActiveInKeyWindow | NSTrackingInVisibleRect
- owner: self
- userInfo: nil];
- [self addTrackingArea: area];
- [area release];
-}
-
-static browser_mouse_state cocoa_mouse_flags_for_event( NSEvent *evt )
-{
- browser_mouse_state result = 0;
- NSUInteger flags = [evt modifierFlags];
-
- if (flags & NSShiftKeyMask) result |= BROWSER_MOUSE_MOD_1;
- if (flags & NSAlternateKeyMask) result |= BROWSER_MOUSE_MOD_2;
-
- return result;
-}
-
-- (NSPoint) convertMousePoint: (NSEvent *)event
-{
- NSPoint location = [self convertPoint: [event locationInWindow] fromView: nil];
- float bscale = browser_window_get_scale(browser);
-
- location.x /= bscale;
- location.y /= bscale;
-
- location.x = cocoa_pt_to_px( location.x );
- location.y = cocoa_pt_to_px( location.y );
- return location;
-}
-
-- (void) mouseDown: (NSEvent *)theEvent
-{
- if ([theEvent modifierFlags] & NSControlKeyMask) {
- [self popUpContextMenuForEvent: theEvent];
- return;
- }
-
- dragStart = [self convertMousePoint: theEvent];
-
- browser_window_mouse_click(browser,
- BROWSER_MOUSE_PRESS_1 | cocoa_mouse_flags_for_event( theEvent ),
- dragStart.x,
- dragStart.y );
-}
-
-- (void) rightMouseDown: (NSEvent *)theEvent
-{
- [self popUpContextMenuForEvent: theEvent];
-}
-
-- (void) mouseUp: (NSEvent *)theEvent
-{
- if (historyVisible) {
- [self setHistoryVisible: NO];
- return;
- }
-
- NSPoint location = [self convertMousePoint: theEvent];
-
- browser_mouse_state modifierFlags = cocoa_mouse_flags_for_event( theEvent );
-
- if (isDragging) {
- isDragging = NO;
- browser_window_mouse_track( browser, (browser_mouse_state)0, location.x, location.y );
- } else {
- modifierFlags |= BROWSER_MOUSE_CLICK_1;
- if ([theEvent clickCount] == 2) modifierFlags |= BROWSER_MOUSE_DOUBLE_CLICK;
- browser_window_mouse_click( browser, modifierFlags, location.x, location.y );
- }
-}
-
-#define squared(x) ((x)*(x))
-#define MinDragDistance (5.0)
-
-- (void) mouseDragged: (NSEvent *)theEvent
-{
- NSPoint location = [self convertMousePoint: theEvent];
- browser_mouse_state modifierFlags = cocoa_mouse_flags_for_event( theEvent );
-
- if (!isDragging) {
- const CGFloat distance = squared( dragStart.x - location.x ) + squared( dragStart.y - location.y );
-
- if (distance >= squared( MinDragDistance)) {
- isDragging = YES;
- browser_window_mouse_click(browser,
- BROWSER_MOUSE_DRAG_1 | modifierFlags,
- dragStart.x,
- dragStart.y);
- }
- }
-
- if (isDragging) {
- browser_window_mouse_track(browser,
- BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON | modifierFlags,
- location.x,
- location.y );
- }
-}
-
-- (void) mouseMoved: (NSEvent *)theEvent
-{
- if (historyVisible) return;
-
- NSPoint location = [self convertMousePoint: theEvent];
-
- browser_window_mouse_track(browser,
- cocoa_mouse_flags_for_event(theEvent),
- location.x,
- location.y);
-}
-
-- (void) mouseExited: (NSEvent *) theEvent
-{
- [[NSCursor arrowCursor] set];
-}
-
-- (void) keyDown: (NSEvent *)theEvent
-{
- if (!historyVisible) {
- [self interpretKeyEvents: [NSArray arrayWithObject: theEvent]];
- } else {
- [history keyDown: theEvent];
- }
-}
-
-- (void) insertText: (id)string
-{
- for (NSUInteger i = 0, length = [string length]; i < length; i++) {
- unichar ch = [string characterAtIndex: i];
- if (!browser_window_key_press( browser, ch )) {
- if (ch == ' ') [self scrollPageDown: self];
- break;
- }
- }
- [self setMarkedText: nil];
-}
-
-- (void) moveLeft: (id)sender
-{
- if (browser_window_key_press( browser, NS_KEY_LEFT )) return;
- [self scrollHorizontal: -[[self enclosingScrollView] horizontalLineScroll]];
-}
-
-- (void) moveRight: (id)sender
-{
- if (browser_window_key_press( browser, NS_KEY_RIGHT )) return;
- [self scrollHorizontal: [[self enclosingScrollView] horizontalLineScroll]];
-}
-
-- (void) moveUp: (id)sender
-{
- if (browser_window_key_press( browser, NS_KEY_UP )) return;
- [self scrollVertical: -[[self enclosingScrollView] lineScroll]];
-}
-
-- (void) moveDown: (id)sender
-{
- if (browser_window_key_press( browser, NS_KEY_DOWN )) return;
- [self scrollVertical: [[self enclosingScrollView] lineScroll]];
-}
-
-- (void) deleteBackward: (id)sender
-{
- if (!browser_window_key_press( browser, NS_KEY_DELETE_LEFT )) {
- [NSApp sendAction: @selector( goBack: ) to: nil from: self];
- }
-}
-
-- (void) deleteForward: (id)sender
-{
- browser_window_key_press( browser, NS_KEY_DELETE_RIGHT );
-}
-
-- (void) cancelOperation: (id)sender
-{
- browser_window_key_press( browser, NS_KEY_ESCAPE );
-}
-
-- (void) scrollPageUp: (id)sender
-{
- if (browser_window_key_press( browser, NS_KEY_PAGE_UP )) {
- return;
- }
- [self scrollVertical: -[self pageScroll]];
-}
-
-- (void) scrollPageDown: (id)sender
-{
- if (browser_window_key_press( browser, NS_KEY_PAGE_DOWN )) {
- return;
- }
- [self scrollVertical: [self pageScroll]];
-}
-
-- (void) insertTab: (id)sender
-{
- browser_window_key_press( browser, NS_KEY_TAB );
-}
-
-- (void) insertBacktab: (id)sender
-{
- browser_window_key_press( browser, NS_KEY_SHIFT_TAB );
-}
-
-- (void) moveToBeginningOfLine: (id)sender
-{
- browser_window_key_press( browser, NS_KEY_LINE_START );
-}
-
-- (void) moveToEndOfLine: (id)sender
-{
- browser_window_key_press( browser, NS_KEY_LINE_END );
-}
-
-- (void) moveToBeginningOfDocument: (id)sender
-{
- if (browser_window_key_press( browser, NS_KEY_TEXT_START )) return;
-}
-
-- (void) scrollToBeginningOfDocument: (id) sender
-{
- NSPoint origin = [self visibleRect].origin;
- origin.y = 0;
- [self scrollPoint: origin];
-}
-
-- (void) moveToEndOfDocument: (id)sender
-{
- browser_window_key_press( browser, NS_KEY_TEXT_END );
-}
-
-- (void) scrollToEndOfDocument: (id) sender
-{
- NSPoint origin = [self visibleRect].origin;
- origin.y = NSHeight( [self frame] );
- [self scrollPoint: origin];
-}
-
-- (void) insertNewline: (id)sender
-{
- browser_window_key_press( browser, NS_KEY_NL );
-}
-
-- (void) selectAll: (id)sender
-{
- browser_window_key_press( browser, NS_KEY_SELECT_ALL );
-}
-
-- (void) copy: (id)sender
-{
- browser_window_key_press( browser, NS_KEY_COPY_SELECTION );
-}
-
-- (void) cut: (id)sender
-{
- browser_window_key_press( browser, NS_KEY_CUT_SELECTION );
-}
-
-- (void) paste: (id)sender
-{
- browser_window_key_press( browser, NS_KEY_PASTE );
-}
-
-- (BOOL) acceptsFirstResponder
-{
- return YES;
-}
-
-- (void) adjustFrame
-{
- browser_window_schedule_reformat(browser);
-
- [super adjustFrame];
-}
-
-- (BOOL) isHistoryVisible
-{
- return historyVisible;
-}
-
-- (void) setHistoryVisible: (BOOL)newVisible
-{
- if (newVisible == historyVisible) return;
- historyVisible = newVisible;
-
- if (historyVisible) {
- if (nil == history) {
- history = [[LocalHistoryController alloc] initWithBrowser: self];
- }
- [history attachToView: [(BrowserWindowController *)[[self window] windowController] historyButton]];
- } else {
- [history detach];
- }
-}
-
-- (void) scrollHorizontal: (CGFloat) amount
-{
- NSPoint currentPoint = [self visibleRect].origin;
- currentPoint.x += amount;
- [self scrollPoint: currentPoint];
-}
-
-- (void) scrollVertical: (CGFloat) amount
-{
- NSPoint currentPoint = [self visibleRect].origin;
- currentPoint.y += amount;
- [self scrollPoint: currentPoint];
-}
-
-- (CGFloat) pageScroll
-{
- return NSHeight( [[self superview] frame] ) - [[self enclosingScrollView] pageScroll];
-}
-
-- (void) reformat
-{
- NSRect size = [[self superview] frame];
- browser_window_reformat(browser,
- false,
- cocoa_pt_to_px( NSWidth( size ) ),
- cocoa_pt_to_px( NSHeight( size ) ) );
-}
-
-- (void) popUpContextMenuForEvent: (NSEvent *) event
-{
- NSMenu *popupMenu = [[NSMenu alloc] initWithTitle: @""];
- NSPoint point = [self convertMousePoint: event];
-
- struct browser_window_features cont;
-
- browser_window_get_features(browser, point.x, point.y, &cont);
-
- if (cont.object != NULL) {
- NSString *imageURL = [NSString stringWithUTF8String: nsurl_access(hlcache_handle_get_url( cont.object ))];
-
- [[popupMenu addItemWithTitle: NSLocalizedString( @"Open image in new tab", @"Context menu" )
- action: @selector(cmOpenURLInTab:)
- keyEquivalent: @""] setRepresentedObject: imageURL];
- [[popupMenu addItemWithTitle: NSLocalizedString( @"Open image in new window", @"Context menu" )
- action: @selector(cmOpenURLInWindow:)
- keyEquivalent: @""] setRepresentedObject: imageURL];
- [[popupMenu addItemWithTitle: NSLocalizedString( @"Save image as", @"Context menu" )
- action: @selector(cmDownloadURL:)
- keyEquivalent: @""] setRepresentedObject: imageURL];
- [[popupMenu addItemWithTitle: NSLocalizedString( @"Copy image", @"Context menu" )
- action: @selector(cmImageCopy:)
- keyEquivalent: @""] setRepresentedObject: (id)content_get_bitmap( cont.object )];
-
- [popupMenu addItem: [NSMenuItem separatorItem]];
- }
-
- if (cont.link != NULL) {
- NSString *target = [NSString stringWithUTF8String: nsurl_access(cont.link)];
-
- [[popupMenu addItemWithTitle: NSLocalizedString( @"Open link in new tab", @"Context menu" )
- action: @selector(cmOpenURLInTab:)
- keyEquivalent: @""] setRepresentedObject: target];
- [[popupMenu addItemWithTitle: NSLocalizedString( @"Open link in new window", @"Context menu" )
- action: @selector(cmOpenURLInWindow:)
- keyEquivalent: @""] setRepresentedObject: target];
- [[popupMenu addItemWithTitle: NSLocalizedString( @"Save link target", @"Context menu" )
- action: @selector(cmDownloadURL:)
- keyEquivalent: @""] setRepresentedObject: target];
- [[popupMenu addItemWithTitle: NSLocalizedString( @"Copy link", @"Context menu" )
- action: @selector(cmLinkCopy:)
- keyEquivalent: @""] setRepresentedObject: target];
-
- [popupMenu addItem: [NSMenuItem separatorItem]];
- }
-
- [popupMenu addItemWithTitle: NSLocalizedString( @"Back", @"Context menu" )
- action: @selector(goBack:) keyEquivalent: @""];
- [popupMenu addItemWithTitle: NSLocalizedString( @"Reload", @"Context menu" )
- action: @selector(reloadPage:) keyEquivalent: @""];
- [popupMenu addItemWithTitle: NSLocalizedString( @"Forward", @"Context menu" )
- action: @selector(goForward:) keyEquivalent: @""];
- [popupMenu addItemWithTitle: NSLocalizedString( @"View Source", @"Context menu" )
- action: @selector(viewSource:) keyEquivalent: @""];
-
- [NSMenu popUpContextMenu: popupMenu withEvent: event forView: self];
-
- [popupMenu release];
-}
-
-- (IBAction) cmOpenURLInTab: (id)sender
-{
- nsurl *url;
- nserror error;
-
- error = nsurl_create([[sender representedObject] UTF8String], &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY |
- BW_CREATE_TAB |
- BW_CREATE_CLONE,
- url,
- NULL,
- browser,
- NULL);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- cocoa_warning(messages_get_errorcode(error), 0);
- }
-}
-
-- (IBAction) cmOpenURLInWindow: (id)sender
-{
- nsurl *url;
- nserror error;
-
- error = nsurl_create([[sender representedObject] UTF8String], &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY |
- BW_CREATE_CLONE,
- url,
- NULL,
- browser,
- NULL);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- cocoa_warning(messages_get_errorcode(error), 0);
- }
-}
-
-- (IBAction) cmDownloadURL: (id)sender
-{
- nsurl *url;
-
- if (nsurl_create([[sender representedObject] UTF8String], &url) == NSERROR_OK) {
- browser_window_navigate(browser,
- url,
- NULL,
- BW_NAVIGATE_DOWNLOAD,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
-}
-
-- (IBAction) cmImageCopy: (id)sender
-{
- NSPasteboard *pb = [NSPasteboard generalPasteboard];
- [pb declareTypes: [NSArray arrayWithObject: NSTIFFPboardType] owner: nil];
- [pb setData: [[sender representedObject] TIFFRepresentation] forType: NSTIFFPboardType];
-}
-
-- (IBAction) cmLinkCopy: (id)sender
-{
- NSPasteboard *pb = [NSPasteboard generalPasteboard];
- [pb declareTypes: [NSArray arrayWithObject: NSStringPboardType] owner: nil];
- [pb setString: [sender representedObject] forType: NSStringPboardType];
-}
-
-
-// MARK: -
-// MARK: Accepting dragged URLs
-
-- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
-{
- if ((NSDragOperationCopy | NSDragOperationGeneric) & [sender draggingSourceOperationMask]) {
- return NSDragOperationCopy;
- }
-
- return NSDragOperationNone;
-}
-
-- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
-{
- return YES;
-}
-
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
-{
- nsurl *url;
- nserror error;
-
- NSPasteboard *pb = [sender draggingPasteboard];
-
- NSString *type = [pb availableTypeFromArray:[NSArray arrayWithObjects: @"public.url", NSURLPboardType, nil]];
-
- NSString *urlstr = nil;
-
- if ([type isEqualToString: NSURLPboardType]) {
- urlstr = [[NSURL URLFromPasteboard: pb] absoluteString];
- } else {
- urlstr = [pb stringForType: type];
- }
-
- error = nsurl_create([urlstr UTF8String], &url);
- if (error != NSERROR_OK) {
- cocoa_warning(messages_get_errorcode(error), 0);
- } else {
- browser_window_navigate(browser,
- url,
- NULL,
- BW_NAVIGATE_DOWNLOAD,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
-
- return YES;
-}
-
-// MARK: -
-// MARK: NSTextInput protocol implementation
-
-- (void) setMarkedText: (id) aString selectedRange: (NSRange) selRange
-{
- [markedText release];
- markedText = [aString isEqualToString: @""] ? nil : [aString copy];
-}
-
-- (void) unmarkText
-{
- [self setMarkedText: nil];
-}
-
-- (BOOL) hasMarkedText
-{
- return markedText != nil;
-}
-
-- (NSInteger) conversationIdentifier
-{
- return (NSInteger)self;
-}
-
-- (NSAttributedString *) attributedSubstringFromRange: (NSRange) theRange
-{
- return [[[NSAttributedString alloc] initWithString: @""] autorelease];
-}
-
-- (NSRange) markedRange
-{
- return NSMakeRange( NSNotFound, 0 );
-}
-
-- (NSRange) selectedRange
-{
- return NSMakeRange( NSNotFound, 0 );
-}
-
-- (NSRect) firstRectForCharacterRange: (NSRange) theRange
-{
- return NSZeroRect;
-}
-
-- (NSUInteger) characterIndexForPoint: (NSPoint) thePoint
-{
- return 0;
-}
-
-- (NSArray *) validAttributesForMarkedText
-{
- return [NSArray array];
-}
-
-- (void) doCommandBySelector: (SEL) sel;
-{
- [super doCommandBySelector: sel];
-}
-
-@end
diff --git a/frontends/cocoa/BrowserViewController.h b/frontends/cocoa/BrowserViewController.h
deleted file mode 100644
index 6b4c3e79c..000000000
--- a/frontends/cocoa/BrowserViewController.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#import <Cocoa/Cocoa.h>
-
-struct browser_window;
-@class BrowserView;
-@class BrowserWindowController;
-
-@interface BrowserViewController : NSViewController {
- struct browser_window *browser;
- NSString *url;
- BrowserView *browserView;
- BrowserWindowController *windowController;
- NSString *title;
- NSString *status;
- BOOL isProcessing;
- NSImage *favicon;
- BOOL canGoBack;
- BOOL canGoForward;
-}
-
-@property (readwrite, assign, nonatomic) struct browser_window *browser;
-@property (readwrite, copy, nonatomic) NSString *url;
-@property (readwrite, assign, nonatomic) IBOutlet BrowserView *browserView;
-@property (readwrite, retain, nonatomic) BrowserWindowController *windowController;
-@property (readwrite, copy, nonatomic) NSString *title;
-@property (readwrite, copy, nonatomic) NSString *status;
-@property (readwrite, assign, nonatomic) BOOL isProcessing;
-@property (readwrite, copy, nonatomic) NSImage *favicon;
-@property (readwrite, assign, nonatomic) BOOL canGoBack;
-@property (readwrite, assign, nonatomic) BOOL canGoForward;
-
-- (id) initWithBrowser: (struct browser_window *) bw;
-
-- (void) contentUpdated;
-- (void) updateBackForward;
-
-- (IBAction) navigate: (id) sender;
-
-- (IBAction) backForwardSelected: (id) sender;
-
-- (IBAction) goHome: (id) sender;
-
-- (IBAction) goBack: (id) sender;
-- (IBAction) goForward: (id) sender;
-- (IBAction) reloadPage: (id) sender;
-- (IBAction) stopLoading: (id) sender;
-
-- (IBAction) zoomIn: (id) sender;
-- (IBAction) zoomOut: (id) sender;
-- (IBAction) zoomOriginal: (id) sender;
-
-- (IBAction) viewSource: (id) sender;
-
-- (void) buildBackMenu: (NSMenu *)menu;
-- (void) buildForwardMenu: (NSMenu *)menu;
-
-@end
diff --git a/frontends/cocoa/BrowserViewController.m b/frontends/cocoa/BrowserViewController.m
deleted file mode 100644
index 4cac57ef3..000000000
--- a/frontends/cocoa/BrowserViewController.m
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "utils/nsoption.h"
-#import "utils/corestrings.h"
-#import "utils/filename.h"
-#import "utils/file.h"
-#import "utils/messages.h"
-#import "utils/nsurl.h"
-#import "netsurf/content.h"
-#import "netsurf/browser_window.h"
-#import "desktop/browser_history.h"
-
-#import "cocoa/gui.h"
-#import "cocoa/BrowserViewController.h"
-#import "cocoa/BrowserView.h"
-#import "cocoa/BrowserWindowController.h"
-#import "cocoa/fetch.h"
-
-
-
-@implementation BrowserViewController
-
-@synthesize browser;
-@synthesize url;
-@synthesize browserView;
-@synthesize windowController;
-@synthesize title;
-@synthesize status;
-@synthesize isProcessing;
-@synthesize favicon;
-@synthesize canGoBack;
-@synthesize canGoForward;
-
-- (void) dealloc
-{
- [self setUrl: nil];
- [self setBrowserView: nil];
- [self setWindowController: nil];
- [self setTitle: nil];
- [self setStatus: nil];
- [self setFavicon: nil];
-
- [super dealloc];
-}
-
-- initWithBrowser: (struct browser_window *) bw
-{
- if ((self = [super initWithNibName: @"Browser" bundle: nil]) == nil) {
- return nil;
- }
-
- browser = bw;
-
- return self;
-}
-
-
-- (IBAction) navigate: (id) sender
-{
- nsurl *urlns;
- nserror error;
-
- error = nsurl_create([url UTF8String], &urlns);
- if (error != NSERROR_OK) {
- cocoa_warning(messages_get_errorcode(error), 0);
- } else {
- browser_window_navigate(browser,
- urlns,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- nsurl_unref(urlns);
- }
-}
-
-
-- (void) awakeFromNib
-{
- [browserView setBrowser: browser];
-}
-
-
-- (IBAction) zoomIn: (id) sender
-{
- browser_window_set_scale(browser,
- browser_window_get_scale(browser) * 1.1,
- true);
-}
-
-
-- (IBAction) zoomOut: (id) sender
-{
- browser_window_set_scale(browser,
- browser_window_get_scale(browser) * 0.9,
- true);
-}
-
-
-- (IBAction) zoomOriginal: (id) sender
-{
- browser_window_set_scale(browser,
- (float)nsoption_int(scale) / 100.0,
- true);
-}
-
-
-- (IBAction) backForwardSelected: (id) sender
-{
- if ([sender selectedSegment] == 0) {
- [self goBack: sender];
- } else {
- [self goForward: sender];
- }
-}
-
-
-- (IBAction) goBack: (id) sender
-{
- if (browser && browser_window_history_back_available( browser )) {
- browser_window_history_back(browser, false);
- [self updateBackForward];
- }
-}
-
-
-- (IBAction) goForward: (id) sender
-{
- if (browser && browser_window_history_forward_available( browser )) {
- browser_window_history_forward(browser, false);
- [self updateBackForward];
- }
-}
-
-
-- (IBAction) goHome: (id) sender
-{
- nsurl *urlns;
- nserror error;
-
- error = nsurl_create(nsoption_charp(homepage_url), &urlns);
- if (error == NSERROR_OK) {
- error = browser_window_navigate(browser,
- urlns,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- nsurl_unref(urlns);
- }
- if (error != NSERROR_OK) {
- cocoa_warning(messages_get_errorcode(error), 0);
- }
-}
-
-
-- (IBAction) reloadPage: (id) sender
-{
- browser_window_reload( browser, true );
-}
-
-
-- (IBAction) stopLoading: (id) sender
-{
- browser_window_stop( browser );
-}
-
-
-- (IBAction) viewSource: (id) sender
-{
- struct hlcache_handle *content;
- size_t size;
- const char *source;
- char *path = NULL;
-
- if (browser == NULL) {
- return;
- }
- content = browser_window_get_content(browser);
- if (content == NULL) {
- return;
- }
- source = content_get_source_data(content, &size);
- if (source == NULL) {
- return;
- }
-
- /* try to load local files directly. */
- netsurf_nsurl_to_path(hlcache_handle_get_url(content), &path);
-
- if (path == NULL) {
- /* We cannot release the requested filename until after it
- * has finished being used. As we can't easily find out when
- * this is, we simply don't bother releasing it and simply
- * allow it to be re-used next time NetSurf is started. The
- * memory overhead from doing this is under 1 byte per
- * filename. */
- const char *filename = filename_request();
- const char *extension = "txt";
- fprintf(stderr, "filename '%p'\n", filename);
- if (filename == NULL)
- return;
- lwc_string *str = content_get_mime_type(content);
- if (str) {
- NSString *mime = [NSString stringWithUTF8String:lwc_string_data(str)];
- NSString *uti = (NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, (CFStringRef)mime, NULL);
- NSString *ext = (NSString *)UTTypeCopyPreferredTagWithClass((CFStringRef)uti, kUTTagClassFilenameExtension);
- extension = [ext UTF8String];
- lwc_string_unref(str);
- }
-
- NSURL *dataUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%s.%s", filename, extension]
- relativeToURL:[NSURL fileURLWithPath:@TEMP_FILENAME_PREFIX]];
-
-
- NSData *data = [NSData dataWithBytes:source length:size];
- [data writeToURL:dataUrl atomically:NO];
- path = [[dataUrl path] UTF8String];
- }
-
- if (path) {
- NSString * p = [NSString stringWithUTF8String: path];
- NSWorkspace * ws = [NSWorkspace sharedWorkspace];
- [ws openFile:p withApplication:@"Xcode"];
- }
-}
-
-
-static inline bool
-compare_float( float a, float b )
-{
- const float epsilon = 0.00001;
-
- if (a == b) {
- return true;
- }
-
- return fabs( (a - b) / b ) <= epsilon;
-}
-
-- (BOOL) validateUserInterfaceItem: (id) item
-{
- SEL action = [item action];
-
- if (action == @selector(copy:)) {
- return browser_window_get_editor_flags( browser ) & BW_EDITOR_CAN_COPY;
- }
-
- if (action == @selector(cut:)) {
- return browser_window_get_editor_flags( browser ) & BW_EDITOR_CAN_CUT;
- }
-
- if (action == @selector(paste:)) {
- return browser_window_get_editor_flags( browser ) & BW_EDITOR_CAN_PASTE;
- }
-
- if (action == @selector( stopLoading: )) {
- return browser_window_stop_available( browser );
- }
-
- if (action == @selector( zoomOriginal: )) {
- return !compare_float( browser_window_get_scale(browser), (float)nsoption_int(scale) / 100.0 );
- }
-
- if (action == @selector( goBack: )) {
- return canGoBack;
- }
-
- if (action == @selector( goForward: )) {
- return canGoForward;
- }
-
- return YES;
-}
-
-
-- (void) updateBackForward
-{
- [browserView updateHistory];
- [self setCanGoBack: browser != NULL && browser_window_history_back_available( browser )];
- [self setCanGoForward: browser != NULL && browser_window_history_forward_available( browser )];
-}
-
-- (void) contentUpdated
-{
- [browserView updateHistory];
-}
-
-struct history_add_menu_item_data {
- NSInteger index;
- NSMenu *menu;
- id target;
-};
-
-static bool
-history_add_menu_item_cb(const struct browser_window *bw,
- int x0, int y0, int x1, int y1,
- const struct history_entry *page,
- void *user_data )
-{
- struct history_add_menu_item_data *data = user_data;
-
- NSMenuItem *item = nil;
- if (data->index < [data->menu numberOfItems]) {
- item = [data->menu itemAtIndex: data->index];
- } else {
- item = [[NSMenuItem alloc] initWithTitle: @""
- action: @selector( historyItemSelected: )
- keyEquivalent: @""];
- [data->menu addItem: item];
- [item release];
- }
- ++data->index;
-
- [item setTarget: data->target];
- [item setTitle: [NSString stringWithUTF8String: browser_window_history_entry_get_title( page )]];
- [item setRepresentedObject: [NSValue valueWithPointer: page]];
-
- return true;
-}
-
-- (IBAction) historyItemSelected: (id) sender
-{
- struct history_entry *entry = [[sender representedObject] pointerValue];
- browser_window_history_go( browser, entry, false );
- [self updateBackForward];
-}
-
-- (void) buildBackMenu: (NSMenu *)menu
-{
- struct history_add_menu_item_data data = {
- .index = 0,
- .menu = menu,
- .target = self
- };
- browser_window_history_enumerate_back(browser,
- history_add_menu_item_cb,
- &data);
- while (data.index < [menu numberOfItems]) {
- [menu removeItemAtIndex: data.index];
- }
-}
-
-- (void) buildForwardMenu: (NSMenu *)menu
-{
- struct history_add_menu_item_data data = {
- .index = 0,
- .menu = menu,
- .target = self
- };
- browser_window_history_enumerate_forward(browser,
- history_add_menu_item_cb,
- &data);
- while (data.index < [menu numberOfItems]) {
- [menu removeItemAtIndex: data.index];
- }
-}
-
-@end
diff --git a/frontends/cocoa/BrowserWindow.h b/frontends/cocoa/BrowserWindow.h
deleted file mode 100644
index e0b83017f..000000000
--- a/frontends/cocoa/BrowserWindow.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface BrowserWindow : NSWindow {
-
-}
-
-@end
diff --git a/frontends/cocoa/BrowserWindow.m b/frontends/cocoa/BrowserWindow.m
deleted file mode 100644
index f01b17a25..000000000
--- a/frontends/cocoa/BrowserWindow.m
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "cocoa/BrowserWindow.h"
-#import "cocoa/BrowserWindowController.h"
-
-@implementation BrowserWindow
-
-- (void) performClose: (id) sender
-{
- [[self windowController] closeCurrentTab: sender];
-}
-
-@end
diff --git a/frontends/cocoa/BrowserWindowController.h b/frontends/cocoa/BrowserWindowController.h
deleted file mode 100644
index 22e199509..000000000
--- a/frontends/cocoa/BrowserWindowController.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@class PSMTabBarControl;
-@class BrowserViewController;
-@class URLFieldCell;
-
-@interface BrowserWindowController : NSWindowController {
- PSMTabBarControl *tabBar;
- NSTabView *tabView;
- URLFieldCell *urlField;
- NSObjectController *activeBrowserController;
- NSSegmentedControl *navigationControl;
- NSButton *historyButton;
- BrowserViewController *activeBrowser;
- NSMenu *historyBackMenu;
- NSMenu *historyForwardMenu;
-}
-
-@property (readwrite, assign, nonatomic) IBOutlet PSMTabBarControl *tabBar;
-@property (readwrite, assign, nonatomic) IBOutlet NSTabView *tabView;
-@property (readwrite, assign, nonatomic) IBOutlet URLFieldCell *urlField;
-@property (readwrite, assign, nonatomic) IBOutlet NSObjectController *activeBrowserController;
-@property (readwrite, assign, nonatomic) IBOutlet NSSegmentedControl *navigationControl;
-@property (readwrite, assign, nonatomic) IBOutlet NSButton *historyButton;
-@property (readwrite, assign, nonatomic) IBOutlet NSMenu *historyBackMenu;
-@property (readwrite, assign, nonatomic) IBOutlet NSMenu *historyForwardMenu;
-
-@property (readwrite, assign, nonatomic) BrowserViewController *activeBrowser;
-
-@property (readwrite, assign, nonatomic) BOOL canGoBack;
-@property (readwrite, assign, nonatomic) BOOL canGoForward;
-
-- (IBAction) newTab: (id) sender;
-- (IBAction) closeCurrentTab: (id) sender;
-
-- (void) addTab: (BrowserViewController *)browser;
-- (void) removeTab: (BrowserViewController *)browser;
-
-@end
diff --git a/frontends/cocoa/BrowserWindowController.m b/frontends/cocoa/BrowserWindowController.m
deleted file mode 100644
index aa7375a0e..000000000
--- a/frontends/cocoa/BrowserWindowController.m
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "netsurf/browser_window.h"
-#import "utils/nsoption.h"
-#import "utils/messages.h"
-#import "utils/utils.h"
-#import "utils/nsurl.h"
-
-#import "cocoa/BrowserWindowController.h"
-
-#import "cocoa/BrowserViewController.h"
-#import "cocoa/PSMTabBarControl/PSMTabBarControl.h"
-#import "cocoa/PSMTabBarControl/PSMRolloverButton.h"
-#import "cocoa/URLFieldCell.h"
-#import "cocoa/gui.h"
-#import "cocoa/NetsurfApp.h"
-
-
-@interface BrowserWindowController ()
-
-- (void) canCloseAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo;
-
-@end
-
-
-@implementation BrowserWindowController
-
-@synthesize tabBar;
-@synthesize tabView;
-@synthesize urlField;
-@synthesize navigationControl;
-@synthesize historyButton;
-@synthesize historyBackMenu;
-@synthesize historyForwardMenu;
-
-@synthesize activeBrowser;
-@synthesize activeBrowserController;
-
-- (id) init;
-{
- if (nil == (self = [super initWithWindowNibName: @"BrowserWindow"])) return nil;
-
- return self;
-}
-
-- (void) dealloc;
-{
- [self setTabBar: nil];
- [self setTabView: nil];
- [self setUrlField: nil];
- [self setNavigationControl: nil];
-
- [super dealloc];
-}
-
-- (void) awakeFromNib;
-{
- [tabBar setShowAddTabButton: YES];
- [tabBar setTearOffStyle: PSMTabBarTearOffMiniwindow];
- [tabBar setCanCloseOnlyTab: YES];
- [tabBar setHideForSingleTab: YES];
-
- NSButton *b = [tabBar addTabButton];
- [b setTarget: self];
- [b setAction: @selector(newTab:)];
-
- [urlField setRefreshAction: @selector(reloadPage:)];
- [urlField bind: @"favicon" toObject: activeBrowserController withKeyPath: @"selection.favicon" options: nil];
-
- [self bind: @"canGoBack"
- toObject: activeBrowserController withKeyPath: @"selection.canGoBack"
- options: nil];
- [self bind: @"canGoForward"
- toObject: activeBrowserController withKeyPath: @"selection.canGoForward"
- options: nil];
-
- [navigationControl setMenu: historyBackMenu forSegment: 0];
- [navigationControl setMenu: historyForwardMenu forSegment: 1];
-}
-
-- (void) addTab: (BrowserViewController *)browser;
-{
- NSTabViewItem *item = [[[NSTabViewItem alloc] initWithIdentifier: browser] autorelease];
-
- [item setView: [browser view]];
- [item bind: @"label" toObject: browser withKeyPath: @"title" options: nil];
-
- [tabView addTabViewItem: item];
- [browser setWindowController: self];
-
- [tabView selectTabViewItem: item];
-}
-
-- (void) removeTab: (BrowserViewController *)browser;
-{
- NSUInteger itemIndex = [tabView indexOfTabViewItemWithIdentifier: browser];
- if (itemIndex != NSNotFound) {
- NSTabViewItem *item = [tabView tabViewItemAtIndex: itemIndex];
- [tabView removeTabViewItem: item];
- [browser setWindowController: nil];
- }
-}
-
-- (BOOL) windowShouldClose: (NSWindow *) window;
-{
- if ([tabView numberOfTabViewItems] <= 1) return YES;
- if ([[NSUserDefaults standardUserDefaults] boolForKey: kAlwaysCloseMultipleTabs]) return YES;
-
- NSAlert *ask = [NSAlert alertWithMessageText: NSLocalizedString( @"Do you really want to close this window?", nil )
- defaultButton: NSLocalizedString( @"Yes", @"'Yes' button" )
- alternateButton: NSLocalizedString( @"No" , @"'No' button" )
- otherButton:nil
- informativeTextWithFormat: NSLocalizedString( @"There are %d tabs open, do you want to close them all?", nil ),
- [tabView numberOfTabViewItems]];
- [ask setShowsSuppressionButton:YES];
-
- [ask beginSheetModalForWindow: window modalDelegate:self didEndSelector:@selector(canCloseAlertDidEnd:returnCode:contextInfo:)
- contextInfo: NULL];
-
- return NO;
-}
-
-- (void) canCloseAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo;
-{
- if (returnCode == NSOKButton) {
- [[NSUserDefaults standardUserDefaults] setBool: [[alert suppressionButton] state] == NSOnState
- forKey: kAlwaysCloseMultipleTabs];
- [[self window] close];
- }
-}
-
-- (void) windowWillClose: (NSNotification *)notification;
-{
- for (NSTabViewItem *tab in [tabView tabViewItems]) {
- [tabView removeTabViewItem: tab];
- }
-}
-
-- (IBAction) newTab: (id) sender;
-{
- nsurl *url;
- nserror error;
-
- if (nsoption_charp(homepage_url) != NULL) {
- error = nsurl_create(nsoption_charp(homepage_url), &url);
- } else {
- error = nsurl_create(NETSURF_HOMEPAGE, &url);
- }
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY |
- BW_CREATE_TAB,
- url,
- NULL,
- [activeBrowser browser],
- NULL);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- cocoa_warning(messages_get_errorcode(error), 0);
- }
-}
-
-- (IBAction) closeCurrentTab: (id) sender;
-{
- [self removeTab: activeBrowser];
-}
-
-- (void) setActiveBrowser: (BrowserViewController *)newBrowser;
-{
- activeBrowser = newBrowser;
- [self setNextResponder: activeBrowser];
-}
-
-- (void) setCanGoBack: (BOOL)can;
-{
- [navigationControl setEnabled: can forSegment: 0];
-}
-
-- (BOOL) canGoBack;
-{
- return [navigationControl isEnabledForSegment: 0];
-}
-
-- (void) setCanGoForward: (BOOL)can;
-{
- [navigationControl setEnabled: can forSegment: 1];
-}
-
-- (BOOL) canGoForward;
-{
- return [navigationControl isEnabledForSegment: 1];
-}
-
-- (void)windowDidBecomeMain: (NSNotification *)note;
-{
- [(NetSurfApp *)NSApp setFrontTab: [[tabView selectedTabViewItem] identifier]];
-}
-
-- (void)menuNeedsUpdate:(NSMenu *)menu
-{
- if (menu == historyBackMenu) {
- [activeBrowser buildBackMenu: menu];
- } else if (menu == historyForwardMenu) {
- [activeBrowser buildForwardMenu: menu];
- }
-}
-
-#pragma mark -
-#pragma mark Tab bar delegate
-
-- (void) tabView: (NSTabView *)tabView didSelectTabViewItem: (NSTabViewItem *)tabViewItem;
-{
- [self setActiveBrowser: [tabViewItem identifier]];
- if ([[self window] isMainWindow]) {
- [(NetSurfApp *)NSApp setFrontTab: [tabViewItem identifier]];
- }
-}
-
-- (BOOL)tabView:(NSTabView*)aTabView shouldDragTabViewItem:(NSTabViewItem *)tabViewItem fromTabBar:(PSMTabBarControl *)tabBarControl
-{
- return [aTabView numberOfTabViewItems] > 1;
-}
-
-- (BOOL)tabView:(NSTabView*)aTabView shouldDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl
-{
- [[tabViewItem identifier] setWindowController: self];
- return YES;
-}
-
-- (PSMTabBarControl *)tabView:(NSTabView *)aTabView newTabBarForDraggedTabViewItem:(NSTabViewItem *)tabViewItem atPoint:(NSPoint)point;
-{
- BrowserWindowController *newWindow = [[[BrowserWindowController alloc] init] autorelease];
- [[tabViewItem identifier] setWindowController: newWindow];
- [[newWindow window] setFrameOrigin: point];
- return newWindow->tabBar;
-}
-
-- (void) tabView: (NSTabView *)aTabView didCloseTabViewItem: (NSTabViewItem *)tabViewItem;
-{
- [tabViewItem unbind: @"label"];
-
- if (activeBrowser == [tabViewItem identifier]) {
- [self setActiveBrowser: nil];
- [(NetSurfApp *)NSApp setFrontTab: nil];
- }
-
- browser_window_destroy( [[tabViewItem identifier] browser] );
-}
-
-@end
diff --git a/frontends/cocoa/DownloadWindowController.h b/frontends/cocoa/DownloadWindowController.h
deleted file mode 100644
index 47a05be39..000000000
--- a/frontends/cocoa/DownloadWindowController.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-struct gui_download_table *cocoa_download_table;
-
-@interface DownloadWindowController : NSWindowController {
- struct download_context *context;
- unsigned long totalSize;
- unsigned long receivedSize;
-
- NSURL *url;
- NSString *mimeType;
- NSURL *saveURL;
- NSFileHandle *outputFile;
- NSMutableData *savedData;
- NSDate *startDate;
-
- BOOL canClose;
- BOOL shouldClose;
-}
-
-@property (readwrite, copy, nonatomic) NSURL *URL;
-@property (readwrite, copy, nonatomic) NSString *MIMEType;
-@property (readwrite, assign, nonatomic) unsigned long totalSize;
-@property (readwrite, copy, nonatomic) NSURL *saveURL;
-@property (readwrite, assign, nonatomic) unsigned long receivedSize;
-
-@property (readonly, nonatomic) NSString *fileName;
-@property (readonly, nonatomic) NSImage *icon;
-@property (readonly, nonatomic) NSString *statusText;
-
-- (id)initWithContext: (struct download_context *)ctx;
-
-- (void) abort;
-
-@end
diff --git a/frontends/cocoa/DownloadWindowController.m b/frontends/cocoa/DownloadWindowController.m
deleted file mode 100644
index b8cf09b18..000000000
--- a/frontends/cocoa/DownloadWindowController.m
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "utils/log.h"
-#import "utils/nsurl.h"
-#import "desktop/download.h"
-#import "netsurf/download.h"
-
-#import "cocoa/DownloadWindowController.h"
-#import "cocoa/gui.h"
-
-@interface DownloadWindowController ()
-
-@property (readwrite, retain, nonatomic) NSFileHandle *outputFile;
-@property (readwrite, retain, nonatomic) NSMutableData *savedData;
-@property (readwrite, copy, nonatomic) NSDate *startDate;
-
-- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
-- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
-- (void)askCancelDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
-
-- (BOOL) receivedData: (NSData *)data;
-
-- (void) showError: (NSString *)error;
-- (void) downloadDone;
-- (void) removeIfPossible;
-
-@end
-
-static void cocoa_unregister_download( DownloadWindowController *download );
-static void cocoa_register_download( DownloadWindowController *download );
-
-
-@implementation DownloadWindowController
-
-- (id) initWithContext: (struct download_context *)ctx
-{
- if ((self = [super initWithWindowNibName: @"DownloadWindow"]) == nil) {
- return nil;
- }
-
- context = ctx;
- totalSize = download_context_get_total_length( context );
- [self setURL: [NSURL URLWithString: [NSString stringWithUTF8String: nsurl_access(download_context_get_url( context ))]]];
- [self setMIMEType: [NSString stringWithUTF8String: download_context_get_mime_type( context )]];
- [self setStartDate: [NSDate date]];
-
- return self;
-}
-
-- (void) dealloc
-{
- download_context_destroy( context );
-
- [self setURL: nil];
- [self setMIMEType: nil];
- [self setSaveURL: nil];
- [self setOutputFile: nil];
- [self setSavedData: nil];
- [self setStartDate: nil];
-
- [super dealloc];
-}
-
-- (void) abort
-{
- download_context_abort( context );
- [self removeIfPossible];
-}
-
-- (void) askForSave
-{
- canClose = NO;
- [[NSSavePanel savePanel]
- beginSheetForDirectory: nil
- file: [NSString stringWithUTF8String: download_context_get_filename( context )]
- modalForWindow: [self window]
- modalDelegate: self
- didEndSelector: @selector(savePanelDidEnd:returnCode:contextInfo:)
- contextInfo: NULL];
-}
-
-- (void) savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
-{
- canClose = YES;
-
- if (returnCode == NSCancelButton) {
- [self abort];
- return;
- }
-
- NSURL *targetURL = [sheet URL];
- NSString *path = [targetURL path];
-
- [[NSFileManager defaultManager] createFileAtPath: path contents: nil attributes: nil];
-
- FSRef ref;
- if (CFURLGetFSRef( (CFURLRef)targetURL, &ref )) {
- NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
- url, (NSString *)kLSQuarantineDataURLKey,
- (NSString *)kLSQuarantineTypeWebDownload, (NSString *)kLSQuarantineTypeKey,
- nil];
- LSSetItemAttribute( &ref, kLSRolesAll, kLSItemQuarantineProperties, (CFDictionaryRef)attributes );
- LOG("Set quarantine attributes on file %s", [path UTF8String]);
- }
-
- [self setOutputFile: [NSFileHandle fileHandleForWritingAtPath: path]];
- [self setSaveURL: targetURL];
-
- NSWindow *win = [self window];
- [win setRepresentedURL: targetURL];
- [win setTitle: [self fileName]];
-
- if (nil == outputFile) {
- [self performSelector: @selector(showError:) withObject: @"Cannot create file" afterDelay: 0];
- return;
- }
-
- if (nil != savedData) {
- [outputFile writeData: savedData];
- [self setSavedData: nil];
- }
-
- [self removeIfPossible];
-}
-
-- (BOOL) receivedData: (NSData *)data
-{
- if (outputFile) {
- [outputFile writeData: data];
- } else {
- if (nil == savedData) {
- [self setSavedData: [NSMutableData data]];
- }
- [savedData appendData: data];
- }
-
- [self setReceivedSize: receivedSize + [data length]];
-
- return YES;
-}
-
-- (void) showError: (NSString *)error
-{
- canClose = NO;
- NSAlert *alert = [NSAlert alertWithMessageText: NSLocalizedString( @"Error", @"show error" )
- defaultButton: NSLocalizedString( @"OK", @"'OK' button" )
- alternateButton: nil otherButton: nil
- informativeTextWithFormat: @"%@", error];
-
- [alert beginSheetModalForWindow: [self window] modalDelegate: self
- didEndSelector: @selector(alertDidEnd:returnCode:contextInfo:)
- contextInfo: NULL];
-}
-
-- (void) alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
-{
- [self abort];
-}
-
-- (void) removeIfPossible
-{
- if (canClose && shouldClose) {
- cocoa_unregister_download( self );
- }
-}
-- (void) downloadDone
-{
- shouldClose = YES;
- [self removeIfPossible];
-}
-
-- (BOOL) windowShouldClose: (id)sender
-{
- if ([[NSUserDefaults standardUserDefaults] boolForKey: kAlwaysCancelDownload]) {
- return YES;
- }
-
- NSAlert *ask = [NSAlert alertWithMessageText: NSLocalizedString( @"Cancel download?", @"Download" )
- defaultButton: NSLocalizedString( @"Yes", @"" )
- alternateButton: NSLocalizedString( @"No", @"" )
- otherButton: nil
- informativeTextWithFormat: NSLocalizedString( @"Should the download of '%@' really be cancelled?", @"Download" ),
- [self fileName]];
- [ask setShowsSuppressionButton: YES];
- [ask beginSheetModalForWindow: [self window] modalDelegate: self
- didEndSelector: @selector(askCancelDidEnd:returnCode:contextInfo:) contextInfo: NULL];
- return NO;
-}
-
-- (void) windowWillClose: (NSNotification *)notification
-{
- [self abort];
-}
-
-- (void) askCancelDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
-{
- if (returnCode == NSOKButton) {
- [[NSUserDefaults standardUserDefaults]
- setBool: [[alert suppressionButton] state] == NSOnState
- forKey: kAlwaysCancelDownload];
- [self close];
- }
-}
-
-#pragma mark -
-#pragma mark Properties
-
-@synthesize URL = url;
-@synthesize MIMEType = mimeType;
-@synthesize totalSize;
-@synthesize saveURL;
-@synthesize outputFile;
-@synthesize savedData;
-@synthesize receivedSize;
-@synthesize startDate;
-
-+ (NSSet *) keyPathsForValuesAffectingStatusText
-{
- return [NSSet setWithObjects: @"totalSize", @"receivedSize", nil];
-}
-
-#ifndef NSAppKitVersionNumber10_5
-#define NSAppKitVersionNumber10_5 949
-#endif
-
-static NSString *cocoa_file_size_string( float size )
-{
- static unsigned factor = 0;
- if (factor == 0) {
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) {
- factor = 1000;
- } else {
- factor = 1024;
- }
- }
-
- if (size == 0) return @"nothing";
- if (size <= 1.0) return @"1 byte";
-
- if (size < factor - 1) return [NSString stringWithFormat:@"%1.0f bytes",size];
-
- size /= factor;
- if (size < factor - 1) return [NSString stringWithFormat:@"%1.1f KB", size];
-
- size /= factor;
- if (size < factor - 1) return [NSString stringWithFormat:@"%1.1f MB", size];
-
- size /= factor;
- if (size < factor - 1) return [NSString stringWithFormat:@"%1.1f GB", size];
-
- size /= factor;
- return [NSString stringWithFormat:@"%1.1f TB", size];
-}
-
-static NSString *cocoa_time_string( unsigned seconds )
-{
- if (seconds <= 10) {
- return NSLocalizedString(@"less than 10 seconds",
- @"time remaining" );
- }
-
- if (seconds < 60) {
- return [NSString stringWithFormat: NSLocalizedString( @"%u seconds",
- @"time remaining" ), seconds];
- }
-
- unsigned minutes = seconds / 60;
- seconds = seconds % 60;
-
- if (minutes < 60) {
- return [NSString stringWithFormat: NSLocalizedString( @"%u:%02u minutes",
- @"time remaining: minutes, seconds" ) , minutes, seconds];
- }
-
- unsigned hours = minutes / 60;
- minutes = minutes % 60;
-
- return [NSString stringWithFormat: NSLocalizedString( @"%2:%02u hours", @"time remaining: hours, minutes" ), hours, minutes];
-}
-
-- (NSString *) statusText
-{
- NSString *speedString = @"";
-
- float speed = 0.0;
- NSTimeInterval elapsedTime = [[NSDate date] timeIntervalSinceDate: startDate];
- if (elapsedTime >= 0.1) {
- speed = (float)receivedSize / elapsedTime;
- speedString = [NSString stringWithFormat: @" (%@/s)", cocoa_file_size_string( speed )];
- }
-
- NSString *timeRemainingString = @"";
- NSString *totalSizeString = @"";
- if (totalSize != 0) {
- if (speed > 0.0) {
- float timeRemaining = (float)(totalSize - receivedSize) / speed;
- timeRemainingString = [NSString stringWithFormat: @": %@", cocoa_time_string( timeRemaining )];
- }
- totalSizeString = [NSString stringWithFormat: NSLocalizedString( @" of %@", @"... of (total size)" ), cocoa_file_size_string( totalSize )];
- }
-
- return [NSString stringWithFormat: @"%@%@%@%@", cocoa_file_size_string( receivedSize ),
- totalSizeString, speedString, timeRemainingString];
-}
-
-+ (NSSet *) keyPathsForValuesAffectingFileName
-{
- return [NSSet setWithObject: @"saveURL"];
-}
-
-- (NSString *) fileName
-{
- return [[saveURL path] lastPathComponent];
-}
-
-+ (NSSet *) keyPathsForValuesAffectingIcon
-{
- return [NSSet setWithObjects: @"mimeType", @"URL", nil];
-}
-
-- (NSImage *) icon;
-{
- NSString *type = [(NSString *)UTTypeCreatePreferredIdentifierForTag( kUTTagClassMIMEType, (CFStringRef)mimeType, NULL ) autorelease];
- if ([type hasPrefix: @"dyn."] || [type isEqualToString: (NSString *)kUTTypeData]) {
- NSString *pathExt = [[url path] pathExtension];
- type = [(NSString *)UTTypeCreatePreferredIdentifierForTag( kUTTagClassFilenameExtension, (CFStringRef)pathExt, NULL ) autorelease];
- }
- return [[NSWorkspace sharedWorkspace] iconForFileType: type];
-}
-
-
-#pragma mark -
-#pragma mark NetSurf interface functions
-
-static struct gui_download_window *
-gui_download_window_create(download_context *ctx,
- struct gui_window *parent)
-{
- DownloadWindowController * const window = [[DownloadWindowController alloc] initWithContext: ctx];
- cocoa_register_download( window );
- [window askForSave];
- [window release];
-
- return (struct gui_download_window *)window;
-}
-
-static nserror
-gui_download_window_data(struct gui_download_window *dw,
- const char *data,
- unsigned int size)
-{
- DownloadWindowController * const window = (DownloadWindowController *)dw;
- return [window receivedData: [NSData dataWithBytes: data length: size]] ? NSERROR_OK : NSERROR_SAVE_FAILED;
-}
-
-static void
-gui_download_window_error(struct gui_download_window *dw,
- const char *error_msg)
-{
- DownloadWindowController * const window = (DownloadWindowController *)dw;
- [window showError: [NSString stringWithUTF8String: error_msg]];
-}
-
-static void
-gui_download_window_done(struct gui_download_window *dw)
-{
- DownloadWindowController * const window = (DownloadWindowController *)dw;
- [window downloadDone];
-}
-
-@end
-
-#pragma mark -
-static NSMutableSet *cocoa_all_downloads = nil;
-
-static void
-cocoa_register_download( DownloadWindowController *download )
-{
- if (cocoa_all_downloads == nil) {
- cocoa_all_downloads = [[NSMutableSet alloc] init];
- }
- [cocoa_all_downloads addObject: download];
-}
-
-static void
-cocoa_unregister_download( DownloadWindowController *download )
-{
- [cocoa_all_downloads removeObject: download];
-}
-
-
-static struct gui_download_table download_table = {
- .create = gui_download_window_create,
- .data = gui_download_window_data,
- .error = gui_download_window_error,
- .done = gui_download_window_done,
-};
-
-struct gui_download_table *cocoa_download_table = &download_table;
diff --git a/frontends/cocoa/FormSelectMenu.h b/frontends/cocoa/FormSelectMenu.h
deleted file mode 100644
index cec519296..000000000
--- a/frontends/cocoa/FormSelectMenu.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@interface FormSelectMenu : NSObject {
- NSMenu *menu;
- NSPopUpButtonCell *cell;
-
- struct browser_window *browser;
- struct form_control *control;
-}
-
-- (id)initWithControl: (struct form_control *) control forWindow: (struct browser_window *) window;
-- (void) runInView: (NSView *) view;
-
-@end
diff --git a/frontends/cocoa/FormSelectMenu.m b/frontends/cocoa/FormSelectMenu.m
deleted file mode 100644
index b7d168e0f..000000000
--- a/frontends/cocoa/FormSelectMenu.m
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "cocoa/FormSelectMenu.h"
-#import "cocoa/coordinates.h"
-
-#import "netsurf/types.h"
-#import "netsurf/browser_window.h"
-#import "netsurf/form.h"
-
-static inline NSRect cocoa_rect_for_control( struct browser_window *bw, struct form_control *control)
-{
- struct rect r;
- form_control_bounding_rect(control, &r);
- return cocoa_scaled_rect(browser_window_get_scale(bw),
- r.x0,
- r.y0,
- r.x1,
- r.y1);
-}
-
-@interface FormSelectMenu ()
-
-- (void) itemSelected: (id) sender;
-
-@end
-
-
-@implementation FormSelectMenu
-
-- (id) initWithControl: (struct form_control *) c forWindow: (struct browser_window *) w
-{
- if ((self = [super init]) == nil) return nil;
-
- control = c;
- browser = w;
-
- menu = [[NSMenu alloc] initWithTitle: @"Select"];
- if (menu == nil) {
- [self release];
- return nil;
- }
-
- [menu addItemWithTitle: @"" action: NULL keyEquivalent: @""];
-
- NSInteger currentItemIndex = 0;
- struct form_option *opt;
- for (opt = form_select_get_option(control, 0);
- opt != NULL;
- opt = opt->next) {
- NSMenuItem *item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithUTF8String: opt->text]
- action: @selector( itemSelected: )
- keyEquivalent: @""];
- if (opt->selected) {
- [item setState: NSOnState];
- }
- [item setTarget: self];
- [item setTag: currentItemIndex++];
- [menu addItem: item];
- [item release];
- }
-
- [menu setDelegate: self];
-
- return self;
-}
-
-- (void) dealloc
-{
- [cell release];
- [menu release];
-
- [super dealloc];
-}
-
-- (void) runInView: (NSView *) view
-{
- [self retain];
-
- cell = [[NSPopUpButtonCell alloc] initTextCell: @"" pullsDown: YES];
- [cell setMenu: menu];
-
- const NSRect rect = cocoa_rect_for_control(browser, control);
-
- [cell attachPopUpWithFrame: rect inView: view];
- [cell performClickWithFrame: rect inView: view];
-}
-
-- (void) itemSelected: (id) sender
-{
- form_select_process_selection( control, [sender tag] );
-}
-
-- (void) menuDidClose: (NSMenu *) sender
-{
- [self release];
-}
-
-@end
diff --git a/frontends/cocoa/HistoryView.h b/frontends/cocoa/HistoryView.h
deleted file mode 100644
index 6ef061321..000000000
--- a/frontends/cocoa/HistoryView.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@class HistoryView;
-@class BrowserView;
-
-@interface HistoryView : NSView {
- struct browser_window *browser;
- BrowserView *browserView;
- NSMutableArray *toolTips;
-}
-
-@property (readwrite, assign, nonatomic) BrowserView *browser;
-
-- (void) updateHistory;
-- (NSSize) size;
-
-@end
diff --git a/frontends/cocoa/HistoryView.m b/frontends/cocoa/HistoryView.m
deleted file mode 100644
index bead8dbed..000000000
--- a/frontends/cocoa/HistoryView.m
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "cocoa/HistoryView.h"
-#import "cocoa/font.h"
-#import "cocoa/coordinates.h"
-#import "cocoa/plotter.h"
-#import "cocoa/LocalHistoryController.h"
-#import "cocoa/BrowserView.h"
-
-#import "desktop/browser_history.h"
-#import "netsurf/plotters.h"
-
-@implementation HistoryView
-
-@synthesize browser = browserView;
-
-- (void) setBrowser: (BrowserView *) bw;
-{
- browserView = bw;
- browser = [bw browser];
- [self updateHistory];
-}
-
-- (NSSize) size;
-{
- int width, height;
- browser_window_history_size( browser, &width, &height );
-
- return cocoa_size( width, height );
-}
-
-- (void) updateHistory;
-{
- [self setFrameSize: [self size]];
- [self setNeedsDisplay: YES];
-}
-
-- (void) drawRect: (NSRect)rect;
-{
- [[NSColor clearColor] set];
- [NSBezierPath fillRect: rect];
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &cocoa_plotters
- };
-
- cocoa_set_clip( rect );
-
- browser_window_history_redraw( browser, &ctx );
-}
-
-- (void) mouseUp: (NSEvent *)theEvent;
-{
- const NSPoint location = [self convertPoint: [theEvent locationInWindow] fromView: nil];
- const bool newWindow = [theEvent modifierFlags] & NSCommandKeyMask;
- if (browser_window_history_click( browser,
- cocoa_pt_to_px( location.x ), cocoa_pt_to_px( location.y ),
- newWindow )) {
- [browserView setHistoryVisible: NO];
- }
-}
-
-- (BOOL) isFlipped;
-{
- return YES;
-}
-
-- (void) mouseEntered: (NSEvent *) event;
-{
- [[NSCursor pointingHandCursor] set];
-}
-
-- (void) mouseExited: (NSEvent *) event;
-{
- [[NSCursor arrowCursor] set];
-}
-
-static bool cursor_rects_cb( const struct browser_window *bw, int x0, int y0, int x1, int y1,
- const struct history_entry *page, void *user_data )
-{
- HistoryView *view = user_data;
-
- NSRect rect = NSIntersectionRect( [view visibleRect], cocoa_rect( x0, y0, x1, y1 ) );
- if (!NSIsEmptyRect( rect )) {
-
- NSString *toolTip = [NSString stringWithFormat: @"%s\n%s", browser_window_history_entry_get_title(page),
- browser_window_history_entry_get_url( page )];
-
- [view addToolTipRect: rect owner: toolTip userData: nil];
- NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect: rect
- options: NSTrackingMouseEnteredAndExited | NSTrackingActiveInActiveApp
- owner: view userInfo: nil];
- [view addTrackingArea: area];
- [area release];
- }
-
- return true;
-}
-
-- (NSToolTipTag)addToolTipRect: (NSRect) rect owner: (id) owner userData: (void *) userData;
-{
- if (toolTips == nil) toolTips = [[NSMutableArray alloc] init];
- [toolTips addObject: owner];
-
- return [super addToolTipRect: rect owner: owner userData: userData];
-}
-
-- (void) removeAllToolTips;
-{
- [super removeAllToolTips];
- [toolTips removeAllObjects];
-}
-
-- (void) updateTrackingAreas;
-{
- [self removeAllToolTips];
-
- for (NSTrackingArea *area in [self trackingAreas]) {
- [self removeTrackingArea: area];
- }
-
- browser_window_history_enumerate( browser, cursor_rects_cb, self );
-
- [super updateTrackingAreas];
-}
-
-- (void) dealloc;
-{
- [self removeAllToolTips];
- [super dealloc];
-}
-
-@end
diff --git a/frontends/cocoa/HistoryWindowController.h b/frontends/cocoa/HistoryWindowController.h
deleted file mode 100644
index 30ba8049a..000000000
--- a/frontends/cocoa/HistoryWindowController.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@class Tree;
-@class TreeView;
-
-@interface HistoryWindowController : NSWindowController {
- Tree *tree;
- TreeView *view;
-}
-
-@property (readwrite, assign, nonatomic) IBOutlet TreeView *view;
-
-@end
diff --git a/frontends/cocoa/HistoryWindowController.m b/frontends/cocoa/HistoryWindowController.m
deleted file mode 100644
index cae679b9d..000000000
--- a/frontends/cocoa/HistoryWindowController.m
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "cocoa/HistoryWindowController.h"
-#import "cocoa/Tree.h"
-#import "cocoa/TreeView.h"
-
-#import "desktop/global_history.h"
-
-@implementation HistoryWindowController
-
-@synthesize view;
-
-- init;
-{
- if ((self = [super initWithWindowNibName: @"HistoryWindow"]) == nil) return nil;
-
- tree = [[Tree alloc] initWithFlags: TREE_HISTORY];
-
- return self;
-}
-
-- (void) dealloc;
-{
- [tree release];
- [self setView: nil];
-
- [super dealloc];
-}
-
-- (void)awakeFromNib;
-{
- [view setTree: tree];
- [[self window] setExcludedFromWindowsMenu: YES];
-}
-
-@end
diff --git a/frontends/cocoa/LocalHistoryController.h b/frontends/cocoa/LocalHistoryController.h
deleted file mode 100644
index 3e6d1775e..000000000
--- a/frontends/cocoa/LocalHistoryController.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@class HistoryView;
-@class BrowserView;
-
-@interface LocalHistoryController : NSWindowController {
- HistoryView *history;
- BrowserView *browser;
-}
-
-@property (readwrite, assign, nonatomic) BrowserView *browser;
-@property (readwrite, assign, nonatomic) IBOutlet HistoryView *history;
-
-- (id)initWithBrowser: (BrowserView *) bw;
-
-- (void) attachToView: (NSView *) view;
-- (void) detach;
-- (void) redraw;
-
-- (void) keyDown: (NSEvent *)theEvent;
-
-@end
diff --git a/frontends/cocoa/LocalHistoryController.m b/frontends/cocoa/LocalHistoryController.m
deleted file mode 100644
index b3992b614..000000000
--- a/frontends/cocoa/LocalHistoryController.m
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "cocoa/LocalHistoryController.h"
-
-#import "cocoa/BrowserView.h"
-#import "cocoa/HistoryView.h"
-#import "cocoa/ArrowWindow.h"
-
-@implementation LocalHistoryController
-
-@synthesize browser;
-@synthesize history;
-
-- initWithBrowser: (BrowserView *) bw;
-{
- if ((self = [super initWithWindowNibName: @"LocalHistoryPanel"]) == nil) return nil;
-
- browser = bw;
-
- return self;
-}
-
-- (void) attachToView: (NSView *) view;
-{
- NSDisableScreenUpdates();
-
- ArrowWindow *box = (ArrowWindow *)[self window];
-
- [box setContentSize: [history size]];
- [box setArrowPosition: 50];
- [history updateHistory];
- [box attachToView: view];
-
- NSRect frame = [box frame];
- NSRect screenFrame = [[box screen] visibleFrame];
-
- const CGFloat arrowSize = [box arrowSize];
- frame.origin.x += arrowSize;
- frame.origin.y += arrowSize;
- frame.size.width -= 2 * arrowSize;
- frame.size.height -= 2 * arrowSize;
-
- if (NSMinY( frame ) < NSMinY( screenFrame )) {
- const CGFloat delta = NSMinY( screenFrame ) - NSMinY( frame );
- frame.size.height -= delta;
- frame.origin.y += delta;
- }
-
- CGFloat arrowPositionChange = 50;
- if (NSMaxX( frame ) > NSMaxX( screenFrame )) {
- const CGFloat delta = NSMaxX( frame ) - NSMaxX( screenFrame );
- arrowPositionChange += delta;
- frame.origin.x -= delta;
- }
-
- if (NSMinX( frame ) < NSMinX( screenFrame )) {
- const CGFloat delta = NSMinX( screenFrame ) - NSMinX( frame );
- arrowPositionChange -= delta;
- frame.origin.x += delta;
- frame.size.width -= delta;
- }
-
- frame.origin.x -= arrowSize;
- frame.origin.y -= arrowSize;
- frame.size.width += 2 * arrowSize;
- frame.size.height += 2 * arrowSize;
-
- [box setArrowPosition: arrowPositionChange];
- [box setFrame: frame display: YES];
-
- NSEnableScreenUpdates();
-}
-
-- (void) detach;
-{
- [(ArrowWindow *)[self window] detach];
-}
-
-- (void) windowDidLoad;
-{
- [history setBrowser: browser];
-}
-
-- (void) redraw;
-{
- [history setNeedsDisplay: YES];
-}
-
-- (void) keyDown: (NSEvent *)theEvent;
-{
- unichar key = [[theEvent characters] characterAtIndex: 0];
- switch (key) {
- case 27:
- [browser setHistoryVisible: NO];
- break;
-
- default:
- NSBeep();
- break;
- };
-}
-
-@end
diff --git a/frontends/cocoa/Makefile b/frontends/cocoa/Makefile
deleted file mode 100644
index a0ebfbb43..000000000
--- a/frontends/cocoa/Makefile
+++ /dev/null
@@ -1,250 +0,0 @@
-# ----------------------------------------------------------------------------
-# Mac OS X target setup
-# ----------------------------------------------------------------------------
-
-POSTEXES += NetSurf.app
-
-# shut up zconf.h and zlib.h
-#CFLAGS += -D_LARGEFILE64_SOURCE=1
-
-# add Mac Ports include and library paths for openssl
-ifneq ($(shell test -d /opt/local && echo 'yes'),)
- LDFLAGS += -L/opt/local/lib
- CFLAGS += -I/opt/local/include
-endif
-
-ifeq ($(SDK_VERSION),)
- # if no SDK_VERSION has been specified select one from those available
- SDK_PARAM := $(shell xcodebuild -showsdks | awk '/^$$/{p=0};p; /OS X SDKs:/{p=1}' | tail -1 | cut -f3)
- SDK_VERSION := $(MACOSX_VERSION)
-else
- SDK_PARAM := -sdk macosx$(SDK_VERSION)
-endif
-
-SDK_PATH ?= $(shell xcodebuild -version $(SDK_PARAM) Path)
-SDK_FLAGS := -isysroot $(SDK_PATH) -mmacosx-version-min=$(SDK_VERSION)
-CFLAGS := $(SDK_FLAGS) $(CFLAGS)
-LDFLAGS := $(SDK_FLAGS) -Wl,-syslibroot,$(SDK_PATH) $(LDFLAGS)
-CXXFLAGS := $(SDK_FLAGS) $(CXXFLAGS)
-
-# for timerisset()
-CFLAGS += -D_DARWIN_C_SOURCE
-
-LDFLAGS += -L/usr/lib
-LDFLAGS += -L/usr/X11/lib
-LDFLAGS += -lm -lcurl
-LDFLAGS += -lssl -lcrypto
-
-CFLAGS += -Dnscocoa -D_BSD_SOURCE -D_POSIX_C_SOURCE -std=c99 -g -Os
-
-CFLAGS += -I/usr/X11/include
-CFLAGS += -include cocoa/Prefix.pch
-
-VERSION_FULL := $(shell sed -n '/_version.*=.*"/{s/.*"\(.*\)".*/\1/;p;}' desktop/version.c)
-VERSION_MAJ := $(shell sed -n '/_major/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
-VERSION_MIN := $(shell sed -n '/_minor/{s/.* = \([0-9]*\).*/\1/;p;}' desktop/version.c)
-
-LDFLAGS += -Wl,-framework,Cocoa -Wl,-framework,Carbon $(NETLDFLAGS)
-
-$(eval $(call feature_enabled,IMAGEIO,-DWITH_APPLE_IMAGE,,Apple ImageIO ))
-
-ifneq ($(UNIVERSAL),)
- UNIVERSAL_FLAGS := $(foreach arch,$(UNIVERSAL),-arch $(arch) )
- CFLAGS += $(UNIVERSAL_FLAGS)
- LDFLAGS += $(UNIVERSAL_FLAGS)
- CXXFLAGS += $(UNIVERSAL_FLAGS)
-endif
-
-# ----------------------------------------------------------------------------
-# Source file setup
-# ----------------------------------------------------------------------------
-
-# sources purely for the Mac OS X build
-S_FRONTEND := \
- BookmarksController.m \
- BrowserView.m \
- BrowserViewController.m \
- BrowserWindowController.m \
- BrowserWindow.m \
- DownloadWindowController.m \
- NetSurfAppDelegate.m \
- NetsurfApp.m \
- PreferencesWindowController.m \
- ScrollableView.m \
- SearchWindowController.m \
- URLFieldCell.m \
- Tree.m \
- desktop-tree.m \
- TreeView.m \
- HistoryView.m \
- HistoryWindowController.m \
- FormSelectMenu.m \
- bitmap.m \
- fetch.m \
- font.m \
- gui.m \
- plotter.m \
- schedule.m \
- selection.m \
- ArrowBox.m \
- ArrowWindow.m \
- BlackScroller.m \
- LocalHistoryController.m \
- apple_image.m
-
-S_TABBAR := \
- NSBezierPath_AMShading.m \
- NSString_AITruncation.m \
- PSMOverflowPopUpButton.m \
- PSMProgressIndicator.m \
- PSMRolloverButton.m \
- PSMTabBarCell.m \
- PSMTabBarControl.m \
- PSMTabBarController.m \
- PSMTabDragAssistant.m \
- PSMTabDragView.m \
- PSMTabDragWindow.m \
- PSMTabDragWindowController.m \
- PSMUnifiedTabStyle.m
-
-S_FRONTEND += $(addprefix PSMTabBarControl/,$(S_TABBAR))
-
-# This is the final source build list
-# Note this is deliberately *not* expanded here as common and image
-# are not yet available
-SOURCES = $(addprefix $(shell pwd)/,$(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_FRONTEND))
-
-# Since we prefix the sources with the pwd, also create a special
-# prefixed rule so that the testament is run
-$(shell pwd)/content/fetchers/about.c: testament
-
-EXETARGET := NetSurf
-
-S_XIBS := \
- MainMenu.xib \
- Browser.xib \
- BrowserWindow.xib \
- DownloadWindow.xib \
- SearchWindow.xib \
- PreferencesWindow.xib \
- HistoryWindow.xib \
- BookmarksWindow.xib \
- LocalHistoryPanel.xib
-
-R_RESOURCES := \
- default.css \
- adblock.css \
- internal.css \
- quirks.css \
- NetSurf.icns \
- HomeTemplate.pdf \
- Icons \
- ca-bundle \
- netsurf.png
-
-
-TABBAR_RESOURCES := \
- AquaTabClose_Front_Pressed.png \
- AquaTabClose_Front_Rollover.png \
- AquaTabClose_Front.png \
- AquaTabCloseDirty_Front_Pressed.png \
- AquaTabCloseDirty_Front_Rollover.png \
- AquaTabCloseDirty_Front.png \
- AquaTabNew.png \
- AquaTabNewPressed.png \
- AquaTabNewRollover.png \
- overflowImage.png \
- overflowImagePressed.png \
- pi.png
-
-R_RESOURCES := $(addprefix $(FRONTEND_RESOURCES_DIR)/,$(R_RESOURCES))
-
-R_RESOURCES += $(addprefix $(FRONTEND_SOURCE_DIR)/PSMTabBarControl/Images/,$(TABBAR_RESOURCES))
-
-LANGUAGES := de en fr it nl
-LOCALIZED_RESOURCES := Localizable.strings
-
-#languiage project macro
-# $1 is language name
-# $2 is list of resources per language
-define make_lproj
-R_RESOURCES += $$(OBJROOT)/$(1).lproj
-$$(OBJROOT)/$(1).lproj: $(2)
- $(VQ)echo Bundling language $(1)
- $(Q)$(MKDIR) -p $$@
- $(Q)cp -pLR $(2) $$@
- $(Q)$(SPLIT_MESSAGES) -l $(1) -p cocoa -f messages resources/FatMessages > $$@/Messages
-endef
-
-# compile_xib (xib) (lang)
-define compile_xib
-$$(OBJROOT)/$(2).lproj: $$(OBJROOT)/$(2).lproj/$(1:.xib=.nib)
-
-$$(OBJROOT)/$(2).lproj/$(1:.xib=.nib): $(FRONTEND_RESOURCES_DIR)/$(1) $$(OBJROOT)/created
- $(VQ)echo Compiling XIB $(1) for language $(2)
- $(Q)$(MKDIR) -p $$(OBJROOT)/$(2).lproj
- $(Q)$(FRONTEND_SOURCE_DIR)/compile-xib.sh $(FRONTEND_RESOURCES_DIR)/$(1) $(2) $$@
-
-ifeq ($(wildcard $(FRONTEND_RESOURCES_DIR)/$(2).lproj/$(1).strings),$(FRONTEND_RESOURCES_DIR)/$(2).lproj/$(1).strings)
-$$(OBJROOT)/$(2).lproj/$(1:.xib=.nib): $(FRONTEND_RESOURCES_DIR)/$(2).lproj/$(1).strings
-endif
-
-endef
-
-$(foreach lang,$(LANGUAGES),$(eval $(call make_lproj,$(lang),$(addprefix $(FRONTEND_RESOURCES_DIR)/$(lang).lproj/,$(LOCALIZED_RESOURCES)))))
-$(foreach lang,$(LANGUAGES),$(foreach xib,$(S_XIBS),$(eval $(call compile_xib,$(xib),$(lang)))))
-
-# ----------------------------------------------------------------------------
-# Install target
-# ----------------------------------------------------------------------------
-
-install-cocoa: NetSurf.app
-
-NetSurf.app: NetSurf $(FRONTEND_SOURCE_DIR)/Makefile $(R_RESOURCES) NetSurf.app/Contents/Info.plist
- $(VQ)echo Assembling NetSurf.app bundle
- $(Q)$(MKDIR) -p NetSurf.app/Contents/MacOS
- $(Q)cp NetSurf NetSurf.app/Contents/MacOS
- $(Q)rm -rf NetSurf.app/Contents/Resources
- $(Q)$(MKDIR) -p NetSurf.app/Contents/Resources
- $(Q)cp -pLR $(R_RESOURCES) NetSurf.app/Contents/Resources
- $(Q)echo 'APPL????' > NetSurf.app/Contents/PkgInfo
-
-NetSurf.app/Contents/Info.plist: $(FRONTEND_RESOURCES_DIR)/NetSurf-Info.plist $(FRONTEND_SOURCE_DIR)/Makefile
- $(VQ)echo Generating Info.plist
- $(Q)$(MKDIR) -p NetSurf.app/Contents
- $(Q)sed -e 's/$${EXECUTABLE_NAME}/$(EXETARGET)/' \
- -e 's/$${PRODUCT_NAME.*}/$(EXETARGET)/' \
- -e 's/$${MACOSX_DEPLOYMENT_TARGET}/$(MACOSX_VERSION)/' \
- -e 's/$${NETSURF_VERSION}/$(VERSION_FULL)/' \
- -e 's/$${NETSURF_SHORT_VERSION}/$(VERSION_MAJ).$(VERSION_MIN)/' \
- < $(FRONTEND_RESOURCES_DIR)/NetSurf-Info.plist > NetSurf.app/Contents/Info.plist
-
-# ----------------------------------------------------------------------------
-# Package target
-# ----------------------------------------------------------------------------
-
-package-cocoa: NetSurf.dmg
-
-.INTERMEDIATE: NetSurf.tmp.dmg
-
-NetSurf.tmp.dmg: NetSurf.app
- hdiutil create -size 8m -fs HFS+ -volname "NetSurf" $@
- sleep 2
- hdiutil attach $@
- sleep 2
- cp -pPR $^ /Volumes/NetSurf/
- hdiutil detach $$(echo $$(hdiutil attach $@ | cut -f 1) | cut -f 1 -d ' ')
- sleep 2
-
-NetSurf.dmg: NetSurf.tmp.dmg
- hdiutil convert $^ -format UDZO -o $@
-
-CLEANS += clean-package-cocoa
-
-clean-package-cocoa:
- $(VQ)echo " CLEAN: NetSurf.tmp.dmg"
- $(Q)$(RM) NetSurf.tmp.dmg
- $(VQ)echo " CLEAN: NetSurf.dmg"
- $(Q)$(RM) NetSurf.dmg
- $(VQ)echo " CLEAN: NetSurf.app"
- $(Q)$(RM) -r NetSurf.app
diff --git a/frontends/cocoa/Makefile.defaults b/frontends/cocoa/Makefile.defaults
deleted file mode 100644
index 8f5792b0a..000000000
--- a/frontends/cocoa/Makefile.defaults
+++ /dev/null
@@ -1,30 +0,0 @@
-# ----------------------------------------------------------------------------
-# Cocoa-specific options
-# ----------------------------------------------------------------------------
-
-# Force using glibc internal iconv implementation instead of external libiconv
-# Valid options: YES, NO
-NETSURF_USE_LIBICONV_PLUG := NO
-
-# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
-# Valid options: YES, NO, AUTO
-NETSURF_USE_ROSPRITE := NO
-
-# Enable NetSurf's use of librsvg in conjunction with Cairo to display SVGs
-# Valid options: YES, NO, AUTO
-NETSURF_USE_RSVG := AUTO
-
-# Enable NetSurf's use of libsvgtiny for displaying SVGs
-# Valid options: YES, NO, AUTO
-NETSURF_USE_NSSVG := AUTO
-
-NETSURF_USE_BMP := NO
-NETSURF_USE_GIF := NO
-NETSURF_USE_PNG := NO
-NETSURF_USE_JPEG := NO
-NETSURF_USE_IMAGEIO := YES
-
-MACOSX_VERSION := $(shell sw_vers -productVersion | awk -F '.' '{print $$1 "." $$2}')
-
-# Optimisation levels
-CFLAGS += -O2
diff --git a/frontends/cocoa/NetSurf.xcodeproj/project.pbxproj b/frontends/cocoa/NetSurf.xcodeproj/project.pbxproj
deleted file mode 100644
index ef25d2f1a..000000000
--- a/frontends/cocoa/NetSurf.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,1023 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 45;
- objects = {
-
-/* Begin PBXFileReference section */
- 260F1F6312D620E800D9B07F /* content.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = content.c; sourceTree = "<group>"; };
- 260F1F6412D620E800D9B07F /* content.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = content.h; sourceTree = "<group>"; };
- 260F1F6512D620E800D9B07F /* content_protected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = content_protected.h; sourceTree = "<group>"; };
- 260F1F6612D620E800D9B07F /* content_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = content_type.h; sourceTree = "<group>"; };
- 260F1F6712D620E800D9B07F /* dirlist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dirlist.c; sourceTree = "<group>"; };
- 260F1F6812D620E800D9B07F /* dirlist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dirlist.h; sourceTree = "<group>"; };
- 260F1F6912D620E800D9B07F /* fetch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fetch.c; sourceTree = "<group>"; };
- 260F1F6A12D620E800D9B07F /* fetch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fetch.h; sourceTree = "<group>"; };
- 260F1F6C12D620E800D9B07F /* curl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = curl.c; sourceTree = "<group>"; };
- 260F1F6D12D620E800D9B07F /* curl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = curl.h; sourceTree = "<group>"; };
- 260F1F6E12D620E800D9B07F /* data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = data.c; sourceTree = "<group>"; };
- 260F1F6F12D620E800D9B07F /* data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = data.h; sourceTree = "<group>"; };
- 260F1F7012D620E800D9B07F /* file.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = file.c; sourceTree = "<group>"; };
- 260F1F7112D620E800D9B07F /* file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = file.h; sourceTree = "<group>"; };
- 260F1F7212D620E800D9B07F /* hlcache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hlcache.c; sourceTree = "<group>"; };
- 260F1F7312D620E800D9B07F /* hlcache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hlcache.h; sourceTree = "<group>"; };
- 260F1F7412D620E800D9B07F /* llcache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = llcache.c; sourceTree = "<group>"; };
- 260F1F7512D620E800D9B07F /* llcache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = llcache.h; sourceTree = "<group>"; };
- 260F1F7612D620E800D9B07F /* urldb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = urldb.c; sourceTree = "<group>"; };
- 260F1F7712D620E800D9B07F /* urldb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = urldb.h; sourceTree = "<group>"; };
- 260F1F7912D620E800D9B07F /* css.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = css.c; sourceTree = "<group>"; };
- 260F1F7A12D620E800D9B07F /* css.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = css.h; sourceTree = "<group>"; };
- 260F1F7B12D620E800D9B07F /* dump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dump.c; sourceTree = "<group>"; };
- 260F1F7C12D620E800D9B07F /* dump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dump.h; sourceTree = "<group>"; };
- 260F1F7D12D620E800D9B07F /* internal.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = internal.c; sourceTree = "<group>"; };
- 260F1F7E12D620E800D9B07F /* internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = internal.h; sourceTree = "<group>"; };
- 260F1F7F12D620E800D9B07F /* select.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = select.c; sourceTree = "<group>"; };
- 260F1F8012D620E800D9B07F /* select.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = select.h; sourceTree = "<group>"; };
- 260F1F8112D620E800D9B07F /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utils.c; sourceTree = "<group>"; };
- 260F1F8212D620E800D9B07F /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = "<group>"; };
- 260F1F8412D620E800D9B07F /* 401login.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 401login.h; sourceTree = "<group>"; };
- 260F1F8512D620E800D9B07F /* browser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = browser.c; sourceTree = "<group>"; };
- 260F1F8612D620E800D9B07F /* browser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = browser.h; sourceTree = "<group>"; };
- 260F1F8712D620E800D9B07F /* cookies.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cookies.c; sourceTree = "<group>"; };
- 260F1F8812D620E800D9B07F /* cookies_old.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cookies_old.h; sourceTree = "<group>"; };
- 260F1F8912D620E800D9B07F /* download.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = download.c; sourceTree = "<group>"; };
- 260F1F8A12D620E800D9B07F /* download.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = download.h; sourceTree = "<group>"; };
- 260F1F8B12D620E800D9B07F /* frames.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = frames.c; sourceTree = "<group>"; };
- 260F1F8C12D620E800D9B07F /* frames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = frames.h; sourceTree = "<group>"; };
- 260F1F8D12D620E800D9B07F /* gui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gui.h; sourceTree = "<group>"; };
- 260F1F8E12D620E800D9B07F /* local_history.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = local_history.c; sourceTree = "<group>"; };
- 260F1F8F12D620E800D9B07F /* local_history.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = local_history.h; sourceTree = "<group>"; };
- 260F1F9012D620E800D9B07F /* history_global_core.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = history_global_core.c; sourceTree = "<group>"; };
- 260F1F9112D620E800D9B07F /* history_global_core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = history_global_core.h; sourceTree = "<group>"; };
- 260F1F9212D620E800D9B07F /* hotlist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hotlist.c; sourceTree = "<group>"; };
- 260F1F9312D620E800D9B07F /* hotlist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hotlist.h; sourceTree = "<group>"; };
- 260F1F9412D620E800D9B07F /* knockout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = knockout.c; sourceTree = "<group>"; };
- 260F1F9512D620E800D9B07F /* knockout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = knockout.h; sourceTree = "<group>"; };
- 260F1F9612D620E800D9B07F /* mouse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mouse.c; sourceTree = "<group>"; };
- 260F1F9712D620E800D9B07F /* mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mouse.h; sourceTree = "<group>"; };
- 260F1F9812D620E800D9B07F /* netsurf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = netsurf.c; sourceTree = "<group>"; };
- 260F1F9912D620E800D9B07F /* netsurf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = netsurf.h; sourceTree = "<group>"; };
- 260F1F9A12D620E800D9B07F /* options.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = options.c; sourceTree = "<group>"; };
- 260F1F9B12D620E800D9B07F /* options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = options.h; sourceTree = "<group>"; };
- 260F1F9C12D620E800D9B07F /* plot_style.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = plot_style.c; sourceTree = "<group>"; };
- 260F1F9D12D620E800D9B07F /* plot_style.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = plot_style.h; sourceTree = "<group>"; };
- 260F1F9E12D620E800D9B07F /* plotters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = plotters.h; sourceTree = "<group>"; };
- 260F1F9F12D620E800D9B07F /* print.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = print.c; sourceTree = "<group>"; };
- 260F1FA012D620E800D9B07F /* print.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = print.h; sourceTree = "<group>"; };
- 260F1FA112D620E800D9B07F /* printer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = printer.h; sourceTree = "<group>"; };
- 260F1FA212D620E800D9B07F /* save_complete.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = save_complete.c; sourceTree = "<group>"; };
- 260F1FA312D620E800D9B07F /* save_complete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = save_complete.h; sourceTree = "<group>"; };
- 260F1FA512D620E800D9B07F /* font_haru.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = font_haru.c; sourceTree = "<group>"; };
- 260F1FA612D620E800D9B07F /* font_haru.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = font_haru.h; sourceTree = "<group>"; };
- 260F1FA712D620E800D9B07F /* pdf_plotters.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pdf_plotters.c; sourceTree = "<group>"; };
- 260F1FA812D620E800D9B07F /* pdf_plotters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pdf_plotters.h; sourceTree = "<group>"; };
- 260F1FAA12D620E800D9B07F /* save_text.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = save_text.c; sourceTree = "<group>"; };
- 260F1FAB12D620E800D9B07F /* save_text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = save_text.h; sourceTree = "<group>"; };
- 260F1FAC12D620E800D9B07F /* scroll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scroll.c; sourceTree = "<group>"; };
- 260F1FAD12D620E800D9B07F /* scroll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scroll.h; sourceTree = "<group>"; };
- 260F1FAE12D620E800D9B07F /* search.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = search.c; sourceTree = "<group>"; };
- 260F1FAF12D620E800D9B07F /* search.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = search.h; sourceTree = "<group>"; };
- 260F1FB012D620E800D9B07F /* searchweb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = searchweb.c; sourceTree = "<group>"; };
- 260F1FB112D620E800D9B07F /* searchweb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = searchweb.h; sourceTree = "<group>"; };
- 260F1FB212D620E800D9B07F /* selection.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = selection.c; sourceTree = "<group>"; };
- 260F1FB312D620E800D9B07F /* selection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = selection.h; sourceTree = "<group>"; };
- 260F1FB412D620E800D9B07F /* sslcert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sslcert.c; sourceTree = "<group>"; };
- 260F1FB512D620E800D9B07F /* sslcert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sslcert.h; sourceTree = "<group>"; };
- 260F1FB612D620E800D9B07F /* textarea.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = textarea.c; sourceTree = "<group>"; };
- 260F1FB712D620E800D9B07F /* textarea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = textarea.h; sourceTree = "<group>"; };
- 260F1FB812D620E800D9B07F /* textinput.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = textinput.c; sourceTree = "<group>"; };
- 260F1FB912D620E800D9B07F /* textinput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = textinput.h; sourceTree = "<group>"; };
- 260F1FBA12D620E800D9B07F /* tree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tree.c; sourceTree = "<group>"; };
- 260F1FBB12D620E800D9B07F /* tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tree.h; sourceTree = "<group>"; };
- 260F1FBC12D620E800D9B07F /* tree_url_node.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tree_url_node.c; sourceTree = "<group>"; };
- 260F1FBD12D620E800D9B07F /* tree_url_node.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tree_url_node.h; sourceTree = "<group>"; };
- 260F1FBE12D620E800D9B07F /* version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = "<group>"; };
- 260F1FC712D620E800D9B07F /* box.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = box.c; sourceTree = "<group>"; };
- 260F1FC812D620E800D9B07F /* box.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = box.h; sourceTree = "<group>"; };
- 260F1FC912D620E800D9B07F /* box_construct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = box_construct.c; sourceTree = "<group>"; };
- 260F1FCA12D620E800D9B07F /* box_normalise.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = box_normalise.c; sourceTree = "<group>"; };
- 260F1FCB12D620E800D9B07F /* favicon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = favicon.c; sourceTree = "<group>"; };
- 260F1FCC12D620E800D9B07F /* favicon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = favicon.h; sourceTree = "<group>"; };
- 260F1FCD12D620E800D9B07F /* font.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = font.c; sourceTree = "<group>"; };
- 260F1FCE12D620E800D9B07F /* font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = font.h; sourceTree = "<group>"; };
- 260F1FCF12D620E800D9B07F /* form.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = form.c; sourceTree = "<group>"; };
- 260F1FD012D620E800D9B07F /* form.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = form.h; sourceTree = "<group>"; };
- 260F1FD112D620E800D9B07F /* html.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = html.c; sourceTree = "<group>"; };
- 260F1FD212D620E800D9B07F /* html.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = html.h; sourceTree = "<group>"; };
- 260F1FD312D620E800D9B07F /* html_interaction.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = html_interaction.c; sourceTree = "<group>"; };
- 260F1FD412D620E800D9B07F /* html_redraw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = html_redraw.c; sourceTree = "<group>"; };
- 260F1FD512D620E800D9B07F /* hubbub_binding.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hubbub_binding.c; sourceTree = "<group>"; };
- 260F1FD612D620E800D9B07F /* imagemap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = imagemap.c; sourceTree = "<group>"; };
- 260F1FD712D620E800D9B07F /* imagemap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imagemap.h; sourceTree = "<group>"; };
- 260F1FD812D620E800D9B07F /* layout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = layout.c; sourceTree = "<group>"; };
- 260F1FD912D620E800D9B07F /* layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = layout.h; sourceTree = "<group>"; };
- 260F1FDA12D620E800D9B07F /* list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = list.c; sourceTree = "<group>"; };
- 260F1FDB12D620E800D9B07F /* list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = list.h; sourceTree = "<group>"; };
- 260F1FDC12D620E800D9B07F /* parser_binding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parser_binding.h; sourceTree = "<group>"; };
- 260F1FDD12D620E800D9B07F /* table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = "<group>"; };
- 260F1FDE12D620E800D9B07F /* table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = table.h; sourceTree = "<group>"; };
- 260F1FE012D620E800D9B07F /* textplain.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = textplain.c; sourceTree = "<group>"; };
- 260F1FE112D620E800D9B07F /* textplain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = textplain.h; sourceTree = "<group>"; };
- 260F1FE312D620E800D9B07F /* base64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = base64.c; sourceTree = "<group>"; };
- 260F1FE412D620E800D9B07F /* base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = base64.h; sourceTree = "<group>"; };
- 260F1FE512D620E800D9B07F /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
- 260F1FE612D620E800D9B07F /* container.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = container.c; sourceTree = "<group>"; };
- 260F1FE712D620E800D9B07F /* container.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = container.h; sourceTree = "<group>"; };
- 260F1FE812D620E800D9B07F /* errors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = errors.h; sourceTree = "<group>"; };
- 260F1FE912D620E800D9B07F /* filename.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = filename.c; sourceTree = "<group>"; };
- 260F1FEA12D620E800D9B07F /* filename.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = filename.h; sourceTree = "<group>"; };
- 260F1FEB12D620E800D9B07F /* resource.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = resource.c; sourceTree = "<group>"; };
- 260F1FEC12D620E800D9B07F /* resource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resource.h; sourceTree = "<group>"; };
- 260F1FED12D620E800D9B07F /* hashtable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hashtable.c; sourceTree = "<group>"; };
- 260F1FEE12D620E800D9B07F /* hashtable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hashtable.h; sourceTree = "<group>"; };
- 260F1FEF12D620E800D9B07F /* http.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = http.c; sourceTree = "<group>"; };
- 260F1FF012D620E800D9B07F /* http.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = http.h; sourceTree = "<group>"; };
- 260F1FF112D620E800D9B07F /* locale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = locale.c; sourceTree = "<group>"; };
- 260F1FF212D620E800D9B07F /* locale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = locale.h; sourceTree = "<group>"; };
- 260F1FF312D620E800D9B07F /* log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = log.c; sourceTree = "<group>"; };
- 260F1FF412D620E800D9B07F /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = "<group>"; };
- 260F1FF612D620E800D9B07F /* memdebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memdebug.c; sourceTree = "<group>"; };
- 260F1FF712D620E800D9B07F /* memdebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memdebug.h; sourceTree = "<group>"; };
- 260F1FF812D620E800D9B07F /* messages.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = messages.c; sourceTree = "<group>"; };
- 260F1FF912D620E800D9B07F /* messages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = messages.h; sourceTree = "<group>"; };
- 260F1FFA12D620E800D9B07F /* ring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ring.h; sourceTree = "<group>"; };
- 260F1FFB12D620E800D9B07F /* talloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = talloc.c; sourceTree = "<group>"; };
- 260F1FFC12D620E800D9B07F /* talloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = talloc.h; sourceTree = "<group>"; };
- 260F1FFF12D620E800D9B07F /* url.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = url.c; sourceTree = "<group>"; };
- 260F200012D620E800D9B07F /* url.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = url.h; sourceTree = "<group>"; };
- 260F200112D620E800D9B07F /* useragent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = useragent.c; sourceTree = "<group>"; };
- 260F200212D620E800D9B07F /* useragent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = useragent.h; sourceTree = "<group>"; };
- 260F200312D620E800D9B07F /* utf8.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utf8.c; sourceTree = "<group>"; };
- 260F200412D620E800D9B07F /* utf8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utf8.h; sourceTree = "<group>"; };
- 260F200512D620E800D9B07F /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utils.c; sourceTree = "<group>"; };
- 260F200612D620E800D9B07F /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = "<group>"; };
- 260F200712D620E800D9B07F /* utsname.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utsname.h; sourceTree = "<group>"; };
- 260FC03112D85ACE00079C00 /* bitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bitmap.h; sourceTree = "<group>"; };
- 26121DA812D700B800E10F91 /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = "<group>"; };
- 26121EAB12D70E0A00E10F91 /* Browser.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Browser.xib; sourceTree = "<group>"; };
- 26121EFB12D7132100E10F91 /* BrowserView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BrowserView.h; sourceTree = "<group>"; };
- 26121EFC12D7132100E10F91 /* BrowserView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BrowserView.m; sourceTree = "<group>"; };
- 261223B712D77F9C00E10F91 /* font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = font.h; sourceTree = "<group>"; };
- 261223CB12D7805300E10F91 /* plotter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = plotter.h; sourceTree = "<group>"; };
- 2612265712D7ACB500E10F91 /* default.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = default.css; sourceTree = "<group>"; };
- 2612265912D7ACB500E10F91 /* quirks.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = quirks.css; sourceTree = "<group>"; };
- 2612265D12D7AD6800E10F91 /* adblock.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = adblock.css; sourceTree = "<group>"; };
- 2612269012D7AE4100E10F91 /* de */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = de; path = de.lproj/Messages; sourceTree = "<group>"; };
- 2612269312D7AE9B00E10F91 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text; name = nl; path = nl.lproj/Messages; sourceTree = "<group>"; };
- 2612269412D7AEA800E10F91 /* en */ = {isa = PBXFileReference; lastKnownFileType = text; name = en; path = en.lproj/Messages; sourceTree = "<group>"; };
- 2612269512D7AEB500E10F91 /* it */ = {isa = PBXFileReference; lastKnownFileType = text; name = it; path = it.lproj/Messages; sourceTree = "<group>"; };
- 2612269612D7AEBE00E10F91 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text; name = fr; path = fr.lproj/Messages; sourceTree = "<group>"; };
- 261DB22213180AFF00C59F12 /* en */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
- 261DB22613180B4F00C59F12 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
- 261DB23313180CD600C59F12 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
- 261DB23413180CE000C59F12 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = "<group>"; };
- 261DB23513180CEE00C59F12 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
- 261DB24F1318444F00C59F12 /* compile-xib.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "compile-xib.sh"; sourceTree = "<group>"; };
- 261DB2501318444F00C59F12 /* extract-strings.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "extract-strings.sh"; sourceTree = "<group>"; };
- 261DB29013185C0A00C59F12 /* de */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/BookmarksWindow.xib.strings; sourceTree = "<group>"; };
- 261DB29413185C0A00C59F12 /* de */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/BrowserWindow.xib.strings; sourceTree = "<group>"; };
- 261DB29613185C0A00C59F12 /* de */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/DownloadWindow.xib.strings; sourceTree = "<group>"; };
- 261DB29813185C0A00C59F12 /* de */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/HistoryWindow.xib.strings; sourceTree = "<group>"; };
- 261DB29C13185C0A00C59F12 /* de */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/MainMenu.xib.strings; sourceTree = "<group>"; };
- 261DB29E13185C0A00C59F12 /* de */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/PreferencesWindow.xib.strings; sourceTree = "<group>"; };
- 261DB2A013185C0A00C59F12 /* de */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/SearchWindow.xib.strings; sourceTree = "<group>"; };
- 2622F1D512DCD84600CD5A62 /* TreeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TreeView.h; sourceTree = "<group>"; };
- 2622F1D612DCD84600CD5A62 /* TreeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TreeView.m; sourceTree = "<group>"; };
- 2625095012F72A8F0090D236 /* PreferencesWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PreferencesWindow.xib; sourceTree = "<group>"; };
- 2625095112F72AA70090D236 /* PreferencesWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesWindowController.h; sourceTree = "<group>"; };
- 2625095212F72AA70090D236 /* PreferencesWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferencesWindowController.m; sourceTree = "<group>"; };
- 2636299412F699250048542C /* NetSurf.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; name = NetSurf.app; path = ../NetSurf.app; sourceTree = SOURCE_ROOT; };
- 263629B312F69A290048542C /* Makefile.config */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; name = Makefile.config; path = ../Makefile.config; sourceTree = SOURCE_ROOT; };
- 263629B412F69A290048542C /* Makefile.defaults */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; name = Makefile.defaults; path = ../Makefile.defaults; sourceTree = SOURCE_ROOT; };
- 263629B512F69A290048542C /* Makefile.resources */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; name = Makefile.resources; path = ../Makefile.resources; sourceTree = SOURCE_ROOT; };
- 263629B612F69A290048542C /* Makefile.sources */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; name = Makefile.sources; path = ../Makefile.sources; sourceTree = SOURCE_ROOT; };
- 263629B712F69A3C0048542C /* Makefile.target */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.target; sourceTree = "<group>"; };
- 263629BC12F69A760048542C /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = ../Makefile; sourceTree = SOURCE_ROOT; };
- 263629C812F69B120048542C /* NetsurfApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetsurfApp.h; sourceTree = "<group>"; };
- 263629C912F69B120048542C /* NetsurfApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetsurfApp.m; sourceTree = "<group>"; };
- 263629CA12F69B120048542C /* system_colour.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = system_colour.m; sourceTree = "<group>"; };
- 263769A912F7EBE2000F45FE /* Tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tree.h; sourceTree = "<group>"; };
- 263769AA12F7EBE2000F45FE /* Tree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tree.m; sourceTree = "<group>"; };
- 26376A4112F7FA67000F45FE /* HistoryWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HistoryWindow.xib; sourceTree = "<group>"; };
- 26376A4312F7FA86000F45FE /* HistoryWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryWindowController.h; sourceTree = "<group>"; };
- 26376A4412F7FA86000F45FE /* HistoryWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HistoryWindowController.m; sourceTree = "<group>"; };
- 26376A8A12F7FF57000F45FE /* BookmarksController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BookmarksController.h; sourceTree = "<group>"; };
- 26376A8B12F7FF57000F45FE /* BookmarksController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BookmarksController.m; sourceTree = "<group>"; };
- 26376BAC12F820D7000F45FE /* BookmarksWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BookmarksWindow.xib; sourceTree = "<group>"; };
- 2639E20512F2ADEE00699678 /* coordinates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = coordinates.h; sourceTree = "<group>"; };
- 264C344112F0987E00D11246 /* gui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gui.h; sourceTree = "<group>"; };
- 265F30A712D6637E0048B600 /* NetSurf-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "NetSurf-Info.plist"; sourceTree = "<group>"; };
- 265F30AB12D6637E0048B600 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = "<group>"; };
- 265F311912D663F50048B600 /* gui.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = gui.m; sourceTree = "<group>"; };
- 265F314712D666660048B600 /* plotter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = plotter.m; sourceTree = "<group>"; };
- 265F316112D667E10048B600 /* schedule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = schedule.m; sourceTree = "<group>"; };
- 265F316612D668130048B600 /* thumbnail.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = thumbnail.m; sourceTree = "<group>"; };
- 265F316F12D668790048B600 /* fetch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = fetch.m; sourceTree = "<group>"; };
- 265F319012D668DB0048B600 /* url.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = url.m; sourceTree = "<group>"; };
- 265F31C412D66A0D0048B600 /* save.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = save.m; sourceTree = "<group>"; };
- 265F31CA12D66A890048B600 /* bitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bitmap.h; sourceTree = "<group>"; };
- 265F31CB12D66A890048B600 /* bmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bmp.c; sourceTree = "<group>"; };
- 265F31CC12D66A890048B600 /* bmp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bmp.h; sourceTree = "<group>"; };
- 265F31CD12D66A890048B600 /* gif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gif.c; sourceTree = "<group>"; };
- 265F31CE12D66A890048B600 /* gif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gif.h; sourceTree = "<group>"; };
- 265F31CF12D66A890048B600 /* ico.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ico.c; sourceTree = "<group>"; };
- 265F31D012D66A890048B600 /* ico.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ico.h; sourceTree = "<group>"; };
- 265F31D112D66A890048B600 /* jpeg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = jpeg.c; sourceTree = "<group>"; };
- 265F31D212D66A890048B600 /* jpeg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jpeg.h; sourceTree = "<group>"; };
- 265F31D312D66A890048B600 /* mng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mng.c; sourceTree = "<group>"; };
- 265F31D412D66A890048B600 /* mng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mng.h; sourceTree = "<group>"; };
- 265F31D512D66A890048B600 /* nssprite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nssprite.c; sourceTree = "<group>"; };
- 265F31D612D66A890048B600 /* nssprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nssprite.h; sourceTree = "<group>"; };
- 265F31D712D66A890048B600 /* png.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = png.c; sourceTree = "<group>"; };
- 265F31D812D66A890048B600 /* png.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = png.h; sourceTree = "<group>"; };
- 265F31D912D66A890048B600 /* rsvg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rsvg.c; sourceTree = "<group>"; };
- 265F31DA12D66A890048B600 /* rsvg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rsvg.h; sourceTree = "<group>"; };
- 265F31DB12D66A890048B600 /* svg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = svg.c; sourceTree = "<group>"; };
- 265F31DC12D66A890048B600 /* svg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svg.h; sourceTree = "<group>"; };
- 265F31DD12D66A890048B600 /* webp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = webp.c; sourceTree = "<group>"; };
- 265F31DE12D66A890048B600 /* webp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = webp.h; sourceTree = "<group>"; };
- 265F31EB12D66B190048B600 /* bitmap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = bitmap.m; sourceTree = "<group>"; };
- 265F320512D66C200048B600 /* utf8.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = utf8.m; sourceTree = "<group>"; };
- 265F321312D66CD90048B600 /* utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = utils.m; sourceTree = "<group>"; };
- 265F321E12D66D510048B600 /* font.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = font.m; sourceTree = "<group>"; };
- 2666DC5B12F6D1770045E8B6 /* SearchWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SearchWindow.xib; sourceTree = "<group>"; };
- 2666DC5D12F6D2E70045E8B6 /* SearchWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchWindowController.h; sourceTree = "<group>"; };
- 2666DC5E12F6D2E70045E8B6 /* SearchWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchWindowController.m; sourceTree = "<group>"; };
- 2666DD5012F706BC0045E8B6 /* BrowserWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BrowserWindow.h; sourceTree = "<group>"; };
- 2666DD5112F706BC0045E8B6 /* BrowserWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BrowserWindow.m; sourceTree = "<group>"; };
- 2684028E1301848100850DA2 /* HomeTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = HomeTemplate.pdf; sourceTree = "<group>"; };
- 26ABD61C12F02EB900407161 /* overflowImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = overflowImage.png; sourceTree = "<group>"; };
- 26ABD61D12F02EB900407161 /* overflowImagePressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = overflowImagePressed.png; sourceTree = "<group>"; };
- 26ABD61E12F02EB900407161 /* pi.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = pi.png; sourceTree = "<group>"; };
- 26AFE63E12DDEB0A005AD082 /* NetSurf.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = NetSurf.icns; sourceTree = "<group>"; };
- 26AFE8E212DF4200005AD082 /* ScrollableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollableView.h; sourceTree = "<group>"; };
- 26AFE8E312DF4200005AD082 /* ScrollableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScrollableView.m; sourceTree = "<group>"; };
- 26AFE97A12DF514C005AD082 /* NetSurfAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetSurfAppDelegate.h; sourceTree = "<group>"; };
- 26AFE97B12DF514C005AD082 /* NetSurfAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetSurfAppDelegate.m; sourceTree = "<group>"; };
- 26AFEAE912E04253005AD082 /* DownloadWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadWindowController.h; sourceTree = "<group>"; };
- 26AFEAEA12E04253005AD082 /* DownloadWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DownloadWindowController.m; sourceTree = "<group>"; };
- 26AFEAF012E042F9005AD082 /* DownloadWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DownloadWindow.xib; sourceTree = "<group>"; };
- 26AFED0312E09916005AD082 /* selection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = selection.m; sourceTree = "<group>"; };
- 26B4E91A130D351F0003B527 /* ArrowBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrowBox.h; sourceTree = "<group>"; };
- 26B4E91B130D351F0003B527 /* ArrowBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ArrowBox.m; sourceTree = "<group>"; };
- 26B4E91C130D351F0003B527 /* ArrowWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrowWindow.h; sourceTree = "<group>"; };
- 26B4E91D130D351F0003B527 /* ArrowWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ArrowWindow.m; sourceTree = "<group>"; };
- 26B4E91E130D351F0003B527 /* BlackScroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlackScroller.h; sourceTree = "<group>"; };
- 26B4E91F130D351F0003B527 /* BlackScroller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlackScroller.m; sourceTree = "<group>"; };
- 26B4E926130D36A90003B527 /* LocalHistoryPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LocalHistoryPanel.xib; sourceTree = "<group>"; };
- 26B4E928130D37E50003B527 /* LocalHistoryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalHistoryController.h; sourceTree = "<group>"; };
- 26B4E929130D37E50003B527 /* LocalHistoryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocalHistoryController.m; sourceTree = "<group>"; };
- 26BA25AB1321653200AEC1DA /* apple_image.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = apple_image.m; sourceTree = "<group>"; };
- 26BA25AC1321653200AEC1DA /* apple_image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = apple_image.h; sourceTree = "<group>"; };
- 26CDCEB312E702D8004FC66B /* NSBezierPath_AMShading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSBezierPath_AMShading.h; sourceTree = "<group>"; };
- 26CDCEB412E702D8004FC66B /* NSBezierPath_AMShading.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSBezierPath_AMShading.m; sourceTree = "<group>"; };
- 26CDCEB512E702D8004FC66B /* NSString_AITruncation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSString_AITruncation.h; sourceTree = "<group>"; };
- 26CDCEB612E702D8004FC66B /* NSString_AITruncation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSString_AITruncation.m; sourceTree = "<group>"; };
- 26CDCEBD12E702D8004FC66B /* PSMOverflowPopUpButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMOverflowPopUpButton.h; sourceTree = "<group>"; };
- 26CDCEBE12E702D8004FC66B /* PSMOverflowPopUpButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMOverflowPopUpButton.m; sourceTree = "<group>"; };
- 26CDCEBF12E702D8004FC66B /* PSMProgressIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMProgressIndicator.h; sourceTree = "<group>"; };
- 26CDCEC012E702D8004FC66B /* PSMProgressIndicator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMProgressIndicator.m; sourceTree = "<group>"; };
- 26CDCEC112E702D8004FC66B /* PSMRolloverButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMRolloverButton.h; sourceTree = "<group>"; };
- 26CDCEC212E702D8004FC66B /* PSMRolloverButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMRolloverButton.m; sourceTree = "<group>"; };
- 26CDCEC312E702D8004FC66B /* PSMTabBarCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabBarCell.h; sourceTree = "<group>"; };
- 26CDCEC412E702D8004FC66B /* PSMTabBarCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMTabBarCell.m; sourceTree = "<group>"; };
- 26CDCEC512E702D8004FC66B /* PSMTabBarControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabBarControl.h; sourceTree = "<group>"; };
- 26CDCEC612E702D8004FC66B /* PSMTabBarControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMTabBarControl.m; sourceTree = "<group>"; };
- 26CDCEC712E702D8004FC66B /* PSMTabBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabBarController.h; sourceTree = "<group>"; };
- 26CDCEC812E702D8004FC66B /* PSMTabBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMTabBarController.m; sourceTree = "<group>"; };
- 26CDCEC912E702D8004FC66B /* PSMTabDragAssistant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabDragAssistant.h; sourceTree = "<group>"; };
- 26CDCECA12E702D8004FC66B /* PSMTabDragAssistant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMTabDragAssistant.m; sourceTree = "<group>"; };
- 26CDCECB12E702D8004FC66B /* PSMTabDragView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabDragView.h; sourceTree = "<group>"; };
- 26CDCECC12E702D8004FC66B /* PSMTabDragView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMTabDragView.m; sourceTree = "<group>"; };
- 26CDCECD12E702D8004FC66B /* PSMTabDragWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabDragWindow.h; sourceTree = "<group>"; };
- 26CDCECE12E702D8004FC66B /* PSMTabDragWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMTabDragWindow.m; sourceTree = "<group>"; };
- 26CDCECF12E702D8004FC66B /* PSMTabDragWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabDragWindowController.h; sourceTree = "<group>"; };
- 26CDCED012E702D8004FC66B /* PSMTabDragWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMTabDragWindowController.m; sourceTree = "<group>"; };
- 26CDCED112E702D8004FC66B /* PSMTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabStyle.h; sourceTree = "<group>"; };
- 26CDCED212E702D8004FC66B /* PSMUnifiedTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMUnifiedTabStyle.h; sourceTree = "<group>"; };
- 26CDCED312E702D8004FC66B /* PSMUnifiedTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMUnifiedTabStyle.m; sourceTree = "<group>"; };
- 26CDCFDC12E706FE004FC66B /* AquaTabClose_Front.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AquaTabClose_Front.png; sourceTree = "<group>"; };
- 26CDCFDD12E706FF004FC66B /* AquaTabClose_Front_Pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AquaTabClose_Front_Pressed.png; sourceTree = "<group>"; };
- 26CDCFDE12E706FF004FC66B /* AquaTabClose_Front_Rollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AquaTabClose_Front_Rollover.png; sourceTree = "<group>"; };
- 26CDCFDF12E706FF004FC66B /* AquaTabCloseDirty_Front.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AquaTabCloseDirty_Front.png; sourceTree = "<group>"; };
- 26CDCFE012E706FF004FC66B /* AquaTabCloseDirty_Front_Pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AquaTabCloseDirty_Front_Pressed.png; sourceTree = "<group>"; };
- 26CDCFE112E706FF004FC66B /* AquaTabCloseDirty_Front_Rollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AquaTabCloseDirty_Front_Rollover.png; sourceTree = "<group>"; };
- 26CDCFE212E706FF004FC66B /* AquaTabNew.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AquaTabNew.png; sourceTree = "<group>"; };
- 26CDCFE312E706FF004FC66B /* AquaTabNewPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AquaTabNewPressed.png; sourceTree = "<group>"; };
- 26CDCFE412E706FF004FC66B /* AquaTabNewRollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AquaTabNewRollover.png; sourceTree = "<group>"; };
- 26CDCFF212E70AD1004FC66B /* BrowserWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BrowserWindow.xib; sourceTree = "<group>"; };
- 26CDD00112E70F56004FC66B /* BrowserWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BrowserWindowController.h; sourceTree = "<group>"; };
- 26CDD00212E70F56004FC66B /* BrowserWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BrowserWindowController.m; sourceTree = "<group>"; };
- 26CDD0F412E726E0004FC66B /* BrowserViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BrowserViewController.h; sourceTree = "<group>"; };
- 26CDD0F512E726E0004FC66B /* BrowserViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BrowserViewController.m; sourceTree = "<group>"; };
- 26E7A22B131FEBA8005B5B6A /* about.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = about.c; sourceTree = "<group>"; };
- 26E7A22C131FEBA8005B5B6A /* about.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = about.h; sourceTree = "<group>"; };
- 26E7A22D131FEBA8005B5B6A /* resource.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = resource.c; sourceTree = "<group>"; };
- 26E7A22E131FEBA8005B5B6A /* resource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resource.h; sourceTree = "<group>"; };
- 26EC3B6812ED62C0000A960C /* URLFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLFieldCell.h; sourceTree = "<group>"; };
- 26EC3B6912ED62C0000A960C /* URLFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = URLFieldCell.m; sourceTree = "<group>"; };
- 26EC3C4212ED8202000A960C /* HistoryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryView.h; sourceTree = "<group>"; };
- 26EC3C4312ED8202000A960C /* HistoryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HistoryView.m; sourceTree = "<group>"; };
- 26EC3F1612EF0CBD000A960C /* FormSelectMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormSelectMenu.h; sourceTree = "<group>"; };
- 26EC3F1712EF0CBD000A960C /* FormSelectMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FormSelectMenu.m; sourceTree = "<group>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXGroup section */
- 19C28FACFE9D520D11CA2CBB /* Products */ = {
- isa = PBXGroup;
- children = (
- 2636299412F699250048542C /* NetSurf.app */,
- );
- name = Products;
- sourceTree = "<group>";
- };
- 260F1F6212D620E800D9B07F /* content */ = {
- isa = PBXGroup;
- children = (
- 260F1F6312D620E800D9B07F /* content.c */,
- 260F1F6412D620E800D9B07F /* content.h */,
- 260F1F6512D620E800D9B07F /* content_protected.h */,
- 260F1F6612D620E800D9B07F /* content_type.h */,
- 260F1F6712D620E800D9B07F /* dirlist.c */,
- 260F1F6812D620E800D9B07F /* dirlist.h */,
- 260F1F6912D620E800D9B07F /* fetch.c */,
- 260F1F6A12D620E800D9B07F /* fetch.h */,
- 260F1F6B12D620E800D9B07F /* fetchers */,
- 260F1F7212D620E800D9B07F /* hlcache.c */,
- 260F1F7312D620E800D9B07F /* hlcache.h */,
- 260F1F7412D620E800D9B07F /* llcache.c */,
- 260F1F7512D620E800D9B07F /* llcache.h */,
- 260F1F7612D620E800D9B07F /* urldb.c */,
- 260F1F7712D620E800D9B07F /* urldb.h */,
- );
- name = content;
- path = ../content;
- sourceTree = SOURCE_ROOT;
- };
- 260F1F6B12D620E800D9B07F /* fetchers */ = {
- isa = PBXGroup;
- children = (
- 26E7A22B131FEBA8005B5B6A /* about.c */,
- 26E7A22C131FEBA8005B5B6A /* about.h */,
- 26E7A22D131FEBA8005B5B6A /* resource.c */,
- 26E7A22E131FEBA8005B5B6A /* resource.h */,
- 260F1F6C12D620E800D9B07F /* curl.c */,
- 260F1F6D12D620E800D9B07F /* curl.h */,
- 260F1F6E12D620E800D9B07F /* data.c */,
- 260F1F6F12D620E800D9B07F /* data.h */,
- 260F1F7012D620E800D9B07F /* file.c */,
- 260F1F7112D620E800D9B07F /* file.h */,
- );
- path = fetchers;
- sourceTree = "<group>";
- };
- 260F1F7812D620E800D9B07F /* css */ = {
- isa = PBXGroup;
- children = (
- 260F1F7912D620E800D9B07F /* css.c */,
- 260F1F7A12D620E800D9B07F /* css.h */,
- 260F1F7B12D620E800D9B07F /* dump.c */,
- 260F1F7C12D620E800D9B07F /* dump.h */,
- 260F1F7D12D620E800D9B07F /* internal.c */,
- 260F1F7E12D620E800D9B07F /* internal.h */,
- 260F1F7F12D620E800D9B07F /* select.c */,
- 260F1F8012D620E800D9B07F /* select.h */,
- 260F1F8112D620E800D9B07F /* utils.c */,
- 260F1F8212D620E800D9B07F /* utils.h */,
- );
- name = css;
- path = ../css;
- sourceTree = SOURCE_ROOT;
- };
- 260F1F8312D620E800D9B07F /* desktop */ = {
- isa = PBXGroup;
- children = (
- 260F1F8412D620E800D9B07F /* 401login.h */,
- 260F1F8512D620E800D9B07F /* browser.c */,
- 260F1F8612D620E800D9B07F /* browser.h */,
- 260F1F8712D620E800D9B07F /* cookies.c */,
- 260F1F8812D620E800D9B07F /* cookies_old.h */,
- 260F1F8912D620E800D9B07F /* download.c */,
- 260F1F8A12D620E800D9B07F /* download.h */,
- 260F1F8B12D620E800D9B07F /* frames.c */,
- 260F1F8C12D620E800D9B07F /* frames.h */,
- 260F1F8D12D620E800D9B07F /* gui.h */,
- 260F1F8E12D620E800D9B07F /* local_history.c */,
- 260F1F8F12D620E800D9B07F /* local_history.h */,
- 260F1F9012D620E800D9B07F /* history_global_core.c */,
- 260F1F9112D620E800D9B07F /* history_global_core.h */,
- 260F1F9212D620E800D9B07F /* hotlist.c */,
- 260F1F9312D620E800D9B07F /* hotlist.h */,
- 260F1F9412D620E800D9B07F /* knockout.c */,
- 260F1F9512D620E800D9B07F /* knockout.h */,
- 260F1F9612D620E800D9B07F /* mouse.c */,
- 260F1F9712D620E800D9B07F /* mouse.h */,
- 260F1F9812D620E800D9B07F /* netsurf.c */,
- 260F1F9912D620E800D9B07F /* netsurf.h */,
- 260F1F9A12D620E800D9B07F /* options.c */,
- 260F1F9B12D620E800D9B07F /* options.h */,
- 260F1F9C12D620E800D9B07F /* plot_style.c */,
- 260F1F9D12D620E800D9B07F /* plot_style.h */,
- 260F1F9E12D620E800D9B07F /* plotters.h */,
- 260F1F9F12D620E800D9B07F /* print.c */,
- 260F1FA012D620E800D9B07F /* print.h */,
- 260F1FA112D620E800D9B07F /* printer.h */,
- 260F1FA212D620E800D9B07F /* save_complete.c */,
- 260F1FA312D620E800D9B07F /* save_complete.h */,
- 260F1FA412D620E800D9B07F /* save_pdf */,
- 260F1FAA12D620E800D9B07F /* save_text.c */,
- 260F1FAB12D620E800D9B07F /* save_text.h */,
- 260F1FAC12D620E800D9B07F /* scroll.c */,
- 260F1FAD12D620E800D9B07F /* scroll.h */,
- 260F1FAE12D620E800D9B07F /* search.c */,
- 260F1FAF12D620E800D9B07F /* search.h */,
- 260F1FB012D620E800D9B07F /* searchweb.c */,
- 260F1FB112D620E800D9B07F /* searchweb.h */,
- 260F1FB212D620E800D9B07F /* selection.c */,
- 260F1FB312D620E800D9B07F /* selection.h */,
- 260F1FB412D620E800D9B07F /* sslcert.c */,
- 260F1FB512D620E800D9B07F /* sslcert.h */,
- 260F1FB612D620E800D9B07F /* textarea.c */,
- 260F1FB712D620E800D9B07F /* textarea.h */,
- 260F1FB812D620E800D9B07F /* textinput.c */,
- 260F1FB912D620E800D9B07F /* textinput.h */,
- 260F1FBA12D620E800D9B07F /* tree.c */,
- 260F1FBB12D620E800D9B07F /* tree.h */,
- 260F1FBC12D620E800D9B07F /* tree_url_node.c */,
- 260F1FBD12D620E800D9B07F /* tree_url_node.h */,
- 260F1FBE12D620E800D9B07F /* version.c */,
- );
- name = desktop;
- path = ../desktop;
- sourceTree = SOURCE_ROOT;
- };
- 260F1FA412D620E800D9B07F /* save_pdf */ = {
- isa = PBXGroup;
- children = (
- 260F1FA512D620E800D9B07F /* font_haru.c */,
- 260F1FA612D620E800D9B07F /* font_haru.h */,
- 260F1FA712D620E800D9B07F /* pdf_plotters.c */,
- 260F1FA812D620E800D9B07F /* pdf_plotters.h */,
- );
- path = save_pdf;
- sourceTree = "<group>";
- };
- 260F1FC612D620E800D9B07F /* render */ = {
- isa = PBXGroup;
- children = (
- 260F1FC712D620E800D9B07F /* box.c */,
- 260F1FC812D620E800D9B07F /* box.h */,
- 260F1FC912D620E800D9B07F /* box_construct.c */,
- 260F1FCA12D620E800D9B07F /* box_normalise.c */,
- 260F1FCB12D620E800D9B07F /* favicon.c */,
- 260F1FCC12D620E800D9B07F /* favicon.h */,
- 260F1FCD12D620E800D9B07F /* font.c */,
- 260F1FCE12D620E800D9B07F /* font.h */,
- 260F1FCF12D620E800D9B07F /* form.c */,
- 260F1FD012D620E800D9B07F /* form.h */,
- 260F1FD112D620E800D9B07F /* html.c */,
- 260F1FD212D620E800D9B07F /* html.h */,
- 260F1FD312D620E800D9B07F /* html_interaction.c */,
- 260F1FD412D620E800D9B07F /* html_redraw.c */,
- 260F1FD512D620E800D9B07F /* hubbub_binding.c */,
- 260F1FD612D620E800D9B07F /* imagemap.c */,
- 260F1FD712D620E800D9B07F /* imagemap.h */,
- 260F1FD812D620E800D9B07F /* layout.c */,
- 260F1FD912D620E800D9B07F /* layout.h */,
- 260F1FDA12D620E800D9B07F /* list.c */,
- 260F1FDB12D620E800D9B07F /* list.h */,
- 260F1FDC12D620E800D9B07F /* parser_binding.h */,
- 260F1FDD12D620E800D9B07F /* table.c */,
- 260F1FDE12D620E800D9B07F /* table.h */,
- 260F1FE012D620E800D9B07F /* textplain.c */,
- 260F1FE112D620E800D9B07F /* textplain.h */,
- );
- name = render;
- path = ../render;
- sourceTree = SOURCE_ROOT;
- };
- 260F1FE212D620E800D9B07F /* utils */ = {
- isa = PBXGroup;
- children = (
- 260F1FE312D620E800D9B07F /* base64.c */,
- 260F1FE412D620E800D9B07F /* base64.h */,
- 260F1FE512D620E800D9B07F /* config.h */,
- 260F1FE612D620E800D9B07F /* container.c */,
- 260F1FE712D620E800D9B07F /* container.h */,
- 260F1FE812D620E800D9B07F /* errors.h */,
- 260F1FE912D620E800D9B07F /* filename.c */,
- 260F1FEA12D620E800D9B07F /* filename.h */,
- 260F1FEB12D620E800D9B07F /* resource.c */,
- 260F1FEC12D620E800D9B07F /* resource.h */,
- 260F1FED12D620E800D9B07F /* hashtable.c */,
- 260F1FEE12D620E800D9B07F /* hashtable.h */,
- 260F1FEF12D620E800D9B07F /* http.c */,
- 260F1FF012D620E800D9B07F /* http.h */,
- 260F1FF112D620E800D9B07F /* locale.c */,
- 260F1FF212D620E800D9B07F /* locale.h */,
- 260F1FF312D620E800D9B07F /* log.c */,
- 260F1FF412D620E800D9B07F /* log.h */,
- 260F1FF612D620E800D9B07F /* memdebug.c */,
- 260F1FF712D620E800D9B07F /* memdebug.h */,
- 260F1FF812D620E800D9B07F /* messages.c */,
- 260F1FF912D620E800D9B07F /* messages.h */,
- 260F1FFA12D620E800D9B07F /* ring.h */,
- 260F1FFB12D620E800D9B07F /* talloc.c */,
- 260F1FFC12D620E800D9B07F /* talloc.h */,
- 260F1FFF12D620E800D9B07F /* url.c */,
- 260F200012D620E800D9B07F /* url.h */,
- 260F200112D620E800D9B07F /* useragent.c */,
- 260F200212D620E800D9B07F /* useragent.h */,
- 260F200312D620E800D9B07F /* utf8.c */,
- 260F200412D620E800D9B07F /* utf8.h */,
- 260F200512D620E800D9B07F /* utils.c */,
- 260F200612D620E800D9B07F /* utils.h */,
- 260F200712D620E800D9B07F /* utsname.h */,
- );
- name = utils;
- path = ../utils;
- sourceTree = SOURCE_ROOT;
- };
- 261DB24E1318443500C59F12 /* Tools */ = {
- isa = PBXGroup;
- children = (
- 261DB24F1318444F00C59F12 /* compile-xib.sh */,
- 261DB2501318444F00C59F12 /* extract-strings.sh */,
- );
- name = Tools;
- sourceTree = "<group>";
- };
- 263629B212F69A080048542C /* Makefiles */ = {
- isa = PBXGroup;
- children = (
- 263629BC12F69A760048542C /* Makefile */,
- 263629B712F69A3C0048542C /* Makefile.target */,
- 263629B312F69A290048542C /* Makefile.config */,
- 263629B412F69A290048542C /* Makefile.defaults */,
- 263629B512F69A290048542C /* Makefile.resources */,
- 263629B612F69A290048542C /* Makefile.sources */,
- );
- name = Makefiles;
- sourceTree = "<group>";
- };
- 263769A812F7EBC3000F45FE /* Tree View */ = {
- isa = PBXGroup;
- children = (
- 2622F1D512DCD84600CD5A62 /* TreeView.h */,
- 2622F1D612DCD84600CD5A62 /* TreeView.m */,
- 263769A912F7EBE2000F45FE /* Tree.h */,
- 263769AA12F7EBE2000F45FE /* Tree.m */,
- );
- name = "Tree View";
- sourceTree = "<group>";
- };
- 26376A8C12F7FF5A000F45FE /* Bookmarks */ = {
- isa = PBXGroup;
- children = (
- 26376A8A12F7FF57000F45FE /* BookmarksController.h */,
- 26376A8B12F7FF57000F45FE /* BookmarksController.m */,
- );
- name = Bookmarks;
- sourceTree = "<group>";
- };
- 265F303F12D6637E0048B600 /* Cocoa Frontend */ = {
- isa = PBXGroup;
- children = (
- 26BA25AB1321653200AEC1DA /* apple_image.m */,
- 26BA25AC1321653200AEC1DA /* apple_image.h */,
- 26CDD26512E74402004FC66B /* Browser */,
- 26CDD26712E74453004FC66B /* Download */,
- 26CDD26612E7441E004FC66B /* Views */,
- 263769A812F7EBC3000F45FE /* Tree View */,
- 26376A8C12F7FF5A000F45FE /* Bookmarks */,
- 26CDD26812E74461004FC66B /* NSApplication */,
- 26CDD26912E7446E004FC66B /* Platform Interface */,
- 265F310F12D663C20048B600 /* Resources */,
- 26CDCEB212E702D8004FC66B /* PSMTabBarControl */,
- 265F30AB12D6637E0048B600 /* Prefix.pch */,
- 2625095112F72AA70090D236 /* PreferencesWindowController.h */,
- 2625095212F72AA70090D236 /* PreferencesWindowController.m */,
- 26376A4312F7FA86000F45FE /* HistoryWindowController.h */,
- 26376A4412F7FA86000F45FE /* HistoryWindowController.m */,
- );
- name = "Cocoa Frontend";
- sourceTree = "<group>";
- };
- 265F310F12D663C20048B600 /* Resources */ = {
- isa = PBXGroup;
- children = (
- 261DB28F13185C0A00C59F12 /* BookmarksWindow.xib.strings */,
- 261DB29313185C0A00C59F12 /* BrowserWindow.xib.strings */,
- 261DB29513185C0A00C59F12 /* DownloadWindow.xib.strings */,
- 261DB29713185C0A00C59F12 /* HistoryWindow.xib.strings */,
- 261DB29B13185C0A00C59F12 /* MainMenu.xib.strings */,
- 261DB29D13185C0A00C59F12 /* PreferencesWindow.xib.strings */,
- 261DB29F13185C0A00C59F12 /* SearchWindow.xib.strings */,
- 261DB22113180AFF00C59F12 /* Localizable.strings */,
- 2684028E1301848100850DA2 /* HomeTemplate.pdf */,
- 26AFE63E12DDEB0A005AD082 /* NetSurf.icns */,
- 2612268F12D7AE4100E10F91 /* Messages */,
- 2612265D12D7AD6800E10F91 /* adblock.css */,
- 2612265712D7ACB500E10F91 /* default.css */,
- 2612265912D7ACB500E10F91 /* quirks.css */,
- 265F30A712D6637E0048B600 /* NetSurf-Info.plist */,
- 26121DA812D700B800E10F91 /* MainMenu.xib */,
- 26121EAB12D70E0A00E10F91 /* Browser.xib */,
- 26AFEAF012E042F9005AD082 /* DownloadWindow.xib */,
- 26CDCFF212E70AD1004FC66B /* BrowserWindow.xib */,
- 2666DC5B12F6D1770045E8B6 /* SearchWindow.xib */,
- 2625095012F72A8F0090D236 /* PreferencesWindow.xib */,
- 26376A4112F7FA67000F45FE /* HistoryWindow.xib */,
- 26376BAC12F820D7000F45FE /* BookmarksWindow.xib */,
- 26B4E926130D36A90003B527 /* LocalHistoryPanel.xib */,
- );
- name = Resources;
- path = res;
- sourceTree = "<group>";
- };
- 265F31C912D66A890048B600 /* image */ = {
- isa = PBXGroup;
- children = (
- 265F31CA12D66A890048B600 /* bitmap.h */,
- 265F31CB12D66A890048B600 /* bmp.c */,
- 265F31CC12D66A890048B600 /* bmp.h */,
- 265F31CD12D66A890048B600 /* gif.c */,
- 265F31CE12D66A890048B600 /* gif.h */,
- 265F31CF12D66A890048B600 /* ico.c */,
- 265F31D012D66A890048B600 /* ico.h */,
- 265F31D112D66A890048B600 /* jpeg.c */,
- 265F31D212D66A890048B600 /* jpeg.h */,
- 265F31D312D66A890048B600 /* mng.c */,
- 265F31D412D66A890048B600 /* mng.h */,
- 265F31D512D66A890048B600 /* nssprite.c */,
- 265F31D612D66A890048B600 /* nssprite.h */,
- 265F31D712D66A890048B600 /* png.c */,
- 265F31D812D66A890048B600 /* png.h */,
- 265F31D912D66A890048B600 /* rsvg.c */,
- 265F31DA12D66A890048B600 /* rsvg.h */,
- 265F31DB12D66A890048B600 /* svg.c */,
- 265F31DC12D66A890048B600 /* svg.h */,
- 265F31DD12D66A890048B600 /* webp.c */,
- 265F31DE12D66A890048B600 /* webp.h */,
- );
- name = image;
- path = ../image;
- sourceTree = SOURCE_ROOT;
- };
- 26CDCEB212E702D8004FC66B /* PSMTabBarControl */ = {
- isa = PBXGroup;
- children = (
- 26CDCFDB12E706FE004FC66B /* Images */,
- 26CDCEB312E702D8004FC66B /* NSBezierPath_AMShading.h */,
- 26CDCEB412E702D8004FC66B /* NSBezierPath_AMShading.m */,
- 26CDCEB512E702D8004FC66B /* NSString_AITruncation.h */,
- 26CDCEB612E702D8004FC66B /* NSString_AITruncation.m */,
- 26CDCEBD12E702D8004FC66B /* PSMOverflowPopUpButton.h */,
- 26CDCEBE12E702D8004FC66B /* PSMOverflowPopUpButton.m */,
- 26CDCEBF12E702D8004FC66B /* PSMProgressIndicator.h */,
- 26CDCEC012E702D8004FC66B /* PSMProgressIndicator.m */,
- 26CDCEC112E702D8004FC66B /* PSMRolloverButton.h */,
- 26CDCEC212E702D8004FC66B /* PSMRolloverButton.m */,
- 26CDCEC312E702D8004FC66B /* PSMTabBarCell.h */,
- 26CDCEC412E702D8004FC66B /* PSMTabBarCell.m */,
- 26CDCEC512E702D8004FC66B /* PSMTabBarControl.h */,
- 26CDCEC612E702D8004FC66B /* PSMTabBarControl.m */,
- 26CDCEC712E702D8004FC66B /* PSMTabBarController.h */,
- 26CDCEC812E702D8004FC66B /* PSMTabBarController.m */,
- 26CDCEC912E702D8004FC66B /* PSMTabDragAssistant.h */,
- 26CDCECA12E702D8004FC66B /* PSMTabDragAssistant.m */,
- 26CDCECB12E702D8004FC66B /* PSMTabDragView.h */,
- 26CDCECC12E702D8004FC66B /* PSMTabDragView.m */,
- 26CDCECD12E702D8004FC66B /* PSMTabDragWindow.h */,
- 26CDCECE12E702D8004FC66B /* PSMTabDragWindow.m */,
- 26CDCECF12E702D8004FC66B /* PSMTabDragWindowController.h */,
- 26CDCED012E702D8004FC66B /* PSMTabDragWindowController.m */,
- 26CDCED112E702D8004FC66B /* PSMTabStyle.h */,
- 26CDCED212E702D8004FC66B /* PSMUnifiedTabStyle.h */,
- 26CDCED312E702D8004FC66B /* PSMUnifiedTabStyle.m */,
- );
- path = PSMTabBarControl;
- sourceTree = "<group>";
- };
- 26CDCFDB12E706FE004FC66B /* Images */ = {
- isa = PBXGroup;
- children = (
- 26ABD61C12F02EB900407161 /* overflowImage.png */,
- 26ABD61D12F02EB900407161 /* overflowImagePressed.png */,
- 26ABD61E12F02EB900407161 /* pi.png */,
- 26CDCFDC12E706FE004FC66B /* AquaTabClose_Front.png */,
- 26CDCFDD12E706FF004FC66B /* AquaTabClose_Front_Pressed.png */,
- 26CDCFDE12E706FF004FC66B /* AquaTabClose_Front_Rollover.png */,
- 26CDCFDF12E706FF004FC66B /* AquaTabCloseDirty_Front.png */,
- 26CDCFE012E706FF004FC66B /* AquaTabCloseDirty_Front_Pressed.png */,
- 26CDCFE112E706FF004FC66B /* AquaTabCloseDirty_Front_Rollover.png */,
- 26CDCFE212E706FF004FC66B /* AquaTabNew.png */,
- 26CDCFE312E706FF004FC66B /* AquaTabNewPressed.png */,
- 26CDCFE412E706FF004FC66B /* AquaTabNewRollover.png */,
- );
- path = Images;
- sourceTree = "<group>";
- };
- 26CDD23E12E743A3004FC66B /* NetSurf */ = {
- isa = PBXGroup;
- children = (
- 260F1F6212D620E800D9B07F /* content */,
- 260F1F7812D620E800D9B07F /* css */,
- 260F1F8312D620E800D9B07F /* desktop */,
- 260F1FC612D620E800D9B07F /* render */,
- 265F31C912D66A890048B600 /* image */,
- 260F1FE212D620E800D9B07F /* utils */,
- );
- name = NetSurf;
- sourceTree = "<group>";
- };
- 26CDD26512E74402004FC66B /* Browser */ = {
- isa = PBXGroup;
- children = (
- 26121EFB12D7132100E10F91 /* BrowserView.h */,
- 26121EFC12D7132100E10F91 /* BrowserView.m */,
- 26CDD00112E70F56004FC66B /* BrowserWindowController.h */,
- 26CDD00212E70F56004FC66B /* BrowserWindowController.m */,
- 26CDD0F412E726E0004FC66B /* BrowserViewController.h */,
- 26CDD0F512E726E0004FC66B /* BrowserViewController.m */,
- 2666DC5D12F6D2E70045E8B6 /* SearchWindowController.h */,
- 2666DC5E12F6D2E70045E8B6 /* SearchWindowController.m */,
- 2666DD5012F706BC0045E8B6 /* BrowserWindow.h */,
- 2666DD5112F706BC0045E8B6 /* BrowserWindow.m */,
- 26B4E928130D37E50003B527 /* LocalHistoryController.h */,
- 26B4E929130D37E50003B527 /* LocalHistoryController.m */,
- );
- name = Browser;
- sourceTree = "<group>";
- };
- 26CDD26612E7441E004FC66B /* Views */ = {
- isa = PBXGroup;
- children = (
- 26B4E91A130D351F0003B527 /* ArrowBox.h */,
- 26B4E91B130D351F0003B527 /* ArrowBox.m */,
- 26B4E91C130D351F0003B527 /* ArrowWindow.h */,
- 26B4E91D130D351F0003B527 /* ArrowWindow.m */,
- 26B4E91E130D351F0003B527 /* BlackScroller.h */,
- 26B4E91F130D351F0003B527 /* BlackScroller.m */,
- 26AFE8E212DF4200005AD082 /* ScrollableView.h */,
- 26AFE8E312DF4200005AD082 /* ScrollableView.m */,
- 26EC3B6812ED62C0000A960C /* URLFieldCell.h */,
- 26EC3B6912ED62C0000A960C /* URLFieldCell.m */,
- 26EC3C4212ED8202000A960C /* HistoryView.h */,
- 26EC3C4312ED8202000A960C /* HistoryView.m */,
- 26EC3F1612EF0CBD000A960C /* FormSelectMenu.h */,
- 26EC3F1712EF0CBD000A960C /* FormSelectMenu.m */,
- );
- name = Views;
- sourceTree = "<group>";
- };
- 26CDD26712E74453004FC66B /* Download */ = {
- isa = PBXGroup;
- children = (
- 26AFEAE912E04253005AD082 /* DownloadWindowController.h */,
- 26AFEAEA12E04253005AD082 /* DownloadWindowController.m */,
- );
- name = Download;
- sourceTree = "<group>";
- };
- 26CDD26812E74461004FC66B /* NSApplication */ = {
- isa = PBXGroup;
- children = (
- 263629C812F69B120048542C /* NetsurfApp.h */,
- 263629C912F69B120048542C /* NetsurfApp.m */,
- 26AFE97A12DF514C005AD082 /* NetSurfAppDelegate.h */,
- 26AFE97B12DF514C005AD082 /* NetSurfAppDelegate.m */,
- );
- name = NSApplication;
- sourceTree = "<group>";
- };
- 26CDD26912E7446E004FC66B /* Platform Interface */ = {
- isa = PBXGroup;
- children = (
- 263629CA12F69B120048542C /* system_colour.m */,
- 264C344112F0987E00D11246 /* gui.h */,
- 265F311912D663F50048B600 /* gui.m */,
- 261223CB12D7805300E10F91 /* plotter.h */,
- 265F314712D666660048B600 /* plotter.m */,
- 265F316112D667E10048B600 /* schedule.m */,
- 265F316612D668130048B600 /* thumbnail.m */,
- 265F316F12D668790048B600 /* fetch.m */,
- 265F319012D668DB0048B600 /* url.m */,
- 265F31C412D66A0D0048B600 /* save.m */,
- 260FC03112D85ACE00079C00 /* bitmap.h */,
- 265F31EB12D66B190048B600 /* bitmap.m */,
- 265F320512D66C200048B600 /* utf8.m */,
- 265F321312D66CD90048B600 /* utils.m */,
- 261223B712D77F9C00E10F91 /* font.h */,
- 265F321E12D66D510048B600 /* font.m */,
- 26AFED0312E09916005AD082 /* selection.m */,
- 2639E20512F2ADEE00699678 /* coordinates.h */,
- );
- name = "Platform Interface";
- sourceTree = "<group>";
- };
- 29B97314FDCFA39411CA2CEA /* Untitled */ = {
- isa = PBXGroup;
- children = (
- 265F303F12D6637E0048B600 /* Cocoa Frontend */,
- 26CDD23E12E743A3004FC66B /* NetSurf */,
- 263629B212F69A080048542C /* Makefiles */,
- 261DB24E1318443500C59F12 /* Tools */,
- 19C28FACFE9D520D11CA2CBB /* Products */,
- );
- name = Untitled;
- sourceTree = "<group>";
- };
-/* End PBXGroup section */
-
-/* Begin PBXLegacyTarget section */
- 2636298F12F698E00048542C /* NetSurf */ = {
- isa = PBXLegacyTarget;
- buildArgumentsString = "$(ACTION) MKDIR=\"mkdir -p\"";
- buildConfigurationList = 2636299512F699250048542C /* Build configuration list for PBXLegacyTarget "NetSurf" */;
- buildPhases = (
- );
- buildToolPath = /usr/bin/make;
- buildWorkingDirectory = "$(SRCROOT)/..";
- dependencies = (
- );
- name = NetSurf;
- passBuildSettingsInEnvironment = 1;
- productName = NetSurf;
- };
-/* End PBXLegacyTarget section */
-
-/* Begin PBXProject section */
- 29B97313FDCFA39411CA2CEA /* Project object */ = {
- isa = PBXProject;
- attributes = {
- BuildIndependentTargetsInParallel = YES;
- };
- buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "NetSurf" */;
- compatibilityVersion = "Xcode 3.1";
- developmentRegion = English;
- hasScannedForEncodings = 1;
- knownRegions = (
- English,
- Japanese,
- French,
- German,
- de,
- en,
- fr,
- it,
- nl,
- );
- mainGroup = 29B97314FDCFA39411CA2CEA /* Untitled */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 2636298F12F698E00048542C /* NetSurf */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXVariantGroup section */
- 2612268F12D7AE4100E10F91 /* Messages */ = {
- isa = PBXVariantGroup;
- children = (
- 2612269012D7AE4100E10F91 /* de */,
- 2612269312D7AE9B00E10F91 /* nl */,
- 2612269412D7AEA800E10F91 /* en */,
- 2612269512D7AEB500E10F91 /* it */,
- 2612269612D7AEBE00E10F91 /* fr */,
- );
- name = Messages;
- sourceTree = "<group>";
- };
- 261DB22113180AFF00C59F12 /* Localizable.strings */ = {
- isa = PBXVariantGroup;
- children = (
- 261DB22213180AFF00C59F12 /* en */,
- 261DB22613180B4F00C59F12 /* de */,
- 261DB23313180CD600C59F12 /* fr */,
- 261DB23413180CE000C59F12 /* it */,
- 261DB23513180CEE00C59F12 /* nl */,
- );
- name = Localizable.strings;
- sourceTree = "<group>";
- };
- 261DB28F13185C0A00C59F12 /* BookmarksWindow.xib.strings */ = {
- isa = PBXVariantGroup;
- children = (
- 261DB29013185C0A00C59F12 /* de */,
- );
- name = BookmarksWindow.xib.strings;
- sourceTree = "<group>";
- };
- 261DB29313185C0A00C59F12 /* BrowserWindow.xib.strings */ = {
- isa = PBXVariantGroup;
- children = (
- 261DB29413185C0A00C59F12 /* de */,
- );
- name = BrowserWindow.xib.strings;
- sourceTree = "<group>";
- };
- 261DB29513185C0A00C59F12 /* DownloadWindow.xib.strings */ = {
- isa = PBXVariantGroup;
- children = (
- 261DB29613185C0A00C59F12 /* de */,
- );
- name = DownloadWindow.xib.strings;
- sourceTree = "<group>";
- };
- 261DB29713185C0A00C59F12 /* HistoryWindow.xib.strings */ = {
- isa = PBXVariantGroup;
- children = (
- 261DB29813185C0A00C59F12 /* de */,
- );
- name = HistoryWindow.xib.strings;
- sourceTree = "<group>";
- };
- 261DB29B13185C0A00C59F12 /* MainMenu.xib.strings */ = {
- isa = PBXVariantGroup;
- children = (
- 261DB29C13185C0A00C59F12 /* de */,
- );
- name = MainMenu.xib.strings;
- sourceTree = "<group>";
- };
- 261DB29D13185C0A00C59F12 /* PreferencesWindow.xib.strings */ = {
- isa = PBXVariantGroup;
- children = (
- 261DB29E13185C0A00C59F12 /* de */,
- );
- name = PreferencesWindow.xib.strings;
- sourceTree = "<group>";
- };
- 261DB29F13185C0A00C59F12 /* SearchWindow.xib.strings */ = {
- isa = PBXVariantGroup;
- children = (
- 261DB2A013185C0A00C59F12 /* de */,
- );
- name = SearchWindow.xib.strings;
- sourceTree = "<group>";
- };
-/* End PBXVariantGroup section */
-
-/* Begin XCBuildConfiguration section */
- 2636299012F698E10048542C /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- PRODUCT_NAME = NetSurf;
- };
- name = Debug;
- };
- 2636299112F698E10048542C /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- MKDIR = "mkdir -p";
- PRODUCT_NAME = NetSurf;
- };
- name = Release;
- };
- C01FCF4F08A954540054247B /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
- ONLY_ACTIVE_ARCH = YES;
- SDKROOT = macosx10.5;
- };
- name = Debug;
- };
- C01FCF5008A954540054247B /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
- ONLY_ACTIVE_ARCH = NO;
- SDKROOT = macosx10.5;
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 2636299512F699250048542C /* Build configuration list for PBXLegacyTarget "NetSurf" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 2636299012F698E10048542C /* Debug */,
- 2636299112F698E10048542C /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- C01FCF4E08A954540054247B /* Build configuration list for PBXProject "NetSurf" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- C01FCF4F08A954540054247B /* Debug */,
- C01FCF5008A954540054247B /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
-}
diff --git a/frontends/cocoa/NetSurfAppDelegate.h b/frontends/cocoa/NetSurfAppDelegate.h
deleted file mode 100644
index a22c4ceee..000000000
--- a/frontends/cocoa/NetSurfAppDelegate.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@class SearchWindowController;
-@class PreferencesWindowController;
-@class HistoryWindowController;
-
-@interface NetSurfAppDelegate : NSObject {
- SearchWindowController *search;
- PreferencesWindowController *preferences;
- HistoryWindowController *history;
-}
-
-@property (readwrite, retain, nonatomic) SearchWindowController *search;
-@property (readwrite, retain, nonatomic) PreferencesWindowController *preferences;
-@property (readwrite, retain, nonatomic) HistoryWindowController *history;
-
-- (IBAction) showSearchWindow: (id) sender;
-- (IBAction) searchForward: (id) sender;
-- (IBAction) searchBackward: (id) sender;
-
-- (IBAction) showPreferences: (id) sender;
-- (IBAction) showGlobalHistory: (id) sender;
-
-@end
diff --git a/frontends/cocoa/NetSurfAppDelegate.m b/frontends/cocoa/NetSurfAppDelegate.m
deleted file mode 100644
index 0939a1149..000000000
--- a/frontends/cocoa/NetSurfAppDelegate.m
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "utils/nsoption.h"
-#import "utils/messages.h"
-#import "utils/utils.h"
-#import "utils/nsurl.h"
-#import "netsurf/browser_window.h"
-
-#import "cocoa/gui.h"
-#import "cocoa/NetSurfAppDelegate.h"
-#import "cocoa/SearchWindowController.h"
-#import "cocoa/PreferencesWindowController.h"
-#import "cocoa/HistoryWindowController.h"
-
-
-@interface NetSurfAppDelegate ()
-
-- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
-
-@end
-
-
-@implementation NetSurfAppDelegate
-
-@synthesize history;
-@synthesize search;
-@synthesize preferences;
-
-- (void) newDocument: (id) sender;
-{
- nsurl *url;
- nserror error;
-
- if (nsoption_charp(homepage_url) != NULL) {
- error = nsurl_create(nsoption_charp(homepage_url), &url);
- } else {
- error = nsurl_create(NETSURF_HOMEPAGE, &url);
- }
-
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- cocoa_warning(messages_get_errorcode(error), 0);
- }
-}
-
-- (void) openDocument: (id) sender;
-{
- nsurl *u;
- nserror error;
-
- NSOpenPanel *openPanel = [NSOpenPanel openPanel];
- [openPanel setAllowsMultipleSelection: YES];
- if ([openPanel runModalForTypes: nil] == NSOKButton) {
- for (NSURL *url in [openPanel URLs]) {
- error = nsurl_create([[url absoluteString] UTF8String], &u);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- u,
- NULL,
- NULL,
- NULL);
- nsurl_unref(u);
- }
- if (error != NSERROR_OK) {
- cocoa_warning(messages_get_errorcode(error), 0);
- }
- }
- }
-}
-
-- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
-{
- nsurl *url;
- nserror error;
- NSString *urlAsString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
-
- error = nsurl_create([urlAsString UTF8String], &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- cocoa_warning(messages_get_errorcode(error), 0);
- }
-}
-
-- (IBAction) showSearchWindow: (id) sender;
-{
- if (search == nil) {
- [self setSearch: [[[SearchWindowController alloc] init] autorelease]];
- }
- [[search window] makeKeyAndOrderFront: self];
-}
-
-- (IBAction) searchForward: (id) sender;
-{
- [search search: SearchForward];
-}
-
-- (IBAction) searchBackward: (id) sender;
-{
- [search search: SearchBackward];
-}
-
-- (BOOL) validateMenuItem: (id) item;
-{
- SEL action = [item action];
-
- if (action == @selector( searchForward: )) {
- return [search canGoForward];
- } else if (action == @selector( searchBackward: )) {
- return [search canGoBack];
- }
-
- return YES;
-}
-
-- (IBAction) showPreferences: (id) sender;
-{
- if (preferences == nil) {
- [self setPreferences: [[[PreferencesWindowController alloc] init] autorelease]];
- }
- [preferences showWindow: sender];
-}
-
-- (IBAction) showGlobalHistory: (id) sender;
-{
- if (history == nil) {
- [self setHistory: [[[HistoryWindowController alloc] init] autorelease]];
- }
- [history showWindow: sender];
-}
-
-// Application delegate methods
-
-- (BOOL) applicationOpenUntitledFile: (NSApplication *)sender;
-{
- [self newDocument: self];
- return YES;
-}
-
--(void)applicationWillFinishLaunching:(NSNotification *)aNotification
-{
- NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
- [appleEventManager setEventHandler:self
- andSelector:@selector(handleGetURLEvent:withReplyEvent:)
- forEventClass:kInternetEventClass andEventID:kAEGetURL];
-}
-
-- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
-{
- nsurl *url;
- nserror error;
- NSURL *urltxt = [NSURL fileURLWithPath: filename];
-
- error = nsurl_create([[urltxt absoluteString] UTF8String], &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- cocoa_warning(messages_get_errorcode(error), 0);
- }
-
- return YES;
-}
-
-
-@end
diff --git a/frontends/cocoa/NetsurfApp.h b/frontends/cocoa/NetsurfApp.h
deleted file mode 100644
index 330f33826..000000000
--- a/frontends/cocoa/NetsurfApp.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-@class BrowserViewController;
-
-@interface NetSurfApp : NSApplication {
- BrowserViewController *frontTab;
-}
-
-@property (readwrite, assign, nonatomic) BrowserViewController *frontTab;
-
-@end
-
-NSString *cocoa_get_user_path( NSString *fileName );
diff --git a/frontends/cocoa/NetsurfApp.m b/frontends/cocoa/NetsurfApp.m
deleted file mode 100644
index 7d49e0b51..000000000
--- a/frontends/cocoa/NetsurfApp.m
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "cocoa/apple_image.h"
-#import "cocoa/NetsurfApp.h"
-#import "cocoa/gui.h"
-#import "cocoa/plotter.h"
-#import "cocoa/DownloadWindowController.h"
-#import "cocoa/SearchWindowController.h"
-#import "cocoa/selection.h"
-#import "cocoa/fetch.h"
-#import "cocoa/bitmap.h"
-#import "cocoa/font.h"
-
-#import "utils/filename.h"
-#import "utils/log.h"
-#import "utils/messages.h"
-#import "utils/utils.h"
-#import "utils/nsoption.h"
-#import "utils/nsurl.h"
-#import "netsurf/plotters.h"
-#import "netsurf/mouse.h"
-#import "netsurf/netsurf.h"
-#import "netsurf/browser_window.h"
-#import "netsurf/cookie_db.h"
-#import "netsurf/url_db.h"
-#import "desktop/save_complete.h"
-#import "cocoa/desktop-tree.h"
-
-#ifndef NETSURF_HOMEPAGE
-#define NETSURF_HOMEPAGE "http://www.netsurf-browser.org/welcome/"
-#endif
-
-@implementation NetSurfApp
-
-@synthesize frontTab;
-
-static bool cocoa_done = false;
-
-/**
- * Cause an abnormal program termination.
- *
- * \note This never returns and is intended to terminate without any cleanup.
- *
- * \param error The message to display to the user.
- */
-static void die(const char * const error)
-{
- [NSException raise: @"NetsurfDie" format: @"Error: %s", error];
-}
-
-- (void) loadOptions
-{
- NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- [defaults registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
- cocoa_get_user_path( @"Cookies" ),
- kCookiesFileOption,
- cocoa_get_user_path( @"URLs" ),
- kURLsFileOption,
- [NSString stringWithUTF8String: NETSURF_HOMEPAGE],
- kHomepageURLOption,
- nil]];
-
-
- nsoption_setnull_charp(cookie_file, strdup( [[defaults objectForKey: kCookiesFileOption] UTF8String] ));
-
- nsoption_setnull_charp(cookie_jar, strdup( nsoption_charp(cookie_file) ));
-
- nsoption_setnull_charp(homepage_url, strdup( [[defaults objectForKey: kHomepageURLOption] UTF8String] ));
-
- urldb_load( [[defaults objectForKey: kURLsFileOption] UTF8String] );
- urldb_load_cookies( nsoption_charp(cookie_file) );
-
- cocoa_update_scale_factor();
- LOG("done setup");
-}
-
-- (void) saveOptions
-{
- urldb_save_cookies( nsoption_charp(cookie_file) );
- urldb_save( [[[NSUserDefaults standardUserDefaults] objectForKey: kURLsFileOption] UTF8String] );
-}
-
-- (void) run
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- [self finishLaunching];
-
- [self loadOptions];
-
- while (!cocoa_done) {
- [pool release];
- pool = [[NSAutoreleasePool alloc] init];
-
- NSEvent *event =
- [self nextEventMatchingMask: NSAnyEventMask
- untilDate: [NSDate distantFuture]
- inMode: NSDefaultRunLoopMode
- dequeue: YES];
- if (nil != event) {
- [self sendEvent: event];
- [self updateWindows];
- }
-
- }
-
- [self saveOptions];
-
- [pool release];
-}
-
--(void) terminate: (id)sender
-{
- [[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationWillTerminateNotification object:self];
-
- cocoa_done = true;
- [self postEvent: [NSEvent otherEventWithType: NSApplicationDefined
- location: NSZeroPoint
- modifierFlags: 0
- timestamp: 0
- windowNumber: 0
- context: NULL
- subtype: 0
- data1: 0
- data2: 0]
- atStart: YES];
-}
-
-@end
-
-#pragma mark -
-
-static NSString *cocoa_get_preferences_path( void )
-{
- NSArray *paths = NSSearchPathForDirectoriesInDomains( NSApplicationSupportDirectory, NSUserDomainMask, YES );
- NSCAssert( [paths count] >= 1, @"Where is the application support directory?" );
-
- NSString *netsurfPath = [[paths objectAtIndex: 0] stringByAppendingPathComponent: @"NetSurf"];
-
- NSFileManager *fm = [NSFileManager defaultManager];
- BOOL isDirectory = NO;
- BOOL exists = [fm fileExistsAtPath: netsurfPath isDirectory: &isDirectory];
-
- if (!exists) {
- exists = [fm createDirectoryAtPath: netsurfPath withIntermediateDirectories: YES attributes: nil error: NULL];
- isDirectory = YES;
- }
- if (!(exists && isDirectory)) {
- die( "Cannot create netsurf preferences directory" );
- }
-
- return netsurfPath;
-}
-
-NSString *cocoa_get_user_path( NSString *fileName )
-{
- return [cocoa_get_preferences_path() stringByAppendingPathComponent: fileName];
-}
-
-static const char *cocoa_get_options_file( void )
-{
- NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- [defaults registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
- cocoa_get_user_path( @"Options" ), kOptionsFileOption,
- nil]];
-
- return [[defaults objectForKey: kOptionsFileOption] UTF8String];
-}
-
-static NSApplication *cocoa_prepare_app( void )
-{
- /* if application instance has already been created return it */
- if (NSApp != nil) {
- return NSApp;
- }
-
- NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
-
- /* Obtain principle class of bundle which must implement sharedApplication API */
- Class principalClass = NSClassFromString([infoDictionary objectForKey:@"NSPrincipalClass"]);
- NSCAssert([principalClass respondsToSelector:@selector(sharedApplication)],
- @"Principal class must implement sharedApplication.");
-
- /* create application instance */
- [principalClass sharedApplication];
-
- /* load interface nib */
- NSString *mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
- NSNib *mainNib = [[NSNib alloc] initWithNibNamed:mainNibName bundle:[NSBundle mainBundle]];
- [mainNib instantiateNibWithOwner:NSApp topLevelObjects:nil];
- [mainNib release];
-
- return NSApp;
-}
-
-/**
- * Set option defaults for cocoa frontend
- *
- * @param defaults The option table to update.
- * @return error status.
- */
-static nserror set_defaults(struct nsoption_s *defaults)
-{
- /* Set defaults for absent option strings */
- const char * const ca_bundle = [[[NSBundle mainBundle] pathForResource: @"ca-bundle" ofType: @""] UTF8String];
-
- nsoption_setnull_charp(ca_bundle, strdup(ca_bundle));
-
- return NSERROR_OK;
-}
-
-int main( int argc, char **argv )
-{
- nsurl *url;
- nserror error;
- struct netsurf_table cocoa_table = {
- .misc = cocoa_misc_table,
- .window = cocoa_window_table,
- .clipboard = cocoa_clipboard_table,
- .download = cocoa_download_table,
- .fetch = cocoa_fetch_table,
- .search = cocoa_search_table,
- .bitmap = cocoa_bitmap_table,
- .layout = cocoa_layout_table,
- };
-
- error = netsurf_register(&cocoa_table);
- if (error != NSERROR_OK) {
- die("NetSurf operation table failed registration");
- }
-
- const char * const messages = [[[NSBundle mainBundle] pathForResource: @"Messages" ofType: @""] UTF8String];
- const char * const options = cocoa_get_options_file();
-
- /* initialise logging. Not fatal if it fails but not much we
- * can do about it either.
- */
- nslog_init(NULL, &argc, argv);
-
- /* user options setup */
- error = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
- if (error != NSERROR_OK) {
- die("Options failed to initialise");
- }
- nsoption_read(options, NULL);
- nsoption_commandline(&argc, argv, NULL);
-
- error = messages_add_from_file(messages);
-
- /* common initialisation */
- error = netsurf_init(NULL);
- if (error != NSERROR_OK) {
- die("NetSurf failed to initialise");
- }
-
- /* Initialise filename allocator */
- filename_initialise();
-
- (void)apple_image_init();
-
- NSApplication *app = cocoa_prepare_app();
-
- for (int i = 1; i < argc; i++) {
- /* skip -psn_* and other possible options */
- if (argv[i][0] == '-')
- continue;
-
- error = nsurl_create(argv[i], &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- cocoa_warning(messages_get_errorcode(error), 0);
- }
- }
-
- [app run];
-
- netsurf_exit();
-
- return 0;
-}
diff --git a/frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front.png b/frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front.png
deleted file mode 100644
index 77d220505..000000000
--- a/frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front.png
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front_Pressed.png b/frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front_Pressed.png
deleted file mode 100644
index 197ea95c2..000000000
--- a/frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front_Pressed.png
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front_Rollover.png b/frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front_Rollover.png
deleted file mode 100644
index 2dfe5777e..000000000
--- a/frontends/cocoa/PSMTabBarControl/Images/AquaTabCloseDirty_Front_Rollover.png
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front.png b/frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front.png
deleted file mode 100644
index 02b72d39e..000000000
--- a/frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front.png
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front_Pressed.png b/frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front_Pressed.png
deleted file mode 100644
index f81125a01..000000000
--- a/frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front_Pressed.png
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front_Rollover.png b/frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front_Rollover.png
deleted file mode 100644
index 4f6b865f7..000000000
--- a/frontends/cocoa/PSMTabBarControl/Images/AquaTabClose_Front_Rollover.png
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PSMTabBarControl/Images/AquaTabNew.png b/frontends/cocoa/PSMTabBarControl/Images/AquaTabNew.png
deleted file mode 100644
index 10a83705d..000000000
--- a/frontends/cocoa/PSMTabBarControl/Images/AquaTabNew.png
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PSMTabBarControl/Images/AquaTabNewPressed.png b/frontends/cocoa/PSMTabBarControl/Images/AquaTabNewPressed.png
deleted file mode 100644
index cb4dd10f2..000000000
--- a/frontends/cocoa/PSMTabBarControl/Images/AquaTabNewPressed.png
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PSMTabBarControl/Images/AquaTabNewRollover.png b/frontends/cocoa/PSMTabBarControl/Images/AquaTabNewRollover.png
deleted file mode 100644
index 4d469f8a6..000000000
--- a/frontends/cocoa/PSMTabBarControl/Images/AquaTabNewRollover.png
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PSMTabBarControl/Images/overflowImage.png b/frontends/cocoa/PSMTabBarControl/Images/overflowImage.png
deleted file mode 100644
index 2b762555d..000000000
--- a/frontends/cocoa/PSMTabBarControl/Images/overflowImage.png
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PSMTabBarControl/Images/overflowImagePressed.png b/frontends/cocoa/PSMTabBarControl/Images/overflowImagePressed.png
deleted file mode 100644
index b3918b344..000000000
--- a/frontends/cocoa/PSMTabBarControl/Images/overflowImagePressed.png
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PSMTabBarControl/Images/pi.png b/frontends/cocoa/PSMTabBarControl/Images/pi.png
deleted file mode 100644
index 4d598dc73..000000000
--- a/frontends/cocoa/PSMTabBarControl/Images/pi.png
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PSMTabBarControl/NSBezierPath_AMShading.h b/frontends/cocoa/PSMTabBarControl/NSBezierPath_AMShading.h
deleted file mode 100644
index fd2c2dde4..000000000
--- a/frontends/cocoa/PSMTabBarControl/NSBezierPath_AMShading.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// NSBezierPath_AMShading.h
-// ------------------------
-//
-// Created by Andreas on 2005-06-01.
-// Copyright 2005 Andreas Mayer. All rights reserved.
-//
-// based on http://www.cocoadev.com/index.pl?GradientFill
-
-
-#import <Cocoa/Cocoa.h>
-
-@interface NSBezierPath (AMShading)
-
-- (void)customHorizontalFillWithCallbacks:(CGFunctionCallbacks) functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor;
-- (void)customVerticalFillWithCallbacks:(CGFunctionCallbacks) functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor;
-
-- (void)linearGradientFillWithStartColor:(NSColor *)startColor endColor:(NSColor *)endColor;
-- (void)linearVerticalGradientFillWithStartColor:(NSColor *)startColor endColor:(NSColor *)endColor;
-
-- (void)bilinearGradientFillWithOuterColor:(NSColor *)outerColor innerColor:(NSColor *)innerColor;
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/NSBezierPath_AMShading.m b/frontends/cocoa/PSMTabBarControl/NSBezierPath_AMShading.m
deleted file mode 100644
index 30ee24096..000000000
--- a/frontends/cocoa/PSMTabBarControl/NSBezierPath_AMShading.m
+++ /dev/null
@@ -1,119 +0,0 @@
-//
-// NSBezierPath_AMShading.m
-// ------------------------
-//
-// Created by Andreas on 2005-06-01.
-// Copyright 2005 Andreas Mayer. All rights reserved.
-//
-
-#import "NSBezierPath_AMShading.h"
-
-
-@implementation NSBezierPath (AMShading)
-
-static void linearShadedColor(void *info, const CGFloat *in, CGFloat *out){
- CGFloat *colors = (CGFloat *)info;
- *out++ = colors[0] + *in * colors[8];
- *out++ = colors[1] + *in * colors[9];
- *out++ = colors[2] + *in * colors[10];
- *out++ = colors[3] + *in * colors[11];
-}
-
-static void bilinearShadedColor(void *info, const CGFloat *in, CGFloat *out){
- CGFloat *colors = (CGFloat *)info;
- CGFloat factor = (*in) * 2.0;
- if(*in > 0.5) {
- factor = 2 - factor;
- }
- *out++ = colors[0] + factor * colors[8];
- *out++ = colors[1] + factor * colors[9];
- *out++ = colors[2] + factor * colors[10];
- *out++ = colors[3] + factor * colors[11];
-}
-
-- (void)linearGradientFillWithStartColor:(NSColor *)startColor endColor:(NSColor *)endColor {
- static const CGFunctionCallbacks callbacks = {0, &linearShadedColor, NULL};
-
- [self customHorizontalFillWithCallbacks:callbacks firstColor:startColor secondColor:endColor];
-}
-
-- (void)linearVerticalGradientFillWithStartColor:(NSColor *)startColor endColor:(NSColor *)endColor {
- static const CGFunctionCallbacks callbacks = {0, &linearShadedColor, NULL};
-
- [self customVerticalFillWithCallbacks:callbacks firstColor:startColor secondColor:endColor];
-}
-
-- (void)bilinearGradientFillWithOuterColor:(NSColor *)outerColor innerColor:(NSColor *)innerColor {
- static const CGFunctionCallbacks callbacks = {0, &bilinearShadedColor, NULL};
-
- [self customHorizontalFillWithCallbacks:callbacks firstColor:innerColor secondColor:outerColor];
-}
-
-- (void)customFillWithCallbacks:(CGFunctionCallbacks)functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint {
- CGColorSpaceRef colorspace;
- CGShadingRef shading;
- CGFunctionRef function;
- CGFloat colors[12]; // pointer to color values
-
- // get my context
- CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
-
- NSColor *deviceDependentFirstColor = [firstColor colorUsingColorSpaceName:NSDeviceRGBColorSpace];
- NSColor *deviceDependentSecondColor = [secondColor colorUsingColorSpaceName:NSDeviceRGBColorSpace];
-
- // set up colors for gradient
- colors[0] = [deviceDependentFirstColor redComponent];
- colors[1] = [deviceDependentFirstColor greenComponent];
- colors[2] = [deviceDependentFirstColor blueComponent];
- colors[3] = [deviceDependentFirstColor alphaComponent];
-
- colors[4] = [deviceDependentSecondColor redComponent];
- colors[5] = [deviceDependentSecondColor greenComponent];
- colors[6] = [deviceDependentSecondColor blueComponent];
- colors[7] = [deviceDependentSecondColor alphaComponent];
-
- // difference between start and end color for each color components
- colors[8] = (colors[4] - colors[0]);
- colors[9] = (colors[5] - colors[1]);
- colors[10] = (colors[6] - colors[2]);
- colors[11] = (colors[7] - colors[3]);
-
- // draw gradient
- colorspace = CGColorSpaceCreateDeviceRGB();
- size_t components = 1 + CGColorSpaceGetNumberOfComponents(colorspace);
- static const CGFloat domain[2] = {0.0, 1.0};
- static const CGFloat range[10] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1};
- //static const CGFunctionCallbacks callbacks = {0, &bilinearShadedColor, NULL};
-
- // Create a CGFunctionRef that describes a function taking 1 input and kChannelsPerColor outputs.
- function = CGFunctionCreate(colors, 1, domain, components, range, &functionCallbacks);
-
- shading = CGShadingCreateAxial(colorspace, startPoint, endPoint, function, NO, NO);
-
- CGContextSaveGState(currentContext);
- [self addClip];
- CGContextDrawShading(currentContext, shading);
- CGContextRestoreGState(currentContext);
-
- CGShadingRelease(shading);
- CGFunctionRelease(function);
- CGColorSpaceRelease(colorspace);
-}
-
-- (void)customHorizontalFillWithCallbacks:(CGFunctionCallbacks)functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor {
- [self customFillWithCallbacks:functionCallbacks
- firstColor:firstColor
- secondColor:secondColor
- startPoint:CGPointMake(0, NSMinY([self bounds]))
- endPoint:CGPointMake(0, NSMaxY([self bounds]))];
-}
-
-- (void)customVerticalFillWithCallbacks:(CGFunctionCallbacks)functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor {
- [self customFillWithCallbacks:functionCallbacks
- firstColor:firstColor
- secondColor:secondColor
- startPoint:CGPointMake(NSMinX([self bounds]), 0)
- endPoint:CGPointMake(NSMaxX([self bounds]), 0)];
-}
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/NSString_AITruncation.h b/frontends/cocoa/PSMTabBarControl/NSString_AITruncation.h
deleted file mode 100644
index cbcbf2c7f..000000000
--- a/frontends/cocoa/PSMTabBarControl/NSString_AITruncation.h
+++ /dev/null
@@ -1,12 +0,0 @@
-//
-// NSString_AITruncation.h
-// PSMTabBarControl
-//
-// Created by Evan Schoenberg on 7/14/07.
-//
-
-#import <Cocoa/Cocoa.h>
-
-@interface NSString (AITruncation)
-- (NSString *)stringWithEllipsisByTruncatingToLength:(NSUInteger)length;
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/NSString_AITruncation.m b/frontends/cocoa/PSMTabBarControl/NSString_AITruncation.m
deleted file mode 100644
index 1a54502e5..000000000
--- a/frontends/cocoa/PSMTabBarControl/NSString_AITruncation.m
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// NSString_AITruncation.m
-// PSMTabBarControl
-//
-// Created by Evan Schoenberg on 7/14/07.
-// From Adium, which is licensed under the GPL. Used in PSMTabBarControl with permission.
-// The contents of this remain licensed under the GPL.
-//
-
-#import "NSString_AITruncation.h"
-
-@implementation NSString (AITruncation)
-
-+ (id)ellipsis {
- return [NSString stringWithUTF8String:"\xE2\x80\xA6"];
-}
-
-- (NSString *)stringWithEllipsisByTruncatingToLength:(NSUInteger)length {
- NSString *returnString;
-
- if(length < [self length]) {
- //Truncate and append the ellipsis
- returnString = [[self substringToIndex:length - 1] stringByAppendingString:[NSString ellipsis]];
- } else {
- //We don't need to truncate, so don't append an ellipsis
- returnString = [[self copy] autorelease];
- }
-
- return returnString;
-}
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.h b/frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.h
deleted file mode 100644
index decda5be4..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.h
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// PSMOverflowPopUpButton.h
-// PSMTabBarControl
-//
-// Created by John Pannell on 11/4/05.
-// Copyright 2005 Positive Spin Media. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface PSMOverflowPopUpButton : NSPopUpButton {
- NSImage *_PSMTabBarOverflowPopUpImage;
- NSImage *_PSMTabBarOverflowDownPopUpImage;
- BOOL _down;
- BOOL _animatingAlternateImage;
- NSTimer *_animationTimer;
- CGFloat _animationValue;
-}
-
-//alternate image display
-- (BOOL)animatingAlternateImage;
-- (void)setAnimatingAlternateImage:(BOOL)flag;
-
-// archiving
-- (void)encodeWithCoder:(NSCoder *)aCoder;
-- (id)initWithCoder:(NSCoder *)aDecoder;
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.m b/frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.m
deleted file mode 100644
index c316f6973..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMOverflowPopUpButton.m
+++ /dev/null
@@ -1,152 +0,0 @@
-//
-// PSMOverflowPopUpButton.m
-// PSMTabBarControl
-//
-// Created by John Pannell on 11/4/05.
-// Copyright 2005 Positive Spin Media. All rights reserved.
-//
-
-#import "PSMOverflowPopUpButton.h"
-#import "PSMTabBarControl.h"
-
-#define TIMER_INTERVAL 1.0 / 15.0
-#define ANIMATION_STEP 0.033f
-
-@implementation PSMOverflowPopUpButton
-
-- (id)initWithFrame:(NSRect)frameRect pullsDown:(BOOL)flag {
- if ((self = [super initWithFrame:frameRect pullsDown:YES]) != nil) {
- [self setBezelStyle:NSRegularSquareBezelStyle];
- [self setBordered:NO];
- [self setTitle:@""];
- [self setPreferredEdge:NSMaxXEdge];
- _PSMTabBarOverflowPopUpImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"overflowImage"]];
- _PSMTabBarOverflowDownPopUpImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"overflowImagePressed"]];
- _animatingAlternateImage = NO;
- }
- return self;
-}
-
-- (void)dealloc {
- [_PSMTabBarOverflowPopUpImage release];
- [_PSMTabBarOverflowDownPopUpImage release];
- [super dealloc];
-}
-
-- (void)drawRect:(NSRect)rect {
- if(_PSMTabBarOverflowPopUpImage == nil) {
- [super drawRect:rect];
- return;
- }
-
- NSImage *image = (_down) ? _PSMTabBarOverflowDownPopUpImage : _PSMTabBarOverflowPopUpImage;
- NSSize imageSize = [image size];
- NSRect bounds = [self bounds];
-
- NSPoint drawPoint = NSMakePoint(NSMidX(bounds) - (imageSize.width * 0.5f), NSMidY(bounds) - (imageSize.height * 0.5f));
-
- if([self isFlipped]) {
- drawPoint.y += imageSize.height;
- }
-
- [image compositeToPoint:drawPoint operation:NSCompositeSourceOver fraction:(_animatingAlternateImage ? 0.7f : 1.0f)];
-
- if(_animatingAlternateImage) {
- NSImage *alternateImage = [self alternateImage];
- NSSize altImageSize = [alternateImage size];
- drawPoint = NSMakePoint(NSMidX(bounds) - (altImageSize.width * 0.5f), NSMidY(bounds) - (altImageSize.height * 0.5f));
-
- if([self isFlipped]) {
- drawPoint.y += altImageSize.height;
- }
-
- [[self alternateImage] compositeToPoint:drawPoint operation:NSCompositeSourceOver fraction:sin(_animationValue * M_PI)];
- }
-}
-
-- (void)mouseDown:(NSEvent *)event {
- _down = YES;
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationReceived:) name:NSMenuDidEndTrackingNotification object:[self menu]];
- [self setNeedsDisplay:YES];
- [super mouseDown:event];
-}
-
-- (void)setHidden:(BOOL)value {
- if([self isHidden] != value) {
- if(value) {
- // Stop any animating alternate image if we hide
- [_animationTimer invalidate], _animationTimer = nil;
- } else if(_animatingAlternateImage) {
- // Restart any animating alternate image if we unhide
- _animationValue = ANIMATION_STEP;
- _animationTimer = [NSTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(animateStep:) userInfo:nil repeats:YES];
- [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode];
- }
- }
-
- [super setHidden:value];
-}
-
-- (void)notificationReceived:(NSNotification *)notification {
- _down = NO;
- [self setNeedsDisplay:YES];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-}
-
-- (void)setAnimatingAlternateImage:(BOOL)flag {
- if(_animatingAlternateImage != flag) {
- _animatingAlternateImage = flag;
-
- if(![self isHidden]) {
- if(flag) {
- _animationValue = ANIMATION_STEP;
- _animationTimer = [NSTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(animateStep:) userInfo:nil repeats:YES];
- [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode];
- } else {
- [_animationTimer invalidate], _animationTimer = nil;
- }
-
- [self setNeedsDisplay:YES];
- }
- }
-}
-
-- (BOOL)animatingAlternateImage;
-{
- return _animatingAlternateImage;
-}
-
-- (void)animateStep:(NSTimer *)timer {
- _animationValue += ANIMATION_STEP;
-
- if(_animationValue >= 1) {
- _animationValue = ANIMATION_STEP;
- }
-
- [self setNeedsDisplay:YES];
-}
-
-#pragma mark -
-#pragma mark Archiving
-
-- (void)encodeWithCoder:(NSCoder *)aCoder {
- [super encodeWithCoder:aCoder];
- if([aCoder allowsKeyedCoding]) {
- [aCoder encodeObject:_PSMTabBarOverflowPopUpImage forKey:@"PSMTabBarOverflowPopUpImage"];
- [aCoder encodeObject:_PSMTabBarOverflowDownPopUpImage forKey:@"PSMTabBarOverflowDownPopUpImage"];
- [aCoder encodeBool:_animatingAlternateImage forKey:@"PSMTabBarOverflowAnimatingAlternateImage"];
- }
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder {
- if((self = [super initWithCoder:aDecoder])) {
- if([aDecoder allowsKeyedCoding]) {
- _PSMTabBarOverflowPopUpImage = [[aDecoder decodeObjectForKey:@"PSMTabBarOverflowPopUpImage"] retain];
- _PSMTabBarOverflowDownPopUpImage = [[aDecoder decodeObjectForKey:@"PSMTabBarOverflowDownPopUpImage"] retain];
- [self setAnimatingAlternateImage:[aDecoder decodeBoolForKey:@"PSMTabBarOverflowAnimatingAlternateImage"]];
- }
- }
- return self;
-}
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.h b/frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.h
deleted file mode 100644
index ffce06926..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//
-// PSMProgressIndicator.h
-// PSMTabBarControl
-//
-// Created by John Pannell on 2/23/06.
-// Copyright 2006 Positive Spin Media. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface PSMProgressIndicator : NSProgressIndicator {
-}
-
-@end \ No newline at end of file
diff --git a/frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.m b/frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.m
deleted file mode 100644
index 983609bbc..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMProgressIndicator.m
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// PSMProgressIndicator.m
-// PSMTabBarControl
-//
-// Created by John Pannell on 2/23/06.
-// Copyright 2006 Positive Spin Media. All rights reserved.
-//
-
-#import "PSMProgressIndicator.h"
-#import "PSMTabBarControl.h"
-
-@interface PSMTabBarControl (PSMProgressIndicatorExtensions)
-
-- (void)update;
-
-@end
-
-@implementation PSMProgressIndicator
-
-- (id) initWithFrame: (NSRect)frameRect;
-{
- if ((self = [super initWithFrame: frameRect]) == nil) return nil;
- [self setControlSize: NSSmallControlSize];
- return self;
-}
-
-// overrides to make tab bar control re-layout things if status changes
-- (void)setHidden:(BOOL)flag {
- [super setHidden:flag];
- [(PSMTabBarControl *)[self superview] update];
-}
-
-- (void)stopAnimation:(id)sender {
- [NSObject cancelPreviousPerformRequestsWithTarget:self
- selector:@selector(startAnimation:)
- object:nil];
- [super stopAnimation:sender];
-}
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMRolloverButton.h b/frontends/cocoa/PSMTabBarControl/PSMRolloverButton.h
deleted file mode 100644
index 62fce23e0..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMRolloverButton.h
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// PSMOverflowPopUpButton.h
-// NetScrape
-//
-// Created by John Pannell on 8/4/04.
-// Copyright 2004 Positive Spin Media. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-@interface PSMRolloverButton : NSButton {
- NSImage *_rolloverImage;
- NSImage *_usualImage;
- NSTrackingRectTag _myTrackingRectTag;
-}
-
-// the regular image
-- (void)setUsualImage:(NSImage *)newImage;
-- (NSImage *)usualImage;
-
-// the rollover image
-- (void)setRolloverImage:(NSImage *)newImage;
-- (NSImage *)rolloverImage;
-
-// tracking rect for mouse events
-- (void)addTrackingRect;
-- (void)removeTrackingRect;
-@end \ No newline at end of file
diff --git a/frontends/cocoa/PSMTabBarControl/PSMRolloverButton.m b/frontends/cocoa/PSMTabBarControl/PSMRolloverButton.m
deleted file mode 100644
index 8886560c7..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMRolloverButton.m
+++ /dev/null
@@ -1,170 +0,0 @@
-//
-// PSMOverflowPopUpButton.m
-// NetScrape
-//
-// Created by John Pannell on 8/4/04.
-// Copyright 2004 Positive Spin Media. All rights reserved.
-//
-
-#import "PSMRolloverButton.h"
-
-@implementation PSMRolloverButton
-
-- (void)awakeFromNib {
- if([[self superclass] instancesRespondToSelector:@selector(awakeFromNib)]) {
- [super awakeFromNib];
- }
-
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(rolloverFrameDidChange:)
- name:NSViewFrameDidChangeNotification
- object:self];
- [self setPostsFrameChangedNotifications:YES];
- [self resetCursorRects];
-
- _myTrackingRectTag = -1;
-}
-
-- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-
- [self removeTrackingRect];
-
- [super dealloc];
-}
-
-// the regular image
-- (void)setUsualImage:(NSImage *)newImage {
- [newImage retain];
- [_usualImage release];
- _usualImage = newImage;
-
- [self setImage:_usualImage];
-}
-
-- (NSImage *)usualImage {
- return _usualImage;
-}
-
-- (void)setRolloverImage:(NSImage *)newImage {
- [newImage retain];
- [_rolloverImage release];
- _rolloverImage = newImage;
-}
-
-- (NSImage *)rolloverImage {
- return _rolloverImage;
-}
-
-//Remove old tracking rects when we change superviews
-- (void)viewWillMoveToSuperview:(NSView *)newSuperview {
- [self removeTrackingRect];
-
- [super viewWillMoveToSuperview:newSuperview];
-}
-
-- (void)viewDidMoveToSuperview {
- [super viewDidMoveToSuperview];
-
- [self resetCursorRects];
-}
-
-- (void)viewWillMoveToWindow:(NSWindow *)newWindow {
- [self removeTrackingRect];
-
- [super viewWillMoveToWindow:newWindow];
-}
-
-- (void)viewDidMoveToWindow {
- [super viewDidMoveToWindow];
-
- [self resetCursorRects];
-}
-
-- (void)rolloverFrameDidChange:(NSNotification *)inNotification {
- [self resetCursorRects];
-}
-
-- (void)addTrackingRect {
- // assign a tracking rect to watch for mouse enter/exit
- NSRect trackRect = [self bounds];
- NSPoint localPoint = [self convertPoint:[[self window] convertScreenToBase:[NSEvent mouseLocation]]
- fromView:nil];
- BOOL mouseInside = NSPointInRect(localPoint, trackRect);
-
- _myTrackingRectTag = [self addTrackingRect:trackRect owner:self userData:nil assumeInside:mouseInside];
- if(mouseInside) {
- //[self mouseEntered:nil];
- [self setImage:_rolloverImage];
- } else{
- //[self mouseExited:nil];
- [self setImage:_usualImage];
- }
-}
-
-- (void)removeTrackingRect {
- if(_myTrackingRectTag != -1) {
- [self removeTrackingRect:_myTrackingRectTag];
- }
- _myTrackingRectTag = -1;
-}
-
-// override for rollover effect
-- (void)mouseEntered:(NSEvent *)theEvent;
-{
- // set rollover image
- [self setImage:_rolloverImage];
-
- [super mouseEntered:theEvent];
-}
-
-- (void)mouseExited:(NSEvent *)theEvent;
-{
- // restore usual image
- [self setImage:_usualImage];
-
- [super mouseExited:theEvent];
-}
-
-- (void)resetCursorRects {
- // called when the button rect has been changed
- [self removeTrackingRect];
- [self addTrackingRect];
-}
-
-- (void)setFrame:(NSRect)rect {
- [super setFrame:rect];
- [self resetCursorRects];
-}
-
-- (void)setBounds:(NSRect)rect {
- [super setBounds:rect];
- [self resetCursorRects];
-}
-
-#pragma mark -
-#pragma mark Archiving
-
-- (void)encodeWithCoder:(NSCoder *)aCoder {
- [super encodeWithCoder:aCoder];
- if([aCoder allowsKeyedCoding]) {
- [aCoder encodeObject:_rolloverImage forKey:@"rolloverImage"];
- [aCoder encodeObject:_usualImage forKey:@"usualImage"];
- [aCoder encodeInt64:_myTrackingRectTag forKey:@"myTrackingRectTag"];
- }
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder {
- self = [super initWithCoder:aDecoder];
- if(self) {
- if([aDecoder allowsKeyedCoding]) {
- _rolloverImage = [[aDecoder decodeObjectForKey:@"rolloverImage"] retain];
- _usualImage = [[aDecoder decodeObjectForKey:@"usualImage"] retain];
- _myTrackingRectTag = [aDecoder decodeInt64ForKey:@"myTrackingRectTag"];
- }
- }
- return self;
-}
-
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabBarCell.h b/frontends/cocoa/PSMTabBarControl/PSMTabBarCell.h
deleted file mode 100644
index c8f6cecdd..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabBarCell.h
+++ /dev/null
@@ -1,116 +0,0 @@
-//
-// PSMTabBarCell.h
-// PSMTabBarControl
-//
-// Created by John Pannell on 10/13/05.
-// Copyright 2005 Positive Spin Media. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "PSMTabBarControl.h"
-#import "PSMProgressIndicator.h"
-
-
-@interface PSMTabBarCell : NSActionCell {
- // sizing
- NSRect _frame;
- NSSize _stringSize;
- NSInteger _currentStep;
- BOOL _isPlaceholder;
-
- // state
- NSInteger _tabState;
- NSTrackingRectTag _closeButtonTrackingTag; // left side tracking, if dragging
- NSTrackingRectTag _cellTrackingTag; // right side tracking, if dragging
- BOOL _closeButtonOver;
- BOOL _closeButtonPressed;
- PSMProgressIndicator *_indicator;
- BOOL _isInOverflowMenu;
- BOOL _hasCloseButton;
- BOOL _isCloseButtonSuppressed;
- BOOL _hasIcon;
- BOOL _hasLargeImage;
- NSInteger _count;
- NSColor *_countColor;
- BOOL _isEdited;
-}
-
-// creation/destruction
-- (id)initWithControlView:(PSMTabBarControl *)controlView;
-- (id)initPlaceholderWithFrame:(NSRect) frame expanded:(BOOL) value inControlView:(PSMTabBarControl *)controlView;
-- (void)dealloc;
-
-// accessors
-- (id)controlView;
-- (void)setControlView:(id)view;
-- (NSTrackingRectTag)closeButtonTrackingTag;
-- (void)setCloseButtonTrackingTag:(NSTrackingRectTag)tag;
-- (NSTrackingRectTag)cellTrackingTag;
-- (void)setCellTrackingTag:(NSTrackingRectTag)tag;
-- (CGFloat)width;
-- (NSRect)frame;
-- (void)setFrame:(NSRect)rect;
-- (void)setStringValue:(NSString *)aString;
-- (NSSize)stringSize;
-- (NSAttributedString *)attributedStringValue;
-- (NSInteger)tabState;
-- (void)setTabState:(NSInteger)state;
-- (NSProgressIndicator *)indicator;
-- (BOOL)isInOverflowMenu;
-- (void)setIsInOverflowMenu:(BOOL)value;
-- (BOOL)closeButtonPressed;
-- (void)setCloseButtonPressed:(BOOL)value;
-- (BOOL)closeButtonOver;
-- (void)setCloseButtonOver:(BOOL)value;
-- (BOOL)hasCloseButton;
-- (void)setHasCloseButton:(BOOL)set;
-- (void)setCloseButtonSuppressed:(BOOL)suppress;
-- (BOOL)isCloseButtonSuppressed;
-- (BOOL)hasIcon;
-- (void)setHasIcon:(BOOL)value;
-- (BOOL)hasLargeImage;
-- (void)setHasLargeImage:(BOOL)value;
-- (NSInteger)count;
-- (void)setCount:(NSInteger)value;
-- (NSColor *)countColor;
-- (void)setCountColor:(NSColor *)value;
-- (BOOL)isPlaceholder;
-- (void)setIsPlaceholder:(BOOL)value;
-- (NSInteger)currentStep;
-- (void)setCurrentStep:(NSInteger)value;
-- (BOOL)isEdited;
-- (void)setIsEdited:(BOOL)value;
-
-// component attributes
-- (NSRect)indicatorRectForFrame:(NSRect)cellFrame;
-- (NSRect)closeButtonRectForFrame:(NSRect)cellFrame;
-- (CGFloat)minimumWidthOfCell;
-- (CGFloat)desiredWidthOfCell;
-
-// drawing
-- (void)drawWithFrame:(NSRect) cellFrame inView:(NSView *)controlView;
-
-// tracking the mouse
-- (void)mouseEntered:(NSEvent *)theEvent;
-- (void)mouseExited:(NSEvent *)theEvent;
-
-// drag support
-- (NSImage *)dragImage;
-
-// archiving
-- (void)encodeWithCoder:(NSCoder *)aCoder;
-- (id)initWithCoder:(NSCoder *)aDecoder;
-
-@end
-
-@interface PSMTabBarControl (CellAccessors)
-
-- (id<PSMTabStyle>)style;
-
-@end
-
-@interface NSObject (IdentifierAccesors)
-
-- (NSImage *)largeImage;
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m b/frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m
deleted file mode 100644
index f7a04f202..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabBarCell.m
+++ /dev/null
@@ -1,489 +0,0 @@
-//
-// PSMTabBarCell.m
-// PSMTabBarControl
-//
-// Created by John Pannell on 10/13/05.
-// Copyright 2005 Positive Spin Media. All rights reserved.
-//
-
-#import "PSMTabBarCell.h"
-#import "PSMTabBarControl.h"
-#import "PSMTabStyle.h"
-#import "PSMProgressIndicator.h"
-#import "PSMTabDragAssistant.h"
-
-@interface PSMTabBarControl (Private)
-- (void)update;
-@end
-
-@implementation PSMTabBarCell
-
-#pragma mark -
-#pragma mark Creation/Destruction
-- (id)initWithControlView:(PSMTabBarControl *)controlView {
- if((self = [super init])) {
- _controlView = controlView;
- _closeButtonTrackingTag = 0;
- _cellTrackingTag = 0;
- _closeButtonOver = NO;
- _closeButtonPressed = NO;
- _indicator = [[PSMProgressIndicator alloc] initWithFrame:NSMakeRect(0.0, 0.0, kPSMTabBarIndicatorWidth, kPSMTabBarIndicatorWidth)];
- [_indicator setStyle:NSProgressIndicatorSpinningStyle];
- [_indicator setAutoresizingMask:NSViewMinYMargin];
- _hasCloseButton = YES;
- _isCloseButtonSuppressed = NO;
- _count = 0;
- _countColor = nil;
- _isEdited = NO;
- _isPlaceholder = NO;
- }
- return self;
-}
-
-- (id)initPlaceholderWithFrame:(NSRect)frame expanded:(BOOL)value inControlView:(PSMTabBarControl *)controlView {
- if((self = [super init])) {
- _controlView = controlView;
- _isPlaceholder = YES;
- if(!value) {
- if([controlView orientation] == PSMTabBarHorizontalOrientation) {
- frame.size.width = 0.0;
- } else {
- frame.size.height = 0.0;
- }
- }
- [self setFrame:frame];
- _closeButtonTrackingTag = 0;
- _cellTrackingTag = 0;
- _closeButtonOver = NO;
- _closeButtonPressed = NO;
- _indicator = nil;
- _hasCloseButton = YES;
- _isCloseButtonSuppressed = NO;
- _count = 0;
- _countColor = nil;
- _isEdited = NO;
-
- if(value) {
- [self setCurrentStep:(kPSMTabDragAnimationSteps - 1)];
- } else {
- [self setCurrentStep:0];
- }
- }
- return self;
-}
-
-- (void)dealloc {
- [_countColor release];
-
- [_indicator removeFromSuperviewWithoutNeedingDisplay];
-
- [_indicator release];
- [super dealloc];
-}
-
-#pragma mark -
-#pragma mark Accessors
-
-- (id)controlView {
- return _controlView;
-}
-
-- (void)setControlView:(id)view {
- // no retain release pattern, as this simply switches a tab to another view.
- _controlView = view;
-}
-
-- (NSTrackingRectTag)closeButtonTrackingTag {
- return _closeButtonTrackingTag;
-}
-
-- (void)setCloseButtonTrackingTag:(NSTrackingRectTag)tag {
- _closeButtonTrackingTag = tag;
-}
-
-- (NSTrackingRectTag)cellTrackingTag {
- return _cellTrackingTag;
-}
-
-- (void)setCellTrackingTag:(NSTrackingRectTag)tag {
- _cellTrackingTag = tag;
-}
-
-- (CGFloat)width {
- return _frame.size.width;
-}
-
-- (NSRect)frame {
- return _frame;
-}
-
-- (void)setFrame:(NSRect)rect {
- _frame = rect;
-
- //move the status indicator along with the rest of the cell
- if(![[self indicator] isHidden] && ![_controlView isTabBarHidden]) {
- [[self indicator] setFrame:[self indicatorRectForFrame:rect]];
- }
-}
-
-- (void)setStringValue:(NSString *)aString {
- [super setStringValue:aString];
- _stringSize = [[self attributedStringValue] size];
- // need to redisplay now - binding observation was too quick.
- [_controlView update];
-}
-
-- (NSSize)stringSize {
- return _stringSize;
-}
-
-- (NSAttributedString *)attributedStringValue {
- return [(id < PSMTabStyle >)[_controlView style] attributedStringValueForTabCell:self];
-}
-
-- (NSInteger)tabState {
- return _tabState;
-}
-
-- (void)setTabState:(NSInteger)state {
- _tabState = state;
-}
-
-- (NSProgressIndicator *)indicator {
- return _indicator;
-}
-
-- (BOOL)isInOverflowMenu {
- return _isInOverflowMenu;
-}
-
-- (void)setIsInOverflowMenu:(BOOL)value {
- if(_isInOverflowMenu != value) {
- _isInOverflowMenu = value;
- if([[[self controlView] delegate] respondsToSelector:@selector(tabView:tabViewItem:isInOverflowMenu:)]) {
- [[[self controlView] delegate] tabView:[self controlView] tabViewItem:[self representedObject] isInOverflowMenu:_isInOverflowMenu];
- }
- }
-}
-
-- (BOOL)closeButtonPressed {
- return _closeButtonPressed;
-}
-
-- (void)setCloseButtonPressed:(BOOL)value {
- _closeButtonPressed = value;
-}
-
-- (BOOL)closeButtonOver {
- return(_closeButtonOver && ([_controlView allowsBackgroundTabClosing] || ([self tabState] & PSMTab_SelectedMask) || [[NSApp currentEvent] modifierFlags] & NSCommandKeyMask));
-}
-
-- (void)setCloseButtonOver:(BOOL)value {
- _closeButtonOver = value;
-}
-
-- (BOOL)hasCloseButton {
- return _hasCloseButton;
-}
-
-- (void)setHasCloseButton:(BOOL)set;
-{
- _hasCloseButton = set;
-}
-
-- (void)setCloseButtonSuppressed:(BOOL)suppress;
-{
- _isCloseButtonSuppressed = suppress;
-}
-
-- (BOOL)isCloseButtonSuppressed;
-{
- return _isCloseButtonSuppressed;
-}
-
-- (BOOL)hasIcon {
- return _hasIcon;
-}
-
-- (void)setHasIcon:(BOOL)value {
- _hasIcon = value;
- //[_controlView update:[[self controlView] automaticallyAnimates]]; // binding notice is too fast
-}
-
-- (BOOL)hasLargeImage {
- return _hasLargeImage;
-}
-
-- (void)setHasLargeImage:(BOOL)value {
- _hasLargeImage = value;
-}
-
-
-- (NSInteger)count {
- return _count;
-}
-
-- (void)setCount:(NSInteger)value {
- _count = value;
- //[_controlView update:[[self controlView] automaticallyAnimates]]; // binding notice is too fast
-}
-
-- (NSColor *)countColor {
- return _countColor;
-}
-
-- (void)setCountColor:(NSColor *)color {
- [_countColor release];
- _countColor = [color retain];
-}
-
-- (BOOL)isPlaceholder {
- return _isPlaceholder;
-}
-
-- (void)setIsPlaceholder:(BOOL)value;
-{
- _isPlaceholder = value;
-}
-
-- (NSInteger)currentStep {
- return _currentStep;
-}
-
-- (void)setCurrentStep:(NSInteger)value {
- if(value < 0) {
- value = 0;
- }
-
- if(value > (kPSMTabDragAnimationSteps - 1)) {
- value = (kPSMTabDragAnimationSteps - 1);
- }
-
- _currentStep = value;
-}
-
-- (BOOL)isEdited {
- return _isEdited;
-}
-
-- (void)setIsEdited:(BOOL)value {
- _isEdited = value;
- //[_controlView update:[[self controlView] automaticallyAnimates]]; // binding notice is too fast
-}
-
-#pragma mark -
-#pragma mark Bindings
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
- // the progress indicator, label, icon, or count has changed - redraw the control view
- //[_controlView update];
- //I seem to have run into some odd issue with update not being called at the right time. This seems to avoid the problem.
- [_controlView performSelector:@selector(update) withObject:nil afterDelay:0.0];
-}
-
-#pragma mark -
-#pragma mark Component Attributes
-
-- (NSRect)indicatorRectForFrame:(NSRect)cellFrame {
- return [(id < PSMTabStyle >)[_controlView style] indicatorRectForTabCell:self];
-}
-
-- (NSRect)closeButtonRectForFrame:(NSRect)cellFrame {
- return [(id < PSMTabStyle >)[_controlView style] closeButtonRectForTabCell:self withFrame:cellFrame];
-}
-
-- (CGFloat)minimumWidthOfCell {
- return [(id < PSMTabStyle >)[_controlView style] minimumWidthOfTabCell:self];
-}
-
-- (CGFloat)desiredWidthOfCell {
- return [(id < PSMTabStyle >)[_controlView style] desiredWidthOfTabCell:self];
-}
-
-#pragma mark -
-#pragma mark Drawing
-
-- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
- if(_isPlaceholder) {
- [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set];
- NSRectFillUsingOperation(cellFrame, NSCompositeSourceAtop);
- return;
- }
-
- [(id < PSMTabStyle >)[_controlView style] drawTabCell:self];
-}
-
-#pragma mark -
-#pragma mark Tracking
-
-- (void)mouseEntered:(NSEvent *)theEvent {
- // check for which tag
- if([theEvent trackingNumber] == _closeButtonTrackingTag) {
- _closeButtonOver = YES;
- }
- if([theEvent trackingNumber] == _cellTrackingTag) {
- [self setHighlighted:YES];
- [_controlView setNeedsDisplay:NO];
- }
-
- // scrubtastic
- if([_controlView allowsScrubbing] && ([theEvent modifierFlags] & NSAlternateKeyMask)) {
- [_controlView performSelector:@selector(tabClick:) withObject:self];
- }
-
- // tell the control we only need to redraw the affected tab
- [_controlView setNeedsDisplayInRect:NSInsetRect([self frame], -2, -2)];
-}
-
-- (void)mouseExited:(NSEvent *)theEvent {
- // check for which tag
- if([theEvent trackingNumber] == _closeButtonTrackingTag) {
- _closeButtonOver = NO;
- }
-
- if([theEvent trackingNumber] == _cellTrackingTag) {
- [self setHighlighted:NO];
- [_controlView setNeedsDisplay:NO];
- }
-
- //tell the control we only need to redraw the affected tab
- [_controlView setNeedsDisplayInRect:NSInsetRect([self frame], -2, -2)];
-}
-
-#pragma mark -
-#pragma mark Drag Support
-
-- (NSImage *)dragImage {
- NSRect cellFrame = [(id < PSMTabStyle >)[(PSMTabBarControl *)_controlView style] dragRectForTabCell:self orientation:(PSMTabBarOrientation)[(PSMTabBarControl *)_controlView orientation]];
- //NSRect cellFrame = [self frame];
-
- [_controlView lockFocus];
- NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:cellFrame] autorelease];
- [_controlView unlockFocus];
- NSImage *image = [[[NSImage alloc] initWithSize:[rep size]] autorelease];
- [image addRepresentation:rep];
- NSImage *returnImage = [[[NSImage alloc] initWithSize:[rep size]] autorelease];
- [returnImage lockFocus];
- [image compositeToPoint:NSMakePoint(0.0, 0.0) operation:NSCompositeSourceOver fraction:1.0];
- [returnImage unlockFocus];
- if(![[self indicator] isHidden]) {
- NSImage *pi = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"pi"]];
- [returnImage lockFocus];
- NSPoint indicatorPoint = NSMakePoint([self frame].size.width - MARGIN_X - kPSMTabBarIndicatorWidth, MARGIN_Y);
- [pi compositeToPoint:indicatorPoint operation:NSCompositeSourceOver fraction:1.0];
- [returnImage unlockFocus];
- [pi release];
- }
- return returnImage;
-}
-
-#pragma mark -
-#pragma mark Archiving
-
-- (void)encodeWithCoder:(NSCoder *)aCoder {
- [super encodeWithCoder:aCoder];
- if([aCoder allowsKeyedCoding]) {
- [aCoder encodeRect:_frame forKey:@"frame"];
- [aCoder encodeSize:_stringSize forKey:@"stringSize"];
- [aCoder encodeInteger:_currentStep forKey:@"currentStep"];
- [aCoder encodeBool:_isPlaceholder forKey:@"isPlaceholder"];
- [aCoder encodeInteger:_tabState forKey:@"tabState"];
- [aCoder encodeInteger:_closeButtonTrackingTag forKey:@"closeButtonTrackingTag"];
- [aCoder encodeInteger:_cellTrackingTag forKey:@"cellTrackingTag"];
- [aCoder encodeBool:_closeButtonOver forKey:@"closeButtonOver"];
- [aCoder encodeBool:_closeButtonPressed forKey:@"closeButtonPressed"];
- [aCoder encodeObject:_indicator forKey:@"indicator"];
- [aCoder encodeBool:_isInOverflowMenu forKey:@"isInOverflowMenu"];
- [aCoder encodeBool:_hasCloseButton forKey:@"hasCloseButton"];
- [aCoder encodeBool:_isCloseButtonSuppressed forKey:@"isCloseButtonSuppressed"];
- [aCoder encodeBool:_hasIcon forKey:@"hasIcon"];
- [aCoder encodeBool:_hasLargeImage forKey:@"hasLargeImage"];
- [aCoder encodeInteger:_count forKey:@"count"];
- [aCoder encodeBool:_isEdited forKey:@"isEdited"];
- }
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder {
- self = [super initWithCoder:aDecoder];
- if(self) {
- if([aDecoder allowsKeyedCoding]) {
- _frame = [aDecoder decodeRectForKey:@"frame"];
- _stringSize = [aDecoder decodeSizeForKey:@"stringSize"];
- _currentStep = [aDecoder decodeIntegerForKey:@"currentStep"];
- _isPlaceholder = [aDecoder decodeBoolForKey:@"isPlaceholder"];
- _tabState = [aDecoder decodeIntegerForKey:@"tabState"];
- _closeButtonTrackingTag = [aDecoder decodeIntegerForKey:@"closeButtonTrackingTag"];
- _cellTrackingTag = [aDecoder decodeIntegerForKey:@"cellTrackingTag"];
- _closeButtonOver = [aDecoder decodeBoolForKey:@"closeButtonOver"];
- _closeButtonPressed = [aDecoder decodeBoolForKey:@"closeButtonPressed"];
- _indicator = [[aDecoder decodeObjectForKey:@"indicator"] retain];
- _isInOverflowMenu = [aDecoder decodeBoolForKey:@"isInOverflowMenu"];
- _hasCloseButton = [aDecoder decodeBoolForKey:@"hasCloseButton"];
- _isCloseButtonSuppressed = [aDecoder decodeBoolForKey:@"isCloseButtonSuppressed"];
- _hasIcon = [aDecoder decodeBoolForKey:@"hasIcon"];
- _hasLargeImage = [aDecoder decodeBoolForKey:@"hasLargeImage"];
- _count = [aDecoder decodeIntegerForKey:@"count"];
- _isEdited = [aDecoder decodeBoolForKey:@"isEdited"];
- }
- }
- return self;
-}
-
-#pragma mark -
-#pragma mark Accessibility
-
--(BOOL)accessibilityIsIgnored {
- return NO;
-}
-
-- (id)accessibilityAttributeValue:(NSString *)attribute {
- id attributeValue = nil;
-
- if([attribute isEqualToString: NSAccessibilityRoleAttribute]) {
- attributeValue = NSAccessibilityButtonRole;
- } else if([attribute isEqualToString: NSAccessibilityHelpAttribute]) {
- if([[[self controlView] delegate] respondsToSelector:@selector(accessibilityStringForTabView:objectCount:)]) {
- attributeValue = [NSString stringWithFormat:@"%@, %lu %@", [self stringValue],
- (unsigned long)[self count],
- [[[self controlView] delegate] accessibilityStringForTabView:[[self controlView] tabView] objectCount:[self count]]];
- } else {
- attributeValue = [self stringValue];
- }
- } else if([attribute isEqualToString: NSAccessibilityFocusedAttribute]) {
- attributeValue = [NSNumber numberWithBool:([self tabState] == 2)];
- } else {
- attributeValue = [super accessibilityAttributeValue:attribute];
- }
-
- return attributeValue;
-}
-
-- (NSArray *)accessibilityActionNames {
- static NSArray *actions;
-
- if(!actions) {
- actions = [[NSArray alloc] initWithObjects:NSAccessibilityPressAction, nil];
- }
- return actions;
-}
-
-- (NSString *)accessibilityActionDescription:(NSString *)action {
- return NSAccessibilityActionDescription(action);
-}
-
-- (void)accessibilityPerformAction:(NSString *)action {
- if([action isEqualToString:NSAccessibilityPressAction]) {
- // this tab was selected
- [_controlView performSelector:@selector(tabClick:) withObject:self];
- }
-}
-
-- (id)accessibilityHitTest:(NSPoint)point {
- return NSAccessibilityUnignoredAncestor(self);
-}
-
-- (id)accessibilityFocusedUIElement:(NSPoint)point {
- return NSAccessibilityUnignoredAncestor(self);
-}
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabBarControl.h b/frontends/cocoa/PSMTabBarControl/PSMTabBarControl.h
deleted file mode 100644
index 980c43d38..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabBarControl.h
+++ /dev/null
@@ -1,241 +0,0 @@
-//
-// PSMTabBarControl.h
-// PSMTabBarControl
-//
-// Created by John Pannell on 10/13/05.
-// Copyright 2005 Positive Spin Media. All rights reserved.
-//
-
-/*
- This view provides a control interface to manage a regular NSTabView. It looks and works like the tabbed browsing interface of many popular browsers.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#define PSMTabDragDidEndNotification @ "PSMTabDragDidEndNotification"
-#define PSMTabDragDidBeginNotification @ "PSMTabDragDidBeginNotification"
-
-#define kPSMTabBarControlHeight 22
-// internal cell border
-#define MARGIN_X 6
-#define MARGIN_Y 3
-// padding between objects
-#define kPSMTabBarCellPadding 4
-// fixed size objects
-#define kPSMMinimumTitleWidth 30
-#define kPSMTabBarIndicatorWidth 16.0
-#define kPSMTabBarIconWidth 16.0
-#define kPSMHideAnimationSteps 3.0
-
-// Value used in _currentStep to indicate that resizing operation is not in progress
-#define kPSMIsNotBeingResized -1
-
-// Value used in _currentStep when a resizing operation has just been started
-#define kPSMStartResizeAnimation 0
-
-@class PSMOverflowPopUpButton;
-@class PSMRolloverButton;
-@class PSMTabBarCell;
-@class PSMTabBarController;
-@protocol PSMTabStyle;
-
-typedef enum {
- PSMTabBarHorizontalOrientation,
- PSMTabBarVerticalOrientation
-} PSMTabBarOrientation;
-
-typedef enum {
- PSMTabBarTearOffAlphaWindow,
- PSMTabBarTearOffMiniwindow
-} PSMTabBarTearOffStyle;
-
-enum {
- PSMTab_SelectedMask = 1 << 1,
- PSMTab_LeftIsSelectedMask = 1 << 2,
- PSMTab_RightIsSelectedMask = 1 << 3,
- PSMTab_PositionLeftMask = 1 << 4,
- PSMTab_PositionMiddleMask = 1 << 5,
- PSMTab_PositionRightMask = 1 << 6,
- PSMTab_PositionSingleMask = 1 << 7,
-};
-
-@interface PSMTabBarControl : NSControl {
-
- // control basics
- NSMutableArray *_cells; // the cells that draw the tabs
- IBOutlet NSTabView *tabView; // the tab view being navigated
- PSMOverflowPopUpButton *_overflowPopUpButton; // for too many tabs
- PSMRolloverButton *_addTabButton;
- PSMTabBarController *_controller;
-
- // Spring-loading.
- NSTimer *_springTimer;
- NSTabViewItem *_tabViewItemWithSpring;
-
- // drawing style
- id<PSMTabStyle> style;
- BOOL _canCloseOnlyTab;
- BOOL _disableTabClose;
- BOOL _hideForSingleTab;
- BOOL _showAddTabButton;
- BOOL _sizeCellsToFit;
- BOOL _useOverflowMenu;
- BOOL _alwaysShowActiveTab;
- BOOL _allowsScrubbing;
- NSInteger _resizeAreaCompensation;
- PSMTabBarOrientation _orientation;
- BOOL _automaticallyAnimates;
- NSTimer *_animationTimer;
- PSMTabBarTearOffStyle _tearOffStyle;
-
- // behavior
- BOOL _allowsBackgroundTabClosing;
- BOOL _selectsTabsOnMouseDown;
-
- // vertical tab resizing
- BOOL _allowsResizing;
- BOOL _resizing;
-
- // cell width
- NSInteger _cellMinWidth;
- NSInteger _cellMaxWidth;
- NSInteger _cellOptimumWidth;
-
- // animation for hide/show
- NSInteger _currentStep;
- BOOL _isHidden;
- IBOutlet id partnerView; // gets resized when hide/show
- BOOL _awakenedFromNib;
- NSInteger _tabBarWidth;
- NSTimer *_showHideAnimationTimer;
-
- // drag and drop
- NSEvent *_lastMouseDownEvent; // keep this for dragging reference
- BOOL _didDrag;
- BOOL _closeClicked;
-
- // MVC help
- IBOutlet id delegate;
-}
-
-// control characteristics
-+ (NSBundle *)bundle;
-- (CGFloat)availableCellWidth;
-- (NSRect)genericCellRect;
-
-// control configuration
-- (PSMTabBarOrientation)orientation;
-- (void)setOrientation:(PSMTabBarOrientation)value;
-- (BOOL)canCloseOnlyTab;
-- (void)setCanCloseOnlyTab:(BOOL)value;
-- (BOOL)disableTabClose;
-- (void)setDisableTabClose:(BOOL)value;
-- (id<PSMTabStyle>)style;
-- (void)setStyle:(id <PSMTabStyle>)newStyle;
-- (NSString *)styleName;
-- (void)setStyleNamed:(NSString *)name;
-- (BOOL)hideForSingleTab;
-- (void)setHideForSingleTab:(BOOL)value;
-- (BOOL)showAddTabButton;
-- (void)setShowAddTabButton:(BOOL)value;
-- (NSInteger)cellMinWidth;
-- (void)setCellMinWidth:(NSInteger)value;
-- (NSInteger)cellMaxWidth;
-- (void)setCellMaxWidth:(NSInteger)value;
-- (NSInteger)cellOptimumWidth;
-- (void)setCellOptimumWidth:(NSInteger)value;
-- (BOOL)sizeCellsToFit;
-- (void)setSizeCellsToFit:(BOOL)value;
-- (BOOL)useOverflowMenu;
-- (void)setUseOverflowMenu:(BOOL)value;
-- (BOOL)allowsBackgroundTabClosing;
-- (void)setAllowsBackgroundTabClosing:(BOOL)value;
-- (BOOL)allowsResizing;
-- (void)setAllowsResizing:(BOOL)value;
-- (BOOL)selectsTabsOnMouseDown;
-- (void)setSelectsTabsOnMouseDown:(BOOL)value;
-- (BOOL)automaticallyAnimates;
-- (void)setAutomaticallyAnimates:(BOOL)value;
-- (BOOL)alwaysShowActiveTab;
-- (void)setAlwaysShowActiveTab:(BOOL)value;
-- (BOOL)allowsScrubbing;
-- (void)setAllowsScrubbing:(BOOL)value;
-- (PSMTabBarTearOffStyle)tearOffStyle;
-- (void)setTearOffStyle:(PSMTabBarTearOffStyle)tearOffStyle;
-
-// Factory for default style
-+ (Class)defaultStyleClass;
-
-// accessors
-- (NSTabView *)tabView;
-- (void)setTabView:(NSTabView *)view;
-- (id)delegate;
-- (void)setDelegate:(id)object;
-- (id)partnerView;
-- (void)setPartnerView:(id)view;
-
-// the buttons
-- (PSMRolloverButton *)addTabButton;
-- (PSMOverflowPopUpButton *)overflowPopUpButton;
-
-// tab information
-- (NSMutableArray *)representedTabViewItems;
-- (NSInteger)numberOfVisibleTabs;
-- (PSMTabBarCell *)lastVisibleTab;
-
-// special effects
-- (void)hideTabBar:(BOOL) hide animate:(BOOL)animate;
-- (BOOL)isTabBarHidden;
-- (BOOL)isAnimating;
-
-// internal bindings methods also used by the tab drag assistant
-- (void)bindPropertiesForCell:(PSMTabBarCell *)cell andTabViewItem:(NSTabViewItem *)item;
-- (void)removeTabForCell:(PSMTabBarCell *)cell;
-
-@end
-
-
-@interface NSObject (TabBarControlDelegateMethods)
-
-//Standard NSTabView methods
-- (BOOL)tabView:(NSTabView *)aTabView shouldCloseTabViewItem:(NSTabViewItem *)tabViewItem;
-- (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem;
-
-//"Spring-loaded" tabs methods
-- (NSArray *)allowedDraggedTypesForTabView:(NSTabView *)aTabView;
-- (void)tabView:(NSTabView *)aTabView acceptedDraggingInfo:(id <NSDraggingInfo>) draggingInfo onTabViewItem:(NSTabViewItem *)tabViewItem;
-
-//Contextual menu method
-- (NSMenu *)tabView:(NSTabView *)aTabView menuForTabViewItem:(NSTabViewItem *)tabViewItem;
-
-//Drag and drop methods
-- (BOOL)tabView:(NSTabView *)aTabView shouldDragTabViewItem:(NSTabViewItem *)tabViewItem fromTabBar:(PSMTabBarControl *)tabBarControl;
-- (BOOL)tabView:(NSTabView *)aTabView shouldDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl;
-- (BOOL)tabView:(NSTabView *)aTabView shouldAllowTabViewItem:(NSTabViewItem *)tabViewItem toLeaveTabBar:(PSMTabBarControl *)tabBarControl;
-- (void)tabView:(NSTabView*)aTabView didDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl;
-
-
-//Tear-off tabs methods
-- (NSImage *)tabView:(NSTabView *)aTabView imageForTabViewItem:(NSTabViewItem *)tabViewItem offset:(NSSize *)offset styleMask:(NSUInteger *)styleMask;
-- (PSMTabBarControl *)tabView:(NSTabView *)aTabView newTabBarForDraggedTabViewItem:(NSTabViewItem *)tabViewItem atPoint:(NSPoint)point;
-- (void)tabView:(NSTabView *)aTabView closeWindowForLastTabViewItem:(NSTabViewItem *)tabViewItem;
-
-//Overflow menu validation
-- (BOOL)tabView:(NSTabView *)aTabView validateOverflowMenuItem:(NSMenuItem *)menuItem forTabViewItem:(NSTabViewItem *)tabViewItem;
-- (void)tabView:(NSTabView *)aTabView tabViewItem:(NSTabViewItem *)tabViewItem isInOverflowMenu:(BOOL)inOverflowMenu;
-
-//tab bar hiding methods
-- (void)tabView:(NSTabView *)aTabView tabBarDidHide:(PSMTabBarControl *)tabBarControl;
-- (void)tabView:(NSTabView *)aTabView tabBarDidUnhide:(PSMTabBarControl *)tabBarControl;
-- (CGFloat)desiredWidthForVerticalTabBar:(PSMTabBarControl *)tabBarControl;
-
-//closing
-- (BOOL)tabView:(NSTabView *)aTabView disableTabCloseForTabViewItem:(NSTabViewItem *)tabViewItem;
-
-//tooltips
-- (NSString *)tabView:(NSTabView *)aTabView toolTipForTabViewItem:(NSTabViewItem *)tabViewItem;
-
-//accessibility
-- (NSString *)accessibilityStringForTabView:(NSTabView *)aTabView objectCount:(NSInteger)objectCount;
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabBarControl.m b/frontends/cocoa/PSMTabBarControl/PSMTabBarControl.m
deleted file mode 100644
index cb0e0342c..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabBarControl.m
+++ /dev/null
@@ -1,1995 +0,0 @@
-//
-// PSMTabBarControl.m
-// PSMTabBarControl
-//
-// Created by John Pannell on 10/13/05.
-// Copyright 2005 Positive Spin Media. All rights reserved.
-//
-
-#import <objc/runtime.h>
-
-#import "PSMTabBarControl.h"
-#import "PSMTabBarCell.h"
-#import "PSMOverflowPopUpButton.h"
-#import "PSMRolloverButton.h"
-#import "PSMTabStyle.h"
-#import "PSMUnifiedTabStyle.h"
-#import "PSMTabDragAssistant.h"
-#import "PSMTabBarController.h"
-
-@interface PSMTabBarControl (Private)
-
-// constructor/destructor
-- (void)initAddedProperties;
-
-// accessors
-- (NSEvent *)lastMouseDownEvent;
-- (void)setLastMouseDownEvent:(NSEvent *)event;
-
-// contents
-- (void)addTabViewItem:(NSTabViewItem *)item;
-- (void)removeTabForCell:(PSMTabBarCell *)cell;
-
-// draw
-- (void)update;
-- (void)update:(BOOL)animate;
-- (void)_setupTrackingRectsForCell:(PSMTabBarCell *)cell;
-- (void)_positionOverflowMenu;
-- (void)_checkWindowFrame;
-
-// actions
-- (void)overflowMenuAction:(id)sender;
-- (void)closeTabClick:(id)sender;
-- (void)tabClick:(id)sender;
-- (void)tabNothing:(id)sender;
-
-// notification handlers
-- (void)frameDidChange:(NSNotification *)notification;
-- (void)windowDidMove:(NSNotification *)aNotification;
-- (void)windowDidUpdate:(NSNotification *)notification;
-
-// NSTabView delegate
-- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem;
-- (BOOL)tabView:(NSTabView *)tabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem;
-- (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem;
-- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)tabView;
-
-// archiving
-- (void)encodeWithCoder:(NSCoder *)aCoder;
-- (id)initWithCoder:(NSCoder *)aDecoder;
-
-// convenience
-- (void)_bindPropertiesForCell:(PSMTabBarCell *)cell andTabViewItem:(NSTabViewItem *)item;
-- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
-
-- (void)_animateCells:(NSTimer *)timer;
-@end
-
-@implementation PSMTabBarControl
-
-#pragma mark -
-#pragma mark Characteristics
-
-+ (NSBundle *)bundle
-{
- static NSBundle *bundle = nil;
- if(!bundle) {
- bundle = [NSBundle bundleForClass:[PSMTabBarControl class]];
- }
- return bundle;
-}
-
-/*!
- @method availableCellWidth
- @abstract The number of pixels available for cells
- @discussion Calculates the number of pixels available for cells based on margins and the window resize badge.
- @returns Returns the amount of space for cells.
- */
-
-- (CGFloat)availableCellWidth {
- return [self frame].size.width - [style leftMarginForTabBarControl] - [style rightMarginForTabBarControl] - _resizeAreaCompensation;
-}
-
-/*!
- @method genericCellRect
- @abstract The basic rect for a tab cell.
- @discussion Creates a generic frame for a tab cell based on the current control state.
- @returns Returns a basic rect for a tab cell.
- */
-
-- (NSRect)genericCellRect {
- NSRect aRect = [self frame];
- aRect.origin.x = [style leftMarginForTabBarControl];
- aRect.origin.y = 0.0;
- aRect.size.width = [self availableCellWidth];
- aRect.size.height = [style tabCellHeight];
- return aRect;
-}
-
-#pragma mark -
-#pragma mark Constructor/destructor
-
-- (void)initAddedProperties {
- _cells = [[NSMutableArray alloc] initWithCapacity:10];
- _controller = [[PSMTabBarController alloc] initWithTabBarControl:self];
- _animationTimer = nil;
-
- // default config
- _currentStep = kPSMIsNotBeingResized;
- _orientation = PSMTabBarHorizontalOrientation;
- _canCloseOnlyTab = NO;
- _disableTabClose = NO;
- _showAddTabButton = NO;
- _hideForSingleTab = NO;
- _sizeCellsToFit = NO;
- _isHidden = NO;
- _awakenedFromNib = NO;
- _automaticallyAnimates = NO;
- _useOverflowMenu = YES;
- _allowsBackgroundTabClosing = YES;
- _allowsResizing = NO;
- _selectsTabsOnMouseDown = NO;
- _alwaysShowActiveTab = NO;
- _allowsScrubbing = NO;
- _cellMinWidth = 100;
- _cellMaxWidth = 280;
- _cellOptimumWidth = 130;
- _tearOffStyle = PSMTabBarTearOffAlphaWindow;
- style = [[[[self class] defaultStyleClass] alloc] init];
-
- // the overflow button/menu
- NSRect overflowButtonRect = NSMakeRect([self frame].size.width - [style rightMarginForTabBarControl] + 1, 0, [style rightMarginForTabBarControl] - 1, [self frame].size.height);
- _overflowPopUpButton = [[PSMOverflowPopUpButton alloc] initWithFrame:overflowButtonRect pullsDown:YES];
- [_overflowPopUpButton setAutoresizingMask:NSViewNotSizable | NSViewMinXMargin];
- [_overflowPopUpButton setHidden:YES];
- [self addSubview:_overflowPopUpButton];
- [self _positionOverflowMenu];
-
- // new tab button
- NSRect addTabButtonRect = NSMakeRect([self frame].size.width - [style rightMarginForTabBarControl] + 1, 3.0, 16.0, 16.0);
- _addTabButton = [[PSMRolloverButton alloc] initWithFrame:addTabButtonRect];
- if(_addTabButton) {
- NSImage *newButtonImage = [style addTabButtonImage];
- if(newButtonImage) {
- [_addTabButton setUsualImage:newButtonImage];
- }
- newButtonImage = [style addTabButtonPressedImage];
- if(newButtonImage) {
- [_addTabButton setAlternateImage:newButtonImage];
- }
- newButtonImage = [style addTabButtonRolloverImage];
- if(newButtonImage) {
- [_addTabButton setRolloverImage:newButtonImage];
- }
- [_addTabButton setTitle:@""];
- [_addTabButton setImagePosition:NSImageOnly];
- [_addTabButton setButtonType:NSMomentaryChangeButton];
- [_addTabButton setBordered:NO];
- [_addTabButton setBezelStyle:NSShadowlessSquareBezelStyle];
- [self addSubview:_addTabButton];
-
- if(_showAddTabButton) {
- [_addTabButton setHidden:NO];
- } else {
- [_addTabButton setHidden:YES];
- }
- [_addTabButton setNeedsDisplay:YES];
- }
-}
-
-+ (Class) defaultStyleClass
-{
- return [PSMUnifiedTabStyle class];
-}
-
-- (id)initWithFrame:(NSRect)frame {
- self = [super initWithFrame:frame];
- if(self) {
- // Initialization
- [self initAddedProperties];
- [self registerForDraggedTypes:[NSArray arrayWithObjects:@"PSMTabBarControlItemPBType", nil]];
-
- // resize
- [self setPostsFrameChangedNotifications:YES];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(frameDidChange:) name:NSViewFrameDidChangeNotification object:self];
- }
- [self setTarget:self];
- return self;
-}
-
-- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-
- //stop any animations that may be running
- [_animationTimer invalidate];
- [_animationTimer release]; _animationTimer = nil;
-
- [_showHideAnimationTimer invalidate];
- [_showHideAnimationTimer release]; _showHideAnimationTimer = nil;
-
- //Also unwind the spring, if it's wound.
- [_springTimer invalidate];
- [_springTimer release]; _springTimer = nil;
-
- //unbind all the items to prevent crashing
- //not sure if this is necessary or not
- // http://code.google.com/p/maccode/issues/detail?id=35
- NSEnumerator *enumerator = [[[_cells copy] autorelease] objectEnumerator];
- PSMTabBarCell *nextCell;
- while((nextCell = [enumerator nextObject])) {
- [self removeTabForCell:nextCell];
- }
-
- [_overflowPopUpButton release];
- [_cells release];
- [_controller release];
- [tabView release];
- [_addTabButton release];
- [partnerView release];
- [_lastMouseDownEvent release];
- [style release];
-
- [self unregisterDraggedTypes];
-
- [super dealloc];
-}
-
-- (void)awakeFromNib {
- // build cells from existing tab view items
- NSArray *existingItems = [tabView tabViewItems];
- NSEnumerator *e = [existingItems objectEnumerator];
- NSTabViewItem *item;
- while((item = [e nextObject])) {
- if(![[self representedTabViewItems] containsObject:item]) {
- [self addTabViewItem:item];
- }
- }
-}
-
-- (void)viewWillMoveToWindow:(NSWindow *)aWindow {
- NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
-
- [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil];
- [center removeObserver:self name:NSWindowDidResignKeyNotification object:nil];
- [center removeObserver:self name:NSWindowDidUpdateNotification object:nil];
- [center removeObserver:self name:NSWindowDidMoveNotification object:nil];
-
- if(_showHideAnimationTimer) {
- [_showHideAnimationTimer invalidate];
- [_showHideAnimationTimer release]; _showHideAnimationTimer = nil;
- }
-
- if(aWindow) {
- [center addObserver:self selector:@selector(windowStatusDidChange:) name:NSWindowDidBecomeKeyNotification object:aWindow];
- [center addObserver:self selector:@selector(windowStatusDidChange:) name:NSWindowDidResignKeyNotification object:aWindow];
- [center addObserver:self selector:@selector(windowDidUpdate:) name:NSWindowDidUpdateNotification object:aWindow];
- [center addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:aWindow];
- }
-}
-
-- (void)windowStatusDidChange:(NSNotification *)notification {
- [self setNeedsDisplay:YES];
-}
-
-#pragma mark -
-#pragma mark Accessors
-
-- (NSMutableArray *)cells {
- return _cells;
-}
-
-- (NSEvent *)lastMouseDownEvent {
- return _lastMouseDownEvent;
-}
-
-- (void)setLastMouseDownEvent:(NSEvent *)event {
- [event retain];
- [_lastMouseDownEvent release];
- _lastMouseDownEvent = event;
-}
-
-- (id)delegate {
- return delegate;
-}
-
-- (void)setDelegate:(id)object {
- delegate = object;
-
- NSMutableArray *types = [NSMutableArray arrayWithObject:@"PSMTabBarControlItemPBType"];
-
- //Update the allowed drag types
- if([self delegate] && [[self delegate] respondsToSelector:@selector(allowedDraggedTypesForTabView:)]) {
- [types addObjectsFromArray:[[self delegate] allowedDraggedTypesForTabView:tabView]];
- }
- [self unregisterDraggedTypes];
- [self registerForDraggedTypes:types];
-}
-
-- (NSTabView *)tabView {
- return tabView;
-}
-
-- (void)setTabView:(NSTabView *)view {
- [view retain];
- [tabView release];
- tabView = view;
-}
-
-- (id<PSMTabStyle>)style {
- return style;
-}
-
-- (NSString *)styleName {
- return [style name];
-}
-
-- (void)setStyle:(id <PSMTabStyle>)newStyle {
- if(style != newStyle) {
- [style autorelease];
- style = [newStyle retain];
-
- // restyle add tab button
- if(_addTabButton) {
- NSImage *newButtonImage = [style addTabButtonImage];
- if(newButtonImage) {
- [_addTabButton setUsualImage:newButtonImage];
- }
-
- newButtonImage = [style addTabButtonPressedImage];
- if(newButtonImage) {
- [_addTabButton setAlternateImage:newButtonImage];
- }
-
- newButtonImage = [style addTabButtonRolloverImage];
- if(newButtonImage) {
- [_addTabButton setRolloverImage:newButtonImage];
- }
- }
-
- [self update];
- }
-}
-
-- (void)setStyleNamed:(NSString *)name {
-
- Class styleClass = NSClassFromString( [NSString stringWithFormat: @"PSM%@TabStyle", [name capitalizedString]] );
- if (styleClass == Nil) {
- styleClass = object_getClass([PSMTabBarControl defaultStyleClass]);
- }
-
- id <PSMTabStyle> newStyle = [[styleClass alloc] init];
- [self setStyle:newStyle];
- [newStyle release];
-}
-
-- (PSMTabBarOrientation)orientation {
- return _orientation;
-}
-
-- (void)setOrientation:(PSMTabBarOrientation)value {
- PSMTabBarOrientation lastOrientation = _orientation;
- _orientation = value;
-
- if(_tabBarWidth < 10) {
- _tabBarWidth = 120;
- }
-
- if (lastOrientation != _orientation) {
- [[self style] setOrientation:_orientation];
-
- [self _positionOverflowMenu]; //move the overflow popup button to the right place
- [self update:NO];
- }
-}
-
-- (BOOL)canCloseOnlyTab {
- return _canCloseOnlyTab;
-}
-
-- (void)setCanCloseOnlyTab:(BOOL)value {
- _canCloseOnlyTab = value;
- if([_cells count] == 1) {
- [self update];
- }
-}
-
-- (BOOL)disableTabClose {
- return _disableTabClose;
-}
-
-- (void)setDisableTabClose:(BOOL)value {
- _disableTabClose = value;
- [self update];
-}
-
-- (BOOL)hideForSingleTab {
- return _hideForSingleTab;
-}
-
-- (void)setHideForSingleTab:(BOOL)value {
- _hideForSingleTab = value;
- [self update];
-}
-
-- (BOOL)showAddTabButton {
- return _showAddTabButton;
-}
-
-- (void)setShowAddTabButton:(BOOL)value {
- _showAddTabButton = value;
- if(!NSIsEmptyRect([_controller addButtonRect])) {
- [_addTabButton setFrame:[_controller addButtonRect]];
- }
-
- [_addTabButton setHidden:!_showAddTabButton];
- [_addTabButton setNeedsDisplay:YES];
-
- [self update];
-}
-
-- (NSInteger)cellMinWidth {
- return _cellMinWidth;
-}
-
-- (void)setCellMinWidth:(NSInteger)value {
- _cellMinWidth = value;
- [self update];
-}
-
-- (NSInteger)cellMaxWidth {
- return _cellMaxWidth;
-}
-
-- (void)setCellMaxWidth:(NSInteger)value {
- _cellMaxWidth = value;
- [self update];
-}
-
-- (NSInteger)cellOptimumWidth {
- return _cellOptimumWidth;
-}
-
-- (void)setCellOptimumWidth:(NSInteger)value {
- _cellOptimumWidth = value;
- [self update];
-}
-
-- (BOOL)sizeCellsToFit {
- return _sizeCellsToFit;
-}
-
-- (void)setSizeCellsToFit:(BOOL)value {
- _sizeCellsToFit = value;
- [self update];
-}
-
-- (BOOL)useOverflowMenu {
- return _useOverflowMenu;
-}
-
-- (void)setUseOverflowMenu:(BOOL)value {
- _useOverflowMenu = value;
- [self update];
-}
-
-- (PSMRolloverButton *)addTabButton {
- return _addTabButton;
-}
-
-- (PSMOverflowPopUpButton *)overflowPopUpButton {
- return _overflowPopUpButton;
-}
-
-- (BOOL)allowsBackgroundTabClosing {
- return _allowsBackgroundTabClosing;
-}
-
-- (void)setAllowsBackgroundTabClosing:(BOOL)value {
- _allowsBackgroundTabClosing = value;
-}
-
-- (BOOL)allowsResizing {
- return _allowsResizing;
-}
-
-- (void)setAllowsResizing:(BOOL)value {
- _allowsResizing = value;
-}
-
-- (BOOL)selectsTabsOnMouseDown {
- return _selectsTabsOnMouseDown;
-}
-
-- (void)setSelectsTabsOnMouseDown:(BOOL)value {
- _selectsTabsOnMouseDown = value;
-}
-
-- (BOOL)automaticallyAnimates {
- return _automaticallyAnimates;
-}
-
-- (void)setAutomaticallyAnimates:(BOOL)value {
- _automaticallyAnimates = value;
-}
-
-- (BOOL)alwaysShowActiveTab {
- return _alwaysShowActiveTab;
-}
-
-- (void)setAlwaysShowActiveTab:(BOOL)value {
- _alwaysShowActiveTab = value;
-}
-
-- (BOOL)allowsScrubbing {
- return _allowsScrubbing;
-}
-
-- (void)setAllowsScrubbing:(BOOL)value {
- _allowsScrubbing = value;
-}
-
-- (PSMTabBarTearOffStyle)tearOffStyle {
- return _tearOffStyle;
-}
-
-- (void)setTearOffStyle:(PSMTabBarTearOffStyle)tearOffStyle {
- _tearOffStyle = tearOffStyle;
-}
-
-#pragma mark -
-#pragma mark Functionality
-
-- (void)addTabViewItem:(NSTabViewItem *)item {
- // create cell
- PSMTabBarCell *cell = [[PSMTabBarCell alloc] initWithControlView:self];
- NSRect cellRect, lastCellFrame;
- if([_cells lastObject] != nil) {
- cellRect = lastCellFrame = [[_cells lastObject] frame];
- } else {
- cellRect = lastCellFrame = NSZeroRect;
- }
-
- if([self orientation] == PSMTabBarHorizontalOrientation) {
- cellRect = [self genericCellRect];
- cellRect.size.width = 30;
- cellRect.origin.x = lastCellFrame.origin.x + lastCellFrame.size.width;
- } else {
- cellRect = /*lastCellFrame*/ [self genericCellRect];
- cellRect.size.width = lastCellFrame.size.width;
- cellRect.size.height = 0;
- cellRect.origin.y = lastCellFrame.origin.y + lastCellFrame.size.height;
- }
-
- [cell setRepresentedObject:item];
- [cell setFrame:cellRect];
-
- // bind it up
- [self bindPropertiesForCell:cell andTabViewItem:item];
-
- // add to collection
- [_cells addObject:cell];
- [cell release];
- if([_cells count] == (NSUInteger)[tabView numberOfTabViewItems]) {
- [self update]; // don't update unless all are accounted for!
- }
-}
-
-- (void)removeTabForCell:(PSMTabBarCell *)cell {
- NSTabViewItem *item = [cell representedObject];
-
- // unbind
- [[cell indicator] unbind:@"animate"];
- [[cell indicator] unbind:@"hidden"];
- [cell unbind:@"hasIcon"];
- [cell unbind:@"hasLargeImage"];
- [cell unbind:@"title"];
- [cell unbind:@"count"];
- [cell unbind:@"countColor"];
- [cell unbind:@"isEdited"];
-
- if([item identifier] != nil) {
- if([[item identifier] respondsToSelector:@selector(isProcessing)]) {
- [[item identifier] removeObserver:cell forKeyPath:@"isProcessing"];
- }
- }
-
- if([item identifier] != nil) {
- if([[item identifier] respondsToSelector:@selector(icon)]) {
- [[item identifier] removeObserver:cell forKeyPath:@"icon"];
- }
- }
-
- if([item identifier] != nil) {
- if([[item identifier] respondsToSelector:@selector(objectCount)]) {
- [[item identifier] removeObserver:cell forKeyPath:@"objectCount"];
- }
- }
-
- if([item identifier] != nil) {
- if([[item identifier] respondsToSelector:@selector(countColor)]) {
- [[item identifier] removeObserver:cell forKeyPath:@"countColor"];
- }
- }
-
- if([item identifier] != nil) {
- if([[item identifier] respondsToSelector:@selector(largeImage)]) {
- [[item identifier] removeObserver:cell forKeyPath:@"largeImage"];
- }
- }
-
- if([item identifier] != nil) {
- if([[item identifier] respondsToSelector:@selector(isEdited)]) {
- [[item identifier] removeObserver:cell forKeyPath:@"isEdited"];
- }
- }
-
- // stop watching identifier
- [item removeObserver:self forKeyPath:@"identifier"];
-
- // remove indicator
- if([[self subviews] containsObject:[cell indicator]]) {
- [[cell indicator] removeFromSuperview];
- }
- // remove tracking
- [[NSNotificationCenter defaultCenter] removeObserver:cell];
-
- if([cell closeButtonTrackingTag] != 0) {
- [self removeTrackingRect:[cell closeButtonTrackingTag]];
- [cell setCloseButtonTrackingTag:0];
- }
- if([cell cellTrackingTag] != 0) {
- [self removeTrackingRect:[cell cellTrackingTag]];
- [cell setCellTrackingTag:0];
- }
-
- // pull from collection
- [_cells removeObject:cell];
-
- [self update];
-}
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
- // did the tab's identifier change?
- if([keyPath isEqualToString:@"identifier"]) {
- NSEnumerator *e = [_cells objectEnumerator];
- PSMTabBarCell *cell;
- while((cell = [e nextObject])) {
- if([cell representedObject] == object) {
- [self _bindPropertiesForCell:cell andTabViewItem:object];
- }
- }
- }
-}
-
-#pragma mark -
-#pragma mark Hide/Show
-
-- (void)hideTabBar:(BOOL)hide animate:(BOOL)animate {
- if(!_awakenedFromNib || (_isHidden && hide) || (!_isHidden && !hide) || (_currentStep != kPSMIsNotBeingResized)) {
- return;
- }
-
- [[self subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
-
- _isHidden = hide;
- _currentStep = 0;
- if(!animate) {
- _currentStep = (NSInteger)kPSMHideAnimationSteps;
- }
-
- if(hide) {
- [_overflowPopUpButton removeFromSuperview];
- [_addTabButton removeFromSuperview];
- } else if(!animate) {
- [self addSubview:_overflowPopUpButton];
- [self addSubview:_addTabButton];
- }
-
- CGFloat partnerOriginalSize, partnerOriginalOrigin, myOriginalSize, myOriginalOrigin, partnerTargetSize, partnerTargetOrigin, myTargetSize, myTargetOrigin;
-
- // target values for partner
- if([self orientation] == PSMTabBarHorizontalOrientation) {
- // current (original) values
- myOriginalSize = [self frame].size.height;
- myOriginalOrigin = [self frame].origin.y;
- if(partnerView) {
- partnerOriginalSize = [partnerView frame].size.height;
- partnerOriginalOrigin = [partnerView frame].origin.y;
- } else {
- partnerOriginalSize = [[self window] frame].size.height;
- partnerOriginalOrigin = [[self window] frame].origin.y;
- }
-
- if(partnerView) {
- // above or below me?
- if((myOriginalOrigin - 22) > partnerOriginalOrigin) {
- // partner is below me
- if(_isHidden) {
- // I'm shrinking
- myTargetOrigin = myOriginalOrigin + 21;
- myTargetSize = myOriginalSize - 21;
- partnerTargetOrigin = partnerOriginalOrigin;
- partnerTargetSize = partnerOriginalSize + 21;
- } else {
- // I'm growing
- myTargetOrigin = myOriginalOrigin - 21;
- myTargetSize = myOriginalSize + 21;
- partnerTargetOrigin = partnerOriginalOrigin;
- partnerTargetSize = partnerOriginalSize - 21;
- }
- } else {
- // partner is above me
- if(_isHidden) {
- // I'm shrinking
- myTargetOrigin = myOriginalOrigin;
- myTargetSize = myOriginalSize - 21;
- partnerTargetOrigin = partnerOriginalOrigin - 21;
- partnerTargetSize = partnerOriginalSize + 21;
- } else {
- // I'm growing
- myTargetOrigin = myOriginalOrigin;
- myTargetSize = myOriginalSize + 21;
- partnerTargetOrigin = partnerOriginalOrigin + 21;
- partnerTargetSize = partnerOriginalSize - 21;
- }
- }
- } else {
- // for window movement
- if(_isHidden) {
- // I'm shrinking
- myTargetOrigin = myOriginalOrigin;
- myTargetSize = myOriginalSize - 21;
- partnerTargetOrigin = partnerOriginalOrigin + 21;
- partnerTargetSize = partnerOriginalSize - 21;
- } else {
- // I'm growing
- myTargetOrigin = myOriginalOrigin;
- myTargetSize = myOriginalSize + 21;
- partnerTargetOrigin = partnerOriginalOrigin - 21;
- partnerTargetSize = partnerOriginalSize + 21;
- }
- }
- } else { /* vertical */
- // current (original) values
- myOriginalSize = [self frame].size.width;
- myOriginalOrigin = [self frame].origin.x;
- if(partnerView) {
- partnerOriginalSize = [partnerView frame].size.width;
- partnerOriginalOrigin = [partnerView frame].origin.x;
- } else {
- partnerOriginalSize = [[self window] frame].size.width;
- partnerOriginalOrigin = [[self window] frame].origin.x;
- }
-
- if(partnerView) {
- //to the left or right?
- if(myOriginalOrigin < partnerOriginalOrigin + partnerOriginalSize) {
- // partner is to the left
- if(_isHidden) {
- // I'm shrinking
- myTargetOrigin = myOriginalOrigin;
- myTargetSize = 1;
- partnerTargetOrigin = partnerOriginalOrigin - myOriginalSize + 1;
- partnerTargetSize = partnerOriginalSize + myOriginalSize - 1;
- _tabBarWidth = myOriginalSize;
- } else {
- // I'm growing
- myTargetOrigin = myOriginalOrigin;
- myTargetSize = myOriginalSize + _tabBarWidth;
- partnerTargetOrigin = partnerOriginalOrigin + _tabBarWidth;
- partnerTargetSize = partnerOriginalSize - _tabBarWidth;
- }
- } else {
- // partner is to the right
- if(_isHidden) {
- // I'm shrinking
- myTargetOrigin = myOriginalOrigin + myOriginalSize;
- myTargetSize = 1;
- partnerTargetOrigin = partnerOriginalOrigin;
- partnerTargetSize = partnerOriginalSize + myOriginalSize;
- _tabBarWidth = myOriginalSize;
- } else {
- // I'm growing
- myTargetOrigin = myOriginalOrigin - _tabBarWidth;
- myTargetSize = myOriginalSize + _tabBarWidth;
- partnerTargetOrigin = partnerOriginalOrigin;
- partnerTargetSize = partnerOriginalSize - _tabBarWidth;
- }
- }
- } else {
- // for window movement
- if(_isHidden) {
- // I'm shrinking
- myTargetOrigin = myOriginalOrigin;
- myTargetSize = 1;
- partnerTargetOrigin = partnerOriginalOrigin + myOriginalSize - 1;
- partnerTargetSize = partnerOriginalSize - myOriginalSize + 1;
- _tabBarWidth = myOriginalSize;
- } else {
- // I'm growing
- myTargetOrigin = myOriginalOrigin;
- myTargetSize = _tabBarWidth;
- partnerTargetOrigin = partnerOriginalOrigin - _tabBarWidth + 1;
- partnerTargetSize = partnerOriginalSize + _tabBarWidth - 1;
- }
- }
-
- if(!_isHidden && [[self delegate] respondsToSelector:@selector(desiredWidthForVerticalTabBar:)]) {
- myTargetSize = [[self delegate] desiredWidthForVerticalTabBar:self];
- }
- }
-
- NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithDouble:myOriginalOrigin], @"myOriginalOrigin", [NSNumber numberWithDouble:partnerOriginalOrigin], @"partnerOriginalOrigin", [NSNumber numberWithDouble:myOriginalSize], @"myOriginalSize", [NSNumber numberWithDouble:partnerOriginalSize], @"partnerOriginalSize", [NSNumber numberWithDouble:myTargetOrigin], @"myTargetOrigin", [NSNumber numberWithDouble:partnerTargetOrigin], @"partnerTargetOrigin", [NSNumber numberWithDouble:myTargetSize], @"myTargetSize", [NSNumber numberWithDouble:partnerTargetSize], @"partnerTargetSize", nil];
- if(_showHideAnimationTimer) {
- [_showHideAnimationTimer invalidate];
- [_showHideAnimationTimer release];
- }
- _showHideAnimationTimer = [[NSTimer scheduledTimerWithTimeInterval:(1.0 / 30.0) target:self selector:@selector(animateShowHide:) userInfo:userInfo repeats:YES] retain];
-}
-
-- (void)animateShowHide:(NSTimer *)timer {
- // moves the frame of the tab bar and window (or partner view) linearly to hide or show the tab bar
- NSRect myFrame = [self frame];
- NSDictionary *userInfo = [timer userInfo];
- CGFloat myCurrentOrigin = ([[userInfo objectForKey:@"myOriginalOrigin"] doubleValue] + (([[userInfo objectForKey:@"myTargetOrigin"] doubleValue] - [[userInfo objectForKey:@"myOriginalOrigin"] doubleValue]) * (_currentStep / kPSMHideAnimationSteps)));
- CGFloat myCurrentSize = ([[userInfo objectForKey:@"myOriginalSize"] doubleValue] + (([[userInfo objectForKey:@"myTargetSize"] doubleValue] - [[userInfo objectForKey:@"myOriginalSize"] doubleValue]) * (_currentStep / kPSMHideAnimationSteps)));
- CGFloat partnerCurrentOrigin = ([[userInfo objectForKey:@"partnerOriginalOrigin"] doubleValue] + (([[userInfo objectForKey:@"partnerTargetOrigin"] doubleValue] - [[userInfo objectForKey:@"partnerOriginalOrigin"] doubleValue]) * (_currentStep / kPSMHideAnimationSteps)));
- CGFloat partnerCurrentSize = ([[userInfo objectForKey:@"partnerOriginalSize"] doubleValue] + (([[userInfo objectForKey:@"partnerTargetSize"] doubleValue] - [[userInfo objectForKey:@"partnerOriginalSize"] doubleValue]) * (_currentStep / kPSMHideAnimationSteps)));
-
- NSRect myNewFrame;
- if([self orientation] == PSMTabBarHorizontalOrientation) {
- myNewFrame = NSMakeRect(myFrame.origin.x, myCurrentOrigin, myFrame.size.width, myCurrentSize);
- } else {
- myNewFrame = NSMakeRect(myCurrentOrigin, myFrame.origin.y, myCurrentSize, myFrame.size.height);
- }
-
- if(partnerView) {
- // resize self and view
- NSRect resizeRect;
- if([self orientation] == PSMTabBarHorizontalOrientation) {
- resizeRect = NSMakeRect([partnerView frame].origin.x, partnerCurrentOrigin, [partnerView frame].size.width, partnerCurrentSize);
- } else {
- resizeRect = NSMakeRect(partnerCurrentOrigin, [partnerView frame].origin.y, partnerCurrentSize, [partnerView frame].size.height);
- }
- [partnerView setFrame:resizeRect];
- [partnerView setNeedsDisplay:YES];
- [self setFrame:myNewFrame];
- } else {
- // resize self and window
- NSRect resizeRect;
- if([self orientation] == PSMTabBarHorizontalOrientation) {
- resizeRect = NSMakeRect([[self window] frame].origin.x, partnerCurrentOrigin, [[self window] frame].size.width, partnerCurrentSize);
- } else {
- resizeRect = NSMakeRect(partnerCurrentOrigin, [[self window] frame].origin.y, partnerCurrentSize, [[self window] frame].size.height);
- }
- [[self window] setFrame:resizeRect display:YES];
- [self setFrame:myNewFrame];
- }
-
- // next
- _currentStep++;
- if(_currentStep == kPSMHideAnimationSteps + 1) {
- _currentStep = kPSMIsNotBeingResized;
- [self viewDidEndLiveResize];
- [self update:NO];
-
- //send the delegate messages
- if(_isHidden) {
- if([[self delegate] respondsToSelector:@selector(tabView:tabBarDidHide:)]) {
- [[self delegate] tabView:[self tabView] tabBarDidHide:self];
- }
- } else {
- [self addSubview:_overflowPopUpButton];
- [self addSubview:_addTabButton];
-
- if([[self delegate] respondsToSelector:@selector(tabView:tabBarDidUnhide:)]) {
- [[self delegate] tabView:[self tabView] tabBarDidUnhide:self];
- }
- }
-
- [_showHideAnimationTimer invalidate];
- [_showHideAnimationTimer release]; _showHideAnimationTimer = nil;
- }
- [[self window] display];
-}
-
-- (BOOL)isTabBarHidden {
- return _isHidden;
-}
-
-- (BOOL)isAnimating {
- return _animationTimer != nil;
-}
-
-- (id)partnerView {
- return partnerView;
-}
-
-- (void)setPartnerView:(id)view {
- [partnerView release];
- [view retain];
- partnerView = view;
-}
-
-#pragma mark -
-#pragma mark Drawing
-
-- (BOOL)isFlipped {
- return YES;
-}
-
-- (void)drawRect:(NSRect)rect {
- [style drawTabBar:self inRect:rect];
-}
-
-- (void)update {
- [self update:_automaticallyAnimates];
-}
-
-- (void)update:(BOOL)animate {
- // make sure all of our tabs are accounted for before updating
- if((NSUInteger)[[self tabView] numberOfTabViewItems] != [_cells count]) {
- return;
- }
-
- // hide/show? (these return if already in desired state)
- if((_hideForSingleTab) && ([_cells count] <= 1)) {
- [self hideTabBar:YES animate:YES];
- return;
- } else {
- [self hideTabBar:NO animate:YES];
- }
-
- [self removeAllToolTips];
- [_controller layoutCells]; //eventually we should only have to call this when we know something has changed
-
- PSMTabBarCell *currentCell;
-
- NSMenu *overflowMenu = [_controller overflowMenu];
- [_overflowPopUpButton setHidden:(overflowMenu == nil)];
- [_overflowPopUpButton setMenu:overflowMenu];
-
- if(_animationTimer) {
- [_animationTimer invalidate];
- [_animationTimer release]; _animationTimer = nil;
- }
-
- if(animate) {
- NSMutableArray *targetFrames = [NSMutableArray arrayWithCapacity:[_cells count]];
-
- for(NSUInteger i = 0; i < [_cells count]; i++) {
- currentCell = [_cells objectAtIndex:i];
-
- //we're going from NSRect -> NSValue -> NSRect -> NSValue here - oh well
- [targetFrames addObject:[NSValue valueWithRect:[_controller cellFrameAtIndex:i]]];
- }
-
- [_addTabButton setHidden:!_showAddTabButton];
-
- NSAnimation *animation = [[NSAnimation alloc] initWithDuration:0.50 animationCurve:NSAnimationEaseInOut];
- [animation setAnimationBlockingMode:NSAnimationNonblocking];
- [animation startAnimation];
- _animationTimer = [[NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0
- target:self
- selector:@selector(_animateCells:)
- userInfo:[NSArray arrayWithObjects:targetFrames, animation, nil]
- repeats:YES] retain];
- [animation release];
- [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode];
- [self _animateCells:_animationTimer];
- } else {
- for(NSUInteger i = 0; i < [_cells count]; i++) {
- currentCell = [_cells objectAtIndex:i];
- [currentCell setFrame:[_controller cellFrameAtIndex:i]];
-
- if(![currentCell isInOverflowMenu]) {
- [self _setupTrackingRectsForCell:currentCell];
- }
- }
-
- [_addTabButton setFrame:[_controller addButtonRect]];
- [_addTabButton setHidden:!_showAddTabButton];
- [self setNeedsDisplay:YES];
- }
-}
-
-- (void)_animateCells:(NSTimer *)timer {
- NSAnimation *animation = [[timer userInfo] objectAtIndex:1];
- NSArray *targetFrames = [[timer userInfo] objectAtIndex:0];
- PSMTabBarCell *currentCell;
- NSUInteger cellCount = [_cells count];
-
- if((cellCount > 0) && [animation isAnimating]) {
- //compare our target position with the current position and move towards the target
- for(NSUInteger i = 0; i < [targetFrames count] && i < cellCount; i++) {
- currentCell = [_cells objectAtIndex:i];
- NSRect cellFrame = [currentCell frame], targetFrame = [[targetFrames objectAtIndex:i] rectValue];
- CGFloat sizeChange;
- CGFloat originChange;
-
- if([self orientation] == PSMTabBarHorizontalOrientation) {
- sizeChange = (targetFrame.size.width - cellFrame.size.width) * [animation currentProgress];
- originChange = (targetFrame.origin.x - cellFrame.origin.x) * [animation currentProgress];
- cellFrame.size.width += sizeChange;
- cellFrame.origin.x += originChange;
- } else {
- sizeChange = (targetFrame.size.height - cellFrame.size.height) * [animation currentProgress];
- originChange = (targetFrame.origin.y - cellFrame.origin.y) * [animation currentProgress];
- cellFrame.size.height += sizeChange;
- cellFrame.origin.y += originChange;
- }
-
- [currentCell setFrame:cellFrame];
-
- //highlight the cell if the mouse is over it
- NSPoint mousePoint = [self convertPoint:[[self window] mouseLocationOutsideOfEventStream] fromView:nil];
- NSRect closeRect = [currentCell closeButtonRectForFrame:cellFrame];
- [currentCell setHighlighted:NSMouseInRect(mousePoint, cellFrame, [self isFlipped])];
- [currentCell setCloseButtonOver:NSMouseInRect(mousePoint, closeRect, [self isFlipped])];
- }
-
- if(_showAddTabButton) {
- //animate the add tab button
- NSRect target = [_controller addButtonRect], frame = [_addTabButton frame];
- frame.origin.x += (target.origin.x - frame.origin.x) * [animation currentProgress];
- [_addTabButton setFrame:frame];
- }
- } else {
- //put all the cells where they should be in their final position
- if(cellCount > 0) {
- for(NSUInteger i = 0; i < [targetFrames count] && i < cellCount; i++) {
- PSMTabBarCell *currentCell = [_cells objectAtIndex:i];
- NSRect cellFrame = [currentCell frame], targetFrame = [[targetFrames objectAtIndex:i] rectValue];
-
- if([self orientation] == PSMTabBarHorizontalOrientation) {
- cellFrame.size.width = targetFrame.size.width;
- cellFrame.origin.x = targetFrame.origin.x;
- } else {
- cellFrame.size.height = targetFrame.size.height;
- cellFrame.origin.y = targetFrame.origin.y;
- }
-
- [currentCell setFrame:cellFrame];
-
- //highlight the cell if the mouse is over it
- NSPoint mousePoint = [self convertPoint:[[self window] mouseLocationOutsideOfEventStream] fromView:nil];
- NSRect closeRect = [currentCell closeButtonRectForFrame:cellFrame];
- [currentCell setHighlighted:NSMouseInRect(mousePoint, cellFrame, [self isFlipped])];
- [currentCell setCloseButtonOver:NSMouseInRect(mousePoint, closeRect, [self isFlipped])];
- }
- }
-
- //set the frame for the add tab button
- if(_showAddTabButton) {
- NSRect frame = [_addTabButton frame];
- frame.origin.x = [_controller addButtonRect].origin.x;
- [_addTabButton setFrame:frame];
- }
-
- [_animationTimer invalidate];
- [_animationTimer release]; _animationTimer = nil;
-
- for(NSUInteger i = 0; i < cellCount; i++) {
- currentCell = [_cells objectAtIndex:i];
-
- //we've hit the cells that are in overflow, stop setting up tracking rects
- if([currentCell isInOverflowMenu]) {
- break;
- }
-
- [self _setupTrackingRectsForCell:currentCell];
- }
- }
-
- [self setNeedsDisplay:YES];
-}
-
-- (void)_setupTrackingRectsForCell:(PSMTabBarCell *)cell {
- NSInteger tag, index = [_cells indexOfObject:cell];
- NSRect cellTrackingRect = [_controller cellTrackingRectAtIndex:index];
- NSPoint mousePoint = [self convertPoint:[[self window] mouseLocationOutsideOfEventStream] fromView:nil];
- BOOL mouseInCell = NSMouseInRect(mousePoint, cellTrackingRect, [self isFlipped]);
-
- //set the cell tracking rect
- [self removeTrackingRect:[cell cellTrackingTag]];
- tag = [self addTrackingRect:cellTrackingRect owner:cell userData:nil assumeInside:mouseInCell];
- [cell setCellTrackingTag:tag];
- [cell setHighlighted:mouseInCell];
-
- if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
- NSRect closeRect = [_controller closeButtonTrackingRectAtIndex:index];
- BOOL mouseInCloseRect = NSMouseInRect(mousePoint, closeRect, [self isFlipped]);
-
- //set the close button tracking rect
- [self removeTrackingRect:[cell closeButtonTrackingTag]];
- tag = [self addTrackingRect:closeRect owner:cell userData:nil assumeInside:mouseInCloseRect];
- [cell setCloseButtonTrackingTag:tag];
-
- [cell setCloseButtonOver:mouseInCloseRect];
- }
-
- //set the tooltip tracking rect
- [self addToolTipRect:[cell frame] owner:self userData:nil];
-}
-
-- (void)_positionOverflowMenu {
- NSRect cellRect, frame = [self frame];
- cellRect.size.height = [style tabCellHeight];
- cellRect.size.width = [style rightMarginForTabBarControl];
-
- if([self orientation] == PSMTabBarHorizontalOrientation) {
- cellRect.origin.y = 0;
- cellRect.origin.x = frame.size.width - [style rightMarginForTabBarControl] + (_resizeAreaCompensation ? -(_resizeAreaCompensation - 1) : 1);
- [_overflowPopUpButton setAutoresizingMask:NSViewNotSizable | NSViewMinXMargin];
- } else {
- cellRect.origin.x = 0;
- cellRect.origin.y = frame.size.height - [style tabCellHeight];
- cellRect.size.width = frame.size.width;
- [_overflowPopUpButton setAutoresizingMask:NSViewNotSizable | NSViewMinXMargin | NSViewMinYMargin];
- }
-
- [_overflowPopUpButton setFrame:cellRect];
-}
-
-- (void)_checkWindowFrame {
- //figure out if the new frame puts the control in the way of the resize widget
- NSWindow *window = [self window];
-
- if(window) {
- NSRect resizeWidgetFrame = [[window contentView] frame];
- resizeWidgetFrame.origin.x += resizeWidgetFrame.size.width - 22;
- resizeWidgetFrame.size.width = 22;
- resizeWidgetFrame.size.height = 22;
-
- if([window showsResizeIndicator] && NSIntersectsRect([self frame], resizeWidgetFrame)) {
- //the resize widgets are larger on metal windows
- _resizeAreaCompensation = [window styleMask] & NSTexturedBackgroundWindowMask ? 20 : 8;
- } else {
- _resizeAreaCompensation = 0;
- }
-
- [self _positionOverflowMenu];
- }
-}
-
-#pragma mark -
-#pragma mark Mouse Tracking
-
-- (BOOL)mouseDownCanMoveWindow {
- return NO;
-}
-
-- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent {
- return YES;
-}
-
-- (void)mouseDown:(NSEvent *)theEvent {
- _didDrag = NO;
-
- // keep for dragging
- [self setLastMouseDownEvent:theEvent];
- // what cell?
- NSPoint mousePt = [self convertPoint:[theEvent locationInWindow] fromView:nil];
- NSRect frame = [self frame];
-
- if([self orientation] == PSMTabBarVerticalOrientation && [self allowsResizing] && partnerView && (mousePt.x > frame.size.width - 3)) {
- _resizing = YES;
- }
-
- NSRect cellFrame;
- PSMTabBarCell *cell = [self cellForPoint:mousePt cellFrame:&cellFrame];
- if(cell) {
- BOOL overClose = NSMouseInRect(mousePt, [cell closeButtonRectForFrame:cellFrame], [self isFlipped]);
- if(overClose &&
- ![self disableTabClose] &&
- ![cell isCloseButtonSuppressed] &&
- ([self allowsBackgroundTabClosing] || [[cell representedObject] isEqualTo:[tabView selectedTabViewItem]] || [theEvent modifierFlags] & NSCommandKeyMask)) {
- [cell setCloseButtonOver:NO];
- [cell setCloseButtonPressed:YES];
- _closeClicked = YES;
- } else {
- [cell setCloseButtonPressed:NO];
- if(_selectsTabsOnMouseDown) {
- [self performSelector:@selector(tabClick:) withObject:cell];
- }
- }
- [self setNeedsDisplay:YES];
- }
-}
-
-- (void)mouseDragged:(NSEvent *)theEvent {
- if([self lastMouseDownEvent] == nil) {
- return;
- }
-
- NSPoint currentPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
-
- if(_resizing) {
- NSRect frame = [self frame];
- CGFloat resizeAmount = [theEvent deltaX];
- if((currentPoint.x > frame.size.width && resizeAmount > 0) || (currentPoint.x < frame.size.width && resizeAmount < 0)) {
- [[NSCursor resizeLeftRightCursor] push];
-
- NSRect partnerFrame = [partnerView frame];
-
- //do some bounds checking
- if((frame.size.width + resizeAmount > [self cellMinWidth]) && (frame.size.width + resizeAmount < [self cellMaxWidth])) {
- frame.size.width += resizeAmount;
- partnerFrame.size.width -= resizeAmount;
- partnerFrame.origin.x += resizeAmount;
-
- [self setFrame:frame];
- [partnerView setFrame:partnerFrame];
- [[self superview] setNeedsDisplay:YES];
- }
- }
- return;
- }
-
- NSRect cellFrame;
- NSPoint trackingStartPoint = [self convertPoint:[[self lastMouseDownEvent] locationInWindow] fromView:nil];
- PSMTabBarCell *cell = [self cellForPoint:trackingStartPoint cellFrame:&cellFrame];
- if(cell) {
- //check to see if the close button was the target in the clicked cell
- //highlight/unhighlight the close button as necessary
- NSRect iconRect = [cell closeButtonRectForFrame:cellFrame];
-
- if(_closeClicked && NSMouseInRect(trackingStartPoint, iconRect, [self isFlipped]) &&
- ([self allowsBackgroundTabClosing] || [[cell representedObject] isEqualTo:[tabView selectedTabViewItem]])) {
- [cell setCloseButtonPressed:NSMouseInRect(currentPoint, iconRect, [self isFlipped])];
- [self setNeedsDisplay:YES];
- return;
- }
-
- CGFloat dx = fabs(currentPoint.x - trackingStartPoint.x);
- CGFloat dy = fabs(currentPoint.y - trackingStartPoint.y);
- CGFloat distance = sqrt(dx * dx + dy * dy);
-
- if(distance >= 10 && !_didDrag && ![[PSMTabDragAssistant sharedDragAssistant] isDragging] &&
- [self delegate] && [[self delegate] respondsToSelector:@selector(tabView:shouldDragTabViewItem:fromTabBar:)] &&
- [[self delegate] tabView:tabView shouldDragTabViewItem:[cell representedObject] fromTabBar:self]) {
- _didDrag = YES;
- [[PSMTabDragAssistant sharedDragAssistant] startDraggingCell:cell fromTabBar:self withMouseDownEvent:[self lastMouseDownEvent]];
- }
- }
-}
-
-- (void)mouseUp:(NSEvent *)theEvent {
- if(_resizing) {
- _resizing = NO;
- [[NSCursor arrowCursor] set];
- } else {
- // what cell?
- NSPoint mousePt = [self convertPoint:[theEvent locationInWindow] fromView:nil];
- NSRect cellFrame, mouseDownCellFrame;
- PSMTabBarCell *cell = [self cellForPoint:mousePt cellFrame:&cellFrame];
- PSMTabBarCell *mouseDownCell = [self cellForPoint:[self convertPoint:[[self lastMouseDownEvent] locationInWindow] fromView:nil] cellFrame:&mouseDownCellFrame];
- if(cell) {
- NSPoint trackingStartPoint = [self convertPoint:[[self lastMouseDownEvent] locationInWindow] fromView:nil];
- NSRect iconRect = [mouseDownCell closeButtonRectForFrame:mouseDownCellFrame];
-
- if((NSMouseInRect(mousePt, iconRect, [self isFlipped])) && ![self disableTabClose] && ![cell isCloseButtonSuppressed] && [mouseDownCell closeButtonPressed]) {
- if(([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0) {
- //If the user is holding Option, close all other tabs
- NSEnumerator *enumerator = [[[[self cells] copy] autorelease] objectEnumerator];
- PSMTabBarCell *otherCell;
-
- while((otherCell = [enumerator nextObject])) {
- if(otherCell != cell) {
- [self performSelector:@selector(closeTabClick:) withObject:otherCell];
- }
- }
-
- //Fix the close button for the clicked tab not to be pressed
- [cell setCloseButtonPressed:NO];
- } else {
- //Otherwise, close this tab
- [self performSelector:@selector(closeTabClick:) withObject:cell];
- }
- } else if(NSMouseInRect(mousePt, mouseDownCellFrame, [self isFlipped]) &&
- (!NSMouseInRect(trackingStartPoint, [cell closeButtonRectForFrame:cellFrame], [self isFlipped]) || ![self allowsBackgroundTabClosing] || [self disableTabClose])) {
- [mouseDownCell setCloseButtonPressed:NO];
- // If -[self selectsTabsOnMouseDown] is TRUE, we already performed tabClick: on mouseDown.
- if(![self selectsTabsOnMouseDown]) {
- [self performSelector:@selector(tabClick:) withObject:cell];
- }
- } else {
- [mouseDownCell setCloseButtonPressed:NO];
- [self performSelector:@selector(tabNothing:) withObject:cell];
- }
- }
-
- _closeClicked = NO;
- }
-}
-
-- (NSMenu *)menuForEvent:(NSEvent *)event {
- NSMenu *menu = nil;
- NSTabViewItem *item = [[self cellForPoint:[self convertPoint:[event locationInWindow] fromView:nil] cellFrame:nil] representedObject];
-
- if(item && [[self delegate] respondsToSelector:@selector(tabView:menuForTabViewItem:)]) {
- menu = [[self delegate] tabView:tabView menuForTabViewItem:item];
- }
- return menu;
-}
-
-#pragma mark -
-#pragma mark Drag and Drop
-
-- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)theEvent {
- return YES;
-}
-
-// NSDraggingSource
-- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal {
- return(isLocal ? NSDragOperationMove : NSDragOperationNone);
-}
-
-- (BOOL)ignoreModifierKeysWhileDragging {
- return YES;
-}
-
-- (void)draggedImage:(NSImage *)anImage beganAt:(NSPoint)screenPoint {
- [[PSMTabDragAssistant sharedDragAssistant] draggingBeganAt:screenPoint];
-}
-
-- (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint {
- [[PSMTabDragAssistant sharedDragAssistant] draggingMovedTo:screenPoint];
-}
-
-// NSDraggingDestination
-- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
- if([[[sender draggingPasteboard] types] indexOfObject:@"PSMTabBarControlItemPBType"] != NSNotFound) {
- if([self delegate] && [[self delegate] respondsToSelector:@selector(tabView:shouldDropTabViewItem:inTabBar:)] &&
- ![[self delegate] tabView:[[sender draggingSource] tabView] shouldDropTabViewItem:[[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject] inTabBar:self]) {
- return NSDragOperationNone;
- }
-
- [[PSMTabDragAssistant sharedDragAssistant] draggingEnteredTabBar:self atPoint:[self convertPoint:[sender draggingLocation] fromView:nil]];
- return NSDragOperationMove;
- }
-
- return NSDragOperationNone;
-}
-
-- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender {
- PSMTabBarCell *cell = [self cellForPoint:[self convertPoint:[sender draggingLocation] fromView:nil] cellFrame:nil];
-
- if([[[sender draggingPasteboard] types] indexOfObject:@"PSMTabBarControlItemPBType"] != NSNotFound) {
- if([self delegate] && [[self delegate] respondsToSelector:@selector(tabView:shouldDropTabViewItem:inTabBar:)] &&
- ![[self delegate] tabView:[[sender draggingSource] tabView] shouldDropTabViewItem:[[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject] inTabBar:self]) {
- return NSDragOperationNone;
- }
-
- [[PSMTabDragAssistant sharedDragAssistant] draggingUpdatedInTabBar:self atPoint:[self convertPoint:[sender draggingLocation] fromView:nil]];
- return NSDragOperationMove;
- } else if(cell) {
- //something that was accepted by the delegate was dragged on
-
- //Test for the space bar (the skip-the-delay key).
- /*enum { virtualKeycodeForSpace = 49 }; //Source: IM:Tx (Fig. C-2)
- union {
- KeyMap keymap;
- char bits[16];
- } keymap;
- GetKeys(keymap.keymap);
- if ((GetCurrentEventKeyModifiers() == 0) && bit_test(keymap.bits, virtualKeycodeForSpace)) {
- //The user pressed the space bar. This skips the delay; the user wants to pop the spring on this tab *now*.
-
- //For some reason, it crashes if I call -fire here. I don't know why. It doesn't crash if I simply set the fire date to now.
- [_springTimer setFireDate:[NSDate date]];
- } else {*/
- //Wind the spring for a spring-loaded drop.
- //The delay time comes from Finder's defaults, which specifies it in milliseconds.
- //If the delegate can't handle our spring-loaded drop, we'll abort it when the timer fires. See fireSpring:. This is simpler than constantly (checking for spring-loaded awareness and tearing down/rebuilding the timer) at every delegate change.
-
- //If the user has dragged to a different tab, reset the timer.
- if(_tabViewItemWithSpring != [cell representedObject]) {
- [_springTimer invalidate];
- [_springTimer release]; _springTimer = nil;
- _tabViewItemWithSpring = [cell representedObject];
- }
- if(!_springTimer) {
- //Finder's default delay time, as of Tiger, is 668 ms. If the user has never changed it, there's no setting in its defaults, so we default to that amount.
- NSNumber *delayNumber = [(NSNumber *)CFPreferencesCopyAppValue((CFStringRef)@"SpringingDelayMilliseconds", (CFStringRef)@"com.apple.finder") autorelease];
- NSTimeInterval delaySeconds = delayNumber ?[delayNumber doubleValue] / 1000.0 : 0.668;
- _springTimer = [[NSTimer scheduledTimerWithTimeInterval:delaySeconds
- target:self
- selector:@selector(fireSpring:)
- userInfo:sender
- repeats:NO] retain];
- }
- return NSDragOperationCopy;
- }
-
- return NSDragOperationNone;
-}
-
-- (void)draggingExited:(id <NSDraggingInfo>)sender {
- [_springTimer invalidate];
- [_springTimer release]; _springTimer = nil;
-
- [[PSMTabDragAssistant sharedDragAssistant] draggingExitedTabBar:self];
-}
-
-- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender {
- //validate the drag operation only if there's a valid tab bar to drop into
- return [[[sender draggingPasteboard] types] indexOfObject:@"PSMTabBarControlItemPBType"] == NSNotFound ||
- [[PSMTabDragAssistant sharedDragAssistant] destinationTabBar] != nil;
-}
-
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
- if([[[sender draggingPasteboard] types] indexOfObject:@"PSMTabBarControlItemPBType"] != NSNotFound) {
- [[PSMTabDragAssistant sharedDragAssistant] performDragOperation];
- } else if([self delegate] && [[self delegate] respondsToSelector:@selector(tabView:acceptedDraggingInfo:onTabViewItem:)]) {
- //forward the drop to the delegate
- [[self delegate] tabView:tabView acceptedDraggingInfo:sender onTabViewItem:[[self cellForPoint:[self convertPoint:[sender draggingLocation] fromView:nil] cellFrame:nil] representedObject]];
- }
- return YES;
-}
-
-- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation {
- [[PSMTabDragAssistant sharedDragAssistant] draggedImageEndedAt:aPoint operation:operation];
-}
-
-- (void)concludeDragOperation:(id <NSDraggingInfo>)sender {
-}
-
-#pragma mark -
-#pragma mark Spring-loading
-
-- (void)fireSpring:(NSTimer *)timer {
- NSAssert1(timer == _springTimer, @"Spring fired by unrecognized timer %@", timer);
-
- id <NSDraggingInfo> sender = [timer userInfo];
- PSMTabBarCell *cell = [self cellForPoint:[self convertPoint:[sender draggingLocation] fromView:nil] cellFrame:nil];
- [tabView selectTabViewItem:[cell representedObject]];
-
- _tabViewItemWithSpring = nil;
- [_springTimer invalidate];
- [_springTimer release]; _springTimer = nil;
-}
-
-#pragma mark -
-#pragma mark Actions
-
-- (void)overflowMenuAction:(id)sender {
- NSTabViewItem *tabViewItem = (NSTabViewItem *)[sender representedObject];
- [tabView selectTabViewItem:tabViewItem];
-}
-
-- (void)closeTabClick:(id)sender {
- NSTabViewItem *item = [sender representedObject];
- [sender retain];
- if(([_cells count] == 1) && (![self canCloseOnlyTab])) {
- return;
- }
-
- if([[self delegate] respondsToSelector:@selector(tabView:shouldCloseTabViewItem:)]) {
- if(![[self delegate] tabView:tabView shouldCloseTabViewItem:item]) {
- // fix mouse downed close button
- [sender setCloseButtonPressed:NO];
- return;
- }
- }
-
- [item retain];
-
- [tabView removeTabViewItem:item];
- [item release];
- [sender release];
-}
-
-- (void)tabClick:(id)sender {
- [tabView selectTabViewItem:[sender representedObject]];
-}
-
-- (void)tabNothing:(id)sender {
- //[self update]; // takes care of highlighting based on state
-}
-
-- (void)frameDidChange:(NSNotification *)notification {
- [self _checkWindowFrame];
-
- // trying to address the drawing artifacts for the progress indicators - hackery follows
- // this one fixes the "blanking" effect when the control hides and shows itself
- NSEnumerator *e = [_cells objectEnumerator];
- PSMTabBarCell *cell;
- while((cell = [e nextObject])) {
- [[cell indicator] stopAnimation:self];
-
- [[cell indicator] performSelector:@selector(startAnimation:)
- withObject:nil
- afterDelay:0];
- }
-
- [self update:NO];
-}
-
-- (void)viewDidMoveToWindow {
- [self _checkWindowFrame];
-}
-
-- (void)viewWillStartLiveResize {
- NSEnumerator *e = [_cells objectEnumerator];
- PSMTabBarCell *cell;
- while((cell = [e nextObject])) {
- [[cell indicator] stopAnimation:self];
- }
- [self setNeedsDisplay:YES];
-}
-
--(void)viewDidEndLiveResize {
- NSEnumerator *e = [_cells objectEnumerator];
- PSMTabBarCell *cell;
- while((cell = [e nextObject])) {
- [[cell indicator] startAnimation:self];
- }
-
- [self _checkWindowFrame];
- [self update:NO];
-}
-
-- (void)resetCursorRects {
- [super resetCursorRects];
- if([self orientation] == PSMTabBarVerticalOrientation) {
- NSRect frame = [self frame];
- [self addCursorRect:NSMakeRect(frame.size.width - 2, 0, 2, frame.size.height) cursor:[NSCursor resizeLeftRightCursor]];
- }
-}
-
-- (void)windowDidMove:(NSNotification *)aNotification {
- [self setNeedsDisplay:YES];
-}
-
-- (void)windowDidUpdate:(NSNotification *)notification {
- // hide? must readjust things if I'm not supposed to be showing
- // this block of code only runs when the app launches
- if([self hideForSingleTab] && ([_cells count] <= 1) && !_awakenedFromNib) {
- // must adjust frames now before display
- NSRect myFrame = [self frame];
- if([self orientation] == PSMTabBarHorizontalOrientation) {
- if(partnerView) {
- NSRect partnerFrame = [partnerView frame];
- // above or below me?
- if(myFrame.origin.y - 22 > [partnerView frame].origin.y) {
- // partner is below me
- [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y + 21, myFrame.size.width, myFrame.size.height - 21)];
- [partnerView setFrame:NSMakeRect(partnerFrame.origin.x, partnerFrame.origin.y, partnerFrame.size.width, partnerFrame.size.height + 21)];
- } else {
- // partner is above me
- [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, myFrame.size.width, myFrame.size.height - 21)];
- [partnerView setFrame:NSMakeRect(partnerFrame.origin.x, partnerFrame.origin.y - 21, partnerFrame.size.width, partnerFrame.size.height + 21)];
- }
- [partnerView setNeedsDisplay:YES];
- [self setNeedsDisplay:YES];
- } else {
- // for window movement
- NSRect windowFrame = [[self window] frame];
- [[self window] setFrame:NSMakeRect(windowFrame.origin.x, windowFrame.origin.y + 21, windowFrame.size.width, windowFrame.size.height - 21) display:YES];
- [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, myFrame.size.width, myFrame.size.height - 21)];
- }
- } else {
- if(partnerView) {
- NSRect partnerFrame = [partnerView frame];
- //to the left or right?
- if(myFrame.origin.x < [partnerView frame].origin.x) {
- // partner is to the left
- [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, 1, myFrame.size.height)];
- [partnerView setFrame:NSMakeRect(partnerFrame.origin.x - myFrame.size.width + 1, partnerFrame.origin.y, partnerFrame.size.width + myFrame.size.width - 1, partnerFrame.size.height)];
- } else {
- // partner to the right
- [self setFrame:NSMakeRect(myFrame.origin.x + myFrame.size.width, myFrame.origin.y, 1, myFrame.size.height)];
- [partnerView setFrame:NSMakeRect(partnerFrame.origin.x, partnerFrame.origin.y, partnerFrame.size.width + myFrame.size.width, partnerFrame.size.height)];
- }
- _tabBarWidth = myFrame.size.width;
- [partnerView setNeedsDisplay:YES];
- [self setNeedsDisplay:YES];
- } else {
- // for window movement
- NSRect windowFrame = [[self window] frame];
- [[self window] setFrame:NSMakeRect(windowFrame.origin.x + myFrame.size.width - 1, windowFrame.origin.y, windowFrame.size.width - myFrame.size.width + 1, windowFrame.size.height) display:YES];
- [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, 1, myFrame.size.height)];
- }
- }
-
- _isHidden = YES;
-
- if([[self delegate] respondsToSelector:@selector(tabView:tabBarDidHide:)]) {
- [[self delegate] tabView:[self tabView] tabBarDidHide:self];
- }
- }
-
- _awakenedFromNib = YES;
- [self setNeedsDisplay:YES];
-
- //we only need to do this once
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidUpdateNotification object:nil];
-}
-
-#pragma mark -
-#pragma mark Menu Validation
-
-- (BOOL)validateMenuItem:(NSMenuItem *)sender {
- [sender setState:([[sender representedObject] isEqualTo:[tabView selectedTabViewItem]]) ? NSOnState : NSOffState];
-
- return [[self delegate] respondsToSelector:@selector(tabView:validateOverflowMenuItem:forTabViewItem:)] ?
- [[self delegate] tabView:[self tabView] validateOverflowMenuItem:sender forTabViewItem:[sender representedObject]] : YES;
-}
-
-#pragma mark -
-#pragma mark NSTabView Delegate
-
-- (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem {
- // here's a weird one - this message is sent before the "tabViewDidChangeNumberOfTabViewItems"
- // message, thus I can end up updating when there are no cells, if no tabs were (yet) present
- NSUInteger tabIndex = [aTabView indexOfTabViewItem:tabViewItem];
-
- if([_cells count] > 0 && tabIndex < [_cells count]) {
- PSMTabBarCell *thisCell = [_cells objectAtIndex:tabIndex];
- if(_alwaysShowActiveTab && [thisCell isInOverflowMenu]) {
- //temporarily disable the delegate in order to move the tab to a different index
- id tempDelegate = [aTabView delegate];
- [aTabView setDelegate:nil];
-
- // move it all around first
- [tabViewItem retain];
- [thisCell retain];
- [aTabView removeTabViewItem:tabViewItem];
- [aTabView insertTabViewItem:tabViewItem atIndex:0];
- [_cells removeObjectAtIndex:tabIndex];
- [_cells insertObject:thisCell atIndex:0];
- [thisCell setIsInOverflowMenu:NO]; //very important else we get a fun recursive loop going
- [[_cells objectAtIndex:[_cells count] - 1] setIsInOverflowMenu:YES]; //these 2 lines are pretty uncool and this logic needs to be updated
- [thisCell release];
- [tabViewItem release];
-
- [aTabView setDelegate:tempDelegate];
-
- //reset the selection since removing it changed the selection
- [aTabView selectTabViewItem:tabViewItem];
-
- [self update];
- } else {
- [_controller setSelectedCell:thisCell];
- [self setNeedsDisplay:YES];
- }
- }
-
- if([[self delegate] respondsToSelector:@selector(tabView:didSelectTabViewItem:)]) {
- [[self delegate] performSelector:@selector(tabView:didSelectTabViewItem:) withObject:aTabView withObject:tabViewItem];
- }
-}
-
-- (BOOL)tabView:(NSTabView *)aTabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem {
- if([[self delegate] respondsToSelector:@selector(tabView:shouldSelectTabViewItem:)]) {
- return [[self delegate] tabView:aTabView shouldSelectTabViewItem:tabViewItem];
- } else {
- return YES;
- }
-}
-- (void)tabView:(NSTabView *)aTabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem {
- if([[self delegate] respondsToSelector:@selector(tabView:willSelectTabViewItem:)]) {
- [[self delegate] performSelector:@selector(tabView:willSelectTabViewItem:) withObject:aTabView withObject:tabViewItem];
- }
-}
-
-- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)aTabView {
- NSArray *tabItems = [tabView tabViewItems];
- // go through cells, remove any whose representedObjects are not in [tabView tabViewItems]
- NSEnumerator *e = [[[_cells copy] autorelease] objectEnumerator];
- PSMTabBarCell *cell;
- while((cell = [e nextObject])) {
- //remove the observer binding
- if([cell representedObject] && ![tabItems containsObject:[cell representedObject]]) {
- if([[self delegate] respondsToSelector:@selector(tabView:didCloseTabViewItem:)]) {
- [[self delegate] tabView:aTabView didCloseTabViewItem:[cell representedObject]];
- }
-
- [self removeTabForCell:cell];
- }
- }
-
- // go through tab view items, add cell for any not present
- NSMutableArray *cellItems = [self representedTabViewItems];
- NSEnumerator *ex = [tabItems objectEnumerator];
- NSTabViewItem *item;
- while((item = [ex nextObject])) {
- if(![cellItems containsObject:item]) {
- [self addTabViewItem:item];
- }
- }
-
- // pass along for other delegate responses
- if([[self delegate] respondsToSelector:@selector(tabViewDidChangeNumberOfTabViewItems:)]) {
- [[self delegate] performSelector:@selector(tabViewDidChangeNumberOfTabViewItems:) withObject:aTabView];
- }
-
- // reset cursor tracking for the add tab button if one exists
- if([self addTabButton]) {
- [[self addTabButton] resetCursorRects];
- }
-}
-
-#pragma mark -
-#pragma mark Tooltips
-
-- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void *)userData {
- if([[self delegate] respondsToSelector:@selector(tabView:toolTipForTabViewItem:)]) {
- return [[self delegate] tabView:[self tabView] toolTipForTabViewItem:[[self cellForPoint:point cellFrame:nil] representedObject]];
- }
- return nil;
-}
-
-#pragma mark -
-#pragma mark Archiving
-
-- (void)encodeWithCoder:(NSCoder *)aCoder
-{
- [super encodeWithCoder:aCoder];
- if ([aCoder allowsKeyedCoding]) {
- [aCoder encodeObject:_cells forKey:@"PSMcells"];
- [aCoder encodeObject:tabView forKey:@"PSMtabView"];
- [aCoder encodeObject:_overflowPopUpButton forKey:@"PSMoverflowPopUpButton"];
- [aCoder encodeObject:_addTabButton forKey:@"PSMaddTabButton"];
- [aCoder encodeObject:style forKey:@"PSMstyle"];
- [aCoder encodeInteger:_orientation forKey:@"PSMorientation"];
- [aCoder encodeBool:_canCloseOnlyTab forKey:@"PSMcanCloseOnlyTab"];
- [aCoder encodeBool:_disableTabClose forKey:@"PSMdisableTabClose"];
- [aCoder encodeBool:_hideForSingleTab forKey:@"PSMhideForSingleTab"];
- [aCoder encodeBool:_allowsBackgroundTabClosing forKey:@"PSMallowsBackgroundTabClosing"];
- [aCoder encodeBool:_allowsResizing forKey:@"PSMallowsResizing"];
- [aCoder encodeBool:_selectsTabsOnMouseDown forKey:@"PSMselectsTabsOnMouseDown"];
- [aCoder encodeBool:_showAddTabButton forKey:@"PSMshowAddTabButton"];
- [aCoder encodeBool:_sizeCellsToFit forKey:@"PSMsizeCellsToFit"];
- [aCoder encodeInteger:_cellMinWidth forKey:@"PSMcellMinWidth"];
- [aCoder encodeInteger:_cellMaxWidth forKey:@"PSMcellMaxWidth"];
- [aCoder encodeInteger:_cellOptimumWidth forKey:@"PSMcellOptimumWidth"];
- [aCoder encodeInteger:_currentStep forKey:@"PSMcurrentStep"];
- [aCoder encodeBool:_isHidden forKey:@"PSMisHidden"];
- [aCoder encodeObject:partnerView forKey:@"PSMpartnerView"];
- [aCoder encodeBool:_awakenedFromNib forKey:@"PSMawakenedFromNib"];
- [aCoder encodeObject:_lastMouseDownEvent forKey:@"PSMlastMouseDownEvent"];
- [aCoder encodeObject:delegate forKey:@"PSMdelegate"];
- [aCoder encodeBool:_useOverflowMenu forKey:@"PSMuseOverflowMenu"];
- [aCoder encodeBool:_automaticallyAnimates forKey:@"PSMautomaticallyAnimates"];
- [aCoder encodeBool:_alwaysShowActiveTab forKey:@"PSMalwaysShowActiveTab"];
- }
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
- self = [super initWithCoder:aDecoder];
- if (self) {
- // Initialization
- [self initAddedProperties];
- [self registerForDraggedTypes:[NSArray arrayWithObjects:@"PSMTabBarControlItemPBType", nil]];
-
- // resize
- [self setPostsFrameChangedNotifications:YES];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(frameDidChange:) name:NSViewFrameDidChangeNotification object:self];
- if ([aDecoder allowsKeyedCoding]) {
- _cells = [[aDecoder decodeObjectForKey:@"PSMcells"] retain];
- tabView = [[aDecoder decodeObjectForKey:@"PSMtabView"] retain];
- _overflowPopUpButton = [[aDecoder decodeObjectForKey:@"PSMoverflowPopUpButton"] retain];
- _addTabButton = [[aDecoder decodeObjectForKey:@"PSMaddTabButton"] retain];
- style = [[aDecoder decodeObjectForKey:@"PSMstyle"] retain];
- _orientation = (PSMTabBarOrientation)[aDecoder decodeIntegerForKey:@"PSMorientation"];
- _canCloseOnlyTab = [aDecoder decodeBoolForKey:@"PSMcanCloseOnlyTab"];
- _disableTabClose = [aDecoder decodeBoolForKey:@"PSMdisableTabClose"];
- _hideForSingleTab = [aDecoder decodeBoolForKey:@"PSMhideForSingleTab"];
- _allowsBackgroundTabClosing = [aDecoder decodeBoolForKey:@"PSMallowsBackgroundTabClosing"];
- _allowsResizing = [aDecoder decodeBoolForKey:@"PSMallowsResizing"];
- _selectsTabsOnMouseDown = [aDecoder decodeBoolForKey:@"PSMselectsTabsOnMouseDown"];
- _showAddTabButton = [aDecoder decodeBoolForKey:@"PSMshowAddTabButton"];
- _sizeCellsToFit = [aDecoder decodeBoolForKey:@"PSMsizeCellsToFit"];
- _cellMinWidth = [aDecoder decodeIntegerForKey:@"PSMcellMinWidth"];
- _cellMaxWidth = [aDecoder decodeIntegerForKey:@"PSMcellMaxWidth"];
- _cellOptimumWidth = [aDecoder decodeIntegerForKey:@"PSMcellOptimumWidth"];
- _currentStep = [aDecoder decodeIntegerForKey:@"PSMcurrentStep"];
- _isHidden = [aDecoder decodeBoolForKey:@"PSMisHidden"];
- partnerView = [[aDecoder decodeObjectForKey:@"PSMpartnerView"] retain];
- _awakenedFromNib = [aDecoder decodeBoolForKey:@"PSMawakenedFromNib"];
- _lastMouseDownEvent = [[aDecoder decodeObjectForKey:@"PSMlastMouseDownEvent"] retain];
- _useOverflowMenu = [aDecoder decodeBoolForKey:@"PSMuseOverflowMenu"];
- _automaticallyAnimates = [aDecoder decodeBoolForKey:@"PSMautomaticallyAnimates"];
- _alwaysShowActiveTab = [aDecoder decodeBoolForKey:@"PSMalwaysShowActiveTab"];
- delegate = [[aDecoder decodeObjectForKey:@"PSMdelegate"] retain];
- }
- }
- [self setTarget:self];
- return self;
-}
-
-#pragma mark -
-#pragma mark IB Palette
-
-- (NSSize)minimumFrameSizeFromKnobPosition:(NSInteger)position {
- return NSMakeSize(100.0, 22.0);
-}
-
-- (NSSize)maximumFrameSizeFromKnobPosition:(NSInteger)knobPosition {
- return NSMakeSize(10000.0, 22.0);
-}
-
-- (void)placeView:(NSRect)newFrame {
- // this is called any time the view is resized in IB
- [self setFrame:newFrame];
- [self update:NO];
-}
-
-#pragma mark -
-#pragma mark Convenience
-
-- (void)bindPropertiesForCell:(PSMTabBarCell *)cell andTabViewItem:(NSTabViewItem *)item {
- [self _bindPropertiesForCell:cell andTabViewItem:item];
-
- // watch for changes in the identifier
- [item addObserver:self forKeyPath:@"identifier" options:0 context:nil];
-}
-
-- (void)_bindPropertiesForCell:(PSMTabBarCell *)cell andTabViewItem:(NSTabViewItem *)item {
- // bind the indicator to the represented object's status (if it exists)
- [[cell indicator] setHidden:YES];
- if([item identifier] != nil) {
- if([[[cell representedObject] identifier] respondsToSelector:@selector(isProcessing)]) {
- NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary];
- [bindingOptions setObject:NSNegateBooleanTransformerName forKey:@"NSValueTransformerName"];
- [[cell indicator] bind:@"animate" toObject:[item identifier] withKeyPath:@"isProcessing" options:nil];
- [[cell indicator] bind:@"hidden" toObject:[item identifier] withKeyPath:@"isProcessing" options:bindingOptions];
- [[item identifier] addObserver:cell forKeyPath:@"isProcessing" options:0 context:nil];
- }
- }
-
- // bind for the existence of an icon
- [cell setHasIcon:NO];
- if([item identifier] != nil) {
- if([[[cell representedObject] identifier] respondsToSelector:@selector(icon)]) {
- NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary];
- [bindingOptions setObject:NSIsNotNilTransformerName forKey:@"NSValueTransformerName"];
- [cell bind:@"hasIcon" toObject:[item identifier] withKeyPath:@"icon" options:bindingOptions];
- [[item identifier] addObserver:cell forKeyPath:@"icon" options:0 context:nil];
- }
- }
-
- // bind for the existence of a counter
- [cell setCount:0];
- if([item identifier] != nil) {
- if([[[cell representedObject] identifier] respondsToSelector:@selector(objectCount)]) {
- [cell bind:@"count" toObject:[item identifier] withKeyPath:@"objectCount" options:nil];
- [[item identifier] addObserver:cell forKeyPath:@"objectCount" options:0 context:nil];
- }
- }
-
- // bind for the color of a counter
- [cell setCountColor:nil];
- if([item identifier] != nil) {
- if([[[cell representedObject] identifier] respondsToSelector:@selector(countColor)]) {
- [cell bind:@"countColor" toObject:[item identifier] withKeyPath:@"countColor" options:nil];
- [[item identifier] addObserver:cell forKeyPath:@"countColor" options:0 context:nil];
- }
- }
-
- // bind for a large image
- [cell setHasLargeImage:NO];
- if([item identifier] != nil) {
- if([[[cell representedObject] identifier] respondsToSelector:@selector(largeImage)]) {
- NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary];
- [bindingOptions setObject:NSIsNotNilTransformerName forKey:@"NSValueTransformerName"];
- [cell bind:@"hasLargeImage" toObject:[item identifier] withKeyPath:@"largeImage" options:bindingOptions];
- [[item identifier] addObserver:cell forKeyPath:@"largeImage" options:0 context:nil];
- }
- }
-
- [cell setIsEdited:NO];
- if([item identifier] != nil) {
- if([[[cell representedObject] identifier] respondsToSelector:@selector(isEdited)]) {
- [cell bind:@"isEdited" toObject:[item identifier] withKeyPath:@"isEdited" options:nil];
- [[item identifier] addObserver:cell forKeyPath:@"isEdited" options:0 context:nil];
- }
- }
-
- // bind my string value to the label on the represented tab
- [cell bind:@"title" toObject:item withKeyPath:@"label" options:nil];
-}
-
-- (NSMutableArray *)representedTabViewItems {
- NSMutableArray *temp = [NSMutableArray arrayWithCapacity:[_cells count]];
- NSEnumerator *e = [_cells objectEnumerator];
- PSMTabBarCell *cell;
- while((cell = [e nextObject])) {
- if([cell representedObject]) {
- [temp addObject:[cell representedObject]];
- }
- }
- return temp;
-}
-
-- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame {
- if([self orientation] == PSMTabBarHorizontalOrientation && !NSPointInRect(point, [self genericCellRect])) {
- return nil;
- }
-
- NSInteger i, cnt = [_cells count];
- for(i = 0; i < cnt; i++) {
- PSMTabBarCell *cell = [_cells objectAtIndex:i];
-
- if(NSPointInRect(point, [cell frame])) {
- if(outFrame) {
- *outFrame = [cell frame];
- }
- return cell;
- }
- }
- return nil;
-}
-
-- (PSMTabBarCell *)lastVisibleTab {
- NSInteger i, cellCount = [_cells count];
- for(i = 0; i < cellCount; i++) {
- if([[_cells objectAtIndex:i] isInOverflowMenu]) {
- return [_cells objectAtIndex:(i - 1)];
- }
- }
- return [_cells objectAtIndex:(cellCount - 1)];
-}
-
-- (NSInteger)numberOfVisibleTabs {
- NSUInteger i, cellCount = 0;
- PSMTabBarCell *nextCell;
-
- for(i = 0; i < [_cells count]; i++) {
- nextCell = [_cells objectAtIndex:i];
-
- if([nextCell isInOverflowMenu]) {
- break;
- }
-
- if(![nextCell isPlaceholder]) {
- cellCount++;
- }
- }
-
- return cellCount;
-}
-
-#pragma mark -
-#pragma mark Accessibility
-
--(BOOL)accessibilityIsIgnored {
- return NO;
-}
-
-- (id)accessibilityAttributeValue:(NSString *)attribute {
- id attributeValue = nil;
- if([attribute isEqualToString: NSAccessibilityRoleAttribute]) {
- attributeValue = NSAccessibilityGroupRole;
- } else if([attribute isEqualToString: NSAccessibilityChildrenAttribute]) {
- attributeValue = NSAccessibilityUnignoredChildren(_cells);
- } else {
- attributeValue = [super accessibilityAttributeValue:attribute];
- }
- return attributeValue;
-}
-
-- (id)accessibilityHitTest:(NSPoint)point {
- id hitTestResult = self;
-
- NSEnumerator *enumerator = [_cells objectEnumerator];
- PSMTabBarCell *cell = nil;
- PSMTabBarCell *highlightedCell = nil;
-
- while(!highlightedCell && (cell = [enumerator nextObject])) {
- if([cell isHighlighted]) {
- highlightedCell = cell;
- }
- }
-
- if(highlightedCell) {
- hitTestResult = [highlightedCell accessibilityHitTest:point];
- }
-
- return hitTestResult;
-}
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabBarController.h b/frontends/cocoa/PSMTabBarControl/PSMTabBarController.h
deleted file mode 100644
index a73a04f1f..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabBarController.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// PSMTabBarController.h
-// PSMTabBarControl
-//
-// Created by Kent Sutherland on 11/24/06.
-// Copyright 2006 Kent Sutherland. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-@class PSMTabBarControl, PSMTabBarCell;
-
-@interface PSMTabBarController : NSObject
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
- <NSMenuDelegate>
-#endif
-{
- PSMTabBarControl *_control;
- NSMutableArray *_cellTrackingRects;
- NSMutableArray *_closeButtonTrackingRects;
- NSMutableArray *_cellFrames;
- NSRect _addButtonRect;
- NSMenu *_overflowMenu;
-}
-
-- (id)initWithTabBarControl:(PSMTabBarControl *)control;
-
-- (NSRect)addButtonRect;
-- (NSMenu *)overflowMenu;
-- (NSRect)cellTrackingRectAtIndex:(NSUInteger)index;
-- (NSRect)closeButtonTrackingRectAtIndex:(NSUInteger)index;
-- (NSRect)cellFrameAtIndex:(NSUInteger)index;
-
-- (void)setSelectedCell:(PSMTabBarCell *)cell;
-
-- (void)layoutCells;
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabBarController.m b/frontends/cocoa/PSMTabBarControl/PSMTabBarController.m
deleted file mode 100644
index 68e1bc498..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabBarController.m
+++ /dev/null
@@ -1,643 +0,0 @@
-//
-// PSMTabBarController.m
-// PSMTabBarControl
-//
-// Created by Kent Sutherland on 11/24/06.
-// Copyright 2006 Kent Sutherland. All rights reserved.
-//
-
-#import "PSMTabBarController.h"
-#import "PSMTabBarControl.h"
-#import "PSMTabBarCell.h"
-#import "PSMTabStyle.h"
-#import "NSString_AITruncation.h"
-
-#define MAX_OVERFLOW_MENUITEM_TITLE_LENGTH 60
-
-@interface PSMTabBarController (Private)
-- (NSArray *)_generateWidthsFromCells:(NSArray *)cells;
-- (void)_setupCells:(NSArray *)cells withWidths:(NSArray *)widths;
-@end
-
-@implementation PSMTabBarController
-
-/*!
- @method initWithTabBarControl:
- @abstract Creates a new PSMTabBarController instance.
- @discussion Creates a new PSMTabBarController for controlling a PSMTabBarControl. Should only be called by
- PSMTabBarControl.
- @param A PSMTabBarControl.
- @returns A newly created PSMTabBarController instance.
- */
-
-- (id)initWithTabBarControl:(PSMTabBarControl *)control {
- if((self = [super init])) {
- _control = control;
- _cellTrackingRects = [[NSMutableArray alloc] init];
- _closeButtonTrackingRects = [[NSMutableArray alloc] init];
- _cellFrames = [[NSMutableArray alloc] init];
- _addButtonRect = NSZeroRect;
- }
- return self;
-}
-
-- (void)dealloc {
- [_cellTrackingRects release];
- [_closeButtonTrackingRects release];
- [_cellFrames release];
- [super dealloc];
-}
-
-/*!
- @method addButtonRect
- @abstract Returns the position for the add tab button.
- @discussion Returns the position for the add tab button.
- @returns The rect for the add button rect.
- */
-
-- (NSRect)addButtonRect {
- return _addButtonRect;
-}
-
-/*!
- @method overflowMenu
- @abstract Returns current overflow menu or nil if there is none.
- @discussion Returns current overflow menu or nil if there is none.
- @returns The current overflow menu.
- */
-
-- (NSMenu *)overflowMenu {
- return _overflowMenu;
-}
-
-/*!
- @method cellTrackingRectAtIndex:
- @abstract Returns the rect for the tracking rect at the requested index.
- @discussion Returns the rect for the tracking rect at the requested index.
- @param Index of a cell.
- @returns The tracking rect of the cell at the requested index.
- */
-
-- (NSRect)cellTrackingRectAtIndex:(NSUInteger)index {
- NSRect rect;
- if(index < [_cellTrackingRects count]) {
- rect = [[_cellTrackingRects objectAtIndex:index] rectValue];
- } else {
- NSLog(@"cellTrackingRectAtIndex: Invalid index (%ld)", (long)index);
- rect = NSZeroRect;
- }
- return rect;
-}
-
-/*!
- @method closeButtonTrackingRectAtIndex:
- @abstract Returns the tracking rect for the close button at the requested index.
- @discussion Returns the tracking rect for the close button at the requested index.
- @param Index of a cell.
- @returns The close button tracking rect of the cell at the requested index.
- */
-
-- (NSRect)closeButtonTrackingRectAtIndex:(NSUInteger)index {
- NSRect rect;
- if(index < [_closeButtonTrackingRects count]) {
- rect = [[_closeButtonTrackingRects objectAtIndex:index] rectValue];
- } else {
- NSLog(@"closeButtonTrackingRectAtIndex: Invalid index (%ld)", (long)index);
- rect = NSZeroRect;
- }
- return rect;
-}
-
-/*!
- @method cellFrameAtIndex:
- @abstract Returns the frame for the cell at the requested index.
- @discussion Returns the frame for the cell at the requested index.
- @param Index of a cell.
- @returns The frame of the cell at the requested index.
- */
-
-- (NSRect)cellFrameAtIndex:(NSUInteger)index {
- NSRect rect;
-
- if(index < [_cellFrames count]) {
- rect = [[_cellFrames objectAtIndex:index] rectValue];
- } else {
- NSLog(@"cellFrameAtIndex: Invalid index (%ld)", (long)index);
- rect = NSZeroRect;
- }
- return rect;
-}
-
-/*!
- @method setSelectedCell:
- @abstract Changes the cell states so the given cell is the currently selected cell.
- @discussion Makes the given cell the active cell and properly recalculates the tab states for surrounding cells.
- @param An instance of PSMTabBarCell to make active.
- */
-
-- (void)setSelectedCell:(PSMTabBarCell *)cell {
- NSArray *cells = [_control cells];
- NSEnumerator *enumerator = [cells objectEnumerator];
- PSMTabBarCell *lastCell = nil, *nextCell;
-
- //deselect the previously selected tab
- while((nextCell = [enumerator nextObject]) && ([nextCell state] == NSOffState)) {
- lastCell = nextCell;
- }
-
- [nextCell setState:NSOffState];
- [nextCell setTabState:PSMTab_PositionMiddleMask];
-
- if(lastCell && lastCell != [_control lastVisibleTab]) {
- [lastCell setTabState:~[lastCell tabState] & PSMTab_RightIsSelectedMask];
- }
-
- if((nextCell = [enumerator nextObject])) {
- [nextCell setTabState:~[lastCell tabState] & PSMTab_LeftIsSelectedMask];
- }
-
- [cell setState:NSOnState];
- [cell setTabState:PSMTab_SelectedMask];
-
- if(![cell isInOverflowMenu]) {
- NSUInteger cellIndex = [cells indexOfObject:cell];
-
- if(cellIndex > 0) {
- nextCell = [cells objectAtIndex:cellIndex - 1];
- [nextCell setTabState:[nextCell tabState] | PSMTab_RightIsSelectedMask];
- }
-
- if(cellIndex < [cells count] - 1) {
- nextCell = [cells objectAtIndex:cellIndex + 1];
- [nextCell setTabState:[nextCell tabState] | PSMTab_LeftIsSelectedMask];
- }
- }
-}
-
-/*!
- @method layoutCells
- @abstract Recalculates cell positions and states.
- @discussion This method calculates the proper frame, tabState and overflow menu status for all cells in the
- tab bar control.
- */
-
-- (void)layoutCells {
- NSArray *cells = [_control cells];
- NSInteger cellCount = [cells count];
-
- // make sure all of our tabs are accounted for before updating
- if([[_control tabView] numberOfTabViewItems] != cellCount) {
- return;
- }
-
- [_cellTrackingRects removeAllObjects];
- [_closeButtonTrackingRects removeAllObjects];
- [_cellFrames removeAllObjects];
-
- NSArray *cellWidths = [self _generateWidthsFromCells:cells];
- [self _setupCells:cells withWidths:cellWidths];
-
- //set up the rect from the add tab button
- _addButtonRect = [_control genericCellRect];
- _addButtonRect.size = [[_control addTabButton] frame].size;
- if([_control orientation] == PSMTabBarHorizontalOrientation) {
- _addButtonRect.origin.y = MARGIN_Y;
- _addButtonRect.origin.x += [[cellWidths valueForKeyPath:@"@sum.floatValue"] doubleValue] + 2;
- } else {
- _addButtonRect.origin.x = 0;
- _addButtonRect.origin.y = [[cellWidths lastObject] doubleValue];
- }
-}
-
-/*!
- * @method _shrinkWidths:towardMinimum:withAvailableWidth:
- * @abstract Decreases widths in an array toward a minimum until they fit within availableWidth, if possible
- * @param An array of NSNumbers
- * @param The target minimum
- * @param The maximum available width
- * @returns The amount by which the total array width was shrunk
- */
-- (NSInteger)_shrinkWidths:(NSMutableArray *)newWidths towardMinimum:(NSInteger)minimum withAvailableWidth:(CGFloat)availableWidth {
- BOOL changed = NO;
- NSInteger count = [newWidths count];
- NSInteger totalWidths = [[newWidths valueForKeyPath:@"@sum.intValue"] integerValue];
- NSInteger originalTotalWidths = totalWidths;
-
- do {
- changed = NO;
-
- for(NSInteger q = (count - 1); q >= 0; q--) {
- CGFloat cellWidth = [[newWidths objectAtIndex:q] doubleValue];
- if(cellWidth - 1 >= minimum) {
- cellWidth--;
- totalWidths--;
-
- [newWidths replaceObjectAtIndex:q
- withObject:[NSNumber numberWithDouble:cellWidth]];
-
- changed = YES;
- }
- }
- } while(changed && (totalWidths > availableWidth));
-
- return(originalTotalWidths - totalWidths);
-}
-
-/*!
- * @function potentialMinimumForArray()
- * @abstract Calculate the minimum total for a given array of widths
- * @discussion The array is summed using, for each item, the minimum between the current value and the passed minimum value.
- * This is useful for getting a sum if the array has size-to-fit widths which will be allowed to be less than the
- * specified minimum.
- * @param An array of widths
- * @param The minimum
- * @returns The smallest possible sum for the array
- */
-static NSInteger potentialMinimumForArray(NSArray *array, NSInteger minimum){
- NSInteger runningTotal = 0;
- NSInteger count = [array count];
-
- for(NSInteger i = 0; i < count; i++) {
- NSInteger currentValue = [[array objectAtIndex:i] integerValue];
- runningTotal += MIN(currentValue, minimum);
- }
-
- return runningTotal;
-}
-
-/*!
- @method _generateWidthsFromCells:
- @abstract Calculates the width of cells that would be visible.
- @discussion Calculates the width of cells in the tab bar and returns an array of widths for the cells that would be
- visible. Uses large blocks of code that were previously in PSMTabBarControl's update method.
- @param An array of PSMTabBarCells.
- @returns An array of numbers representing the widths of cells that would be visible.
- */
-
-- (NSArray *)_generateWidthsFromCells:(NSArray *)cells {
- NSInteger cellCount = [cells count], i, numberOfVisibleCells = ([_control orientation] == PSMTabBarHorizontalOrientation) ? 1 : 0;
- NSMutableArray *newWidths = [NSMutableArray arrayWithCapacity:cellCount];
- id <PSMTabStyle> style = [_control style];
- CGFloat availableWidth = [_control availableCellWidth], currentOrigin = 0, totalOccupiedWidth = 0.0, width;
- NSRect cellRect = [_control genericCellRect], controlRect = [_control frame];
- PSMTabBarCell *currentCell;
-
- if([_control orientation] == PSMTabBarVerticalOrientation) {
- currentOrigin = [style topMarginForTabBarControl];
- }
-
- //Don't let cells overlap the add tab button if it is visible
- if([_control showAddTabButton]) {
- availableWidth -= [self addButtonRect].size.width;
- }
-
- for(i = 0; i < cellCount; i++) {
- currentCell = [cells objectAtIndex:i];
-
- // supress close button?
- [currentCell setCloseButtonSuppressed:((cellCount == 1 && [_control canCloseOnlyTab] == NO) ||
- [_control disableTabClose] ||
- ([[_control delegate] respondsToSelector:@selector(tabView:disableTabCloseForTabViewItem:)] &&
- [[_control delegate] tabView:[_control tabView] disableTabCloseForTabViewItem:[currentCell representedObject]]))];
-
- if([_control orientation] == PSMTabBarHorizontalOrientation) {
- // Determine cell width
- if([_control sizeCellsToFit]) {
- width = [currentCell desiredWidthOfCell];
- if(width > [_control cellMaxWidth]) {
- width = [_control cellMaxWidth];
- }
- } else {
- width = [_control cellOptimumWidth];
- }
-
- width = ceil(width);
-
- //check to see if there is not enough space to place all tabs as preferred
- if(totalOccupiedWidth + width >= availableWidth) {
- //There's not enough space to add currentCell at its preferred width!
-
- //If we're not going to use the overflow menu, cram all the tab cells into the bar regardless of minimum width
- if(![_control useOverflowMenu]) {
- NSInteger j, averageWidth = (availableWidth / cellCount);
-
- numberOfVisibleCells = cellCount;
- [newWidths removeAllObjects];
-
- for(j = 0; j < cellCount; j++) {
- CGFloat desiredWidth = [[cells objectAtIndex:j] desiredWidthOfCell];
- [newWidths addObject:[NSNumber numberWithDouble:(desiredWidth < averageWidth && [_control sizeCellsToFit]) ? desiredWidth : averageWidth]];
- }
-
- totalOccupiedWidth = [[newWidths valueForKeyPath:@"@sum.intValue"] integerValue];
- break;
- }
-
- //We'll be using the overflow menu if needed.
- numberOfVisibleCells = i;
- if([_control sizeCellsToFit]) {
- BOOL remainingCellsMustGoToOverflow = NO;
-
- totalOccupiedWidth = [[newWidths valueForKeyPath:@"@sum.intValue"] integerValue];
-
- /* Can I squeeze it in without violating min cell width? This is the width we would take up
- * if every cell so far were at the control minimum size (or their current size if that is less than the control minimum).
- */
- if((potentialMinimumForArray(newWidths, [_control cellMinWidth]) + MIN(width, [_control cellMinWidth])) <= availableWidth) {
- /* It's definitely possible for cells so far to be visible.
- * Shrink other cells to allow this one to fit
- */
- NSInteger cellMinWidth = [_control cellMinWidth];
-
- /* Start off adding it to the array; we know that it will eventually fit because
- * (the potential minimum <= availableWidth)
- *
- * This allows average and minimum aggregates on the NSArray to work.
- */
- [newWidths addObject:[NSNumber numberWithDouble:width]];
- numberOfVisibleCells++;
-
- totalOccupiedWidth += width;
-
- //First, try to shrink tabs toward the average. Tabs smaller than average won't change
- totalOccupiedWidth -= [self _shrinkWidths:newWidths
- towardMinimum:[[newWidths valueForKeyPath:@"@avg.intValue"] integerValue]
- withAvailableWidth:availableWidth];
-
-
-
- if(totalOccupiedWidth > availableWidth) {
- //Next, shrink tabs toward the smallest of the existing tabs. The smallest tab won't change.
- NSInteger smallestTabWidth = [[newWidths valueForKeyPath:@"@min.intValue"] integerValue];
- if(smallestTabWidth > cellMinWidth) {
- totalOccupiedWidth -= [self _shrinkWidths:newWidths
- towardMinimum:smallestTabWidth
- withAvailableWidth:availableWidth];
- }
- }
-
- if(totalOccupiedWidth > availableWidth) {
- //Finally, shrink tabs toward the imposed minimum size. All tabs larger than the minimum wll change.
- totalOccupiedWidth -= [self _shrinkWidths:newWidths
- towardMinimum:cellMinWidth
- withAvailableWidth:availableWidth];
- }
-
- if(totalOccupiedWidth > availableWidth) {
- NSLog(@"**** -[PSMTabBarController generateWidthsFromCells:] This is a failure (available %f, total %f, width is %f)",
- availableWidth, totalOccupiedWidth, width);
- remainingCellsMustGoToOverflow = YES;
- }
-
- if(totalOccupiedWidth < availableWidth) {
- /* We're not using all available space not but exceeded available width before;
- * stretch all cells to fully fit the bar
- */
- NSInteger leftoverWidth = availableWidth - totalOccupiedWidth;
- if(leftoverWidth > 0) {
- NSInteger q;
- for(q = numberOfVisibleCells - 1; q >= 0; q--) {
- NSInteger desiredAddition = (NSInteger)leftoverWidth / (q + 1);
- NSInteger newCellWidth = (NSInteger)[[newWidths objectAtIndex:q] doubleValue] + desiredAddition;
- [newWidths replaceObjectAtIndex:q withObject:[NSNumber numberWithDouble:newCellWidth]];
- leftoverWidth -= desiredAddition;
- totalOccupiedWidth += desiredAddition;
- }
- }
- }
- } else {
- // stretch - distribute leftover room among cells, since we can't add this cell
- NSInteger leftoverWidth = availableWidth - totalOccupiedWidth;
- NSInteger q;
- for(q = i - 1; q >= 0; q--) {
- NSInteger desiredAddition = (NSInteger)leftoverWidth / (q + 1);
- NSInteger newCellWidth = (NSInteger)[[newWidths objectAtIndex:q] doubleValue] + desiredAddition;
- [newWidths replaceObjectAtIndex:q withObject:[NSNumber numberWithDouble:newCellWidth]];
- leftoverWidth -= desiredAddition;
- }
-
- remainingCellsMustGoToOverflow = YES;
- }
-
- // done assigning widths; remaining cells go in overflow menu
- if(remainingCellsMustGoToOverflow) {
- break;
- }
- } else {
- //We're not using size-to-fit
- NSInteger revisedWidth = availableWidth / (i + 1);
- if(revisedWidth >= [_control cellMinWidth]) {
- NSUInteger q;
- totalOccupiedWidth = 0;
-
- for(q = 0; q < [newWidths count]; q++) {
- [newWidths replaceObjectAtIndex:q withObject:[NSNumber numberWithDouble:revisedWidth]];
- totalOccupiedWidth += revisedWidth;
- }
- // just squeezed this one in...
- [newWidths addObject:[NSNumber numberWithDouble:revisedWidth]];
- totalOccupiedWidth += revisedWidth;
- numberOfVisibleCells++;
- } else {
- // couldn't fit that last one...
- break;
- }
- }
- } else {
- //(totalOccupiedWidth < availableWidth)
- numberOfVisibleCells = cellCount;
- [newWidths addObject:[NSNumber numberWithDouble:width]];
- totalOccupiedWidth += width;
- }
- } else {
- //lay out vertical tabs
- if(currentOrigin + cellRect.size.height <= controlRect.size.height) {
- [newWidths addObject:[NSNumber numberWithDouble:currentOrigin]];
- numberOfVisibleCells++;
- currentOrigin += cellRect.size.height;
- } else {
- //out of room, the remaining tabs go into overflow
- if([newWidths count] > 0 && controlRect.size.height - currentOrigin < 17) {
- [newWidths removeLastObject];
- numberOfVisibleCells--;
- }
- break;
- }
- }
- }
-
- //make sure there are at least two items in the horizontal tab bar
- if([_control orientation] == PSMTabBarHorizontalOrientation) {
- if(numberOfVisibleCells < 2 && [cells count] > 1) {
- PSMTabBarCell *cell1 = [cells objectAtIndex:0], *cell2 = [cells objectAtIndex:1];
- NSNumber *cellWidth;
-
- [newWidths removeAllObjects];
- totalOccupiedWidth = 0;
-
- cellWidth = [NSNumber numberWithDouble:[cell1 desiredWidthOfCell] < availableWidth * 0.5f ?[cell1 desiredWidthOfCell] : availableWidth * 0.5f];
- [newWidths addObject:cellWidth];
- totalOccupiedWidth += [cellWidth doubleValue];
-
- cellWidth = [NSNumber numberWithDouble:[cell2 desiredWidthOfCell] < (availableWidth - totalOccupiedWidth) ?[cell2 desiredWidthOfCell] : (availableWidth - totalOccupiedWidth)];
- [newWidths addObject:cellWidth];
- totalOccupiedWidth += [cellWidth doubleValue];
-
- if(totalOccupiedWidth < availableWidth) {
- [newWidths replaceObjectAtIndex:0 withObject:[NSNumber numberWithDouble:availableWidth - [cellWidth doubleValue]]];
- }
-
- numberOfVisibleCells = 2;
- }
- }
-
- return newWidths;
-}
-
-/*!
- @method _setupCells:withWidths
- @abstract Creates tracking rect arrays and sets the frames of the visible cells.
- @discussion Creates tracking rect arrays and sets the cells given in the widths array.
- */
-
-- (void)_setupCells:(NSArray *)cells withWidths:(NSArray *)widths {
- NSUInteger i, tabState, cellCount = [cells count];
- NSRect cellRect = [_control genericCellRect];
- PSMTabBarCell *cell;
- NSTabViewItem *selectedTabViewItem = [[_control tabView] selectedTabViewItem];
- NSMenuItem *menuItem;
-
- [_overflowMenu release], _overflowMenu = nil;
-
- for(i = 0; i < cellCount; i++) {
- cell = [cells objectAtIndex:i];
-
- if(i < [widths count]) {
- tabState = 0;
-
- // set cell frame
- if([_control orientation] == PSMTabBarHorizontalOrientation) {
- cellRect.size.width = [[widths objectAtIndex:i] doubleValue];
- } else {
- cellRect.size.width = [_control frame].size.width;
- cellRect.origin.y = [[widths objectAtIndex:i] doubleValue];
- cellRect.origin.x = 0;
- }
-
- [_cellFrames addObject:[NSValue valueWithRect:cellRect]];
-
- //add tracking rects to arrays
- [_closeButtonTrackingRects addObject:[NSValue valueWithRect:[cell closeButtonRectForFrame:cellRect]]];
- [_cellTrackingRects addObject:[NSValue valueWithRect:cellRect]];
-
- if([[cell representedObject] isEqualTo:selectedTabViewItem]) {
- [cell setState:NSOnState];
- tabState |= PSMTab_SelectedMask;
- // previous cell
- if(i > 0) {
- [[cells objectAtIndex:i - 1] setTabState:([(PSMTabBarCell *)[cells objectAtIndex:i - 1] tabState] | PSMTab_RightIsSelectedMask)];
- }
- // next cell - see below
- } else {
- [cell setState:NSOffState];
- // see if prev cell was selected
- if((i > 0) && ([[cells objectAtIndex:i - 1] state] == NSOnState)) {
- tabState |= PSMTab_LeftIsSelectedMask;
- }
- }
-
- // more tab states
- if([widths count] == 1) {
- tabState |= PSMTab_PositionLeftMask | PSMTab_PositionRightMask | PSMTab_PositionSingleMask;
- } else if(i == 0) {
- tabState |= PSMTab_PositionLeftMask;
- } else if(i == [widths count] - 1) {
- tabState |= PSMTab_PositionRightMask;
- }
-
- [cell setTabState:tabState];
- [cell setIsInOverflowMenu:NO];
-
- // indicator
- if(![[cell indicator] isHidden] && ![_control isTabBarHidden]) {
- if(![[_control subviews] containsObject:[cell indicator]]) {
- [_control addSubview:[cell indicator]];
- [[cell indicator] startAnimation:self];
- }
- }
-
- // next...
- cellRect.origin.x += [[widths objectAtIndex:i] doubleValue];
- } else {
- [cell setState:NSOffState];
- [cell setIsInOverflowMenu:YES];
- [[cell indicator] removeFromSuperview];
-
- //position the cell well offscreen
- if([_control orientation] == PSMTabBarHorizontalOrientation) {
- cellRect.origin.x += [[_control style] rightMarginForTabBarControl] + 20;
- } else {
- cellRect.origin.y = [_control frame].size.height + 2;
- }
-
- [_cellFrames addObject:[NSValue valueWithRect:cellRect]];
-
- if(_overflowMenu == nil) {
- _overflowMenu = [[NSMenu alloc] init];
- [_overflowMenu insertItemWithTitle:@"" action:nil keyEquivalent:@"" atIndex:0]; // Because the overflowPupUpButton is a pull down menu
- [_overflowMenu setDelegate:self];
- }
-
- // Each item's title is limited to 60 characters. If more than 60 characters, use an ellipsis to indicate that more exists.
- menuItem = [_overflowMenu addItemWithTitle:[[[cell attributedStringValue] string] stringWithEllipsisByTruncatingToLength:MAX_OVERFLOW_MENUITEM_TITLE_LENGTH]
- action:@selector(overflowMenuAction:)
- keyEquivalent:@""];
- [menuItem setTarget:_control];
- [menuItem setRepresentedObject:[cell representedObject]];
-
- if([cell count] > 0) {
- [menuItem setTitle:[[menuItem title] stringByAppendingFormat:@" (%lu)", (unsigned long)[cell count]]];
- }
- }
- }
-}
-
-- (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)menuItem atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel {
- if(menu == _overflowMenu) {
- if([[[menuItem representedObject] identifier] respondsToSelector:@selector(icon)]) {
- [menuItem setImage:[[[menuItem representedObject] identifier] valueForKey:@"icon"]];
- }
- }
-
- return TRUE;
-}
-
-- (NSInteger)numberOfItemsInMenu:(NSMenu *)menu {
- if(menu == _overflowMenu) {
- return [_overflowMenu numberOfItems];
- } else {
- NSLog(@"Warning: Unexpected menu delegate call for menu %@", menu);
- return 0;
- }
-}
-
-@end
-
-/*
- PSMTabBarController will store what the current tab frame state should be like based off the last layout. PSMTabBarControl
- has to handle fetching the new frame and then changing the tab cell frame.
- Tab states will probably be changed immediately.
-
- Tabs that aren't going to be visible need to have their frame set offscreen. Treat them as if they were visible.
-
- The overflow menu is rebuilt and stored by the controller.
-
- Arrays of tracking rects will be created here, but not applied.
- Tracking rects are removed and added by PSMTabBarControl at the end of an animate/display cycle.
-
- The add tab button frame is handled by this controller. Visibility and location are set by the control.
-
- isInOverflowMenu should probably be removed in favor of a call that returns yes/no to if a cell is in overflow. (Not yet implemented)
-
- Still need to rewrite most of the code in PSMTabDragAssistant.
- */
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.h b/frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.h
deleted file mode 100644
index 2632e11a0..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.h
+++ /dev/null
@@ -1,101 +0,0 @@
-//
-// PSMTabDragAssistant.h
-// PSMTabBarControl
-//
-// Created by John Pannell on 4/10/06.
-// Copyright 2006 Positive Spin Media. All rights reserved.
-//
-
-/*
- This class is a sigleton that manages the details of a tab drag and drop. The details were beginning to overwhelm me when keeping all of this in the control and cells :-)
- */
-
-#import <Cocoa/Cocoa.h>
-#import "PSMTabBarControl.h"
-
-#define kPSMTabDragAnimationSteps 8
-
-@class PSMTabBarCell, PSMTabDragWindowController;
-
-@interface PSMTabDragAssistant : NSObject {
- PSMTabBarControl *_sourceTabBar;
- PSMTabBarControl *_destinationTabBar;
- NSMutableSet *_participatingTabBars;
- PSMTabBarCell *_draggedCell;
- NSUInteger _draggedCellIndex; // for snap back
- BOOL _isDragging;
-
- // Support for dragging into new windows
- PSMTabDragWindowController *_draggedTab;
- PSMTabDragWindowController *_draggedView;
- NSSize _dragWindowOffset;
- NSTimer *_fadeTimer;
- BOOL _centersDragWindows;
- PSMTabBarTearOffStyle _currentTearOffStyle;
-
- // Animation
- NSTimer *_animationTimer;
- NSMutableArray *_sineCurveWidths;
- NSPoint _currentMouseLoc;
- PSMTabBarCell *_targetCell;
-}
-
-// Creation/destruction
-+ (PSMTabDragAssistant *)sharedDragAssistant;
-
-// Accessors
-- (PSMTabBarControl *)sourceTabBar;
-- (void)setSourceTabBar:(PSMTabBarControl *)tabBar;
-- (PSMTabBarControl *)destinationTabBar;
-- (void)setDestinationTabBar:(PSMTabBarControl *)tabBar;
-- (PSMTabBarCell *)draggedCell;
-- (void)setDraggedCell:(PSMTabBarCell *)cell;
-- (NSInteger)draggedCellIndex;
-- (void)setDraggedCellIndex:(NSInteger)value;
-- (BOOL)isDragging;
-- (void)setIsDragging:(BOOL)value;
-- (NSPoint)currentMouseLoc;
-- (void)setCurrentMouseLoc:(NSPoint)point;
-- (PSMTabBarCell *)targetCell;
-- (void)setTargetCell:(PSMTabBarCell *)cell;
-
-// Functionality
-- (void)startDraggingCell:(PSMTabBarCell *)cell fromTabBar:(PSMTabBarControl *)control withMouseDownEvent:(NSEvent *)event;
-- (void)draggingEnteredTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc;
-- (void)draggingUpdatedInTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc;
-- (void)draggingExitedTabBar:(PSMTabBarControl *)control;
-- (void)performDragOperation;
-- (void)draggedImageEndedAt:(NSPoint) aPoint operation:(NSDragOperation)operation;
-- (void)finishDrag;
-
-- (void)draggingBeganAt:(NSPoint)aPoint;
-- (void)draggingMovedTo:(NSPoint)aPoint;
-
-// Animation
-- (void)animateDrag:(NSTimer *)timer;
-- (void)calculateDragAnimationForTabBar:(PSMTabBarControl *)control;
-
-// Placeholder
-- (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control withDraggedCell:(PSMTabBarCell *)cell;
-- (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control;
-- (void)removeAllPlaceholdersFromTabBar:(PSMTabBarControl *)control;
-
-@end
-
-@interface PSMTabBarControl (DragAccessors)
-
-- (id<PSMTabStyle>)style;
-- (NSMutableArray *)cells;
-- (void)setControlView:(id)view;
-- (id)cellForPoint:(NSPoint) point cellFrame:(NSRectPointer)outFrame;
-- (PSMTabBarCell *)lastVisibleTab;
-- (NSInteger)numberOfVisibleTabs;
-
-@end
-
-void CGContextCopyWindowCaptureContentsToRect(void *grafport, CGRect rect, NSInteger cid, NSInteger wid, NSInteger zero);
-OSStatus CGSSetWindowTransform(NSInteger cid, NSInteger wid, CGAffineTransform transform);
-
-@interface NSApplication (CoreGraphicsUndocumented)
-- (NSInteger)contextID;
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.m b/frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.m
deleted file mode 100644
index 4542e8d02..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabDragAssistant.m
+++ /dev/null
@@ -1,834 +0,0 @@
-//
-// PSMTabDragAssistant.m
-// PSMTabBarControl
-//
-// Created by John Pannell on 4/10/06.
-// Copyright 2006 Positive Spin Media. All rights reserved.
-//
-
-#import "PSMTabDragAssistant.h"
-#import "PSMTabBarCell.h"
-#import "PSMTabStyle.h"
-#import "PSMTabDragWindowController.h"
-
-#define PI 3.1417
-
-@interface PSMTabBarControl (Private)
-- (void)update:(BOOL)animate;
-@end
-
-@interface PSMTabDragAssistant (Private)
-- (NSImage *)_imageForViewOfCell:(PSMTabBarCell *)cell styleMask:(NSUInteger *)outMask;
-- (NSImage *)_miniwindowImageOfWindow:(NSWindow *)window;
-- (void)_expandWindow:(NSWindow *)window atPoint:(NSPoint)point;
-@end
-
-@implementation PSMTabDragAssistant
-
-static PSMTabDragAssistant *sharedDragAssistant = nil;
-
-#pragma mark -
-#pragma mark Creation/Destruction
-
-+ (PSMTabDragAssistant *)sharedDragAssistant {
- if(!sharedDragAssistant) {
- sharedDragAssistant = [[PSMTabDragAssistant alloc] init];
- }
-
- return sharedDragAssistant;
-}
-
-- (id)init {
- if((self = [super init])) {
- _sourceTabBar = nil;
- _destinationTabBar = nil;
- _participatingTabBars = [[NSMutableSet alloc] init];
- _draggedCell = nil;
- _animationTimer = nil;
- _sineCurveWidths = [[NSMutableArray alloc] initWithCapacity:kPSMTabDragAnimationSteps];
- _targetCell = nil;
- _isDragging = NO;
- }
-
- return self;
-}
-
-- (void)dealloc {
- [_sourceTabBar release];
- [_destinationTabBar release];
- [_participatingTabBars release];
- [_draggedCell release];
- [_animationTimer release];
- [_sineCurveWidths release];
- [_targetCell release];
- [super dealloc];
-}
-
-#pragma mark -
-#pragma mark Accessors
-
-- (PSMTabBarControl *)sourceTabBar {
- return _sourceTabBar;
-}
-
-- (void)setSourceTabBar:(PSMTabBarControl *)tabBar {
- [tabBar retain];
- [_sourceTabBar release];
- _sourceTabBar = tabBar;
-}
-
-- (PSMTabBarControl *)destinationTabBar {
- return _destinationTabBar;
-}
-
-- (void)setDestinationTabBar:(PSMTabBarControl *)tabBar {
- [tabBar retain];
- [_destinationTabBar release];
- _destinationTabBar = tabBar;
-}
-
-- (PSMTabBarCell *)draggedCell {
- return _draggedCell;
-}
-
-- (void)setDraggedCell:(PSMTabBarCell *)cell {
- [cell retain];
- [_draggedCell release];
- _draggedCell = cell;
-}
-
-- (NSInteger)draggedCellIndex {
- return _draggedCellIndex;
-}
-
-- (void)setDraggedCellIndex:(NSInteger)value {
- _draggedCellIndex = value;
-}
-
-- (BOOL)isDragging {
- return _isDragging;
-}
-
-- (void)setIsDragging:(BOOL)value {
- _isDragging = value;
-}
-
-- (NSPoint)currentMouseLoc {
- return _currentMouseLoc;
-}
-
-- (void)setCurrentMouseLoc:(NSPoint)point {
- _currentMouseLoc = point;
-}
-
-- (PSMTabBarCell *)targetCell {
- return _targetCell;
-}
-
-- (void)setTargetCell:(PSMTabBarCell *)cell {
- [cell retain];
- [_targetCell release];
- _targetCell = cell;
-}
-
-#pragma mark -
-#pragma mark Functionality
-
-- (void)startDraggingCell:(PSMTabBarCell *)cell fromTabBar:(PSMTabBarControl *)control withMouseDownEvent:(NSEvent *)event {
- [self setIsDragging:YES];
- [self setSourceTabBar:control];
- [self setDestinationTabBar:control];
- [_participatingTabBars addObject:control];
- [self setDraggedCell:cell];
- [self setDraggedCellIndex:[[control cells] indexOfObject:cell]];
-
- NSRect cellFrame = [cell frame];
- // list of widths for animation
- NSInteger i;
- CGFloat cellStepSize = ([control orientation] == PSMTabBarHorizontalOrientation) ? (cellFrame.size.width + 6) : (cellFrame.size.height + 1);
- for(i = 0; i < kPSMTabDragAnimationSteps - 1; i++) {
- NSInteger thisWidth = (NSInteger)(cellStepSize - ((cellStepSize / 2.0) + ((sin((PI / 2.0) + ((CGFloat)i / (CGFloat)kPSMTabDragAnimationSteps) * PI) * cellStepSize) / 2.0)));
- [_sineCurveWidths addObject:[NSNumber numberWithInteger:thisWidth]];
- }
- [_sineCurveWidths addObject:[NSNumber numberWithInteger:([control orientation] == PSMTabBarHorizontalOrientation) ? cellFrame.size.width : cellFrame.size.height]];
-
- // hide UI buttons
- [[control overflowPopUpButton] setHidden:YES];
- [[control addTabButton] setHidden:YES];
-
- [[NSCursor closedHandCursor] set];
-
- NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
- NSImage *dragImage = [cell dragImage];
- [[cell indicator] removeFromSuperview];
- [self distributePlaceholdersInTabBar:control withDraggedCell:cell];
-
- if([control isFlipped]) {
- cellFrame.origin.y += cellFrame.size.height;
- }
- [cell setHighlighted:NO];
- NSSize offset = NSZeroSize;
- [pboard declareTypes:[NSArray arrayWithObjects:@"PSMTabBarControlItemPBType", nil] owner: nil];
- [pboard setString:[[NSNumber numberWithInteger:[[control cells] indexOfObject:cell]] stringValue] forType:@"PSMTabBarControlItemPBType"];
- _animationTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / 30.0) target:self selector:@selector(animateDrag:) userInfo:nil repeats:YES];
-
- [[NSNotificationCenter defaultCenter] postNotificationName:PSMTabDragDidBeginNotification object:nil];
-
- //retain the control in case the drag operation causes the control to be released
- [control retain];
-
- if([control delegate] && [[control delegate] respondsToSelector:@selector(tabView:shouldDropTabViewItem:inTabBar:)] &&
- [[control delegate] tabView:[control tabView] shouldDropTabViewItem:[[self draggedCell] representedObject] inTabBar:nil]) {
- _currentTearOffStyle = [control tearOffStyle];
- _draggedTab = [[PSMTabDragWindowController alloc] initWithImage:dragImage styleMask:NSBorderlessWindowMask tearOffStyle:_currentTearOffStyle];
-
- cellFrame.origin.y -= cellFrame.size.height;
- [control dragImage:[[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] autorelease] at:cellFrame.origin offset:offset event:event pasteboard:pboard source:control slideBack:NO];
- } else {
- [control dragImage:dragImage at:cellFrame.origin offset:offset event:event pasteboard:pboard source:control slideBack:YES];
- }
-
- [control release];
-}
-
-- (void)draggingEnteredTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc {
- if(_currentTearOffStyle == PSMTabBarTearOffMiniwindow && ![self destinationTabBar]) {
- [_draggedTab switchImages];
- }
-
- [self setDestinationTabBar:control];
- [self setCurrentMouseLoc:mouseLoc];
- // hide UI buttons
- [[control overflowPopUpButton] setHidden:YES];
- [[control addTabButton] setHidden:YES];
- if([[control cells] count] == 0 || ![[[control cells] objectAtIndex:0] isPlaceholder]) {
- [self distributePlaceholdersInTabBar:control];
- }
- [_participatingTabBars addObject:control];
-
- //tell the drag window to display only the header if there is one
- if(_currentTearOffStyle == PSMTabBarTearOffAlphaWindow && _draggedView) {
- if(_fadeTimer) {
- [_fadeTimer invalidate];
- }
-
- [[_draggedTab window] orderFront:nil];
- _fadeTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0 target:self selector:@selector(fadeOutDragWindow:) userInfo:nil repeats:YES];
- }
-}
-
-- (void)draggingUpdatedInTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc {
- if([self destinationTabBar] != control) {
- [self setDestinationTabBar:control];
- }
- [self setCurrentMouseLoc:mouseLoc];
-}
-
-- (void)draggingExitedTabBar:(PSMTabBarControl *)control {
- if([[control delegate] respondsToSelector:@selector(tabView:shouldAllowTabViewItem:toLeaveTabBar:)] &&
- ![[control delegate] tabView:[control tabView] shouldAllowTabViewItem:[[self draggedCell] representedObject] toLeaveTabBar:control]) {
- return;
- }
-
- [self setDestinationTabBar:nil];
- [self setCurrentMouseLoc:NSMakePoint(-1.0, -1.0)];
-
- if(_fadeTimer) {
- [_fadeTimer invalidate];
- _fadeTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0 target:self selector:@selector(fadeInDragWindow:) userInfo:nil repeats:YES];
- } else if(_draggedTab) {
- if(_currentTearOffStyle == PSMTabBarTearOffAlphaWindow) {
- //create a new floating drag window
- if(!_draggedView) {
- NSUInteger styleMask;
- NSImage *viewImage = [self _imageForViewOfCell:[self draggedCell] styleMask:&styleMask];
-
- _draggedView = [[PSMTabDragWindowController alloc] initWithImage:viewImage styleMask:styleMask tearOffStyle:PSMTabBarTearOffAlphaWindow];
- [[_draggedView window] setAlphaValue:0.0];
- }
-
- NSPoint windowOrigin = [[control window] frame].origin;
-
- windowOrigin.x -= _dragWindowOffset.width;
- windowOrigin.y += _dragWindowOffset.height;
- [[_draggedView window] setFrameOrigin:windowOrigin];
- [[_draggedView window] orderWindow:NSWindowBelow relativeTo:[[_draggedTab window] windowNumber]];
- } else if(_currentTearOffStyle == PSMTabBarTearOffMiniwindow && ![_draggedTab alternateImage]) {
- NSImage *image;
- NSSize imageSize;
- NSUInteger mask; //we don't need this but we can't pass nil in for the style mask, as some delegate implementations will crash
-
- if(!(image = [self _miniwindowImageOfWindow:[control window]])) {
- image = [[self _imageForViewOfCell:[self draggedCell] styleMask:&mask] copy];
- }
-
- imageSize = [image size];
- [image setScalesWhenResized:YES];
-
- if(imageSize.width > imageSize.height) {
- [image setSize:NSMakeSize(125, 125 * (imageSize.height / imageSize.width))];
- } else {
- [image setSize:NSMakeSize(125 * (imageSize.width / imageSize.height), 125)];
- }
-
- [_draggedTab setAlternateImage:image];
- }
-
- //set the window's alpha mask to zero if the last tab is being dragged
- //don't fade out the old window if the delegate doesn't respond to the new tab bar method, just to be safe
- if([[[self sourceTabBar] tabView] numberOfTabViewItems] == 1 && [self sourceTabBar] == control &&
- [[[self sourceTabBar] delegate] respondsToSelector:@selector(tabView:newTabBarForDraggedTabViewItem:atPoint:)]) {
- [[[self sourceTabBar] window] setAlphaValue:0.0];
-
- if([_sourceTabBar tearOffStyle] == PSMTabBarTearOffAlphaWindow) {
- [[_draggedView window] setAlphaValue:kPSMTabDragWindowAlpha];
- } else {
- //#warning fix me - what should we do when the last tab is dragged as a miniwindow?
- }
- } else {
- if([_sourceTabBar tearOffStyle] == PSMTabBarTearOffAlphaWindow) {
- _fadeTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0 target:self selector:@selector(fadeInDragWindow:) userInfo:nil repeats:YES];
- } else {
- [_draggedTab switchImages];
- _centersDragWindows = YES;
- }
- }
- }
-}
-
-- (void)performDragOperation {
- // move cell
- NSUInteger destinationIndex = [[[self destinationTabBar] cells] indexOfObject:[self targetCell]];
-
- //there is the slight possibility of the targetCell now being set properly, so avoid errors
- if(destinationIndex >= [[[self destinationTabBar] cells] count]) {
- destinationIndex = [[[self destinationTabBar] cells] count] - 1;
- }
-
- [[[self destinationTabBar] cells] replaceObjectAtIndex:destinationIndex withObject:[self draggedCell]];
- [[self draggedCell] setControlView:[self destinationTabBar]];
-
- // move actual NSTabViewItem
- if([self sourceTabBar] != [self destinationTabBar]) {
- //remove the tracking rects and bindings registered on the old tab
- [[self sourceTabBar] removeTrackingRect:[[self draggedCell] closeButtonTrackingTag]];
- [[self sourceTabBar] removeTrackingRect:[[self draggedCell] cellTrackingTag]];
- [[self sourceTabBar] removeTabForCell:[self draggedCell]];
-
- NSUInteger i, insertIndex;
- NSArray *cells = [[self destinationTabBar] cells];
-
- //find the index of where the dragged cell was just dropped
- for(i = 0, insertIndex = 0; (i < [cells count]) && ([cells objectAtIndex:i] != [self draggedCell]); i++, insertIndex++) {
- if([[cells objectAtIndex:i] isPlaceholder]) {
- insertIndex--;
- }
- }
-
- [[[self sourceTabBar] tabView] removeTabViewItem:[[self draggedCell] representedObject]];
- [[[self destinationTabBar] tabView] insertTabViewItem:[[self draggedCell] representedObject] atIndex:insertIndex];
-
- //calculate the position for the dragged cell
- if([[self destinationTabBar] automaticallyAnimates]) {
- if(insertIndex > 0) {
- NSRect cellRect = [[cells objectAtIndex:insertIndex - 1] frame];
- cellRect.origin.x += cellRect.size.width;
- [[self draggedCell] setFrame:cellRect];
- }
- }
-
- //rebind the cell to the new control
- [[self destinationTabBar] bindPropertiesForCell:[self draggedCell] andTabViewItem:[[self draggedCell] representedObject]];
-
- //select the newly moved item in the destination tab view
- [[[self destinationTabBar] tabView] selectTabViewItem:[[self draggedCell] representedObject]];
- } else {
- //have to do this before checking the index of a cell otherwise placeholders will be counted
- [self removeAllPlaceholdersFromTabBar:[self sourceTabBar]];
-
- //rearrange the tab view items
- NSTabView *tabView = [[self sourceTabBar] tabView];
- NSTabViewItem *item = [[self draggedCell] representedObject];
- BOOL reselect = ([tabView selectedTabViewItem] == item);
- NSArray *cells = [[self sourceTabBar] cells];
- NSUInteger index;
- //find the index of where the dragged cell was just dropped
- for(index = 0; index < [cells count] && [cells objectAtIndex:index] != [self draggedCell]; index++) {
- ;
- }
-
- //temporarily disable the delegate in order to move the tab to a different index
- id tempDelegate = [tabView delegate];
- [tabView setDelegate:nil];
- [item retain];
- [tabView removeTabViewItem:item];
- [tabView insertTabViewItem:item atIndex:index];
- if(reselect) {
- [tabView selectTabViewItem:item];
- }
- [tabView setDelegate:tempDelegate];
- }
-
- if(([self sourceTabBar] != [self destinationTabBar] || [[[self sourceTabBar] cells] indexOfObject:[self draggedCell]] != _draggedCellIndex) && [[[self sourceTabBar] delegate] respondsToSelector:@selector(tabView:didDropTabViewItem:inTabBar:)]) {
- [[[self sourceTabBar] delegate] tabView:[[self sourceTabBar] tabView] didDropTabViewItem:[[self draggedCell] representedObject] inTabBar:[self destinationTabBar]];
- }
-
- [[NSNotificationCenter defaultCenter] postNotificationName:PSMTabDragDidEndNotification object:nil];
-
- [self finishDrag];
-}
-
-- (void)draggedImageEndedAt:(NSPoint)aPoint operation:(NSDragOperation)operation {
- if([self isDragging]) { // means there was not a successful drop (performDragOperation)
- id sourceDelegate = [[self sourceTabBar] delegate];
-
- //split off the dragged tab into a new window
- if([self destinationTabBar] == nil &&
- sourceDelegate && [sourceDelegate respondsToSelector:@selector(tabView:shouldDropTabViewItem:inTabBar:)] &&
- [sourceDelegate tabView:[[self sourceTabBar] tabView] shouldDropTabViewItem:[[self draggedCell] representedObject] inTabBar:nil] &&
- [sourceDelegate respondsToSelector:@selector(tabView:newTabBarForDraggedTabViewItem:atPoint:)]) {
- PSMTabBarControl *control = [sourceDelegate tabView:[[self sourceTabBar] tabView] newTabBarForDraggedTabViewItem:[[self draggedCell] representedObject] atPoint:aPoint];
-
- if(control) {
- //add the dragged tab to the new window
- [[control cells] insertObject:[self draggedCell] atIndex:0];
-
- //remove the tracking rects and bindings registered on the old tab
- [[self sourceTabBar] removeTrackingRect:[[self draggedCell] closeButtonTrackingTag]];
- [[self sourceTabBar] removeTrackingRect:[[self draggedCell] cellTrackingTag]];
- [[self sourceTabBar] removeTabForCell:[self draggedCell]];
-
- //rebind the cell to the new control
- [control bindPropertiesForCell:[self draggedCell] andTabViewItem:[[self draggedCell] representedObject]];
-
- [[self draggedCell] setControlView:control];
-
- [[[self sourceTabBar] tabView] removeTabViewItem:[[self draggedCell] representedObject]];
-
- [[control tabView] addTabViewItem:[[self draggedCell] representedObject]];
- [control update:NO]; //make sure the new tab is set in the correct position
-
- if(_currentTearOffStyle == PSMTabBarTearOffAlphaWindow) {
- [[control window] makeKeyAndOrderFront:nil];
- } else {
- //center the window over where we ended dragging
- [self _expandWindow:[control window] atPoint:[NSEvent mouseLocation]];
- }
-
- if([sourceDelegate respondsToSelector:@selector(tabView:didDropTabViewItem:inTabBar:)]) {
- [sourceDelegate tabView:[[self sourceTabBar] tabView] didDropTabViewItem:[[self draggedCell] representedObject] inTabBar:control];
- }
- } else {
- NSLog(@"Delegate returned no control to add to.");
- [[[self sourceTabBar] cells] insertObject:[self draggedCell] atIndex:[self draggedCellIndex]];
- }
- } else {
- // put cell back
- [[[self sourceTabBar] cells] insertObject:[self draggedCell] atIndex:[self draggedCellIndex]];
- }
-
- [[NSNotificationCenter defaultCenter] postNotificationName:PSMTabDragDidEndNotification object:nil];
-
- [self finishDrag];
- }
-}
-
-- (void)finishDrag {
- if([[[self sourceTabBar] tabView] numberOfTabViewItems] == 0 && [[[self sourceTabBar] delegate] respondsToSelector:@selector(tabView:closeWindowForLastTabViewItem:)]) {
- [[[self sourceTabBar] delegate] tabView:[[self sourceTabBar] tabView] closeWindowForLastTabViewItem:[[self draggedCell] representedObject]];
- }
-
- if(_draggedTab) {
- [[_draggedTab window] orderOut:nil];
- [_draggedTab release];
- _draggedTab = nil;
- }
-
- if(_draggedView) {
- [[_draggedView window] orderOut:nil];
- [_draggedView release];
- _draggedView = nil;
- }
-
- _centersDragWindows = NO;
-
- [self setIsDragging:NO];
- [self removeAllPlaceholdersFromTabBar:[self sourceTabBar]];
- [self setSourceTabBar:nil];
- [self setDestinationTabBar:nil];
- NSEnumerator *e = [_participatingTabBars objectEnumerator];
- PSMTabBarControl *tabBar;
- while((tabBar = [e nextObject])) {
- [self removeAllPlaceholdersFromTabBar:tabBar];
- }
- [_participatingTabBars removeAllObjects];
- [self setDraggedCell:nil];
- [_animationTimer invalidate];
- _animationTimer = nil;
- [_sineCurveWidths removeAllObjects];
- [self setTargetCell:nil];
-}
-
-- (void)draggingBeganAt:(NSPoint)aPoint {
- if(_draggedTab) {
- [[_draggedTab window] setFrameTopLeftPoint:aPoint];
- [[_draggedTab window] orderFront:nil];
-
- if([[[self sourceTabBar] tabView] numberOfTabViewItems] == 1) {
- [self draggingExitedTabBar:[self sourceTabBar]];
- [[_draggedTab window] setAlphaValue:0.0];
- }
- }
-}
-
-- (void)draggingMovedTo:(NSPoint)aPoint {
- if(_draggedTab) {
- if(_centersDragWindows) {
- if([_draggedTab isAnimating]) {
- return;
- }
-
- //Ignore aPoint, as it seems to give wacky values
- NSRect frame = [[_draggedTab window] frame];
- frame.origin = [NSEvent mouseLocation];
- frame.origin.x -= frame.size.width / 2;
- frame.origin.y -= frame.size.height / 2;
- [[_draggedTab window] setFrame:frame display:NO];
- } else {
- [[_draggedTab window] setFrameTopLeftPoint:aPoint];
- }
-
- if(_draggedView) {
- //move the view representation with the tab
- //the relative position of the dragged view window will be different
- //depending on the position of the tab bar relative to the controlled tab view
-
- aPoint.y -= [[_draggedTab window] frame].size.height;
- aPoint.x -= _dragWindowOffset.width;
- aPoint.y += _dragWindowOffset.height;
- [[_draggedView window] setFrameTopLeftPoint:aPoint];
- }
- }
-}
-
-- (void)fadeInDragWindow:(NSTimer *)timer {
- CGFloat value = [[_draggedView window] alphaValue];
- if(value >= kPSMTabDragWindowAlpha || _draggedTab == nil) {
- [timer invalidate];
- _fadeTimer = nil;
- } else {
- [[_draggedTab window] setAlphaValue:[[_draggedTab window] alphaValue] - kPSMTabDragAlphaInterval];
- [[_draggedView window] setAlphaValue:value + kPSMTabDragAlphaInterval];
- }
-}
-
-- (void)fadeOutDragWindow:(NSTimer *)timer {
- CGFloat value = [[_draggedView window] alphaValue];
- NSWindow *tabWindow = [_draggedTab window], *viewWindow = [_draggedView window];
-
- if(value <= 0.0) {
- [viewWindow setAlphaValue:0.0];
- [tabWindow setAlphaValue:kPSMTabDragWindowAlpha];
-
- [timer invalidate];
- _fadeTimer = nil;
- } else {
- if([tabWindow alphaValue] < kPSMTabDragWindowAlpha) {
- [tabWindow setAlphaValue:[tabWindow alphaValue] + kPSMTabDragAlphaInterval];
- }
- [viewWindow setAlphaValue:value - kPSMTabDragAlphaInterval];
- }
-}
-
-#pragma mark -
-#pragma mark Private
-
-- (NSImage *)_imageForViewOfCell:(PSMTabBarCell *)cell styleMask:(NSUInteger *)outMask {
- PSMTabBarControl *control = [cell controlView];
- NSImage *viewImage = nil;
-
- if(outMask) {
- *outMask = NSBorderlessWindowMask;
- }
-
- if([control delegate] && [[control delegate] respondsToSelector:@selector(tabView:imageForTabViewItem:offset:styleMask:)]) {
- //get a custom image representation of the view to drag from the delegate
- NSImage *tabImage = [_draggedTab image];
- NSPoint drawPoint;
- _dragWindowOffset = NSZeroSize;
- viewImage = [[control delegate] tabView:[control tabView] imageForTabViewItem:[cell representedObject] offset:&_dragWindowOffset styleMask:outMask];
- [viewImage lockFocus];
-
- //draw the tab into the returned window, that way we don't have two windows being dragged (this assumes the tab will be on the window)
- drawPoint = NSMakePoint(_dragWindowOffset.width, [viewImage size].height - _dragWindowOffset.height);
-
- if([control orientation] == PSMTabBarHorizontalOrientation) {
- drawPoint.y += [[control style] tabCellHeight] - [tabImage size].height;
- _dragWindowOffset.height -= [[control style] tabCellHeight] - [tabImage size].height;
- } else {
- drawPoint.x += [control frame].size.width - [tabImage size].width;
- }
-
- [tabImage compositeToPoint:drawPoint operation:NSCompositeSourceOver];
-
- [viewImage unlockFocus];
- } else {
- //the delegate doesn't give a custom image, so use an image of the view
- NSView *tabView = [[cell representedObject] view];
- viewImage = [[[NSImage alloc] initWithSize:[tabView frame].size] autorelease];
- [viewImage lockFocus];
- [tabView drawRect:[tabView bounds]];
- [viewImage unlockFocus];
- }
-
- if(*outMask | NSBorderlessWindowMask) {
- _dragWindowOffset.height += 22;
- }
-
- return viewImage;
-}
-
-- (NSImage *)_miniwindowImageOfWindow:(NSWindow *)window {
- NSRect rect = [window frame];
- NSImage *image = [[[NSImage alloc] initWithSize:rect.size] autorelease];
- [image lockFocus];
- rect.origin = NSZeroPoint;
- CGContextCopyWindowCaptureContentsToRect([[NSGraphicsContext currentContext] graphicsPort], *(CGRect *)&rect, [NSApp contextID], [window windowNumber], 0);
- [image unlockFocus];
-
- return image;
-}
-
-- (void)_expandWindow:(NSWindow *)window atPoint:(NSPoint)point {
- NSRect frame = [window frame];
- [window setFrameTopLeftPoint:NSMakePoint(point.x - frame.size.width / 2, point.y + frame.size.height / 2)];
- [window setAlphaValue:0.0];
- [window makeKeyAndOrderFront:nil];
-
- NSAnimation *animation = [[NSAnimation alloc] initWithDuration:0.25 animationCurve:NSAnimationEaseInOut];
- [animation setAnimationBlockingMode:NSAnimationNonblocking];
- [animation setCurrentProgress:0.1];
- [animation startAnimation];
- NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0 target:self selector:@selector(_expandWindowTimerFired:) userInfo:[NSDictionary dictionaryWithObjectsAndKeys:window, @"Window", animation, @"Animation", nil] repeats:YES];
- [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSEventTrackingRunLoopMode];
-}
-
-- (void)_expandWindowTimerFired:(NSTimer *)timer {
- NSWindow *window = [[timer userInfo] objectForKey:@"Window"];
- NSAnimation *animation = [[timer userInfo] objectForKey:@"Animation"];
- CGAffineTransform transform;
- NSPoint translation;
- NSRect winFrame = [window frame];
-
- translation.x = (winFrame.size.width / 2.0);
- translation.y = (winFrame.size.height / 2.0);
- transform = CGAffineTransformMakeTranslation(translation.x, translation.y);
- transform = CGAffineTransformScale(transform, 1.0 / [animation currentValue], 1.0 / [animation currentValue]);
- transform = CGAffineTransformTranslate(transform, -translation.x, -translation.y);
-
- translation.x = -winFrame.origin.x;
- translation.y = winFrame.origin.y + winFrame.size.height - [[NSScreen mainScreen] frame].size.height;
-
- transform = CGAffineTransformTranslate(transform, translation.x, translation.y);
-
- CGSSetWindowTransform([NSApp contextID], [window windowNumber], transform);
-
- [window setAlphaValue:[animation currentValue]];
-
- if(![animation isAnimating]) {
- [timer invalidate];
- [animation release];
- }
-}
-
-#pragma mark -
-#pragma mark Animation
-
-- (void)animateDrag:(NSTimer *)timer {
- NSEnumerator *e = [[[_participatingTabBars copy] autorelease] objectEnumerator];
- PSMTabBarControl *tabBar;
- while((tabBar = [e nextObject])) {
- [self calculateDragAnimationForTabBar:tabBar];
- [[NSRunLoop currentRunLoop] performSelector:@selector(display) target:tabBar argument:nil order:1 modes:[NSArray arrayWithObjects:@"NSEventTrackingRunLoopMode", @"NSDefaultRunLoopMode", nil]];
- }
-}
-
-- (void)calculateDragAnimationForTabBar:(PSMTabBarControl *)control {
- BOOL removeFlag = YES;
- NSMutableArray *cells = [control cells];
- NSInteger i, cellCount = [cells count];
- CGFloat position = [control orientation] == PSMTabBarHorizontalOrientation ?[[control style] leftMarginForTabBarControl] :[[control style] topMarginForTabBarControl];
-
- // identify target cell
- // mouse at beginning of tabs
- NSPoint mouseLoc = [self currentMouseLoc];
- if([self destinationTabBar] == control) {
- removeFlag = NO;
- if(mouseLoc.x < [[control style] leftMarginForTabBarControl]) {
- [self setTargetCell:[cells objectAtIndex:0]];
- } else {
- NSRect overCellRect;
- PSMTabBarCell *overCell = [control cellForPoint:mouseLoc cellFrame:&overCellRect];
- if(overCell) {
- // mouse among cells - placeholder
- if([overCell isPlaceholder]) {
- [self setTargetCell:overCell];
- } else if([control orientation] == PSMTabBarHorizontalOrientation) {
- // non-placeholders - horizontal orientation
- if(mouseLoc.x < (overCellRect.origin.x + (overCellRect.size.width / 2.0))) {
- // mouse on left side of cell
- [self setTargetCell:[cells objectAtIndex:([cells indexOfObject:overCell] - 1)]];
- } else {
- // mouse on right side of cell
- [self setTargetCell:[cells objectAtIndex:([cells indexOfObject:overCell] + 1)]];
- }
- } else {
- // non-placeholders - vertical orientation
- if(mouseLoc.y < (overCellRect.origin.y + (overCellRect.size.height / 2.0))) {
- // mouse on top of cell
- [self setTargetCell:[cells objectAtIndex:([cells indexOfObject:overCell] - 1)]];
- } else {
- // mouse on bottom of cell
- [self setTargetCell:[cells objectAtIndex:([cells indexOfObject:overCell] + 1)]];
- }
- }
- } else {
- // out at end - must find proper cell (could be more in overflow menu)
- [self setTargetCell:[control lastVisibleTab]];
- }
- }
- } else {
- [self setTargetCell:nil];
- }
-
- for(i = 0; i < cellCount; i++) {
- PSMTabBarCell *cell = [cells objectAtIndex:i];
- NSRect newRect = [cell frame];
- if(![cell isInOverflowMenu]) {
- if([cell isPlaceholder]) {
- if(cell == [self targetCell]) {
- [cell setCurrentStep:([cell currentStep] + 1)];
- } else {
- [cell setCurrentStep:([cell currentStep] - 1)];
- if([cell currentStep] > 0) {
- removeFlag = NO;
- }
- }
-
- if([control orientation] == PSMTabBarHorizontalOrientation) {
- newRect.size.width = [[_sineCurveWidths objectAtIndex:[cell currentStep]] integerValue];
- } else {
- newRect.size.height = [[_sineCurveWidths objectAtIndex:[cell currentStep]] integerValue];
- }
- }
- } else {
- break;
- }
-
- if([control orientation] == PSMTabBarHorizontalOrientation) {
- newRect.origin.x = position;
- position += newRect.size.width;
- } else {
- newRect.origin.y = position;
- position += newRect.size.height;
- }
- [cell setFrame:newRect];
- if([cell indicator]) {
- [[cell indicator] setFrame:[[control style] indicatorRectForTabCell:cell]];
- }
- }
- if(removeFlag) {
- [_participatingTabBars removeObject:control];
- [self removeAllPlaceholdersFromTabBar:control];
- }
-}
-
-#pragma mark -
-#pragma mark Placeholders
-
-- (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control withDraggedCell:(PSMTabBarCell *)cell {
- // called upon first drag - must distribute placeholders
- [self distributePlaceholdersInTabBar:control];
-
- NSMutableArray *cells = [control cells];
-
- // replace dragged cell with a placeholder, and clean up surrounding cells
- NSInteger cellIndex = [cells indexOfObject:cell];
- PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:YES inControlView:control] autorelease];
- [cells replaceObjectAtIndex:cellIndex withObject:pc];
- [cells removeObjectAtIndex:(cellIndex + 1)];
- [cells removeObjectAtIndex:(cellIndex - 1)];
-
- if(cellIndex - 2 >= 0) {
- pc = [cells objectAtIndex:cellIndex - 2];
- [pc setTabState:~[pc tabState] & PSMTab_RightIsSelectedMask];
- }
-}
-
-- (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control {
- NSUInteger i, numVisibleTabs = [control numberOfVisibleTabs];
- for(i = 0; i < numVisibleTabs; i++) {
- PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control] autorelease];
- [[control cells] insertObject:pc atIndex:(2 * i)];
- }
-
- PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control] autorelease];
- if([[control cells] count] > (2 * numVisibleTabs)) {
- [[control cells] insertObject:pc atIndex:(2 * numVisibleTabs)];
- } else {
- [[control cells] addObject:pc];
- }
-}
-
-- (void)removeAllPlaceholdersFromTabBar:(PSMTabBarControl *)control {
- NSInteger i, cellCount = [[control cells] count];
- for(i = (cellCount - 1); i >= 0; i--) {
- PSMTabBarCell *cell = [[control cells] objectAtIndex:i];
- if([cell isPlaceholder]) {
- [control removeTabForCell:cell];
- }
- }
- // redraw
- [control update:NO];
-}
-
-#pragma mark -
-#pragma mark Archiving
-
-- (void)encodeWithCoder:(NSCoder *)aCoder {
- //[super encodeWithCoder:aCoder];
- if([aCoder allowsKeyedCoding]) {
- [aCoder encodeObject:_sourceTabBar forKey:@"sourceTabBar"];
- [aCoder encodeObject:_destinationTabBar forKey:@"destinationTabBar"];
- [aCoder encodeObject:_participatingTabBars forKey:@"participatingTabBars"];
- [aCoder encodeObject:_draggedCell forKey:@"draggedCell"];
- [aCoder encodeInteger:_draggedCellIndex forKey:@"draggedCellIndex"];
- [aCoder encodeBool:_isDragging forKey:@"isDragging"];
- [aCoder encodeObject:_animationTimer forKey:@"animationTimer"];
- [aCoder encodeObject:_sineCurveWidths forKey:@"sineCurveWidths"];
- [aCoder encodePoint:_currentMouseLoc forKey:@"currentMouseLoc"];
- [aCoder encodeObject:_targetCell forKey:@"targetCell"];
- }
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder {
- //self = [super initWithCoder:aDecoder];
- //if (self) {
- if([aDecoder allowsKeyedCoding]) {
- _sourceTabBar = [[aDecoder decodeObjectForKey:@"sourceTabBar"] retain];
- _destinationTabBar = [[aDecoder decodeObjectForKey:@"destinationTabBar"] retain];
- _participatingTabBars = [[aDecoder decodeObjectForKey:@"participatingTabBars"] retain];
- _draggedCell = [[aDecoder decodeObjectForKey:@"draggedCell"] retain];
- _draggedCellIndex = [aDecoder decodeIntegerForKey:@"draggedCellIndex"];
- _isDragging = [aDecoder decodeBoolForKey:@"isDragging"];
- _animationTimer = [[aDecoder decodeObjectForKey:@"animationTimer"] retain];
- _sineCurveWidths = [[aDecoder decodeObjectForKey:@"sineCurveWidths"] retain];
- _currentMouseLoc = [aDecoder decodePointForKey:@"currentMouseLoc"];
- _targetCell = [[aDecoder decodeObjectForKey:@"targetCell"] retain];
- }
- //}
- return self;
-}
-
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragView.h b/frontends/cocoa/PSMTabBarControl/PSMTabDragView.h
deleted file mode 100644
index f8018d290..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabDragView.h
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// PSMTabDragView.h
-// PSMTabBarControl
-//
-// Created by Kent Sutherland on 6/17/07.
-// Copyright 2007 Kent Sutherland. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-@interface PSMTabDragView : NSView {
- NSImage *_image;
- NSImage *_alternateImage;
- CGFloat _alpha;
-}
-- (void)setFadeValue:(CGFloat)value;
-- (NSImage *)image;
-- (void)setImage:(NSImage *)image;
-- (NSImage *)alternateImage;
-- (void)setAlternateImage:(NSImage *)image;
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragView.m b/frontends/cocoa/PSMTabBarControl/PSMTabDragView.m
deleted file mode 100644
index 2c9781dbc..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabDragView.m
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// PSMTabDragView.m
-// PSMTabBarControl
-//
-// Created by Kent Sutherland on 6/17/07.
-// Copyright 2007 Kent Sutherland. All rights reserved.
-//
-
-#import "PSMTabDragView.h"
-
-
-@implementation PSMTabDragView
-
-- (id)initWithFrame:(NSRect)frame {
- if((self = [super initWithFrame:frame])) {
- _alpha = 1.0;
- }
- return self;
-}
-
-- (void)dealloc {
- [_image release];
- [_alternateImage release];
- [super dealloc];
-}
-
-- (void)drawRect:(NSRect)rect {
- //1.0 fade means show the primary image
- //0.0 fade means show the secondary image
- CGFloat primaryAlpha = _alpha + 0.001f, alternateAlpha = 1.001f - _alpha;
- NSRect srcRect;
- srcRect.origin = NSZeroPoint;
- srcRect.size = [_image size];
-
- [_image drawInRect:[self bounds] fromRect:srcRect operation:NSCompositeSourceOver fraction:primaryAlpha];
- srcRect.size = [_alternateImage size];
- [_alternateImage drawInRect:[self bounds] fromRect:srcRect operation:NSCompositeSourceOver fraction:alternateAlpha];
-}
-
-- (void)setFadeValue:(CGFloat)value {
- _alpha = value;
-}
-
-- (NSImage *)image {
- return _image;
-}
-
-- (void)setImage:(NSImage *)image {
- [_image release];
- _image = [image retain];
-}
-
-- (NSImage *)alternateImage {
- return _alternateImage;
-}
-
-- (void)setAlternateImage:(NSImage *)image {
- [_alternateImage release];
- _alternateImage = [image retain];
-}
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.h b/frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.h
deleted file mode 100644
index 04cde248c..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.h
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// PSMTabDragWindow.h
-// PSMTabBarControl
-//
-// Created by Kent Sutherland on 6/1/06.
-// Copyright 2006 Kent Sutherland. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-@class PSMTabDragView;
-
-@interface PSMTabDragWindow : NSWindow {
- PSMTabDragView *_dragView;
-}
-+ (PSMTabDragWindow *)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask;
-
-- (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask;
-- (PSMTabDragView *)dragView;
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.m b/frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.m
deleted file mode 100644
index d6fcc95a3..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabDragWindow.m
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// PSMTabDragWindow.m
-// PSMTabBarControl
-//
-// Created by Kent Sutherland on 6/1/06.
-// Copyright 2006 Kent Sutherland. All rights reserved.
-//
-
-#import "PSMTabDragWindow.h"
-#import "PSMTabDragView.h"
-
-@implementation PSMTabDragWindow
-
-+ (PSMTabDragWindow *)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask {
- return [[[PSMTabDragWindow alloc] initWithImage:image styleMask:styleMask] autorelease];
-}
-
-- (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask {
- NSSize size = [image size];
-
- if((self = [super initWithContentRect:NSMakeRect(0, 0, size.width, size.height) styleMask:styleMask backing:NSBackingStoreBuffered defer:NO])) {
- _dragView = [[[PSMTabDragView alloc] initWithFrame:NSMakeRect(0, 0, size.width, size.height)] autorelease];
- [self setContentView:_dragView];
- [self setLevel:NSStatusWindowLevel];
- [self setIgnoresMouseEvents:YES];
- [self setOpaque:NO];
-
- [_dragView setImage:image];
-
- //Set the size of the window to be the exact size of the drag image
- NSRect windowFrame = [self frame];
- windowFrame.origin.y += windowFrame.size.height - size.height;
- windowFrame.size = size;
-
- if(styleMask | NSBorderlessWindowMask) {
- windowFrame.size.height += 22;
- }
-
- [self setFrame:windowFrame display:YES];
- }
- return self;
-}
-
-- (PSMTabDragView *)dragView {
- return _dragView;
-}
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.h b/frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.h
deleted file mode 100644
index 5948207f2..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// PSMTabDragWindowController.h
-// PSMTabBarControl
-//
-// Created by Kent Sutherland on 6/18/07.
-// Copyright 2007 Kent Sutherland. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "PSMTabBarControl.h"
-
-#define kPSMTabDragWindowAlpha 0.75
-#define kPSMTabDragAlphaInterval 0.15
-
-@class PSMTabDragView;
-
-@interface PSMTabDragWindowController : NSWindowController {
- PSMTabBarTearOffStyle _tearOffStyle;
- PSMTabDragView *_view;
- NSAnimation *_animation;
- NSTimer *_timer;
-
- BOOL _showingAlternate;
- NSRect _originalWindowFrame;
-}
-- (id)initWithImage:(NSImage *)image styleMask:(NSUInteger) styleMask tearOffStyle:(PSMTabBarTearOffStyle)tearOffStyle;
-
-- (NSImage *)image;
-- (NSImage *)alternateImage;
-- (void)setAlternateImage:(NSImage *)image;
-- (BOOL)isAnimating;
-- (void)switchImages;
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.m b/frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.m
deleted file mode 100644
index 3a6e8c663..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabDragWindowController.m
+++ /dev/null
@@ -1,111 +0,0 @@
-//
-// PSMTabDragWindowController.m
-// PSMTabBarControl
-//
-// Created by Kent Sutherland on 6/18/07.
-// Copyright 2007 Kent Sutherland. All rights reserved.
-//
-
-#import "PSMTabDragWindowController.h"
-#import "PSMTabDragWindow.h"
-#import "PSMTabDragView.h"
-
-@implementation PSMTabDragWindowController
-
-- (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask tearOffStyle:(PSMTabBarTearOffStyle)tearOffStyle {
- PSMTabDragWindow *window = [PSMTabDragWindow dragWindowWithImage:image styleMask:styleMask];
- if((self = [super initWithWindow:window])) {
- _view = [[window dragView] retain];
- _tearOffStyle = tearOffStyle;
-
- if(tearOffStyle == PSMTabBarTearOffMiniwindow) {
- [window setBackgroundColor:[NSColor clearColor]];
- [window setHasShadow:YES];
- }
-
- [window setAlphaValue:kPSMTabDragWindowAlpha];
- }
- return self;
-}
-
-- (void)dealloc {
- if(_timer) {
- [_timer invalidate];
- }
-
- if(_animation) {
- [_animation release];
- }
-
- [_view release];
- [super dealloc];
-}
-
-- (NSImage *)image {
- return [_view image];
-}
-
-- (NSImage *)alternateImage {
- return [_view alternateImage];
-}
-
-- (void)setAlternateImage:(NSImage *)image {
- [_view setAlternateImage:image];
-}
-
-- (BOOL)isAnimating {
- return _animation != nil;
-}
-
-- (void)switchImages {
- if(_tearOffStyle != PSMTabBarTearOffMiniwindow || ![_view alternateImage]) {
- return;
- }
-
- CGFloat progress = 0;
- _showingAlternate = !_showingAlternate;
-
- if(_animation) {
- //An animation already exists, get the current progress
- progress = 1.0f - [_animation currentProgress];
- [_animation stopAnimation];
- [_animation release];
- }
-
- //begin animating
- _animation = [[NSAnimation alloc] initWithDuration:0.25 animationCurve:NSAnimationEaseInOut];
- [_animation setAnimationBlockingMode:NSAnimationNonblocking];
- [_animation setCurrentProgress:progress];
- [_animation startAnimation];
-
- _originalWindowFrame = [[self window] frame];
-
- if(_timer) {
- [_timer invalidate];
- }
- _timer = [NSTimer scheduledTimerWithTimeInterval:1.0f / 30.0f target:self selector:@selector(animateTimer:) userInfo:nil repeats:YES];
-}
-
-- (void)animateTimer:(NSTimer *)timer {
- NSRect frame = _originalWindowFrame;
- NSImage *currentImage = _showingAlternate ?[_view alternateImage] :[_view image];
- NSSize size = [currentImage size];
- NSPoint mousePoint = [NSEvent mouseLocation];
- CGFloat animationValue = [_animation currentValue];
-
- frame.size.width = _originalWindowFrame.size.width + (size.width - _originalWindowFrame.size.width) * animationValue;
- frame.size.height = _originalWindowFrame.size.height + (size.height - _originalWindowFrame.size.height) * animationValue;
- frame.origin.x = mousePoint.x - (frame.size.width / 2);
- frame.origin.y = mousePoint.y - (frame.size.height / 2);
-
- [_view setFadeValue:_showingAlternate ? 1.0f - animationValue : animationValue];
- [[self window] setFrame:frame display:YES];
-
- if(![_animation isAnimating]) {
- [_animation release], _animation = nil;
- [timer invalidate];
- _timer = nil;
- }
-}
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMTabStyle.h b/frontends/cocoa/PSMTabBarControl/PSMTabStyle.h
deleted file mode 100644
index ca3717435..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMTabStyle.h
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// PSMTabStyle.h
-// PSMTabBarControl
-//
-// Created by John Pannell on 2/17/06.
-// Copyright 2006 Positive Spin Media. All rights reserved.
-//
-
-/*
- Protocol to be observed by all style delegate objects. These objects handle the drawing responsibilities for PSMTabBarCell; once the control has been assigned a style, the background and cells draw consistent with that style. Design pattern and implementation by David Smith, Seth Willits, and Chris Forsythe, all touch up and errors by John P. :-)
- */
-
-#import "PSMTabBarCell.h"
-#import "PSMTabBarControl.h"
-
-@protocol PSMTabStyle <NSObject>
-
-// identity
-- (NSString *)name;
-
-// control specific parameters
-- (CGFloat)leftMarginForTabBarControl;
-- (CGFloat)rightMarginForTabBarControl;
-- (CGFloat)topMarginForTabBarControl;
-- (void)setOrientation:(PSMTabBarOrientation)value;
-
-// add tab button
-- (NSImage *)addTabButtonImage;
-- (NSImage *)addTabButtonPressedImage;
-- (NSImage *)addTabButtonRolloverImage;
-
-// cell specific parameters
-- (NSRect)dragRectForTabCell:(PSMTabBarCell *)cell orientation:(PSMTabBarOrientation)orientation;
-- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)cellFrame;
-- (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell;
-- (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell;
-- (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell;
-- (CGFloat)minimumWidthOfTabCell:(PSMTabBarCell *)cell;
-- (CGFloat)desiredWidthOfTabCell:(PSMTabBarCell *)cell;
-- (CGFloat)tabCellHeight;
-
-// cell values
-- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell;
-- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell;
-
-// drawing
-- (void)drawTabCell:(PSMTabBarCell *)cell;
-- (void)drawBackgroundInRect:(NSRect)rect;
-- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect;
-
-@end
-
-@interface PSMTabBarControl (StyleAccessors)
-
-- (NSMutableArray *)cells;
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.h b/frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.h
deleted file mode 100644
index 20202536a..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.h
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// PSMUnifiedTabStyle.h
-// --------------------
-//
-// Created by Keith Blount on 30/04/2006.
-// Copyright 2006 __MyCompanyName__. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "PSMTabStyle.h"
-
-@interface PSMUnifiedTabStyle : NSObject <PSMTabStyle> {
- NSImage *unifiedCloseButton;
- NSImage *unifiedCloseButtonDown;
- NSImage *unifiedCloseButtonOver;
- NSImage *unifiedCloseDirtyButton;
- NSImage *unifiedCloseDirtyButtonDown;
- NSImage *unifiedCloseDirtyButtonOver;
- NSImage *_addTabButtonImage;
- NSImage *_addTabButtonPressedImage;
- NSImage *_addTabButtonRolloverImage;
-
- NSDictionary *_objectCountStringAttributes;
-
- CGFloat leftMargin;
- PSMTabBarControl *tabBar;
-}
-- (void)setLeftMarginForTabBarControl:(CGFloat)margin;
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.m b/frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.m
deleted file mode 100644
index 77be601be..000000000
--- a/frontends/cocoa/PSMTabBarControl/PSMUnifiedTabStyle.m
+++ /dev/null
@@ -1,573 +0,0 @@
-//
-// PSMUnifiedTabStyle.m
-// --------------------
-//
-// Created by Keith Blount on 30/04/2006.
-// Copyright 2006 __MyCompanyName__. All rights reserved.
-//
-
-#import "PSMUnifiedTabStyle.h"
-#import "PSMTabBarCell.h"
-#import "PSMTabBarControl.h"
-#import "NSBezierPath_AMShading.h"
-
-#define kPSMUnifiedObjectCounterRadius 7.0
-#define kPSMUnifiedCounterMinWidth 20
-
-@interface PSMUnifiedTabStyle (Private)
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView;
-@end
-
-@implementation PSMUnifiedTabStyle
-
-- (NSString *)name {
- return @"Unified";
-}
-
-#pragma mark -
-#pragma mark Creation/Destruction
-
-- (id) init {
- if((self = [super init])) {
- unifiedCloseButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front"]];
- unifiedCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]];
- unifiedCloseButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Rollover"]];
-
- unifiedCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]];
- unifiedCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]];
- unifiedCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Rollover"]];
-
- _addTabButtonImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNew"]];
- _addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNewPressed"]];
- _addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNewRollover"]];
-
- _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
- [[NSColor whiteColor] colorWithAlphaComponent:0.85], NSForegroundColorAttributeName,
- nil, nil];
-
- leftMargin = 5.0;
- }
- return self;
-}
-
-- (void)dealloc {
- [unifiedCloseButton release];
- [unifiedCloseButtonDown release];
- [unifiedCloseButtonOver release];
- [unifiedCloseDirtyButton release];
- [unifiedCloseDirtyButtonDown release];
- [unifiedCloseDirtyButtonOver release];
- [_addTabButtonImage release];
- [_addTabButtonPressedImage release];
- [_addTabButtonRolloverImage release];
-
- [_objectCountStringAttributes release];
-
- [super dealloc];
-}
-
-#pragma mark -
-#pragma mark Control Specific
-
-- (void)setLeftMarginForTabBarControl:(CGFloat)margin {
- leftMargin = margin;
-}
-
-- (CGFloat)leftMarginForTabBarControl {
- return leftMargin;
-}
-
-- (CGFloat)rightMarginForTabBarControl {
- return 24.0f;
-}
-
-- (CGFloat)topMarginForTabBarControl {
- return 10.0f;
-}
-
-- (void)setOrientation:(PSMTabBarOrientation)value {
-}
-
-#pragma mark -
-#pragma mark Add Tab Button
-
-- (NSImage *)addTabButtonImage {
- return _addTabButtonImage;
-}
-
-- (NSImage *)addTabButtonPressedImage {
- return _addTabButtonPressedImage;
-}
-
-- (NSImage *)addTabButtonRolloverImage {
- return _addTabButtonRolloverImage;
-}
-
-#pragma mark -
-#pragma mark Cell Specific
-
-- (NSRect)dragRectForTabCell:(PSMTabBarCell *)cell orientation:(PSMTabBarOrientation)orientation {
- NSRect dragRect = [cell frame];
- dragRect.size.width++;
- return dragRect;
-}
-
-- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)cellFrame {
- if([cell hasCloseButton] == NO) {
- return NSZeroRect;
- }
-
- NSRect result;
- result.size = [unifiedCloseButton size];
- result.origin.x = cellFrame.origin.x + MARGIN_X;
- result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0;
-
- return result;
-}
-
-- (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell {
- NSRect cellFrame = [cell frame];
-
- if([cell hasIcon] == NO) {
- return NSZeroRect;
- }
-
- NSRect result;
- result.size = NSMakeSize(kPSMTabBarIconWidth, kPSMTabBarIconWidth);
- result.origin.x = cellFrame.origin.x + MARGIN_X;
- result.origin.y = cellFrame.origin.y + MARGIN_Y - 1.0;
-
- if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
- result.origin.x += [unifiedCloseButton size].width + kPSMTabBarCellPadding;
- }
-
- return result;
-}
-
-- (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell {
- NSRect cellFrame = [cell frame];
-
- if([[cell indicator] isHidden]) {
- return NSZeroRect;
- }
-
- NSRect result;
- result.size = NSMakeSize(kPSMTabBarIndicatorWidth, kPSMTabBarIndicatorWidth);
- result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - kPSMTabBarIndicatorWidth;
- result.origin.y = cellFrame.origin.y + MARGIN_Y - 1.0;
-
- return result;
-}
-
-- (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell {
- NSRect cellFrame = [cell frame];
-
- if([cell count] == 0) {
- return NSZeroRect;
- }
-
- CGFloat countWidth = [[self attributedObjectCountValueForTabCell:cell] size].width;
- countWidth += (2 * kPSMUnifiedObjectCounterRadius - 6.0);
- if(countWidth < kPSMUnifiedCounterMinWidth) {
- countWidth = kPSMUnifiedCounterMinWidth;
- }
-
- NSRect result;
- result.size = NSMakeSize(countWidth, 2 * kPSMUnifiedObjectCounterRadius); // temp
- result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - result.size.width;
- result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0;
-
- if(![[cell indicator] isHidden]) {
- result.origin.x -= kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding;
- }
-
- return result;
-}
-
-
-- (CGFloat)minimumWidthOfTabCell:(PSMTabBarCell *)cell {
- CGFloat resultWidth = 0.0;
-
- // left margin
- resultWidth = MARGIN_X;
-
- // close button?
- if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
- resultWidth += [unifiedCloseButton size].width + kPSMTabBarCellPadding;
- }
-
- // icon?
- if([cell hasIcon]) {
- resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding;
- }
-
- // the label
- resultWidth += kPSMMinimumTitleWidth;
-
- // object counter?
- if([cell count] > 0) {
- resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding;
- }
-
- // indicator?
- if([[cell indicator] isHidden] == NO) {
- resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth;
- }
-
- // right margin
- resultWidth += MARGIN_X;
-
- return ceil(resultWidth);
-}
-
-- (CGFloat)desiredWidthOfTabCell:(PSMTabBarCell *)cell {
- CGFloat resultWidth = 0.0;
-
- // left margin
- resultWidth = MARGIN_X;
-
- // close button?
- if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
- resultWidth += [unifiedCloseButton size].width + kPSMTabBarCellPadding;
- }
-
- // icon?
- if([cell hasIcon]) {
- resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding;
- }
-
- // the label
- resultWidth += [[cell attributedStringValue] size].width;
-
- // object counter?
- if([cell count] > 0) {
- resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding;
- }
-
- // indicator?
- if([[cell indicator] isHidden] == NO) {
- resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth;
- }
-
- // right margin
- resultWidth += MARGIN_X;
-
- return ceil(resultWidth);
-}
-
-- (CGFloat)tabCellHeight {
- return kPSMTabBarControlHeight;
-}
-
-#pragma mark -
-#pragma mark Cell Values
-
-- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell {
- NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[cell count]];
- return [[[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] autorelease];
-}
-
-- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell {
- NSMutableAttributedString *attrStr;
- NSString * contents = [cell stringValue];
- attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease];
- NSRange range = NSMakeRange(0, [contents length]);
-
- [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range];
-
- // Paragraph Style for Truncating Long Text
- static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil;
- if(!TruncatingTailParagraphStyle) {
- TruncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
- [TruncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
- }
- [attrStr addAttribute:NSParagraphStyleAttributeName value:TruncatingTailParagraphStyle range:range];
-
- return attrStr;
-}
-
-#pragma mark -
-#pragma mark ---- drawing ----
-
-- (void)drawTabCell:(PSMTabBarCell *)cell {
- NSRect cellFrame = [cell frame];
-
- NSToolbar *toolbar = [[[cell controlView] window] toolbar];
- BOOL showsBaselineSeparator = (toolbar && [toolbar respondsToSelector:@selector(showsBaselineSeparator)] && [toolbar showsBaselineSeparator]);
- if(!showsBaselineSeparator) {
- cellFrame.origin.y += 1.0;
- cellFrame.size.height -= 1.0;
- }
-
- NSColor * lineColor = nil;
- NSBezierPath* bezier = [NSBezierPath bezierPath];
- lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0];
-
- if(!showsBaselineSeparator || [cell state] == NSOnState) {
- // selected tab
- NSRect aRect = NSMakeRect(cellFrame.origin.x + 0.5, cellFrame.origin.y - 0.5, cellFrame.size.width, cellFrame.size.height);
-
- // frame
- CGFloat radius = MIN(6.0, 0.5f * MIN(NSWidth(aRect), NSHeight(aRect)));
- NSRect rect = NSInsetRect(aRect, radius, radius);
-
- [bezier appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(rect), NSMinY(rect)) radius:radius startAngle:180.0 endAngle:270.0];
-
- [bezier appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(rect), NSMinY(rect)) radius:radius startAngle:270.0 endAngle:360.0];
-
- NSPoint cornerPoint = NSMakePoint(NSMaxX(aRect), NSMaxY(aRect));
- [bezier appendBezierPathWithPoints:&cornerPoint count:1];
-
- cornerPoint = NSMakePoint(NSMinX(aRect), NSMaxY(aRect));
- [bezier appendBezierPathWithPoints:&cornerPoint count:1];
-
- [bezier closePath];
-
- //[[NSColor windowBackgroundColor] set];
- //[bezier fill];
- if([NSApp isActive]) {
- if([cell state] == NSOnState) {
- [bezier linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.99 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.941 alpha:1.0]];
- } else if([cell isHighlighted]) {
- [bezier linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.80 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.80 alpha:1.0]];
- } else {
- [bezier linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]];
- }
- }
-
- [lineColor set];
- [bezier stroke];
- } else{
- // unselected tab
- NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height);
- aRect.origin.y += 0.5;
- aRect.origin.x += 1.5;
- aRect.size.width -= 1;
-
- aRect.origin.x -= 1;
- aRect.size.width += 1;
-
- // rollover
- if([cell isHighlighted]) {
- [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set];
- NSRectFillUsingOperation(aRect, NSCompositeSourceAtop);
- }
-
- // frame
-
- [lineColor set];
- [bezier moveToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y - 0.5)];
- if(!([cell tabState] & PSMTab_RightIsSelectedMask)) {
- [bezier lineToPoint:NSMakePoint(NSMaxX(aRect), NSMaxY(aRect))];
- }
-
- [bezier stroke];
-
- // Create a thin lighter line next to the dividing line for a bezel effect
- if(!([cell tabState] & PSMTab_RightIsSelectedMask)) {
- [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect) + 1.0, aRect.origin.y - 0.5)
- toPoint:NSMakePoint(NSMaxX(aRect) + 1.0, NSMaxY(aRect) - 2.5)];
- }
-
- // If this is the leftmost tab, we want to draw a line on the left, too
- if([cell tabState] & PSMTab_PositionLeftMask) {
- [lineColor set];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(aRect.origin.x, aRect.origin.y - 0.5)
- toPoint:NSMakePoint(aRect.origin.x, NSMaxY(aRect) - 2.5)];
- [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(aRect.origin.x + 1.0, aRect.origin.y - 0.5)
- toPoint:NSMakePoint(aRect.origin.x + 1.0, NSMaxY(aRect) - 2.5)];
- }
- }
-
- [self drawInteriorWithTabCell:cell inView:[cell controlView]];
-}
-
-
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView {
- NSRect cellFrame = [cell frame];
- CGFloat labelPosition = cellFrame.origin.x + MARGIN_X;
-
- // close button
- if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
- NSSize closeButtonSize = NSZeroSize;
- NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame];
- NSImage * closeButton = nil;
-
- closeButton = [cell isEdited] ? unifiedCloseDirtyButton : unifiedCloseButton;
-
- if([cell closeButtonOver]) {
- closeButton = [cell isEdited] ? unifiedCloseDirtyButtonOver : unifiedCloseButtonOver;
- }
- if([cell closeButtonPressed]) {
- closeButton = [cell isEdited] ? unifiedCloseDirtyButtonDown : unifiedCloseButtonDown;
- }
-
- closeButtonSize = [closeButton size];
- if([controlView isFlipped]) {
- closeButtonRect.origin.y += closeButtonRect.size.height;
- }
-
- [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0];
-
- // scoot label over
- labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
- }
-
- // icon
- if([cell hasIcon]) {
- NSRect iconRect = [self iconRectForTabCell:cell];
- NSImage *icon = [[[cell representedObject] identifier] icon];
- if([controlView isFlipped]) {
- iconRect.origin.y += iconRect.size.height;
- }
-
- // center in available space (in case icon image is smaller than kPSMTabBarIconWidth)
- if([icon size].width < kPSMTabBarIconWidth) {
- iconRect.origin.x += (kPSMTabBarIconWidth - [icon size].width) / 2.0;
- }
- if([icon size].height < kPSMTabBarIconWidth) {
- iconRect.origin.y -= (kPSMTabBarIconWidth - [icon size].height) / 2.0;
- }
-
- [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0];
-
- // scoot label over
- labelPosition += iconRect.size.width + kPSMTabBarCellPadding;
- }
-
- // label rect
- NSRect labelRect;
- labelRect.origin.x = labelPosition;
- labelRect.size.width = cellFrame.size.width - (labelRect.origin.x - cellFrame.origin.x) - kPSMTabBarCellPadding;
- NSSize s = [[cell attributedStringValue] size];
- labelRect.origin.y = cellFrame.origin.y + (cellFrame.size.height - s.height) / 2.0 - 1.0;
- labelRect.size.height = s.height;
-
- if(![[cell indicator] isHidden]) {
- labelRect.size.width -= (kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding);
- }
-
- // object counter
- if([cell count] > 0) {
- [[cell countColor] ?: [NSColor colorWithCalibratedWhite:0.3 alpha:0.6] set];
- NSBezierPath *path = [NSBezierPath bezierPath];
- NSRect myRect = [self objectCounterRectForTabCell:cell];
- myRect.origin.y -= 1.0;
- [path moveToPoint:NSMakePoint(myRect.origin.x + kPSMUnifiedObjectCounterRadius, myRect.origin.y)];
- [path lineToPoint:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMUnifiedObjectCounterRadius, myRect.origin.y)];
- [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMUnifiedObjectCounterRadius, myRect.origin.y + kPSMUnifiedObjectCounterRadius) radius:kPSMUnifiedObjectCounterRadius startAngle:270.0 endAngle:90.0];
- [path lineToPoint:NSMakePoint(myRect.origin.x + kPSMUnifiedObjectCounterRadius, myRect.origin.y + myRect.size.height)];
- [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + kPSMUnifiedObjectCounterRadius, myRect.origin.y + kPSMUnifiedObjectCounterRadius) radius:kPSMUnifiedObjectCounterRadius startAngle:90.0 endAngle:270.0];
- [path fill];
-
- // draw attributed string centered in area
- NSRect counterStringRect;
- NSAttributedString *counterString = [self attributedObjectCountValueForTabCell:cell];
- counterStringRect.size = [counterString size];
- counterStringRect.origin.x = myRect.origin.x + ((myRect.size.width - counterStringRect.size.width) / 2.0) + 0.25;
- counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0) + 0.5;
- [counterString drawInRect:counterStringRect];
-
- labelRect.size.width -= myRect.size.width + kPSMTabBarCellPadding;
- }
-
- // label
- [[cell attributedStringValue] drawInRect:labelRect];
-}
-
-- (void)drawBackgroundInRect:(NSRect)rect {
- //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area
- rect = [tabBar bounds];
-
- NSRect gradientRect = rect;
- gradientRect.size.height -= 1.0;
-
- NSBezierPath *path = [NSBezierPath bezierPathWithRect:gradientRect];
- [path linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]];
- [[NSColor colorWithCalibratedWhite:0.576 alpha:1.0] set];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, NSMaxY(rect) - 0.5)
- toPoint:NSMakePoint(NSMaxX(rect), NSMaxY(rect) - 0.5)];
-
- if(![[[tabBar tabView] window] isKeyWindow]) {
- [[NSColor windowBackgroundColor] set];
- NSRectFill(gradientRect);
- }
-}
-
-- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect {
- tabBar = bar;
- [self drawBackgroundInRect:rect];
-
- // no tab view == not connected
- if(![bar tabView]) {
- NSRect labelRect = rect;
- labelRect.size.height -= 4.0;
- labelRect.origin.y += 4.0;
- NSMutableAttributedString *attrStr;
- NSString *contents = @"PSMTabBarControl";
- attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease];
- NSRange range = NSMakeRange(0, [contents length]);
- [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range];
- NSMutableParagraphStyle *centeredParagraphStyle = nil;
- if(!centeredParagraphStyle) {
- centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
- [centeredParagraphStyle setAlignment:NSCenterTextAlignment];
- }
- [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range];
- [attrStr drawInRect:labelRect];
- return;
- }
-
- // draw cells
- NSEnumerator *e = [[bar cells] objectEnumerator];
- PSMTabBarCell *cell;
- while((cell = [e nextObject])) {
- if([bar isAnimating] || (![cell isInOverflowMenu] && NSIntersectsRect([cell frame], rect))) {
- [cell drawWithFrame:[cell frame] inView:bar];
- }
- }
-}
-
-#pragma mark -
-#pragma mark Archiving
-
-- (void)encodeWithCoder:(NSCoder *)aCoder {
- //[super encodeWithCoder:aCoder];
- if([aCoder allowsKeyedCoding]) {
- [aCoder encodeObject:unifiedCloseButton forKey:@"unifiedCloseButton"];
- [aCoder encodeObject:unifiedCloseButtonDown forKey:@"unifiedCloseButtonDown"];
- [aCoder encodeObject:unifiedCloseButtonOver forKey:@"unifiedCloseButtonOver"];
- [aCoder encodeObject:unifiedCloseDirtyButton forKey:@"unifiedCloseDirtyButton"];
- [aCoder encodeObject:unifiedCloseDirtyButtonDown forKey:@"unifiedCloseDirtyButtonDown"];
- [aCoder encodeObject:unifiedCloseDirtyButtonOver forKey:@"unifiedCloseDirtyButtonOver"];
- [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"];
- [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"];
- [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"];
- }
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder {
- // self = [super initWithCoder:aDecoder];
- //if (self) {
- if([aDecoder allowsKeyedCoding]) {
- unifiedCloseButton = [[aDecoder decodeObjectForKey:@"unifiedCloseButton"] retain];
- unifiedCloseButtonDown = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonDown"] retain];
- unifiedCloseButtonOver = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonOver"] retain];
- unifiedCloseDirtyButton = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButton"] retain];
- unifiedCloseDirtyButtonDown = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButtonDown"] retain];
- unifiedCloseDirtyButtonOver = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButtonOver"] retain];
- _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain];
- _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain];
- _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain];
- }
- //}
- return self;
-}
-
-@end
diff --git a/frontends/cocoa/PSMTabBarControl/ReadMe.rtfd/TXT.rtf b/frontends/cocoa/PSMTabBarControl/ReadMe.rtfd/TXT.rtf
deleted file mode 100644
index acd9372a2..000000000
--- a/frontends/cocoa/PSMTabBarControl/ReadMe.rtfd/TXT.rtf
+++ /dev/null
@@ -1,186 +0,0 @@
-{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf380
-{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;\f2\fswiss\fcharset77 Helvetica-Oblique;
-\f3\fnil\fcharset77 Monaco;}
-{\colortbl;\red255\green255\blue255;\red118\green15\blue80;\red0\green0\blue255;\red35\green110\blue37;
-}
-{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1}}
-{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\qc\pardirnatural
-
-\f0\b\fs24 \cf0 \
-PSMTabBarControl (and related classes)\
-
-\f1\b0 developed by John Pannell, Positive Spin Media\
-\
-as seen in the super-cool app...\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\qc\pardirnatural
-\cf0 {{\NeXTGraphic startpage.gif \width7200 \height2820
-}¬}\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\qc\pardirnatural
-\cf0 \
-\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-\cf0 This source code and all related materials are released under the BSD license, which is explained at the end of this document, along with some other legalese. I've made my best effort to make everything bug free, but please let me know of any bugs found or suggestions you have: johnp@positivespinmedia.com.\
-\
-
-\f0\b Purpose
-\f1\b0 \
-\
-PSMTabBarControl seeks to provide developers with a high-quality, easy to use GUI to manage an NSTabView (or subclasses) in a manner similar to Safari's tabbed browsing implementation. It attempts to add a few features as well. Here's what you get:\
-\
-
-\f0\b The look:
-\f1\b0 a control/cell architecture that draws the expected tab appearance below a toolbar or similar view. Included styles work consistently in Aqua, Metal, or customized metal variations by basing fills on the window's background color. Includes drawing of a close button, and rollover states for the close button and tab cell. Also provides pop-up button and menu when tabs overflow available space, and support for individual tab progress indicators, icons, and object counters. Tabs can be drawn sized to fit the string content of the label, or uniformly sized.\
-\
-
-\f0\b The functionality:
-\f1\b0 Close button removes tabs, click on a tab cell selects. Indicators start, stop, and hide if things are hooked up correctly.\
-\
-
-\f0\b Extras:
-\f1\b0 Supports multi-window drag-and-drop reordering of the tabs with aqua-licious animation.\
-\
-
-\f0\b Files
-\f1\b0 \
-\
-Your project will need the files in the "Framework" folder of the project. The actual framework packages these (and some images) up nicely for you, if desired. Please look over the "TabBarControlDemo" target of the source code project to see exactly what is needed to get everything to build. Building and playing with the demo is also a good way to get a feel for the features provided by these classes.\
-\
-
-\f0\b Usage
-\f1\b0 \
-\
-Simply drag a custom view object from the views palette in IB, read the PSMTabBarControl class into IB, and set the view's custom class to PSMTabBarControl. Then connect the control's tabview outlet to the tab view being controlled, and make the control the delegate of the tab view. You can also connect the control's "partner view" outlet to another view that will resize in response to the hide/show behavior of the control.\
-\
-Alternately, you can build the Palette subproject and add the built IB palette to Interface Builder. In this case, creating and configuring an instance is as easy and drag, drop, and a few clicks. A demo movie and the built palette are available in a separate download from my website: http://www.positivespinmedia.com/dev/PSMTabBarControl.html\
-\
-
-\f2\i Please read the PSMTabBarControlDoc.html file in the documentation folder of this project. It provides an Apple-ish page describing the interface and usage of this object.
-\f1\i0 \
-\
-
-\f0\b Patterns of Use
-\f1\b0 \
-\
-There are a few random notes I can think of for usage guidelines...\
-\
-- You may see a line between the toolbar and the control in your app; it is part of the toolbar. In Tiger, you can eliminate the appearance of this line:\
-\
-\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural
-
-\f3\fs20 \cf0 \CocoaLigature0 SInt32 MacVersion;\
-\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural
-\cf2 if\cf0 (Gestalt(gestaltSystemVersion, &MacVersion) == noErr)\{\
- \cf2 if\cf0 (MacVersion >= \cf3 0x1040\cf0 )\{\
- \cf4 // this call is Tiger only\cf0 \
- [toolbar setShowsBaselineSeparator:\cf2 NO\cf0 ];\
- \}\
-\}\
-\
-\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural
-
-\f1\fs24 \cf0 - In general, there is no reason for your app objects to communicate (outside of configuration) with the PSMTabBarControl at all. Changes made to the NSTabView instance programmatically should be directed at the NSTabView instance itself, and the control will update to reflect the changes made.\
-\
-- Your app might want to receive tab view delegate notifications in order to perform some actions. No problem, simply make the desired object the delegate of the PSMTabBarControl instance... it passes along all tab view notifications. Note that it uses these notifications to make changes itself - read the source code to make sure you aren't tripping over something.\
-\
-- The control creates bindings between each cell's progress indicator and the represented NSTabViewItem's identifier object, if it can. In my app design, I set an instance of NSObjectController as the NSTabViewItem's identifier, and then bind to the "isProcessing" key of the controller's content object. All of this can be seen in the source of the demo app...\
-\
-- The control can be set to hide itself when there is only a single tab, and can also be told to hide/show on demand. It can animate to appear and disappear, and will resize something to compensate for the missing window real estate. By default, it will resize the window, but you can also connect the "partnerView" outlet in IB to specify another view to resize to take up the missing space. Note that this takes some attention to sizing springs and wires to get right, and complex views may need a container view to achieve the desired effect.\
-\
-- The control can be configured to draw an attractive "Add Tab" button at the end of the tab cells. Unfortunately, the button is all looks and no brains - it has no idea what your app wants to do when adding a tab. If you configure your app to show the add tab button, you need to hook up the add tab button to the proper target with the proper selector. Something like this will do nicely in your app controller's awakeFromNib:\
-\
-\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural
-
-\f3\fs20 \cf4 // hook up add tab button\cf0 \
-[[tabBar addTabButton] setTarget:\cf2 self\cf0 ];\
-[[tabBar addTabButton] setAction:\cf2 @selector\cf0 (addNewTab:)];
-\f1\fs24 \
-\
-- The tabs have some sizing options: You can specify the minimum width, maximum width, and optimum width, as well as spcifying if the tabs should size to fit their label or not. The sizing bahavior of the tabs is as follows: If "size to fit" is specified, then tabs will be generated to fit the label, but will never exceed the specified max or min widths. Once the end of the control is reached, the overflow menu will appear as tabs are added; the last tab will squeeze in if it can, or the remaining tabs will stretch to occupy the full control. If "size to fit" is not specified, then all successive tabs will appear at the optimum width. Once the end of the control is reached, adding new tabs will cause all tabs to shrink to accomodate, until the minumum width is reached, and then the overflow menu will be used; max width is ignored in this case. Hopefully that all makes sense :-)\
-\
-- PSMTabBarControl will load the existing tabs from the tabView outlet at startup. However, many of the advanced features (icon display, progress indicator, object count) rely on binding to a controller that is likely not set up in IB. Solution? Nuke the existing tabs in the NSTabView and add new ones, configured the way you like. The demo app does this in the awakeFromNib: method of the app controller.\
-\
-- As a design choice, I elected to keep a cell object around until its tab was closed, instead of "churning" cell objects in each update cycle. Each cell keeps its NSTabViewItem as its representedObject and maintains reference that way, rather than by any index. As a result of this, drag-and-drop reordering of tabs does not change the underlying NSTabView instance at all. All that to say: don't rely on numerical indices if communicating with both the control and the tab view - the indices may not correlate if the user moved some tabs around (and remember - you shouldn't need to communicate with the control anyway :-). The Shiira Project, from which I gained much insight and inspiration from for this UI element, elected to scrap and rebuild the array of cells each time through the update cycle, and rely on indices to correlate between cells and NSTabViewItems. I felt the representedObject route was cleaner, and preferred not to churn objects.\
-\
-\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural
-
-\f0\b \cf0 Improvements?
-\f1\b0 \
-\
-Pipe up if you think of something you'd like to see; here's my current list:\
-\
-- "Pop-up" tabs - like pop-up folders in the finder, in case you want to drag to a destination in another tab.\
-- Support for the
-\f3\fs22 \CocoaLigature1 NSUnifiedTitleAndToolbarWindowMask
-\f1\fs24 \CocoaLigature0 "unified" window appearance. (Help! I really searched around to try to make this work... the color pattern of the title and toolbar seem to be top secret! The new "unified" style is an excellent replication of a unified look, but isn't "built from" the unified appearance like the metal is.)\
-- During multi-window drag, having a "drag window/image" that shows the represented view getting moved to the other window.\
-- During multi-window drag, support for dragging out solo tabs to consolidate in another window, removing the source window in the process.\
-- Support vertical as well as horizontal alignment.\
-\
-
-\f0\b Version History
-\f1\b0 \
-\
-Version 1.3 (May 29, 2006)\
-- new feature: Unified tab style, compliments of Keith Blount\
-- new feature: allow multi-window drag config option (again from Keith).\
-- fixed bug: Palette installation/usage instructions were wrong.\
-- enhancement: exposed the
-\f3\fs20 representedTabViewItems
-\f1\fs24 method, which can be used to retrieve the order of the tabs as displayed in the control, since the underlying NSTabView does not get reordered during drag and drop rearrangement.\
-\
-Version 1.2 (April 20, 2006)\
-- new feature: multi-window drag and drop support.\
-- bug fixed: zombie issue with tabView:didCloseTabViewItem\
-- bugs fixed: some drawing issues around the progress indicators in tabs, and the add tab button.\
-- enhancement: the hide/show animation has been improved with less "flickering" of progress indicators during the hide and show.\
-\
-Version 1.1.2 (April 5, 2006)\
-- fixed bug: tabs of non-integer width resulted in occasional anti-aliased drawing issues of dividers between tabs in the Metal style (Thanks, Kent).\
-- added feature: delegate can now respond to -tabView:shouldCloseTabViewItem: and -tabView:willCloseTabViewItem:, and -tabView:didCloseTabViewItem: messages, so your app can take care of any needed setup/cleanup for these actions.\
-- fixed bug: tab close buttons now show down state when pressed down.\
-\
-Version 1.1.1 (March 16, 2006)\
-- fixed bug: Palette inspector would not reflect state of previously instantiated control. This has been fixed (Thanks, Guillaume).\
-- enhancement: Overflow button now highlights when mouse down (Thanks, Kent).\
-- fixed bug: when set to not close a solo tab, the close button would be hidden for the tab, but could still be closed if you clicked the tab in the right location. This has been fixed (Thanks, malcom).\
-\
-Version 1.1 (March 10, 2006)\
-- Bound the "title" of the cell to the "label" of the source tabview item. Just in case you wanted to change the label on the tab during the running of your application.\
-- PSMTabBarCell factored to support new tab "styles", or appearances in drawing. Now supported are the existing "Metal" style and a new "Aqua" style. Many thanks to David Smith, Seth Willits, and Chris Forsythe for their contributions!\
-- Control can be configured to "Hide for single tab", so it doesn't appear unless there are more than a single tab view present. Features animated show/hide behavior (that can be called anytime, and is called automatically in the case that a single tab exists). The show/hide behavior can also be set up to resize either the window (default) or a selected "partner view" to compensate for the lost height of the tab bar.\
-- Control can be configured for "Can close only tab" behavior. If set to NO, no close button will appear on a lone tab.\
-- Cells can be set to "size to fit", or given uniform min/max/optimum sizes.\
-- Added support for display of an icon and an object count, if the proper app design pattern is followed.\
-- Sweet animated drag-and-drop drawing!\
-- A few drawing bugs surrounding the progress indicators in cells were squished.\
-- New documentation, in case you found this read me a little pithy.\
-\
-Version 1.0 (December 2005)\
-Initial release of safari-like tab implementation.\
-\
-
-\f0\b The standard disavowal of this beautiful mess
-\f1\b0 \
-\
-I should note that portions of this source code were inspired by the Shiira project's implementation of Safari-style tabs. While I made some different design decisions, the drawing and some other aspects are only slight modifications of their excellent work. As such, I note their copyright under their BSD licence:\
-\
-\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural
-
-\f3\fs20 \cf4 Portions of this software Copyright 2004 The Shiira Project. All rights reserved.\
-\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural
-
-\f1\fs24 \cf0 Check them out at: http://hmdt-web.net/shiira/\
-\
-This source code is provided under BSD license, the conditions of which are listed below. I hope you'll make note somewhere in your about window or ReadMe stating the sweet coding goodness of Positive Spin Media and link to the fascinating and informative website at www.positivespinmedia.com\
-\
-\pard\pardeftab720\sa320\ql\qnatural
-\cf0 \CocoaLigature1 Copyright (c) 2005, Positive Spin Media\uc0\u8232 All rights reserved.\
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\
-\pard\tx220\tx720\pardeftab720\li720\fi-720\ql\qnatural
-\ls1\ilvl0\cf0 {\listtext \'a5 }Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\
-{\listtext \'a5 }Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\
-{\listtext \'a5 }Neither the name of Positive Spin Media nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\
- \
-\pard\pardeftab720\sa320\ql\qnatural
-\cf0 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\CocoaLigature0 \
-} \ No newline at end of file
diff --git a/frontends/cocoa/PSMTabBarControl/ReadMe.rtfd/startpage.gif b/frontends/cocoa/PSMTabBarControl/ReadMe.rtfd/startpage.gif
deleted file mode 100644
index 8707a77ab..000000000
--- a/frontends/cocoa/PSMTabBarControl/ReadMe.rtfd/startpage.gif
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/PreferencesWindowController.h b/frontends/cocoa/PreferencesWindowController.h
deleted file mode 100644
index 8f72907a3..000000000
--- a/frontends/cocoa/PreferencesWindowController.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface PreferencesWindowController : NSWindowController
-
-@property (readwrite, copy, nonatomic) NSString *homepageURL;
-
-- (IBAction) useCurrentPageAsHomepage: (id) sender;
-
-@end
diff --git a/frontends/cocoa/PreferencesWindowController.m b/frontends/cocoa/PreferencesWindowController.m
deleted file mode 100644
index 590a96818..000000000
--- a/frontends/cocoa/PreferencesWindowController.m
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "utils/nsoption.h"
-#import "utils/nsurl.h"
-#import "netsurf/browser_window.h"
-
-#import "cocoa/PreferencesWindowController.h"
-#import "cocoa/NetsurfApp.h"
-#import "cocoa/gui.h"
-#import "cocoa/BrowserViewController.h"
-
-@implementation PreferencesWindowController
-
-- init;
-{
- if ((self = [super initWithWindowNibName: @"PreferencesWindow"]) == nil) return nil;
-
- return self;
-}
-
-- (IBAction) useCurrentPageAsHomepage: (id) sender;
-{
- struct browser_window *bw = [[(NetSurfApp *)NSApp frontTab] browser];
- const char *url = nsurl_access(browser_window_get_url(bw));
- [self setHomepageURL: [NSString stringWithUTF8String: url]];
-}
-
-- (void) setHomepageURL: (NSString *) newUrl;
-{
- nsoption_set_charp(homepage_url, strdup( [newUrl UTF8String] ));
- [[NSUserDefaults standardUserDefaults] setObject: newUrl forKey: kHomepageURLOption];
- [[NSUserDefaults standardUserDefaults] synchronize];
-}
-
-- (NSString *) homepageURL;
-{
- return [NSString stringWithUTF8String: nsoption_charp(homepage_url)];
-}
-
-@end
diff --git a/frontends/cocoa/Prefix.pch b/frontends/cocoa/Prefix.pch
deleted file mode 100644
index 7fa2c0547..000000000
--- a/frontends/cocoa/Prefix.pch
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <Carbon/Carbon.h>
-
-#ifdef __OBJC__
-#import <Cocoa/Cocoa.h>
-#endif
-
-#undef offsetof
-
-#define HISTORY_COLOUR_BACKGROUND 0x000000
-#define HISTORY_COLOUR_FOREGROUND 0xFFFFFF
-#define HISTORY_COLOUR_SELECTED 0xFF6D27 \ No newline at end of file
diff --git a/frontends/cocoa/ScrollableView.h b/frontends/cocoa/ScrollableView.h
deleted file mode 100644
index 071a11825..000000000
--- a/frontends/cocoa/ScrollableView.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface ScrollableView : NSView {
- NSSize minimumSize;
- NSView *observedSuperview;
-}
-
-@property (readwrite, assign, nonatomic) NSSize minimumSize;
-
-- (void) adjustFrame;
-
-@end
diff --git a/frontends/cocoa/ScrollableView.m b/frontends/cocoa/ScrollableView.m
deleted file mode 100644
index 8f27b2b56..000000000
--- a/frontends/cocoa/ScrollableView.m
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "cocoa/ScrollableView.h"
-
-@interface ScrollableView ()
-
-- (void) frameChangeNotification: (NSNotification *) note;
-
-@end
-
-@implementation ScrollableView
-@synthesize minimumSize;
-
-- (void) setMinimumSize: (NSSize)newSize
-{
- minimumSize = newSize;
- [self adjustFrame];
-}
-
-- (void) adjustFrame
-{
- NSSize frameSize = [[self superview] frame].size;
- [self setFrameSize: NSMakeSize( MAX( minimumSize.width, frameSize.width ),
- MAX( minimumSize.height, frameSize.height ) )];
-}
-
-- (void) frameChangeNotification: (NSNotification *) note
-{
- [self adjustFrame];
-}
-
-- (void) viewDidMoveToSuperview
-{
- if (observedSuperview) {
- [[NSNotificationCenter defaultCenter]
- removeObserver: self
- name: NSViewFrameDidChangeNotification
- object: observedSuperview];
- observedSuperview = nil;
- }
-
- NSView *newSuperView = [self superview];
-
- if (nil != newSuperView) {
- observedSuperview = newSuperView;
- [[NSNotificationCenter defaultCenter]
- addObserver: self
- selector: @selector(frameChangeNotification:)
- name: NSViewFrameDidChangeNotification
- object: observedSuperview];
- [observedSuperview setPostsFrameChangedNotifications: YES];
- }
-}
-
-@end
diff --git a/frontends/cocoa/SearchWindowController.h b/frontends/cocoa/SearchWindowController.h
deleted file mode 100644
index 7ce8c00c9..000000000
--- a/frontends/cocoa/SearchWindowController.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#import <Cocoa/Cocoa.h>
-
-@class BrowserViewController;
-
-typedef enum {
- SearchBackward,
- SearchForward
-} SearchDirection;
-
-@interface SearchWindowController : NSWindowController {
- BOOL caseSensitive;
- BOOL selectAll;
- BOOL canGoBack;
- BOOL canGoForward;
- NSString *searchString;
- BrowserViewController *browser;
-}
-
-@property (readwrite, assign, nonatomic) BOOL caseSensitive;
-@property (readwrite, assign, nonatomic) BOOL selectAll;
-@property (readwrite, assign, nonatomic) BOOL canGoBack;
-@property (readwrite, assign, nonatomic) BOOL canGoForward;
-@property (readwrite, copy, nonatomic) NSString *searchString;
-@property (readwrite, assign, nonatomic) BrowserViewController *browser;
-
-- (IBAction) searchNext: (id) sender;
-- (IBAction) searchPrevious: (id) sender;
-
-- (IBAction) searchStringDidChange: (id) sender;
-
-- (void) search: (SearchDirection)direction;
-
-@end
-
-struct gui_search_table *cocoa_search_table;
diff --git a/frontends/cocoa/SearchWindowController.m b/frontends/cocoa/SearchWindowController.m
deleted file mode 100644
index 95372fc19..000000000
--- a/frontends/cocoa/SearchWindowController.m
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#import "cocoa/SearchWindowController.h"
-#import "cocoa/BrowserViewController.h"
-
-#import "netsurf/search.h"
-#import "netsurf/browser_window.h"
-#import "desktop/search.h"
-
-static void cocoa_search_set_back( bool active, void *p );
-static void cocoa_search_set_forward( bool active, void *p );
-
-static struct gui_search_table search_table = {
- .forward_state = cocoa_search_set_forward,
- .back_state = cocoa_search_set_back,
-};
-
-struct gui_search_table *cocoa_search_table = &search_table;
-
-@implementation SearchWindowController
-
-@synthesize caseSensitive;
-@synthesize selectAll;
-@synthesize canGoBack;
-@synthesize canGoForward;
-@synthesize searchString;
-@synthesize browser;
-
-- init;
-{
- if ((self = [super initWithWindowNibName: @"SearchWindow"]) == nil) return nil;
-
- [self bind: @"browser" toObject: NSApp withKeyPath: @"frontTab" options: nil];
- canGoBack = canGoForward = YES;
-
- return self;
-}
-
-- (void) dealloc;
-{
- [self unbind: @"browser"];
- [super dealloc];
-}
-
-- (IBAction) searchNext: (id) sender;
-{
- [self search: SearchForward];
-}
-
-- (IBAction) searchPrevious: (id) sender;
-{
- [self search: SearchBackward];
-}
-
-- (void) search: (SearchDirection)direction;
-{
- search_flags_t flags = (direction == SearchForward) ? SEARCH_FLAG_FORWARDS : 0;
- if (caseSensitive) flags |= SEARCH_FLAG_CASE_SENSITIVE;
- if (selectAll) flags |= SEARCH_FLAG_SHOWALL;
-
- struct browser_window *bw = [browser browser];
- browser_window_search( bw, self, flags, [searchString UTF8String] );
-}
-
-- (IBAction) searchStringDidChange: (id) sender;
-{
- struct browser_window *bw = [browser browser];
- browser_window_search_clear( bw );
-
- [self setCanGoBack: YES];
- [self setCanGoForward: YES];
-}
-
-- (void) setCaseSensitive: (BOOL) newValue;
-{
- if (caseSensitive != newValue) {
- caseSensitive = newValue;
- [self setCanGoBack: YES];
- [self setCanGoForward: YES];
- }
-}
-
-- (void) setSelectAll: (BOOL) newValue;
-{
- if (selectAll != newValue) {
- selectAll = newValue;
- [self setCanGoBack: YES];
- [self setCanGoForward: YES];
- }
-}
-
-static void cocoa_search_set_back( bool active, void *p )
-{
- [(SearchWindowController *)p setCanGoBack: active];
-}
-
-static void cocoa_search_set_forward( bool active, void *p )
-{
- [(SearchWindowController *)p setCanGoForward: active];
-}
-
-@end
diff --git a/frontends/cocoa/Tree.h b/frontends/cocoa/Tree.h
deleted file mode 100644
index 25c93b709..000000000
--- a/frontends/cocoa/Tree.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "cocoa/desktop-tree.h"
-
-@class Tree;
-
-@protocol TreeDelegate
-
-- (void) tree: (Tree *)tree requestedRedrawInRect: (NSRect) rect;
-- (void) tree: (Tree *)tree resized: (NSSize) size;
-- (void) tree: (Tree *)tree scrollPoint: (NSPoint) point;
-- (NSSize) treeWindowSize: (Tree *)tree;
-
-@end
-
-
-@interface Tree : NSObject {
- id <TreeDelegate> delegate;
- struct tree *tree;
-}
-
-@property (readwrite, assign, nonatomic) id <TreeDelegate> delegate;
-
-- (id)initWithFlags: (unsigned int) flags;
-
-- (struct tree *) tree;
-
-@end
-
-
-@interface Tree (ViewInterface)
-
-- (void) drawRect: (NSRect) rect inView: (NSView *) view;
-- (void) mouseAction: (browser_mouse_state)state atPoint: (NSPoint)point;
-- (void) mouseDragEnd: (browser_mouse_state)state fromPoint: (NSPoint)p0 toPoint: (NSPoint) p1;
-- (void) keyPress: (uint32_t) key;
-
-@end
diff --git a/frontends/cocoa/Tree.m b/frontends/cocoa/Tree.m
deleted file mode 100644
index b5d4a3f06..000000000
--- a/frontends/cocoa/Tree.m
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "cocoa/Tree.h"
-#import "cocoa/coordinates.h"
-#import "cocoa/font.h"
-#import "cocoa/plotter.h"
-
-#import "netsurf/plotters.h"
-#import "cocoa/desktop-tree.h"
-
-@implementation Tree
-
-@synthesize delegate;
-
-static void tree_redraw_request( int x, int y, int w, int h, void *data );
-static void tree_resized( struct tree *tree, int w, int h, void *data );
-static void tree_scroll_visible( int y, int height, void *data );
-static void tree_get_window_dimensions( int *width, int *height, void *data );
-
-static const struct treeview_table cocoa_tree_callbacks = {
- .redraw_request = tree_redraw_request,
- .resized = tree_resized,
- .scroll_visible = tree_scroll_visible,
- .get_window_dimensions = tree_get_window_dimensions
-};
-
-- (id)initWithFlags: (unsigned int)flags
-{
- if ((self = [super init]) == nil) return nil;
-
- tree = tree_create( flags, &cocoa_tree_callbacks, self );
- if (tree == NULL) {
- [self release];
- return nil;
- }
-
- return self;
-}
-
-
-- (void) dealloc
-{
- tree_delete( tree );
- [super dealloc];
-}
-
-- (struct tree *) tree
-{
- return tree;
-}
-
-- (void) setRedrawing: (BOOL) newRedrawing
-{
-}
-
-
-+ (void) initialize
-{
-}
-
-//MARK: -
-//MARK: Callbacks
-
-static void tree_redraw_request( int x, int y, int w, int h, void *data )
-{
- id <TreeDelegate> delegate = ((Tree *)data)->delegate;
- [delegate tree: (Tree *)data requestedRedrawInRect: cocoa_rect_wh( x, y, w, h )];
-}
-
-static void tree_resized( struct tree *tree, int w, int h, void *data )
-{
- id <TreeDelegate> delegate = ((Tree *)data)->delegate;
- [delegate tree: (Tree *)data resized: cocoa_size( w, h )];
-}
-
-static void tree_scroll_visible( int y, int height, void *data )
-{
- id <TreeDelegate> delegate = ((Tree *)data)->delegate;
- [delegate tree: (Tree *)data scrollPoint: cocoa_point( 0, y )];
-}
-
-static void tree_get_window_dimensions( int *width, int *height, void *data )
-{
- id <TreeDelegate> delegate = ((Tree *)data)->delegate;
- if (delegate == nil) return;
-
- NSSize size = [delegate treeWindowSize: (Tree *)data];
-
- if (width != NULL) *width = cocoa_pt_to_px( size.width );
- if (height != NULL) *height = cocoa_pt_to_px( size.height );
-}
-
-@end
-
-@implementation Tree (ViewInterface)
-
-- (void) drawRect: (NSRect) rect inView: (NSView *) view
-{
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &cocoa_plotters
- };
-
- tree_draw(tree, 0, 0,
- cocoa_pt_to_px(NSMinX( rect )),
- cocoa_pt_to_px(NSMinY( rect )),
- cocoa_pt_to_px(NSWidth( rect )),
- cocoa_pt_to_px(NSHeight( rect )),
- &ctx );
-}
-
-- (void) mouseAction: (browser_mouse_state)state atPoint: (NSPoint)point
-{
- tree_mouse_action(tree, state,
- cocoa_pt_to_px( point.x ), cocoa_pt_to_px( point.y ));
-}
-
-- (void) mouseDragEnd: (browser_mouse_state)state fromPoint: (NSPoint)p0 toPoint: (NSPoint) p1
-{
- tree_drag_end(tree, state,
- cocoa_pt_to_px( p0.x ), cocoa_pt_to_px( p0.y ),
- cocoa_pt_to_px( p1.x ), cocoa_pt_to_px( p1.y ));
-}
-
-- (void) keyPress: (uint32_t) key;
-{
- tree_keypress( tree, key );
-}
-
-@end
diff --git a/frontends/cocoa/TreeView.h b/frontends/cocoa/TreeView.h
deleted file mode 100644
index 31dedbb0f..000000000
--- a/frontends/cocoa/TreeView.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "cocoa/ScrollableView.h"
-@class Tree;
-
-@interface TreeView : ScrollableView {
- Tree *tree;
-
- BOOL isDragging;
- NSPoint dragStart;
-
-}
-
-@property (readwrite, retain, nonatomic) Tree *tree;
-
-@end
diff --git a/frontends/cocoa/TreeView.m b/frontends/cocoa/TreeView.m
deleted file mode 100644
index 949c3c228..000000000
--- a/frontends/cocoa/TreeView.m
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "cocoa/TreeView.h"
-#import "cocoa/Tree.h"
-
-#import "netsurf/plotters.h"
-#import "netsurf/keypress.h"
-
-@interface TreeView () <TreeDelegate>
-@end
-
-@implementation TreeView
-
-@synthesize tree;
-
-- (void)drawRect:(NSRect)dirtyRect
-{
- [tree drawRect: dirtyRect inView: self];
-}
-
-- (BOOL) isFlipped
-{
- return YES;
-}
-
-- (BOOL) acceptsFirstResponder
-{
- return YES;
-}
-
-- (void) dealloc
-{
- [self setTree: nil];
- [super dealloc];
-}
-
-- (void) setTree: (Tree *)newTree
-{
- if (tree != newTree) {
- [tree setRedrawing: NO];
- [tree setDelegate: nil];
- [tree release];
-
- tree = [newTree retain];
- [tree setDelegate: self];
- [tree setRedrawing: YES];
-
- [self setNeedsDisplay: YES];
- }
-}
-
-//MARK: -
-//MARK: Event handlers
-
-- (void)mouseDown: (NSEvent *)event
-{
- isDragging = NO;
- dragStart = [self convertPoint: [event locationInWindow] fromView: nil];
- [tree mouseAction: BROWSER_MOUSE_PRESS_1 atPoint: dragStart];
-}
-
-#define squared(x) ((x)*(x))
-#define MinDragDistance (5.0)
-
-- (void) mouseDragged: (NSEvent *)event
-{
- const NSPoint point = [self convertPoint: [event locationInWindow] fromView: nil];
-
- if (!isDragging) {
- const CGFloat distance = squared( dragStart.x - point.x ) + squared( dragStart.y - point.y );
- if (distance >= squared( MinDragDistance)) {
- isDragging = YES;
- }
- }
-}
-
-- (void) mouseUp: (NSEvent *)event
-{
- const NSPoint point = [self convertPoint: [event locationInWindow] fromView: nil];
-
- browser_mouse_state modifierFlags = 0;
-
- if (isDragging) {
- isDragging = NO;
- [tree mouseDragEnd: modifierFlags fromPoint: dragStart toPoint: point];
- } else {
- modifierFlags |= BROWSER_MOUSE_CLICK_1;
- if ([event clickCount] == 2) {
- modifierFlags |= BROWSER_MOUSE_DOUBLE_CLICK;
- }
- [tree mouseAction: modifierFlags atPoint: point];
- }
-}
-
-//MARK: Keyboard events
-
-- (void) keyDown: (NSEvent *)theEvent
-{
- [self interpretKeyEvents: [NSArray arrayWithObject: theEvent]];
-}
-
-- (void) insertText: (id)string
-{
- for (NSUInteger i = 0, length = [string length]; i < length; i++) {
- unichar ch = [string characterAtIndex: i];
- [tree keyPress: ch];
- }
-}
-
-- (void) moveLeft: (id)sender
-{
- [tree keyPress: NS_KEY_LEFT];
-}
-
-- (void) moveRight: (id)sender
-{
- [tree keyPress: NS_KEY_RIGHT];
-}
-
-- (void) moveUp: (id)sender
-{
- [tree keyPress: NS_KEY_UP];
-}
-
-- (void) moveDown: (id)sender
-{
- [tree keyPress: NS_KEY_DOWN];
-}
-
-- (void) deleteBackward: (id)sender
-{
- [tree keyPress: NS_KEY_DELETE_LEFT];
-}
-
-- (void) deleteForward: (id)sender
-{
- [tree keyPress: NS_KEY_DELETE_RIGHT];
-}
-
-- (void) cancelOperation: (id)sender
-{
- [tree keyPress: NS_KEY_ESCAPE];
-}
-
-- (void) scrollPageUp: (id)sender
-{
- [tree keyPress: NS_KEY_PAGE_UP];
-}
-
-- (void) scrollPageDown: (id)sender
-{
- [tree keyPress: NS_KEY_PAGE_DOWN];
-}
-
-- (void) insertTab: (id)sender
-{
- [tree keyPress: NS_KEY_TAB];
-}
-
-- (void) insertBacktab: (id)sender
-{
- [tree keyPress: NS_KEY_SHIFT_TAB];
-}
-
-- (void) moveToBeginningOfLine: (id)sender
-{
- [tree keyPress: NS_KEY_LINE_START];
-}
-
-- (void) moveToEndOfLine: (id)sender
-{
- [tree keyPress: NS_KEY_LINE_END];
-}
-
-- (void) moveToBeginningOfDocument: (id)sender
-{
- [tree keyPress: NS_KEY_TEXT_START];
-}
-
-- (void) moveToEndOfDocument: (id)sender
-{
- [tree keyPress: NS_KEY_TEXT_END];
-}
-
-- (void) insertNewline: (id)sender
-{
- [tree keyPress: NS_KEY_NL];
-}
-
-- (void) selectAll: (id)sender
-{
- [tree keyPress: NS_KEY_SELECT_ALL];
-}
-
-- (void) copy: (id) sender
-{
- [tree keyPress: NS_KEY_COPY_SELECTION];
-}
-
-- (void) cut: (id) sender
-{
- [tree keyPress: NS_KEY_CUT_SELECTION];
-}
-
-- (void) paste: (id) sender
-{
- [tree keyPress: NS_KEY_PASTE];
-}
-
-//MARK: -
-//MARK: Tree delegate methods
-
-- (void) tree: (Tree *)t requestedRedrawInRect: (NSRect) rect
-{
- [self setNeedsDisplayInRect: rect];
-}
-
-- (void) tree: (Tree *)t resized: (NSSize) size
-{
- [self setMinimumSize: size];
-}
-
-- (void) tree: (Tree *)t scrollPoint: (NSPoint) point
-{
- [self scrollPoint: point];
-}
-
-- (NSSize) treeWindowSize: (Tree *)t
-{
- return [self frame].size;
-}
-
-@end
diff --git a/frontends/cocoa/URLFieldCell.h b/frontends/cocoa/URLFieldCell.h
deleted file mode 100644
index 38a75a139..000000000
--- a/frontends/cocoa/URLFieldCell.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface URLFieldCell : NSTextFieldCell {
- NSButtonCell *refreshCell;
- NSImage *favicon;
-}
-
-@property (readwrite, assign, nonatomic) SEL refreshAction;
-@property (readwrite, assign, nonatomic) id refreshTarget;
-@property (readwrite, retain, nonatomic) NSImage *favicon;
-
-@end
diff --git a/frontends/cocoa/URLFieldCell.m b/frontends/cocoa/URLFieldCell.m
deleted file mode 100644
index e9e66476e..000000000
--- a/frontends/cocoa/URLFieldCell.m
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import "cocoa/URLFieldCell.h"
-
-#import "utils/nsurl.h"
-#import "netsurf/url_db.h"
-
-@interface URLFieldCell ()
-
-@property (readonly, retain, nonatomic) NSButtonCell *refreshCell;
-
-- (NSRect) buttonFrame: (NSRect) cellFrame;
-- (NSRect) urlFrame: (NSRect) cellFrame;
-- (NSRect) iconFrame: (NSRect) cellFrame;
-
-@end
-
-
-@implementation URLFieldCell
-
-@synthesize favicon;
-
-- (void) setFavicon: (NSImage *)newIcon;
-{
- if (favicon != newIcon) {
- [favicon release];
- favicon = [newIcon retain];
- [[self controlView] setNeedsDisplay: YES];
- }
-}
-
-#define BUTTON_SIZE 32
-#define PADDING 2
-
-- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView *)controlView;
-{
- [favicon drawInRect: [self iconFrame: cellFrame] fromRect: NSZeroRect
- operation: NSCompositeSourceOver fraction: 1.0];
-
- [super drawInteriorWithFrame: [self urlFrame: cellFrame] inView: controlView];
-
- [[self refreshCell] drawInteriorWithFrame: [self buttonFrame: cellFrame]
- inView: controlView];
-}
-
-- (void) selectWithFrame: (NSRect)aRect inView: (NSView *)controlView editor: (NSText *)textObj
- delegate: (id)anObject start: (NSInteger)selStart length: (NSInteger)selLength;
-{
- const NSRect textFrame = [self urlFrame: aRect];
- [super selectWithFrame: textFrame inView: controlView editor: textObj
- delegate: anObject start: selStart length: selLength];
-}
-
-- (void) editWithFrame: (NSRect)aRect inView: (NSView *)controlView editor: (NSText *)textObj
- delegate: (id)anObject event: (NSEvent *)theEvent;
-{
- const NSRect textFrame = [self urlFrame: aRect];
- [super editWithFrame: textFrame inView: controlView editor: textObj
- delegate: anObject event: theEvent];
-}
-
-- (void) startDragURLAt: (NSPoint) point inView: (NSView *) view;
-{
- NSString *url = [self stringValue];
- NSString *title = url;
- nsurl *nsurl;
-
- if (nsurl_create( [url UTF8String] , &nsurl ) != NSERROR_OK)
- return;
-
- const struct url_data *data = urldb_get_url_data( nsurl );
-
- nsurl_unref(nsurl);
-
- if (data && data->title) title = [NSString stringWithUTF8String: data->title];
-
- NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSDragPboard];
- [pb declareTypes: [NSArray arrayWithObjects: NSStringPboardType, NSURLPboardType,
- @"public.url", @"public.url-name", nil] owner: nil];
- [pb setString: url forType: NSStringPboardType];
- [pb setString: url forType: @"public.url"];
- [pb setString: title forType: @"public.url-name"];
- [[NSURL URLWithString: url] writeToPasteboard: pb];
-
- NSRect urlBounds = NSZeroRect;
- urlBounds.size = [title sizeWithAttributes: nil];
- urlBounds.size.width += urlBounds.size.height + 2;
-
- NSImage *image = [[NSImage alloc] initWithSize: urlBounds.size];
-
- [image lockFocus];
- [favicon drawInRect: NSMakeRect( urlBounds.origin.x, urlBounds.origin.y, urlBounds.size.height, urlBounds.size.height )
- fromRect: NSZeroRect operation: NSCompositeCopy fraction: 1.0];
- urlBounds.origin.x += urlBounds.size.height + 2;
- [title drawInRect: urlBounds withAttributes: nil];
- [image unlockFocus];
-
- point.x -= urlBounds.size.height / 2;
- point.y += urlBounds.size.height / 2;
-
- [view dragImage: image at: point offset: NSZeroSize event: [NSApp currentEvent]
- pasteboard: pb source: self slideBack: YES];
-
- [image release];
-}
-
-- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
-{
- return NSDragOperationCopy | NSDragOperationGeneric;
-}
-
-- (BOOL) trackMouse: (NSEvent *)theEvent inRect: (NSRect)cellFrame ofView: (NSView *)controlView untilMouseUp: (BOOL)flag;
-{
- const NSPoint point = [controlView convertPoint: [theEvent locationInWindow] fromView: nil];
- const NSRect buttonRect = [self buttonFrame: cellFrame];
- if (NSPointInRect( point, [self iconFrame: cellFrame] )) {
- [self startDragURLAt: point inView: controlView];
- return NO;
- } else if (NSPointInRect( point, buttonRect )) {
- return [[self refreshCell] trackMouse: theEvent inRect: buttonRect
- ofView: controlView untilMouseUp: flag];
- } else {
- cellFrame.size.width -= BUTTON_SIZE + PADDING;
- return [super trackMouse: theEvent inRect: cellFrame ofView: controlView untilMouseUp: YES];
- }
-}
-
-- (void) dealloc;
-{
- [refreshCell release];
-
- [super dealloc];
-}
-
-- (NSRect) buttonFrame: (NSRect) cellFrame;
-{
- NSRect buttonRect = cellFrame;
- buttonRect.origin.x = NSMaxX( cellFrame ) - BUTTON_SIZE;
- buttonRect.size.width = BUTTON_SIZE;
- return buttonRect;
-}
-
-- (NSRect) urlFrame: (NSRect) cellFrame;
-{
- NSRect textFrame = cellFrame;
- textFrame.origin.x += cellFrame.size.height;
- textFrame.size.width -= cellFrame.size.height + BUTTON_SIZE + PADDING;
- return textFrame;
-}
-
-- (NSRect) iconFrame: (NSRect)cellFrame;
-{
- NSRect iconFrame = {
- .origin = {
- .x = cellFrame.origin.x + PADDING,
- .y = cellFrame.origin.y,
- },
- .size = NSMakeSize( NSHeight( cellFrame ), NSHeight( cellFrame ) )
- };
- return NSInsetRect( iconFrame, 2 * PADDING, 2 * PADDING );
-}
-
-- (NSButtonCell *) refreshCell;
-{
- if (nil == refreshCell) {
- refreshCell = [[NSButtonCell alloc] initImageCell: [NSImage imageNamed: NSImageNameRefreshTemplate]];
- [refreshCell setButtonType: NSMomentaryPushInButton];
- [refreshCell setBordered: NO];
- }
- return refreshCell;
-}
-
-- (void) setRefreshTarget: (id) newTarget;
-{
- [[self refreshCell] setTarget: newTarget];
-}
-
-- (id) refreshTarget;
-{
- return [[self refreshCell] target];
-}
-
-- (void) setRefreshAction: (SEL) newAction;
-{
- [[self refreshCell] setAction: newAction];
-}
-
-- (SEL) refreshAction;
-{
- return [[self refreshCell] action];
-}
-
-@end
diff --git a/frontends/cocoa/apple_image.m b/frontends/cocoa/apple_image.m
deleted file mode 100644
index 0bbaabd10..000000000
--- a/frontends/cocoa/apple_image.m
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef WITH_APPLE_IMAGE
-
-#import "cocoa/apple_image.h"
-
-#include "utils/config.h"
-#include "utils/utils.h"
-#include "netsurf/bitmap.h"
-#include "netsurf/plotters.h"
-#include "netsurf/content.h"
-#include "content/llcache.h"
-#include "content/content_protected.h"
-
-#import "cocoa/schedule.h"
-#import "cocoa/bitmap.h"
-
-typedef struct apple_image_content {
- struct content base;
-
- struct bitmap *bitmap; /**< Created NetSurf bitmap */
-
- NSUInteger frames;
- NSUInteger currentFrame;
- int *frameTimes;
-} apple_image_content;
-
-
-static void *apple_image_get_internal(const struct content *c, void *context)
-{
- apple_image_content *ai_c = (apple_image_content *)c;
-
- return ai_c->bitmap;
-}
-
-static nserror apple_image_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c)
-{
- apple_image_content *ai;
- nserror error;
-
- ai = calloc(1, sizeof(apple_image_content));
- if (ai == NULL)
- return NSERROR_NOMEM;
-
- error = content__init(&ai->base, handler, imime_type, params,
- llcache, fallback_charset, quirks);
- if (error != NSERROR_OK) {
- free(ai);
- return error;
- }
-
- *c = (struct content *) ai;
-
- return NSERROR_OK;
-}
-
-
-static void animate_image_cb( void *ptr )
-{
- struct apple_image_content *ai = ptr;
- ++ai->currentFrame;
- if (ai->currentFrame >= ai->frames) ai->currentFrame = 0;
-
- [(NSBitmapImageRep *)ai->bitmap setProperty: NSImageCurrentFrame withValue: [NSNumber numberWithUnsignedInteger: ai->currentFrame]];
- cocoa_bitmap_modified( ai->bitmap );
-
- union content_msg_data data;
- data.redraw.full_redraw = true;
- data.redraw.x = data.redraw.object_x = 0;
- data.redraw.y = data.redraw.object_y = 0;
- data.redraw.width = data.redraw.object_width = ai->base.width;
- data.redraw.height = data.redraw.object_height = ai->base.height;
- data.redraw.object = &ai->base;
- content_broadcast( &ai->base, CONTENT_MSG_REDRAW, data );
-
- cocoa_schedule(ai->frameTimes[ai->currentFrame], animate_image_cb, ai );
-}
-
-/**
- * Convert a CONTENT_APPLE_IMAGE for display.
- */
-static bool apple_image_convert(struct content *c)
-{
- apple_image_content *ai_c = (apple_image_content *)c;
- unsigned long size;
- const char *bytes = content__get_source_data(c, &size);
-
- NSData *data = [NSData dataWithBytesNoCopy: (char *)bytes length: size freeWhenDone: NO];
- NSBitmapImageRep *image = [[NSBitmapImageRep imageRepWithData: data] retain];
-
- if (image == nil) {
- union content_msg_data msg_data;
- msg_data.error = "cannot decode image";
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
- return false;
- }
-
- c->width = [image pixelsWide];
- c->height = [image pixelsHigh];
- ai_c->bitmap = (void *)image;
-
- NSString *url = [NSString stringWithUTF8String: nsurl_access(llcache_handle_get_url( content_get_llcache_handle( c )) )];
- NSString *title = [NSString stringWithFormat: @"%@ (%dx%d)", [url lastPathComponent], c->width, c->height];
- content__set_title(c, [title UTF8String] );
-
- content_set_ready(c);
- content_set_done(c);
- content_set_status(c, "");
-
- struct apple_image_content *ai = (struct apple_image_content *)c;
- NSUInteger frames = [[image valueForProperty: NSImageFrameCount] unsignedIntegerValue];
- if (frames > 1) {
- ai->frames = frames;
- ai->currentFrame = 0;
- ai->frameTimes = calloc( ai->frames , sizeof(int));
- for (NSUInteger i = 0; i < frames; i++) {
- [image setProperty: NSImageCurrentFrame withValue: [NSNumber numberWithUnsignedInteger: i]];
- ai->frameTimes[i] = 1000 * [[image valueForProperty: NSImageCurrentFrameDuration] floatValue];
- }
- [image setProperty: NSImageCurrentFrame withValue: [NSNumber numberWithUnsignedInteger: 0]];
- cocoa_schedule( ai->frameTimes[0], animate_image_cb, ai );
- }
-
- return true;
-}
-
-
-static void apple_image_destroy(struct content *c)
-{
- apple_image_content *ai_c = (apple_image_content *)c;
-
- [(id)ai_c->bitmap release];
- ai_c->bitmap = NULL;
- cocoa_schedule(-1, animate_image_cb, c );
-}
-
-
-static nserror apple_image_clone(const struct content *old, struct content **newc)
-{
- apple_image_content *ai;
- apple_image_content *ai_old = (apple_image_content *)old;
- nserror error;
-
- ai = calloc(1, sizeof(apple_image_content));
- if (ai == NULL)
- return NSERROR_NOMEM;
-
- error = content__clone(old, &ai->base);
- if (error != NSERROR_OK) {
- content_destroy(&ai->base);
- return error;
- }
-
- if (old->status == CONTENT_STATUS_READY ||
- old->status == CONTENT_STATUS_DONE) {
- ai->base.width = old->width;
- ai->base.height = old->height;
- ai->bitmap = (void *)[(id)ai_old->bitmap retain];
- }
-
- *newc = (struct content *) ai;
-
- return NSERROR_OK;
-}
-
-static content_type apple_image_content_type(void)
-{
- return CONTENT_IMAGE;
-}
-
-/**
- * Redraw a CONTENT_APPLE_IMAGE with appropriate tiling.
- */
-static bool apple_image_redraw(struct content *c, struct content_redraw_data *data,
- const struct rect *clip, const struct redraw_context *ctx)
-{
- apple_image_content *ai_c = (apple_image_content *)c;
- bitmap_flags_t flags = BITMAPF_NONE;
-
- if (data->repeat_x)
- flags |= BITMAPF_REPEAT_X;
- if (data->repeat_y)
- flags |= BITMAPF_REPEAT_Y;
-
- return ctx->plot->bitmap(data->x, data->y, data->width, data->height,
- ai_c->bitmap, data->background_colour, flags);
-}
-
-static const content_handler apple_image_content_handler = {
- .create = apple_image_create,
- .data_complete = apple_image_convert,
- .destroy = apple_image_destroy,
- .redraw = apple_image_redraw,
- .clone = apple_image_clone,
- .get_internal = apple_image_get_internal,
- .type = apple_image_content_type,
- .no_share = false
-};
-
-static nserror register_for_type( NSString *mime )
-{
- const char *type = [mime UTF8String];
- /* nsgif has priority since it supports animated GIF */
-#ifdef WITH_GIF
- if (strcmp(type, "image/gif") == 0)
- return NSERROR_OK;
-#endif
-
- nserror error = content_factory_register_handler( type, &apple_image_content_handler );
- if (error != NSERROR_OK) return error;
-
- return NSERROR_OK;
-}
-
-/* exported interface documented in cocoa/apple_image.h */
-nserror apple_image_init(void)
-{
- NSArray *utis = [NSBitmapImageRep imageTypes];
- for (NSString *uti in utis) {
- NSDictionary *declaration = [(NSDictionary *)UTTypeCopyDeclaration( (CFStringRef)uti ) autorelease];
- id mimeTypes = [[declaration objectForKey: (NSString *)kUTTypeTagSpecificationKey] objectForKey: (NSString *)kUTTagClassMIMEType];
-
- if (mimeTypes == nil) continue;
-
- if (![mimeTypes isKindOfClass: [NSArray class]]) {
- mimeTypes = [NSArray arrayWithObject: mimeTypes];
- }
-
- for (NSString *mime in mimeTypes) {
- nserror error = register_for_type( mime );
- if (error != NSERROR_OK) return error;
- }
- }
-
- return NSERROR_OK;
-}
-
-#endif /* WITH_APPLE_IMAGE */
diff --git a/frontends/cocoa/bitmap.h b/frontends/cocoa/bitmap.h
deleted file mode 100644
index 1eeed1767..000000000
--- a/frontends/cocoa/bitmap.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef COCOA_BITMAP_H
-#define COCOA_BITMAP_H
-
-CGImageRef cocoa_get_cgimage( void *bitmap );
-
-void cocoa_bitmap_modified(void *bitmap);
-
-struct gui_bitmap_table *cocoa_bitmap_table;
-
-#endif
diff --git a/frontends/cocoa/bitmap.m b/frontends/cocoa/bitmap.m
deleted file mode 100644
index 1ab8c3e2f..000000000
--- a/frontends/cocoa/bitmap.m
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * \file
- * Cocoa implementation of bitmap operations.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "netsurf/browser_window.h"
-#import "netsurf/plotters.h"
-#import "netsurf/bitmap.h"
-#import "netsurf/content.h"
-
-#import "cocoa/plotter.h"
-#import "cocoa/bitmap.h"
-
-#define BITS_PER_SAMPLE (8)
-#define SAMPLES_PER_PIXEL (4)
-#define BITS_PER_PIXEL (BITS_PER_SAMPLE * SAMPLES_PER_PIXEL)
-#define BYTES_PER_PIXEL (BITS_PER_PIXEL / 8)
-#define RED_OFFSET (0)
-#define GREEN_OFFSET (1)
-#define BLUE_OFFSET (2)
-#define ALPHA_OFFSET (3)
-
-static CGImageRef cocoa_prepare_bitmap( void *bitmap );
-static NSMapTable *cocoa_get_bitmap_cache( void );
-
-static int bitmap_get_width(void *bitmap)
-{
- NSCParameterAssert( NULL != bitmap );
- NSBitmapImageRep *bmp = (NSBitmapImageRep *)bitmap;
- return [bmp pixelsWide];
-}
-
-static int bitmap_get_height(void *bitmap)
-{
- NSCParameterAssert( NULL != bitmap );
- NSBitmapImageRep *bmp = (NSBitmapImageRep *)bitmap;
- return [bmp pixelsHigh];
-}
-
-static bool bitmap_get_opaque(void *bitmap)
-{
- NSCParameterAssert( NULL != bitmap );
- NSBitmapImageRep *bmp = (NSBitmapImageRep *)bitmap;
- return [bmp isOpaque];
-}
-
-static void bitmap_destroy(void *bitmap)
-{
- NSCParameterAssert( NULL != bitmap );
-
- NSMapTable *cache = cocoa_get_bitmap_cache();
- CGImageRef image = NSMapGet( cache, bitmap );
- if (NULL != image) {
- CGImageRelease( image );
- NSMapRemove( cache, bitmap );
- }
-
- NSBitmapImageRep *bmp = (NSBitmapImageRep *)bitmap;
- [bmp release];
-}
-
-static void *bitmap_create(int width, int height, unsigned int state)
-{
- NSBitmapImageRep *bmp = [[NSBitmapImageRep alloc]
- initWithBitmapDataPlanes: NULL
- pixelsWide: width
- pixelsHigh: height
- bitsPerSample: BITS_PER_SAMPLE
- samplesPerPixel: SAMPLES_PER_PIXEL
- hasAlpha: YES
- isPlanar: NO
- colorSpaceName: NSDeviceRGBColorSpace
- bitmapFormat: NSAlphaNonpremultipliedBitmapFormat
- bytesPerRow: BYTES_PER_PIXEL * width
- bitsPerPixel: BITS_PER_PIXEL];
-
- return bmp;
-}
-
-static void bitmap_set_opaque(void *bitmap, bool opaque)
-{
- NSCParameterAssert( NULL != bitmap );
- NSBitmapImageRep *bmp = (NSBitmapImageRep *)bitmap;
- [bmp setOpaque: opaque ? YES : NO];
-}
-
-static unsigned char *bitmap_get_buffer(void *bitmap)
-{
- NSCParameterAssert( NULL != bitmap );
- NSBitmapImageRep *bmp = (NSBitmapImageRep *)bitmap;
- return [bmp bitmapData];
-}
-
-static size_t bitmap_get_rowstride(void *bitmap)
-{
- NSCParameterAssert( NULL != bitmap );
- NSBitmapImageRep *bmp = (NSBitmapImageRep *)bitmap;
- return [bmp bytesPerRow];
-}
-
-static size_t bitmap_get_bpp(void *bitmap)
-{
- NSCParameterAssert( NULL != bitmap );
- NSBitmapImageRep *bmp = (NSBitmapImageRep *)bitmap;
- return [bmp bitsPerPixel] / 8;
-}
-
-static bool bitmap_test_opaque(void *bitmap)
-{
- NSCParameterAssert( bitmap_get_bpp( bitmap ) == BYTES_PER_PIXEL );
-
- unsigned char *buf = bitmap_get_buffer( bitmap );
-
- const size_t height = bitmap_get_height( bitmap );
- const size_t width = bitmap_get_width( bitmap );
-
- const size_t line_step = bitmap_get_rowstride( bitmap ) - BYTES_PER_PIXEL * width;
-
- for (size_t y = 0; y < height; y++) {
- for (size_t x = 0; x < height; x++) {
- if (buf[ALPHA_OFFSET] != 0xFF) return false;
- buf += BYTES_PER_PIXEL;
- }
- buf += line_step;
- }
-
- return true;
-}
-
-static bool bitmap_save(void *bitmap, const char *path, unsigned flags)
-{
- NSCParameterAssert( NULL != bitmap );
- NSBitmapImageRep *bmp = (NSBitmapImageRep *)bitmap;
-
- NSData *tiff = [bmp TIFFRepresentation];
- return [tiff writeToFile: [NSString stringWithUTF8String: path] atomically: YES];
-}
-
-void cocoa_bitmap_modified(void *bitmap)
-{
- NSMapTable *cache = cocoa_get_bitmap_cache();
- CGImageRef image = NSMapGet( cache, bitmap );
- if (NULL != image) {
- CGImageRelease( image );
- NSMapRemove( cache, bitmap );
- }
-}
-
-CGImageRef cocoa_get_cgimage( void *bitmap )
-{
- NSMapTable *cache = cocoa_get_bitmap_cache();
-
- CGImageRef result = NSMapGet( cache, bitmap );
- if (NULL == result) {
- result = cocoa_prepare_bitmap( bitmap );
- NSMapInsertKnownAbsent( cache, bitmap, result );
- }
-
- return result;
-}
-
-static inline NSMapTable *cocoa_get_bitmap_cache( void )
-{
- static NSMapTable *cache = nil;
- if (cache == nil) {
- cache = NSCreateMapTable( NSNonOwnedPointerMapKeyCallBacks, NSNonOwnedPointerMapValueCallBacks, 0 );
- }
- return cache;
-}
-
-static CGImageRef cocoa_prepare_bitmap( void *bitmap )
-{
- NSCParameterAssert( NULL != bitmap );
-
- NSBitmapImageRep *bmp = (NSBitmapImageRep *)bitmap;
-
- size_t w = [bmp pixelsWide];
- size_t h = [bmp pixelsHigh];
-
- CGImageRef original = [bmp CGImage];
-
- if (h <= 1) return CGImageRetain( original );
-
- void *data = malloc( 4 * w * h );
-
- CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
- CGContextRef context = CGBitmapContextCreate( data, w, h, BITS_PER_SAMPLE,
- BYTES_PER_PIXEL * w, colorSpace,
- [bmp isOpaque] ? kCGImageAlphaNoneSkipLast
- : kCGImageAlphaPremultipliedLast );
- CGColorSpaceRelease( colorSpace );
-
- CGContextTranslateCTM( context, 0.0, h );
- CGContextScaleCTM( context, 1.0, -1.0 );
-
- CGRect rect = CGRectMake( 0, 0, w, h );
- CGContextClearRect( context, rect );
- CGContextDrawImage( context, rect, original );
-
- CGImageRef result = CGBitmapContextCreateImage( context );
-
- CGContextRelease( context );
- free( data );
-
- return result;
-}
-
-static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content)
-{
- int bwidth = bitmap_get_width( bitmap );
- int bheight = bitmap_get_height( bitmap );
-
- struct redraw_context ctx = {
- .interactive = false,
- .background_images = true,
- .plot = &cocoa_plotters
- };
-
- CGColorSpaceRef cspace = CGColorSpaceCreateWithName( kCGColorSpaceGenericRGB );
- CGContextRef bitmapContext = CGBitmapContextCreate( bitmap_get_buffer( bitmap ),
- bwidth, bheight,
- bitmap_get_bpp( bitmap ) * 8 / 4,
- bitmap_get_rowstride( bitmap ),
- cspace, kCGImageAlphaNoneSkipLast );
- CGColorSpaceRelease( cspace );
-
- size_t width = MIN( content_get_width( content ), 1024 );
- size_t height = ((width * bheight) + bwidth / 2) / bwidth;
-
- CGContextTranslateCTM( bitmapContext, 0, bheight );
- CGContextScaleCTM( bitmapContext, (CGFloat)bwidth / width, -(CGFloat)bheight / height );
-
- [NSGraphicsContext setCurrentContext: [NSGraphicsContext graphicsContextWithGraphicsPort: bitmapContext flipped: YES]];
-
- content_scaled_redraw( content, width, height, &ctx );
-
- [NSGraphicsContext setCurrentContext: nil];
- CGContextRelease( bitmapContext );
-
- cocoa_bitmap_modified( bitmap );
-
- return true;
-}
-
-static struct gui_bitmap_table bitmap_table = {
- .create = bitmap_create,
- .destroy = bitmap_destroy,
- .set_opaque = bitmap_set_opaque,
- .get_opaque = bitmap_get_opaque,
- .test_opaque = bitmap_test_opaque,
- .get_buffer = bitmap_get_buffer,
- .get_rowstride = bitmap_get_rowstride,
- .get_width = bitmap_get_width,
- .get_height = bitmap_get_height,
- .get_bpp = bitmap_get_bpp,
- .save = bitmap_save,
- .modified = cocoa_bitmap_modified,
- .render = bitmap_render,
-};
-
-struct gui_bitmap_table *cocoa_bitmap_table = &bitmap_table;
diff --git a/frontends/cocoa/compile-xib.sh b/frontends/cocoa/compile-xib.sh
deleted file mode 100755
index 576f9bfd0..000000000
--- a/frontends/cocoa/compile-xib.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-# call: compile-xib.sh [xib file] [language] [(optional output nib file)]
-DIR=`dirname "$1"`
-XIB=`basename -s .xib "$1"`
-
-STRINGS_FILE="$DIR/$2.lproj/$XIB.xib.strings"
-TRANSLATE=""
-if [ -f $STRINGS_FILE ]
-then
- TRANSLATE="--strings-file $STRINGS_FILE"
-fi
-
-OUTPUT="$2.$XIB.nib"
-
-if [ "x$3" != "x" ]
-then
- OUTPUT="$3"
-fi
-
-exec /usr/bin/ibtool $TRANSLATE --compile $OUTPUT $1
diff --git a/frontends/cocoa/coordinates.h b/frontends/cocoa/coordinates.h
deleted file mode 100644
index a9614389b..000000000
--- a/frontends/cocoa/coordinates.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef COCOA_COORDINATES_H
-#define COCOA_COORDINATES_H
-
-extern CGFloat cocoa_scale_factor;
-
-static inline CGFloat cocoa_px_to_pt( int location ) __attribute__((always_inline,pure));
-static inline CGFloat cocoa_px_to_pt_f( CGFloat location ) __attribute__((always_inline,pure));
-
-static inline int cocoa_pt_to_px( CGFloat location ) __attribute__((always_inline,pure));
-
-static inline NSPoint cocoa_point( int x, int y ) __attribute__((always_inline,pure));
-static inline NSPoint cocoa_scaled_point( CGFloat scale, int x, int y ) __attribute__((always_inline,pure));
-
-static inline NSSize cocoa_size( int w, int h ) __attribute__((always_inline,pure));
-static inline NSSize cocoa_scaled_size( CGFloat scale, int w, int h ) __attribute__((always_inline,pure));
-
-static inline NSRect cocoa_rect( int x0, int y0, int x1, int y1 ) __attribute__((always_inline,pure));
-static inline NSRect cocoa_rect_wh( int x, int y, int w, int h ) __attribute__((always_inline,pure));
-
-static inline NSRect cocoa_scaled_rect( CGFloat scale, int x0, int y0, int x1, int y1 ) __attribute__((always_inline,pure));
-static inline NSRect cocoa_scaled_rect_wh( CGFloat scale, int x, int y, int w, int h ) __attribute__((always_inline,pure));
-
-static inline CGFloat cocoa_px_to_pt( int location )
-{
- return (CGFloat)location * cocoa_scale_factor;
-}
-
-static inline CGFloat cocoa_px_to_pt_f( CGFloat location )
-{
- return floor( location ) * cocoa_scale_factor;
-}
-
-static inline int cocoa_pt_to_px( CGFloat location )
-{
- return location / cocoa_scale_factor;
-}
-
-static inline NSPoint cocoa_point( int x, int y )
-{
- return NSMakePoint( cocoa_px_to_pt( x ), cocoa_px_to_pt( y ) );
-}
-
-static inline NSPoint cocoa_scaled_point( CGFloat scale, int x, int y )
-{
- return NSMakePoint( cocoa_px_to_pt_f( scale * x ), cocoa_px_to_pt_f( scale * y ) );
-}
-
-static inline NSSize cocoa_size( int w, int h )
-{
- return NSMakeSize( cocoa_px_to_pt( w ), cocoa_px_to_pt( h ) );
-}
-
-static inline NSSize cocoa_scaled_size( CGFloat scale, int w, int h )
-{
- return NSMakeSize( cocoa_px_to_pt_f( scale * w ), cocoa_px_to_pt_f( scale * h ) );
-}
-
-static inline NSRect cocoa_rect( int x0, int y0, int x1, int y1 )
-{
- return cocoa_rect_wh( x0, y0, x1 - x0, y1 - y0 );
-}
-
-static inline NSRect cocoa_rect_wh( int x, int y, int w, int h )
-{
- const NSRect result = {
- .origin = cocoa_point( x, y ),
- .size = cocoa_size( w, h )
- };
- return result;
-}
-
-static inline NSRect cocoa_scaled_rect_wh( CGFloat scale, int x, int y, int w, int h )
-{
- const NSRect result = {
- .origin = cocoa_scaled_point( scale, x, y ),
- .size = cocoa_scaled_size( scale, w, h )
- };
- return result;
-}
-
-static inline NSRect cocoa_scaled_rect( CGFloat scale, int x0, int y0, int x1, int y1 )
-{
- return cocoa_scaled_rect_wh( scale, x0, y0, x1 - x0, y1 - y0 );
-}
-
-
-#endif
diff --git a/frontends/cocoa/desktop-tree.h b/frontends/cocoa/desktop-tree.h
deleted file mode 100644
index f8864e167..000000000
--- a/frontends/cocoa/desktop-tree.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2004 Richard Wilson <not_ginger_matt@users.sourceforge.net>
- * Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * deprecated compatibility layer for new treeview modules. Do not use.
- */
-
-#ifndef _NETSURF_DESKTOP_TREE_H_
-#define _NETSURF_DESKTOP_TREE_H_
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "netsurf/mouse.h"
-
-struct sslcert_session_data;
-struct tree;
-struct redraw_context;
-
-/**
- * Current ssl session data for treeview
- *
- * @todo FIXME global certificate treeview state must go away, this is
- * just wrong.
- */
-extern struct sslcert_session_data *ssl_current_session;
-extern const char *tree_hotlist_path;
-
-/* Tree flags */
-enum tree_flags {
- TREE_HISTORY,
- TREE_COOKIES,
- TREE_SSLCERT,
- TREE_HOTLIST
-};
-
-typedef enum {
- TREE_NO_DRAG = 0,
- TREE_SELECT_DRAG,
- TREE_MOVE_DRAG,
- TREE_TEXTAREA_DRAG, /** < A drag that is passed to a textarea */
- TREE_UNKNOWN_DRAG /** < A drag the tree itself won't handle */
-} tree_drag_type;
-
-/** callbacks to perform necessary operations on treeview. */
-struct treeview_table {
- void (*redraw_request)(int x, int y, int width, int height,
- void *data); /**< request a redraw. */
- void (*resized)(struct tree *tree, int width, int height,
- void *data); /**< resize treeview area. */
- void (*scroll_visible)(int y, int height, void *data); /**< scroll visible treeview area. */
- void (*get_window_dimensions)(int *width, int *height, void *data); /**< get dimensions of window */
-};
-
-struct tree *tree_create(unsigned int flags,
- const struct treeview_table *callbacks,
- void *client_data);
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_delete(struct tree *tree);
-tree_drag_type tree_drag_status(struct tree *tree);
-void tree_draw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx);
-bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse,
- int x, int y);
-void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0,
- int x1, int y1);
-bool tree_keypress(struct tree *tree, uint32_t key);
-
-
-#endif
diff --git a/frontends/cocoa/desktop-tree.m b/frontends/cocoa/desktop-tree.m
deleted file mode 100644
index c3c729660..000000000
--- a/frontends/cocoa/desktop-tree.m
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright 2004 Richard Wilson <not_ginger_matt@users.sourceforge.net>
- * Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * deprecated compatibility layer for new treeview modules. Do not use.
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "utils/nsoption.h"
-#include "netsurf/browser_window.h"
-#include "netsurf/core_window.h"
-#include "content/content.h"
-#include "content/hlcache.h"
-
-#import "cocoa/desktop-tree.h"
-
-struct tree {
- unsigned int flags; /* Tree flags */
- tree_drag_type drag;
- const struct treeview_table *callbacks;
- void *client_data; /* User assigned data for the callbacks */
-};
-
-#include "netsurf/misc.h"
-#include "desktop/gui_internal.h"
-#include "desktop/treeview.h"
-#include "desktop/hotlist.h"
-#include "desktop/cookie_manager.h"
-#include "desktop/global_history.h"
-#include "desktop/sslcert_viewer.h"
-
-struct sslcert_session_data *ssl_current_session = NULL;
-const char *tree_hotlist_path = NULL;
-
-static void treeview_test_redraw_request(struct core_window *cw,
- const struct rect *r)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->redraw_request(r->x0, r->y0,
- r->x1 - r->x0, r->y1 - r->y0,
- tree->client_data);
-}
-
-static void treeview_test_update_size(struct core_window *cw,
- int width, int height)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->resized(tree, width, height, tree->client_data);
-}
-
-static void treeview_test_scroll_visible(struct core_window *cw,
- const struct rect *r)
-{
-}
-
-static void treeview_test_get_window_dimensions(struct core_window *cw,
- int *width, int *height)
-{
- struct tree *tree = (struct tree *)cw;
-
- tree->callbacks->get_window_dimensions(width, height,
- tree->client_data);
-}
-
-static void treeview_test_drag_status(struct core_window *cw,
- core_window_drag_status ds)
-{
- struct tree *tree = (struct tree *)cw;
-
- switch (ds) {
- case CORE_WINDOW_DRAG_NONE:
- tree->drag = TREE_NO_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_SELECTION:
- tree->drag = TREE_SELECT_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_MOVE:
- tree->drag = TREE_MOVE_DRAG;
- break;
-
- case CORE_WINDOW_DRAG_TEXT_SELECTION:
- tree->drag = TREE_TEXTAREA_DRAG;
- break;
-
- default:
- break;
- }
-}
-
-struct core_window_callback_table cw_t = {
- .redraw_request = treeview_test_redraw_request,
- .update_size = treeview_test_update_size,
- .scroll_visible = treeview_test_scroll_visible,
- .get_window_dimensions = treeview_test_get_window_dimensions,
- .drag_status = treeview_test_drag_status
-};
-
-static bool treeview_test_init(struct tree *tree)
-{
- nserror err;
-
- switch (tree->flags) {
- case TREE_COOKIES:
- err = cookie_manager_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new cookie manager.", 0);
- break;
- case TREE_HISTORY:
- err = global_history_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new global history.", 0);
- break;
- case TREE_HOTLIST:
- err = hotlist_init(tree_hotlist_path);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new hotlist.", 0);
- err = hotlist_manager_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init hotlist manager.", 0);
- break;
- case TREE_SSLCERT:
- assert(ssl_current_session == NULL &&
- "Call sslcert_viewer_init directly, "
- "this compat. layer can't cope with simultanious "
- "sslcert viewers");
- err = sslcert_viewer_init(&cw_t, (struct core_window *)tree,
- ssl_current_session);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't init new sslcert viewer.", 0);
- break;
- }
-
- return true;
-}
-
-static bool treeview_test_fini(struct tree *tree)
-{
- nserror err;
-
- switch (tree->flags) {
- case TREE_COOKIES:
- err = cookie_manager_fini();
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise cookie manager.", 0);
- break;
- case TREE_HISTORY:
- err = global_history_fini();
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise cookie manager.", 0);
- break;
- case TREE_HOTLIST:
- err = hotlist_fini(tree_hotlist_path);
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise hotlist.", 0);
- break;
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- err = sslcert_viewer_fini(ssl_current_session);
- ssl_current_session = NULL;
- if (err != NSERROR_OK)
- guit->misc->warning("Couldn't finalise sslcert viewer.", 0);
- break;
- }
-
- return true;
-}
-
-static bool treeview_test_redraw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx)
-{
- struct rect clip;
-
- clip.x0 = clip_x;
- clip.y0 = clip_y;
- clip.x1 = clip_x + clip_width;
- clip.y1 = clip_y + clip_height;
-
- switch (tree->flags) {
- case TREE_SSLCERT:
- if (ssl_current_session != NULL) {
- sslcert_viewer_redraw(ssl_current_session, x, y, &clip, ctx);
- }
- return true;
- case TREE_COOKIES:
- cookie_manager_redraw(x, y, &clip, ctx);
- return true;
- case TREE_HISTORY:
- global_history_redraw(x, y, &clip, ctx);
- return true;
- case TREE_HOTLIST:
- hotlist_redraw(x, y, &clip, ctx);
- return true;
- }
-
- return false;
-}
-
-static bool treeview_test_mouse_action(struct tree *tree,
- browser_mouse_state mouse, int x, int y)
-{
- switch (tree->flags) {
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- sslcert_viewer_mouse_action(ssl_current_session, mouse, x, y);
- return true;
- case TREE_COOKIES:
- cookie_manager_mouse_action(mouse, x, y);
- return true;
- case TREE_HISTORY:
- global_history_mouse_action(mouse, x, y);
- return true;
- case TREE_HOTLIST:
- hotlist_mouse_action(mouse, x, y);
- return true;
- }
-
- return false;
-}
-
-static bool treeview_test_keypress(struct tree *tree, uint32_t key)
-{
- switch (tree->flags) {
- case TREE_SSLCERT:
- assert(ssl_current_session != NULL &&
- "Can't use sslcert window after sslcert_viewer_fini()");
- sslcert_viewer_keypress(ssl_current_session, key);
- return true;
- case TREE_COOKIES:
- cookie_manager_keypress(key);
- return true;
- case TREE_HISTORY:
- global_history_keypress(key);
- return true;
- case TREE_HOTLIST:
- hotlist_keypress(key);
- return true;
- }
-
- return false;
-}
-
-/* -------------------------------------------------------------------------- */
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-struct tree *tree_create(unsigned int flags,
- const struct treeview_table *callbacks, void *client_data)
-{
- struct tree *tree;
-
- tree = calloc(sizeof(struct tree), 1);
- if (tree == NULL) {
- LOG("calloc failed");
- guit->misc->warning(messages_get_errorcode(NSERROR_NOMEM), 0);
- return NULL;
- }
-
- tree->flags = flags;
- tree->drag = TREE_NO_DRAG;
- tree->callbacks = callbacks;
- tree->client_data = client_data;
-
- treeview_test_init(tree);
-
- return tree;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_delete(struct tree *tree)
-{
- treeview_test_fini(tree);
- free(tree);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_draw(struct tree *tree, int x, int y,
- int clip_x, int clip_y, int clip_width, int clip_height,
- const struct redraw_context *ctx)
-{
- assert(tree != NULL);
-
- treeview_test_redraw(tree, x, y, clip_x, clip_y,
- clip_width, clip_height, ctx);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
- int y)
-{
- assert(tree != NULL);
-
- if (treeview_test_mouse_action(tree, mouse, x, y)) {
- return true;
- }
-
- return false;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0,
- int x1, int y1)
-{
- assert(tree != NULL);
-
- treeview_test_mouse_action(tree, BROWSER_MOUSE_HOVER, x1, y1);
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-bool tree_keypress(struct tree *tree, uint32_t key)
-{
- if (treeview_test_keypress(tree, key)) {
- return true;
- }
-
- return false;
-}
-
-/** deprecated compatibility layer for new treeview modules. Do not use. */
-tree_drag_type tree_drag_status(struct tree *tree)
-{
- assert(tree != NULL);
- return tree->drag;
-}
diff --git a/frontends/cocoa/extract-strings.sh b/frontends/cocoa/extract-strings.sh
deleted file mode 100755
index c3f582619..000000000
--- a/frontends/cocoa/extract-strings.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-for i in $1/*.xib
-do
- xib=`basename "$i"`
- strings="$2/$xib.strings"
-
- ibtool "$i" --generate-strings-file "$strings"
-done
-
-
diff --git a/frontends/cocoa/fetch.h b/frontends/cocoa/fetch.h
deleted file mode 100644
index 1b0991ef5..000000000
--- a/frontends/cocoa/fetch.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-extern struct gui_fetch_table *cocoa_fetch_table;
diff --git a/frontends/cocoa/fetch.m b/frontends/cocoa/fetch.m
deleted file mode 100644
index 0bbce09f6..000000000
--- a/frontends/cocoa/fetch.m
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "utils/log.h"
-#import "utils/nsurl.h"
-#import "netsurf/fetch.h"
-
-#import "cocoa/fetch.h"
-
-static char cocoafiletype[200];
-
-static const struct mimemap_s {
- const char const *extension;
- const char const *mimetype;
-} cocoamimemap[] = {
- { "css", "text/css" },
- { "f79", "text/css" },
- { "jpg", "image/jpeg" },
- { "jpeg", "image/jpeg" },
- { "gif", "image/gif" },
- { "png", "image/png" },
- { "b60", "image/png" },
- { "jng", "image/jng" },
- { "svg", "image/svg" },
- { NULL, "text/html" }
-};
-
-
-static const char *fetch_filetype(const char *unix_path)
-{
- NSString *uti;
- NSString *mimeType = nil;
- NSError *utiError = nil;
-
- uti = [[NSWorkspace sharedWorkspace] typeOfFile: [NSString stringWithUTF8String: unix_path] error:&utiError];
- if (nil != uti) {
- LOG("Looking for mimetype from uti \"%s\"", [uti UTF8String] );
- mimeType = (NSString *)UTTypeCopyPreferredTagWithClass( (CFStringRef)uti, kUTTagClassMIMEType );
- } else {
- NSAlert *utiAlert = [NSAlert alertWithError:utiError];
- [utiAlert runModal]; // Ignore return value.
-
- LOG("uti call failed");
-
- strncpy(cocoafiletype, "text/html", sizeof(cocoafiletype));
- return cocoafiletype;
- }
-
- if (nil != mimeType) {
- strncpy(cocoafiletype, [mimeType UTF8String], sizeof(cocoafiletype));
- [mimeType release];
- } else {
- const char *extension;
-
- LOG("mimetype from uti failed");
-
- extension = [(NSString *)UTTypeCopyPreferredTagWithClass( (CFStringRef)uti, kUTTagClassFilenameExtension) UTF8String];
-
- if (extension == NULL) {
- /* give up and go with default */
- LOG("No extension going with default type");
- strncpy(cocoafiletype, "text/html", sizeof(cocoafiletype)); } else {
- int eidx = 0; /* index of extension entry */
-
- while ((cocoamimemap[eidx].extension != NULL) &&
- (strcmp(cocoamimemap[eidx].extension, extension) != 0)) {
- eidx++;
- }
-
- strncpy(cocoafiletype,
- cocoamimemap[eidx].mimetype,
- sizeof(cocoafiletype));
- }
- }
-
- LOG("\tMIME type for '%s' is '%s'", unix_path, cocoafiletype);
-
- return cocoafiletype;
-}
-
-static nsurl *gui_get_resource_url(const char *path)
-{
- nsurl *url = NULL;
- NSString *nspath = [[NSBundle mainBundle] pathForResource: [NSString stringWithUTF8String: path] ofType: @""];
- if (nspath == nil) return NULL;
- nsurl_create([[[NSURL fileURLWithPath: nspath] absoluteString] UTF8String], &url);
- return url;
-}
-
-static struct gui_fetch_table fetch_table = {
- .filetype = fetch_filetype,
-
- .get_resource_url = gui_get_resource_url,
-};
-
-struct gui_fetch_table *cocoa_fetch_table = &fetch_table;
diff --git a/frontends/cocoa/font.h b/frontends/cocoa/font.h
deleted file mode 100644
index ed0479765..000000000
--- a/frontends/cocoa/font.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef COCOA_FONT_H
-#define COCOA_FONT_H
-
-#import "netsurf/plot_style.h"
-
-void cocoa_draw_string( CGFloat x, CGFloat y, const char *bytes, size_t length, const struct plot_font_style *style );
-
-struct gui_layout_table *cocoa_layout_table;
-
-#endif
diff --git a/frontends/cocoa/font.m b/frontends/cocoa/font.m
deleted file mode 100644
index 17212fff9..000000000
--- a/frontends/cocoa/font.m
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "utils/nsoption.h"
-#import "netsurf/layout.h"
-#import "netsurf/plotters.h"
-
-#import "cocoa/coordinates.h"
-#import "cocoa/plotter.h"
-#import "cocoa/font.h"
-
-static NSLayoutManager *cocoa_prepare_layout_manager( const char *string, size_t length,
- const plot_font_style_t *style );
-
-static CGFloat cocoa_layout_width( NSLayoutManager *layout );
-static CGFloat cocoa_layout_width_chars( NSLayoutManager *layout, size_t characters );
-static NSUInteger cocoa_glyph_for_location( NSLayoutManager *layout, CGFloat x );
-static size_t cocoa_bytes_for_characters( const char *string, size_t characters );
-static NSDictionary *cocoa_font_attributes( const plot_font_style_t *style );
-
-static NSTextStorage *cocoa_text_storage = nil;
-static NSTextContainer *cocoa_text_container = nil;
-
-static nserror cocoa_font_width(const plot_font_style_t *style,
- const char *string, size_t length,
- int *width)
-{
- NSLayoutManager *layout;
- layout = cocoa_prepare_layout_manager( string, length, style );
- *width = cocoa_layout_width( layout );
- return NSERROR_OK;
-}
-
-static nserror cocoa_font_position(const plot_font_style_t *style,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
-{
- NSLayoutManager *layout = cocoa_prepare_layout_manager( string, length, style );
- if (layout == nil) {
- return NSERROR_BAD_PARAMETER;
- }
-
- NSUInteger glyphIndex = cocoa_glyph_for_location( layout, x );
- NSUInteger chars = [layout characterIndexForGlyphAtIndex: glyphIndex];
-
- if (chars >= [cocoa_text_storage length]) *char_offset = length;
- else *char_offset = cocoa_bytes_for_characters( string, chars );
-
- *actual_x = cocoa_pt_to_px( NSMaxX( [layout boundingRectForGlyphRange: NSMakeRange( glyphIndex - 1, 1 )
- inTextContainer: cocoa_text_container] ) );
-
- return NSERROR_OK;
-}
-
-static nserror cocoa_font_split(const plot_font_style_t *style,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
-{
- NSLayoutManager *layout = cocoa_prepare_layout_manager( string, length, style );
- if (layout == nil) return NSERROR_BAD_PARAMETER;
-
- NSUInteger glyphIndex = cocoa_glyph_for_location( layout, x );
- NSUInteger chars = [layout characterIndexForGlyphAtIndex: glyphIndex];
-
- if (chars >= [cocoa_text_storage length]) {
- *char_offset = length;
- *actual_x = cocoa_layout_width( layout );
- return NSERROR_OK;
- }
-
-
- chars = [[cocoa_text_storage string] rangeOfString: @" " options: NSBackwardsSearch range: NSMakeRange( 0, chars + 1 )].location;
- if (chars == NSNotFound) {
- *char_offset = 0;
- *actual_x = 0;
- return NSERROR_OK;
- }
-
- *char_offset = cocoa_bytes_for_characters( string, chars );
- *actual_x = cocoa_layout_width_chars( layout, chars );
-
- return NSERROR_OK;
-}
-
-
-static struct gui_layout_table layout_table = {
- .width = cocoa_font_width,
- .position = cocoa_font_position,
- .split = cocoa_font_split,
-};
-
-struct gui_layout_table *cocoa_layout_table = &layout_table;
-
-
-#pragma mark -
-
-void cocoa_draw_string( CGFloat x, CGFloat y, const char *bytes, size_t length, const plot_font_style_t *style )
-{
- NSLayoutManager *layout = cocoa_prepare_layout_manager( bytes, length, style );
- if (layout == nil) return;
-
- NSFont *font = [cocoa_text_storage attribute: NSFontAttributeName atIndex: 0 effectiveRange: NULL];
- CGFloat baseline = [layout defaultLineHeightForFont: font] * 3.0 / 4.0;
-
- NSRange glyphRange = [layout glyphRangeForTextContainer: cocoa_text_container];
- [layout drawGlyphsForGlyphRange: glyphRange atPoint: NSMakePoint( x, y - baseline )];
-}
-
-
-#pragma mark -
-
-static inline CGFloat cocoa_layout_width( NSLayoutManager *layout )
-{
- if (layout == nil) return 0.0;
-
- return cocoa_pt_to_px( NSWidth( [layout usedRectForTextContainer: cocoa_text_container] ) );
-}
-
-static inline CGFloat cocoa_layout_width_chars( NSLayoutManager *layout, size_t characters )
-{
- NSUInteger glyphIndex = [layout glyphIndexForCharacterAtIndex: characters];
- return cocoa_pt_to_px( [layout locationForGlyphAtIndex: glyphIndex].x );
-}
-
-static inline NSUInteger cocoa_glyph_for_location( NSLayoutManager *layout, CGFloat x )
-{
- CGFloat fraction = 0.0;
- NSUInteger glyphIndex = [layout glyphIndexForPoint: NSMakePoint( cocoa_px_to_pt( x ), 0 )
- inTextContainer: cocoa_text_container
- fractionOfDistanceThroughGlyph: &fraction];
- if (fraction >= 1.0) ++glyphIndex;
- return glyphIndex;
-}
-
-static inline size_t cocoa_bytes_for_characters( const char *string, size_t chars )
-{
- size_t offset = 0;
- while (chars-- > 0) {
- uint8_t ch = ((uint8_t *)string)[offset];
-
- if (0xC2 <= ch && ch <= 0xDF) offset += 2;
- else if (0xE0 <= ch && ch <= 0xEF) offset += 3;
- else if (0xF0 <= ch && ch <= 0xF4) offset += 4;
- else offset++;
- }
- return offset;
-}
-
-static NSLayoutManager *cocoa_prepare_layout_manager( const char *bytes, size_t length,
- const plot_font_style_t *style )
-{
- if (NULL == bytes || 0 == length) return nil;
-
- NSString *string = [[[NSString alloc] initWithBytes: bytes length:length encoding:NSUTF8StringEncoding] autorelease];
- if (string == nil) return nil;
-
- static NSLayoutManager *layout = nil;
- if (nil == layout) {
- cocoa_text_container = [[NSTextContainer alloc] initWithContainerSize: NSMakeSize( CGFLOAT_MAX, CGFLOAT_MAX )];
- [cocoa_text_container setLineFragmentPadding: 0];
-
- layout = [[NSLayoutManager alloc] init];
- [layout addTextContainer: cocoa_text_container];
- }
-
- static NSString *oldString = 0;
- static plot_font_style_t oldStyle = { 0, 0, 0, 0, 0, 0 };
-
- const bool styleChanged = memcmp( style, &oldStyle, sizeof oldStyle ) != 0;
-
- if ([oldString isEqualToString: string] && !styleChanged) {
- return layout;
- }
-
- [oldString release];
- oldString = [string copy];
- oldStyle = *style;
-
- static NSDictionary *attributes = nil;
- if (styleChanged || attributes == nil) {
- [attributes release];
- attributes = [cocoa_font_attributes( style ) retain];
- }
-
- [cocoa_text_storage release];
- cocoa_text_storage = [[NSTextStorage alloc] initWithString: string attributes: attributes];
- [cocoa_text_storage addLayoutManager: layout];
-
- [layout ensureLayoutForTextContainer: cocoa_text_container];
-
- return layout;
-}
-
-static NSString * const cocoa_font_families[PLOT_FONT_FAMILY_COUNT] = {
- [PLOT_FONT_FAMILY_SERIF] = @"Times",
- [PLOT_FONT_FAMILY_SANS_SERIF] = @"Helvetica",
- [PLOT_FONT_FAMILY_MONOSPACE] = @"Courier",
- [PLOT_FONT_FAMILY_CURSIVE] = @"Apple Chancery",
- [PLOT_FONT_FAMILY_FANTASY] = @"Marker Felt"
-};
-
-static inline NSFont *cocoa_font_get_nsfont( const plot_font_style_t *style )
-{
- NSFont *font = [NSFont fontWithName: cocoa_font_families[style->family]
- size: (CGFloat)style->size / FONT_SIZE_SCALE];
-
- NSFontTraitMask traits = 0;
- if (style->flags & FONTF_ITALIC || style->flags & FONTF_OBLIQUE) traits |= NSItalicFontMask;
- if (style->flags & FONTF_SMALLCAPS) traits |= NSSmallCapsFontMask;
- if (style->weight > 400) traits |= NSBoldFontMask;
-
- if (0 != traits) {
- NSFontManager *fm = [NSFontManager sharedFontManager];
- font = [fm convertFont: font toHaveTrait: traits];
- }
-
- return font;
-}
-
-static inline NSDictionary *cocoa_font_attributes( const plot_font_style_t *style )
-{
- return [NSDictionary dictionaryWithObjectsAndKeys:
- cocoa_font_get_nsfont( style ), NSFontAttributeName,
- cocoa_convert_colour( style->foreground ), NSForegroundColorAttributeName,
- nil];
-}
diff --git a/frontends/cocoa/gui.h b/frontends/cocoa/gui.h
deleted file mode 100644
index b34e9b702..000000000
--- a/frontends/cocoa/gui.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-extern struct gui_window_table *cocoa_window_table;
-extern struct gui_clipboard_table *cocoa_clipboard_table;
-extern struct gui_misc_table *cocoa_misc_table;
-
-extern NSString * const kCookiesFileOption;
-extern NSString * const kURLsFileOption;
-extern NSString * const kHotlistFileOption;
-extern NSString * const kHomepageURLOption;
-extern NSString * const kOptionsFileOption;
-extern NSString * const kAlwaysCancelDownload;
-extern NSString * const kAlwaysCloseMultipleTabs;
-
-void cocoa_autorelease( void );
-
-nserror cocoa_warning(const char *warning, const char *detail);
diff --git a/frontends/cocoa/gui.m b/frontends/cocoa/gui.m
deleted file mode 100644
index 7e180fa24..000000000
--- a/frontends/cocoa/gui.m
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "utils/nsoption.h"
-#import "utils/utils.h"
-#import "utils/log.h"
-#import "utils/nsurl.h"
-#import "netsurf/mouse.h"
-#import "netsurf/window.h"
-#import "netsurf/misc.h"
-#import "netsurf/browser_window.h"
-#import "netsurf/content.h"
-
-#import "cocoa/gui.h"
-#import "cocoa/coordinates.h"
-#import "cocoa/plotter.h"
-#import "cocoa/BrowserView.h"
-#import "cocoa/BrowserViewController.h"
-#import "cocoa/BrowserWindowController.h"
-#import "cocoa/FormSelectMenu.h"
-#import "cocoa/fetch.h"
-#import "cocoa/schedule.h"
-
-
-NSString * const kCookiesFileOption = @"CookiesFile";
-NSString * const kURLsFileOption = @"URLsFile";
-NSString * const kHotlistFileOption = @"Hotlist";
-NSString * const kHomepageURLOption = @"HomepageURL";
-NSString * const kOptionsFileOption = @"ClassicOptionsFile";
-NSString * const kAlwaysCancelDownload = @"AlwaysCancelDownload";
-NSString * const kAlwaysCloseMultipleTabs = @"AlwaysCloseMultipleTabs";
-
-#define UNIMPL() NSLog( @"Function '%s' unimplemented", __func__ )
-
-struct browser_window;
-
-/* exported function docuemnted in cocoa/gui.h */
-nserror cocoa_warning(const char *warning, const char *detail)
-{
- NSRunAlertPanel( NSLocalizedString( @"Warning",
- @"Warning title" ),
- NSLocalizedString( @"Warning %s%s%s",
- @"Warning message" ),
- NSLocalizedString( @"OK", @"" ), nil, nil,
- warning, detail != NULL ? ": " : "",
- detail != NULL ? detail : "" );
- return NSERROR_OK;
-}
-
-
-static struct gui_window *
-gui_window_create(struct browser_window *bw,
- struct gui_window *existing,
- gui_window_create_flags flags)
-{
- BrowserWindowController *window = nil;
- BrowserViewController *result;
-
- browser_window_set_scale(bw, (float)nsoption_int(scale) / 100, false);
- if (existing != NULL) {
- window = [(BrowserViewController *)(existing) windowController];
- }
-
- result = [[BrowserViewController alloc] initWithBrowser: bw];
-
- if (!(flags & GW_CREATE_TAB) || nil == window) {
- window = [[[BrowserWindowController alloc] init] autorelease];
- [[window window] makeKeyAndOrderFront: nil];
- }
- [window addTab: result];
-
- return (struct gui_window *)result;
-}
-
-static void gui_window_destroy(struct gui_window *g)
-{
- BrowserViewController *vc = (BrowserViewController *)g;
- [vc release];
-}
-
-static void gui_window_set_title(struct gui_window *g, const char *title)
-{
- [(BrowserViewController *)g setTitle: [NSString stringWithUTF8String: title]];
-}
-
-static void gui_window_redraw_window(struct gui_window *g)
-{
- [[(BrowserViewController *)g browserView] setNeedsDisplay: YES];
-}
-
-static void gui_window_update_box(struct gui_window *g, const struct rect *rect)
-{
- const NSRect nsrect = cocoa_scaled_rect_wh(
- browser_window_get_scale([(BrowserViewController *)g browser]),
- rect->x0, rect->y0,
- rect->x1 - rect->x0, rect->y1 - rect->y0 );
- [[(BrowserViewController *)g browserView] setNeedsDisplayInRect: nsrect];
-}
-
-static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
-{
- NSCParameterAssert( g != NULL && sx != NULL && sy != NULL );
-
- NSRect visible = [[(BrowserViewController *)g browserView] visibleRect];
- *sx = cocoa_pt_to_px( NSMinX( visible ) );
- *sy = cocoa_pt_to_px( NSMinY( visible ) );
- return true;
-}
-
-static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
-{
- [[(BrowserViewController *)g browserView] scrollPoint: cocoa_point( sx, sy )];
-}
-
-/**
- * callback from core to reformat a window.
- */
-static void cocoa_window_reformat(struct gui_window *gw)
-{
- if (gw != NULL) {
- [[(BrowserViewController *)gw browserView] reformat ];
- }
-}
-
-
-static void gui_window_get_dimensions(struct gui_window *g,
- int *width, int *height,
- bool scaled)
-{
- NSCParameterAssert( width != NULL && height != NULL );
-
- NSRect frame = [[[(BrowserViewController *)g browserView] superview] frame];
- if (scaled) {
- const CGFloat scale = browser_window_get_scale([(BrowserViewController *)g browser]);
- frame.size.width /= scale;
- frame.size.height /= scale;
- }
- *width = cocoa_pt_to_px( NSWidth( frame ) );
- *height = cocoa_pt_to_px( NSHeight( frame ) );
-}
-
-static void gui_window_update_extent(struct gui_window *g)
-{
- BrowserViewController * const window = (BrowserViewController *)g;
- int width;
- int height;
- struct browser_window *browser = [window browser];
-
- browser_window_get_extents(browser, false, &width, &height);
-
- [[window browserView] setMinimumSize:
- cocoa_scaled_size( browser_window_get_scale(browser), width, height )];
-}
-
-static void gui_window_set_status(struct gui_window *g, const char *text)
-{
- [(BrowserViewController *)g setStatus: [NSString stringWithUTF8String: text]];
-}
-
-static void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
-{
- switch (shape) {
- case GUI_POINTER_DEFAULT:
- case GUI_POINTER_WAIT:
- case GUI_POINTER_PROGRESS:
- [[NSCursor arrowCursor] set];
- break;
-
- case GUI_POINTER_CROSS:
- [[NSCursor crosshairCursor] set];
- break;
-
- case GUI_POINTER_POINT:
- case GUI_POINTER_MENU:
- [[NSCursor pointingHandCursor] set];
- break;
-
- case GUI_POINTER_CARET:
- [[NSCursor IBeamCursor] set];
- break;
-
- case GUI_POINTER_MOVE:
- [[NSCursor closedHandCursor] set];
- break;
-
- default:
- NSLog( @"Other cursor %d requested", shape );
- [[NSCursor arrowCursor] set];
- break;
- }
-}
-
-static nserror gui_window_set_url(struct gui_window *g, struct nsurl *url)
-{
- [(BrowserViewController *)g setUrl: [NSString stringWithUTF8String: nsurl_access(url)]];
- return NSERROR_OK;
-}
-
-static void gui_window_start_throbber(struct gui_window *g)
-{
- [(BrowserViewController *)g setIsProcessing: YES];
- [(BrowserViewController *)g updateBackForward];
-}
-
-static void gui_window_stop_throbber(struct gui_window *g)
-{
- [(BrowserViewController *)g setIsProcessing: NO];
- [(BrowserViewController *)g updateBackForward];
-}
-
-static void gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
-{
- NSBitmapImageRep *bmp = NULL;
- NSImage *image = nil;
-
- if (icon != NULL) {
- bmp = (NSBitmapImageRep *)content_get_bitmap( icon );
- }
-
- if (bmp != nil) {
- image = [[NSImage alloc] initWithSize: NSMakeSize( 32, 32 )];
- [image addRepresentation: bmp];
- } else {
- image = [[NSImage imageNamed: @"NetSurf"] copy];
- }
- [image setFlipped: YES];
-
- [(BrowserViewController *)g setFavicon: image];
- [image release];
-}
-
-static void
-gui_window_place_caret(struct gui_window *g, int x, int y, int height,
- const struct rect *clip)
-{
- [[(BrowserViewController *)g browserView]
- addCaretAt: cocoa_point( x, y )
- height: cocoa_px_to_pt( height )];
-}
-
-static void gui_window_remove_caret(struct gui_window *g)
-{
- [[(BrowserViewController *)g browserView] removeCaret];
-}
-
-static void gui_window_new_content(struct gui_window *g)
-{
- [(BrowserViewController *)g contentUpdated];
-}
-
-
-static void gui_create_form_select_menu(struct gui_window *g,
- struct form_control *control)
-{
- BrowserViewController * const window = (BrowserViewController *)g;
- FormSelectMenu *menu = [[FormSelectMenu alloc]
- initWithControl: control
- forWindow: [window browser]];
- [menu runInView: [window browserView]];
- [menu release];
-}
-
-static nserror gui_launch_url(nsurl *url)
-{
- [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: [NSString stringWithUTF8String: nsurl_access(url)]]];
- return NSERROR_OK;
-}
-
-struct ssl_cert_info;
-
-static nserror
-gui_cert_verify(nsurl *url,
- const struct ssl_cert_info *certs,
- unsigned long num,
- nserror (*cb)(bool proceed,void *pw), void *cbpw)
-{
- return NSERROR_NOT_IMPLEMENTED;
-}
-
-
-static struct gui_window_table window_table = {
- .create = gui_window_create,
- .destroy = gui_window_destroy,
- .redraw = gui_window_redraw_window,
- .update = gui_window_update_box,
- .get_scroll = gui_window_get_scroll,
- .set_scroll = gui_window_set_scroll,
- .get_dimensions = gui_window_get_dimensions,
- .update_extent = gui_window_update_extent,
- .reformat = cocoa_window_reformat,
-
- .set_title = gui_window_set_title,
- .set_url = gui_window_set_url,
- .set_icon = gui_window_set_icon,
- .set_status = gui_window_set_status,
- .set_pointer = gui_window_set_pointer,
- .place_caret = gui_window_place_caret,
- .remove_caret = gui_window_remove_caret,
- .new_content = gui_window_new_content,
- .start_throbber = gui_window_start_throbber,
- .stop_throbber = gui_window_stop_throbber,
- .create_form_select_menu = gui_create_form_select_menu,
-};
-
-struct gui_window_table *cocoa_window_table = &window_table;
-
-
-static struct gui_misc_table browser_table = {
- .schedule = cocoa_schedule,
- .warning = cocoa_warning,
-
- .launch_url = gui_launch_url,
- .cert_verify = gui_cert_verify,
-};
-
-struct gui_misc_table *cocoa_misc_table = &browser_table;
diff --git a/frontends/cocoa/plotter.h b/frontends/cocoa/plotter.h
deleted file mode 100644
index ce4865336..000000000
--- a/frontends/cocoa/plotter.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef COCOA_PLOTTER_H
-#define COCOA_PLOTTER_H
-
-#import <Cocoa/Cocoa.h>
-#import "netsurf/plot_style.h"
-
-extern const struct plotter_table cocoa_plotters;
-
-NSColor *cocoa_convert_colour( colour clr );
-
-void cocoa_update_scale_factor( void );
-
-void cocoa_set_clip( NSRect rect );
-
-#endif
diff --git a/frontends/cocoa/plotter.m b/frontends/cocoa/plotter.m
deleted file mode 100644
index dea3245bb..000000000
--- a/frontends/cocoa/plotter.m
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <Cocoa/Cocoa.h>
-
-#import "utils/log.h"
-#import "utils/utils.h"
-#import "netsurf/browser_window.h"
-#import "netsurf/plotters.h"
-
-#import "cocoa/font.h"
-#import "cocoa/coordinates.h"
-#import "cocoa/plotter.h"
-#import "cocoa/bitmap.h"
-
-static void cocoa_plot_render_path(NSBezierPath *path,const plot_style_t *pstyle);
-static void cocoa_plot_path_set_stroke_pattern(NSBezierPath *path,const plot_style_t *pstyle);
-static inline void cocoa_center_pixel( bool x, bool y );
-
-static NSRect cocoa_plot_clip_rect;
-
-#define colour_red_component( c ) (((c) >> 0) & 0xFF)
-#define colour_green_component( c ) (((c) >> 8) & 0xFF)
-#define colour_blue_component( c ) (((c) >> 16) & 0xFF)
-#define colour_alpha_component( c ) (((c) >> 24) & 0xFF)
-#define colour_from_rgba( r, g, b, a) ((((colour)(r)) << 0) | \
- (((colour)(g)) << 8) | \
- (((colour)(b)) << 16) | \
- (((colour)(a)) << 24))
-#define colour_from_rgb( r, g, b ) colour_from_rgba( (r), (g), (b), 0xFF )
-
-NSColor *cocoa_convert_colour( colour clr )
-{
- return [NSColor colorWithDeviceRed: (float)colour_red_component( clr ) / 0xFF
- green: (float)colour_green_component( clr ) / 0xFF
- blue: (float)colour_blue_component( clr ) / 0xFF
- alpha: 1.0];
-}
-
-static void cocoa_plot_path_set_stroke_pattern(NSBezierPath *path,const plot_style_t *pstyle)
-{
- static const CGFloat dashed_pattern[2] = { 5.0, 2.0 };
- static const CGFloat dotted_pattern[2] = { 2.0, 2.0 };
-
- switch (pstyle->stroke_type) {
- case PLOT_OP_TYPE_DASH:
- [path setLineDash: dashed_pattern count: 2 phase: 0];
- break;
-
- case PLOT_OP_TYPE_DOT:
- [path setLineDash: dotted_pattern count: 2 phase: 0];
- break;
-
- default:
- // ignore
- break;
- }
-
- [path setLineWidth: cocoa_px_to_pt( pstyle->stroke_width > 0 ? pstyle->stroke_width : 1 )];
-}
-
-static bool plot_line(int x0, int y0, int x1, int y1, const plot_style_t *pstyle)
-{
- if (pstyle->stroke_type == PLOT_OP_TYPE_NONE) return true;
-
- [NSGraphicsContext saveGraphicsState];
- [NSBezierPath clipRect: cocoa_plot_clip_rect];
-
- NSBezierPath *path = [NSBezierPath bezierPath];
- [path moveToPoint: cocoa_point( x0, y0 )];
- [path lineToPoint: cocoa_point( x1, y1 )];
- cocoa_plot_path_set_stroke_pattern( path, pstyle );
-
- const bool horizontal = y0 == y1;
- const bool vertical = x0 == x1;
- const bool oddThickness = pstyle->stroke_width != 0 ? (pstyle->stroke_width % 2) != 0 : true;
-
- if (oddThickness) cocoa_center_pixel( !horizontal, !vertical );
-
- [cocoa_convert_colour( pstyle->stroke_colour ) set];
- [path stroke];
-
- [NSGraphicsContext restoreGraphicsState];
-
- return true;
-}
-
-static bool plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *pstyle)
-{
- NSRect rect = cocoa_rect( x0, y0, x1, y1 );
- NSBezierPath *path = [NSBezierPath bezierPathWithRect: rect];
- cocoa_plot_render_path( path, pstyle );
-
- return true;
-}
-
-static bool plot_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle)
-{
- [NSGraphicsContext saveGraphicsState];
- [NSBezierPath clipRect: cocoa_plot_clip_rect];
-
- cocoa_draw_string( cocoa_px_to_pt( x ), cocoa_px_to_pt( y ), text, length, fstyle );
-
- [NSGraphicsContext restoreGraphicsState];
-
- return true;
-}
-
-void cocoa_set_clip( NSRect rect )
-{
- cocoa_plot_clip_rect = rect;
-}
-
-static bool plot_clip(const struct rect *clip)
-{
- cocoa_plot_clip_rect = cocoa_rect( clip->x0, clip->y0, clip->x1, clip->y1 );
- return true;
-}
-
-void cocoa_plot_render_path(NSBezierPath *path,const plot_style_t *pstyle)
-{
- [NSGraphicsContext saveGraphicsState];
- [NSBezierPath clipRect: cocoa_plot_clip_rect];
-
- if (pstyle->fill_type != PLOT_OP_TYPE_NONE) {
- [cocoa_convert_colour( pstyle->fill_colour ) setFill];
- [path fill];
- }
-
- if (pstyle->stroke_type != PLOT_OP_TYPE_NONE) {
- if (pstyle->stroke_width == 0 || pstyle->stroke_width % 2 != 0) cocoa_center_pixel( true, true );
-
- cocoa_plot_path_set_stroke_pattern(path,pstyle);
-
- [cocoa_convert_colour( pstyle->stroke_colour ) set];
-
- [path stroke];
- }
-
- [NSGraphicsContext restoreGraphicsState];
-}
-
-static bool plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *pstyle)
-{
- NSBezierPath *path = [NSBezierPath bezierPath];
- [path appendBezierPathWithArcWithCenter: NSMakePoint( x, y ) radius: radius
- startAngle: angle1 endAngle: angle2
- clockwise: NO];
-
- cocoa_plot_render_path( path, pstyle);
-
- return true;
-}
-
-static bool plot_disc(int x, int y, int radius, const plot_style_t *pstyle)
-{
- NSBezierPath *path = [NSBezierPath bezierPathWithOvalInRect:
- NSMakeRect( x - radius, y-radius, 2*radius, 2*radius )];
-
- cocoa_plot_render_path( path, pstyle );
-
- return true;
-}
-
-static bool plot_polygon(const int *p, unsigned int n, const plot_style_t *pstyle)
-{
- if (n <= 1) return true;
-
- NSBezierPath *path = [NSBezierPath bezierPath];
- [path moveToPoint: cocoa_point( p[0], p[1] )];
- for (unsigned i = 1; i < n; i++) {
- [path lineToPoint: cocoa_point( p[2*i], p[2*i+1] )];
- }
- [path closePath];
-
- cocoa_plot_render_path( path, pstyle );
-
- return true;
-}
-
-/* complex path (for SVG) */
-static bool plot_path(const float *p, unsigned int n, colour fill, float width,
- colour c, const float transform[6])
-{
- if (n == 0) return true;
-
- if (*p != PLOTTER_PATH_MOVE) {
- LOG("Path does not start with move");
- return false;
- }
-
- NSBezierPath *path = [NSBezierPath bezierPath];
-
-#define NEXT_POINT() NSMakePoint( *p++, *p++ )
-
- while (n--) {
- switch ((int)*p++) {
- case PLOTTER_PATH_MOVE: {
- const NSPoint pt = NEXT_POINT();
- [path moveToPoint: pt];
- break;
- }
-
- case PLOTTER_PATH_LINE: {
- const NSPoint pt = NEXT_POINT();
- [path lineToPoint: pt];
- break;
- }
-
- case PLOTTER_PATH_BEZIER: {
- const NSPoint cp1 = NEXT_POINT();
- const NSPoint cp2 = NEXT_POINT();
- const NSPoint ep = NEXT_POINT();
- [path curveToPoint: ep controlPoint1: cp1 controlPoint2: cp2];
- break;
- }
-
- case PLOTTER_PATH_CLOSE:
- [path closePath];
- break;
-
- default:
- LOG("Invalid path");
- return false;
- }
- }
-
-#undef NEXT_POINT
-
- [path setLineWidth: width];
-
- CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
- CGContextSaveGState( context );
-
- CGContextClipToRect( context, NSRectToCGRect( cocoa_plot_clip_rect ) );
-
- CGContextConcatCTM( context, CGAffineTransformMake( transform[0], transform[1], transform[2],
- transform[3], transform[4], transform[5] ) );
-
- if (fill != NS_TRANSPARENT) {
- [cocoa_convert_colour( fill ) setFill];
- [path fill];
- }
-
- if (c != NS_TRANSPARENT) {
- cocoa_center_pixel( true, true );
- [cocoa_convert_colour( c ) set];
- [path stroke];
- }
-
- CGContextRestoreGState( context );
-
- return true;
-}
-
-/* Image */
-static bool plot_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags)
-{
- CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
- CGContextSaveGState( context );
-
- CGContextClipToRect( context, NSRectToCGRect( cocoa_plot_clip_rect ) );
-
- const bool tileX = flags & BITMAPF_REPEAT_X;
- const bool tileY = flags & BITMAPF_REPEAT_Y;
-
- CGImageRef img = cocoa_get_cgimage( bitmap );
-
- CGRect rect = NSRectToCGRect( cocoa_rect_wh( x, y, width, height ) );
-
- if (tileX || tileY) {
- CGContextDrawTiledImage( context, rect, img );
- } else {
- CGContextDrawImage( context, rect, img );
- }
-
- CGContextRestoreGState( context );
-
- return true;
-}
-
-const struct plotter_table cocoa_plotters = {
- .clip = plot_clip,
- .arc = plot_arc,
- .disc = plot_disc,
- .rectangle = plot_rectangle,
- .line = plot_line,
- .polygon = plot_polygon,
-
- .path = plot_path,
-
- .bitmap = plot_bitmap,
-
- .text = plot_text,
-
- .option_knockout = true
-};
-
-
-CGFloat cocoa_scale_factor;
-static const CGFloat points_per_inch = 72.0;
-static CGFloat cocoa_half_pixel;
-
-void cocoa_update_scale_factor( void )
-{
- const CGFloat scale = [[NSScreen mainScreen] userSpaceScaleFactor];
- cocoa_scale_factor = scale == 1.0 ? 1.0 : 1.0 / scale;
- cocoa_half_pixel = 0.5 * cocoa_scale_factor;
- browser_set_dpi( points_per_inch * scale );
-}
-
-static inline void cocoa_center_pixel( bool x, bool y )
-{
- NSAffineTransform *transform = [NSAffineTransform transform];
- [transform translateXBy: x ? cocoa_half_pixel : 0.0 yBy: y ? cocoa_half_pixel : 0.0];
- [transform concat];
-}
diff --git a/frontends/cocoa/res/BookmarksWindow.xib b/frontends/cocoa/res/BookmarksWindow.xib
deleted file mode 100644
index b038e6ca1..000000000
--- a/frontends/cocoa/res/BookmarksWindow.xib
+++ /dev/null
@@ -1,610 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
- <data>
- <int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">10J567</string>
- <string key="IBDocument.InterfaceBuilderVersion">804</string>
- <string key="IBDocument.AppKitVersion">1038.35</string>
- <string key="IBDocument.HIToolboxVersion">462.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">804</string>
- </object>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="1"/>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1001">
- <string key="NSClassName">BookmarksController</string>
- </object>
- <object class="NSCustomObject" id="1003">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1004">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSWindowTemplate" id="1005">
- <int key="NSWindowStyleMask">15</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{196, 80}, {350, 400}}</string>
- <int key="NSWTFlags">1618477056</int>
- <string key="NSWindowTitle">Bookmarks</string>
- <string key="NSWindowClass">NSWindow</string>
- <nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
- <string key="NSWindowContentMinSize">{200, 100}</string>
- <object class="NSView" key="NSWindowView" id="1006">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSScrollView" id="79136560">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">274</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSClipView" id="286793088">
- <reference key="NSNextResponder" ref="79136560"/>
- <int key="NSvFlags">2304</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomView" id="347174519">
- <reference key="NSNextResponder" ref="286793088"/>
- <int key="NSvFlags">274</int>
- <string key="NSFrameSize">{350, 360}</string>
- <reference key="NSSuperview" ref="286793088"/>
- <string key="NSClassName">TreeView</string>
- </object>
- </object>
- <string key="NSFrame">{{1, 1}, {350, 360}}</string>
- <reference key="NSSuperview" ref="79136560"/>
- <reference key="NSNextKeyView" ref="347174519"/>
- <reference key="NSDocView" ref="347174519"/>
- <object class="NSColor" key="NSBGColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
- </object>
- </object>
- <int key="NScvFlags">4</int>
- </object>
- <object class="NSScroller" id="343618412">
- <reference key="NSNextResponder" ref="79136560"/>
- <int key="NSvFlags">-2147483392</int>
- <string key="NSFrame">{{353, 1}, {15, 313}}</string>
- <reference key="NSSuperview" ref="79136560"/>
- <reference key="NSTarget" ref="79136560"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSCurValue">1</double>
- <double key="NSPercent">0.96363627910614014</double>
- </object>
- <object class="NSScroller" id="885399726">
- <reference key="NSNextResponder" ref="79136560"/>
- <int key="NSvFlags">-2147483392</int>
- <string key="NSFrame">{{1, 314}, {352, 15}}</string>
- <reference key="NSSuperview" ref="79136560"/>
- <int key="NSsFlags">1</int>
- <reference key="NSTarget" ref="79136560"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.50602412223815918</double>
- </object>
- </object>
- <string key="NSFrame">{{-1, 39}, {352, 362}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <reference key="NSNextKeyView" ref="286793088"/>
- <int key="NSsFlags">562</int>
- <reference key="NSVScroller" ref="343618412"/>
- <reference key="NSHScroller" ref="885399726"/>
- <reference key="NSContentView" ref="286793088"/>
- </object>
- <object class="NSButton" id="1013386414">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">292</int>
- <string key="NSFrame">{{7, 7}, {29, 25}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="1030859690">
- <int key="NSCellFlags">-2080244224</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents"/>
- <object class="NSFont" key="NSSupport" id="1037042855">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">13</double>
- <int key="NSfFlags">1044</int>
- </object>
- <reference key="NSControlView" ref="1013386414"/>
- <int key="NSButtonFlags">-2033958657</int>
- <int key="NSButtonFlags2">163</int>
- <object class="NSCustomResource" key="NSNormalImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSAddTemplate</string>
- </object>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">400</int>
- <int key="NSPeriodicInterval">75</int>
- </object>
- </object>
- <object class="NSButton" id="812276353">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">292</int>
- <string key="NSFrame">{{43, 7}, {29, 25}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="142633288">
- <int key="NSCellFlags">-2080244224</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents"/>
- <reference key="NSSupport" ref="1037042855"/>
- <reference key="NSControlView" ref="812276353"/>
- <int key="NSButtonFlags">-2033958657</int>
- <int key="NSButtonFlags2">163</int>
- <object class="NSCustomResource" key="NSNormalImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSRemoveTemplate</string>
- </object>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">400</int>
- <int key="NSPeriodicInterval">75</int>
- </object>
- </object>
- <object class="NSButton" id="482147213">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">292</int>
- <string key="NSFrame">{{80, 7}, {38, 25}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="586666285">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents">Edit</string>
- <reference key="NSSupport" ref="1037042855"/>
- <reference key="NSControlView" ref="482147213"/>
- <int key="NSButtonFlags">-2038152961</int>
- <int key="NSButtonFlags2">163</int>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">400</int>
- <int key="NSPeriodicInterval">75</int>
- </object>
- </object>
- </object>
- <string key="NSFrameSize">{350, 400}</string>
- <reference key="NSSuperview"/>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
- <string key="NSMinSize">{200, 122}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
- <bool key="NSAutorecalculatesContentBorderThicknessMinY">NO</bool>
- <double key="NSContentBorderThicknessMinY">39</double>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="1005"/>
- </object>
- <int key="connectionID">3</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">view</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="347174519"/>
- </object>
- <int key="connectionID">8</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">addFolder:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="1013386414"/>
- </object>
- <int key="connectionID">17</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">deleteSelected:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="812276353"/>
- </object>
- <int key="connectionID">18</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">editSelected:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="482147213"/>
- </object>
- <int key="connectionID">19</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">initialFirstResponder</string>
- <reference key="source" ref="1005"/>
- <reference key="destination" ref="347174519"/>
- </object>
- <int key="connectionID">20</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <reference key="object" ref="0"/>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1001"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">File's Owner</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1003"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1004"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">1</int>
- <reference key="object" ref="1005"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1006"/>
- </object>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">2</int>
- <reference key="object" ref="1006"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="79136560"/>
- <reference ref="1013386414"/>
- <reference ref="812276353"/>
- <reference ref="482147213"/>
- </object>
- <reference key="parent" ref="1005"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">4</int>
- <reference key="object" ref="79136560"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="343618412"/>
- <reference ref="885399726"/>
- <reference ref="347174519"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5</int>
- <reference key="object" ref="343618412"/>
- <reference key="parent" ref="79136560"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">6</int>
- <reference key="object" ref="885399726"/>
- <reference key="parent" ref="79136560"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">7</int>
- <reference key="object" ref="347174519"/>
- <reference key="parent" ref="79136560"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">11</int>
- <reference key="object" ref="1013386414"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1030859690"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">12</int>
- <reference key="object" ref="1030859690"/>
- <reference key="parent" ref="1013386414"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">13</int>
- <reference key="object" ref="812276353"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="142633288"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">14</int>
- <reference key="object" ref="142633288"/>
- <reference key="parent" ref="812276353"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">15</int>
- <reference key="object" ref="482147213"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="586666285"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">16</int>
- <reference key="object" ref="586666285"/>
- <reference key="parent" ref="482147213"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>1.IBEditorWindowLastContentRect</string>
- <string>1.IBPluginDependency</string>
- <string>1.IBWindowTemplateEditedContentRect</string>
- <string>1.NSWindowTemplate.visibleAtLaunch</string>
- <string>1.WindowOrigin</string>
- <string>1.editorWindowContentRectSynchronizationRect</string>
- <string>1.windowTemplate.hasMinSize</string>
- <string>1.windowTemplate.minSize</string>
- <string>11.IBPluginDependency</string>
- <string>11.IBViewBoundsToFrameTransform</string>
- <string>12.IBPluginDependency</string>
- <string>13.IBPluginDependency</string>
- <string>13.IBViewBoundsToFrameTransform</string>
- <string>14.IBPluginDependency</string>
- <string>15.IBPluginDependency</string>
- <string>15.IBViewBoundsToFrameTransform</string>
- <string>16.IBPluginDependency</string>
- <string>2.IBPluginDependency</string>
- <string>4.IBPluginDependency</string>
- <string>4.IBViewBoundsToFrameTransform</string>
- <string>5.IBPluginDependency</string>
- <string>6.IBPluginDependency</string>
- <string>7.IBPluginDependency</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>{{226, 417}, {350, 400}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{226, 417}, {350, 400}}</string>
- <integer value="1"/>
- <string>{196, 240}</string>
- <string>{{202, 428}, {480, 270}}</string>
- <boolean value="YES"/>
- <string>{200, 100}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABAwAAAwfAAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABCJAAAwfAAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABCmAAAwfAAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAAC/gAAAw7eAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">20</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">BookmarksController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>addBookmark:</string>
- <string>addFolder:</string>
- <string>deleteSelected:</string>
- <string>editSelected:</string>
- <string>openBookmarkURL:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>addBookmark:</string>
- <string>addFolder:</string>
- <string>deleteSelected:</string>
- <string>editSelected:</string>
- <string>openBookmarkURL:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">addBookmark:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">addFolder:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">deleteSelected:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">editSelected:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">openBookmarkURL:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>defaultMenu</string>
- <string>view</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSMenu</string>
- <string>TreeView</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>defaultMenu</string>
- <string>view</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">defaultMenu</string>
- <string key="candidateClassName">NSMenu</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">view</string>
- <string key="candidateClassName">TreeView</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">BookmarksController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabDragAssistant.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarCell.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarControl.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">ScrollableView</string>
- <string key="superclassName">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">ScrollableView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">TreeView</string>
- <string key="superclassName">ScrollableView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">TreeView.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
- <integer value="3000" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">../NetSurf.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSAddTemplate</string>
- <string>NSRemoveTemplate</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>{8, 8}</string>
- <string>{8, 8}</string>
- </object>
- </object>
- </data>
-</archive>
diff --git a/frontends/cocoa/res/Browser.xib b/frontends/cocoa/res/Browser.xib
deleted file mode 100644
index 35ff885b5..000000000
--- a/frontends/cocoa/res/Browser.xib
+++ /dev/null
@@ -1,399 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
- <data>
- <int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10J567</string>
- <string key="IBDocument.InterfaceBuilderVersion">804</string>
- <string key="IBDocument.AppKitVersion">1038.35</string>
- <string key="IBDocument.HIToolboxVersion">462.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">804</string>
- </object>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="41"/>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1001">
- <string key="NSClassName">BrowserViewController</string>
- </object>
- <object class="NSCustomObject" id="1003">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1004">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSView" id="716999560">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">274</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSScrollView" id="140458632">
- <reference key="NSNextResponder" ref="716999560"/>
- <int key="NSvFlags">274</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSClipView" id="461870317">
- <reference key="NSNextResponder" ref="140458632"/>
- <int key="NSvFlags">2304</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomView" id="623715071">
- <reference key="NSNextResponder" ref="461870317"/>
- <int key="NSvFlags">274</int>
- <string key="NSFrameSize">{691, 631}</string>
- <reference key="NSSuperview" ref="461870317"/>
- <string key="NSClassName">BrowserView</string>
- </object>
- </object>
- <string key="NSFrame">{{1, 1}, {691, 631}}</string>
- <reference key="NSSuperview" ref="140458632"/>
- <reference key="NSNextKeyView" ref="623715071"/>
- <reference key="NSDocView" ref="623715071"/>
- <object class="NSColor" key="NSBGColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
- </object>
- </object>
- <int key="NScvFlags">4</int>
- </object>
- <object class="NSScroller" id="411009984">
- <reference key="NSNextResponder" ref="140458632"/>
- <int key="NSvFlags">-2147483392</int>
- <string key="NSFrame">{{677, 1}, {15, 616}}</string>
- <reference key="NSSuperview" ref="140458632"/>
- <reference key="NSTarget" ref="140458632"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSCurValue">1</double>
- <double key="NSPercent">0.96363627910614014</double>
- </object>
- <object class="NSScroller" id="17116469">
- <reference key="NSNextResponder" ref="140458632"/>
- <int key="NSvFlags">-2147483392</int>
- <string key="NSFrame">{{1, 617}, {676, 15}}</string>
- <reference key="NSSuperview" ref="140458632"/>
- <int key="NSsFlags">1</int>
- <reference key="NSTarget" ref="140458632"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.50602412223815918</double>
- </object>
- </object>
- <string key="NSFrame">{{-1, 0}, {693, 633}}</string>
- <reference key="NSSuperview" ref="716999560"/>
- <reference key="NSNextKeyView" ref="461870317"/>
- <int key="NSsFlags">562</int>
- <reference key="NSVScroller" ref="411009984"/>
- <reference key="NSHScroller" ref="17116469"/>
- <reference key="NSContentView" ref="461870317"/>
- </object>
- </object>
- <string key="NSFrameSize">{691, 632}</string>
- <reference key="NSSuperview"/>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">view</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="716999560"/>
- </object>
- <int key="connectionID">52</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">browserView</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="623715071"/>
- </object>
- <int key="connectionID">53</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <reference key="object" ref="0"/>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1001"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">File's Owner</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1003"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1004"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">41</int>
- <reference key="object" ref="716999560"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="140458632"/>
- </object>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">44</int>
- <reference key="object" ref="140458632"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="623715071"/>
- <reference ref="17116469"/>
- <reference ref="411009984"/>
- </object>
- <reference key="parent" ref="716999560"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">45</int>
- <reference key="object" ref="623715071"/>
- <reference key="parent" ref="140458632"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">46</int>
- <reference key="object" ref="17116469"/>
- <reference key="parent" ref="140458632"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">47</int>
- <reference key="object" ref="411009984"/>
- <reference key="parent" ref="140458632"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>41.IBEditorWindowLastContentRect</string>
- <string>41.IBPluginDependency</string>
- <string>44.IBPluginDependency</string>
- <string>44.IBViewBoundsToFrameTransform</string>
- <string>45.IBPluginDependency</string>
- <string>46.IBPluginDependency</string>
- <string>47.IBPluginDependency</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>{{290, 199}, {691, 632}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAAC/gAAAw5EAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">53</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">BrowserView</string>
- <string key="superclassName">ScrollableView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">BrowserView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BrowserViewController</string>
- <string key="superclassName">NSViewController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>goBack:</string>
- <string>goForward:</string>
- <string>navigate:</string>
- <string>reloadPage:</string>
- <string>stopLoading:</string>
- <string>zoomIn:</string>
- <string>zoomOriginal:</string>
- <string>zoomOut:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>goBack:</string>
- <string>goForward:</string>
- <string>navigate:</string>
- <string>reloadPage:</string>
- <string>stopLoading:</string>
- <string>zoomIn:</string>
- <string>zoomOriginal:</string>
- <string>zoomOut:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">goBack:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">goForward:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">navigate:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">reloadPage:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">stopLoading:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">zoomIn:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">zoomOriginal:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">zoomOut:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">browserView</string>
- <string key="NS.object.0">BrowserView</string>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <string key="NS.key.0">browserView</string>
- <object class="IBToOneOutletInfo" key="NS.object.0">
- <string key="name">browserView</string>
- <string key="candidateClassName">BrowserView</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">BrowserViewController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabDragAssistant.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarCell.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarControl.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">ScrollableView</string>
- <string key="superclassName">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">ScrollableView.h</string>
- </object>
- </object>
- </object>
- <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Print.framework/Headers/PDEPluginInterface.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
- <integer value="1050" key="NS.object.0"/>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
- <integer value="3000" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">../NetSurf.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- </data>
-</archive>
diff --git a/frontends/cocoa/res/BrowserWindow.xib b/frontends/cocoa/res/BrowserWindow.xib
deleted file mode 100644
index 982144cb8..000000000
--- a/frontends/cocoa/res/BrowserWindow.xib
+++ /dev/null
@@ -1,1395 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
- <data>
- <int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">9L31a</string>
- <string key="IBDocument.InterfaceBuilderVersion">680</string>
- <string key="IBDocument.AppKitVersion">949.54</string>
- <string key="IBDocument.HIToolboxVersion">353.00</string>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="1" id="9"/>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1001">
- <string key="NSClassName">BrowserWindowController</string>
- </object>
- <object class="NSCustomObject" id="1003">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1004">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSWindowTemplate" id="1005">
- <int key="NSWindowStyleMask">4111</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{139, 364}, {774, 554}}</string>
- <int key="NSWTFlags">1618477056</int>
- <string key="NSWindowTitle">NetSurf</string>
- <string key="NSWindowClass">BrowserWindow</string>
- <object class="NSToolbar" key="NSViewClass" id="71746575">
- <object class="NSMutableString" key="NSToolbarIdentifier">
- <characters key="NS.bytes">8335B5EA-A088-4DE8-BF4F-777E98920BB3</characters>
- </object>
- <nil key="NSToolbarDelegate"/>
- <bool key="NSToolbarPrefersToBeShown">YES</bool>
- <bool key="NSToolbarShowsBaselineSeparator">YES</bool>
- <bool key="NSToolbarAllowsUserCustomization">YES</bool>
- <bool key="NSToolbarAutosavesConfiguration">NO</bool>
- <int key="NSToolbarDisplayMode">2</int>
- <int key="NSToolbarSizeMode">1</int>
- <object class="NSMutableDictionary" key="NSToolbarIBIdentifiedItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>6D497003-6D4B-4335-ADCE-368C7CD87371</string>
- <string>9DB83278-4E60-41F8-8A7C-C0B2E00A552B</string>
- <string>BC5CEBFC-2E3B-420C-A75F-BE0760149C45</string>
- <string>E2E89C48-DD3F-47A5-9E6C-25985A970F69</string>
- <string>NSToolbarCustomizeToolbarItem</string>
- <string>NSToolbarFlexibleSpaceItem</string>
- <string>NSToolbarSeparatorItem</string>
- <string>NSToolbarSpaceItem</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSToolbarItem" id="16676378">
- <object class="NSMutableString" key="NSToolbarItemIdentifier">
- <characters key="NS.bytes">6D497003-6D4B-4335-ADCE-368C7CD87371</characters>
- </object>
- <string key="NSToolbarItemLabel">History</string>
- <string key="NSToolbarItemPaletteLabel">History</string>
- <nil key="NSToolbarItemToolTip"/>
- <object class="NSButton" key="NSToolbarItemView" id="229385913">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{8, 14}, {30, 25}}</string>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="296571644">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents"/>
- <object class="NSFont" key="NSSupport" id="770988704">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">1.300000e+01</double>
- <int key="NSfFlags">1044</int>
- </object>
- <reference key="NSControlView" ref="229385913"/>
- <int key="NSButtonFlags">919355647</int>
- <int key="NSButtonFlags2">163</int>
- <object class="NSCustomResource" key="NSNormalImage" id="235904051">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSIconViewTemplate</string>
- </object>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">400</int>
- <int key="NSPeriodicInterval">75</int>
- </object>
- </object>
- <reference key="NSToolbarItemImage" ref="235904051"/>
- <nil key="NSToolbarItemTarget"/>
- <nil key="NSToolbarItemAction"/>
- <string key="NSToolbarItemMinSize">{22, 25}</string>
- <string key="NSToolbarItemMaxSize">{32, 25}</string>
- <bool key="NSToolbarItemEnabled">YES</bool>
- <bool key="NSToolbarItemAutovalidates">YES</bool>
- <int key="NSToolbarItemTag">0</int>
- <bool key="NSToolbarIsUserRemovable">YES</bool>
- <int key="NSToolbarItemVisibilityPriority">0</int>
- </object>
- <object class="NSToolbarItem" id="694471322">
- <object class="NSMutableString" key="NSToolbarItemIdentifier">
- <characters key="NS.bytes">9DB83278-4E60-41F8-8A7C-C0B2E00A552B</characters>
- </object>
- <string key="NSToolbarItemLabel">Homepage</string>
- <string key="NSToolbarItemPaletteLabel">Homepage</string>
- <nil key="NSToolbarItemToolTip"/>
- <object class="NSButton" key="NSToolbarItemView" id="518219892">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{18, 14}, {30, 25}}</string>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="413663381">
- <int key="NSCellFlags">-2080244224</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents"/>
- <reference key="NSSupport" ref="770988704"/>
- <reference key="NSControlView" ref="518219892"/>
- <int key="NSButtonFlags">-2033434369</int>
- <int key="NSButtonFlags2">99</int>
- <object class="NSCustomResource" key="NSNormalImage" id="967303005">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">HomeTemplate</string>
- </object>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">400</int>
- <int key="NSPeriodicInterval">75</int>
- </object>
- </object>
- <reference key="NSToolbarItemImage" ref="967303005"/>
- <nil key="NSToolbarItemTarget"/>
- <nil key="NSToolbarItemAction"/>
- <string key="NSToolbarItemMinSize">{30, 25}</string>
- <string key="NSToolbarItemMaxSize">{30, 25}</string>
- <bool key="NSToolbarItemEnabled">YES</bool>
- <bool key="NSToolbarItemAutovalidates">YES</bool>
- <int key="NSToolbarItemTag">0</int>
- <bool key="NSToolbarIsUserRemovable">YES</bool>
- <int key="NSToolbarItemVisibilityPriority">0</int>
- </object>
- <object class="NSToolbarItem" id="685547192">
- <object class="NSMutableString" key="NSToolbarItemIdentifier">
- <characters key="NS.bytes">BC5CEBFC-2E3B-420C-A75F-BE0760149C45</characters>
- </object>
- <string key="NSToolbarItemLabel"/>
- <string key="NSToolbarItemPaletteLabel">Back/Forward</string>
- <nil key="NSToolbarItemToolTip"/>
- <object class="NSSegmentedControl" key="NSToolbarItemView" id="692457026">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{7, 14}, {67, 25}}</string>
- <bool key="NSEnabled">YES</bool>
- <object class="NSSegmentedCell" key="NSCell" id="845979064">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">0</int>
- <object class="NSFont" key="NSSupport">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">1.300000e+01</double>
- <int key="NSfFlags">16</int>
- </object>
- <reference key="NSControlView" ref="692457026"/>
- <object class="NSMutableArray" key="NSSegmentImages">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSSegmentItem">
- <double key="NSSegmentItemWidth">3.000000e+01</double>
- <object class="NSCustomResource" key="NSSegmentItemImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSLeftFacingTriangleTemplate</string>
- </object>
- <string key="NSSegmentItemLabel"/>
- <string key="NSSegmentItemTooltip">Back</string>
- <int key="NSSegmentItemImageScaling">0</int>
- </object>
- <object class="NSSegmentItem">
- <double key="NSSegmentItemWidth">3.000000e+01</double>
- <object class="NSCustomResource" key="NSSegmentItemImage">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSRightFacingTriangleTemplate</string>
- </object>
- <string key="NSSegmentItemLabel"/>
- <string key="NSSegmentItemTooltip">Forward</string>
- <int key="NSSegmentItemTag">1</int>
- <int key="NSSegmentItemImageScaling">0</int>
- </object>
- </object>
- <int key="NSSelectedSegment">1</int>
- <int key="NSTrackingMode">2</int>
- <int key="NSSegmentStyle">2</int>
- </object>
- </object>
- <nil key="NSToolbarItemImage"/>
- <nil key="NSToolbarItemTarget"/>
- <nil key="NSToolbarItemAction"/>
- <string key="NSToolbarItemMinSize">{67, 25}</string>
- <string key="NSToolbarItemMaxSize">{71, 25}</string>
- <bool key="NSToolbarItemEnabled">YES</bool>
- <bool key="NSToolbarItemAutovalidates">YES</bool>
- <int key="NSToolbarItemTag">0</int>
- <bool key="NSToolbarIsUserRemovable">YES</bool>
- <int key="NSToolbarItemVisibilityPriority">0</int>
- </object>
- <object class="NSToolbarItem" id="192029103">
- <object class="NSMutableString" key="NSToolbarItemIdentifier">
- <characters key="NS.bytes">E2E89C48-DD3F-47A5-9E6C-25985A970F69</characters>
- </object>
- <string key="NSToolbarItemLabel"/>
- <string key="NSToolbarItemPaletteLabel">URL</string>
- <nil key="NSToolbarItemToolTip"/>
- <object class="NSTextField" key="NSToolbarItemView" id="77748234">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{0, 14}, {96, 22}}</string>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="1053649244">
- <int key="NSCellFlags">-1804468671</int>
- <int key="NSCellFlags2">268436480</int>
- <string key="NSContents"/>
- <reference key="NSSupport" ref="770988704"/>
- <string key="NSPlaceholderString">Open this URL</string>
- <reference key="NSControlView" ref="77748234"/>
- <bool key="NSDrawsBackground">YES</bool>
- <object class="NSColor" key="NSBackgroundColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">textBackgroundColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- </object>
- </object>
- <object class="NSColor" key="NSTextColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">textColor</string>
- <object class="NSColor" key="NSColor" id="733901069">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MAA</bytes>
- </object>
- </object>
- </object>
- </object>
- <nil key="NSToolbarItemImage"/>
- <nil key="NSToolbarItemTarget"/>
- <nil key="NSToolbarItemAction"/>
- <string key="NSToolbarItemMinSize">{96, 22}</string>
- <string key="NSToolbarItemMaxSize">{10000, 22}</string>
- <bool key="NSToolbarItemEnabled">YES</bool>
- <bool key="NSToolbarItemAutovalidates">YES</bool>
- <int key="NSToolbarItemTag">0</int>
- <bool key="NSToolbarIsUserRemovable">YES</bool>
- <int key="NSToolbarItemVisibilityPriority">0</int>
- </object>
- <object class="NSToolbarItem" id="276197344">
- <string key="NSToolbarItemIdentifier">NSToolbarCustomizeToolbarItem</string>
- <string key="NSToolbarItemLabel">Customize</string>
- <string key="NSToolbarItemPaletteLabel">Customize</string>
- <string key="NSToolbarItemToolTip">Customize Toolbar</string>
- <nil key="NSToolbarItemView"/>
- <object class="NSImage" key="NSToolbarItemImage">
- <int key="NSImageFlags">683671552</int>
- <string key="NSSize">{32, 32}</string>
- <object class="NSMutableArray" key="NSReps">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="0" id="8"/>
- <object class="NSBitmapImageRep">
- <object class="NSData" key="NSTIFFRepresentation">
- <bytes key="NS.bytes">TU0AKgAAEAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAICAgbAAAABAAAAAAEBAQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAQEBAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAENDQ0dJSUlW11dXbBpaWnDb29vzyAgIGUPDw8xAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAABsbGyUoKChIHh4ePSkpKUonJycsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwMDCEJCQoWvr6/i9fX1/fX19f7h4eH82dnZ+YODg9sYGBg8
-AAAAAAAAAAAAAAAAAAAAAAAAAAJFRUV6ZGRkvf39/f/+/v7//////0NDQ7QAAAAEAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8PDx9ISEiH2tra8/7+/v/j4+P/2NjY/7a2tv+ysrL/
-i4uL7j09PeUKCgoSAAAAAAAAAAAAAAAAUVFRlo2NjfTIyMj6x8fH/56env97e3v/ISEhMAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPDw8lRUVFjtDQ0Pb+/v7/4eHh/dDQ0P+NjY3/
-Tk5O6yoqKrIfHx+gGhoarCIiImwAAAABAAAAADg4OGWenp7/y8vL/d3d3f+8vLz/hYWF/0RERE0AAAAA
-AAAAAAAAAAAfHx8sAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAj8/P2za2try9/f3/+vr6/7Kysr/
-dnZ2/D4+PvwgICB+EBAQNAICAgcAAAAPERERPQMDAwkQEBASh4eH2MHBwf/o6Oj/39/f/3R0dP88PDxO
-AAAAAAAAAAAAAAAAcnJylkNDQ58HBwcIAAAAAAAAAAAAAAAAAAAAAAAAAAAGBgYMfn5+uMvLy/3Hx8f+
-u7u7/5OTk/9CQkL7HRYL7AICAgQAAAAAAAAAAAAAAAAAAAAAAgICBS4uLjOWlpbz6urq/+7u7v+rq6v/
-IyMj0wAAAAAAAAAAAAAAAIGBgZGLi4v/QkJC2Q0NDSYAAAAAAAAAAAAAAAAAAAAAGRkZJF5eXoylpaXz
-pqam/4qKiv91dXX/YWFh+iwkHvojEADrJhcGoAgICA0AAAAAAAAAAAAAAAAAAAAAPj4+RJaWlvr19fX/
-6+vr/7W1tfVaWlrlAwMDbAAAAACKioqcoqKi/7+/v/9HR0fnDg4OJwAAAAAAAAAAHR0dK3V1dZ+pqanC
-+vr6/9vb2/99fX3+Y2Nj+EhISOgMCAP4JhIA8jgaAPBxNADsNyMMjgcHBwsAAAAAAAAAAAAAAAAMDAwO
-m5ub+Orq6v/y8vL/0NDQ7ICAgMtkZGTqcHBwzLOzs//Pz8//0tLS/0xMTNoJCQkhAAAAABoaGjZ/f3+4
-//////j4+P/9/f3/9vb2/0dHR/8oKCjkKSkpoAQCAJUNBQDXVSgA5XY5AOuTSADcOiUOewYGBgoAAAAA
-AAAAAB4eHmFlZWX76Ojo/+7u7v/5+fn/5OTk9Li4uO3f39//8PDw/+Hh4f/Ly8v/Ozs7rQICAgMAAAAA
-GBgYL3x8fP///////////7S0tP+np6f/QEBA+xUVFXUJCQkkBAQEDgcFA20jEQC7YzIA3n9BAOiiUwDK
-NiMObgYGBgoTExNIOzs74bGxsf3Dw8P/1dXV////////////////////////////8/Pz/3R0dOcPDw9H
-AAAAAQAAAAAAAAAAVVVVooCAgP/v7+//v7+//2VlZf86OjrLAQEBBgAAAAAAAAAAAAAAABENCVctFwCl
-ZTQA1oZFAOCqWgDAMiMTgzExMcKzs7P4wcHB/5+fn//W1tb///////v7+/v//////////729vfOFhYXy
-IyMjdAAAAAMAAAABAAAAAAAAAAAAAAAASkpKmlpaWv+RkZH/Nzc38hgYGG4AAAABAAAAAAAAAAAAAAAA
-AAAAAAsFAEUwGACbaDcAzXpCAOFnRiLjs7Kx+MTExP+pqan/09PT/3p6evpdXV3rbGxs6l1dXfVXV1fs
-UlJSxykpKWMAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAQUFBmiMjI/8cHBysBQUFHQAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAsFAEAuGACfSzAT47y4s/24uLj/lJSU/9TU1P+Dg4PkMzMzzwYGBgw6OjpB
-QEBASQ8PDxYbGxshAAAAAgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIiIimgoKCi4AAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAwJBYS9u7n4r6+v/4GBgf/Pz8//iISB6CYmJqoDAwMK
-AAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAABUwcHB7qurq/9ubm7/zs7O/5yOgPhlPhbf
-MhsCegAAAA0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAwMnCgoKZsvLy++pqan/Wlpa/9LS0v+Nh4Hq
-SCYE4IdDAeSbTgDLNxsAhwAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAwMOxoaGobV1dXzq6ur/0ZGRv/Z2dn/
-hoaGxQkEAIY6HgCyaDMA2YVAAOuWSQDZPh4AngAAABEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgYGFEoKCio0tLS86urq/8xMTH/
-4uLi/4+Pj84AAABIAAAAAg8HAGg6HQDKaDIA4YI+APCVRQDsRSEAuAAAABMAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWFhYrNTU1z9ra2vb8/Pz/
-FxcX/+rq6v+amprZAAAASAAAAAIAAAAAAAAAABAIAIY4GwDiaTEA6X46APeVRAD/SyIA0gAAABIAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgICBT8/P4asrKz3
-0dHR//39/f/z8/P/paWl5gUFBVkAAAACAAAAAAAAAAAAAAAAAAAAABIJAKUxFgD6bTMA9no4AP9uLwD/
-KxIAxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBwcO
-QUFBmpqamv+pqan/+Pj4/7GxsfIXFxeBAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAHAMogDgD/
-WSkA/zwaAPcuEwCyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAEBAQMnJydWUFBQ85aWlvqoqKjfKioqrQEBAQUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAsFAOUXCQD6IA4AwgQCADMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAgICBBR0dHmi4uLnACAgIHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAgDAMwFAgA9AAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE
-AAAACQAAABAAAAAYAAAAIAAAACoAAAAxAAAANgAAADkAAAA4AQEBOQAAAC8AAAAnAAAAHQAAABUAAAAO
-AAAACgAAAAsAAAAPAAAAFwAAACAAAAAqAAAAMQAAADQAAAAzAAAALQAAACQAAAAbAAAAEgAAAAsAAAAA
-AAAAAAAAAAQAAAAJAAAAEAAAABgAAAAgAAAAKgAAADEAAAA2AAAAOQAAADgAAAA1AAAALwAAACcAAAAd
-AAAAFQAAAA4AAAAKAAAACwAAAA8AAAAXAAAAIAAAACoAAAAxAAAANAAAADMAAAAtAAAAJAAAABsAAAAS
-AAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0BAAADAAAAAQAgAAABAQADAAAAAQAgAAABAgADAAAABAAA
-EKoBAwADAAAAAQABAAABBgADAAAAAQACAAABEQAEAAAAAQAAAAgBEgADAAAAAQABAAABFQADAAAAAQAE
-AAABFgADAAAAAQD8AAABFwAEAAAAAQAAEAABHAADAAAAAQABAAABUgADAAAAAQABAAABUwADAAAABAAA
-ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
- </object>
- </object>
- </object>
- </object>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MCAwAA</bytes>
- </object>
- </object>
- <nil key="NSToolbarItemTarget"/>
- <string key="NSToolbarItemAction">runToolbarCustomizationPalette:</string>
- <string key="NSToolbarItemMinSize">{0, 0}</string>
- <string key="NSToolbarItemMaxSize">{0, 0}</string>
- <bool key="NSToolbarItemEnabled">YES</bool>
- <bool key="NSToolbarItemAutovalidates">YES</bool>
- <int key="NSToolbarItemTag">-1</int>
- <bool key="NSToolbarIsUserRemovable">YES</bool>
- <int key="NSToolbarItemVisibilityPriority">0</int>
- </object>
- <object class="NSToolbarFlexibleSpaceItem" id="568640167">
- <string key="NSToolbarItemIdentifier">NSToolbarFlexibleSpaceItem</string>
- <string key="NSToolbarItemLabel"/>
- <string key="NSToolbarItemPaletteLabel">Flexible Space</string>
- <nil key="NSToolbarItemToolTip"/>
- <nil key="NSToolbarItemView"/>
- <nil key="NSToolbarItemImage"/>
- <nil key="NSToolbarItemTarget"/>
- <nil key="NSToolbarItemAction"/>
- <string key="NSToolbarItemMinSize">{1, 5}</string>
- <string key="NSToolbarItemMaxSize">{20000, 32}</string>
- <bool key="NSToolbarItemEnabled">YES</bool>
- <bool key="NSToolbarItemAutovalidates">YES</bool>
- <int key="NSToolbarItemTag">-1</int>
- <bool key="NSToolbarIsUserRemovable">YES</bool>
- <int key="NSToolbarItemVisibilityPriority">0</int>
- <object class="NSMenuItem" key="NSToolbarItemMenuFormRepresentation">
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <object class="NSCustomResource" key="NSOnImage" id="945310746">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSMenuCheckmark</string>
- </object>
- <object class="NSCustomResource" key="NSMixedImage" id="969998504">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSMenuMixedState</string>
- </object>
- </object>
- </object>
- <object class="NSToolbarSeparatorItem" id="1012010237">
- <string key="NSToolbarItemIdentifier">NSToolbarSeparatorItem</string>
- <string key="NSToolbarItemLabel"/>
- <string key="NSToolbarItemPaletteLabel">Separator</string>
- <nil key="NSToolbarItemToolTip"/>
- <nil key="NSToolbarItemView"/>
- <nil key="NSToolbarItemImage"/>
- <nil key="NSToolbarItemTarget"/>
- <nil key="NSToolbarItemAction"/>
- <string key="NSToolbarItemMinSize">{12, 5}</string>
- <string key="NSToolbarItemMaxSize">{12, 1000}</string>
- <bool key="NSToolbarItemEnabled">YES</bool>
- <bool key="NSToolbarItemAutovalidates">YES</bool>
- <int key="NSToolbarItemTag">-1</int>
- <bool key="NSToolbarIsUserRemovable">YES</bool>
- <int key="NSToolbarItemVisibilityPriority">0</int>
- <object class="NSMenuItem" key="NSToolbarItemMenuFormRepresentation">
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="945310746"/>
- <reference key="NSMixedImage" ref="969998504"/>
- </object>
- </object>
- <object class="NSToolbarSpaceItem" id="661775936">
- <string key="NSToolbarItemIdentifier">NSToolbarSpaceItem</string>
- <string key="NSToolbarItemLabel"/>
- <string key="NSToolbarItemPaletteLabel">Space</string>
- <nil key="NSToolbarItemToolTip"/>
- <nil key="NSToolbarItemView"/>
- <nil key="NSToolbarItemImage"/>
- <nil key="NSToolbarItemTarget"/>
- <nil key="NSToolbarItemAction"/>
- <string key="NSToolbarItemMinSize">{32, 5}</string>
- <string key="NSToolbarItemMaxSize">{32, 32}</string>
- <bool key="NSToolbarItemEnabled">YES</bool>
- <bool key="NSToolbarItemAutovalidates">YES</bool>
- <int key="NSToolbarItemTag">-1</int>
- <bool key="NSToolbarIsUserRemovable">YES</bool>
- <int key="NSToolbarItemVisibilityPriority">0</int>
- <object class="NSMenuItem" key="NSToolbarItemMenuFormRepresentation">
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="945310746"/>
- <reference key="NSMixedImage" ref="969998504"/>
- </object>
- </object>
- </object>
- </object>
- <object class="NSArray" key="NSToolbarIBAllowedItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="685547192"/>
- <reference ref="694471322"/>
- <reference ref="16676378"/>
- <reference ref="192029103"/>
- <reference ref="1012010237"/>
- <reference ref="661775936"/>
- <reference ref="568640167"/>
- <reference ref="276197344"/>
- </object>
- <object class="NSMutableArray" key="NSToolbarIBDefaultItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="685547192"/>
- <reference ref="694471322"/>
- <reference ref="16676378"/>
- <reference ref="192029103"/>
- </object>
- <object class="NSMutableArray" key="NSToolbarIBSelectableItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
- <string key="NSWindowContentMinSize">{273, 43}</string>
- <object class="NSView" key="NSWindowView" id="1006">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomView" id="720246950">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">266</int>
- <string key="NSFrame">{{0, 532}, {774, 22}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <string key="NSClassName">PSMTabBarControl</string>
- </object>
- <object class="NSTextField" id="795357547">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">290</int>
- <string key="NSFrame">{{25, 3}, {732, 14}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="717772067">
- <int key="NSCellFlags">68288064</int>
- <int key="NSCellFlags2">272761856</int>
- <string key="NSContents">Status bar</string>
- <object class="NSFont" key="NSSupport">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">1.100000e+01</double>
- <int key="NSfFlags">3100</int>
- </object>
- <reference key="NSControlView" ref="795357547"/>
- <object class="NSColor" key="NSBackgroundColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes>
- </object>
- </object>
- <object class="NSColor" key="NSTextColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlTextColor</string>
- <reference key="NSColor" ref="733901069"/>
- </object>
- </object>
- </object>
- <object class="NSProgressIndicator" id="528651909">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">1316</int>
- <object class="NSPSMatrix" key="NSDrawMatrix"/>
- <string key="NSFrame">{{4, 2}, {16, 16}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <int key="NSpiFlags">28938</int>
- <double key="NSMaxValue">1.000000e+02</double>
- </object>
- <object class="NSTabView" id="477345536">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">18</int>
- <string key="NSFrame">{{0, 20}, {774, 512}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <object class="NSMutableArray" key="NSTabViewItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="NSFont" ref="770988704"/>
- <int key="NSTvFlags">6</int>
- <bool key="NSAllowTruncatedLabels">YES</bool>
- <bool key="NSDrawsBackground">YES</bool>
- </object>
- </object>
- <string key="NSFrameSize">{774, 554}</string>
- <reference key="NSSuperview"/>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
- <string key="NSMinSize">{273, 97}</string>
- <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
- </object>
- <object class="NSObjectController" id="177599630">
- <object class="NSMutableArray" key="NSDeclaredKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>URL</string>
- <string>url</string>
- <string>status</string>
- <string>processing</string>
- <string>title</string>
- <string>isProcessing</string>
- <string>browserView.historyVisible</string>
- </object>
- <string key="NSObjectClassName">BrowserViewController</string>
- <bool key="NSEditable">YES</bool>
- <object class="_NSManagedProxy" key="_NSManagedProxy"/>
- </object>
- <object class="NSMenu" id="237938373">
- <string key="NSTitle">Forward</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <object class="NSMenu" id="353660550">
- <string key="NSTitle">Back</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="1005"/>
- </object>
- <int key="connectionID">18</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="720246950"/>
- <reference key="destination" ref="1001"/>
- </object>
- <int key="connectionID">19</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">tabBar</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="720246950"/>
- </object>
- <int key="connectionID">20</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">tabView</string>
- <reference key="source" ref="720246950"/>
- <reference key="destination" ref="477345536"/>
- </object>
- <int key="connectionID">42</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="477345536"/>
- <reference key="destination" ref="720246950"/>
- </object>
- <int key="connectionID">43</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">tabView</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="477345536"/>
- </object>
- <int key="connectionID">56</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">navigate:</string>
- <reference key="source" ref="1003"/>
- <reference key="destination" ref="192029103"/>
- </object>
- <int key="connectionID">60</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">contentObject: activeBrowser</string>
- <reference key="source" ref="177599630"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="177599630"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">contentObject: activeBrowser</string>
- <string key="NSBinding">contentObject</string>
- <string key="NSKeyPath">activeBrowser</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">62</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: selection.url</string>
- <reference key="source" ref="77748234"/>
- <reference key="destination" ref="177599630"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="77748234"/>
- <reference key="NSDestination" ref="177599630"/>
- <string key="NSLabel">value: selection.url</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">selection.url</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">64</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: selection.status</string>
- <reference key="source" ref="795357547"/>
- <reference key="destination" ref="177599630"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="795357547"/>
- <reference key="NSDestination" ref="177599630"/>
- <string key="NSLabel">value: selection.status</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">selection.status</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">65</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">title: selection.title</string>
- <reference key="source" ref="1005"/>
- <reference key="destination" ref="177599630"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="1005"/>
- <reference key="NSDestination" ref="177599630"/>
- <string key="NSLabel">title: selection.title</string>
- <string key="NSBinding">title</string>
- <string key="NSKeyPath">selection.title</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">67</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="1005"/>
- <reference key="destination" ref="1001"/>
- </object>
- <int key="connectionID">68</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">animate: selection.isProcessing</string>
- <reference key="source" ref="528651909"/>
- <reference key="destination" ref="177599630"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="528651909"/>
- <reference key="NSDestination" ref="177599630"/>
- <string key="NSLabel">animate: selection.isProcessing</string>
- <string key="NSBinding">animate</string>
- <string key="NSKeyPath">selection.isProcessing</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">69</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">urlField</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="1053649244"/>
- </object>
- <int key="connectionID">70</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">backForwardSelected:</string>
- <reference key="source" ref="1003"/>
- <reference key="destination" ref="685547192"/>
- </object>
- <int key="connectionID">74</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: selection.browserView.historyVisible</string>
- <reference key="source" ref="296571644"/>
- <reference key="destination" ref="177599630"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="296571644"/>
- <reference key="NSDestination" ref="177599630"/>
- <string key="NSLabel">value: selection.browserView.historyVisible</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">selection.browserView.historyVisible</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">79</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">activeBrowserController</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="177599630"/>
- </object>
- <int key="connectionID">80</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">navigationControl</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="692457026"/>
- </object>
- <int key="connectionID">81</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">goHome:</string>
- <reference key="source" ref="1003"/>
- <reference key="destination" ref="518219892"/>
- </object>
- <int key="connectionID">85</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">partnerView</string>
- <reference key="source" ref="720246950"/>
- <reference key="destination" ref="477345536"/>
- </object>
- <int key="connectionID">86</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">historyButton</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="229385913"/>
- </object>
- <int key="connectionID">87</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">historyForwardMenu</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="237938373"/>
- </object>
- <int key="connectionID">96</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">historyBackMenu</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="353660550"/>
- </object>
- <int key="connectionID">97</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="237938373"/>
- <reference key="destination" ref="1001"/>
- </object>
- <int key="connectionID">98</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="353660550"/>
- <reference key="destination" ref="1001"/>
- </object>
- <int key="connectionID">99</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <object class="NSArray" key="object" id="209349352">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1001"/>
- <reference key="parent" ref="209349352"/>
- <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1003"/>
- <reference key="parent" ref="209349352"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1004"/>
- <reference key="parent" ref="209349352"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">1</int>
- <reference key="object" ref="1005"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1006"/>
- <reference ref="71746575"/>
- </object>
- <reference key="parent" ref="209349352"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">2</int>
- <reference key="object" ref="1006"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="528651909"/>
- <reference ref="795357547"/>
- <reference ref="720246950"/>
- <reference ref="477345536"/>
- </object>
- <reference key="parent" ref="1005"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">26</int>
- <reference key="object" ref="795357547"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="717772067"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">27</int>
- <reference key="object" ref="717772067"/>
- <reference key="parent" ref="795357547"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">28</int>
- <reference key="object" ref="528651909"/>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">3</int>
- <reference key="object" ref="720246950"/>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">37</int>
- <reference key="object" ref="477345536"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">44</int>
- <reference key="object" ref="71746575"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="192029103"/>
- <reference ref="1012010237"/>
- <reference ref="276197344"/>
- <reference ref="568640167"/>
- <reference ref="661775936"/>
- <reference ref="685547192"/>
- <reference ref="16676378"/>
- <reference ref="694471322"/>
- </object>
- <reference key="parent" ref="1005"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">49</int>
- <reference key="object" ref="192029103"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="77748234"/>
- </object>
- <reference key="parent" ref="71746575"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">50</int>
- <reference key="object" ref="1012010237"/>
- <reference key="parent" ref="71746575"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">51</int>
- <reference key="object" ref="276197344"/>
- <reference key="parent" ref="71746575"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">52</int>
- <reference key="object" ref="568640167"/>
- <reference key="parent" ref="71746575"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">53</int>
- <reference key="object" ref="661775936"/>
- <reference key="parent" ref="71746575"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">54</int>
- <reference key="object" ref="77748234"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1053649244"/>
- </object>
- <reference key="parent" ref="192029103"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">55</int>
- <reference key="object" ref="1053649244"/>
- <reference key="parent" ref="77748234"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">61</int>
- <reference key="object" ref="177599630"/>
- <reference key="parent" ref="209349352"/>
- <string key="objectName">Active Browser</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">73</int>
- <reference key="object" ref="685547192"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="692457026"/>
- </object>
- <reference key="parent" ref="71746575"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">71</int>
- <reference key="object" ref="692457026"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="845979064"/>
- </object>
- <reference key="parent" ref="685547192"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">72</int>
- <reference key="object" ref="845979064"/>
- <reference key="parent" ref="692457026"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">77</int>
- <reference key="object" ref="16676378"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="229385913"/>
- </object>
- <reference key="parent" ref="71746575"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">75</int>
- <reference key="object" ref="229385913"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="296571644"/>
- </object>
- <reference key="parent" ref="16676378"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">76</int>
- <reference key="object" ref="296571644"/>
- <reference key="parent" ref="229385913"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">84</int>
- <reference key="object" ref="694471322"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="518219892"/>
- </object>
- <reference key="parent" ref="71746575"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">82</int>
- <reference key="object" ref="518219892"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="413663381"/>
- </object>
- <reference key="parent" ref="694471322"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">83</int>
- <reference key="object" ref="413663381"/>
- <reference key="parent" ref="518219892"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">88</int>
- <reference key="object" ref="237938373"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="parent" ref="209349352"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">92</int>
- <reference key="object" ref="353660550"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="parent" ref="209349352"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>1.IBEditorWindowLastContentRect</string>
- <string>1.IBPluginDependency</string>
- <string>1.IBWindowTemplateEditedContentRect</string>
- <string>1.NSWindowTemplate.visibleAtLaunch</string>
- <string>1.WindowOrigin</string>
- <string>1.editorWindowContentRectSynchronizationRect</string>
- <string>1.windowTemplate.hasMinSize</string>
- <string>1.windowTemplate.minSize</string>
- <string>2.IBPluginDependency</string>
- <string>26.IBPluginDependency</string>
- <string>26.IBViewBoundsToFrameTransform</string>
- <string>27.IBPluginDependency</string>
- <string>28.IBPluginDependency</string>
- <string>28.IBViewBoundsToFrameTransform</string>
- <string>3.IBPluginDependency</string>
- <string>3.IBViewBoundsToFrameTransform</string>
- <string>37.IBPluginDependency</string>
- <string>37.IBViewBoundsToFrameTransform</string>
- <string>44.IBEditorWindowLastContentRect</string>
- <string>44.IBPluginDependency</string>
- <string>50.IBPluginDependency</string>
- <string>51.IBPluginDependency</string>
- <string>52.IBPluginDependency</string>
- <string>53.IBPluginDependency</string>
- <string>54.IBPluginDependency</string>
- <string>55.CustomClassName</string>
- <string>55.IBPluginDependency</string>
- <string>61.IBPluginDependency</string>
- <string>71.IBPluginDependency</string>
- <string>72.IBPluginDependency</string>
- <string>72.IBSegmentedControlInspectorSelectedSegmentMetadataKey</string>
- <string>75.IBAttributePlaceholdersKey</string>
- <string>75.IBPluginDependency</string>
- <string>76.IBPluginDependency</string>
- <string>82.IBAttributePlaceholdersKey</string>
- <string>82.IBPluginDependency</string>
- <string>83.IBPluginDependency</string>
- <string>88.IBPluginDependency</string>
- <string>92.IBPluginDependency</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>{{103, 62}, {774, 554}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{103, 62}, {774, 554}}</string>
- <reference ref="9"/>
- <string>{196, 240}</string>
- <string>{{202, 428}, {480, 270}}</string>
- <boolean value="YES"/>
- <string>{273, 43}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABDCAAAwaAAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABAwAAAwWAAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">AQAAAABEE8AAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABDiwAAxAVAAA</bytes>
- </object>
- <string>{{355, 640}, {616, 0}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>URLFieldCell</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <reference ref="8"/>
- <object class="NSMutableDictionary">
- <string key="NS.key.0">ToolTip</string>
- <object class="IBToolTipAttribute" key="NS.object.0">
- <string key="name">ToolTip</string>
- <reference key="object" ref="229385913"/>
- <string key="toolTip">Show local history</string>
- </object>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSMutableDictionary">
- <string key="NS.key.0">ToolTip</string>
- <object class="IBToolTipAttribute" key="NS.object.0">
- <string key="name">ToolTip</string>
- <reference key="object" ref="518219892"/>
- <string key="toolTip">Go to your homepage</string>
- </object>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">99</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">BrowserView</string>
- <string key="superclassName">ScrollableView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">BrowserView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BrowserViewController</string>
- <string key="superclassName">NSViewController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>backForwardSelected:</string>
- <string>goBack:</string>
- <string>goForward:</string>
- <string>goHome:</string>
- <string>navigate:</string>
- <string>reloadPage:</string>
- <string>stopLoading:</string>
- <string>zoomIn:</string>
- <string>zoomOriginal:</string>
- <string>zoomOut:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">browserView</string>
- <string key="NS.object.0">BrowserView</string>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">BrowserViewController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BrowserWindow</string>
- <string key="superclassName">NSWindow</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">BrowserWindow.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BrowserWindowController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>closeCurrentTab:</string>
- <string>newTab:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>activeBrowserController</string>
- <string>historyBackMenu</string>
- <string>historyButton</string>
- <string>historyForwardMenu</string>
- <string>navigationControl</string>
- <string>tabBar</string>
- <string>tabView</string>
- <string>urlField</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSObjectController</string>
- <string>NSMenu</string>
- <string>NSButton</string>
- <string>NSMenu</string>
- <string>NSSegmentedControl</string>
- <string>PSMTabBarControl</string>
- <string>NSTabView</string>
- <string>URLFieldCell</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">BrowserWindowController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="238543186">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabDragAssistant.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="472370996">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarCell.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="395663776">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarControl.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">PSMTabBarControl</string>
- <reference key="sourceIdentifier" ref="472370996"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">PSMTabBarControl</string>
- <string key="superclassName">NSControl</string>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>delegate</string>
- <string>partnerView</string>
- <string>style</string>
- <string>tabView</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>NSTabView</string>
- </object>
- </object>
- <reference key="sourceIdentifier" ref="395663776"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">PSMTabBarControl</string>
- <reference key="sourceIdentifier" ref="238543186"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">PSMTabBarControl</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabStyle.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">ScrollableView</string>
- <string key="superclassName">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">ScrollableView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">URLFieldCell</string>
- <string key="superclassName">NSTextFieldCell</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">URLFieldCell.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.LastKnownRelativeProjectPath">../NetSurf.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- </data>
-</archive>
diff --git a/frontends/cocoa/res/DownloadWindow.xib b/frontends/cocoa/res/DownloadWindow.xib
deleted file mode 100644
index 039ff1914..000000000
--- a/frontends/cocoa/res/DownloadWindow.xib
+++ /dev/null
@@ -1,493 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
- <data>
- <int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10J567</string>
- <string key="IBDocument.InterfaceBuilderVersion">804</string>
- <string key="IBDocument.AppKitVersion">1038.35</string>
- <string key="IBDocument.HIToolboxVersion">462.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">804</string>
- </object>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="1"/>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1001">
- <string key="NSClassName">DownloadWindowController</string>
- </object>
- <object class="NSCustomObject" id="1003">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1004">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSWindowTemplate" id="1005">
- <int key="NSWindowStyleMask">15</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{196, 429}, {376, 90}}</string>
- <int key="NSWTFlags">544735232</int>
- <string key="NSWindowTitle">Download</string>
- <string key="NSWindowClass">NSWindow</string>
- <nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1000, 90}</string>
- <string key="NSWindowContentMinSize">{330, 90}</string>
- <object class="NSView" key="NSWindowView" id="1006">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSProgressIndicator" id="663127685">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">1290</int>
- <object class="NSPSMatrix" key="NSDrawMatrix"/>
- <string key="NSFrame">{{79, 33}, {279, 20}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <int key="NSpiFlags">16392</int>
- <double key="NSMaxValue">100</double>
- </object>
- <object class="NSImageView" id="454520484">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">268</int>
- <object class="NSMutableSet" key="NSDragTypes">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="set.sortedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>Apple PDF pasteboard type</string>
- <string>Apple PICT pasteboard type</string>
- <string>Apple PNG pasteboard type</string>
- <string>NSFilenamesPboardType</string>
- <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
- <string>NeXT TIFF v4.0 pasteboard type</string>
- </object>
- </object>
- <string key="NSFrame">{{17, 17}, {56, 56}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSImageCell" key="NSCell" id="596224379">
- <int key="NSCellFlags">130560</int>
- <int key="NSCellFlags2">33554432</int>
- <int key="NSAlign">0</int>
- <int key="NSScale">3</int>
- <int key="NSStyle">0</int>
- <bool key="NSAnimates">NO</bool>
- </object>
- <bool key="NSEditable">YES</bool>
- </object>
- <object class="NSTextField" id="355449439">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">266</int>
- <string key="NSFrame">{{78, 56}, {261, 17}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="578533771">
- <int key="NSCellFlags">68288064</int>
- <int key="NSCellFlags2">272630784</int>
- <string key="NSContents">Label</string>
- <object class="NSFont" key="NSSupport">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">13</double>
- <int key="NSfFlags">1044</int>
- </object>
- <reference key="NSControlView" ref="355449439"/>
- <object class="NSColor" key="NSBackgroundColor" id="388192080">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
- </object>
- </object>
- <object class="NSColor" key="NSTextColor" id="1042936865">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlTextColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MAA</bytes>
- </object>
- </object>
- </object>
- </object>
- <object class="NSTextField" id="1027859209">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">266</int>
- <string key="NSFrame">{{78, 17}, {281, 14}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="882473472">
- <int key="NSCellFlags">68288064</int>
- <int key="NSCellFlags2">272761856</int>
- <string key="NSContents">Label</string>
- <object class="NSFont" key="NSSupport">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">11</double>
- <int key="NSfFlags">3100</int>
- </object>
- <reference key="NSControlView" ref="1027859209"/>
- <reference key="NSBackgroundColor" ref="388192080"/>
- <reference key="NSTextColor" ref="1042936865"/>
- </object>
- </object>
- </object>
- <string key="NSFrameSize">{376, 90}</string>
- <reference key="NSSuperview"/>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
- <string key="NSMinSize">{330, 112}</string>
- <string key="NSMaxSize">{1000, 112}</string>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="1005"/>
- </object>
- <int key="connectionID">3</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">maxValue: totalSize</string>
- <reference key="source" ref="663127685"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector" id="721881472">
- <reference key="NSSource" ref="663127685"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">maxValue: totalSize</string>
- <string key="NSBinding">maxValue</string>
- <string key="NSKeyPath">totalSize</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">6</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: receivedSize</string>
- <reference key="source" ref="663127685"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="663127685"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">value: receivedSize</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">receivedSize</string>
- <reference key="NSPreviousConnector" ref="721881472"/>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">7</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: fileName</string>
- <reference key="source" ref="355449439"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="355449439"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">value: fileName</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">fileName</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">22</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: icon</string>
- <reference key="source" ref="454520484"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="454520484"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">value: icon</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">icon</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">23</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: statusText</string>
- <reference key="source" ref="1027859209"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="1027859209"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">value: statusText</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">statusText</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">24</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="1005"/>
- <reference key="destination" ref="1001"/>
- </object>
- <int key="connectionID">25</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <reference key="object" ref="0"/>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1001"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">File's Owner</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1003"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1004"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">1</int>
- <reference key="object" ref="1005"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1006"/>
- </object>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">2</int>
- <reference key="object" ref="1006"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="454520484"/>
- <reference ref="355449439"/>
- <reference ref="1027859209"/>
- <reference ref="663127685"/>
- </object>
- <reference key="parent" ref="1005"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">4</int>
- <reference key="object" ref="663127685"/>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">14</int>
- <reference key="object" ref="454520484"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="596224379"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">15</int>
- <reference key="object" ref="596224379"/>
- <reference key="parent" ref="454520484"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">16</int>
- <reference key="object" ref="355449439"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="578533771"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">17</int>
- <reference key="object" ref="578533771"/>
- <reference key="parent" ref="355449439"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">18</int>
- <reference key="object" ref="1027859209"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="882473472"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">19</int>
- <reference key="object" ref="882473472"/>
- <reference key="parent" ref="1027859209"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>1.IBEditorWindowLastContentRect</string>
- <string>1.IBPluginDependency</string>
- <string>1.IBWindowTemplateEditedContentRect</string>
- <string>1.NSWindowTemplate.visibleAtLaunch</string>
- <string>1.WindowOrigin</string>
- <string>1.editorWindowContentRectSynchronizationRect</string>
- <string>1.windowTemplate.hasMaxSize</string>
- <string>1.windowTemplate.hasMinSize</string>
- <string>1.windowTemplate.maxSize</string>
- <string>1.windowTemplate.minSize</string>
- <string>14.IBPluginDependency</string>
- <string>14.IBViewBoundsToFrameTransform</string>
- <string>15.IBPluginDependency</string>
- <string>16.IBPluginDependency</string>
- <string>16.IBViewBoundsToFrameTransform</string>
- <string>17.IBPluginDependency</string>
- <string>18.IBPluginDependency</string>
- <string>18.IBViewBoundsToFrameTransform</string>
- <string>19.IBPluginDependency</string>
- <string>2.IBPluginDependency</string>
- <string>4.IBPluginDependency</string>
- <string>4.IBViewBoundsToFrameTransform</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>{{305, 231}, {376, 90}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{305, 231}, {376, 90}}</string>
- <integer value="1"/>
- <string>{196, 240}</string>
- <string>{{202, 428}, {480, 270}}</string>
- <boolean value="YES"/>
- <boolean value="YES"/>
- <string>{1000, 90}</string>
- <string>{330, 90}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">AUGIAABBiAAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABCzAAAwo4AAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABCnAAAwgAAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABCngAAwkAAAA</bytes>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">25</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">DownloadWindowController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">DownloadWindowController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabDragAssistant.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarCell.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarControl.h</string>
- </object>
- </object>
- </object>
- <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Print.framework/Headers/PDEPluginInterface.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
- <integer value="1050" key="NS.object.0"/>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
- <integer value="3000" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">../NetSurf.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- </data>
-</archive>
diff --git a/frontends/cocoa/res/HistoryWindow.xib b/frontends/cocoa/res/HistoryWindow.xib
deleted file mode 100644
index a5ec90e1a..000000000
--- a/frontends/cocoa/res/HistoryWindow.xib
+++ /dev/null
@@ -1,338 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
- <data>
- <int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">10J567</string>
- <string key="IBDocument.InterfaceBuilderVersion">804</string>
- <string key="IBDocument.AppKitVersion">1038.35</string>
- <string key="IBDocument.HIToolboxVersion">462.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">804</string>
- </object>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="1"/>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1001">
- <string key="NSClassName">HistoryWindowController</string>
- </object>
- <object class="NSCustomObject" id="1003">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1004">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSWindowTemplate" id="1005">
- <int key="NSWindowStyleMask">15</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{196, 112}, {327, 398}}</string>
- <int key="NSWTFlags">1618477056</int>
- <string key="NSWindowTitle">History</string>
- <string key="NSWindowClass">NSWindow</string>
- <nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
- <object class="NSView" key="NSWindowView" id="1006">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSScrollView" id="329245506">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">274</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSClipView" id="429990844">
- <reference key="NSNextResponder" ref="329245506"/>
- <int key="NSvFlags">2304</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomView" id="920629225">
- <reference key="NSNextResponder" ref="429990844"/>
- <int key="NSvFlags">274</int>
- <string key="NSFrameSize">{312, 383}</string>
- <reference key="NSSuperview" ref="429990844"/>
- <string key="NSClassName">TreeView</string>
- </object>
- </object>
- <string key="NSFrame">{{1, 1}, {312, 383}}</string>
- <reference key="NSSuperview" ref="329245506"/>
- <reference key="NSNextKeyView" ref="920629225"/>
- <reference key="NSDocView" ref="920629225"/>
- <object class="NSColor" key="NSBGColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
- </object>
- </object>
- <int key="NScvFlags">4</int>
- </object>
- <object class="NSScroller" id="909448709">
- <reference key="NSNextResponder" ref="329245506"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{313, 1}, {15, 383}}</string>
- <reference key="NSSuperview" ref="329245506"/>
- <reference key="NSTarget" ref="329245506"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSCurValue">1</double>
- <double key="NSPercent">0.96363627910614014</double>
- </object>
- <object class="NSScroller" id="886582390">
- <reference key="NSNextResponder" ref="329245506"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{1, 384}, {312, 15}}</string>
- <reference key="NSSuperview" ref="329245506"/>
- <int key="NSsFlags">1</int>
- <reference key="NSTarget" ref="329245506"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.50602412223815918</double>
- </object>
- </object>
- <string key="NSFrame">{{-1, -1}, {329, 400}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <reference key="NSNextKeyView" ref="429990844"/>
- <int key="NSsFlags">50</int>
- <reference key="NSVScroller" ref="909448709"/>
- <reference key="NSHScroller" ref="886582390"/>
- <reference key="NSContentView" ref="429990844"/>
- </object>
- </object>
- <string key="NSFrameSize">{327, 398}</string>
- <reference key="NSSuperview"/>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="1005"/>
- </object>
- <int key="connectionID">3</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">view</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="920629225"/>
- </object>
- <int key="connectionID">8</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <reference key="object" ref="0"/>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1001"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">File's Owner</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1003"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1004"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">1</int>
- <reference key="object" ref="1005"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1006"/>
- </object>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">2</int>
- <reference key="object" ref="1006"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="329245506"/>
- </object>
- <reference key="parent" ref="1005"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">4</int>
- <reference key="object" ref="329245506"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="909448709"/>
- <reference ref="886582390"/>
- <reference ref="920629225"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5</int>
- <reference key="object" ref="909448709"/>
- <reference key="parent" ref="329245506"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">6</int>
- <reference key="object" ref="886582390"/>
- <reference key="parent" ref="329245506"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">7</int>
- <reference key="object" ref="920629225"/>
- <reference key="parent" ref="329245506"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>1.IBEditorWindowLastContentRect</string>
- <string>1.IBPluginDependency</string>
- <string>1.IBWindowTemplateEditedContentRect</string>
- <string>1.NSWindowTemplate.visibleAtLaunch</string>
- <string>1.WindowOrigin</string>
- <string>1.editorWindowContentRectSynchronizationRect</string>
- <string>2.IBPluginDependency</string>
- <string>4.IBPluginDependency</string>
- <string>5.IBPluginDependency</string>
- <string>6.IBPluginDependency</string>
- <string>7.IBPluginDependency</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>{{361, 416}, {327, 398}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{361, 416}, {327, 398}}</string>
- <boolean value="NO"/>
- <string>{196, 240}</string>
- <string>{{202, 428}, {480, 270}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">8</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">HistoryWindowController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">view</string>
- <string key="NS.object.0">TreeView</string>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <string key="NS.key.0">view</string>
- <object class="IBToOneOutletInfo" key="NS.object.0">
- <string key="name">view</string>
- <string key="candidateClassName">TreeView</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">HistoryWindowController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabDragAssistant.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarCell.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarControl.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">ScrollableView</string>
- <string key="superclassName">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">ScrollableView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">TreeView</string>
- <string key="superclassName">ScrollableView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">TreeView.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
- <integer value="3000" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">../NetSurf.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- </data>
-</archive>
diff --git a/frontends/cocoa/res/HomeTemplate.pdf b/frontends/cocoa/res/HomeTemplate.pdf
deleted file mode 100644
index 42b88e9eb..000000000
--- a/frontends/cocoa/res/HomeTemplate.pdf
+++ /dev/null
@@ -1,106 +0,0 @@
-%PDF-1.5 %âãÏÓ
-1 0 obj <</Metadata 9 0 R/Pages 2 0 R/Type/Catalog>> endobj 9 0 obj <</Subtype/XML/Length 16417/Type/Metadata>>stream
-<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
-<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.1-c036 46.277092, Fri Feb 23 2007 14:16:18 ">
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
- <rdf:Description rdf:about=""
- xmlns:dc="http://purl.org/dc/elements/1.1/">
- <dc:format>application/pdf</dc:format>
- <dc:title>
- <rdf:Alt>
- <rdf:li xml:lang="x-default">HomeTemplate</rdf:li>
- </rdf:Alt>
- </dc:title>
- </rdf:Description>
- <rdf:Description rdf:about=""
- xmlns:xap="http://ns.adobe.com/xap/1.0/"
- xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/">
- <xap:CreatorTool>Adobe Illustrator CS3</xap:CreatorTool>
- <xap:CreateDate>2011-02-08T14:59:01+01:00</xap:CreateDate>
- <xap:ModifyDate>2011-02-08T14:59:01+01:00</xap:ModifyDate>
- <xap:MetadataDate>2011-02-08T14:59:01+01:00</xap:MetadataDate>
- <xap:Thumbnails>
- <rdf:Alt>
- <rdf:li rdf:parseType="Resource">
- <xapGImg:width>256</xapGImg:width>
- <xapGImg:height>256</xapGImg:height>
- <xapGImg:format>JPEG</xapGImg:format>
- <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f&#xA;Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAEAAwER&#xA;AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA&#xA;AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB&#xA;UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE&#xA;1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ&#xA;qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy&#xA;obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp&#xA;0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo&#xA;+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYq7FXYq7&#xA;FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7F&#xA;XYq7FXYq7FXYq7FXYq7FXYqwz80/zT8uflz5cfVtWf1bqXkmm6ajAS3MoH2V68UWo5vSijxJAKrv&#xA;ys/NPy5+Y3lxNW0l/SuouKalprsDLbSkfZbpyRqHg9KMPAggKszxV2KuxV2KuxV2KuxV2KuxV2Ku&#xA;xV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxVhn5p/mn5c/Lny4+ras/q3UvJNN01G&#xA;AluZQPsr14otRzelFHiSAVXwD5+8/eY/PPmOfXten9W4l+GGFaiKCIElYolJPFVr8ydzUnFXeQfP&#xA;3mPyN5jg17QZ/SuIvhmhapiniJBaKVQRyVqfMHcUIxV9/flZ+aflz8xvLiatpL+ldRcU1LTXYGW2&#xA;lI+y3TkjUPB6UYeBBAVZnirsVflXirsVdirsVfqpirsVdirsVdirsVdirsVdirsVdirsVdirsVdi&#xA;rsVdirsVdirsVdirDPzT/NPy5+XPlx9W1Z/VupeSabpqMBLcygfZXrxRajm9KKPEkAqvgHz95+8x&#xA;+efMc+va9P6txL8MMK1EUEQJKxRKSeKrX5k7mpOKscxV2Ksj8g+fvMfkbzHBr2gz+lcRfDNC1TFP&#xA;ESC0UqgjkrU+YO4oRir7+/Kz80/Ln5jeXE1bSX9K6i4pqWmuwMttKR9lunJGoeD0ow8CCAqzPFX5&#xA;V4q7FXYq7FX6qYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FWGfmn+aflz8ufL&#xA;j6tqz+rdS8k03TUYCW5lA+yvXii1HN6UUeJIBVfAPn7z95j88+Y59e16f1biX4YYVqIoIgSViiUk&#xA;8VWvzJ3NScVY5irsVdirsVZH5B8/eY/I3mODXtBn9K4i+GaFqmKeIkFopVBHJWp8wdxQjFX39+Vn&#xA;5p+XPzG8uJq2kv6V1FxTUtNdgZbaUj7LdOSNQ8HpRh4EEBV4H/zkj/zjd6H1rzr5Ktf3PxTazo0K&#xA;/Y7vcW6D9nu6Dp1G1QFXy1irsVdir9VMVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdir&#xA;sVYZ+af5p+XPy58uPq2rP6t1LyTTdNRgJbmUD7K9eKLUc3pRR4kgFV8A+fvP3mPzz5jn17Xp/VuJ&#xA;fhhhWoigiBJWKJSTxVa/Mnc1JxVjmKuxV2KuxV2KuxVkfkHz95j8jeY4Ne0Gf0riL4ZoWqYp4iQW&#xA;ilUEclanzB3FCMVff35Wfmn5c/Mby4mraS/pXUXFNS012BltpSPst05I1DwelGHgQQFXgf8Azkj/&#xA;AM43eh9a86+SrX9z8U2s6NCv2O73Fug/Z7ug6dRtUBV8tYq7FX6qYq7FXYq7FXYq7FXYq7FXYq7F&#xA;XYq7FXYq7FXYq7FXYq7FWGfmn+aflz8ufLj6tqz+rdS8k03TUYCW5lA+yvXii1HN6UUeJIBVfAPn&#xA;7z95j88+Y59e16f1biX4YYVqIoIgSViiUk8VWvzJ3NScVY5irsVdirYBJoNycVV7/T7/AE68lstQ&#xA;tpbS8hIE1tOjRyISKjkjAEbGuKofFXYq7FWR+QfP3mPyN5jg17QZ/SuIvhmhapiniJBaKVQRyVqf&#xA;MHcUIxV9/flZ+aflz8xvLiatpL+ldRcU1LTXYGW2lI+y3TkjUPB6UYeBBAVeB/8AOSP/ADjd6H1r&#xA;zr5Ktf3PxTazo0K/Y7vcW6D9nu6Dp1G1QFXy1ir9VMVdirsVdirsVdirsVdirsVdirsVdirsVdir&#xA;sVdirsVYZ+af5p+XPy58uPq2rP6t1LyTTdNRgJbmUD7K9eKLUc3pRR4kgFV8A+fvP3mPzz5jn17X&#xA;p/VuJfhhhWoigiBJWKJSTxVa/Mnc1JxVjmKuxV2KtgEmg3JxV9c/843f843DTRa+dPOlrXUTxm0f&#xA;R5l/3n7rPOp/3b3RD9jqfi+yqz/8+fyG0v8AMbSzf2Ajs/NtnHSzvDsk6DcQTkdv5W6qfaoxV8Ja&#xA;xo+qaNqlzpWq20lnqNnIYrm2lFHRx2P6wRsRuMVQeKuxV2Ksj8g+fvMfkbzHBr2gz+lcRfDNC1TF&#xA;PESC0UqgjkrU+YO4oRir7+/Kz80/Ln5jeXE1bSX9K6i4pqWmuwMttKR9lunJGoeD0ow8CCAq8D/5&#xA;yR/5xu9D61518lWv7n4ptZ0aFfsd3uLdB+z3dB06jaoCr6vxV2KuxV2KuxV2KuxV2KuxV2KuxV2K&#xA;uxV2KuxV2KsM/NP80/Ln5c+XH1bVn9W6l5JpumowEtzKB9levFFqOb0oo8SQCq+AfP3n7zH558xz&#xA;69r0/q3EvwwwrURQRAkrFEpJ4qtfmTuak4qxzFXYq7FWwCTQbk4q+uf+cbv+cbhpotfOnnS1rqJ4&#xA;zaPo8y/7z91nnU/7t7oh+x1PxfZVfTWKuxV5J+fP5DaX+Y2lm/sBHZ+bbOOlneHZJ0G4gnI7fyt1&#xA;U+1Rir4S1jR9U0bVLnStVtpLPUbOQxXNtKKOjjsf1gjYjcYqg8VdirsVZH5B8/eY/I3mODXtBn9K&#xA;4i+GaFqmKeIkFopVBHJWp8wdxQjFX39+Vn5p+XPzG8uJq2kv6V1FxTUtNdgZbaUj7LdOSNQ8HpRh&#xA;4EEBVmYAAoNgOgxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxVhn5p/mn5c/Lny4+ras/q3UvJN&#xA;N01GAluZQPsr14otRzelFHiSAVXwD5+8/eY/PPmOfXten9W4l+GGFaiKCIElYolJPFVr8ydzUnFW&#xA;OYq7FXYq2ASaDcnFX1z/AM43f843DTRa+dPOlrXUTxm0fR5l/wB5+6zzqf8AdvdEP2Op+L7Kr6ax&#xA;V2KuxV2KvJPz5/IbS/zG0s39gI7PzbZx0s7w7JOg3EE5Hb+Vuqn2qMVfCWsaPqmjapc6VqttJZ6j&#xA;ZyGK5tpRR0cdj+sEbEbjFUHirsVdirI/IPn7zH5G8xwa9oM/pXEXwzQtUxTxEgtFKoI5K1PmDuKE&#xA;Yq+/vys/NPy5+Y3lxNW0l/SuouKalprsDLbSkfZbpyRqHg9KMPAggKszxV2KuxV2KuxV2KuxV2Ku&#xA;xV2KuxV2KuxVhn5p/mn5c/Lny4+ras/q3UvJNN01GAluZQPsr14otRzelFHiSAVXwD5+8/eY/PPm&#xA;OfXten9W4l+GGFaiKCIElYolJPFVr8ydzUnFWOYq7FXYq2ASaDcnFX1z/wA43f8AONw00WvnTzpa&#xA;11E8ZtH0eZf95+6zzqf9290Q/Y6n4vsqvprFXYq7FXYq7FXYq8k/Pn8htL/MbSzf2Ajs/NtnHSzv&#xA;Dsk6DcQTkdv5W6qfaoxV8Jaxo+qaNqlzpWq20lnqNnIYrm2lFHRx2P6wRsRuMVQeKuxV2Ksj8g+f&#xA;vMfkbzHBr2gz+lcRfDNC1TFPESC0UqgjkrU+YO4oRir7+/Kz80/Ln5jeXE1bSX9K6i4pqWmuwMtt&#xA;KR9lunJGoeD0ow8CCAqzPFXYq7FXYq7FXYq7FXYq7FXYq7FWGfmn+aflz8ufLj6tqz+rdS8k03TU&#xA;YCW5lA+yvXii1HN6UUeJIBVfAPn7z95j88+Y59e16f1biX4YYVqIoIgSViiUk8VWvzJ3NScVY5ir&#xA;sVdirYBJoNycVfXP/ON3/ONw00WvnTzpa11E8ZtH0eZf95+6zzqf9290Q/Y6n4vsqvprFXYq7FXY&#xA;q7FXYq7FXYq8k/Pn8htL/MbSzf2Ajs/NtnHSzvDsk6DcQTkdv5W6qfaoxV8Jaxo+qaNqlzpWq20l&#xA;nqNnIYrm2lFHRx2P6wRsRuMVQeKuxV2Ksj8g+fvMfkbzHBr2gz+lcRfDNC1TFPESC0UqgjkrU+YO&#xA;4oRir7+/Kz80/Ln5jeXE1bSX9K6i4pqWmuwMttKR9lunJGoeD0ow8CCAqzPFXYq7FXYq7FXYq7FX&#xA;Yq7FWGfmn+aflz8ufLj6tqz+rdS8k03TUYCW5lA+yvXii1HN6UUeJIBVfAPn7z95j88+Y59e16f1&#xA;biX4YYVqIoIgSViiUk8VWvzJ3NScVY5irsVdirYBJoNycVfXP/ON3/ONw00WvnTzpa11E8ZtH0eZ&#xA;f95+6zzqf9290Q/Y6n4vsqvprFXYq7FXYq7FXYq7FXYq7FXYq8k/Pn8htL/MbSzf2Ajs/NtnHSzv&#xA;Dsk6DcQTkdv5W6qfaoxV8Jaxo+qaNqlzpWq20lnqNnIYrm2lFHRx2P6wRsRuMVQeKuxV2Ksj8g+f&#xA;vMfkbzHBr2gz+lcRfDNC1TFPESC0UqgjkrU+YO4oRir7+/Kz80/Ln5jeXE1bSX9K6i4pqWmuwMtt&#xA;KR9lunJGoeD0ow8CCAqzPFXYq7FXYq7FXYq7FWGfmn+aflz8ufLj6tqz+rdS8k03TUYCW5lA+yvX&#xA;ii1HN6UUeJIBVfAPn7z95j88+Y59e16f1biX4YYVqIoIgSViiUk8VWvzJ3NScVY5irsVdirYBJoN&#xA;ycVfXP8Azjd/zjcNNFr5086WtdRPGbR9HmX/AHn7rPOp/wB290Q/Y6n4vsqvprFXYq7FXYq7FXYq&#xA;7FXYq7FXYq7FXYq8k/Pn8htL/MbSzf2Ajs/NtnHSzvDsk6DcQTkdv5W6qfaoxV8Jaxo+qaNqlzpW&#xA;q20lnqNnIYrm2lFHRx2P6wRsRuMVQeKuxV2Ksj8g+fvMfkbzHBr2gz+lcRfDNC1TFPESC0Uqgjkr&#xA;U+YO4oRir7+/Kz80/Ln5jeXE1bSX9K6i4pqWmuwMttKR9lunJGoeD0ow8CCAqzPFXYq7FXYq7FWG&#xA;fmn+aflz8ufLj6tqz+rdS8k03TUYCW5lA+yvXii1HN6UUeJIBVfAPn7z95j88+Y59e16f1biX4YY&#xA;VqIoIgSViiUk8VWvzJ3NScVY5irsVdirYBJoNycVfXP/ADjd/wA43DTRa+dPOlrXUTxm0fR5l/3n&#xA;7rPOp/3b3RD9jqfi+yq+lzPAJ1gMiid1Z0iJHMohAZgvWgLqCfcYqvxV2KuxV2KuxV2KuxV2KuxV&#xA;2KuxV2KpNF5v0GTzXceVPrITXbe1jvjaPsXt5GZOcZ/a4stG8NvHFXnv58/kNpf5jaWb+wEdn5ts&#xA;46Wd4dknQbiCcjt/K3VT7VGKvhLWNH1TRtUudK1W2ks9Rs5DFc20oo6OOx/WCNiNxiqDxV2KuxVk&#xA;fkHz95j8jeY4Ne0Gf0riL4ZoWqYp4iQWilUEclanzB3FCMVff35Wfmn5c/Mby4mraS/pXUXFNS01&#xA;2BltpSPst05I1DwelGHgQQFWZ4q7FXYqwz80/wA0/Ln5c+XH1bVn9W6l5JpumowEtzKB9levFFqO&#xA;b0oo8SQCq+AfP3n7zH558xz69r0/q3EvwwwrURQRAkrFEpJ4qtfmTuak4qxzFXYq7FWwCTQbk4q+&#xA;uf8AnG7/AJxuGmi186edLWuonjNo+jzL/vP3WedT/u3uiH7HU/F9lV7x5/8APnl/yN5ZufMGtzcL&#xA;aH4YYV3knmYEpDEO7NT6BUnYHFXzz/zjl+ZXmPz9+e2vazrEpCSaJOLSxViYbeJLy24Rxg+AY1P7&#xA;RqcVfVGKuxV2KuxV2KuxV2KuxV2KuxV2KuxV8X/85V69q+gfnpp+saRdPZ6jZabay29xGaFWEk23&#xA;uCNmB2I2OKvof8kfzo0j8yvL/qfu7TzFZKBqumA9D0E0VdzE5/4E/CexKqW/nz+Q2l/mNpZv7AR2&#xA;fm2zjpZ3h2SdBuIJyO38rdVPtUYq+EtY0fVNG1S50rVbaSz1GzkMVzbSijo47H9YI2I3GKoPFXYq&#xA;7FWR+QfP3mPyN5jg17QZ/SuIvhmhapiniJBaKVQRyVqfMHcUIxV9/flZ+aflz8xvLiatpL+ldRcU&#xA;1LTXYGW2lI+y3TkjUPB6UYeBBAVZnirsVeT/AJ+fkZY/mTpCXdm62vmnToyun3LEiOVKlvq83+SW&#xA;JKt+yfaoxV8H6xo+qaNqlzpWq20lnqNnIYrm2lFHRx2P6wRsRuMVQeKuxVsAk0G5OKvrn/nG7/nG&#xA;4aaLXzp50ta6ieM2j6PMv+8/dZ51P+7e6IfsdT8X2VX0N5n8zaL5Y0K813WrlbXTbJDJNKdz4Kqr&#xA;1ZmOyqOpxV+fv5x/m5rX5k+Zm1C65W+k2vKPSdNr8MMRP2mANDK+3Nvo6AYq9C/5wq/8mnqv/bDu&#xA;P+oy0xV9qYq7FXwB/wA5R/8Ak9vM3/Rj/wB0+3xV5VirsVdir7//AOcXP/JE+Wf+j7/uoXGKvVcV&#xA;dirsVdirsVfEH/OZP/k3If8AtlW3/J2bFXkvk7zjr/k/zDa69oVyba/tWr4pIh+3FKv7SONiP44q&#xA;/QT8pvzU0H8x/LEeracRBexUj1TTGYNJbTeB6ckelUem48CCAqxn8+fyG0v8xtLN/YCOz822cdLO&#xA;8OyToNxBOR2/lbqp9qjFXwlrGj6po2qXOlarbSWeo2chiubaUUdHHY/rBGxG4xVB4q7FU+8keSPM&#xA;XnTzFbaDoNsZ72c1dzURwxgjlLK1DxRa7n6BUkDFX37+Uv5S+Xfy38urp2nKJ9RnCvqmqOoElxIB&#xA;9PGNangldvckkqs5xV2KuxV5J+fP5DaX+Y2lm/sBHZ+bbOOlneHZJ0G4gnI7fyt1U+1Rir4S1jR9&#xA;U0bVLnStVtpLPUbOQxXNtKKOjjsf1gjYjcYqhACTQbk4q+uf+cbv+cbhpotfOnnS1rqJ4zaPo8y/&#xA;7z91nnU/7t7oh+x1PxfZVfSOp6np+l6fcajqNxHaWNpG0tzcysFREUVLMTir4K/Pv877/wDMjXRB&#xA;aF7byrp7n9G2bbNI1KG4mA/bb9kfsrt1LEqvKcVfQH/OFX/k09V/7Ydx/wBRlpir7UxV2KvgD/nK&#xA;P/ye3mb/AKMf+6fb4q8qxV2KuxV9/wD/ADi5/wCSJ8s/9H3/AHULjFXquKuxV2KuxV2KviD/AJzJ&#xA;/wDJuQ/9sq2/5OzYq8KxVlP5b/mL5g8g+Z7fXdGkNUIS8tGNIrmAkF4pOvWmxpVTuMVfoN+Xv5ge&#xA;X/Pflm21/RJeUMo43FsxHq28wHxwygdGX8RQjY4qwn8+fyG0v8xtLN/YCOz822cdLO8OyToNxBOR&#xA;2/lbqp9qjFXwlrGj6po2qXOlarbSWeo2chiubaUUdHHY/rBGxG4xVMvJHkjzF508xW2g6DbGe9nN&#xA;Xc1EcMYI5SytQ8UWu5+gVJAxV9+/lL+Uvl38t/Lq6dpyifUZwr6pqjqBJcSAfTxjWp4JXb3JJKrO&#xA;cVdirsVdirsVeSfnz+Q2l/mNpZv7AR2fm2zjpZ3h2SdBuIJyO38rdVPtUYqwT/nHf/nGaTRLiLzZ&#xA;55tV/S0L8tL0dyrrbsp2nm4llaTaqL0X7X2qcVX0tir4d/5yO/PybzxqL+XfL8zR+UrKT45AafXp&#xA;kO0rCgPpKf7tT1+0d6BVXhuKuxV9Af8AOFX/AJNPVf8Ath3H/UZaYq+1MVdir4A/5yj/APJ7eZv+&#xA;jH/un2+KvKsVdirsVff/APzi5/5Inyz/ANH3/dQuMVeq4q7FXYq7FXYq+IP+cyf/ACbkP/bKtv8A&#xA;k7NirwrFXYqzr8ofzY1z8t/MyanYkz6dcFY9W00miXEIPav2ZEqSjdvkSCq/RrFXk356/kHpP5k2&#xA;C3tk0Wn+a7VQtrqDgiOWMf7puOIZiv8AKwBK+42xVkH5S/lL5d/Lfy6unacon1GcK+qao6gSXEgH&#xA;08Y1qeCV29ySSqznFXYq7FXYq7FXYq7FXYq7FX5V4q7FXYq+gP8AnCr/AMmnqv8A2w7j/qMtMVfa&#xA;mKuxV8Af85R/+T28zf8ARj/3T7fFXlWKuxV2Kvv/AP5xc/8AJE+Wf+j7/uoXGKvVcVdirsVdirsV&#xA;fEn/ADmdA0f5sWbkgibR7d1p2AnuE3+lMVeDYq7FXYq/VTFXYq7FXYq7FXYq7FXYq7FXYq7FXYq/&#xA;KvFXYq7FX0B/zhV/5NPVf+2Hcf8AUZaYq+1MVdir4A/5yj/8nt5m/wCjH/un2+KvKsVdirsVff8A&#xA;/wA4uf8AkifLP/R9/wB1C4xV6rirsVdirsVdir4r/wCc1f8Ayaelf9sO3/6jLvFXz/irsVdir9VM&#xA;VdirsVdirsVdirsVdirsVdirsVdir8q8VdirsVfQH/OFX/k09V/7Ydx/1GWmKvtTFXYq+AP+co//&#xA;ACe3mb/ox/7p9viryrFXYq7FX3//AM4uf+SJ8s/9H3/dQuMVeq4q7FXYq7FXYq+K/wDnNX/yaelf&#xA;9sO3/wCoy7xV8/4q7FXYq/VTFXYq7FXYq7FXYq7FXYq7FXYq7FXYq/KvFXYq7FX0B/zhV/5NPVf+&#xA;2Hcf9Rlpir7UxV2KvgD/AJyj/wDJ7eZv+jH/ALp9viryrFXYq7FX3/8A84uf+SJ8s/8AR9/3ULjF&#xA;XquKuxV2KuxV2Kviv/nNX/yaelf9sO3/AOoy7xV8/wCKuxV2Kv1UxV2KuxV2KuxV2KuxV2KuxV2K&#xA;uxV2KvyrxV2KuxV9Af8AOFX/AJNPVf8Ath3H/UZaYq+1MVdir4A/5yj/APJ7eZv+jH/un2+KvKsV&#xA;dirsVff/APzi5/5Inyz/ANH3/dQuMVeq4q7FXYq7FXYq+K/+c1f/ACaelf8AbDt/+oy7xV8/4q7F&#xA;XYq/VTFXYq7FXYq7FXYq7FXYq7FXYq7FXYq/KvFXYq7FXoH5Kfmv/wAqy81XWvfov9L/AFmxksfq&#xA;3r/VuPqTRS8+fpzVp6NKce/XFXtX/Q8//fk/9zT/ALM8Vd/0PP8A9+T/ANzT/szxV3/Q8/8A35P/&#xA;AHNP+zPFXf8AQ8//AH5P/c0/7M8Vd/0PP/35P/c0/wCzPFXf9Dz/APfk/wDc0/7M8Vd/0PP/AN+T&#xA;/wBzT/szxV3/AEPP/wB+T/3NP+zPFXf9Dz/9+T/3NP8AszxV3/Q8/wD35P8A3NP+zPFXf9Dz/wDf&#xA;k/8Ac0/7M8Vd/wBDz/8Afk/9zT/szxV4r+df5r/8rN81Wuvfov8ARH1axjsfq3r/AFnl6c0svPn6&#xA;cNK+tSnHt1xV5/irsVdir9VMVdirsVdirsVdirsVdirsVdirsVdir8q8VdirsVdirsVdirsVdirs&#xA;VdirsVdirsVdirsVdirsVdirsVdir9VMVdirsVdirsVdirsVdirsVdirsVdir8q8VdirsVdirsVd&#xA;irsVdirsVdirsVdirsVdirsVdirsVdirsVdir9VMVdirsVdirsVdirsVdirsVdirsVdir8q8Vdir&#xA;sVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdir9VMVdirsVdirsVdirsVdirsVdirsVdi&#xA;rsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdir&#xA;sVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirs&#xA;VdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsV&#xA;dirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVd&#xA;ir//2Q==</xapGImg:image>
- </rdf:li>
- </rdf:Alt>
- </xap:Thumbnails>
- </rdf:Description>
- <rdf:Description rdf:about=""
- xmlns:xapMM="http://ns.adobe.com/xap/1.0/mm/">
- <xapMM:DocumentID>uuid:FF364C322635E01192F88CC5416A78CF</xapMM:DocumentID>
- <xapMM:InstanceID>uuid:be6b4bae-323e-c246-9a75-1280d64495f2</xapMM:InstanceID>
- <xapMM:DerivedFrom rdf:parseType="Resource"/>
- </rdf:Description>
- <rdf:Description rdf:about=""
- xmlns:xapTPg="http://ns.adobe.com/xap/1.0/t/pg/"
- xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
- xmlns:xapG="http://ns.adobe.com/xap/1.0/g/">
- <xapTPg:NPages>1</xapTPg:NPages>
- <xapTPg:HasVisibleTransparency>False</xapTPg:HasVisibleTransparency>
- <xapTPg:HasVisibleOverprint>False</xapTPg:HasVisibleOverprint>
- <xapTPg:MaxPageSize rdf:parseType="Resource">
- <stDim:w>16.000000</stDim:w>
- <stDim:h>16.000000</stDim:h>
- <stDim:unit>Points</stDim:unit>
- </xapTPg:MaxPageSize>
- <xapTPg:PlateNames>
- <rdf:Seq>
- <rdf:li>Cyan</rdf:li>
- <rdf:li>Magenta</rdf:li>
- <rdf:li>Yellow</rdf:li>
- <rdf:li>Black</rdf:li>
- </rdf:Seq>
- </xapTPg:PlateNames>
- <xapTPg:SwatchGroups>
- <rdf:Seq>
- <rdf:li rdf:parseType="Resource">
- <xapG:groupName>Default Swatch Group</xapG:groupName>
- <xapG:groupType>0</xapG:groupType>
- </rdf:li>
- </rdf:Seq>
- </xapTPg:SwatchGroups>
- </rdf:Description>
- <rdf:Description rdf:about=""
- xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
- <pdf:Producer>Adobe PDF library 8.00</pdf:Producer>
- </rdf:Description>
- </rdf:RDF>
-</x:xmpmeta>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<?xpacket end="w"?> endstream endobj 2 0 obj <</Count 1/Type/Pages/Kids[5 0 R]>> endobj 5 0 obj <</Parent 2 0 R/Contents 7 0 R/BleedBox[0.0 0.0 16.0 16.0]/ArtBox[0.0 0.0 15.7812 15.7812]/MediaBox[0.0 0.0 16.0 16.0]/TrimBox[0.0 0.0 16.0 16.0]/Resources<</Properties<</MC0<</Color[20224 32768 65535]/Visible true/Editable true/Dimmed false/Preview true/Printed true/Title(Layer 1)>>>>/ExtGState<</GS0 6 0 R>>>>/Type/Page>> endobj 7 0 obj <</Length 218/Filter/FlateDecode>>stream
-H‰d‘;R1 †{ŸB°V²lÉnI24¤`8Ã@(’"¡âöH»!³q!}–~ëáééõûýÓ~Cð°Ý@"ˆs9¤éñ…àð•ÎÀóƒ¡u6à†TeÀÛiN>¥l(dp5Ç”ŽêÜQ5˜š@.Wôhm&Ž†EgqÑîø‘žW%™p˜*6îº*©(½º{œÝ1 bçØ‘Gƒò3£Igìt‡ÅûåHöNYý©?ÿ7ñ
-0000000016 00000 n
-0000016570 00000 n
-0000000004 00001 f
-0000000000 00000 f
-0000016621 00000 n
-0000017247 00000 n
-0000016961 00000 n
-0000017359 00000 n
-0000000076 00000 n
-trailer <</Size 10/Root 1 0 R/Info 8 0 R/ID[<ADA186DB0F3649B8AC5BA40BFA30D11D><8A6AD6F969574B3A87EA4AAF57E7FEB8>]>> startxref 17534 %%EOF \ No newline at end of file
diff --git a/frontends/cocoa/res/Icons b/frontends/cocoa/res/Icons
deleted file mode 120000
index 187efd6f9..000000000
--- a/frontends/cocoa/res/Icons
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/Icons/ \ No newline at end of file
diff --git a/frontends/cocoa/res/LocalHistoryPanel.xib b/frontends/cocoa/res/LocalHistoryPanel.xib
deleted file mode 100644
index 794d2db54..000000000
--- a/frontends/cocoa/res/LocalHistoryPanel.xib
+++ /dev/null
@@ -1,357 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
- <data>
- <int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">10J567</string>
- <string key="IBDocument.InterfaceBuilderVersion">804</string>
- <string key="IBDocument.AppKitVersion">1038.35</string>
- <string key="IBDocument.HIToolboxVersion">462.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">804</string>
- </object>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="2"/>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1001">
- <string key="NSClassName">LocalHistoryController</string>
- </object>
- <object class="NSCustomObject" id="1003">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1004">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSWindowTemplate" id="1005">
- <int key="NSWindowStyleMask">15</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{196, 240}, {480, 270}}</string>
- <int key="NSWTFlags">1618477056</int>
- <string key="NSWindowTitle">Window</string>
- <string key="NSWindowClass">ArrowWindow</string>
- <nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
- <object class="NSView" key="NSWindowView" id="1006">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSScrollView" id="488267087">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">274</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSClipView" id="753770525">
- <reference key="NSNextResponder" ref="488267087"/>
- <int key="NSvFlags">2304</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomView" id="820702167">
- <reference key="NSNextResponder" ref="753770525"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrameSize">{480, 270}</string>
- <reference key="NSSuperview" ref="753770525"/>
- <string key="NSClassName">HistoryView</string>
- </object>
- </object>
- <string key="NSFrame">{{1, 1}, {480, 270}}</string>
- <reference key="NSSuperview" ref="488267087"/>
- <reference key="NSNextKeyView" ref="820702167"/>
- <reference key="NSDocView" ref="820702167"/>
- <object class="NSColor" key="NSBGColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
- </object>
- </object>
- <int key="NScvFlags">2</int>
- </object>
- <object class="NSScroller" id="84195230">
- <reference key="NSNextResponder" ref="488267087"/>
- <int key="NSvFlags">-2147483392</int>
- <string key="NSFrame">{{470, 1}, {11, 255}}</string>
- <reference key="NSSuperview" ref="488267087"/>
- <int key="NSsFlags">256</int>
- <int key="NSArrowsLoc">2</int>
- <reference key="NSTarget" ref="488267087"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSCurValue">1</double>
- <double key="NSPercent">0.96363627910614014</double>
- </object>
- <object class="NSScroller" id="645365106">
- <reference key="NSNextResponder" ref="488267087"/>
- <int key="NSvFlags">-2147483392</int>
- <string key="NSFrame">{{1, 260}, {465, 11}}</string>
- <reference key="NSSuperview" ref="488267087"/>
- <int key="NSsFlags">257</int>
- <int key="NSArrowsLoc">2</int>
- <reference key="NSTarget" ref="488267087"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.50602412223815918</double>
- </object>
- </object>
- <string key="NSFrame">{{-1, -1}, {482, 272}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <reference key="NSNextKeyView" ref="753770525"/>
- <int key="NSsFlags">562</int>
- <reference key="NSVScroller" ref="84195230"/>
- <reference key="NSHScroller" ref="645365106"/>
- <reference key="NSContentView" ref="753770525"/>
- </object>
- </object>
- <string key="NSFrameSize">{480, 270}</string>
- <reference key="NSSuperview"/>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="1005"/>
- </object>
- <int key="connectionID">7</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">history</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="820702167"/>
- </object>
- <int key="connectionID">8</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <reference key="object" ref="0"/>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1001"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">File's Owner</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1003"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1004"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">1</int>
- <reference key="object" ref="1005"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1006"/>
- </object>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">2</int>
- <reference key="object" ref="1006"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="488267087"/>
- </object>
- <reference key="parent" ref="1005"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">3</int>
- <reference key="object" ref="488267087"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="84195230"/>
- <reference ref="645365106"/>
- <reference ref="820702167"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">4</int>
- <reference key="object" ref="84195230"/>
- <reference key="parent" ref="488267087"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5</int>
- <reference key="object" ref="645365106"/>
- <reference key="parent" ref="488267087"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">6</int>
- <reference key="object" ref="820702167"/>
- <reference key="parent" ref="488267087"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>1.IBEditorWindowLastContentRect</string>
- <string>1.IBPluginDependency</string>
- <string>1.IBWindowTemplateEditedContentRect</string>
- <string>1.NSWindowTemplate.visibleAtLaunch</string>
- <string>1.WindowOrigin</string>
- <string>1.editorWindowContentRectSynchronizationRect</string>
- <string>2.IBPluginDependency</string>
- <string>3.IBPluginDependency</string>
- <string>3.IBViewBoundsToFrameTransform</string>
- <string>4.CustomClassName</string>
- <string>4.IBPluginDependency</string>
- <string>5.CustomClassName</string>
- <string>5.IBPluginDependency</string>
- <string>6.IBPluginDependency</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>{{364, 310}, {480, 270}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{364, 310}, {480, 270}}</string>
- <boolean value="NO"/>
- <string>{196, 240}</string>
- <string>{{202, 428}, {480, 270}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAAC/gAAAw4aAAA</bytes>
- </object>
- <string>BlackScroller</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>BlackScroller</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">8</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">ArrowWindow</string>
- <string key="superclassName">NSWindow</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">ArrowWindow.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BlackScroller</string>
- <string key="superclassName">NSScroller</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">BlackScroller.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">HistoryView</string>
- <string key="superclassName">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">HistoryView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">LocalHistoryController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">history</string>
- <string key="NS.object.0">HistoryView</string>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <string key="NS.key.0">history</string>
- <object class="IBToOneOutletInfo" key="NS.object.0">
- <string key="name">history</string>
- <string key="candidateClassName">HistoryView</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">LocalHistoryController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabDragAssistant.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarCell.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarControl.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
- <integer value="3000" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">../NetSurf.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- </data>
-</archive>
diff --git a/frontends/cocoa/res/MainMenu.xib b/frontends/cocoa/res/MainMenu.xib
deleted file mode 100644
index d38240bfd..000000000
--- a/frontends/cocoa/res/MainMenu.xib
+++ /dev/null
@@ -1,2369 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
- <data>
- <int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10J567</string>
- <string key="IBDocument.InterfaceBuilderVersion">804</string>
- <string key="IBDocument.AppKitVersion">1038.35</string>
- <string key="IBDocument.HIToolboxVersion">462.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">804</string>
- </object>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="29"/>
- <integer value="853"/>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
- <integer value="1" key="NS.object.0"/>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1021">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSCustomObject" id="1014">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1050">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSMenu" id="649796088">
- <string key="NSTitle">Main Menu</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="694149608">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">NetSurf</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <object class="NSCustomResource" key="NSOnImage" id="756751024">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSMenuCheckmark</string>
- </object>
- <object class="NSCustomResource" key="NSMixedImage" id="908425081">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSMenuMixedState</string>
- </object>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="110575045">
- <string key="NSTitle">NetSurf</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="238522557">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">About NetSurf</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="304266470">
- <reference key="NSMenu" ref="110575045"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="609285721">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Preferences…</string>
- <string key="NSKeyEquiv">,</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="481834944">
- <reference key="NSMenu" ref="110575045"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="1046388886">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Services</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="752062318">
- <string key="NSTitle">Services</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <string key="NSName">_NSServicesMenu</string>
- </object>
- </object>
- <object class="NSMenuItem" id="646227648">
- <reference key="NSMenu" ref="110575045"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="755159360">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Hide NetSurf</string>
- <string key="NSKeyEquiv">h</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="342932134">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Hide Others</string>
- <string key="NSKeyEquiv">h</string>
- <int key="NSKeyEquivModMask">1572864</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="908899353">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Show All</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="1056857174">
- <reference key="NSMenu" ref="110575045"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="632727374">
- <reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Quit NetSurf</string>
- <string key="NSKeyEquiv">q</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- </object>
- <string key="NSName">_NSAppleMenu</string>
- </object>
- </object>
- <object class="NSMenuItem" id="379814623">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">File</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="720053764">
- <string key="NSTitle">File</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="705341025">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">New Window</string>
- <string key="NSKeyEquiv">n</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="72022292">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">New Tab</string>
- <string key="NSKeyEquiv">t</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="722745758">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Open File…</string>
- <string key="NSKeyEquiv">o</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="425164168">
- <reference key="NSMenu" ref="720053764"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="776162233">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Close</string>
- <string key="NSKeyEquiv">w</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="117038363">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Save As…</string>
- <string key="NSKeyEquiv">s</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="1010469920">
- <reference key="NSMenu" ref="720053764"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="294629803">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Page Setup...</string>
- <string key="NSKeyEquiv">P</string>
- <int key="NSKeyEquivModMask">1179648</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <string key="NSToolTip"/>
- </object>
- <object class="NSMenuItem" id="49223823">
- <reference key="NSMenu" ref="720053764"/>
- <string key="NSTitle">Print…</string>
- <string key="NSKeyEquiv">p</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- </object>
- </object>
- </object>
- <object class="NSMenuItem" id="584895621">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">Edit</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="141080932">
- <string key="NSTitle">Edit</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="80034836">
- <reference key="NSMenu" ref="141080932"/>
- <string key="NSTitle">Undo</string>
- <string key="NSKeyEquiv">z</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="128588396">
- <reference key="NSMenu" ref="141080932"/>
- <string key="NSTitle">Redo</string>
- <string key="NSKeyEquiv">Z</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="165057028">
- <reference key="NSMenu" ref="141080932"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="5858980">
- <reference key="NSMenu" ref="141080932"/>
- <string key="NSTitle">Cut</string>
- <string key="NSKeyEquiv">x</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="704355768">
- <reference key="NSMenu" ref="141080932"/>
- <string key="NSTitle">Copy</string>
- <string key="NSKeyEquiv">c</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="275307167">
- <reference key="NSMenu" ref="141080932"/>
- <string key="NSTitle">Paste</string>
- <string key="NSKeyEquiv">v</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="714155551">
- <reference key="NSMenu" ref="141080932"/>
- <string key="NSTitle">Delete</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="197377228">
- <reference key="NSMenu" ref="141080932"/>
- <string key="NSTitle">Select All</string>
- <string key="NSKeyEquiv">a</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="246962120">
- <reference key="NSMenu" ref="141080932"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="602982148">
- <reference key="NSMenu" ref="141080932"/>
- <string key="NSTitle">Find</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="930654435">
- <string key="NSTitle">Find</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="671868626">
- <reference key="NSMenu" ref="930654435"/>
- <string key="NSTitle">Find…</string>
- <string key="NSKeyEquiv">f</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <int key="NSTag">1</int>
- </object>
- <object class="NSMenuItem" id="497741775">
- <reference key="NSMenu" ref="930654435"/>
- <string key="NSTitle">Find Next</string>
- <string key="NSKeyEquiv">g</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <int key="NSTag">2</int>
- </object>
- <object class="NSMenuItem" id="285322108">
- <reference key="NSMenu" ref="930654435"/>
- <string key="NSTitle">Find Previous</string>
- <string key="NSKeyEquiv">G</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <int key="NSTag">3</int>
- </object>
- <object class="NSMenuItem" id="456308224">
- <reference key="NSMenu" ref="930654435"/>
- <string key="NSTitle">Use Selection for Find</string>
- <string key="NSKeyEquiv">e</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <int key="NSTag">7</int>
- </object>
- </object>
- </object>
- </object>
- <object class="NSMenuItem" id="1046338161">
- <reference key="NSMenu" ref="141080932"/>
- <string key="NSTitle">Speech</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="390929284">
- <string key="NSTitle">Speech</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="787796378">
- <reference key="NSMenu" ref="390929284"/>
- <string key="NSTitle">Start Speaking</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="831785675">
- <reference key="NSMenu" ref="390929284"/>
- <string key="NSTitle">Stop Speaking</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- </object>
- </object>
- </object>
- </object>
- </object>
- </object>
- <object class="NSMenuItem" id="586577488">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">View</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="466310130">
- <string key="NSTitle">View</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="102151532">
- <reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Show Toolbar</string>
- <string key="NSKeyEquiv">t</string>
- <int key="NSKeyEquivModMask">1572864</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="237841660">
- <reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Customize Toolbar…</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="588542073">
- <reference key="NSMenu" ref="466310130"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="1008284068">
- <reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Stop Loading</string>
- <string key="NSKeyEquiv">.</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="997106205">
- <reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Reload Page</string>
- <string key="NSKeyEquiv">r</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="403460345">
- <reference key="NSMenu" ref="466310130"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="924072330">
- <reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Original Size</string>
- <string key="NSKeyEquiv">0</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="157577355">
- <reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Zoom In</string>
- <string key="NSKeyEquiv">+</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="148271458">
- <reference key="NSMenu" ref="466310130"/>
- <string key="NSTitle">Zoom Out</string>
- <string key="NSKeyEquiv">-</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- </object>
- </object>
- </object>
- <object class="NSMenuItem" id="603467951">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">Bookmarks</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="1062528031">
- <string key="NSTitle">Bookmarks</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- </object>
- <object class="NSMenuItem" id="713487014">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">Window</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="835318025">
- <string key="NSTitle">Window</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="1011231497">
- <reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">Minimize</string>
- <string key="NSKeyEquiv">m</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="575023229">
- <reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">Zoom</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="971013910">
- <reference key="NSMenu" ref="835318025"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="532573582">
- <reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">History</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="299356726">
- <reference key="NSMenu" ref="835318025"/>
- <bool key="NSIsDisabled">YES</bool>
- <bool key="NSIsSeparator">YES</bool>
- <string key="NSTitle"/>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="625202149">
- <reference key="NSMenu" ref="835318025"/>
- <string key="NSTitle">Bring All to Front</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- </object>
- <string key="NSName">_NSWindowsMenu</string>
- </object>
- </object>
- <object class="NSMenuItem" id="391199113">
- <reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">Help</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- <string key="NSAction">submenuAction:</string>
- <object class="NSMenu" key="NSSubmenu" id="374024848">
- <string key="NSTitle">Help</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="238773614">
- <reference key="NSMenu" ref="374024848"/>
- <string key="NSTitle">NetSurf Help</string>
- <string key="NSKeyEquiv">?</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- </object>
- <string key="NSName">_NSHelpMenu</string>
- </object>
- </object>
- </object>
- <string key="NSName">_NSMainMenu</string>
- </object>
- <object class="NSCustomObject" id="1026802243">
- <string key="NSClassName">NetSurfAppDelegate</string>
- </object>
- <object class="NSCustomObject" id="867741866">
- <string key="NSClassName">BookmarksController</string>
- </object>
- <object class="NSMenu" id="509997857">
- <string key="NSTitle">Default Bookmark Actions</string>
- <object class="NSMutableArray" key="NSMenuItems">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMenuItem" id="844807595">
- <reference key="NSMenu" ref="509997857"/>
- <string key="NSTitle">Add bookmark</string>
- <string key="NSKeyEquiv">d</string>
- <int key="NSKeyEquivModMask">1048576</int>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- <object class="NSMenuItem" id="832858329">
- <reference key="NSMenu" ref="509997857"/>
- <string key="NSTitle">Show bookmarks...</string>
- <string key="NSKeyEquiv"/>
- <int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSOnImage" ref="756751024"/>
- <reference key="NSMixedImage" ref="908425081"/>
- </object>
- </object>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">performMiniaturize:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="1011231497"/>
- </object>
- <int key="connectionID">37</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">arrangeInFront:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="625202149"/>
- </object>
- <int key="connectionID">39</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">print:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="49223823"/>
- </object>
- <int key="connectionID">86</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">runPageLayout:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="294629803"/>
- </object>
- <int key="connectionID">87</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">orderFrontStandardAboutPanel:</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="238522557"/>
- </object>
- <int key="connectionID">142</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">performZoom:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="575023229"/>
- </object>
- <int key="connectionID">240</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">showHelp:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="238773614"/>
- </object>
- <int key="connectionID">360</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">saveDocumentAs:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="117038363"/>
- </object>
- <int key="connectionID">363</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">runToolbarCustomizationPalette:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="237841660"/>
- </object>
- <int key="connectionID">365</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">toggleToolbarShown:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="102151532"/>
- </object>
- <int key="connectionID">366</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">hide:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="755159360"/>
- </object>
- <int key="connectionID">369</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">hideOtherApplications:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="342932134"/>
- </object>
- <int key="connectionID">370</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">unhideAllApplications:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="908899353"/>
- </object>
- <int key="connectionID">372</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">terminate:</string>
- <reference key="source" ref="1021"/>
- <reference key="destination" ref="632727374"/>
- </object>
- <int key="connectionID">448</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">cut:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="5858980"/>
- </object>
- <int key="connectionID">741</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">paste:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="275307167"/>
- </object>
- <int key="connectionID">742</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">redo:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="128588396"/>
- </object>
- <int key="connectionID">745</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">undo:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="80034836"/>
- </object>
- <int key="connectionID">749</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">startSpeaking:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="787796378"/>
- </object>
- <int key="connectionID">751</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">copy:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="704355768"/>
- </object>
- <int key="connectionID">755</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">delete:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="714155551"/>
- </object>
- <int key="connectionID">756</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">selectAll:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="197377228"/>
- </object>
- <int key="connectionID">758</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">stopSpeaking:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="831785675"/>
- </object>
- <int key="connectionID">759</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="1050"/>
- <reference key="destination" ref="1026802243"/>
- </object>
- <int key="connectionID">821</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">newDocument:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="705341025"/>
- </object>
- <int key="connectionID">823</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">openDocument:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="722745758"/>
- </object>
- <int key="connectionID">824</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">zoomIn:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="157577355"/>
- </object>
- <int key="connectionID">829</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">zoomOut:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="148271458"/>
- </object>
- <int key="connectionID">830</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">stopLoading:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="1008284068"/>
- </object>
- <int key="connectionID">835</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">reloadPage:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="997106205"/>
- </object>
- <int key="connectionID">836</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">zoomOriginal:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="924072330"/>
- </object>
- <int key="connectionID">837</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">newTab:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="72022292"/>
- </object>
- <int key="connectionID">839</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">showSearchWindow:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="671868626"/>
- </object>
- <int key="connectionID">841</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">searchNext:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="497741775"/>
- </object>
- <int key="connectionID">842</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">searchPrevious:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="285322108"/>
- </object>
- <int key="connectionID">843</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">performClose:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="776162233"/>
- </object>
- <int key="connectionID">844</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">showPreferences:</string>
- <reference key="source" ref="1026802243"/>
- <reference key="destination" ref="609285721"/>
- </object>
- <int key="connectionID">845</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">showGlobalHistory:</string>
- <reference key="source" ref="1014"/>
- <reference key="destination" ref="532573582"/>
- </object>
- <int key="connectionID">846</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="1062528031"/>
- <reference key="destination" ref="867741866"/>
- </object>
- <int key="connectionID">851</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">defaultMenu</string>
- <reference key="source" ref="867741866"/>
- <reference key="destination" ref="509997857"/>
- </object>
- <int key="connectionID">856</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">addBookmark:</string>
- <reference key="source" ref="867741866"/>
- <reference key="destination" ref="844807595"/>
- </object>
- <int key="connectionID">857</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">showWindow:</string>
- <reference key="source" ref="867741866"/>
- <reference key="destination" ref="832858329"/>
- </object>
- <int key="connectionID">859</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <object class="NSArray" key="object" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="children" ref="1048"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1021"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">File's Owner</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1014"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1050"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">29</int>
- <reference key="object" ref="649796088"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="713487014"/>
- <reference ref="694149608"/>
- <reference ref="391199113"/>
- <reference ref="379814623"/>
- <reference ref="586577488"/>
- <reference ref="584895621"/>
- <reference ref="603467951"/>
- </object>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">19</int>
- <reference key="object" ref="713487014"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="835318025"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">56</int>
- <reference key="object" ref="694149608"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="110575045"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">103</int>
- <reference key="object" ref="391199113"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="374024848"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">83</int>
- <reference key="object" ref="379814623"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="720053764"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">81</int>
- <reference key="object" ref="720053764"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="117038363"/>
- <reference ref="49223823"/>
- <reference ref="722745758"/>
- <reference ref="705341025"/>
- <reference ref="294629803"/>
- <reference ref="776162233"/>
- <reference ref="1010469920"/>
- <reference ref="425164168"/>
- <reference ref="72022292"/>
- </object>
- <reference key="parent" ref="379814623"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">80</int>
- <reference key="object" ref="117038363"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">78</int>
- <reference key="object" ref="49223823"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">72</int>
- <reference key="object" ref="722745758"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">82</int>
- <reference key="object" ref="705341025"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">77</int>
- <reference key="object" ref="294629803"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">73</int>
- <reference key="object" ref="776162233"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">74</int>
- <reference key="object" ref="1010469920"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">106</int>
- <reference key="object" ref="374024848"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="238773614"/>
- </object>
- <reference key="parent" ref="391199113"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">111</int>
- <reference key="object" ref="238773614"/>
- <reference key="parent" ref="374024848"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">57</int>
- <reference key="object" ref="110575045"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="238522557"/>
- <reference ref="755159360"/>
- <reference ref="908899353"/>
- <reference ref="632727374"/>
- <reference ref="646227648"/>
- <reference ref="609285721"/>
- <reference ref="481834944"/>
- <reference ref="304266470"/>
- <reference ref="1046388886"/>
- <reference ref="1056857174"/>
- <reference ref="342932134"/>
- </object>
- <reference key="parent" ref="694149608"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">58</int>
- <reference key="object" ref="238522557"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">134</int>
- <reference key="object" ref="755159360"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">150</int>
- <reference key="object" ref="908899353"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">136</int>
- <reference key="object" ref="632727374"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">144</int>
- <reference key="object" ref="646227648"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">129</int>
- <reference key="object" ref="609285721"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">143</int>
- <reference key="object" ref="481834944"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">236</int>
- <reference key="object" ref="304266470"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">131</int>
- <reference key="object" ref="1046388886"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="752062318"/>
- </object>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">149</int>
- <reference key="object" ref="1056857174"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">145</int>
- <reference key="object" ref="342932134"/>
- <reference key="parent" ref="110575045"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">130</int>
- <reference key="object" ref="752062318"/>
- <reference key="parent" ref="1046388886"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">24</int>
- <reference key="object" ref="835318025"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="299356726"/>
- <reference ref="625202149"/>
- <reference ref="575023229"/>
- <reference ref="1011231497"/>
- <reference ref="971013910"/>
- <reference ref="532573582"/>
- </object>
- <reference key="parent" ref="713487014"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">92</int>
- <reference key="object" ref="299356726"/>
- <reference key="parent" ref="835318025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5</int>
- <reference key="object" ref="625202149"/>
- <reference key="parent" ref="835318025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">239</int>
- <reference key="object" ref="575023229"/>
- <reference key="parent" ref="835318025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">23</int>
- <reference key="object" ref="1011231497"/>
- <reference key="parent" ref="835318025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">295</int>
- <reference key="object" ref="586577488"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="466310130"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">296</int>
- <reference key="object" ref="466310130"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="102151532"/>
- <reference ref="237841660"/>
- <reference ref="588542073"/>
- <reference ref="148271458"/>
- <reference ref="924072330"/>
- <reference ref="157577355"/>
- <reference ref="403460345"/>
- <reference ref="1008284068"/>
- <reference ref="997106205"/>
- </object>
- <reference key="parent" ref="586577488"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">297</int>
- <reference key="object" ref="102151532"/>
- <reference key="parent" ref="466310130"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">298</int>
- <reference key="object" ref="237841660"/>
- <reference key="parent" ref="466310130"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">79</int>
- <reference key="object" ref="425164168"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">684</int>
- <reference key="object" ref="584895621"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="141080932"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">685</int>
- <reference key="object" ref="141080932"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="80034836"/>
- <reference ref="128588396"/>
- <reference ref="165057028"/>
- <reference ref="5858980"/>
- <reference ref="704355768"/>
- <reference ref="275307167"/>
- <reference ref="714155551"/>
- <reference ref="197377228"/>
- <reference ref="246962120"/>
- <reference ref="602982148"/>
- <reference ref="1046338161"/>
- </object>
- <reference key="parent" ref="584895621"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">686</int>
- <reference key="object" ref="80034836"/>
- <reference key="parent" ref="141080932"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">687</int>
- <reference key="object" ref="128588396"/>
- <reference key="parent" ref="141080932"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">688</int>
- <reference key="object" ref="165057028"/>
- <reference key="parent" ref="141080932"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">689</int>
- <reference key="object" ref="5858980"/>
- <reference key="parent" ref="141080932"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">690</int>
- <reference key="object" ref="704355768"/>
- <reference key="parent" ref="141080932"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">691</int>
- <reference key="object" ref="275307167"/>
- <reference key="parent" ref="141080932"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">693</int>
- <reference key="object" ref="714155551"/>
- <reference key="parent" ref="141080932"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">694</int>
- <reference key="object" ref="197377228"/>
- <reference key="parent" ref="141080932"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">695</int>
- <reference key="object" ref="246962120"/>
- <reference key="parent" ref="141080932"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">696</int>
- <reference key="object" ref="602982148"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="930654435"/>
- </object>
- <reference key="parent" ref="141080932"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">700</int>
- <reference key="object" ref="1046338161"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="390929284"/>
- </object>
- <reference key="parent" ref="141080932"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">711</int>
- <reference key="object" ref="390929284"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="787796378"/>
- <reference ref="831785675"/>
- </object>
- <reference key="parent" ref="1046338161"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">712</int>
- <reference key="object" ref="787796378"/>
- <reference key="parent" ref="390929284"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">713</int>
- <reference key="object" ref="831785675"/>
- <reference key="parent" ref="390929284"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">734</int>
- <reference key="object" ref="930654435"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="671868626"/>
- <reference ref="497741775"/>
- <reference ref="285322108"/>
- <reference ref="456308224"/>
- </object>
- <reference key="parent" ref="602982148"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">735</int>
- <reference key="object" ref="671868626"/>
- <reference key="parent" ref="930654435"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">736</int>
- <reference key="object" ref="497741775"/>
- <reference key="parent" ref="930654435"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">737</int>
- <reference key="object" ref="285322108"/>
- <reference key="parent" ref="930654435"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">738</int>
- <reference key="object" ref="456308224"/>
- <reference key="parent" ref="930654435"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">817</int>
- <reference key="object" ref="971013910"/>
- <reference key="parent" ref="835318025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">818</int>
- <reference key="object" ref="532573582"/>
- <reference key="parent" ref="835318025"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">820</int>
- <reference key="object" ref="1026802243"/>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">825</int>
- <reference key="object" ref="588542073"/>
- <reference key="parent" ref="466310130"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">826</int>
- <reference key="object" ref="148271458"/>
- <reference key="parent" ref="466310130"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">827</int>
- <reference key="object" ref="924072330"/>
- <reference key="parent" ref="466310130"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">828</int>
- <reference key="object" ref="157577355"/>
- <reference key="parent" ref="466310130"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">832</int>
- <reference key="object" ref="403460345"/>
- <reference key="parent" ref="466310130"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">833</int>
- <reference key="object" ref="1008284068"/>
- <reference key="parent" ref="466310130"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">834</int>
- <reference key="object" ref="997106205"/>
- <reference key="parent" ref="466310130"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">838</int>
- <reference key="object" ref="72022292"/>
- <reference key="parent" ref="720053764"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">847</int>
- <reference key="object" ref="867741866"/>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">848</int>
- <reference key="object" ref="603467951"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1062528031"/>
- </object>
- <reference key="parent" ref="649796088"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">849</int>
- <reference key="object" ref="1062528031"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="parent" ref="603467951"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">853</int>
- <reference key="object" ref="509997857"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="844807595"/>
- <reference ref="832858329"/>
- </object>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">854</int>
- <reference key="object" ref="844807595"/>
- <reference key="parent" ref="509997857"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">855</int>
- <reference key="object" ref="832858329"/>
- <reference key="parent" ref="509997857"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>-3.IBPluginDependency</string>
- <string>103.IBPluginDependency</string>
- <string>103.ImportedFromIB2</string>
- <string>106.IBEditorWindowLastContentRect</string>
- <string>106.IBPluginDependency</string>
- <string>106.ImportedFromIB2</string>
- <string>106.editorWindowContentRectSynchronizationRect</string>
- <string>111.IBPluginDependency</string>
- <string>111.ImportedFromIB2</string>
- <string>129.IBPluginDependency</string>
- <string>129.ImportedFromIB2</string>
- <string>130.IBEditorWindowLastContentRect</string>
- <string>130.IBPluginDependency</string>
- <string>130.ImportedFromIB2</string>
- <string>130.editorWindowContentRectSynchronizationRect</string>
- <string>131.IBPluginDependency</string>
- <string>131.ImportedFromIB2</string>
- <string>134.IBPluginDependency</string>
- <string>134.ImportedFromIB2</string>
- <string>136.IBPluginDependency</string>
- <string>136.ImportedFromIB2</string>
- <string>143.IBPluginDependency</string>
- <string>143.ImportedFromIB2</string>
- <string>144.IBPluginDependency</string>
- <string>144.ImportedFromIB2</string>
- <string>145.IBPluginDependency</string>
- <string>145.ImportedFromIB2</string>
- <string>149.IBPluginDependency</string>
- <string>149.ImportedFromIB2</string>
- <string>150.IBPluginDependency</string>
- <string>150.ImportedFromIB2</string>
- <string>19.IBPluginDependency</string>
- <string>19.ImportedFromIB2</string>
- <string>23.IBPluginDependency</string>
- <string>23.ImportedFromIB2</string>
- <string>236.IBPluginDependency</string>
- <string>236.ImportedFromIB2</string>
- <string>239.IBPluginDependency</string>
- <string>239.ImportedFromIB2</string>
- <string>24.IBEditorWindowLastContentRect</string>
- <string>24.IBPluginDependency</string>
- <string>24.ImportedFromIB2</string>
- <string>24.editorWindowContentRectSynchronizationRect</string>
- <string>29.IBEditorWindowLastContentRect</string>
- <string>29.IBPluginDependency</string>
- <string>29.ImportedFromIB2</string>
- <string>29.WindowOrigin</string>
- <string>29.editorWindowContentRectSynchronizationRect</string>
- <string>295.IBPluginDependency</string>
- <string>296.IBEditorWindowLastContentRect</string>
- <string>296.IBPluginDependency</string>
- <string>296.editorWindowContentRectSynchronizationRect</string>
- <string>297.IBPluginDependency</string>
- <string>298.IBPluginDependency</string>
- <string>5.IBPluginDependency</string>
- <string>5.ImportedFromIB2</string>
- <string>56.IBPluginDependency</string>
- <string>56.ImportedFromIB2</string>
- <string>57.IBEditorWindowLastContentRect</string>
- <string>57.IBPluginDependency</string>
- <string>57.ImportedFromIB2</string>
- <string>57.editorWindowContentRectSynchronizationRect</string>
- <string>58.IBPluginDependency</string>
- <string>58.ImportedFromIB2</string>
- <string>684.IBPluginDependency</string>
- <string>685.IBEditorWindowLastContentRect</string>
- <string>685.IBPluginDependency</string>
- <string>686.IBPluginDependency</string>
- <string>687.IBPluginDependency</string>
- <string>688.IBPluginDependency</string>
- <string>689.IBPluginDependency</string>
- <string>690.IBPluginDependency</string>
- <string>691.IBPluginDependency</string>
- <string>693.IBPluginDependency</string>
- <string>694.IBPluginDependency</string>
- <string>695.IBPluginDependency</string>
- <string>696.IBPluginDependency</string>
- <string>700.IBPluginDependency</string>
- <string>711.IBEditorWindowLastContentRect</string>
- <string>711.IBPluginDependency</string>
- <string>712.IBPluginDependency</string>
- <string>713.IBPluginDependency</string>
- <string>72.IBPluginDependency</string>
- <string>72.ImportedFromIB2</string>
- <string>73.IBPluginDependency</string>
- <string>73.ImportedFromIB2</string>
- <string>734.IBEditorWindowLastContentRect</string>
- <string>734.IBPluginDependency</string>
- <string>735.IBPluginDependency</string>
- <string>736.IBPluginDependency</string>
- <string>737.IBPluginDependency</string>
- <string>738.IBPluginDependency</string>
- <string>74.IBPluginDependency</string>
- <string>74.ImportedFromIB2</string>
- <string>77.IBPluginDependency</string>
- <string>77.ImportedFromIB2</string>
- <string>78.IBPluginDependency</string>
- <string>78.ImportedFromIB2</string>
- <string>79.IBPluginDependency</string>
- <string>79.ImportedFromIB2</string>
- <string>80.IBPluginDependency</string>
- <string>80.ImportedFromIB2</string>
- <string>81.IBEditorWindowLastContentRect</string>
- <string>81.IBPluginDependency</string>
- <string>81.ImportedFromIB2</string>
- <string>81.editorWindowContentRectSynchronizationRect</string>
- <string>817.IBPluginDependency</string>
- <string>818.IBPluginDependency</string>
- <string>82.IBPluginDependency</string>
- <string>82.ImportedFromIB2</string>
- <string>820.IBPluginDependency</string>
- <string>825.IBPluginDependency</string>
- <string>826.IBPluginDependency</string>
- <string>827.IBPluginDependency</string>
- <string>828.IBPluginDependency</string>
- <string>83.IBPluginDependency</string>
- <string>83.ImportedFromIB2</string>
- <string>832.IBPluginDependency</string>
- <string>833.IBPluginDependency</string>
- <string>834.IBPluginDependency</string>
- <string>838.IBPluginDependency</string>
- <string>847.IBPluginDependency</string>
- <string>848.IBPluginDependency</string>
- <string>849.IBEditorWindowLastContentRect</string>
- <string>849.IBPluginDependency</string>
- <string>853.IBEditorWindowLastContentRect</string>
- <string>853.IBPluginDependency</string>
- <string>854.IBPluginDependency</string>
- <string>855.IBPluginDependency</string>
- <string>92.IBPluginDependency</string>
- <string>92.ImportedFromIB2</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{881, 774}, {157, 23}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{596, 852}, {216, 23}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{509, 573}, {64, 6}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{436, 809}, {64, 6}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{876, 712}, {194, 103}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{525, 802}, {197, 73}}</string>
- <string>{{604, 815}, {446, 20}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{74, 862}</string>
- <string>{{11, 977}, {478, 20}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{823, 465}, {234, 163}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{475, 832}, {234, 43}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{668, 632}, {186, 183}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{23, 794}, {245, 183}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{782, 612}, {151, 203}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{933, 592}, {150, 43}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{933, 572}, {238, 83}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{740, 652}, {179, 163}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>{{323, 672}, {199, 203}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{824, 809}, {64, 6}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{616, 718}, {206, 43}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <integer value="1"/>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">859</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">BookmarksController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>addBookmark:</string>
- <string>openBookmarkURL:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>addBookmark:</string>
- <string>openBookmarkURL:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">addBookmark:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">openBookmarkURL:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">defaultMenu</string>
- <string key="NS.object.0">NSMenu</string>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <string key="NS.key.0">defaultMenu</string>
- <object class="IBToOneOutletInfo" key="NS.object.0">
- <string key="name">defaultMenu</string>
- <string key="candidateClassName">NSMenu</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">BookmarksController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BrowserView</string>
- <string key="superclassName">ScrollableView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">BrowserView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BrowserViewController</string>
- <string key="superclassName">NSViewController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>backForwardSelected:</string>
- <string>goBack:</string>
- <string>goForward:</string>
- <string>goHome:</string>
- <string>navigate:</string>
- <string>reloadPage:</string>
- <string>stopLoading:</string>
- <string>zoomIn:</string>
- <string>zoomOriginal:</string>
- <string>zoomOut:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>backForwardSelected:</string>
- <string>goBack:</string>
- <string>goForward:</string>
- <string>goHome:</string>
- <string>navigate:</string>
- <string>reloadPage:</string>
- <string>stopLoading:</string>
- <string>zoomIn:</string>
- <string>zoomOriginal:</string>
- <string>zoomOut:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">backForwardSelected:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">goBack:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">goForward:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">goHome:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">navigate:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">reloadPage:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">stopLoading:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">zoomIn:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">zoomOriginal:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">zoomOut:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">browserView</string>
- <string key="NS.object.0">BrowserView</string>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <string key="NS.key.0">browserView</string>
- <object class="IBToOneOutletInfo" key="NS.object.0">
- <string key="name">browserView</string>
- <string key="candidateClassName">BrowserView</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">BrowserViewController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">BrowserWindowController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>closeCurrentTab:</string>
- <string>newTab:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>closeCurrentTab:</string>
- <string>newTab:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">closeCurrentTab:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">newTab:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>activeBrowserController</string>
- <string>navigationControl</string>
- <string>tabBar</string>
- <string>tabView</string>
- <string>urlField</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSObjectController</string>
- <string>NSSegmentedControl</string>
- <string>PSMTabBarControl</string>
- <string>NSTabView</string>
- <string>URLFieldCell</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>activeBrowserController</string>
- <string>navigationControl</string>
- <string>tabBar</string>
- <string>tabView</string>
- <string>urlField</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">activeBrowserController</string>
- <string key="candidateClassName">NSObjectController</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">navigationControl</string>
- <string key="candidateClassName">NSSegmentedControl</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">tabBar</string>
- <string key="candidateClassName">PSMTabBarControl</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">tabView</string>
- <string key="candidateClassName">NSTabView</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">urlField</string>
- <string key="candidateClassName">URLFieldCell</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">BrowserWindowController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="294109393">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabDragAssistant.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="831067236">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarCell.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="354078772">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarControl.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NetSurfAppDelegate</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>searchBackward:</string>
- <string>searchForward:</string>
- <string>showGlobalHistory:</string>
- <string>showPreferences:</string>
- <string>showSearchWindow:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>searchBackward:</string>
- <string>searchForward:</string>
- <string>showGlobalHistory:</string>
- <string>showPreferences:</string>
- <string>showSearchWindow:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">searchBackward:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">searchForward:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">showGlobalHistory:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">showPreferences:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">showSearchWindow:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">NetSurfAppDelegate.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">PSMTabBarControl</string>
- <reference key="sourceIdentifier" ref="831067236"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">PSMTabBarControl</string>
- <string key="superclassName">NSControl</string>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>delegate</string>
- <string>partnerView</string>
- <string>style</string>
- <string>tabView</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- <string>NSTabView</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>delegate</string>
- <string>partnerView</string>
- <string>style</string>
- <string>tabView</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">delegate</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">partnerView</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">style</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">tabView</string>
- <string key="candidateClassName">NSTabView</string>
- </object>
- </object>
- </object>
- <reference key="sourceIdentifier" ref="354078772"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">PSMTabBarControl</string>
- <reference key="sourceIdentifier" ref="294109393"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">PSMTabBarControl</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabStyle.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">ScrollableView</string>
- <string key="superclassName">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">ScrollableView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">SearchWindowController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>searchNext:</string>
- <string>searchPrevious:</string>
- <string>searchStringDidChange:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>searchNext:</string>
- <string>searchPrevious:</string>
- <string>searchStringDidChange:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBActionInfo">
- <string key="name">searchNext:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">searchPrevious:</string>
- <string key="candidateClassName">id</string>
- </object>
- <object class="IBActionInfo">
- <string key="name">searchStringDidChange:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">SearchWindowController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">URLFieldCell</string>
- <string key="superclassName">NSTextFieldCell</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">URLFieldCell.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
- <integer value="1050" key="NS.object.0"/>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
- <integer value="3000" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">../NetSurf.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSMenuCheckmark</string>
- <string>NSMenuMixedState</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>{9, 8}</string>
- <string>{7, 2}</string>
- </object>
- </object>
- </data>
-</archive>
diff --git a/frontends/cocoa/res/NetSurf-Info.plist b/frontends/cocoa/res/NetSurf-Info.plist
deleted file mode 100644
index 60bf6820e..000000000
--- a/frontends/cocoa/res/NetSurf-Info.plist
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleDocumentTypes</key>
- <array>
- <dict>
- <key>CFBundleTypeExtensions</key>
- <array/>
- <key>CFBundleTypeMIMETypes</key>
- <array/>
- <key>CFBundleTypeName</key>
- <string>HTML</string>
- <key>CFBundleTypeRole</key>
- <string>Viewer</string>
- <key>LSItemContentTypes</key>
- <array>
- <string>public.html</string>
- </array>
- </dict>
- </array>
- <key>CFBundleExecutable</key>
- <string>${EXECUTABLE_NAME}</string>
- <key>CFBundleIconFile</key>
- <string>NetSurf</string>
- <key>CFBundleIdentifier</key>
- <string>org.netsurf-browser.${PRODUCT_NAME:rfc1034identifier}</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>${PRODUCT_NAME}</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleShortVersionString</key>
- <string>${NETSURF_VERSION}</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleURLTypes</key>
- <array>
- <dict>
- <key>CFBundleURLName</key>
- <string>org.netsurf-browser.NetSurf.URI</string>
- <key>CFBundleURLSchemes</key>
- <array>
- <string>http</string>
- <string>https</string>
- </array>
- </dict>
- </array>
- <key>CFBundleVersion</key>
- <string>${NETSURF_SHORT_VERSION}</string>
- <key>LSMinimumSystemVersion</key>
- <string>${MACOSX_DEPLOYMENT_TARGET}</string>
- <key>NSMainNibFile</key>
- <string>MainMenu</string>
- <key>NSPrincipalClass</key>
- <string>NetSurfApp</string>
- <key>NSServices</key>
- <array/>
- <key>UTExportedTypeDeclarations</key>
- <array/>
- <key>UTImportedTypeDeclarations</key>
- <array>
- <dict>
- <key>UTTypeConformsTo</key>
- <array>
- <string>public.text</string>
- </array>
- <key>UTTypeDescription</key>
- <string>HTML</string>
- <key>UTTypeIdentifier</key>
- <string>public.html</string>
- <key>UTTypeTagSpecification</key>
- <dict>
- <key>public.filename-extension</key>
- <array>
- <string>html</string>
- <string>htm</string>
- </array>
- <key>public.mime-type</key>
- <array>
- <string>text/html</string>
- </array>
- </dict>
- </dict>
- <dict>
- <key>UTTypeConformsTo</key>
- <array>
- <string>public.source-code</string>
- </array>
- <key>UTTypeDescription</key>
- <string>CSS</string>
- <key>UTTypeIdentifier</key>
- <string>org.w3.css</string>
- <key>UTTypeTagSpecification</key>
- <dict>
- <key>public.filename-extension</key>
- <array>
- <string>css</string>
- </array>
- <key>public.mime-type</key>
- <array>
- <string>text/css</string>
- </array>
- </dict>
- </dict>
- </array>
-</dict>
-</plist>
diff --git a/frontends/cocoa/res/NetSurf.icns b/frontends/cocoa/res/NetSurf.icns
deleted file mode 100644
index 654942373..000000000
--- a/frontends/cocoa/res/NetSurf.icns
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/res/PreferencesWindow.xib b/frontends/cocoa/res/PreferencesWindow.xib
deleted file mode 100644
index c4ea6b3b6..000000000
--- a/frontends/cocoa/res/PreferencesWindow.xib
+++ /dev/null
@@ -1,512 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
- <data>
- <int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">9L31a</string>
- <string key="IBDocument.InterfaceBuilderVersion">680</string>
- <string key="IBDocument.AppKitVersion">949.54</string>
- <string key="IBDocument.HIToolboxVersion">353.00</string>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="2"/>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1001">
- <string key="NSClassName">PreferencesWindowController</string>
- </object>
- <object class="NSCustomObject" id="1003">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1004">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSWindowTemplate" id="1005">
- <int key="NSWindowStyleMask">7</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{196, 362}, {455, 148}}</string>
- <int key="NSWTFlags">1618477056</int>
- <string key="NSWindowTitle">Preferences</string>
- <string key="NSWindowClass">NSWindow</string>
- <nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
- <object class="NSView" key="NSWindowView" id="1006">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSTextField" id="343066491">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{98, 106}, {337, 22}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="218234675">
- <int key="NSCellFlags">-1804468671</int>
- <int key="NSCellFlags2">272630784</int>
- <string key="NSContents"/>
- <object class="NSFont" key="NSSupport" id="1015231142">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">1.300000e+01</double>
- <int key="NSfFlags">1044</int>
- </object>
- <reference key="NSControlView" ref="343066491"/>
- <bool key="NSDrawsBackground">YES</bool>
- <object class="NSColor" key="NSBackgroundColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">textBackgroundColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- </object>
- </object>
- <object class="NSColor" key="NSTextColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">textColor</string>
- <object class="NSColor" key="NSColor" id="751207648">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MAA</bytes>
- </object>
- </object>
- </object>
- </object>
- <object class="NSTextField" id="662601838">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{17, 108}, {76, 17}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="633183289">
- <int key="NSCellFlags">68288064</int>
- <int key="NSCellFlags2">272630784</int>
- <string key="NSContents">Homepage:</string>
- <reference key="NSSupport" ref="1015231142"/>
- <reference key="NSControlView" ref="662601838"/>
- <object class="NSColor" key="NSBackgroundColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes>
- </object>
- </object>
- <object class="NSColor" key="NSTextColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlTextColor</string>
- <reference key="NSColor" ref="751207648"/>
- </object>
- </object>
- </object>
- <object class="NSButton" id="272890940">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{222, 70}, {219, 32}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="136693114">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents">Use current page</string>
- <reference key="NSSupport" ref="1015231142"/>
- <reference key="NSControlView" ref="272890940"/>
- <int key="NSButtonFlags">-2038284033</int>
- <int key="NSButtonFlags2">129</int>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSButton" id="748375959">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{96, 38}, {341, 18}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="497902592">
- <int key="NSCellFlags">-2080244224</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Cancel downloads without asking</string>
- <reference key="NSSupport" ref="1015231142"/>
- <reference key="NSControlView" ref="748375959"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <object class="NSCustomResource" key="NSNormalImage" id="118883570">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSSwitch</string>
- </object>
- <object class="NSButtonImageSource" key="NSAlternateImage" id="21608943">
- <string key="NSImageName">NSSwitch</string>
- </object>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSButton" id="832107887">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{96, 18}, {341, 18}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="616812964">
- <int key="NSCellFlags">-2080244224</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Close multiple tabs without asking</string>
- <reference key="NSSupport" ref="1015231142"/>
- <reference key="NSControlView" ref="832107887"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="118883570"/>
- <reference key="NSAlternateImage" ref="21608943"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- </object>
- <string key="NSFrameSize">{455, 148}</string>
- <reference key="NSSuperview"/>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
- <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
- </object>
- <object class="NSUserDefaultsController" id="562818373">
- <bool key="NSSharedInstance">YES</bool>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="1005"/>
- </object>
- <int key="connectionID">3</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: values.AlwaysCancelDownload</string>
- <reference key="source" ref="748375959"/>
- <reference key="destination" ref="562818373"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="748375959"/>
- <reference key="NSDestination" ref="562818373"/>
- <string key="NSLabel">value: values.AlwaysCancelDownload</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">values.AlwaysCancelDownload</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">21</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: values.AlwaysCloseMultipleTabs</string>
- <reference key="source" ref="832107887"/>
- <reference key="destination" ref="562818373"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="832107887"/>
- <reference key="NSDestination" ref="562818373"/>
- <string key="NSLabel">value: values.AlwaysCloseMultipleTabs</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">values.AlwaysCloseMultipleTabs</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">22</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">useCurrentPageAsHomepage:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="272890940"/>
- </object>
- <int key="connectionID">23</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: homepageURL</string>
- <reference key="source" ref="343066491"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="343066491"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">value: homepageURL</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">homepageURL</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">25</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <object class="NSArray" key="object" id="854144324">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1001"/>
- <reference key="parent" ref="854144324"/>
- <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1003"/>
- <reference key="parent" ref="854144324"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1004"/>
- <reference key="parent" ref="854144324"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">1</int>
- <reference key="object" ref="1005"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1006"/>
- </object>
- <reference key="parent" ref="854144324"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">2</int>
- <reference key="object" ref="1006"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="343066491"/>
- <reference ref="662601838"/>
- <reference ref="272890940"/>
- <reference ref="748375959"/>
- <reference ref="832107887"/>
- </object>
- <reference key="parent" ref="1005"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">9</int>
- <reference key="object" ref="343066491"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="218234675"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">10</int>
- <reference key="object" ref="218234675"/>
- <reference key="parent" ref="343066491"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">11</int>
- <reference key="object" ref="662601838"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="633183289"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">12</int>
- <reference key="object" ref="633183289"/>
- <reference key="parent" ref="662601838"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">13</int>
- <reference key="object" ref="272890940"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="136693114"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">14</int>
- <reference key="object" ref="136693114"/>
- <reference key="parent" ref="272890940"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">15</int>
- <reference key="object" ref="748375959"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="497902592"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">16</int>
- <reference key="object" ref="497902592"/>
- <reference key="parent" ref="748375959"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">17</int>
- <reference key="object" ref="832107887"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="616812964"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">18</int>
- <reference key="object" ref="616812964"/>
- <reference key="parent" ref="832107887"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">19</int>
- <reference key="object" ref="562818373"/>
- <reference key="parent" ref="854144324"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>1.IBEditorWindowLastContentRect</string>
- <string>1.IBPluginDependency</string>
- <string>1.IBWindowTemplateEditedContentRect</string>
- <string>1.NSWindowTemplate.visibleAtLaunch</string>
- <string>1.WindowOrigin</string>
- <string>1.editorWindowContentRectSynchronizationRect</string>
- <string>10.IBPluginDependency</string>
- <string>11.IBPluginDependency</string>
- <string>11.IBViewBoundsToFrameTransform</string>
- <string>12.IBPluginDependency</string>
- <string>13.IBPluginDependency</string>
- <string>13.IBViewBoundsToFrameTransform</string>
- <string>14.IBPluginDependency</string>
- <string>15.IBPluginDependency</string>
- <string>16.IBPluginDependency</string>
- <string>17.IBPluginDependency</string>
- <string>17.IBViewBoundsToFrameTransform</string>
- <string>18.IBPluginDependency</string>
- <string>2.IBPluginDependency</string>
- <string>9.IBPluginDependency</string>
- <string>9.IBViewBoundsToFrameTransform</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>{{176, 384}, {455, 148}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{176, 384}, {455, 148}}</string>
- <integer value="1"/>
- <string>{196, 240}</string>
- <string>{{202, 428}, {480, 270}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABCYAAAw2sAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABClgAAw3wAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABCwAAAwggAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABDSQAAw2sAAA</bytes>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">25</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabDragAssistant.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarCell.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarControl.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">PreferencesWindowController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PreferencesWindowController.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.LastKnownRelativeProjectPath">../NetSurf.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- </data>
-</archive>
diff --git a/frontends/cocoa/res/SearchWindow.xib b/frontends/cocoa/res/SearchWindow.xib
deleted file mode 100644
index 8e9315b51..000000000
--- a/frontends/cocoa/res/SearchWindow.xib
+++ /dev/null
@@ -1,614 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
- <data>
- <int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">9L31a</string>
- <string key="IBDocument.InterfaceBuilderVersion">680</string>
- <string key="IBDocument.AppKitVersion">949.54</string>
- <string key="IBDocument.HIToolboxVersion">353.00</string>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="2"/>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1001">
- <string key="NSClassName">SearchWindowController</string>
- </object>
- <object class="NSCustomObject" id="1003">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1004">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSWindowTemplate" id="1005">
- <int key="NSWindowStyleMask">7</int>
- <int key="NSWindowBacking">2</int>
- <string key="NSWindowRect">{{196, 354}, {480, 156}}</string>
- <int key="NSWTFlags">1618477056</int>
- <string key="NSWindowTitle">Search</string>
- <string key="NSWindowClass">NSWindow</string>
- <nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
- <object class="NSView" key="NSWindowView" id="1006">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSTextField" id="656125083">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{67, 114}, {393, 22}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="175732045">
- <int key="NSCellFlags">-1803944383</int>
- <int key="NSCellFlags2">272630784</int>
- <string key="NSContents"/>
- <object class="NSFont" key="NSSupport" id="926601808">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">1.300000e+01</double>
- <int key="NSfFlags">1044</int>
- </object>
- <reference key="NSControlView" ref="656125083"/>
- <bool key="NSDrawsBackground">YES</bool>
- <object class="NSColor" key="NSBackgroundColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">textBackgroundColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- </object>
- </object>
- <object class="NSColor" key="NSTextColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">textColor</string>
- <object class="NSColor" key="NSColor" id="92132461">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MAA</bytes>
- </object>
- </object>
- </object>
- </object>
- <object class="NSTextField" id="90768291">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{17, 116}, {45, 14}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="874604921">
- <int key="NSCellFlags">68288064</int>
- <int key="NSCellFlags2">71435264</int>
- <string key="NSContents">Find:</string>
- <object class="NSFont" key="NSSupport">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">1.100000e+01</double>
- <int key="NSfFlags">3100</int>
- </object>
- <reference key="NSControlView" ref="90768291"/>
- <object class="NSColor" key="NSBackgroundColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes>
- </object>
- </object>
- <object class="NSColor" key="NSTextColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlTextColor</string>
- <reference key="NSColor" ref="92132461"/>
- </object>
- </object>
- </object>
- <object class="NSButton" id="1016680565">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{370, 12}, {96, 32}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="567819516">
- <int key="NSCellFlags">67239424</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents">Next</string>
- <reference key="NSSupport" ref="926601808"/>
- <reference key="NSControlView" ref="1016680565"/>
- <int key="NSButtonFlags">-2038284033</int>
- <int key="NSButtonFlags2">129</int>
- <string key="NSAlternateContents"/>
- <string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSButton" id="88766619">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{274, 12}, {96, 32}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="450885469">
- <int key="NSCellFlags">-2080244224</int>
- <int key="NSCellFlags2">134217728</int>
- <string key="NSContents">Previous</string>
- <reference key="NSSupport" ref="926601808"/>
- <reference key="NSControlView" ref="88766619"/>
- <int key="NSButtonFlags">-2038284033</int>
- <int key="NSButtonFlags2">129</int>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSButton" id="650505141">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{139, 90}, {323, 18}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="657985060">
- <int key="NSCellFlags">-2080244224</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Case sensitive</string>
- <reference key="NSSupport" ref="926601808"/>
- <reference key="NSControlView" ref="650505141"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <object class="NSCustomResource" key="NSNormalImage" id="312987126">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSSwitch</string>
- </object>
- <object class="NSButtonImageSource" key="NSAlternateImage" id="973359313">
- <string key="NSImageName">NSSwitch</string>
- </object>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- <object class="NSButton" id="331870754">
- <reference key="NSNextResponder" ref="1006"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{139, 70}, {323, 18}}</string>
- <reference key="NSSuperview" ref="1006"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="239506938">
- <int key="NSCellFlags">-2080244224</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents">Select all</string>
- <reference key="NSSupport" ref="926601808"/>
- <reference key="NSControlView" ref="331870754"/>
- <int key="NSButtonFlags">1211912703</int>
- <int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="312987126"/>
- <reference key="NSAlternateImage" ref="973359313"/>
- <string key="NSAlternateContents"/>
- <string key="NSKeyEquivalent"/>
- <int key="NSPeriodicDelay">200</int>
- <int key="NSPeriodicInterval">25</int>
- </object>
- </object>
- </object>
- <string key="NSFrameSize">{480, 156}</string>
- <reference key="NSSuperview"/>
- </object>
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
- <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">searchNext:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="1016680565"/>
- </object>
- <int key="connectionID">15</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">searchPrevious:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="88766619"/>
- </object>
- <int key="connectionID">16</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">enabled: canGoForward</string>
- <reference key="source" ref="1016680565"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="1016680565"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">enabled: canGoForward</string>
- <string key="NSBinding">enabled</string>
- <string key="NSKeyPath">canGoForward</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">17</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">enabled: canGoBack</string>
- <reference key="source" ref="88766619"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="88766619"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">enabled: canGoBack</string>
- <string key="NSBinding">enabled</string>
- <string key="NSKeyPath">canGoBack</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">18</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">searchStringDidChange:</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="656125083"/>
- </object>
- <int key="connectionID">22</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="1005"/>
- </object>
- <int key="connectionID">23</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: searchString</string>
- <reference key="source" ref="656125083"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="656125083"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">value: searchString</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">searchString</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">24</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: caseSensitive</string>
- <reference key="source" ref="650505141"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="650505141"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">value: caseSensitive</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">caseSensitive</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">25</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: selectAll</string>
- <reference key="source" ref="331870754"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="331870754"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">value: selectAll</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">selectAll</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">27</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <object class="NSArray" key="object" id="729119712">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1001"/>
- <reference key="parent" ref="729119712"/>
- <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1003"/>
- <reference key="parent" ref="729119712"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1004"/>
- <reference key="parent" ref="729119712"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">1</int>
- <reference key="object" ref="1005"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1006"/>
- </object>
- <reference key="parent" ref="729119712"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">2</int>
- <reference key="object" ref="1006"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="656125083"/>
- <reference ref="90768291"/>
- <reference ref="1016680565"/>
- <reference ref="88766619"/>
- <reference ref="331870754"/>
- <reference ref="650505141"/>
- </object>
- <reference key="parent" ref="1005"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">3</int>
- <reference key="object" ref="656125083"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="175732045"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">4</int>
- <reference key="object" ref="175732045"/>
- <reference key="parent" ref="656125083"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">5</int>
- <reference key="object" ref="90768291"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="874604921"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">6</int>
- <reference key="object" ref="874604921"/>
- <reference key="parent" ref="90768291"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">7</int>
- <reference key="object" ref="1016680565"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="567819516"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">8</int>
- <reference key="object" ref="567819516"/>
- <reference key="parent" ref="1016680565"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">9</int>
- <reference key="object" ref="88766619"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="450885469"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">10</int>
- <reference key="object" ref="450885469"/>
- <reference key="parent" ref="88766619"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">11</int>
- <reference key="object" ref="650505141"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="657985060"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">12</int>
- <reference key="object" ref="657985060"/>
- <reference key="parent" ref="650505141"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">13</int>
- <reference key="object" ref="331870754"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="239506938"/>
- </object>
- <reference key="parent" ref="1006"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">14</int>
- <reference key="object" ref="239506938"/>
- <reference key="parent" ref="331870754"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>1.IBEditorWindowLastContentRect</string>
- <string>1.IBPluginDependency</string>
- <string>1.IBWindowTemplateEditedContentRect</string>
- <string>1.NSWindowTemplate.visibleAtLaunch</string>
- <string>1.WindowOrigin</string>
- <string>1.editorWindowContentRectSynchronizationRect</string>
- <string>10.IBPluginDependency</string>
- <string>11.IBPluginDependency</string>
- <string>11.IBViewBoundsToFrameTransform</string>
- <string>12.IBPluginDependency</string>
- <string>13.IBPluginDependency</string>
- <string>13.IBViewBoundsToFrameTransform</string>
- <string>14.IBPluginDependency</string>
- <string>2.IBPluginDependency</string>
- <string>3.IBPluginDependency</string>
- <string>4.IBPluginDependency</string>
- <string>5.IBPluginDependency</string>
- <string>5.IBViewBoundsToFrameTransform</string>
- <string>6.IBPluginDependency</string>
- <string>7.IBPluginDependency</string>
- <string>7.IBViewBoundsToFrameTransform</string>
- <string>8.IBPluginDependency</string>
- <string>9.IBPluginDependency</string>
- <string>9.IBViewBoundsToFrameTransform</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>{{185, 223}, {480, 156}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{185, 223}, {480, 156}}</string>
- <boolean value="NO"/>
- <string>{196, 240}</string>
- <string>{{202, 428}, {480, 270}}</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABDCwAAwpQAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABDk4AAwpQAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABBiAAAw3IAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABDuQAAwigAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABDiQAAwigAAA</bytes>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">27</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabDragAssistant.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarCell.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PSMTabBarControl/PSMTabBarControl.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">SearchWindowController</string>
- <string key="superclassName">NSWindowController</string>
- <object class="NSMutableDictionary" key="actions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>searchNext:</string>
- <string>searchPrevious:</string>
- <string>searchStringDidChange:</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>id</string>
- <string>id</string>
- <string>id</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">SearchWindowController.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.LastKnownRelativeProjectPath">../NetSurf.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- </data>
-</archive>
diff --git a/frontends/cocoa/res/adblock.css b/frontends/cocoa/res/adblock.css
deleted file mode 120000
index ff2485622..000000000
--- a/frontends/cocoa/res/adblock.css
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/AdBlock,f79 \ No newline at end of file
diff --git a/frontends/cocoa/res/ca-bundle b/frontends/cocoa/res/ca-bundle
deleted file mode 120000
index 0b0e416ad..000000000
--- a/frontends/cocoa/res/ca-bundle
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/ca-bundle \ No newline at end of file
diff --git a/frontends/cocoa/res/de.lproj/BookmarksWindow.xib.strings b/frontends/cocoa/res/de.lproj/BookmarksWindow.xib.strings
deleted file mode 100644
index 5fa44a11e..000000000
--- a/frontends/cocoa/res/de.lproj/BookmarksWindow.xib.strings
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/res/de.lproj/BrowserWindow.xib.strings b/frontends/cocoa/res/de.lproj/BrowserWindow.xib.strings
deleted file mode 100644
index a0c782cd6..000000000
--- a/frontends/cocoa/res/de.lproj/BrowserWindow.xib.strings
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/res/de.lproj/DownloadWindow.xib.strings b/frontends/cocoa/res/de.lproj/DownloadWindow.xib.strings
deleted file mode 100644
index d92040249..000000000
--- a/frontends/cocoa/res/de.lproj/DownloadWindow.xib.strings
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/res/de.lproj/HistoryWindow.xib.strings b/frontends/cocoa/res/de.lproj/HistoryWindow.xib.strings
deleted file mode 100644
index c43bc418e..000000000
--- a/frontends/cocoa/res/de.lproj/HistoryWindow.xib.strings
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/res/de.lproj/Localizable.strings b/frontends/cocoa/res/de.lproj/Localizable.strings
deleted file mode 100644
index 04180f485..000000000
--- a/frontends/cocoa/res/de.lproj/Localizable.strings
+++ /dev/null
@@ -1,78 +0,0 @@
-/* ... of (total size) */
-" of %@" = " von %@";
-
-/* time remaining: hours, minutes */
-"%2:%02u hours" = "%1$:%2$u Stunden";
-
-/* time remaining */
-"%u seconds" = "%u Sekunden";
-
-/* time remaining: minutes, seconds */
-"%u:%02u minutes" = "%1$u:%2$u Minuten";
-
-/* Context menu */
-"Back" = "Zurück";
-
-/* Download */
-"Cancel download?" = "Download abbrechen?";
-
-/* Context menu */
-"Copy image" = "Bild kopieren";
-
-/* Context menu */
-"Copy link" = "Link kopieren";
-
-/* No comment provided by engineer. */
-"Do you really want to close this window?" = "Wollen Sie dieses Fenster wirklich schließen?";
-
-/* show error */
-"Error" = "Fehler";
-
-/* Context menu */
-"Forward" = "Vorwärts";
-
-/* time remaining */
-"less than 10 seconds" = "weniger als 10 Sekunden";
-
-/* 'No' button */
-"No" = "Nein";
-
-/* 'OK' button */
-"OK" = "OK";
-
-/* Context menu */
-"Open image in new tab" = "Bild in neuem Tab öffnen";
-
-/* Context menu */
-"Open image in new window" = "Bild in neuem Fenster öffnen";
-
-/* Context menu */
-"Open link in new tab" = "Link in neuem Tab öffnen";
-
-/* Context menu */
-"Open link in new window" = "Link in neuem Fenster öffnen";
-
-/* Context menu */
-"Reload" = "Neu laden";
-
-/* Context menu */
-"Save image as" = "Bild speichern";
-
-/* Context menu */
-"Save link target" = "Linkziel speichern";
-
-/* Download */
-"Should the download of '%@' really be cancelled?" = "Soll der Download von '%@' wirklich abgebrochen werden?";
-
-/* No comment provided by engineer. */
-"There are %d tabs open, do you want to close them all?" = "Es sind noch %d tabs offen. Sollen alle geschlossen werden?";
-
-/* Warning title */
-"Warning" = "Warnung";
-
-/* Warning message */
-"Warning %s%s%s" = "Warnung %1$s%2$s%3$s";
-
-/* 'Yes' button */
-"Yes" = "Ja";
-
diff --git a/frontends/cocoa/res/de.lproj/MainMenu.xib.strings b/frontends/cocoa/res/de.lproj/MainMenu.xib.strings
deleted file mode 100644
index 3fc91c48c..000000000
--- a/frontends/cocoa/res/de.lproj/MainMenu.xib.strings
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/res/de.lproj/Messages b/frontends/cocoa/res/de.lproj/Messages
deleted file mode 120000
index 32530a151..000000000
--- a/frontends/cocoa/res/de.lproj/Messages
+++ /dev/null
@@ -1 +0,0 @@
-../../../../!NetSurf/Resources/de/Messages \ No newline at end of file
diff --git a/frontends/cocoa/res/de.lproj/PreferencesWindow.xib.strings b/frontends/cocoa/res/de.lproj/PreferencesWindow.xib.strings
deleted file mode 100644
index fbe9762f2..000000000
--- a/frontends/cocoa/res/de.lproj/PreferencesWindow.xib.strings
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/res/de.lproj/SearchWindow.xib.strings b/frontends/cocoa/res/de.lproj/SearchWindow.xib.strings
deleted file mode 100644
index 31fdea76b..000000000
--- a/frontends/cocoa/res/de.lproj/SearchWindow.xib.strings
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/res/default.css b/frontends/cocoa/res/default.css
deleted file mode 120000
index a8579eb7c..000000000
--- a/frontends/cocoa/res/default.css
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/CSS,f79 \ No newline at end of file
diff --git a/frontends/cocoa/res/en.lproj/Localizable.strings b/frontends/cocoa/res/en.lproj/Localizable.strings
deleted file mode 100644
index 9ac7a7b4d..000000000
--- a/frontends/cocoa/res/en.lproj/Localizable.strings
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/res/en.lproj/Messages b/frontends/cocoa/res/en.lproj/Messages
deleted file mode 120000
index a26483244..000000000
--- a/frontends/cocoa/res/en.lproj/Messages
+++ /dev/null
@@ -1 +0,0 @@
-../../../../!NetSurf/Resources/en/Messages \ No newline at end of file
diff --git a/frontends/cocoa/res/fr.lproj/Localizable.strings b/frontends/cocoa/res/fr.lproj/Localizable.strings
deleted file mode 100644
index 9ac7a7b4d..000000000
--- a/frontends/cocoa/res/fr.lproj/Localizable.strings
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/res/fr.lproj/Messages b/frontends/cocoa/res/fr.lproj/Messages
deleted file mode 120000
index 467559b12..000000000
--- a/frontends/cocoa/res/fr.lproj/Messages
+++ /dev/null
@@ -1 +0,0 @@
-../../../../!NetSurf/Resources/fr/Messages \ No newline at end of file
diff --git a/frontends/cocoa/res/internal.css b/frontends/cocoa/res/internal.css
deleted file mode 120000
index 17f9f1504..000000000
--- a/frontends/cocoa/res/internal.css
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/internal.css,f79 \ No newline at end of file
diff --git a/frontends/cocoa/res/it.lproj/Localizable.strings b/frontends/cocoa/res/it.lproj/Localizable.strings
deleted file mode 100644
index 5927796a6..000000000
--- a/frontends/cocoa/res/it.lproj/Localizable.strings
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/res/it.lproj/Messages b/frontends/cocoa/res/it.lproj/Messages
deleted file mode 120000
index 00fc6d1ed..000000000
--- a/frontends/cocoa/res/it.lproj/Messages
+++ /dev/null
@@ -1 +0,0 @@
-../../../../!NetSurf/Resources/it/Messages \ No newline at end of file
diff --git a/frontends/cocoa/res/netsurf.png b/frontends/cocoa/res/netsurf.png
deleted file mode 120000
index 905512c25..000000000
--- a/frontends/cocoa/res/netsurf.png
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/netsurf.png,b60 \ No newline at end of file
diff --git a/frontends/cocoa/res/nl.lproj/Localizable.strings b/frontends/cocoa/res/nl.lproj/Localizable.strings
deleted file mode 100644
index 9ac7a7b4d..000000000
--- a/frontends/cocoa/res/nl.lproj/Localizable.strings
+++ /dev/null
Binary files differ
diff --git a/frontends/cocoa/res/nl.lproj/Messages b/frontends/cocoa/res/nl.lproj/Messages
deleted file mode 120000
index c8a9cbe81..000000000
--- a/frontends/cocoa/res/nl.lproj/Messages
+++ /dev/null
@@ -1 +0,0 @@
-../../../../!NetSurf/Resources/nl/Messages \ No newline at end of file
diff --git a/frontends/cocoa/res/quirks.css b/frontends/cocoa/res/quirks.css
deleted file mode 120000
index 88aabe48c..000000000
--- a/frontends/cocoa/res/quirks.css
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/Quirks,f79 \ No newline at end of file
diff --git a/frontends/cocoa/schedule.h b/frontends/cocoa/schedule.h
deleted file mode 100644
index 43b2c1462..000000000
--- a/frontends/cocoa/schedule.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-nserror cocoa_schedule(int t, void (*callback)(void *p), void *p);
diff --git a/frontends/cocoa/schedule.m b/frontends/cocoa/schedule.m
deleted file mode 100644
index f0896bd9d..000000000
--- a/frontends/cocoa/schedule.m
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "utils/errors.h"
-
-#import "cocoa/schedule.h"
-
-@interface ScheduledCallback : NSObject {
- void (*callback)( void *userData );
- void *userData;
-}
-
-- initWithCallback: (void (*)(void *))cb userData: (void *)ud;
-- (void) schedule: (NSTimeInterval) ti;
-
-@end
-
-@implementation ScheduledCallback
-
-- initWithCallback: (void (*)(void *))cb userData: (void *)ud;
-{
- callback = cb;
- userData = ud;
-
- return self;
-}
-
-static NSMutableSet *timerSet = nil;
-
-- (void) schedule: (NSTimeInterval) ti;
-{
- if (nil == timerSet) {
- timerSet = [[NSMutableSet alloc] init];
- }
-
- [self performSelector: @selector(timerFired) withObject: nil afterDelay: ti];
- [timerSet addObject: self];
-}
-
-- (void) timerFired;
-{
- if ([timerSet containsObject: self]) {
- [timerSet removeObject: self];
- callback( userData );
- }
-}
-
-- (BOOL) isEqual: (id)object
-{
- if (object == self) return YES;
- if ([object class] != [self class]) return NO;
- return ((ScheduledCallback *)object)->callback == callback && ((ScheduledCallback *)object)->userData == userData;
-}
-
-- (NSUInteger) hash;
-{
- return (NSUInteger)callback + (NSUInteger)userData;
-}
-
-@end
-
-/* exported interface documented in cocoa/schedule.h */
-nserror cocoa_schedule(int t, void (*callback)(void *p), void *p)
-{
- ScheduledCallback *cb = [[ScheduledCallback alloc] initWithCallback: callback userData: p];
- [timerSet removeObject: cb];
- if (t >= 0) {
- [cb schedule: (NSTimeInterval)t / 1000];
- }
- [cb release];
-
- return NSERROR_OK;
-}
diff --git a/frontends/cocoa/selection.h b/frontends/cocoa/selection.h
deleted file mode 100644
index 67331ea83..000000000
--- a/frontends/cocoa/selection.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-struct gui_clipboard_table *cocoa_clipboard_table;
diff --git a/frontends/cocoa/selection.m b/frontends/cocoa/selection.m
deleted file mode 100644
index 37562bc07..000000000
--- a/frontends/cocoa/selection.m
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "cocoa/BrowserViewController.h"
-#import "cocoa/selection.h"
-
-#import "netsurf/clipboard.h"
-
-
-static NSMutableString *cocoa_clipboard_string;
-
-/**
- * Core asks front end for clipboard contents.
- *
- * \param buffer UTF-8 text, allocated by front end, ownership yeilded to core
- * \param length Byte length of UTF-8 text in buffer
- */
-static void gui_get_clipboard(char **buffer, size_t *length)
-{
- NSPasteboard *pb = [NSPasteboard generalPasteboard];
- NSString *string = [pb stringForType: NSStringPboardType];
-
- *buffer = NULL;
- *length = 0;
-
- if (string) {
- const char *text = [string UTF8String];
- *length = strlen(text);
-
- *buffer = malloc(*length);
-
- if (*buffer != NULL) {
- memcpy(*buffer, text, *length);
- } else {
- *length = 0;
- }
- }
-}
-
-/**
- * Core tells front end to put given text in clipboard
- *
- * \param buffer UTF-8 text, owned by core
- * \param length Byte length of UTF-8 text in buffer
- * \param styles Array of styles given to text runs, owned by core, or NULL
- * \param n_styles Number of text run styles in array
- */
-static void gui_set_clipboard(const char *buffer, size_t length,
- nsclipboard_styles styles[], int n_styles)
-{
- /* Empty clipboard string */
- if (nil == cocoa_clipboard_string) {
- cocoa_clipboard_string = [[NSMutableString alloc] init];
- } else {
- [cocoa_clipboard_string setString: @""];
- }
-
- /* Add text to clipboard string */
- if (nil == cocoa_clipboard_string) return;
-
- [cocoa_clipboard_string appendString: [[[NSString alloc]
- initWithBytes: buffer
- length: length
- encoding: NSUTF8StringEncoding]
- autorelease]];
-
- /* Stick it on the pasteboard */
- NSPasteboard *pb = [NSPasteboard generalPasteboard];
- [pb declareTypes: [NSArray arrayWithObject: NSStringPboardType] owner: nil];
- bool result = [pb setString: cocoa_clipboard_string forType: NSStringPboardType];
-
- if (result) {
- /* Empty clipboard string */
- if (nil == cocoa_clipboard_string) {
- cocoa_clipboard_string = [[NSMutableString alloc] init];
- } else {
- [cocoa_clipboard_string setString: @""];
- }
- }
-}
-
-static struct gui_clipboard_table clipboard_table = {
- .get = gui_get_clipboard,
- .set = gui_set_clipboard,
-};
-
-struct gui_clipboard_table *cocoa_clipboard_table = &clipboard_table;
diff --git a/frontends/framebuffer/Makefile b/frontends/framebuffer/Makefile
index 6d2acb079..bdedd903b 100644
--- a/frontends/framebuffer/Makefile
+++ b/frontends/framebuffer/Makefile
@@ -130,10 +130,12 @@ define convert_font
S_FONTS += $(2)
-$(2): $(1) $(TOOLROOT)/convert_font
+$(2) $(3): $(1) $(TOOLROOT)/convert_font
$(VQ)echo " FONT: $(1) ($(4))"
$(Q)$(TOOLROOT)/convert_font -H $(3) $(1) $(2)
+frontends/framebuffer/font_internal.c: $(2)
+
endef
S_FONTS :=
@@ -146,7 +148,7 @@ $(eval $(foreach V,$(filter FB_FONT_$(NETSURF_FB_FONTLIB)_%,$(.VARIABLES)),$(cal
# S_FRONTEND are sources purely for the framebuffer build
S_FRONTEND := gui.c framebuffer.c schedule.c bitmap.c fetch.c \
- findfile.c localhistory.c clipboard.c
+ findfile.c corewindow.c local_history.c clipboard.c
# toolkit sources
S_FRAMEBUFFER_FBTK := fbtk.c event.c fill.c bitmap.c user.c window.c \
@@ -168,14 +170,15 @@ EXETARGET := nsfb
NETSURF_FRAMEBUFFER_RESOURCE_LIST := adblock.css credits.html \
default.css internal.css licence.html \
- netsurf.png quirks.css welcome.html maps.html Messages
+ netsurf.png quirks.css welcome.html maps.html
install-framebuffer:
$(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_BIN)
$(Q)$(MKDIR) -p $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)
$(Q)cp -v $(EXETARGET) $(DESTDIR)/$(NETSURF_FRAMEBUFFER_BIN)netsurf-fb
$(Q)for F in $(NETSURF_FRAMEBUFFER_RESOURCE_LIST); do cp -vL $(FRONTEND_RESOURCES_DIR)/$$F $(DESTDIR)/$(NETSURF_FRAMEBUFFER_RESOURCES); done
- $(Q)$(SPLIT_MESSAGES) -l en -p fb -f messages resources/FatMessages | gzip -9n > $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)messages
+ $(Q)$(RM) $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)messages
+ $(Q)$(SPLIT_MESSAGES) -l en -p fb -f messages -o $(DESTDIR)$(NETSURF_FRAMEBUFFER_RESOURCES)messages -z resources/FatMessages
# ----------------------------------------------------------------------------
# Package target
diff --git a/frontends/framebuffer/bitmap.c b/frontends/framebuffer/bitmap.c
index 027e0122b..1fc9f46a2 100644
--- a/frontends/framebuffer/bitmap.c
+++ b/frontends/framebuffer/bitmap.c
@@ -51,7 +51,8 @@ static void *bitmap_create(int width, int height, unsigned int state)
{
nsfb_t *bm;
- LOG("width %d, height %d, state %u", width, height, state);
+ NSLOG(netsurf, INFO, "width %d, height %d, state %u", width, height,
+ state);
bm = nsfb_new(NSFB_SURFACE_RAM);
if (bm == NULL) {
@@ -69,7 +70,7 @@ static void *bitmap_create(int width, int height, unsigned int state)
return NULL;
}
- LOG("bitmap %p", bm);
+ NSLOG(netsurf, INFO, "bitmap %p", bm);
return bm;
}
@@ -197,11 +198,11 @@ static bool bitmap_test_opaque(void *bitmap)
while (tst-- > 0) {
if (bmpptr[(tst << 2) + 3] != 0xff) {
- LOG("bitmap %p has transparency", bm);
+ NSLOG(netsurf, INFO, "bitmap %p has transparency", bm);
return false;
}
}
- LOG("bitmap %p is opaque", bm);
+ NSLOG(netsurf, INFO, "bitmap %p is opaque", bm);
return true;
}
@@ -282,14 +283,14 @@ bitmap_render(struct bitmap *bitmap,
nsfb_get_geometry(tbm, &width, &height, NULL);
- LOG("width %d, height %d", width, height);
+ NSLOG(netsurf, INFO, "width %d, height %d", width, height);
/* Calculate size of buffer to render the content into */
- /* We get the width from the content width, unless it exceeds 1024,
- * in which case we use 1024. This means we never create excessively
- * large render buffers for huge contents, which would eat memory and
- * cripple performance. */
- cwidth = min(content_get_width(content), 1024);
+ /* We get the width from the largest of the bitmap width and the content
+ * width, unless it exceeds 1024, in which case we use 1024. This means
+ * we never create excessively large render buffers for huge contents,
+ * which would eat memory and cripple performance. */
+ cwidth = max(width, min(content_get_width(content), 1024));
/* The height is set in proportion with the width, according to the
* aspect ratio of the required thumbnail. */
cheight = ((cwidth * height) + (width / 2)) / width;
diff --git a/frontends/framebuffer/clipboard.c b/frontends/framebuffer/clipboard.c
index 1254c36f3..20a00e038 100644
--- a/frontends/framebuffer/clipboard.c
+++ b/frontends/framebuffer/clipboard.c
@@ -53,8 +53,8 @@ static void gui_get_clipboard(char **buffer, size_t *length)
if (gui_clipboard.length > 0) {
assert(gui_clipboard.buffer != NULL);
- LOG("Pasting %zd bytes: \"%s\"\n",
- gui_clipboard.length, gui_clipboard.buffer);
+ NSLOG(netsurf, INFO, "Pasting %zd bytes: \"%s\"\n",
+ gui_clipboard.length, gui_clipboard.buffer);
*buffer = malloc(gui_clipboard.length);
diff --git a/frontends/framebuffer/corewindow.c b/frontends/framebuffer/corewindow.c
new file mode 100644
index 000000000..93f88ff61
--- /dev/null
+++ b/frontends/framebuffer/corewindow.c
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * framebuffer generic core window interface.
+ *
+ * Provides interface for core renderers to the framebufefr toolkit
+ * drawable area.
+ *
+ * This module is an object that must be encapsulated. Client users
+ * should embed a struct fb_corewindow at the beginning of their
+ * context for this display surface, fill in relevant data and then
+ * call fb_corewindow_init()
+ *
+ * The fb core window structure requires the callback for draw, key and
+ * mouse operations.
+ */
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include <libnsfb.h>
+#include <libnsfb_plot.h>
+#include <libnsfb_event.h>
+
+#include "utils/log.h"
+#include "utils/utils.h"
+#include "utils/messages.h"
+#include "utils/utf8.h"
+#include "utils/nsoption.h"
+#include "netsurf/keypress.h"
+#include "netsurf/mouse.h"
+#include "netsurf/plot_style.h"
+
+#include "framebuffer/gui.h"
+#include "framebuffer/fbtk.h"
+#include "framebuffer/corewindow.h"
+
+
+/* toolkit event handlers that do generic things and call internal callbacks */
+
+
+static int
+fb_cw_mouse_press_event(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
+ struct fb_corewindow *fb_cw = (struct fb_corewindow *)cbi->context;
+ browser_mouse_state state;
+
+ /** \todo frambuffer corewindow mouse event handling needs improving */
+ if (cbi->event->type != NSFB_EVENT_KEY_UP) {
+ state = BROWSER_MOUSE_HOVER;
+ } else {
+ state = BROWSER_MOUSE_PRESS_1;
+ }
+
+ fb_cw->mouse(fb_cw, state, cbi->x, cbi->y);
+
+ return 1;
+}
+
+/*
+static bool
+fb_cw_input_event(toolkit_widget *widget, void *ctx)
+{
+ struct fb_corewindow *fb_cw = (struct fb_corewindow *)ctx;
+
+ fb_cw->key(fb_cw, keycode);
+
+ return true;
+}
+*/
+
+/**
+ * handler for toolkit window redraw event
+ */
+static int fb_cw_draw_event(fbtk_widget_t *widget, fbtk_callback_info *cbi)
+{
+ struct fb_corewindow *fb_cw;
+ nsfb_bbox_t rbox;
+ struct rect clip;
+
+ fb_cw = (struct fb_corewindow *)cbi->context;
+
+ rbox.x0 = fbtk_get_absx(widget);
+ rbox.y0 = fbtk_get_absy(widget);
+
+ rbox.x1 = rbox.x0 + fbtk_get_width(widget);
+ rbox.y1 = rbox.y0 + fbtk_get_height(widget);
+
+ nsfb_claim(fbtk_get_nsfb(widget), &rbox);
+
+ clip.x0 = fb_cw->scrollx;
+ clip.y0 = fb_cw->scrolly;
+ clip.x1 = fbtk_get_width(widget) + fb_cw->scrollx;
+ clip.y1 = fbtk_get_height(widget) + fb_cw->scrolly;
+
+ fb_cw->draw(fb_cw, &clip);
+
+ nsfb_update(fbtk_get_nsfb(widget), &rbox);
+
+ return 0;
+}
+
+
+/**
+ * callback from core to request a redraw
+ */
+static nserror
+fb_cw_invalidate(struct core_window *cw, const struct rect *r)
+{
+/* struct fb_corewindow *fb_cw = (struct fb_corewindow *)cw;
+
+ toolkit_widget_queue_draw_area(fb_cw->widget,
+ r->x0, r->y0,
+ r->x1 - r->x0, r->y1 - r->y0);
+*/
+ return NSERROR_OK;
+}
+
+
+static void
+fb_cw_update_size(struct core_window *cw, int width, int height)
+{
+/* struct fb_corewindow *fb_cw = (struct fb_corewindow *)cw;
+
+ toolkit_widget_set_size_request(FB_WIDGET(fb_cw->drawing_area),
+ width, height);
+*/
+}
+
+
+static void
+fb_cw_scroll_visible(struct core_window *cw, const struct rect *r)
+{
+/* struct fb_corewindow *fb_cw = (struct fb_corewindow *)cw;
+
+ toolkit_scroll_widget(fb_cw->widget, r);
+*/
+}
+
+
+static void
+fb_cw_get_window_dimensions(struct core_window *cw, int *width, int *height)
+{
+ struct fb_corewindow *fb_cw = (struct fb_corewindow *)cw;
+
+ *width = fbtk_get_width(fb_cw->drawable);
+ *height = fbtk_get_height(fb_cw->drawable);
+}
+
+
+static void
+fb_cw_drag_status(struct core_window *cw, core_window_drag_status ds)
+{
+ struct fb_corewindow *fb_cw = (struct fb_corewindow *)cw;
+ fb_cw->drag_status = ds;
+}
+
+
+struct core_window_callback_table fb_cw_cb_table = {
+ .invalidate = fb_cw_invalidate,
+ .update_size = fb_cw_update_size,
+ .scroll_visible = fb_cw_scroll_visible,
+ .get_window_dimensions = fb_cw_get_window_dimensions,
+ .drag_status = fb_cw_drag_status
+};
+
+/* exported function documented fb/corewindow.h */
+nserror fb_corewindow_init(fbtk_widget_t *parent, struct fb_corewindow *fb_cw)
+{
+ int furniture_width;
+
+ furniture_width = nsoption_int(fb_furniture_size);
+
+ /* setup the core window callback table */
+ fb_cw->cb_table = &fb_cw_cb_table;
+ fb_cw->drag_status = CORE_WINDOW_DRAG_NONE;
+
+ /* container window */
+ fb_cw->wnd = fbtk_create_window(parent, 0, 0, 0, 0, 0);
+
+ fb_cw->drawable = fbtk_create_user(fb_cw->wnd,
+ 0, 0,
+ -furniture_width, -furniture_width,
+ fb_cw);
+
+ fbtk_set_handler(fb_cw->drawable,
+ FBTK_CBT_REDRAW,
+ fb_cw_draw_event,
+ fb_cw);
+
+ fbtk_set_handler(fb_cw->drawable,
+ FBTK_CBT_CLICK,
+ fb_cw_mouse_press_event,
+ fb_cw);
+/*
+ fbtk_set_handler(fb_cw->drawable,
+ FBTK_CBT_INPUT,
+ fb_cw_input_event,
+ fb_cw);
+
+ fbtk_set_handler(fb_cw->drawable,
+ FBTK_CBT_POINTERMOVE,
+ fb_cw_move_event,
+ fb_cw);
+*/
+
+ /* create horizontal scrollbar */
+ fb_cw->hscroll = fbtk_create_hscroll(fb_cw->wnd,
+ 0,
+ fbtk_get_height(fb_cw->wnd) - furniture_width,
+ fbtk_get_width(fb_cw->wnd) - furniture_width,
+ furniture_width,
+ FB_SCROLL_COLOUR,
+ FB_FRAME_COLOUR,
+ NULL,
+ NULL);
+
+ fb_cw->vscroll = fbtk_create_vscroll(fb_cw->wnd,
+ fbtk_get_width(fb_cw->wnd) - furniture_width,
+ 0,
+ furniture_width,
+ fbtk_get_height(fb_cw->wnd) - furniture_width,
+ FB_SCROLL_COLOUR,
+ FB_FRAME_COLOUR,
+ NULL,
+ NULL);
+
+ fbtk_create_fill(fb_cw->wnd,
+ fbtk_get_width(fb_cw->wnd) - furniture_width,
+ fbtk_get_height(fb_cw->wnd) - furniture_width,
+ furniture_width,
+ furniture_width,
+ FB_FRAME_COLOUR);
+
+
+ return NSERROR_OK;
+}
+
+/* exported interface documented in fb/corewindow.h */
+nserror fb_corewindow_fini(struct fb_corewindow *fb_cw)
+{
+ return NSERROR_OK;
+}
diff --git a/frontends/framebuffer/corewindow.h b/frontends/framebuffer/corewindow.h
new file mode 100644
index 000000000..5546c09b6
--- /dev/null
+++ b/frontends/framebuffer/corewindow.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef FB_COREWINDOW_H
+#define FB_COREWINDOW_H
+
+#include "netsurf/core_window.h"
+
+/**
+ * fb core window state
+ */
+struct fb_corewindow {
+
+ /**
+ * framebuffer toolkit window.
+ */
+ struct fbtk_widget_s *wnd;
+ /**
+ * framebuffer toolkit horizontal scrollbar.
+ */
+ struct fbtk_widget_s *hscroll;
+ /**
+ * framebuffer toolkit vertical scrollbar.
+ */
+ struct fbtk_widget_s *vscroll;
+ /**
+ * framebuffer toolkit user drawable widget.
+ */
+ struct fbtk_widget_s *drawable;
+
+ int scrollx, scrolly; /**< scroll offsets. */
+
+
+ /** drag status set by core */
+ core_window_drag_status drag_status;
+
+ /** table of callbacks for core window operations */
+ struct core_window_callback_table *cb_table;
+
+ /**
+ * callback to draw on drawable area of fb core window
+ *
+ * \param fb_cw The fb core window structure.
+ * \param r The rectangle of the window that needs updating.
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+ nserror (*draw)(struct fb_corewindow *fb_cw, struct rect *r);
+
+ /**
+ * callback for keypress on fb core window
+ *
+ * \param fb_cw The fb core window structure.
+ * \param nskey The netsurf key code.
+ * \return NSERROR_OK if key processed,
+ * NSERROR_NOT_IMPLEMENTED if key not processed
+ * otherwise apropriate error code
+ */
+ nserror (*key)(struct fb_corewindow *fb_cw, uint32_t nskey);
+
+ /**
+ * callback for mouse event on fb core window
+ *
+ * \param fb_cw The fb core window structure.
+ * \param mouse_state mouse state
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on sucess otherwise apropriate error code.
+ */
+ nserror (*mouse)(struct fb_corewindow *fb_cw, browser_mouse_state mouse_state, int x, int y);
+};
+
+
+/**
+ * initialise elements of fb core window.
+ *
+ * As a pre-requisite the draw, key and mouse callbacks must be defined
+ *
+ * \param fb_cw A fb core window structure to initialise
+ * \return NSERROR_OK on successful initialisation otherwise error code.
+ */
+nserror fb_corewindow_init(fbtk_widget_t *parent, struct fb_corewindow *fb_cw);
+
+
+/**
+ * finalise elements of fb core window.
+ *
+ * \param fb_cw A fb core window structure to initialise
+ * \return NSERROR_OK on successful finalisation otherwise error code.
+ */
+nserror fb_corewindow_fini(struct fb_corewindow *fb_cw);
+
+#endif
diff --git a/frontends/framebuffer/fbtk.h b/frontends/framebuffer/fbtk.h
index 3cc326cef..86bdc864b 100644
--- a/frontends/framebuffer/fbtk.h
+++ b/frontends/framebuffer/fbtk.h
@@ -21,12 +21,6 @@
#include "netsurf/types.h"
-#ifdef FBTK_LOGGING
-#define FBTK_LOG(x) LOG(x)
-#else
-#define FBTK_LOG(x)
-#endif
-
#define FB_SCROLL_COLOUR 0xFFAAAAAA
#define FB_FRAME_COLOUR 0xFFDDDDDD
#define FB_COLOUR_BLACK 0xFF000000
diff --git a/frontends/framebuffer/fbtk/event.c b/frontends/framebuffer/fbtk/event.c
index a48e63809..84c6c3791 100644
--- a/frontends/framebuffer/fbtk/event.c
+++ b/frontends/framebuffer/fbtk/event.c
@@ -51,7 +51,7 @@ fbtk_input(fbtk_widget_t *root, nsfb_event_t *event)
/* obtain widget with input focus */
input = root->u.root.input;
if (input == NULL) {
- LOG("No widget has input focus.");
+ NSLOG(netsurf, INFO, "No widget has input focus.");
return; /* no widget with input */
}
@@ -84,7 +84,7 @@ fbtk_click(fbtk_widget_t *widget, nsfb_event_t *event)
x = fbtk_get_absx(clicked);
y = fbtk_get_absy(clicked);
- LOG("clicked %p at %d,%d", clicked, x, y);
+ NSLOG(netsurf, INFO, "clicked %p at %d,%d", clicked, x, y);
/* post the click */
fbtk_post_callback(clicked, FBTK_CBT_CLICK, event, cloc.x0 - x, cloc.y0 - y);
diff --git a/frontends/framebuffer/fbtk/fbtk.c b/frontends/framebuffer/fbtk/fbtk.c
index c63a6d8c9..91f6e2570 100644
--- a/frontends/framebuffer/fbtk/fbtk.c
+++ b/frontends/framebuffer/fbtk/fbtk.c
@@ -53,7 +53,7 @@ dump_tk_tree(fbtk_widget_t *widget)
int indent = 0;
while (widget != NULL) {
- LOG("%*s%p", indent, "", widget);
+ NSLOG(fbtk, DEBUG, "%*s%p", indent, "", widget);
if (widget->first_child != NULL) {
widget = widget->first_child;
indent += 6;
@@ -100,9 +100,13 @@ fbtk_request_redraw(fbtk_widget_t *widget)
widget->redraw.width = widget->width;
widget->redraw.height = widget->height;
-#ifdef FBTK_LOGGING
- LOG("redrawing %p %d,%d %d,%d", widget, widget->redraw.x, widget->redraw.y, widget->redraw.width, widget->redraw.height);
-#endif
+ NSLOG(fbtk, DEBUG,
+ "redrawing %p %d,%d %d,%d",
+ widget,
+ widget->redraw.x,
+ widget->redraw.y,
+ widget->redraw.width,
+ widget->redraw.height);
cwidget = widget->last_child;
while (cwidget != NULL) {
@@ -122,7 +126,7 @@ fbtk_request_redraw(fbtk_widget_t *widget)
int
fbtk_set_mapping(fbtk_widget_t *widget, bool map)
{
- LOG("setting mapping on %p to %d", widget, map);
+ NSLOG(netsurf, INFO, "setting mapping on %p to %d", widget, map);
widget->mapped = map;
if (map) {
fbtk_request_redraw(widget);
@@ -132,9 +136,11 @@ fbtk_set_mapping(fbtk_widget_t *widget, bool map)
return 0;
}
-/** swap the widget given with the next sibling.
- *
+
+/**
* Swap a sibling widget with the next deepest in the hierachy
+ *
+ * \param lw The widget to swap
*/
static void
swap_siblings(fbtk_widget_t *lw)
@@ -145,7 +151,7 @@ swap_siblings(fbtk_widget_t *lw)
assert(rw != NULL);
- LOG("Swapping %p with %p", lw, rw);
+ NSLOG(netsurf, INFO, "Swapping %p with %p", lw, rw);
before = lw->prev;
after = rw->next;
@@ -401,7 +407,6 @@ fbtk_set_ptr(fbtk_widget_t *widget, fbtk_callback_info *cbi)
}
-
/* internally exported function documented in widget.h */
fbtk_widget_t *
fbtk_get_root_widget(fbtk_widget_t *widget)
@@ -411,7 +416,8 @@ fbtk_get_root_widget(fbtk_widget_t *widget)
/* check root widget was found */
if (widget->type != FB_WIDGET_TYPE_ROOT) {
- LOG("Widget with null parent that is not the root widget!");
+ NSLOG(netsurf, INFO,
+ "Widget with null parent that is not the root widget!");
return NULL;
}
@@ -433,6 +439,7 @@ fbtk_get_absx(fbtk_widget_t *widget)
return x;
}
+
/* exported function documented in fbtk.h */
int
fbtk_get_absy(fbtk_widget_t *widget)
@@ -447,6 +454,7 @@ fbtk_get_absy(fbtk_widget_t *widget)
return y;
}
+
/* exported function documented in fbtk.h */
int
fbtk_get_height(fbtk_widget_t *widget)
@@ -551,9 +559,7 @@ fbtk_widget_new(fbtk_widget_t *parent,
if (neww == NULL)
return NULL;
-#ifdef FBTK_LOGGING
- LOG("creating %p %d,%d %d,%d", neww, x, y, width, height);
-#endif
+ NSLOG(fbtk, DEBUG, "creating %p %d,%d %d,%d", neww, x, y, width, height);
/* make new window fit inside parent */
if (width == 0) {
@@ -574,9 +580,8 @@ fbtk_widget_new(fbtk_widget_t *parent,
height = parent->height - y;
}
-#ifdef FBTK_LOGGING
- LOG("using %p %d,%d %d,%d", neww, x, y, width, height);
-#endif
+ NSLOG(fbtk, DEBUG, "using %p %d,%d %d,%d", neww, x, y, width, height);
+
/* set values */
neww->type = type;
neww->x = x;
@@ -634,9 +639,12 @@ do_redraw(nsfb_t *nsfb, fbtk_widget_t *widget)
plot_ctx.x1 = plot_ctx.x0 + widget->redraw.width;
plot_ctx.y1 = plot_ctx.y0 + widget->redraw.height;
-#ifdef FBTK_LOGGING
- LOG("clipping %p %d,%d %d,%d", widget, plot_ctx.x0, plot_ctx.y0, plot_ctx.x1, plot_ctx.y1);
-#endif
+ NSLOG(fbtk, DEBUG,
+ "clipping %p %d,%d %d,%d",
+ widget,
+ plot_ctx.x0, plot_ctx.y0,
+ plot_ctx.x1, plot_ctx.y1);
+
if (nsfb_plot_set_clip(nsfb, &plot_ctx) == true) {
fbtk_post_callback(widget, FBTK_CBT_REDRAW);
}
diff --git a/frontends/framebuffer/fbtk/scroll.c b/frontends/framebuffer/fbtk/scroll.c
index cc98fb2dd..b056ac81f 100644
--- a/frontends/framebuffer/fbtk/scroll.c
+++ b/frontends/framebuffer/fbtk/scroll.c
@@ -334,7 +334,7 @@ hscroll_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi)
hpos = 0;
}
- LOG("hscroll %d", hscroll);
+ NSLOG(netsurf, INFO, "hscroll %d", hscroll);
rect.x0 = bbox.x0 + 3 + hpos;
rect.y0 = bbox.y0 + 5;
@@ -362,7 +362,7 @@ hscrolll_click(fbtk_widget_t *widget, fbtk_callback_info *cbi)
newpos = scrollw->u.scroll.minimum;
if (newpos == scrollw->u.scroll.position) {
- LOG("horiz scroll was the same %d", newpos);
+ NSLOG(netsurf, INFO, "horiz scroll was the same %d", newpos);
return 0;
}
diff --git a/frontends/framebuffer/fbtk/text.c b/frontends/framebuffer/fbtk/text.c
index 00dcba491..9c96dcef4 100644
--- a/frontends/framebuffer/fbtk/text.c
+++ b/frontends/framebuffer/fbtk/text.c
@@ -71,7 +71,7 @@ fb_text_font_style(fbtk_widget_t *widget, int *font_height, int *padding,
#endif
font_style->family = PLOT_FONT_FAMILY_SANS_SERIF;
- font_style->size = px_to_pt(*font_height * FONT_SIZE_SCALE);
+ font_style->size = px_to_pt(*font_height * PLOT_STYLE_SCALE);
font_style->weight = 400;
font_style->flags = FONTF_NONE;
font_style->background = widget->bg;
@@ -98,6 +98,11 @@ fb_redraw_text(fbtk_widget_t *widget, fbtk_callback_info *cbi )
int padding;
int scroll = 0;
bool caret = false;
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &fb_plotters
+ };
fb_text_font_style(widget, &fh, &padding, &font_style);
@@ -142,8 +147,11 @@ fb_redraw_text(fbtk_widget_t *widget, fbtk_callback_info *cbi )
}
/* Call the fb text plotting, baseline is 3/4 down the font */
- fb_plotters.text(x, y, widget->u.text.text,
- widget->u.text.len, &font_style);
+ ctx.plot->text(&ctx,
+ &font_style,
+ x, y,
+ widget->u.text.text,
+ widget->u.text.len);
}
if (caret) {
@@ -209,6 +217,11 @@ fb_redraw_text_button(fbtk_widget_t *widget, fbtk_callback_info *cbi )
int fh;
int border;
fbtk_widget_t *root = fbtk_get_root_widget(widget);
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &fb_plotters
+ };
fb_text_font_style(widget, &fh, &border, &font_style);
@@ -256,11 +269,12 @@ fb_redraw_text_button(fbtk_widget_t *widget, fbtk_callback_info *cbi )
if (widget->u.text.text != NULL) {
/* Call the fb text plotting, baseline is 3/4 down the font */
- fb_plotters.text(bbox.x0 + border,
- bbox.y0 + ((fh * 3) / 4) + border,
- widget->u.text.text,
- widget->u.text.len,
- &font_style);
+ ctx.plot->text(&ctx,
+ &font_style,
+ bbox.x0 + border,
+ bbox.y0 + ((fh * 3) / 4) + border,
+ widget->u.text.text,
+ widget->u.text.len);
}
nsfb_update(root->u.root.fb, &bbox);
@@ -374,6 +388,22 @@ text_input(fbtk_widget_t *widget, fbtk_callback_info *cbi)
}
break;
+ case NSFB_KEY_HOME:
+ if (widget->u.text.idx > 0) {
+ widget->u.text.idx = 0;
+
+ caret_moved = true;
+ }
+ break;
+
+ case NSFB_KEY_END:
+ if (widget->u.text.idx < widget->u.text.len) {
+ widget->u.text.idx = widget->u.text.len;
+
+ caret_moved = true;
+ }
+ break;
+
case NSFB_KEY_PAGEUP:
case NSFB_KEY_PAGEDOWN:
case NSFB_KEY_UP:
diff --git a/frontends/framebuffer/fetch.c b/frontends/framebuffer/fetch.c
index 801b87a74..23cbb4f21 100644
--- a/frontends/framebuffer/fetch.c
+++ b/frontends/framebuffer/fetch.c
@@ -65,7 +65,7 @@ static nsurl *get_resource_url(const char *path)
static const char *fetch_filetype(const char *unix_path)
{
int l;
- LOG("unix path %s", unix_path);
+ NSLOG(netsurf, INFO, "unix path %s", unix_path);
l = strlen(unix_path);
if (2 < l && strcasecmp(unix_path + l - 3, "css") == 0)
return "text/css";
diff --git a/frontends/framebuffer/font_freetype.c b/frontends/framebuffer/font_freetype.c
index e7c07f5ff..744ac6281 100644
--- a/frontends/framebuffer/font_freetype.c
+++ b/frontends/framebuffer/font_freetype.c
@@ -90,12 +90,13 @@ ft_face_requester(FTC_FaceID face_id,
error = FT_New_Face(library, fb_face->fontfile, fb_face->index, face);
if (error) {
- LOG("Could not find font (code %d)", error);
+ NSLOG(netsurf, INFO, "Could not find font (code %d)", error);
} else {
error = FT_Select_Charmap(*face, FT_ENCODING_UNICODE);
if (error) {
- LOG("Could not select charmap (code %d)", error);
+ NSLOG(netsurf, INFO,
+ "Could not select charmap (code %d)", error);
} else {
for (cidx = 0; cidx < (*face)->num_charmaps; cidx++) {
if ((*face)->charmap == (*face)->charmaps[cidx]) {
@@ -105,7 +106,7 @@ ft_face_requester(FTC_FaceID face_id,
}
}
}
- LOG("Loaded face from %s", fb_face->fontfile);
+ NSLOG(netsurf, INFO, "Loaded face from %s", fb_face->fontfile);
return error;
}
@@ -132,7 +133,8 @@ fb_new_face(const char *option, const char *resname, const char *fontname)
error = FTC_Manager_LookupFace(ft_cmanager, (FTC_FaceID)newf, &aface);
if (error) {
- LOG("Could not find font face %s (code %d)", fontname, error);
+ NSLOG(netsurf, INFO, "Could not find font face %s (code %d)",
+ fontname, error);
free(newf->fontfile);
free(newf);
newf = NULL;
@@ -152,7 +154,8 @@ bool fb_font_init(void)
/* freetype library initialise */
error = FT_Init_FreeType( &library );
if (error) {
- LOG("Freetype could not initialised (code %d)", error);
+ NSLOG(netsurf, INFO,
+ "Freetype could not initialised (code %d)", error);
return false;
}
@@ -172,7 +175,9 @@ bool fb_font_init(void)
NULL,
&ft_cmanager);
if (error) {
- LOG("Freetype could not initialise cache manager (code %d)", error);
+ NSLOG(netsurf, INFO,
+ "Freetype could not initialise cache manager (code %d)",
+ error);
FT_Done_FreeType(library);
return false;
}
@@ -189,7 +194,7 @@ bool fb_font_init(void)
NETSURF_FB_FONT_SANS_SERIF);
if (fb_face == NULL) {
/* The sans serif font is the default and must be found. */
- LOG("Could not find the default font");
+ NSLOG(netsurf, INFO, "Could not find the default font");
FTC_Manager_Done(ft_cmanager);
FT_Done_FreeType(library);
return false;
@@ -387,7 +392,7 @@ static void fb_fill_scalar(const plot_font_style_t *fstyle, FTC_Scaler srec)
srec->face_id = (FTC_FaceID)fb_faces[selected_face];
- srec->width = srec->height = (fstyle->size * 64) / FONT_SIZE_SCALE;
+ srec->width = srec->height = (fstyle->size * 64) / PLOT_STYLE_SCALE;
srec->pixel = 0;
srec->x_res = srec->y_res = browser_get_dpi();
diff --git a/frontends/framebuffer/font_internal.c b/frontends/framebuffer/font_internal.c
index 3b8a1c43f..d755681c6 100644
--- a/frontends/framebuffer/font_internal.c
+++ b/frontends/framebuffer/font_internal.c
@@ -212,7 +212,7 @@ fb_get_font_size(const plot_font_style_t *fstyle)
{
int size = fstyle->size * 10 /
(((nsoption_int(font_min_size) * 3 +
- nsoption_int(font_size)) / 4) * FONT_SIZE_SCALE);
+ nsoption_int(font_size)) / 4) * PLOT_STYLE_SCALE);
if (size > 2)
size = 2;
else if (size <= 0)
@@ -270,6 +270,7 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale)
break;
}
}
+ /* Fall through. */
case FB_BOLD:
section = fb_bold_section_table[ucs4 / 256];
if (section != 0 || ucs4 / 256 == 0) {
@@ -280,6 +281,7 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale)
break;
}
}
+ /* Fall through. */
case FB_ITALIC:
section = fb_italic_section_table[ucs4 / 256];
if (section != 0 || ucs4 / 256 == 0) {
@@ -290,6 +292,7 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale)
break;
}
}
+ /* Fall through. */
case FB_REGULAR:
section = fb_regular_section_table[ucs4 / 256];
if (section != 0 || ucs4 / 256 == 0) {
@@ -300,6 +303,7 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale)
break;
}
}
+ /* Fall through. */
default:
glyph_data = get_codepoint(ucs4, style & FB_ITALIC);
break;
diff --git a/frontends/framebuffer/framebuffer.c b/frontends/framebuffer/framebuffer.c
index 74c72fe71..52afdbf5d 100644
--- a/frontends/framebuffer/framebuffer.c
+++ b/frontends/framebuffer/framebuffer.c
@@ -45,139 +45,274 @@
static nsfb_t *nsfb;
-static bool
-framebuffer_plot_disc(int x, int y, int radius, const plot_style_t *style)
+/**
+ * \brief Sets a clip rectangle for subsequent plot operations.
+ *
+ * \param ctx The current redraw context.
+ * \param clip The rectangle to limit all subsequent plot
+ * operations within.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+framebuffer_plot_clip(const struct redraw_context *ctx, const struct rect *clip)
{
- nsfb_bbox_t ellipse;
- ellipse.x0 = x - radius;
- ellipse.y0 = y - radius;
- ellipse.x1 = x + radius;
- ellipse.y1 = y + radius;
-
- if (style->fill_type != PLOT_OP_TYPE_NONE) {
- nsfb_plot_ellipse_fill(nsfb, &ellipse, style->fill_colour);
- }
-
- if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- nsfb_plot_ellipse(nsfb, &ellipse, style->stroke_colour);
- }
- return true;
+ nsfb_bbox_t nsfb_clip;
+ nsfb_clip.x0 = clip->x0;
+ nsfb_clip.y0 = clip->y0;
+ nsfb_clip.x1 = clip->x1;
+ nsfb_clip.y1 = clip->y1;
+
+ if (!nsfb_plot_set_clip(nsfb, &nsfb_clip)) {
+ return NSERROR_INVALID;
+ }
+ return NSERROR_OK;
}
-static bool
-framebuffer_plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style)
+
+/**
+ * Plots an arc
+ *
+ * plot an arc segment around (x,y), anticlockwise from angle1
+ * to angle2. Angles are measured anticlockwise from
+ * horizontal, in degrees.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the arc plot.
+ * \param x The x coordinate of the arc.
+ * \param y The y coordinate of the arc.
+ * \param radius The radius of the arc.
+ * \param angle1 The start angle of the arc.
+ * \param angle2 The finish angle of the arc.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+framebuffer_plot_arc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius, int angle1, int angle2)
{
- return nsfb_plot_arc(nsfb, x, y, radius, angle1, angle2, style->fill_colour);
+ if (!nsfb_plot_arc(nsfb, x, y, radius, angle1, angle2, style->fill_colour)) {
+ return NSERROR_INVALID;
+ }
+ return NSERROR_OK;
}
-static bool
-framebuffer_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
+
+/**
+ * Plots a circle
+ *
+ * Plot a circle centered on (x,y), which is optionally filled.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the circle plot.
+ * \param x x coordinate of circle centre.
+ * \param y y coordinate of circle centre.
+ * \param radius circle radius.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+framebuffer_plot_disc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius)
{
- return nsfb_plot_polygon(nsfb, p, n, style->fill_colour);
+ nsfb_bbox_t ellipse;
+ ellipse.x0 = x - radius;
+ ellipse.y0 = y - radius;
+ ellipse.x1 = x + radius;
+ ellipse.y1 = y + radius;
+
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+ nsfb_plot_ellipse_fill(nsfb, &ellipse, style->fill_colour);
+ }
+
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ nsfb_plot_ellipse(nsfb, &ellipse, style->stroke_colour);
+ }
+ return NSERROR_OK;
}
-#ifdef FB_USE_FREETYPE
-static bool
-framebuffer_plot_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle)
+/**
+ * Plots a line
+ *
+ * plot a line from (x0,y0) to (x1,y1). Coordinates are at
+ * centre of line width/thickness.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the line plot.
+ * \param line A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+framebuffer_plot_line(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *line)
{
- uint32_t ucs4;
- size_t nxtchr = 0;
- FT_Glyph glyph;
- FT_BitmapGlyph bglyph;
- nsfb_bbox_t loc;
-
- while (nxtchr < length) {
- ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr);
- nxtchr = utf8_next(text, length, nxtchr);
-
- glyph = fb_getglyph(fstyle, ucs4);
- if (glyph == NULL)
- continue;
-
- if (glyph->format == FT_GLYPH_FORMAT_BITMAP) {
- bglyph = (FT_BitmapGlyph)glyph;
-
- loc.x0 = x + bglyph->left;
- loc.y0 = y - bglyph->top;
- loc.x1 = loc.x0 + bglyph->bitmap.width;
- loc.y1 = loc.y0 + bglyph->bitmap.rows;
-
- /* now, draw to our target surface */
- if (bglyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) {
- nsfb_plot_glyph1(nsfb,
- &loc,
- bglyph->bitmap.buffer,
- bglyph->bitmap.pitch,
- fstyle->foreground);
- } else {
- nsfb_plot_glyph8(nsfb,
- &loc,
- bglyph->bitmap.buffer,
- bglyph->bitmap.pitch,
- fstyle->foreground);
- }
- }
- x += glyph->advance.x >> 16;
-
- }
- return true;
+ nsfb_bbox_t rect;
+ nsfb_plot_pen_t pen;
+
+ rect.x0 = line->x0;
+ rect.y0 = line->y0;
+ rect.x1 = line->x1;
+ rect.y1 = line->y1;
+
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+
+ if (style->stroke_type == PLOT_OP_TYPE_DOT) {
+ pen.stroke_type = NFSB_PLOT_OPTYPE_PATTERN;
+ pen.stroke_pattern = 0xAAAAAAAA;
+ } else if (style->stroke_type == PLOT_OP_TYPE_DASH) {
+ pen.stroke_type = NFSB_PLOT_OPTYPE_PATTERN;
+ pen.stroke_pattern = 0xF0F0F0F0;
+ } else {
+ pen.stroke_type = NFSB_PLOT_OPTYPE_SOLID;
+ }
+
+ pen.stroke_colour = style->stroke_colour;
+ pen.stroke_width = plot_style_fixed_to_int(style->stroke_width);
+ nsfb_plot_line(nsfb, &rect, &pen);
+ }
+ return NSERROR_OK;
}
-#else
-static bool framebuffer_plot_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle)
+
+
+/**
+ * Plots a rectangle.
+ *
+ * The rectangle can be filled an outline or both controlled
+ * by the plot style The line can be solid, dotted or
+ * dashed. Top left corner at (x0,y0) and rectangle has given
+ * width and height.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the rectangle plot.
+ * \param nsrect A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+framebuffer_plot_rectangle(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *nsrect)
{
- enum fb_font_style style = fb_get_font_style(fstyle);
- int size = fb_get_font_size(fstyle);
- const uint8_t *chrp;
- size_t nxtchr = 0;
- nsfb_bbox_t loc;
- uint32_t ucs4;
- int p = FB_FONT_PITCH * size;
- int w = FB_FONT_WIDTH * size;
- int h = FB_FONT_HEIGHT * size;
+ nsfb_bbox_t rect;
+ bool dotted = false;
+ bool dashed = false;
- y -= ((h * 3) / 4);
- /* the coord is the bottom-left of the pixels offset by 1 to make
- * it work since fb coords are the top-left of pixels */
- y += 1;
+ rect.x0 = nsrect->x0;
+ rect.y0 = nsrect->y0;
+ rect.x1 = nsrect->x1;
+ rect.y1 = nsrect->y1;
- while (nxtchr < length) {
- ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr);
- nxtchr = utf8_next(text, length, nxtchr);
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+ nsfb_plot_rectangle_fill(nsfb, &rect, style->fill_colour);
+ }
- if (!codepoint_displayable(ucs4))
- continue;
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ if (style->stroke_type == PLOT_OP_TYPE_DOT) {
+ dotted = true;
+ }
- loc.x0 = x;
- loc.y0 = y;
- loc.x1 = loc.x0 + w;
- loc.y1 = loc.y0 + h;
+ if (style->stroke_type == PLOT_OP_TYPE_DASH) {
+ dashed = true;
+ }
- chrp = fb_get_glyph(ucs4, style, size);
- nsfb_plot_glyph1(nsfb, &loc, chrp, p, fstyle->foreground);
+ nsfb_plot_rectangle(nsfb, &rect,
+ plot_style_fixed_to_int(style->stroke_width),
+ style->stroke_colour, dotted, dashed);
+ }
+ return NSERROR_OK;
+}
- x += w;
- }
+/**
+ * Plot a polygon
+ *
+ * Plots a filled polygon with straight lines between
+ * points. The lines around the edge of the ploygon are not
+ * plotted. The polygon is filled with the non-zero winding
+ * rule.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the polygon plot.
+ * \param p verticies of polygon
+ * \param n number of verticies.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+framebuffer_plot_polygon(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const int *p,
+ unsigned int n)
+{
+ if (!nsfb_plot_polygon(nsfb, p, n, style->fill_colour)) {
+ return NSERROR_INVALID;
+ }
+ return NSERROR_OK;
+}
- return true;
+
+/**
+ * Plots a path.
+ *
+ * Path plot consisting of cubic Bezier curves. Line and fill colour is
+ * controlled by the plot style.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the path plot.
+ * \param p elements of path
+ * \param n nunber of elements on path
+ * \param transform A transform to apply to the path.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+framebuffer_plot_path(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const float *p,
+ unsigned int n,
+ const float transform[6])
+{
+ NSLOG(netsurf, INFO, "path unimplemented");
+ return NSERROR_OK;
}
-#endif
-static bool
-framebuffer_plot_bitmap(int x, int y,
- int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags)
+/**
+ * Plot a bitmap
+ *
+ * Tiled plot of a bitmap image. (x,y) gives the top left
+ * coordinate of an explicitly placed tile. From this tile the
+ * image can repeat in all four directions -- up, down, left
+ * and right -- to the extents given by the current clip
+ * rectangle.
+ *
+ * The bitmap_flags say whether to tile in the x and y
+ * directions. If not tiling in x or y directions, the single
+ * image is plotted. The width and height give the dimensions
+ * the image is to be scaled to.
+ *
+ * \param ctx The current redraw context.
+ * \param bitmap The bitmap to plot
+ * \param x The x coordinate to plot the bitmap
+ * \param y The y coordiante to plot the bitmap
+ * \param width The width of area to plot the bitmap into
+ * \param height The height of area to plot the bitmap into
+ * \param bg the background colour to alpha blend into
+ * \param flags the flags controlling the type of plot operation
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+framebuffer_plot_bitmap(const struct redraw_context *ctx,
+ struct bitmap *bitmap,
+ int x, int y,
+ int width,
+ int height,
+ colour bg,
+ bitmap_flags_t flags)
{
- nsfb_bbox_t loc;
- nsfb_bbox_t clipbox;
- bool repeat_x = (flags & BITMAPF_REPEAT_X);
- bool repeat_y = (flags & BITMAPF_REPEAT_Y);
+ nsfb_bbox_t loc;
+ nsfb_bbox_t clipbox;
+ bool repeat_x = (flags & BITMAPF_REPEAT_X);
+ bool repeat_y = (flags & BITMAPF_REPEAT_Y);
int bmwidth;
int bmheight;
int bmstride;
@@ -193,15 +328,18 @@ framebuffer_plot_bitmap(int x, int y,
if (!(repeat_x || repeat_y)) {
/* Not repeating at all, so just plot it */
- loc.x0 = x;
- loc.y0 = y;
- loc.x1 = loc.x0 + width;
- loc.y1 = loc.y0 + height;
+ loc.x0 = x;
+ loc.y0 = y;
+ loc.x1 = loc.x0 + width;
+ loc.y1 = loc.y0 + height;
- return nsfb_plot_copy(bm, NULL, nsfb, &loc);
+ if (!nsfb_plot_copy(bm, NULL, nsfb, &loc)) {
+ return NSERROR_INVALID;
+ }
+ return NSERROR_OK;
}
- nsfb_plot_get_clip(nsfb, &clipbox);
+ nsfb_plot_get_clip(nsfb, &clipbox);
nsfb_get_geometry(bm, &bmwidth, &bmheight, &bmformat);
nsfb_get_buffer(bm, &bmptr, &bmstride);
@@ -209,8 +347,11 @@ framebuffer_plot_bitmap(int x, int y,
* of the area. Can only be done when image is fully opaque. */
if ((bmwidth == 1) && (bmheight == 1)) {
if ((*(nsfb_colour_t *)bmptr & 0xff000000) != 0) {
- return nsfb_plot_rectangle_fill(nsfb, &clipbox,
- *(nsfb_colour_t *)bmptr);
+ if (!nsfb_plot_rectangle_fill(nsfb, &clipbox,
+ *(nsfb_colour_t *)bmptr)) {
+ return NSERROR_INVALID;
+ }
+ return NSERROR_OK;
}
}
@@ -221,24 +362,29 @@ framebuffer_plot_bitmap(int x, int y,
if (framebuffer_bitmap_get_opaque(bm)) {
/** TODO: Currently using top left pixel. Maybe centre
* pixel or average value would be better. */
- return nsfb_plot_rectangle_fill(nsfb, &clipbox,
- *(nsfb_colour_t *)bmptr);
+ if (!nsfb_plot_rectangle_fill(nsfb, &clipbox,
+ *(nsfb_colour_t *)bmptr)) {
+ return NSERROR_INVALID;
+ }
+ return NSERROR_OK;
}
}
/* get left most tile position */
- if (repeat_x)
+ if (repeat_x) {
for (; x > clipbox.x0; x -= width);
+ }
/* get top most tile position */
- if (repeat_y)
+ if (repeat_y) {
for (; y > clipbox.y0; y -= height);
+ }
/* set up top left tile location */
- loc.x0 = x;
- loc.y0 = y;
- loc.x1 = loc.x0 + width;
- loc.y1 = loc.y0 + height;
+ loc.x0 = x;
+ loc.y0 = y;
+ loc.x1 = loc.x0 + width;
+ loc.y1 = loc.y0 + height;
/* plot tiling across and down to extents */
nsfb_plot_bitmap_tiles(nsfb, &loc,
@@ -247,94 +393,135 @@ framebuffer_plot_bitmap(int x, int y,
(nsfb_colour_t *)bmptr, bmwidth, bmheight,
bmstride * 8 / 32, bmformat == NSFB_FMT_ABGR8888);
- return true;
+ return NSERROR_OK;
}
-static bool
-framebuffer_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
-{
- nsfb_bbox_t rect;
- bool dotted = false;
- bool dashed = false;
-
- rect.x0 = x0;
- rect.y0 = y0;
- rect.x1 = x1;
- rect.y1 = y1;
- if (style->fill_type != PLOT_OP_TYPE_NONE) {
- nsfb_plot_rectangle_fill(nsfb, &rect, style->fill_colour);
- }
-
- if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- if (style->stroke_type == PLOT_OP_TYPE_DOT)
- dotted = true;
-
- if (style->stroke_type == PLOT_OP_TYPE_DASH)
- dashed = true;
+#ifdef FB_USE_FREETYPE
+/**
+ * Text plotting.
+ *
+ * \param ctx The current redraw context.
+ * \param fstyle plot style for this text
+ * \param x x coordinate
+ * \param y y coordinate
+ * \param text UTF-8 string to plot
+ * \param length length of string, in bytes
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+framebuffer_plot_text(const struct redraw_context *ctx,
+ const struct plot_font_style *fstyle,
+ int x,
+ int y,
+ const char *text,
+ size_t length)
+{
+ uint32_t ucs4;
+ size_t nxtchr = 0;
+ FT_Glyph glyph;
+ FT_BitmapGlyph bglyph;
+ nsfb_bbox_t loc;
+
+ while (nxtchr < length) {
+ ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr);
+ nxtchr = utf8_next(text, length, nxtchr);
+
+ glyph = fb_getglyph(fstyle, ucs4);
+ if (glyph == NULL)
+ continue;
+
+ if (glyph->format == FT_GLYPH_FORMAT_BITMAP) {
+ bglyph = (FT_BitmapGlyph)glyph;
+
+ loc.x0 = x + bglyph->left;
+ loc.y0 = y - bglyph->top;
+ loc.x1 = loc.x0 + bglyph->bitmap.width;
+ loc.y1 = loc.y0 + bglyph->bitmap.rows;
+
+ /* now, draw to our target surface */
+ if (bglyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) {
+ nsfb_plot_glyph1(nsfb,
+ &loc,
+ bglyph->bitmap.buffer,
+ bglyph->bitmap.pitch,
+ fstyle->foreground);
+ } else {
+ nsfb_plot_glyph8(nsfb,
+ &loc,
+ bglyph->bitmap.buffer,
+ bglyph->bitmap.pitch,
+ fstyle->foreground);
+ }
+ }
+ x += glyph->advance.x >> 16;
- nsfb_plot_rectangle(nsfb, &rect, style->stroke_width, style->stroke_colour, dotted, dashed);
}
+ return NSERROR_OK;
- return true;
}
-static bool
-framebuffer_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
+#else
+
+/**
+ * Text plotting.
+ *
+ * \param ctx The current redraw context.
+ * \param fstyle plot style for this text
+ * \param x x coordinate
+ * \param y y coordinate
+ * \param text UTF-8 string to plot
+ * \param length length of string, in bytes
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+framebuffer_plot_text(const struct redraw_context *ctx,
+ const struct plot_font_style *fstyle,
+ int x,
+ int y,
+ const char *text,
+ size_t length)
{
- nsfb_bbox_t rect;
- nsfb_plot_pen_t pen;
+ enum fb_font_style style = fb_get_font_style(fstyle);
+ int size = fb_get_font_size(fstyle);
+ const uint8_t *chrp;
+ size_t nxtchr = 0;
+ nsfb_bbox_t loc;
+ uint32_t ucs4;
+ int p = FB_FONT_PITCH * size;
+ int w = FB_FONT_WIDTH * size;
+ int h = FB_FONT_HEIGHT * size;
- rect.x0 = x0;
- rect.y0 = y0;
- rect.x1 = x1;
- rect.y1 = y1;
-
- if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ y -= ((h * 3) / 4);
+ /* the coord is the bottom-left of the pixels offset by 1 to make
+ * it work since fb coords are the top-left of pixels */
+ y += 1;
- if (style->stroke_type == PLOT_OP_TYPE_DOT) {
- pen.stroke_type = NFSB_PLOT_OPTYPE_PATTERN;
- pen.stroke_pattern = 0xAAAAAAAA;
- } else if (style->stroke_type == PLOT_OP_TYPE_DASH) {
- pen.stroke_type = NFSB_PLOT_OPTYPE_PATTERN;
- pen.stroke_pattern = 0xF0F0F0F0;
- } else {
- pen.stroke_type = NFSB_PLOT_OPTYPE_SOLID;
- }
+ while (nxtchr < length) {
+ ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr);
+ nxtchr = utf8_next(text, length, nxtchr);
- pen.stroke_colour = style->stroke_colour;
- pen.stroke_width = style->stroke_width;
- nsfb_plot_line(nsfb, &rect, &pen);
- }
+ if (!codepoint_displayable(ucs4))
+ continue;
- return true;
-}
+ loc.x0 = x;
+ loc.y0 = y;
+ loc.x1 = loc.x0 + w;
+ loc.y1 = loc.y0 + h;
+ chrp = fb_get_glyph(ucs4, style, size);
+ nsfb_plot_glyph1(nsfb, &loc, chrp, p, fstyle->foreground);
-static bool
-framebuffer_plot_path(const float *p,
- unsigned int n,
- colour fill,
- float width,
- colour c,
- const float transform[6])
-{
- LOG("path unimplemented");
- return true;
-}
+ x += w;
-static bool
-framebuffer_plot_clip(const struct rect *clip)
-{
- nsfb_bbox_t nsfb_clip;
- nsfb_clip.x0 = clip->x0;
- nsfb_clip.y0 = clip->y0;
- nsfb_clip.x1 = clip->x1;
- nsfb_clip.y1 = clip->y1;
+ }
- return nsfb_plot_set_clip(nsfb, &nsfb_clip);
+ return NSERROR_OK;
}
+#endif
+
+/** framebuffer plot operation table */
const struct plotter_table fb_plotters = {
.clip = framebuffer_plot_clip,
.arc = framebuffer_plot_arc,
@@ -345,7 +532,7 @@ const struct plotter_table fb_plotters = {
.path = framebuffer_plot_path,
.bitmap = framebuffer_plot_bitmap,
.text = framebuffer_plot_text,
- .option_knockout = true,
+ .option_knockout = true,
};
@@ -377,7 +564,7 @@ static bool framebuffer_format_from_bpp(int bpp, enum nsfb_format_e *fmt)
break;
default:
- LOG("Bad bits per pixel (%d)\n", bpp);
+ NSLOG(netsurf, INFO, "Bad bits per pixel (%d)\n", bpp);
return false;
}
@@ -394,33 +581,34 @@ framebuffer_initialise(const char *fename, int width, int height, int bpp)
/* bpp is a proxy for the framebuffer format */
if (framebuffer_format_from_bpp(bpp, &fbfmt) == false) {
- return NULL;
+ return NULL;
}
fbtype = nsfb_type_from_name(fename);
if (fbtype == NSFB_SURFACE_NONE) {
- LOG("The %s surface is not available from libnsfb\n", fename);
- return NULL;
+ NSLOG(netsurf, INFO,
+ "The %s surface is not available from libnsfb\n", fename);
+ return NULL;
}
nsfb = nsfb_new(fbtype);
if (nsfb == NULL) {
- LOG("Unable to create %s fb surface\n", fename);
- return NULL;
+ NSLOG(netsurf, INFO, "Unable to create %s fb surface\n", fename);
+ return NULL;
}
-
+
if (nsfb_set_geometry(nsfb, width, height, fbfmt) == -1) {
- LOG("Unable to set surface geometry\n");
- nsfb_free(nsfb);
- return NULL;
+ NSLOG(netsurf, INFO, "Unable to set surface geometry\n");
+ nsfb_free(nsfb);
+ return NULL;
}
nsfb_cursor_init(nsfb);
-
+
if (nsfb_init(nsfb) == -1) {
- LOG("Unable to initialise nsfb surface\n");
- nsfb_free(nsfb);
- return NULL;
+ NSLOG(netsurf, INFO, "Unable to initialise nsfb surface\n");
+ nsfb_free(nsfb);
+ return NULL;
}
return nsfb;
@@ -434,12 +622,12 @@ framebuffer_resize(nsfb_t *nsfb, int width, int height, int bpp)
/* bpp is a proxy for the framebuffer format */
if (framebuffer_format_from_bpp(bpp, &fbfmt) == false) {
- return false;
+ return false;
}
if (nsfb_set_geometry(nsfb, width, height, fbfmt) == -1) {
- LOG("Unable to change surface geometry\n");
- return false;
+ NSLOG(netsurf, INFO, "Unable to change surface geometry\n");
+ return false;
}
return true;
@@ -449,14 +637,14 @@ framebuffer_resize(nsfb_t *nsfb, int width, int height, int bpp)
void
framebuffer_finalise(void)
{
- nsfb_free(nsfb);
+ nsfb_free(nsfb);
}
bool
framebuffer_set_cursor(struct fbtk_bitmap *bm)
{
return nsfb_cursor_set(nsfb, (nsfb_colour_t *)bm->pixdata, bm->width, bm->height, bm->width, bm->hot_x, bm->hot_y);
-}
+}
nsfb_t *framebuffer_set_surface(nsfb_t *new_nsfb)
{
diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c
index 4d4c7334f..1e27dafb6 100644
--- a/frontends/framebuffer/gui.c
+++ b/frontends/framebuffer/gui.c
@@ -54,6 +54,7 @@
#include "framebuffer/clipboard.h"
#include "framebuffer/fetch.h"
#include "framebuffer/bitmap.h"
+#include "framebuffer/local_history.h"
#define NSFB_TOOLBAR_DEFAULT_LAYOUT "blfsrutc"
@@ -119,7 +120,7 @@ static void die(const char *error)
*/
static nserror fb_warn_user(const char *warning, const char *detail)
{
- LOG("%s %s", warning, detail);
+ NSLOG(netsurf, INFO, "%s %s", warning, detail);
return NSERROR_OK;
}
@@ -152,7 +153,7 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs)
int content_width, content_height;
int height;
- LOG("window scroll");
+ NSLOG(netsurf, INFO, "window scroll");
if (abs) {
bwidget->pany = y - bwidget->scrolly;
} else {
@@ -236,7 +237,7 @@ fb_pan(fbtk_widget_t *widget,
height = fbtk_get_height(widget);
width = fbtk_get_width(widget);
- LOG("panning %d, %d", bwidget->panx, bwidget->pany);
+ NSLOG(netsurf, INFO, "panning %d, %d", bwidget->panx, bwidget->pany);
x = fbtk_get_absx(widget);
y = fbtk_get_absy(widget);
@@ -412,7 +413,8 @@ fb_browser_window_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi)
bwidget = fbtk_get_userpw(widget);
if (bwidget == NULL) {
- LOG("browser widget from widget %p was null", widget);
+ NSLOG(netsurf, INFO,
+ "browser widget from widget %p was null", widget);
return -1;
}
@@ -464,7 +466,7 @@ process_cmdline(int argc, char** argv)
{0, 0, 0, 0 }
}; /* no long options */
- LOG("argc %d, argv %p", argc, argv);
+ NSLOG(netsurf, INFO, "argc %d, argv %p", argc, argv);
fename = "sdl";
febpp = 32;
@@ -533,7 +535,7 @@ static nserror set_defaults(struct nsoption_s *defaults)
if (nsoption_charp(cookie_file) == NULL ||
nsoption_charp(cookie_jar) == NULL) {
- LOG("Failed initialising cookie options");
+ NSLOG(netsurf, INFO, "Failed initialising cookie options");
return NSERROR_BAD_PARAMETER;
}
@@ -611,7 +613,7 @@ static void framebuffer_run(void)
static void gui_quit(void)
{
- LOG("gui_quit");
+ NSLOG(netsurf, INFO, "gui_quit");
urldb_save_cookies(nsoption_charp(cookie_jar));
@@ -638,7 +640,8 @@ fb_browser_window_click(fbtk_widget_t *widget, fbtk_callback_info *cbi)
cbi->event->type != NSFB_EVENT_KEY_UP)
return 0;
- LOG("browser window clicked at %d,%d", cbi->x, cbi->y);
+ NSLOG(netsurf, INFO, "browser window clicked at %d,%d", cbi->x,
+ cbi->y);
switch (cbi->event->type) {
case NSFB_EVENT_KEY_DOWN:
@@ -823,7 +826,7 @@ fb_browser_window_input(fbtk_widget_t *widget, fbtk_callback_info *cbi)
static fbtk_modifier_type modifier = FBTK_MOD_CLEAR;
int ucs4 = -1;
- LOG("got value %d", cbi->event->value.keycode);
+ NSLOG(netsurf, INFO, "got value %d", cbi->event->value.keycode);
switch (cbi->event->type) {
case NSFB_EVENT_KEY_DOWN:
@@ -948,8 +951,8 @@ fb_browser_window_input(fbtk_widget_t *widget, fbtk_callback_info *cbi)
browser_window_key_press(gw->bw, NS_KEY_REDO);
break;
}
- /* Z or Y pressed but not undo or redo;
- * Fall through to default handling */
+ /* Z or Y pressed but not undo or redo; */
+ /* Fall through */
default:
ucs4 = fbtk_keycode_to_ucs4(cbi->event->value.keycode,
@@ -1150,7 +1153,7 @@ fb_localhistory_btn_clik(fbtk_widget_t *widget, fbtk_callback_info *cbi)
if (cbi->event->type != NSFB_EVENT_KEY_UP)
return 0;
- fb_localhistory_map(gw->localhistory);
+ fb_local_history_present(fbtk, gw->bw);
return 0;
}
@@ -1199,7 +1202,7 @@ create_toolbar(struct gui_window *gw,
toolbar_layout = NSFB_TOOLBAR_DEFAULT_LAYOUT;
}
- LOG("Using toolbar layout %s", toolbar_layout);
+ NSLOG(netsurf, INFO, "Using toolbar layout %s", toolbar_layout);
itmtype = toolbar_layout;
@@ -1233,7 +1236,7 @@ create_toolbar(struct gui_window *gw,
(*itmtype != 0) &&
(xdir !=0)) {
- LOG("toolbar adding %c", *itmtype);
+ NSLOG(netsurf, INFO, "toolbar adding %c", *itmtype);
switch (*itmtype) {
@@ -1375,7 +1378,9 @@ create_toolbar(struct gui_window *gw,
default:
widget = NULL;
xdir = 0;
- LOG("Unknown element %c in toolbar layout", *itmtype);
+ NSLOG(netsurf, INFO,
+ "Unknown element %c in toolbar layout",
+ *itmtype);
break;
}
@@ -1384,7 +1389,7 @@ create_toolbar(struct gui_window *gw,
xpos += (xdir * (fbtk_get_width(widget) + padding));
}
- LOG("xpos is %d", xpos);
+ NSLOG(netsurf, INFO, "xpos is %d", xpos);
itmtype += xdir;
}
@@ -1583,7 +1588,7 @@ resize_browser_widget(struct gui_window *gw, int x, int y,
int width, int height)
{
fbtk_set_pos_and_size(gw->browser, x, y, width, height);
- browser_window_reformat(gw->bw, false, width, height);
+ browser_window_schedule_reformat(gw->bw);
}
static void
@@ -1594,7 +1599,7 @@ create_normal_browser_window(struct gui_window *gw, int furniture_width)
int statusbar_width = 0;
int toolbar_height = nsoption_int(fb_toolbar_size);
- LOG("Normal window");
+ NSLOG(netsurf, INFO, "Normal window");
gw->window = fbtk_create_window(fbtk, 0, 0, 0, 0, 0);
@@ -1625,7 +1630,8 @@ create_normal_browser_window(struct gui_window *gw, int furniture_width)
false);
fbtk_set_handler(gw->status, FBTK_CBT_POINTERENTER, set_ptr_default_move, NULL);
- LOG("status bar %p at %d,%d", gw->status, fbtk_get_absx(gw->status), fbtk_get_absy(gw->status));
+ NSLOG(netsurf, INFO, "status bar %p at %d,%d", gw->status,
+ fbtk_get_absx(gw->status), fbtk_get_absy(gw->status));
/* create horizontal scrollbar */
gw->hscroll = fbtk_create_hscroll(gw->window,
@@ -1782,7 +1788,6 @@ gui_window_create(struct browser_window *bw,
gw->bw = bw;
create_normal_browser_window(gw, nsoption_int(fb_furniture_size));
- gw->localhistory = fb_create_localhistory(bw, fbtk, nsoption_int(fb_furniture_size));
/* map and request redraw of gui window */
fbtk_set_mapping(gw->window, true);
@@ -1803,21 +1808,33 @@ gui_window_destroy(struct gui_window *gw)
free(gw);
}
-static void
-gui_window_redraw_window(struct gui_window *g)
-{
- fb_queue_redraw(g->browser, 0, 0, fbtk_get_width(g->browser), fbtk_get_height(g->browser) );
-}
-static void
-gui_window_update_box(struct gui_window *g, const struct rect *rect)
+/**
+ * Invalidates an area of a framebuffer browser window
+ *
+ * \param g The netsurf window being invalidated.
+ * \param rect area to redraw or NULL for the entire window area
+ * \return NSERROR_OK on success or appropriate error code
+ */
+static nserror
+fb_window_invalidate_area(struct gui_window *g, const struct rect *rect)
{
struct browser_widget_s *bwidget = fbtk_get_userpw(g->browser);
- fb_queue_redraw(g->browser,
- rect->x0 - bwidget->scrollx,
- rect->y0 - bwidget->scrolly,
- rect->x1 - bwidget->scrollx,
- rect->y1 - bwidget->scrolly);
+
+ if (rect != NULL) {
+ fb_queue_redraw(g->browser,
+ rect->x0 - bwidget->scrollx,
+ rect->y0 - bwidget->scrolly,
+ rect->x1 - bwidget->scrollx,
+ rect->y1 - bwidget->scrolly);
+ } else {
+ fb_queue_redraw(g->browser,
+ 0,
+ 0,
+ fbtk_get_width(g->browser),
+ fbtk_get_height(g->browser));
+ }
+ return NSERROR_OK;
}
static bool
@@ -1832,34 +1849,56 @@ gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
return true;
}
-static void
-gui_window_set_scroll(struct gui_window *gw, int sx, int sy)
+/**
+ * Set the scroll position of a framebuffer browser window.
+ *
+ * Scrolls the viewport to ensure the specified rectangle of the
+ * content is shown. The framebuffer implementation scrolls the contents so
+ * the specified point in the content is at the top of the viewport.
+ *
+ * \param gw gui_window to scroll
+ * \param rect The rectangle to ensure is shown.
+ * \return NSERROR_OK on success or apropriate error code.
+ */
+static nserror
+gui_window_set_scroll(struct gui_window *gw, const struct rect *rect)
{
struct browser_widget_s *bwidget = fbtk_get_userpw(gw->browser);
float scale = browser_window_get_scale(gw->bw);
assert(bwidget);
- widget_scroll_x(gw, sx * scale, true);
- widget_scroll_y(gw, sy * scale, true);
+ widget_scroll_x(gw, rect->x0 * scale, true);
+ widget_scroll_y(gw, rect->y0 * scale, true);
+
+ return NSERROR_OK;
}
-static void
-gui_window_get_dimensions(struct gui_window *g,
+/**
+ * Find the current dimensions of a framebuffer browser window content area.
+ *
+ * \param gw The gui window to measure content area of.
+ * \param width receives width of window
+ * \param height receives height of window
+ * \param scaled whether to return scaled values
+ * \return NSERROR_OK on sucess and width and height updated.
+ */
+static nserror
+gui_window_get_dimensions(struct gui_window *gw,
int *width,
int *height,
bool scaled)
{
- float scale = browser_window_get_scale(g->bw);
-
- *width = fbtk_get_width(g->browser);
- *height = fbtk_get_height(g->browser);
+ *width = fbtk_get_width(gw->browser);
+ *height = fbtk_get_height(gw->browser);
if (scaled) {
+ float scale = browser_window_get_scale(gw->bw);
*width /= scale;
*height /= scale;
}
+ return NSERROR_OK;
}
static void
@@ -2038,26 +2077,15 @@ gui_window_remove_caret(struct gui_window *g)
}
}
-static void framebuffer_window_reformat(struct gui_window *gw)
-{
- /** @todo if we ever do zooming reformat should be implemented */
- LOG("window:%p", gw);
-
- /*
- browser_window_reformat(gw->bw, false, width, height);
- */
-}
static struct gui_window_table framebuffer_window_table = {
.create = gui_window_create,
.destroy = gui_window_destroy,
- .redraw = gui_window_redraw_window,
- .update = gui_window_update_box,
+ .invalidate = fb_window_invalidate_area,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
- .reformat = framebuffer_window_reformat,
.set_url = gui_window_set_url,
.set_status = gui_window_set_status,
@@ -2160,7 +2188,7 @@ main(int argc, char** argv)
/* create an initial browser window */
- LOG("calling browser_window_create");
+ NSLOG(netsurf, INFO, "calling browser_window_create");
ret = nsurl_create(feurl, &url);
if (ret == NSERROR_OK) {
@@ -2182,11 +2210,14 @@ main(int argc, char** argv)
netsurf_exit();
if (fb_font_finalise() == false)
- LOG("Font finalisation failed.");
+ NSLOG(netsurf, INFO, "Font finalisation failed.");
/* finalise options */
nsoption_finalise(nsoptions, nsoptions_default);
+ /* finalise logging */
+ nslog_finalise();
+
return 0;
}
diff --git a/frontends/framebuffer/gui.h b/frontends/framebuffer/gui.h
index 0de1add69..abb27c4bb 100644
--- a/frontends/framebuffer/gui.h
+++ b/frontends/framebuffer/gui.h
@@ -27,17 +27,6 @@ typedef struct fb_cursor_s fb_cursor_t;
/* bounding box */
typedef struct nsfb_bbox_s bbox_t;
-struct gui_localhistory {
- struct browser_window *bw;
-
- struct fbtk_widget_s *window;
- struct fbtk_widget_s *hscroll;
- struct fbtk_widget_s *vscroll;
- struct fbtk_widget_s *history;
-
- int scrollx, scrolly; /**< scroll offsets. */
-};
-
struct gui_window {
struct browser_window *bw;
@@ -59,8 +48,6 @@ struct gui_window {
int throbber_index;
- struct gui_localhistory *localhistory;
-
struct gui_window *next;
struct gui_window *prev;
};
@@ -68,13 +55,8 @@ struct gui_window {
extern struct gui_window *window_list;
-struct gui_localhistory *fb_create_localhistory(struct browser_window *bw,
- struct fbtk_widget_s *parent, int furniture_width);
-void fb_localhistory_map(struct gui_localhistory * glh);
-
void gui_resize(struct fbtk_widget_s *root, int width, int height);
-
#endif /* NETSURF_FB_GUI_H */
/*
diff --git a/frontends/framebuffer/local_history.c b/frontends/framebuffer/local_history.c
new file mode 100644
index 000000000..cc45b1f29
--- /dev/null
+++ b/frontends/framebuffer/local_history.c
@@ -0,0 +1,248 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Implementation of framebuffer local history manager.
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include <libnsfb.h>
+#include <libnsfb_plot.h>
+#include <libnsfb_event.h>
+
+#include "utils/log.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "desktop/local_history.h"
+
+#include "framebuffer/gui.h"
+#include "framebuffer/fbtk.h"
+#include "framebuffer/framebuffer.h"
+#include "framebuffer/corewindow.h"
+#include "framebuffer/local_history.h"
+
+struct fb_local_history_window {
+ struct fb_corewindow core;
+
+ struct local_history_session *session;
+};
+
+static struct fb_local_history_window *local_history_window = NULL;
+
+
+/**
+ * callback for mouse action on local history window
+ *
+ * \param fb_cw The fb core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+fb_local_history_mouse(struct fb_corewindow *fb_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ struct fb_local_history_window *lhw;
+ /* technically degenerate container of */
+ lhw = (struct fb_local_history_window *)fb_cw;
+
+ local_history_mouse_action(lhw->session, mouse_state, x, y);
+
+ if (mouse_state != BROWSER_MOUSE_HOVER) {
+ fbtk_set_mapping(lhw->core.wnd, false);
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * callback for keypress on local history window
+ *
+ * \param fb_cw The fb core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+fb_local_history_key(struct fb_corewindow *fb_cw, uint32_t nskey)
+{
+ struct fb_local_history_window *lhw;
+ /* technically degenerate container of */
+ lhw = (struct fb_local_history_window *)fb_cw;
+
+ if (local_history_keypress(lhw->session, nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
+
+/**
+ * callback on draw event for local history window
+ *
+ * \param fb_cw The fb core window structure.
+ * \param r The rectangle of the window that needs updating.
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+fb_local_history_draw(struct fb_corewindow *fb_cw, struct rect *r)
+{
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &fb_plotters
+ };
+ struct fb_local_history_window *lhw;
+
+ /* technically degenerate container of */
+ lhw = (struct fb_local_history_window *)fb_cw;
+
+ local_history_redraw(lhw->session, 0, 0, r, &ctx);
+
+ return NSERROR_OK;
+}
+
+/**
+ * Creates the window for the local history view.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+static nserror
+fb_local_history_init(fbtk_widget_t *parent,
+ struct browser_window *bw,
+ struct fb_local_history_window **win_out)
+{
+ struct fb_local_history_window *ncwin;
+ nserror res;
+
+ /* memoise window so it can be represented when necessary
+ * instead of recreating every time.
+ */
+ if ((*win_out) != NULL) {
+ res = local_history_set((*win_out)->session, bw);
+ return res;
+ }
+
+ ncwin = calloc(1, sizeof(*ncwin));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ ncwin->core.draw = fb_local_history_draw;
+ ncwin->core.key = fb_local_history_key;
+ ncwin->core.mouse = fb_local_history_mouse;
+
+ res = fb_corewindow_init(parent, &ncwin->core);
+ if (res != NSERROR_OK) {
+ free(ncwin);
+ return res;
+ }
+
+ res = local_history_init(ncwin->core.cb_table,
+ (struct core_window *)ncwin,
+ bw,
+ &ncwin->session);
+ if (res != NSERROR_OK) {
+ free(ncwin);
+ return res;
+ }
+
+ *win_out = ncwin;
+
+ return NSERROR_OK;
+}
+
+
+/* exported function documented gtk/history.h */
+nserror fb_local_history_present(fbtk_widget_t *parent,
+ struct browser_window *bw)
+{
+ nserror res;
+ int prnt_width, prnt_height;
+ int width, height;
+
+ res = fb_local_history_init(parent, bw, &local_history_window);
+ if (res == NSERROR_OK) {
+
+ prnt_width = fbtk_get_width(parent);
+ prnt_height = fbtk_get_height(parent);
+
+ /* resize history widget ensureing the drawing area is
+ * no larger than parent window
+ */
+ res = local_history_get_size(local_history_window->session,
+ &width,
+ &height);
+ if (width > prnt_width) {
+ width = prnt_width;
+ }
+ if (height > prnt_height) {
+ height = prnt_height;
+ }
+ /* should update scroll area with contents */
+
+ fbtk_set_zorder(local_history_window->core.wnd, INT_MIN);
+ fbtk_set_mapping(local_history_window->core.wnd, true);
+ }
+
+ return res;
+}
+
+
+/* exported function documented gtk/history.h */
+nserror fb_local_history_hide(void)
+{
+ nserror res = NSERROR_OK;
+
+ if (local_history_window != NULL) {
+ fbtk_set_mapping(local_history_window->core.wnd, false);
+
+ res = local_history_set(local_history_window->session, NULL);
+ }
+
+ return res;
+}
+
+
+/* exported function documented gtk/history.h */
+nserror fb_local_history_destroy(void)
+{
+ nserror res;
+
+ if (local_history_window == NULL) {
+ return NSERROR_OK;
+ }
+
+ res = local_history_fini(local_history_window->session);
+ if (res == NSERROR_OK) {
+ res = fb_corewindow_fini(&local_history_window->core);
+ //gtk_widget_destroy(GTK_WIDGET(local_history_window->wnd));
+ free(local_history_window);
+ local_history_window = NULL;
+ }
+
+ return res;
+
+}
diff --git a/frontends/framebuffer/local_history.h b/frontends/framebuffer/local_history.h
new file mode 100644
index 000000000..929eeacd8
--- /dev/null
+++ b/frontends/framebuffer/local_history.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Interface to framebuffer local history manager
+ */
+
+#ifndef FB_LOCAL_HISTORY_H
+#define FB_LOCAL_HISTORY_H
+
+struct browser_window;
+
+/**
+ * make the local history window visible.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+nserror fb_local_history_present(fbtk_widget_t *parent, struct browser_window *bw);
+
+/**
+ * hide the local history window from being visible.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+nserror fb_local_history_hide(void);
+
+/**
+ * Destroys the local history window and performs any other necessary cleanup
+ * actions.
+ */
+nserror fb_local_history_destroy(void);
+
+#endif
diff --git a/frontends/framebuffer/localhistory.c b/frontends/framebuffer/localhistory.c
deleted file mode 100644
index 3192f0747..000000000
--- a/frontends/framebuffer/localhistory.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2010 Vincent Sanders <vince@simtec.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <limits.h>
-
-#include <libnsfb.h>
-#include <libnsfb_plot.h>
-#include <libnsfb_event.h>
-
-#include "desktop/browser_history.h"
-#include "netsurf/plotters.h"
-
-#include "framebuffer/gui.h"
-#include "framebuffer/fbtk.h"
-#include "framebuffer/framebuffer.h"
-
-static int
-localhistory_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi)
-{
- struct gui_localhistory *glh = cbi->context;
- nsfb_bbox_t rbox;
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &fb_plotters
- };
-
- rbox.x0 = fbtk_get_absx(widget);
- rbox.y0 = fbtk_get_absy(widget);
-
- rbox.x1 = rbox.x0 + fbtk_get_width(widget);
- rbox.y1 = rbox.y0 + fbtk_get_height(widget);
-
- nsfb_claim(fbtk_get_nsfb(widget), &rbox);
-
- nsfb_plot_rectangle_fill(fbtk_get_nsfb(widget), &rbox, 0xffffffff);
-
- browser_window_history_redraw_rectangle(glh->bw,
- glh->scrollx,
- glh->scrolly,
- fbtk_get_width(widget) + glh->scrollx,
- fbtk_get_height(widget) + glh->scrolly,
- 0, 0, &ctx);
-
- nsfb_update(fbtk_get_nsfb(widget), &rbox);
-
- return 0;
-}
-
-static int
-localhistory_click(fbtk_widget_t *widget, fbtk_callback_info *cbi)
-{
- struct gui_localhistory *glh = cbi->context;
-
- if (cbi->event->type != NSFB_EVENT_KEY_UP)
- return 0;
-
- browser_window_history_click(glh->bw, cbi->x, cbi->y, false);
-
- fbtk_set_mapping(glh->window, false);
-
- return 1;
-}
-
-struct gui_localhistory *
-fb_create_localhistory(struct browser_window *bw,
- fbtk_widget_t *parent,
- int furniture_width)
-{
- struct gui_localhistory *glh;
- glh = calloc(1, sizeof(struct gui_localhistory));
-
- if (glh == NULL)
- return NULL;
-
- glh->bw = bw;
-
- /* container window */
- glh->window = fbtk_create_window(parent, 0, 0, 0, 0, 0);
-
- glh->history = fbtk_create_user(glh->window, 0, 0, -furniture_width, -furniture_width, glh);
-
- fbtk_set_handler(glh->history, FBTK_CBT_REDRAW, localhistory_redraw, glh);
- fbtk_set_handler(glh->history, FBTK_CBT_CLICK, localhistory_click, glh);
- /*
- fbtk_set_handler(gw->localhistory, FBTK_CBT_INPUT, fb_browser_window_input, gw);
- fbtk_set_handler(gw->localhistory, FBTK_CBT_POINTERMOVE, fb_browser_window_move, bw);
- */
-
- /* create horizontal scrollbar */
- glh->hscroll = fbtk_create_hscroll(glh->window,
- 0,
- fbtk_get_height(glh->window) - furniture_width,
- fbtk_get_width(glh->window) - furniture_width,
- furniture_width,
- FB_SCROLL_COLOUR,
- FB_FRAME_COLOUR,
- NULL,
- NULL);
-
- glh->vscroll = fbtk_create_vscroll(glh->window,
- fbtk_get_width(glh->window) - furniture_width,
- 0,
- furniture_width,
- fbtk_get_height(glh->window) - furniture_width,
- FB_SCROLL_COLOUR,
- FB_FRAME_COLOUR,
- NULL,
- NULL);
-
- fbtk_create_fill(glh->window,
- fbtk_get_width(glh->window) - furniture_width,
- fbtk_get_height(glh->window) - furniture_width,
- furniture_width,
- furniture_width,
- FB_FRAME_COLOUR);
-
- return glh;
-}
-
-void
-fb_localhistory_map(struct gui_localhistory * glh)
-{
- fbtk_set_zorder(glh->window, INT_MIN);
- fbtk_set_mapping(glh->window, true);
-}
diff --git a/frontends/framebuffer/res/Messages b/frontends/framebuffer/res/Messages
deleted file mode 120000
index 72c9eff90..000000000
--- a/frontends/framebuffer/res/Messages
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/en/Messages \ No newline at end of file
diff --git a/frontends/framebuffer/res/adblock.css b/frontends/framebuffer/res/adblock.css
index ff2485622..0d12aaa7c 120000
--- a/frontends/framebuffer/res/adblock.css
+++ b/frontends/framebuffer/res/adblock.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/AdBlock,f79 \ No newline at end of file
+../../../resources/adblock.css \ No newline at end of file
diff --git a/frontends/framebuffer/res/credits.html b/frontends/framebuffer/res/credits.html
index 1ba17392b..b43a1a06c 120000
--- a/frontends/framebuffer/res/credits.html
+++ b/frontends/framebuffer/res/credits.html
@@ -1 +1 @@
-../../../!NetSurf/Resources/en/credits.html,faf \ No newline at end of file
+../../../resources/en/credits.html \ No newline at end of file
diff --git a/frontends/framebuffer/res/default.css b/frontends/framebuffer/res/default.css
index a8579eb7c..fa3ae6c26 120000
--- a/frontends/framebuffer/res/default.css
+++ b/frontends/framebuffer/res/default.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/CSS,f79 \ No newline at end of file
+../../../resources/default.css \ No newline at end of file
diff --git a/frontends/framebuffer/res/internal.css b/frontends/framebuffer/res/internal.css
index 17f9f1504..5583a9811 120000
--- a/frontends/framebuffer/res/internal.css
+++ b/frontends/framebuffer/res/internal.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/internal.css,f79 \ No newline at end of file
+../../../resources/internal.css \ No newline at end of file
diff --git a/frontends/framebuffer/res/licence.html b/frontends/framebuffer/res/licence.html
index 147dd6db2..c0c1e6630 120000
--- a/frontends/framebuffer/res/licence.html
+++ b/frontends/framebuffer/res/licence.html
@@ -1 +1 @@
-../../../!NetSurf/Resources/en/licence.html,faf \ No newline at end of file
+../../../resources/en/licence.html \ No newline at end of file
diff --git a/frontends/framebuffer/res/maps.html b/frontends/framebuffer/res/maps.html
index 28362130a..05bcdc42e 120000
--- a/frontends/framebuffer/res/maps.html
+++ b/frontends/framebuffer/res/maps.html
@@ -1 +1 @@
-../../../!NetSurf/Resources/en/welcome.html,faf \ No newline at end of file
+../../../resources/en/maps.html \ No newline at end of file
diff --git a/frontends/framebuffer/res/netsurf.png b/frontends/framebuffer/res/netsurf.png
index 905512c25..d0ab72a5e 120000
--- a/frontends/framebuffer/res/netsurf.png
+++ b/frontends/framebuffer/res/netsurf.png
@@ -1 +1 @@
-../../../!NetSurf/Resources/netsurf.png,b60 \ No newline at end of file
+../../../resources/netsurf.png \ No newline at end of file
diff --git a/frontends/framebuffer/res/quirks.css b/frontends/framebuffer/res/quirks.css
index 88aabe48c..1e752cb9e 120000
--- a/frontends/framebuffer/res/quirks.css
+++ b/frontends/framebuffer/res/quirks.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/Quirks,f79 \ No newline at end of file
+../../../resources/quirks.css \ No newline at end of file
diff --git a/frontends/framebuffer/res/welcome.html b/frontends/framebuffer/res/welcome.html
index 28362130a..d5220f90a 120000
--- a/frontends/framebuffer/res/welcome.html
+++ b/frontends/framebuffer/res/welcome.html
@@ -1 +1 @@
-../../../!NetSurf/Resources/en/welcome.html,faf \ No newline at end of file
+../../../resources/en/welcome.html \ No newline at end of file
diff --git a/frontends/framebuffer/schedule.c b/frontends/framebuffer/schedule.c
index 581ad72f1..6d1711236 100644
--- a/frontends/framebuffer/schedule.c
+++ b/frontends/framebuffer/schedule.c
@@ -24,12 +24,6 @@
#include "framebuffer/schedule.h"
-#ifdef DEBUG_SCHEDULER
-#define SRLOG(x...) LOG(x)
-#else
-#define SRLOG(x...) ((void) 0)
-#endif
-
/* linked list of scheduled callbacks */
static struct nscallback *schedule_list = NULL;
@@ -63,7 +57,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
return NSERROR_OK;
}
- SRLOG("removing %p, %p", callback, p);
+ NSLOG(schedule, DEBUG, "removing %p, %p", callback, p);
cur_nscb = schedule_list;
prev_nscb = NULL;
@@ -73,7 +67,8 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
(cur_nscb->p == p)) {
/* item to remove */
- SRLOG("callback entry %p removing %p(%p)",
+ NSLOG(schedule, DEBUG,
+ "callback entry %p removing %p(%p)",
cur_nscb, cur_nscb->callback, cur_nscb->p);
/* remove callback */
@@ -109,7 +104,7 @@ nserror framebuffer_schedule(int tival, void (*callback)(void *p), void *p)
return ret;
}
- SRLOG("Adding %p(%p) in %d", callback, p, tival);
+ NSLOG(schedule, DEBUG, "Adding %p(%p) in %d", callback, p, tival);
tv.tv_sec = tival / 1000; /* miliseconds to seconds */
tv.tv_usec = (tival % 1000) * 1000; /* remainder to microseconds */
@@ -190,7 +185,9 @@ int schedule_run(void)
/* make rettime relative to now */
timersub(&nexttime, &tv, &rettime);
- SRLOG("returning time to next event as %ldms",(rettime.tv_sec * 1000) + (rettime.tv_usec / 1000));
+ NSLOG(schedule, DEBUG,
+ "returning time to next event as %ldms",
+ (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000));
/* return next event time in milliseconds (24days max wait) */
return (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000);
@@ -203,12 +200,14 @@ void list_schedule(void)
gettimeofday(&tv, NULL);
- LOG("schedule list at %ld:%ld", tv.tv_sec, tv.tv_usec);
+ NSLOG(netsurf, INFO, "schedule list at %ld:%ld", tv.tv_sec,
+ tv.tv_usec);
cur_nscb = schedule_list;
while (cur_nscb != NULL) {
- LOG("Schedule %p at %ld:%ld", cur_nscb, cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec);
+ NSLOG(netsurf, INFO, "Schedule %p at %ld:%ld", cur_nscb,
+ cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec);
cur_nscb = cur_nscb->next;
}
}
diff --git a/frontends/gtk/Makefile b/frontends/gtk/Makefile
index afbfcd791..ec60ce70c 100644
--- a/frontends/gtk/Makefile
+++ b/frontends/gtk/Makefile
@@ -165,11 +165,11 @@ endif
# S_FRONTEND are sources purely for the GTK frontend
S_FRONTEND := gui.c schedule.c layout_pango.c bitmap.c plotters.c \
- scaffolding.c gdk.c completion.c login.c throbber.c \
- selection.c global_history.c window.c fetch.c download.c menu.c \
- print.c search.c tabs.c toolbar.c gettext.c \
- compat.c cookies.c hotlist.c viewdata.c viewsource.c \
- preferences.c about.c ssl_cert.c resources.c corewindow.c
+ scaffolding.c gdk.c completion.c login.c throbber.c accelerator.c \
+ selection.c window.c fetch.c download.c menu.c print.c \
+ search.c tabs.c toolbar.c gettext.c compat.c viewdata.c \
+ viewsource.c preferences.c about.c resources.c corewindow.c \
+ local_history.c global_history.c cookies.c hotlist.c ssl_cert.c
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
diff --git a/frontends/gtk/accelerator.c b/frontends/gtk/accelerator.c
new file mode 100644
index 000000000..11b7fb1d0
--- /dev/null
+++ b/frontends/gtk/accelerator.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2018 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * GTK accelerator support
+ *
+ */
+
+#include <stdint.h>
+#include <gtk/gtk.h>
+
+#include "utils/log.h"
+#include "utils/errors.h"
+#include "utils/hashtable.h"
+
+#include "gtk/resources.h"
+#include "gtk/accelerator.h"
+
+/** acclelerators are stored in a fixed-size hash table. */
+#define HASH_SIZE 53
+
+/** The hash table used to store the accelerators */
+static struct hash_table *accelerators_hash = NULL;
+
+nserror nsgtk_accelerator_init(char **respaths)
+{
+ nserror res;
+ const uint8_t *data;
+ size_t data_size;
+
+ if (accelerators_hash == NULL) {
+ accelerators_hash = hash_create(HASH_SIZE);
+ }
+ if (accelerators_hash == NULL) {
+ NSLOG(netsurf, INFO, "Unable to create hash table");
+ return NSERROR_NOMEM;
+ }
+
+ res = nsgtk_data_from_resname("accelerators", &data, &data_size);
+ if (res == NSERROR_OK) {
+ res = hash_add_inline(accelerators_hash, data, data_size);
+ } else {
+ const char *accelerators_path;
+ /* Obtain path to accelerators */
+ res = nsgtk_path_from_resname("accelerators",
+ &accelerators_path);
+ if (res == NSERROR_OK) {
+ res = hash_add_file(accelerators_hash,
+ accelerators_path);
+ }
+ }
+
+ return res;
+}
+
+const char *nsgtk_accelerator_get_desc(const char *key)
+{
+ if ((key == NULL) ||
+ (accelerators_hash == NULL)) {
+ return NULL;
+ }
+ return hash_get(accelerators_hash, key);
+}
diff --git a/frontends/gtk/accelerator.h b/frontends/gtk/accelerator.h
new file mode 100644
index 000000000..09c253eb9
--- /dev/null
+++ b/frontends/gtk/accelerator.h
@@ -0,0 +1,2 @@
+nserror nsgtk_accelerator_init(char **respaths);
+const char *nsgtk_accelerator_get_desc(const char *key);
diff --git a/frontends/gtk/bitmap.c b/frontends/gtk/bitmap.c
index b42814295..36b614cf9 100644
--- a/frontends/gtk/bitmap.c
+++ b/frontends/gtk/bitmap.c
@@ -18,9 +18,9 @@
/**
* \file
- * Generic bitmap handling (GDK / GTK+ implementation).
+ * GTK bitmap handling.
*
- * This implements the interface given by desktop/bitmap.h using GdkPixbufs.
+ * This implements the bitmap interface using cairo image surfaces
*/
#include <assert.h>
diff --git a/frontends/gtk/cookies.c b/frontends/gtk/cookies.c
index dc77e1c4e..1f7833cca 100644
--- a/frontends/gtk/cookies.c
+++ b/frontends/gtk/cookies.c
@@ -164,8 +164,9 @@ static void nsgtk_cookies_init_menu(struct nsgtk_cookie_window *ncwin)
w = GTK_WIDGET(gtk_builder_get_object(ncwin->builder,
event->widget));
if (w == NULL) {
- LOG("Unable to connect menu widget ""%s""",
- event->widget);
+ NSLOG(netsurf, INFO,
+ "Unable to connect menu widget ""%s""",
+ event->widget);
} else {
g_signal_connect(G_OBJECT(w),
"activate",
@@ -246,14 +247,14 @@ static nserror nsgtk_cookies_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsgtk_cookie_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
res = nsgtk_builder_new_from_resname("cookies", &ncwin->builder);
if (res != NSERROR_OK) {
- LOG("Cookie UI builder init failed");
+ NSLOG(netsurf, INFO, "Cookie UI builder init failed");
free(ncwin);
return res;
}
diff --git a/frontends/gtk/corewindow.c b/frontends/gtk/corewindow.c
index 70c3ad135..6ca5d228f 100644
--- a/frontends/gtk/corewindow.c
+++ b/frontends/gtk/corewindow.c
@@ -145,6 +145,7 @@ nsgtk_cw_button_release_event(GtkWidget *widget,
{
struct nsgtk_corewindow *nsgtk_cw = (struct nsgtk_corewindow *)g;
struct nsgtk_corewindow_mouse *mouse = &nsgtk_cw->mouse_state;
+ bool was_drag = false;
/* only button 1 clicks are considered double clicks. If the
* mouse state is PRESS then we are waiting for a release to
@@ -168,9 +169,11 @@ nsgtk_cw_button_release_event(GtkWidget *widget,
} else if (mouse->state & BROWSER_MOUSE_HOLDING_1) {
mouse->state ^= (BROWSER_MOUSE_HOLDING_1 |
BROWSER_MOUSE_DRAG_ON);
+ was_drag = true;
} else if (mouse->state & BROWSER_MOUSE_HOLDING_2) {
mouse->state ^= (BROWSER_MOUSE_HOLDING_2 |
BROWSER_MOUSE_DRAG_ON);
+ was_drag = true;
}
/* Handle modifiers being removed */
@@ -188,9 +191,10 @@ nsgtk_cw_button_release_event(GtkWidget *widget,
}
/* end drag with modifiers */
- if (mouse->state & (BROWSER_MOUSE_MOD_1 |
- BROWSER_MOUSE_MOD_2 |
- BROWSER_MOUSE_MOD_3)) {
+ if (was_drag && (mouse->state & (
+ BROWSER_MOUSE_MOD_1 |
+ BROWSER_MOUSE_MOD_2 |
+ BROWSER_MOUSE_MOD_3))) {
mouse->state = BROWSER_MOUSE_HOVER;
}
@@ -413,14 +417,14 @@ nsgtk_cw_keypress_event(GtkWidget *widget, GdkEventKey *event, gpointer g)
if (res == NSERROR_OK) {
return TRUE;
} else if (res != NSERROR_NOT_IMPLEMENTED) {
- LOG("%s", messages_get_errorcode(res));
+ NSLOG(netsurf, INFO, "%s", messages_get_errorcode(res));
return FALSE;
}
/* deal with unprocessed keypress */
res = nsgtk_cw_key(nsgtk_cw, nskey);
if (res != NSERROR_OK) {
- LOG("%s", messages_get_errorcode(res));
+ NSLOG(netsurf, INFO, "%s", messages_get_errorcode(res));
return FALSE;
}
return TRUE;
@@ -496,7 +500,6 @@ nsgtk_cw_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data)
double y2;
struct rect clip;
- current_widget = widget;
current_cr = cr;
cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
@@ -508,8 +511,6 @@ nsgtk_cw_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data)
nsgtk_cw->draw(nsgtk_cw, &clip);
- current_widget = NULL;
-
return FALSE;
}
@@ -537,12 +538,10 @@ nsgtk_cw_draw_event(GtkWidget *widget,
clip.x1 = event->area.x + event->area.width;
clip.y1 = event->area.y + event->area.height;
- current_widget = widget;
current_cr = gdk_cairo_create(nsgtk_widget_get_window(widget));
nsgtk_cw->draw(nsgtk_cw, &clip);
- current_widget = NULL;
cairo_destroy(current_cr);
return FALSE;
@@ -552,19 +551,33 @@ nsgtk_cw_draw_event(GtkWidget *widget,
/**
- * redraw window core window callback
+ * callback from core to request an invalidation of a GTK core window area.
*
- * \param cw core window handle.
- * \param r rectangle that needs redrawing.
+ * The specified area of the window should now be considered
+ * out of date. If the area is NULL the entire window must be
+ * invalidated.
+ *
+ * \param[in] cw The core window to invalidate.
+ * \param[in] rect area to redraw or NULL for the entire window area.
+ * \return NSERROR_OK on success or appropriate error code.
*/
-static void
-nsgtk_cw_redraw_request(struct core_window *cw, const struct rect *r)
+static nserror
+nsgtk_cw_invalidate_area(struct core_window *cw, const struct rect *rect)
{
struct nsgtk_corewindow *nsgtk_cw = (struct nsgtk_corewindow *)cw;
+ if (rect == NULL) {
+ gtk_widget_queue_draw(GTK_WIDGET(nsgtk_cw->drawing_area));
+ return NSERROR_OK;
+ }
+
gtk_widget_queue_draw_area(GTK_WIDGET(nsgtk_cw->drawing_area),
- r->x0, r->y0,
- r->x1 - r->x0, r->y1 - r->y0);
+ rect->x0,
+ rect->y0,
+ rect->x1 - rect->x0,
+ rect->y1 - rect->y0);
+
+ return NSERROR_OK;
}
@@ -653,7 +666,7 @@ static void
nsgtk_cw_drag_status(struct core_window *cw, core_window_drag_status ds)
{
struct nsgtk_corewindow *nsgtk_cw = (struct nsgtk_corewindow *)cw;
- nsgtk_cw->drag_staus = ds;
+ nsgtk_cw->drag_status = ds;
}
@@ -661,17 +674,19 @@ nsgtk_cw_drag_status(struct core_window *cw, core_window_drag_status ds)
* core window callback table for nsgtk
*/
static struct core_window_callback_table nsgtk_cw_cb_table = {
- .redraw_request = nsgtk_cw_redraw_request,
+ .invalidate = nsgtk_cw_invalidate_area,
.update_size = nsgtk_cw_update_size,
.scroll_visible = nsgtk_cw_scroll_visible,
.get_window_dimensions = nsgtk_cw_get_window_dimensions,
.drag_status = nsgtk_cw_drag_status
};
+
/* exported function documented gtk/corewindow.h */
nserror nsgtk_corewindow_init(struct nsgtk_corewindow *nsgtk_cw)
{
nsgtk_cw->cb_table = &nsgtk_cw_cb_table;
+ nsgtk_cw->drag_status = CORE_WINDOW_DRAG_NONE;
/* input method setup */
nsgtk_cw->input_method = gtk_im_multicontext_new();
diff --git a/frontends/gtk/corewindow.h b/frontends/gtk/corewindow.h
index 90bfd6193..6100e67ae 100644
--- a/frontends/gtk/corewindow.h
+++ b/frontends/gtk/corewindow.h
@@ -51,7 +51,7 @@ struct nsgtk_corewindow {
/** mouse state */
struct nsgtk_corewindow_mouse mouse_state;
/** drag status set by core */
- core_window_drag_status drag_staus;
+ core_window_drag_status drag_status;
/**
* callback to draw on drawable area of nsgtk core window
diff --git a/frontends/gtk/download.c b/frontends/gtk/download.c
index 8c8161459..d11036ea8 100644
--- a/frontends/gtk/download.c
+++ b/frontends/gtk/download.c
@@ -331,6 +331,7 @@ static gboolean nsgtk_download_update(gboolean force_update)
switch (dl->status) {
case NSGTK_DOWNLOAD_WORKING:
pulse_mode = TRUE;
+ /* Fall through */
case NSGTK_DOWNLOAD_NONE:
dl->speed = dl->size_downloaded /
@@ -347,6 +348,7 @@ static gboolean nsgtk_download_update(gboolean force_update)
nsgtk_downloads_num_active++;
update = TRUE;
+ /* Fall through */
case NSGTK_DOWNLOAD_COMPLETE:
downloaded += dl->size_downloaded;
@@ -475,7 +477,7 @@ nserror nsgtk_download_init(void)
res = nsgtk_builder_new_from_resname("downloads", &builder);
if (res != NSERROR_OK) {
- LOG("Download UI builder init failed");
+ NSLOG(netsurf, INFO, "Download UI builder init failed");
return res;
}
diff --git a/frontends/gtk/fetch.c b/frontends/gtk/fetch.c
index 154f43708..b05c1bd95 100644
--- a/frontends/gtk/fetch.c
+++ b/frontends/gtk/fetch.c
@@ -30,6 +30,7 @@
* ASCII hence not using locale dependant ctype functions for parsing.
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -39,8 +40,8 @@
#include <strings.h>
#include <gtk/gtk.h>
-#include "utils/hashtable.h"
#include "utils/log.h"
+#include "utils/hashtable.h"
#include "utils/filepath.h"
#include "utils/file.h"
#include "utils/nsurl.h"
@@ -90,7 +91,8 @@ void gtk_fetch_filetype_init(const char *mimefile)
fh = fopen(mimefile, "r");
if (fh == NULL) {
- LOG("Unable to open a mime.types file, so using a minimal one for you.");
+ NSLOG(netsurf, INFO,
+ "Unable to open a mime.types file, so using a minimal one for you.");
return;
}
diff --git a/frontends/gtk/gdk.c b/frontends/gtk/gdk.c
index 9ed90bd8e..fd82af5b2 100644
--- a/frontends/gtk/gdk.c
+++ b/frontends/gtk/gdk.c
@@ -86,7 +86,7 @@ nsgdk_pixbuf_get_from_surface(cairo_surface_t *surface, int scwidth, int scheigh
if (cairo_surface_status(scsurface) != CAIRO_STATUS_SUCCESS) {
cairo_surface_destroy(scsurface);
g_object_unref(pixbuf);
- LOG("Surface creation failed");
+ NSLOG(netsurf, INFO, "Surface creation failed");
return NULL;
}
diff --git a/frontends/gtk/global_history.c b/frontends/gtk/global_history.c
index 7d647057b..f204168d0 100644
--- a/frontends/gtk/global_history.c
+++ b/frontends/gtk/global_history.c
@@ -214,8 +214,9 @@ nsgtk_global_history_init_menu(struct nsgtk_global_history_window *ghwin)
w = GTK_WIDGET(gtk_builder_get_object(ghwin->builder,
event->widget));
if (w == NULL) {
- LOG("Unable to connect menu widget ""%s""",
- event->widget);
+ NSLOG(netsurf, INFO,
+ "Unable to connect menu widget ""%s""",
+ event->widget);
} else {
g_signal_connect(G_OBJECT(w),
"activate",
@@ -228,7 +229,7 @@ nsgtk_global_history_init_menu(struct nsgtk_global_history_window *ghwin)
/**
- * callback for mouse action on cookie window
+ * callback for mouse action on global history window
*
* \param nsgtk_cw The nsgtk core window structure.
* \param mouse_state netsurf mouse state on event
@@ -248,7 +249,7 @@ nsgtk_global_history_mouse(struct nsgtk_corewindow *nsgtk_cw,
/**
- * callback for keypress on cookie window
+ * callback for keypress on global history window
*
* \param nsgtk_cw The nsgtk core window structure.
* \param nskey The netsurf key code
@@ -265,7 +266,7 @@ nsgtk_global_history_key(struct nsgtk_corewindow *nsgtk_cw, uint32_t nskey)
/**
- * callback on draw event for cookie window
+ * callback on draw event for global history window
*
* \param nsgtk_cw The nsgtk core window structure.
* \param r The rectangle of the window that needs updating.
@@ -299,14 +300,14 @@ static nserror nsgtk_global_history_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsgtk_global_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
- res = nsgtk_builder_new_from_resname("history", &ncwin->builder);
+ res = nsgtk_builder_new_from_resname("globalhistory", &ncwin->builder);
if (res != NSERROR_OK) {
- LOG("History UI builder init failed");
+ NSLOG(netsurf, INFO, "History UI builder init failed");
free(ncwin);
return res;
}
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index 8d6b42234..3163be16d 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -58,6 +58,7 @@
#include "gtk/download.h"
#include "gtk/fetch.h"
#include "gtk/gui.h"
+#include "gtk/local_history.h"
#include "gtk/global_history.h"
#include "gtk/hotlist.h"
#include "gtk/throbber.h"
@@ -71,6 +72,7 @@
#include "gtk/resources.h"
#include "gtk/login.h"
#include "gtk/layout_pango.h"
+#include "gtk/accelerator.h"
bool nsgtk_complete = false;
@@ -207,7 +209,8 @@ static nserror set_defaults(struct nsoption_s *defaults)
(nsoption_charp(hotlist_path) == NULL) ||
(nsoption_charp(downloads_directory) == NULL) ||
(nsoption_charp(ca_path) == NULL)) {
- LOG("Failed initialising default resource paths");
+ NSLOG(netsurf, INFO,
+ "Failed initialising default resource paths");
return NSERROR_BAD_PARAMETER;
}
@@ -225,7 +228,11 @@ static nserror set_defaults(struct nsoption_s *defaults)
/**
- * Initialize GTK interface.
+ * Initialize GTK specific parts of the browser.
+ *
+ * \param argc The number of arguments on the command line
+ * \param argv A string vector of command line arguments.
+ * \respath A string vector of the path elements of resources
*/
static nserror nsgtk_init(int argc, char** argv, char **respath)
{
@@ -233,21 +240,30 @@ static nserror nsgtk_init(int argc, char** argv, char **respath)
char *resource_filename;
char *addr = NULL;
nsurl *url;
- nserror error;
+ nserror res;
- error = nsgtk_builder_new_from_resname("warning", &warning_builder);
- if (error != NSERROR_OK) {
- LOG("Unable to initialise warning dialog");
- return error;
+ /* Initialise gtk accelerator table */
+ res = nsgtk_accelerator_init(respaths);
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO,
+ "Unable to load gtk accelerator configuration");
+ /* not fatal if this does not load */
+ }
+
+ /* initialise warning dialog */
+ res = nsgtk_builder_new_from_resname("warning", &warning_builder);
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO, "Unable to initialise warning dialog");
+ return res;
}
gtk_builder_connect_signals(warning_builder, NULL);
/* set default icon if its available */
- error = nsgdk_pixbuf_new_from_resname("netsurf.xpm",
- &win_default_icon_pixbuf);
- if (error == NSERROR_OK) {
- LOG("Seting default window icon");
+ res = nsgdk_pixbuf_new_from_resname("netsurf.xpm",
+ &win_default_icon_pixbuf);
+ if (res == NSERROR_OK) {
+ NSLOG(netsurf, INFO, "Seting default window icon");
gtk_window_set_default_icon(win_default_icon_pixbuf);
}
@@ -255,35 +271,43 @@ static nserror nsgtk_init(int argc, char** argv, char **respath)
resource_filename = filepath_find(respath, "SearchEngines");
search_web_init(resource_filename);
if (resource_filename != NULL) {
- LOG("Using '%s' as Search Engines file", resource_filename);
+ NSLOG(netsurf, INFO, "Using '%s' as Search Engines file",
+ resource_filename);
free(resource_filename);
}
/* Default favicon */
- error = nsgdk_pixbuf_new_from_resname("favicon.png", &favicon_pixbuf);
- if (error != NSERROR_OK) {
+ res = nsgdk_pixbuf_new_from_resname("favicon.png", &favicon_pixbuf);
+ if (res != NSERROR_OK) {
favicon_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
false, 8, 16, 16);
}
/* arrow down icon */
- error = nsgdk_pixbuf_new_from_resname("arrow_down_8x32.png",
- &arrow_down_pixbuf);
- if (error != NSERROR_OK) {
+ res = nsgdk_pixbuf_new_from_resname("arrow_down_8x32.png",
+ &arrow_down_pixbuf);
+ if (res != NSERROR_OK) {
arrow_down_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
false, 8, 8, 32);
}
/* initialise throbber */
- error = nsgtk_throbber_init();
- if (error != NSERROR_OK) {
- LOG("Unable to initialise throbber.");
- return error;
+ res = nsgtk_throbber_init();
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO, "Unable to initialise throbber.");
+ return res;
}
/* Initialise completions - cannot fail */
nsgtk_completion_init();
+ /* The tree view system needs to know the screen's DPI, so we
+ * find that out here, rather than when we create a first browser
+ * window.
+ */
+ browser_set_dpi(gdk_screen_get_resolution(gdk_screen_get_default()));
+ NSLOG(netsurf, INFO, "Set CSS DPI to %d", browser_get_dpi());
+
filepath_sfinddef(respath, buf, "mime.types", "/etc/");
gtk_fetch_filetype_init(buf);
@@ -291,20 +315,14 @@ static nserror nsgtk_init(int argc, char** argv, char **respath)
urldb_load(nsoption_charp(url_file));
urldb_load_cookies(nsoption_charp(cookie_file));
- hotlist_init(nsoption_charp(hotlist_path));
-
- /* The tree view system needs to know the screen's DPI, so we
- * find that out here, rather than when we create a first browser
- * window.
- */
- browser_set_dpi(gdk_screen_get_resolution(gdk_screen_get_default()));
- LOG("Set CSS DPI to %d", browser_get_dpi());
+ hotlist_init(nsoption_charp(hotlist_path),
+ nsoption_charp(hotlist_path));
/* Initialise top level UI elements */
- error = nsgtk_download_init();
- if (error != NSERROR_OK) {
- LOG("Unable to initialise download window.");
- return error;
+ res = nsgtk_download_init();
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO, "Unable to initialise download window.");
+ return res;
}
/* If there is a url specified on the command line use it */
@@ -334,19 +352,19 @@ static nserror nsgtk_init(int argc, char** argv, char **respath)
}
/* create an initial browser window */
- error = nsurl_create(addr, &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
+ res = nsurl_create(addr, &url);
+ if (res == NSERROR_OK) {
+ res = browser_window_create(BW_CREATE_HISTORY,
+ url,
+ NULL,
+ NULL,
+ NULL);
nsurl_unref(url);
}
free(addr);
- return error;
+ return res;
}
@@ -424,7 +442,7 @@ static void gui_quit(void)
{
nserror res;
- LOG("Quitting GUI");
+ NSLOG(netsurf, INFO, "Quitting GUI");
/* Ensure all scaffoldings are destroyed before we go into exit */
nsgtk_download_destroy();
@@ -433,26 +451,34 @@ static void gui_quit(void)
res = nsgtk_cookies_destroy();
if (res != NSERROR_OK) {
- LOG("Error finalising cookie viewer: %s",
- messages_get_errorcode(res));
+ NSLOG(netsurf, INFO, "Error finalising cookie viewer: %s",
+ messages_get_errorcode(res));
+ }
+
+ res = nsgtk_local_history_destroy();
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO,
+ "Error finalising local history viewer: %s",
+ messages_get_errorcode(res));
}
res = nsgtk_global_history_destroy();
if (res != NSERROR_OK) {
- LOG("Error finalising global history viewer: %s",
- messages_get_errorcode(res));
+ NSLOG(netsurf, INFO,
+ "Error finalising global history viewer: %s",
+ messages_get_errorcode(res));
}
res = nsgtk_hotlist_destroy();
if (res != NSERROR_OK) {
- LOG("Error finalising hotlist viewer: %s",
- messages_get_errorcode(res));
+ NSLOG(netsurf, INFO, "Error finalising hotlist viewer: %s",
+ messages_get_errorcode(res));
}
- res = hotlist_fini(nsoption_charp(hotlist_path));
+ res = hotlist_fini();
if (res != NSERROR_OK) {
- LOG("Error finalising hotlist: %s",
- messages_get_errorcode(res));
+ NSLOG(netsurf, INFO, "Error finalising hotlist: %s",
+ messages_get_errorcode(res));
}
free(nsgtk_config_home);
@@ -484,7 +510,7 @@ nserror nsgtk_warning(const char *warning, const char *detail)
static GtkWindow *nsgtk_warning_window;
GtkLabel *WarningLabel;
- LOG("%s %s", warning, detail ? detail : "");
+ NSLOG(netsurf, INFO, "%s %s", warning, detail ? detail : "");
fflush(stdout);
nsgtk_warning_window = GTK_WINDOW(gtk_builder_get_object(warning_builder, "wndWarning"));
@@ -592,7 +618,7 @@ static void nsgtk_pdf_password(char **owner_pass, char **user_pass, char *path)
res = nsgtk_builder_new_from_resname("password", &password_builder);
if (res != NSERROR_OK) {
- LOG("Password UI builder init failed");
+ NSLOG(netsurf, INFO, "Password UI builder init failed");
return;
}
@@ -813,7 +839,7 @@ static nserror get_config_home(char **config_home_out)
if (home_dir != NULL) {
ret = check_dirname(home_dir, ".netsurf", &config_home);
if (ret == NSERROR_OK) {
- LOG("\"%s\"", config_home);
+ NSLOG(netsurf, INFO, "\"%s\"", config_home);
*config_home_out = config_home;
return ret;
}
@@ -853,7 +879,7 @@ static nserror get_config_home(char **config_home_out)
}
}
- LOG("\"%s\"", config_home);
+ NSLOG(netsurf, INFO, "\"%s\"", config_home);
*config_home_out = config_home;
return NSERROR_OK;
@@ -866,7 +892,7 @@ static nserror create_config_home(char **config_home_out)
char *xdg_config_dir;
nserror ret;
- LOG("Attempting to create configuration directory");
+ NSLOG(netsurf, INFO, "Attempting to create configuration directory");
/* $XDG_CONFIG_HOME defines the base directory
* relative to which user specific configuration files
@@ -902,7 +928,7 @@ static nserror create_config_home(char **config_home_out)
/* strip the trailing separator */
config_home[strlen(config_home) - 1] = 0;
- LOG("\"%s\"", config_home);
+ NSLOG(netsurf, INFO, "\"%s\"", config_home);
*config_home_out = config_home;
@@ -951,7 +977,7 @@ static nserror get_cache_home(char **cache_home_out)
}
}
- LOG("\"%s\"", cache_home);
+ NSLOG(netsurf, INFO, "\"%s\"", cache_home);
*cache_home_out = cache_home;
return NSERROR_OK;
@@ -964,7 +990,7 @@ static nserror create_cache_home(char **cache_home_out)
char *xdg_cache_dir;
nserror ret;
- LOG("Attempting to create configuration directory");
+ NSLOG(netsurf, INFO, "Attempting to create configuration directory");
/* $XDG_CACHE_HOME defines the base directory
* relative to which user specific cache files
@@ -1000,7 +1026,7 @@ static nserror create_cache_home(char **cache_home_out)
/* strip the trailing separator */
cache_home[strlen(cache_home) - 1] = 0;
- LOG("\"%s\"", cache_home);
+ NSLOG(netsurf, INFO, "\"%s\"", cache_home);
*cache_home_out = cache_home;
@@ -1107,7 +1133,8 @@ int main(int argc, char** argv)
ret = create_config_home(&nsgtk_config_home);
}
if (ret != NSERROR_OK) {
- LOG("Unable to locate a configuration directory.");
+ NSLOG(netsurf, INFO,
+ "Unable to locate a configuration directory.");
nsgtk_config_home = NULL;
}
@@ -1147,10 +1174,10 @@ int main(int argc, char** argv)
if (ret != NSERROR_OK) {
fprintf(stderr, "Unable to load translated messages (%s)\n",
messages_get_errorcode(ret));
- LOG("Unable to load translated messages");
+ NSLOG(netsurf, INFO, "Unable to load translated messages");
/** \todo decide if message load faliure should be fatal */
}
-
+
/* Locate the correct user cache directory path */
ret = get_cache_home(&cache_home);
if (ret == NSERROR_NOT_FOUND) {
@@ -1158,7 +1185,7 @@ int main(int argc, char** argv)
ret = create_cache_home(&cache_home);
}
if (ret != NSERROR_OK) {
- LOG("Unable to locate a cache directory.");
+ NSLOG(netsurf, INFO, "Unable to locate a cache directory.");
}
/* core initialisation */
@@ -1170,7 +1197,7 @@ int main(int argc, char** argv)
return 1;
}
- /* run the browser */
+ /* gtk specific initalisation and main run loop */
ret = nsgtk_init(argc, argv, respaths);
if (ret != NSERROR_OK) {
fprintf(stderr, "NetSurf gtk initialise failed (%s)\n",
@@ -1185,5 +1212,8 @@ int main(int argc, char** argv)
/* finalise options */
nsoption_finalise(nsoptions, nsoptions_default);
+ /* finalise logging */
+ nslog_finalise();
+
return 0;
}
diff --git a/frontends/gtk/hotlist.c b/frontends/gtk/hotlist.c
index 34a13772d..843e47736 100644
--- a/frontends/gtk/hotlist.c
+++ b/frontends/gtk/hotlist.c
@@ -236,8 +236,9 @@ static void nsgtk_hotlist_init_menu(struct nsgtk_hotlist_window *hlwin)
w = GTK_WIDGET(gtk_builder_get_object(hlwin->builder,
event->widget));
if (w == NULL) {
- LOG("Unable to connect menu widget ""%s""",
- event->widget);
+ NSLOG(netsurf, INFO,
+ "Unable to connect menu widget ""%s""",
+ event->widget);
} else {
g_signal_connect(G_OBJECT(w),
"activate",
@@ -319,14 +320,14 @@ static nserror nsgtk_hotlist_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsgtk_hotlist_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
res = nsgtk_builder_new_from_resname("hotlist", &ncwin->builder);
if (res != NSERROR_OK) {
- LOG("Hotlist UI builder init failed");
+ NSLOG(netsurf, INFO, "Hotlist UI builder init failed");
free(ncwin);
return res;
}
diff --git a/frontends/gtk/layout_pango.c b/frontends/gtk/layout_pango.c
index 7c7190982..9e8e94d48 100644
--- a/frontends/gtk/layout_pango.c
+++ b/frontends/gtk/layout_pango.c
@@ -30,6 +30,7 @@
#include "utils/log.h"
#include "utils/nsoption.h"
+#include "netsurf/inttypes.h"
#include "netsurf/layout.h"
#include "netsurf/plot_style.h"
@@ -42,12 +43,12 @@ static PangoLayout *nsfont_pango_layout = NULL;
static inline void nsfont_pango_check(void)
{
if (nsfont_pango_context == NULL) {
- LOG("Creating nsfont_pango_context.");
+ NSLOG(netsurf, INFO, "Creating nsfont_pango_context.");
nsfont_pango_context = gdk_pango_context_get();
}
if (nsfont_pango_layout == NULL) {
- LOG("Creating nsfont_pango_layout.");
+ NSLOG(netsurf, INFO, "Creating nsfont_pango_layout.");
nsfont_pango_layout = pango_layout_new(nsfont_pango_context);
}
}
@@ -84,9 +85,10 @@ nsfont_width(const plot_font_style_t *fstyle,
pango_layout_get_pixel_size(nsfont_pango_layout, width, 0);
- /* LOG("fstyle: %p string:\"%.*s\", length: %u, width: %dpx",
- fstyle, length, string, length, *width);
- */
+ NSLOG(netsurf, DEEPDEBUG,
+ "fstyle: %p string:\"%.*s\", length: %" PRIsizet ", width: %dpx",
+ fstyle, (int)length, string, length, *width);
+
return NSERROR_OK;
}
@@ -194,7 +196,7 @@ nsfont_split(const plot_font_style_t *fstyle,
pango_layout_set_single_paragraph_mode(layout, TRUE);
/* Obtain the second line of the layout (if there is one) */
- line = pango_layout_get_line(layout, 1);
+ line = pango_layout_get_line_readonly(layout, 1);
if (line != NULL) {
/* Pango split the text. The line's start_index indicates the
* start of the character after the line break. */
@@ -222,32 +224,29 @@ nsfont_split(const plot_font_style_t *fstyle,
* \param fstyle plot style for this text
* \return true on success, false on error and error reported
*/
-bool nsfont_paint(int x, int y, const char *string, size_t length,
+nserror nsfont_paint(int x, int y, const char *string, size_t length,
const plot_font_style_t *fstyle)
{
PangoFontDescription *desc;
- PangoLayout *layout;
PangoLayoutLine *line;
if (length == 0)
- return true;
+ return NSERROR_OK;
- layout = pango_cairo_create_layout(current_cr);
+ nsfont_pango_check();
desc = nsfont_style_to_description(fstyle);
- pango_layout_set_font_description(layout, desc);
+ pango_layout_set_font_description(nsfont_pango_layout, desc);
pango_font_description_free(desc);
- pango_layout_set_text(layout, string, length);
+ pango_layout_set_text(nsfont_pango_layout, string, length);
- line = pango_layout_get_line_readonly(layout, 0);
+ line = pango_layout_get_line_readonly(nsfont_pango_layout, 0);
cairo_move_to(current_cr, x, y);
nsgtk_set_colour(fstyle->foreground);
pango_cairo_show_layout_line(current_cr, line);
- g_object_unref(layout);
-
- return true;
+ return NSERROR_OK;
}
@@ -278,7 +277,7 @@ nsfont_style_to_description(const plot_font_style_t *fstyle)
break;
}
- size = (fstyle->size * PANGO_SCALE) / FONT_SIZE_SCALE;
+ size = (fstyle->size * PANGO_SCALE) / PLOT_STYLE_SCALE;
if (fstyle->flags & FONTF_ITALIC)
style = PANGO_STYLE_ITALIC;
diff --git a/frontends/gtk/layout_pango.h b/frontends/gtk/layout_pango.h
index 137cebe68..7ce107a5d 100644
--- a/frontends/gtk/layout_pango.h
+++ b/frontends/gtk/layout_pango.h
@@ -30,7 +30,7 @@ struct plot_font_style;
extern struct gui_layout_table *nsgtk_layout_table;
-bool nsfont_paint(int x, int y, const char *string, size_t length, const struct plot_font_style *fstyle);
+nserror nsfont_paint(int x, int y, const char *string, size_t length, const struct plot_font_style *fstyle);
/**
* Convert a plot style to a PangoFontDescription.
diff --git a/frontends/gtk/local_history.c b/frontends/gtk/local_history.c
new file mode 100644
index 000000000..35b7a4ad6
--- /dev/null
+++ b/frontends/gtk/local_history.c
@@ -0,0 +1,269 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Implementation of GTK local history manager.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <gtk/gtk.h>
+
+#include "utils/log.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "desktop/local_history.h"
+
+#include "gtk/compat.h"
+#include "gtk/plotters.h"
+#include "gtk/resources.h"
+#include "gtk/corewindow.h"
+#include "gtk/local_history.h"
+
+struct nsgtk_local_history_window {
+ struct nsgtk_corewindow core;
+
+ GtkBuilder *builder;
+
+ GtkWindow *wnd;
+
+ struct local_history_session *session;
+};
+
+static struct nsgtk_local_history_window *local_history_window = NULL;
+
+
+
+/**
+ * callback for mouse action on local history window
+ *
+ * \param nsgtk_cw The nsgtk core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+nsgtk_local_history_mouse(struct nsgtk_corewindow *nsgtk_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ struct nsgtk_local_history_window *lhw;
+ /* technically degenerate container of */
+ lhw = (struct nsgtk_local_history_window *)nsgtk_cw;
+
+ local_history_mouse_action(lhw->session, mouse_state, x, y);
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * callback for keypress on local history window
+ *
+ * \param nsgtk_cw The nsgtk core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+nsgtk_local_history_key(struct nsgtk_corewindow *nsgtk_cw, uint32_t nskey)
+{
+ struct nsgtk_local_history_window *lhw;
+ /* technically degenerate container of */
+ lhw = (struct nsgtk_local_history_window *)nsgtk_cw;
+
+ if (local_history_keypress(lhw->session, nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
+
+/**
+ * callback on draw event for local history window
+ *
+ * \param nsgtk_cw The nsgtk core window structure.
+ * \param r The rectangle of the window that needs updating.
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+nsgtk_local_history_draw(struct nsgtk_corewindow *nsgtk_cw, struct rect *r)
+{
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &nsgtk_plotters
+ };
+ struct nsgtk_local_history_window *lhw;
+
+ /* technically degenerate container of */
+ lhw = (struct nsgtk_local_history_window *)nsgtk_cw;
+
+ ctx.plot->clip(&ctx, r);
+ local_history_redraw(lhw->session, 0, 0, r, &ctx);
+
+ return NSERROR_OK;
+}
+
+/**
+ * Creates the window for the local history view.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+static nserror
+nsgtk_local_history_init(struct browser_window *bw,
+ struct nsgtk_local_history_window **win_out)
+{
+ struct nsgtk_local_history_window *ncwin;
+ nserror res;
+
+ /* memoise window so it can be represented when necessary
+ * instead of recreating every time.
+ */
+ if ((*win_out) != NULL) {
+ res = local_history_set((*win_out)->session, bw);
+ return res;
+ }
+
+ ncwin = calloc(1, sizeof(*ncwin));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ res = nsgtk_builder_new_from_resname("localhistory", &ncwin->builder);
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO, "Local history UI builder init failed");
+ free(ncwin);
+ return res;
+ }
+
+ gtk_builder_connect_signals(ncwin->builder, NULL);
+
+ ncwin->wnd = GTK_WINDOW(gtk_builder_get_object(ncwin->builder,
+ "wndHistory"));
+
+ ncwin->core.scrolled = GTK_SCROLLED_WINDOW(
+ gtk_builder_get_object(ncwin->builder,
+ "HistoryScrolled"));
+
+ ncwin->core.drawing_area = GTK_DRAWING_AREA(
+ gtk_builder_get_object(ncwin->builder,
+ "HistoryDrawingArea"));
+
+ /* make the delete event hide the window */
+ g_signal_connect(G_OBJECT(ncwin->wnd),
+ "delete_event",
+ G_CALLBACK(gtk_widget_hide_on_delete),
+ NULL);
+
+ ncwin->core.draw = nsgtk_local_history_draw;
+ ncwin->core.key = nsgtk_local_history_key;
+ ncwin->core.mouse = nsgtk_local_history_mouse;
+
+ res = nsgtk_corewindow_init(&ncwin->core);
+ if (res != NSERROR_OK) {
+ free(ncwin);
+ return res;
+ }
+
+ res = local_history_init(ncwin->core.cb_table,
+ (struct core_window *)ncwin,
+ bw,
+ &ncwin->session);
+ if (res != NSERROR_OK) {
+ free(ncwin);
+ return res;
+ }
+
+ *win_out = ncwin;
+
+ return NSERROR_OK;
+}
+
+
+/* exported function documented gtk/history.h */
+nserror nsgtk_local_history_present(GtkWindow *parent,
+ struct browser_window *bw)
+{
+ nserror res;
+ int prnt_width, prnt_height;
+ int width, height;
+ res = nsgtk_local_history_init(bw, &local_history_window);
+ if (res == NSERROR_OK) {
+ gtk_window_set_transient_for(local_history_window->wnd, parent);
+
+ gtk_window_get_size(parent, &prnt_width, &prnt_height);
+
+ /* resize history widget ensureing the drawing area is
+ * no larger than parent window
+ */
+ res = local_history_get_size(local_history_window->session,
+ &width,
+ &height);
+ if (width > prnt_width) {
+ width = prnt_width;
+ }
+ if (height > prnt_height) {
+ height = prnt_height;
+ }
+ gtk_window_resize(local_history_window->wnd, width, height);
+
+ gtk_window_present(local_history_window->wnd);
+ }
+
+ return res;
+}
+
+
+/* exported function documented gtk/history.h */
+nserror nsgtk_local_history_hide(void)
+{
+ nserror res = NSERROR_OK;
+
+ if (local_history_window != NULL) {
+ gtk_widget_hide(GTK_WIDGET(local_history_window->wnd));
+
+ res = local_history_set(local_history_window->session, NULL);
+ }
+
+ return res;
+}
+
+
+/* exported function documented gtk/history.h */
+nserror nsgtk_local_history_destroy(void)
+{
+ nserror res;
+
+ if (local_history_window == NULL) {
+ return NSERROR_OK;
+ }
+
+ res = local_history_fini(local_history_window->session);
+ if (res == NSERROR_OK) {
+ res = nsgtk_corewindow_fini(&local_history_window->core);
+ gtk_widget_destroy(GTK_WIDGET(local_history_window->wnd));
+ g_object_unref(G_OBJECT(local_history_window->builder));
+ free(local_history_window);
+ local_history_window = NULL;
+ }
+
+ return res;
+
+}
diff --git a/frontends/gtk/local_history.h b/frontends/gtk/local_history.h
new file mode 100644
index 000000000..605405ddf
--- /dev/null
+++ b/frontends/gtk/local_history.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@kyllikki.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Interface to GTK local history manager
+ */
+
+#ifndef NSGTK_LOCAL_HISTORY_H
+#define NSGTK_LOCAL_HISTORY_H
+
+struct browser_window;
+
+/**
+ * make the local history window visible.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+nserror nsgtk_local_history_present(GtkWindow *parent, struct browser_window *bw);
+
+/**
+ * hide the local history window from being visible.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+nserror nsgtk_local_history_hide(void);
+
+/**
+ * Destroys the local history window and performs any other necessary cleanup
+ * actions.
+ */
+nserror nsgtk_local_history_destroy(void);
+
+#endif
diff --git a/frontends/gtk/login.c b/frontends/gtk/login.c
index 3e29903fe..91d8b37f0 100644
--- a/frontends/gtk/login.c
+++ b/frontends/gtk/login.c
@@ -222,7 +222,7 @@ void gui_401login_open(nsurl *url,
res = create_login_window(url, host, realm, cb, cbpw);
if (res != NSERROR_OK) {
- LOG("Login init failed");
+ NSLOG(netsurf, INFO, "Login init failed");
/* creating login failed so cancel navigation */
cb(false, cbpw);
diff --git a/frontends/gtk/menu.c b/frontends/gtk/menu.c
index a93ef9385..6a6033231 100644
--- a/frontends/gtk/menu.c
+++ b/frontends/gtk/menu.c
@@ -27,6 +27,7 @@
#include "gtk/compat.h"
#include "gtk/menu.h"
#include "gtk/warn.h"
+#include "gtk/accelerator.h"
/**
* Adds image menu item to a menu.
@@ -34,28 +35,37 @@
* \param menu the menu to add the item to
* \param item_out a pointer to the item's location in the menu struct
* \param message the menu item I18n lookup value
- * \param messageAccel the menu item accelerator I18n lookup value
* \param group the 'global' in a gtk sense accelerator group
* \return true if sucessful and \a item_out updated else false.
*/
-static bool nsgtk_menu_add_image_item(GtkMenu *menu,
- GtkWidget **item_out, const char *message,
- const char *messageAccel, GtkAccelGroup *group)
+static bool
+nsgtk_menu_add_image_item(GtkMenu *menu,
+ GtkWidget **item_out,
+ const char *message,
+ GtkAccelGroup *group)
{
unsigned int key;
GdkModifierType mod;
GtkWidget *item;
-
+ const char *accelerator_desc; /* accelerator key description */
+
item = nsgtk_image_menu_item_new_with_mnemonic(messages_get(message));
if (item == NULL) {
return false;
}
-
- gtk_accelerator_parse(messages_get(messageAccel), &key, &mod);
- if (key > 0) {
- gtk_widget_add_accelerator(item, "activate", group, key, mod,
- GTK_ACCEL_VISIBLE);
+
+ accelerator_desc = nsgtk_accelerator_get_desc(message);
+ if (accelerator_desc != NULL) {
+ gtk_accelerator_parse(accelerator_desc, &key, &mod);
+ if (key > 0) {
+ gtk_widget_add_accelerator(item,
+ "activate",
+ group,
+ key,
+ mod,
+ GTK_ACCEL_VISIBLE);
+ }
}
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
gtk_widget_show(item);
@@ -73,8 +83,7 @@ static bool nsgtk_menu_add_image_item(GtkMenu *menu,
n->m##_menu = GTK_MENU(gtk_menu_new())
#define IMAGE_ITEM(p, q, r, s, t)\
- nsgtk_menu_add_image_item(s->p##_menu, &(s->q##_menuitem), #r,\
- #r "Accel", t)
+ nsgtk_menu_add_image_item(s->p##_menu, &(s->q##_menuitem), #r, t)
#define CHECK_ITEM(p, q, r, s)\
s->q##_menuitem = GTK_CHECK_MENU_ITEM(\
@@ -130,8 +139,8 @@ static bool nsgtk_menu_add_image_item(GtkMenu *menu,
* creates an export submenu
* \param group the 'global' in a gtk sense accelerator reference
*/
-
-static struct nsgtk_export_submenu *nsgtk_menu_export_submenu(GtkAccelGroup *group)
+static struct nsgtk_export_submenu *
+nsgtk_menu_export_submenu(GtkAccelGroup *group)
{
struct nsgtk_export_submenu *ret = malloc(sizeof(struct
nsgtk_export_submenu));
@@ -157,8 +166,8 @@ static struct nsgtk_export_submenu *nsgtk_menu_export_submenu(GtkAccelGroup *gro
* \param group the 'global' in a gtk sense accelerator reference
*/
-static struct nsgtk_scaleview_submenu *nsgtk_menu_scaleview_submenu(
- GtkAccelGroup *group)
+static struct nsgtk_scaleview_submenu *
+nsgtk_menu_scaleview_submenu(GtkAccelGroup *group)
{
struct nsgtk_scaleview_submenu *ret =
malloc(sizeof(struct nsgtk_scaleview_submenu));
@@ -185,7 +194,8 @@ static struct nsgtk_scaleview_submenu *nsgtk_menu_scaleview_submenu(
static struct nsgtk_tabs_submenu *nsgtk_menu_tabs_submenu(GtkAccelGroup *group)
{
- struct nsgtk_tabs_submenu *ret = malloc(sizeof(struct nsgtk_tabs_submenu));
+ struct nsgtk_tabs_submenu *ret;
+ ret = malloc(sizeof(struct nsgtk_tabs_submenu));
if (ret == NULL) {
nsgtk_warning(messages_get("NoMemory"), 0);
return NULL;
diff --git a/frontends/gtk/plotters.c b/frontends/gtk/plotters.c
index 817b72808..4a5ef510c 100644
--- a/frontends/gtk/plotters.c
+++ b/frontends/gtk/plotters.c
@@ -39,14 +39,15 @@
#include "gtk/scaffolding.h"
#include "gtk/bitmap.h"
-GtkWidget *current_widget;
cairo_t *current_cr;
static GdkRectangle cliprect;
-struct plotter_table plot;
-
-/** Set cairo context colour to nsgtk colour. */
+/**
+ * Set cairo context colour to nsgtk colour.
+ *
+ * \param c the netsurf colour to set in cairo
+ */
void nsgtk_set_colour(colour c)
{
cairo_set_source_rgba(current_cr,
@@ -56,29 +57,61 @@ void nsgtk_set_colour(colour c)
1.0);
}
-/** Set cairo context to solid plot operation. */
+
+/**
+ * Set cairo context to solid plot operation.
+ */
static inline void nsgtk_set_solid(void)
{
double dashes = 0;
cairo_set_dash(current_cr, &dashes, 0, 0);
}
-/** Set cairo context to dotted plot operation. */
+
+/**
+ * Set cairo context to dotted plot operation.
+ */
static inline void nsgtk_set_dotted(void)
{
double cdashes[] = { 1.0, 2.0 };
cairo_set_dash(current_cr, cdashes, 2, 0);
}
-/** Set cairo context to dashed plot operation. */
+
+/**
+ * Set cairo context to dashed plot operation.
+ */
static inline void nsgtk_set_dashed(void)
{
double cdashes[] = { 8.0, 2.0 };
cairo_set_dash(current_cr, cdashes, 2, 0);
}
-/** Set clipping area for subsequent plot operations. */
-static bool nsgtk_plot_clip(const struct rect *clip)
+
+/**
+ * Set cairo context line width.
+ */
+static inline void nsgtk_set_line_width(plot_style_fixed width)
+{
+ if (width == 0) {
+ cairo_set_line_width(current_cr, 1);
+ } else {
+ cairo_set_line_width(current_cr,
+ plot_style_fixed_to_double(width));
+ }
+}
+
+
+/**
+ * \brief Sets a clip rectangle for subsequent plot operations.
+ *
+ * \param ctx The current redraw context.
+ * \param clip The rectangle to limit all subsequent plot
+ * operations within.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_plot_clip(const struct redraw_context *ctx, const struct rect *clip)
{
cairo_reset_clip(current_cr);
cairo_rectangle(current_cr, clip->x0, clip->y0,
@@ -90,11 +123,30 @@ static bool nsgtk_plot_clip(const struct rect *clip)
cliprect.width = clip->x1 - clip->x0;
cliprect.height = clip->y1 - clip->y0;
- return true;
+ return NSERROR_OK;
}
-static bool nsgtk_plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style)
+/**
+ * Plots an arc
+ *
+ * plot an arc segment around (x,y), anticlockwise from angle1
+ * to angle2. Angles are measured anticlockwise from
+ * horizontal, in degrees.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the arc plot.
+ * \param x The x coordinate of the arc.
+ * \param y The y coordinate of the arc.
+ * \param radius The radius of the arc.
+ * \param angle1 The start angle of the arc.
+ * \param angle2 The finish angle of the arc.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_plot_arc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius, int angle1, int angle2)
{
nsgtk_set_colour(style->fill_colour);
nsgtk_set_solid();
@@ -105,10 +157,26 @@ static bool nsgtk_plot_arc(int x, int y, int radius, int angle1, int angle2, con
(angle2 + 90) * (M_PI / 180));
cairo_stroke(current_cr);
- return true;
+ return NSERROR_OK;
}
-static bool nsgtk_plot_disc(int x, int y, int radius, const plot_style_t *style)
+
+/**
+ * Plots a circle
+ *
+ * Plot a circle centered on (x,y), which is optionally filled.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the circle plot.
+ * \param x x coordinate of circle centre.
+ * \param y y coordinate of circle centre.
+ * \param radius circle radius.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_plot_disc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius)
{
if (style->fill_type != PLOT_OP_TYPE_NONE) {
nsgtk_set_colour(style->fill_colour);
@@ -123,49 +191,60 @@ static bool nsgtk_plot_disc(int x, int y, int radius, const plot_style_t *style)
nsgtk_set_colour(style->stroke_colour);
switch (style->stroke_type) {
- case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ case PLOT_OP_TYPE_SOLID: /* Solid colour */
default:
nsgtk_set_solid();
break;
- case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ case PLOT_OP_TYPE_DOT: /* Doted plot */
nsgtk_set_dotted();
break;
- case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ case PLOT_OP_TYPE_DASH: /* dashed plot */
nsgtk_set_dashed();
break;
}
- if (style->stroke_width == 0)
- cairo_set_line_width(current_cr, 1);
- else
- cairo_set_line_width(current_cr, style->stroke_width);
+ nsgtk_set_line_width(style->stroke_width);
cairo_arc(current_cr, x, y, radius, 0, M_PI * 2);
cairo_stroke(current_cr);
}
- return true;
+ return NSERROR_OK;
}
-static bool
-nsgtk_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
+
+/**
+ * Plots a line
+ *
+ * plot a line from (x0,y0) to (x1,y1). Coordinates are at
+ * centre of line width/thickness.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the line plot.
+ * \param line A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_plot_line(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *line)
{
nsgtk_set_colour(style->stroke_colour);
switch (style->stroke_type) {
- case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ case PLOT_OP_TYPE_SOLID: /* Solid colour */
default:
nsgtk_set_solid();
break;
- case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ case PLOT_OP_TYPE_DOT: /* Doted plot */
nsgtk_set_dotted();
break;
- case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ case PLOT_OP_TYPE_DASH: /* dashed plot */
nsgtk_set_dashed();
break;
}
@@ -174,23 +253,25 @@ nsgtk_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
nsgtk_set_colour(style->stroke_colour);
}
- if (style->stroke_width == 0)
- cairo_set_line_width(current_cr, 1);
- else
- cairo_set_line_width(current_cr, style->stroke_width);
+ nsgtk_set_line_width(style->stroke_width);
/* core expects horizontal and vertical lines to be on pixels, not
- * between pixels */
- cairo_move_to(current_cr, (x0 == x1) ? x0 + 0.5 : x0,
- (y0 == y1) ? y0 + 0.5 : y0);
- cairo_line_to(current_cr, (x0 == x1) ? x1 + 0.5 : x1,
- (y0 == y1) ? y1 + 0.5 : y1);
+ * between pixels
+ */
+ cairo_move_to(current_cr,
+ (line->x0 == line->x1) ? line->x0 + 0.5 : line->x0,
+ (line->y0 == line->y1) ? line->y0 + 0.5 : line->y0);
+ cairo_line_to(current_cr,
+ (line->x0 == line->x1) ? line->x1 + 0.5 : line->x1,
+ (line->y0 == line->y1) ? line->y1 + 0.5 : line->y1);
cairo_stroke(current_cr);
- return true;
+ return NSERROR_OK;
}
-/** Plot a caret.
+
+/**
+ * Plot a caret.
*
* @note It is assumed that the plotters have been set up.
*/
@@ -207,14 +288,35 @@ void nsgtk_plot_caret(int x, int y, int h)
cairo_stroke(current_cr);
}
-static bool nsgtk_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
+
+/**
+ * Plots a rectangle.
+ *
+ * The rectangle can be filled an outline or both controlled
+ * by the plot style The line can be solid, dotted or
+ * dashed. Top left corner at (x0,y0) and rectangle has given
+ * width and height.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the rectangle plot.
+ * \param rect A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_plot_rectangle(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *rect)
{
if (style->fill_type != PLOT_OP_TYPE_NONE) {
nsgtk_set_colour(style->fill_colour);
nsgtk_set_solid();
cairo_set_line_width(current_cr, 0);
- cairo_rectangle(current_cr, x0, y0, x1 - x0, y1 - y0);
+ cairo_rectangle(current_cr,
+ rect->x0,
+ rect->y0,
+ rect->x1 - rect->x0,
+ rect->y1 - rect->y0);
cairo_fill(current_cr);
cairo_stroke(current_cr);
}
@@ -223,32 +325,52 @@ static bool nsgtk_plot_rectangle(int x0, int y0, int x1, int y1, const plot_styl
nsgtk_set_colour(style->stroke_colour);
switch (style->stroke_type) {
- case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ case PLOT_OP_TYPE_SOLID: /* Solid colour */
default:
nsgtk_set_solid();
break;
- case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ case PLOT_OP_TYPE_DOT: /* Doted plot */
nsgtk_set_dotted();
break;
- case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ case PLOT_OP_TYPE_DASH: /* dashed plot */
nsgtk_set_dashed();
break;
}
- if (style->stroke_width == 0)
- cairo_set_line_width(current_cr, 1);
- else
- cairo_set_line_width(current_cr, style->stroke_width);
+ nsgtk_set_line_width(style->stroke_width);
- cairo_rectangle(current_cr, x0 + 0.5, y0 + 0.5, x1 - x0, y1 - y0);
+ cairo_rectangle(current_cr,
+ rect->x0 + 0.5,
+ rect->y0 + 0.5,
+ rect->x1 - rect->x0,
+ rect->y1 - rect->y0);
cairo_stroke(current_cr);
}
- return true;
+ return NSERROR_OK;
}
-static bool nsgtk_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
+
+/**
+ * Plot a polygon
+ *
+ * Plots a filled polygon with straight lines between
+ * points. The lines around the edge of the ploygon are not
+ * plotted. The polygon is filled with the non-zero winding
+ * rule.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the polygon plot.
+ * \param p verticies of polygon
+ * \param n number of verticies.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_plot_polygon(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const int *p,
+ unsigned int n)
{
unsigned int i;
@@ -263,201 +385,46 @@ static bool nsgtk_plot_polygon(const int *p, unsigned int n, const plot_style_t
cairo_fill(current_cr);
cairo_stroke(current_cr);
- return true;
-}
-
-
-
-
-static bool nsgtk_plot_text(int x, int y, const char *text, size_t length,
- const struct plot_font_style *fstyle)
-{
- return nsfont_paint(x, y, text, length, fstyle);
-}
-
-
-
-static bool nsgtk_plot_pixbuf(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg)
-{
- int x0, y0, x1, y1;
- int dsrcx, dsrcy, dwidth, dheight;
- int bmwidth, bmheight;
-
- cairo_surface_t *bmsurface = bitmap->surface;
-
- /* Bail early if we can */
- if (width == 0 || height == 0)
- /* Nothing to plot */
- return true;
- if ((x > (cliprect.x + cliprect.width)) ||
- ((x + width) < cliprect.x) ||
- (y > (cliprect.y + cliprect.height)) ||
- ((y + height) < cliprect.y)) {
- /* Image completely outside clip region */
- return true;
- }
-
- /* Get clip rectangle / image rectangle edge differences */
- x0 = cliprect.x - x;
- y0 = cliprect.y - y;
- x1 = (x + width) - (cliprect.x + cliprect.width);
- y1 = (y + height) - (cliprect.y + cliprect.height);
-
- /* Set initial draw geometry */
- dsrcx = x;
- dsrcy = y;
- dwidth = width;
- dheight = height;
-
- /* Manually clip draw coordinates to area of image to be rendered */
- if (x0 > 0) {
- /* Clip left */
- dsrcx += x0;
- dwidth -= x0;
- }
- if (y0 > 0) {
- /* Clip top */
- dsrcy += y0;
- dheight -= y0;
- }
- if (x1 > 0) {
- /* Clip right */
- dwidth -= x1;
- }
- if (y1 > 0) {
- /* Clip bottom */
- dheight -= y1;
- }
-
- if (dwidth == 0 || dheight == 0)
- /* Nothing to plot */
- return true;
-
- bmwidth = cairo_image_surface_get_width(bmsurface);
- bmheight = cairo_image_surface_get_height(bmsurface);
-
- /* Render the bitmap */
- if ((bmwidth == width) && (bmheight == height)) {
- /* Bitmap is not scaled */
- /* Plot the bitmap */
- cairo_set_source_surface(current_cr, bmsurface, x, y);
- cairo_rectangle(current_cr, dsrcx, dsrcy, dwidth, dheight);
- cairo_fill(current_cr);
-
- } else {
- /* Bitmap is scaled */
- if ((bitmap->scsurface != NULL) &&
- ((cairo_image_surface_get_width(bitmap->scsurface) != width) ||
- (cairo_image_surface_get_height(bitmap->scsurface) != height))){
- cairo_surface_destroy(bitmap->scsurface);
- bitmap->scsurface = NULL;
- }
-
- if (bitmap->scsurface == NULL) {
- bitmap->scsurface = cairo_surface_create_similar(bmsurface,CAIRO_CONTENT_COLOR_ALPHA, width, height);
- cairo_t *cr = cairo_create(bitmap->scsurface);
-
- /* Scale *before* setting the source surface (1) */
- cairo_scale(cr, (double)width / bmwidth, (double)height / bmheight);
- cairo_set_source_surface(cr, bmsurface, 0, 0);
-
- /* To avoid getting the edge pixels blended with 0
- * alpha, which would occur with the default
- * EXTEND_NONE. Use EXTEND_PAD for 1.2 or newer (2)
- */
- cairo_pattern_set_extend(cairo_get_source(cr),
- CAIRO_EXTEND_REFLECT);
-
- /* Replace the destination with the source instead of
- * overlaying
- */
- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
-
- /* Do the actual drawing */
- cairo_paint(cr);
-
- cairo_destroy(cr);
-
- }
- /* Plot the scaled bitmap */
- cairo_set_source_surface(current_cr, bitmap->scsurface, x, y);
- cairo_rectangle(current_cr, dsrcx, dsrcy, dwidth, dheight);
- cairo_fill(current_cr);
-
-
- }
-
- return true;
+ return NSERROR_OK;
}
-static bool nsgtk_plot_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags)
-{
- int doneheight = 0, donewidth = 0;
- bool repeat_x = (flags & BITMAPF_REPEAT_X);
- bool repeat_y = (flags & BITMAPF_REPEAT_Y);
-
- /* Bail early if we can */
- if (width == 0 || height == 0)
- /* Nothing to plot */
- return true;
-
- if (!(repeat_x || repeat_y)) {
- /* Not repeating at all, so just pass it on */
- return nsgtk_plot_pixbuf(x, y, width, height, bitmap, bg);
- }
-
- if (y > cliprect.y) {
- doneheight = (cliprect.y - height) + ((y - cliprect.y) % height);
- } else {
- doneheight = y;
- }
-
- while (doneheight < (cliprect.y + cliprect.height)) {
- if (x > cliprect.x) {
- donewidth = (cliprect.x - width) + ((x - cliprect.x) % width);
- } else {
- donewidth = x;
- }
-
- while (donewidth < (cliprect.x + cliprect.width)) {
- nsgtk_plot_pixbuf(donewidth, doneheight,
- width, height, bitmap, bg);
- donewidth += width;
- if (!repeat_x)
- break;
- }
- doneheight += height;
-
- if (!repeat_y)
- break;
- }
-
- return true;
-}
-static bool nsgtk_plot_path(const float *p, unsigned int n, colour fill, float width,
- colour c, const float transform[6])
+/**
+ * Plots a path.
+ *
+ * Path plot consisting of cubic Bezier curves. Line and fill colour is
+ * controlled by the plot style.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the path plot.
+ * \param p elements of path
+ * \param n nunber of elements on path
+ * \param transform A transform to apply to the path.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_plot_path(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const float *p,
+ unsigned int n,
+ const float transform[6])
{
unsigned int i;
cairo_matrix_t old_ctm, n_ctm;
if (n == 0)
- return true;
+ return NSERROR_OK;
if (p[0] != PLOTTER_PATH_MOVE) {
- LOG("Path does not start with move");
- return false;
+ NSLOG(netsurf, INFO, "Path does not start with move");
+ return NSERROR_INVALID;
}
-
/* Save CTM */
cairo_get_matrix(current_cr, &old_ctm);
/* Set up line style and width */
- cairo_set_line_width(current_cr, 1);
+ nsgtk_set_line_width(pstyle->stroke_width);
nsgtk_set_solid();
/* Load new CTM */
@@ -487,10 +454,10 @@ static bool nsgtk_plot_path(const float *p, unsigned int n, colour fill, float w
p[i+5], p[i+6]);
i += 7;
} else {
- LOG("bad path command %f", p[i]);
+ NSLOG(netsurf, INFO, "bad path command %f", p[i]);
/* Reset matrix for safety */
cairo_set_matrix(current_cr, &old_ctm);
- return false;
+ return NSERROR_INVALID;
}
}
@@ -498,27 +465,184 @@ static bool nsgtk_plot_path(const float *p, unsigned int n, colour fill, float w
cairo_set_matrix(current_cr, &old_ctm);
/* Now draw path */
- if (fill != NS_TRANSPARENT) {
- nsgtk_set_colour(fill);
+ if (pstyle->fill_colour != NS_TRANSPARENT) {
+ nsgtk_set_colour(pstyle->fill_colour);
- if (c != NS_TRANSPARENT) {
+ if (pstyle->stroke_colour != NS_TRANSPARENT) {
/* Fill & Stroke */
cairo_fill_preserve(current_cr);
- nsgtk_set_colour(c);
+ nsgtk_set_colour(pstyle->stroke_colour);
cairo_stroke(current_cr);
} else {
/* Fill only */
cairo_fill(current_cr);
}
- } else if (c != NS_TRANSPARENT) {
+ } else if (pstyle->stroke_colour != NS_TRANSPARENT) {
/* Stroke only */
- nsgtk_set_colour(c);
+ nsgtk_set_colour(pstyle->stroke_colour);
cairo_stroke(current_cr);
}
- return true;
+ return NSERROR_OK;
}
+
+/**
+ * Plot a bitmap
+ *
+ * Tiled plot of a bitmap image. (x,y) gives the top left
+ * coordinate of an explicitly placed tile. From this tile the
+ * image can repeat in all four directions -- up, down, left
+ * and right -- to the extents given by the current clip
+ * rectangle.
+ *
+ * The bitmap_flags say whether to tile in the x and y
+ * directions. If not tiling in x or y directions, the single
+ * image is plotted. The width and height give the dimensions
+ * the image is to be scaled to.
+ *
+ * \param ctx The current redraw context.
+ * \param bitmap The bitmap to plot
+ * \param x The x coordinate to plot the bitmap
+ * \param y The y coordiante to plot the bitmap
+ * \param width The width of area to plot the bitmap into
+ * \param height The height of area to plot the bitmap into
+ * \param bg the background colour to alpha blend into
+ * \param flags the flags controlling the type of plot operation
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_plot_bitmap(const struct redraw_context *ctx,
+ struct bitmap *bitmap,
+ int x, int y,
+ int width,
+ int height,
+ colour bg,
+ bitmap_flags_t flags)
+{
+ bool repeat_x = (flags & BITMAPF_REPEAT_X);
+ bool repeat_y = (flags & BITMAPF_REPEAT_Y);
+ GdkRectangle cliprect_bitmap;
+ cairo_surface_t *img_surface;
+ int img_width, img_height;
+
+ /* Bail early if we can */
+ if (width <= 0 || height <= 0) {
+ /* Nothing to plot */
+ return NSERROR_OK;
+ }
+
+ /* Copy the clip rectangle into bitmap plot clip rectangle */
+ cliprect_bitmap = cliprect;
+
+ /* Constrain bitmap plot rectangle for any lack of tiling */
+ if (!repeat_x) {
+ if (cliprect_bitmap.width > width) {
+ cliprect_bitmap.width = width;
+ }
+ if (cliprect_bitmap.x < x) {
+ cliprect_bitmap.x = x;
+ cliprect_bitmap.width -= x - cliprect_bitmap.x;
+ }
+ }
+ if (!repeat_y) {
+ if (cliprect_bitmap.height > height) {
+ cliprect_bitmap.height = height;
+ }
+ if (cliprect_bitmap.y < y) {
+ cliprect_bitmap.y = y;
+ cliprect_bitmap.height -= y - cliprect_bitmap.y;
+ }
+ }
+
+ /* Bail early if we can */
+ if (cliprect_bitmap.width <= 0 || cliprect_bitmap.height <= 0) {
+ /* Nothing to plot */
+ return NSERROR_OK;
+ }
+
+ /* Get the image's surface and intrinsic dimensions */
+ img_surface = bitmap->surface;
+ img_width = cairo_image_surface_get_width(img_surface);
+ img_height = cairo_image_surface_get_height(img_surface);
+
+ /* Set the source surface */
+ if ((img_width == width) && (img_height == height)) {
+ /* Non-scaled rendering */
+ cairo_set_source_surface(current_cr, img_surface, x, y);
+
+ /* Enable tiling if we're repeating */
+ if (repeat_x || repeat_y) {
+ cairo_pattern_set_extend(
+ cairo_get_source(current_cr),
+ CAIRO_EXTEND_REPEAT);
+ }
+
+ /* Render the bitmap */
+ cairo_rectangle(current_cr,
+ cliprect_bitmap.x,
+ cliprect_bitmap.y,
+ cliprect_bitmap.width,
+ cliprect_bitmap.height);
+ cairo_fill(current_cr);
+ } else {
+ /* Scaled rendering */
+ double scale_x = (double)width / img_width;
+ double scale_y = (double)height / img_height;
+
+ /* Save cairo rendering context state before scaling */
+ cairo_save(current_cr);
+ cairo_scale(current_cr, scale_x, scale_y);
+
+ cairo_set_source_surface(current_cr, img_surface,
+ x / scale_x, y / scale_y);
+
+ /* Enable tiling if we're repeating */
+ if (repeat_x || repeat_y) {
+ cairo_pattern_set_extend(
+ cairo_get_source(current_cr),
+ CAIRO_EXTEND_REPEAT);
+ }
+
+ /* Render the bitmap */
+ cairo_rectangle(current_cr,
+ cliprect_bitmap.x / scale_x,
+ cliprect_bitmap.y / scale_y,
+ cliprect_bitmap.width / scale_x,
+ cliprect_bitmap.height / scale_y);
+ cairo_fill(current_cr);
+
+ /* Restore pre-scaling cairo rendering state */
+ cairo_restore(current_cr);
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Text plotting.
+ *
+ * \param ctx The current redraw context.
+ * \param fstyle plot style for this text
+ * \param x x coordinate
+ * \param y y coordinate
+ * \param text UTF-8 string to plot
+ * \param length length of string, in bytes
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_plot_text(const struct redraw_context *ctx,
+ const struct plot_font_style *fstyle,
+ int x,
+ int y,
+ const char *text,
+ size_t length)
+{
+ return nsfont_paint(x, y, text, length, fstyle);
+}
+
+
/** GTK plotter table */
const struct plotter_table nsgtk_plotters = {
.clip = nsgtk_plot_clip,
@@ -532,6 +656,3 @@ const struct plotter_table nsgtk_plotters = {
.text = nsgtk_plot_text,
.option_knockout = true
};
-
-
-
diff --git a/frontends/gtk/plotters.h b/frontends/gtk/plotters.h
index c88a8da0c..453d5ceb5 100644
--- a/frontends/gtk/plotters.h
+++ b/frontends/gtk/plotters.h
@@ -16,8 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Target independent plotting (GDK / GTK+ interface).
+/**
+ * \file
+ * Target independent plotting GTK+ interface.
*/
#ifndef NETSURF_GTK_PLOTTERS_H
@@ -30,7 +31,6 @@ struct plotter_table;
extern const struct plotter_table nsgtk_plotters;
/* make sure this is NULL if no redraw is in progress */
-extern GtkWidget *current_widget;
extern cairo_t *current_cr;
void nsgtk_set_colour(colour c);
diff --git a/frontends/gtk/preferences.c b/frontends/gtk/preferences.c
index e51e77014..dac4a559d 100644
--- a/frontends/gtk/preferences.c
+++ b/frontends/gtk/preferences.c
@@ -621,7 +621,7 @@ comboboxLanguage_add_from_file(GtkListStore *liststore,
gtk_list_store_clear(liststore);
- LOG("Used %s for languages", file_location);
+ NSLOG(netsurf, INFO, "Used %s for languages", file_location);
while (fgets(buf, sizeof(buf), fp)) {
/* Ignore blank lines */
if (buf[0] == '\0')
@@ -668,7 +668,7 @@ nsgtk_preferences_comboboxLanguage_realize(GtkWidget *widget,
const char *accept_language;
if (priv->content_language == NULL) {
- LOG("content language list store unavailable");
+ NSLOG(netsurf, INFO, "content language list store unavailable");
return;
}
@@ -697,7 +697,7 @@ nsgtk_preferences_comboboxLanguage_realize(GtkWidget *widget,
}
}
if (res != NSERROR_OK) {
- LOG("error populatiung languages combo");
+ NSLOG(netsurf, INFO, "error populatiung languages combo");
}
}
@@ -826,7 +826,7 @@ ENTRY_SIGNALS(entryHomePageURL, homepage_url)
G_MODULE_EXPORT void
nsgtk_preferences_setCurrentPage_clicked(GtkButton *button, struct ppref *priv)
{
- const gchar *url = nsurl_access(browser_window_get_url(priv->bw));
+ const gchar *url = nsurl_access(browser_window_access_url(priv->bw));
if (priv->entryHomePageURL != NULL) {
gtk_entry_set_text(GTK_ENTRY(priv->entryHomePageURL), url);
@@ -989,14 +989,15 @@ GtkWidget* nsgtk_preferences(struct browser_window *bw, GtkWindow *parent)
res = nsgtk_builder_new_from_resname("options", &preferences_builder);
if (res != NSERROR_OK) {
- LOG("Preferences UI builder init failed");
+ NSLOG(netsurf, INFO, "Preferences UI builder init failed");
return NULL;
}
priv->dialog = gtk_builder_get_object(preferences_builder,
"dialogPreferences");
if (priv->dialog == NULL) {
- LOG("Unable to get object for preferences dialog");
+ NSLOG(netsurf, INFO,
+ "Unable to get object for preferences dialog");
/* release builder as were done with it */
g_object_unref(G_OBJECT(preferences_builder));
return NULL;
diff --git a/frontends/gtk/print.c b/frontends/gtk/print.c
index 55dcf6390..c4f1b0f7a 100644
--- a/frontends/gtk/print.c
+++ b/frontends/gtk/print.c
@@ -17,8 +17,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
- /** \file
- * GTK printing (implementation).
+
+/**
+ * \file
+ * GTK printing implementation.
* All the functions and structures necessary for printing( signal handlers,
* plotters, printer) are here.
* Most of the plotters have been copied from the gtk_plotters.c file.
@@ -71,7 +73,7 @@ static inline void nsgtk_print_set_colour(colour c)
-static bool gtk_print_font_paint(int x, int y,
+static nserror gtk_print_font_paint(int x, int y,
const char *string, size_t length,
const plot_font_style_t *fstyle)
{
@@ -81,7 +83,7 @@ static bool gtk_print_font_paint(int x, int y,
PangoLayoutLine *line;
if (length == 0)
- return true;
+ return NSERROR_OK;
desc = nsfont_style_to_description(fstyle);
size = (gint) ((double) pango_font_description_get_size(desc) *
@@ -106,7 +108,7 @@ static bool gtk_print_font_paint(int x, int y,
g_object_unref(layout);
pango_font_description_free(desc);
- return true;
+ return NSERROR_OK;
}
@@ -131,10 +133,32 @@ static inline void nsgtk_print_set_dashed(void)
cairo_set_dash(gtk_print_current_cr, cdashes, 1, 0);
}
-/** Set clipping area for subsequent plot operations. */
-static bool nsgtk_print_plot_clip(const struct rect *clip)
+/** Set cairo context line width. */
+static inline void nsgtk_set_line_width(plot_style_fixed width)
{
- LOG("Clipping. x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", clip->x0, clip->y0, clip->x1, clip->y1);
+ if (width == 0) {
+ cairo_set_line_width(gtk_print_current_cr, 1);
+ } else {
+ cairo_set_line_width(gtk_print_current_cr,
+ plot_style_fixed_to_double(width));
+ }
+}
+
+
+/**
+ * \brief Sets a clip rectangle for subsequent plot operations.
+ *
+ * \param ctx The current redraw context.
+ * \param clip The rectangle to limit all subsequent plot
+ * operations within.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_print_plot_clip(const struct redraw_context *ctx, const struct rect *clip)
+{
+ NSLOG(netsurf, INFO,
+ "Clipping. x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", clip->x0,
+ clip->y0, clip->x1, clip->y1);
/* Normalize cllipping area - to prevent overflows.
* See comment in pdf_plot_fill. */
@@ -153,10 +177,30 @@ static bool nsgtk_print_plot_clip(const struct rect *clip)
cliprect.width = clip_x1 - clip_x0;
cliprect.height = clip_y1 - clip_y0;
- return true;
+ return NSERROR_OK;
}
-static bool nsgtk_print_plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style)
+
+/**
+ * Plots an arc
+ *
+ * plot an arc segment around (x,y), anticlockwise from angle1
+ * to angle2. Angles are measured anticlockwise from
+ * horizontal, in degrees.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the arc plot.
+ * \param x The x coordinate of the arc.
+ * \param y The y coordinate of the arc.
+ * \param radius The radius of the arc.
+ * \param angle1 The start angle of the arc.
+ * \param angle2 The finish angle of the arc.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_print_plot_arc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius, int angle1, int angle2)
{
nsgtk_print_set_colour(style->fill_colour);
nsgtk_print_set_solid();
@@ -167,10 +211,26 @@ static bool nsgtk_print_plot_arc(int x, int y, int radius, int angle1, int angle
(angle2 + 90) * (M_PI / 180));
cairo_stroke(gtk_print_current_cr);
- return true;
+ return NSERROR_OK;
}
-static bool nsgtk_print_plot_disc(int x, int y, int radius, const plot_style_t *style)
+
+/**
+ * Plots a circle
+ *
+ * Plot a circle centered on (x,y), which is optionally filled.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the circle plot.
+ * \param x x coordinate of circle centre.
+ * \param y y coordinate of circle centre.
+ * \param radius circle radius.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_print_plot_disc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius)
{
if (style->fill_type != PLOT_OP_TYPE_NONE) {
nsgtk_print_set_colour(style->fill_colour);
@@ -199,19 +259,31 @@ static bool nsgtk_print_plot_disc(int x, int y, int radius, const plot_style_t *
break;
}
- if (style->stroke_width == 0)
- cairo_set_line_width(gtk_print_current_cr, 1);
- else
- cairo_set_line_width(gtk_print_current_cr, style->stroke_width);
+ nsgtk_set_line_width(style->stroke_width);
cairo_arc(gtk_print_current_cr, x, y, radius, 0, M_PI * 2);
cairo_stroke(gtk_print_current_cr);
}
- return true;
+ return NSERROR_OK;
}
-static bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
+
+/**
+ * Plots a line
+ *
+ * plot a line from (x0,y0) to (x1,y1). Coordinates are at
+ * centre of line width/thickness.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the line plot.
+ * \param line A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_print_plot_line(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *line)
{
nsgtk_print_set_colour(style->stroke_colour);
@@ -230,42 +302,61 @@ static bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, const plot_sty
break;
}
- if (style->stroke_width == 0)
- cairo_set_line_width(gtk_print_current_cr, 1);
- else
- cairo_set_line_width(gtk_print_current_cr, style->stroke_width);
+ nsgtk_set_line_width(style->stroke_width);
- cairo_move_to(gtk_print_current_cr, x0 + 0.5, y0 + 0.5);
- cairo_line_to(gtk_print_current_cr, x1 + 0.5, y1 + 0.5);
+ cairo_move_to(gtk_print_current_cr, line->x0 + 0.5, line->y0 + 0.5);
+ cairo_line_to(gtk_print_current_cr, line->x1 + 0.5, line->y1 + 0.5);
cairo_stroke(gtk_print_current_cr);
- return true;
+ return NSERROR_OK;
}
-static bool nsgtk_print_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
+
+/**
+ * Plots a rectangle.
+ *
+ * The rectangle can be filled an outline or both controlled
+ * by the plot style The line can be solid, dotted or
+ * dashed. Top left corner at (x0,y0) and rectangle has given
+ * width and height.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the rectangle plot.
+ * \param rect A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_print_plot_rectangle(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *rect)
{
- LOG("x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", x0, y0, x1, y1);
+ NSLOG(netsurf, INFO, "x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i",
+ rect->x0, rect->y0, rect->x1, rect->y1);
if (style->fill_type != PLOT_OP_TYPE_NONE) {
+ int x0,y0,x1,y1;
nsgtk_print_set_colour(style->fill_colour);
nsgtk_print_set_solid();
/* Normalize boundaries of the area - to prevent overflows.
* See comment in pdf_plot_fill. */
- x0 = min(max(x0, 0), settings->page_width);
- y0 = min(max(y0, 0), settings->page_height);
- x1 = min(max(x1, 0), settings->page_width);
- y1 = min(max(y1, 0), settings->page_height);
+ x0 = min(max(rect->x0, 0), settings->page_width);
+ y0 = min(max(rect->y0, 0), settings->page_height);
+ x1 = min(max(rect->x1, 0), settings->page_width);
+ y1 = min(max(rect->y1, 0), settings->page_height);
cairo_set_line_width(gtk_print_current_cr, 0);
- cairo_rectangle(gtk_print_current_cr, x0, y0, x1 - x0, y1 - y0);
+ cairo_rectangle(gtk_print_current_cr,
+ x0, y0,
+ x1 - x0, y1 - y0);
cairo_fill(gtk_print_current_cr);
cairo_stroke(gtk_print_current_cr);
}
if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- nsgtk_print_set_colour(style->stroke_colour);
+
+ nsgtk_print_set_colour(style->stroke_colour);
switch (style->stroke_type) {
case PLOT_OP_TYPE_SOLID: /**< Solid colour */
@@ -282,23 +373,28 @@ static bool nsgtk_print_plot_rectangle(int x0, int y0, int x1, int y1, const plo
break;
}
- if (style->stroke_width == 0)
- cairo_set_line_width(gtk_print_current_cr, 1);
- else
- cairo_set_line_width(gtk_print_current_cr, style->stroke_width);
+ nsgtk_set_line_width(style->stroke_width);
+
+ cairo_rectangle(gtk_print_current_cr,
+ rect->x0, rect->y0,
+ rect->x1 - rect->x0, rect->y1 - rect->y0);
- cairo_rectangle(gtk_print_current_cr, x0, y0, x1 - x0, y1 - y0);
cairo_stroke(gtk_print_current_cr);
}
- return true;
+ return NSERROR_OK;
}
-static bool nsgtk_print_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
+
+static nserror
+nsgtk_print_plot_polygon(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const int *p,
+ unsigned int n)
{
unsigned int i;
- LOG("Plotting polygon.");
+ NSLOG(netsurf, INFO, "Plotting polygon.");
nsgtk_print_set_colour(style->fill_colour);
nsgtk_print_set_solid();
@@ -306,28 +402,46 @@ static bool nsgtk_print_plot_polygon(const int *p, unsigned int n, const plot_st
cairo_set_line_width(gtk_print_current_cr, 0);
cairo_move_to(gtk_print_current_cr, p[0], p[1]);
- LOG("Starting line at: %i\t%i", p[0], p[1]);
+ NSLOG(netsurf, INFO, "Starting line at: %i\t%i", p[0], p[1]);
for (i = 1; i != n; i++) {
cairo_line_to(gtk_print_current_cr, p[i * 2], p[i * 2 + 1]);
- LOG("Drawing line to: %i\t%i", p[i * 2], p[i * 2 + 1]);
+ NSLOG(netsurf, INFO, "Drawing line to: %i\t%i", p[i * 2],
+ p[i * 2 + 1]);
}
cairo_fill(gtk_print_current_cr);
cairo_stroke(gtk_print_current_cr);
- return true;
+ return NSERROR_OK;
}
-static bool nsgtk_print_plot_path(const float *p, unsigned int n, colour fill,
- float width, colour c, const float transform[6])
+/**
+ * Plots a path.
+ *
+ * Path plot consisting of cubic Bezier curves. Line and fill colour is
+ * controlled by the plot style.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the path plot.
+ * \param p elements of path
+ * \param n nunber of elements on path
+ * \param transform A transform to apply to the path.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_print_plot_path(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const float *p,
+ unsigned int n,
+ const float transform[6])
{
/* Only the internal SVG renderer uses this plot call currently,
* and the GTK version uses librsvg. Thus, we ignore this complexity,
* and just return true obliviously. */
- return true;
+ return NSERROR_OK;
}
@@ -445,9 +559,37 @@ static bool nsgtk_print_plot_pixbuf(int x, int y, int width, int height,
}
-static bool nsgtk_print_plot_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags)
+/**
+ * Plot a bitmap
+ *
+ * Tiled plot of a bitmap image. (x,y) gives the top left
+ * coordinate of an explicitly placed tile. From this tile the
+ * image can repeat in all four directions -- up, down, left
+ * and right -- to the extents given by the current clip
+ * rectangle.
+ *
+ * The bitmap_flags say whether to tile in the x and y
+ * directions. If not tiling in x or y directions, the single
+ * image is plotted. The width and height give the dimensions
+ * the image is to be scaled to.
+ *
+ * \param ctx The current redraw context.
+ * \param bitmap The bitmap to plot
+ * \param x The x coordinate to plot the bitmap
+ * \param y The y coordiante to plot the bitmap
+ * \param width The width of area to plot the bitmap into
+ * \param height The height of area to plot the bitmap into
+ * \param bg the background colour to alpha blend into
+ * \param flags the flags controlling the type of plot operation
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+nsgtk_print_plot_bitmap(const struct redraw_context *ctx,
+ struct bitmap *bitmap,
+ int x, int y,
+ int width, int height,
+ colour bg,
+ bitmap_flags_t flags)
{
int doneheight = 0, donewidth = 0;
bool repeat_x = (flags & BITMAPF_REPEAT_X);
@@ -495,12 +637,19 @@ static bool nsgtk_print_plot_bitmap(int x, int y, int width, int height,
return true;
}
-static bool nsgtk_print_plot_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle)
+
+static nserror
+nsgtk_print_plot_text(const struct redraw_context *ctx,
+ const struct plot_font_style *fstyle,
+ int x,
+ int y,
+ const char *text,
+ size_t length)
{
return gtk_print_font_paint(x, y, text, length, fstyle);
}
+
/** GTK print plotter table */
static const struct plotter_table nsgtk_print_plotters = {
.clip = nsgtk_print_plot_clip,
@@ -549,7 +698,7 @@ void gtk_print_signal_begin_print (GtkPrintOperation *operation,
int page_number;
double height_on_page, height_to_print;
- LOG("Begin print");
+ NSLOG(netsurf, INFO, "Begin print");
settings = user_data;
@@ -568,7 +717,11 @@ void gtk_print_signal_begin_print (GtkPrintOperation *operation,
} else {
- LOG("page_width: %f ;page_height: %f; content height: %lf", settings->page_width, settings->page_height, height_to_print);
+ NSLOG(netsurf, INFO,
+ "page_width: %f ;page_height: %f; content height: %lf",
+ settings->page_width,
+ settings->page_height,
+ height_to_print);
height_on_page = settings->page_height;
height_on_page = height_on_page -
@@ -592,7 +745,7 @@ void gtk_print_signal_begin_print (GtkPrintOperation *operation,
void gtk_print_signal_draw_page(GtkPrintOperation *operation,
GtkPrintContext *context, gint page_nr, gpointer user_data)
{
- LOG("Draw Page");
+ NSLOG(netsurf, INFO, "Draw Page");
gtk_print_current_cr = gtk_print_context_get_cairo_context(context);
print_draw_next_page(&gtk_printer, settings);
}
@@ -604,7 +757,7 @@ void gtk_print_signal_draw_page(GtkPrintOperation *operation,
void gtk_print_signal_end_print(GtkPrintOperation *operation,
GtkPrintContext *context, gpointer user_data)
{
- LOG("End print");
+ NSLOG(netsurf, INFO, "End print");
print_cleanup(content_to_print, &gtk_printer, user_data);
}
diff --git a/frontends/gtk/res/accelerators b/frontends/gtk/res/accelerators
new file mode 100644
index 000000000..2da229aff
--- /dev/null
+++ b/frontends/gtk/res/accelerators
@@ -0,0 +1,40 @@
+# GTK accelerator keys for menu entries
+# The keys must match those in the menus to be applied
+#
+# These are passed to gtk_accelerator_parse and must not be translated
+# The key names are the same as those in the gdk/gdkkeysyms.h header file
+# but without the leading “GDK_KEY_â€.
+
+gtkNextTab:<Control>Page_Down
+gtkPrevTab:<Control>Page_Up
+gtkCloseTab:<Control>w
+gtkNewTab:<Control>t
+gtkNewWindow:<Control>n
+gtkOpenFile:<Control>o
+gtkCloseWindow:<Control><shift>w
+gtkSavePage:<Control>s
+gtkPrintPreview:<Control><shift>p
+gtkPrint:<Control>p
+gtkQuitMenu:<Control>q
+gtkCut:<Control>x
+gtkCopy:<Control>c
+gtkPaste:<Control>v
+gtkSelectAll:<Control>a
+gtkFind:<Control>f
+gtkStop:Escape
+gtkReload:F5
+gtkZoomPlus:<Control>plus
+gtkZoomMinus:<Control>minus
+gtkZoomNormal:<Control>0
+gtkFullScreen:F11
+gtkPageSource:<Control>U
+gtkDownloads:<Control>j
+gtkBack:<alt>Left
+gtkForward:<alt>Right
+gtkHome:<alt>Down
+gtkLocalHistory:<Control>h
+gtkGlobalHistory:<Control><shift>h
+gtkAddBookMarks:<Control>d
+gtkShowBookMarks:F6
+gtkShowCookies:F9
+gtkOpenLocation:<Control>l
diff --git a/frontends/gtk/res/adblock.css b/frontends/gtk/res/adblock.css
index ff2485622..0d12aaa7c 120000
--- a/frontends/gtk/res/adblock.css
+++ b/frontends/gtk/res/adblock.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/AdBlock,f79 \ No newline at end of file
+../../../resources/adblock.css \ No newline at end of file
diff --git a/frontends/gtk/res/ca-bundle.txt b/frontends/gtk/res/ca-bundle.txt
index 0b0e416ad..1187fa51a 120000
--- a/frontends/gtk/res/ca-bundle.txt
+++ b/frontends/gtk/res/ca-bundle.txt
@@ -1 +1 @@
-../../../!NetSurf/Resources/ca-bundle \ No newline at end of file
+../../../resources/ca-bundle \ No newline at end of file
diff --git a/frontends/gtk/res/de/welcome.html b/frontends/gtk/res/de/welcome.html
index 98a53b215..b77e23743 120000
--- a/frontends/gtk/res/de/welcome.html
+++ b/frontends/gtk/res/de/welcome.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/de/welcome.html,faf \ No newline at end of file
+../../../../resources/de/welcome.html \ No newline at end of file
diff --git a/frontends/gtk/res/default.css b/frontends/gtk/res/default.css
index a8579eb7c..fa3ae6c26 120000
--- a/frontends/gtk/res/default.css
+++ b/frontends/gtk/res/default.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/CSS,f79 \ No newline at end of file
+../../../resources/default.css \ No newline at end of file
diff --git a/frontends/gtk/res/en/credits.html b/frontends/gtk/res/en/credits.html
index 252516fd7..f73ecd4aa 120000
--- a/frontends/gtk/res/en/credits.html
+++ b/frontends/gtk/res/en/credits.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/en/credits.html,faf \ No newline at end of file
+../../../../resources/en/credits.html \ No newline at end of file
diff --git a/frontends/gtk/res/en/licence.html b/frontends/gtk/res/en/licence.html
index 79f73669b..0c3b430b7 120000
--- a/frontends/gtk/res/en/licence.html
+++ b/frontends/gtk/res/en/licence.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/en/licence.html,faf \ No newline at end of file
+../../../../resources/en/licence.html \ No newline at end of file
diff --git a/frontends/gtk/res/en/maps.html b/frontends/gtk/res/en/maps.html
index bb3ffcbe7..507a4b248 120000
--- a/frontends/gtk/res/en/maps.html
+++ b/frontends/gtk/res/en/maps.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/en/maps.html,faf \ No newline at end of file
+../../../../resources/en/maps.html \ No newline at end of file
diff --git a/frontends/gtk/res/en/welcome.html b/frontends/gtk/res/en/welcome.html
index 601099223..543f31ddd 120000
--- a/frontends/gtk/res/en/welcome.html
+++ b/frontends/gtk/res/en/welcome.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/en/welcome.html,faf \ No newline at end of file
+../../../../resources/en/welcome.html \ No newline at end of file
diff --git a/frontends/gtk/res/history.gtk2.ui b/frontends/gtk/res/globalhistory.gtk2.ui
index 2b89ecb4b..2b89ecb4b 100644
--- a/frontends/gtk/res/history.gtk2.ui
+++ b/frontends/gtk/res/globalhistory.gtk2.ui
diff --git a/frontends/gtk/res/history.gtk3.ui b/frontends/gtk/res/globalhistory.gtk3.ui
index 7fa598f1e..7fa598f1e 100644
--- a/frontends/gtk/res/history.gtk3.ui
+++ b/frontends/gtk/res/globalhistory.gtk3.ui
diff --git a/frontends/gtk/res/icons b/frontends/gtk/res/icons
index 187efd6f9..94d2dc0df 120000
--- a/frontends/gtk/res/icons
+++ b/frontends/gtk/res/icons
@@ -1 +1 @@
-../../../!NetSurf/Resources/Icons/ \ No newline at end of file
+../../../resources/icons \ No newline at end of file
diff --git a/frontends/gtk/res/internal.css b/frontends/gtk/res/internal.css
index 17f9f1504..5583a9811 120000
--- a/frontends/gtk/res/internal.css
+++ b/frontends/gtk/res/internal.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/internal.css,f79 \ No newline at end of file
+../../../resources/internal.css \ No newline at end of file
diff --git a/frontends/gtk/res/it/credits.html b/frontends/gtk/res/it/credits.html
index 64b78982e..2b7c99542 120000
--- a/frontends/gtk/res/it/credits.html
+++ b/frontends/gtk/res/it/credits.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/it/credits.html,faf \ No newline at end of file
+../../../../resources/it/credits.html \ No newline at end of file
diff --git a/frontends/gtk/res/it/licence.html b/frontends/gtk/res/it/licence.html
index 4abc825d3..92afce85b 120000
--- a/frontends/gtk/res/it/licence.html
+++ b/frontends/gtk/res/it/licence.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/it/licence.html,faf \ No newline at end of file
+../../../../resources/it/licence.html \ No newline at end of file
diff --git a/frontends/gtk/res/it/welcome.html b/frontends/gtk/res/it/welcome.html
index 59cef0551..2673ba948 120000
--- a/frontends/gtk/res/it/welcome.html
+++ b/frontends/gtk/res/it/welcome.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/it/welcome.html,faf \ No newline at end of file
+../../../../resources/it/welcome.html \ No newline at end of file
diff --git a/frontends/gtk/res/ja/welcome.html b/frontends/gtk/res/ja/welcome.html
index a2556ee4e..8b603f3df 120000
--- a/frontends/gtk/res/ja/welcome.html
+++ b/frontends/gtk/res/ja/welcome.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/ja/welcome.html,faf \ No newline at end of file
+../../../../resources/ja/welcome.html \ No newline at end of file
diff --git a/frontends/gtk/res/localhistory.gtk2.ui b/frontends/gtk/res/localhistory.gtk2.ui
new file mode 100644
index 000000000..9512b6289
--- /dev/null
+++ b/frontends/gtk/res/localhistory.gtk2.ui
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkWindow" id="wndHistory">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">NetSurf Local History</property>
+ <property name="window_position">center</property>
+ <property name="default_width">20</property>
+ <property name="default_height">20</property>
+ <property name="type_hint">utility</property>
+ <property name="decorated">False</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkScrolledWindow" id="HistoryScrolled">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkViewport" id="HistoryViewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="resize_mode">queue</property>
+ <child>
+ <object class="GtkDrawingArea" id="HistoryDrawingArea">
+ <property name="visible">True</property>
+ <property name="app_paintable">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/frontends/gtk/res/localhistory.gtk3.ui b/frontends/gtk/res/localhistory.gtk3.ui
new file mode 100644
index 000000000..1a4b9004d
--- /dev/null
+++ b/frontends/gtk/res/localhistory.gtk3.ui
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkWindow" id="wndHistory">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">NetSurf Local History</property>
+ <property name="window_position">center</property>
+ <property name="default_width">20</property>
+ <property name="default_height">20</property>
+ <property name="type_hint">utility</property>
+ <property name="decorated">False</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow" id="HistoryScrolled">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport" id="HistoryViewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkDrawingArea" id="HistoryDrawingArea">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/frontends/gtk/res/netsurf.gresource.xml b/frontends/gtk/res/netsurf.gresource.xml
index c7626b053..e8243254a 100644
--- a/frontends/gtk/res/netsurf.gresource.xml
+++ b/frontends/gtk/res/netsurf.gresource.xml
@@ -2,30 +2,32 @@
<gresources>
<gresource prefix="/org/netsurf">
<file>cookies.gtk2.ui</file>
- <file>history.gtk3.ui</file>
- <file>netsurf.gtk2.ui</file>
- <file>password.gtk3.ui</file>
- <file>toolbar.gtk2.ui</file>
+ <file>globalhistory.gtk3.ui</file>
+ <file>localhistory.gtk3.ui</file>
+ <file>netsurf.gtk2.ui</file>
+ <file>password.gtk3.ui</file>
+ <file>toolbar.gtk2.ui</file>
<file>warning.gtk3.ui</file>
- <file>cookies.gtk3.ui</file>
- <file>hotlist.gtk2.ui</file>
- <file>netsurf.gtk3.ui</file>
- <file>ssl.gtk2.ui</file>
+ <file>cookies.gtk3.ui</file>
+ <file>hotlist.gtk2.ui</file>
+ <file>netsurf.gtk3.ui</file>
+ <file>ssl.gtk2.ui</file>
<file>toolbar.gtk3.ui</file>
- <file>downloads.gtk2.ui</file>
- <file>hotlist.gtk3.ui</file>
- <file>options.gtk2.ui</file>
- <file>ssl.gtk3.ui</file>
+ <file>downloads.gtk2.ui</file>
+ <file>hotlist.gtk3.ui</file>
+ <file>options.gtk2.ui</file>
+ <file>ssl.gtk3.ui</file>
<file>viewdata.gtk2.ui</file>
- <file>downloads.gtk3.ui</file>
- <file>login.gtk2.ui</file>
- <file>options.gtk3.ui</file>
- <file>tabcontents.gtk2.ui</file>
+ <file>downloads.gtk3.ui</file>
+ <file>login.gtk2.ui</file>
+ <file>options.gtk3.ui</file>
+ <file>tabcontents.gtk2.ui</file>
<file>viewdata.gtk3.ui</file>
- <file>history.gtk2.ui</file>
- <file>login.gtk3.ui</file>
- <file>password.gtk2.ui</file>
- <file>tabcontents.gtk3.ui</file>
+ <file>localhistory.gtk2.ui</file>
+ <file>globalhistory.gtk2.ui</file>
+ <file>login.gtk3.ui</file>
+ <file>password.gtk2.ui</file>
+ <file>tabcontents.gtk3.ui</file>
<file>warning.gtk2.ui</file>
<file preprocess="to-pixdata">favicon.png</file>
<file preprocess="to-pixdata">netsurf.xpm</file>
@@ -66,5 +68,6 @@
<file>icons/hotlist-rmv.png</file>
<file>icons/search.png</file>
<file>languages</file>
+ <file>accelerators</file>
</gresource>
</gresources>
diff --git a/frontends/gtk/res/netsurf.png b/frontends/gtk/res/netsurf.png
index 905512c25..d0ab72a5e 120000
--- a/frontends/gtk/res/netsurf.png
+++ b/frontends/gtk/res/netsurf.png
@@ -1 +1 @@
-../../../!NetSurf/Resources/netsurf.png,b60 \ No newline at end of file
+../../../resources/netsurf.png \ No newline at end of file
diff --git a/frontends/gtk/res/nl/credits.html b/frontends/gtk/res/nl/credits.html
index 9c983987a..71b27e40a 120000
--- a/frontends/gtk/res/nl/credits.html
+++ b/frontends/gtk/res/nl/credits.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/nl/credits.html,faf \ No newline at end of file
+../../../../resources/nl/credits.html \ No newline at end of file
diff --git a/frontends/gtk/res/nl/licence.html b/frontends/gtk/res/nl/licence.html
index 8a10d2073..5aaf1cb44 120000
--- a/frontends/gtk/res/nl/licence.html
+++ b/frontends/gtk/res/nl/licence.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/nl/licence.html,faf \ No newline at end of file
+../../../../resources/nl/licence.html \ No newline at end of file
diff --git a/frontends/gtk/res/nl/welcome.html b/frontends/gtk/res/nl/welcome.html
index 6b2ba7742..ef7a97cc9 120000
--- a/frontends/gtk/res/nl/welcome.html
+++ b/frontends/gtk/res/nl/welcome.html
@@ -1 +1 @@
-../../../../!NetSurf/Resources/nl/welcome.html,faf \ No newline at end of file
+../../../../resources/nl/welcome.html \ No newline at end of file
diff --git a/frontends/gtk/res/options.gtk2.ui b/frontends/gtk/res/options.gtk2.ui
index d5542ba5d..a1162585d 100644
--- a/frontends/gtk/res/options.gtk2.ui
+++ b/frontends/gtk/res/options.gtk2.ui
@@ -2,6 +2,297 @@
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
+ <object class="GtkAdjustment" id="adjustment_animation_time">
+ <property name="lower">0.10000000000000001</property>
+ <property name="upper">10</property>
+ <property name="value">0.10000000000000001</property>
+ <property name="step_increment">0.10000000000000001</property>
+ <property name="page_increment">1</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_cache_disc_size">
+ <property name="upper">4096</property>
+ <property name="value">1024</property>
+ <property name="step_increment">32</property>
+ <property name="page_increment">256</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_cache_memory_size">
+ <property name="upper">2048</property>
+ <property name="value">16</property>
+ <property name="step_increment">4</property>
+ <property name="page_increment">16</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_disc_cache_age">
+ <property name="upper">999</property>
+ <property name="value">28</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_fetching_cached">
+ <property name="upper">100</property>
+ <property name="value">1</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_fetching_max">
+ <property name="lower">1</property>
+ <property name="upper">100</property>
+ <property name="value">10</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_fetching_perhost">
+ <property name="lower">1</property>
+ <property name="upper">100</property>
+ <property name="value">1</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_font_default_size">
+ <property name="lower">1</property>
+ <property name="upper">99.900000000000006</property>
+ <property name="value">16</property>
+ <property name="step_increment">0.10000000000000001</property>
+ <property name="page_increment">2</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_history_age">
+ <property name="upper">999</property>
+ <property name="value">28</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">28</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_pdf_lmargin">
+ <property name="upper">999</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_pdf_scale">
+ <property name="lower">1</property>
+ <property name="upper">1000</property>
+ <property name="value">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_proxy_port">
+ <property name="lower">1</property>
+ <property name="upper">65535</property>
+ <property name="value">3128</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xpad">3</property>
+ <property name="stock">gtk-apply</property>
+ </object>
+ <object class="GtkListStore" id="liststore_content_language">
+ <columns>
+ <!-- column-name Code -->
+ <column type="gchararray"/>
+ <!-- column-name Description -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">en</col>
+ <col id="1" translatable="yes">English</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="liststore_defaultfont">
+ <columns>
+ <!-- column-name Type -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">preferencesFonttypeSans</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesFonttypeSerif</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesFonttypeMonospace</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesFonttypeCursive</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesFonttypeFantasy</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="liststore_developer_view">
+ <columns>
+ <!-- column-name Type -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">preferencesDeveloperViewWindow</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesDeveloperViewTab</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesDeveloperViewEditor</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="liststore_image_loading">
+ <columns>
+ <!-- column-name Type -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">preferencesImageLoadBoth</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesImageLoadFore</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesImageLoadBack</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesImageLoadNone</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="liststore_proxy_type">
+ <columns>
+ <!-- column-name Type -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">preferencesProxyTypeDirect</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesProxyTypeManual</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesProxyTypeBasic</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesProxyTypeNLTM</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesProxyTypeSystem</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="liststore_search_provider">
+ <columns>
+ <!-- column-name Provider -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0">Google</col>
+ </row>
+ <row>
+ <col id="0">Yahoo!</col>
+ </row>
+ <row>
+ <col id="0">Microsoft Live</col>
+ </row>
+ <row>
+ <col id="0">Buisiness.com</col>
+ </row>
+ <row>
+ <col id="0">Omgili</col>
+ </row>
+ <row>
+ <col id="0">BBC News</col>
+ </row>
+ <row>
+ <col id="0">Ubuntu Packages</col>
+ </row>
+ <row>
+ <col id="0">Creative Commons</col>
+ </row>
+ <row>
+ <col id="0">Ask</col>
+ </row>
+ <row>
+ <col id="0">Answers</col>
+ </row>
+ <row>
+ <col id="0">Dictionary.com</col>
+ </row>
+ <row>
+ <col id="0">YouTube</col>
+ </row>
+ <row>
+ <col id="0">AeroMP3</col>
+ </row>
+ <row>
+ <col id="0">AOL</col>
+ </row>
+ <row>
+ <col id="0">Baidu</col>
+ </row>
+ <row>
+ <col id="0">Amazon</col>
+ </row>
+ <row>
+ <col id="0">Ebay</col>
+ </row>
+ <row>
+ <col id="0">IMBD</col>
+ </row>
+ <row>
+ <col id="0">ESPN</col>
+ </row>
+ <row>
+ <col id="0">Wikipedia</col>
+ </row>
+ <row>
+ <col id="0">DuckDuckGo</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="liststore_tab_position">
+ <columns>
+ <!-- column-name Position -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">preferencesTabLocTop</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesTabLocLeft</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesTabLocRight</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesTabLocBottom</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="liststore_toolbar_buttontype">
+ <columns>
+ <!-- column-name Type -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">preferencesButtonTypeSmall</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesButtonTypeLarge</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesButtonTypeLargeText</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">preferencesButtonTypeText</col>
+ </row>
+ </data>
+ </object>
<object class="GtkDialog" id="dialogPreferences">
<property name="can_focus">False</property>
<property name="border_width">5</property>
@@ -2178,7 +2469,6 @@
</child>
<child>
<object class="GtkVBox" id="vbox_pdfexport">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
@@ -2583,6 +2873,12 @@
<property name="x_options">GTK_EXPAND</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">True</property>
@@ -2710,295 +3006,4 @@
<action-widget response="-7">close</action-widget>
</action-widgets>
</object>
- <object class="GtkListStore" id="liststore_search_provider">
- <columns>
- <!-- column-name Provider -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0">Google</col>
- </row>
- <row>
- <col id="0">Yahoo!</col>
- </row>
- <row>
- <col id="0">Microsoft Live</col>
- </row>
- <row>
- <col id="0">Buisiness.com</col>
- </row>
- <row>
- <col id="0">Omgili</col>
- </row>
- <row>
- <col id="0">BBC News</col>
- </row>
- <row>
- <col id="0">Ubuntu Packages</col>
- </row>
- <row>
- <col id="0">Creative Commons</col>
- </row>
- <row>
- <col id="0">Ask</col>
- </row>
- <row>
- <col id="0">Answers</col>
- </row>
- <row>
- <col id="0">Dictionary.com</col>
- </row>
- <row>
- <col id="0">YouTube</col>
- </row>
- <row>
- <col id="0">AeroMP3</col>
- </row>
- <row>
- <col id="0">AOL</col>
- </row>
- <row>
- <col id="0">Baidu</col>
- </row>
- <row>
- <col id="0">Amazon</col>
- </row>
- <row>
- <col id="0">Ebay</col>
- </row>
- <row>
- <col id="0">IMBD</col>
- </row>
- <row>
- <col id="0">ESPN</col>
- </row>
- <row>
- <col id="0">Wikipedia</col>
- </row>
- <row>
- <col id="0">DuckDuckGo</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="liststore_tab_position">
- <columns>
- <!-- column-name Position -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">preferencesTabLocTop</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesTabLocLeft</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesTabLocRight</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesTabLocBottom</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="liststore_toolbar_buttontype">
- <columns>
- <!-- column-name Type -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">preferencesButtonTypeSmall</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesButtonTypeLarge</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesButtonTypeLargeText</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesButtonTypeText</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="liststore_image_loading">
- <columns>
- <!-- column-name Type -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">preferencesImageLoadBoth</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesImageLoadFore</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesImageLoadBack</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesImageLoadNone</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="liststore_defaultfont">
- <columns>
- <!-- column-name Type -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">preferencesFonttypeSans</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesFonttypeSerif</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesFonttypeMonospace</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesFonttypeCursive</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesFonttypeFantasy</col>
- </row>
- </data>
- </object>
- <object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xpad">3</property>
- <property name="stock">gtk-apply</property>
- </object>
- <object class="GtkListStore" id="liststore_proxy_type">
- <columns>
- <!-- column-name Type -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">preferencesProxyTypeDirect</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesProxyTypeManual</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesProxyTypeBasic</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesProxyTypeNLTM</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesProxyTypeSystem</col>
- </row>
- </data>
- </object>
- <object class="GtkAdjustment" id="adjustment_animation_time">
- <property name="value">0.10000000000000001</property>
- <property name="lower">0.10000000000000001</property>
- <property name="upper">10</property>
- <property name="step_increment">0.10000000000000001</property>
- <property name="page_increment">1</property>
- </object>
- <object class="GtkAdjustment" id="adjustment_font_default_size">
- <property name="value">16</property>
- <property name="lower">1</property>
- <property name="upper">99.900000000000006</property>
- <property name="step_increment">0.10000000000000001</property>
- <property name="page_increment">2</property>
- </object>
- <object class="GtkAdjustment" id="adjustment_history_age">
- <property name="value">28</property>
- <property name="upper">999</property>
- <property name="step_increment">1</property>
- <property name="page_increment">28</property>
- </object>
- <object class="GtkAdjustment" id="adjustment_cache_memory_size">
- <property name="value">16</property>
- <property name="upper">2048</property>
- <property name="step_increment">4</property>
- <property name="page_increment">16</property>
- </object>
- <object class="GtkAdjustment" id="adjustment_cache_disc_size">
- <property name="value">1024</property>
- <property name="upper">4096</property>
- <property name="step_increment">32</property>
- <property name="page_increment">256</property>
- </object>
- <object class="GtkAdjustment" id="adjustment_disc_cache_age">
- <property name="value">28</property>
- <property name="upper">999</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustment_proxy_port">
- <property name="value">3128</property>
- <property name="lower">1</property>
- <property name="upper">65535</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustment_fetching_max">
- <property name="value">10</property>
- <property name="lower">1</property>
- <property name="upper">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustment_fetching_perhost">
- <property name="value">1</property>
- <property name="lower">1</property>
- <property name="upper">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustment_fetching_cached">
- <property name="value">1</property>
- <property name="upper">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustment_pdf_scale">
- <property name="value">100</property>
- <property name="lower">1</property>
- <property name="upper">1000</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustment_pdf_lmargin">
- <property name="upper">999</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkListStore" id="liststore_content_language">
- <columns>
- <!-- column-name Code -->
- <column type="gchararray"/>
- <!-- column-name Description -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">en</col>
- <col id="1" translatable="yes">English</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="liststore_developer_view">
- <columns>
- <!-- column-name Type -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">preferencesDeveloperViewWindow</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesDeveloperViewTab</col>
- </row>
- <row>
- <col id="0" translatable="yes">preferencesDeveloperViewEditor</col>
- </row>
- </data>
- </object>
</interface>
diff --git a/frontends/gtk/res/quirks.css b/frontends/gtk/res/quirks.css
index 88aabe48c..1e752cb9e 120000
--- a/frontends/gtk/res/quirks.css
+++ b/frontends/gtk/res/quirks.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/Quirks,f79 \ No newline at end of file
+../../../resources/quirks.css \ No newline at end of file
diff --git a/frontends/gtk/res/toolbar.gtk2.ui b/frontends/gtk/res/toolbar.gtk2.ui
index d84db5c8c..4e8805a6f 100644
--- a/frontends/gtk/res/toolbar.gtk2.ui
+++ b/frontends/gtk/res/toolbar.gtk2.ui
@@ -1,67 +1,84 @@
-<?xml version="1.0"?>
-<!--*- mode: xml -*-->
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <object class="GtkWindow" id="toolbarwindow">
+ <!-- interface-requires gtk+ 2.12 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkDialog" id="dialogToolbar">
<property name="width_request">700</property>
<property name="height_request">450</property>
- <property name="title" translatable="yes"/>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
- <child>
- <object class="GtkVBox" id="windowvbox">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">gtkToolBarTitle</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
<child>
- <object class="GtkLabel" id="toolbarlabel">
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
- <property name="label" translatable="yes">Move items from store to toolbar Rearrange items in toolbar Move items from toolbar to store</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
+ <property name="can_focus">False</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Move items from store to toolbar</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Rearrange items in toolbar</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Move items from toolbar to store</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
+ <property name="padding">2</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+ <property name="can_focus">False</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkVBox" id="widgetvbox">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="can_focus">False</property>
<child>
<placeholder/>
</child>
@@ -71,119 +88,85 @@
</child>
</object>
<packing>
- <property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkHBox" id="buttonhbox">
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="resetbutton">
+ <object class="GtkButton" id="reset">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
+ <property name="receives_default">False</property>
<child>
<object class="GtkHBox" id="button1hbox">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="stock">gtk-refresh</property>
- <property name="icon_size">4</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
</object>
<packing>
- <property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="refreshbuttonlabel">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">Reset to defaults</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
</object>
<packing>
- <property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
- <property name="padding">10</property>
<property name="expand">False</property>
<property name="fill">True</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <object class="GtkButton" id="okbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="label">gtk-apply</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </object>
- <packing>
<property name="padding">10</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="cancelbutton">
+ <object class="GtkButton" id="close">
+ <property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
+ <property name="receives_default">True</property>
<property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
</object>
<packing>
- <property name="padding">0</property>
<property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
<packing>
- <property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
</child>
+ <action-widgets>
+ <action-widget response="0">reset</action-widget>
+ <action-widget response="0">close</action-widget>
+ </action-widgets>
</object>
</interface>
diff --git a/frontends/gtk/res/toolbar.gtk3.ui b/frontends/gtk/res/toolbar.gtk3.ui
index d84db5c8c..1f1148703 100644
--- a/frontends/gtk/res/toolbar.gtk3.ui
+++ b/frontends/gtk/res/toolbar.gtk3.ui
@@ -1,186 +1,134 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
<!--*- mode: xml -*-->
<interface>
- <object class="GtkWindow" id="toolbarwindow">
+ <requires lib="gtk+" version="3.0"/>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-refresh</property>
+ </object>
+ <object class="GtkDialog" id="dialogToolbar">
<property name="width_request">700</property>
<property name="height_request">450</property>
- <property name="title" translatable="yes"/>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
- <child>
- <object class="GtkVBox" id="windowvbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
- <child>
- <object class="GtkLabel" id="toolbarlabel">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Move items from store to toolbar Rearrange items in toolbar Move items from toolbar to store</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </object>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">gtkToolBarTitle</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
<child>
- <object class="GtkViewport" id="viewport1">
+ <object class="GtkButton" id="reset">
+ <property name="label" translatable="yes">Reset To Defaults</property>
<property name="visible">True</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <child>
- <object class="GtkVBox" id="widgetvbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image2</property>
+ <property name="yalign">0.52999997138977051</property>
+ <property name="always_show_image">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="close">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
</object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
<packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="buttonhbox">
+ <object class="GtkGrid" id="grid1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="can_focus">False</property>
+ <property name="column_homogeneous">True</property>
<child>
- <object class="GtkButton" id="resetbutton">
+ <object class="GtkLabel" id="label1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <child>
- <object class="GtkHBox" id="button1hbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
- <child>
- <object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-refresh</property>
- <property name="icon_size">4</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </object>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="refreshbuttonlabel">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Reset to defaults</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </object>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </object>
- </child>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Move items from store to toolbar</property>
</object>
<packing>
- <property name="padding">10</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
- <object class="GtkButton" id="okbutton">
+ <object class="GtkLabel" id="label2">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="label">gtk-apply</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Rearrange items in toolbar</property>
</object>
<packing>
- <property name="padding">10</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="cancelbutton">
+ <object class="GtkLabel" id="label3">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Move items from toolbar to store</property>
</object>
<packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
- <property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkViewport" id="viewport1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkVBox" id="widgetvbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
diff --git a/frontends/gtk/resources.c b/frontends/gtk/resources.c
index dfe3d3dad..fc3ac6ff3 100644
--- a/frontends/gtk/resources.c
+++ b/frontends/gtk/resources.c
@@ -81,7 +81,8 @@ static struct nsgtk_resource_s ui_resource[] = {
RES_ENTRY("ssl"),
RES_ENTRY("toolbar"),
RES_ENTRY("downloads"),
- RES_ENTRY("history"),
+ RES_ENTRY("globalhistory"),
+ RES_ENTRY("localhistory"),
RES_ENTRY("options"),
RES_ENTRY("hotlist"),
RES_ENTRY("cookies"),
@@ -128,6 +129,7 @@ static struct nsgtk_resource_s direct_resource[] = {
RES_ENTRY("icons/hotlist-rmv.png"),
RES_ENTRY("icons/search.png"),
RES_ENTRY("languages"),
+ RES_ENTRY("accelerators"),
RES_ENTRY("Messages"),
{ NULL, 0, NSGTK_RESOURCE_FILE, NULL },
};
@@ -177,11 +179,12 @@ init_resource(char **respath, struct nsgtk_resource_s *resource)
langv = g_get_language_names();
+ /* look for resource under per language paths */
while (langv[langc] != NULL) {
+ /* allocate and fill a full resource name path buffer */
resnamelen = snprintf(NULL, 0,
"/org/netsurf/%s/%s",
langv[langc], resource->name);
-
resname = malloc(resnamelen + 1);
if (resname == NULL) {
return NSERROR_NOMEM;
@@ -190,6 +193,7 @@ init_resource(char **respath, struct nsgtk_resource_s *resource)
"/org/netsurf/%s/%s",
langv[langc], resource->name);
+ /* check if resource is present */
present = g_resources_get_info(resname,
G_RESOURCE_LOOKUP_FLAGS_NONE,
NULL, NULL, NULL);
@@ -197,16 +201,19 @@ init_resource(char **respath, struct nsgtk_resource_s *resource)
/* found an entry in the resources */
resource->path = resname;
resource->type = NSGTK_RESOURCE_GLIB;
- LOG("Found gresource path %s", resource->path);
+ NSLOG(netsurf, INFO, "Found gresource path %s",
+ resource->path);
return NSERROR_OK;
}
- /*LOG("gresource \"%s\" not found", resname);*/
+ NSLOG(netsurf, DEEPDEBUG,
+ "gresource \"%s\" not found", resname);
free(resname);
langc++;
}
- resnamelen = snprintf(NULL, 0, "/org/netsurf/%s", resource->name);
+ /* allocate and fill a full resource name path buffer with no language*/
+ resnamelen = snprintf(NULL, 0, "/org/netsurf/%s", resource->name);
resname = malloc(resnamelen + 1);
if (resname == NULL) {
return NSERROR_NOMEM;
@@ -220,27 +227,31 @@ init_resource(char **respath, struct nsgtk_resource_s *resource)
/* found an entry in the resources */
resource->path = resname;
resource->type = NSGTK_RESOURCE_GLIB;
- LOG("Found gresource path %s", resource->path);
+ NSLOG(netsurf, INFO, "Found gresource path %s",
+ resource->path);
return NSERROR_OK;
}
- /*LOG("gresource \"%s\" not found", resname);*/
+ NSLOG(netsurf, DEEPDEBUG, "gresource \"%s\" not found", resname);
free(resname);
#endif
+ /* look for file on disc */
resname = filepath_find(respath, resource->name);
- if (resname == NULL) {
- LOG("Unable to find resource %s on resource path",
- resource->name);
- return NSERROR_NOT_FOUND;
+ if (resname != NULL) {
+ /* found an entry on the path */
+ resource->path = resname;
+ resource->type = NSGTK_RESOURCE_FILE;
+
+ NSLOG(netsurf, INFO,
+ "Found file resource path %s", resource->path);
+ return NSERROR_OK;
}
- /* found an entry on the path */
- resource->path = resname;
- resource->type = NSGTK_RESOURCE_FILE;
+ NSLOG(netsurf, INFO, "Unable to find resource %s on resource path",
+ resource->name);
- LOG("Found file resource path %s", resource->path);
- return NSERROR_OK;
+ return NSERROR_NOT_FOUND;
}
/**
@@ -294,21 +305,21 @@ init_pixbuf_resource(char **respath, struct nsgtk_resource_s *resource)
if (strncmp(resource->name, "menu_cursor.png", resource->len) == 0) {
resource->path = (char *)&menu_cursor_pixdata[0];
resource->type = NSGTK_RESOURCE_INLINE;
- LOG("Found builtin for %s", resource->name);
+ NSLOG(netsurf, INFO, "Found builtin for %s", resource->name);
return NSERROR_OK;
}
if (strncmp(resource->name, "netsurf.xpm", resource->len) == 0) {
resource->path = (char *)&netsurf_pixdata[0];
resource->type = NSGTK_RESOURCE_INLINE;
- LOG("Found builtin for %s", resource->name);
+ NSLOG(netsurf, INFO, "Found builtin for %s", resource->name);
return NSERROR_OK;
}
if (strncmp(resource->name, "favicon.png", resource->len) == 0) {
resource->path = (char *)&favicon_pixdata[0];
resource->type = NSGTK_RESOURCE_INLINE;
- LOG("Found builtin for %s", resource->name);
+ NSLOG(netsurf, INFO, "Found builtin for %s", resource->name);
return NSERROR_OK;
}
#endif
@@ -376,7 +387,7 @@ find_resource_from_name(const char *resname, struct nsgtk_resource_s *resource)
#ifdef SHOW_GRESOURCE
/**
- * Debug dump of all resources compile din via GResource.
+ * Debug dump of all resources compiled in via GResource.
*/
static void list_gresource(void)
{
@@ -388,13 +399,13 @@ static void list_gresource(void)
G_RESOURCE_LOOKUP_FLAGS_NONE,
&gerror);
if (gerror) {
- LOG("gerror %s", gerror->message);
+ NSLOG(netsurf, INFO, "gerror %s", gerror->message);
g_error_free(gerror);
} else {
cur = reslist;
while (cur != NULL && *cur != NULL) {
- LOG("gres %s", *cur);
+ NSLOG(netsurf, INFO, "gres %s", *cur);
cur++;
}
g_strfreev(reslist);
@@ -487,12 +498,17 @@ nsgdk_pixbuf_new_from_resname(const char *resname, GdkPixbuf **pixbuf_out)
if (new_pixbuf == NULL) {
if (error != NULL) {
- LOG("Unable to create pixbuf from file for %s with path %s \"%s\"",
- resource->name, resource->path, error->message);
+ NSLOG(netsurf, INFO,
+ "Unable to create pixbuf from file for %s with path %s \"%s\"",
+ resource->name,
+ resource->path,
+ error->message);
g_error_free(error);
} else {
- LOG("Unable to create pixbuf from file for %s with path %s",
- resource->name, resource->path);
+ NSLOG(netsurf, INFO,
+ "Unable to create pixbuf from file for %s with path %s",
+ resource->name,
+ resource->path);
}
return NSERROR_INIT_FAILED;
}
@@ -520,8 +536,11 @@ nsgtk_builder_new_from_resname(const char *resname, GtkBuilder **builder_out)
if (!gtk_builder_add_from_file(new_builder,
ui_res->path,
&error)) {
- LOG("Unable to add UI builder from file for %s with path %s \"%s\"",
- ui_res->name, ui_res->path, error->message);
+ NSLOG(netsurf, INFO,
+ "Unable to add UI builder from file for %s with path %s \"%s\"",
+ ui_res->name,
+ ui_res->path,
+ error->message);
g_error_free(error);
g_object_unref(G_OBJECT(new_builder));
return NSERROR_INIT_FAILED;
@@ -530,8 +549,11 @@ nsgtk_builder_new_from_resname(const char *resname, GtkBuilder **builder_out)
if (!nsgtk_builder_add_from_resource(new_builder,
ui_res->path,
&error)) {
- LOG("Unable to add UI builder from resource for %s with path %s \"%s\"",
- ui_res->name, ui_res->path, error->message);
+ NSLOG(netsurf, INFO,
+ "Unable to add UI builder from resource for %s with path %s \"%s\"",
+ ui_res->name,
+ ui_res->path,
+ error->message);
g_error_free(error);
g_object_unref(G_OBJECT(new_builder));
return NSERROR_INIT_FAILED;
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index bbc568e15..bedad9140 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -61,6 +61,7 @@
#include "gtk/bitmap.h"
#include "gtk/gui.h"
#include "gtk/global_history.h"
+#include "gtk/local_history.h"
#include "gtk/hotlist.h"
#include "gtk/download.h"
#include "gtk/menu.h"
@@ -103,15 +104,12 @@ static gboolean nsgtk_on_##q##_activate(GtkButton *widget, gpointer data)
/** Core scaffolding structure. */
struct nsgtk_scaffolding {
- /** global linked list of scaffoldings for gui interface adjustments */
+ /** global linked list of scaffolding for gui interface adjustments */
struct nsgtk_scaffolding *next, *prev;
/** currently active gui browsing context */
struct gui_window *top_level;
- /** local history window */
- struct gtk_history_window *history_window;
-
/** Builder object scaffold was created from */
GtkBuilder *builder;
@@ -150,7 +148,6 @@ struct nsgtk_scaffolding {
/** link popup menu */
struct nsgtk_link_menu *link_menu;
-
};
/** current scaffold for model dialogue use */
@@ -159,19 +156,30 @@ static struct nsgtk_scaffolding *scaf_current;
/** global list for interface changes */
static struct nsgtk_scaffolding *scaf_list = NULL;
-/** holds the context data for what's under the pointer, when the contextual
- * menu is opened.
+/**
+ * holds the context data for what's under the pointer, when the
+ * contextual menu is opened.
*/
static struct browser_window_features current_menu_features;
/**
- * Helper to hide popup menu entries by grouping
+ * Helper to hide popup menu entries by grouping.
+ *
+ * \param menu The popup menu to modify.
+ * \param submenu flag to indicate if submenus should be hidden.
+ * \param nav flag to indicate if navigation entries should be hidden.
+ * \param cnp flag to indicate if cut and paste entries should be hidden.
+ * \param custom flag to indicate if menu customisation is hidden.
*/
-static void popup_menu_hide(struct nsgtk_popup_menu *menu, bool submenu,
- bool nav, bool cnp, bool custom)
+static void
+popup_menu_hide(struct nsgtk_popup_menu *menu,
+ bool submenu,
+ bool nav,
+ bool cnp,
+ bool custom)
{
- if (submenu){
+ if (submenu) {
gtk_widget_hide(GTK_WIDGET(menu->file_menuitem));
gtk_widget_hide(GTK_WIDGET(menu->edit_menuitem));
gtk_widget_hide(GTK_WIDGET(menu->view_menuitem));
@@ -200,13 +208,24 @@ static void popup_menu_hide(struct nsgtk_popup_menu *menu, bool submenu,
}
+
/**
- * Helper to show popup menu entries by grouping
+ * Helper to show popup menu entries by grouping.
+ *
+ * \param menu The popup menu to modify.
+ * \param submenu flag to indicate if submenus should be visible.
+ * \param nav flag to indicate if navigation entries should be visible.
+ * \param cnp flag to indicate if cut and paste entries should be visible.
+ * \param custom flag to indicate if menu customisation is visible.
*/
-static void popup_menu_show(struct nsgtk_popup_menu *menu, bool submenu,
- bool nav, bool cnp, bool custom)
+static void
+popup_menu_show(struct nsgtk_popup_menu *menu,
+ bool submenu,
+ bool nav,
+ bool cnp,
+ bool custom)
{
- if (submenu){
+ if (submenu) {
gtk_widget_show(GTK_WIDGET(menu->file_menuitem));
gtk_widget_show(GTK_WIDGET(menu->edit_menuitem));
gtk_widget_show(GTK_WIDGET(menu->view_menuitem));
@@ -232,7 +251,6 @@ static void popup_menu_show(struct nsgtk_popup_menu *menu, bool submenu,
if (custom) {
gtk_widget_show(GTK_WIDGET(menu->customize_menuitem));
}
-
}
@@ -240,16 +258,20 @@ static void popup_menu_show(struct nsgtk_popup_menu *menu, bool submenu,
/**
* resource cleanup function for window destruction.
+ *
+ * gtk event called when window is being destroyed. Need to free any
+ * resources associated with this scaffold,
+ *
+ * \param widget the widget being destroyed
+ * \param data The context pointer passed when the connection was made.
*/
static void scaffolding_window_destroy(GtkWidget *widget, gpointer data)
{
struct nsgtk_scaffolding *gs = data;
- LOG("scaffold:%p", gs);
+ NSLOG(netsurf, INFO, "scaffold:%p", gs);
- if ((gs->history_window) && (gs->history_window->window)) {
- gtk_widget_destroy(GTK_WIDGET(gs->history_window->window));
- }
+ nsgtk_local_history_hide();
if (gs->prev != NULL) {
gs->prev->next = gs->next;
@@ -260,7 +282,7 @@ static void scaffolding_window_destroy(GtkWidget *widget, gpointer data)
gs->next->prev = gs->prev;
}
- LOG("scaffold list head: %p", scaf_list);
+ NSLOG(netsurf, INFO, "scaffold list head: %p", scaf_list);
if (scaf_list == NULL) {
/* no more open windows - stop the browser */
@@ -268,11 +290,21 @@ static void scaffolding_window_destroy(GtkWidget *widget, gpointer data)
}
}
-/* signal delivered on window delete event, allowing to halt close if
- * download is in progress
+
+/**
+ * gtk event callback on window delete event.
+ *
+ * prevent window close if download is in progress
+ *
+ * \param widget The widget receiving the delete event
+ * \param event The event
+ * \param data The context pointer passed when the connection was made.
+ * \return TRUE to indicate message handled.
*/
-static gboolean scaffolding_window_delete_event(GtkWidget *widget,
- GdkEvent *event, gpointer data)
+static gboolean
+scaffolding_window_delete_event(GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data)
{
struct nsgtk_scaffolding *g = data;
@@ -282,12 +314,16 @@ static gboolean scaffolding_window_delete_event(GtkWidget *widget,
return TRUE;
}
+
/**
- * Update the scaffoling button sensitivity, url bar and local history size
+ * Update the scaffolding controls
+ *
+ * The button sensitivity, url bar and local history visibility are updated
+ *
+ * \param g The scaffolding context to update
*/
static void scaffolding_update_context(struct nsgtk_scaffolding *g)
{
- int width, height;
struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
g->buttons[BACK_BUTTON]->sensitivity =
@@ -300,34 +336,41 @@ static void scaffolding_update_context(struct nsgtk_scaffolding *g)
/* update the url bar, particularly necessary when tabbing */
browser_window_refresh_url_bar(bw);
- /* update the local history window, as well as queuing a redraw
- * for it.
- */
- browser_window_history_size(bw, &width, &height);
- gtk_widget_set_size_request(GTK_WIDGET(g->history_window->drawing_area),
- width, height);
- gtk_widget_queue_draw(GTK_WIDGET(g->history_window->drawing_area));
+ nsgtk_local_history_hide();
}
+
/**
* Make the throbber run.
+ *
+ * scheduled callback to update the throbber
+ *
+ * \param p The context passed when scheduled.
*/
static void nsgtk_throb(void *p)
{
struct nsgtk_scaffolding *g = p;
- if (g->throb_frame >= (nsgtk_throbber->nframes - 1))
+ if (g->throb_frame >= (nsgtk_throbber->nframes - 1)) {
g->throb_frame = 1;
- else
+ } else {
g->throb_frame++;
+ }
- gtk_image_set_from_pixbuf(g->throbber, nsgtk_throbber->framedata[
- g->throb_frame]);
+ gtk_image_set_from_pixbuf(g->throbber,
+ nsgtk_throbber->framedata[g->throb_frame]);
nsgtk_schedule(100, nsgtk_throb, p);
}
-static guint nsgtk_scaffolding_update_edit_actions_sensitivity(
+
+/**
+ * edit the sensitivity of focused widget
+ *
+ * \param g The scaffolding context.
+ */
+static guint
+nsgtk_scaffolding_update_edit_actions_sensitivity(
struct nsgtk_scaffolding *g)
{
GtkWidget *widget = gtk_window_get_focus(g->window);
@@ -361,7 +404,13 @@ static guint nsgtk_scaffolding_update_edit_actions_sensitivity(
}
-static void nsgtk_scaffolding_enable_edit_actions_sensitivity(
+/**
+ * make edit actions sensitive
+ *
+ * \param g The scaffolding context.
+ */
+static void
+nsgtk_scaffolding_enable_edit_actions_sensitivity(
struct nsgtk_scaffolding *g)
{
@@ -374,22 +423,46 @@ static void nsgtk_scaffolding_enable_edit_actions_sensitivity(
}
/* signal handling functions for the toolbar, URL bar, and menu bar */
-static gboolean nsgtk_window_edit_menu_clicked(GtkWidget *widget,
- struct nsgtk_scaffolding *g)
+
+/**
+ * gtk event for edit menu being show
+ *
+ * \param widget The menu widget
+ * \param g scaffolding handle
+ * \return TRUE to indicate event handled
+ */
+static gboolean
+nsgtk_window_edit_menu_shown(GtkWidget *widget,
+ struct nsgtk_scaffolding *g)
{
nsgtk_scaffolding_update_edit_actions_sensitivity(g);
return TRUE;
}
-static gboolean nsgtk_window_edit_menu_hidden(GtkWidget *widget,
- struct nsgtk_scaffolding *g)
+/**
+ * gtk event handler for edit menu being hidden
+ *
+ * \param widget The menu widget
+ * \param g scaffolding handle
+ * \return TRUE to indicate event handled
+ */
+static gboolean
+nsgtk_window_edit_menu_hidden(GtkWidget *widget,
+ struct nsgtk_scaffolding *g)
{
nsgtk_scaffolding_enable_edit_actions_sensitivity(g);
return TRUE;
}
+/**
+ * gtk event handler for popup menu being hidden.
+ *
+ * \param widget The menu widget
+ * \param g scaffolding handle
+ * \return TRUE to indicate event handled
+ */
static gboolean nsgtk_window_popup_menu_hidden(GtkWidget *widget,
struct nsgtk_scaffolding *g)
{
@@ -397,6 +470,7 @@ static gboolean nsgtk_window_popup_menu_hidden(GtkWidget *widget,
return TRUE;
}
+/* exported interface documented in gtk/scaffolding.h */
gboolean nsgtk_window_url_activate_event(GtkWidget *widget, gpointer data)
{
struct nsgtk_scaffolding *g = data;
@@ -419,8 +493,14 @@ gboolean nsgtk_window_url_activate_event(GtkWidget *widget, gpointer data)
return TRUE;
}
+
/**
* update handler for URL entry widget
+ *
+ * \param widget The widget receiving the delete event
+ * \param event The event
+ * \param data The context pointer passed when the connection was made.
+ * \return TRUE to indicate signal handled.
*/
gboolean
nsgtk_window_url_changed(GtkWidget *widget,
@@ -430,11 +510,23 @@ nsgtk_window_url_changed(GtkWidget *widget,
return nsgtk_completion_update(GTK_ENTRY(widget));
}
+
/**
* Event handler for popup menu on toolbar.
+ *
+ * \param toolbar The toolbar being clicked
+ * \param x The x coordinate where the click happened
+ * \param y The x coordinate where the click happened
+ * \param button the buttons being pressed
+ * \param data The context pointer passed when the connection was made.
+ * \return TRUE to indicate event handled.
*/
-static gboolean nsgtk_window_tool_bar_clicked(GtkToolbar *toolbar,
- gint x, gint y, gint button, gpointer data)
+static gboolean
+nsgtk_window_tool_bar_clicked(GtkToolbar *toolbar,
+ gint x,
+ gint y,
+ gint button,
+ gpointer data)
{
struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
@@ -448,23 +540,40 @@ static gboolean nsgtk_window_tool_bar_clicked(GtkToolbar *toolbar,
return TRUE;
}
+
/**
* Update the menus when the number of tabs changes.
+ *
+ * \param notebook The notebook all the tabs are in
+ * \param page The newly added page container widget
+ * \param page_num The index of the newly added page
+ * \param g The scaffolding context containing the notebook
*/
-static void nsgtk_window_tabs_add(GtkNotebook *notebook,
- GtkWidget *page, guint page_num, struct nsgtk_scaffolding *g)
+static void
+nsgtk_window_tabs_add(GtkNotebook *notebook,
+ GtkWidget *page,
+ guint page_num,
+ struct nsgtk_scaffolding *g)
{
gboolean visible = gtk_notebook_get_show_tabs(g->notebook);
- g_object_set(g->menu_bar->view_submenu->tabs_menuitem, "visible", visible, NULL);
- g_object_set(g->menu_popup->view_submenu->tabs_menuitem, "visible", visible, NULL);
+ g_object_set(g->menu_bar->view_submenu->tabs_menuitem,
+ "visible", visible, NULL);
+ g_object_set(g->menu_popup->view_submenu->tabs_menuitem,
+ "visible", visible, NULL);
g->buttons[NEXTTAB_BUTTON]->sensitivity = visible;
g->buttons[PREVTAB_BUTTON]->sensitivity = visible;
g->buttons[CLOSETAB_BUTTON]->sensitivity = visible;
nsgtk_scaffolding_set_sensitivity(g);
}
+
/**
* Update the menus when the number of tabs changes.
+ *
+ * \param notebook The notebook all the tabs are in
+ * \param page The page container widget being removed
+ * \param page_num The index of the removed page
+ * \param gs The scaffolding context containing the notebook
*/
static void
nsgtk_window_tabs_remove(GtkNotebook *notebook,
@@ -473,7 +582,7 @@ nsgtk_window_tabs_remove(GtkNotebook *notebook,
struct nsgtk_scaffolding *gs)
{
/* if the scaffold is being destroyed it is not useful to
- * update the state, futher many of the widgets may have
+ * update the state, further many of the widgets may have
* already been destroyed.
*/
if (gtk_widget_in_destruction(GTK_WIDGET(gs->window)) == TRUE) {
@@ -497,6 +606,8 @@ nsgtk_window_tabs_remove(GtkNotebook *notebook,
/**
* Handle opening a file path.
+ *
+ * \param filename The filename to open.
*/
static void nsgtk_openfile_open(const char *filename)
{
@@ -560,6 +671,7 @@ MULTIHANDLER(newwindow)
return TRUE;
}
+/* exported interface documented in gtk/scaffolding.h */
nserror nsgtk_scaffolding_new_tab(struct gui_window *gw)
{
struct browser_window *bw = nsgtk_get_browser_window(gw);
@@ -629,8 +741,16 @@ MULTIHANDLER(openfile)
return TRUE;
}
-static gboolean nsgtk_filter_directory(const GtkFileFilterInfo *info,
- gpointer data)
+/**
+ * callback to determine if a path is a directory.
+ *
+ * \param info The path information
+ * \param data context pointer set to NULL
+ * \return TRUE if path is a directory else false
+ */
+static gboolean
+nsgtk_filter_directory(const GtkFileFilterInfo *info,
+ gpointer data)
{
DIR *d = opendir(info->filename);
if (d == NULL)
@@ -660,7 +780,7 @@ MULTIHANDLER(savepage)
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fc), filter);
gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(fc), filter);
- res = nsurl_nice(browser_window_get_url(
+ res = nsurl_nice(browser_window_access_url(
nsgtk_get_browser_window(g->top_level)), &path, false);
if (res != NSERROR_OK) {
path = strdup(messages_get("SaveText"));
@@ -685,7 +805,10 @@ MULTIHANDLER(savepage)
path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc));
d = opendir(path);
if (d == NULL) {
- LOG("Unable to open directory %s for complete save: %s", path, strerror(errno));
+ NSLOG(netsurf, INFO,
+ "Unable to open directory %s for complete save: %s",
+ path,
+ strerror(errno));
if (errno == ENOTDIR)
nsgtk_warning("NoDirError", path);
else
@@ -717,9 +840,9 @@ MULTIHANDLER(pdf)
char *url_name;
nserror res;
- LOG("Print preview (generating PDF) started.");
+ NSLOG(netsurf, INFO, "Print preview (generating PDF) started.");
- res = nsurl_nice(browser_window_get_url(bw), &url_name, true);
+ res = nsurl_nice(browser_window_access_url(bw), &url_name, true);
if (res != NSERROR_OK) {
nsgtk_warning(messages_get_errorcode(res), 0);
return TRUE;
@@ -735,7 +858,7 @@ MULTIHANDLER(pdf)
strncat(dirname, "/", PATH_MAX - strlen(dirname));
dirname[PATH_MAX - 1] = '\0';
- /* this way the scale used by PDF functions is synchronized with that
+ /* this way the scale used by PDF functions is synchronised with that
* used by the all-purpose print interface
*/
haru_nsfont_set_scale((float)option_export_scale / 100);
@@ -792,7 +915,7 @@ MULTIHANDLER(plaintext)
char *filename;
nserror res;
- res = nsurl_nice(browser_window_get_url(
+ res = nsurl_nice(browser_window_access_url(
nsgtk_get_browser_window(g->top_level)),
&filename, false);
if (res != NSERROR_OK) {
@@ -891,7 +1014,7 @@ MULTIHANDLER(print)
CONTENT_TEXTPLAIN) {
res = gtk_print_operation_run(print_op,
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
- g->window,
+ g->window,
NULL);
}
@@ -1101,10 +1224,10 @@ MULTIHANDLER(selectall)
struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
if (nsgtk_widget_has_focus(GTK_WIDGET(g->url_bar))) {
- LOG("Selecting all URL bar text");
+ NSLOG(netsurf, INFO, "Selecting all URL bar text");
gtk_editable_select_region(GTK_EDITABLE(g->url_bar), 0, -1);
} else {
- LOG("Selecting all document text");
+ NSLOG(netsurf, INFO, "Selecting all document text");
browser_window_key_press(bw, NS_KEY_SELECT_ALL);
}
@@ -1466,31 +1589,13 @@ MULTIHANDLER(home)
MULTIHANDLER(localhistory)
{
struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
+ nserror res;
- int x,y, width, height, mainwidth, mainheight, margin = 20;
- /* if entries of the same url but different frag_ids have been added
- * the history needs redrawing (what throbber code normally does)
- */
-
- scaffolding_update_context(g);
- gtk_window_get_position(g->window, &x, &y);
- gtk_window_get_size(g->window, &mainwidth, &mainheight);
- browser_window_history_size(bw, &width, &height);
- width = (width + g->historybase + margin > mainwidth) ?
- mainwidth - g->historybase : width + margin;
- height = (height + g->toolbarbase + margin > mainheight) ?
- mainheight - g->toolbarbase : height + margin;
- gtk_window_set_default_size(g->history_window->window, width, height);
- gtk_widget_set_size_request(GTK_WIDGET(g->history_window->window),
- -1, -1);
- gtk_window_resize(g->history_window->window, width, height);
- gtk_window_set_transient_for(g->history_window->window, g->window);
- nsgtk_window_set_opacity(g->history_window->window, 0.9);
- gtk_widget_show(GTK_WIDGET(g->history_window->window));
- gtk_window_move(g->history_window->window, x + g->historybase, y +
- g->toolbarbase);
- gdk_window_raise(nsgtk_widget_get_window(GTK_WIDGET(g->history_window->window)));
-
+ res = nsgtk_local_history_present(g->window, bw);
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO,
+ "Unable to initialise local history window.");
+ }
return TRUE;
}
@@ -1499,7 +1604,8 @@ MULTIHANDLER(globalhistory)
nserror res;
res = nsgtk_global_history_present();
if (res != NSERROR_OK) {
- LOG("Unable to initialise global history window.");
+ NSLOG(netsurf, INFO,
+ "Unable to initialise global history window.");
}
return TRUE;
}
@@ -1510,7 +1616,7 @@ MULTIHANDLER(addbookmarks)
if (bw == NULL || !browser_window_has_content(bw))
return TRUE;
- hotlist_add_url(browser_window_get_url(bw));
+ hotlist_add_url(browser_window_access_url(bw));
return TRUE;
}
@@ -1519,7 +1625,7 @@ MULTIHANDLER(showbookmarks)
nserror res;
res = nsgtk_hotlist_present();
if (res != NSERROR_OK) {
- LOG("Unable to initialise bookmark window.");
+ NSLOG(netsurf, INFO, "Unable to initialise bookmark window.");
}
return TRUE;
}
@@ -1529,7 +1635,7 @@ MULTIHANDLER(showcookies)
nserror res;
res = nsgtk_cookies_present();
if (res != NSERROR_OK) {
- LOG("Unable to initialise cookies window.");
+ NSLOG(netsurf, INFO, "Unable to initialise cookies window.");
}
return TRUE;
}
@@ -1643,98 +1749,6 @@ BUTTONHANDLER(history)
#undef CHECKHANDLER
#undef BUTTONHANDLER
-#if GTK_CHECK_VERSION(3,0,0)
-
-static gboolean
-nsgtk_history_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data)
-{
- struct rect clip;
- struct gtk_history_window *hw = (struct gtk_history_window *)data;
- struct browser_window *bw =
- nsgtk_get_browser_window(hw->g->top_level);
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &nsgtk_plotters
- };
- double x1;
- double y1;
- double x2;
- double y2;
-
- current_widget = widget;
- current_cr = cr;
-
- cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
-
- clip.x0 = x1;
- clip.y0 = y1;
- clip.x1 = x2;
- clip.y1 = y2;
-
- ctx.plot->clip(&clip);
-
- browser_window_history_redraw(bw, &ctx);
-
- current_widget = NULL;
-
- return FALSE;
-}
-#else
-
-/* signal handler functions for the local history window */
-static gboolean
-nsgtk_history_draw_event(GtkWidget *widget, GdkEventExpose *event, gpointer g)
-{
- struct rect clip;
- struct gtk_history_window *hw = (struct gtk_history_window *)g;
- struct browser_window *bw =
- nsgtk_get_browser_window(hw->g->top_level);
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &nsgtk_plotters
- };
-
- current_widget = widget;
-
- current_cr = gdk_cairo_create(nsgtk_widget_get_window(widget));
-
- clip.x0 = event->area.x;
- clip.y0 = event->area.y;
- clip.x1 = event->area.x + event->area.width;
- clip.y1 = event->area.y + event->area.height;
- ctx.plot->clip(&clip);
-
- browser_window_history_redraw(bw, &ctx);
-
- cairo_destroy(current_cr);
-
- current_widget = NULL;
-
- return FALSE;
-}
-
-#endif /* GTK_CHECK_VERSION(3,0,0) */
-
-static gboolean nsgtk_history_button_press_event(GtkWidget *widget,
- GdkEventButton *event, gpointer g)
-{
- struct gtk_history_window *hw = (struct gtk_history_window *)g;
- struct browser_window *bw =
- nsgtk_get_browser_window(hw->g->top_level);
-
- LOG("X=%g, Y=%g", event->x, event->y);
-
- browser_window_history_click(bw, event->x, event->y, false);
-
- return TRUE;
-}
-
-
-
static void nsgtk_attach_menu_handlers(struct nsgtk_scaffolding *g)
{
for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
@@ -2059,12 +2073,13 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
int i;
GtkAccelGroup *group;
- gs = malloc(sizeof(*gs));
+ gs = calloc(1, sizeof(*gs));
if (gs == NULL) {
return NULL;
}
- LOG("Constructing a scaffold of %p for gui_window %p", gs, toplevel);
+ NSLOG(netsurf, INFO,
+ "Constructing a scaffold of %p for gui_window %p", gs, toplevel);
gs->top_level = toplevel;
@@ -2188,35 +2203,6 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
gtk_widget_set_size_request(GTK_WIDGET(
gs->buttons[HISTORY_BUTTON]->button), 20, -1);
- /* create the local history window to be associated with this scaffold */
- gs->history_window = malloc(sizeof(struct gtk_history_window));
- gs->history_window->g = gs;
- gs->history_window->window =
- GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
- gtk_window_set_transient_for(gs->history_window->window, gs->window);
- gtk_window_set_title(gs->history_window->window, "NetSurf History");
- gtk_window_set_type_hint(gs->history_window->window,
- GDK_WINDOW_TYPE_HINT_UTILITY);
- gs->history_window->scrolled =
- GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(0, 0));
- gtk_container_add(GTK_CONTAINER(gs->history_window->window),
- GTK_WIDGET(gs->history_window->scrolled));
-
- gtk_widget_show(GTK_WIDGET(gs->history_window->scrolled));
- gs->history_window->drawing_area =
- GTK_DRAWING_AREA(gtk_drawing_area_new());
-
- gtk_widget_set_events(GTK_WIDGET(gs->history_window->drawing_area),
- GDK_EXPOSURE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_BUTTON_PRESS_MASK);
- nsgtk_widget_override_background_color(GTK_WIDGET(gs->history_window->drawing_area),
- GTK_STATE_NORMAL,
- 0, 0xffff, 0xffff, 0xffff);
- nsgtk_scrolled_window_add_with_viewport(gs->history_window->scrolled,
- GTK_WIDGET(gs->history_window->drawing_area));
- gtk_widget_show(GTK_WIDGET(gs->history_window->drawing_area));
-
/* set up URL bar completion */
gs->url_bar_completion = nsgtk_url_entry_completion_new(gs);
@@ -2228,17 +2214,6 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
#define CONNECT(obj, sig, callback, ptr) \
g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
- /* connect history window signals to their handlers */
- nsgtk_connect_draw_event(GTK_WIDGET(gs->history_window->drawing_area),
- G_CALLBACK(nsgtk_history_draw_event),
- gs->history_window);
- /*CONNECT(gs->history_window->drawing_area, "motion_notify_event",
- nsgtk_history_motion_notify_event, gs->history_window);*/
- CONNECT(gs->history_window->drawing_area, "button_press_event",
- nsgtk_history_button_press_event, gs->history_window);
- CONNECT(gs->history_window->window, "delete_event",
- gtk_widget_hide_on_delete, NULL);
-
g_signal_connect_after(gs->notebook, "page-added",
G_CALLBACK(nsgtk_window_tabs_add), gs);
g_signal_connect_after(gs->notebook, "page-removed",
@@ -2252,7 +2227,7 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
/* toolbar URL bar menu bar search bar signal handlers */
CONNECT(gs->menu_bar->edit_submenu->edit, "show",
- nsgtk_window_edit_menu_clicked, gs);
+ nsgtk_window_edit_menu_shown, gs);
CONNECT(gs->menu_bar->edit_submenu->edit, "hide",
nsgtk_window_edit_menu_hidden, gs);
@@ -2309,7 +2284,7 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
/* finally, show the window. */
gtk_widget_show(GTK_WIDGET(gs->window));
- LOG("creation complete");
+ NSLOG(netsurf, INFO, "creation complete");
return gs;
}
@@ -2497,7 +2472,8 @@ gui_search_web_provider_update(const char *provider_name,
GdkPixbuf *srch_pixbuf = NULL;
char *searchcontent;
- LOG("name:%s bitmap %p", provider_name, provider_bitmap);
+ NSLOG(netsurf, INFO, "name:%s bitmap %p", provider_name,
+ provider_bitmap);
if (provider_bitmap != NULL) {
srch_pixbuf = nsgdk_pixbuf_get_from_surface(provider_bitmap->surface, 16, 16);
@@ -2515,7 +2491,11 @@ gui_search_web_provider_update(const char *provider_name,
/* set the search provider parameters up in each scaffold */
for (current = scaf_list; current != NULL; current = current->next) {
- /* add ico to each window's toolbar */
+ if (current->webSearchEntry == NULL) {
+ continue;
+ }
+
+ /* add ico to each window's toolbar */
if (srch_pixbuf != NULL) {
nsgtk_entry_set_icon_from_pixbuf(current->webSearchEntry,
GTK_ENTRY_ICON_PRIMARY,
@@ -2599,13 +2579,6 @@ GtkMenuBar *nsgtk_scaffolding_menu_bar(struct nsgtk_scaffolding *g)
}
/* exported interface documented in gtk/scaffolding.h */
-struct gtk_history_window *
-nsgtk_scaffolding_history_window(struct nsgtk_scaffolding *g)
-{
- return g->history_window;
-}
-
-/* exported interface documented in gtk/scaffolding.h */
struct nsgtk_scaffolding *nsgtk_scaffolding_iterate(struct nsgtk_scaffolding *g)
{
if (g == NULL) {
@@ -2774,7 +2747,7 @@ void nsgtk_scaffolding_context_menu(struct nsgtk_scaffolding *g,
gtk_widget_show(GTK_WIDGET(g->menu_popup->paste_menuitem));
}
- /* hide customize */
+ /* hide customise */
popup_menu_hide(g->menu_popup, false, false, false, true);
}
diff --git a/frontends/gtk/schedule.c b/frontends/gtk/schedule.c
index cf0333388..d5b45674b 100644
--- a/frontends/gtk/schedule.c
+++ b/frontends/gtk/schedule.c
@@ -21,14 +21,10 @@
#include <stdbool.h>
#include "utils/errors.h"
+#include "utils/log.h"
#include "gtk/schedule.h"
-#ifdef DEBUG_GTK_SCHEDULE
-#include "utils/log.h"
-#else
-#define LOG(format, args...) ((void) 0)
-#endif
/** Killable callback closure embodiment. */
typedef struct {
@@ -50,7 +46,7 @@ nsgtk_schedule_generic_callback(gpointer data)
_nsgtk_callback_t *cb = (_nsgtk_callback_t *)(data);
if (cb->callback_killed) {
/* This callback instance has been killed. */
- LOG("CB at %p already dead.", cb);
+ NSLOG(schedule, DEBUG, "CB at %p already dead.", cb);
}
queued_callbacks = g_list_remove(queued_callbacks, cb);
pending_callbacks = g_list_append(pending_callbacks, cb);
@@ -64,7 +60,9 @@ nsgtk_schedule_kill_callback(void *_target, void *_match)
_nsgtk_callback_t *match = (_nsgtk_callback_t *)_match;
if ((target->callback == match->callback) &&
(target->context == match->context)) {
- LOG("Found match for %p(%p), killing.", target->callback, target->context);
+ NSLOG(schedule, DEBUG,
+ "Found match for %p(%p), killing.",
+ target->callback, target->context);
target->callback = NULL;
target->context = NULL;
target->callback_killed = true;
@@ -122,7 +120,9 @@ schedule_run(void)
/* Clear the pending list. */
pending_callbacks = NULL;
- LOG("Captured a run of %d callbacks to fire.", g_list_length(this_run));
+ NSLOG(schedule, DEBUG,
+ "Captured a run of %d callbacks to fire.",
+ g_list_length(this_run));
/* Run all the callbacks which made it this far. */
while (this_run != NULL) {
diff --git a/frontends/gtk/ssl_cert.c b/frontends/gtk/ssl_cert.c
index 5388f0194..9d98db1f6 100644
--- a/frontends/gtk/ssl_cert.c
+++ b/frontends/gtk/ssl_cert.c
@@ -183,7 +183,7 @@ nserror gtk_cert_verify(struct nsurl *url,
res = nsgtk_builder_new_from_resname("ssl", &ncwin->builder);
if (res != NSERROR_OK) {
- LOG("SSL UI builder init failed");
+ NSLOG(netsurf, INFO, "SSL UI builder init failed");
free(ncwin);
return res;
}
diff --git a/frontends/gtk/tabs.c b/frontends/gtk/tabs.c
index 6adce3a06..dbe9d405b 100644
--- a/frontends/gtk/tabs.c
+++ b/frontends/gtk/tabs.c
@@ -147,18 +147,20 @@ nsgtk_tab_switch_page_after(GtkNotebook *notebook,
if ((srcpagenum != -1) &&
(srcpagenum != (gint)selpagenum)) {
/* ensure the add tab is not actually selected */
- LOG("src %d sel %d", srcpagenum, selpagenum);
+ NSLOG(netsurf, INFO, "src %d sel %d", srcpagenum,
+ selpagenum);
srcpage = gtk_notebook_get_nth_page(notebook, srcpagenum);
gw = g_object_get_data(G_OBJECT(srcpage), "gui_window");
if ((gw != NULL) && (nsgtk_get_scaffold(gw) != NULL)) {
error = nsgtk_scaffolding_new_tab(gw);
if (error != NSERROR_OK) {
- LOG("Failed to open new tab.");
+ NSLOG(netsurf, INFO,
+ "Failed to open new tab.");
}
}
}
} else {
- LOG("sel %d", selpagenum);
+ NSLOG(netsurf, INFO, "sel %d", selpagenum);
/* tab with page in it */
gw = g_object_get_data(G_OBJECT(selpage), "gui_window");
if (gw != NULL) {
diff --git a/frontends/gtk/throbber.c b/frontends/gtk/throbber.c
index 9392c3909..b8efceca1 100644
--- a/frontends/gtk/throbber.c
+++ b/frontends/gtk/throbber.c
@@ -59,12 +59,14 @@ nserror nsgtk_throbber_init(void)
if (res != NSERROR_OK) {
break;
}
- LOG("%s",resname);
+ NSLOG(netsurf, INFO, "%s", resname);
}
if (frame < 1) {
/* we need at least two frames - one for idle, one for active */
- LOG("Insufficent number of frames (%d) in throbber animation.", frame);
+ NSLOG(netsurf, INFO,
+ "Insufficent number of frames (%d) in throbber animation.",
+ frame);
res = NSERROR_INIT_FAILED;
}
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index ac24a78ca..e93bd49f9 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -26,6 +26,7 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
+#include "utils/file.h"
#include "gtk/gui.h"
#include "gtk/warn.h"
@@ -44,7 +45,7 @@ static bool edit_mode = false;
struct nsgtk_toolbar_custom_store {
GtkWidget *window;
- GtkWidget *store_buttons[PLACEHOLDER_BUTTON];
+ GtkWidget *store_buttons[PLACEHOLDER_BUTTON];
GtkWidget *widgetvbox;
GtkWidget *currentbar;
char numberh; /* current horizontal location while adding */
@@ -107,13 +108,13 @@ static char *remove_underscores(const char *s, bool replacespace)
ret = malloc(len + 1);
if (ret == NULL) {
return NULL;
- }
+ }
for (i = 0, ii = 0; i < len; i++) {
if (s[i] != '_') {
ret[ii++] = s[i];
- } else if (replacespace) {
+ } else if (replacespace) {
ret[ii++] = ' ';
- }
+ }
}
ret[ii] = '\0';
return ret;
@@ -125,6 +126,7 @@ static char *remove_underscores(const char *s, bool replacespace)
*
* \param tbbutton button reference
* \param iconsize The size of icons to select.
+ * \param usedef Use the default image if not found.
* \return default images.
*/
static GtkImage *
@@ -193,6 +195,7 @@ nsgtk_theme_image_default(nsgtk_toolbar_button tbbutton,
*
* \param tbbutton search button reference
* \param iconsize The size of icons to select.
+ * \param usedef Use the default image if not found.
* \return default search image.
*/
@@ -206,18 +209,18 @@ nsgtk_theme_searchimage_default(nsgtk_search_buttons tbbutton,
switch (tbbutton) {
case (SEARCH_BACK_BUTTON):
- image = GTK_IMAGE(nsgtk_image_new_from_stock(NSGTK_STOCK_GO_BACK,
- iconsize));
+ image = GTK_IMAGE(nsgtk_image_new_from_stock(
+ NSGTK_STOCK_GO_BACK, iconsize));
break;
case (SEARCH_FORWARD_BUTTON):
- image = GTK_IMAGE(nsgtk_image_new_from_stock(NSGTK_STOCK_GO_FORWARD,
- iconsize));
+ image = GTK_IMAGE(nsgtk_image_new_from_stock(
+ NSGTK_STOCK_GO_FORWARD, iconsize));
break;
case (SEARCH_CLOSE_BUTTON):
- image = GTK_IMAGE(nsgtk_image_new_from_stock(NSGTK_STOCK_CLOSE,
- iconsize));
+ image = GTK_IMAGE(nsgtk_image_new_from_stock(
+ NSGTK_STOCK_CLOSE, iconsize));
break;
default:
@@ -225,7 +228,8 @@ nsgtk_theme_searchimage_default(nsgtk_search_buttons tbbutton,
}
if (usedef && (image == NULL)) {
- image = GTK_IMAGE(nsgtk_image_new_from_stock("gtk-missing-image", iconsize));
+ image = GTK_IMAGE(nsgtk_image_new_from_stock(
+ "gtk-missing-image", iconsize));
}
return image;
@@ -253,7 +257,6 @@ static struct nsgtk_theme *nsgtk_theme_load(GtkIconSize iconsize, bool usedef)
theme->image[btnloop] = nsgtk_theme_image_default(btnloop,
iconsize,
usedef);
-
}
for (btnloop = SEARCH_BACK_BUTTON;
@@ -821,8 +824,9 @@ static void nsgtk_toolbar_close(struct nsgtk_scaffolding *g)
*/
static gboolean nsgtk_toolbar_cancel_clicked(GtkWidget *widget, gpointer data)
{
- edit_mode = false;
struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
+
+ edit_mode = false;
/* reset g->buttons->location */
for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
nsgtk_scaffolding_button(g, i)->location =
@@ -948,6 +952,7 @@ void nsgtk_toolbar_customization_load(struct nsgtk_scaffolding *g)
*/
static nserror nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g)
{
+ char *choices = NULL;
char *order;
int order_len = PLACEHOLDER_BUTTON * 12; /* length of order buffer */
int tbidx;
@@ -969,7 +974,8 @@ static nserror nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g)
nsgtk_scaffolding_button(g, tbidx)->location);
if (plen == order_len) {
/* ran out of space, bail early */
- LOG("toolbar ordering exceeded available space");
+ NSLOG(netsurf, INFO,
+ "toolbar ordering exceeded available space");
break;
}
cur += plen;
@@ -978,6 +984,13 @@ static nserror nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g)
nsoption_set_charp(toolbar_order, order);
+ /* ensure choices are saved */
+ netsurf_mkpath(&choices, NULL, 2, nsgtk_config_home, "Choices");
+ if (choices != NULL) {
+ nsoption_write(choices, NULL, NULL);
+ free(choices);
+ }
+
return NSERROR_OK;
}
@@ -987,8 +1000,9 @@ static nserror nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g)
*/
static gboolean nsgtk_toolbar_persist(GtkWidget *widget, gpointer data)
{
- edit_mode = false;
struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
+
+ edit_mode = false;
/* save state to file, update toolbars for all windows */
nsgtk_toolbar_customization_save(g);
nsgtk_toolbar_cast(g);
@@ -1095,7 +1109,6 @@ nsgtk_toolbar_store_action(GtkWidget *widget, GdkDragContext *gdc,
*/
static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g)
{
- int x = 0, y = 0;
struct nsgtk_theme *theme;
nserror res;
@@ -1108,8 +1121,8 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g)
res = nsgtk_builder_new_from_resname("toolbar", &window->builder);
if (res != NSERROR_OK) {
- LOG("Toolbar UI builder init failed");
- nsgtk_warning(messages_get("NoMemory"), 0);
+ NSLOG(netsurf, INFO, "Toolbar UI builder init failed");
+ nsgtk_warning("Toolbar UI builder init failed", 0);
nsgtk_toolbar_cancel_clicked(NULL, g);
free(theme);
return;
@@ -1117,8 +1130,8 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g)
gtk_builder_connect_signals(window->builder, NULL);
- window->window = GTK_WIDGET(gtk_builder_get_object(window->builder,
- "toolbarwindow"));
+ window->window = GTK_WIDGET(gtk_builder_get_object(
+ window->builder, "dialogToolbar"));
if (window->window == NULL) {
nsgtk_warning(messages_get("NoMemory"), 0);
nsgtk_toolbar_cancel_clicked(NULL, g);
@@ -1126,8 +1139,11 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g)
return;
}
- window->widgetvbox = GTK_WIDGET(gtk_builder_get_object(window->builder,
- "widgetvbox"));
+ gtk_window_set_transient_for(GTK_WINDOW(window->window),
+ nsgtk_scaffolding_window(g));
+
+ window->widgetvbox = GTK_WIDGET(gtk_builder_get_object(
+ window->builder, "widgetvbox"));
if (window->widgetvbox == NULL) {
nsgtk_warning(messages_get("NoMemory"), 0);
nsgtk_toolbar_cancel_clicked(NULL, g);
@@ -1135,9 +1151,12 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g)
return;
}
- window->numberh = NSGTK_STORE_WIDTH; /* preset to width [in buttons] of */
+ /* preset to width [in buttons] of */
+ window->numberh = NSGTK_STORE_WIDTH;
+
/* store to cause creation of a new toolbar */
window->currentbutton = -1;
+
/* load toolbuttons */
/* add toolbuttons to window */
/* set event handlers */
@@ -1157,33 +1176,20 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g)
}
free(theme);
- gtk_window_set_transient_for(GTK_WINDOW(window->window),
- nsgtk_scaffolding_window(g));
- gtk_window_set_title(GTK_WINDOW(window->window), messages_get(
- "gtkToolBarTitle"));
+
gtk_window_set_accept_focus(GTK_WINDOW(window->window), FALSE);
+
gtk_drag_dest_set(GTK_WIDGET(window->window), GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP, &entry, 1, GDK_ACTION_COPY);
- gtk_widget_show_all(window->window);
- gtk_window_set_position(GTK_WINDOW(window->window),
- GTK_WIN_POS_CENTER_ON_PARENT);
- gtk_window_get_position(nsgtk_scaffolding_window(g), &x, &y);
- gtk_window_move(GTK_WINDOW(window->window), x, y + 100);
-
- g_signal_connect(GTK_WIDGET(gtk_builder_get_object(window->builder,
- "cancelbutton")),
- "clicked",
- G_CALLBACK(nsgtk_toolbar_cancel_clicked),
- g);
- g_signal_connect(GTK_WIDGET(gtk_builder_get_object(window->builder,
- "okbutton")),
+ g_signal_connect(GTK_WIDGET(gtk_builder_get_object(
+ window->builder, "close")),
"clicked",
G_CALLBACK(nsgtk_toolbar_persist),
g);
- g_signal_connect(GTK_WIDGET(gtk_builder_get_object(window->builder,
- "resetbutton")),
+ g_signal_connect(GTK_WIDGET(gtk_builder_get_object(
+ window->builder, "reset")),
"clicked",
G_CALLBACK(nsgtk_toolbar_reset),
g);
@@ -1196,6 +1202,8 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g)
g_signal_connect(window->window, "drag-motion",
G_CALLBACK(nsgtk_toolbar_store_action), g);
+
+ gtk_widget_show_all(window->window);
}
/**
@@ -1339,33 +1347,37 @@ nsgtk_toolbar_set_handler(struct nsgtk_scaffolding *g, nsgtk_toolbar_button i)
case URL_BAR_ITEM:
nsgtk_scaffolding_update_url_bar_ref(g);
g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_urlbar(g)),
- "activate", G_CALLBACK(
- nsgtk_window_url_activate_event), g);
+ "activate", G_CALLBACK(
+ nsgtk_window_url_activate_event), g);
g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_urlbar(g)),
- "changed", G_CALLBACK(
- nsgtk_window_url_changed), g);
+ "changed", G_CALLBACK(
+ nsgtk_window_url_changed), g);
break;
+
case THROBBER_ITEM:
nsgtk_scaffolding_update_throbber_ref(g);
break;
+
case WEBSEARCH_ITEM:
nsgtk_scaffolding_update_websearch_ref(g);
g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_websearch(g)),
- "activate", G_CALLBACK(
- nsgtk_websearch_activate), g);
+ "activate", G_CALLBACK(
+ nsgtk_websearch_activate), g);
g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_websearch(g)),
- "button-press-event", G_CALLBACK(
- nsgtk_websearch_clear), g);
+ "button-press-event", G_CALLBACK(
+ nsgtk_websearch_clear), g);
break;
+
default:
if ((nsgtk_scaffolding_button(g, i)->bhandler != NULL) &&
- (nsgtk_scaffolding_button(g, i)->button
- != NULL))
- g_signal_connect(nsgtk_scaffolding_button(g, i)->
- button, "clicked",
- G_CALLBACK(nsgtk_scaffolding_button(g,
- i)->bhandler), g);
- break;
+ (nsgtk_scaffolding_button(g, i)->button != NULL)) {
+ g_signal_connect(
+ nsgtk_scaffolding_button(g, i)->button,
+ "clicked",
+ G_CALLBACK(nsgtk_scaffolding_button(
+ g, i)->bhandler), g);
+ }
+ break;
}
}
@@ -1457,7 +1469,8 @@ DATAHANDLER(prevtab, PREVTAB, window)
DATAHANDLER(guide, GUIDE, window)
DATAHANDLER(info, INFO, window)
#undef DATAHANDLER
-#define DATAHANDLER(p, q, r)\
+
+#define DATAHANDLER(p, q, r) \
gboolean nsgtk_toolbar_##p##_button_data(GtkWidget *widget, GdkDragContext\
*cont, GtkSelectionData *selection, guint info, guint time,\
gpointer data)\
@@ -1478,5 +1491,3 @@ gboolean nsgtk_toolbar_##p##_toolbar_button_data(GtkWidget *widget,\
DATAHANDLER(throbber, THROBBER, window)
DATAHANDLER(websearch, WEBSEARCH, window)
#undef DATAHANDLER
-
-
diff --git a/frontends/gtk/viewdata.c b/frontends/gtk/viewdata.c
index 6ed9dd9ac..d633238d0 100644
--- a/frontends/gtk/viewdata.c
+++ b/frontends/gtk/viewdata.c
@@ -371,7 +371,7 @@ window_init(const char *title,
res = nsgtk_builder_new_from_resname("viewdata", &newctx->builder);
if (res != NSERROR_OK) {
- LOG("Viewdata UI builder init failed");
+ NSLOG(netsurf, INFO, "Viewdata UI builder init failed");
free(newctx);
return res;
}
@@ -381,7 +381,7 @@ window_init(const char *title,
window = GTK_WINDOW(gtk_builder_get_object(newctx->builder,
"ViewDataWindow"));
if (window == NULL) {
- LOG("Unable to find window in builder ");
+ NSLOG(netsurf, INFO, "Unable to find window in builder ");
/* free the builder */
g_object_unref(G_OBJECT(newctx->builder));
@@ -616,7 +616,7 @@ static char** xdg_data_strvec(void)
xdg_data_home, xdg_data_dirs);
}
- LOG("%s", xdg_data_path);
+ NSLOG(netsurf, INFO, "%s", xdg_data_path);
svec = filepath_path_to_strvec(xdg_data_path);
free(xdg_data_path);
@@ -651,7 +651,7 @@ static char *xdg_get_default_app(const char *path, const char *mimetype)
fname = malloc(fname_len);
snprintf(fname, fname_len, "%s/applications/defaults.list", path);
- LOG("Checking %s", fname);
+ NSLOG(netsurf, INFO, "Checking %s", fname);
fp = fopen(fname, "r");
free(fname);
@@ -674,8 +674,11 @@ static char *xdg_get_default_app(const char *path, const char *mimetype)
ret = strdup(line + mimetype_len + 1);
- LOG("Found line match for %s length %zu\n", mimetype, rd);
- LOG("Result %s", ret);
+ NSLOG(netsurf, INFO,
+ "Found line match for %s length %zu\n",
+ mimetype,
+ rd);
+ NSLOG(netsurf, INFO, "Result %s", ret);
break;
}
@@ -714,7 +717,7 @@ static char *xdg_get_exec_cmd(const char *path, const char *desktop)
fname = malloc(fname_len);
snprintf(fname, fname_len, "%s/applications/%s", path, desktop);
- LOG("Checking %s", fname);
+ NSLOG(netsurf, INFO, "Checking %s", fname);
fp = fopen(fname, "r");
free(fname);
@@ -735,8 +738,8 @@ static char *xdg_get_exec_cmd(const char *path, const char *desktop)
ret = strdup(line + SLEN("Exec="));
- LOG("Found Exec length %zu", rd);
- LOG("Result %s", ret);
+ NSLOG(netsurf, INFO, "Found Exec length %zu", rd);
+ NSLOG(netsurf, INFO, "Result %s", ret);
break;
}
@@ -801,7 +804,7 @@ static char **build_exec_argv(const char *fname, const char *exec_cmd)
argv[aidx] = exec_arg(start, cur - start, fname);
if (argv[aidx] != NULL) {
- LOG("adding \"%s\"", argv[aidx]);
+ NSLOG(netsurf, INFO, "adding \"%s\"", argv[aidx]);
aidx++;
}
}
diff --git a/frontends/gtk/viewsource.c b/frontends/gtk/viewsource.c
index acf81018d..87ff6976a 100644
--- a/frontends/gtk/viewsource.c
+++ b/frontends/gtk/viewsource.c
@@ -52,7 +52,7 @@ nserror nsgtk_viewsource(GtkWindow *parent, struct browser_window *bw)
source_data = content_get_source_data(hlcontent, &source_size);
- ret = nsurl_nice(browser_window_get_url(bw), &filename, false);
+ ret = nsurl_nice(browser_window_access_url(bw), &filename, false);
if (ret != NSERROR_OK) {
filename = strdup(messages_get("SaveSource"));
if (filename == NULL) {
@@ -60,12 +60,12 @@ nserror nsgtk_viewsource(GtkWindow *parent, struct browser_window *bw)
}
}
- title = malloc(strlen(nsurl_access(browser_window_get_url(bw))) + SLEN("Source of - NetSurf") + 1);
+ title = malloc(strlen(nsurl_access(browser_window_access_url(bw))) + SLEN("Source of - NetSurf") + 1);
if (title == NULL) {
free(filename);
return NSERROR_NOMEM;
}
- sprintf(title, "Source of %s - NetSurf", nsurl_access(browser_window_get_url(bw)));
+ sprintf(title, "Source of %s - NetSurf", nsurl_access(browser_window_access_url(bw)));
ret = utf8_from_enc(source_data,
content_get_encoding(hlcontent, CONTENT_ENCODING_NORMAL),
diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c
index 326e57395..7f24d40ac 100644
--- a/frontends/gtk/window.c
+++ b/frontends/gtk/window.c
@@ -42,7 +42,6 @@
#include "netsurf/plotters.h"
#include "netsurf/form.h"
#include "netsurf/keypress.h"
-#include "desktop/textarea.h"
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
@@ -52,6 +51,7 @@
#include "gtk/compat.h"
#include "gtk/gui.h"
#include "gtk/scaffolding.h"
+#include "gtk/local_history.h"
#include "gtk/plotters.h"
#include "gtk/schedule.h"
#include "gtk/tabs.h"
@@ -211,7 +211,6 @@ nsgtk_window_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data)
assert(z);
assert(GTK_WIDGET(gw->layout) == widget);
- current_widget = (GtkWidget *)gw->layout;
current_cr = cr;
GtkAdjustment *vscroll = nsgtk_layout_get_vadjustment(gw->layout);
@@ -234,8 +233,6 @@ nsgtk_window_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data)
nsgtk_plot_caret(gw->caretx, gw->carety, gw->careth);
}
- current_widget = NULL;
-
return FALSE;
}
@@ -261,7 +258,6 @@ nsgtk_window_draw_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
assert(z);
assert(GTK_WIDGET(gw->layout) == widget);
- current_widget = (GtkWidget *)gw->layout;
current_cr = gdk_cairo_create(nsgtk_layout_get_bin_window(gw->layout));
clip.x0 = event->area.x;
@@ -277,8 +273,6 @@ nsgtk_window_draw_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
cairo_destroy(current_cr);
- current_widget = NULL;
-
return FALSE;
}
@@ -345,8 +339,7 @@ static gboolean nsgtk_window_button_press_event(GtkWidget *widget,
gtk_im_context_reset(g->input_method);
gtk_widget_grab_focus(GTK_WIDGET(g->layout));
- gtk_widget_hide(GTK_WIDGET(nsgtk_scaffolding_history_window(
- g->scaffold)->window));
+ nsgtk_local_history_hide();
g->mouse.pressed_x = event->x / browser_window_get_scale(g->bw);
g->mouse.pressed_y = event->y / browser_window_get_scale(g->bw);
@@ -361,6 +354,7 @@ static gboolean nsgtk_window_button_press_event(GtkWidget *widget,
break;
case 3: /* Right button, usually. Action button, context menu. */
+ /** \todo determine if hiding the caret here is necessary */
browser_window_remove_caret(g->bw, true);
nsgtk_scaffolding_context_menu(g->scaffold,
g->mouse.pressed_x,
@@ -464,7 +458,7 @@ nsgtk_window_scroll_event(GtkWidget *widget,
break;
#endif
default:
- LOG("Unhandled mouse scroll direction");
+ NSLOG(netsurf, INFO, "Unhandled mouse scroll direction");
return TRUE;
}
@@ -747,7 +741,7 @@ gui_window_create(struct browser_window *bw,
res = nsgtk_builder_new_from_resname("tabcontents", &tab_builder);
if (res != NSERROR_OK) {
- LOG("Tab contents UI builder init failed");
+ NSLOG(netsurf, INFO, "Tab contents UI builder init failed");
return NULL;
}
@@ -760,7 +754,8 @@ gui_window_create(struct browser_window *bw,
return NULL;
}
- LOG("Creating gui window %p for browser window %p", g, bw);
+ NSLOG(netsurf, INFO, "Creating gui window %p for browser window %p",
+ g, bw);
g->bw = bw;
g->mouse.state = 0;
@@ -901,21 +896,6 @@ void nsgtk_reflow_all_windows(void)
}
-/**
- * callback from core to reformat a window.
- */
-static void nsgtk_window_reformat(struct gui_window *gw)
-{
- GtkAllocation alloc;
-
- if (gw != NULL) {
- /** @todo consider gtk_widget_get_allocated_width() */
- nsgtk_widget_get_allocation(GTK_WIDGET(gw->layout), &alloc);
-
- browser_window_reformat(gw->bw, false, alloc.width, alloc.height);
- }
-}
-
void nsgtk_window_destroy_browser(struct gui_window *gw)
{
/* remove tab */
@@ -924,10 +904,10 @@ void nsgtk_window_destroy_browser(struct gui_window *gw)
static void gui_window_destroy(struct gui_window *g)
{
- LOG("gui_window: %p", g);
+ NSLOG(netsurf, INFO, "gui_window: %p", g);
assert(g != NULL);
assert(g->bw != NULL);
- LOG("scaffolding: %p", g->scaffold);
+ NSLOG(netsurf, INFO, "scaffolding: %p", g->scaffold);
if (g->prev) {
g->prev->next = g->next;
@@ -939,7 +919,7 @@ static void gui_window_destroy(struct gui_window *g)
g->next->prev = g->prev;
}
- LOG("window list head: %p", window_list);
+ NSLOG(netsurf, INFO, "window list head: %p", window_list);
}
/**
@@ -961,13 +941,13 @@ static void gui_window_set_icon(struct gui_window *gw, struct hlcache_handle *ic
if (icon != NULL) {
icon_bitmap = content_get_bitmap(icon);
if (icon_bitmap != NULL) {
- LOG("Using %p bitmap", icon_bitmap);
+ NSLOG(netsurf, INFO, "Using %p bitmap", icon_bitmap);
gw->icon = nsgdk_pixbuf_get_from_surface(icon_bitmap->surface, 16, 16);
}
}
if (gw->icon == NULL) {
- LOG("Using default favicon");
+ NSLOG(netsurf, INFO, "Using default favicon");
g_object_ref(favicon_pixbuf);
gw->icon = favicon_pixbuf;
}
@@ -1020,27 +1000,38 @@ static void gui_window_remove_caret(struct gui_window *g)
}
-static void gui_window_redraw_window(struct gui_window *g)
-{
- gtk_widget_queue_draw(GTK_WIDGET(g->layout));
-}
-
-static void gui_window_update_box(struct gui_window *g, const struct rect *rect)
+/**
+ * Invalidates an area of a GTK browser window
+ *
+ * \param g gui_window
+ * \param rect area to redraw or NULL for the entire window area
+ * \return NSERROR_OK on success or appropriate error code
+ */
+static nserror
+nsgtk_window_invalidate_area(struct gui_window *g, const struct rect *rect)
{
int sx, sy;
float scale;
- if (!browser_window_has_content(g->bw))
- return;
+ if (rect == NULL) {
+ gtk_widget_queue_draw(GTK_WIDGET(g->layout));
+ return NSERROR_OK;
+ }
+
+ if (!browser_window_has_content(g->bw)) {
+ return NSERROR_OK;
+ }
gui_window_get_scroll(g, &sx, &sy);
scale = browser_window_get_scale(g->bw);
gtk_widget_queue_draw_area(GTK_WIDGET(g->layout),
- rect->x0 * scale - sx,
- rect->y0 * scale - sy,
- (rect->x1 - rect->x0) * scale,
- (rect->y1 - rect->y0) * scale);
+ rect->x0 * scale - sx,
+ rect->y0 * scale - sy,
+ (rect->x1 - rect->x0) * scale,
+ (rect->y1 - rect->y0) * scale);
+
+ return NSERROR_OK;
}
static void gui_window_set_status(struct gui_window *g, const char *text)
@@ -1051,11 +1042,25 @@ static void gui_window_set_status(struct gui_window *g, const char *text)
}
-static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
+/**
+ * Set the scroll position of a gtk browser window.
+ *
+ * Scrolls the viewport to ensure the specified rectangle of the
+ * content is shown. The GTK implementation scrolls the contents so
+ * the specified point in the content is at the top of the viewport.
+ *
+ * \param g gui window to scroll
+ * \param rect The rectangle to ensure is shown.
+ * \return NSERROR_OK on success or apropriate error code.
+ */
+static nserror
+gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
{
GtkAdjustment *vadj = nsgtk_layout_get_vadjustment(g->layout);
GtkAdjustment *hadj = nsgtk_layout_get_hadjustment(g->layout);
- gdouble vlower, vpage, vupper, hlower, hpage, hupper, x = (double)sx, y = (double)sy;
+ gdouble vlower, vpage, vupper, hlower, hpage, hupper;
+ gdouble x = (gdouble)rect->x0;
+ gdouble y = (gdouble)rect->y0;
assert(vadj);
assert(hadj);
@@ -1063,17 +1068,23 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
g_object_get(vadj, "page-size", &vpage, "lower", &vlower, "upper", &vupper, NULL);
g_object_get(hadj, "page-size", &hpage, "lower", &hlower, "upper", &hupper, NULL);
- if (x < hlower)
+ if (x < hlower) {
x = hlower;
- if (x > (hupper - hpage))
+ }
+ if (x > (hupper - hpage)) {
x = hupper - hpage;
- if (y < vlower)
+ }
+ if (y < vlower) {
y = vlower;
- if (y > (vupper - vpage))
+ }
+ if (y > (vupper - vpage)) {
y = vupper - vpage;
+ }
gtk_adjustment_set_value(vadj, y);
gtk_adjustment_set_value(hadj, x);
+
+ return NSERROR_OK;
}
static void gui_window_update_extent(struct gui_window *g)
@@ -1198,24 +1209,37 @@ static void gui_window_place_caret(struct gui_window *g, int x, int y, int heigh
}
-static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
- bool scaled)
+/**
+ * Find the current dimensions of a GTK browser window content area.
+ *
+ * \param gw The gui window to measure content area of.
+ * \param width receives width of window
+ * \param height receives height of window
+ * \param scaled whether to return scaled values
+ * \return NSERROR_OK on sucess and width and height updated
+ * else error code.
+ */
+static nserror
+gui_window_get_dimensions(struct gui_window *gw,
+ int *width, int *height,
+ bool scaled)
{
GtkAllocation alloc;
- /* @todo consider gtk_widget_get_allocated_width() */
- nsgtk_widget_get_allocation(GTK_WIDGET(g->layout), &alloc);
+ /** @todo consider gtk_widget_get_allocated_width() */
+ nsgtk_widget_get_allocation(GTK_WIDGET(gw->layout), &alloc);
*width = alloc.width;
*height = alloc.height;
if (scaled) {
- float scale = browser_window_get_scale(g->bw);
+ float scale = browser_window_get_scale(gw->bw);
*width /= scale;
*height /= scale;
}
- LOG("width: %i", *width);
- LOG("height: %i", *height);
+ NSLOG(netsurf, INFO, "gw:%p width:%i height:%i", gw, *width, *height);
+
+ return NSERROR_OK;
}
static void gui_window_start_selection(struct gui_window *g)
@@ -1246,8 +1270,8 @@ static void gui_window_create_form_select_menu(struct gui_window *g,
item = 0;
option = form_select_get_option(control, item);
while (option != NULL) {
- LOG("Item %"PRIdPTR" option %p text %s",
- item, option, option->text);
+ NSLOG(netsurf, INFO, "Item %"PRIdPTR" option %p text %s",
+ item, option, option->text);
menu_item = gtk_check_menu_item_new_with_label(option->text);
if (option->selected) {
gtk_check_menu_item_set_active(
@@ -1290,10 +1314,10 @@ gui_window_file_gadget_open(struct gui_window *g,
NSGTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
- LOG("*** open dialog: %p", dialog);
+ NSLOG(netsurf, INFO, "*** open dialog: %p", dialog);
int ret = gtk_dialog_run(GTK_DIALOG(dialog));
- LOG("*** return value: %d", ret);
+ NSLOG(netsurf, INFO, "*** return value: %d", ret);
if (ret == GTK_RESPONSE_ACCEPT) {
char *filename;
@@ -1301,7 +1325,7 @@ gui_window_file_gadget_open(struct gui_window *g,
GTK_FILE_CHOOSER(dialog));
browser_window_set_gadget_filename(g->bw, gadget, filename);
-
+
g_free(filename);
}
@@ -1311,13 +1335,11 @@ gui_window_file_gadget_open(struct gui_window *g,
static struct gui_window_table window_table = {
.create = gui_window_create,
.destroy = gui_window_destroy,
- .redraw = gui_window_redraw_window,
- .update = gui_window_update_box,
+ .invalidate = nsgtk_window_invalidate_area,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
- .reformat = nsgtk_window_reformat,
.set_icon = gui_window_set_icon,
.set_status = gui_window_set_status,
diff --git a/frontends/monkey/401login.c b/frontends/monkey/401login.c
index 8b4d33d7d..090f18984 100644
--- a/frontends/monkey/401login.c
+++ b/frontends/monkey/401login.c
@@ -24,11 +24,11 @@
#include "monkey/401login.h"
typedef struct monkey401 {
- struct monkey401 *r_next, *r_prev;
- uint32_t num;
- lwc_string *host; /* Ignore */
- nserror (*cb)(bool,void*);
- void *pw;
+ struct monkey401 *r_next, *r_prev;
+ uint32_t num;
+ lwc_string *host; /* Ignore */
+ nserror (*cb)(bool,void*);
+ void *pw;
} monkey401_t;
static monkey401_t *m4_ring = NULL;
@@ -37,19 +37,19 @@ static uint32_t m4_ctr = 0;
void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
- monkey401_t *m4t = calloc(sizeof(*m4t), 1);
- if (m4t == NULL) {
- cb(false, cbpw);
- return;
- }
- m4t->cb = cb;
- m4t->pw = cbpw;
- m4t->num = m4_ctr++;
+ monkey401_t *m4t = calloc(sizeof(*m4t), 1);
+ if (m4t == NULL) {
+ cb(false, cbpw);
+ return;
+ }
+ m4t->cb = cb;
+ m4t->pw = cbpw;
+ m4t->num = m4_ctr++;
- RING_INSERT(m4_ring, m4t);
+ RING_INSERT(m4_ring, m4t);
- fprintf(stdout, "401LOGIN OPEN M4 %u URL %s REALM %s\n",
- m4t->num, nsurl_access(url), realm);
+ fprintf(stdout, "401LOGIN OPEN M4 %u URL %s REALM %s\n",
+ m4t->num, nsurl_access(url), realm);
}
diff --git a/frontends/monkey/bitmap.c b/frontends/monkey/bitmap.c
index 3313e1123..83b8566b6 100644
--- a/frontends/monkey/bitmap.c
+++ b/frontends/monkey/bitmap.c
@@ -26,125 +26,125 @@
#include "monkey/bitmap.h"
struct bitmap {
- void *ptr;
- size_t rowstride;
- int width;
- int height;
- unsigned int state;
+ void *ptr;
+ size_t rowstride;
+ int width;
+ int height;
+ unsigned int state;
};
static void *bitmap_create(int width, int height, unsigned int state)
{
- struct bitmap *ret = calloc(sizeof(*ret), 1);
- if (ret == NULL)
- return NULL;
+ struct bitmap *ret = calloc(sizeof(*ret), 1);
+ if (ret == NULL)
+ return NULL;
- ret->width = width;
- ret->height = height;
- ret->state = state;
+ ret->width = width;
+ ret->height = height;
+ ret->state = state;
- ret->ptr = calloc(width, height * 4);
+ ret->ptr = calloc(width, height * 4);
- if (ret->ptr == NULL) {
- free(ret);
- return NULL;
- }
+ if (ret->ptr == NULL) {
+ free(ret);
+ return NULL;
+ }
- return ret;
+ return ret;
}
static void bitmap_destroy(void *bitmap)
{
- struct bitmap *bmap = bitmap;
- free(bmap->ptr);
- free(bmap);
+ struct bitmap *bmap = bitmap;
+ free(bmap->ptr);
+ free(bmap);
}
static void bitmap_set_opaque(void *bitmap, bool opaque)
{
- struct bitmap *bmap = bitmap;
+ struct bitmap *bmap = bitmap;
- if (opaque)
- bmap->state |= (BITMAP_OPAQUE);
- else
- bmap->state &= ~(BITMAP_OPAQUE);
+ if (opaque)
+ bmap->state |= (BITMAP_OPAQUE);
+ else
+ bmap->state &= ~(BITMAP_OPAQUE);
}
static bool bitmap_test_opaque(void *bitmap)
{
- return false;
+ return false;
}
static bool bitmap_get_opaque(void *bitmap)
{
- struct bitmap *bmap = bitmap;
+ struct bitmap *bmap = bitmap;
- return (bmap->state & BITMAP_OPAQUE) == BITMAP_OPAQUE;
+ return (bmap->state & BITMAP_OPAQUE) == BITMAP_OPAQUE;
}
static unsigned char *bitmap_get_buffer(void *bitmap)
{
- struct bitmap *bmap = bitmap;
+ struct bitmap *bmap = bitmap;
- return (unsigned char *)(bmap->ptr);
+ return (unsigned char *)(bmap->ptr);
}
static size_t bitmap_get_rowstride(void *bitmap)
{
- struct bitmap *bmap = bitmap;
- return bmap->width * 4;
+ struct bitmap *bmap = bitmap;
+ return bmap->width * 4;
}
static size_t bitmap_get_bpp(void *bitmap)
{
- /* OMG?! */
- return 4;
+ /* OMG?! */
+ return 4;
}
static bool bitmap_save(void *bitmap, const char *path, unsigned flags)
{
- return true;
+ return true;
}
static void bitmap_modified(void *bitmap)
{
- struct bitmap *bmap = bitmap;
- bmap->state |= BITMAP_MODIFIED;
+ struct bitmap *bmap = bitmap;
+ bmap->state |= BITMAP_MODIFIED;
}
static int bitmap_get_width(void *bitmap)
{
- struct bitmap *bmap = bitmap;
- return bmap->width;
+ struct bitmap *bmap = bitmap;
+ return bmap->width;
}
static int bitmap_get_height(void *bitmap)
{
- struct bitmap *bmap = bitmap;
- return bmap->height;
+ struct bitmap *bmap = bitmap;
+ return bmap->height;
}
static nserror bitmap_render(struct bitmap *bitmap,
struct hlcache_handle *content)
{
- fprintf(stdout, "GENERIC BITMAP RENDER\n");
- return NSERROR_OK;
+ fprintf(stdout, "GENERIC BITMAP RENDER\n");
+ return NSERROR_OK;
}
static struct gui_bitmap_table bitmap_table = {
- .create = bitmap_create,
- .destroy = bitmap_destroy,
- .set_opaque = bitmap_set_opaque,
- .get_opaque = bitmap_get_opaque,
- .test_opaque = bitmap_test_opaque,
- .get_buffer = bitmap_get_buffer,
- .get_rowstride = bitmap_get_rowstride,
- .get_width = bitmap_get_width,
- .get_height = bitmap_get_height,
- .get_bpp = bitmap_get_bpp,
- .save = bitmap_save,
- .modified = bitmap_modified,
- .render = bitmap_render,
+ .create = bitmap_create,
+ .destroy = bitmap_destroy,
+ .set_opaque = bitmap_set_opaque,
+ .get_opaque = bitmap_get_opaque,
+ .test_opaque = bitmap_test_opaque,
+ .get_buffer = bitmap_get_buffer,
+ .get_rowstride = bitmap_get_rowstride,
+ .get_width = bitmap_get_width,
+ .get_height = bitmap_get_height,
+ .get_bpp = bitmap_get_bpp,
+ .save = bitmap_save,
+ .modified = bitmap_modified,
+ .render = bitmap_render,
};
struct gui_bitmap_table *monkey_bitmap_table = &bitmap_table;
diff --git a/frontends/monkey/browser.c b/frontends/monkey/browser.c
index 3bf0dd036..1fbbbf0b1 100644
--- a/frontends/monkey/browser.c
+++ b/frontends/monkey/browser.c
@@ -42,287 +42,306 @@ static struct gui_window *gw_ring = NULL;
/* exported function documented in monkey/browser.h */
nserror monkey_warn_user(const char *warning, const char *detail)
{
- fprintf(stderr, "WARN %s %s\n", warning, detail);
- return NSERROR_OK;
+ fprintf(stderr, "WARN %s %s\n", warning, detail);
+ return NSERROR_OK;
}
struct gui_window *
monkey_find_window_by_num(uint32_t win_num)
{
- struct gui_window *ret = NULL;
+ struct gui_window *ret = NULL;
- RING_ITERATE_START(struct gui_window, gw_ring, c_ring) {
- if (c_ring->win_num == win_num) {
- ret = c_ring;
- RING_ITERATE_STOP(gw_ring, c_ring);
- }
- } RING_ITERATE_END(gw_ring, c_ring);
+ RING_ITERATE_START(struct gui_window, gw_ring, c_ring) {
+ if (c_ring->win_num == win_num) {
+ ret = c_ring;
+ RING_ITERATE_STOP(gw_ring, c_ring);
+ }
+ } RING_ITERATE_END(gw_ring, c_ring);
- return ret;
-}
-
-
-/**
- * callback from core to reformat a window.
- */
-static void monkey_window_reformat(struct gui_window *gw)
-{
- browser_window_reformat(gw->bw, false, gw->width, gw->height);
+ return ret;
}
void
monkey_kill_browser_windows(void)
{
- while (gw_ring != NULL) {
- browser_window_destroy(gw_ring->bw);
- }
+ while (gw_ring != NULL) {
+ browser_window_destroy(gw_ring->bw);
+ }
}
static struct gui_window *
gui_window_create(struct browser_window *bw,
- struct gui_window *existing,
- gui_window_create_flags flags)
+ struct gui_window *existing,
+ gui_window_create_flags flags)
{
- struct gui_window *ret = calloc(sizeof(*ret), 1);
- if (ret == NULL)
- return NULL;
+ struct gui_window *ret = calloc(sizeof(*ret), 1);
+ if (ret == NULL)
+ return NULL;
- ret->win_num = win_ctr++;
- ret->bw = bw;
+ ret->win_num = win_ctr++;
+ ret->bw = bw;
- ret->width = 800;
- ret->height = 600;
+ ret->width = 800;
+ ret->height = 600;
- fprintf(stdout, "WINDOW NEW WIN %u FOR %p EXISTING %p NEWTAB %s CLONE %s\n",
- ret->win_num, bw, existing, flags & GW_CREATE_TAB ? "TRUE" : "FALSE",
- flags & GW_CREATE_CLONE ? "TRUE" : "FALSE");
- fprintf(stdout, "WINDOW SIZE WIN %u WIDTH %d HEIGHT %d\n",
- ret->win_num, ret->width, ret->height);
+ fprintf(stdout, "WINDOW NEW WIN %u FOR %p EXISTING %p NEWTAB %s CLONE %s\n",
+ ret->win_num, bw, existing, flags & GW_CREATE_TAB ? "TRUE" : "FALSE",
+ flags & GW_CREATE_CLONE ? "TRUE" : "FALSE");
+ fprintf(stdout, "WINDOW SIZE WIN %u WIDTH %d HEIGHT %d\n",
+ ret->win_num, ret->width, ret->height);
- RING_INSERT(gw_ring, ret);
+ RING_INSERT(gw_ring, ret);
- return ret;
+ return ret;
}
static void
gui_window_destroy(struct gui_window *g)
{
- fprintf(stdout, "WINDOW DESTROY WIN %u\n", g->win_num);
- RING_REMOVE(gw_ring, g);
- free(g);
+ fprintf(stdout, "WINDOW DESTROY WIN %u\n", g->win_num);
+ RING_REMOVE(gw_ring, g);
+ free(g);
}
static void
gui_window_set_title(struct gui_window *g, const char *title)
{
- fprintf(stdout, "WINDOW TITLE WIN %u STR %s\n", g->win_num, title);
-}
-
-static void
-gui_window_redraw_window(struct gui_window *g)
-{
- fprintf(stdout, "WINDOW REDRAW WIN %u\n", g->win_num);
+ fprintf(stdout, "WINDOW TITLE WIN %u STR %s\n", g->win_num, title);
}
-static void
+/**
+ * Find the current dimensions of a monkey browser window content area.
+ *
+ * \param g The gui window to measure content area of.
+ * \param width receives width of window
+ * \param height receives height of window
+ * \param scaled whether to return scaled values
+ * \return NSERROR_OK on sucess and width and height updated.
+ */
+static nserror
gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
bool scaled)
{
- fprintf(stdout, "WINDOW GET_DIMENSIONS WIN %u WIDTH %d HEIGHT %d\n",
- g->win_num, g->width, g->height);
- *width = g->width;
- *height = g->height;
+ fprintf(stdout, "WINDOW GET_DIMENSIONS WIN %u WIDTH %d HEIGHT %d\n",
+ g->win_num, g->width, g->height);
+ *width = g->width;
+ *height = g->height;
+
+ return NSERROR_OK;
}
static void
gui_window_new_content(struct gui_window *g)
{
- fprintf(stdout, "WINDOW NEW_CONTENT WIN %u\n", g->win_num);
+ fprintf(stdout, "WINDOW NEW_CONTENT WIN %u\n", g->win_num);
}
static void
gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
{
- fprintf(stdout, "WINDOW NEW_ICON WIN %u\n", g->win_num);
+ fprintf(stdout, "WINDOW NEW_ICON WIN %u\n", g->win_num);
}
static void
gui_window_start_throbber(struct gui_window *g)
{
- fprintf(stdout, "WINDOW START_THROBBER WIN %u\n", g->win_num);
+ fprintf(stdout, "WINDOW START_THROBBER WIN %u\n", g->win_num);
}
static void
gui_window_stop_throbber(struct gui_window *g)
{
- fprintf(stdout, "WINDOW STOP_THROBBER WIN %u\n", g->win_num);
+ fprintf(stdout, "WINDOW STOP_THROBBER WIN %u\n", g->win_num);
}
-static void
-gui_window_set_scroll(struct gui_window *g, int sx, int sy)
+
+/**
+ * Set the scroll position of a monkey browser window.
+ *
+ * Scrolls the viewport to ensure the specified rectangle of the
+ * content is shown.
+ *
+ * \param gw gui window to scroll
+ * \param rect The rectangle to ensure is shown.
+ * \return NSERROR_OK on success or apropriate error code.
+ */
+static nserror
+gui_window_set_scroll(struct gui_window *gw, const struct rect *rect)
{
- g->scrollx = sx;
- g->scrolly = sy;
- fprintf(stdout, "WINDOW SET_SCROLL WIN %u X %d Y %d\n", g->win_num, sx, sy);
+ gw->scrollx = rect->x0;
+ gw->scrolly = rect->y0;
+
+ fprintf(stdout, "WINDOW SET_SCROLL WIN %u X %d Y %d\n",
+ gw->win_num, rect->x0, rect->y0);
+ return NSERROR_OK;
}
-static void
-gui_window_update_box(struct gui_window *g, const struct rect *rect)
+
+/**
+ * Invalidates an area of a monkey browser window
+ *
+ * \param gw gui_window
+ * \param rect area to redraw or NULL for the entire window area
+ * \return NSERROR_OK on success or appropriate error code
+ */
+static nserror
+monkey_window_invalidate_area(struct gui_window *gw, const struct rect *rect)
{
- fprintf(stdout, "WINDOW UPDATE_BOX WIN %u X %d Y %d WIDTH %d HEIGHT %d\n",
- g->win_num, rect->x0, rect->y0,
- (rect->x1 - rect->x0), (rect->y1 - rect->y0));
-
+ fprintf(stdout, "WINDOW INVALIDATE_AREA WIN %u", gw->win_num);
+
+ if (rect != NULL) {
+ fprintf(stdout,
+ " X %d Y %d WIDTH %d HEIGHT %d\n",
+ rect->x0, rect->y0,
+ (rect->x1 - rect->x0), (rect->y1 - rect->y0));
+ } else {
+ fprintf(stdout," ALL\n");
+ }
+
+ return NSERROR_OK;
}
static void
gui_window_update_extent(struct gui_window *g)
{
- int width, height;
+ int width, height;
- if (browser_window_get_extents(g->bw, false, &width, &height) != NSERROR_OK)
- return;
+ if (browser_window_get_extents(g->bw, false, &width, &height) != NSERROR_OK)
+ return;
- fprintf(stdout, "WINDOW UPDATE_EXTENT WIN %u WIDTH %d HEIGHT %d\n",
- g->win_num, width, height);
+ fprintf(stdout, "WINDOW UPDATE_EXTENT WIN %u WIDTH %d HEIGHT %d\n",
+ g->win_num, width, height);
}
static void
gui_window_set_status(struct gui_window *g, const char *text)
{
- fprintf(stdout, "WINDOW SET_STATUS WIN %u STR %s\n", g->win_num, text);
+ fprintf(stdout, "WINDOW SET_STATUS WIN %u STR %s\n", g->win_num, text);
}
static void
gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
{
- const char *ptr_name = "UNKNOWN";
+ const char *ptr_name = "UNKNOWN";
- switch (shape) {
- case GUI_POINTER_POINT:
- ptr_name = "POINT";
- break;
- case GUI_POINTER_CARET:
- ptr_name = "CARET";
- break;
- case GUI_POINTER_UP:
- ptr_name = "UP";
- break;
- case GUI_POINTER_DOWN:
- ptr_name = "DOWN";
- break;
- case GUI_POINTER_LEFT:
- ptr_name = "LEFT";
- break;
- case GUI_POINTER_RIGHT:
- ptr_name = "RIGHT";
- break;
- case GUI_POINTER_LD:
- ptr_name = "LD";
- break;
- case GUI_POINTER_RD:
- ptr_name = "RD";
- break;
- case GUI_POINTER_LU:
- ptr_name = "LU";
- break;
- case GUI_POINTER_RU:
- ptr_name = "RU";
- break;
- case GUI_POINTER_CROSS:
- ptr_name = "CROSS";
- break;
- case GUI_POINTER_MOVE:
- ptr_name = "MOVE";
- break;
- case GUI_POINTER_WAIT:
- ptr_name = "WAIT";
- break;
- case GUI_POINTER_HELP:
- ptr_name = "HELP";
- break;
- case GUI_POINTER_MENU:
- ptr_name = "MENU";
- break;
- case GUI_POINTER_PROGRESS:
- ptr_name = "PROGRESS";
- break;
- case GUI_POINTER_NO_DROP:
- ptr_name = "NO_DROP";
- break;
- case GUI_POINTER_NOT_ALLOWED:
- ptr_name = "NOT_ALLOWED";
- break;
- case GUI_POINTER_DEFAULT:
- ptr_name = "DEFAULT";
- break;
- default:
- break;
- }
- fprintf(stdout, "WINDOW SET_POINTER WIN %u POINTER %s\n", g->win_num, ptr_name);
+ switch (shape) {
+ case GUI_POINTER_POINT:
+ ptr_name = "POINT";
+ break;
+ case GUI_POINTER_CARET:
+ ptr_name = "CARET";
+ break;
+ case GUI_POINTER_UP:
+ ptr_name = "UP";
+ break;
+ case GUI_POINTER_DOWN:
+ ptr_name = "DOWN";
+ break;
+ case GUI_POINTER_LEFT:
+ ptr_name = "LEFT";
+ break;
+ case GUI_POINTER_RIGHT:
+ ptr_name = "RIGHT";
+ break;
+ case GUI_POINTER_LD:
+ ptr_name = "LD";
+ break;
+ case GUI_POINTER_RD:
+ ptr_name = "RD";
+ break;
+ case GUI_POINTER_LU:
+ ptr_name = "LU";
+ break;
+ case GUI_POINTER_RU:
+ ptr_name = "RU";
+ break;
+ case GUI_POINTER_CROSS:
+ ptr_name = "CROSS";
+ break;
+ case GUI_POINTER_MOVE:
+ ptr_name = "MOVE";
+ break;
+ case GUI_POINTER_WAIT:
+ ptr_name = "WAIT";
+ break;
+ case GUI_POINTER_HELP:
+ ptr_name = "HELP";
+ break;
+ case GUI_POINTER_MENU:
+ ptr_name = "MENU";
+ break;
+ case GUI_POINTER_PROGRESS:
+ ptr_name = "PROGRESS";
+ break;
+ case GUI_POINTER_NO_DROP:
+ ptr_name = "NO_DROP";
+ break;
+ case GUI_POINTER_NOT_ALLOWED:
+ ptr_name = "NOT_ALLOWED";
+ break;
+ case GUI_POINTER_DEFAULT:
+ ptr_name = "DEFAULT";
+ break;
+ default:
+ break;
+ }
+ fprintf(stdout, "WINDOW SET_POINTER WIN %u POINTER %s\n", g->win_num, ptr_name);
}
static nserror
gui_window_set_url(struct gui_window *g, nsurl *url)
{
- fprintf(stdout, "WINDOW SET_URL WIN %u URL %s\n", g->win_num, nsurl_access(url));
- return NSERROR_OK;
+ fprintf(stdout, "WINDOW SET_URL WIN %u URL %s\n", g->win_num, nsurl_access(url));
+ return NSERROR_OK;
}
static bool
gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
{
- fprintf(stdout, "WINDOW GET_SCROLL WIN %u X %d Y %d\n",
- g->win_num, g->scrollx, g->scrolly);
- *sx = g->scrollx;
- *sy = g->scrolly;
- return true;
+ fprintf(stdout, "WINDOW GET_SCROLL WIN %u X %d Y %d\n",
+ g->win_num, g->scrollx, g->scrolly);
+ *sx = g->scrollx;
+ *sy = g->scrolly;
+ return true;
}
static bool
gui_window_scroll_start(struct gui_window *g)
{
- fprintf(stdout, "WINDOW SCROLL_START WIN %u\n", g->win_num);
- g->scrollx = g->scrolly = 0;
- return true;
+ fprintf(stdout, "WINDOW SCROLL_START WIN %u\n", g->win_num);
+ g->scrollx = g->scrolly = 0;
+ return true;
}
-static void
-gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
- int x1, int y1)
-{
- fprintf(stdout, "WINDOW SCROLL_VISIBLE WIN %u X0 %d Y0 %d X1 %d Y1 %d\n",
- g->win_num, x0, y0, x1, y1);
-}
static void
gui_window_place_caret(struct gui_window *g, int x, int y, int height,
- const struct rect *clip)
+ const struct rect *clip)
{
- fprintf(stdout, "WINDOW PLACE_CARET WIN %u X %d Y %d HEIGHT %d\n",
- g->win_num, x, y, height);
+ fprintf(stdout, "WINDOW PLACE_CARET WIN %u X %d Y %d HEIGHT %d\n",
+ g->win_num, x, y, height);
}
static void
gui_window_remove_caret(struct gui_window *g)
{
- fprintf(stdout, "WINDOW REMOVE_CARET WIN %u\n", g->win_num);
+ fprintf(stdout, "WINDOW REMOVE_CARET WIN %u\n", g->win_num);
}
static bool
gui_window_drag_start(struct gui_window *g, gui_drag_type type,
const struct rect *rect)
{
- fprintf(stdout, "WINDOW SCROLL_START WIN %u TYPE %i\n", g->win_num, type);
- return false;
+ fprintf(stdout, "WINDOW SCROLL_START WIN %u TYPE %i\n", g->win_num, type);
+ return false;
}
static nserror
gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
{
- fprintf(stdout, "WINDOW SAVE_LINK WIN %u URL %s TITLE %s\n",
- g->win_num, nsurl_access(url), title);
- return NSERROR_OK;
+ fprintf(stdout, "WINDOW SAVE_LINK WIN %u URL %s TITLE %s\n",
+ g->win_num, nsurl_access(url), title);
+ return NSERROR_OK;
}
@@ -332,182 +351,180 @@ gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
static void
monkey_window_handle_new(int argc, char **argv)
{
- nsurl *url = NULL;
- nserror error = NSERROR_OK;
-
- if (argc > 3)
- return;
-
- if (argc == 3) {
- error = nsurl_create(argv[2], &url);
- }
- if (error == NSERROR_OK) {
- error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
- if (url != NULL) {
- nsurl_unref(url);
- }
- }
- if (error != NSERROR_OK) {
- monkey_warn_user(messages_get_errorcode(error), 0);
- }
+ nsurl *url = NULL;
+ nserror error = NSERROR_OK;
+
+ if (argc > 3)
+ return;
+
+ if (argc == 3) {
+ error = nsurl_create(argv[2], &url);
+ }
+ if (error == NSERROR_OK) {
+ error = browser_window_create(BW_CREATE_HISTORY,
+ url,
+ NULL,
+ NULL,
+ NULL);
+ if (url != NULL) {
+ nsurl_unref(url);
+ }
+ }
+ if (error != NSERROR_OK) {
+ monkey_warn_user(messages_get_errorcode(error), 0);
+ }
}
static void
monkey_window_handle_destroy(int argc, char **argv)
{
- struct gui_window *gw;
- uint32_t nr = atoi((argc > 2) ? argv[2] : "-1");
+ struct gui_window *gw;
+ uint32_t nr = atoi((argc > 2) ? argv[2] : "-1");
- gw = monkey_find_window_by_num(nr);
+ gw = monkey_find_window_by_num(nr);
- if (gw == NULL) {
- fprintf(stdout, "ERROR WINDOW NUM BAD\n");
- } else {
- browser_window_destroy(gw->bw);
- }
+ if (gw == NULL) {
+ fprintf(stdout, "ERROR WINDOW NUM BAD\n");
+ } else {
+ browser_window_destroy(gw->bw);
+ }
}
static void
monkey_window_handle_go(int argc, char **argv)
{
- struct gui_window *gw;
- nsurl *url;
- nsurl *ref_url = NULL;
- nserror error;
+ struct gui_window *gw;
+ nsurl *url;
+ nsurl *ref_url = NULL;
+ nserror error;
- if (argc < 4 || argc > 5) {
- fprintf(stdout, "ERROR WINDOW GO ARGS BAD\n");
- return;
- }
+ if (argc < 4 || argc > 5) {
+ fprintf(stdout, "ERROR WINDOW GO ARGS BAD\n");
+ return;
+ }
- gw = monkey_find_window_by_num(atoi(argv[2]));
+ gw = monkey_find_window_by_num(atoi(argv[2]));
- if (gw == NULL) {
- fprintf(stdout, "ERROR WINDOW NUM BAD\n");
- return;
- }
-
- error = nsurl_create(argv[3], &url);
- if (error == NSERROR_OK) {
- if (argc == 5) {
- error = nsurl_create(argv[4], &ref_url);
- }
-
- if (error == NSERROR_OK) {
- error = browser_window_navigate(gw->bw,
- url,
- ref_url,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- if (ref_url != NULL) {
- nsurl_unref(ref_url);
- }
- }
- nsurl_unref(url);
- }
-
- if (error != NSERROR_OK) {
- monkey_warn_user(messages_get_errorcode(error), 0);
- }
+ if (gw == NULL) {
+ fprintf(stdout, "ERROR WINDOW NUM BAD\n");
+ return;
+ }
+
+ error = nsurl_create(argv[3], &url);
+ if (error == NSERROR_OK) {
+ if (argc == 5) {
+ error = nsurl_create(argv[4], &ref_url);
+ }
+
+ if (error == NSERROR_OK) {
+ error = browser_window_navigate(gw->bw,
+ url,
+ ref_url,
+ BW_NAVIGATE_HISTORY,
+ NULL,
+ NULL,
+ NULL);
+ if (ref_url != NULL) {
+ nsurl_unref(ref_url);
+ }
+ }
+ nsurl_unref(url);
+ }
+
+ if (error != NSERROR_OK) {
+ monkey_warn_user(messages_get_errorcode(error), 0);
+ }
}
static void
monkey_window_handle_redraw(int argc, char **argv)
{
- struct gui_window *gw;
- struct rect clip;
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = monkey_plotters
- };
+ struct gui_window *gw;
+ struct rect clip;
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = monkey_plotters
+ };
- if (argc != 3 && argc != 7) {
- fprintf(stdout, "ERROR WINDOW REDRAW ARGS BAD\n");
- return;
- }
+ if (argc != 3 && argc != 7) {
+ fprintf(stdout, "ERROR WINDOW REDRAW ARGS BAD\n");
+ return;
+ }
- gw = monkey_find_window_by_num(atoi(argv[2]));
+ gw = monkey_find_window_by_num(atoi(argv[2]));
- if (gw == NULL) {
- fprintf(stdout, "ERROR WINDOW NUM BAD\n");
- return;
- }
+ if (gw == NULL) {
+ fprintf(stdout, "ERROR WINDOW NUM BAD\n");
+ return;
+ }
- clip.x0 = 0;
- clip.y0 = 0;
- clip.x1 = gw->width;
- clip.y1 = gw->height;
+ clip.x0 = 0;
+ clip.y0 = 0;
+ clip.x1 = gw->width;
+ clip.y1 = gw->height;
- if (argc == 7) {
- clip.x0 = atoi(argv[3]);
- clip.y0 = atoi(argv[4]);
- clip.x1 = atoi(argv[5]);
- clip.y1 = atoi(argv[6]);
- }
+ if (argc == 7) {
+ clip.x0 = atoi(argv[3]);
+ clip.y0 = atoi(argv[4]);
+ clip.x1 = atoi(argv[5]);
+ clip.y1 = atoi(argv[6]);
+ }
- LOG("Issue redraw");
- fprintf(stdout, "WINDOW REDRAW WIN %d START\n", atoi(argv[2]));
- browser_window_redraw(gw->bw, gw->scrollx, gw->scrolly, &clip, &ctx);
- fprintf(stdout, "WINDOW REDRAW WIN %d STOP\n", atoi(argv[2]));
+ NSLOG(netsurf, INFO, "Issue redraw");
+ fprintf(stdout, "WINDOW REDRAW WIN %d START\n", atoi(argv[2]));
+ browser_window_redraw(gw->bw, gw->scrollx, gw->scrolly, &clip, &ctx);
+ fprintf(stdout, "WINDOW REDRAW WIN %d STOP\n", atoi(argv[2]));
}
static void
monkey_window_handle_reload(int argc, char **argv)
{
- struct gui_window *gw;
- if (argc != 3 && argc != 4) {
- fprintf(stdout, "ERROR WINDOW RELOAD ARGS BAD\n");
- }
+ struct gui_window *gw;
+ if (argc != 3 && argc != 4) {
+ fprintf(stdout, "ERROR WINDOW RELOAD ARGS BAD\n");
+ }
- gw = monkey_find_window_by_num(atoi(argv[2]));
+ gw = monkey_find_window_by_num(atoi(argv[2]));
- if (gw == NULL) {
- fprintf(stdout, "ERROR WINDOW NUM BAD\n");
- } else {
- browser_window_reload(gw->bw, argc == 4);
- }
+ if (gw == NULL) {
+ fprintf(stdout, "ERROR WINDOW NUM BAD\n");
+ } else {
+ browser_window_reload(gw->bw, argc == 4);
+ }
}
void
monkey_window_handle_command(int argc, char **argv)
{
- if (argc == 1)
- return;
+ if (argc == 1)
+ return;
- if (strcmp(argv[1], "NEW") == 0) {
- monkey_window_handle_new(argc, argv);
- } else if (strcmp(argv[1], "DESTROY") == 0) {
- monkey_window_handle_destroy(argc, argv);
- } else if (strcmp(argv[1], "GO") == 0) {
- monkey_window_handle_go(argc, argv);
- } else if (strcmp(argv[1], "REDRAW") == 0) {
- monkey_window_handle_redraw(argc, argv);
- } else if (strcmp(argv[1], "RELOAD") == 0) {
- monkey_window_handle_reload(argc, argv);
- } else {
- fprintf(stdout, "ERROR WINDOW COMMAND UNKNOWN %s\n", argv[1]);
- }
+ if (strcmp(argv[1], "NEW") == 0) {
+ monkey_window_handle_new(argc, argv);
+ } else if (strcmp(argv[1], "DESTROY") == 0) {
+ monkey_window_handle_destroy(argc, argv);
+ } else if (strcmp(argv[1], "GO") == 0) {
+ monkey_window_handle_go(argc, argv);
+ } else if (strcmp(argv[1], "REDRAW") == 0) {
+ monkey_window_handle_redraw(argc, argv);
+ } else if (strcmp(argv[1], "RELOAD") == 0) {
+ monkey_window_handle_reload(argc, argv);
+ } else {
+ fprintf(stdout, "ERROR WINDOW COMMAND UNKNOWN %s\n", argv[1]);
+ }
}
static struct gui_window_table window_table = {
.create = gui_window_create,
.destroy = gui_window_destroy,
- .redraw = gui_window_redraw_window,
- .update = gui_window_update_box,
+ .invalidate = monkey_window_invalidate_area,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.update_extent = gui_window_update_extent,
- .reformat = monkey_window_reformat,
.set_title = gui_window_set_title,
.set_url = gui_window_set_url,
@@ -518,7 +535,6 @@ static struct gui_window_table window_table = {
.remove_caret = gui_window_remove_caret,
.drag_start = gui_window_drag_start,
.save_link = gui_window_save_link,
- .scroll_visible = gui_window_scroll_visible,
.scroll_start = gui_window_scroll_start,
.new_content = gui_window_new_content,
.start_throbber = gui_window_start_throbber,
diff --git a/frontends/monkey/browser.h b/frontends/monkey/browser.h
index 2b0340211..8cbbb947d 100644
--- a/frontends/monkey/browser.h
+++ b/frontends/monkey/browser.h
@@ -25,16 +25,16 @@ extern struct gui_window_table *monkey_window_table;
extern struct gui_download_table *monkey_download_table;
struct gui_window {
- struct gui_window *r_next;
- struct gui_window *r_prev;
+ struct gui_window *r_next;
+ struct gui_window *r_prev;
- uint32_t win_num;
- struct browser_window *bw;
+ uint32_t win_num;
+ struct browser_window *bw;
- int width, height;
- int scrollx, scrolly;
+ int width, height;
+ int scrollx, scrolly;
- char *host; /* Ignore this, it's in case RING*() gets debugging for fetchers */
+ char *host; /* Ignore this, it's in case RING*() gets debugging for fetchers */
};
diff --git a/frontends/monkey/cert.c b/frontends/monkey/cert.c
index 710e71098..a19975527 100644
--- a/frontends/monkey/cert.c
+++ b/frontends/monkey/cert.c
@@ -25,11 +25,11 @@
#include "monkey/cert.h"
typedef struct monkey_cert {
- struct monkey_cert *r_next, *r_prev;
- uint32_t num;
- char *host; /* Ignore */
- nserror (*cb)(bool,void*);
- void *pw;
+ struct monkey_cert *r_next, *r_prev;
+ uint32_t num;
+ char *host; /* Ignore */
+ nserror (*cb)(bool,void*);
+ void *pw;
} monkey_cert_t;
static monkey_cert_t *cert_ring = NULL;
@@ -40,20 +40,20 @@ gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
unsigned long num, nserror (*cb)(bool proceed, void *pw),
void *cbpw)
{
- monkey_cert_t *m4t = calloc(sizeof(*m4t), 1);
- if (m4t == NULL) {
- return NSERROR_NOMEM;
- }
- m4t->cb = cb;
- m4t->pw = cbpw;
- m4t->num = cert_ctr++;
+ monkey_cert_t *m4t = calloc(sizeof(*m4t), 1);
+ if (m4t == NULL) {
+ return NSERROR_NOMEM;
+ }
+ m4t->cb = cb;
+ m4t->pw = cbpw;
+ m4t->num = cert_ctr++;
- RING_INSERT(cert_ring, m4t);
+ RING_INSERT(cert_ring, m4t);
- fprintf(stdout, "SSLCERT VERIFY CERT %u URL %s\n",
- m4t->num, nsurl_access(url));
+ fprintf(stdout, "SSLCERT VERIFY CERT %u URL %s\n",
+ m4t->num, nsurl_access(url));
- return NSERROR_OK;
+ return NSERROR_OK;
}
diff --git a/frontends/monkey/dispatch.c b/frontends/monkey/dispatch.c
index 563534d64..e60325cf1 100644
--- a/frontends/monkey/dispatch.c
+++ b/frontends/monkey/dispatch.c
@@ -28,9 +28,9 @@
#include "monkey/dispatch.h"
typedef struct cmdhandler {
- struct cmdhandler *r_next, *r_prev;
- const char *cmd;
- handle_command_fn fn;
+ struct cmdhandler *r_next, *r_prev;
+ const char *cmd;
+ handle_command_fn fn;
} monkey_cmdhandler_t;
static monkey_cmdhandler_t *handler_ring = NULL;
@@ -38,68 +38,68 @@ static monkey_cmdhandler_t *handler_ring = NULL;
nserror
monkey_register_handler(const char *cmd, handle_command_fn fn)
{
- monkey_cmdhandler_t *ret = calloc(sizeof(*ret), 1);
- if (ret == NULL) {
- LOG("Unable to allocate handler");
- return NSERROR_NOMEM;
- }
- ret->cmd = strdup(cmd);
- ret->fn = fn;
- RING_INSERT(handler_ring, ret);
- return NSERROR_OK;
+ monkey_cmdhandler_t *ret = calloc(sizeof(*ret), 1);
+ if (ret == NULL) {
+ NSLOG(netsurf, INFO, "Unable to allocate handler");
+ return NSERROR_NOMEM;
+ }
+ ret->cmd = strdup(cmd);
+ ret->fn = fn;
+ RING_INSERT(handler_ring, ret);
+ return NSERROR_OK;
}
void
monkey_process_command(void)
{
- char buffer[PATH_MAX];
- int argc = 0;
- char **argv = NULL;
- char *p, *r = NULL;
- handle_command_fn fn = NULL;
- char **nargv;
+ char buffer[PATH_MAX];
+ int argc = 0;
+ char **argv = NULL;
+ char *p, *r = NULL;
+ handle_command_fn fn = NULL;
+ char **nargv;
- if (fgets(buffer, PATH_MAX, stdin) == NULL) {
- /* end of input or read error so issue QUIT */
- sprintf(buffer, "QUIT\n");
- }
+ if (fgets(buffer, PATH_MAX, stdin) == NULL) {
+ /* end of input or read error so issue QUIT */
+ sprintf(buffer, "QUIT\n");
+ }
- /* remove newline */
- buffer[strlen(buffer) - 1] = '\0';
+ /* remove newline */
+ buffer[strlen(buffer) - 1] = '\0';
- argv = malloc(sizeof *argv);
- if (argv == NULL) {
- return;
- }
- argc = 1;
- *argv = buffer;
+ argv = malloc(sizeof *argv);
+ if (argv == NULL) {
+ return;
+ }
+ argc = 1;
+ *argv = buffer;
- for (p = r = buffer; *p != '\0'; p++) {
- if (*p == ' ') {
- nargv = realloc(argv, sizeof(*argv) * (argc + 1));
- if (nargv == NULL) {
- /* reallocation of argument vector failed, try using what is
- * already processed.
- */
- break;
- } else {
- argv = nargv;
- }
- argv[argc++] = r = p + 1;
- *p = '\0';
- }
- }
+ for (p = r = buffer; *p != '\0'; p++) {
+ if (*p == ' ') {
+ nargv = realloc(argv, sizeof(*argv) * (argc + 1));
+ if (nargv == NULL) {
+ /* reallocation of argument vector failed, try using what is
+ * already processed.
+ */
+ break;
+ } else {
+ argv = nargv;
+ }
+ argv[argc++] = r = p + 1;
+ *p = '\0';
+ }
+ }
- RING_ITERATE_START(monkey_cmdhandler_t, handler_ring, handler) {
- if (strcmp(argv[0], handler->cmd) == 0) {
- fn = handler->fn;
- RING_ITERATE_STOP(handler_ring, handler);
- }
- } RING_ITERATE_END(handler_ring, handler);
+ RING_ITERATE_START(monkey_cmdhandler_t, handler_ring, handler) {
+ if (strcmp(argv[0], handler->cmd) == 0) {
+ fn = handler->fn;
+ RING_ITERATE_STOP(handler_ring, handler);
+ }
+ } RING_ITERATE_END(handler_ring, handler);
- if (fn != NULL) {
- fn(argc, argv);
- }
+ if (fn != NULL) {
+ fn(argc, argv);
+ }
- free(argv);
+ free(argv);
}
diff --git a/frontends/monkey/download.c b/frontends/monkey/download.c
index f2e1cbfbf..5c9ce1b53 100644
--- a/frontends/monkey/download.c
+++ b/frontends/monkey/download.c
@@ -30,11 +30,11 @@
static uint32_t dwin_ctr = 0;
struct gui_download_window {
- struct gui_download_window *r_next;
- struct gui_download_window *r_prev;
- struct gui_window *g;
- uint32_t dwin_num;
- char *host; /* ignore */
+ struct gui_download_window *r_next;
+ struct gui_download_window *r_prev;
+ struct gui_window *g;
+ uint32_t dwin_num;
+ char *host; /* ignore */
};
static struct gui_download_window *dw_ring = NULL;
@@ -43,44 +43,44 @@ static struct gui_download_window *
gui_download_window_create(download_context *ctx,
struct gui_window *parent)
{
- struct gui_download_window *ret = calloc(sizeof(*ret), 1);
- if (ret == NULL)
- return NULL;
- ret->g = parent;
- ret->dwin_num = dwin_ctr++;
+ struct gui_download_window *ret = calloc(sizeof(*ret), 1);
+ if (ret == NULL)
+ return NULL;
+ ret->g = parent;
+ ret->dwin_num = dwin_ctr++;
- RING_INSERT(dw_ring, ret);
+ RING_INSERT(dw_ring, ret);
- fprintf(stdout, "DOWNLOAD_WINDOW CREATE DWIN %u WIN %u\n",
- ret->dwin_num, parent->win_num);
+ fprintf(stdout, "DOWNLOAD_WINDOW CREATE DWIN %u WIN %u\n",
+ ret->dwin_num, parent->win_num);
- return ret;
+ return ret;
}
static nserror
gui_download_window_data(struct gui_download_window *dw,
const char *data, unsigned int size)
{
- fprintf(stdout, "DOWNLOAD_WINDOW DATA DWIN %u SIZE %u DATA %s\n",
- dw->dwin_num, size, data);
- return NSERROR_OK;
+ fprintf(stdout, "DOWNLOAD_WINDOW DATA DWIN %u SIZE %u DATA %s\n",
+ dw->dwin_num, size, data);
+ return NSERROR_OK;
}
static void
gui_download_window_error(struct gui_download_window *dw,
const char *error_msg)
{
- fprintf(stdout, "DOWNLOAD_WINDOW ERROR DWIN %u ERROR %s\n",
- dw->dwin_num, error_msg);
+ fprintf(stdout, "DOWNLOAD_WINDOW ERROR DWIN %u ERROR %s\n",
+ dw->dwin_num, error_msg);
}
static void
gui_download_window_done(struct gui_download_window *dw)
{
- fprintf(stdout, "DOWNLOAD_WINDOW DONE DWIN %u\n",
- dw->dwin_num);
- RING_REMOVE(dw_ring, dw);
- free(dw);
+ fprintf(stdout, "DOWNLOAD_WINDOW DONE DWIN %u\n",
+ dw->dwin_num);
+ RING_REMOVE(dw_ring, dw);
+ free(dw);
}
static struct gui_download_table download_table = {
diff --git a/frontends/monkey/farmer.py b/frontends/monkey/farmer.py
new file mode 100644
index 000000000..d4b4b1e21
--- /dev/null
+++ b/frontends/monkey/farmer.py
@@ -0,0 +1,363 @@
+#!/usr/bin/python
+
+# Copyright 2017 Daniel Silverstone <dsilvers@digital-scurf.org>
+#
+# This file is part of NetSurf, http://www.netsurf-browser.org/
+#
+# NetSurf is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# NetSurf is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+"""
+Monkey Farmer
+
+The monkey farmer is a wrapper around `nsmonkey` which can be used to simplify
+access to the monkey behaviours and ultimately to write useful tests in an
+expressive but not overcomplicated DSLish way. Tests are, ultimately, still
+Python code.
+
+"""
+
+import asyncore
+import os
+import socket
+import subprocess
+import time
+
+#monkey_cmd = ['./nsmonkey', '--accept_language=fr']
+monkey_cmd = ['./nsmonkey']
+
+class MonkeyFarmer(asyncore.dispatcher):
+ def __init__(self, online, quiet=False):
+ (mine, monkeys) = socket.socketpair()
+
+ asyncore.dispatcher.__init__(self, sock=mine)
+
+ self.monkey = subprocess.Popen(
+ monkey_cmd,
+ stdin=monkeys,
+ stdout=monkeys,
+ close_fds=[mine])
+
+ monkeys.close()
+
+ self.buffer = ""
+ self.incoming = ""
+ self.lines = []
+ self.scheduled = []
+ self.deadmonkey = False
+ self.online = online
+ self.quiet = quiet
+
+ def handle_connect(self):
+ pass
+
+ def handle_read(self):
+ got = self.recv(8192)
+ if got == "" or got is None:
+ self.deadmonkey = True
+ return
+ self.incoming += got
+ if "\n" in self.incoming:
+ lines = self.incoming.split("\n")
+ self.incoming = lines.pop()
+ self.lines = lines
+
+ def writable(self):
+ return (len(self.buffer) > 0)
+
+ def handle_write(self):
+ sent = self.send(self.buffer)
+ self.buffer = self.buffer[sent:]
+
+ def tell_monkey(self, *args):
+ cmd = (" ".join(args))
+ if not self.quiet:
+ print ">>> %s" % cmd
+ self.buffer += "%s\n" % cmd
+
+ def monkey_says(self, line):
+ if not self.quiet:
+ print "<<< %s" % line
+ self.online(line)
+
+ def schedule_event(self, event, secs=None, when=None):
+ assert(secs is not None or when is not None)
+ if when is None:
+ when = time.time() + secs
+ self.scheduled.append((when, event))
+ self.scheduled.sort(lambda a,b: cmp(a[0],b[0]))
+
+ def unschedule_event(self, event):
+ self.scheduled = [x for x in self.scheduled if x[1] != event]
+
+ def loop(self, once=False):
+ if len(self.lines) > 0:
+ self.monkey_says(self.lines.pop(0))
+ if once:
+ return
+ while not self.deadmonkey:
+ now = time.time()
+ while len(self.scheduled) > 0 and now >= self.scheduled[0][0]:
+ func = self.scheduled[0][1]
+ self.scheduled.pop(0)
+ func(self)
+ now = time.time()
+ if len(self.scheduled) > 0:
+ next = self.scheduled[0][0]
+ asyncore.loop(timeout=next-now, count=1)
+ else:
+ asyncore.loop(count=1)
+ if len(self.lines) > 0:
+ self.monkey_says(self.lines.pop(0))
+ if once:
+ break
+
+class Browser:
+ def __init__(self, quiet=False):
+ self.farmer = MonkeyFarmer(online=self.on_monkey_line, quiet=quiet)
+ self.windows = {}
+ self.current_draw_target = None
+
+ def pass_options(self, *opts):
+ if len(opts) > 0:
+ self.farmer.tell_monkey("OPTIONS " + (" ".join(opts)))
+
+ def on_monkey_line(self, line):
+ parts = line.split(" ")
+ handler = getattr(self, "handle_" + parts[0], None)
+ if handler is not None:
+ handler(*parts[1:])
+
+ def quit(self):
+ self.farmer.tell_monkey("QUIT")
+
+ def quit_and_wait(self):
+ self.quit()
+ self.farmer.loop()
+
+ def handle_GENERIC(self, what, *args):
+ pass
+
+ def handle_WINDOW(self, action, _win, winid, *args):
+ if action == "NEW":
+ new_win = BrowserWindow(self, winid, *args)
+ self.windows[winid] = new_win
+ else:
+ win = self.windows.get(winid, None)
+ if win is None:
+ print " Unknown window id %s" % winid
+ else:
+ win.handle(action, *args)
+
+ def handle_PLOT(self, *args):
+ if self.current_draw_target is not None:
+ self.current_draw_target.handle_plot(*args)
+
+ def new_window(self, url=None):
+ if url is None:
+ self.farmer.tell_monkey("WINDOW NEW")
+ else:
+ self.farmer.tell_monkey("WINDOW NEW %s" % url)
+ wins_known = set(self.windows.keys())
+ while len(set(self.windows.keys()).difference(wins_known)) == 0:
+ self.farmer.loop(once=True)
+ poss_wins = set(self.windows.keys()).difference(wins_known)
+ return self.windows[poss_wins.pop()]
+
+
+class BrowserWindow:
+ def __init__(self, browser, winid, _for, coreid, _existing, otherid, _newtab, newtab, _clone, clone):
+ self.alive = True
+ self.browser = browser
+ self.winid = winid
+ self.coreid = coreid
+ self.existing = browser.windows.get(otherid, None)
+ self.newtab = newtab == "TRUE"
+ self.clone = clone == "TRUE"
+ self.width = 0
+ self.height = 0
+ self.title = ""
+ self.throbbing = False
+ self.scrollx = 0
+ self.scrolly = 0
+ self.content_width = 0
+ self.content_height = 0
+ self.status = ""
+ self.pointer = ""
+ self.scale = 1.0
+ self.url = ""
+ self.plotted = []
+ self.plotting = False
+
+ def kill(self):
+ self.browser.farmer.tell_monkey("WINDOW DESTROY %s" % self.winid)
+
+ def go(self, url, referer = None):
+ if referer is None:
+ self.browser.farmer.tell_monkey("WINDOW GO %s %s" % (
+ self.winid, url))
+ else:
+ self.browser.farmer.tell_monkey("WINDOW GO %s %s %s" % (
+ self.winid, url, referer))
+
+ def reload(self):
+ self.browser.farmer.tell_monkey("WINDOW RELOAD %s" % self.winid)
+
+ def redraw(self, coords=None):
+ if coords is None:
+ self.browser.farmer.tell_monkey("WINDOW REDRAW %s" % self.winid)
+ else:
+ self.browser.farmer.tell_monkey("WINDOW REDRAW %s %s" % (
+ self.winid, (" ".join(coords))))
+
+ def handle(self, action, *args):
+ handler = getattr(self, "handle_window_" + action, None)
+ if handler is not None:
+ handler(*args)
+
+ def handle_window_SIZE(self, _width, width, _height, height):
+ self.width = int(width)
+ self.height = int(height)
+
+ def handle_window_DESTROY(self):
+ self.alive = False
+
+ def handle_window_TITLE(self, _str, *title):
+ self.title = " ".join(title)
+
+ def handle_window_REDRAW(self):
+ pass
+
+ def handle_window_GET_DIMENSIONS(self, _width, width, _height, height):
+ self.width = width
+ self.height = height
+
+ def handle_window_NEW_CONTENT(self):
+ pass
+
+ def handle_window_NEW_ICON(self):
+ pass
+
+ def handle_window_START_THROBBER(self):
+ self.throbbing = True
+
+ def handle_window_STOP_THROBBER(self):
+ self.throbbing = False
+
+ def handle_window_SET_SCROLL(self, _x, x, _y, y):
+ self.scrollx = int(x)
+ self.scrolly = int(y)
+
+ def handle_window_UPDATE_BOX(self, _x, x, _y, y, _width, width, _height, height):
+ x = int(x)
+ y = int(y)
+ width = int(width)
+ height = int(height)
+ pass
+
+ def handle_window_UPDATE_EXTENT(self, _width, width, _height, height):
+ self.content_width = int(width)
+ self.content_height = int(height)
+
+ def handle_window_SET_STATUS(self, _str, *status):
+ self.status = (" ".join(status))
+
+ def handle_window_SET_POINTER(self, _ptr, ptr):
+ self.pointer = ptr
+
+ def handle_window_SET_SCALE(self, _scale, scale):
+ self.scale = float(scale)
+
+ def handle_window_SET_URL(self, _url, url):
+ self.url = url
+
+ def handle_window_GET_SCROLL(self, _x, x, _y, y):
+ self.scrollx = int(x)
+ self.scrolly = int(y)
+
+ def handle_window_SCROLL_START(self):
+ self.scrollx = 0
+ self.scrolly = 0
+
+ def handle_window_REDRAW(self, act):
+ if act == "START":
+ self.browser.current_draw_target = self
+ self.plotted = []
+ self.plotting = True
+ else:
+ self.browser.current_draw_target = None
+ self.plotting = False
+
+ def load_page(self, url=None, referer=None):
+ if url is not None:
+ self.go(url, referer)
+ self.wait_loaded()
+
+ def reload(self):
+ self.browser.farmer.tell_monkey("WINDOW RELOAD %s" % self.winid)
+ self.wait_loaded()
+
+ def wait_loaded(self):
+ while not self.throbbing:
+ self.browser.farmer.loop(once=True)
+ while self.throbbing:
+ self.browser.farmer.loop(once=True)
+
+ def handle_plot(self, *args):
+ self.plotted.append(args)
+
+ def redraw(self, coords=None):
+ if coords is None:
+ self.browser.farmer.tell_monkey("WINDOW REDRAW %s" % self.winid)
+ else:
+ self.browser.farmer.tell_monkey("WINDOW REDRAW %s %s" % (
+ self.winid, (" ".join(coords))))
+ while not self.plotting:
+ self.browser.farmer.loop(once=True)
+ while self.plotting:
+ self.browser.farmer.loop(once=True)
+ return self.plotted
+
+
+# Simple test is as follows...
+
+browser = Browser(quiet=True)
+
+win = browser.new_window()
+
+fname = "test/js/inline-doc-write-simple.html"
+full_fname = os.path.join(os.getcwd(), fname)
+
+browser.pass_options("--enable_javascript=0")
+win.load_page("file://" + full_fname)
+
+print("Loaded, URL is %s" % win.url)
+
+cmds = win.redraw()
+print("Received %d plot commands" % len(cmds))
+for cmd in cmds:
+ if cmd[0] == "TEXT":
+ print "%s %s -> %s" % (cmd[2], cmd[4], (" ".join(cmd[6:])))
+
+
+browser.pass_options("--enable_javascript=1")
+win.load_page("file://" + full_fname)
+
+print("Loaded, URL is %s" % win.url)
+
+cmds = win.redraw()
+print("Received %d plot commands" % len(cmds))
+for cmd in cmds:
+ if cmd[0] == "TEXT":
+ print "%s %s -> %s" % (cmd[2], cmd[4], (" ".join(cmd[6:])))
+
+browser.quit_and_wait()
diff --git a/frontends/monkey/fetch.c b/frontends/monkey/fetch.c
index 4985329db..256d79b59 100644
--- a/frontends/monkey/fetch.c
+++ b/frontends/monkey/fetch.c
@@ -36,18 +36,18 @@ extern char **respaths;
static nsurl *gui_get_resource_url(const char *path)
{
- char buf[PATH_MAX];
- nsurl *url = NULL;
+ char buf[PATH_MAX];
+ nsurl *url = NULL;
- netsurf_path_to_nsurl(filepath_sfind(respaths, buf, path), &url);
+ netsurf_path_to_nsurl(filepath_sfind(respaths, buf, path), &url);
- return url;
+ return url;
}
static struct gui_fetch_table fetch_table = {
- .filetype = monkey_fetch_filetype,
+ .filetype = monkey_fetch_filetype,
- .get_resource_url = gui_get_resource_url,
+ .get_resource_url = gui_get_resource_url,
};
struct gui_fetch_table *monkey_fetch_table = &fetch_table;
diff --git a/frontends/monkey/filetype.c b/frontends/monkey/filetype.c
index 20bd1edad..65c84f9bd 100644
--- a/frontends/monkey/filetype.c
+++ b/frontends/monkey/filetype.c
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <stdbool.h>
+#include <stdint.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
@@ -85,7 +86,8 @@ void monkey_fetch_filetype_init(const char *mimefile)
fh = fopen(mimefile, "r");
if (fh == NULL) {
- LOG("Unable to open a mime.types file, so using a minimal one for you.");
+ NSLOG(netsurf, INFO,
+ "Unable to open a mime.types file, so using a minimal one for you.");
return;
}
diff --git a/frontends/monkey/layout.c b/frontends/monkey/layout.c
index 4bcc51b68..0d6a3b4dc 100644
--- a/frontends/monkey/layout.c
+++ b/frontends/monkey/layout.c
@@ -30,11 +30,11 @@
#include "monkey/layout.h"
static nserror nsfont_width(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int *width)
+ const char *string, size_t length,
+ int *width)
{
- *width = (fstyle->size * utf8_bounded_length(string, length)) / FONT_SIZE_SCALE;
- return NSERROR_OK;
+ *width = (fstyle->size * utf8_bounded_length(string, length)) / PLOT_STYLE_SCALE;
+ return NSERROR_OK;
}
/**
@@ -50,14 +50,14 @@ static nserror nsfont_width(const plot_font_style_t *fstyle,
*/
static nserror nsfont_position_in_string(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
+ const char *string, size_t length,
+ int x, size_t *char_offset, int *actual_x)
{
- *char_offset = x / (fstyle->size / FONT_SIZE_SCALE);
- if (*char_offset > length)
- *char_offset = length;
- *actual_x = *char_offset * (fstyle->size / FONT_SIZE_SCALE);
- return NSERROR_OK;
+ *char_offset = x / (fstyle->size / PLOT_STYLE_SCALE);
+ if (*char_offset > length)
+ *char_offset = length;
+ *actual_x = *char_offset * (fstyle->size / PLOT_STYLE_SCALE);
+ return NSERROR_OK;
}
@@ -85,27 +85,27 @@ static nserror nsfont_position_in_string(const plot_font_style_t *fstyle,
*/
static nserror nsfont_split(const plot_font_style_t *fstyle,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
+ const char *string, size_t length,
+ int x, size_t *char_offset, int *actual_x)
{
- int c_off = *char_offset = x / (fstyle->size / FONT_SIZE_SCALE);
- if (*char_offset > length) {
- *char_offset = length;
- } else {
- while (*char_offset > 0) {
- if (string[*char_offset] == ' ')
- break;
- (*char_offset)--;
- }
- if (*char_offset == 0) {
- *char_offset = c_off;
- while (*char_offset < length && string[*char_offset] != ' ') {
- (*char_offset)++;
- }
- }
- }
- *actual_x = *char_offset * (fstyle->size / FONT_SIZE_SCALE);
- return NSERROR_OK;
+ int c_off = *char_offset = x / (fstyle->size / PLOT_STYLE_SCALE);
+ if (*char_offset > length) {
+ *char_offset = length;
+ } else {
+ while (*char_offset > 0) {
+ if (string[*char_offset] == ' ')
+ break;
+ (*char_offset)--;
+ }
+ if (*char_offset == 0) {
+ *char_offset = c_off;
+ while (*char_offset < length && string[*char_offset] != ' ') {
+ (*char_offset)++;
+ }
+ }
+ }
+ *actual_x = *char_offset * (fstyle->size / PLOT_STYLE_SCALE);
+ return NSERROR_OK;
}
static struct gui_layout_table layout_table = {
diff --git a/frontends/monkey/main.c b/frontends/monkey/main.c
index 0059ff047..53cde5a72 100644
--- a/frontends/monkey/main.c
+++ b/frontends/monkey/main.c
@@ -66,8 +66,8 @@ static bool monkey_done = false;
*/
static void die(const char * const error)
{
- fprintf(stderr, "DIE %s\n", error);
- exit(EXIT_FAILURE);
+ fprintf(stderr, "DIE %s\n", error);
+ exit(EXIT_FAILURE);
}
/** obtain language from environment
@@ -78,29 +78,29 @@ static void die(const char * const error)
*/
static const char *get_language(void)
{
- const char *lang;
+ const char *lang;
- lang = getenv("LANGUAGE");
- if ((lang != NULL) && (lang[0] != '\0')) {
- return lang;
- }
+ lang = getenv("LANGUAGE");
+ if ((lang != NULL) && (lang[0] != '\0')) {
+ return lang;
+ }
- lang = getenv("LC_ALL");
- if ((lang != NULL) && (lang[0] != '\0')) {
- return lang;
- }
+ lang = getenv("LC_ALL");
+ if ((lang != NULL) && (lang[0] != '\0')) {
+ return lang;
+ }
- lang = getenv("LC_MESSAGES");
- if ((lang != NULL) && (lang[0] != '\0')) {
- return lang;
- }
+ lang = getenv("LC_MESSAGES");
+ if ((lang != NULL) && (lang[0] != '\0')) {
+ return lang;
+ }
- lang = getenv("LANG");
- if ((lang != NULL) && (lang[0] != '\0')) {
- return lang;
- }
+ lang = getenv("LANG");
+ if ((lang != NULL) && (lang[0] != '\0')) {
+ return lang;
+ }
- return NULL;
+ return NULL;
}
@@ -120,92 +120,97 @@ static const char *get_language(void)
*/
static const char * const *get_languagev(void)
{
- static const char *langv[LANGV_SIZE];
- int langidx = 0; /* index of next entry in vector */
- static char langs[LANGS_SIZE];
- char *curp; /* next language parameter in langs string */
- const char *lange; /* language from environment variable */
- int lang_len;
- char *cln; /* colon in lange */
-
- /* return cached vector */
- if (langv[0] != NULL) {
- return &langv[0];
- }
-
- curp = &langs[0];
-
- lange = get_language();
-
- if (lange != NULL) {
- lang_len = strlen(lange) + 1;
- if (lang_len < (LANGS_SIZE - 2)) {
- memcpy(curp, lange, lang_len);
- while ((curp[0] != 0) &&
- (langidx < (LANGV_SIZE - 2))) {
- /* avoid using strchrnul as it is not portable */
- cln = strchr(curp, ':');
- if (cln == NULL) {
- langv[langidx++] = curp;
- curp += lang_len;
- break;
- } else {
- if ((cln - curp) > 1) {
- /* only place non empty entries in vector */
- langv[langidx++] = curp;
- }
- *cln++ = 0; /* null terminate */
- lang_len -= (cln - curp);
- curp = cln;
+ static const char *langv[LANGV_SIZE];
+ int langidx = 0; /* index of next entry in vector */
+ static char langs[LANGS_SIZE];
+ char *curp; /* next language parameter in langs string */
+ const char *lange; /* language from environment variable */
+ int lang_len;
+ char *cln; /* colon in lange */
+
+ /* return cached vector */
+ if (langv[0] != NULL) {
+ return &langv[0];
}
- }
- }
- }
- /* ensure C language is present */
- langv[langidx++] = curp;
- *curp++ = 'C';
- *curp++ = 0;
- langv[langidx] = NULL;
+ curp = &langs[0];
+
+ lange = get_language();
+
+ if (lange != NULL) {
+ lang_len = strlen(lange) + 1;
+ if (lang_len < (LANGS_SIZE - 2)) {
+ memcpy(curp, lange, lang_len);
+ while ((curp[0] != 0) &&
+ (langidx < (LANGV_SIZE - 2))) {
+ /* avoid using strchrnul as it is not portable */
+ cln = strchr(curp, ':');
+ if (cln == NULL) {
+ langv[langidx++] = curp;
+ curp += lang_len;
+ break;
+ } else {
+ if ((cln - curp) > 1) {
+ /* only place non empty entries in vector */
+ langv[langidx++] = curp;
+ }
+ *cln++ = 0; /* null terminate */
+ lang_len -= (cln - curp);
+ curp = cln;
+ }
+ }
+ }
+ }
- return &langv[0];
+ /* ensure C language is present */
+ langv[langidx++] = curp;
+ *curp++ = 'C';
+ *curp++ = 0;
+ langv[langidx] = NULL;
+
+ return &langv[0];
}
/* Stolen from gtk/gui.c */
static char **
nsmonkey_init_resource(const char *resource_path)
{
- const char * const *langv;
- char **pathv; /* resource path string vector */
- char **respath; /* resource paths vector */
+ const char * const *langv;
+ char **pathv; /* resource path string vector */
+ char **respath; /* resource paths vector */
- pathv = filepath_path_to_strvec(resource_path);
+ pathv = filepath_path_to_strvec(resource_path);
- langv = get_languagev();
+ langv = get_languagev();
- respath = filepath_generate(pathv, langv);
+ respath = filepath_generate(pathv, langv);
- filepath_free_strvec(pathv);
+ filepath_free_strvec(pathv);
- return respath;
+ return respath;
}
static void monkey_quit(void)
{
- urldb_save_cookies(nsoption_charp(cookie_jar));
- urldb_save(nsoption_charp(url_file));
- monkey_fetch_filetype_fin();
+ urldb_save_cookies(nsoption_charp(cookie_jar));
+ urldb_save(nsoption_charp(url_file));
+ monkey_fetch_filetype_fin();
}
static nserror gui_launch_url(struct nsurl *url)
{
- fprintf(stdout, "GENERIC LAUNCH URL %s\n", nsurl_access(url));
- return NSERROR_OK;
+ fprintf(stdout, "GENERIC LAUNCH URL %s\n", nsurl_access(url));
+ return NSERROR_OK;
}
static void quit_handler(int argc, char **argv)
{
- monkey_done = true;
+ monkey_done = true;
+}
+
+static void monkey_options_handle_command(int argc, char **argv)
+{
+ nsoption_commandline(&argc, argv, nsoptions);
}
/**
@@ -216,12 +221,12 @@ static void quit_handler(int argc, char **argv)
*/
static nserror set_defaults(struct nsoption_s *defaults)
{
- /* Set defaults for absent option strings */
- nsoption_setnull_charp(cookie_file, strdup("~/.netsurf/Cookies"));
- nsoption_setnull_charp(cookie_jar, strdup("~/.netsurf/Cookies"));
- nsoption_setnull_charp(url_file, strdup("~/.netsurf/URLs"));
+ /* Set defaults for absent option strings */
+ nsoption_setnull_charp(cookie_file, strdup("~/.netsurf/Cookies"));
+ nsoption_setnull_charp(cookie_jar, strdup("~/.netsurf/Cookies"));
+ nsoption_setnull_charp(url_file, strdup("~/.netsurf/URLs"));
- return NSERROR_OK;
+ return NSERROR_OK;
}
@@ -230,170 +235,177 @@ static nserror set_defaults(struct nsoption_s *defaults)
*/
static bool nslog_stream_configure(FILE *fptr)
{
- /* set log stream to be non-buffering */
- setbuf(fptr, NULL);
+ /* set log stream to be non-buffering */
+ setbuf(fptr, NULL);
- return true;
+ return true;
}
static struct gui_misc_table monkey_misc_table = {
- .schedule = monkey_schedule,
- .warning = monkey_warn_user,
+ .schedule = monkey_schedule,
+ .warning = monkey_warn_user,
- .quit = monkey_quit,
- .launch_url = gui_launch_url,
- .cert_verify = gui_cert_verify,
- .login = gui_401login_open,
+ .quit = monkey_quit,
+ .launch_url = gui_launch_url,
+ .cert_verify = gui_cert_verify,
+ .login = gui_401login_open,
};
static void monkey_run(void)
{
- fd_set read_fd_set, write_fd_set, exc_fd_set;
- int max_fd;
- int rdy_fd;
- int schedtm;
- struct timeval tv;
- struct timeval* timeout;
-
- while (!monkey_done) {
-
- /* clears fdset */
- fetch_fdset(&read_fd_set, &write_fd_set, &exc_fd_set, &max_fd);
-
- /* add stdin to the set */
- if (max_fd < 0) {
- max_fd = 0;
- }
- FD_SET(0, &read_fd_set);
- FD_SET(0, &exc_fd_set);
-
- /* discover the next scheduled event time */
- schedtm = monkey_schedule_run();
-
- /* setup timeout */
- switch (schedtm) {
- case -1:
- LOG("Iterate blocking");
- fprintf(stdout, "GENERIC POLL BLOCKING\n");
- timeout = NULL;
- break;
-
- case 0:
- LOG("Iterate immediate");
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- timeout = &tv;
- break;
-
- default:
- LOG("Iterate non-blocking");
- fprintf(stdout, "GENERIC POLL TIMED\n");
- tv.tv_sec = schedtm / 1000; /* miliseconds to seconds */
- tv.tv_usec = (schedtm % 1000) * 1000; /* remainder to microseconds */
- timeout = &tv;
- break;
- }
-
- rdy_fd = select(max_fd + 1,
- &read_fd_set,
- &write_fd_set,
- &exc_fd_set,
- timeout);
- if (rdy_fd < 0) {
- monkey_done = true;
- } else if (rdy_fd > 0) {
- if (FD_ISSET(0, &read_fd_set)) {
- monkey_process_command();
- }
- }
- }
-
+ fd_set read_fd_set, write_fd_set, exc_fd_set;
+ int max_fd;
+ int rdy_fd;
+ int schedtm;
+ struct timeval tv;
+ struct timeval* timeout;
+
+ while (!monkey_done) {
+
+ /* clears fdset */
+ fetch_fdset(&read_fd_set, &write_fd_set, &exc_fd_set, &max_fd);
+
+ /* add stdin to the set */
+ if (max_fd < 0) {
+ max_fd = 0;
+ }
+ FD_SET(0, &read_fd_set);
+ FD_SET(0, &exc_fd_set);
+
+ /* discover the next scheduled event time */
+ schedtm = monkey_schedule_run();
+
+ /* setup timeout */
+ switch (schedtm) {
+ case -1:
+ NSLOG(netsurf, INFO, "Iterate blocking");
+ fprintf(stdout, "GENERIC POLL BLOCKING\n");
+ timeout = NULL;
+ break;
+
+ case 0:
+ NSLOG(netsurf, INFO, "Iterate immediate");
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ timeout = &tv;
+ break;
+
+ default:
+ NSLOG(netsurf, INFO, "Iterate non-blocking");
+ fprintf(stdout, "GENERIC POLL TIMED %d\n", schedtm);
+ tv.tv_sec = schedtm / 1000; /* miliseconds to seconds */
+ tv.tv_usec = (schedtm % 1000) * 1000; /* remainder to microseconds */
+ timeout = &tv;
+ break;
+ }
+
+ rdy_fd = select(max_fd + 1,
+ &read_fd_set,
+ &write_fd_set,
+ &exc_fd_set,
+ timeout);
+ if (rdy_fd < 0) {
+ monkey_done = true;
+ } else if (rdy_fd > 0) {
+ if (FD_ISSET(0, &read_fd_set)) {
+ monkey_process_command();
+ }
+ }
+ }
}
int
main(int argc, char **argv)
{
- char *messages;
- char *options;
- char buf[PATH_MAX];
- nserror ret;
- struct netsurf_table monkey_table = {
- .misc = &monkey_misc_table,
- .window = monkey_window_table,
- .download = monkey_download_table,
- .fetch = monkey_fetch_table,
- .bitmap = monkey_bitmap_table,
- .layout = monkey_layout_table,
- };
-
- ret = netsurf_register(&monkey_table);
- if (ret != NSERROR_OK) {
- die("NetSurf operation table failed registration");
- }
-
- /* Unbuffer stdin/out/err */
- setbuf(stdin, NULL);
- setbuf(stdout, NULL);
- setbuf(stderr, NULL);
-
- /* Prep the search paths */
- respaths = nsmonkey_init_resource("${HOME}/.netsurf/:${NETSURFRES}:"MONKEY_RESPATH":./monkey/res");
-
- /* initialise logging. Not fatal if it fails but not much we can do
- * about it either.
- */
- nslog_init(nslog_stream_configure, &argc, argv);
-
- /* user options setup */
- ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
- if (ret != NSERROR_OK) {
- die("Options failed to initialise");
- }
- options = filepath_find(respaths, "Choices");
- nsoption_read(options, nsoptions);
- free(options);
- nsoption_commandline(&argc, argv, nsoptions);
-
- messages = filepath_find(respaths, "Messages");
- ret = messages_add_from_file(messages);
- if (ret != NSERROR_OK) {
- LOG("Messages failed to load");
- }
-
- /* common initialisation */
- ret = netsurf_init(NULL);
- free(messages);
- if (ret != NSERROR_OK) {
- die("NetSurf failed to initialise");
- }
-
- filepath_sfinddef(respaths, buf, "mime.types", "/etc/");
- monkey_fetch_filetype_init(buf);
-
- urldb_load(nsoption_charp(url_file));
- urldb_load_cookies(nsoption_charp(cookie_file));
-
- ret = monkey_register_handler("QUIT", quit_handler);
- if (ret != NSERROR_OK) {
- die("quit handler failed to register");
- }
-
- ret = monkey_register_handler("WINDOW", monkey_window_handle_command);
- if (ret != NSERROR_OK) {
- die("window handler fialed to register");
- }
-
- fprintf(stdout, "GENERIC STARTED\n");
- monkey_run();
-
- fprintf(stdout, "GENERIC CLOSING_DOWN\n");
- monkey_kill_browser_windows();
-
- netsurf_exit();
- fprintf(stdout, "GENERIC FINISHED\n");
-
- /* finalise options */
- nsoption_finalise(nsoptions, nsoptions_default);
-
- return 0;
+ char *messages;
+ char *options;
+ char buf[PATH_MAX];
+ nserror ret;
+ struct netsurf_table monkey_table = {
+ .misc = &monkey_misc_table,
+ .window = monkey_window_table,
+ .download = monkey_download_table,
+ .fetch = monkey_fetch_table,
+ .bitmap = monkey_bitmap_table,
+ .layout = monkey_layout_table,
+ };
+
+ ret = netsurf_register(&monkey_table);
+ if (ret != NSERROR_OK) {
+ die("NetSurf operation table failed registration");
+ }
+
+ /* Unbuffer stdin/out/err */
+ setbuf(stdin, NULL);
+ setbuf(stdout, NULL);
+ setbuf(stderr, NULL);
+
+ /* Prep the search paths */
+ respaths = nsmonkey_init_resource("${HOME}/.netsurf/:${NETSURFRES}:"MONKEY_RESPATH":./frontends/monkey/res");
+
+ /* initialise logging. Not fatal if it fails but not much we can do
+ * about it either.
+ */
+ nslog_init(nslog_stream_configure, &argc, argv);
+
+ /* user options setup */
+ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ die("Options failed to initialise");
+ }
+ options = filepath_find(respaths, "Choices");
+ nsoption_read(options, nsoptions);
+ free(options);
+ nsoption_commandline(&argc, argv, nsoptions);
+
+ messages = filepath_find(respaths, "Messages");
+ ret = messages_add_from_file(messages);
+ if (ret != NSERROR_OK) {
+ NSLOG(netsurf, INFO, "Messages failed to load");
+ }
+
+ /* common initialisation */
+ ret = netsurf_init(NULL);
+ free(messages);
+ if (ret != NSERROR_OK) {
+ die("NetSurf failed to initialise");
+ }
+
+ filepath_sfinddef(respaths, buf, "mime.types", "/etc/");
+ monkey_fetch_filetype_init(buf);
+
+ urldb_load(nsoption_charp(url_file));
+ urldb_load_cookies(nsoption_charp(cookie_file));
+
+ ret = monkey_register_handler("QUIT", quit_handler);
+ if (ret != NSERROR_OK) {
+ die("quit handler failed to register");
+ }
+
+ ret = monkey_register_handler("WINDOW", monkey_window_handle_command);
+ if (ret != NSERROR_OK) {
+ die("window handler failed to register");
+ }
+
+ ret = monkey_register_handler("OPTIONS", monkey_options_handle_command);
+ if (ret != NSERROR_OK) {
+ die("options handler failed to register");
+ }
+
+ fprintf(stdout, "GENERIC STARTED\n");
+ monkey_run();
+
+ fprintf(stdout, "GENERIC CLOSING_DOWN\n");
+ monkey_kill_browser_windows();
+
+ netsurf_exit();
+ fprintf(stdout, "GENERIC FINISHED\n");
+
+ /* finalise options */
+ nsoption_finalise(nsoptions, nsoptions_default);
+
+ /* finalise logging */
+ nslog_finalise();
+
+ return 0;
}
diff --git a/frontends/monkey/plot.c b/frontends/monkey/plot.c
index bd94e7551..2fc9a3cb6 100644
--- a/frontends/monkey/plot.c
+++ b/frontends/monkey/plot.c
@@ -19,82 +19,248 @@
#include <stdio.h>
#include "utils/utils.h"
+#include "utils/errors.h"
#include "netsurf/plotters.h"
-static bool
-monkey_plot_disc(int x, int y, int radius, const plot_style_t *style)
+/**
+ * \brief Sets a clip rectangle for subsequent plot operations.
+ *
+ * \param ctx The current redraw context.
+ * \param clip The rectangle to limit all subsequent plot
+ * operations within.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+monkey_plot_clip(const struct redraw_context *ctx, const struct rect *clip)
{
- return true;
+ fprintf(stdout,
+ "PLOT CLIP X0 %d Y0 %d X1 %d Y1 %d\n",
+ clip->x0, clip->y0, clip->x1, clip->y1);
+ return NSERROR_OK;
}
-static bool
-monkey_plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style)
+
+/**
+ * Plots an arc
+ *
+ * plot an arc segment around (x,y), anticlockwise from angle1
+ * to angle2. Angles are measured anticlockwise from
+ * horizontal, in degrees.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the arc plot.
+ * \param x The x coordinate of the arc.
+ * \param y The y coordinate of the arc.
+ * \param radius The radius of the arc.
+ * \param angle1 The start angle of the arc.
+ * \param angle2 The finish angle of the arc.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+monkey_plot_arc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius, int angle1, int angle2)
{
- return true;
+ fprintf(stdout,
+ "PLOT ARC X %d Y %d RADIUS %d ANGLE1 %d ANGLE2 %d\n",
+ x, y, radius, angle1, angle2);
+ return NSERROR_OK;
}
-static bool
-monkey_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
+
+/**
+ * Plots a circle
+ *
+ * Plot a circle centered on (x,y), which is optionally filled.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the circle plot.
+ * \param x x coordinate of circle centre.
+ * \param y y coordinate of circle centre.
+ * \param radius circle radius.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+monkey_plot_disc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius)
{
- return true;
+ fprintf(stdout,
+ "PLOT DISC X %d Y %d RADIUS %d\n",
+ x, y, radius);
+ return NSERROR_OK;
}
-static bool
-monkey_plot_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle)
+/**
+ * Plots a line
+ *
+ * plot a line from (x0,y0) to (x1,y1). Coordinates are at
+ * centre of line width/thickness.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the line plot.
+ * \param line A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+monkey_plot_line(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *line)
{
- fprintf(stdout, "PLOT TEXT X %d Y %d STR %*s\n", x, y, (int)length, text);
- return true;
+ fprintf(stdout,
+ "PLOT LINE X0 %d Y0 %d X1 %d Y1 %d\n",
+ line->x0, line->y0, line->x1, line->y1);
+ return NSERROR_OK;
}
-static bool
-monkey_plot_bitmap(int x, int y,
- int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags)
+
+/**
+ * Plots a rectangle.
+ *
+ * The rectangle can be filled an outline or both controlled
+ * by the plot style The line can be solid, dotted or
+ * dashed. Top left corner at (x0,y0) and rectangle has given
+ * width and height.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the rectangle plot.
+ * \param rect A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+monkey_plot_rectangle(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *rect)
{
- fprintf(stdout, "PLOT BITMAP X %d Y %d WIDTH %d HEIGHT %d\n",
- x, y, width, height);
- return true;
+ fprintf(stdout,
+ "PLOT RECT X0 %d Y0 %d X1 %d Y1 %d\n",
+ rect->x0, rect->y0, rect->x1, rect->y1);
+ return NSERROR_OK;
}
-static bool
-monkey_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
+
+/**
+ * Plot a polygon
+ *
+ * Plots a filled polygon with straight lines between
+ * points. The lines around the edge of the ploygon are not
+ * plotted. The polygon is filled with the non-zero winding
+ * rule.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the polygon plot.
+ * \param p verticies of polygon
+ * \param n number of verticies.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+monkey_plot_polygon(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const int *p,
+ unsigned int n)
{
- fprintf(stdout, "PLOT RECT X0 %d Y0 %d X1 %d Y1 %d\n",
- x0, y0, x1, y1);
- return true;
+ fprintf(stdout,
+ "PLOT POLYGON VERTICIES %d\n",
+ n);
+ return NSERROR_OK;
}
-static bool
-monkey_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
+
+/**
+ * Plots a path.
+ *
+ * Path plot consisting of cubic Bezier curves. Line and fill colour is
+ * controlled by the plot style.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the path plot.
+ * \param p elements of path
+ * \param n nunber of elements on path
+ * \param transform A transform to apply to the path.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+monkey_plot_path(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const float *p,
+ unsigned int n,
+ const float transform[6])
{
- fprintf(stdout, "PLOT LINE X0 %d Y0 %d X1 %d Y1 %d\n",
- x0, y0, x1, y1);
- return true;
+ fprintf(stdout,
+ "PLOT PATH VERTICIES %d WIDTH %f\n",
+ n, plot_style_fixed_to_float(pstyle->stroke_width));
+ return NSERROR_OK;
}
-static bool
-monkey_plot_path(const float *p,
- unsigned int n,
- colour fill,
- float width,
- colour c,
- const float transform[6])
+/**
+ * Plot a bitmap
+ *
+ * Tiled plot of a bitmap image. (x,y) gives the top left
+ * coordinate of an explicitly placed tile. From this tile the
+ * image can repeat in all four directions -- up, down, left
+ * and right -- to the extents given by the current clip
+ * rectangle.
+ *
+ * The bitmap_flags say whether to tile in the x and y
+ * directions. If not tiling in x or y directions, the single
+ * image is plotted. The width and height give the dimensions
+ * the image is to be scaled to.
+ *
+ * \param ctx The current redraw context.
+ * \param bitmap The bitmap to plot
+ * \param x The x coordinate to plot the bitmap
+ * \param y The y coordiante to plot the bitmap
+ * \param width The width of area to plot the bitmap into
+ * \param height The height of area to plot the bitmap into
+ * \param bg the background colour to alpha blend into
+ * \param flags the flags controlling the type of plot operation
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+monkey_plot_bitmap(const struct redraw_context *ctx,
+ struct bitmap *bitmap,
+ int x, int y,
+ int width,
+ int height,
+ colour bg,
+ bitmap_flags_t flags)
{
- return true;
+ fprintf(stdout,
+ "PLOT BITMAP X %d Y %d WIDTH %d HEIGHT %d\n",
+ x, y, width, height);
+ return NSERROR_OK;
}
-static bool
-monkey_plot_clip(const struct rect *clip)
+
+/**
+ * Text plotting.
+ *
+ * \param ctx The current redraw context.
+ * \param fstyle plot style for this text
+ * \param x x coordinate
+ * \param y y coordinate
+ * \param text UTF-8 string to plot
+ * \param length length of string, in bytes
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+monkey_plot_text(const struct redraw_context *ctx,
+ const struct plot_font_style *fstyle,
+ int x,
+ int y,
+ const char *text,
+ size_t length)
{
- fprintf(stdout, "PLOT CLIP X0 %d Y0 %d X1 %d Y1 %d\n",
- clip->x0, clip->y0, clip->x1, clip->y1);
- return true;
+ fprintf(stdout,
+ "PLOT TEXT X %d Y %d STR %*s\n",
+ x, y, (int)length, text);
+ return NSERROR_OK;
}
+
+/** monkey plotter operations table */
static const struct plotter_table plotters = {
.clip = monkey_plot_clip,
.arc = monkey_plot_arc,
@@ -105,7 +271,7 @@ static const struct plotter_table plotters = {
.path = monkey_plot_path,
.bitmap = monkey_plot_bitmap,
.text = monkey_plot_text,
- .option_knockout = true,
+ .option_knockout = true,
};
const struct plotter_table* monkey_plotters = &plotters;
diff --git a/frontends/monkey/schedule.c b/frontends/monkey/schedule.c
index 8c638c0b9..3d76997f4 100644
--- a/frontends/monkey/schedule.c
+++ b/frontends/monkey/schedule.c
@@ -24,12 +24,6 @@
#include "monkey/schedule.h"
-#ifdef DEBUG_SCHEDULER
-#define SRLOG(x...) LOG(x)
-#else
-#define SRLOG(x...) ((void) 0)
-#endif
-
/* linked list of scheduled callbacks */
static struct nscallback *schedule_list = NULL;
@@ -38,10 +32,10 @@ static struct nscallback *schedule_list = NULL;
*/
struct nscallback
{
- struct nscallback *next;
- struct timeval tv;
- void (*callback)(void *p);
- void *p;
+ struct nscallback *next;
+ struct timeval tv;
+ void (*callback)(void *p);
+ void *p;
};
/**
@@ -54,170 +48,164 @@ struct nscallback
*/
static nserror schedule_remove(void (*callback)(void *p), void *p)
{
- struct nscallback *cur_nscb;
- struct nscallback *prev_nscb;
- struct nscallback *unlnk_nscb;
-
- /* check there is something on the list to remove */
- if (schedule_list == NULL) {
- return NSERROR_OK;
- }
-
- SRLOG("removing %p, %p", callback, p);
-
- cur_nscb = schedule_list;
- prev_nscb = NULL;
-
- while (cur_nscb != NULL) {
- if ((cur_nscb->callback == callback) &&
- (cur_nscb->p == p)) {
- /* item to remove */
-
- SRLOG("callback entry %p removing %p(%p)",
- cur_nscb, cur_nscb->callback, cur_nscb->p);
-
- /* remove callback */
- unlnk_nscb = cur_nscb;
- cur_nscb = unlnk_nscb->next;
-
- if (prev_nscb == NULL) {
- schedule_list = cur_nscb;
- } else {
- prev_nscb->next = cur_nscb;
- }
- free (unlnk_nscb);
- } else {
- /* move to next element */
- prev_nscb = cur_nscb;
- cur_nscb = prev_nscb->next;
- }
- }
-
- return NSERROR_OK;
+ struct nscallback *cur_nscb;
+ struct nscallback *prev_nscb;
+ struct nscallback *unlnk_nscb;
+
+ /* check there is something on the list to remove */
+ if (schedule_list == NULL) {
+ return NSERROR_OK;
+ }
+
+ NSLOG(schedule, DEBUG, "removing %p, %p", callback, p);
+
+ cur_nscb = schedule_list;
+ prev_nscb = NULL;
+
+ while (cur_nscb != NULL) {
+ if ((cur_nscb->callback == callback) &&
+ (cur_nscb->p == p)) {
+ /* item to remove */
+
+ NSLOG(schedule, DEBUG, "callback entry %p removing %p(%p)",
+ cur_nscb, cur_nscb->callback, cur_nscb->p);
+
+ /* remove callback */
+ unlnk_nscb = cur_nscb;
+ cur_nscb = unlnk_nscb->next;
+
+ if (prev_nscb == NULL) {
+ schedule_list = cur_nscb;
+ } else {
+ prev_nscb->next = cur_nscb;
+ }
+ free (unlnk_nscb);
+ } else {
+ /* move to next element */
+ prev_nscb = cur_nscb;
+ cur_nscb = prev_nscb->next;
+ }
+ }
+
+ return NSERROR_OK;
}
-/* exported function documented in framebuffer/schedule.h */
+/* exported function documented in monkey/schedule.h */
nserror monkey_schedule(int tival, void (*callback)(void *p), void *p)
{
- struct nscallback *nscb;
- struct timeval tv;
- nserror ret;
+ struct nscallback *nscb;
+ struct timeval tv;
+ nserror ret;
- /* ensure uniqueness of the callback and context */
- ret = schedule_remove(callback, p);
- if ((tival < 0) || (ret != NSERROR_OK)) {
- return ret;
- }
+ /* ensure uniqueness of the callback and context */
+ ret = schedule_remove(callback, p);
+ if ((tival < 0) || (ret != NSERROR_OK)) {
+ return ret;
+ }
- SRLOG("Adding %p(%p) in %d", callback, p, tival);
+ NSLOG(schedule, DEBUG, "Adding %p(%p) in %d", callback, p, tival);
- tv.tv_sec = tival / 1000; /* miliseconds to seconds */
- tv.tv_usec = (tival % 1000) * 1000; /* remainder to microseconds */
+ tv.tv_sec = tival / 1000; /* miliseconds to seconds */
+ tv.tv_usec = (tival % 1000) * 1000; /* remainder to microseconds */
- nscb = calloc(1, sizeof(struct nscallback));
+ nscb = calloc(1, sizeof(struct nscallback));
- gettimeofday(&nscb->tv, NULL);
- timeradd(&nscb->tv, &tv, &nscb->tv);
+ gettimeofday(&nscb->tv, NULL);
+ timeradd(&nscb->tv, &tv, &nscb->tv);
- nscb->callback = callback;
- nscb->p = p;
+ nscb->callback = callback;
+ nscb->p = p;
- /* add to list front */
- nscb->next = schedule_list;
- schedule_list = nscb;
+ /* add to list front */
+ nscb->next = schedule_list;
+ schedule_list = nscb;
- return NSERROR_OK;
+ return NSERROR_OK;
}
-/* exported function documented in framebuffer/schedule.h */
+/* exported function documented in monkey/schedule.h */
int monkey_schedule_run(void)
{
- struct timeval tv;
- struct timeval nexttime;
- struct timeval rettime;
- struct nscallback *cur_nscb;
- struct nscallback *prev_nscb;
- struct nscallback *unlnk_nscb;
-
- if (schedule_list == NULL)
- return -1;
-
- /* reset enumeration to the start of the list */
- cur_nscb = schedule_list;
- prev_nscb = NULL;
- nexttime = cur_nscb->tv;
-
- gettimeofday(&tv, NULL);
-
- while (cur_nscb != NULL) {
- if (timercmp(&tv, &cur_nscb->tv, >)) {
- /* scheduled time */
-
- /* remove callback */
- unlnk_nscb = cur_nscb;
-
- if (prev_nscb == NULL) {
- schedule_list = unlnk_nscb->next;
- } else {
- prev_nscb->next = unlnk_nscb->next;
- }
-
- unlnk_nscb->callback(unlnk_nscb->p);
-
- free(unlnk_nscb);
-
- /* need to deal with callback modifying the list. */
- if (schedule_list == NULL)
- return -1; /* no more callbacks scheduled */
-
- /* reset enumeration to the start of the list */
- cur_nscb = schedule_list;
- prev_nscb = NULL;
- nexttime = cur_nscb->tv;
- } else {
- /* if the time to the event is sooner than the
- * currently recorded soonest event record it
- */
- if (timercmp(&nexttime, &cur_nscb->tv, >)) {
+ struct timeval tv;
+ struct timeval nexttime;
+ struct timeval rettime;
+ struct nscallback *cur_nscb;
+ struct nscallback *prev_nscb;
+ struct nscallback *unlnk_nscb;
+
+ if (schedule_list == NULL)
+ return -1;
+
+ /* reset enumeration to the start of the list */
+ cur_nscb = schedule_list;
+ prev_nscb = NULL;
nexttime = cur_nscb->tv;
- }
- /* move to next element */
- prev_nscb = cur_nscb;
- cur_nscb = prev_nscb->next;
- }
- }
-
- /* make rettime relative to now */
- timersub(&nexttime, &tv, &rettime);
- SRLOG("returning time to next event as %ldms",
- (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000));
-
- /* return next event time in milliseconds (24days max wait) */
- return (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000);
+ gettimeofday(&tv, NULL);
+
+ while (cur_nscb != NULL) {
+ if (timercmp(&tv, &cur_nscb->tv, >)) {
+ /* scheduled time */
+
+ /* remove callback */
+ unlnk_nscb = cur_nscb;
+
+ if (prev_nscb == NULL) {
+ schedule_list = unlnk_nscb->next;
+ } else {
+ prev_nscb->next = unlnk_nscb->next;
+ }
+
+ unlnk_nscb->callback(unlnk_nscb->p);
+
+ free(unlnk_nscb);
+
+ /* need to deal with callback modifying the list. */
+ if (schedule_list == NULL)
+ return -1; /* no more callbacks scheduled */
+
+ /* reset enumeration to the start of the list */
+ cur_nscb = schedule_list;
+ prev_nscb = NULL;
+ nexttime = cur_nscb->tv;
+ } else {
+ /* if the time to the event is sooner than the
+ * currently recorded soonest event record it
+ */
+ if (timercmp(&nexttime, &cur_nscb->tv, >)) {
+ nexttime = cur_nscb->tv;
+ }
+ /* move to next element */
+ prev_nscb = cur_nscb;
+ cur_nscb = prev_nscb->next;
+ }
+ }
+
+ /* make rettime relative to now */
+ timersub(&nexttime, &tv, &rettime);
+
+ NSLOG(schedule, DEBUG, "returning time to next event as %ldms",
+ (long)((rettime.tv_sec * 1000) + (rettime.tv_usec / 1000)));
+
+ /* return next event time in milliseconds (24days max wait) */
+ return (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000);
}
void monkey_schedule_list(void)
{
- struct timeval tv;
- struct nscallback *cur_nscb;
+ struct timeval tv;
+ struct nscallback *cur_nscb;
- gettimeofday(&tv, NULL);
+ gettimeofday(&tv, NULL);
- LOG("schedule list at %lld:%ld", (long long)tv.tv_sec, tv.tv_usec);
+ NSLOG(netsurf, INFO, "schedule list at %lld:%ld",
+ (long long)tv.tv_sec, tv.tv_usec);
- cur_nscb = schedule_list;
+ cur_nscb = schedule_list;
- while (cur_nscb != NULL) {
- LOG("Schedule %p at %lld:%ld",
- cur_nscb, (long long)cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec);
- cur_nscb = cur_nscb->next;
- }
+ while (cur_nscb != NULL) {
+ NSLOG(netsurf, INFO, "Schedule %p at %lld:%ld", cur_nscb,
+ (long long)cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec);
+ cur_nscb = cur_nscb->next;
+ }
}
-
-
-/*
- * Local Variables:
- * c-basic-offset:2
- * End:
- */
diff --git a/frontends/riscos/401login.c b/frontends/riscos/401login.c
index a23c01c90..4b2deb16b 100644
--- a/frontends/riscos/401login.c
+++ b/frontends/riscos/401login.c
@@ -191,7 +191,8 @@ void ro_gui_401login_close(wimp_w w)
error = xwimp_delete_window(w);
if (error) {
- LOG("xwimp_delete_window: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
ro_gui_wimp_event_finalise(w);
@@ -212,7 +213,7 @@ bool ro_gui_401login_apply(wimp_w w)
auth = malloc(strlen(session->uname) + strlen(session->pwd) + 2);
if (!auth) {
- LOG("calloc failed");
+ NSLOG(netsurf, INFO, "calloc failed");
ro_warn_user("NoMemory", 0);
return false;
}
diff --git a/frontends/riscos/Makefile b/frontends/riscos/Makefile
index 87790acc0..f531b6b5b 100644
--- a/frontends/riscos/Makefile
+++ b/frontends/riscos/Makefile
@@ -16,7 +16,7 @@ $(eval $(call feature_enabled,DRAW_EXPORT,-DWITH_DRAW_EXPORT,-lpencil,Drawfile e
TPD_RISCOS = $(foreach TPL,$(notdir $(TPL_RISCOS)), \
- !NetSurf/Resources/$(TPL)/Templates$(TPLEXT))
+ $(FRONTEND_SOURCE_DIR)/appdir/Resources/$(TPL)/Templates$(TPLEXT))
RESOURCES = $(TPD_RISCOS)
@@ -47,13 +47,14 @@ endif
# S_RISCOS are sources purely for the RISC OS build
S_FRONTEND := 401login.c assert.c bitmap.c buffer.c configure.c gui.c \
- dialog.c download.c filetype.c font.c help.c history.c image.c \
+ dialog.c download.c filetype.c font.c help.c image.c \
iconbar.c menus.c message.c mouse.c palettes.c plotters.c \
print.c query.c save.c save_draw.c save_pdf.c schedule.c \
search.c searchweb.c textarea.c textselection.c theme.c \
theme_install.c toolbar.c url_suggest.c wimp.c wimp_event.c \
ucstables.c uri.c url_complete.c url_protocol.c window.c \
- corewindow.c cookies.c sslcert.c global_history.c hotlist.c \
+ corewindow.c cookies.c sslcert.c hotlist.c \
+ local_history.c global_history.c \
$(addprefix content-handlers/,artworks.c awrender.s draw.c \
sprite.c) \
$(addprefix gui/,button_bar.c progress_bar.c status_bar.c \
@@ -67,16 +68,16 @@ S_FRONTEND := 401login.c assert.c bitmap.c buffer.c configure.c gui.c \
# are not yet available
SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_FRONTEND)
-EXETARGET := !NetSurf/!RunImage$(EXEEXT)
+EXETARGET := $(FRONTEND_SOURCE_DIR)/appdir/!RunImage$(EXEEXT)
# The filter and target for split messages
MESSAGES_FILTER=ro
-!NetSurf/!Run$(RUNEXT): $(FRONTEND_SOURCE_DIR)/scripts/Run $(EXETARGET)
+$(FRONTEND_SOURCE_DIR)/appdir/!Run$(RUNEXT): $(FRONTEND_SOURCE_DIR)/scripts/Run $(EXETARGET)
$(VQ)echo " MAKERUN: $@"
$(Q)$(MAKERUN) $(EXETARGET) $< $@
-!NetSurf/!Help$(RUNEXT): $(FRONTEND_SOURCE_DIR)/scripts/Help
+$(FRONTEND_SOURCE_DIR)/appdir/!Help$(RUNEXT): $(FRONTEND_SOURCE_DIR)/scripts/Help
$(VQ)echo " CP: $@"
$(Q)cp $< $@
@@ -85,16 +86,16 @@ $(DEPROOT)/squeeze.d: $(EXETARGET)
$(Q)$(SQUEEZE) -f -v $(EXETARGET)
$(Q)$(TOUCH) $@
-POSTEXES += !NetSurf/!Run$(RUNEXT) !NetSurf/!Help$(RUNEXT) $(DEPROOT)/squeeze.d
+POSTEXES += $(FRONTEND_SOURCE_DIR)/appdir/!Run$(RUNEXT) $(FRONTEND_SOURCE_DIR)/appdir/!Help$(RUNEXT) $(DEPROOT)/squeeze.d
clean-run:
- $(VQ)echo " CLEAN: !NetSurf/!Run$(RUNEXT)"
- $(Q) $(RM) !NetSurf/!Run$(RUNEXT)
+ $(VQ)echo " CLEAN: !Run$(RUNEXT)"
+ $(Q) $(RM) $(FRONTEND_SOURCE_DIR)/appdir/!Run$(RUNEXT)
clean-help:
- $(VQ)echo " CLEAN: !NetSurf/!Help$(RUNEXT)"
- $(Q) $(RM) !NetSurf/!Help$(RUNEXT)
+ $(VQ)echo " CLEAN: !Help$(RUNEXT)"
+ $(Q) $(RM) $(FRONTEND_SOURCE_DIR)/appdir/!Help$(RUNEXT)
CLEANS += clean-run clean-help
@@ -108,12 +109,12 @@ TPL_RISCOS := $(addprefix $(FRONTEND_SOURCE_DIR)/templates/,$(TPL_RISCOS))
# Template target creation macro
define compile_template
-!NetSurf/Resources/$(1)/Templates$$(TPLEXT): $(2)
+$(FRONTEND_SOURCE_DIR)/appdir/Resources/$(1)/Templates$$(TPLEXT): $(2)
$$(VQ)echo "TEMPLATE: $(2)"
- $$(Q)$$(MKDIR) -p !NetSurf/Resources/$(1)
+ $$(Q)$$(MKDIR) -p $(FRONTEND_SOURCE_DIR)/appdir/Resources/$(1)
$$(Q)$$(CC) -x c -E -P $$(CFLAGS) $(2) | $$(CCRES) - $$@
-CLEAN_TEMPLATES += !NetSurf/Resources/$(1)/Templates$$(TPLEXT)
+CLEAN_TEMPLATES += $(FRONTEND_SOURCE_DIR)/appdir/Resources/$(1)/Templates$$(TPLEXT)
endef
@@ -141,7 +142,7 @@ package-riscos: netsurf.zip
netsurf.zip: $(EXETARGET)
$(eval $@_TMPDIR := $(shell mktemp -d))
$(Q) $(RM) $@
- $(Q) rsync --archive --verbose $(CURDIR)/!NetSurf $($@_TMPDIR)
+ $(Q) cp -rLvp $(FRONTEND_SOURCE_DIR)/appdir $($@_TMPDIR)/!NetSurf
$(Q) $(CURDIR)/utils/git-date.sh $(FRONTEND_SOURCE_DIR)/distribution
$(Q) rsync --archive --verbose $(FRONTEND_SOURCE_DIR)/distribution/!Boot $($@_TMPDIR)
$(Q) rsync --archive --verbose $(FRONTEND_SOURCE_DIR)/distribution/!System $($@_TMPDIR)
diff --git a/frontends/riscos/appdir/!Boot,feb b/frontends/riscos/appdir/!Boot,feb
new file mode 100644
index 000000000..ca7a3feec
--- /dev/null
+++ b/frontends/riscos/appdir/!Boot,feb
@@ -0,0 +1,90 @@
+| Boot file for NetSurf. ( $Revision$ )
+|
+| This file sets up various system variables which NetSurf may use.
+| Additionally, it places the NetSurf application sprites into the Wimp
+| sprite pool.
+|
+| This file may be executed in two ways:
+| 1. When NetSurf is first seen by the OS.
+| 2. When NetSurf is run by the user (called from the !Run file).
+| In the first instance, NetSurf-specific variables are set and non
+| NetSurf-specific variables which are unset are initialised.
+| In the second instance, all variables are set, irrespective of their
+| previous state. This is achieved by use of the NetSurf$ForceVars
+| variable, which is set by the !Run file prior to calling this file.
+
+| Set up NetSurf$Dir
+If (("<NetSurf$Dir>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set NetSurf$Dir <Obey$Dir>
+
+| Filetype -> Type name mappings
+|
+| These get set whether they were previously set or not
+Set File$Type_132 ICO
+Set File$Type_695 GIF
+Set File$Type_69C BMP
+Set File$Type_AAD SVG
+Set File$Type_ADF PDF
+Set File$Type_B28 URL
+Set File$Type_B60 PNG
+Set File$Type_C85 JPEG
+Set File$Type_F78 JNG
+Set File$Type_F79 CSS
+Set File$Type_F81 JSScript
+Set File$Type_F83 MNG
+Set File$Type_F91 URI
+Set File$Type_FAF HTML
+
+| Application system variables
+|
+| See http://www.iyonix.com/32bit/help.shtml for more details.
+If (("<NetSurf$Help>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set NetSurf$Help <NetSurf$Dir>.Docs.docs_en
+If (("<NetSurf$Web>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set NetSurf$Web "http://www.netsurf-browser.org/"
+If (("<NetSurf$Title>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set NetSurf$Title "NetSurf"
+If (("<NetSurf$Publisher>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set NetSurf$Publisher "The NetSurf Developers"
+If (("<NetSurf$Description>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set NetSurf$Description "Web browser"
+
+| NetSurf Sprites
+Set NetSurf$Sprites "!Sprites"
+/<NetSurf$Dir>.ChkSprites
+IconSprites <NetSurf$Dir>.<NetSurf$Sprites>
+Unset NetSurf$Sprites
+
+| Acorn URI protocol
+|
+| Format: Alias$Open_URI_<scheme> <command to run>
+|
+| These are basically a last resort. The URI module will initially broadcast
+| Message_URI_MProcess. If this isn't claimed, then it'll check if an
+| appropriate Alias$Open_URI_<scheme> variable is set. If such a variable
+| exists, then it will attempt to launch the task named by the variable.
+| If the launch is successful, the Message_URI_MProcess is rebroadcast.
+| The -nowin is required to ensure only one window is opened (this only has
+| an effect if the user has configured auto window opening at startup).
+If (("<Alias$Open_URI_http>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$Open_URI_http /<NetSurf$Dir>.!Run -nowin
+If (("<Alias$Open_URI_https>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$Open_URI_https /<NetSurf$Dir>.!Run -nowin
+If (("<Alias$Open_URI_file>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$Open_URI_file /<NetSurf$Dir>.!Run -nowin
+
+| ANT URL protocol
+|
+| Format: Alias$URLOpen_<scheme> <command to run>
+|
+| These handle the "load" stage of the protocol. The appropriate variable's
+| existence is checked then, if it is present, the URL to be opened is
+| appended to the string "URLOpen_<scheme> " and this is then fed to
+| Wimp_StartTask.
+If (("<Alias$URLOpen_http>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$URLOpen_http /<NetSurf$Dir>.!Run -url %%*0
+If (("<Alias$URLOpen_https>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$URLOpen_https /<NetSurf$Dir>.!Run -url %%*0
+If (("<Alias$URLOpen_file>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$URLOpen_file /<NetSurf$Dir>.!Run -url %%*0
+
+| Claim HTML and URL files
+|
+| Format: Alias$@RunType_<hex> <command to run>
+|
+| Again, a fallback. The filer initially tries a DataOpen message. If that
+| bounces, it looks at these variables.
+If (("<Alias$@RunType_FAF>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$@RunType_FAF /<NetSurf$Dir>.!Run -html %%*0
+If (("<Alias$@RunType_B28>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$@RunType_B28 /<NetSurf$Dir>.!Run -urlf %%*0
+
+| We don't claim the URI filetype as the spec tells us not to:
+| "Applications must not set an Alias$@RunType variable for the URI filetype"
+| Obviously this means that Browse/Phoenix and the Oreganos are incorrect.
diff --git a/frontends/riscos/appdir/!Sprites,ff9 b/frontends/riscos/appdir/!Sprites,ff9
new file mode 100644
index 000000000..2c7d6f648
--- /dev/null
+++ b/frontends/riscos/appdir/!Sprites,ff9
Binary files differ
diff --git a/frontends/riscos/appdir/!Sprites22,ff9 b/frontends/riscos/appdir/!Sprites22,ff9
new file mode 100644
index 000000000..8bc3aa616
--- /dev/null
+++ b/frontends/riscos/appdir/!Sprites22,ff9
Binary files differ
diff --git a/frontends/riscos/appdir/5Sprites,ff9 b/frontends/riscos/appdir/5Sprites,ff9
new file mode 100755
index 000000000..b0cf1c95f
--- /dev/null
+++ b/frontends/riscos/appdir/5Sprites,ff9
Binary files differ
diff --git a/frontends/riscos/appdir/5Sprites11,ff9 b/frontends/riscos/appdir/5Sprites11,ff9
new file mode 100755
index 000000000..c039ea180
--- /dev/null
+++ b/frontends/riscos/appdir/5Sprites11,ff9
Binary files differ
diff --git a/frontends/riscos/appdir/5Sprites22,ff9 b/frontends/riscos/appdir/5Sprites22,ff9
new file mode 100755
index 000000000..766471428
--- /dev/null
+++ b/frontends/riscos/appdir/5Sprites22,ff9
Binary files differ
diff --git a/frontends/riscos/appdir/ASprites,ff9 b/frontends/riscos/appdir/ASprites,ff9
new file mode 100755
index 000000000..5cab2a16b
--- /dev/null
+++ b/frontends/riscos/appdir/ASprites,ff9
Binary files differ
diff --git a/frontends/riscos/appdir/ASprites11,ff9 b/frontends/riscos/appdir/ASprites11,ff9
new file mode 100755
index 000000000..5f94dfbd9
--- /dev/null
+++ b/frontends/riscos/appdir/ASprites11,ff9
Binary files differ
diff --git a/frontends/riscos/appdir/ASprites22,ff9 b/frontends/riscos/appdir/ASprites22,ff9
new file mode 100755
index 000000000..cc932844e
--- /dev/null
+++ b/frontends/riscos/appdir/ASprites22,ff9
Binary files differ
diff --git a/frontends/riscos/appdir/ChkSprites,ffb b/frontends/riscos/appdir/ChkSprites,ffb
new file mode 100644
index 000000000..4e38dfba5
--- /dev/null
+++ b/frontends/riscos/appdir/ChkSprites,ffb
Binary files differ
diff --git a/frontends/riscos/appdir/Docs/online,b60 b/frontends/riscos/appdir/Docs/online,b60
new file mode 100755
index 000000000..1ef39f0c9
--- /dev/null
+++ b/frontends/riscos/appdir/Docs/online,b60
Binary files differ
diff --git a/frontends/riscos/appdir/FixFonts,ffb b/frontends/riscos/appdir/FixFonts,ffb
new file mode 100644
index 000000000..c6b73d0b0
--- /dev/null
+++ b/frontends/riscos/appdir/FixFonts,ffb
@@ -0,0 +1,147 @@
+REM Attempt to fix broken font installations which have non-Base0 copies of the
+REM ROM fonts in !Fonts on disc.
+
+ON ERROR ON ERROR OFF: PRINT REPORT$ + " (at line " + STR$ERL + ")": END
+
+DIM f$(11)
+f$() = "Corpus.Bold","Corpus.Bold.Oblique","Corpus.Medium","Corpus.Medium.Oblique","Homerton.Bold","Homerton.Bold.Oblique","Homerton.Medium","Homerton.Medium.Oblique","Trinity.Bold","Trinity.Bold.Italic","Trinity.Medium","Trinity.Medium.Italic"
+
+PRINT "FONT INSTALLATION FIX"
+PRINT
+
+PRINT "Checking ROM fonts"
+PRINT
+ok% = TRUE
+FOR f% = 0 TO 11
+ PROCcheck_rom_font(f$(f%))
+NEXT
+PRINT
+IF NOT ok% THEN
+ PRINT "One or more of the standard ROM fonts are missing!"
+ PRINT "Please contact the developers stating your RISC OS version."
+ END
+ENDIF
+
+
+PRINT "Searching for obsolete copies in Boot:Resources.!Fonts"
+PRINT
+ok% = TRUE
+FOR f% = 0 TO 11
+ PROCcheck_disc_font(f$(f%))
+NEXT
+PRINT
+IF ok% THEN
+ PRINT "No problems were found."
+ END
+ENDIF
+
+PRINT "One or more obsolete fonts were found in !Fonts."
+PRINT
+PRINT "Press Y to move these fonts to a new directory"
+PRINT "called 'ObsolFonts' and remove them from the"
+PRINT "font list ('Messages1'),"
+PRINT "or any other key to exit without changes."
+key$ = GET$
+IF INSTR("Yy", key$) = 0 THEN
+ PRINT
+ PRINT "Exiting without changes."
+ END
+ENDIF
+PRINT
+
+PRINT "Creating 'ObsolFonts' directory - ";
+SYS"OS_File", 8, "<Boot$Dir>.^.ObsolFonts"
+PRINT "done"
+PRINT
+PRINT "Closing open files - ";
+SYS"OS_FSControl", 22
+PRINT "done"
+PRINT
+PRINT "Removing fonts from font list - ";
+file% = OPENIN "<Boot$Dir>.Resources.!Fonts.Messages1"
+IF file% THEN
+ new% = OPENOUT "<Boot$Dir>.Resources.!Fonts.Messages_"
+ IF new% = 0 THEN
+ PRINT "Failed to open new font list"
+ END
+ ENDIF
+ WHILE NOT EOF#file%
+ line$ = GET$#file%
+ ok% = TRUE
+ FOR f% = 0 TO 11
+ IF INSTR(line$, "Font_" + f$(f%) + ":") <> 0 THEN ok% = FALSE
+ NEXT
+ IF ok% THEN
+ BPUT#new%, line$
+ ENDIF
+ ENDWHILE
+ CLOSE#file%
+ CLOSE#new%
+ SYS"OS_File", 18, "<Boot$Dir>.Resources.!Fonts.Messages_", &fff
+ SYS"XOS_FSControl", 27, "<Boot$Dir>.^.ObsolFonts.Messages1"
+ SYS"OS_FSControl", 25, "<Boot$Dir>.Resources.!Fonts.Messages1", "<Boot$Dir>.^.ObsolFonts.Messages1"
+ SYS"OS_FSControl", 25, "<Boot$Dir>.Resources.!Fonts.Messages_", "<Boot$Dir>.Resources.!Fonts.Messages1"
+ENDIF
+PRINT "done"
+PRINT
+PRINT "Moving away obsolete fonts"
+PRINT
+FOR f% = 0 TO 11
+ PROCfix_font(f$(f%))
+NEXT
+PRINT
+PRINT "Finished"
+PRINT "Please restart your machine for the changes to take effect."
+
+END
+
+
+
+DEF PROCcheck_rom_font(f$)
+PRINT " "; f$;
+SYS"OS_File", 17, "Resources:$.Fonts." + f$ + ".Outlines0" TO t1%
+SYS"OS_File", 17, "Resources:$.Fonts." + f$ + ".IntMetric0" TO t2%
+IF t1% = 1 AND t2% = 1 THEN
+ PRINT " - ok"
+ELSE
+ PRINT " - MISSING"
+ ok% = FALSE
+ENDIF
+ENDPROC
+
+
+
+DEF PROCcheck_disc_font(f$)
+SYS"OS_File", 17, "<Boot$Dir>.Resources.!Fonts." + f$ + ".Outlines" TO t%
+IF t% <> 0 THEN
+ PRINT " "; f$
+ ok% = FALSE
+ENDIF
+ENDPROC
+
+
+
+DEF PROCfix_font(f$)
+SYS"OS_File", 17, "<Boot$Dir>.Resources.!Fonts." + f$ + ".Outlines" TO t%
+IF t% = 0 THEN ENDPROC
+
+PRINT " "; f$; " - ";
+i% = 0
+REPEAT
+ i% = INSTR(f$, ".", i% + 1)
+ IF i% <> 0 THEN
+ SYS"OS_File", 8, "<Boot$Dir>.^.ObsolFonts." + LEFT$(f$, i% - 1)
+ ENDIF
+UNTIL i% = 0
+SYS"OS_File", 8, "<Boot$Dir>.^.ObsolFonts." + f$
+
+SYS"OS_FSControl", 25, "<Boot$Dir>.Resources.!Fonts." + f$ + ".Outlines", "<Boot$Dir>.^.ObsolFonts." + f$ + ".Outlines"
+
+SYS"OS_File", 17, "<Boot$Dir>.Resources.!Fonts." + f$ + ".IntMetrics" TO t%
+IF t% <> 0 THEN
+ SYS"OS_FSControl", 25, "<Boot$Dir>.Resources.!Fonts." + f$ + ".IntMetrics", "<Boot$Dir>.^.ObsolFonts." + f$ + ".IntMetrics"
+ENDIF
+
+PRINT "done"
+ENDPROC
+
diff --git a/frontends/riscos/appdir/KickNS,ffb b/frontends/riscos/appdir/KickNS,ffb
new file mode 100644
index 000000000..bc209ad02
--- /dev/null
+++ b/frontends/riscos/appdir/KickNS,ffb
Binary files differ
diff --git a/frontends/riscos/appdir/OpenChoices,feb b/frontends/riscos/appdir/OpenChoices,feb
new file mode 100755
index 000000000..06ed7be01
--- /dev/null
+++ b/frontends/riscos/appdir/OpenChoices,feb
@@ -0,0 +1 @@
+*Filer_OpenDir Choices:WWW.NetSurf
diff --git a/frontends/riscos/appdir/OpenHelp,ffb b/frontends/riscos/appdir/OpenHelp,ffb
new file mode 100644
index 000000000..8928652da
--- /dev/null
+++ b/frontends/riscos/appdir/OpenHelp,ffb
Binary files differ
diff --git a/frontends/riscos/appdir/OpenScrap,feb b/frontends/riscos/appdir/OpenScrap,feb
new file mode 100755
index 000000000..e45854bcd
--- /dev/null
+++ b/frontends/riscos/appdir/OpenScrap,feb
@@ -0,0 +1 @@
+*Filer_OpenDir <Wimp$ScrapDir>.WWW.NetSurf
diff --git a/frontends/riscos/appdir/Resources/AdBlock,f79 b/frontends/riscos/appdir/Resources/AdBlock,f79
new file mode 120000
index 000000000..8f57c43fd
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/AdBlock,f79
@@ -0,0 +1 @@
+../../../../resources/adblock.css \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/Aletheia,ffd b/frontends/riscos/appdir/Resources/Aletheia,ffd
new file mode 100644
index 000000000..9af7ea129
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/Aletheia,ffd
Binary files differ
diff --git a/frontends/riscos/appdir/Resources/CSS,f79 b/frontends/riscos/appdir/Resources/CSS,f79
new file mode 120000
index 000000000..3238d9188
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/CSS,f79
@@ -0,0 +1 @@
+../../../../resources/default.css \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/Fonts/NSSymbol/Encoding b/frontends/riscos/appdir/Resources/Fonts/NSSymbol/Encoding
new file mode 100644
index 000000000..c92dad17a
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/Fonts/NSSymbol/Encoding
@@ -0,0 +1,39 @@
+% Encoding vector for NSSymbol
+
+% Codes 0-31
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+/.notdef
+
+% Codes 32-33
+/H18543
+/circle
diff --git a/frontends/riscos/appdir/Resources/Fonts/NSSymbol/IntMetrics,ff6 b/frontends/riscos/appdir/Resources/Fonts/NSSymbol/IntMetrics,ff6
new file mode 100644
index 000000000..4dcbc625d
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/Fonts/NSSymbol/IntMetrics,ff6
Binary files differ
diff --git a/frontends/riscos/appdir/Resources/Fonts/NSSymbol/Outlines,ff6 b/frontends/riscos/appdir/Resources/Fonts/NSSymbol/Outlines,ff6
new file mode 100644
index 000000000..d2e624132
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/Fonts/NSSymbol/Outlines,ff6
Binary files differ
diff --git a/frontends/riscos/appdir/Resources/Icons b/frontends/riscos/appdir/Resources/Icons
new file mode 120000
index 000000000..6820377bb
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/Icons
@@ -0,0 +1 @@
+../../../../resources/icons \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/Image,ff9 b/frontends/riscos/appdir/Resources/Image,ff9
new file mode 100755
index 000000000..a61ddefd2
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/Image,ff9
Binary files differ
diff --git a/frontends/riscos/appdir/Resources/LangNames b/frontends/riscos/appdir/Resources/LangNames
new file mode 100644
index 000000000..de7c76c65
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/LangNames
@@ -0,0 +1,52 @@
+# Language names file for NetSurf
+#
+# IMPORTANT! - If you add/remove a language from this file, the
+# languages menu definition in menus.c _must_ be updated correspondingly.
+#
+lang_af:Afrikaans
+lang_bm:Bamanankan
+lang_ca:Català
+lang_cs:Cestina
+lang_cy:Cymraeg
+lang_da:Dansk
+lang_de:Deutsch
+lang_en:English
+lang_es:Español
+lang_et:Eesti
+lang_eu:euskera
+lang_ff:Fulfulde
+lang_fi:suomi
+lang_fr:français
+lang_ga:Gaeilge
+lang_gl:Galego
+lang_ha:Hausa
+lang_hr:Hrvatski
+lang_hu:Magyar
+lang_id:Bahasa indonesia
+lang_is:íslenska
+lang_it:italiano
+lang_lt:Lietuviskai
+lang_lv:Latviesu
+lang_ms:Bahasa melayu
+lang_mt:Malti
+lang_nl:Nederlands
+lang_no:Norsk
+lang_pl:Polski
+lang_pt:português
+lang_rn:Kirundi
+lang_ro:Româna
+lang_rw:Kinyarwanda
+lang_sk:Slovencina
+lang_sl:Slovenscina
+lang_so:Somali
+lang_sq:shqip
+lang_sr:Srpski
+lang_sv:svenska
+lang_sw:Kiswahili
+lang_tr:Türkçe
+lang_uz:o'zbek
+lang_vi:Tiêng Viêêt
+lang_wo:Wolof
+lang_xs:isiXhosa
+lang_yo:Yorùbá
+lang_zu:isiZulu
diff --git a/frontends/riscos/appdir/Resources/Quirks,f79 b/frontends/riscos/appdir/Resources/Quirks,f79
new file mode 120000
index 000000000..995fafc61
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/Quirks,f79
@@ -0,0 +1 @@
+../../../../resources/quirks.css \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/SearchEngines b/frontends/riscos/appdir/Resources/SearchEngines
new file mode 100644
index 000000000..e7fd7cb65
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/SearchEngines
@@ -0,0 +1,22 @@
+Google|www.google.com|http://www.google.com/search?q=%s|http://www.google.com/favicon.ico|
+Yahoo|search.yahoo.com|http://search.yahoo.com/search?p=%s|http://www.yahoo.com/favicon.ico|
+Bing|www.bing.com|http://www.bing.com/search?q=%s|http://www.bing.com/favicon.ico|
+Business.com|www.business.com|http://www.business.com/search/rslt_default.asp?query=%s|http://www.business.com/favicon.ico|
+Omgili|www.omgili.com|http://www.omgili.com/AAAAA/%s.html|http://www.omgili.com/favicon.ico|
+BBC News|search.bbc.co.uk|http://search.bbc.co.uk/search?q=%s&tab=ns|http://news.bbc.co.uk/favicon.ico|
+Ubuntu Packages|packages.ubuntu.com|http://packages.ubuntu.com/search?keywords=%s|http://packages.ubuntu.com/favicon.ico|
+Creative Commons|creativecommons.org|http://creativecommons.org/?s=%s|http://creativecommons.org/favicon.ico|
+Ask.com|www.ask.com|http://www.ask.com/web?q=%s|http://www.ask.com/favicon.ico|
+Answers.com|www.answers.com|http://www.answers.com/%s|http://www.answers.com/favicon.ico|
+Dictionary.com|dictionary.reference.com|http://dictionary.reference.com/browse/%s?jss=0|http://dictionary.reference.com/favicon.ico|
+Youtube|www.youtube.com|http://www.youtube.com/results?search_query=%s|http://www.youtube.com/favicon.ico|
+AeroMp3|www.aeromp3.com|http://www.aeromp3.com/search?q=%s|http://www.aeromp3.com/favicon.ico|
+AOL|search.aol.com|http://search.aol.com/aol/search?query=%s|http://www.aol.com/favicon.ico|
+Baidu|www.baidu.com|http://www.baidu.com/s?wd=%s|http://www.baidu.com/favicon.ico|
+Amazon|www.amazon.com|http://www.amazon.com/s/ref=nb_ss_gw?field-keywords=%s|http://www.amazon.com/favicon.ico|
+Ebay|shop.ebay.com|http://shop.ebay.com/items/%s|http://www.ebay.com/favicon.ico|
+IMDB|www.imdb.com|http://www.imdb.com/find?q=%s|http://www.imdb.com/favicon.ico|
+ESPN|search.espn.go.com|http://search.espn.go.com/%s/|http://www.espn.go.com/favicon.ico|
+Wikipedia|en.wikipedia.org|http://en.wikipedia.org/w/index.php?title=Special%%3ASearch&search=%s|http://en.wikipedia.org/favicon.ico|
+DuckDuckGo|www.duckduckgo.com|http://www.duckduckgo.com/?q=%s|http://www.duckduckgo.com/favicon.ico|
+Seeks|www.seeks-project.info|https://www.seeks-project.info/search.php/search?q=%s|http://www.seeks-project.info/search.php/public/images/seek_icon_32x32_transparent.png|
diff --git a/frontends/riscos/appdir/Resources/Sprites,ff9 b/frontends/riscos/appdir/Resources/Sprites,ff9
new file mode 100755
index 000000000..bdbd6e877
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/Sprites,ff9
Binary files differ
diff --git a/frontends/riscos/appdir/Resources/ca-bundle b/frontends/riscos/appdir/Resources/ca-bundle
new file mode 120000
index 000000000..2d99c7508
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/ca-bundle
@@ -0,0 +1 @@
+../../../../resources/ca-bundle \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/de/Messages b/frontends/riscos/appdir/Resources/de/Messages
new file mode 120000
index 000000000..aa4060685
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/de/Messages
@@ -0,0 +1 @@
+../../../../../resources/de/Messages \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/de/welcome.html,faf b/frontends/riscos/appdir/Resources/de/welcome.html,faf
new file mode 120000
index 000000000..d3cfb115d
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/de/welcome.html,faf
@@ -0,0 +1 @@
+../../../../../resources/de/welcome.html \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/en/!Help b/frontends/riscos/appdir/Resources/en/!Help
new file mode 100644
index 000000000..977f069d8
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/en/!Help
@@ -0,0 +1,14 @@
+NetSurf - Open Source web browser - http://www.netsurf-browser.org/
+
+To view the full documentation, start NetSurf and choose "Help..." from the
+icon bar menu.
+
+This is a development build of NetSurf. In case of problems, please check
+for a newer development build at http://www.netsurf-browser.org/
+
+Please report any unexpected behaviour on the NetSurf bug tracker.
+This may be found at http://bugs.netsurf-browser.org/
+
+
+Alternatively, the developers are often available on Freenode in the
+channel #netsurf.
diff --git a/frontends/riscos/appdir/Resources/en/Messages b/frontends/riscos/appdir/Resources/en/Messages
new file mode 120000
index 000000000..56c2ae237
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/en/Messages
@@ -0,0 +1 @@
+../../../../../resources/en/Messages \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/en/credits.html,faf b/frontends/riscos/appdir/Resources/en/credits.html,faf
new file mode 120000
index 000000000..7999c6c56
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/en/credits.html,faf
@@ -0,0 +1 @@
+../../../../../resources/en/credits.html \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/en/licence.html,faf b/frontends/riscos/appdir/Resources/en/licence.html,faf
new file mode 120000
index 000000000..70371ada8
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/en/licence.html,faf
@@ -0,0 +1 @@
+../../../../../resources/en/licence.html \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/en/maps.html,faf b/frontends/riscos/appdir/Resources/en/maps.html,faf
new file mode 120000
index 000000000..4ae4f6c42
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/en/maps.html,faf
@@ -0,0 +1 @@
+../../../../../resources/en/maps.html \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/en/welcome.html,faf b/frontends/riscos/appdir/Resources/en/welcome.html,faf
new file mode 120000
index 000000000..71020bfe8
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/en/welcome.html,faf
@@ -0,0 +1 @@
+../../../../../resources/en/welcome.html \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/fr/Messages b/frontends/riscos/appdir/Resources/fr/Messages
new file mode 120000
index 000000000..4c321aefd
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/fr/Messages
@@ -0,0 +1 @@
+../../../../../resources/fr/Messages \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/internal.css,f79 b/frontends/riscos/appdir/Resources/internal.css,f79
new file mode 120000
index 000000000..c807a4d3d
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/internal.css,f79
@@ -0,0 +1 @@
+../../../../resources/internal.css \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/it/Messages b/frontends/riscos/appdir/Resources/it/Messages
new file mode 120000
index 000000000..7dc2ae2b1
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/it/Messages
@@ -0,0 +1 @@
+../../../../../resources/it/Messages \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/it/credits.html,faf b/frontends/riscos/appdir/Resources/it/credits.html,faf
new file mode 120000
index 000000000..e0bd9a23f
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/it/credits.html,faf
@@ -0,0 +1 @@
+../../../../../resources/it/credits.html \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/it/licence.html,faf b/frontends/riscos/appdir/Resources/it/licence.html,faf
new file mode 120000
index 000000000..7e8c83571
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/it/licence.html,faf
@@ -0,0 +1 @@
+../../../../../resources/it/licence.html \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/it/welcome.html,faf b/frontends/riscos/appdir/Resources/it/welcome.html,faf
new file mode 120000
index 000000000..6e24135ff
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/it/welcome.html,faf
@@ -0,0 +1 @@
+../../../../../resources/it/welcome.html \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/ja/welcome.html,faf b/frontends/riscos/appdir/Resources/ja/welcome.html,faf
new file mode 120000
index 000000000..1dfdbd7ea
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/ja/welcome.html,faf
@@ -0,0 +1 @@
+../../../../../resources/ja/welcome.html \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/netsurf.png,b60 b/frontends/riscos/appdir/Resources/netsurf.png,b60
new file mode 120000
index 000000000..e7fa4cb87
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/netsurf.png,b60
@@ -0,0 +1 @@
+../../../../resources/netsurf.png \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/nl/!Help b/frontends/riscos/appdir/Resources/nl/!Help
new file mode 100644
index 000000000..4eca563bc
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/nl/!Help
@@ -0,0 +1,15 @@
+NetSurf - Webbrowser (met open broncode) - http://www.netsurf-browser.org/
+
+Om alle documentatie te kunnen raadplegen: start NetSurf en kies "Help..."
+vanuit het symbolenbalkmenu.
+
+Dit is een ontwikkelversie van NetSurf. Bij problemen: kijk eerst of er een
+nieuwere versie is op http://www.netsurf-browser.org/
+
+Gelieve ook elk onverwacht gedrag van NetSurf, in het Engels te melden via
+onze 'bug tracker' op http://bugs.netsurf-browser.org/
+
+
+Een alternatief is Freenode op het kanaal #netsurf waar de ontwikkelaars
+vaak bereikbaar zijn.
+
diff --git a/frontends/riscos/appdir/Resources/nl/Messages b/frontends/riscos/appdir/Resources/nl/Messages
new file mode 120000
index 000000000..20acc40f2
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/nl/Messages
@@ -0,0 +1 @@
+../../../../../resources/nl/Messages \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/nl/credits.html,faf b/frontends/riscos/appdir/Resources/nl/credits.html,faf
new file mode 120000
index 000000000..2380aa33c
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/nl/credits.html,faf
@@ -0,0 +1 @@
+../../../../../resources/nl/credits.html \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/nl/licence.html,faf b/frontends/riscos/appdir/Resources/nl/licence.html,faf
new file mode 120000
index 000000000..46804ce86
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/nl/licence.html,faf
@@ -0,0 +1 @@
+../../../../../resources/nl/licence.html \ No newline at end of file
diff --git a/frontends/riscos/appdir/Resources/nl/welcome.html,faf b/frontends/riscos/appdir/Resources/nl/welcome.html,faf
new file mode 120000
index 000000000..6de5c4a73
--- /dev/null
+++ b/frontends/riscos/appdir/Resources/nl/welcome.html,faf
@@ -0,0 +1 @@
+../../../../../resources/nl/welcome.html \ No newline at end of file
diff --git a/frontends/riscos/bitmap.c b/frontends/riscos/bitmap.c
index 1a3524633..d554d54b4 100644
--- a/frontends/riscos/bitmap.c
+++ b/frontends/riscos/bitmap.c
@@ -287,7 +287,10 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags)
error = xosspriteop_save_sprite_file(osspriteop_USER_AREA,
(bitmap->sprite_area), path);
if (error) {
- LOG("xosspriteop_save_sprite_file: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosspriteop_save_sprite_file: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("SaveError", error->errmess);
return false;
}
@@ -347,7 +350,8 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags)
error = xosfind_openoutw(0, path, NULL, &fw);
if (error) {
- LOG("xosfind_openoutw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfind_openoutw: 0x%x: %s",
+ error->errnum, error->errmess);
free(chunk_buf);
ro_warn_user("SaveError", error->errmess);
return false;
@@ -361,7 +365,8 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags)
if (!error)
error = xosgbpb_writew(fw, (byte*)p, image_size, NULL);
if (error) {
- LOG("xosgbpb_writew: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosgbpb_writew: 0x%x: %s",
+ error->errnum, error->errmess);
free(chunk_buf);
xosfind_closew(fw);
ro_warn_user("SaveError", error->errmess);
@@ -406,7 +411,10 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags)
}
error = xosgbpb_writew(fw, (byte*)chunk_buf, dp-chunk_buf, NULL);
if (error) {
- LOG("xosgbpb_writew: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosgbpb_writew: 0x%x: %s",
+ error->errnum,
+ error->errmess);
free(chunk_buf);
xosfind_closew(fw);
ro_warn_user("SaveError", error->errmess);
@@ -416,13 +424,15 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags)
error = xosfind_closew(fw);
if (error) {
- LOG("xosfind_closew: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfind_closew: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
}
error = xosfile_set_type(path, osfile_TYPE_SPRITE);
if (error) {
- LOG("xosfile_set_type: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfile_set_type: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
}
@@ -509,7 +519,8 @@ void riscos_bitmap_overlay_sprite(struct bitmap *bitmap,
(osspriteop_id)s,
&w, &h, NULL, NULL);
if (error) {
- LOG("xosspriteop_read_sprite_info: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosspriteop_read_sprite_info: 0x%x:%s",
+ error->errnum, error->errmess);
return;
}
sp_offset = ((s->width + 1) * 4) - w;
@@ -591,7 +602,7 @@ static osspriteop_area *thumbnail_create_8bpp(struct bitmap *bitmap)
sprite_area = (osspriteop_area *)malloc(area_size);
if (!sprite_area) {
- LOG("no memory for malloc()");
+ NSLOG(netsurf, INFO, "no memory for malloc()");
return NULL;
}
sprite_area->size = area_size;
@@ -759,7 +770,8 @@ static void thumbnail_test(void)
area_size = sizeof(osspriteop_area) +
sizeof(osspriteop_header) + sizeof(int);
if ((sprite_area = (osspriteop_area *)malloc(area_size)) == NULL) {
- LOG("Insufficient memory to perform sprite test.");
+ NSLOG(netsurf, INFO,
+ "Insufficient memory to perform sprite test.");
return;
}
sprite_area->size = area_size + 1;
@@ -791,7 +803,7 @@ nserror riscos_bitmap_render(struct bitmap *bitmap,
assert(content);
assert(bitmap);
- LOG("content %p in bitmap %p", content, bitmap);
+ NSLOG(netsurf, INFO, "content %p in bitmap %p", content, bitmap);
/* check if we have access to 32bpp sprites natively */
if (thumbnail_32bpp_available == -1) {
diff --git a/frontends/riscos/buffer.c b/frontends/riscos/buffer.c
index 7176c1c1c..c63a270db 100644
--- a/frontends/riscos/buffer.c
+++ b/frontends/riscos/buffer.c
@@ -107,7 +107,12 @@ void ro_gui_buffer_open(wimp_draw *redraw)
*/
if ((clipping.x1 < clipping.x0) ||
(clipping.y1 < clipping.y0)) {
- LOG("Invalid clipping rectangle (%i, %i) to (%i,%i)", clipping.x0, clipping.y0, clipping.x1, clipping.y1);
+ NSLOG(netsurf, INFO,
+ "Invalid clipping rectangle (%i, %i) to (%i,%i)",
+ clipping.x0,
+ clipping.y0,
+ clipping.x1,
+ clipping.y1);
return;
}
@@ -138,7 +143,7 @@ void ro_gui_buffer_open(wimp_draw *redraw)
(word_width * sprite_size.y * 4) + palette_size;
buffer = (osspriteop_area *)malloc(total_size);
if (!buffer) {
- LOG("Failed to allocate memory");
+ NSLOG(netsurf, INFO, "Failed to allocate memory");
ro_gui_buffer_free();
return;
}
@@ -149,7 +154,8 @@ void ro_gui_buffer_open(wimp_draw *redraw)
mode = tinct_SPRITE_MODE;
#else
if ((error = xwimpreadsysinfo_wimp_mode(&mode)) != NULL) {
- LOG("Error reading mode '%s'", error->errmess);
+ NSLOG(netsurf, INFO, "Error reading mode '%s'",
+ error->errmess);
ro_gui_buffer_free();
return;
}
@@ -177,7 +183,9 @@ void ro_gui_buffer_open(wimp_draw *redraw)
error = xos_read_vdu_variables(PTR_OS_VDU_VAR_LIST(&vars), (int *)&vals);
if (error) {
- LOG("Error reading mode properties '%s'", error->errmess);
+ NSLOG(netsurf, INFO,
+ "Error reading mode properties '%s'",
+ error->errmess);
ro_gui_buffer_free();
return;
}
@@ -233,7 +241,9 @@ void ro_gui_buffer_open(wimp_draw *redraw)
}
break;
default:
- LOG("Unhandled 16bpp format from flags %d", vals.flags);
+ NSLOG(netsurf, INFO,
+ "Unhandled 16bpp format from flags %d",
+ vals.flags);
ro_gui_buffer_free();
return;
}
@@ -261,13 +271,16 @@ void ro_gui_buffer_open(wimp_draw *redraw)
}
break;
default:
- LOG("Unhandled 32bpp data format from flags %d", vals.flags);
+ NSLOG(netsurf, INFO,
+ "Unhandled 32bpp data format from flags %d",
+ vals.flags);
ro_gui_buffer_free();
return;
}
break;
default:
- LOG("Unhandled NCOLOUR value %d", vals.ncolour);
+ NSLOG(netsurf, INFO, "Unhandled NCOLOUR value %d",
+ vals.ncolour);
ro_gui_buffer_free();
return;
}
@@ -305,7 +318,7 @@ void ro_gui_buffer_open(wimp_draw *redraw)
buffer, buffer_name, palette,
clipping.x0, clipping.y0,
clipping.x1, clipping.y1)) != NULL) {
- LOG("Grab error '%s'", error->errmess);
+ NSLOG(netsurf, INFO, "Grab error '%s'", error->errmess);
ro_gui_buffer_free();
return;
}
@@ -314,7 +327,7 @@ void ro_gui_buffer_open(wimp_draw *redraw)
*/
if ((error = xosspriteop_read_save_area_size(osspriteop_PTR,
buffer, (osspriteop_id)(buffer + 1), &size)) != NULL) {
- LOG("Save area error '%s'", error->errmess);
+ NSLOG(netsurf, INFO, "Save area error '%s'", error->errmess);
ro_gui_buffer_free();
return;
}
@@ -329,7 +342,7 @@ void ro_gui_buffer_open(wimp_draw *redraw)
if ((error = xosspriteop_switch_output_to_sprite(osspriteop_PTR,
buffer, (osspriteop_id)(buffer + 1), save_area,
&context0, &context1, &context2, &context3)) != NULL) {
- LOG("Switching error '%s'", error->errmess);
+ NSLOG(netsurf, INFO, "Switching error '%s'", error->errmess);
free(save_area);
ro_gui_buffer_free();
return;
@@ -345,7 +358,8 @@ void ro_gui_buffer_open(wimp_draw *redraw)
*/
if ((error = xos_set_ecf_origin(-ro_plot_origin_x,
-ro_plot_origin_y)) != NULL) {
- LOG("Invalid ECF origin: '%s'", error->errmess);
+ NSLOG(netsurf, INFO, "Invalid ECF origin: '%s'",
+ error->errmess);
}
}
diff --git a/frontends/riscos/configure.c b/frontends/riscos/configure.c
index 9d28616ec..f4dced55b 100644
--- a/frontends/riscos/configure.c
+++ b/frontends/riscos/configure.c
@@ -212,7 +212,10 @@ void ro_gui_configure_open_window(wimp_open *open)
y + configure_icon_height -
CONFIGURE_ICON_PADDING_V);
if (error) {
- LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_resize_icon: 0x%x: %s",
+ error->errnum,
+ error->errmess);
}
x += configure_icon_width;
l++;
@@ -225,7 +228,8 @@ void ro_gui_configure_open_window(wimp_open *open)
error = xwimp_force_redraw(configure_window,
0, -16384, 16384, 0);
if (error) {
- LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -248,7 +252,8 @@ void ro_gui_configure_open_window(wimp_open *open)
extent.y0 = -max_height;
error = xwimp_set_extent(open->w, &extent);
if (error) {
- LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -259,7 +264,8 @@ void ro_gui_configure_open_window(wimp_open *open)
/* open the window */
error = xwimp_open_window(open);
if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -276,7 +282,7 @@ void ro_gui_configure_register(const char *window,
/* create our tool */
tool = calloc(sizeof(struct configure_tool), 1);
if (!tool) {
- LOG("Insufficient memory for calloc()");
+ NSLOG(netsurf, INFO, "Insufficient memory for calloc()");
die("Insufficient memory");
return; /* For the benefit of scan-build */
}
@@ -284,7 +290,7 @@ void ro_gui_configure_register(const char *window,
tool->translated[0] = '\0';
tool->validation = malloc(strlen(window) + 2);
if (!tool->validation) {
- LOG("Insufficient memory for malloc()");
+ NSLOG(netsurf, INFO, "Insufficient memory for malloc()");
die("Insufficient memory");
}
sprintf(tool->validation, "S%s", window);
@@ -311,7 +317,8 @@ void ro_gui_configure_register(const char *window,
CONFIGURE_TOOL_TRANSLATED_SIZE;
error = xwimp_create_icon(&new_icon, &tool->i);
if (error) {
- LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s",
+ error->errnum, error->errmess);
die(error->errmess);
}
@@ -360,7 +367,8 @@ bool ro_gui_configure_translate(void)
error = xosbyte1(osbyte_ALPHABET_NUMBER, 127, 0,
&alphabet);
if (error) {
- LOG("failed reading alphabet: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "failed reading alphabet: 0x%x: %s",
+ error->errnum, error->errmess);
/* assume Latin1 */
alphabet = territory_ALPHABET_LATIN1;
}
@@ -381,7 +389,10 @@ bool ro_gui_configure_translate(void)
error = xwimptextop_string_width(tool->translated,
strlen(tool->translated), &icon_width);
if (error) {
- LOG("xwimptextop_string_width: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimptextop_string_width: 0x%x: %s",
+ error->errnum,
+ error->errmess);
return false;
}
icon_width += CONFIGURE_ICON_PADDING_H;
@@ -395,7 +406,8 @@ bool ro_gui_configure_translate(void)
configure_icon_width,
0);
if (error) {
- LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s",
+ error->errnum, error->errmess);
}
}
diff --git a/frontends/riscos/configure/con_image.c b/frontends/riscos/configure/con_image.c
index 49dd4f76d..c7fc7f314 100644
--- a/frontends/riscos/configure/con_image.c
+++ b/frontends/riscos/configure/con_image.c
@@ -150,8 +150,9 @@ void ro_gui_options_image_redraw(wimp_draw *redraw)
icon_state.i = IMAGE_CURRENT_DISPLAY;
error = xwimp_get_icon_state(&icon_state);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MenuError", error->errmess);
return;
}
diff --git a/frontends/riscos/configure/con_language.c b/frontends/riscos/configure/con_language.c
index 2030c65c0..77e4f6cb4 100644
--- a/frontends/riscos/configure/con_language.c
+++ b/frontends/riscos/configure/con_language.c
@@ -98,7 +98,8 @@ bool ro_gui_options_language_ok(wimp_w w)
if (temp) {
nsoption_set_charp(language, temp);
} else {
- LOG("No memory to duplicate language code");
+ NSLOG(netsurf, INFO,
+ "No memory to duplicate language code");
ro_warn_user("NoMemory", 0);
}
}
@@ -113,7 +114,8 @@ bool ro_gui_options_language_ok(wimp_w w)
if (temp) {
nsoption_set_charp(accept_language,temp);
} else {
- LOG("No memory to duplicate language code");
+ NSLOG(netsurf, INFO,
+ "No memory to duplicate language code");
ro_warn_user("NoMemory", 0);
}
}
diff --git a/frontends/riscos/configure/con_theme.c b/frontends/riscos/configure/con_theme.c
index fb0d3dfb0..28195dea9 100644
--- a/frontends/riscos/configure/con_theme.c
+++ b/frontends/riscos/configure/con_theme.c
@@ -104,20 +104,23 @@ bool ro_gui_options_theme_initialise(wimp_w w)
return false;
error = xwimp_create_window(&theme_pane_definition, &theme_pane);
if (error) {
- LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
state.w = w;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
icon_state.w = w;
icon_state.i = THEME_PANE_AREA;
error = xwimp_get_icon_state(&icon_state);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
state.w = theme_pane;
@@ -126,7 +129,8 @@ bool ro_gui_options_theme_initialise(wimp_w w)
state.visible.x0 += icon_state.icon.extent.x0 + 16;
state.visible.y0 = state.visible.y1 + icon_state.icon.extent.y0 + 16;
state.visible.y1 += icon_state.icon.extent.y1 - 28;
- LOG("Y0 = %i, y1 = %i", icon_state.icon.extent.y0, icon_state.icon.extent.y1);
+ NSLOG(netsurf, INFO, "Y0 = %i, y1 = %i", icon_state.icon.extent.y0,
+ icon_state.icon.extent.y1);
error = xwimp_open_window_nested(PTR_WIMP_OPEN(&state), w,
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
<< wimp_CHILD_XORIGIN_SHIFT |
@@ -141,7 +145,8 @@ bool ro_gui_options_theme_initialise(wimp_w w)
wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
<< wimp_CHILD_TS_EDGE_SHIFT);
if (error) {
- LOG("xwimp_open_window_nested: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window_nested: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
@@ -176,7 +181,8 @@ void ro_gui_options_theme_finalise(wimp_w w)
ro_gui_wimp_event_finalise(theme_pane);
error = xwimp_delete_window(theme_pane);
if (error) {
- LOG("xwimp_delete_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
theme_pane = 0;
@@ -269,7 +275,7 @@ void ro_gui_options_theme_load(void)
ro_toolbar_rebuild(toolbar);
toolbar_display = calloc(sizeof(struct toolbar_display), 1);
if (!toolbar_display) {
- LOG("No memory for calloc()");
+ NSLOG(netsurf, INFO, "No memory for calloc()");
ro_warn_user("NoMemory", 0);
return;
}
@@ -291,7 +297,8 @@ void ro_gui_options_theme_load(void)
state.w = theme_pane;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
diff --git a/frontends/riscos/content-handlers/artworks.c b/frontends/riscos/content-handlers/artworks.c
index f70b10ac7..8ec4edcae 100644
--- a/frontends/riscos/content-handlers/artworks.c
+++ b/frontends/riscos/content-handlers/artworks.c
@@ -183,18 +183,19 @@ bool artworks_convert(struct content *c)
xos_read_var_val_size("Alias$LoadArtWorksModules", 0, os_VARTYPE_STRING,
&used, NULL, NULL);
if (used >= 0) {
- LOG("Alias$LoadArtWorksModules not defined");
+ NSLOG(netsurf, INFO, "Alias$LoadArtWorksModules not defined");
msg_data.error = messages_get("AWNotSeen");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
/* load the modules, or do nothing if they're already loaded */
error = xos_cli("LoadArtWorksModules");
if (error) {
- LOG("xos_cli: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xos_cli: 0x%x: %s", error->errnum,
+ error->errmess);
msg_data.error = error->errmess;
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -202,9 +203,10 @@ bool artworks_convert(struct content *c)
error = (os_error*)_swix(AWRender_FileInitAddress, _OUT(0) | _OUT(1),
&init_routine, &init_workspace);
if (error) {
- LOG("AWRender_FileInitAddress: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "AWRender_FileInitAddress: 0x%x: %s",
+ error->errnum, error->errmess);
msg_data.error = error->errmess;
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -212,9 +214,10 @@ bool artworks_convert(struct content *c)
&aw->render_routine,
&aw->render_workspace);
if (error) {
- LOG("AWRender_RenderAddress: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "AWRender_RenderAddress: 0x%x: %s",
+ error->errnum, error->errmess);
msg_data.error = error->errmess;
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -224,9 +227,10 @@ bool artworks_convert(struct content *c)
error = awrender_init(&source_data, &source_size,
init_routine, init_workspace);
if (error) {
- LOG("awrender_init: 0x%x : %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "awrender_init: 0x%x : %s",
+ error->errnum, error->errmess);
msg_data.error = error->errmess;
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -239,13 +243,15 @@ bool artworks_convert(struct content *c)
&aw->y1);
if (error) {
- LOG("AWRender_DocBounds: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "AWRender_DocBounds: 0x%x: %s",
+ error->errnum, error->errmess);
msg_data.error = error->errmess;
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
- LOG("bounding box: %d,%d,%d,%d", aw->x0, aw->y0, aw->x1, aw->y1);
+ NSLOG(netsurf, INFO, "bounding box: %d,%d,%d,%d", aw->x0, aw->y0,
+ aw->x1, aw->y1);
/* create the resizable workspace required by the
ArtWorksRenderer rendering routine */
@@ -253,9 +259,10 @@ bool artworks_convert(struct content *c)
aw->size = INITIAL_BLOCK_SIZE;
aw->block = malloc(INITIAL_BLOCK_SIZE);
if (!aw->block) {
- LOG("failed to create block for ArtworksRenderer");
+ NSLOG(netsurf, INFO,
+ "failed to create block for ArtworksRenderer");
msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -317,7 +324,7 @@ bool artworks_redraw(struct content *c, struct content_redraw_data *data,
int clip_x1 = clip->x1;
int clip_y1 = clip->y1;
- if (ctx->plot->flush && !ctx->plot->flush())
+ if (ctx->plot->flush && (ctx->plot->flush(ctx) != NSERROR_OK))
return false;
/* pick up render addresses again in case they've changed
@@ -368,13 +375,15 @@ bool artworks_redraw(struct content *c, struct content_redraw_data *data,
error = xos_read_vdu_variables(PTR_OS_VDU_VAR_LIST(&vars), vals);
if (error) {
- LOG("xos_read_vdu_variables: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xos_read_vdu_variables: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
error = xwimp_read_palette((os_palette*)&vals[3]);
if (error) {
- LOG("xwimp_read_palette: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_read_palette: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
@@ -393,7 +402,8 @@ bool artworks_redraw(struct content *c, struct content_redraw_data *data,
aw->render_workspace);
if (error) {
- LOG("awrender_render: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "awrender_render: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
diff --git a/frontends/riscos/content-handlers/draw.c b/frontends/riscos/content-handlers/draw.c
index 9dff75736..bb66f9dbb 100644
--- a/frontends/riscos/content-handlers/draw.c
+++ b/frontends/riscos/content-handlers/draw.c
@@ -126,9 +126,10 @@ bool draw_convert(struct content *c)
error = xdrawfile_bbox(0, (drawfile_diagram *) data,
(int) source_size, 0, &bbox);
if (error) {
- LOG("xdrawfile_bbox: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xdrawfile_bbox: 0x%x: %s",
+ error->errnum, error->errmess);
msg_data.error = error->errmess;
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -184,7 +185,7 @@ bool draw_redraw(struct content *c, struct content_redraw_data *data,
const void *src_data;
os_error *error;
- if (ctx->plot->flush && !ctx->plot->flush())
+ if (ctx->plot->flush && (ctx->plot->flush(ctx) != NSERROR_OK))
return false;
if (!c->width || !c->height)
@@ -208,7 +209,8 @@ bool draw_redraw(struct content *c, struct content_redraw_data *data,
error = xdrawfile_render(0, (drawfile_diagram *) src_data,
(int) source_size, &matrix, 0, 0);
if (error) {
- LOG("xdrawfile_render: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xdrawfile_render: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
diff --git a/frontends/riscos/content-handlers/sprite.c b/frontends/riscos/content-handlers/sprite.c
index ed06110ec..3556aa555 100644
--- a/frontends/riscos/content-handlers/sprite.c
+++ b/frontends/riscos/content-handlers/sprite.c
@@ -126,7 +126,7 @@ bool sprite_convert(struct content *c)
/* check for bad data */
if ((int)source_size + 4 != area->used) {
msg_data.error = messages_get("BadSprite");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -135,9 +135,12 @@ bool sprite_convert(struct content *c)
(osspriteop_id) ((char *) area + area->first),
&w, &h, NULL, NULL);
if (error) {
- LOG("xosspriteop_read_sprite_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosspriteop_read_sprite_info: 0x%x: %s",
+ error->errnum,
+ error->errmess);
msg_data.error = error->errmess;
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@@ -180,7 +183,7 @@ bool sprite_redraw(struct content *c, struct content_redraw_data *data,
{
sprite_content *sprite = (sprite_content *) c;
- if (ctx->plot->flush && !ctx->plot->flush())
+ if (ctx->plot->flush && (ctx->plot->flush(ctx) != NSERROR_OK))
return false;
return image_redraw(sprite->data,
diff --git a/frontends/riscos/cookies.c b/frontends/riscos/cookies.c
index 38963ab3a..125d04356 100644
--- a/frontends/riscos/cookies.c
+++ b/frontends/riscos/cookies.c
@@ -377,7 +377,7 @@ static nserror ro_cookie_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct ro_cookie_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
@@ -445,12 +445,12 @@ nserror ro_gui_cookies_present(void)
res = ro_cookie_init();
if (res == NSERROR_OK) {
- LOG("Presenting");
+ NSLOG(netsurf, INFO, "Presenting");
ro_gui_dialog_open_top(cookie_window->core.wh,
cookie_window->core.toolbar,
600, 800);
} else {
- LOG("Failed presenting code %d", res);
+ NSLOG(netsurf, INFO, "Failed presenting code %d", res);
}
return res;
diff --git a/frontends/riscos/corewindow.c b/frontends/riscos/corewindow.c
index 3219be985..84177aa90 100644
--- a/frontends/riscos/corewindow.c
+++ b/frontends/riscos/corewindow.c
@@ -42,6 +42,7 @@
#include "riscos/wimp_event.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
+#include "riscos/window.h"
#include "riscos/toolbar.h"
#include "riscos/mouse.h"
#include "riscos/corewindow.h"
@@ -62,22 +63,22 @@ static void update_scrollbars(struct ro_corewindow *ro_cw, wimp_open *open)
int extent_height;
os_box extent;
- LOG("RO corewindow context %p", ro_cw);
+ NSLOG(netsurf, INFO, "RO corewindow context %p", ro_cw);
/* extent of content in not smaller than window so start there */
extent_width = open->visible.x1 - open->visible.x0;
extent_height = open->visible.y0 - open->visible.y1;
- LOG("extent w:%d h:%d content w:%d h:%d origin h:%d",
- extent_width, extent_height,
- ro_cw->content_width, ro_cw->content_height, ro_cw->origin_y);
+ NSLOG(netsurf, INFO,
+ "extent w:%d h:%d content w:%d h:%d origin h:%d", extent_width,
+ extent_height, ro_cw->content_width, ro_cw->content_height,
+ ro_cw->origin_y);
if (ro_cw->content_width > extent_width) {
extent_width = ro_cw->content_width;
}
if (extent_height > (ro_cw->origin_y + ro_cw->content_height)) {
extent_height = ro_cw->origin_y + ro_cw->content_height;
}
- LOG("extent w:%d h:%d",
- extent_width, extent_height);
+ NSLOG(netsurf, INFO, "extent w:%d h:%d", extent_width, extent_height);
extent.x0 = 0;
extent.y0 = extent_height;
extent.x1 = extent_width;
@@ -85,15 +86,15 @@ static void update_scrollbars(struct ro_corewindow *ro_cw, wimp_open *open)
error = xwimp_set_extent(ro_cw->wh, &extent);
if (error) {
- LOG("xwimp_set_extent: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
error = xwimp_open_window(open);
if (error) {
- LOG("xwimp_open_window: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
}
}
@@ -129,8 +130,8 @@ static void ro_cw_redraw(wimp_draw *redraw)
error = xwimp_get_rectangle(redraw, &more);
}
if (error != NULL) {
- LOG("xwimp_redraw_window: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s",
+ error->errnum, error->errmess);
}
}
@@ -144,7 +145,7 @@ static void ro_cw_scroll(wimp_scroll *scroll)
wimp_open open;
ro_cw = (struct ro_corewindow *)ro_gui_wimp_event_get_user_data(scroll->w);
- LOG("RO corewindow context %p", ro_cw);
+ NSLOG(netsurf, INFO, "RO corewindow context %p", ro_cw);
page_x = scroll->visible.x1 - scroll->visible.x0 - 32;
page_y = scroll->visible.y1 - scroll->visible.y0 - 32;
@@ -201,8 +202,8 @@ static void ro_cw_scroll(wimp_scroll *scroll)
error = xwimp_open_window(&open);
if (error) {
- LOG("xwimp_open_window: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
}
}
@@ -230,38 +231,38 @@ static void ro_cw_mouse_at(wimp_pointer *pointer, void *data)
ro_cw = (struct ro_corewindow *)ro_gui_wimp_event_get_user_data(pointer->w);
if (ro_cw == NULL) {
- LOG("no corewindow conext for window: 0x%x",
- (unsigned int)pointer->w);
+ NSLOG(netsurf, INFO, "no corewindow conext for window: 0x%x",
+ (unsigned int)pointer->w);
return;
}
- LOG("RO corewindow context %p", ro_cw);
+ NSLOG(netsurf, INFO, "RO corewindow context %p", ro_cw);
- /* no futher processing required if no drag in progress */
- if (ro_cw->drag_status == CORE_WINDOW_DRAG_NONE) {
- return;
- }
-
- /* Not a Menu click and a drag is in progress. */
+ /* Not a Menu click. */
state.w = pointer->w;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
- /* Convert the returned mouse coordinates into NetSurf's internal
- * units.
+ /* Convert the returned mouse coordinates into
+ * NetSurf's internal units.
*/
xpos = ((pointer->pos.x - state.visible.x0) + state.xscroll) / 2;
ypos = ((state.visible.y1 - pointer->pos.y) -
state.yscroll + ro_cw->origin_y) / 2;
- /* Start to process the mouse click. */
- mouse = ro_gui_mouse_drag_state(pointer->buttons,
- wimp_BUTTON_DOUBLE_CLICK_DRAG);
+ /* if no drag in progress report hover */
+ if (ro_cw->drag_status == CORE_WINDOW_DRAG_NONE) {
+ mouse = BROWSER_MOUSE_HOVER;
+ } else {
+ /* Start to process the mouse click. */
+ mouse = ro_gui_mouse_drag_state(pointer->buttons,
+ wimp_BUTTON_DOUBLE_CLICK_DRAG);
- ro_cw->mouse(ro_cw, mouse, xpos, ypos);
+ ro_cw->mouse(ro_cw, mouse, xpos, ypos);
+ }
if (!(mouse & BROWSER_MOUSE_DRAG_ON)) {
ro_cw->mouse(ro_cw, BROWSER_MOUSE_HOVER, xpos, ypos);
@@ -284,14 +285,15 @@ static void ro_cw_drag_end(wimp_dragged *drag, void *data)
error = xwimp_drag_box((wimp_drag *) -1);
if (error) {
- LOG("xwimp_drag_box: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
error = xwimp_auto_scroll(0, NULL, NULL);
if (error) {
- LOG("xwimp_auto_scroll: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_auto_scroll: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -344,12 +346,13 @@ ro_cw_drag_start(struct ro_corewindow *ro_cw,
break;
}
- LOG("Drag start...");
+ NSLOG(netsurf, INFO, "Drag start...");
error = xwimp_drag_box_with_flags(&drag,
wimp_DRAG_BOX_KEEP_IN_LINE | wimp_DRAG_BOX_CLIP);
if (error) {
- LOG("xwimp_drag_box: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
} else {
auto_scroll.w = ro_cw->wh;
@@ -363,7 +366,8 @@ ro_cw_drag_start(struct ro_corewindow *ro_cw,
error = xwimp_auto_scroll(wimp_AUTO_SCROLL_ENABLE_VERTICAL,
&auto_scroll, NULL);
if (error) {
- LOG("xwimp_auto_scroll: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_auto_scroll: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -373,16 +377,40 @@ ro_cw_drag_start(struct ro_corewindow *ro_cw,
/**
+ * Handle Pointer Leaving Window events.
+ *
+ * These events are delivered as the termination callback handler from
+ * ro_mouse's mouse tracking.
+ *
+ * \param leaving The Wimp_PointerLeavingWindow block.
+ * \param data NULL data pointer.
+ */
+static void ro_cw_pointer_leaving(wimp_leaving *leaving, void *data)
+{
+ struct ro_corewindow *ro_cw;
+
+ ro_cw = (struct ro_corewindow *)ro_gui_wimp_event_get_user_data(leaving->w);
+ if (ro_cw == NULL) {
+ NSLOG(netsurf, INFO, "no corewindow conext for window: 0x%x",
+ (unsigned int)leaving->w);
+ return;
+ }
+
+ ro_cw->mouse(ro_cw, BROWSER_MOUSE_LEAVE, 0, 0);
+}
+
+
+/**
* Wimp callback on pointer entering window.
*
* The wimp has issued an event to the window because the pointer has
* entered it.
*
- * \param open The open event to be processed
+ * \param entering The entering event to be processed
*/
static void ro_cw_pointer_entering(wimp_entering *entering)
{
- ro_mouse_track_start(NULL, ro_cw_mouse_at, NULL);
+ ro_mouse_track_start(ro_cw_pointer_leaving, ro_cw_mouse_at, NULL);
}
@@ -414,14 +442,14 @@ static bool ro_cw_mouse_click(wimp_pointer *pointer)
struct ro_corewindow *ro_cw;
ro_cw = (struct ro_corewindow *)ro_gui_wimp_event_get_user_data(pointer->w);
- LOG("RO corewindow context %p", ro_cw);
+ NSLOG(netsurf, INFO, "RO corewindow context %p", ro_cw);
state.w = ro_cw->wh;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
@@ -492,7 +520,7 @@ static bool ro_cw_keypress(wimp_key *key)
nserror res;
ro_cw = (struct ro_corewindow *)ro_gui_wimp_event_get_user_data(key->w);
- LOG("RO corewindow context %p", ro_cw);
+ NSLOG(netsurf, INFO, "RO corewindow context %p", ro_cw);
c = (uint32_t) key->c;
@@ -615,8 +643,8 @@ static void cw_tb_size(void *ctx)
state.w = ro_cw->wh;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
@@ -624,8 +652,8 @@ static void cw_tb_size(void *ctx)
0, state.visible.y0 - state.visible.y1,
state.visible.x1 - state.visible.x0, 0);
if (error) {
- LOG("xwimp_force_redraw: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
}
@@ -664,6 +692,8 @@ static void cw_tb_update(void *ctx)
* Respond to user actions (click) in a corewindow.
*
* \param ctx Context as passed to toolbar creation.
+ * \param action_type type of action on toolbar
+ * \param action data for action.
*/
static void
cw_tb_click(void *ctx,
@@ -698,7 +728,9 @@ static void cw_tb_save(void *ctx, char *config)
-/** core window toolbar callbacks */
+/**
+ * riscos core window toolbar callbacks
+ */
static const struct toolbar_callbacks corewindow_toolbar_callbacks = {
.theme_update = cw_tb_theme,
.change_size = cw_tb_size,
@@ -707,24 +739,52 @@ static const struct toolbar_callbacks corewindow_toolbar_callbacks = {
.save_buttons = cw_tb_save,
};
+
/**
- * callback from core to request a redraw.
+ * callback from core to request an invalidation of a window area.
+ *
+ * The specified area of the window should now be considered
+ * out of date. If the area is NULL the entire window must be
+ * invalidated.
+ *
+ * \param[in] cw The core window to invalidate.
+ * \param[in] r area to redraw or NULL for the entire window area.
+ * \return NSERROR_OK on success or appropriate error code.
*/
-static void
-ro_cw_redraw_request(struct core_window *cw, const struct rect *r)
+static nserror
+ro_cw_invalidate(struct core_window *cw, const struct rect *r)
{
struct ro_corewindow *ro_cw = (struct ro_corewindow *)cw;
os_error *error;
+ wimp_window_info info;
+
+ if (r == NULL) {
+ info.w = ro_cw->wh;
+ error = xwimp_get_window_info_header_only(&info);
+ if (error) {
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_info_header_only: 0x%x: %s",
+ error->errnum,
+ error->errmess);
+ return NSERROR_INVALID;
+ }
+ } else {
+ /* convert the passed rectangle into RO window dimensions */
+ info.extent.x0 = 2 * r->x0;
+ info.extent.y0 = (-2 * (r->y0 + (r->y1 - r->y0))) + ro_cw->origin_y;
+ info.extent.x1 = 2 * (r->x0 + (r->x1 - r->x0));
+ info.extent.y1 = (-2 * r->y0) + ro_cw->origin_y;
+ }
error = xwimp_force_redraw(ro_cw->wh,
- (2 * r->x0),
- (-2 * (r->y0 + (r->y1 - r->y0))) + ro_cw->origin_y,
- (2 * (r->x0 + (r->x1 - r->x0))),
- (-2 * r->y0) + ro_cw->origin_y);
+ info.extent.x0, info.extent.y0,
+ info.extent.x1, info.extent.y1);
if (error) {
- LOG("xwimp_force_redraw: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s",
+ error->errnum, error->errmess);
+ return NSERROR_INVALID;
}
+ return NSERROR_OK;
}
@@ -739,8 +799,8 @@ ro_cw_update_size(struct core_window *cw, int width, int height)
wimp_window_state state;
os_error *error;
- LOG("content resize from w:%d h:%d to w:%d h:%d",
- ro_cw->content_width, ro_cw->content_height, width, height);
+ NSLOG(netsurf, INFO, "content resize from w:%d h:%d to w:%d h:%d",
+ ro_cw->content_width, ro_cw->content_height, width, height);
ro_cw->content_width = width * 2;
ro_cw->content_height = -(2 * height);
@@ -748,8 +808,8 @@ ro_cw_update_size(struct core_window *cw, int width, int height)
state.w = ro_cw->wh;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
@@ -793,8 +853,8 @@ ro_cw_get_window_dimensions(struct core_window *cw, int *width, int *height)
state.w = ro_cw->wh;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
@@ -815,7 +875,7 @@ ro_cw_drag_status(struct core_window *cw, core_window_drag_status ds)
struct core_window_callback_table ro_cw_cb_table = {
- .redraw_request = ro_cw_redraw_request,
+ .invalidate = ro_cw_invalidate,
.update_size = ro_cw_update_size,
.scroll_visible = ro_cw_scroll_visible,
.get_window_dimensions = ro_cw_get_window_dimensions,
diff --git a/frontends/riscos/corewindow.h b/frontends/riscos/corewindow.h
index b340bde35..7d808c298 100644
--- a/frontends/riscos/corewindow.h
+++ b/frontends/riscos/corewindow.h
@@ -123,6 +123,10 @@ struct ro_corewindow {
* As a pre-requisite the draw, key and mouse callbacks must be defined
*
* \param ro_cw A riscos core window structure to initialise
+ * \param tb_buttons toolbar button bar context
+ * \param tb_order The order of toolbar buttons
+ * \param tb_style The style of toolbar buttons
+ * \param tb_help Thh toolbar help text
* \return NSERROR_OK on successful initialisation otherwise error code.
*/
nserror ro_corewindow_init(struct ro_corewindow *ro_cw, const struct button_bar_buttons *tb_buttons, char *tb_order, theme_style tb_style, const char *tb_help);
diff --git a/frontends/riscos/dialog.c b/frontends/riscos/dialog.c
index 18df1bfe4..a50d1289b 100644
--- a/frontends/riscos/dialog.c
+++ b/frontends/riscos/dialog.c
@@ -44,8 +44,10 @@
#include "riscos/configure.h"
#include "riscos/cookies.h"
#include "riscos/dialog.h"
+#include "riscos/local_history.h"
#include "riscos/global_history.h"
#include "riscos/gui.h"
+#include "riscos/window.h"
#include "riscos/hotlist.h"
#include "riscos/menus.h"
#include "riscos/save.h"
@@ -176,7 +178,7 @@ void ro_gui_dialog_init(void)
ro_gui_dialog_zoom_apply);
ro_gui_wimp_event_set_help_prefix(dialog_zoom, "HelpScaleView");
- /* Treeview initialisation has moved to the end, to allow any
+ /* core window based initialisation done last to allow any
* associated dialogues to be set up first.
*/
@@ -186,6 +188,9 @@ void ro_gui_dialog_init(void)
/* hotlist window */
ro_gui_hotlist_initialise();
+ /* local history window */
+ ro_gui_local_history_initialise();
+
/* global history window */
ro_gui_global_history_initialise();
@@ -215,7 +220,8 @@ wimp_w ro_gui_dialog_create(const char *template_name)
window->sprite_area = gui_sprites;
error = xwimp_create_window(window, &w);
if (error) {
- LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
+ error->errnum, error->errmess);
xwimp_close_template();
die(error->errmess);
}
@@ -254,12 +260,13 @@ wimp_window * ro_gui_dialog_load_template(const char *template_name)
error = xwimp_load_template(wimp_GET_SIZE, 0, 0, wimp_NO_FONTS,
name, 0, &window_size, &data_size, &context);
if (error) {
- LOG("xwimp_load_template: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_load_template: 0x%x: %s",
+ error->errnum, error->errmess);
xwimp_close_template();
die(error->errmess);
}
if (!context) {
- LOG("template '%s' missing", template_name);
+ NSLOG(netsurf, INFO, "template '%s' missing", template_name);
xwimp_close_template();
die("Template");
}
@@ -276,7 +283,8 @@ wimp_window * ro_gui_dialog_load_template(const char *template_name)
error = xwimp_load_template(window, data, data + data_size,
wimp_NO_FONTS, name, 0, 0, 0, 0);
if (error) {
- LOG("xwimp_load_template: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_load_template: 0x%x: %s",
+ error->errnum, error->errmess);
xwimp_close_template();
die(error->errmess);
}
@@ -304,7 +312,8 @@ void ro_gui_dialog_open(wimp_w w)
state.w = w;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -351,7 +360,8 @@ void ro_gui_dialog_close(wimp_w close)
*/
error = xwimp_get_caret_position(&caret);
if (error) {
- LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
} else if (caret.w == close) {
/* Check if we are a persistent window */
@@ -362,7 +372,10 @@ void ro_gui_dialog_close(wimp_w close)
32, -1);
/* parent may have been closed first */
if ((error) && (error->errnum != 0x287)) {
- LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_set_caret_position: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -370,7 +383,8 @@ void ro_gui_dialog_close(wimp_w close)
error = xwimp_close_window(close);
if (error) {
- LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -455,7 +469,8 @@ void ro_gui_dialog_open_at_pointer(wimp_w w)
/* get the pointer position */
error = xwimp_get_pointer_info(&ptr);
if (error) {
- LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -478,7 +493,8 @@ void ro_gui_dialog_open_xy(wimp_w w, int x, int y)
state.w = w;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -493,7 +509,8 @@ void ro_gui_dialog_open_xy(wimp_w w, int x, int y)
* on screen */
error = xwimp_close_window(w);
if (error) {
- LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -510,7 +527,8 @@ void ro_gui_dialog_open_xy(wimp_w w, int x, int y)
* /param parent the parent window (NULL for centre of screen)
* /param child the child window
*/
-void ro_gui_dialog_open_centre_parent(wimp_w parent, wimp_w child) {
+static void ro_gui_dialog_open_centre_parent(wimp_w parent, wimp_w child)
+{
os_error *error;
wimp_window_state state;
int mid_x, mid_y;
@@ -521,7 +539,10 @@ void ro_gui_dialog_open_centre_parent(wimp_w parent, wimp_w child) {
state.w = parent;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_state: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -538,14 +559,15 @@ void ro_gui_dialog_open_centre_parent(wimp_w parent, wimp_w child) {
state.w = child;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
/* move to the centre of the parent at the top of the stack */
dimension = state.visible.x1 - state.visible.x0;
- scroll_width = ro_get_vscroll_width(history_window);
+ scroll_width = ro_get_vscroll_width(parent);
state.visible.x0 = mid_x - (dimension + scroll_width) / 2;
state.visible.x1 = state.visible.x0 + dimension;
dimension = state.visible.y1 - state.visible.y0;
@@ -567,10 +589,11 @@ void ro_gui_dialog_open_centre_parent(wimp_w parent, wimp_w child) {
void ro_gui_dialog_open_persistent(wimp_w parent, wimp_w w, bool pointer) {
- if (pointer)
+ if (pointer) {
ro_gui_dialog_open_at_pointer(w);
- else
+ } else {
ro_gui_dialog_open_centre_parent(parent, w);
+ }
/* todo: use wimp_event definitions rather than special cases */
if ((w == dialog_pageinfo) || (w == dialog_objinfo))
@@ -600,7 +623,7 @@ void ro_gui_dialog_add_persistent(wimp_w parent, wimp_w w) {
return;
}
}
- LOG("Unable to map persistent dialog to parent.");
+ NSLOG(netsurf, INFO, "Unable to map persistent dialog to parent.");
return;
}
@@ -629,7 +652,9 @@ void ro_gui_dialog_close_persistent(wimp_w parent) {
w = persistent_dialog[i].dialog;
ro_gui_dialog_close(w);
if (ro_gui_wimp_event_close_window(w))
- LOG("Persistent dialog close event: 0x%x", (unsigned)w);
+ NSLOG(netsurf, INFO,
+ "Persistent dialog close event: 0x%x",
+ (unsigned)w);
persistent_dialog[i].parent = NULL;
persistent_dialog[i].dialog = NULL;
}
@@ -706,7 +731,7 @@ static bool ro_gui_dialog_open_url_init(void)
if ((definition->icons[ICON_OPENURL_URL].flags & wimp_ICON_INDIRECTED)
== 0) {
- LOG("open_url URL icon not indirected");
+ NSLOG(netsurf, INFO, "open_url URL icon not indirected");
xwimp_close_template();
die("Template");
}
@@ -724,7 +749,8 @@ static bool ro_gui_dialog_open_url_init(void)
error = xwimp_create_window(definition, &dialog_openurl);
if (error != NULL) {
- LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
+ error->errnum, error->errmess);
xwimp_close_template();
die(error->errmess);
}
diff --git a/frontends/riscos/dialog.h b/frontends/riscos/dialog.h
index 463048436..2ec86c339 100644
--- a/frontends/riscos/dialog.h
+++ b/frontends/riscos/dialog.h
@@ -33,7 +33,6 @@ bool ro_gui_dialog_open_top(wimp_w w, struct toolbar *toolbar,
int width, int height);
void ro_gui_dialog_open_at_pointer(wimp_w w);
void ro_gui_dialog_open_xy(wimp_w, int x, int y);
-void ro_gui_dialog_open_centre_parent(wimp_w parent, wimp_w w);
void ro_gui_dialog_open_persistent(wimp_w parent, wimp_w w, bool pointer);
void ro_gui_dialog_add_persistent(wimp_w parent, wimp_w w);
diff --git a/frontends/riscos/download.c b/frontends/riscos/download.c
index 561409ed1..bdc705426 100644
--- a/frontends/riscos/download.c
+++ b/frontends/riscos/download.c
@@ -261,7 +261,10 @@ static nserror download_ro_filetype(download_context *ctx, bits *ftype_out)
mime_type = download_context_get_mime_type(ctx);
error = xmimemaptranslate_mime_type_to_filetype(mime_type, &ftype);
if (error) {
- LOG("xmimemaptranslate_mime_type_to_filetype: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xmimemaptranslate_mime_type_to_filetype: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
ftype = 0xffd;
}
@@ -339,7 +342,8 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui)
error = xosfind_openoutw(osfind_NO_PATH | osfind_ERROR_IF_DIR,
temp_name, 0, &dw->file);
if (error) {
- LOG("xosfind_openoutw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfind_openoutw: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
free(dw);
return 0;
@@ -372,7 +376,7 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui)
filename = strdup(temp_name);
if (filename == NULL) {
- LOG("Failed to establish download filename.");
+ NSLOG(netsurf, INFO, "Failed to establish download filename.");
ro_warn_user("SaveError", error->errmess);
free(dw);
return 0;
@@ -404,7 +408,7 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui)
if (err != NSERROR_OK) {
/* badenc should never happen */
assert(err !=NSERROR_BAD_ENCODING);
- LOG("utf8_to_local_encoding failed");
+ NSLOG(netsurf, INFO, "utf8_to_local_encoding failed");
ro_warn_user("NoMemory", 0);
free(dw);
return 0;
@@ -430,7 +434,8 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui)
/* create and open the download window */
error = xwimp_create_window(download_template, &dw->window);
if (error) {
- LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
free(dw);
return 0;
@@ -485,7 +490,8 @@ static void gui_download_window_error(struct gui_download_window *dw,
wimp_COLOUR_RED << wimp_ICON_FG_COLOUR_SHIFT,
wimp_ICON_FG_COLOUR);
if (error) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -493,7 +499,8 @@ static void gui_download_window_error(struct gui_download_window *dw,
error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_PATH,
wimp_ICON_SHADED, 0);
if (error) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -501,7 +508,8 @@ static void gui_download_window_error(struct gui_download_window *dw,
error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_ICON,
wimp_ICON_SHADED, wimp_ICON_SHADED);
if (error) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -528,11 +536,13 @@ static nserror gui_download_window_data(struct gui_download_window *dw,
error = xosgbpb_writew(dw->file, (const byte *) data, size,
&unwritten);
if (error) {
- LOG("xosgbpb_writew: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosgbpb_writew: 0x%x: %s",
+ error->errnum, error->errmess);
msg = error->errmess;
} else if (unwritten) {
- LOG("xosgbpb_writew: unwritten %i", unwritten);
+ NSLOG(netsurf, INFO, "xosgbpb_writew: unwritten %i",
+ unwritten);
msg = messages_get("Unwritten");
}
else {
@@ -555,20 +565,29 @@ static nserror gui_download_window_data(struct gui_download_window *dw,
error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_ICON,
wimp_ICON_SHADED, 0);
if (error) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_DESTINATION,
wimp_ICON_DELETED, wimp_ICON_DELETED);
if (error) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
error = xwimp_set_icon_state(dw->window,
ICON_DOWNLOAD_PATH, wimp_ICON_DELETED, 0);
if (error) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -717,13 +736,15 @@ void ro_gui_download_update_status(struct gui_download_window *dw)
download_progress_x0 + width,
download_progress_y1);
if (error) {
- LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_STATUS, 0, 0);
if (error) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -759,13 +780,17 @@ void ro_gui_download_window_hide_caret(struct gui_download_window *dw)
error = xwimp_get_caret_position(&caret);
if (error) {
- LOG("xwimp_get_caret_position: 0x%x : %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x : %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
else if (caret.w == dw->window) {
error = xwimp_set_caret_position(dw->window, (wimp_i)-1, 0, 0, 1 << 25, -1);
if (error) {
- LOG("xwimp_get_caret_position: 0x%x : %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_caret_position: 0x%x : %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -791,7 +816,8 @@ static void gui_download_window_done(struct gui_download_window *dw)
error = xosfind_closew(dw->file);
if (error) {
- LOG("xosfind_closew: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfind_closew: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
}
dw->file = 0;
@@ -800,7 +826,8 @@ static void gui_download_window_done(struct gui_download_window *dw)
error = xosfile_set_type(dw->path,
dw->file_type);
if (error) {
- LOG("xosfile_set_type: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfile_set_type: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
}
@@ -856,7 +883,8 @@ bool ro_gui_download_click(wimp_pointer *pointer)
*dot = 0;
error = xos_cli(command);
if (error) {
- LOG("xos_cli: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xos_cli: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MiscError", error->errmess);
}
}
@@ -929,7 +957,8 @@ static void ro_gui_download_drag_end(wimp_dragged *drag, void *data)
error = xwimp_get_pointer_info(&pointer);
if (error) {
- LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -959,7 +988,10 @@ static void ro_gui_download_drag_end(wimp_dragged *drag, void *data)
error = xwimp_send_message_to_window(wimp_USER_MESSAGE, &message,
pointer.w, pointer.i, 0);
if (error) {
- LOG("xwimp_send_message_to_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_send_message_to_window: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -1011,7 +1043,10 @@ char *ro_gui_download_canonicalise(const char *path)
error = xosfscontrol_canonicalise_path(path, NULL, NULL, NULL, 0, &spare);
if (error) {
- LOG("xosfscontrol_canonicalise_path: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfscontrol_canonicalise_path: 0x%x: %s",
+ error->errnum,
+ error->errmess);
return NULL;
}
@@ -1020,7 +1055,10 @@ char *ro_gui_download_canonicalise(const char *path)
error = xosfscontrol_canonicalise_path(path, buf, NULL, NULL,
1 - spare, NULL);
if (error) {
- LOG("xosfscontrol_canonicalise_path: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfscontrol_canonicalise_path: 0x%x: %s",
+ error->errnum,
+ error->errmess);
free(buf);
return NULL;
@@ -1065,13 +1103,17 @@ bool ro_gui_download_check_space(struct gui_download_window *dw,
error = xosfscontrol_free_space64(dir, &free_lo, &free_hi,
&max_file, NULL, NULL);
if (error) {
- LOG("xosfscontrol_free_space64: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfscontrol_free_space64: 0x%x: %s",
+ error->errnum, error->errmess);
free_hi = 0;
error = xosfscontrol_free_space(dir, (int*)&free_lo,
&max_file, NULL);
if (error) {
- LOG("xosfscontrol_free_space: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfscontrol_free_space: 0x%x: %s",
+ error->errnum,
+ error->errmess);
/* close our eyes and hope */
free(dir);
return true;
@@ -1108,7 +1150,10 @@ bool ro_gui_download_check_space(struct gui_download_window *dw,
error = xosargs_read_allocation(dw->file,
&allocation);
if (error) {
- LOG("xosargs_read_allocation: 0x%x : %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosargs_read_allocation: 0x%x : %s",
+ error->errnum,
+ error->errmess);
}
else {
space += allocation;
@@ -1147,7 +1192,8 @@ os_error *ro_gui_download_move(struct gui_download_window *dw,
error = xosfind_closew(dw->file);
dw->file = 0;
if (error) {
- LOG("xosfind_closew: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfind_closew: 0x%x: %s",
+ error->errnum, error->errmess);
return error;
}
}
@@ -1165,11 +1211,13 @@ os_error *ro_gui_download_move(struct gui_download_window *dw,
osfscontrol_COPY_LOOK,
0, 0, 0, 0, 0);
if (error) {
- LOG("xosfscontrol_copy: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfscontrol_copy: 0x%x: %s",
+ error->errnum, error->errmess);
return error;
}
} else if (error) {
- LOG("xosfscontrol_rename: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfscontrol_rename: 0x%x: %s",
+ error->errnum, error->errmess);
return error;
}
@@ -1179,20 +1227,23 @@ os_error *ro_gui_download_move(struct gui_download_window *dw,
fileswitch_ATTR_OWNER_READ |
fileswitch_ATTR_OWNER_WRITE);
if (error) {
- LOG("xosfile_write: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfile_write: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
}
error = xosfind_openupw(osfind_NO_PATH | osfind_ERROR_IF_DIR,
dest_file, 0, &dw->file);
if (error) {
- LOG("xosfind_openupw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfind_openupw: 0x%x: %s",
+ error->errnum, error->errmess);
return error;
}
error = xosargs_set_ptrw(dw->file, dw->received);
if (error) {
- LOG("xosargs_set_ptrw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosargs_set_ptrw: 0x%x: %s",
+ error->errnum, error->errmess);
return error;
}
@@ -1201,7 +1252,8 @@ os_error *ro_gui_download_move(struct gui_download_window *dw,
error = xosfile_set_type(dest_file,
dw->file_type);
if (error) {
- LOG("xosfile_set_type: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfile_set_type: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
}
}
@@ -1273,7 +1325,8 @@ bool ro_gui_download_save(struct gui_download_window *dw,
error = xosfile_read_stamped(file_name, &obj_type,
NULL, NULL, NULL, NULL, NULL);
if (error) {
- LOG("xosfile_read_stamped: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfile_read_stamped: 0x%x:%s",
+ error->errnum, error->errmess);
return false;
}
@@ -1309,12 +1362,16 @@ bool ro_gui_download_save(struct gui_download_window *dw,
error = xosfind_openupw(osfind_NO_PATH | osfind_ERROR_IF_DIR,
temp_name, 0, &dw->file);
if (error) {
- LOG("xosfind_openupw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfind_openupw: 0x%x: %s",
+ error->errnum, error->errmess);
} else {
error = xosargs_set_ptrw(dw->file, dw->received);
if (error) {
- LOG("xosargs_set_ptrw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosargs_set_ptrw: 0x%x: %s",
+ error->errnum,
+ error->errmess);
}
}
@@ -1336,7 +1393,8 @@ bool ro_gui_download_save(struct gui_download_window *dw,
error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_ICON,
wimp_ICON_SHADED, wimp_ICON_SHADED);
if (error) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -1349,13 +1407,15 @@ bool ro_gui_download_save(struct gui_download_window *dw,
error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_PATH,
wimp_ICON_DELETED, wimp_ICON_DELETED);
if (error) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
error = xwimp_set_icon_state(dw->window,
ICON_DOWNLOAD_DESTINATION, wimp_ICON_DELETED, 0);
if (error) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -1401,7 +1461,8 @@ void ro_gui_download_send_dataload(struct gui_download_window *dw)
* for the rather depressing details.
*/
if (error && error->errnum != error_WIMP_BAD_HANDLE) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -1482,7 +1543,8 @@ bool ro_gui_download_window_destroy(struct gui_download_window *dw, bool quit)
/* delete window */
error = xwimp_delete_window(dw->window);
if (error) {
- LOG("xwimp_delete_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
ro_gui_wimp_event_finalise(dw->window);
@@ -1491,7 +1553,8 @@ bool ro_gui_download_window_destroy(struct gui_download_window *dw, bool quit)
if (dw->file) {
error = xosfind_closew(dw->file);
if (error) {
- LOG("xosfind_closew: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfind_closew: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
}
}
@@ -1502,7 +1565,8 @@ bool ro_gui_download_window_destroy(struct gui_download_window *dw, bool quit)
error = xosfile_delete(temp_name, 0, 0, 0, 0, 0);
if (error) {
- LOG("xosfile_delete: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfile_delete: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
}
}
diff --git a/frontends/riscos/filetype.c b/frontends/riscos/filetype.c
index 75ff41414..73651cd63 100644
--- a/frontends/riscos/filetype.c
+++ b/frontends/riscos/filetype.c
@@ -72,7 +72,7 @@ const char *fetch_filetype(const char *unix_path)
int objtype;
if (!path) {
- LOG("Insufficient memory for calloc");
+ NSLOG(netsurf, INFO, "Insufficient memory for calloc");
ro_warn_user("NoMemory", 0);
return "application/riscos";
}
@@ -80,7 +80,7 @@ const char *fetch_filetype(const char *unix_path)
/* convert path to RISC OS format and read file type */
r = __riscosify(unix_path, 0, __RISCOSIFY_NO_SUFFIX, path, len, 0);
if (r == 0) {
- LOG("__riscosify failed");
+ NSLOG(netsurf, INFO, "__riscosify failed");
free(path);
return "application/riscos";
}
@@ -88,7 +88,9 @@ const char *fetch_filetype(const char *unix_path)
error = xosfile_read_stamped_no_path(path, &objtype, 0, 0, 0, 0,
&file_type);
if (error) {
- LOG("xosfile_read_stamped_no_path failed: %s", error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfile_read_stamped_no_path failed: %s",
+ error->errmess);
free(path);
return "application/riscos";
}
@@ -108,7 +110,10 @@ const char *fetch_filetype(const char *unix_path)
slash+1, &temp);
if (error)
/* ignore error and leave file_type alone */
- LOG("xmimemaptranslate_extension_to_filetype: ""0x%x %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xmimemaptranslate_extension_to_filetype: ""0x%x %s",
+ error->errnum,
+ error->errmess);
else
file_type = temp;
}
@@ -126,7 +131,7 @@ const char *fetch_filetype(const char *unix_path)
/* not in internal table, so ask MimeMap */
error = xmimemaptranslate_filetype_to_mime_type(file_type, type_buf);
if (error) {
- LOG("0x%x %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "0x%x %s", error->errnum, error->errmess);
free(path);
return "application/riscos";
}
@@ -139,7 +144,7 @@ const char *fetch_filetype(const char *unix_path)
free(path);
- LOG("mime type '%s'", type_buf);
+ NSLOG(netsurf, INFO, "mime type '%s'", type_buf);
return (const char *)type_buf;
}
@@ -155,14 +160,15 @@ char *fetch_mimetype(const char *ro_path)
struct type_entry *t;
if (!mime) {
- LOG("Insufficient memory for calloc");
+ NSLOG(netsurf, INFO, "Insufficient memory for calloc");
ro_warn_user("NoMemory", 0);
return 0;
}
e = xosfile_read_no_path(ro_path, &objtype, &load, 0, 0, 0);
if (e) {
- LOG("xosfile_read_no_path: 0x%x: %s", e->errnum, e->errmess);
+ NSLOG(netsurf, INFO, "xosfile_read_no_path: 0x%x: %s",
+ e->errnum, e->errmess);
free(mime);
return 0;
}
@@ -188,7 +194,7 @@ char *fetch_mimetype(const char *ro_path)
if (e)
/* if we get an error here, simply ignore it and
* leave filetype unchanged */
- LOG("0x%x %s", e->errnum, e->errmess);
+ NSLOG(netsurf, INFO, "0x%x %s", e->errnum, e->errmess);
else
filetype = load;
}
@@ -205,7 +211,10 @@ char *fetch_mimetype(const char *ro_path)
/* not in internal table, so ask MimeMap */
e = xmimemaptranslate_filetype_to_mime_type(filetype, mime);
if (e) {
- LOG("xmimemaptranslate_filetype_to_mime_type: 0x%x: %s", e->errnum, e->errmess);
+ NSLOG(netsurf, INFO,
+ "xmimemaptranslate_filetype_to_mime_type: 0x%x: %s",
+ e->errnum,
+ e->errmess);
free(mime);
return 0;
}
@@ -322,7 +331,7 @@ bits ro_filetype_from_unix_path(const char *unix_path)
bits file_type;
if (!path) {
- LOG("Insufficient memory for calloc");
+ NSLOG(netsurf, INFO, "Insufficient memory for calloc");
ro_warn_user("NoMemory", 0);
return osfile_TYPE_DATA;
}
@@ -330,7 +339,7 @@ bits ro_filetype_from_unix_path(const char *unix_path)
/* convert path to RISC OS format and read file type */
r = __riscosify(unix_path, 0, __RISCOSIFY_NO_SUFFIX, path, len, 0);
if (r == 0) {
- LOG("__riscosify failed");
+ NSLOG(netsurf, INFO, "__riscosify failed");
free(path);
return osfile_TYPE_DATA;
}
@@ -338,7 +347,9 @@ bits ro_filetype_from_unix_path(const char *unix_path)
error = xosfile_read_stamped_no_path(path, 0, 0, 0, 0, 0,
&file_type);
if (error) {
- LOG("xosfile_read_stamped_no_path failed: %s", error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfile_read_stamped_no_path failed: %s",
+ error->errmess);
free(path);
return osfile_TYPE_DATA;
}
diff --git a/frontends/riscos/font.c b/frontends/riscos/font.c
index 560afc785..2ff309043 100644
--- a/frontends/riscos/font.c
+++ b/frontends/riscos/font.c
@@ -65,7 +65,8 @@ static void nsfont_check_fonts(void)
"<NetSurf$Dir>.FixFonts", 0);
die("FontBadInst");
} else {
- LOG("xfont_find_font: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xfont_find_font: 0x%x: %s",
+ error->errnum, error->errmess);
snprintf(s, sizeof s, messages_get("FontError"),
error->errmess);
die(s);
@@ -74,7 +75,8 @@ static void nsfont_check_fonts(void)
error = xfont_lose_font(font);
if (error) {
- LOG("xfont_lose_font: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xfont_lose_font: 0x%x: %s",
+ error->errnum, error->errmess);
snprintf(s, sizeof s, messages_get("FontError"),
error->errmess);
die(s);
@@ -118,17 +120,20 @@ void nsfont_init(void)
nsfont_check_fonts();
- LOG("Initialise RUfl");
+ NSLOG(netsurf, INFO, "Initialise RUfl");
code = rufl_init();
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG("rufl_init: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
+ NSLOG(netsurf, INFO,
+ "rufl_init: rufl_FONT_MANAGER_ERROR: 0x%x: %s",
+ rufl_fm_error->errnum,
+ rufl_fm_error->errmess);
else
- LOG("rufl_init: 0x%x", code);
+ NSLOG(netsurf, INFO, "rufl_init: 0x%x", code);
die("The Unicode font library could not be initialized. "
"Please report this to the developers.");
}
- LOG("RUfl initialised");
+ NSLOG(netsurf, INFO, "RUfl initialised");
if (rufl_family_list_entries == 0)
die("No fonts could be found. At least one font must be "
@@ -162,9 +167,10 @@ const char *nsfont_fallback_font(void)
const char *fallback = "Homerton";
if (!nsfont_exists(fallback)) {
- LOG("Homerton not found, dumping RUfl family list");
+ NSLOG(netsurf, INFO,
+ "Homerton not found, dumping RUfl family list");
for (unsigned int i = 0; i < rufl_family_list_entries; i++) {
- LOG("'%s'", rufl_family_list[i]);
+ NSLOG(netsurf, INFO, "'%s'", rufl_family_list[i]);
}
fallback = rufl_family_list[0];
}
@@ -230,9 +236,12 @@ ro_font_width(const plot_font_style_t *fstyle,
width);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG("rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
+ NSLOG(netsurf, INFO,
+ "rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s",
+ rufl_fm_error->errnum,
+ rufl_fm_error->errmess);
else
- LOG("rufl_width: 0x%x", code);
+ NSLOG(netsurf, INFO, "rufl_width: 0x%x", code);
/* ro_warn_user("MiscError", "font error"); */
*width = 0;
return NSERROR_INVALID;
@@ -276,9 +285,12 @@ ro_font_position(const plot_font_style_t *fstyle,
x * 2, char_offset, actual_x);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG("rufl_x_to_offset: rufl_FONT_MANAGER_ERROR: ""0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
+ NSLOG(netsurf, INFO,
+ "rufl_x_to_offset: rufl_FONT_MANAGER_ERROR: ""0x%x: %s",
+ rufl_fm_error->errnum,
+ rufl_fm_error->errmess);
else
- LOG("rufl_x_to_offset: 0x%x", code);
+ NSLOG(netsurf, INFO, "rufl_x_to_offset: 0x%x", code);
/* ro_warn_user("MiscError", "font error"); */
*char_offset = 0;
*actual_x = 0;
@@ -335,10 +347,12 @@ ro_font_split(const plot_font_style_t *fstyle,
x * 2, char_offset, actual_x);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR) {
- LOG("rufl_split: rufl_FONT_MANAGER_ERROR: ""0x%x: %s",
- rufl_fm_error->errnum, rufl_fm_error->errmess);
+ NSLOG(netsurf, INFO,
+ "rufl_split: rufl_FONT_MANAGER_ERROR: ""0x%x: %s",
+ rufl_fm_error->errnum,
+ rufl_fm_error->errmess);
} else {
- LOG("rufl_split: 0x%x", code);
+ NSLOG(netsurf, INFO, "rufl_split: 0x%x", code);
}
/* ro_warn_user("MiscError", "font error"); */
*char_offset = 0;
@@ -370,10 +384,12 @@ ro_font_split(const plot_font_style_t *fstyle,
actual_x);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR) {
- LOG("rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s",
- rufl_fm_error->errnum, rufl_fm_error->errmess);
+ NSLOG(netsurf, INFO,
+ "rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s",
+ rufl_fm_error->errnum,
+ rufl_fm_error->errmess);
} else {
- LOG("rufl_width: 0x%x", code);
+ NSLOG(netsurf, INFO, "rufl_width: 0x%x", code);
}
/* ro_warn_user("MiscError", "font error"); */
*char_offset = 0;
@@ -416,9 +432,12 @@ bool nsfont_paint(const plot_font_style_t *fstyle, const char *string,
string, length, x, y, flags);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR) {
- LOG("rufl_paint: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
+ NSLOG(netsurf, INFO,
+ "rufl_paint: rufl_FONT_MANAGER_ERROR: 0x%x: %s",
+ rufl_fm_error->errnum,
+ rufl_fm_error->errmess);
} else {
- LOG("rufl_paint: 0x%x", code);
+ NSLOG(netsurf, INFO, "rufl_paint: 0x%x", code);
}
}
@@ -450,7 +469,7 @@ void nsfont_read_style(const plot_font_style_t *fstyle,
rufl_WEIGHT_900
};
- *font_size = (fstyle->size * 16) / FONT_SIZE_SCALE;
+ *font_size = (fstyle->size * 16) / PLOT_STYLE_SCALE;
if (1600 < *font_size)
*font_size = 1600;
@@ -513,7 +532,8 @@ ro_gui_wimp_desktop_font(char *family,
error = xwimpreadsysinfo_font(&font_handle, NULL);
if (error) {
- LOG("xwimpreadsysinfo_font: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimpreadsysinfo_font: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
goto failsafe;
}
@@ -525,20 +545,22 @@ ro_gui_wimp_desktop_font(char *family,
error = xfont_read_identifier(font_handle, NULL, &used);
if (error) {
- LOG("xfont_read_identifier: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xfont_read_identifier: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MiscError", error->errmess);
goto failsafe;
}
if (family_size < (size_t) used + 1) {
- LOG("desktop font name too long");
+ NSLOG(netsurf, INFO, "desktop font name too long");
goto failsafe;
}
error = xfont_read_defn(font_handle, (byte *) family,
&ptx, &pty, NULL, NULL, NULL, NULL);
if (error) {
- LOG("xfont_read_defn: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xfont_read_defn: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MiscError", error->errmess);
goto failsafe;
}
@@ -550,7 +572,7 @@ ro_gui_wimp_desktop_font(char *family,
}
}
- LOG("desktop font \"%s\"", family);
+ NSLOG(netsurf, INFO, "desktop font \"%s\"", family);
if (strcasestr(family, ".Medium"))
style = rufl_WEIGHT_500;
@@ -566,7 +588,8 @@ ro_gui_wimp_desktop_font(char *family,
*psize = max(ptx, pty);
*pstyle = style;
- LOG("family \"%s\", size %i, style %i", family, *psize, style);
+ NSLOG(netsurf, INFO, "family \"%s\", size %i, style %i", family,
+ *psize, style);
return;
diff --git a/frontends/riscos/global_history.c b/frontends/riscos/global_history.c
index 94e1d4a03..7dfc58317 100644
--- a/frontends/riscos/global_history.c
+++ b/frontends/riscos/global_history.c
@@ -405,7 +405,7 @@ static nserror ro_global_history_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct ro_global_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
@@ -474,12 +474,12 @@ nserror ro_gui_global_history_present(void)
res = ro_global_history_init();
if (res == NSERROR_OK) {
- LOG("Presenting");
+ NSLOG(netsurf, INFO, "Presenting");
ro_gui_dialog_open_top(global_history_window->core.wh,
global_history_window->core.toolbar,
600, 800);
} else {
- LOG("Failed presenting code %d", res);
+ NSLOG(netsurf, INFO, "Failed presenting code %d", res);
}
return res;
diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c
index 27b81d92e..be1bc8d9a 100644
--- a/frontends/riscos/gui.c
+++ b/frontends/riscos/gui.c
@@ -74,6 +74,7 @@
#include "riscos/window.h"
#include "riscos/iconbar.h"
#include "riscos/sslcert.h"
+#include "riscos/local_history.h"
#include "riscos/global_history.h"
#include "riscos/cookies.h"
#include "riscos/wimp_event.h"
@@ -194,6 +195,7 @@ static struct
static nsurl *gui_get_resource_url(const char *path)
{
static const char base_url[] = "file:///NetSurf:/Resources/";
+ const char *lang;
size_t path_len, length;
char *raw;
nsurl *url = NULL;
@@ -219,8 +221,12 @@ static nsurl *gui_get_resource_url(const char *path)
path_len = strlen(path);
+ lang = ro_gui_default_language();
+
/* Find max URL length */
- length = SLEN(base_url) + SLEN("xx/") + path_len + 1;
+ length = SLEN(base_url) +
+ strlen(lang) + 1 + /* <lang> + / */
+ path_len + 1; /* + NUL */
raw = malloc(length);
if (raw != NULL) {
@@ -229,13 +235,11 @@ static nsurl *gui_get_resource_url(const char *path)
ptr += SLEN(base_url);
/* Add language directory to URL, for translated files */
- /* TODO: handle non-en langauages
- * handle non-html translated files */
+ /* TODO: handle non-html translated files */
if (path_len > SLEN(".html") &&
strncmp(path + path_len - SLEN(".html"),
".html", SLEN(".html")) == 0) {
- memcpy(ptr, "en/", SLEN("en/"));
- ptr += SLEN("en/");
+ ptr += sprintf(ptr, "%s/", lang);
}
/* Add filename to URL */
@@ -273,8 +277,10 @@ set_colour_from_wimp(struct nsoption_s *opts,
error = xwimp_read_true_palette((os_palette *) &palette);
if (error != NULL) {
- LOG("xwimp_read_palette: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_read_palette: 0x%x: %s",
+ error->errnum,
+ error->errmess);
} else {
/* entries are in B0G0R0LL */
def_colour = palette.entries[wimp] >> 8;
@@ -306,7 +312,7 @@ static nserror set_defaults(struct nsoption_s *defaults)
if (nsoption_charp(ca_bundle) == NULL ||
nsoption_charp(cookie_file) == NULL ||
nsoption_charp(cookie_jar) == NULL) {
- LOG("Failed initialising default options");
+ NSLOG(netsurf, INFO, "Failed initialising default options");
return NSERROR_BAD_PARAMETER;
}
@@ -429,7 +435,7 @@ static void ro_gui_signal(int sig)
if (used) {
int curr_slot;
xwimp_slot_size(-1, -1, &curr_slot, 0, 0);
- LOG("saving WimpSlot, size 0x%x", curr_slot);
+ NSLOG(netsurf, INFO, "saving WimpSlot, size 0x%x", curr_slot);
xosfile_save("$.NetSurf_Slot", 0x8000, 0,
(byte *) 0x8000,
(byte *) 0x8000 + curr_slot);
@@ -439,7 +445,11 @@ static void ro_gui_signal(int sig)
byte *base_address;
xosdynamicarea_read(__dynamic_num, &size,
&base_address, 0, 0, 0, 0, 0);
- LOG("saving DA %i, base %p, size 0x%x", __dynamic_num, base_address, size);
+ NSLOG(netsurf, INFO,
+ "saving DA %i, base %p, size 0x%x",
+ __dynamic_num,
+ base_address,
+ size);
xosfile_save("$.NetSurf_DA",
(bits) base_address, 0,
base_address,
@@ -451,7 +461,7 @@ static void ro_gui_signal(int sig)
* defines a coredump directory. */
const _kernel_oserror *err = __unixlib_write_coredump (NULL);
if (err != NULL)
- LOG("Coredump failed: %s", err->errmess);
+ NSLOG(netsurf, INFO, "Coredump failed: %s", err->errmess);
#endif
xhourglass_colours(old_sand, old_glass, 0, 0);
@@ -535,7 +545,8 @@ static char *ro_gui_uri_file_parse(const char *file_name, char **uri_title)
*uri_title = NULL;
fp = fopen(file_name, "rb");
if (!fp) {
- LOG("fopen(\"%s\", \"rb\"): %i: %s", file_name, errno, strerror(errno));
+ NSLOG(netsurf, INFO, "fopen(\"%s\", \"rb\"): %i: %s",
+ file_name, errno, strerror(errno));
ro_warn_user("LoadError", strerror(errno));
return 0;
}
@@ -596,14 +607,16 @@ static char *ro_gui_url_file_parse(const char *file_name)
fp = fopen(file_name, "r");
if (!fp) {
- LOG("fopen(\"%s\", \"r\"): %i: %s", file_name, errno, strerror(errno));
+ NSLOG(netsurf, INFO, "fopen(\"%s\", \"r\"): %i: %s",
+ file_name, errno, strerror(errno));
ro_warn_user("LoadError", strerror(errno));
return 0;
}
if (!fgets(line, sizeof line, fp)) {
if (ferror(fp)) {
- LOG("fgets: %i: %s", errno, strerror(errno));
+ NSLOG(netsurf, INFO, "fgets: %i: %s", errno,
+ strerror(errno));
ro_warn_user("LoadError", strerror(errno));
} else
ro_warn_user("LoadError", messages_get("EmptyError"));
@@ -640,7 +653,8 @@ static char *ro_gui_ieurl_file_parse(const char *file_name)
fp = fopen(file_name, "r");
if (!fp) {
- LOG("fopen(\"%s\", \"r\"): %i: %s", file_name, errno, strerror(errno));
+ NSLOG(netsurf, INFO, "fopen(\"%s\", \"r\"): %i: %s",
+ file_name, errno, strerror(errno));
ro_warn_user("LoadError", strerror(errno));
return 0;
}
@@ -659,7 +673,7 @@ static char *ro_gui_ieurl_file_parse(const char *file_name)
}
}
if (ferror(fp)) {
- LOG("fgets: %i: %s", errno, strerror(errno));
+ NSLOG(netsurf, INFO, "fgets: %i: %s", errno, strerror(errno));
ro_warn_user("LoadError", strerror(errno));
fclose(fp);
return 0;
@@ -731,7 +745,8 @@ static void ro_msg_dataopen(wimp_message *message)
message->your_ref = message->my_ref;
oserror = xwimp_send_message(wimp_USER_MESSAGE, message, message->sender);
if (oserror) {
- LOG("xwimp_send_message: 0x%x: %s", oserror->errnum, oserror->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
+ oserror->errnum, oserror->errmess);
ro_warn_user("WimpError", oserror->errmess);
return;
}
@@ -854,7 +869,8 @@ static void ro_msg_dataload(wimp_message *message)
oserror = xwimp_send_message(wimp_USER_MESSAGE, message,
message->sender);
if (oserror) {
- LOG("xwimp_send_message: 0x%x: %s", oserror->errnum, oserror->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
+ oserror->errnum, oserror->errmess);
ro_warn_user("WimpError", oserror->errmess);
return;
}
@@ -924,7 +940,10 @@ static void ro_msg_datasave(wimp_message *message)
error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message*)dataxfer, message->sender);
if (error) {
- LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_send_message: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -976,7 +995,8 @@ static void ro_msg_prequit(wimp_message *message)
error = xwimp_send_message(wimp_USER_MESSAGE_ACKNOWLEDGE,
message, message->sender);
if (error) {
- LOG("xwimp_send_message: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x:%s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -1002,7 +1022,8 @@ static void ro_msg_save_desktop(wimp_message *message)
}
if (error) {
- LOG("xosgbpb_writew/xos_bputw: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosgbpb_writew/xos_bputw: 0x%x:%s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
/* we must cancel the save by acknowledging the message */
@@ -1010,7 +1031,8 @@ static void ro_msg_save_desktop(wimp_message *message)
error = xwimp_send_message(wimp_USER_MESSAGE_ACKNOWLEDGE,
message, message->sender);
if (error) {
- LOG("xwimp_send_message: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x:%s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -1061,7 +1083,8 @@ static void ro_gui_get_screen_properties(void)
error = xos_read_vdu_variables(PTR_OS_VDU_VAR_LIST(&vars), vals);
if (error) {
- LOG("xos_read_vdu_variables: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xos_read_vdu_variables: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MiscError", error->errmess);
return;
}
@@ -1078,9 +1101,9 @@ static void ro_gui_check_resolvers(void)
char *resolvers;
resolvers = getenv("Inet$Resolvers");
if (resolvers && resolvers[0]) {
- LOG("Inet$Resolvers '%s'", resolvers);
+ NSLOG(netsurf, INFO, "Inet$Resolvers '%s'", resolvers);
} else {
- LOG("Inet$Resolvers not set or empty");
+ NSLOG(netsurf, INFO, "Inet$Resolvers not set or empty");
ro_warn_user("Resolvers", 0);
}
}
@@ -1179,17 +1202,24 @@ static nserror gui_init(int argc, char** argv)
/* Initialise save complete functionality */
save_complete_init();
+ /* Initialise the font subsystem */
+ nsfont_init();
+
/* Load in visited URLs, Cookies, and hostlist */
urldb_load(nsoption_charp(url_path));
urldb_load_cookies(nsoption_charp(cookie_file));
- hotlist_init(nsoption_charp(hotlist_path));
+ hotlist_init(nsoption_charp(hotlist_path),
+ nsoption_bool(external_hotlists) ?
+ NULL :
+ nsoption_charp(hotlist_save));
/* Initialise with the wimp */
error = xwimp_initialise(wimp_VERSION_RO38, task_name,
PTR_WIMP_MESSAGE_LIST(&task_messages), 0,
&task_handle);
if (error) {
- LOG("xwimp_initialise: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_initialise: 0x%x: %s",
+ error->errnum, error->errmess);
die(error->errmess);
}
/* Register message handlers */
@@ -1212,9 +1242,6 @@ static nserror gui_init(int argc, char** argv)
ro_message_register_route(message_WINDOW_INFO,
ro_msg_window_info);
- /* Initialise the font subsystem */
- nsfont_init();
-
/* Initialise global information */
ro_gui_get_screen_properties();
ro_gui_wimp_get_desktop_font();
@@ -1230,7 +1257,8 @@ static nserror gui_init(int argc, char** argv)
die("Failed to locate Templates resource.");
error = xwimp_open_template(path);
if (error) {
- LOG("xwimp_open_template failed: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_template failed: 0x%x: %s",
+ error->errnum, error->errmess);
die(error->errmess);
}
@@ -1249,9 +1277,6 @@ static nserror gui_init(int argc, char** argv)
/* Initialise query windows */
ro_gui_query_init();
- /* Initialise the history subsystem */
- ro_gui_history_init();
-
/* Initialise toolbars */
ro_toolbar_init();
@@ -1274,7 +1299,7 @@ static nserror gui_init(int argc, char** argv)
/* parse command-line arguments */
if (argc == 2) {
- LOG("parameters: '%s'", argv[1]);
+ NSLOG(netsurf, INFO, "parameters: '%s'", argv[1]);
/* this is needed for launching URI files */
if (strcasecmp(argv[1], "-nowin") == 0) {
return NSERROR_OK;
@@ -1282,7 +1307,8 @@ static nserror gui_init(int argc, char** argv)
ret = nsurl_create(NETSURF_HOMEPAGE, &url);
}
else if (argc == 3) {
- LOG("parameters: '%s' '%s'", argv[1], argv[2]);
+ NSLOG(netsurf, INFO, "parameters: '%s' '%s'", argv[1],
+ argv[2]);
open_window = true;
/* HTML files */
@@ -1293,7 +1319,7 @@ static nserror gui_init(int argc, char** argv)
else if (strcasecmp(argv[1], "-urlf") == 0) {
char *urlf = ro_gui_url_file_parse(argv[2]);
if (!urlf) {
- LOG("allocation failed");
+ NSLOG(netsurf, INFO, "allocation failed");
die("Insufficient memory for URL");
}
ret = nsurl_create(urlf, &url);
@@ -1305,7 +1331,8 @@ static nserror gui_init(int argc, char** argv)
}
/* Unknown => exit here. */
else {
- LOG("Unknown parameters: '%s' '%s'", argv[1], argv[2]);
+ NSLOG(netsurf, INFO, "Unknown parameters: '%s' '%s'",
+ argv[1], argv[2]);
return NSERROR_BAD_PARAMETER;
}
}
@@ -1353,7 +1380,8 @@ const char *ro_gui_default_language(void)
/* choose a language from the configured country number */
error = xosbyte_read(osbyte_VAR_COUNTRY_NUMBER, &country);
if (error) {
- LOG("xosbyte_read failed: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosbyte_read failed: 0x%x: %s",
+ error->errnum, error->errmess);
country = 1;
}
switch (country) {
@@ -1404,7 +1432,10 @@ static nserror ro_path_to_nsurl(const char *path, struct nsurl **url_out)
/* calculate the canonical risc os path */
error = xosfscontrol_canonicalise_path(path, 0, 0, 0, 0, &spare);
if (error) {
- LOG("xosfscontrol_canonicalise_path failed: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfscontrol_canonicalise_path failed: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("PathToURL", error->errmess);
return NSERROR_NOT_FOUND;
}
@@ -1417,7 +1448,10 @@ static nserror ro_path_to_nsurl(const char *path, struct nsurl **url_out)
error = xosfscontrol_canonicalise_path(path, canonical_path, 0, 0, 1 - spare, 0);
if (error) {
- LOG("xosfscontrol_canonicalise_path failed: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfscontrol_canonicalise_path failed: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("PathToURL", error->errmess);
free(canonical_path);
return NSERROR_NOT_FOUND;
@@ -1427,7 +1461,7 @@ static nserror ro_path_to_nsurl(const char *path, struct nsurl **url_out)
unix_path = __unixify(canonical_path, __RISCOSIFY_NO_REVERSE_SUFFIX, NULL, 0, 0);
if (unix_path == NULL) {
- LOG("__unixify failed: %s", canonical_path);
+ NSLOG(netsurf, INFO, "__unixify failed: %s", canonical_path);
free(canonical_path);
return NSERROR_BAD_PARAMETER;
}
@@ -1445,7 +1479,7 @@ static nserror ro_path_to_nsurl(const char *path, struct nsurl **url_out)
urllen = strlen(escaped_path) + FILE_SCHEME_PREFIX_LEN + 1;
url = malloc(urllen);
if (url == NULL) {
- LOG("Unable to allocate url");
+ NSLOG(netsurf, INFO, "Unable to allocate url");
free(escaped_path);
return NSERROR_NOMEM;
}
@@ -1557,6 +1591,7 @@ static void gui_quit(void)
urldb_save_cookies(nsoption_charp(cookie_jar));
urldb_save(nsoption_charp(url_save));
ro_gui_window_quit();
+ ro_gui_local_history_finalise();
ro_gui_global_history_finalise();
ro_gui_hotlist_finalise();
ro_gui_cookies_finalise();
@@ -1594,7 +1629,8 @@ static void ro_gui_keypress_cb(void *pw)
if (ro_gui_wimp_event_keypress(key) == false) {
os_error *error = xwimp_process_key(key->c);
if (error) {
- LOG("xwimp_process_key: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_process_key: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -1631,7 +1667,8 @@ static void ro_gui_keypress(wimp_key *key)
} else if (ro_gui_wimp_event_keypress(key) == false) {
os_error *error = xwimp_process_key(key->c);
if (error) {
- LOG("xwimp_process_key: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_process_key: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -1903,7 +1940,8 @@ void ro_gui_open_window_request(wimp_open *open)
error = xwimp_open_window(open);
if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -1924,7 +1962,8 @@ static void ro_gui_view_source_bounce(wimp_message *message)
sprintf(command, "@RunType_FFF %s", filename);
error = xwimp_start_task(command, 0);
if (error) {
- LOG("xwimp_start_task failed: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_start_task failed: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -1987,7 +2026,7 @@ void ro_gui_view_source(struct hlcache_handle *c)
r = __riscosify(full_name, 0, __RISCOSIFY_NO_SUFFIX,
message.file_name, 212, 0);
if (r == 0) {
- LOG("__riscosify failed");
+ NSLOG(netsurf, INFO, "__riscosify failed");
return;
}
message.file_name[211] = '\0';
@@ -1997,7 +2036,10 @@ void ro_gui_view_source(struct hlcache_handle *c)
(byte *) source_data,
(byte *) source_data + source_size);
if (error) {
- LOG("xosfile_save_stamped failed: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfile_save_stamped failed: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
return;
}
@@ -2067,7 +2109,7 @@ static void ro_gui_choose_language(void)
*/
nserror ro_warn_user(const char *warning, const char *detail)
{
- LOG("%s %s", warning, detail);
+ NSLOG(netsurf, INFO, "%s %s", warning, detail);
if (dialog_warning) {
char warn_buffer[300];
@@ -2111,7 +2153,7 @@ void die(const char * const error)
{
os_error warn_error;
- LOG("%s", error);
+ NSLOG(netsurf, INFO, "%s", error);
warn_error.errnum = 1; /* \todo: reasonable ? */
strncpy(warn_error.errmess, messages_get(error),
@@ -2348,7 +2390,7 @@ void ro_gui_dump_browser_window(struct browser_window *bw)
/* open file for dump */
FILE *stream = fopen("<Wimp$ScrapDir>.WWW.NetSurf.dump", "w");
if (!stream) {
- LOG("fopen: errno %i", errno);
+ NSLOG(netsurf, INFO, "fopen: errno %i", errno);
ro_warn_user("SaveError", strerror(errno));
return;
}
@@ -2361,7 +2403,8 @@ void ro_gui_dump_browser_window(struct browser_window *bw)
error = xwimp_start_task("Filer_Run <Wimp$ScrapDir>.WWW.NetSurf.dump",
0);
if (error) {
- LOG("xwimp_start_task failed: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_start_task failed: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -2401,7 +2444,7 @@ static char *get_cachepath(void)
cachedir = getenv("Cache$Dir");
if ((cachedir == NULL) || (cachedir[0] == 0)) {
- LOG("cachedir was null");
+ NSLOG(netsurf, INFO, "cachedir was null");
return NULL;
}
ret = netsurf_mkpath(&cachepath, NULL, 2, cachedir, "NetSurf");
@@ -2517,5 +2560,8 @@ int main(int argc, char** argv)
netsurf_exit();
nsoption_finalise(nsoptions, nsoptions_default);
+ /* finalise logging */
+ nslog_finalise();
+
return 0;
}
diff --git a/frontends/riscos/gui.h b/frontends/riscos/gui.h
index 1f5070012..49a8ba417 100644
--- a/frontends/riscos/gui.h
+++ b/frontends/riscos/gui.h
@@ -59,7 +59,6 @@ extern wimp_w dialog_info, dialog_saveas, dialog_zoom, dialog_pageinfo,
extern wimp_w current_menu_window;
extern bool current_menu_open;
extern wimp_menu *recent_search_menu; /* search.c */
-extern wimp_w history_window;
extern bool gui_redraw_debug;
extern osspriteop_area *gui_sprites;
extern bool dialog_folder_add, dialog_entry_add, hotlist_insert;
@@ -140,39 +139,6 @@ void ro_gui_401login_init(void);
void gui_401login_open(struct nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw);
-/* in window.c */
-void ro_gui_window_set_scale(struct gui_window *g, float scale);
-bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message);
-void ro_gui_window_mouse_at(wimp_pointer *pointer, void *data);
-void ro_gui_window_iconise(struct gui_window *g,
- wimp_full_message_window_info *wi);
-bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message);
-void ro_gui_window_redraw_all(void);
-void ro_gui_window_update_boxes(void);
-void ro_gui_window_quit(void);
-/* void ro_gui_window_close_all(void); */
-#define ro_gui_window_close_all ro_gui_window_quit /* no need for a separate fn */
-void ro_gui_throb(void);
-void ro_gui_window_default_options(struct gui_window *gui);
-struct gui_window *ro_gui_window_lookup(wimp_w window);
-struct gui_window *ro_gui_toolbar_lookup(wimp_w window);
-bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y,
- os_coord *pos);
-bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y,
- os_coord *pos);
-enum browser_mouse_state ro_gui_mouse_click_state(wimp_mouse_state buttons,
- wimp_icon_flags type);
-enum browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons,
- wimp_icon_flags type);
-bool ro_gui_shift_pressed(void);
-bool ro_gui_ctrl_pressed(void);
-bool ro_gui_alt_pressed(void);
-void gui_window_set_pointer(struct gui_window *g, enum gui_pointer_shape shape);
-
-/* in history.c */
-void ro_gui_history_init(void);
-void ro_gui_history_open(struct gui_window *g, bool pointer);
-
/* in schedule.c */
extern bool sched_active;
extern os_t sched_time;
diff --git a/frontends/riscos/gui/button_bar.c b/frontends/riscos/gui/button_bar.c
index 6ecd7cffa..34ae39ae5 100644
--- a/frontends/riscos/gui/button_bar.c
+++ b/frontends/riscos/gui/button_bar.c
@@ -138,7 +138,7 @@ struct button_bar *ro_gui_button_bar_create(struct theme_descriptor *theme,
button_bar = malloc(sizeof(struct button_bar));
if (button_bar == NULL) {
- LOG("No memory for malloc()");
+ NSLOG(netsurf, INFO, "No memory for malloc()");
return NULL;
}
@@ -538,7 +538,10 @@ bool ro_gui_button_bar_icon_update(struct button_bar *button_bar)
error = xwimp_create_icon(&icon, &button->icon);
if (error) {
- LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_create_icon: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
button->icon = -1;
return false;
@@ -548,7 +551,10 @@ bool ro_gui_button_bar_icon_update(struct button_bar *button_bar)
error = xwimp_delete_icon(button_bar->window,
button->icon);
if (error != NULL) {
- LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_delete_icon: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -598,7 +604,10 @@ bool ro_gui_button_bar_icon_resize(struct button_bar *button_bar)
button->y_pos +
button->y_size);
if (error != NULL) {
- LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_resize_icon: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
button->icon = -1;
return false;
@@ -769,7 +778,10 @@ bool ro_gui_button_bar_click(struct button_bar *button_bar,
button_bar->sprites,
sprite, &box, NULL);
if (error)
- LOG("xdragasprite_start: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xdragasprite_start: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_mouse_drag_start(ro_gui_button_bar_drag_end,
NULL, NULL, NULL);
@@ -870,7 +882,8 @@ void ro_gui_button_bar_drag_end(wimp_dragged *drag, void *data)
error = xwimp_get_pointer_info(&pointer);
if (error) {
- LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -880,7 +893,8 @@ void ro_gui_button_bar_drag_end(wimp_dragged *drag, void *data)
state.w = drag_start->window;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -1068,7 +1082,7 @@ char *ro_gui_button_bar_get_config(struct button_bar *button_bar)
config = malloc(size);
if (config == NULL) {
- LOG("No memory for malloc()");
+ NSLOG(netsurf, INFO, "No memory for malloc()");
ro_warn_user("NoMemory", 0);
return NULL;
}
diff --git a/frontends/riscos/gui/progress_bar.c b/frontends/riscos/gui/progress_bar.c
index c26b46c84..06d89dbf4 100644
--- a/frontends/riscos/gui/progress_bar.c
+++ b/frontends/riscos/gui/progress_bar.c
@@ -30,9 +30,9 @@
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
-#include "netsurf/plotters.h"
#include "utils/log.h"
#include "utils/utils.h"
+#include "netsurf/plotters.h"
#include "riscos/gui.h"
#include "riscos/tinct.h"
@@ -137,7 +137,8 @@ struct progress_bar *ro_gui_progress_bar_create(void)
error = xwimp_create_window((wimp_window *)&progress_bar_definition,
&pb->w);
if (error) {
- LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
+ error->errnum, error->errmess);
free(pb);
return NULL;
}
@@ -165,7 +166,8 @@ void ro_gui_progress_bar_destroy(struct progress_bar *pb)
ro_gui_wimp_event_finalise(pb->w);
error = xwimp_delete_window(pb->w);
if (error) {
- LOG("xwimp_delete_window: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s",
+ error->errnum, error->errmess);
}
free(pb);
@@ -327,7 +329,8 @@ void ro_gui_progress_bar_update(struct progress_bar *pb, int width, int height)
redraw.box.x0 = cur.x1;
error = xwimp_update_window(&redraw, &more);
if (error) {
- LOG("Error getting update window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "Error getting update window: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
if (more)
@@ -351,7 +354,8 @@ void ro_gui_progress_bar_redraw(wimp_draw *redraw)
error = xwimp_redraw_window(redraw, &more);
if (error) {
- LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
if (more)
@@ -385,7 +389,8 @@ void ro_gui_progress_bar_animate(void *p)
redraw.box = pb->visible;
error = xwimp_update_window(&redraw, &more);
if (error != NULL) {
- LOG("Error getting update window: '%s'", error->errmess);
+ NSLOG(netsurf, INFO, "Error getting update window: '%s'",
+ error->errmess);
return;
}
if (more)
@@ -482,6 +487,11 @@ void ro_gui_progress_bar_redraw_window(wimp_draw *redraw,
osbool more = true;
struct rect clip;
int progress_ymid;
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &ro_plotters
+ };
/* initialise the plotters */
ro_plot_origin_x = 0;
@@ -513,22 +523,23 @@ void ro_gui_progress_bar_redraw_window(wimp_draw *redraw,
redraw->box.y0 + pb->visible.y0) >> 1;
if ((clip.x0 < clip.x1) && (clip.y0 < clip.y1)) {
if (progress_icon) {
- ro_plotters.clip(&clip);
+ ctx.plot->clip(&ctx, &clip);
_swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7),
progress_icon,
redraw->box.x0 - pb->offset,
progress_ymid - progress_height,
tinct_FILL_HORIZONTALLY);
} else {
- ro_plotters.rectangle(clip.x0, clip.y0,
- clip.x1, clip.y1,
- plot_style_fill_red);
+ ctx.plot->rectangle(&ctx,
+ plot_style_fill_red,
+ &clip);
}
}
}
error = xwimp_get_rectangle(redraw, &more);
if (error) {
- LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
}
diff --git a/frontends/riscos/gui/status_bar.c b/frontends/riscos/gui/status_bar.c
index 9d1bada91..dd1aab639 100644
--- a/frontends/riscos/gui/status_bar.c
+++ b/frontends/riscos/gui/status_bar.c
@@ -28,9 +28,10 @@
#include "oslib/os.h"
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
-#include "netsurf/plotters.h"
+
#include "utils/log.h"
#include "utils/utils.h"
+#include "netsurf/plotters.h"
#include "riscos/gui.h"
#include "riscos/wimp.h"
@@ -130,7 +131,8 @@ struct status_bar *ro_gui_status_bar_create(wimp_w parent, unsigned int width)
error = xwimp_create_window((wimp_window *)&status_bar_definition,
&sb->w);
if (error) {
- LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
+ error->errnum, error->errmess);
free(sb);
return NULL;
}
@@ -164,7 +166,8 @@ void ro_gui_status_bar_destroy(struct status_bar *sb)
ro_gui_wimp_event_finalise(sb->w);
error = xwimp_delete_window(sb->w);
if (error) {
- LOG("xwimp_delete_window: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s",
+ error->errnum, error->errmess);
}
ro_gui_progress_bar_destroy(sb->pb);
@@ -221,7 +224,8 @@ void ro_gui_status_bar_set_visible(struct status_bar *sb, bool visible)
} else {
os_error *error = xwimp_close_window(sb->w);
if (error) {
- LOG("xwimp_close_window: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x:%s",
+ error->errnum, error->errmess);
}
}
}
@@ -274,14 +278,15 @@ void ro_gui_status_bar_set_progress_range(struct status_bar *sb,
old_range = ro_gui_progress_bar_get_range(sb->pb);
ro_gui_progress_bar_set_range(sb->pb, range);
- LOG("Ranges are %i vs %i", old_range, range);
+ NSLOG(netsurf, INFO, "Ranges are %i vs %i", old_range, range);
if ((old_range == 0) && (range != 0)) {
ro_gui_status_position_progress_bar(sb);
} else if ((old_range != 0) && (range == 0)) {
os_error *error = xwimp_close_window(
ro_gui_progress_bar_get_window(sb->pb));
if (error) {
- LOG("xwimp_close_window: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x:%s",
+ error->errnum, error->errmess);
}
}
}
@@ -353,7 +358,8 @@ void ro_gui_status_bar_resize(struct status_bar *sb)
state.w = sb->parent;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
window_width = state.visible.x1 - state.visible.x0;
@@ -376,7 +382,8 @@ void ro_gui_status_bar_resize(struct status_bar *sb)
extent.y1 = status_height - 4;
error = xwimp_set_extent(sb->w, &extent);
if (error) {
- LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
@@ -404,7 +411,10 @@ void ro_gui_status_bar_resize(struct status_bar *sb)
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
<< wimp_CHILD_TS_EDGE_SHIFT);
if (error) {
- LOG("xwimp_open_window_nested: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_open_window_nested: 0x%x: %s",
+ error->errnum,
+ error->errmess);
return;
}
ro_gui_status_position_progress_bar(sb);
@@ -412,7 +422,8 @@ void ro_gui_status_bar_resize(struct status_bar *sb)
status_width - WIDGET_WIDTH, 0,
status_width, status_height - 4);
if (error) {
- LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
@@ -436,6 +447,12 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw)
os_error *error;
osbool more;
rufl_code code;
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &ro_plotters
+ };
+ struct rect rect;
sb = (struct status_bar *)ro_gui_wimp_event_get_user_data(redraw->w);
assert(sb);
@@ -447,7 +464,8 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw)
/* redraw the window */
error = xwimp_redraw_window(redraw, &more);
if (error) {
- LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
while (more) {
@@ -456,7 +474,10 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw)
error = xcolourtrans_set_font_colours(font_CURRENT,
0xeeeeee00, 0x00000000, 14, 0, 0, 0);
if (error) {
- LOG("xcolourtrans_set_font_colours: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xcolourtrans_set_font_colours: 0x%x: %s",
+ error->errnum,
+ error->errmess);
return;
}
code = rufl_paint(ro_gui_desktop_font_family,
@@ -467,22 +488,30 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw)
rufl_BLEND_FONT);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG("rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
+ NSLOG(netsurf, INFO,
+ "rufl_FONT_MANAGER_ERROR: 0x%x: %s",
+ rufl_fm_error->errnum,
+ rufl_fm_error->errmess);
else
- LOG("rufl_paint: 0x%x", code);
+ NSLOG(netsurf, INFO,
+ "rufl_paint: 0x%x", code);
}
}
+ rect.x0 = (redraw->box.x0 + sb->width - WIDGET_WIDTH - 2) >> 1;
+ rect.y0 = -redraw->box.y0 >> 1;
+ rect.x1 = (redraw->box.x0 + sb->width - WIDGET_WIDTH) >> 1;
+ rect.y1 = -redraw->box.y1 >> 1;
+
/* separate the widget from the text with a line */
- ro_plotters.rectangle((redraw->box.x0 + sb->width - WIDGET_WIDTH - 2) >> 1,
- -redraw->box.y0 >> 1,
- (redraw->box.x0 + sb->width - WIDGET_WIDTH) >> 1,
- -redraw->box.y1 >> 1,
- plot_style_fill_black);
+ ctx.plot->rectangle(&ctx,
+ plot_style_fill_black,
+ &rect);
error = xwimp_get_rectangle(redraw, &more);
if (error) {
- LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
}
@@ -521,7 +550,10 @@ bool ro_gui_status_bar_click(wimp_pointer *pointer)
drag.initial.y1 = pointer->pos.y;
error = xwimp_drag_box(&drag);
if (error) {
- LOG("xwimp_drag_box: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_drag_box: 0x%x: %s",
+ error->errnum,
+ error->errmess);
}
break;
}
@@ -546,7 +578,8 @@ void ro_gui_status_bar_open(wimp_open *open)
state.w = sb->parent;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
window_width = state.visible.x1 - state.visible.x0;
@@ -585,7 +618,8 @@ void ro_gui_status_position_progress_bar(struct status_bar *sb)
state.w = sb->w;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
@@ -615,7 +649,8 @@ void ro_gui_status_position_progress_bar(struct status_bar *sb)
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
<< wimp_CHILD_TS_EDGE_SHIFT);
if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
}
/* update the progress bar display on non-standard width */
diff --git a/frontends/riscos/gui/throbber.c b/frontends/riscos/gui/throbber.c
index a326f806c..f3b79a68e 100644
--- a/frontends/riscos/gui/throbber.c
+++ b/frontends/riscos/gui/throbber.c
@@ -81,7 +81,7 @@ struct throbber *ro_gui_throbber_create(struct theme_descriptor *theme)
throbber = malloc(sizeof(struct throbber));
if (throbber == NULL) {
- LOG("No memory for malloc()");
+ NSLOG(netsurf, INFO, "No memory for malloc()");
return NULL;
}
@@ -248,7 +248,8 @@ bool ro_gui_throbber_icon_update(struct throbber *throbber)
error = xwimp_create_icon(&icon, &throbber->icon);
if (error != NULL) {
- LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
throbber->icon = -1;
return false;
@@ -259,7 +260,8 @@ bool ro_gui_throbber_icon_update(struct throbber *throbber)
} else if (throbber->hidden && throbber->icon != -1) {
error = xwimp_delete_icon(throbber->window, throbber->icon);
if (error != NULL) {
- LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -295,7 +297,8 @@ bool ro_gui_throbber_icon_resize(struct throbber *throbber)
throbber->extent.x0, throbber->extent.y0,
throbber->extent.x1, throbber->extent.y1);
if (error != NULL) {
- LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
throbber->icon = -1;
return false;
diff --git a/frontends/riscos/gui/url_bar.c b/frontends/riscos/gui/url_bar.c
index a5ec3f8c6..ee5c689df 100644
--- a/frontends/riscos/gui/url_bar.c
+++ b/frontends/riscos/gui/url_bar.c
@@ -140,7 +140,7 @@ struct url_bar *ro_gui_url_bar_create(struct theme_descriptor *theme)
url_bar = malloc(sizeof(struct url_bar));
if (url_bar == NULL) {
- LOG("No memory for malloc()");
+ NSLOG(netsurf, INFO, "No memory for malloc()");
return NULL;
}
@@ -240,7 +240,8 @@ static bool ro_gui_url_bar_icon_resize(struct url_bar *url_bar, bool full)
url_bar->container_icon,
x0, y0, x1, y1);
if (error != NULL) {
- LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
url_bar->container_icon = -1;
return false;
@@ -260,7 +261,8 @@ static bool ro_gui_url_bar_icon_resize(struct url_bar *url_bar, bool full)
url_bar->suggest_icon,
x0, y0, x1, y1);
if (error != NULL) {
- LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
url_bar->suggest_icon = -1;
return false;
@@ -281,7 +283,8 @@ static bool ro_gui_url_bar_icon_resize(struct url_bar *url_bar, bool full)
url_bar->text_icon,
x0, y0, x1, y1);
if (error != NULL) {
- LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
url_bar->text_icon = -1;
return false;
@@ -362,7 +365,8 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
wimp_ICON_BUTTON_TYPE_SHIFT);
error = xwimp_create_icon(&icon, &url_bar->container_icon);
if (error != NULL) {
- LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
url_bar->container_icon = -1;
return false;
@@ -373,7 +377,8 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
error = xwimp_delete_icon(url_bar->window,
url_bar->container_icon);
if (error != NULL) {
- LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -399,7 +404,8 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
wimp_ICON_BUTTON_TYPE_SHIFT);
error = xwimp_create_icon(&icon, &url_bar->text_icon);
if (error) {
- LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
url_bar->text_icon = -1;
return false;
@@ -410,7 +416,8 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
error = xwimp_delete_icon(url_bar->window,
url_bar->text_icon);
if (error != NULL) {
- LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -430,7 +437,8 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
wimp_ICON_BUTTON_TYPE_SHIFT);
error = xwimp_create_icon(&icon, &url_bar->suggest_icon);
if (error) {
- LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -450,7 +458,8 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar)
error = xwimp_delete_icon(url_bar->window,
url_bar->suggest_icon);
if (error != NULL) {
- LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -940,7 +949,8 @@ bool ro_gui_url_bar_take_caret(struct url_bar *url_bar)
error = xwimp_set_caret_position(url_bar->window, url_bar->text_icon,
-1, -1, -1, 0);
if (error) {
- LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_caret_position: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
@@ -977,7 +987,7 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url,
if (err != NSERROR_OK) {
/* A bad encoding should never happen, so assert this */
assert(err != NSERROR_BAD_ENCODING);
- LOG("utf8_to_enc failed");
+ NSLOG(netsurf, INFO, "utf8_to_enc failed");
/* Paranoia */
local_text = NULL;
}
@@ -993,7 +1003,8 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url,
if (strlen(local_url) >= url_bar->text_size) {
url_bar->text_buffer[0] = '\0';
ro_warn_user("LongURL", NULL);
- LOG("Long URL (%zu chars): %s", strlen(url), url);
+ NSLOG(netsurf, INFO, "Long URL (%zu chars): %s", strlen(url),
+ url);
} else {
strncpy(url_bar->text_buffer, local_url,
url_bar->text_size - 1);
@@ -1021,7 +1032,8 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url,
error = xwimp_get_caret_position(&caret);
if (error) {
- LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -1034,7 +1046,10 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url,
error = xwimp_set_caret_position(url_bar->window,
url_bar->text_icon, 0, 0, -1, strlen(set_url));
if (error) {
- LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_set_caret_position: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -1123,7 +1138,8 @@ bool ro_gui_url_bar_get_url_extent(struct url_bar *url_bar, os_box *extent)
state.i = url_bar->container_icon;
error = xwimp_get_icon_state(&state);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
diff --git a/frontends/riscos/help.c b/frontends/riscos/help.c
index b6871c5eb..952b3f2d1 100644
--- a/frontends/riscos/help.c
+++ b/frontends/riscos/help.c
@@ -166,7 +166,8 @@ void ro_gui_interactive_help_request(wimp_message *message)
error = xwimp_get_menu_state(wimp_GIVEN_WINDOW_AND_ICON,
&menu_tree, window, icon);
if (error) {
- LOG("xwimp_get_menu_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_menu_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -269,7 +270,8 @@ static void ro_gui_interactive_help_broadcast(wimp_message *message,
error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message *)reply,
reply->sender);
if (error) {
- LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -297,7 +299,10 @@ bool ro_gui_interactive_help_available(void)
error = xtaskmanager_enumerate_tasks(context, &task,
sizeof(taskmanager_task), &context, 0);
if (error) {
- LOG("xtaskmanager_enumerate_tasks: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xtaskmanager_enumerate_tasks: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
}
@@ -334,7 +339,8 @@ void ro_gui_interactive_help_start(void)
if ((help_start) && (help_start[0])) {
error = xwimp_start_task("<Help$Start>", &task);
if (error) {
- LOG("xwimp_start_tast: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_start_tast: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -344,7 +350,8 @@ void ro_gui_interactive_help_start(void)
if (!task) {
error = xwimp_start_task("Resources:$.Apps.!Help", &task);
if (error) {
- LOG("xwimp_start_tast: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_start_tast: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -354,7 +361,10 @@ void ro_gui_interactive_help_start(void)
if (task) {
error = xos_read_monotonic_time(&help_time);
if (error) {
- LOG("xwimp_read_monotonic_time: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_read_monotonic_time: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
diff --git a/frontends/riscos/history.c b/frontends/riscos/history.c
deleted file mode 100644
index de3af085d..000000000
--- a/frontends/riscos/history.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Copyright 2006 James Bursa <bursa@users.sourceforge.net>
- * Copyright 2005 Richard Wilson <info@tinct.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Browser history window (RISC OS implementation).
- *
- * There is only one history window, not one per browser window.
- */
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-#include "oslib/wimp.h"
-
-#include "utils/nsoption.h"
-#include "utils/log.h"
-#include "desktop/browser_history.h"
-#include "netsurf/plotters.h"
-
-#include "riscos/dialog.h"
-#include "riscos/gui.h"
-#include "riscos/mouse.h"
-#include "riscos/wimp.h"
-#include "riscos/wimp_event.h"
-#include "riscos/wimputils.h"
-
-static struct browser_window *history_bw;
-/* Last position of mouse in window. */
-static int mouse_x = 0;
-/* Last position of mouse in window. */
-static int mouse_y = 0;
-wimp_w history_window;
-
-static void ro_gui_history_redraw(wimp_draw *redraw);
-static bool ro_gui_history_click(wimp_pointer *pointer);
-static void ro_gui_history_pointer_entering(wimp_entering *entering);
-static void ro_gui_history_track_end(wimp_leaving *leaving, void *data);
-static void ro_gui_history_mouse_at(wimp_pointer *pointer, void *data);
-
-
-/**
- * Create history window.
- */
-
-void ro_gui_history_init(void)
-{
- history_window = ro_gui_dialog_create("history");
- ro_gui_wimp_event_register_redraw_window(history_window,
- ro_gui_history_redraw);
- ro_gui_wimp_event_register_mouse_click(history_window,
- ro_gui_history_click);
- ro_gui_wimp_event_register_pointer_entering_window(history_window,
- ro_gui_history_pointer_entering);
- ro_gui_wimp_event_set_help_prefix(history_window, "HelpHistory");
-}
-
-
-/**
- * Open history window.
- *
- * \param g The riscos window to open history for.
- * \param at_pointer open the window at the pointer.
- */
-
-void ro_gui_history_open(struct gui_window *g, bool at_pointer)
-{
- struct browser_window *bw;
- int width, height;
- os_box box = {0, 0, 0, 0};
- wimp_window_state state;
- os_error *error;
-
- assert(g != NULL);
- assert(g->bw != NULL);
- bw = g->bw;
- history_bw = bw;
-
- browser_window_history_size(bw, &width, &height);
- width *= 2;
- height *= 2;
-
- /* set extent */
- box.x1 = width;
- box.y0 = -height;
- error = xwimp_set_extent(history_window, &box);
- if (error) {
- LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
-
- /* open full size */
- state.w = history_window;
- error = xwimp_get_window_state(&state);
- if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
- state.visible.x0 = 0;
- state.visible.y0 = 0;
- state.visible.x1 = width;
- state.visible.y1 = height;
- state.next = wimp_HIDDEN;
- error = xwimp_open_window(PTR_WIMP_OPEN(&state));
- if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
-
- ro_gui_dialog_open_persistent(g->window, history_window, at_pointer);
-}
-
-
-/**
- * Redraw history window.
- */
-
-void ro_gui_history_redraw(wimp_draw *redraw)
-{
- osbool more;
- os_error *error;
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &ro_plotters
- };
-
- error = xwimp_redraw_window(redraw, &more);
- if (error) {
- LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
- while (more) {
- ro_plot_origin_x = redraw->box.x0 - redraw->xscroll;
- ro_plot_origin_y = redraw->box.y1 - redraw->yscroll;
- browser_window_history_redraw(history_bw, &ctx);
- error = xwimp_get_rectangle(redraw, &more);
- if (error) {
- LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
- }
-}
-
-
-/**
- * Handle Pointer Entering Window events the history window.
- *
- * \param *entering The Wimp_PointerEnteringWindow block.
- */
-
-void ro_gui_history_pointer_entering(wimp_entering *entering)
-{
- ro_mouse_track_start(ro_gui_history_track_end,
- ro_gui_history_mouse_at, NULL);
-}
-
-
-/**
- * Handle Pointer Leaving Window events the history window. These arrive as the
- * termination callback handler from ro_mouse's mouse tracking.
- *
- * \param *leaving The Wimp_PointerLeavingWindow block.
- * \param *data NULL data pointer.
- */
-
-void ro_gui_history_track_end(wimp_leaving *leaving, void *data)
-{
- ro_gui_dialog_close(dialog_tooltip);
-}
-
-
-/**
- * Handle mouse movements over the history window.
- */
-
-void ro_gui_history_mouse_at(wimp_pointer *pointer, void *data)
-{
- int x, y;
- int width;
- const char *url;
- wimp_window_state state;
- wimp_icon_state ic;
- os_box box = {0, 0, 0, 0};
- os_error *error;
-
- LOG("Mouse at...");
-
- /* If the mouse hasn't moved, or if we don't want tooltips, exit */
- if ((mouse_x == pointer->pos.x && mouse_y == pointer->pos.y) ||
- !nsoption_bool(history_tooltip))
- return;
-
- /* Update mouse position */
- mouse_x = pointer->pos.x;
- mouse_y = pointer->pos.y;
-
- /* Find history tree entry under mouse */
- state.w = history_window;
- error = xwimp_get_window_state(&state);
- if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
-
- x = (pointer->pos.x - (state.visible.x0 - state.xscroll)) / 2;
- y = -(pointer->pos.y - (state.visible.y1 - state.yscroll)) / 2;
- url = browser_window_history_position_url(history_bw, x, y);
- if (!url) {
- /* not over a tree entry => close tooltip window. */
- error = xwimp_close_window(dialog_tooltip);
- if (error) {
- LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
- return;
- }
-
- /* get width of string */
- error = xwimptextop_string_width(url,
- strlen(url) > 256 ? 256 : strlen(url),
- &width);
- if (error) {
- LOG("xwimptextop_string_width: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
-
- ro_gui_set_icon_string(dialog_tooltip, 0, url, true);
-
- /* resize icon appropriately */
- ic.w = dialog_tooltip;
- ic.i = 0;
- error = xwimp_get_icon_state(&ic);
- if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
- error = xwimp_resize_icon(dialog_tooltip, 0,
- ic.icon.extent.x0, ic.icon.extent.y0,
- width + 16, ic.icon.extent.y1);
- if (error) {
- LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
-
- state.w = dialog_tooltip;
- error = xwimp_get_window_state(&state);
- if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
-
- /* update window extent */
- box.x1 = width + 16;
- box.y0 = -36;
- error = xwimp_set_extent(dialog_tooltip, &box);
- if (error) {
- LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
-
- /* set visible area */
- state.visible.x0 = pointer->pos.x + 24;
- state.visible.y0 = pointer->pos.y - 22 - 36;
- state.visible.x1 = pointer->pos.x + 24 + width + 16;
- state.visible.y1 = pointer->pos.y - 22;
- state.next = wimp_TOP;
- /* open window */
- error = xwimp_open_window(PTR_WIMP_OPEN(&state));
- if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
-}
-
-
-/**
- * Handle mouse clicks in the history window.
- *
- * \return true if the event was handled, false to pass it on
- */
-
-bool ro_gui_history_click(wimp_pointer *pointer)
-{
- int x, y;
- wimp_window_state state;
- os_error *error;
-
- if (pointer->buttons != wimp_CLICK_SELECT &&
- pointer->buttons != wimp_CLICK_ADJUST)
- /* return if not select or adjust click */
- return true;
-
- state.w = history_window;
- error = xwimp_get_window_state(&state);
- if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return true;
- }
-
- x = (pointer->pos.x - (state.visible.x0 - state.xscroll)) / 2;
- y = -(pointer->pos.y - (state.visible.y1 - state.yscroll)) / 2;
- browser_window_history_click(history_bw, x, y,
- pointer->buttons == wimp_CLICK_ADJUST);
-
- return true;
-}
diff --git a/frontends/riscos/hotlist.c b/frontends/riscos/hotlist.c
index ea85bc3b5..b0ed1e2f4 100644
--- a/frontends/riscos/hotlist.c
+++ b/frontends/riscos/hotlist.c
@@ -466,7 +466,7 @@ static nserror ro_hotlist_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct ro_hotlist_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
@@ -548,19 +548,20 @@ nserror ro_gui_hotlist_present(void)
return NSERROR_OK;
}
- LOG("xos_cli: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xos_cli: 0x%x: %s", error->errnum,
+ error->errmess);
ro_warn_user("Failed to launch external hotlist: %s",
error->errmess);
}
res = ro_hotlist_init();
if (res == NSERROR_OK) {
- LOG("Presenting");
+ NSLOG(netsurf, INFO, "Presenting");
ro_gui_dialog_open_top(hotlist_window->core.wh,
hotlist_window->core.toolbar,
600, 800);
} else {
- LOG("Failed presenting code %d", res);
+ NSLOG(netsurf, INFO, "Failed presenting code %d", res);
}
return res;
@@ -583,7 +584,7 @@ nserror ro_gui_hotlist_finalise(void)
return NSERROR_OK;
}
- res = hotlist_fini(nsoption_charp(hotlist_save));
+ res = hotlist_fini();
if (res == NSERROR_OK) {
res = ro_corewindow_fini(&hotlist_window->core);
diff --git a/frontends/riscos/iconbar.c b/frontends/riscos/iconbar.c
index 3430ed2f0..23f97258b 100644
--- a/frontends/riscos/iconbar.c
+++ b/frontends/riscos/iconbar.c
@@ -95,7 +95,8 @@ void ro_gui_iconbar_initialise(void)
{ "!netsurf" } } };
error = xwimp_create_icon(&icon, 0);
if (error) {
- LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s",
+ error->errnum, error->errmess);
die(error->errmess);
}
@@ -238,7 +239,8 @@ bool ro_gui_iconbar_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
return true;
case APPLICATION_QUIT:
if (ro_gui_prequit()) {
- LOG("QUIT in response to user request");
+ NSLOG(netsurf, INFO,
+ "QUIT in response to user request");
riscos_done = true;
}
return true;
diff --git a/frontends/riscos/image.c b/frontends/riscos/image.c
index acbe62d98..30cb30096 100644
--- a/frontends/riscos/image.c
+++ b/frontends/riscos/image.c
@@ -142,7 +142,8 @@ bool image_redraw_tinct(osspriteop_id header, int x, int y,
}
if (error) {
- LOG("xtinct_plotscaled%s: 0x%x: %s", (alpha ? "alpha" : ""), error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xtinct_plotscaled%s: 0x%x: %s",
+ (alpha ? "alpha" : ""), error->errnum, error->errmess);
return false;
}
@@ -176,13 +177,16 @@ bool image_redraw_os(osspriteop_id header, int x, int y, int req_width,
colourtrans_CURRENT_PALETTE,
0, colourtrans_GIVEN_SPRITE, 0, 0, &size);
if (error) {
- LOG("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xcolourtrans_generate_table_for_sprite: 0x%x: %s",
+ error->errnum,
+ error->errmess);
return false;
}
table = calloc(size, sizeof(char));
if (!table) {
- LOG("malloc failed");
+ NSLOG(netsurf, INFO, "malloc failed");
ro_warn_user("NoMemory", 0);
return false;
}
@@ -193,7 +197,10 @@ bool image_redraw_os(osspriteop_id header, int x, int y, int req_width,
colourtrans_CURRENT_PALETTE,
table, colourtrans_GIVEN_SPRITE, 0, 0, 0);
if (error) {
- LOG("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xcolourtrans_generate_table_for_sprite: 0x%x: %s",
+ error->errnum,
+ error->errmess);
free(table);
return false;
}
@@ -208,7 +215,10 @@ bool image_redraw_os(osspriteop_id header, int x, int y, int req_width,
x, (int)(y - req_height),
8, &f, table);
if (error) {
- LOG("xosspriteop_put_sprite_scaled: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosspriteop_put_sprite_scaled: 0x%x: %s",
+ error->errnum,
+ error->errmess);
free(table);
return false;
}
diff --git a/frontends/riscos/local_history.c b/frontends/riscos/local_history.c
new file mode 100644
index 000000000..bbe6a1d12
--- /dev/null
+++ b/frontends/riscos/local_history.c
@@ -0,0 +1,442 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Implementation of RISC OS local history.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <oslib/wimp.h>
+
+#include "utils/nsoption.h"
+#include "utils/messages.h"
+#include "utils/log.h"
+#include "utils/nsurl.h"
+#include "netsurf/window.h"
+#include "netsurf/plotters.h"
+#include "netsurf/keypress.h"
+#include "desktop/local_history.h"
+
+#include "riscos/dialog.h"
+#include "riscos/gui.h"
+#include "riscos/menus.h"
+#include "riscos/save.h"
+#include "riscos/toolbar.h"
+#include "riscos/wimp.h"
+#include "riscos/wimp_event.h"
+#include "riscos/wimputils.h"
+#include "riscos/corewindow.h"
+#include "riscos/local_history.h"
+
+struct ro_local_history_window {
+ struct ro_corewindow core;
+
+ /** local history window context */
+ struct local_history_session *session;
+
+ /** tooltip previous x */
+ int x;
+ /** tooltip previous y */
+ int y;
+};
+
+/** local_history window is a singleton */
+static struct ro_local_history_window *local_history_window = NULL;
+
+/** riscos template for local_history window */
+static wimp_window *dialog_local_history_template;
+
+
+/**
+ * callback to draw on drawable area of ro local history window
+ *
+ * \param ro_cw The riscos core window structure.
+ * \param r The rectangle of the window that needs updating.
+ * \param originx The risc os plotter x origin.
+ * \param originy The risc os plotter y origin.
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ro_local_history_draw(struct ro_corewindow *ro_cw,
+ int originx,
+ int originy,
+ struct rect *r)
+{
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &ro_plotters
+ };
+ struct ro_local_history_window *lhw;
+
+ lhw = (struct ro_local_history_window *)ro_cw;
+
+ ro_plot_origin_x = originx;
+ ro_plot_origin_y = originy;
+ no_font_blending = true;
+ local_history_redraw(lhw->session, 0, 0, r, &ctx);
+ no_font_blending = false;
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * callback for keypress on ro coookie window
+ *
+ * \param ro_cw The ro core window structure.
+ * \param nskey The netsurf key code.
+ * \return NSERROR_OK if key processed,
+ * NSERROR_NOT_IMPLEMENTED if key not processed
+ * otherwise apropriate error code
+ */
+static nserror
+ro_local_history_key(struct ro_corewindow *ro_cw, uint32_t nskey)
+{
+ struct ro_local_history_window *lhw;
+
+ lhw = (struct ro_local_history_window *)ro_cw;
+
+ if (local_history_keypress(lhw->session, nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
+
+/**
+ * handle hover mouse movement for tooltips
+ */
+static nserror
+ro_local_history_tooltip(struct ro_local_history_window *lhw, int x, int y)
+{
+ int width;
+ nsurl *url;
+ wimp_window_state state;
+ wimp_icon_state ic;
+ os_box box = {0, 0, 0, 0};
+ os_error *error;
+ wimp_pointer pointer;
+ nserror res;
+
+ /* check if tooltip are required */
+ if (!nsoption_bool(history_tooltip)) {
+ return NSERROR_OK;
+ }
+
+ /* ensure pointer has moved */
+ if ((lhw->x == x) && (lhw->y == y)) {
+ return NSERROR_OK;
+ }
+
+ lhw->x = x;
+ lhw->y = y;
+
+ res = local_history_get_url(lhw->session, x, y, &url);
+ if (res != NSERROR_OK) {
+ /* not over a tree entry => close tooltip window. */
+ error = xwimp_close_window(dialog_tooltip);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_NOMEM;
+ }
+ return NSERROR_OK;
+ }
+
+ /* get width of string */
+ error = xwimptextop_string_width(nsurl_access(url),
+ nsurl_length(url) > 256 ? 256 : nsurl_length(url),
+ &width);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimptextop_string_width: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ nsurl_unref(url);
+ return NSERROR_NOMEM;
+ }
+
+ ro_gui_set_icon_string(dialog_tooltip, 0, nsurl_access(url), true);
+ nsurl_unref(url);
+
+ /* resize icon appropriately */
+ ic.w = dialog_tooltip;
+ ic.i = 0;
+ error = xwimp_get_icon_state(&ic);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_NOMEM;
+ }
+ error = xwimp_resize_icon(dialog_tooltip, 0,
+ ic.icon.extent.x0, ic.icon.extent.y0,
+ width + 16, ic.icon.extent.y1);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_NOMEM;
+ }
+
+ state.w = dialog_tooltip;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_NOMEM;
+ }
+
+ /* update window extent */
+ box.x1 = width + 16;
+ box.y0 = -36;
+ error = xwimp_set_extent(dialog_tooltip, &box);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_NOMEM;
+ }
+
+ error = xwimp_get_pointer_info(&pointer);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_NOMEM;
+ }
+
+ /* set visible area */
+ state.visible.x0 = pointer.pos.x + 24;
+ state.visible.y0 = pointer.pos.y - 22 - 36;
+ state.visible.x1 = pointer.pos.x + 24 + width + 16;
+ state.visible.y1 = pointer.pos.y - 22;
+ state.next = wimp_TOP;
+ /* open window */
+ error = xwimp_open_window(PTR_WIMP_OPEN(&state));
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_NOMEM;
+ }
+ return NSERROR_OK;
+}
+
+
+/**
+ * callback for mouse event on ro local_history window
+ *
+ * \param ro_cw The ro core window structure.
+ * \param mouse_state mouse state
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on sucess otherwise apropriate error code.
+ */
+static nserror
+ro_local_history_mouse(struct ro_corewindow *ro_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ struct ro_local_history_window *lhw;
+
+ lhw = (struct ro_local_history_window *)ro_cw;
+
+ switch (mouse_state) {
+
+ case BROWSER_MOUSE_HOVER:
+ ro_local_history_tooltip(lhw, x, y);
+ break;
+
+ case BROWSER_MOUSE_LEAVE:
+ ro_gui_dialog_close(dialog_tooltip);
+ break;
+
+ default:
+ local_history_mouse_action(lhw->session, mouse_state, x, y);
+ break;
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Creates the window for the local_history tree.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+static nserror
+ro_local_history_init(struct browser_window *bw,
+ struct ro_local_history_window **win_out)
+{
+ struct ro_local_history_window *ncwin;
+ nserror res;
+
+ /* memoise window so it can be represented when necessary
+ * instead of recreating every time.
+ */
+ if ((*win_out) != NULL) {
+ res = local_history_set((*win_out)->session, bw);
+ return res;
+ }
+
+ ncwin = calloc(1, sizeof(*ncwin));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ /* create window from template */
+ ncwin->core.wh = wimp_create_window(dialog_local_history_template);
+
+ /* initialise callbacks */
+ ncwin->core.draw = ro_local_history_draw;
+ ncwin->core.key = ro_local_history_key;
+ ncwin->core.mouse = ro_local_history_mouse;
+
+ /* initialise core window */
+ res = ro_corewindow_init(&ncwin->core,
+ NULL,
+ NULL,
+ 0,
+ NULL);
+ if (res != NSERROR_OK) {
+ free(ncwin);
+ return res;
+ }
+
+ res = local_history_init(ncwin->core.cb_table,
+ (struct core_window *)ncwin,
+ bw,
+ &ncwin->session);
+ if (res != NSERROR_OK) {
+ free(ncwin);
+ return res;
+ }
+
+ *win_out = ncwin;
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * open RISC OS local history window at the correct size
+ */
+static nserror
+ro_local_history_open(struct ro_local_history_window *lhw, wimp_w parent)
+{
+ nserror res;
+ int width, height;
+ os_box box = {0, 0, 0, 0};
+ wimp_window_state state;
+ os_error *error;
+
+ res = local_history_get_size(lhw->session, &width, &height);
+ if (res != NSERROR_OK) {
+ return res;
+ }
+
+ width *= 2;
+ height *= 2;
+
+ /* set extent */
+ box.x1 = width;
+ box.y0 = -height;
+ error = xwimp_set_extent(lhw->core.wh, &box);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_NOMEM;
+ }
+
+ /* open full size */
+ state.w = lhw->core.wh;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_NOMEM;
+ }
+ state.visible.x0 = 0;
+ state.visible.y0 = 0;
+ state.visible.x1 = width;
+ state.visible.y1 = height;
+ state.next = wimp_HIDDEN;
+ error = xwimp_open_window(PTR_WIMP_OPEN(&state));
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_NOMEM;
+ }
+
+ ro_gui_dialog_open_persistent(parent, lhw->core.wh, true);
+
+ return NSERROR_OK;
+}
+
+/* exported interface documented in riscos/local_history.h */
+nserror ro_gui_local_history_present(wimp_w parent, struct browser_window *bw)
+{
+ nserror res;
+
+ res = ro_local_history_init(bw, &local_history_window);
+ if (res == NSERROR_OK) {
+ NSLOG(netsurf, INFO, "Presenting");
+ res = ro_local_history_open(local_history_window, parent);
+ } else {
+ NSLOG(netsurf, INFO, "Failed presenting error code %d", res);
+ }
+
+ return res;
+}
+
+
+/* exported interface documented in riscos/local_history.h */
+void ro_gui_local_history_initialise(void)
+{
+ dialog_local_history_template = ro_gui_dialog_load_template("history");
+}
+
+
+/* exported interface documented in riscos/local_history.h */
+nserror ro_gui_local_history_finalise(void)
+{
+ nserror res;
+
+ if (local_history_window == NULL) {
+ return NSERROR_OK;
+ }
+
+ res = local_history_fini(local_history_window->session);
+ if (res == NSERROR_OK) {
+ res = ro_corewindow_fini(&local_history_window->core);
+
+ free(local_history_window);
+ local_history_window = NULL;
+ }
+
+ return res;
+}
diff --git a/frontends/riscos/local_history.h b/frontends/riscos/local_history.h
new file mode 100644
index 000000000..d5b22b404
--- /dev/null
+++ b/frontends/riscos/local_history.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * RISC OS local history interface.
+ */
+
+#ifndef RISCOS_LOCALHISTORY_H
+#define RISCOS_LOCALHISTORY_H
+
+/**
+ * initialise the local history window template ready for subsequent use.
+ */
+void ro_gui_local_history_initialise(void);
+
+/**
+ * make the local history window visible.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+nserror ro_gui_local_history_present(wimp_w parent, struct browser_window *bw);
+
+/**
+ * Free any resources allocated for the local history window.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+nserror ro_gui_local_history_finalise(void);
+
+#endif
diff --git a/frontends/riscos/menus.c b/frontends/riscos/menus.c
index d46afa28e..a6e978a6c 100644
--- a/frontends/riscos/menus.c
+++ b/frontends/riscos/menus.c
@@ -232,7 +232,8 @@ void ro_gui_menu_create(wimp_menu *menu, int x, int y, wimp_w w)
current_menu_open = true;
error = xwimp_create_menu(menu, x - 64, y);
if (error) {
- LOG("xwimp_create_menu: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_menu: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MenuError", error->errmess);
ro_gui_menu_closed();
}
@@ -258,14 +259,16 @@ void ro_gui_popup_menu(wimp_menu *menu, wimp_w w, wimp_i i)
icon_state.i = i;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MenuError", error->errmess);
return;
}
error = xwimp_get_icon_state(&icon_state);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MenuError", error->errmess);
return;
}
@@ -291,7 +294,8 @@ void ro_gui_menu_destroy(void)
error = xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
if (error) {
- LOG("xwimp_create_menu: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_menu: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MenuError", error->errmess);
}
@@ -354,7 +358,8 @@ void ro_gui_menu_selection(wimp_selection *selection)
/* re-open the menu for Adjust clicks */
error = xwimp_get_pointer_info(&pointer);
if (error) {
- LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
ro_gui_menu_closed();
return;
@@ -420,7 +425,8 @@ void ro_gui_menu_warning(wimp_message_menu_warning *warning)
error = xwimp_create_sub_menu(menu_entry->sub_menu,
warning->pos.x, warning->pos.y);
if (error) {
- LOG("xwimp_create_sub_menu: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_sub_menu: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MenuError", error->errmess);
}
}
@@ -485,7 +491,8 @@ void ro_gui_menu_refresh(wimp_menu *menu)
os_error *error;
error = xwimp_create_menu(current_menu, 0, 0);
if (error) {
- LOG("xwimp_create_menu: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_menu: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MenuError", error->errmess);
}
}
@@ -851,7 +858,8 @@ int ro_gui_menu_get_checksum(void)
error = xwimp_get_menu_state((wimp_menu_state_flags)0,
&menu_tree, 0, 0);
if (error) {
- LOG("xwimp_get_menu_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_menu_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MenuError", error->errmess);
return 0;
}
@@ -894,7 +902,8 @@ bool ro_gui_menu_translate(struct menu_definition *menu)
/* read current alphabet */
error = xosbyte1(osbyte_ALPHABET_NUMBER, 127, 0, &alphabet);
if (error) {
- LOG("failed reading alphabet: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "failed reading alphabet: 0x%x: %s",
+ error->errnum, error->errmess);
/* assume Latin1 */
alphabet = territory_ALPHABET_LATIN1;
}
@@ -909,7 +918,7 @@ bool ro_gui_menu_translate(struct menu_definition *menu)
0, &translated);
if (err != NSERROR_OK) {
assert(err != NSERROR_BAD_ENCODING);
- LOG("utf8_to_enc failed");
+ NSLOG(netsurf, INFO, "utf8_to_enc failed");
return false;
}
@@ -926,7 +935,7 @@ bool ro_gui_menu_translate(struct menu_definition *menu)
0, &translated);
if (err != NSERROR_OK) {
assert(err != NSERROR_BAD_ENCODING);
- LOG("utf8_to_enc failed");
+ NSLOG(netsurf, INFO, "utf8_to_enc failed");
return false;
}
diff --git a/frontends/riscos/message.c b/frontends/riscos/message.c
index 1c54ea0b7..7a0216185 100644
--- a/frontends/riscos/message.c
+++ b/frontends/riscos/message.c
@@ -64,7 +64,8 @@ bool ro_message_send_message(wimp_event_no event, wimp_message *message,
/* send a message */
error = xwimp_send_message(event, message, task);
if (error) {
- LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -101,7 +102,10 @@ bool ro_message_send_message_to_window(wimp_event_no event, wimp_message *messag
/* send a message */
error = xwimp_send_message_to_window(event, message, to_w, to_i, to_t);
if (error) {
- LOG("xwimp_send_message_to_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_send_message_to_window: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
diff --git a/frontends/riscos/mouse.c b/frontends/riscos/mouse.c
index a0cc0e7ce..89184cff3 100644
--- a/frontends/riscos/mouse.c
+++ b/frontends/riscos/mouse.c
@@ -81,7 +81,8 @@ void ro_mouse_poll(void)
error = xwimp_get_pointer_info(&pointer);
if (error) {
- LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -194,7 +195,7 @@ void ro_mouse_track_start(void (*poll_end)(wimp_leaving *leaving, void *data),
ro_mouse_ignore_leaving_event == false)
ro_mouse_poll_end_callback(NULL, ro_mouse_poll_data);
- LOG("Unexpected mouse track termination.");
+ NSLOG(netsurf, INFO, "Unexpected mouse track termination.");
ro_mouse_ignore_leaving_event = false;
ro_mouse_poll_end_callback = NULL;
diff --git a/frontends/riscos/plotters.c b/frontends/riscos/plotters.c
index 06e732d99..2b306827d 100644
--- a/frontends/riscos/plotters.c
+++ b/frontends/riscos/plotters.c
@@ -16,8 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Target independent plotting (RISC OS screen implementation).
+/**
+ * \file
+ * RISC OS screen plotter implementation.
*/
#include <stdbool.h>
@@ -35,38 +36,6 @@
#include "riscos/font.h"
#include "riscos/oslib_pre7.h"
-static bool ro_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
-static bool ro_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style);
-static bool ro_plot_draw_path(const draw_path * const path, int width,
- colour c, bool dotted, bool dashed);
-static bool ro_plot_polygon(const int *p, unsigned int n, const plot_style_t *style);
-static bool ro_plot_path(const float *p, unsigned int n, colour fill, float width,
- colour c, const float transform[6]);
-static bool ro_plot_clip(const struct rect *clip);
-static bool ro_plot_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle);
-static bool ro_plot_disc(int x, int y, int radius, const plot_style_t *style);
-static bool ro_plot_arc(int x, int y, int radius, int angle1, int angle2,
- const plot_style_t *style);
-static bool ro_plot_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags);
-
-
-struct plotter_table plot;
-
-const struct plotter_table ro_plotters = {
- .rectangle = ro_plot_rectangle,
- .line = ro_plot_line,
- .polygon = ro_plot_polygon,
- .clip = ro_plot_clip,
- .text = ro_plot_text,
- .disc = ro_plot_disc,
- .arc = ro_plot_arc,
- .bitmap = ro_plot_bitmap,
- .path = ro_plot_path,
- .option_knockout = true,
-};
int ro_plot_origin_x = 0;
int ro_plot_origin_y = 0;
@@ -74,143 +43,404 @@ int ro_plot_origin_y = 0;
/** One version of the A9home OS is incapable of drawing patterned lines */
bool ro_plot_patterned_lines = true;
+/**
+ * plot a path on RISC OS
+ */
+static nserror
+ro_plot_draw_path(const draw_path * const path,
+ int width,
+ colour c,
+ bool dotted,
+ bool dashed)
+{
+ static const draw_line_style line_style = {
+ draw_JOIN_MITRED,
+ draw_CAP_BUTT,
+ draw_CAP_BUTT,
+ 0, 0x7fffffff,
+ 0, 0, 0, 0
+ };
+ draw_dash_pattern dash = { 0, 1, { 512 } };
+ const draw_dash_pattern *dash_pattern = 0;
+ os_error *error;
+
+ if (width < 1)
+ width = 1;
+
+ if (ro_plot_patterned_lines) {
+ if (dotted) {
+ dash.elements[0] = 512 * width;
+ dash_pattern = &dash;
+ } else if (dashed) {
+ dash.elements[0] = 1536 * width;
+ dash_pattern = &dash;
+ }
+ }
+
+ error = xcolourtrans_set_gcol(c << 8, 0, os_ACTION_OVERWRITE, 0, 0);
+ if (error) {
+ NSLOG(netsurf, INFO, "xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum, error->errmess);
+ return NSERROR_INVALID;
+ }
+
+ error = xdraw_stroke(path, 0, 0, 0, width * 2 * 256,
+ &line_style, dash_pattern);
+ if (error) {
+ NSLOG(netsurf, INFO, "xdraw_stroke: 0x%x: %s", error->errnum,
+ error->errmess);
+ return NSERROR_INVALID;
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * \brief Sets a clip rectangle for subsequent plot operations.
+ *
+ * \param ctx The current redraw context.
+ * \param clip The rectangle to limit all subsequent plot
+ * operations within.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_plot_clip(const struct redraw_context *ctx, const struct rect *clip)
+{
+ os_error *error;
+ char buf[12];
+
+ int clip_x0 = ro_plot_origin_x + clip->x0 * 2;
+ int clip_y0 = ro_plot_origin_y - clip->y0 * 2 - 1;
+ int clip_x1 = ro_plot_origin_x + clip->x1 * 2 - 1;
+ int clip_y1 = ro_plot_origin_y - clip->y1 * 2;
+
+ if (clip_x1 < clip_x0 || clip_y0 < clip_y1) {
+ NSLOG(netsurf, INFO, "bad clip rectangle %i %i %i %i",
+ clip_x0, clip_y0, clip_x1, clip_y1);
+ return NSERROR_BAD_SIZE;
+ }
+
+ buf[0] = os_VDU_SET_GRAPHICS_WINDOW;
+ buf[1] = clip_x0;
+ buf[2] = clip_x0 >> 8;
+ buf[3] = clip_y1;
+ buf[4] = clip_y1 >> 8;
+ buf[5] = clip_x1;
+ buf[6] = clip_x1 >> 8;
+ buf[7] = clip_y0;
+ buf[8] = clip_y0 >> 8;
+
+ error = xos_writen(buf, 9);
+ if (error) {
+ NSLOG(netsurf, INFO, "xos_writen: 0x%x: %s", error->errnum,
+ error->errmess);
+ return NSERROR_INVALID;
+ }
+ return NSERROR_OK;
+}
-bool ro_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
+
+/**
+ * Plots an arc
+ *
+ * plot an arc segment around (x,y), anticlockwise from angle1
+ * to angle2. Angles are measured anticlockwise from
+ * horizontal, in degrees.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the arc plot.
+ * \param x The x coordinate of the arc.
+ * \param y The y coordinate of the arc.
+ * \param radius The radius of the arc.
+ * \param angle1 The start angle of the arc.
+ * \param angle2 The finish angle of the arc.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_plot_arc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius, int angle1, int angle2)
{
+ os_error *error;
+ int sx, sy, ex, ey;
+ double t;
+
+ x = ro_plot_origin_x + x * 2;
+ y = ro_plot_origin_y - y * 2;
+ radius <<= 1;
+
+ error = xcolourtrans_set_gcol(style->fill_colour << 8, 0,
+ os_ACTION_OVERWRITE, 0, 0);
+
+ if (error) {
+ NSLOG(netsurf, INFO, "xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum, error->errmess);
+ return NSERROR_INVALID;
+ }
+
+ t = ((double)angle1 * M_PI) / 180.0;
+ sx = (x + (int)(radius * cos(t)));
+ sy = (y + (int)(radius * sin(t)));
+
+ t = ((double)angle2 * M_PI) / 180.0;
+ ex = (x + (int)(radius * cos(t)));
+ ey = (y + (int)(radius * sin(t)));
+
+ error = xos_plot(os_MOVE_TO, x, y); /* move to centre */
+ if (error) {
+ NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s", error->errnum,
+ error->errmess);
+ return NSERROR_INVALID;
+ }
+
+ error = xos_plot(os_MOVE_TO, sx, sy); /* move to start */
+ if (error) {
+ NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s", error->errnum,
+ error->errmess);
+ return NSERROR_INVALID;
+ }
+
+ error = xos_plot(os_PLOT_ARC | os_PLOT_TO, ex, ey); /* arc to end */
+ if (error) {
+ NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s", error->errnum,
+ error->errmess);
+ return NSERROR_INVALID;
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plots a circle
+ *
+ * Plot a circle centered on (x,y), which is optionally filled.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the circle plot.
+ * \param x The x coordinate of the circle.
+ * \param y The y coordinate of the circle.
+ * \param radius The radius of the circle.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_plot_disc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius)
+{
+ os_error *error;
if (style->fill_type != PLOT_OP_TYPE_NONE) {
- os_error *error;
- error = xcolourtrans_set_gcol(style->fill_colour << 8,
- colourtrans_USE_ECFS_GCOL,
- os_ACTION_OVERWRITE, 0, 0);
+ error = xcolourtrans_set_gcol(style->fill_colour << 8, 0,
+ os_ACTION_OVERWRITE, 0, 0);
if (error) {
- LOG("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess);
- return false;
+ NSLOG(netsurf, INFO,
+ "xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum,
+ error->errmess);
+ return NSERROR_INVALID;
}
-
error = xos_plot(os_MOVE_TO,
- ro_plot_origin_x + x0 * 2,
- ro_plot_origin_y - y0 * 2 - 1);
+ ro_plot_origin_x + x * 2,
+ ro_plot_origin_y - y * 2);
if (error) {
- LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess);
- return false;
+ NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s",
+ error->errnum, error->errmess);
+ return NSERROR_INVALID;
}
-
- error = xos_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
- ro_plot_origin_x + x1 * 2 - 1,
- ro_plot_origin_y - y1 * 2);
+ error = xos_plot(os_PLOT_CIRCLE | os_PLOT_BY, radius * 2, 0);
if (error) {
- LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess);
- return false;
+ NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s",
+ error->errnum, error->errmess);
+ return NSERROR_INVALID;
}
}
if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- bool dotted = false;
- bool dashed = false;
-
- const int path[] = { draw_MOVE_TO,
- (ro_plot_origin_x + x0 * 2) * 256,
- (ro_plot_origin_y - y0 * 2 - 1) * 256,
- draw_LINE_TO,
- (ro_plot_origin_x + (x1) * 2) * 256,
- (ro_plot_origin_y - y0 * 2 - 1) * 256,
- draw_LINE_TO,
- (ro_plot_origin_x + (x1) * 2) * 256,
- (ro_plot_origin_y - (y1) * 2 - 1) * 256,
- draw_LINE_TO,
- (ro_plot_origin_x + x0 * 2) * 256,
- (ro_plot_origin_y - (y1) * 2 - 1) * 256,
- draw_CLOSE_LINE,
- (ro_plot_origin_x + x0 * 2) * 256,
- (ro_plot_origin_y - y0 * 2 - 1) * 256,
- draw_END_PATH };
-
- if (style->stroke_type == PLOT_OP_TYPE_DOT)
- dotted = true;
- if (style->stroke_type == PLOT_OP_TYPE_DASH)
- dashed = true;
+ error = xcolourtrans_set_gcol(style->stroke_colour << 8, 0,
+ os_ACTION_OVERWRITE, 0, 0);
+ if (error) {
+ NSLOG(netsurf, INFO,
+ "xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum,
+ error->errmess);
+ return NSERROR_INVALID;
+ }
+ error = xos_plot(os_MOVE_TO,
+ ro_plot_origin_x + x * 2,
+ ro_plot_origin_y - y * 2);
+ if (error) {
+ NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s",
+ error->errnum, error->errmess);
+ return NSERROR_INVALID;
+ }
+ error = xos_plot(os_PLOT_CIRCLE_OUTLINE | os_PLOT_BY,
+ radius * 2, 0);
- ro_plot_draw_path((const draw_path *)path,
- style->stroke_width,
- style->stroke_colour,
- dotted, dashed);
+ if (error) {
+ NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s",
+ error->errnum, error->errmess);
+ return NSERROR_INVALID;
+ }
}
-
- return true;
+ return NSERROR_OK;
}
-bool ro_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
+/**
+ * Plots a line
+ *
+ * plot a line from (x0,y0) to (x1,y1). Coordinates are at
+ * centre of line width/thickness.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the line plot.
+ * \param line A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_plot_line(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *line)
{
if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- const int path[] = { draw_MOVE_TO,
- (ro_plot_origin_x + x0 * 2) * 256,
- (ro_plot_origin_y - y0 * 2 - 1) * 256,
- draw_LINE_TO,
- (ro_plot_origin_x + x1 * 2) * 256,
- (ro_plot_origin_y - y1 * 2 - 1) * 256,
- draw_END_PATH };
- bool dotted = false;
+ const int path[] = {
+ draw_MOVE_TO,
+ (ro_plot_origin_x + line->x0 * 2) * 256,
+ (ro_plot_origin_y - line->y0 * 2 - 1) * 256,
+ draw_LINE_TO,
+ (ro_plot_origin_x + line->x1 * 2) * 256,
+ (ro_plot_origin_y - line->y1 * 2 - 1) * 256,
+ draw_END_PATH };
+ bool dotted = false;
bool dashed = false;
- if (style->stroke_type == PLOT_OP_TYPE_DOT)
+ if (style->stroke_type == PLOT_OP_TYPE_DOT)
dotted = true;
- if (style->stroke_type == PLOT_OP_TYPE_DASH)
+ if (style->stroke_type == PLOT_OP_TYPE_DASH)
dashed = true;
- return ro_plot_draw_path((const draw_path *)path,
- style->stroke_width,
- style->stroke_colour,
- dotted, dashed);
+ return ro_plot_draw_path((const draw_path *)path,
+ plot_style_fixed_to_int(style->stroke_width),
+ style->stroke_colour,
+ dotted, dashed);
}
- return true;
+ return NSERROR_OK;
}
-bool ro_plot_draw_path(const draw_path * const path, int width,
- colour c, bool dotted, bool dashed)
+/**
+ * Plots a rectangle.
+ *
+ * The rectangle can be filled an outline or both controlled
+ * by the plot style The line can be solid, dotted or
+ * dashed. Top left corner at (x0,y0) and rectangle has given
+ * width and height.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the rectangle plot.
+ * \param rect A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_plot_rectangle(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *rect)
{
- static const draw_line_style line_style = { draw_JOIN_MITRED,
- draw_CAP_BUTT, draw_CAP_BUTT, 0, 0x7fffffff,
- 0, 0, 0, 0 };
- draw_dash_pattern dash = { 0, 1, { 512 } };
- const draw_dash_pattern *dash_pattern = 0;
- os_error *error;
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+ os_error *error;
+ error = xcolourtrans_set_gcol(style->fill_colour << 8,
+ colourtrans_USE_ECFS_GCOL,
+ os_ACTION_OVERWRITE, 0, 0);
+ if (error) {
+ NSLOG(netsurf, INFO,
+ "xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum,
+ error->errmess);
+ return NSERROR_INVALID;
+ }
- if (width < 1)
- width = 1;
+ error = xos_plot(os_MOVE_TO,
+ ro_plot_origin_x + rect->x0 * 2,
+ ro_plot_origin_y - rect->y0 * 2 - 1);
+ if (error) {
+ NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s",
+ error->errnum, error->errmess);
+ return NSERROR_INVALID;
+ }
- if (ro_plot_patterned_lines) {
- if (dotted) {
- dash.elements[0] = 512 * width;
- dash_pattern = &dash;
- } else if (dashed) {
- dash.elements[0] = 1536 * width;
- dash_pattern = &dash;
+ error = xos_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
+ ro_plot_origin_x + rect->x1 * 2 - 1,
+ ro_plot_origin_y - rect->y1 * 2);
+ if (error) {
+ NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s",
+ error->errnum, error->errmess);
+ return NSERROR_INVALID;
}
}
- error = xcolourtrans_set_gcol(c << 8, 0, os_ACTION_OVERWRITE, 0, 0);
- if (error) {
- LOG("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess);
- return false;
- }
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ bool dotted = false;
+ bool dashed = false;
- error = xdraw_stroke(path, 0, 0, 0, width * 2 * 256,
- &line_style, dash_pattern);
- if (error) {
- LOG("xdraw_stroke: 0x%x: %s", error->errnum, error->errmess);
- return false;
+ const int path[] = {
+ draw_MOVE_TO,
+ (ro_plot_origin_x + rect->x0 * 2) * 256,
+ (ro_plot_origin_y - rect->y0 * 2 - 1) * 256,
+ draw_LINE_TO,
+ (ro_plot_origin_x + (rect->x1) * 2) * 256,
+ (ro_plot_origin_y - rect->y0 * 2 - 1) * 256,
+ draw_LINE_TO,
+ (ro_plot_origin_x + (rect->x1) * 2) * 256,
+ (ro_plot_origin_y - (rect->y1) * 2 - 1) * 256,
+ draw_LINE_TO,
+ (ro_plot_origin_x + rect->x0 * 2) * 256,
+ (ro_plot_origin_y - (rect->y1) * 2 - 1) * 256,
+ draw_CLOSE_LINE,
+ (ro_plot_origin_x + rect->x0 * 2) * 256,
+ (ro_plot_origin_y - rect->y0 * 2 - 1) * 256,
+ draw_END_PATH
+ };
+
+ if (style->stroke_type == PLOT_OP_TYPE_DOT)
+ dotted = true;
+
+ if (style->stroke_type == PLOT_OP_TYPE_DASH)
+ dashed = true;
+
+ ro_plot_draw_path((const draw_path *)path,
+ plot_style_fixed_to_int(style->stroke_width),
+ style->stroke_colour,
+ dotted,
+ dashed);
}
- return true;
+ return NSERROR_OK;
}
-bool ro_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
+/**
+ * Plot a polygon
+ *
+ * Plots a filled polygon with straight lines between
+ * points. The lines around the edge of the ploygon are not
+ * plotted. The polygon is filled with the non-zero winding
+ * rule.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the polygon plot.
+ * \param p verticies of polygon
+ * \param n number of verticies.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_plot_polygon(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const int *p,
+ unsigned int n)
{
int path[n * 3 + 2];
unsigned int i;
@@ -225,43 +455,68 @@ bool ro_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
path[n * 3] = draw_END_PATH;
path[n * 3 + 1] = 0;
- error = xcolourtrans_set_gcol(style->fill_colour << 8, 0, os_ACTION_OVERWRITE, 0, 0);
+ error = xcolourtrans_set_gcol(style->fill_colour << 8,
+ 0, os_ACTION_OVERWRITE, 0, 0);
if (error) {
- LOG("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess);
- return false;
+ NSLOG(netsurf, INFO, "xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum, error->errmess);
+ return NSERROR_INVALID;
}
error = xdraw_fill((draw_path *) path, 0, 0, 0);
if (error) {
- LOG("xdraw_fill: 0x%x: %s", error->errnum, error->errmess);
- return false;
+ NSLOG(netsurf, INFO, "xdraw_fill: 0x%x: %s", error->errnum,
+ error->errmess);
+ return NSERROR_INVALID;
}
- return true;
+ return NSERROR_OK;
}
-bool ro_plot_path(const float *p, unsigned int n, colour fill, float width,
- colour c, const float transform[6])
+/**
+ * Plots a path.
+ *
+ * Path plot consisting of cubic Bezier curves. Line and fill colour is
+ * controlled by the plot style.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the path plot.
+ * \param p elements of path
+ * \param n nunber of elements on path
+ * \param transform A transform to apply to the path.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_plot_path(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const float *p,
+ unsigned int n,
+ const float transform[6])
{
- static const draw_line_style line_style = { draw_JOIN_MITRED,
- draw_CAP_BUTT, draw_CAP_BUTT, 0, 0x7fffffff,
- 0, 0, 0, 0 };
+ static const draw_line_style line_style = {
+ draw_JOIN_MITRED,
+ draw_CAP_BUTT,
+ draw_CAP_BUTT,
+ 0, 0x7fffffff,
+ 0, 0, 0, 0
+ };
int *path = 0;
unsigned int i;
os_trfm trfm;
os_error *error;
- if (n == 0)
- return true;
+ if (n == 0) {
+ return NSERROR_OK;
+ }
if (p[0] != PLOTTER_PATH_MOVE) {
- LOG("path doesn't start with a move");
+ NSLOG(netsurf, INFO, "path doesn't start with a move");
goto error;
}
path = malloc(sizeof *path * (n + 10));
if (!path) {
- LOG("out of memory");
+ NSLOG(netsurf, INFO, "out of memory");
goto error;
}
@@ -289,7 +544,7 @@ bool ro_plot_path(const float *p, unsigned int n, colour fill, float width,
path[i + 6] = -p[i + 6] * 2 * 256;
i += 7;
} else {
- LOG("bad path command %f", p[i]);
+ NSLOG(netsurf, INFO, "bad path command %f", p[i]);
goto error;
}
}
@@ -303,222 +558,167 @@ bool ro_plot_path(const float *p, unsigned int n, colour fill, float width,
trfm.entries[2][0] = (ro_plot_origin_x + transform[4] * 2) * 256;
trfm.entries[2][1] = (ro_plot_origin_y - transform[5] * 2) * 256;
- if (fill != NS_TRANSPARENT) {
- error = xcolourtrans_set_gcol(fill << 8, 0,
+ if (pstyle->fill_colour != NS_TRANSPARENT) {
+ error = xcolourtrans_set_gcol(pstyle->fill_colour << 8, 0,
os_ACTION_OVERWRITE, 0, 0);
if (error) {
- LOG("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum,
+ error->errmess);
goto error;
}
error = xdraw_fill((draw_path *) path, 0, &trfm, 0);
if (error) {
- LOG("xdraw_stroke: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xdraw_stroke: 0x%x: %s",
+ error->errnum, error->errmess);
goto error;
}
}
- if (c != NS_TRANSPARENT) {
- error = xcolourtrans_set_gcol(c << 8, 0,
+ if (pstyle->stroke_colour != NS_TRANSPARENT) {
+ error = xcolourtrans_set_gcol(pstyle->stroke_colour << 8, 0,
os_ACTION_OVERWRITE, 0, 0);
if (error) {
- LOG("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum,
+ error->errmess);
goto error;
}
error = xdraw_stroke((draw_path *) path, 0, &trfm, 0,
- width * 2 * 256, &line_style, 0);
+ plot_style_fixed_to_int(
+ pstyle->stroke_width) * 2 * 256,
+ &line_style, 0);
if (error) {
- LOG("xdraw_stroke: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xdraw_stroke: 0x%x: %s",
+ error->errnum, error->errmess);
goto error;
}
}
free(path);
- return true;
+ return NSERROR_OK;
error:
free(path);
- return false;
+ return NSERROR_INVALID;
}
-
-
-bool ro_plot_clip(const struct rect *clip)
+/**
+ * Plot a bitmap
+ *
+ * Tiled plot of a bitmap image. (x,y) gives the top left
+ * coordinate of an explicitly placed tile. From this tile the
+ * image can repeat in all four directions -- up, down, left
+ * and right -- to the extents given by the current clip
+ * rectangle.
+ *
+ * The bitmap_flags say whether to tile in the x and y
+ * directions. If not tiling in x or y directions, the single
+ * image is plotted. The width and height give the dimensions
+ * the image is to be scaled to.
+ *
+ * \param ctx The current redraw context.
+ * \param bitmap The bitmap to plot
+ * \param x The x coordinate to plot the bitmap
+ * \param y The y coordiante to plot the bitmap
+ * \param width The width of area to plot the bitmap into
+ * \param height The height of area to plot the bitmap into
+ * \param bg the background colour to alpha blend into
+ * \param flags the flags controlling the type of plot operation
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_plot_bitmap(const struct redraw_context *ctx,
+ struct bitmap *bitmap,
+ int x, int y,
+ int width,
+ int height,
+ colour bg,
+ bitmap_flags_t flags)
{
- os_error *error;
- char buf[12];
-
- int clip_x0 = ro_plot_origin_x + clip->x0 * 2;
- int clip_y0 = ro_plot_origin_y - clip->y0 * 2 - 1;
- int clip_x1 = ro_plot_origin_x + clip->x1 * 2 - 1;
- int clip_y1 = ro_plot_origin_y - clip->y1 * 2;
+ const uint8_t *buffer;
- if (clip_x1 < clip_x0 || clip_y0 < clip_y1) {
- LOG("bad clip rectangle %i %i %i %i", clip_x0, clip_y0, clip_x1, clip_y1);
- return false;
+ buffer = riscos_bitmap_get_buffer(bitmap);
+ if (!buffer) {
+ NSLOG(netsurf, INFO, "bitmap_get_buffer failed");
+ return NSERROR_INVALID;
}
- buf[0] = os_VDU_SET_GRAPHICS_WINDOW;
- buf[1] = clip_x0;
- buf[2] = clip_x0 >> 8;
- buf[3] = clip_y1;
- buf[4] = clip_y1 >> 8;
- buf[5] = clip_x1;
- buf[6] = clip_x1 >> 8;
- buf[7] = clip_y0;
- buf[8] = clip_y0 >> 8;
-
- error = xos_writen(buf, 9);
- if (error) {
- LOG("xos_writen: 0x%x: %s", error->errnum, error->errmess);
- return false;
+ if (!image_redraw(bitmap->sprite_area,
+ ro_plot_origin_x + x * 2,
+ ro_plot_origin_y - y * 2,
+ width, height,
+ bitmap->width,
+ bitmap->height,
+ bg,
+ flags & BITMAPF_REPEAT_X, flags & BITMAPF_REPEAT_Y,
+ flags & BITMAPF_REPEAT_X || flags & BITMAPF_REPEAT_Y,
+ riscos_bitmap_get_opaque(bitmap) ? IMAGE_PLOT_TINCT_OPAQUE :
+ IMAGE_PLOT_TINCT_ALPHA)) {
+ return NSERROR_INVALID;
}
-
- return true;
+ return NSERROR_OK;
}
-bool ro_plot_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle)
+/**
+ * Text plotting.
+ *
+ * \param ctx The current redraw context.
+ * \param fstyle plot style for this text
+ * \param x x coordinate
+ * \param y y coordinate
+ * \param text UTF-8 string to plot
+ * \param length length of string, in bytes
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_plot_text(const struct redraw_context *ctx,
+ const struct plot_font_style *fstyle,
+ int x,
+ int y,
+ const char *text,
+ size_t length)
{
os_error *error;
error = xcolourtrans_set_font_colours(font_CURRENT,
- fstyle->background << 8, fstyle->foreground << 8,
+ fstyle->background << 8, fstyle->foreground << 8,
14, 0, 0, 0);
if (error) {
- LOG("xcolourtrans_set_font_colours: 0x%x: %s", error->errnum, error->errmess);
- return false;
+ NSLOG(netsurf, INFO,
+ "xcolourtrans_set_font_colours: 0x%x: %s",
+ error->errnum,
+ error->errmess);
+ return NSERROR_INVALID;
}
- return nsfont_paint(fstyle, text, length,
+ if (!nsfont_paint(fstyle, text, length,
ro_plot_origin_x + x * 2,
- ro_plot_origin_y - y * 2);
-}
-
-
-bool ro_plot_disc(int x, int y, int radius, const plot_style_t *style)
-{
- os_error *error;
- if (style->fill_type != PLOT_OP_TYPE_NONE) {
- error = xcolourtrans_set_gcol(style->fill_colour << 8, 0,
- os_ACTION_OVERWRITE, 0, 0);
- if (error) {
- LOG("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess);
- return false;
- }
- error = xos_plot(os_MOVE_TO,
- ro_plot_origin_x + x * 2,
- ro_plot_origin_y - y * 2);
- if (error) {
- LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess);
- return false;
- }
- error = xos_plot(os_PLOT_CIRCLE | os_PLOT_BY, radius * 2, 0);
- if (error) {
- LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess);
- return false;
- }
- }
-
- if (style->stroke_type != PLOT_OP_TYPE_NONE) {
-
- error = xcolourtrans_set_gcol(style->stroke_colour << 8, 0,
- os_ACTION_OVERWRITE, 0, 0);
- if (error) {
- LOG("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess);
- return false;
- }
- error = xos_plot(os_MOVE_TO,
- ro_plot_origin_x + x * 2,
- ro_plot_origin_y - y * 2);
- if (error) {
- LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess);
- return false;
- }
- error = xos_plot(os_PLOT_CIRCLE_OUTLINE | os_PLOT_BY,
- radius * 2, 0);
-
- if (error) {
- LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess);
- return false;
- }
- }
- return true;
-}
-
-bool ro_plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style)
-{
- os_error *error;
- int sx, sy, ex, ey;
- double t;
-
- x = ro_plot_origin_x + x * 2;
- y = ro_plot_origin_y - y * 2;
- radius <<= 1;
-
- error = xcolourtrans_set_gcol(style->fill_colour << 8, 0,
- os_ACTION_OVERWRITE, 0, 0);
-
- if (error) {
- LOG("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess);
- return false;
+ ro_plot_origin_y - y * 2)) {
+ return NSERROR_INVALID;
}
-
- t = ((double)angle1 * M_PI) / 180.0;
- sx = (x + (int)(radius * cos(t)));
- sy = (y + (int)(radius * sin(t)));
-
- t = ((double)angle2 * M_PI) / 180.0;
- ex = (x + (int)(radius * cos(t)));
- ey = (y + (int)(radius * sin(t)));
-
- error = xos_plot(os_MOVE_TO, x, y); /* move to centre */
- if (error) {
- LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess);
- return false;
- }
-
- error = xos_plot(os_MOVE_TO, sx, sy); /* move to start */
- if (error) {
- LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess);
- return false;
- }
-
- error = xos_plot(os_PLOT_ARC | os_PLOT_TO, ex, ey); /* arc to end */
- if (error) {
- LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess);
- return false;
- }
-
- return true;
+ return NSERROR_OK;
}
-
-bool ro_plot_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags)
-{
- const uint8_t *buffer;
-
- buffer = riscos_bitmap_get_buffer(bitmap);
- if (!buffer) {
- LOG("bitmap_get_buffer failed");
- return false;
- }
-
- return image_redraw(bitmap->sprite_area,
- ro_plot_origin_x + x * 2,
- ro_plot_origin_y - y * 2,
- width, height,
- bitmap->width,
- bitmap->height,
- bg,
- flags & BITMAPF_REPEAT_X, flags & BITMAPF_REPEAT_Y,
- flags & BITMAPF_REPEAT_X || flags & BITMAPF_REPEAT_Y,
- riscos_bitmap_get_opaque(bitmap) ? IMAGE_PLOT_TINCT_OPAQUE :
- IMAGE_PLOT_TINCT_ALPHA);
-}
+/**
+ * RISC OS plotter operation table
+ */
+const struct plotter_table ro_plotters = {
+ .rectangle = ro_plot_rectangle,
+ .line = ro_plot_line,
+ .polygon = ro_plot_polygon,
+ .clip = ro_plot_clip,
+ .text = ro_plot_text,
+ .disc = ro_plot_disc,
+ .arc = ro_plot_arc,
+ .bitmap = ro_plot_bitmap,
+ .path = ro_plot_path,
+ .option_knockout = true,
+};
diff --git a/frontends/riscos/print.c b/frontends/riscos/print.c
index 465627eea..b390c693d 100644
--- a/frontends/riscos/print.c
+++ b/frontends/riscos/print.c
@@ -41,6 +41,7 @@
#include "content/content.h"
#include "riscos/gui.h"
+#include "riscos/window.h"
#include "riscos/dialog.h"
#include "riscos/menus.h"
#include "riscos/print.h"
@@ -95,7 +96,6 @@ static unsigned int print_fonts_count;
/** Error in print_fonts_plot_text() or print_fonts_callback(). */
static const char *print_fonts_error;
-void gui_window_redraw_window(struct gui_window *g);
static bool ro_gui_print_click(wimp_pointer *pointer);
static bool ro_gui_print_apply(wimp_w w);
@@ -104,39 +104,12 @@ static void print_send_printsave(struct hlcache_handle *h);
static bool print_send_printtypeknown(wimp_message *m);
static bool print_document(struct gui_window *g, const char *filename);
static const char *print_declare_fonts(struct hlcache_handle *h);
-static bool print_fonts_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
-static bool print_fonts_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style);
-static bool print_fonts_plot_polygon(const int *p, unsigned int n, const plot_style_t *style);
-static bool print_fonts_plot_clip(const struct rect *clip);
-static bool print_fonts_plot_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle);
-static bool print_fonts_plot_disc(int x, int y, int radius, const plot_style_t *style);
-static bool print_fonts_plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style);
-static bool print_fonts_plot_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags);
-static bool print_fonts_plot_path(const float *p, unsigned int n, colour fill, float width,
- colour c, const float transform[6]);
static void print_fonts_callback(void *context,
const char *font_name, unsigned int font_size,
const char *s8, unsigned short *s16, unsigned int n,
int x, int y);
-/** Plotter for print_declare_fonts(). All the functions do nothing except for
- * print_fonts_plot_text, which records the fonts used. */
-static const struct plotter_table print_fonts_plotters = {
- .rectangle = print_fonts_plot_rectangle,
- .line = print_fonts_plot_line,
- .polygon = print_fonts_plot_polygon,
- .clip = print_fonts_plot_clip,
- .text = print_fonts_plot_text,
- .disc = print_fonts_plot_disc,
- .arc = print_fonts_plot_arc,
- .bitmap = print_fonts_plot_bitmap,
- .path = print_fonts_plot_path,
- .option_knockout = false,
-};
/**
@@ -196,7 +169,8 @@ void ro_gui_print_prepare(struct gui_window *g)
/* Read Printer Driver name */
error = xpdriver_info(0, 0, 0, 0, &desc, 0, 0, 0);
if (error) {
- LOG("xpdriver_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xpdriver_info: 0x%x: %s",
+ error->errnum, error->errmess);
printers_exists = false;
}
@@ -333,7 +307,8 @@ void print_send_printsave(struct hlcache_handle *h)
e = xwimp_send_message(wimp_USER_MESSAGE_RECORDED,
(wimp_message *)&m, 0);
if (e) {
- LOG("xwimp_send_message: 0x%x: %s", e->errnum, e->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
+ e->errnum, e->errmess);
ro_warn_user("WimpError", e->errmess);
ro_print_cleanup();
}
@@ -357,7 +332,8 @@ bool print_send_printtypeknown(wimp_message *m)
m->action = message_PRINT_TYPE_KNOWN;
e = xwimp_send_message(wimp_USER_MESSAGE, m, m->sender);
if (e) {
- LOG("xwimp_send_message: 0x%x: %s", e->errnum, e->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
+ e->errnum, e->errmess);
ro_warn_user("WimpError", e->errmess);
return false;
}
@@ -463,7 +439,8 @@ bool ro_print_ack(wimp_message *m)
/* read printer driver type */
error = xpdriver_info(&info_type, 0, 0, 0, 0, 0, 0, 0);
if (error) {
- LOG("xpdriver_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xpdriver_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("PrintError", error->errmess);
ro_print_cleanup();
return true;
@@ -488,7 +465,8 @@ bool ro_print_ack(wimp_message *m)
error = xwimp_send_message(wimp_USER_MESSAGE_RECORDED, m, m->sender);
if (error) {
- LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
/* and delete temporary file */
xosfile_delete(m->data.data_xfer.file_name,
@@ -560,7 +538,8 @@ bool print_document(struct gui_window *g, const char *filename)
/* read printer driver features */
error = xpdriver_info(0, 0, 0, &features, 0, 0, 0, 0);
if (error) {
- LOG("xpdriver_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xpdriver_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("PrintError", error->errmess);
return false;
}
@@ -568,7 +547,8 @@ bool print_document(struct gui_window *g, const char *filename)
/* read page size */
error = xpdriver_page_size(0, 0, &left, &bottom, &right, &top);
if (error) {
- LOG("xpdriver_page_size: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xpdriver_page_size: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("PrintError", error->errmess);
return false;
}
@@ -591,7 +571,8 @@ bool print_document(struct gui_window *g, const char *filename)
error = xosfind_openoutw(osfind_NO_PATH | osfind_ERROR_IF_DIR |
osfind_ERROR_IF_ABSENT, filename, 0, &fhandle);
if (error) {
- LOG("xosfind_openoutw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfind_openoutw: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("PrintError", error->errmess);
return false;
}
@@ -599,7 +580,8 @@ bool print_document(struct gui_window *g, const char *filename)
/* select print job */
error = xpdriver_select_jobw(fhandle, "NetSurf", &old_job);
if (error) {
- LOG("xpdriver_select_jobw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xpdriver_select_jobw: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("PrintError", error->errmess);
xosfind_closew(fhandle);
return false;
@@ -659,18 +641,23 @@ bool print_document(struct gui_window *g, const char *filename)
/* give page rectangle */
error = xpdriver_give_rectangle(0, &b, &t, &p, os_COLOUR_WHITE);
if (error) {
- LOG("xpdriver_give_rectangle: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xpdriver_give_rectangle: 0x%x: %s",
+ error->errnum,
+ error->errmess);
error_message = error->errmess;
goto error;
}
- LOG("given rectangle: [(%d, %d), (%d, %d)]", b.x0, b.y0, b.x1, b.y1);
+ NSLOG(netsurf, INFO, "given rectangle: [(%d, %d), (%d, %d)]",
+ b.x0, b.y0, b.x1, b.y1);
/* and redraw the document */
error = xpdriver_draw_page(print_num_copies, &b, 0, 0,
&more, 0);
if (error) {
- LOG("xpdriver_draw_page: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xpdriver_draw_page: 0x%x: %s",
+ error->errnum, error->errmess);
error_message = error->errmess;
goto error;
}
@@ -684,7 +671,9 @@ bool print_document(struct gui_window *g, const char *filename)
.plot = &ro_plotters
};
- LOG("redrawing area: [(%d, %d), (%d, %d)]", b.x0, b.y0, b.x1, b.y1);
+ NSLOG(netsurf, INFO,
+ "redrawing area: [(%d, %d), (%d, %d)]", b.x0,
+ b.y0, b.x1, b.y1);
clip.x0 = (b.x0 - ro_plot_origin_x) / 2;
clip.y0 = (ro_plot_origin_y - b.y1) / 2;
clip.x1 = (b.x1 - ro_plot_origin_x) / 2;
@@ -706,7 +695,10 @@ bool print_document(struct gui_window *g, const char *filename)
error = xpdriver_get_rectangle(&b, &more, 0);
if (error) {
- LOG("xpdriver_get_rectangle: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xpdriver_get_rectangle: 0x%x: %s",
+ error->errnum,
+ error->errmess);
error_message = error->errmess;
goto error;
}
@@ -728,14 +720,16 @@ bool print_document(struct gui_window *g, const char *filename)
error = (os_error *) _swix(PDriver_EndJob, _IN(0), (int) fhandle);
if (error) {
- LOG("xpdriver_end_jobw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xpdriver_end_jobw: 0x%x: %s",
+ error->errnum, error->errmess);
error_message = error->errmess;
goto error;
}
error = xosfind_closew(fhandle);
if (error) {
- LOG("xosfind_closew: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfind_closew: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("PrintError", error->errmess);
return false;
}
@@ -743,7 +737,10 @@ bool print_document(struct gui_window *g, const char *filename)
if (old_job) {
error = xpdriver_select_jobw(old_job, 0, 0);
if (error) {
- LOG("xpdriver_select_jobw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xpdriver_select_jobw: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("PrintError", error->errmess);
/* the printing succeeded anyway */
return true;
@@ -756,7 +753,7 @@ bool print_document(struct gui_window *g, const char *filename)
if (content_get_type(h) == CONTENT_HTML)
content_reformat(h, false, saved_width, saved_height);
- gui_window_redraw_window(g);
+ ro_gui_window_invalidate_area(g, NULL);
return true;
@@ -780,6 +777,145 @@ error:
}
+
+
+static nserror
+print_fonts_plot_clip(const struct redraw_context *ctx, const struct rect *clip)
+{
+ return NSERROR_OK;
+}
+
+static nserror
+print_fonts_plot_arc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius, int angle1, int angle2)
+{
+ return NSERROR_OK;
+}
+
+static nserror
+print_fonts_plot_disc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius)
+{
+ return NSERROR_OK;
+}
+
+static nserror
+print_fonts_plot_line(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *line)
+{
+ return NSERROR_OK;
+}
+
+static nserror
+print_fonts_plot_rectangle(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *rect)
+{
+ return NSERROR_OK;
+}
+
+static nserror
+print_fonts_plot_polygon(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const int *p,
+ unsigned int n)
+{
+ return NSERROR_OK;
+}
+
+static nserror
+print_fonts_plot_path(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const float *p,
+ unsigned int n,
+ const float transform[6])
+{
+ return NSERROR_OK;
+}
+
+static nserror
+print_fonts_plot_bitmap(const struct redraw_context *ctx,
+ struct bitmap *bitmap,
+ int x, int y,
+ int width,
+ int height,
+ colour bg,
+ bitmap_flags_t flags)
+{
+ return NSERROR_OK;
+}
+
+/**
+ * text plotting during RO print font listing.
+ *
+ * \param ctx The current redraw context.
+ * \param fstyle plot style for this text
+ * \param x x coordinate
+ * \param y y coordinate
+ * \param text UTF-8 string to plot
+ * \param length length of string, in bytes
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+print_fonts_plot_text(const struct redraw_context *ctx,
+ const struct plot_font_style *fstyle,
+ int x,
+ int y,
+ const char *text,
+ size_t length)
+{
+ const char *font_family;
+ unsigned int font_size;
+ rufl_style font_style;
+ rufl_code code;
+
+ nsfont_read_style(fstyle, &font_family, &font_size, &font_style);
+
+ code = rufl_paint_callback(font_family, font_style, font_size,
+ text, length, 0, 0, print_fonts_callback, 0);
+ if (code != rufl_OK) {
+ if (code == rufl_FONT_MANAGER_ERROR) {
+ NSLOG(netsurf, INFO,
+ "rufl_paint_callback: rufl_FONT_MANAGER_ERROR: ""0x%x: %s",
+ rufl_fm_error->errnum,
+ rufl_fm_error->errmess);
+ print_fonts_error = rufl_fm_error->errmess;
+ } else {
+ NSLOG(netsurf, INFO, "rufl_paint_callback: 0x%x",
+ code);
+ }
+ return NSERROR_INVALID;
+ }
+ if (print_fonts_error)
+ return NSERROR_INVALID;
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plotter table for print_declare_fonts().
+ *
+ * All the functions do nothing except for print_fonts_plot_text,
+ * which records the fonts used.
+*/
+static const struct plotter_table print_fonts_plotters = {
+ .rectangle = print_fonts_plot_rectangle,
+ .line = print_fonts_plot_line,
+ .polygon = print_fonts_plot_polygon,
+ .clip = print_fonts_plot_clip,
+ .text = print_fonts_plot_text,
+ .disc = print_fonts_plot_disc,
+ .arc = print_fonts_plot_arc,
+ .bitmap = print_fonts_plot_bitmap,
+ .path = print_fonts_plot_path,
+ .option_knockout = false,
+};
+
+
/**
* Declare fonts to the printer driver.
*
@@ -824,18 +960,22 @@ const char *print_declare_fonts(struct hlcache_handle *h)
}
for (i = 0; i != print_fonts_count; ++i) {
- LOG("%u %s", i, print_fonts_list[i]);
+ NSLOG(netsurf, INFO, "%u %s", i, print_fonts_list[i]);
error = xpdriver_declare_font(0, print_fonts_list[i],
pdriver_KERNED);
if (error) {
- LOG("xpdriver_declare_font: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xpdriver_declare_font: 0x%x: %s",
+ error->errnum,
+ error->errmess);
error_message = error->errmess;
goto end;
}
}
error = xpdriver_declare_font(0, 0, 0);
if (error) {
- LOG("xpdriver_declare_font: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xpdriver_declare_font: 0x%x: %s",
+ error->errnum, error->errmess);
error_message = error->errmess;
goto end;
}
@@ -850,84 +990,6 @@ end:
}
-bool print_fonts_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
-{
- return true;
-}
-
-
-bool print_fonts_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
-{
- return true;
-}
-
-bool print_fonts_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
-{
- return true;
-}
-
-
-bool print_fonts_plot_clip(const struct rect *clip)
-{
- return true;
-}
-
-bool print_fonts_plot_disc(int x, int y, int radius, const plot_style_t *style)
-{
- return true;
-}
-
-bool print_fonts_plot_arc(int x, int y, int radius, int angle1, int angle2,
- const plot_style_t *style)
-{
- return true;
-}
-
-bool print_fonts_plot_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg, bitmap_flags_t flags)
-{
- return true;
-}
-
-bool print_fonts_plot_path(const float *p, unsigned int n, colour fill, float width,
- colour c, const float transform[6])
-{
- return true;
-}
-
-
-/**
- * Plotter for text plotting during font listing.
- */
-
-bool print_fonts_plot_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle)
-{
- const char *font_family;
- unsigned int font_size;
- rufl_style font_style;
- rufl_code code;
-
- nsfont_read_style(fstyle, &font_family, &font_size, &font_style);
-
- code = rufl_paint_callback(font_family, font_style, font_size,
- text, length, 0, 0, print_fonts_callback, 0);
- if (code != rufl_OK) {
- if (code == rufl_FONT_MANAGER_ERROR) {
- LOG("rufl_paint_callback: rufl_FONT_MANAGER_ERROR: ""0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
- print_fonts_error = rufl_fm_error->errmess;
- } else {
- LOG("rufl_paint_callback: 0x%x", code);
- }
- return false;
- }
- if (print_fonts_error)
- return false;
-
- return true;
-}
-
-
/**
* Callback for print_fonts_plot_text().
*
diff --git a/frontends/riscos/query.c b/frontends/riscos/query.c
index 1d7cf5120..49aea6321 100644
--- a/frontends/riscos/query.c
+++ b/frontends/riscos/query.c
@@ -175,7 +175,7 @@ query_id query_user_xy(const char *query, const char *detail,
err = utf8_to_local_encoding(yes, 0, &local_text);
if (err != NSERROR_OK) {
assert(err != NSERROR_BAD_ENCODING);
- LOG("utf8_to_local_encoding_failed");
+ NSLOG(netsurf, INFO, "utf8_to_local_encoding_failed");
local_text = NULL;
}
@@ -191,7 +191,8 @@ query_id query_user_xy(const char *query, const char *detail,
error = xwimptextop_string_width(icn->data.indirected_text.text, len, &width);
if (error) {
- LOG("xwimptextop_string_width: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimptextop_string_width: 0x%x:%s",
+ error->errnum, error->errmess);
width = len * 16;
}
if (!query_yes_width) query_yes_width = icn->extent.x1 - icn->extent.x0;
@@ -204,7 +205,7 @@ query_id query_user_xy(const char *query, const char *detail,
err = utf8_to_local_encoding(no, 0, &local_text);
if (err != NSERROR_OK) {
assert(err != NSERROR_BAD_ENCODING);
- LOG("utf8_to_local_encoding_failed");
+ NSLOG(netsurf, INFO, "utf8_to_local_encoding_failed");
local_text = NULL;
}
@@ -222,7 +223,8 @@ query_id query_user_xy(const char *query, const char *detail,
icn->extent.x1 = tx - 16;
error = xwimptextop_string_width(icn->data.indirected_text.text, len, &width);
if (error) {
- LOG("xwimptextop_string_width: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimptextop_string_width: 0x%x:%s",
+ error->errnum, error->errmess);
width = len * 16;
}
width += 28;
@@ -263,7 +265,8 @@ query_id query_user_xy(const char *query, const char *detail,
error = xwimp_set_caret_position(qw->window, (wimp_i)-1, 0, 0, 1 << 25, -1);
if (error) {
- LOG("xwimp_get_caret_position: 0x%x : %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x : %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -307,7 +310,10 @@ void ro_gui_query_window_bring_to_front(query_id id)
error = xwimp_set_caret_position(qw->window, (wimp_i)-1, 0, 0, 1 << 25, -1);
if (error) {
- LOG("xwimp_get_caret_position: 0x%x : %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_caret_position: 0x%x : %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -327,7 +333,8 @@ void ro_gui_query_close(wimp_w w)
ro_gui_dialog_close(w);
error = xwimp_delete_window(qw->window);
if (error) {
- LOG("xwimp_delete_window: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
ro_gui_wimp_event_finalise(w);
diff --git a/frontends/riscos/save.c b/frontends/riscos/save.c
index 37474b85c..76ce6d3e5 100644
--- a/frontends/riscos/save.c
+++ b/frontends/riscos/save.c
@@ -56,6 +56,7 @@
#include "riscos/bitmap.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
+#include "riscos/window.h"
#include "riscos/menus.h"
#include "riscos/message.h"
#include "riscos/mouse.h"
@@ -165,7 +166,8 @@ wimp_w ro_gui_saveas_create(const char *template_name)
error = xosmodule_alloc(area_size, (void **) &area);
if (error) {
- LOG("xosmodule_alloc: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosmodule_alloc: 0x%x: %s",
+ error->errnum, error->errmess);
xwimp_close_template();
die(error->errmess);
} else {
@@ -175,7 +177,10 @@ wimp_w ro_gui_saveas_create(const char *template_name)
error = xosspriteop_clear_sprites(osspriteop_USER_AREA, saveas_area);
if (error) {
- LOG("xosspriteop_clear_sprites: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosspriteop_clear_sprites: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
xosmodule_free(saveas_area);
@@ -191,7 +196,8 @@ wimp_w ro_gui_saveas_create(const char *template_name)
/* create window */
error = xwimp_create_window(window, &w);
if (error) {
- LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
+ error->errnum, error->errmess);
xwimp_close_template();
die(error->errmess);
}
@@ -211,7 +217,8 @@ void ro_gui_saveas_quit(void)
if (saveas_area) {
os_error *error = xosmodule_free(saveas_area);
if (error) {
- LOG("xosmodule_free: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosmodule_free: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MiscError", error->errmess);
}
saveas_area = NULL;
@@ -238,14 +245,14 @@ ro_gui_save_create_thumbnail(struct hlcache_handle *h, const char *name)
bitmap = riscos_bitmap_create(34, 34, BITMAP_NEW | BITMAP_OPAQUE | BITMAP_CLEAR_MEMORY);
if (!bitmap) {
- LOG("Thumbnail initialisation failed.");
+ NSLOG(netsurf, INFO, "Thumbnail initialisation failed.");
return false;
}
riscos_bitmap_render(bitmap, h);
area = riscos_bitmap_convert_8bpp(bitmap);
riscos_bitmap_destroy(bitmap);
if (!area) {
- LOG("Thumbnail conversion failed.");
+ NSLOG(netsurf, INFO, "Thumbnail conversion failed.");
return false;
}
@@ -390,7 +397,10 @@ ro_gui_save_set_state(struct hlcache_handle *h, gui_save_type save_type,
}
if (error) {
- LOG("ro_gui_wimp_get_sprite: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "ro_gui_wimp_get_sprite: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
} else {
/* the sprite area should always be large enough for
@@ -500,7 +510,8 @@ static void ro_gui_save_drag_end(wimp_dragged *drag, void *data)
error = xwimp_get_pointer_info(&pointer);
if (error) {
- LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -626,7 +637,8 @@ static void ro_gui_save_done(void)
error = xwimp_send_message(wimp_USER_MESSAGE, message,
message->sender);
if (error) {
- LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
}
}
@@ -666,7 +678,10 @@ static void ro_gui_save_done(void)
ro_gui_dialog_close(dialog_saveas);
error = xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
if (error) {
- LOG("xwimp_create_menu: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_create_menu: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MenuError", error->errmess);
}
}
@@ -769,8 +784,8 @@ static void ro_gui_save_set_file_type(const char *path, lwc_string *mime_type)
error = xosfile_set_type(path, rotype);
if (error != NULL) {
- LOG("xosfile_set_type: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfile_set_type: 0x%x: %s",
+ error->errnum, error->errmess);
}
}
@@ -797,7 +812,8 @@ static bool ro_gui_save_complete(struct hlcache_handle *h, char *path)
/* Create dir */
error = xosfile_create_dir(path, 0);
if (error) {
- LOG("xosfile_create_dir: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfile_create_dir: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
return false;
}
@@ -806,7 +822,7 @@ static bool ro_gui_save_complete(struct hlcache_handle *h, char *path)
snprintf(buf, sizeof buf, "%s.!Run", path);
fp = fopen(buf, "w");
if (!fp) {
- LOG("fopen(): errno = %i", errno);
+ NSLOG(netsurf, INFO, "fopen(): errno = %i", errno);
ro_warn_user("SaveError", strerror(errno));
return false;
}
@@ -815,7 +831,8 @@ static bool ro_gui_save_complete(struct hlcache_handle *h, char *path)
fclose(fp);
error = xosfile_set_type(buf, 0xfeb);
if (error) {
- LOG("xosfile_set_type: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfile_set_type: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
return false;
}
@@ -824,7 +841,8 @@ static bool ro_gui_save_complete(struct hlcache_handle *h, char *path)
snprintf(buf, sizeof buf, "%s.!RunImage", path);
fp = fopen(buf, "w");
if (!fp) {
- LOG("Creating !RunImage failed: errno = %i", errno);
+ NSLOG(netsurf, INFO, "Creating !RunImage failed: errno = %i",
+ errno);
} else {
fclose(fp);
}
@@ -850,7 +868,10 @@ static bool ro_gui_save_complete(struct hlcache_handle *h, char *path)
error = xosspriteop_save_sprite_file(osspriteop_NAME, saveas_area, buf);
if (error) {
- LOG("xosspriteop_save_sprite_file: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosspriteop_save_sprite_file: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("SaveError", error->errmess);
return false;
}
@@ -896,7 +917,10 @@ static bool ro_gui_save_object_native(struct hlcache_handle *h, char *path)
(byte *) source_data,
(byte *) source_data + source_size);
if (error != NULL) {
- LOG("xosfile_save_stamped: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfile_save_stamped: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("SaveError", error->errmess);
return false;
}
@@ -946,7 +970,8 @@ ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite)
error = xosfile_read_stamped(path, &obj_type,
NULL, NULL, NULL, NULL, NULL);
if (error) {
- LOG("xosfile_read_stamped: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfile_read_stamped: 0x%x:%s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
return false;
}
@@ -1002,7 +1027,10 @@ ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite)
(byte *) source_data,
(byte *) source_data + source_size);
if (error) {
- LOG("xosfile_save_stamped: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfile_save_stamped: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("SaveError", error->errmess);
return false;
}
@@ -1028,14 +1056,20 @@ ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite)
return false;
error = xosfile_set_type(path, 0xfaf);
if (error)
- LOG("xosfile_set_type: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfile_set_type: 0x%x: %s",
+ error->errnum,
+ error->errmess);
break;
case GUI_SAVE_HISTORY_EXPORT_HTML:
if (global_history_export(path, NULL) != NSERROR_OK)
return false;
error = xosfile_set_type(path, 0xfaf);
if (error)
- LOG("xosfile_set_type: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfile_set_type: 0x%x: %s",
+ error->errnum,
+ error->errmess);
break;
case GUI_SAVE_TEXT_SELECTION:
@@ -1055,7 +1089,10 @@ ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite)
return ro_gui_save_clipboard(path);
default:
- LOG("Unexpected content type: %d, path %s", gui_save_current_type, path);
+ NSLOG(netsurf, INFO,
+ "Unexpected content type: %d, path %s",
+ gui_save_current_type,
+ path);
return false;
}
return true;
@@ -1120,7 +1157,8 @@ void gui_drag_save_object(struct gui_window *g,
error = xwimp_get_pointer_info(&pointer);
if (error) {
- LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -1157,7 +1195,8 @@ void gui_drag_save_selection(struct gui_window *g, const char *selection)
error = xwimp_get_pointer_info(&pointer);
if (error) {
- LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -1209,8 +1248,8 @@ void ro_gui_drag_save_link(gui_save_type save_type, const nsurl *url,
error = xwimp_get_pointer_info(&pointer);
if (error) {
- LOG("xwimp_get_pointer_info: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -1251,7 +1290,10 @@ void ro_gui_drag_icon(int x, int y, const char *sprite)
saveas_area, (osspriteop_id)sprite, NULL);
if (error) {
if (error->errnum != error_SPRITE_OP_DOESNT_EXIST) {
- LOG("xosspriteop_select_sprite: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosspriteop_select_sprite: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
}
}
@@ -1271,7 +1313,8 @@ void ro_gui_drag_icon(int x, int y, const char *sprite)
return;
}
- LOG("xdragasprite_start: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xdragasprite_start: 0x%x: %s",
+ error->errnum, error->errmess);
}
drag.type = wimp_DRAG_USER_FIXED;
@@ -1284,7 +1327,8 @@ void ro_gui_drag_icon(int x, int y, const char *sprite)
error = xwimp_drag_box(&drag);
if (error) {
- LOG("xwimp_drag_box: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("DragError", error->errmess);
} else {
dragbox_active = true;
@@ -1322,14 +1366,20 @@ void ro_gui_drag_box_cancel(void)
if (using_dragasprite) {
error = xdragasprite_stop();
if (error) {
- LOG("xdragasprite_stop: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xdragasprite_stop: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
else {
error = xwimp_drag_box(NULL);
if (error) {
- LOG("xwimp_drag_box: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_drag_box: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -1383,7 +1433,8 @@ void ro_gui_save_datasave_ack(wimp_message *message)
default:
if (!gui_save_content) {
- LOG("unexpected DataSaveAck: gui_save_content not set");
+ NSLOG(netsurf, INFO,
+ "unexpected DataSaveAck: gui_save_content not set");
return;
}
break;
diff --git a/frontends/riscos/save_draw.c b/frontends/riscos/save_draw.c
index 7e6c9462e..1e67d2d8d 100644
--- a/frontends/riscos/save_draw.c
+++ b/frontends/riscos/save_draw.c
@@ -18,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Export a content as a DrawFile (implementation).
*/
@@ -39,38 +40,6 @@
#include "riscos/save_draw.h"
#include "riscos/font.h"
-static bool ro_save_draw_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
-static bool ro_save_draw_line(int x0, int y0, int x1, int y1, const plot_style_t *style);
-static bool ro_save_draw_polygon(const int *p, unsigned int n, const plot_style_t *style);
-static bool ro_save_draw_path(const float *p, unsigned int n, colour fill,
- float width, colour c, const float transform[6]);
-static bool ro_save_draw_clip(const struct rect *clip);
-static bool ro_save_draw_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle);
-static bool ro_save_draw_disc(int x, int y, int radius, const plot_style_t *style);
-static bool ro_save_draw_arc(int x, int y, int radius, int angle1, int angle2,
- const plot_style_t *style);
-static bool ro_save_draw_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg, bitmap_flags_t flags);
-static bool ro_save_draw_group_start(const char *name);
-static bool ro_save_draw_group_end(void);
-static bool ro_save_draw_error(pencil_code code);
-
-
-static const struct plotter_table ro_save_draw_plotters = {
- .rectangle = ro_save_draw_rectangle,
- .line = ro_save_draw_line,
- .polygon = ro_save_draw_polygon,
- .clip = ro_save_draw_clip,
- .text = ro_save_draw_text,
- .disc = ro_save_draw_disc,
- .arc = ro_save_draw_arc,
- .bitmap = ro_save_draw_bitmap,
- .group_start = ro_save_draw_group_start,
- .group_end = ro_save_draw_group_end,
- .path = ro_save_draw_path,
- .option_knockout = false,
-};
static struct pencil_diagram *ro_save_draw_diagram;
static int ro_save_draw_width;
@@ -78,157 +47,229 @@ static int ro_save_draw_height;
/**
- * Export a content as a DrawFile.
+ * Report an error from pencil.
*
- * \param h content to export
- * \param path path to save DrawFile as
- * \return true on success, false on error and error reported
+ * \param code error code
+ * \return false
*/
-
-bool save_as_draw(struct hlcache_handle *h, const char *path)
+static nserror ro_save_draw_error(pencil_code code)
{
- pencil_code code;
- char *drawfile_buffer;
- struct rect clip;
- struct content_redraw_data data;
- size_t drawfile_size;
- os_error *error;
- struct redraw_context ctx = {
- .interactive = false,
- .background_images = true,
- .plot = &ro_save_draw_plotters
- };
+ NSLOG(netsurf, INFO, "code %i", code);
- ro_save_draw_diagram = pencil_create();
- if (!ro_save_draw_diagram) {
+ switch (code) {
+ case pencil_OK:
+ assert(0);
+ break;
+
+ case pencil_OUT_OF_MEMORY:
ro_warn_user("NoMemory", 0);
- return false;
+ break;
+
+ case pencil_FONT_MANAGER_ERROR:
+ ro_warn_user("SaveError", rufl_fm_error->errmess);
+ break;
+
+ case pencil_FONT_NOT_FOUND:
+ case pencil_IO_ERROR:
+ case pencil_IO_EOF:
+ ro_warn_user("SaveError", "generating the DrawFile failed");
+ break;
}
- ro_save_draw_width = content_get_width(h);
- ro_save_draw_height = content_get_height(h);
+ return NSERROR_INVALID;
+}
- clip.x0 = clip.y0 = INT_MIN;
- clip.x1 = clip.y1 = INT_MAX;
+/**
+ * \brief Sets a clip rectangle for subsequent plot operations.
+ *
+ * \param ctx The current redraw context.
+ * \param clip The rectangle to limit all subsequent plot
+ * operations within.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_save_draw_clip(const struct redraw_context *ctx, const struct rect *clip)
+{
+ return NSERROR_OK;
+}
- data.x = 0;
- data.y = -ro_save_draw_height;
- data.width = ro_save_draw_width;
- data.height = ro_save_draw_height;
- data.background_colour = 0xFFFFFF;
- data.scale = 1;
- data.repeat_x = false;
- data.repeat_y = false;
- if (!content_redraw(h, &data, &clip, &ctx)) {
- pencil_free(ro_save_draw_diagram);
- return false;
- }
+/**
+ * Plots an arc
+ *
+ * plot an arc segment around (x,y), anticlockwise from angle1
+ * to angle2. Angles are measured anticlockwise from
+ * horizontal, in degrees.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the arc plot.
+ * \param x The x coordinate of the arc.
+ * \param y The y coordinate of the arc.
+ * \param radius The radius of the arc.
+ * \param angle1 The start angle of the arc.
+ * \param angle2 The finish angle of the arc.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_save_draw_arc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius, int angle1, int angle2)
+{
+ return NSERROR_OK;
+}
- /*pencil_dump(ro_save_draw_diagram);*/
- code = pencil_save_drawfile(ro_save_draw_diagram, "NetSurf",
- &drawfile_buffer, &drawfile_size);
- if (code != pencil_OK) {
- ro_warn_user("SaveError", 0);
- pencil_free(ro_save_draw_diagram);
- return false;
- }
- assert(drawfile_buffer);
+/**
+ * Plots a circle
+ *
+ * Plot a circle centered on (x,y), which is optionally filled.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the circle plot.
+ * \param x The x coordinate of the circle.
+ * \param y The y coordinate of the circle.
+ * \param radius The radius of the circle.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_save_draw_disc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius)
+{
+ return NSERROR_OK;
+}
- error = xosfile_save_stamped(path, osfile_TYPE_DRAW,
- (byte *) drawfile_buffer,
- (byte *) drawfile_buffer + drawfile_size);
- if (error) {
- LOG("xosfile_save_stamped failed: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("SaveError", error->errmess);
- pencil_free(ro_save_draw_diagram);
- return false;
- }
- pencil_free(ro_save_draw_diagram);
+/**
+ * Plots a line
+ *
+ * plot a line from (x0,y0) to (x1,y1). Coordinates are at
+ * centre of line width/thickness.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the line plot.
+ * \param line A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_save_draw_line(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *line)
+{
+ pencil_code code;
+ const int path[] = {
+ draw_MOVE_TO, line->x0 * 2, -line->y0 * 2 - 1,
+ draw_LINE_TO, line->x1 * 2, -line->y1 * 2 - 1,
+ draw_END_PATH
+ };
- return true;
+ code = pencil_path(ro_save_draw_diagram,
+ path,
+ sizeof path / sizeof path[0],
+ pencil_TRANSPARENT,
+ style->stroke_colour << 8,
+ plot_style_fixed_to_int(style->stroke_width),
+ pencil_JOIN_MITRED,
+ pencil_CAP_BUTT,
+ pencil_CAP_BUTT,
+ 0, 0, false,
+ pencil_SOLID);
+ if (code != pencil_OK)
+ return ro_save_draw_error(code);
+
+ return NSERROR_OK;
}
-bool ro_save_draw_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
+
+/**
+ * Plots a rectangle.
+ *
+ * The rectangle can be filled an outline or both controlled
+ * by the plot style The line can be solid, dotted or
+ * dashed. Top left corner at (x0,y0) and rectangle has given
+ * width and height.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the rectangle plot.
+ * \param rect A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_save_draw_rectangle(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *rect)
{
pencil_code code;
- const int path[] = { draw_MOVE_TO, x0 * 2, -y0 * 2 - 1,
- draw_LINE_TO, x1 * 2, -y0 * 2 - 1,
- draw_LINE_TO, x1 * 2, -y1 * 2 - 1,
- draw_LINE_TO, x0 * 2, -y1 * 2 - 1,
- draw_CLOSE_LINE,
- draw_END_PATH };
+ const int path[] = {
+ draw_MOVE_TO, rect->x0 * 2, -rect->y0 * 2 - 1,
+ draw_LINE_TO, rect->x1 * 2, -rect->y0 * 2 - 1,
+ draw_LINE_TO, rect->x1 * 2, -rect->y1 * 2 - 1,
+ draw_LINE_TO, rect->x0 * 2, -rect->y1 * 2 - 1,
+ draw_CLOSE_LINE,
+ draw_END_PATH
+ };
- if (style->fill_type != PLOT_OP_TYPE_NONE) {
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
- code = pencil_path(ro_save_draw_diagram,
+ code = pencil_path(ro_save_draw_diagram,
path,
sizeof path / sizeof path[0],
- style->fill_colour << 8,
- pencil_TRANSPARENT,
- 0,
+ style->fill_colour << 8,
+ pencil_TRANSPARENT,
+ 0,
pencil_JOIN_MITRED,
- pencil_CAP_BUTT,
- pencil_CAP_BUTT,
- 0,
- 0,
+ pencil_CAP_BUTT,
+ pencil_CAP_BUTT,
+ 0,
+ 0,
false,
pencil_SOLID);
if (code != pencil_OK)
return ro_save_draw_error(code);
}
- if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- code = pencil_path(ro_save_draw_diagram,
+ code = pencil_path(ro_save_draw_diagram,
path,
sizeof path / sizeof path[0],
- pencil_TRANSPARENT,
- style->stroke_colour << 8,
- style->stroke_width,
+ pencil_TRANSPARENT,
+ style->stroke_colour << 8,
+ plot_style_fixed_to_int(style->stroke_width),
pencil_JOIN_MITRED,
- pencil_CAP_BUTT,
- pencil_CAP_BUTT,
- 0,
- 0,
+ pencil_CAP_BUTT,
+ pencil_CAP_BUTT,
+ 0,
+ 0,
false,
pencil_SOLID);
if (code != pencil_OK)
return ro_save_draw_error(code);
}
- return true;
-}
-
-
-bool ro_save_draw_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
-{
- pencil_code code;
- const int path[] = { draw_MOVE_TO, x0 * 2, -y0 * 2 - 1,
- draw_LINE_TO, x1 * 2, -y1 * 2 - 1,
- draw_END_PATH };
-
- code = pencil_path(ro_save_draw_diagram,
- path,
- sizeof path / sizeof path[0],
- pencil_TRANSPARENT,
- style->stroke_colour << 8,
- style->stroke_width,
- pencil_JOIN_MITRED,
- pencil_CAP_BUTT,
- pencil_CAP_BUTT,
- 0, 0, false,
- pencil_SOLID);
- if (code != pencil_OK)
- return ro_save_draw_error(code);
-
- return true;
+ return NSERROR_OK;
}
-bool ro_save_draw_polygon(const int *p, unsigned int n, const plot_style_t *style)
+/**
+ * Plot a polygon
+ *
+ * Plots a filled polygon with straight lines between
+ * points. The lines around the edge of the ploygon are not
+ * plotted. The polygon is filled with the non-zero winding
+ * rule.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the polygon plot.
+ * \param p verticies of polygon
+ * \param n number of verticies.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_save_draw_polygon(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const int *p,
+ unsigned int n)
{
pencil_code code;
int path[n * 3 + 1];
@@ -242,44 +283,64 @@ bool ro_save_draw_polygon(const int *p, unsigned int n, const plot_style_t *styl
path[0] = draw_MOVE_TO;
path[n * 3] = draw_END_PATH;
- code = pencil_path(ro_save_draw_diagram,
+ code = pencil_path(ro_save_draw_diagram,
path, n * 3 + 1,
- style->fill_colour << 8,
- pencil_TRANSPARENT,
- 0,
+ style->fill_colour << 8,
+ pencil_TRANSPARENT,
+ 0,
pencil_JOIN_MITRED,
- pencil_CAP_BUTT,
- pencil_CAP_BUTT,
- 0,
- 0,
+ pencil_CAP_BUTT,
+ pencil_CAP_BUTT,
+ 0,
+ 0,
false,
pencil_SOLID);
if (code != pencil_OK)
return ro_save_draw_error(code);
- return true;
+ return NSERROR_OK;
}
-bool ro_save_draw_path(const float *p, unsigned int n, colour fill,
- float width, colour c, const float transform[6])
+/**
+ * Plots a path.
+ *
+ * Path plot consisting of cubic Bezier curves. Line and fill colour is
+ * controlled by the plot style.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the path plot.
+ * \param p elements of path
+ * \param n nunber of elements on path
+ * \param transform A transform to apply to the path.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_save_draw_path(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const float *p,
+ unsigned int n,
+ const float transform[6])
{
+ pencil_code code;
+ int *path;
+ unsigned int i;
+ bool empty_path = true;
+
if (n == 0)
- return true;
+ return NSERROR_OK;
if (p[0] != PLOTTER_PATH_MOVE) {
- LOG("path doesn't start with a move");
- return false;
+ NSLOG(netsurf, INFO, "path doesn't start with a move");
+ return NSERROR_INVALID;
}
- int *path = malloc(sizeof *path * (n + 10));
+ path = malloc(sizeof *path * (n + 10));
if (!path) {
- LOG("out of memory");
- return false;
+ NSLOG(netsurf, INFO, "out of memory");
+ return NSERROR_INVALID;
}
- unsigned int i;
- bool empty_path = true;
for (i = 0; i < n; ) {
if (p[i] == PLOTTER_PATH_MOVE) {
path[i] = draw_MOVE_TO;
@@ -326,42 +387,114 @@ bool ro_save_draw_path(const float *p, unsigned int n, colour fill,
i += 7;
empty_path = false;
} else {
- LOG("bad path command %f", p[i]);
+ NSLOG(netsurf, INFO, "bad path command %f", p[i]);
free(path);
- return false;
+ return NSERROR_INVALID;
}
}
path[i] = draw_END_PATH;
if (empty_path) {
free(path);
- return true;
+ return NSERROR_OK;
}
- pencil_code code = pencil_path(ro_save_draw_diagram, path, i + 1,
- fill == NS_TRANSPARENT ? pencil_TRANSPARENT : fill << 8,
- c == NS_TRANSPARENT ? pencil_TRANSPARENT : c << 8,
- width, pencil_JOIN_MITRED,
- pencil_CAP_BUTT, pencil_CAP_BUTT, 0, 0, false,
- pencil_SOLID);
+ code = pencil_path(ro_save_draw_diagram,
+ path, i + 1,
+ pstyle->fill_colour == NS_TRANSPARENT ?
+ pencil_TRANSPARENT :
+ pstyle->fill_colour << 8,
+ pstyle->stroke_colour == NS_TRANSPARENT ?
+ pencil_TRANSPARENT :
+ pstyle->stroke_colour << 8,
+ plot_style_fixed_to_int(pstyle->stroke_width),
+ pencil_JOIN_MITRED,
+ pencil_CAP_BUTT,
+ pencil_CAP_BUTT,
+ 0,
+ 0,
+ false,
+ pencil_SOLID);
free(path);
if (code != pencil_OK)
return ro_save_draw_error(code);
- return true;
+ return NSERROR_OK;
}
+/**
+ * Plot a bitmap
+ *
+ * Tiled plot of a bitmap image. (x,y) gives the top left
+ * coordinate of an explicitly placed tile. From this tile the
+ * image can repeat in all four directions -- up, down, left
+ * and right -- to the extents given by the current clip
+ * rectangle.
+ *
+ * The bitmap_flags say whether to tile in the x and y
+ * directions. If not tiling in x or y directions, the single
+ * image is plotted. The width and height give the dimensions
+ * the image is to be scaled to.
+ *
+ * \param ctx The current redraw context.
+ * \param bitmap The bitmap to plot
+ * \param x The x coordinate to plot the bitmap
+ * \param y The y coordiante to plot the bitmap
+ * \param width The width of area to plot the bitmap into
+ * \param height The height of area to plot the bitmap into
+ * \param bg the background colour to alpha blend into
+ * \param flags the flags controlling the type of plot operation
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_save_draw_bitmap(const struct redraw_context *ctx,
+ struct bitmap *bitmap,
+ int x, int y,
+ int width,
+ int height,
+ colour bg,
+ bitmap_flags_t flags)
+{
+ pencil_code code;
+ const uint8_t *buffer;
+
+ buffer = riscos_bitmap_get_buffer(bitmap);
+ if (!buffer) {
+ ro_warn_user("NoMemory", 0);
+ return NSERROR_INVALID;
+ }
+ code = pencil_sprite(ro_save_draw_diagram,
+ x * 2, (-y - height) * 2,
+ width * 2, height * 2,
+ ((char *) bitmap->sprite_area) +
+ bitmap->sprite_area->first);
+ if (code != pencil_OK)
+ return ro_save_draw_error(code);
-bool ro_save_draw_clip(const struct rect *clip)
-{
- return true;
+ return NSERROR_OK;
}
-bool ro_save_draw_text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *fstyle)
+/**
+ * Text plotting.
+ *
+ * \param ctx The current redraw context.
+ * \param fstyle plot style for this text
+ * \param x x coordinate
+ * \param y y coordinate
+ * \param text UTF-8 string to plot
+ * \param length length of string, in bytes
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_save_draw_text(const struct redraw_context *ctx,
+ const struct plot_font_style *fstyle,
+ int x,
+ int y,
+ const char *text,
+ size_t length)
{
pencil_code code;
const char *font_family;
@@ -371,102 +504,135 @@ bool ro_save_draw_text(int x, int y, const char *text, size_t length,
nsfont_read_style(fstyle, &font_family, &font_size, &font_style);
code = pencil_text(ro_save_draw_diagram, x * 2, -y * 2, font_family,
- font_style, font_size, text, length,
+ font_style, font_size, text, length,
fstyle->foreground << 8);
if (code != pencil_OK)
return ro_save_draw_error(code);
- return true;
+ return NSERROR_OK;
}
-bool ro_save_draw_disc(int x, int y, int radius, const plot_style_t *style)
-{
- return true;
-}
-
-bool ro_save_draw_arc(int x, int y, int radius, int angle1, int angle2,
- const plot_style_t *style)
-{
- return true;
-}
-
-bool ro_save_draw_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg, bitmap_flags_t flags)
+/**
+ * Start of a group of objects.
+ *
+ * \param ctx The current redraw context.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_save_draw_group_start(const struct redraw_context *ctx, const char *name)
{
pencil_code code;
- const uint8_t *buffer;
- buffer = riscos_bitmap_get_buffer(bitmap);
- if (!buffer) {
- ro_warn_user("NoMemory", 0);
- return false;
- }
-
- code = pencil_sprite(ro_save_draw_diagram, x * 2, (-y - height) * 2,
- width * 2, height * 2,
- ((char *) bitmap->sprite_area) +
- bitmap->sprite_area->first);
+ code = pencil_group_start(ro_save_draw_diagram, name);
if (code != pencil_OK)
return ro_save_draw_error(code);
- return true;
+ return NSERROR_OK;
}
-bool ro_save_draw_group_start(const char *name)
+/**
+ * End of the most recently started group.
+ *
+ * \param ctx The current redraw context.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+ro_save_draw_group_end(const struct redraw_context *ctx)
{
pencil_code code;
- code = pencil_group_start(ro_save_draw_diagram, name);
+ code = pencil_group_end(ro_save_draw_diagram);
if (code != pencil_OK)
return ro_save_draw_error(code);
- return true;
+ return NSERROR_OK;
}
-bool ro_save_draw_group_end(void)
+static const struct plotter_table ro_save_draw_plotters = {
+ .rectangle = ro_save_draw_rectangle,
+ .line = ro_save_draw_line,
+ .polygon = ro_save_draw_polygon,
+ .clip = ro_save_draw_clip,
+ .text = ro_save_draw_text,
+ .disc = ro_save_draw_disc,
+ .arc = ro_save_draw_arc,
+ .bitmap = ro_save_draw_bitmap,
+ .group_start = ro_save_draw_group_start,
+ .group_end = ro_save_draw_group_end,
+ .path = ro_save_draw_path,
+ .option_knockout = false,
+};
+
+
+/* exported interface documented in save_draw.h */
+bool save_as_draw(struct hlcache_handle *h, const char *path)
{
pencil_code code;
+ char *drawfile_buffer;
+ struct rect clip;
+ struct content_redraw_data data;
+ size_t drawfile_size;
+ os_error *error;
+ struct redraw_context ctx = {
+ .interactive = false,
+ .background_images = true,
+ .plot = &ro_save_draw_plotters
+ };
- code = pencil_group_end(ro_save_draw_diagram);
- if (code != pencil_OK)
- return ro_save_draw_error(code);
+ ro_save_draw_diagram = pencil_create();
+ if (!ro_save_draw_diagram) {
+ ro_warn_user("NoMemory", 0);
+ return false;
+ }
- return true;
-}
+ ro_save_draw_width = content_get_width(h);
+ ro_save_draw_height = content_get_height(h);
+ clip.x0 = clip.y0 = INT_MIN;
+ clip.x1 = clip.y1 = INT_MAX;
-/**
- * Report an error from pencil.
- *
- * \param code error code
- * \return false
- */
+ data.x = 0;
+ data.y = -ro_save_draw_height;
+ data.width = ro_save_draw_width;
+ data.height = ro_save_draw_height;
+ data.background_colour = 0xFFFFFF;
+ data.scale = 1;
+ data.repeat_x = false;
+ data.repeat_y = false;
-bool ro_save_draw_error(pencil_code code)
-{
- LOG("code %i", code);
+ if (!content_redraw(h, &data, &clip, &ctx)) {
+ pencil_free(ro_save_draw_diagram);
+ return false;
+ }
- switch (code) {
- case pencil_OK:
- assert(0);
- break;
- case pencil_OUT_OF_MEMORY:
- ro_warn_user("NoMemory", 0);
- break;
- case pencil_FONT_MANAGER_ERROR:
- ro_warn_user("SaveError", rufl_fm_error->errmess);
- break;
- case pencil_FONT_NOT_FOUND:
- case pencil_IO_ERROR:
- case pencil_IO_EOF:
- ro_warn_user("SaveError", "generating the DrawFile failed");
- break;
+ /*pencil_dump(ro_save_draw_diagram);*/
+
+ code = pencil_save_drawfile(ro_save_draw_diagram, "NetSurf",
+ &drawfile_buffer, &drawfile_size);
+ if (code != pencil_OK) {
+ ro_warn_user("SaveError", 0);
+ pencil_free(ro_save_draw_diagram);
+ return false;
}
+ assert(drawfile_buffer);
- return false;
+ error = xosfile_save_stamped(path, osfile_TYPE_DRAW,
+ (byte *) drawfile_buffer,
+ (byte *) drawfile_buffer + drawfile_size);
+ if (error) {
+ NSLOG(netsurf, INFO, "xosfile_save_stamped failed: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("SaveError", error->errmess);
+ pencil_free(ro_save_draw_diagram);
+ return false;
+ }
+
+ pencil_free(ro_save_draw_diagram);
+
+ return true;
}
#endif
diff --git a/frontends/riscos/save_draw.h b/frontends/riscos/save_draw.h
index 7ae447790..99662e371 100644
--- a/frontends/riscos/save_draw.h
+++ b/frontends/riscos/save_draw.h
@@ -24,6 +24,13 @@
#include <stdbool.h>
struct hlcache_handle;
+/**
+ * Export a content as a DrawFile.
+ *
+ * \param h content to export
+ * \param path path to save DrawFile as
+ * \return true on success, false on error and error reported
+ */
bool save_as_draw(struct hlcache_handle *h, const char *path);
#endif
diff --git a/frontends/riscos/schedule.c b/frontends/riscos/schedule.c
index 54308b7a9..cb44d906d 100644
--- a/frontends/riscos/schedule.c
+++ b/frontends/riscos/schedule.c
@@ -108,7 +108,7 @@ nserror riscos_schedule(int t, void (*callback)(void *p), void *p)
entry = malloc(sizeof *entry);
if (!entry) {
- LOG("malloc failed");
+ NSLOG(netsurf, INFO, "malloc failed");
return NSERROR_NOMEM;
}
diff --git a/frontends/riscos/sslcert.c b/frontends/riscos/sslcert.c
index 85b84456e..4d81268f4 100644
--- a/frontends/riscos/sslcert.c
+++ b/frontends/riscos/sslcert.c
@@ -82,14 +82,14 @@ static void ro_gui_cert_release_window(struct ro_cert_window *certw)
error = xwimp_delete_window(certw->wh);
if (error) {
- LOG("xwimp_delete_window: 0x%x:%s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s",
+ error->errnum, error->errmess);
}
error = xwimp_delete_window(certw->core.wh);
if (error) {
- LOG("xwimp_delete_window: 0x%x:%s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s",
+ error->errnum, error->errmess);
}
free(certw);
@@ -165,16 +165,16 @@ static nserror cert_attach_pane(wimp_w parent, wimp_w pane)
winfo.w = pane;
error = xwimp_get_window_info_header_only(&winfo);
if (error) {
- LOG("xwimp_get_window_info: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_info: 0x%x: %s",
+ error->errnum, error->errmess);
return NSERROR_INIT_FAILED;
}
wstate.w = parent;
error = xwimp_get_window_state(&wstate);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
return NSERROR_INIT_FAILED;
}
@@ -182,8 +182,8 @@ static nserror cert_attach_pane(wimp_w parent, wimp_w pane)
istate.i = ICON_SSL_PANE;
error = xwimp_get_icon_state(&istate);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
return NSERROR_INIT_FAILED;
}
@@ -211,8 +211,8 @@ static nserror cert_attach_pane(wimp_w parent, wimp_w pane)
if (set_extent) {
error = xwimp_set_extent(pane, &(winfo.extent));
if (error) {
- LOG("xwimp_set_extent: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s",
+ error->errnum, error->errmess);
return NSERROR_INIT_FAILED;
}
}
@@ -225,8 +225,8 @@ static nserror cert_attach_pane(wimp_w parent, wimp_w pane)
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT << wimp_CHILD_LS_EDGE_SHIFT |
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT << wimp_CHILD_RS_EDGE_SHIFT);
if (error) {
- LOG("xwimp_open_window_nested: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window_nested: 0x%x: %s",
+ error->errnum, error->errmess);
return NSERROR_INIT_FAILED;
}
@@ -336,8 +336,8 @@ gui_cert_verify(nsurl *url,
/* Create the SSL window */
error = xwimp_create_window(dialog_cert_template, &ncwin->wh);
if (error) {
- LOG("xwimp_create_window: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
+ error->errnum, error->errmess);
free(ncwin);
return NSERROR_INIT_FAILED;
}
@@ -345,8 +345,8 @@ gui_cert_verify(nsurl *url,
/* create ssl viewer pane window */
error = xwimp_create_window(cert_tree_template, &ncwin->core.wh);
if (error) {
- LOG("xwimp_create_window: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
+ error->errnum, error->errmess);
free(ncwin);
return NSERROR_INIT_FAILED;
}
diff --git a/frontends/riscos/textarea.c b/frontends/riscos/textarea.c
index d9872927c..6f41c640b 100644
--- a/frontends/riscos/textarea.c
+++ b/frontends/riscos/textarea.c
@@ -138,7 +138,7 @@ uintptr_t ro_textarea_create(wimp_w parent, wimp_i icon, unsigned int flags,
ret = malloc(sizeof(struct text_area));
if (!ret) {
- LOG("malloc failed");
+ NSLOG(netsurf, INFO, "malloc failed");
return 0;
}
@@ -148,7 +148,7 @@ uintptr_t ro_textarea_create(wimp_w parent, wimp_i icon, unsigned int flags,
ret->flags = flags;
ret->text = malloc(64);
if (!ret->text) {
- LOG("malloc failed");
+ NSLOG(netsurf, INFO, "malloc failed");
free(ret);
return 0;
}
@@ -160,7 +160,7 @@ uintptr_t ro_textarea_create(wimp_w parent, wimp_i icon, unsigned int flags,
// ret->selection_end = (unsigned int)-1;
ret->font_family = strdup(font_family ? font_family : "Corpus");
if (!ret->font_family) {
- LOG("strdup failed");
+ NSLOG(netsurf, INFO, "strdup failed");
free(ret->text);
free(ret);
return 0;
@@ -181,7 +181,8 @@ uintptr_t ro_textarea_create(wimp_w parent, wimp_i icon, unsigned int flags,
text_area_definition.title_fg = wimp_COLOUR_BLACK;
error = xwimp_create_window(&text_area_definition, &ret->window);
if (error) {
- LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
+ error->errnum, error->errmess);
free(ret->font_family);
free(ret->text);
free(ret);
@@ -228,7 +229,8 @@ bool ro_textarea_update(uintptr_t self)
state.w = ta->parent;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
@@ -236,7 +238,8 @@ bool ro_textarea_update(uintptr_t self)
istate.i = ta->icon;
error = xwimp_get_icon_state(&istate);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
@@ -267,7 +270,8 @@ bool ro_textarea_update(uintptr_t self)
error = xwimp_set_extent(ta->window, &extent);
if (error) {
- LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
@@ -282,7 +286,8 @@ bool ro_textarea_update(uintptr_t self)
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
<< wimp_CHILD_RS_EDGE_SHIFT);
if (error) {
- LOG("xwimp_open_window_nested: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window_nested: 0x%x: %s",
+ error->errnum, error->errmess);
return false;
}
@@ -307,7 +312,8 @@ void ro_textarea_destroy(uintptr_t self)
error = xwimp_delete_window(ta->window);
if (error) {
- LOG("xwimp_delete_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x: %s",
+ error->errnum, error->errmess);
}
ro_gui_wimp_event_finalise(ta->window);
@@ -331,14 +337,14 @@ bool ro_textarea_set_text(uintptr_t self, const char *text)
ta = (struct text_area *)self;
if (!ta || ta->magic != MAGIC) {
- LOG("magic doesn't match");
+ NSLOG(netsurf, INFO, "magic doesn't match");
return true;
}
if (len >= ta->text_alloc) {
char *temp = realloc(ta->text, len + 64);
if (!temp) {
- LOG("realloc failed");
+ NSLOG(netsurf, INFO, "realloc failed");
return false;
}
ta->text = temp;
@@ -368,7 +374,7 @@ int ro_textarea_get_text(uintptr_t self, char *buf, unsigned int len)
ta = (struct text_area *)self;
if (!ta || ta->magic != MAGIC) {
- LOG("magic doesn't match");
+ NSLOG(netsurf, INFO, "magic doesn't match");
return -1;
}
@@ -378,7 +384,7 @@ int ro_textarea_get_text(uintptr_t self, char *buf, unsigned int len)
}
if (len < ta->text_len) {
- LOG("buffer too small");
+ NSLOG(netsurf, INFO, "buffer too small");
return -1;
}
@@ -403,7 +409,7 @@ void ro_textarea_insert_text(uintptr_t self, unsigned int index,
ta = (struct text_area *)self;
if (!ta || ta->magic != MAGIC) {
- LOG("magic doesn't match");
+ NSLOG(netsurf, INFO, "magic doesn't match");
return;
}
@@ -420,7 +426,7 @@ void ro_textarea_insert_text(uintptr_t self, unsigned int index,
if (b_len + ta->text_len >= ta->text_alloc) {
char *temp = realloc(ta->text, b_len + ta->text_len + 64);
if (!temp) {
- LOG("realloc failed");
+ NSLOG(netsurf, INFO, "realloc failed");
return;
}
@@ -457,7 +463,7 @@ void ro_textarea_replace_text(uintptr_t self, unsigned int start,
ta = (struct text_area *)self;
if (!ta || ta->magic != MAGIC) {
- LOG("magic doesn't match");
+ NSLOG(netsurf, INFO, "magic doesn't match");
return;
}
@@ -491,7 +497,7 @@ void ro_textarea_replace_text(uintptr_t self, unsigned int start,
char *temp = realloc(ta->text,
b_len + ta->text_len - (b_end - b_start) + 64);
if (!temp) {
- LOG("realloc failed");
+ NSLOG(netsurf, INFO, "realloc failed");
return;
}
@@ -532,7 +538,7 @@ void ro_textarea_set_caret(uintptr_t self, unsigned int caret)
ta = (struct text_area *)self;
if (!ta || ta->magic != MAGIC) {
- LOG("magic doesn't match");
+ NSLOG(netsurf, INFO, "magic doesn't match");
return;
}
@@ -574,9 +580,10 @@ void ro_textarea_set_caret(uintptr_t self, unsigned int caret)
b_off - ta->lines[ta->caret_pos.line].b_start, &x);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG("rufl_width: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
+ NSLOG(netsurf, INFO, "rufl_width: 0x%x: %s",
+ rufl_fm_error->errnum, rufl_fm_error->errmess);
else
- LOG("rufl_width: 0x%x", code);
+ NSLOG(netsurf, INFO, "rufl_width: 0x%x", code);
return;
}
@@ -585,7 +592,8 @@ void ro_textarea_set_caret(uintptr_t self, unsigned int caret)
ta->line_height / 4 + ta->line_spacing,
os_line_height.y, -1);
if (error) {
- LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_caret_position: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
}
@@ -609,7 +617,7 @@ void ro_textarea_set_caret_xy(uintptr_t self, int x, int y)
ta = (struct text_area *)self;
if (!ta || ta->magic != MAGIC) {
- LOG("magic doesn't match");
+ NSLOG(netsurf, INFO, "magic doesn't match");
return;
}
@@ -623,7 +631,8 @@ void ro_textarea_set_caret_xy(uintptr_t self, int x, int y)
state.w = ta->window;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
@@ -644,9 +653,10 @@ void ro_textarea_set_caret_xy(uintptr_t self, int x, int y)
x, &b_off, &x);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG("rufl_x_to_offset: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
+ NSLOG(netsurf, INFO, "rufl_x_to_offset: 0x%x: %s",
+ rufl_fm_error->errnum, rufl_fm_error->errmess);
else
- LOG("rufl_x_to_offset: 0x%x", code);
+ NSLOG(netsurf, INFO, "rufl_x_to_offset: 0x%x", code);
return;
}
@@ -670,7 +680,7 @@ unsigned int ro_textarea_get_caret(uintptr_t self)
ta = (struct text_area *)self;
if (!ta || ta->magic != MAGIC) {
- LOG("magic doesn't match");
+ NSLOG(netsurf, INFO, "magic doesn't match");
return -1;
}
@@ -711,7 +721,7 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line)
ta->lines =
malloc(LINE_CHUNK_SIZE * sizeof(struct line_info));
if (!ta->lines) {
- LOG("malloc failed");
+ NSLOG(netsurf, INFO, "malloc failed");
return;
}
}
@@ -734,9 +744,13 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line)
&b_off, &x);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG("rufl_x_to_offset: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
+ NSLOG(netsurf, INFO,
+ "rufl_x_to_offset: 0x%x: %s",
+ rufl_fm_error->errnum,
+ rufl_fm_error->errmess);
else
- LOG("rufl_x_to_offset: 0x%x", code);
+ NSLOG(netsurf, INFO,
+ "rufl_x_to_offset: 0x%x", code);
return;
}
@@ -745,7 +759,7 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line)
(line_count + LINE_CHUNK_SIZE) *
sizeof(struct line_info));
if (!temp) {
- LOG("realloc failed");
+ NSLOG(netsurf, INFO, "realloc failed");
return;
}
@@ -809,7 +823,8 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line)
error = xwimp_set_extent(ta->window, &extent);
if (error) {
- LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
@@ -826,7 +841,10 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line)
error = xwimp_get_window_state_and_nesting(&state,
&parent, &linkage);
if (error) {
- LOG("xwimp_get_window_state_and_nesting: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_state_and_nesting: 0x%x: %s",
+ error->errnum,
+ error->errmess);
return;
}
@@ -839,7 +857,10 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line)
state.w = ta->window;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_state: 0x%x: %s",
+ error->errnum,
+ error->errmess);
return;
}
@@ -853,7 +874,10 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line)
error = xwimp_open_window_nested(PTR_WIMP_OPEN(&state),
parent, linkage);
if (error) {
- LOG("xwimp_open_window_nested: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_open_window_nested: 0x%x: %s",
+ error->errnum,
+ error->errmess);
return;
}
@@ -1009,7 +1033,10 @@ bool ro_textarea_key_press(wimp_key *key)
(wimp_message*)&keypress, ta->parent,
ta->icon, 0);
if (error) {
- LOG("xwimp_send_message: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_send_message: 0x%x:%s",
+ error->errnum,
+ error->errmess);
}
break;
}
@@ -1060,7 +1087,8 @@ void ro_textarea_redraw_internal(wimp_draw *redraw, bool update)
else
error = xwimp_redraw_window(redraw, &more);
if (error) {
- LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
@@ -1076,13 +1104,17 @@ void ro_textarea_redraw_internal(wimp_draw *redraw, bool update)
colourtrans_SET_BG_GCOL | colourtrans_USE_ECFS_GCOL,
os_ACTION_OVERWRITE, 0, 0);
if (error) {
- LOG("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum,
+ error->errmess);
return;
}
error = xos_clg();
if (error) {
- LOG("xos_clg: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xos_clg: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
@@ -1113,7 +1145,10 @@ void ro_textarea_redraw_internal(wimp_draw *redraw, bool update)
0xD9D9D900 : 0xFFFFFF00,
0x00000000, 14, 0, 0, 0);
if (error) {
- LOG("xcolourtrans_set_font_colours: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xcolourtrans_set_font_colours: 0x%x: %s",
+ error->errnum,
+ error->errmess);
return;
}
@@ -1128,15 +1163,20 @@ void ro_textarea_redraw_internal(wimp_draw *redraw, bool update)
rufl_BLEND_FONT);
if (code != rufl_OK) {
if (code == rufl_FONT_MANAGER_ERROR)
- LOG("rufl_paint: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
+ NSLOG(netsurf, INFO,
+ "rufl_paint: rufl_FONT_MANAGER_ERROR: 0x%x: %s",
+ rufl_fm_error->errnum,
+ rufl_fm_error->errmess);
else
- LOG("rufl_paint: 0x%x", code);
+ NSLOG(netsurf, INFO,
+ "rufl_paint: 0x%x", code);
}
}
error = xwimp_get_rectangle(redraw, &more);
if (error) {
- LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
}
@@ -1153,7 +1193,8 @@ void ro_textarea_open(wimp_open *open)
error = xwimp_open_window(open);
if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
return;
}
}
diff --git a/frontends/riscos/textselection.c b/frontends/riscos/textselection.c
index bce35750f..e5be27791 100644
--- a/frontends/riscos/textselection.c
+++ b/frontends/riscos/textselection.c
@@ -36,6 +36,7 @@
#include "netsurf/browser_window.h"
#include "riscos/gui.h"
+#include "riscos/window.h"
#include "riscos/menus.h"
#include "riscos/message.h"
#include "riscos/mouse.h"
@@ -91,12 +92,13 @@ void gui_start_selection(struct gui_window *g)
wimp_drag drag;
os_error *error;
- LOG("starting text_selection drag");
+ NSLOG(netsurf, INFO, "starting text_selection drag");
state.w = g->window;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -110,7 +112,8 @@ void gui_start_selection(struct gui_window *g)
error = xwimp_send_message(wimp_USER_MESSAGE,
(wimp_message*)&msg, wimp_BROADCAST);
if (error) {
- LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
owns_caret_and_selection = true;
@@ -126,7 +129,8 @@ void gui_start_selection(struct gui_window *g)
wimp_AUTO_SCROLL_ENABLE_HORIZONTAL,
&scroll, 0);
if (error)
- LOG("xwimp_auto_scroll: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_auto_scroll: 0x%x: %s",
+ error->errnum, error->errmess);
ro_mouse_drag_start(ro_gui_selection_drag_end, ro_gui_window_mouse_at,
NULL, g);
@@ -140,7 +144,8 @@ void gui_start_selection(struct gui_window *g)
error = xwimp_drag_box(&drag);
if (error) {
- LOG("xwimp_drag_box: 0x%x : %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x : %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
last_start_window = g;
@@ -165,17 +170,20 @@ static void ro_gui_selection_drag_end(wimp_dragged *drag, void *data)
scroll.w = g->window;
error = xwimp_auto_scroll(0, &scroll, 0);
if (error)
- LOG("xwimp_auto_scroll: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_auto_scroll: 0x%x: %s",
+ error->errnum, error->errmess);
error = xwimp_drag_box((wimp_drag*)-1);
if (error) {
- LOG("xwimp_drag_box: 0x%x : %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x : %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
error = xwimp_get_pointer_info(&pointer);
if (error) {
- LOG("xwimp_get_pointer_info 0x%x : %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info 0x%x : %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -216,7 +224,7 @@ static void gui_set_clipboard(const char *buffer, size_t length,
wimp_full_message_claim_entity msg;
os_error *error;
- LOG("claiming clipboard");
+ NSLOG(netsurf, INFO, "claiming clipboard");
msg.size = sizeof(msg);
msg.your_ref = 0;
@@ -226,13 +234,14 @@ static void gui_set_clipboard(const char *buffer, size_t length,
error = xwimp_send_message(wimp_USER_MESSAGE,
(wimp_message*)&msg, wimp_BROADCAST);
if (error) {
- LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
owns_clipboard = true;
}
- LOG("clipboard now holds %zd bytes", clip_length);
+ NSLOG(netsurf, INFO, "clipboard now holds %zd bytes", clip_length);
}
@@ -440,7 +449,7 @@ void ro_gui_selection_claim_entity(wimp_full_message_claim_entity *claim)
/* ignore our own broadcasts! */
if (claim->sender != task_handle) {
- LOG("%x", claim->flags);
+ NSLOG(netsurf, INFO, "%x", claim->flags);
if (claim->flags & wimp_CLAIM_CARET_OR_SELECTION) {
owns_caret_and_selection = false;
@@ -473,7 +482,7 @@ void ro_gui_selection_data_request(wimp_full_message_data_request *req)
// bits ftype = req->file_types[i];
// if (ftype == ~0U) break; /* list terminator */
//
-// LOG("type %x", ftype);
+// NSLOG(netsurf, INFO, "type %x", ftype);
// i++;
// }
@@ -523,7 +532,8 @@ bool ro_gui_save_clipboard(const char *path)
free(local_cb);
if (error) {
- LOG("xosfile_save_stamped: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfile_save_stamped: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("SaveError", error->errmess);
return false;
}
@@ -605,7 +615,8 @@ void ro_gui_selection_send_dragging(wimp_pointer *pointer)
{
wimp_full_message_dragging dragmsg;
- LOG("sending DRAGGING to %p, %d", pointer->w, pointer->i);
+ NSLOG(netsurf, INFO, "sending DRAGGING to %p, %d", pointer->w,
+ pointer->i);
dragmsg.size = offsetof(wimp_full_message_dragging, file_types) + 8;
dragmsg.your_ref = 0;
diff --git a/frontends/riscos/theme.c b/frontends/riscos/theme.c
index b0b4ab879..341b7f7cd 100644
--- a/frontends/riscos/theme.c
+++ b/frontends/riscos/theme.c
@@ -16,8 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Window themes (implementation).
+/**
+ * \file
+ * Window themes implementation.
*/
#include <alloca.h>
@@ -180,8 +181,10 @@ static void ro_gui_theme_get_available_in_dir(const char *directory)
(osgbpb_info_list *) &info, 1, context,
sizeof(info), 0, &read_count, &context);
if (error) {
- LOG("xosgbpb_dir_entries_info: 0x%x: %s",
- error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosgbpb_dir_entries_info: 0x%x: %s",
+ error->errnum,
+ error->errmess);
if (error->errnum == 0xd6) /* no such dir */
return;
ro_warn_user("MiscError", error->errmess);
@@ -364,7 +367,7 @@ bool ro_gui_theme_add_descriptor(const char *folder, const char *leafname)
/* create a full filename */
filename = malloc(strlen(folder) + strlen(leafname) + 2);
if (!filename) {
- LOG("No memory for malloc");
+ NSLOG(netsurf, INFO, "No memory for malloc");
ro_warn_user("NoMemory", 0);
return false;
}
@@ -374,7 +377,8 @@ bool ro_gui_theme_add_descriptor(const char *folder, const char *leafname)
error = xosfind_openinw(osfind_NO_PATH, filename, 0,
&file_handle);
if (error) {
- LOG("xosfind_openinw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfind_openinw: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("FileError", error->errmess);
free(filename);
return false;
@@ -389,7 +393,8 @@ bool ro_gui_theme_add_descriptor(const char *folder, const char *leafname)
0, &output_left);
xosfind_closew(file_handle);
if (error) {
- LOG("xosbgpb_read_atw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosbgpb_read_atw: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("FileError", error->errmess);
free(filename);
return false;
@@ -403,7 +408,7 @@ bool ro_gui_theme_add_descriptor(const char *folder, const char *leafname)
current = (struct theme_descriptor *)calloc(1,
sizeof(struct theme_descriptor));
if (!current) {
- LOG("calloc failed");
+ NSLOG(netsurf, INFO, "calloc failed");
ro_warn_user("NoMemory", 0);
free(filename);
return false;
@@ -521,7 +526,7 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list)
descriptor->theme = (struct theme *)calloc(1,
sizeof(struct theme));
if (!descriptor->theme) {
- LOG("calloc() failed");
+ NSLOG(netsurf, INFO, "calloc() failed");
ro_warn_user("NoMemory", 0);
continue;
}
@@ -531,7 +536,10 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list)
error = xosfile_read_stamped_no_path(descriptor->filename,
&obj_type, 0, 0, &file_size, 0, 0);
if (error) {
- LOG("xosfile_read_stamped_no_path: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfile_read_stamped_no_path: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("FileError", error->errmess);
continue;
}
@@ -539,7 +547,7 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list)
continue;
raw_data = malloc(file_size);
if (!raw_data) {
- LOG("malloc() failed");
+ NSLOG(netsurf, INFO, "malloc() failed");
ro_warn_user("NoMemory", 0);
continue;
}
@@ -547,7 +555,10 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list)
(byte *)raw_data, 0, 0, 0, 0, 0);
if (error) {
free(raw_data);
- LOG("xosfile_load_stamped_no_path: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfile_load_stamped_no_path: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("FileError", error->errmess);
continue;
}
@@ -556,7 +567,10 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list)
error = xsquash_decompress_return_sizes(-1, &workspace_size, 0);
if (error) {
free(raw_data);
- LOG("xsquash_decompress_return_sizes: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xsquash_decompress_return_sizes: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
continue;
}
@@ -566,7 +580,7 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list)
if ((!decompressed) || (!workspace)) {
free(decompressed);
free(raw_data);
- LOG("malloc() failed");
+ NSLOG(netsurf, INFO, "malloc() failed");
ro_warn_user("NoMemory", 0);
continue;
}
@@ -581,7 +595,8 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list)
free(raw_data);
if (error) {
free(decompressed);
- LOG("xsquash_decompress: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xsquash_decompress: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MiscError", error->errmess);
continue;
}
@@ -599,7 +614,10 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list)
descriptor->theme->sprite_area,
sprite_name, 16, i, 0);
if (error) {
- LOG("xosspriteop_return_name: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosspriteop_return_name: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
continue;
}
@@ -614,7 +632,10 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list)
&dimensions.x, &dimensions.y,
(osbool *) 0, &mode);
if (error) {
- LOG("xosspriteop_read_sprite_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosspriteop_read_sprite_info: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
continue;
}
diff --git a/frontends/riscos/theme_install.c b/frontends/riscos/theme_install.c
index 43ecb4687..fbca9e4fa 100644
--- a/frontends/riscos/theme_install.c
+++ b/frontends/riscos/theme_install.c
@@ -182,7 +182,7 @@ bool ro_gui_theme_install_apply(wimp_w w)
/* convert spaces to hard spaces */
theme_file = strdup(theme_install_descriptor.name);
if (!theme_file) {
- LOG("malloc failed");
+ NSLOG(netsurf, INFO, "malloc failed");
ro_warn_user("NoMemory", 0);
return false;
}
@@ -203,7 +203,8 @@ bool ro_gui_theme_install_apply(wimp_w w)
(byte *) source_data,
(byte *) source_data + source_size);
if (error) {
- LOG("xosfile_save_stamped: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xosfile_save_stamped: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("ThemeInstallErr", 0);
free(theme_file);
return false;
diff --git a/frontends/riscos/toolbar.c b/frontends/riscos/toolbar.c
index 2b5cb3415..758c90cc2 100644
--- a/frontends/riscos/toolbar.c
+++ b/frontends/riscos/toolbar.c
@@ -227,7 +227,7 @@ struct toolbar *ro_toolbar_create(struct theme_descriptor *descriptor,
toolbar = calloc(sizeof(struct toolbar), 1);
if (toolbar == NULL) {
- LOG("No memory for malloc()");
+ NSLOG(netsurf, INFO, "No memory for malloc()");
ro_warn_user("NoMemory", 0);
return NULL;
}
@@ -366,7 +366,8 @@ bool ro_toolbar_rebuild(struct toolbar *toolbar)
old_window = toolbar->toolbar_handle;
error = xwimp_delete_window(toolbar->toolbar_handle);
if (error)
- LOG("xwimp_delete_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x: %s",
+ error->errnum, error->errmess);
toolbar->toolbar_handle = NULL;
}
@@ -375,7 +376,8 @@ bool ro_toolbar_rebuild(struct toolbar *toolbar)
error = xwimp_create_window(&ro_toolbar_window,
&toolbar->toolbar_handle);
if (error) {
- LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -493,7 +495,8 @@ bool ro_toolbar_rebuild(struct toolbar *toolbar)
icon.icon.data.indirected_text.size = 1;
error = xwimp_create_icon(&icon, &toolbar->editor_div1);
if (error) {
- LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
toolbar->editor_div1 = -1;
}
@@ -558,7 +561,10 @@ bool ro_toolbar_attach(struct toolbar *toolbar, wimp_w parent)
wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
<< wimp_CHILD_TS_EDGE_SHIFT);
if (error) {
- LOG("xwimp_open_window_nested: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_open_window_nested: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -568,7 +574,8 @@ bool ro_toolbar_attach(struct toolbar *toolbar, wimp_w parent)
error = xwimp_close_window(toolbar->toolbar_handle);
if (error) {
- LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -601,7 +608,10 @@ bool ro_toolbar_process(struct toolbar *toolbar, int width, bool reformat)
outline.w = toolbar->parent_handle;
error = xwimp_get_window_outline(&outline);
if (error) {
- LOG("xwimp_get_window_outline: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_outline: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -621,7 +631,10 @@ bool ro_toolbar_process(struct toolbar *toolbar, int width, bool reformat)
state.w = toolbar->parent_handle;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_state: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -647,7 +660,10 @@ bool ro_toolbar_process(struct toolbar *toolbar, int width, bool reformat)
error = xwimp_set_extent(toolbar->toolbar_handle,
&extent);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_state: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -935,7 +951,7 @@ void ro_toolbar_destroy(struct toolbar *toolbar)
if (toolbar == NULL)
return;
- LOG("Destroying toolbar 0x%x", (unsigned int)toolbar);
+ NSLOG(netsurf, INFO, "Destroying toolbar 0x%x", (unsigned int)toolbar);
/* Destroy the widgets. */
@@ -994,7 +1010,8 @@ void ro_toolbar_redraw(wimp_draw *redraw)
error = xwimp_redraw_window(redraw, &more);
if (error) {
- LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -1013,7 +1030,8 @@ void ro_toolbar_redraw(wimp_draw *redraw)
error = xwimp_get_rectangle(redraw, &more);
if (error) {
- LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -1046,7 +1064,8 @@ bool ro_toolbar_click(wimp_pointer *pointer)
state.w = toolbar->toolbar_handle;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -1325,7 +1344,8 @@ const char *ro_toolbar_get_help_suffix(wimp_w w, wimp_i i, os_coord *pos,
state.w = toolbar->toolbar_handle;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return NULL;
}
diff --git a/frontends/riscos/ucstables.c b/frontends/riscos/ucstables.c
index 8e538ef95..3e31c992e 100644
--- a/frontends/riscos/ucstables.c
+++ b/frontends/riscos/ucstables.c
@@ -623,7 +623,8 @@ nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
off - prev_off, &temp, NULL);
if (err != NSERROR_OK) {
assert(err != NSERROR_BAD_ENCODING);
- LOG("utf8_from_enc failed");
+ NSLOG(netsurf, INFO,
+ "utf8_from_enc failed");
free(*result);
return NSERROR_NOMEM;
}
@@ -665,7 +666,7 @@ nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
&temp, NULL);
if (err != NSERROR_OK) {
assert(err != NSERROR_BAD_ENCODING);
- LOG("utf8_from_enc failed");
+ NSLOG(netsurf, INFO, "utf8_from_enc failed");
free(*result);
return NSERROR_NOMEM;
}
@@ -680,7 +681,7 @@ nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
/* and copy into more reasonably-sized buffer */
temp = realloc((*result), cur_off + 1);
if (!temp) {
- LOG("realloc failed");
+ NSLOG(netsurf, INFO, "realloc failed");
free(*result);
return NSERROR_NOMEM;
}
diff --git a/frontends/riscos/uri.c b/frontends/riscos/uri.c
index a2f126b31..d79cfe56d 100644
--- a/frontends/riscos/uri.c
+++ b/frontends/riscos/uri.c
@@ -120,7 +120,8 @@ void ro_uri_bounce(wimp_message *msg)
/* Get required buffer size */
e = xuri_request_uri(0, NULL, 0, message->handle, &size);
if (e) {
- LOG("xuri_request_uri: %d: %s", e->errnum, e->errmess);
+ NSLOG(netsurf, INFO, "xuri_request_uri: %d: %s", e->errnum,
+ e->errmess);
return;
}
@@ -131,7 +132,8 @@ void ro_uri_bounce(wimp_message *msg)
/* Get URI */
e = xuri_request_uri(0, uri_buf, size, message->handle, 0);
if (e) {
- LOG("xuri_request_uri: %d: %s", e->errnum, e->errmess);
+ NSLOG(netsurf, INFO, "xuri_request_uri: %d: %s", e->errnum,
+ e->errmess);
free(uri_buf);
return;
}
diff --git a/frontends/riscos/url_complete.c b/frontends/riscos/url_complete.c
index 3ca9be4c0..82c2d2c67 100644
--- a/frontends/riscos/url_complete.c
+++ b/frontends/riscos/url_complete.c
@@ -36,6 +36,7 @@
#include "riscos/global_history.h"
#include "riscos/gui.h"
+#include "riscos/window.h"
#include "riscos/mouse.h"
#include "riscos/toolbar.h"
#include "riscos/url_complete.h"
@@ -170,7 +171,8 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
-(url_complete_matches_selection + 1) * 44,
65536, -url_complete_matches_selection * 44);
if (error) {
- LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -209,7 +211,10 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
state.w = parent;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_state: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -227,7 +232,10 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
error = xwimp_force_redraw(dialog_url_complete,
0, -(i + 1) * 44, 65536, -i * 44);
if (error) {
- LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_force_redraw: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError",
error->errmess);
}
@@ -280,7 +288,8 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
0, -(old_selection + 1) * 44,
65536, -old_selection * 44);
if (error) {
- LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -288,7 +297,8 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
0, -(url_complete_matches_selection + 1) * 44,
65536, -url_complete_matches_selection * 44);
if (error) {
- LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -319,7 +329,8 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
state.w = dialog_url_complete;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return true;
}
@@ -334,7 +345,8 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
error = xwimp_open_window(PTR_WIMP_OPEN(&state));
if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return true;
}
@@ -410,7 +422,8 @@ void ro_gui_url_complete_resize(struct toolbar *toolbar, wimp_open *open)
state.w = dialog_url_complete;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -422,13 +435,14 @@ void ro_gui_url_complete_resize(struct toolbar *toolbar, wimp_open *open)
toolbar_state.w = ro_toolbar_get_window(toolbar);
error = xwimp_get_window_state(&toolbar_state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
if (!ro_toolbar_get_url_field_extent(toolbar, &url_extent)) {
- LOG("Failed to read URL field extent.");
+ NSLOG(netsurf, INFO, "Failed to read URL field extent.");
return;
}
@@ -437,7 +451,8 @@ void ro_gui_url_complete_resize(struct toolbar *toolbar, wimp_open *open)
extent.x1 = 65536;
error = xwimp_set_extent(dialog_url_complete, &extent);
if (error) {
- LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -459,14 +474,16 @@ void ro_gui_url_complete_resize(struct toolbar *toolbar, wimp_open *open)
if (state.visible.x1 - state.visible.x0 < 0) {
error = xwimp_close_window(dialog_url_complete);
if (error) {
- LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
} else {
error = xwimp_open_window_nested_with_flags(&state,
(wimp_w)-1, 0);
if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -506,7 +523,8 @@ bool ro_gui_url_complete_close(void)
error = xwimp_close_window(dialog_url_complete);
if (error) {
- LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -546,7 +564,7 @@ void ro_gui_url_complete_redraw(wimp_draw *redraw)
/* no matches? no redraw */
if (!url_complete_matches) {
- LOG("Attempt to redraw with no matches made");
+ NSLOG(netsurf, INFO, "Attempt to redraw with no matches made");
/* Fill is never used, so make it something obvious */
ro_gui_user_redraw(redraw, false, os_COLOUR_BLACK);
return;
@@ -581,7 +599,10 @@ void ro_gui_url_complete_redraw(wimp_draw *redraw)
error = xwimp_plot_icon(&url_complete_icon);
if (error) {
- LOG("xwimp_plot_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_plot_icon: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -603,7 +624,10 @@ void ro_gui_url_complete_redraw(wimp_draw *redraw)
url_complete_sprite.extent.y0 = -(line + 1) * 44;
error = xwimp_plot_icon(&url_complete_sprite);
if (error) {
- LOG("xwimp_plot_icon: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_plot_icon: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -657,7 +681,8 @@ bool ro_gui_url_complete_click(wimp_pointer *pointer)
state.w = dialog_url_complete;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -684,14 +709,16 @@ bool ro_gui_url_complete_click(wimp_pointer *pointer)
0, -(old_selection + 1) * 44,
65536, -old_selection * 44);
if (error) {
- LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
error = xwimp_force_redraw(dialog_url_complete,
0, -(url_complete_matches_selection + 1) * 44,
65536, -url_complete_matches_selection * 44);
if (error) {
- LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
diff --git a/frontends/riscos/url_protocol.c b/frontends/riscos/url_protocol.c
index 9a7ae062c..184aaeab0 100644
--- a/frontends/riscos/url_protocol.c
+++ b/frontends/riscos/url_protocol.c
@@ -75,17 +75,19 @@ void ro_url_message_received(wimp_message *message)
} else {
if (!url_message->indirect.url.offset) {
- LOG("no URL in message");
+ NSLOG(netsurf, INFO, "no URL in message");
return;
}
if (28 < message->size &&
url_message->indirect.body_file.offset) {
- LOG("POST for URL message not implemented");
+ NSLOG(netsurf, INFO,
+ "POST for URL message not implemented");
return;
}
if (url_message->indirect.url.offset < 28 ||
236 <= url_message->indirect.url.offset) {
- LOG("external pointers in URL message unimplemented");
+ NSLOG(netsurf, INFO,
+ "external pointers in URL message unimplemented");
/* these messages have never been seen in the wild,
* and there is the problem of invalid addresses which
* would cause an abort */
@@ -122,7 +124,8 @@ void ro_url_message_received(wimp_message *message)
error = xwimp_send_message(wimp_USER_MESSAGE_ACKNOWLEDGE, message,
message->sender);
if (error) {
- LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -165,7 +168,8 @@ void ro_url_broadcast(const char *url)
error = xwimp_send_message(wimp_USER_MESSAGE_RECORDED,
(wimp_message *) &message, 0);
if (error) {
- LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -184,7 +188,7 @@ void ro_url_load(const char *url)
colon = strchr(url, ':');
if (!colon) {
- LOG("invalid url '%s'", url);
+ NSLOG(netsurf, INFO, "invalid url '%s'", url);
return;
}
@@ -204,7 +208,8 @@ void ro_url_load(const char *url)
error = xwimp_start_task(command, 0);
if (error) {
- LOG("xwimp_start_task: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_start_task: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
diff --git a/frontends/riscos/wimp.c b/frontends/riscos/wimp.c
index abf099a55..d851ab59e 100644
--- a/frontends/riscos/wimp.c
+++ b/frontends/riscos/wimp.c
@@ -103,7 +103,10 @@ void ro_gui_wimp_cache_furniture_sizes(wimp_w w)
furniture_sizes.border_widths.x1 = 40;
error = xwimpextend_get_furniture_sizes(&furniture_sizes);
if (error) {
- LOG("xwimpextend_get_furniture_sizes: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimpextend_get_furniture_sizes: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -123,13 +126,15 @@ bool ro_gui_wimp_read_eig_factors(os_mode mode, int *xeig, int *yeig)
error = xos_read_mode_variable(mode, os_MODEVAR_XEIG_FACTOR, xeig, 0);
if (error) {
- LOG("xos_read_mode_variable: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xos_read_mode_variable: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MiscError", error->errmess);
return false;
}
error = xos_read_mode_variable(mode, os_MODEVAR_YEIG_FACTOR, yeig, 0);
if (error) {
- LOG("xos_read_mode_variable: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xos_read_mode_variable: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("MiscError", error->errmess);
return false;
}
@@ -196,14 +201,16 @@ void ro_gui_force_redraw_icon(wimp_w w, wimp_i i)
ic.i = i;
error = xwimp_get_icon_state(&ic);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
error = xwimp_force_redraw(w, ic.icon.extent.x0, ic.icon.extent.y0,
ic.icon.extent.x1, ic.icon.extent.y1);
if (error) {
- LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -235,7 +242,8 @@ const char *ro_gui_get_icon_string(wimp_w w, wimp_i i)
ic.i = i;
error = xwimp_get_icon_state(&ic);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return NULL;
}
@@ -277,7 +285,7 @@ void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text, bool is_utf8)
if (err != NSERROR_OK) {
/* A bad encoding should never happen, so assert this */
assert(err != NSERROR_BAD_ENCODING);
- LOG("utf8_to_enc failed");
+ NSLOG(netsurf, INFO, "utf8_to_enc failed");
/* Paranoia */
local_text = NULL;
}
@@ -292,7 +300,8 @@ void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text, bool is_utf8)
ic.i = i;
error = xwimp_get_icon_state(&ic);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
goto exit;
}
@@ -325,7 +334,10 @@ void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text, bool is_utf8)
(button_type == wimp_BUTTON_WRITE_CLICK_DRAG)) {
error = xwimp_get_caret_position(&caret);
if (error) {
- LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_caret_position: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
goto exit;
}
@@ -336,7 +348,10 @@ void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text, bool is_utf8)
error = xwimp_set_caret_position(w, i, caret.pos.x,
caret.pos.y, -1, caret.index);
if (error) {
- LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_set_caret_position: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -433,7 +448,8 @@ void ro_gui_set_icon_selected_state(wimp_w w, wimp_i i, bool state)
error = xwimp_set_icon_state(w, i,
(state ? wimp_ICON_SELECTED : 0), wimp_ICON_SELECTED);
if (error) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -452,7 +468,8 @@ bool ro_gui_get_icon_selected_state(wimp_w w, wimp_i i)
ic.i = i;
error = xwimp_get_icon_state(&ic);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -478,7 +495,8 @@ void ro_gui_set_icon_shaded_state(wimp_w w, wimp_i i, bool state)
error = xwimp_set_icon_state(w, i,
(state ? wimp_ICON_SHADED : 0), wimp_ICON_SHADED);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
if (!state)
@@ -487,7 +505,8 @@ void ro_gui_set_icon_shaded_state(wimp_w w, wimp_i i, bool state)
/* ensure the caret is not in a shaded icon */
error = xwimp_get_caret_position(&caret);
if (error) {
- LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -499,7 +518,8 @@ void ro_gui_set_icon_shaded_state(wimp_w w, wimp_i i, bool state)
/* lose the caret */
error = xwimp_set_caret_position((wimp_w)-1, (wimp_i)-1, -1, -1, -1, -1);
if (error) {
- LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_caret_position: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -540,7 +560,8 @@ void ro_gui_set_icon_deleted_state(wimp_w w, wimp_i i, bool state)
error = xwimp_set_icon_state(w, i,
(state ? wimp_ICON_DELETED : 0), wimp_ICON_DELETED);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
if (!state)
@@ -549,7 +570,8 @@ void ro_gui_set_icon_deleted_state(wimp_w w, wimp_i i, bool state)
/* ensure the caret is not in a shaded icon */
error = xwimp_get_caret_position(&caret);
if (error) {
- LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -561,7 +583,8 @@ void ro_gui_set_icon_deleted_state(wimp_w w, wimp_i i, bool state)
/* lose the caret */
error = xwimp_set_caret_position((wimp_w)-1, (wimp_i)-1, -1, -1, -1, -1);
if (error) {
- LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_caret_position: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -597,7 +620,8 @@ void ro_gui_set_icon_button_type(wimp_w w, wimp_i i, int type)
error = xwimp_set_icon_state(w, i, wimp_ICON_BUTTON_TYPE,
(type << wimp_ICON_BUTTON_TYPE_SHIFT));
if (error) {
- LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -622,7 +646,8 @@ void ro_gui_set_icon_sprite(wimp_w w, wimp_i i, osspriteop_area *area,
ic.i = i;
error = xwimp_get_icon_state(&ic);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -659,7 +684,8 @@ void ro_gui_set_window_title(wimp_w w, const char *text)
window.w = w;
error = xwimp_get_window_info_header_only((wimp_window_info *)&window);
if (error) {
- LOG("xwimp_get_window_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -670,7 +696,7 @@ void ro_gui_set_window_title(wimp_w w, const char *text)
/* A bad encoding should never happen,
* so assert this */
assert(err != NSERROR_BAD_ENCODING);
- LOG("utf8_to_enc failed");
+ NSLOG(netsurf, INFO, "utf8_to_enc failed");
return;
}
@@ -686,7 +712,8 @@ void ro_gui_set_window_title(wimp_w w, const char *text)
*/
error = xwimp_force_redraw_title(w);
if (error) {
- LOG("xwimp_force_redraw_title: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_force_redraw_title: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -713,7 +740,8 @@ bool ro_gui_set_caret_first(wimp_w w)
win_state.w = w;
error = xwimp_get_window_state(&win_state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -724,7 +752,8 @@ bool ro_gui_set_caret_first(wimp_w w)
window.w = w;
error = xwimp_get_window_info_header_only((wimp_window_info *)&window);
if (error) {
- LOG("xwimp_get_window_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_info: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -735,7 +764,10 @@ bool ro_gui_set_caret_first(wimp_w w)
state.i = icon;
error = xwimp_get_icon_state(&state);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -752,7 +784,10 @@ bool ro_gui_set_caret_first(wimp_w w)
error = xwimp_set_caret_position(w, icon, 0, 0, -1,
strlen(state.icon.data.indirected_text.text));
if (error) {
- LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_set_caret_position: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
return true;
@@ -778,7 +813,10 @@ osspriteop_area *ro_gui_load_sprite_file(const char *pathname)
error = xosfile_read_stamped_no_path(pathname,
&obj_type, 0, 0, &len, 0, 0);
if (error) {
- LOG("xosfile_read_stamped_no_path: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosfile_read_stamped_no_path: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
return 0;
}
@@ -801,7 +839,10 @@ osspriteop_area *ro_gui_load_sprite_file(const char *pathname)
error = xosspriteop_load_sprite_file(osspriteop_USER_AREA,
area, pathname);
if (error) {
- LOG("xosspriteop_load_sprite_file: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosspriteop_load_sprite_file: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
free(area);
return 0;
@@ -831,7 +872,10 @@ bool ro_gui_wimp_sprite_exists(const char *sprite)
error = xwimpspriteop_select_sprite(sprite, 0);
if (error) {
if (error->errnum != error_SPRITE_OP_DOESNT_EXIST) {
- LOG("xwimpspriteop_select_sprite: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimpspriteop_select_sprite: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
}
return false;
@@ -904,7 +948,10 @@ bool ro_gui_wimp_get_sprite_dimensions(osspriteop_area *area, char *sprite,
if (height != NULL)
*height = dimensions.y;
} else if (error->errnum != error_SPRITE_OP_DOESNT_EXIST) {
- LOG("xosspriteop_read_sprite_info: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xosspriteop_read_sprite_info: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
return false;
}
@@ -929,7 +976,8 @@ void ro_gui_user_redraw(wimp_draw *redraw, bool user_fill,
error = xwimp_redraw_window(redraw, &more);
if (error) {
- LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -939,14 +987,18 @@ void ro_gui_user_redraw(wimp_draw *redraw, bool user_fill,
colourtrans_SET_BG_GCOL,
os_ACTION_OVERWRITE, 0, 0);
if (error) {
- LOG("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("MiscError", error->errmess);
}
os_clg();
}
error = xwimp_get_rectangle(redraw, &more);
if (error) {
- LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -973,7 +1025,8 @@ void ro_gui_wimp_update_window_furniture(wimp_w w, wimp_window_flags bic_mask,
state.w = w;
error = xwimp_get_window_state_and_nesting(&state, &parent, &linkage);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -986,7 +1039,8 @@ void ro_gui_wimp_update_window_furniture(wimp_w w, wimp_window_flags bic_mask,
state.next = wimp_HIDDEN;
error = xwimp_open_window_nested_with_flags(&state, parent, linkage);
if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -994,7 +1048,8 @@ void ro_gui_wimp_update_window_furniture(wimp_w w, wimp_window_flags bic_mask,
if (!open) {
error = xwimp_close_window(w);
if (error) {
- LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -1016,7 +1071,8 @@ bool ro_gui_wimp_check_window_furniture(wimp_w w, wimp_window_flags mask)
state.w = w;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -1116,7 +1172,8 @@ void ro_gui_scroll(wimp_scroll *scroll)
error = xwimp_open_window((wimp_open *) scroll);
if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
}
}
diff --git a/frontends/riscos/wimp_event.c b/frontends/riscos/wimp_event.c
index 015e87baf..cdca470da 100644
--- a/frontends/riscos/wimp_event.c
+++ b/frontends/riscos/wimp_event.c
@@ -156,7 +156,9 @@ bool ro_gui_wimp_event_memorise(wimp_w w)
ro_gui_get_icon_string(window->w, event->i));
if (!event->previous_value.textual) {
error = true;
- LOG("Unable to store state for icon %i", event->i);
+ NSLOG(netsurf, INFO,
+ "Unable to store state for icon %i",
+ event->i);
}
break;
case EVENT_CHECKBOX:
@@ -267,7 +269,10 @@ bool ro_gui_wimp_event_transfer(wimp_w from, wimp_w to)
struct event_window *window;
int h;
- LOG("Transferring all events from window 0x%x to window 0x%x", (unsigned int)from, (unsigned int)to);
+ NSLOG(netsurf, INFO,
+ "Transferring all events from window 0x%x to window 0x%x",
+ (unsigned int)from,
+ (unsigned int)to);
window = ro_gui_wimp_event_remove_window(from);
if (window == NULL || window->w != from)
@@ -293,7 +298,8 @@ void ro_gui_wimp_event_finalise(wimp_w w)
struct event_window *window;
struct icon_event *event;
- LOG("Removing all events for window 0x%x", (unsigned int)w);
+ NSLOG(netsurf, INFO, "Removing all events for window 0x%x",
+ (unsigned int)w);
window = ro_gui_wimp_event_remove_window(w);
if (!window)
return;
@@ -330,7 +336,8 @@ void ro_gui_wimp_event_deregister(wimp_w w, wimp_i i)
struct event_window *window;
struct icon_event *event, *parent, *child;
- LOG("Removing all events for window 0x%x, icon %d", (unsigned int)w, (int)i);
+ NSLOG(netsurf, INFO, "Removing all events for window 0x%x, icon %d",
+ (unsigned int)w, (int)i);
window = ro_gui_wimp_event_get_window(w);
if (!window)
return;
@@ -344,7 +351,8 @@ void ro_gui_wimp_event_deregister(wimp_w w, wimp_i i)
child = event->next;
if (event->i == i) {
- LOG("Removing event 0x%x", (unsigned int)event);
+ NSLOG(netsurf, INFO, "Removing event 0x%x",
+ (unsigned int)event);
if (parent == NULL)
window->first = child;
@@ -576,7 +584,8 @@ bool ro_gui_wimp_event_menu_selection(wimp_w w, wimp_i i, wimp_menu *menu,
ic.i = event->data.menu_gright.field;
error = xwimp_get_icon_state(&ic);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -586,7 +595,8 @@ bool ro_gui_wimp_event_menu_selection(wimp_w w, wimp_i i, wimp_menu *menu,
return prepared;
error = xwimp_get_caret_position(&caret);
if (error) {
- LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -594,7 +604,10 @@ bool ro_gui_wimp_event_menu_selection(wimp_w w, wimp_i i, wimp_menu *menu,
error = xwimp_set_caret_position(window->w, event->data.menu_gright.field,
-1, -1, -1, strlen(menu_entry->data.indirected_text.text));
if (error) {
- LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_set_caret_position: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -666,7 +679,7 @@ bool ro_gui_wimp_event_mouse_click(wimp_pointer *pointer)
for (search = window->first; search; search = search->next)
if (search->i == event->data.linked_icon) break;
if (!search) {
- LOG("Incorrect reference.");
+ NSLOG(netsurf, INFO, "Incorrect reference.");
return false;
}
stepping = search->data.numeric_field.stepping;
@@ -703,13 +716,19 @@ bool ro_gui_wimp_event_mouse_click(wimp_pointer *pointer)
open.w = pointer->w;
error = xwimp_get_window_state(&open);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_state: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
error = xwimp_get_caret_position(&caret);
if (error) {
- LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_caret_position: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -718,7 +737,10 @@ bool ro_gui_wimp_event_mouse_click(wimp_pointer *pointer)
ro_gui_menu_destroy();
error = xwimp_open_window(PTR_WIMP_OPEN(&open));
if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_open_window: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -728,7 +750,10 @@ bool ro_gui_wimp_event_mouse_click(wimp_pointer *pointer)
caret.pos.x, caret.pos.y,
-1, caret.index);
if (error) {
- LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_set_caret_position: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
@@ -796,7 +821,8 @@ void ro_gui_wimp_event_prepare_gright_menu(wimp_w w, struct icon_event *event)
ic.i = event->data.menu_gright.field;
error = xwimp_get_icon_state(&ic);
if (error) {
- LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
@@ -903,7 +929,8 @@ bool ro_gui_wimp_event_keypress(wimp_key *key)
*/
error = xosbyte1(osbyte_ALPHABET_NUMBER, 127, 0, &t_alphabet);
if (error) {
- LOG("failed reading alphabet: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "failed reading alphabet: 0x%x: %s",
+ error->errnum, error->errmess);
/* prevent any corruption of ucstable */
t_alphabet = alphabet;
}
@@ -917,7 +944,10 @@ bool ro_gui_wimp_event_keypress(wimp_key *key)
error = xserviceinternational_get_ucs_conversion_table(
alphabet, &unclaimed, &ostable);
if (error != NULL) {
- LOG("failed reading UCS conversion table: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "failed reading UCS conversion table: 0x%x: %s",
+ error->errnum,
+ error->errmess);
/* Try using our own table instead */
ucstable = ucstable_from_alphabet(alphabet);
} else if (unclaimed) {
@@ -974,7 +1004,9 @@ bool ro_gui_wimp_event_keypress(wimp_key *key)
/* If this ever happens,
* RISC OS' UTF8 keyboard
* drivers are broken */
- LOG("unexpected UTF8 start"" byte %x (ignoring)", c);
+ NSLOG(netsurf, INFO,
+ "unexpected UTF8 start"" byte %x (ignoring)",
+ c);
return true;
}
/* Anything else is ASCII, so just
@@ -985,7 +1017,9 @@ bool ro_gui_wimp_event_keypress(wimp_key *key)
/* If this ever happens,
* RISC OS' UTF8 keyboard
* drivers are broken */
- LOG("unexpected keycode: ""%x (ignoring)", c);
+ NSLOG(netsurf, INFO,
+ "unexpected keycode: ""%x (ignoring)",
+ c);
return true;
}
@@ -1074,7 +1108,8 @@ bool ro_gui_wimp_event_close_window(wimp_w w)
{
struct event_window *window;
- LOG("Close event received for window 0x%x", (unsigned int)w);
+ NSLOG(netsurf, INFO, "Close event received for window 0x%x",
+ (unsigned int)w);
if (w == ro_gui_wimp_event_submenu)
ro_gui_wimp_event_submenu = 0;
window = ro_gui_wimp_event_find_window(w);
@@ -1615,7 +1650,8 @@ struct event_window *ro_gui_wimp_event_get_window(wimp_w w)
if (window)
return window;
- LOG("Creating structure for window 0x%x", (unsigned int)w);
+ NSLOG(netsurf, INFO, "Creating structure for window 0x%x",
+ (unsigned int)w);
window = calloc(1, sizeof(struct event_window));
if (!window)
return NULL;
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index b1ea58ae1..e41f6096f 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -35,6 +35,7 @@
#include <stdint.h>
#include <time.h>
#include <string.h>
+#include <limits.h>
#include <oslib/colourtrans.h>
#include <oslib/osbyte.h>
#include <oslib/osfile.h>
@@ -63,12 +64,12 @@
#include "netsurf/keypress.h"
#include "desktop/browser_history.h"
#include "desktop/cookie_manager.h"
-#include "desktop/scrollbar.h"
#include "riscos/bitmap.h"
#include "riscos/buffer.h"
#include "riscos/cookies.h"
#include "riscos/dialog.h"
+#include "riscos/local_history.h"
#include "riscos/global_history.h"
#include "riscos/gui.h"
#include "riscos/gui/status_bar.h"
@@ -90,72 +91,6 @@
#include "riscos/ucstables.h"
#include "riscos/filetype.h"
-void gui_window_redraw_window(struct gui_window *g);
-
-static void gui_window_set_extent(struct gui_window *g, int width, int height);
-
-static void ro_gui_window_redraw(wimp_draw *redraw);
-static void ro_gui_window_scroll(wimp_scroll *scroll);
-static void ro_gui_window_pointer_entering(wimp_entering *entering);
-static void ro_gui_window_track_end(wimp_leaving *leaving, void *data);
-static void ro_gui_window_open(wimp_open *open);
-static void ro_gui_window_close(wimp_w w);
-static bool ro_gui_window_click(wimp_pointer *mouse);
-static bool ro_gui_window_keypress(wimp_key *key);
-static bool ro_gui_window_toolbar_keypress(void *data, wimp_key *key);
-static bool ro_gui_window_handle_local_keypress(struct gui_window *g,
- wimp_key *key, bool is_toolbar);
-static bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
- wimp_pointer *pointer);
-static void ro_gui_window_menu_warning(wimp_w w, wimp_i i, wimp_menu *menu,
- wimp_selection *selection, menu_action action);
-static bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
- wimp_selection *selection, menu_action action);
-static void ro_gui_window_menu_close(wimp_w w, wimp_i i, wimp_menu *menu);
-
-static void ro_gui_window_scroll_end(wimp_dragged *drag, void *data);
-
-static void ro_gui_window_scroll_action(struct gui_window *g,
- int scroll_x, int scroll_y);
-
-static void ro_gui_window_toolbar_click(void *data,
- toolbar_action_type action_type, union toolbar_action action);
-
-static bool ro_gui_window_content_export_types(struct hlcache_handle *h,
- bool *export_draw, bool *export_sprite);
-static void ro_gui_window_prepare_pageinfo(struct gui_window *g);
-static void ro_gui_window_prepare_objectinfo(struct hlcache_handle *object,
- nsurl *target_url);
-
-static void ro_gui_window_launch_url(struct gui_window *g, const char *url);
-static void ro_gui_window_action_home(struct gui_window *g);
-static void ro_gui_window_action_new_window(struct gui_window *g);
-static void ro_gui_window_action_local_history(struct gui_window *g);
-static void ro_gui_window_action_save(struct gui_window *g,
- gui_save_type save_type);
-static void ro_gui_window_action_search(struct gui_window *g);
-static void ro_gui_window_action_zoom(struct gui_window *g);
-static void ro_gui_window_action_add_bookmark(struct gui_window *g);
-static void ro_gui_window_action_remove_bookmark(struct gui_window *g);
-static void ro_gui_window_action_print(struct gui_window *g);
-static void ro_gui_window_action_page_info(struct gui_window *g);
-
-static void ro_gui_window_remove_update_boxes(struct gui_window *g);
-static void ro_gui_window_update_toolbar_buttons(struct gui_window *g);
-static void ro_gui_window_update_toolbar(void *data);
-static void ro_gui_window_save_toolbar_buttons(void *data, char *config);
-static void ro_gui_window_update_theme(void *data, bool ok);
-
-static bool ro_gui_window_import_text(struct gui_window *g,
- const char *filename);
-static void ro_gui_window_clone_options(
- struct gui_window *new_gui,
- struct gui_window *old_gui);
-
-static bool ro_gui_window_prepare_form_select_menu(struct gui_window *bw,
- struct form_control *control);
-static void ro_gui_window_process_form_select_menu(struct gui_window *g,
- wimp_selection *selection);
#ifndef wimp_KEY_END
#define wimp_KEY_END wimp_KEY_COPY
@@ -168,6 +103,11 @@ static void ro_gui_window_process_form_select_menu(struct gui_window *g,
#define SCROLL_VISIBLE_PADDING 32
+#define SCROLL_TOP INT_MIN
+#define SCROLL_PAGE_UP (INT_MIN + 1)
+#define SCROLL_PAGE_DOWN (INT_MAX - 1)
+#define SCROLL_BOTTOM INT_MAX
+
/** Remembers which iconised sprite numbers are in use */
static bool iconise_used[64];
static int iconise_next = 0;
@@ -206,7 +146,8 @@ struct ro_gui_pointer_entry {
int yactive;
};
-/** Map from gui_pointer_shape to pointer sprite data. Must be ordered as
+/**
+ * Map from gui_pointer_shape to pointer sprite data. Must be ordered as
* enum gui_pointer_shape. */
struct ro_gui_pointer_entry ro_gui_pointer_table[] = {
{ true, "ptr_default", 0, 0 },
@@ -243,1609 +184,1046 @@ struct update_box {
struct update_box *pending_updates;
#define MARGIN 4
-static const struct toolbar_callbacks ro_gui_window_toolbar_callbacks = {
- ro_gui_window_update_theme,
- ro_gui_window_update_toolbar,
- (void (*)(void *)) ro_gui_window_update_toolbar_buttons,
- ro_gui_window_toolbar_click,
- ro_gui_window_toolbar_keypress,
- ro_gui_window_save_toolbar_buttons
-};
-
-
-/**
- * Initialise the browser window module and its menus.
- */
-
-void ro_gui_window_initialise(void)
-{
- /* Build the browser window menu. */
-
- static const struct ns_menu browser_definition = {
- "NetSurf", {
- { "Page", BROWSER_PAGE, 0 },
- { "Page.PageInfo",BROWSER_PAGE_INFO, &dialog_pageinfo },
- { "Page.Save", BROWSER_SAVE, &dialog_saveas },
- { "Page.SaveComp", BROWSER_SAVE_COMPLETE, &dialog_saveas },
- { "Page.Export", NO_ACTION, 0 },
-#ifdef WITH_DRAW_EXPORT
- { "Page.Export.Draw", BROWSER_EXPORT_DRAW, &dialog_saveas },
-#endif
-#ifdef WITH_PDF_EXPORT
- { "Page.Export.PDF", BROWSER_EXPORT_PDF, &dialog_saveas },
-#endif
- { "Page.Export.Text", BROWSER_EXPORT_TEXT, &dialog_saveas },
- { "Page.SaveURL", NO_ACTION, 0 },
- { "Page.SaveURL.URI", BROWSER_SAVE_URL_URI, &dialog_saveas },
- { "Page.SaveURL.URL", BROWSER_SAVE_URL_URL, &dialog_saveas },
- { "Page.SaveURL.LinkText", BROWSER_SAVE_URL_TEXT, &dialog_saveas },
- { "_Page.Print", BROWSER_PRINT, &dialog_print },
- { "Page.NewWindow", BROWSER_NEW_WINDOW, 0 },
- { "Page.FindText", BROWSER_FIND_TEXT, &dialog_search },
- { "Page.ViewSrc", BROWSER_VIEW_SOURCE, 0 },
- { "Object", BROWSER_OBJECT, 0 },
- { "Object.Object", BROWSER_OBJECT_OBJECT, 0 },
- { "Object.Object.ObjInfo", BROWSER_OBJECT_INFO, &dialog_objinfo },
- { "Object.Object.ObjSave", BROWSER_OBJECT_SAVE, &dialog_saveas },
- { "Object.Object.Export", BROWSER_OBJECT_EXPORT, 0 },
- { "Object.Object.Export.Sprite", BROWSER_OBJECT_EXPORT_SPRITE, &dialog_saveas },
-#ifdef WITH_DRAW_EXPORT
- { "Object.Object.Export.ObjDraw", BROWSER_OBJECT_EXPORT_DRAW, &dialog_saveas },
-#endif
- { "Object.Object.SaveURL", NO_ACTION, 0 },
- { "Object.Object.SaveURL.URI", BROWSER_OBJECT_SAVE_URL_URI, &dialog_saveas },
- { "Object.Object.SaveURL.URL", BROWSER_OBJECT_SAVE_URL_URL, &dialog_saveas },
- { "Object.Object.SaveURL.LinkText", BROWSER_OBJECT_SAVE_URL_TEXT, &dialog_saveas },
- { "Object.Object.ObjPrint", BROWSER_OBJECT_PRINT, 0 },
- { "Object.Object.ObjReload", BROWSER_OBJECT_RELOAD, 0 },
- { "Object.Link", BROWSER_OBJECT_LINK, 0 },
- { "Object.Link.LinkSave", BROWSER_LINK_SAVE, 0 },
- { "Object.Link.LinkSave.URI", BROWSER_LINK_SAVE_URI, &dialog_saveas },
- { "Object.Link.LinkSave.URL", BROWSER_LINK_SAVE_URL, &dialog_saveas },
- { "Object.Link.LinkSave.LinkText", BROWSER_LINK_SAVE_TEXT, &dialog_saveas },
- { "_Object.Link.LinkDload", BROWSER_LINK_DOWNLOAD, 0 },
- { "Object.Link.LinkNew", BROWSER_LINK_NEW_WINDOW, 0 },
- { "Selection", BROWSER_SELECTION, 0 },
- { "_Selection.SelSave", BROWSER_SELECTION_SAVE, &dialog_saveas },
- { "Selection.Copy", BROWSER_SELECTION_COPY, 0 },
- { "Selection.Cut", BROWSER_SELECTION_CUT, 0 },
- { "_Selection.Paste", BROWSER_SELECTION_PASTE, 0 },
- { "Selection.Clear", BROWSER_SELECTION_CLEAR, 0 },
- { "Selection.SelectAll", BROWSER_SELECTION_ALL, 0 },
- { "Navigate", NO_ACTION, 0 },
- { "Navigate.Home", BROWSER_NAVIGATE_HOME, 0 },
- { "Navigate.Back", BROWSER_NAVIGATE_BACK, 0 },
- { "Navigate.Forward", BROWSER_NAVIGATE_FORWARD, 0 },
- { "_Navigate.UpLevel", BROWSER_NAVIGATE_UP, 0 },
- { "Navigate.Reload", BROWSER_NAVIGATE_RELOAD_ALL, 0 },
- { "Navigate.Stop", BROWSER_NAVIGATE_STOP, 0 },
- { "View", NO_ACTION, 0 },
- { "View.ScaleView", BROWSER_SCALE_VIEW, &dialog_zoom },
- { "View.Images", NO_ACTION, 0 },
- { "View.Images.ForeImg", BROWSER_IMAGES_FOREGROUND, 0 },
- { "View.Images.BackImg", BROWSER_IMAGES_BACKGROUND, 0 },
- { "View.Toolbars", NO_ACTION, 0 },
- { "View.Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
- { "View.Toolbars.ToolAddress", TOOLBAR_ADDRESS_BAR, 0 },
- { "_View.Toolbars.ToolThrob", TOOLBAR_THROBBER, 0 },
- { "View.Toolbars.EditToolbar", TOOLBAR_EDIT, 0 },
- { "_View.Render", NO_ACTION, 0 },
- { "View.Render.RenderAnims", BROWSER_BUFFER_ANIMS, 0 },
- { "View.Render.RenderAll", BROWSER_BUFFER_ALL, 0 },
- { "_View.OptDefault", BROWSER_SAVE_VIEW, 0 },
- { "View.Window", NO_ACTION, 0 },
- { "View.Window.WindowSave", BROWSER_WINDOW_DEFAULT, 0 },
- { "View.Window.WindowStagr", BROWSER_WINDOW_STAGGER, 0 },
- { "_View.Window.WindowSize", BROWSER_WINDOW_COPY, 0 },
- { "View.Window.WindowReset", BROWSER_WINDOW_RESET, 0 },
- { "Utilities", NO_ACTION, 0 },
- { "Utilities.Hotlist", HOTLIST_SHOW, 0 },
- { "Utilities.Hotlist.HotlistAdd", HOTLIST_ADD_URL, 0 },
- { "Utilities.Hotlist.HotlistShow", HOTLIST_SHOW, 0 },
- { "Utilities.History", HISTORY_SHOW_GLOBAL, 0 },
- { "Utilities.History.HistLocal", HISTORY_SHOW_LOCAL, 0 },
- { "Utilities.History.HistGlobal", HISTORY_SHOW_GLOBAL, 0 },
- { "Utilities.Cookies", COOKIES_SHOW, 0 },
- { "Utilities.Cookies.ShowCookies", COOKIES_SHOW, 0 },
- { "Utilities.Cookies.DeleteCookies", COOKIES_DELETE, 0 },
- { "Help", HELP_OPEN_CONTENTS, 0 },
- { "Help.HelpContent", HELP_OPEN_CONTENTS, 0 },
- { "Help.HelpGuide", HELP_OPEN_GUIDE, 0 },
- { "_Help.HelpInfo", HELP_OPEN_INFORMATION, 0 },
- { "Help.HelpCredits", HELP_OPEN_CREDITS, 0 },
- { "_Help.HelpLicence", HELP_OPEN_LICENCE, 0 },
- { "Help.HelpInter", HELP_LAUNCH_INTERACTIVE, 0 },
- {NULL, 0, 0}
- }
- };
- ro_gui_browser_window_menu =
- ro_gui_menu_define_menu(&browser_definition);
-
-}
-
-
-/*
- * Interface With Core
- */
/**
* Place the caret in a browser window.
*
- * \param g window with caret
- * \param x coordinates of caret
- * \param y coordinates of caret
- * \param height height of caret
- * \param clip clip rectangle, or NULL if none
+ * \param g window with caret
+ * \param x coordinates of caret
+ * \param y coordinates of caret
+ * \param height height of caret
+ * \param clip clip rectangle, or NULL if none
*/
-
-static void gui_window_place_caret(struct gui_window *g, int x, int y, int height,
- const struct rect *clip)
+static void
+gui_window_place_caret(struct gui_window *g,
+ int x,
+ int y,
+ int height,
+ const struct rect *clip)
{
os_error *error;
error = xwimp_set_caret_position(g->window, -1,
x * 2, -(y + height) * 2, height * 2, -1);
if (error) {
- LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_caret_position: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
}
+
/**
- * Create and open a new browser window.
+ * Updates a windows extent.
*
- * \param bw bw to create gui_window for
- * \param existing an existing gui_window, may be NULL
- * \param flags flags for gui window creation
- * \return gui window, or NULL on error
+ * \param g the gui_window to update
+ * \param width the minimum width, or -1 to use window width
+ * \param height the minimum height, or -1 to use window height
*/
-
-static struct gui_window *gui_window_create(struct browser_window *bw,
- struct gui_window *existing,
- gui_window_create_flags flags)
+static void gui_window_set_extent(struct gui_window *g, int width, int height)
{
- int screen_width, screen_height;
- static int window_count = 2;
- wimp_window window;
+ int screen_width;
+ int toolbar_height = 0;
wimp_window_state state;
os_error *error;
- bool open_centred = true;
- struct gui_window *g;
- g = malloc(sizeof *g);
- if (!g) {
- ro_warn_user("NoMemory", 0);
- return 0;
+ if (g->toolbar) {
+ toolbar_height = ro_toolbar_full_height(g->toolbar);
}
- g->bw = bw;
- g->toolbar = 0;
- g->status_bar = 0;
- g->old_width = 0;
- g->old_height = 0;
- g->update_extent = true;
- g->active = false;
- strcpy(g->title, "NetSurf");
- g->iconise_icon = -1;
- g->scale = browser_window_get_scale(bw);
- /* Set the window position */
- if (existing != NULL &&
- flags & GW_CREATE_CLONE &&
- nsoption_bool(window_size_clone)) {
- state.w = existing->window;
+ /* get the current state */
+ if ((height == -1) || (width == -1)) {
+ state.w = g->window;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_state: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
+ return;
}
- window.visible.x0 = state.visible.x0;
- window.visible.x1 = state.visible.x1;
- window.visible.y0 = state.visible.y0 - 48;
- window.visible.y1 = state.visible.y1 - 48;
- open_centred = false;
- } else {
- int win_width, win_height;
- ro_gui_screen_size(&screen_width, &screen_height);
-
- /* Check if we have a preferred position */
- if ((nsoption_int(window_screen_width) != 0) &&
- (nsoption_int(window_screen_height) != 0)) {
- win_width = (nsoption_int(window_width) *
- screen_width) /
- nsoption_int(window_screen_width);
- win_height = (nsoption_int(window_height) *
- screen_height) /
- nsoption_int(window_screen_height);
- window.visible.x0 = (nsoption_int(window_x) *
- screen_width) /
- nsoption_int(window_screen_width);
- window.visible.y0 = (nsoption_int(window_y) *
- screen_height) /
- nsoption_int(window_screen_height);
- if (nsoption_bool(window_stagger)) {
- window.visible.y0 += 96 -
- (48 * (window_count % 5));
- }
- open_centred = false;
- if (win_width < 100)
- win_width = 100;
- if (win_height < 100)
- win_height = 100;
- } else {
-
- /* Base how we define the window height/width
- on the compile time options set */
- win_width = screen_width * 3 / 4;
- if (1600 < win_width)
- win_width = 1600;
- win_height = win_width * 3 / 4;
-
- window.visible.x0 = (screen_width - win_width) / 2;
- window.visible.y0 = ((screen_height - win_height) / 2) +
- 96 - (48 * (window_count % 5));
+ if (width == -1)
+ width = state.visible.x1 - state.visible.x0;
+ if (height == -1) {
+ height = state.visible.y1 - state.visible.y0;
+ height -= toolbar_height;
}
- window.visible.x1 = window.visible.x0 + win_width;
- window.visible.y1 = window.visible.y0 + win_height;
}
- /* General flags for a non-movable, non-resizable, no-title bar window */
- window.xscroll = 0;
- window.yscroll = 0;
- window.next = wimp_TOP;
- window.flags = wimp_WINDOW_MOVEABLE |
- wimp_WINDOW_NEW_FORMAT |
- wimp_WINDOW_VSCROLL |
- wimp_WINDOW_HSCROLL |
- wimp_WINDOW_IGNORE_XEXTENT |
- wimp_WINDOW_IGNORE_YEXTENT |
- wimp_WINDOW_SCROLL_REPEAT;
- window.title_fg = wimp_COLOUR_BLACK;
- window.title_bg = wimp_COLOUR_LIGHT_GREY;
- window.work_fg = wimp_COLOUR_LIGHT_GREY;
- window.work_bg = wimp_COLOUR_TRANSPARENT;
- window.scroll_outer = wimp_COLOUR_DARK_GREY;
- window.scroll_inner = wimp_COLOUR_MID_LIGHT_GREY;
- window.highlight_bg = wimp_COLOUR_CREAM;
- window.extra_flags = wimp_WINDOW_USE_EXTENDED_SCROLL_REQUEST |
- wimp_WINDOW_GIVE_SHADED_ICON_INFO;
- window.extent.x0 = 0;
- window.extent.y0 = -(window.visible.y1 - window.visible.y0);
- window.extent.x1 = window.visible.x1 - window.visible.x0;
- window.extent.y1 = 0;
- window.title_flags = wimp_ICON_TEXT |
- wimp_ICON_INDIRECTED |
- wimp_ICON_HCENTRED;
- window.work_flags = wimp_BUTTON_DOUBLE_CLICK_DRAG <<
- wimp_ICON_BUTTON_TYPE_SHIFT;
- window.sprite_area = wimpspriteop_AREA;
- window.xmin = 1;
- window.ymin = 1;
- window.title_data.indirected_text.text = g->title;
- window.title_data.indirected_text.validation = (char *) -1;
- window.title_data.indirected_text.size = 255;
- window.icon_count = 0;
-
- /* Add in flags */
- window.flags |= wimp_WINDOW_SIZE_ICON |
- wimp_WINDOW_BACK_ICON |
- wimp_WINDOW_CLOSE_ICON |
- wimp_WINDOW_TITLE_ICON |
- wimp_WINDOW_TOGGLE_ICON;
-
- if (open_centred) {
- int scroll_width = ro_get_vscroll_width(NULL);
- window.visible.x0 -= scroll_width;
+ /* the top-level framed window is a total pain. to get it to maximise
+ * to the top of the screen we need to fake it having a suitably large
+ * extent */
+ if (browser_window_is_frameset(g->bw)) {
+ ro_gui_screen_size(&screen_width, &height);
+ if (g->toolbar)
+ height -= ro_toolbar_full_height(g->toolbar);
+ height -= ro_get_hscroll_height(g->window);
+ height -= ro_get_title_height(g->window);
}
-
- error = xwimp_create_window(&window, &g->window);
+ if (browser_window_has_content(g->bw)) {
+ int w, h;
+ browser_window_get_extents(g->bw, true, &w, &h);
+ width = max(width, w * 2);
+ height = max(height, h * 2);
+ }
+ os_box extent = { 0, -height, width, toolbar_height };
+ error = xwimp_set_extent(g->window, &extent);
if (error) {
- LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
- free(g);
- return 0;
+ return;
}
+}
- /* Link into window list */
- g->prev = 0;
- g->next = window_list;
- if (window_list)
- window_list->prev = g;
- window_list = g;
- window_count++;
- /* Add in a toolbar and status bar */
- g->status_bar = ro_gui_status_bar_create(g->window,
- nsoption_int(toolbar_status_size));
- g->toolbar = ro_toolbar_create(NULL, g->window,
- THEME_STYLE_BROWSER_TOOLBAR, TOOLBAR_FLAGS_NONE,
- &ro_gui_window_toolbar_callbacks, g,
- "HelpToolbar");
- if (g->toolbar != NULL) {
- ro_toolbar_add_buttons(g->toolbar,
- brower_toolbar_buttons,
- nsoption_charp(toolbar_browser));
- ro_toolbar_add_url(g->toolbar);
- ro_toolbar_add_throbber(g->toolbar);
- ro_toolbar_rebuild(g->toolbar);
- }
+/**
+ * Open a window
+ *
+ * opens a window using the given wimp_open, handling toolbars and resizing.
+ *
+ * \param open the window open event information
+ */
+static void ro_gui_window_open(wimp_open *open)
+{
+ struct gui_window *g;
+ int width = open->visible.x1 - open->visible.x0;
+ int height = open->visible.y1 - open->visible.y0;
+ browser_scrolling h_scroll;
+ browser_scrolling v_scroll;
+ int toolbar_height = 0;
+ float new_scale = 0;
+ wimp_window_state state;
+ os_error *error;
+ wimp_w parent;
+ bits linkage;
+ bool have_content;
- /* Register event handlers. Do this quickly, as some of the things
- * that follow will indirectly look up our user data: this MUST
- * be set first!
- */
- ro_gui_wimp_event_set_user_data(g->window, g);
- ro_gui_wimp_event_register_open_window(g->window, ro_gui_window_open);
- ro_gui_wimp_event_register_close_window(g->window, ro_gui_window_close);
- ro_gui_wimp_event_register_redraw_window(g->window, ro_gui_window_redraw);
- ro_gui_wimp_event_register_scroll_window(g->window, ro_gui_window_scroll);
- ro_gui_wimp_event_register_pointer_entering_window(g->window, ro_gui_window_pointer_entering);
- ro_gui_wimp_event_register_keypress(g->window, ro_gui_window_keypress);
- ro_gui_wimp_event_register_mouse_click(g->window, ro_gui_window_click);
- ro_gui_wimp_event_register_menu(g->window, ro_gui_browser_window_menu,
- true, false);
- ro_gui_wimp_event_register_menu_prepare(g->window,
- ro_gui_window_menu_prepare);
- ro_gui_wimp_event_register_menu_selection(g->window,
- ro_gui_window_menu_select);
- ro_gui_wimp_event_register_menu_warning(g->window,
- ro_gui_window_menu_warning);
- ro_gui_wimp_event_register_menu_close(g->window,
- ro_gui_window_menu_close);
+ g = (struct gui_window *)ro_gui_wimp_event_get_user_data(open->w);
- /* Set the window options */
- ro_gui_window_clone_options(g, existing);
- ro_gui_window_update_toolbar_buttons(g);
+ if (open->next == wimp_TOP && g->iconise_icon >= 0) {
+ /* window is no longer iconised, release its sprite number */
+ iconise_used[g->iconise_icon] = false;
+ g->iconise_icon = -1;
+ }
- /* Open the window at the top of the stack */
+ have_content = browser_window_has_content(g->bw);
+
+ /* get the current flags/nesting state */
state.w = g->window;
- error = xwimp_get_window_state(&state);
+ error = xwimp_get_window_state_and_nesting(&state, &parent, &linkage);
if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
- return g;
+ return;
}
- state.next = wimp_TOP;
-
- ro_gui_window_open(PTR_WIMP_OPEN(&state));
+ /* account for toolbar height, if present */
+ if (g->toolbar)
+ toolbar_height = ro_toolbar_full_height(g->toolbar);
+ height -= toolbar_height;
- /* Claim the caret */
- if (ro_toolbar_take_caret(g->toolbar))
- ro_gui_url_complete_start(g->toolbar);
- else
- gui_window_place_caret(g, -100, -100, 0, NULL);
+ /* work with the state from now on so we can modify flags */
+ state.visible = open->visible;
+ state.xscroll = open->xscroll;
+ state.yscroll = open->yscroll;
+ state.next = open->next;
- return g;
-}
+ browser_window_get_scrollbar_type(g->bw, &h_scroll, &v_scroll);
+ /* handle 'auto' scroll bars' and non-fitting scrollbar removal */
+ if ((h_scroll != BW_SCROLLING_NO) && (v_scroll != BW_SCROLLING_NO)) {
+ int size;
-/**
- * Close a browser window and free any related resources.
- *
- * \param g gui_window to destroy
- */
+ /* windows lose scrollbars when containing a frameset */
+ bool no_hscroll = false;
+ bool no_vscroll = browser_window_is_frameset(g->bw);
-static void gui_window_destroy(struct gui_window *g)
-{
- os_error *error;
- wimp_w w;
+ /* hscroll */
+ size = ro_get_hscroll_height(NULL);
+ size -= 2; /* 1px border on both sides */
+ if (!no_hscroll) {
+ if (!(state.flags & wimp_WINDOW_HSCROLL)) {
+ height -= size;
+ state.visible.y0 += size;
+ if (have_content) {
+ browser_window_schedule_reformat(g->bw);
+ }
+ }
+ state.flags |= wimp_WINDOW_HSCROLL;
+ } else {
+ if (state.flags & wimp_WINDOW_HSCROLL) {
+ height += size;
+ state.visible.y0 -= size;
+ if (have_content) {
+ browser_window_schedule_reformat(g->bw);
+ }
+ }
+ state.flags &= ~wimp_WINDOW_HSCROLL;
+ }
- assert(g);
+ /* vscroll */
+ size = ro_get_vscroll_width(NULL);
+ size -= 2; /* 1px border on both sides */
+ if (!no_vscroll) {
+ if (!(state.flags & wimp_WINDOW_VSCROLL)) {
+ width -= size;
+ state.visible.x1 -= size;
+ if (have_content) {
+ browser_window_schedule_reformat(g->bw);
+ }
+ }
+ state.flags |= wimp_WINDOW_VSCROLL;
+ } else {
+ if (state.flags & wimp_WINDOW_VSCROLL) {
+ width += size;
+ state.visible.x1 += size;
+ if (have_content) {
+ browser_window_schedule_reformat(g->bw);
+ }
+ }
+ state.flags &= ~wimp_WINDOW_VSCROLL;
+ }
+ }
- /* stop any tracking */
- ro_mouse_kill(g);
+ /* reformat or change extent if necessary */
+ if (have_content &&
+ (g->old_width != width || g->old_height != height)) {
+ /* Ctrl-resize of a top-level window scales the content size */
+ if ((g->old_width > 0) && (g->old_width != width) &&
+ (ro_gui_ctrl_pressed()))
+ new_scale = (g->scale * width) / g->old_width;
+ browser_window_schedule_reformat(g->bw);
+ }
+ if (g->update_extent || g->old_width != width ||
+ g->old_height != height) {
+ g->old_width = width;
+ g->old_height = height;
+ g->update_extent = false;
+ gui_window_set_extent(g, width, height);
+ }
- /* remove from list */
- if (g->prev)
- g->prev->next = g->next;
- else
- window_list = g->next;
- if (g->next)
- g->next->prev = g->prev;
+ /* first resize stops any flickering by making the URL window on top */
+ ro_gui_url_complete_resize(g->toolbar, PTR_WIMP_OPEN(&state));
- /* destroy toolbar */
- if (g->toolbar)
- ro_toolbar_destroy(g->toolbar);
- if (g->status_bar)
- ro_gui_status_bar_destroy(g->status_bar);
+ /* Windows containing framesets can only be scrolled via the core, which
+ * is implementing frame scrollbars itself. The x and y offsets are
+ * therefore fixed.
+ */
- w = g->window;
- ro_gui_url_complete_close();
- ro_gui_dialog_close_persistent(w);
- if (current_menu_window == w)
- ro_gui_menu_destroy();
- ro_gui_window_remove_update_boxes(g);
+ if (browser_window_is_frameset(g->bw)) {
+ state.xscroll = 0;
+ state.yscroll = toolbar_height;
+ }
- /* delete window */
- error = xwimp_delete_window(w);
+ error = xwimp_open_window_nested_with_flags(&state, parent, linkage);
if (error) {
- LOG("xwimp_delete_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
+ return;
}
- ro_gui_wimp_event_finalise(w);
-
- free(g);
-}
-
-/**
- * Set the title of a browser window.
- *
- * \param g gui_window to update
- * \param title new window title, copied
- */
-
-static void gui_window_set_title(struct gui_window *g, const char *title)
-{
- assert(g);
- assert(title);
-
- if (g->scale != 1.0) {
- int scale_disp = g->scale * 100;
-
- if (ABS((float)scale_disp - g->scale * 100) >= 0.05)
- snprintf(g->title, sizeof g->title, "%s (%.1f%%)",
- title, g->scale * 100);
- else
- snprintf(g->title, sizeof g->title, "%s (%i%%)",
- title, scale_disp);
- } else {
- strncpy(g->title, title, sizeof g->title);
+ /* update the toolbar */
+ if (g->status_bar)
+ ro_gui_status_bar_resize(g->status_bar);
+ if (g->toolbar) {
+ ro_toolbar_process(g->toolbar, -1, false);
+ /* second resize updates to the new URL bar width */
+ ro_gui_url_complete_resize(g->toolbar, open);
}
- ro_gui_set_window_title(g->window, g->title);
+ /* set the new scale from a ctrl-resize. this must be done at the end as
+ * it may cause a frameset recalculation based on the new window size.
+ */
+ if (new_scale > 0) {
+ ro_gui_window_set_scale(g, new_scale);
+ }
}
/**
- * Force a redraw of the entire contents of a browser window.
+ * Update the extent of the inside of a browser window to that of the
+ * current content.
*
- * \param g gui_window to redraw
+ * \param g gui_window to update the extent of
*/
-void gui_window_redraw_window(struct gui_window *g)
+static void gui_window_update_extent(struct gui_window *g)
{
- wimp_window_info info;
os_error *error;
+ wimp_window_info info;
assert(g);
+
info.w = g->window;
error = xwimp_get_window_info_header_only(&info);
if (error) {
- LOG("xwimp_get_window_info_header_only: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_info_header_only: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
- error = xwimp_force_redraw(g->window, info.extent.x0, info.extent.y0,
- info.extent.x1, info.extent.y1);
- if (error) {
- LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
+
+ /* scroll on toolbar height change */
+ if (g->toolbar) {
+ int scroll = ro_toolbar_height(g->toolbar) - info.extent.y1;
+ info.yscroll += scroll;
}
+
+ /* Handle change of extents */
+ g->update_extent = true;
+ ro_gui_window_open(PTR_WIMP_OPEN(&info));
}
/**
- * Redraw an area of a window.
+ * Update a window and its toolbar
*
- * \param g The window to update
- * \param rect The area of the window to update.
+ * makes a window and toolbar reflect a new theme: used as a callback
+ * by the toolbar module when a theme change affects a toolbar.
+ *
+ * \param data void pointer to the window's gui_window struct
+ * \param ok true if the bar still exists; else false.
*/
-
-static void gui_window_update_box(struct gui_window *g, const struct rect *rect)
+static void ro_gui_window_update_theme(void *data, bool ok)
{
- bool use_buffer;
- int x0, y0, x1, y1;
- struct update_box *cur;
-
- x0 = floorf(rect->x0 * 2 * g->scale);
- y0 = -ceilf(rect->y1 * 2 * g->scale);
- x1 = ceilf(rect->x1 * 2 * g->scale) + 1;
- y1 = -floorf(rect->y0 * 2 * g->scale) + 1;
- use_buffer =
- (g->option.buffer_everything || g->option.buffer_animations);
-
- /* try to optimise buffered redraws */
- if (use_buffer) {
- for (cur = pending_updates; cur != NULL; cur = cur->next) {
- if ((cur->g != g) || (!cur->use_buffer))
- continue;
- if ((((cur->x0 - x1) < MARGIN) || ((cur->x1 - x0) < MARGIN)) &&
- (((cur->y0 - y1) < MARGIN) || ((cur->y1 - y0) < MARGIN))) {
- cur->x0 = min(cur->x0, x0);
- cur->y0 = min(cur->y0, y0);
- cur->x1 = max(cur->x1, x1);
- cur->y1 = max(cur->y1, y1);
- return;
- }
+ struct gui_window *g = (struct gui_window *) data;
+ if (g != NULL && g->toolbar != NULL) {
+ if (ok) {
+ gui_window_update_extent(g);
+ } else {
+ g->toolbar = NULL;
}
}
- cur = malloc(sizeof(struct update_box));
- if (!cur) {
- LOG("No memory for malloc.");
- ro_warn_user("NoMemory", 0);
- return;
- }
- cur->x0 = x0;
- cur->y0 = y0;
- cur->x1 = x1;
- cur->y1 = y1;
- cur->next = pending_updates;
- pending_updates = cur;
- cur->g = g;
- cur->use_buffer = use_buffer;
}
/**
- * Get the scroll position of a browser window.
+ * Update a window to reflect a change in toolbar size: used as a callback by
+ * the toolbar module when a toolbar height changes.
*
- * \param g gui_window
- * \param sx receives x ordinate of point at top-left of window
- * \param sy receives y ordinate of point at top-left of window
- * \return true iff successful
+ * \param data void pointer the window's gui_window struct
*/
-
-static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
+static void ro_gui_window_update_toolbar(void *data)
{
- wimp_window_state state;
- os_error *error;
- int toolbar_height = 0;
-
- assert(g);
+ struct gui_window *g = (struct gui_window *) data;
- state.w = g->window;
- error = xwimp_get_window_state(&state);
- if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return false;
+ if (g != NULL) {
+ gui_window_update_extent(g);
}
-
- if (g->toolbar)
- toolbar_height = ro_toolbar_full_height(g->toolbar);
- *sx = state.xscroll / (2 * g->scale);
- *sy = -(state.yscroll - toolbar_height) / (2 * g->scale);
- return true;
}
/**
- * Set the scroll position of a browser window.
+ * Update the toolbar buttons for a given browser window to reflect the
+ * current state of its contents.
*
- * \param g gui_window to scroll
- * \param sx point to place at top-left of window
- * \param sy point to place at top-left of window
+ * Note that the parameters to this function are arranged so that it can be
+ * supplied to the toolbar module as an button state update callback.
+ *
+ * \param g The browser window to update.
*/
-
-static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
+static void ro_gui_window_update_toolbar_buttons(struct gui_window *g)
{
- wimp_window_state state;
- os_error *error;
-
- assert(g);
+ struct browser_window *bw;
+ struct toolbar *toolbar;
- state.w = g->window;
- error = xwimp_get_window_state(&state);
- if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
+ if (g == NULL || g->toolbar == NULL)
return;
- }
- state.xscroll = sx * 2 * g->scale;
- state.yscroll = -sy * 2 * g->scale;
- if (g->toolbar)
- state.yscroll += ro_toolbar_full_height(g->toolbar);
- ro_gui_window_open(PTR_WIMP_OPEN(&state));
-}
+ bw = g->bw;
+ toolbar = g->toolbar;
+ ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_RELOAD,
+ !browser_window_reload_available(bw));
-/**
- * Scrolls the specified area of a browser window into view.
- *
- * \param g gui_window to scroll
- * \param x0 left point to ensure visible
- * \param y0 bottom point to ensure visible
- * \param x1 right point to ensure visible
- * \param y1 top point to ensure visible
- */
-static void gui_window_scroll_visible(struct gui_window *g, int x0, int y0, int x1, int y1)
-{
- wimp_window_state state;
- os_error *error;
- int cx0, cy0, width, height;
- int padding_available;
- int toolbar_height = 0;
- int correction;
+ ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_STOP,
+ !browser_window_stop_available(bw));
- assert(g);
+ ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_BACK,
+ !browser_window_back_available(bw));
- state.w = g->window;
- error = xwimp_get_window_state(&state);
- if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
+ ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_FORWARD,
+ !browser_window_forward_available(bw));
- if (g->toolbar)
- toolbar_height = ro_toolbar_full_height(g->toolbar);
+ ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_UP,
+ !browser_window_up_available(bw));
- x0 = x0 * 2 * g->scale;
- y0 = y0 * 2 * g->scale;
- x1 = x1 * 2 * g->scale;
- y1 = y1 * 2 * g->scale;
-
- cx0 = state.xscroll;
- cy0 = -state.yscroll + toolbar_height;
- width = state.visible.x1 - state.visible.x0;
- height = state.visible.y1 - state.visible.y0 - toolbar_height;
-
- /* make sure we're visible */
- correction = (x1 - cx0 - width);
- if (correction > 0)
- cx0 += correction;
- correction = (y1 - cy0 - height);
- if (correction > 0)
- cy0 += correction;
- if (x0 < cx0)
- cx0 = x0;
- if (y0 < cy0)
- cy0 = y0;
-
- /* try to give a SCROLL_VISIBLE_PADDING border of space around us */
- padding_available = (width - x1 + x0) / 2;
- if (padding_available > 0) {
- if (padding_available > SCROLL_VISIBLE_PADDING)
- padding_available = SCROLL_VISIBLE_PADDING;
- correction = (cx0 + width - x1);
- if (correction < padding_available)
- cx0 += padding_available;
- correction = (x0 - cx0);
- if (correction < padding_available)
- cx0 -= padding_available;
- }
- padding_available = (height - y1 + y0) / 2;
- if (padding_available > 0) {
- if (padding_available > SCROLL_VISIBLE_PADDING)
- padding_available = SCROLL_VISIBLE_PADDING;
- correction = (cy0 + height - y1);
- if (correction < padding_available)
- cy0 += padding_available;
- correction = (y0 - cy0);
- if (correction < padding_available)
- cy0 -= padding_available;
- }
-
- state.xscroll = cx0;
- state.yscroll = -cy0 + toolbar_height;
- ro_gui_window_open(PTR_WIMP_OPEN(&state));
-}
+ ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_SEARCH,
+ !browser_window_can_search(bw));
+ ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_SCALE,
+ !browser_window_has_content(bw));
-/**
- * Find the current dimensions of a browser window's content area.
- *
- * \param g gui_window to measure
- * \param width receives width of window
- * \param height receives height of window
- * \param scaled whether to return scaled values
- */
+ ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_PRINT,
+ !browser_window_has_content(bw));
-static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, bool scaled)
-{
- /* use the cached window sizes */
- *width = g->old_width / 2;
- *height = g->old_height / 2;
- if (scaled) {
- *width /= g->scale;
- *height /= g->scale;
- }
+ ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_SAVE_SOURCE,
+ !browser_window_has_content(bw));
+
+ ro_toolbar_update_urlsuggest(toolbar);
}
/**
- * Update the extent of the inside of a browser window to that of the
- * current content.
+ * Add a hotlist entry for a browser window.
*
- * \param g gui_window to update the extent of
+ * \param g The browser window to act on.
*/
-
-static void gui_window_update_extent(struct gui_window *g)
+static void ro_gui_window_action_add_bookmark(struct gui_window *g)
{
- os_error *error;
- wimp_window_info info;
-
- assert(g);
+ nsurl *url;
- info.w = g->window;
- error = xwimp_get_window_info_header_only(&info);
- if (error) {
- LOG("xwimp_get_window_info_header_only: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
+ if (g == NULL || g->bw == NULL || g->toolbar == NULL ||
+ browser_window_has_content(g->bw) == false)
return;
- }
- /* scroll on toolbar height change */
- if (g->toolbar) {
- int scroll = ro_toolbar_height(g->toolbar) - info.extent.y1;
- info.yscroll += scroll;
- }
+ url = browser_window_access_url(g->bw);
- /* Handle change of extents */
- g->update_extent = true;
- ro_gui_window_open(PTR_WIMP_OPEN(&info));
+ ro_gui_hotlist_add_page(url);
+ ro_toolbar_update_hotlist(g->toolbar);
}
/**
- * Set the status bar of a browser window.
+ * Remove a hotlist entry for a browser window.
*
- * \param g gui_window to update
- * \param text new status text
+ * \param g The browser window to act on.
*/
-
-static void riscos_window_set_status(struct gui_window *g, const char *text)
+static void ro_gui_window_action_remove_bookmark(struct gui_window *g)
{
- if (g->status_bar)
- ro_gui_status_bar_set_text(g->status_bar, text);
+ nsurl *url;
+
+ if (g == NULL || g->bw == NULL || g->toolbar == NULL ||
+ browser_window_has_content(g->bw) == false)
+ return;
+
+ url = browser_window_access_url(g->bw);
+
+ ro_gui_hotlist_remove_page(url);
}
/**
- * Change mouse pointer shape
+ * Open a local history pane for a browser window.
+ *
+ * \param gw The browser window to act on.
*/
-
-void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
+static void ro_gui_window_action_local_history(struct gui_window *gw)
{
- static gui_pointer_shape curr_pointer = GUI_POINTER_DEFAULT;
- struct ro_gui_pointer_entry *entry;
- os_error *error;
+ nserror res;
- if (shape == curr_pointer)
+ if ((gw == NULL) || (gw->bw == NULL)) {
return;
+ }
- assert(shape < sizeof ro_gui_pointer_table /
- sizeof ro_gui_pointer_table[0]);
-
- entry = &ro_gui_pointer_table[shape];
+ res = ro_gui_local_history_present(gw->window, gw->bw);
- if (entry->wimp_area) {
- /* pointer in the Wimp's sprite area */
- error = xwimpspriteop_set_pointer_shape(entry->sprite_name,
- 1, entry->xactive, entry->yactive, 0, 0);
- if (error) {
- LOG("xwimpspriteop_set_pointer_shape: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- }
- } else {
- /* pointer in our own sprite area */
- error = xosspriteop_set_pointer_shape(osspriteop_USER_AREA,
- gui_sprites,
- (osspriteop_id) entry->sprite_name,
- 1, entry->xactive, entry->yactive, 0, 0);
- if (error) {
- LOG("xosspriteop_set_pointer_shape: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- }
+ if (res != NSERROR_OK) {
+ ro_warn_user(messages_get_errorcode(res), 0);
}
-
- curr_pointer = shape;
}
-/* exported function documented in riscos/window.h */
-nserror ro_gui_window_set_url(struct gui_window *g, nsurl *url)
+/**
+ * Perform a Navigate Home action on a browser window.
+ *
+ * \param g The browser window to act on.
+ */
+static void ro_gui_window_action_home(struct gui_window *g)
{
- size_t idn_url_l;
- char *idn_url_s = NULL;
-
- if (g->toolbar) {
- if (nsoption_bool(display_decoded_idn) == true) {
- if (nsurl_get_utf8(url, &idn_url_s, &idn_url_l) != NSERROR_OK)
- idn_url_s = NULL;
- }
-
- ro_toolbar_set_url(g->toolbar, idn_url_s ? idn_url_s : nsurl_access(url), true, false);
+ static const char *addr = NETSURF_HOMEPAGE;
+ nsurl *url;
+ nserror error;
- if (idn_url_s)
- free(idn_url_s);
+ if (g == NULL || g->bw == NULL)
+ return;
- ro_gui_url_complete_start(g->toolbar);
+ if (nsoption_charp(homepage_url) != NULL) {
+ addr = nsoption_charp(homepage_url);
}
- return NSERROR_OK;
+ error = nsurl_create(addr, &url);
+ if (error == NSERROR_OK) {
+ error = browser_window_navigate(g->bw,
+ url,
+ NULL,
+ BW_NAVIGATE_HISTORY,
+ NULL,
+ NULL,
+ NULL);
+ nsurl_unref(url);
+ }
+ if (error != NSERROR_OK) {
+ ro_warn_user(messages_get_errorcode(error), 0);
+ }
}
/**
- * Update the interface to reflect start of page loading.
+ * Open a text search dialogue for a browser window.
*
- * \param g window with start of load
+ * \param g The browser window to act on.
*/
-
-static void gui_window_start_throbber(struct gui_window *g)
+static void ro_gui_window_action_search(struct gui_window *g)
{
- ro_gui_window_update_toolbar_buttons(g);
- ro_gui_menu_refresh(ro_gui_browser_window_menu);
- if (g->toolbar != NULL)
- ro_toolbar_start_throbbing(g->toolbar);
- g->active = true;
-}
+ if (g == NULL || g->bw == NULL || !browser_window_can_search(g->bw))
+ return;
+ ro_gui_search_prepare(g->bw);
+ ro_gui_dialog_open_persistent(g->window, dialog_search, true);
+}
/**
- * Update the interface to reflect page loading stopped.
+ * Open a zoom dialogue for a browser window.
*
- * \param g window with start of load
+ * \param g The browser window to act on.
*/
-
-static void gui_window_stop_throbber(struct gui_window *g)
+static void ro_gui_window_action_zoom(struct gui_window *g)
{
- ro_gui_window_update_toolbar_buttons(g);
- ro_gui_menu_refresh(ro_gui_browser_window_menu);
- if (g->toolbar != NULL)
- ro_toolbar_stop_throbbing(g->toolbar);
- g->active = false;
-}
-
-/**
- * set favicon
- */
-
-static void gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
-{
- if (g == NULL || g->toolbar == NULL)
+ if (g == NULL)
return;
- ro_toolbar_set_site_favicon(g->toolbar, icon);
+ ro_gui_dialog_prepare_zoom(g);
+ ro_gui_dialog_open_persistent(g->window, dialog_zoom, true);
}
-
/**
- * Remove the caret, if present.
+ * Open a save dialogue for a browser window contents.
*
- * \param g window with caret
+ * \param g The browser window to act on.
+ * \param save_type The type of save to open.
*/
-
-static void gui_window_remove_caret(struct gui_window *g)
+static void
+ro_gui_window_action_save(struct gui_window *g, gui_save_type save_type)
{
- wimp_caret caret;
- os_error *error;
+ struct hlcache_handle *h;
- error = xwimp_get_caret_position(&caret);
- if (error) {
- LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
+ if (g == NULL || g->bw == NULL || !browser_window_has_content(g->bw))
return;
- }
- if (caret.w != g->window)
- /* we don't have the caret: do nothing */
+ h = browser_window_get_content(g->bw);
+ if (h == NULL)
return;
- /* hide caret, but keep input focus */
- gui_window_place_caret(g, -100, -100, 0, NULL);
+ ro_gui_save_prepare(save_type, h, NULL, NULL, NULL);
+ ro_gui_dialog_open_persistent(g->window, dialog_saveas, true);
}
/**
- * Called when the gui_window has new content.
+ * Open a print dialogue for a browser window.
*
- * \param g the gui_window that has new content
+ * \param g The browser window to act on.
*/
-
-static void gui_window_new_content(struct gui_window *g)
+static void ro_gui_window_action_print(struct gui_window *g)
{
- ro_gui_menu_refresh(ro_gui_browser_window_menu);
- ro_gui_window_update_toolbar_buttons(g);
- ro_gui_dialog_close_persistent(g->window);
- ro_toolbar_set_content_favicon(g->toolbar, g);
+ if (g != NULL) {
+ ro_gui_print_prepare(g);
+ ro_gui_dialog_open_persistent(g->window, dialog_print, true);
+ }
}
/**
- * Starts drag scrolling of a browser window
+ * Prepare the page info window for use.
*
- * \param g the window to scroll
+ * \param g The GUI window block to use.
*/
-
-static bool gui_window_scroll_start(struct gui_window *g)
+static void ro_gui_window_prepare_pageinfo(struct gui_window *g)
{
- wimp_window_info_base info;
- wimp_pointer pointer;
- os_error *error;
- wimp_drag drag;
- int height;
- int width;
-
- error = xwimp_get_pointer_info(&pointer);
- if (error) {
- LOG("xwimp_get_pointer_info 0x%x : %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return false;
- }
+ struct hlcache_handle *h = browser_window_get_content(g->bw);
+ char icon_buf[20] = "file_xxx";
+ char enc_buf[40];
+ const char *icon = icon_buf;
+ const char *title, *url;
+ lwc_string *mime;
+ const char *enc = "-";
- info.w = g->window;
- error = xwimp_get_window_info_header_only((wimp_window_info*)&info);
- if (error) {
- LOG("xwimp_get_window_state: 0x%x : %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return false;
- }
+ assert(h);
- width = info.extent.x1 - info.extent.x0;
- height = info.extent.y1 - info.extent.y0;
+ title = content_get_title(h);
+ if (title == NULL)
+ title = "-";
+ url = nsurl_access(hlcache_handle_get_url(h));
+ if (url == NULL)
+ url = "-";
+ mime = content_get_mime_type(h);
- drag.type = wimp_DRAG_USER_POINT;
- drag.bbox.x1 = pointer.pos.x + info.xscroll;
- drag.bbox.y0 = pointer.pos.y + info.yscroll;
- drag.bbox.x0 = drag.bbox.x1 - (width - (info.visible.x1 - info.visible.x0));
- drag.bbox.y1 = drag.bbox.y0 + (height - (info.visible.y1 - info.visible.y0));
+ sprintf(icon_buf, "file_%x", ro_content_filetype(h));
+ if (!ro_gui_wimp_sprite_exists(icon_buf))
+ sprintf(icon_buf, "file_xxx");
- if (g->toolbar) {
- int tbar_height = ro_toolbar_full_height(g->toolbar);
- drag.bbox.y0 -= tbar_height;
- drag.bbox.y1 -= tbar_height;
+ if (content_get_type(h) == CONTENT_HTML) {
+ if (content_get_encoding(h, CONTENT_ENCODING_NORMAL)) {
+ snprintf(enc_buf, sizeof enc_buf, "%s (%s)",
+ content_get_encoding(h, CONTENT_ENCODING_NORMAL),
+ content_get_encoding(h, CONTENT_ENCODING_SOURCE));
+ enc = enc_buf;
+ } else {
+ enc = messages_get("EncodingUnk");
+ }
}
- error = xwimp_drag_box(&drag);
- if (error) {
- LOG("xwimp_drag_box: 0x%x : %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return false;
- }
+ ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_ICON,
+ icon, true);
+ ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_TITLE,
+ title, true);
+ ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_URL,
+ url, true);
+ ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_ENC,
+ enc, true);
+ ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_TYPE,
+ lwc_string_data(mime), true);
- ro_mouse_drag_start(ro_gui_window_scroll_end, ro_gui_window_mouse_at,
- NULL, g);
- return true;
+ lwc_string_unref(mime);
}
/**
- * Platform-dependent part of starting drag operation.
+ * Open a page info box for a browser window.
*
- * \param g gui window containing the drag
- * \param type type of drag the core is performing
- * \param rect rectangle to constrain pointer to (relative to drag start coord)
- * \return true iff succesful
+ * \param g The browser window to act on.
*/
-
-static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
- const struct rect *rect)
+static void ro_gui_window_action_page_info(struct gui_window *g)
{
- wimp_pointer pointer;
- wimp_drag drag;
-
- if (rect != NULL) {
- /* We have a box to constrain the pointer to, for the drag
- * duration */
- os_error *error = xwimp_get_pointer_info(&pointer);
- if (error) {
- LOG("xwimp_get_pointer_info 0x%x : %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return false;
- }
-
- drag.type = wimp_DRAG_USER_POINT;
- drag.bbox.x0 = pointer.pos.x +
- (int)(rect->x0 * 2 * g->scale);
- drag.bbox.y0 = pointer.pos.y +
- (int)(rect->y0 * 2 * g->scale);
- drag.bbox.x1 = pointer.pos.x +
- (int)(rect->x1 * 2 * g->scale);
- drag.bbox.y1 = pointer.pos.y +
- (int)(rect->y1 * 2 * g->scale);
-
- error = xwimp_drag_box(&drag);
- if (error) {
- LOG("xwimp_drag_box: 0x%x : %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return false;
- }
- }
-
- switch (type) {
- case GDRAGGING_SCROLLBAR:
- /* Dragging a core scrollbar */
- ro_mouse_drag_start(ro_gui_window_scroll_end, ro_gui_window_mouse_at,
- NULL, g);
- break;
-
- default:
- /* Not handled here yet */
- break;
- }
+ if (g == NULL || g->bw == NULL ||
+ browser_window_has_content(g->bw) == false)
+ return;
- return true;
+ ro_gui_window_prepare_pageinfo(g);
+ ro_gui_dialog_open_persistent(g->window, dialog_pageinfo, false);
}
/**
- * Save the specified content as a link.
+ * Process Mouse_Click events in a toolbar's button bar.
*
- * \param g The window containing the content
- * \param url The url of the link
- * \param title The title of the link
- */
-static nserror
-gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
-{
- ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL, url, title);
- ro_gui_dialog_open_persistent(g->window, dialog_saveas, true);
- return NSERROR_OK;
-}
-
-
-/**
- * Updates a windows extent.
+ * This does not handle other clicks in a toolbar: these are handled
+ * by the toolbar module itself.
*
- * \param g the gui_window to update
- * \param width the minimum width, or -1 to use window width
- * \param height the minimum height, or -1 to use window height
+ * \param data The GUI window associated with the click.
+ * \param action_type The action type to be handled.
+ * \param action The action to process.
*/
-
-void gui_window_set_extent(struct gui_window *g, int width, int height)
+static void
+ro_gui_window_toolbar_click(void *data,
+ toolbar_action_type action_type,
+ union toolbar_action action)
{
- int screen_width;
- int toolbar_height = 0;
- wimp_window_state state;
- os_error *error;
-
- if (g->toolbar)
- toolbar_height = ro_toolbar_full_height(g->toolbar);
-
- /* get the current state */
- if ((height == -1) || (width == -1)) {
- state.w = g->window;
- error = xwimp_get_window_state(&state);
- if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
- if (width == -1)
- width = state.visible.x1 - state.visible.x0;
- if (height == -1) {
- height = state.visible.y1 - state.visible.y0;
- height -= toolbar_height;
- }
- }
+ struct gui_window *g = data;
+ nserror err;
- /* the top-level framed window is a total pain. to get it to maximise
- * to the top of the screen we need to fake it having a suitably large
- * extent */
- if (browser_window_is_frameset(g->bw)) {
- ro_gui_screen_size(&screen_width, &height);
- if (g->toolbar)
- height -= ro_toolbar_full_height(g->toolbar);
- height -= ro_get_hscroll_height(g->window);
- height -= ro_get_title_height(g->window);
- }
- if (browser_window_has_content(g->bw)) {
- int w, h;
- browser_window_get_extents(g->bw, true, &w, &h);
- width = max(width, w * 2);
- height = max(height, h * 2);
- }
- os_box extent = { 0, -height, width, toolbar_height };
- error = xwimp_set_extent(g->window, &extent);
- if (error) {
- LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
+ if (g == NULL)
return;
- }
-}
-/**
- * Display a menu of options for a form select control.
- *
- * \param g gui window containing form control
- * \param control form control of type GADGET_SELECT
- */
-
-static void gui_window_create_form_select_menu(struct gui_window *g,
- struct form_control *control)
-{
- os_error *error;
- wimp_pointer pointer;
-
- /* The first time the menu is opened, control bypasses the normal
- * Menu Prepare event and so we prepare here. On any re-opens,
- * ro_gui_window_prepare_form_select_menu() is called from the
- * normal wimp event.
- */
-
- if (!ro_gui_window_prepare_form_select_menu(g, control))
- return;
-
- error = xwimp_get_pointer_info(&pointer);
- if (error) {
- LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- ro_gui_menu_destroy();
- return;
- }
+ if (action_type == TOOLBAR_ACTION_URL) {
+ switch (action.url) {
+ case TOOLBAR_URL_DRAG_URL:
+ {
+ gui_save_type save_type;
+ nserror err;
+ nsurl *url;
- gui_form_select_control = control;
- ro_gui_menu_create(gui_form_select_menu,
- pointer.pos.x, pointer.pos.y, g->window);
-}
+ if (!browser_window_has_content(g->bw))
+ break;
+ if (ro_gui_shift_pressed())
+ save_type = GUI_SAVE_LINK_URL;
+ else
+ save_type = GUI_SAVE_LINK_TEXT;
-/*
- * RISC OS Wimp Event Handlers
- */
+ err = browser_window_get_url(g->bw, true, &url);
+ if (err != NSERROR_OK) {
+ /* Fall back to access (won't get fragment). */
+ url = nsurl_ref(
+ browser_window_access_url(g->bw));
+ }
+ ro_gui_drag_save_link(save_type, url,
+ browser_window_get_title(g->bw), g);
-/**
- * Handle a Redraw_Window_Request for a browser window.
- */
+ nsurl_unref(url);
+ }
+ break;
-void ro_gui_window_redraw(wimp_draw *redraw)
-{
- osbool more;
- struct gui_window *g = (struct gui_window *)ro_gui_wimp_event_get_user_data(redraw->w);
- os_error *error;
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &ro_plotters
- };
+ case TOOLBAR_URL_SELECT_HOTLIST:
+ ro_gui_window_action_add_bookmark(g);
+ break;
- /* We can't render locked contents. If the browser window is not
- * ready for redraw, do nothing. Else, in the case of buffered
- * rendering we'll show random data. */
- if (!browser_window_redraw_ready(g->bw))
- return;
+ case TOOLBAR_URL_ADJUST_HOTLIST:
+ ro_gui_window_action_remove_bookmark(g);
+ break;
- ro_gui_current_redraw_gui = g;
+ default:
+ break;
+ }
- error = xwimp_redraw_window(redraw, &more);
- if (error) {
- LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
return;
}
- while (more) {
- struct rect clip;
- /* OS's redraw request coordinates are in screen coordinates,
- * with an origin at the bottom left of the screen.
- * Find the coordinate of the top left of the document in terms
- * of OS screen coordinates.
- * NOTE: OS units are 2 per px. */
- ro_plot_origin_x = redraw->box.x0 - redraw->xscroll;
- ro_plot_origin_y = redraw->box.y1 - redraw->yscroll;
- /* Convert OS redraw rectangle request coordinates into NetSurf
- * coordinates. NetSurf coordinates have origin at top left of
- * document and units are in px. */
- clip.x0 = (redraw->clip.x0 - ro_plot_origin_x) / 2; /* left */
- clip.y0 = (ro_plot_origin_y - redraw->clip.y1) / 2; /* top */
- clip.x1 = (redraw->clip.x1 - ro_plot_origin_x) / 2; /* right */
- clip.y1 = (ro_plot_origin_y - redraw->clip.y0) / 2; /* bottom */
+ /* By now, the only valid action left is a button click. If it isn't
+ * one of those, give up.
+ */
- if (ro_gui_current_redraw_gui->option.buffer_everything)
- ro_gui_buffer_open(redraw);
+ if (action_type != TOOLBAR_ACTION_BUTTON)
+ return;
- browser_window_redraw(g->bw, 0, 0, &clip, &ctx);
+ switch (action.button) {
+ case TOOLBAR_BUTTON_BACK:
+ if (g->bw != NULL)
+ browser_window_history_back(g->bw, false);
+ break;
- if (ro_gui_current_redraw_gui->option.buffer_everything)
- ro_gui_buffer_close();
+ case TOOLBAR_BUTTON_BACK_NEW:
+ if (g->bw != NULL)
+ browser_window_history_back(g->bw, true);
+ break;
- /* Check to see if there are more rectangles to draw and
- * get next one */
- error = xwimp_get_rectangle(redraw, &more);
- /* RISC OS 3.7 returns an error here if enough buffer was
- claimed to cause a new dynamic area to be created. It
- doesn't actually stop anything working, so we mask it out
- for now until a better fix is found. This appears to be a
- bug in RISC OS. */
- if (error && !(ro_gui_current_redraw_gui->
- option.buffer_everything &&
- error->errnum == error_WIMP_GET_RECT)) {
- LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- ro_gui_current_redraw_gui = NULL;
- return;
- }
- }
- ro_gui_current_redraw_gui = NULL;
-}
+ case TOOLBAR_BUTTON_FORWARD:
+ if (g->bw != NULL)
+ browser_window_history_forward(g->bw, false);
+ break;
+ case TOOLBAR_BUTTON_FORWARD_NEW:
+ if (g->bw != NULL)
+ browser_window_history_forward(g->bw, true);
+ break;
-/**
- * Set a gui_window's scale
- */
-void ro_gui_window_set_scale(struct gui_window *g, float scale)
-{
- g->scale = scale;
- browser_window_set_scale(g->bw, scale, true);
-}
+ case TOOLBAR_BUTTON_STOP:
+ if (g->bw != NULL)
+ browser_window_stop(g->bw);
+ break;
+ case TOOLBAR_BUTTON_RELOAD:
+ if (g->bw != NULL)
+ browser_window_reload(g->bw, false);
+ break;
-/**
- * Open a window using the given wimp_open, handling toolbars and resizing.
- */
+ case TOOLBAR_BUTTON_RELOAD_ALL:
+ if (g->bw != NULL)
+ browser_window_reload(g->bw, true);
+ break;
-void ro_gui_window_open(wimp_open *open)
-{
- struct gui_window *g = (struct gui_window *)ro_gui_wimp_event_get_user_data(open->w);
- int width = open->visible.x1 - open->visible.x0;
- int height = open->visible.y1 - open->visible.y0;
- browser_scrolling h_scroll;
- browser_scrolling v_scroll;
- int toolbar_height = 0;
- float new_scale = 0;
- wimp_window_state state;
- os_error *error;
- wimp_w parent;
- bits linkage;
- bool have_content;
+ case TOOLBAR_BUTTON_HISTORY_LOCAL:
+ ro_gui_window_action_local_history(g);
+ break;
- if (open->next == wimp_TOP && g->iconise_icon >= 0) {
- /* window is no longer iconised, release its sprite number */
- iconise_used[g->iconise_icon] = false;
- g->iconise_icon = -1;
- }
+ case TOOLBAR_BUTTON_HISTORY_GLOBAL:
+ ro_gui_global_history_present();
+ break;
- have_content = browser_window_has_content(g->bw);
+ case TOOLBAR_BUTTON_HOME:
+ ro_gui_window_action_home(g);
+ break;
- /* get the current flags/nesting state */
- state.w = g->window;
- error = xwimp_get_window_state_and_nesting(&state, &parent, &linkage);
- if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- return;
- }
+ case TOOLBAR_BUTTON_SEARCH:
+ ro_gui_window_action_search(g);
+ break;
- /* account for toolbar height, if present */
- if (g->toolbar)
- toolbar_height = ro_toolbar_full_height(g->toolbar);
- height -= toolbar_height;
+ case TOOLBAR_BUTTON_SCALE:
+ ro_gui_window_action_zoom(g);
+ break;
- /* work with the state from now on so we can modify flags */
- state.visible = open->visible;
- state.xscroll = open->xscroll;
- state.yscroll = open->yscroll;
- state.next = open->next;
+ case TOOLBAR_BUTTON_BOOKMARK_OPEN:
+ ro_gui_hotlist_present();
+ break;
- browser_window_get_scrollbar_type(g->bw, &h_scroll, &v_scroll);
+ case TOOLBAR_BUTTON_BOOKMARK_ADD:
+ ro_gui_window_action_add_bookmark(g);
+ break;
- /* handle 'auto' scroll bars' and non-fitting scrollbar removal */
- if ((h_scroll != BW_SCROLLING_NO) && (v_scroll != BW_SCROLLING_NO)) {
- int size;
+ case TOOLBAR_BUTTON_SAVE_SOURCE:
+ ro_gui_window_action_save(g, GUI_SAVE_SOURCE);
+ break;
- /* windows lose scrollbars when containing a frameset */
- bool no_hscroll = false;
- bool no_vscroll = browser_window_is_frameset(g->bw);
+ case TOOLBAR_BUTTON_SAVE_COMPLETE:
+ ro_gui_window_action_save(g, GUI_SAVE_COMPLETE);
+ break;
- /* hscroll */
- size = ro_get_hscroll_height(NULL);
- size -= 2; /* 1px border on both sides */
- if (!no_hscroll) {
- if (!(state.flags & wimp_WINDOW_HSCROLL)) {
- height -= size;
- state.visible.y0 += size;
- if (have_content) {
- browser_window_schedule_reformat(g->bw);
- }
- }
- state.flags |= wimp_WINDOW_HSCROLL;
- } else {
- if (state.flags & wimp_WINDOW_HSCROLL) {
- height += size;
- state.visible.y0 -= size;
- if (have_content) {
- browser_window_schedule_reformat(g->bw);
- }
- }
- state.flags &= ~wimp_WINDOW_HSCROLL;
+ case TOOLBAR_BUTTON_PRINT:
+ ro_gui_window_action_print(g);
+ break;
+
+ case TOOLBAR_BUTTON_UP:
+ err = browser_window_navigate_up(g->bw, false);
+ if (err != NSERROR_OK) {
+ ro_warn_user(messages_get_errorcode(err), NULL);
}
+ break;
- /* vscroll */
- size = ro_get_vscroll_width(NULL);
- size -= 2; /* 1px border on both sides */
- if (!no_vscroll) {
- if (!(state.flags & wimp_WINDOW_VSCROLL)) {
- width -= size;
- state.visible.x1 -= size;
- if (have_content) {
- browser_window_schedule_reformat(g->bw);
- }
- }
- state.flags |= wimp_WINDOW_VSCROLL;
- } else {
- if (state.flags & wimp_WINDOW_VSCROLL) {
- width += size;
- state.visible.x1 += size;
- if (have_content) {
- browser_window_schedule_reformat(g->bw);
- }
- }
- state.flags &= ~wimp_WINDOW_VSCROLL;
+ case TOOLBAR_BUTTON_UP_NEW:
+ err = browser_window_navigate_up(g->bw, true);
+ if (err != NSERROR_OK) {
+ ro_warn_user(messages_get_errorcode(err), NULL);
}
- }
+ break;
- /* reformat or change extent if necessary */
- if (have_content &&
- (g->old_width != width || g->old_height != height)) {
- /* Ctrl-resize of a top-level window scales the content size */
- if ((g->old_width > 0) && (g->old_width != width) &&
- (ro_gui_ctrl_pressed()))
- new_scale = (g->scale * width) / g->old_width;
- browser_window_schedule_reformat(g->bw);
- }
- if (g->update_extent || g->old_width != width ||
- g->old_height != height) {
- g->old_width = width;
- g->old_height = height;
- g->update_extent = false;
- gui_window_set_extent(g, width, height);
+ default:
+ break;
}
- /* first resize stops any flickering by making the URL window on top */
- ro_gui_url_complete_resize(g->toolbar, PTR_WIMP_OPEN(&state));
+ ro_gui_window_update_toolbar_buttons(g);
+}
- /* Windows containing framesets can only be scrolled via the core, which
- * is implementing frame scrollbars itself. The x and y offsets are
- * therefore fixed.
- */
- if (browser_window_is_frameset(g->bw)) {
- state.xscroll = 0;
- state.yscroll = toolbar_height;
- }
+/**
+ * Launch a new url in the given window.
+ *
+ * \param g gui_window to update
+ * \param url1 url to be launched
+ */
+static void ro_gui_window_launch_url(struct gui_window *g, const char *url1)
+{
+ nserror error;
+ nsurl *url;
- error = xwimp_open_window_nested_with_flags(&state, parent, linkage);
- if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
+ if (url1 == NULL)
return;
- }
- /* update the toolbar */
- if (g->status_bar)
- ro_gui_status_bar_resize(g->status_bar);
- if (g->toolbar) {
- ro_toolbar_process(g->toolbar, -1, false);
- /* second resize updates to the new URL bar width */
- ro_gui_url_complete_resize(g->toolbar, open);
- }
+ ro_gui_url_complete_close();
- /* set the new scale from a ctrl-resize. this must be done at the end as
- * it may cause a frameset recalculation based on the new window size.
- */
- if (new_scale > 0) {
- ro_gui_window_set_scale(g, new_scale);
+ error = nsurl_create(url1, &url);
+ if (error != NSERROR_OK) {
+ ro_warn_user(messages_get_errorcode(error), 0);
+ } else {
+ ro_gui_window_set_url(g, url);
+
+ browser_window_navigate(g->bw, url,
+ NULL, BW_NAVIGATE_HISTORY,
+ NULL, NULL, NULL);
+ nsurl_unref(url);
}
}
/**
- * Handle wimp closing event
+ * Open a new browser window.
+ *
+ * \param g The browser window to act on.
*/
-
-void ro_gui_window_close(wimp_w w)
+static void ro_gui_window_action_new_window(struct gui_window *g)
{
- struct gui_window *g = (struct gui_window *)ro_gui_wimp_event_get_user_data(w);
- wimp_pointer pointer;
- os_error *error;
- char *temp_name;
- char *filename = NULL;
- struct nsurl *url;
- bool destroy;
+ nserror error;
- error = xwimp_get_pointer_info(&pointer);
- if (error) {
- LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
+ if (g == NULL || g->bw == NULL)
return;
- }
- if (pointer.buttons & wimp_CLICK_ADJUST) {
- destroy = !ro_gui_shift_pressed();
+ error = browser_window_create(BW_CREATE_CLONE,
+ browser_window_access_url(g->bw),
+ NULL, g->bw, NULL);
- url = browser_window_get_url(g->bw);
- if (url != NULL) {
- netsurf_nsurl_to_path(url, &filename);
- }
- if (filename != NULL) {
- temp_name = malloc(strlen(filename) + 32);
- if (temp_name) {
- char *r;
- sprintf(temp_name, "Filer_OpenDir %s",
- filename);
- r = temp_name + strlen(temp_name);
- while (r > temp_name) {
- if (*r == '.') {
- *r = '\0';
- break;
- }
- r--;
- }
- error = xos_cli(temp_name);
- if (error) {
- LOG("xos_cli: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("MiscError", error->errmess);
- return;
- }
- free(temp_name);
- }
- free(filename);
- } else {
- /* this is pointless if we are about to close the
- * window */
- if (!destroy && url != NULL)
- browser_window_navigate_up(g->bw, false);
- }
+ if (error != NSERROR_OK) {
+ ro_warn_user(messages_get_errorcode(error), 0);
}
- else
- destroy = true;
-
- if (destroy)
- browser_window_destroy(g->bw);
}
/**
- * Handle Mouse_Click events in a browser window. This should never see
- * Menu clicks, as these will be routed to the menu handlers.
+ * Scroll a browser window.
+ *
+ * the scroll is either via the core or directly using the normal
+ * Wimp_OpenWindow interface.
+ *
+ * Scroll steps are supplied in terms of the (extended) Scroll Event direction
+ * values returned by Wimp_Poll. Special values of 0x7fffffff and 0x80000000
+ * are added to mean "Home" and "End".
*
- * \param *pointer details of mouse click
- * \return true if click handled, false otherwise
+ * \param g The GUI Window to be scrolled.
+ * \param scroll_x The X scroll step to be applied.
+ * \param scroll_y The Y scroll step to be applied.
*/
-
-bool ro_gui_window_click(wimp_pointer *pointer)
+static void
+ro_gui_window_scroll_action(struct gui_window *g,
+ wimp_scroll_direction scroll_x,
+ wimp_scroll_direction scroll_y)
{
- struct gui_window *g;
- os_coord pos;
+ int visible_x, visible_y;
+ int step_x = 0, step_y = 0;
+ int toolbar_y;
+ wimp_window_state state;
+ wimp_pointer pointer;
+ os_error *error;
+ os_coord pos;
+ bool handled = false;
+ struct toolbar *toolbar;
- /* We should never see Menu clicks. */
+ if (g == NULL)
+ return;
- if (pointer->buttons == wimp_CLICK_MENU)
- return false;
+ /* Get the current window, toolbar and pointer details. */
- g = (struct gui_window *) ro_gui_wimp_event_get_user_data(pointer->w);
+ state.w = g->window;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
+ return;
+ }
- /* try to close url-completion */
- ro_gui_url_complete_close();
+ toolbar = ro_toolbar_parent_window_lookup(g->window);
+ assert(g == NULL || g->toolbar == NULL || g->toolbar == toolbar);
- /* set input focus */
- if (pointer->buttons & (wimp_SINGLE_SELECT | wimp_SINGLE_ADJUST))
- gui_window_place_caret(g, -100, -100, 0, NULL);
+ toolbar_y = (toolbar == NULL) ? 0 : ro_toolbar_full_height(toolbar);
- if (ro_gui_window_to_window_pos(g, pointer->pos.x, pointer->pos.y, &pos))
- browser_window_mouse_click(g->bw,
- ro_gui_mouse_click_state(pointer->buttons,
- wimp_BUTTON_DOUBLE_CLICK_DRAG),
- pos.x, pos.y);
+ visible_x = state.visible.x1 - state.visible.x0 - 32;
+ visible_y = state.visible.y1 - state.visible.y0 - 32 - toolbar_y;
- return true;
-}
+ error = xwimp_get_pointer_info(&pointer);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info 0x%x : %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return;
+ }
+ /* Turn the scroll requirement from Scroll Event codes into coordinates
+ * that the core can understand.
+ */
-/**
- * Process Key_Pressed events in a browser window.
- *
- * \param *key The wimp keypress block for the event.
- * \return true if the event was handled, else false.
- */
+ switch (scroll_x) {
+ case wimp_SCROLL_PAGE_LEFT:
+ step_x = SCROLL_PAGE_DOWN;
+ break;
+ case wimp_SCROLL_AUTO_LEFT:
+ case wimp_SCROLL_COLUMN_LEFT:
+ step_x = -16;
+ break;
+ case wimp_SCROLL_AUTO_RIGHT:
+ case wimp_SCROLL_COLUMN_RIGHT:
+ step_x = 16;
+ break;
+ case wimp_SCROLL_PAGE_RIGHT:
+ step_x = SCROLL_PAGE_UP;
+ break;
+ case 0x80000000:
+ step_x = SCROLL_BOTTOM;
+ break;
+ case 0x7fffffff:
+ step_x = SCROLL_TOP;
+ break;
+ default:
+ step_x = (visible_x * (scroll_x>>2)) >> 2;
+ break;
+ }
-bool ro_gui_window_keypress(wimp_key *key)
-{
- struct gui_window *g;
- uint32_t c = (uint32_t) key->c;
+ switch (scroll_y) {
+ case wimp_SCROLL_PAGE_UP:
+ step_y = SCROLL_PAGE_UP;
+ break;
+ case wimp_SCROLL_AUTO_UP:
+ case wimp_SCROLL_LINE_UP:
+ step_y = -16;
+ break;
+ case wimp_SCROLL_AUTO_DOWN:
+ case wimp_SCROLL_LINE_DOWN:
+ step_y = 16;
+ break;
+ case wimp_SCROLL_PAGE_DOWN:
+ step_y = SCROLL_PAGE_DOWN;
+ break;
+ case 0x80000000:
+ step_y = SCROLL_BOTTOM;
+ break;
+ case 0x7fffffff:
+ step_y = SCROLL_TOP;
+ break;
+ default:
+ step_y = -((visible_y * (scroll_y>>2)) >> 2);
+ break;
+ }
- g = (struct gui_window *) ro_gui_wimp_event_get_user_data(key->w);
- if (g == NULL)
- return false;
+ /* If no scrolling is required, there's no point trying to do any. */
- /* First send the key to the browser window, eg. form fields. */
+ if (step_x == 0 && step_y == 0)
+ return;
- if ((unsigned)c < 0x20 || (0x7f <= c && c <= 0x9f) ||
- (c & IS_WIMP_KEY)) {
- /* Munge control keys into unused control chars */
- /* We can't map onto 1->26 (reserved for ctrl+<qwerty>
- That leaves 27->31 and 128->159 */
- switch (c & ~IS_WIMP_KEY) {
- case wimp_KEY_TAB: c = 9; break;
- case wimp_KEY_SHIFT | wimp_KEY_TAB: c = 11; break;
+ /* If the pointer is over the window being scrolled, then try to get
+ * the core to do the scrolling on the object under the pointer.
+ */
- /* cursor movement keys */
- case wimp_KEY_HOME:
- case wimp_KEY_CONTROL | wimp_KEY_LEFT:
- c = NS_KEY_LINE_START;
+ if (pointer.w == g->window &&
+ ro_gui_window_to_window_pos(g,
+ pointer.pos.x, pointer.pos.y, &pos))
+ handled = browser_window_scroll_at_point(g->bw, pos.x, pos.y,
+ step_x, step_y);
+
+ /* If the core didn't do the scrolling, handle it via the Wimp.
+ * Windows which contain frames can only be scrolled by the core,
+ * because it implements frame scroll bars.
+ */
+
+ if (!handled && (browser_window_is_frameset(g->bw) == false)) {
+ switch (step_x) {
+ case SCROLL_TOP:
+ state.xscroll -= 0x10000000;
break;
- case wimp_KEY_END:
- if (os_version >= RISCOS5)
- c = NS_KEY_LINE_END;
- else
- c = NS_KEY_DELETE_RIGHT;
+ case SCROLL_BOTTOM:
+ state.xscroll += 0x10000000;
break;
- case wimp_KEY_CONTROL | wimp_KEY_RIGHT: c = NS_KEY_LINE_END; break;
- case wimp_KEY_CONTROL | wimp_KEY_UP: c = NS_KEY_TEXT_START; break;
- case wimp_KEY_CONTROL | wimp_KEY_DOWN: c = NS_KEY_TEXT_END; break;
- case wimp_KEY_SHIFT | wimp_KEY_LEFT: c = NS_KEY_WORD_LEFT ; break;
- case wimp_KEY_SHIFT | wimp_KEY_RIGHT: c = NS_KEY_WORD_RIGHT; break;
- case wimp_KEY_SHIFT | wimp_KEY_UP: c = NS_KEY_PAGE_UP; break;
- case wimp_KEY_SHIFT | wimp_KEY_DOWN: c = NS_KEY_PAGE_DOWN; break;
- case wimp_KEY_LEFT: c = NS_KEY_LEFT; break;
- case wimp_KEY_RIGHT: c = NS_KEY_RIGHT; break;
- case wimp_KEY_UP: c = NS_KEY_UP; break;
- case wimp_KEY_DOWN: c = NS_KEY_DOWN; break;
-
- /* editing */
- case wimp_KEY_CONTROL | wimp_KEY_END:
- c = NS_KEY_DELETE_LINE_END;
+ case SCROLL_PAGE_UP:
+ state.xscroll += visible_x;
break;
- case wimp_KEY_DELETE:
- if (ro_gui_ctrl_pressed())
- c = NS_KEY_DELETE_LINE_START;
- else if (os_version < RISCOS5)
- c = NS_KEY_DELETE_LEFT;
+ case SCROLL_PAGE_DOWN:
+ state.xscroll -= visible_x;
break;
+ default:
+ state.xscroll += 2 * step_x;
+ break;
+ }
- case wimp_KEY_F8:
- c = NS_KEY_UNDO;
+ switch (step_y) {
+ case SCROLL_TOP:
+ state.yscroll += 0x10000000;
break;
- case wimp_KEY_F9:
- c = NS_KEY_REDO;
+ case SCROLL_BOTTOM:
+ state.yscroll -= 0x10000000;
+ break;
+ case SCROLL_PAGE_UP:
+ state.yscroll += visible_y;
+ break;
+ case SCROLL_PAGE_DOWN:
+ state.yscroll -= visible_y;
break;
-
default:
+ state.yscroll -= 2 * step_y;
break;
}
- }
- if (!(c & IS_WIMP_KEY)) {
- if (browser_window_key_press(g->bw, c))
- return true;
+ error = xwimp_open_window((wimp_open *) &state);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
+ error->errnum, error->errmess);
+ }
}
-
- return ro_gui_window_handle_local_keypress(g, key, false);
}
/**
- * Callback handler for keypresses within browser window toolbars.
+ * Handle keypresses within the RISC OS GUI
*
- * \param *data Client data, pointing to the GUI Window.
- * \param *key The keypress data.
- * \return true if the keypress was handled; else false.
- */
-
-bool ro_gui_window_toolbar_keypress(void *data, wimp_key *key)
-{
- struct gui_window *g = (struct gui_window *) data;
-
- if (g != NULL)
- return ro_gui_window_handle_local_keypress(g, key, true);
-
- return false;
-}
-
-
-/**
- * Handle keypresses within the RISC OS GUI: this is to be called after the
- * core has been given a chance to act, or on keypresses in the toolbar where
- * the core doesn't get involved.
+ * this is to be called after the core has been given a chance to act,
+ * or on keypresses in the toolbar where the core doesn't get
+ * involved.
*
- * \param *g The gui window to which the keypress applies.
- * \param *key The keypress data.
- * \param is_toolbar true if the keypress is from a toolbar;
- * else false.
- * \return true if the keypress was claimed; else false.
+ * \param *g The gui window to which the keypress applies.
+ * \param *key The keypress data.
+ * \param is_toolbar true if the keypress is from a toolbar else false.
+ * \return true if the keypress was claimed; else false.
*/
-
-bool ro_gui_window_handle_local_keypress(struct gui_window *g, wimp_key *key,
- bool is_toolbar)
+static bool
+ro_gui_window_handle_local_keypress(struct gui_window *g,
+ wimp_key *key,
+ bool is_toolbar)
{
struct browser_window_features cont;
os_error *ro_error;
@@ -1862,7 +1240,8 @@ bool ro_gui_window_handle_local_keypress(struct gui_window *g, wimp_key *key,
ro_error = xwimp_get_pointer_info(&pointer);
if (ro_error) {
- LOG("xwimp_get_pointer_info: 0x%x: %s\n", ro_error->errnum, ro_error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s\n",
+ ro_error->errnum, ro_error->errmess);
ro_warn_user("WimpError", ro_error->errmess);
return false;
}
@@ -1983,7 +1362,7 @@ bool ro_gui_window_handle_local_keypress(struct gui_window *g, wimp_key *key,
/* Toggle display of box outlines. */
browser_window_debug(g->bw, CONTENT_DEBUG_REDRAW);
- gui_window_redraw_window(g);
+ ro_gui_window_invalidate_area(g, NULL);
return true;
case wimp_KEY_RETURN:
@@ -2108,18 +1487,648 @@ bool ro_gui_window_handle_local_keypress(struct gui_window *g, wimp_key *key,
/**
- * Prepare the browser window menu for (re-)opening
+ * Callback handler for keypresses within browser window toolbars.
+ *
+ * \param data Client data, pointing to the GUI Window.
+ * \param key The keypress data.
+ * \return true if the keypress was handled; else false.
+ */
+static bool ro_gui_window_toolbar_keypress(void *data, wimp_key *key)
+{
+ struct gui_window *g = (struct gui_window *) data;
+
+ if (g != NULL) {
+ return ro_gui_window_handle_local_keypress(g, key, true);
+ }
+
+ return false;
+}
+
+
+/**
+ * Save a new toolbar button configuration
+ *
+ * used as a callback by the toolbar module when a buttonbar edit has
+ * finished.
+ *
+ * \param data void pointer to the window's gui_window struct
+ * \param config pointer to a malloc()'d button config string.
+ */
+static void ro_gui_window_save_toolbar_buttons(void *data, char *config)
+{
+ nsoption_set_charp(toolbar_browser, config);
+ ro_gui_save_options();
+}
+
+
+/**
+ * toolbar callbacks for a browser window.
+ */
+static const struct toolbar_callbacks ro_gui_window_toolbar_callbacks = {
+ ro_gui_window_update_theme,
+ ro_gui_window_update_toolbar,
+ (void (*)(void *)) ro_gui_window_update_toolbar_buttons,
+ ro_gui_window_toolbar_click,
+ ro_gui_window_toolbar_keypress,
+ ro_gui_window_save_toolbar_buttons
+};
+
+
+/**
+ * Handle wimp closing event
+ *
+ * \param w The window handle the event occoured on
+ */
+static void ro_gui_window_close(wimp_w w)
+{
+ struct gui_window *g;
+ wimp_pointer pointer;
+ os_error *error;
+ char *temp_name;
+ char *filename = NULL;
+ struct nsurl *url;
+ bool destroy;
+
+ error = xwimp_get_pointer_info(&pointer);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return;
+ }
+
+ g = (struct gui_window *)ro_gui_wimp_event_get_user_data(w);
+
+ if (pointer.buttons & wimp_CLICK_ADJUST) {
+ destroy = !ro_gui_shift_pressed();
+
+ url = browser_window_access_url(g->bw);
+ if (url != NULL) {
+ netsurf_nsurl_to_path(url, &filename);
+ }
+ if (filename != NULL) {
+ temp_name = malloc(strlen(filename) + 32);
+ if (temp_name) {
+ char *r;
+ sprintf(temp_name, "Filer_OpenDir %s",
+ filename);
+ r = temp_name + strlen(temp_name);
+ while (r > temp_name) {
+ if (*r == '.') {
+ *r = '\0';
+ break;
+ }
+ r--;
+ }
+ error = xos_cli(temp_name);
+ if (error) {
+ NSLOG(netsurf, INFO,
+ "xos_cli: 0x%x: %s",
+ error->errnum,
+ error->errmess);
+ ro_warn_user("MiscError", error->errmess);
+ return;
+ }
+ free(temp_name);
+ }
+ free(filename);
+ } else {
+ /* this is pointless if we are about to close the
+ * window */
+ if (!destroy && url != NULL)
+ browser_window_navigate_up(g->bw, false);
+ }
+ } else {
+ destroy = true;
+ }
+
+ if (destroy) {
+ browser_window_destroy(g->bw);
+ }
+}
+
+
+/**
+ * Handle a Redraw_Window_Request for a browser window.
+ *
+ * \param redraw The redraw event
+ */
+static void ro_gui_window_redraw(wimp_draw *redraw)
+{
+ osbool more;
+ struct gui_window *g;
+ os_error *error;
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &ro_plotters
+ };
+
+ g = (struct gui_window *)ro_gui_wimp_event_get_user_data(redraw->w);
+
+ /* We cannot render locked contents. If the browser window is not
+ * ready for redraw, do nothing. Else, in the case of buffered
+ * rendering we'll show random data. */
+ if (!browser_window_redraw_ready(g->bw)) {
+ return;
+ }
+
+ ro_gui_current_redraw_gui = g;
+
+ error = xwimp_redraw_window(redraw, &more);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return;
+ }
+ while (more) {
+ struct rect clip;
+
+ /* OS's redraw request coordinates are in screen coordinates,
+ * with an origin at the bottom left of the screen.
+ * Find the coordinate of the top left of the document in terms
+ * of OS screen coordinates.
+ * NOTE: OS units are 2 per px. */
+ ro_plot_origin_x = redraw->box.x0 - redraw->xscroll;
+ ro_plot_origin_y = redraw->box.y1 - redraw->yscroll;
+
+ /* Convert OS redraw rectangle request coordinates into NetSurf
+ * coordinates. NetSurf coordinates have origin at top left of
+ * document and units are in px. */
+ clip.x0 = (redraw->clip.x0 - ro_plot_origin_x) / 2; /* left */
+ clip.y0 = (ro_plot_origin_y - redraw->clip.y1) / 2; /* top */
+ clip.x1 = (redraw->clip.x1 - ro_plot_origin_x) / 2; /* right */
+ clip.y1 = (ro_plot_origin_y - redraw->clip.y0) / 2; /* bottom */
+
+ if (ro_gui_current_redraw_gui->option.buffer_everything)
+ ro_gui_buffer_open(redraw);
+
+ browser_window_redraw(g->bw, 0, 0, &clip, &ctx);
+
+ if (ro_gui_current_redraw_gui->option.buffer_everything)
+ ro_gui_buffer_close();
+
+ /* Check to see if there are more rectangles to draw and
+ * get next one */
+ error = xwimp_get_rectangle(redraw, &more);
+ /* RISC OS 3.7 returns an error here if enough buffer was
+ claimed to cause a new dynamic area to be created. It
+ doesn't actually stop anything working, so we mask it out
+ for now until a better fix is found. This appears to be a
+ bug in RISC OS. */
+ if (error && !(ro_gui_current_redraw_gui->
+ option.buffer_everything &&
+ error->errnum == error_WIMP_GET_RECT)) {
+ NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ ro_gui_current_redraw_gui = NULL;
+ return;
+ }
+ }
+ ro_gui_current_redraw_gui = NULL;
+}
+
+
+/**
+ * Process Scroll_Request events in a browser window.
+ *
+ * \param scroll The wimp scroll event data block.
+ */
+static void ro_gui_window_scroll(wimp_scroll *scroll)
+{
+ struct gui_window *g = ro_gui_window_lookup(scroll->w);
+
+ if (g && browser_window_has_content(g->bw) && ro_gui_shift_pressed()) {
+ /* extended scroll request with shift held down; change zoom */
+ float scale, inc;
+
+ if (scroll->ymin & 3)
+ inc = 0.02; /* RO5 sends the msg 5 times;
+ * don't ask me why
+ *
+ * @todo this is liable to break if
+ * HID is configured optimally for
+ * frame scrolling. *5 appears to be
+ * an artifact of non-HID mode scrolling.
+ */
+ else
+ inc = (1 << (ABS(scroll->ymin)>>2)) / 20.0F;
+
+ if (scroll->ymin > 0) {
+ scale = g->scale + inc;
+ if (scale > scale_snap_to[SCALE_SNAP_TO_SIZE - 1])
+ scale = scale_snap_to[SCALE_SNAP_TO_SIZE - 1];
+ } else {
+ scale = g->scale - inc;
+ if (scale < scale_snap_to[0])
+ scale = scale_snap_to[0];
+ }
+ if (g->scale != scale)
+ ro_gui_window_set_scale(g, scale);
+ } else if (g != NULL) {
+ ro_gui_window_scroll_action(g, scroll->xmin, scroll->ymin);
+ }
+}
+
+
+/**
+ * Process Pointer Leaving Window events in a browser window.
+ *
+ * These arrive via the termination callback handler from ro_mouse's
+ * mouse tracking.
+ *
+ * \param leaving The wimp pointer leaving event data block.
+ * \param data The GUI window that the pointer is leaving.
+ */
+static void ro_gui_window_track_end(wimp_leaving *leaving, void *data)
+{
+ struct gui_window *g = (struct gui_window *)data;
+
+ if (g != NULL) {
+ gui_window_set_pointer(g, GUI_POINTER_DEFAULT);
+ }
+}
+
+
+/**
+ * Process Pointer Entering Window events in a browser window.
+ *
+ * \param entering The wimp pointer entering event data block.
+ */
+static void ro_gui_window_pointer_entering(wimp_entering *entering)
+{
+ struct gui_window *g = ro_gui_window_lookup(entering->w);
+
+ if (g != NULL) {
+ ro_mouse_track_start(ro_gui_window_track_end,
+ ro_gui_window_mouse_at,
+ g);
+ }
+}
+
+
+/**
+ * Process Key_Pressed events in a browser window.
+ *
+ * \param key The wimp keypress block for the event.
+ * \return true if the event was handled, else false.
+ */
+static bool ro_gui_window_keypress(wimp_key *key)
+{
+ struct gui_window *g;
+ uint32_t c = (uint32_t) key->c;
+
+ g = (struct gui_window *) ro_gui_wimp_event_get_user_data(key->w);
+ if (g == NULL) {
+ return false;
+ }
+
+ /* First send the key to the browser window, eg. form fields. */
+
+ if ((unsigned)c < 0x20 ||
+ (0x7f <= c && c <= 0x9f) ||
+ (c & IS_WIMP_KEY)) {
+ /* Munge control keys into unused control chars */
+ /* We can't map onto 1->26 (reserved for ctrl+<qwerty>
+ That leaves 27->31 and 128->159 */
+ switch (c & ~IS_WIMP_KEY) {
+ case wimp_KEY_TAB:
+ c = 9;
+ break;
+
+ case wimp_KEY_SHIFT | wimp_KEY_TAB:
+ c = 11;
+ break;
+
+ /* cursor movement keys */
+ case wimp_KEY_HOME:
+ case wimp_KEY_CONTROL | wimp_KEY_LEFT:
+ c = NS_KEY_LINE_START;
+ break;
+
+ case wimp_KEY_END:
+ if (os_version >= RISCOS5) {
+ c = NS_KEY_LINE_END;
+ } else {
+ c = NS_KEY_DELETE_RIGHT;
+ }
+ break;
+
+ case wimp_KEY_CONTROL | wimp_KEY_RIGHT:
+ c = NS_KEY_LINE_END;
+ break;
+
+ case wimp_KEY_CONTROL | wimp_KEY_UP:
+ c = NS_KEY_TEXT_START;
+ break;
+
+ case wimp_KEY_CONTROL | wimp_KEY_DOWN:
+ c = NS_KEY_TEXT_END;
+ break;
+
+ case wimp_KEY_SHIFT | wimp_KEY_LEFT:
+ c = NS_KEY_WORD_LEFT ;
+ break;
+
+ case wimp_KEY_SHIFT | wimp_KEY_RIGHT:
+ c = NS_KEY_WORD_RIGHT;
+ break;
+
+ case wimp_KEY_SHIFT | wimp_KEY_UP:
+ c = NS_KEY_PAGE_UP;
+ break;
+
+ case wimp_KEY_SHIFT | wimp_KEY_DOWN:
+ c = NS_KEY_PAGE_DOWN;
+ break;
+
+ case wimp_KEY_LEFT:
+ c = NS_KEY_LEFT;
+ break;
+
+ case wimp_KEY_RIGHT:
+ c = NS_KEY_RIGHT;
+ break;
+
+ case wimp_KEY_UP:
+ c = NS_KEY_UP;
+ break;
+
+ case wimp_KEY_DOWN:
+ c = NS_KEY_DOWN;
+ break;
+
+ /* editing */
+ case wimp_KEY_CONTROL | wimp_KEY_END:
+ c = NS_KEY_DELETE_LINE_END;
+ break;
+
+ case wimp_KEY_DELETE:
+ if (ro_gui_ctrl_pressed()) {
+ c = NS_KEY_DELETE_LINE_START;
+ } else if (os_version < RISCOS5) {
+ c = NS_KEY_DELETE_LEFT;
+ }
+ break;
+
+ case wimp_KEY_F8:
+ c = NS_KEY_UNDO;
+ break;
+
+ case wimp_KEY_F9:
+ c = NS_KEY_REDO;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (!(c & IS_WIMP_KEY)) {
+ if (browser_window_key_press(g->bw, c)) {
+ return true;
+ }
+ }
+
+ return ro_gui_window_handle_local_keypress(g, key, false);
+}
+
+
+/**
+ * Handle Mouse_Click events in a browser window.
+ *
+ * This should never see Menu clicks, as these will be routed to the
+ * menu handlers.
+ *
+ * \param pointer details of mouse click
+ * \return true if click handled, false otherwise
+ */
+static bool ro_gui_window_click(wimp_pointer *pointer)
+{
+ struct gui_window *g;
+ os_coord pos;
+
+ /* We should never see Menu clicks. */
+
+ if (pointer->buttons == wimp_CLICK_MENU) {
+ return false;
+ }
+
+ g = (struct gui_window *) ro_gui_wimp_event_get_user_data(pointer->w);
+
+ /* try to close url-completion */
+ ro_gui_url_complete_close();
+
+ /* set input focus */
+ if (pointer->buttons & (wimp_SINGLE_SELECT | wimp_SINGLE_ADJUST))
+ gui_window_place_caret(g, -100, -100, 0, NULL);
+
+ if (ro_gui_window_to_window_pos(g, pointer->pos.x, pointer->pos.y, &pos)) {
+ browser_window_mouse_click(g->bw,
+ ro_gui_mouse_click_state(pointer->buttons,
+ wimp_BUTTON_DOUBLE_CLICK_DRAG),
+ pos.x, pos.y);
+ }
+
+ return true;
+}
+
+
+/**
+ * Prepare or reprepare a form select menu
+ *
+ * setting up the menu handle globals in the process.
+ *
+ * \param g The RISC OS gui window the menu is in.
+ * \param control The form control needing a menu.
+ * \return true if the menu is OK to be opened; else false.
+ */
+static bool
+ro_gui_window_prepare_form_select_menu(struct gui_window *g,
+ struct form_control *control)
+{
+ unsigned int item, entries;
+ char *text_convert, *temp;
+ struct form_option *option;
+ bool reopen = true;
+ nserror err;
+
+ assert(control);
+
+ /* enumerate the entries */
+ entries = 0;
+ option = form_select_get_option(control, entries);
+ while (option != NULL) {
+ entries++;
+ option = form_select_get_option(control, entries);
+ }
+
+ if (entries == 0) {
+ /* no menu to display */
+ ro_gui_menu_destroy();
+ return false;
+ }
+
+ /* free riscos menu if there already is one */
+ if ((gui_form_select_menu) && (control != gui_form_select_control)) {
+ for (item = 0; ; item++) {
+ free(gui_form_select_menu->entries[item].data.
+ indirected_text.text);
+ if (gui_form_select_menu->entries[item].menu_flags &
+ wimp_MENU_LAST)
+ break;
+ }
+ free(gui_form_select_menu->title_data.indirected_text.text);
+ free(gui_form_select_menu);
+ gui_form_select_menu = 0;
+ }
+
+ /* allocate new riscos menu */
+ if (!gui_form_select_menu) {
+ reopen = false;
+ gui_form_select_menu = malloc(wimp_SIZEOF_MENU(entries));
+ if (!gui_form_select_menu) {
+ ro_warn_user("NoMemory", 0);
+ ro_gui_menu_destroy();
+ return false;
+ }
+ err = utf8_to_local_encoding(messages_get("SelectMenu"), 0,
+ &text_convert);
+ if (err != NSERROR_OK) {
+ /* badenc should never happen */
+ assert(err != NSERROR_BAD_ENCODING);
+ NSLOG(netsurf, INFO, "utf8_to_local_encoding failed");
+ ro_warn_user("NoMemory", 0);
+ ro_gui_menu_destroy();
+ return false;
+ }
+ gui_form_select_menu->title_data.indirected_text.text =
+ text_convert;
+ ro_gui_menu_init_structure(gui_form_select_menu, entries);
+ }
+
+ /* initialise menu entries from form control */
+ for (item = 0; item < entries; item++) {
+ option = form_select_get_option(control, item);
+ gui_form_select_menu->entries[item].menu_flags = 0;
+ if (option->selected)
+ gui_form_select_menu->entries[item].menu_flags =
+ wimp_MENU_TICKED;
+ if (!reopen) {
+
+ /* convert spaces to hard spaces to stop things
+ * like 'Go Home' being treated as if 'Home' is a
+ * keyboard shortcut and right aligned in the menu.
+ */
+
+ temp = cnv_space2nbsp(option->text);
+ if (!temp) {
+ NSLOG(netsurf, INFO, "cnv_space2nbsp failed");
+ ro_warn_user("NoMemory", 0);
+ ro_gui_menu_destroy();
+ return false;
+ }
+
+ err = utf8_to_local_encoding(temp,
+ 0, &text_convert);
+ if (err != NSERROR_OK) {
+ /* A bad encoding should never happen,
+ * so assert this */
+ assert(err != NSERROR_BAD_ENCODING);
+ NSLOG(netsurf, INFO, "utf8_to_enc failed");
+ ro_warn_user("NoMemory", 0);
+ ro_gui_menu_destroy();
+ return false;
+ }
+
+ free(temp);
+
+ gui_form_select_menu->entries[item].data.indirected_text.text =
+ text_convert;
+ gui_form_select_menu->entries[item].data.indirected_text.size =
+ strlen(gui_form_select_menu->entries[item].
+ data.indirected_text.text) + 1;
+ }
+ }
+
+ gui_form_select_menu->entries[0].menu_flags |=
+ wimp_MENU_TITLE_INDIRECTED;
+ gui_form_select_menu->entries[item - 1].menu_flags |= wimp_MENU_LAST;
+
+ return true;
+}
+
+
+/**
+ * Return boolean flags to show what RISC OS types we can sensibly convert
+ * the given object into.
+ *
+ * \todo This should probably be somewhere else but in window.c, and
+ * should probably even be done in content_().
*
- * \param w The window owning the menu.
- * \param i The icon owning the menu.
- * \param *menu The menu about to be opened.
- * \param *pointer Pointer to the relevant wimp event block, or
- * NULL for an Adjust click.
- * \return true if the event was handled; else false.
+ * \param h The object to test.
+ * \param export_draw true on exit if a drawfile would be possible.
+ * \param export_sprite true on exit if a sprite would be possible.
+ * \return true if valid data is returned; else false.
*/
+static bool
+ro_gui_window_content_export_types(struct hlcache_handle *h,
+ bool *export_draw,
+ bool *export_sprite)
+{
+ bool found_type = false;
-bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
- wimp_pointer *pointer)
+ if (export_draw != NULL) {
+ *export_draw = false;
+ }
+ if (export_sprite != NULL) {
+ *export_sprite = false;
+ }
+
+ if (h != NULL && content_get_type(h) == CONTENT_IMAGE) {
+ switch (ro_content_native_type(h)) {
+ case osfile_TYPE_SPRITE:
+ /* bitmap types (Sprite export possible) */
+ found_type = true;
+ if (export_sprite != NULL) {
+ *export_sprite = true;
+ }
+ break;
+
+ case osfile_TYPE_DRAW:
+ /* vector types (Draw export possible) */
+ found_type = true;
+ if (export_draw != NULL) {
+ *export_draw = true;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return found_type;
+}
+
+
+/**
+ * Prepare the browser window menu for (re-)opening
+ *
+ * \param w The window owning the menu.
+ * \param i The icon owning the menu.
+ * \param menu The menu about to be opened.
+ * \param pointer Pointer to the relevant wimp event block, or
+ * NULL for an Adjust click.
+ * \return true if the event was handled; else false.
+ */
+static bool
+ro_gui_window_menu_prepare(wimp_w w,
+ wimp_i i,
+ wimp_menu *menu,
+ wimp_pointer *pointer)
{
struct gui_window *g;
struct browser_window *bw;
@@ -2144,13 +2153,13 @@ bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
gui_form_select_control);
}
- if (menu != ro_gui_browser_window_menu)
+ if (menu != ro_gui_browser_window_menu) {
return false;
+ }
/* If this is a new opening for the browser window menu (ie. not for a
* toolbar menu), get details of the object under the pointer.
*/
-
if (pointer != NULL && g->window == w) {
ro_gui_url_complete_close();
@@ -2261,13 +2270,14 @@ bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
ro_gui_menu_set_entry_shaded(menu, BROWSER_OBJECT_SAVE_URL_TEXT,
current_menu_object == NULL);
- if (current_menu_object != NULL)
+ if (current_menu_object != NULL) {
ro_gui_window_content_export_types(current_menu_object,
&export_draw, &export_sprite);
- else
+ } else {
ro_gui_window_content_export_types(
browser_window_get_content(bw),
&export_draw, &export_sprite);
+ }
ro_gui_menu_set_entry_shaded(menu, BROWSER_OBJECT_EXPORT,
(!have_content && current_menu_object == NULL)
@@ -2325,14 +2335,15 @@ bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
/* View Submenu */
ro_gui_menu_set_entry_ticked(menu, BROWSER_IMAGES_FOREGROUND,
- g != NULL && nsoption_bool(foreground_images));
+ g != NULL && nsoption_bool(foreground_images));
ro_gui_menu_set_entry_ticked(menu, BROWSER_IMAGES_BACKGROUND,
- g != NULL && nsoption_bool(background_images));
+ g != NULL && nsoption_bool(background_images));
ro_gui_menu_set_entry_shaded(menu, BROWSER_BUFFER_ANIMS,
g == NULL || g->option.buffer_everything);
- ro_gui_menu_set_entry_ticked(menu, BROWSER_BUFFER_ANIMS, g != NULL &&
+ ro_gui_menu_set_entry_ticked(menu, BROWSER_BUFFER_ANIMS,
+ g != NULL &&
(g->option.buffer_animations ||
g->option.buffer_everything));
@@ -2343,16 +2354,16 @@ bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
ro_gui_menu_set_entry_shaded(menu, BROWSER_SCALE_VIEW, !have_content);
ro_gui_menu_set_entry_shaded(menu, BROWSER_WINDOW_STAGGER,
- nsoption_int(window_screen_width) == 0);
+ nsoption_int(window_screen_width) == 0);
ro_gui_menu_set_entry_ticked(menu, BROWSER_WINDOW_STAGGER,
- ((nsoption_int(window_screen_width) == 0) ||
- nsoption_bool(window_stagger)));
+ ((nsoption_int(window_screen_width) == 0) ||
+ nsoption_bool(window_stagger)));
ro_gui_menu_set_entry_ticked(menu, BROWSER_WINDOW_COPY,
- nsoption_bool(window_size_clone));
+ nsoption_bool(window_size_clone));
ro_gui_menu_set_entry_shaded(menu, BROWSER_WINDOW_RESET,
- nsoption_int(window_screen_width) == 0);
+ nsoption_int(window_screen_width) == 0);
/* Utilities Submenu */
@@ -2376,199 +2387,72 @@ bool ro_gui_window_menu_prepare(wimp_w w, wimp_i i, wimp_menu *menu,
/**
- * Handle submenu warnings for a browser window menu
+ * Process selections from a form select menu, passing them back to the core.
*
- * \param w The window owning the menu.
- * \param i The icon owning the menu.
- * \param *menu The menu to which the warning applies.
- * \param *selection The wimp menu selection data.
- * \param action The selected menu action.
+ * \param g The browser window affected by the menu.
+ * \param selection The menu selection.
*/
-
-void ro_gui_window_menu_warning(wimp_w w, wimp_i i, wimp_menu *menu,
- wimp_selection *selection, menu_action action)
+static void
+ro_gui_window_process_form_select_menu(struct gui_window *g,
+ wimp_selection *selection)
{
- struct gui_window *g;
- struct hlcache_handle *h;
- bool export;
-
- if (menu != ro_gui_browser_window_menu)
- return;
-
- g = (struct gui_window *) ro_gui_wimp_event_get_user_data(w);
- h = browser_window_get_content(g->bw);
-
- switch (action) {
- case BROWSER_PAGE_INFO:
- if (h != NULL)
- ro_gui_window_prepare_pageinfo(g);
- break;
-
- case BROWSER_FIND_TEXT:
- if (h != NULL && (content_get_type(h) == CONTENT_HTML ||
- content_get_type(h) == CONTENT_TEXTPLAIN))
- ro_gui_search_prepare(g->bw);
- break;
-
- case BROWSER_SCALE_VIEW:
- if (h != NULL)
- ro_gui_dialog_prepare_zoom(g);
- break;
-
- case BROWSER_PRINT:
- if (h != NULL)
- ro_gui_print_prepare(g);
- break;
-
- case BROWSER_OBJECT_INFO:
- if (current_menu_object != NULL)
- ro_gui_window_prepare_objectinfo(current_menu_object,
- current_menu_url);
- break;
-
- case BROWSER_OBJECT_SAVE:
- if (current_menu_object != NULL)
- ro_gui_save_prepare(GUI_SAVE_OBJECT_ORIG,
- current_menu_object, NULL, NULL, NULL);
- break;
-
- case BROWSER_SELECTION_SAVE:
- if (browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_COPY)
- ro_gui_save_prepare(GUI_SAVE_TEXT_SELECTION, NULL,
- browser_window_get_selection(g->bw),
- NULL, NULL);
- break;
-
- case BROWSER_SAVE_URL_URI:
- if (h != NULL)
- ro_gui_save_prepare(GUI_SAVE_LINK_URI, NULL, NULL,
- hlcache_handle_get_url(h),
- content_get_title(h));
- break;
-
- case BROWSER_SAVE_URL_URL:
- if (h != NULL)
- ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL,
- hlcache_handle_get_url(h),
- content_get_title(h));
- break;
-
- case BROWSER_SAVE_URL_TEXT:
- if (h != NULL)
- ro_gui_save_prepare(GUI_SAVE_LINK_TEXT, NULL, NULL,
- hlcache_handle_get_url(h),
- content_get_title(h));
- break;
-
- case BROWSER_OBJECT_SAVE_URL_URI:
- if (current_menu_object != NULL)
- ro_gui_save_prepare(GUI_SAVE_LINK_URI, NULL, NULL,
- hlcache_handle_get_url(
- current_menu_object),
- content_get_title(current_menu_object));
- break;
-
- case BROWSER_OBJECT_SAVE_URL_URL:
- if (current_menu_object != NULL)
- ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL,
- hlcache_handle_get_url(
- current_menu_object),
- content_get_title(current_menu_object));
- break;
-
- case BROWSER_OBJECT_SAVE_URL_TEXT:
- if (current_menu_object != NULL)
- ro_gui_save_prepare(GUI_SAVE_LINK_TEXT, NULL, NULL,
- hlcache_handle_get_url(
- current_menu_object),
- content_get_title(current_menu_object));
- break;
-
- case BROWSER_SAVE:
- if (h != NULL)
- ro_gui_save_prepare(GUI_SAVE_SOURCE, h, NULL, NULL, NULL);
- break;
-
- case BROWSER_SAVE_COMPLETE:
- if (h != NULL)
- ro_gui_save_prepare(GUI_SAVE_COMPLETE, h, NULL, NULL, NULL);
- break;
-
- case BROWSER_EXPORT_DRAW:
- if (h != NULL)
- ro_gui_save_prepare(GUI_SAVE_DRAW, h, NULL, NULL, NULL);
- break;
-
- case BROWSER_EXPORT_PDF:
- if (h != NULL)
- ro_gui_save_prepare(GUI_SAVE_PDF, h, NULL, NULL, NULL);
- break;
-
- case BROWSER_EXPORT_TEXT:
- if (h != NULL)
- ro_gui_save_prepare(GUI_SAVE_TEXT, h, NULL, NULL, NULL);
- break;
-
- case BROWSER_LINK_SAVE_URI:
- if (current_menu_url != NULL)
- ro_gui_save_prepare(GUI_SAVE_LINK_URI, NULL, NULL,
- current_menu_url, NULL);
- break;
-
- case BROWSER_LINK_SAVE_URL:
- if (current_menu_url != NULL)
- ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL,
- current_menu_url, NULL);
- break;
+ assert(g != NULL);
- case BROWSER_LINK_SAVE_TEXT:
- if (current_menu_url != NULL)
- ro_gui_save_prepare(GUI_SAVE_LINK_TEXT, NULL, NULL,
- current_menu_url, NULL);
- break;
+ if (selection->items[0] >= 0) {
+ form_select_process_selection(gui_form_select_control,
+ selection->items[0]);
+ }
+}
- case BROWSER_OBJECT_EXPORT_SPRITE:
- if (current_menu_object != NULL) {
- ro_gui_window_content_export_types(current_menu_object,
- NULL, &export);
- if (export)
- ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE,
- current_menu_object,
- NULL, NULL, NULL);
- } else if (h != NULL) {
- ro_gui_window_content_export_types(h, NULL, &export);
+/**
+ * Prepare the object info window for use
+ *
+ * \param object the object for which information is to be displayed
+ * \param target_url corresponding url, if any
+ */
+static void
+ro_gui_window_prepare_objectinfo(struct hlcache_handle *object,
+ nsurl *target_url)
+{
+ char icon_buf[20] = "file_xxx";
+ const char *url;
+ lwc_string *mime;
+ const char *target = "-";
- if (export)
- ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE,
- h, NULL, NULL, NULL);
- }
- break;
+ sprintf(icon_buf, "file_%.3x",ro_content_filetype(object));
+ if (!ro_gui_wimp_sprite_exists(icon_buf)) {
+ sprintf(icon_buf, "file_xxx");
+ }
- case BROWSER_OBJECT_EXPORT_DRAW:
- if (current_menu_object != NULL) {
- ro_gui_window_content_export_types(current_menu_object,
- &export, NULL);
+ url = nsurl_access(hlcache_handle_get_url(object));
+ if (url == NULL) {
+ url = "-";
+ }
+ mime = content_get_mime_type(object);
- if (export)
- ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE,
- current_menu_object,
- NULL, NULL, NULL);
- } else if (h != NULL) {
- ro_gui_window_content_export_types(h, &export, NULL);
+ if (target_url != NULL) {
+ target = nsurl_access(target_url);
+ }
- if (export)
- ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE,
- h, NULL, NULL, NULL);
- }
- break;
+ ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_ICON,
+ icon_buf, true);
+ ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_URL,
+ url, true);
+ ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_TARGET,
+ target, true);
+ ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_TYPE,
+ lwc_string_data(mime), true);
- default:
- break;
- }
+ lwc_string_unref(mime);
}
+/**
+ * callback to handle window paste operation
+ *
+ * \param pw context containing browser window
+ */
static void ro_gui_window_paste_cb(void *pw)
{
struct browser_window *bw = pw;
@@ -2580,22 +2464,25 @@ static void ro_gui_window_paste_cb(void *pw)
/**
* Handle selections from a browser window menu
*
- * \param w The window owning the menu.
- * \param i The icon owning the menu.
- * \param *menu The menu from which the selection was made.
- * \param *selection The wimp menu selection data.
- * \param action The selected menu action.
- * \return true if action accepted; else false.
+ * \param w The window owning the menu.
+ * \param i The icon owning the menu.
+ * \param menu The menu from which the selection was made.
+ * \param selection The wimp menu selection data.
+ * \param action The selected menu action.
+ * \return true if action accepted; else false.
*/
-
-bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
- wimp_selection *selection, menu_action action)
+static bool
+ro_gui_window_menu_select(wimp_w w,
+ wimp_i i,
+ wimp_menu *menu,
+ wimp_selection *selection,
+ menu_action action)
{
- struct gui_window *g;
- struct browser_window *bw;
- struct hlcache_handle *h;
- struct toolbar *toolbar;
- wimp_window_state state;
+ struct gui_window *g;
+ struct browser_window *bw;
+ struct hlcache_handle *h;
+ struct toolbar *toolbar;
+ wimp_window_state state;
nsurl *url;
nserror error = NSERROR_OK;
@@ -2607,7 +2494,6 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
/* If this is a form menu from the core, handle it now and then exit.
* Otherwise, carry on to the main browser window menu.
*/
-
if (menu == gui_form_select_menu && w == g->window) {
ro_gui_window_process_form_select_menu(g, selection);
@@ -2625,10 +2511,10 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
error = nsurl_create("http://www.netsurf-browser.org/documentation/", &url);
if (error == NSERROR_OK) {
error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
+ url,
+ NULL,
+ NULL,
+ NULL);
nsurl_unref(url);
}
break;
@@ -2637,10 +2523,10 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
error = nsurl_create("http://www.netsurf-browser.org/documentation/guide", &url);
if (error == NSERROR_OK) {
error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
+ url,
+ NULL,
+ NULL,
+ NULL);
nsurl_unref(url);
}
break;
@@ -2649,10 +2535,10 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
error = nsurl_create("http://www.netsurf-browser.org/documentation/info", &url);
if (error == NSERROR_OK) {
error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
+ url,
+ NULL,
+ NULL,
+ NULL);
nsurl_unref(url);
}
break;
@@ -2661,10 +2547,10 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
error = nsurl_create("about:credits", &url);
if (error == NSERROR_OK) {
error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
+ url,
+ NULL,
+ NULL,
+ NULL);
nsurl_unref(url);
}
break;
@@ -2673,10 +2559,10 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
error = nsurl_create("about:licence", &url);
if (error == NSERROR_OK) {
error = browser_window_create(BW_CREATE_HISTORY,
- url,
- NULL,
- NULL,
- NULL);
+ url,
+ NULL,
+ NULL,
+ NULL);
nsurl_unref(url);
}
break;
@@ -2686,7 +2572,8 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
ro_gui_interactive_help_start();
nsoption_set_bool(interactive_help, true);
} else {
- nsoption_set_bool(interactive_help, !nsoption_bool(interactive_help));
+ nsoption_set_bool(interactive_help,
+ !nsoption_bool(interactive_help));
}
break;
@@ -2738,9 +2625,10 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
case BROWSER_OBJECT_INFO:
if (current_menu_object != NULL) {
ro_gui_window_prepare_objectinfo(current_menu_object,
- current_menu_url);
+ current_menu_url);
ro_gui_dialog_open_persistent(g->window,
- dialog_objinfo, false);
+ dialog_objinfo,
+ false);
}
break;
case BROWSER_OBJECT_RELOAD:
@@ -2753,50 +2641,62 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
/* link actions */
case BROWSER_LINK_SAVE_URI:
if (current_menu_url != NULL) {
- ro_gui_save_prepare(GUI_SAVE_LINK_URI, NULL, NULL,
- current_menu_url, NULL);
- ro_gui_dialog_open_persistent(g->window, dialog_saveas,
+ ro_gui_save_prepare(GUI_SAVE_LINK_URI,
+ NULL,
+ NULL,
+ current_menu_url,
+ NULL);
+ ro_gui_dialog_open_persistent(g->window,
+ dialog_saveas,
false);
}
break;
case BROWSER_LINK_SAVE_URL:
if (current_menu_url != NULL) {
- ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL,
- current_menu_url, NULL);
- ro_gui_dialog_open_persistent(g->window, dialog_saveas,
+ ro_gui_save_prepare(GUI_SAVE_LINK_URL,
+ NULL,
+ NULL,
+ current_menu_url,
+ NULL);
+ ro_gui_dialog_open_persistent(g->window,
+ dialog_saveas,
false);
}
break;
case BROWSER_LINK_SAVE_TEXT:
if (current_menu_url != NULL) {
- ro_gui_save_prepare(GUI_SAVE_LINK_TEXT, NULL, NULL,
- current_menu_url, NULL);
- ro_gui_dialog_open_persistent(g->window, dialog_saveas,
+ ro_gui_save_prepare(GUI_SAVE_LINK_TEXT,
+ NULL,
+ NULL,
+ current_menu_url,
+ NULL);
+ ro_gui_dialog_open_persistent(g->window,
+ dialog_saveas,
false);
}
break;
case BROWSER_LINK_DOWNLOAD:
if (current_menu_url != NULL) {
- error = browser_window_navigate(bw,
- current_menu_url,
- browser_window_get_url(bw),
- BW_NAVIGATE_DOWNLOAD,
- NULL,
- NULL,
- NULL);
+ error = browser_window_navigate(
+ bw,
+ current_menu_url,
+ browser_window_access_url(bw),
+ BW_NAVIGATE_DOWNLOAD,
+ NULL,
+ NULL,
+ NULL);
}
break;
case BROWSER_LINK_NEW_WINDOW:
if (current_menu_url != NULL) {
error = browser_window_create(
- BW_CREATE_HISTORY |
- BW_CREATE_CLONE,
- current_menu_url,
- browser_window_get_url(bw),
- bw,
- NULL);
+ BW_CREATE_HISTORY | BW_CREATE_CLONE,
+ current_menu_url,
+ browser_window_access_url(bw),
+ bw,
+ NULL);
}
break;
@@ -2805,24 +2705,36 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
case BROWSER_OBJECT_SAVE:
if (current_menu_object != NULL) {
ro_gui_save_prepare(GUI_SAVE_OBJECT_ORIG,
- current_menu_object, NULL, NULL, NULL);
- ro_gui_dialog_open_persistent(g->window, dialog_saveas,
+ current_menu_object,
+ NULL,
+ NULL,
+ NULL);
+ ro_gui_dialog_open_persistent(g->window,
+ dialog_saveas,
false);
}
break;
case BROWSER_OBJECT_EXPORT_SPRITE:
if (current_menu_object != NULL) {
ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE,
- current_menu_object, NULL, NULL, NULL);
- ro_gui_dialog_open_persistent(g->window, dialog_saveas,
+ current_menu_object,
+ NULL,
+ NULL,
+ NULL);
+ ro_gui_dialog_open_persistent(g->window,
+ dialog_saveas,
false);
}
break;
case BROWSER_OBJECT_EXPORT_DRAW:
if (current_menu_object != NULL) {
ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE,
- current_menu_object, NULL, NULL, NULL);
- ro_gui_dialog_open_persistent(g->window, dialog_saveas,
+ current_menu_object,
+ NULL,
+ NULL,
+ NULL);
+ ro_gui_dialog_open_persistent(g->window,
+ dialog_saveas,
false);
}
break;
@@ -2854,10 +2766,13 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
/* selection actions */
case BROWSER_SELECTION_SAVE:
if (h != NULL) {
- ro_gui_save_prepare(GUI_SAVE_TEXT_SELECTION, NULL,
+ ro_gui_save_prepare(GUI_SAVE_TEXT_SELECTION,
+ NULL,
browser_window_get_selection(bw),
- NULL, NULL);
- ro_gui_dialog_open_persistent(g->window, dialog_saveas,
+ NULL,
+ NULL);
+ ro_gui_dialog_open_persistent(g->window,
+ dialog_saveas,
false);
}
break;
@@ -2944,7 +2859,10 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
state.w = w;
oserror = xwimp_get_window_state(&state);
if (oserror) {
- LOG("xwimp_get_window_state: 0x%x: %s", oserror->errnum, oserror->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_state: 0x%x: %s",
+ oserror->errnum,
+ oserror->errmess);
ro_warn_user("WimpError", oserror->errmess);
}
nsoption_set_int(window_x, state.visible.x0);
@@ -2976,19 +2894,19 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
case TOOLBAR_BUTTONS:
assert(toolbar);
ro_toolbar_set_display_buttons(toolbar,
- !ro_toolbar_get_display_buttons(toolbar));
+ !ro_toolbar_get_display_buttons(toolbar));
break;
case TOOLBAR_ADDRESS_BAR:
assert(toolbar);
ro_toolbar_set_display_url(toolbar,
- !ro_toolbar_get_display_url(toolbar));
+ !ro_toolbar_get_display_url(toolbar));
if (ro_toolbar_get_display_url(toolbar))
ro_toolbar_take_caret(toolbar);
break;
case TOOLBAR_THROBBER:
assert(toolbar);
ro_toolbar_set_display_throbber(toolbar,
- !ro_toolbar_get_display_throbber(toolbar));
+ !ro_toolbar_get_display_throbber(toolbar));
break;
case TOOLBAR_EDIT:
assert(toolbar);
@@ -3008,467 +2926,881 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
/**
- * Handle the closure of a browser window menu
+ * Handle submenu warnings for a browser window menu
*
- * \param w The window owning the menu.
- * \param i The icon owning the menu.
- * \param *menu The menu that is being closed.
+ * \param w The window owning the menu.
+ * \param i The icon owning the menu.
+ * \param menu The menu to which the warning applies.
+ * \param selection The wimp menu selection data.
+ * \param action The selected menu action.
*/
-
-void ro_gui_window_menu_close(wimp_w w, wimp_i i, wimp_menu *menu)
+static void
+ro_gui_window_menu_warning(wimp_w w,
+ wimp_i i,
+ wimp_menu *menu,
+ wimp_selection *selection,
+ menu_action action)
{
- if (menu == ro_gui_browser_window_menu) {
- current_menu_object = NULL;
- current_menu_url = NULL;
- } else if (menu == gui_form_select_menu) {
- gui_form_select_control = NULL;
+ struct gui_window *g;
+ struct hlcache_handle *h;
+ bool export;
+
+ if (menu != ro_gui_browser_window_menu) {
+ return;
}
-}
+ g = (struct gui_window *) ro_gui_wimp_event_get_user_data(w);
+ h = browser_window_get_content(g->bw);
-/**
- * Process Scroll_Request events in a browser window.
- *
- * \param *scroll The wimp scroll event data block.
- */
+ switch (action) {
+ case BROWSER_PAGE_INFO:
+ if (h != NULL) {
+ ro_gui_window_prepare_pageinfo(g);
+ }
+ break;
-void ro_gui_window_scroll(wimp_scroll *scroll)
-{
- struct gui_window *g = ro_gui_window_lookup(scroll->w);
+ case BROWSER_FIND_TEXT:
+ if (h != NULL &&
+ (content_get_type(h) == CONTENT_HTML ||
+ content_get_type(h) == CONTENT_TEXTPLAIN)) {
+ ro_gui_search_prepare(g->bw);
+ }
+ break;
- if (g && browser_window_has_content(g->bw) && ro_gui_shift_pressed()) {
- /* extended scroll request with shift held down; change zoom */
- float scale, inc;
+ case BROWSER_SCALE_VIEW:
+ if (h != NULL) {
+ ro_gui_dialog_prepare_zoom(g);
+ }
+ break;
- if (scroll->ymin & 3)
- inc = 0.02; /* RO5 sends the msg 5 times;
- * don't ask me why
- *
- * @todo this is liable to break if
- * HID is configured optimally for
- * frame scrolling. *5 appears to be
- * an artifact of non-HID mode scrolling.
- */
- else
- inc = (1 << (ABS(scroll->ymin)>>2)) / 20.0F;
+ case BROWSER_PRINT:
+ if (h != NULL) {
+ ro_gui_print_prepare(g);
+ }
+ break;
- if (scroll->ymin > 0) {
- scale = g->scale + inc;
- if (scale > scale_snap_to[SCALE_SNAP_TO_SIZE - 1])
- scale = scale_snap_to[SCALE_SNAP_TO_SIZE - 1];
- } else {
- scale = g->scale - inc;
- if (scale < scale_snap_to[0])
- scale = scale_snap_to[0];
+ case BROWSER_OBJECT_INFO:
+ if (current_menu_object != NULL) {
+ ro_gui_window_prepare_objectinfo(current_menu_object,
+ current_menu_url);
}
- if (g->scale != scale)
- ro_gui_window_set_scale(g, scale);
- } else if (g != NULL) {
- ro_gui_window_scroll_action(g, scroll->xmin, scroll->ymin);
+ break;
+
+ case BROWSER_OBJECT_SAVE:
+ if (current_menu_object != NULL) {
+ ro_gui_save_prepare(GUI_SAVE_OBJECT_ORIG,
+ current_menu_object,
+ NULL,
+ NULL,
+ NULL);
+ }
+ break;
+
+ case BROWSER_SELECTION_SAVE:
+ if (browser_window_get_editor_flags(g->bw) & BW_EDITOR_CAN_COPY)
+ ro_gui_save_prepare(GUI_SAVE_TEXT_SELECTION, NULL,
+ browser_window_get_selection(g->bw),
+ NULL, NULL);
+ break;
+
+ case BROWSER_SAVE_URL_URI:
+ if (h != NULL)
+ ro_gui_save_prepare(GUI_SAVE_LINK_URI, NULL, NULL,
+ hlcache_handle_get_url(h),
+ content_get_title(h));
+ break;
+
+ case BROWSER_SAVE_URL_URL:
+ if (h != NULL)
+ ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL,
+ hlcache_handle_get_url(h),
+ content_get_title(h));
+ break;
+
+ case BROWSER_SAVE_URL_TEXT:
+ if (h != NULL)
+ ro_gui_save_prepare(GUI_SAVE_LINK_TEXT, NULL, NULL,
+ hlcache_handle_get_url(h),
+ content_get_title(h));
+ break;
+
+ case BROWSER_OBJECT_SAVE_URL_URI:
+ if (current_menu_object != NULL)
+ ro_gui_save_prepare(GUI_SAVE_LINK_URI, NULL, NULL,
+ hlcache_handle_get_url(
+ current_menu_object),
+ content_get_title(current_menu_object));
+ break;
+
+ case BROWSER_OBJECT_SAVE_URL_URL:
+ if (current_menu_object != NULL)
+ ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL,
+ hlcache_handle_get_url(
+ current_menu_object),
+ content_get_title(current_menu_object));
+ break;
+
+ case BROWSER_OBJECT_SAVE_URL_TEXT:
+ if (current_menu_object != NULL)
+ ro_gui_save_prepare(GUI_SAVE_LINK_TEXT, NULL, NULL,
+ hlcache_handle_get_url(
+ current_menu_object),
+ content_get_title(current_menu_object));
+ break;
+
+ case BROWSER_SAVE:
+ if (h != NULL)
+ ro_gui_save_prepare(GUI_SAVE_SOURCE, h, NULL, NULL, NULL);
+ break;
+
+ case BROWSER_SAVE_COMPLETE:
+ if (h != NULL)
+ ro_gui_save_prepare(GUI_SAVE_COMPLETE, h, NULL, NULL, NULL);
+ break;
+
+ case BROWSER_EXPORT_DRAW:
+ if (h != NULL)
+ ro_gui_save_prepare(GUI_SAVE_DRAW, h, NULL, NULL, NULL);
+ break;
+
+ case BROWSER_EXPORT_PDF:
+ if (h != NULL)
+ ro_gui_save_prepare(GUI_SAVE_PDF, h, NULL, NULL, NULL);
+ break;
+
+ case BROWSER_EXPORT_TEXT:
+ if (h != NULL)
+ ro_gui_save_prepare(GUI_SAVE_TEXT, h, NULL, NULL, NULL);
+ break;
+
+ case BROWSER_LINK_SAVE_URI:
+ if (current_menu_url != NULL)
+ ro_gui_save_prepare(GUI_SAVE_LINK_URI, NULL, NULL,
+ current_menu_url, NULL);
+ break;
+
+ case BROWSER_LINK_SAVE_URL:
+ if (current_menu_url != NULL)
+ ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL,
+ current_menu_url, NULL);
+ break;
+
+ case BROWSER_LINK_SAVE_TEXT:
+ if (current_menu_url != NULL)
+ ro_gui_save_prepare(GUI_SAVE_LINK_TEXT, NULL, NULL,
+ current_menu_url, NULL);
+ break;
+
+ case BROWSER_OBJECT_EXPORT_SPRITE:
+ if (current_menu_object != NULL) {
+ ro_gui_window_content_export_types(current_menu_object,
+ NULL, &export);
+
+ if (export)
+ ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE,
+ current_menu_object,
+ NULL, NULL, NULL);
+ } else if (h != NULL) {
+ ro_gui_window_content_export_types(h, NULL, &export);
+
+ if (export)
+ ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE,
+ h, NULL, NULL, NULL);
+ }
+ break;
+
+ case BROWSER_OBJECT_EXPORT_DRAW:
+ if (current_menu_object != NULL) {
+ ro_gui_window_content_export_types(current_menu_object,
+ &export, NULL);
+
+ if (export)
+ ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE,
+ current_menu_object,
+ NULL, NULL, NULL);
+ } else if (h != NULL) {
+ ro_gui_window_content_export_types(h, &export, NULL);
+
+ if (export)
+ ro_gui_save_prepare(GUI_SAVE_OBJECT_NATIVE,
+ h, NULL, NULL, NULL);
+ }
+ break;
+
+ default:
+ break;
}
}
+
/**
- * Process Pointer Entering Window events in a browser window.
+ * Handle the closure of a browser window menu
*
- * \param *entering The wimp pointer entering event data block.
+ * \param w The window owning the menu.
+ * \param i The icon owning the menu.
+ * \param menu The menu that is being closed.
*/
-
-static void ro_gui_window_pointer_entering(wimp_entering *entering)
+static void ro_gui_window_menu_close(wimp_w w, wimp_i i, wimp_menu *menu)
{
- struct gui_window *g = ro_gui_window_lookup(entering->w);
-
- if (g != NULL)
- ro_mouse_track_start(ro_gui_window_track_end,
- ro_gui_window_mouse_at, g);
+ if (menu == ro_gui_browser_window_menu) {
+ current_menu_object = NULL;
+ current_menu_url = NULL;
+ } else if (menu == gui_form_select_menu) {
+ gui_form_select_control = NULL;
+ }
}
+
/**
- * Process Pointer Leaving Window events in a browser window. These arrive via
- * the termination callback handler from ro_mouse's mouse tracking.
+ * Clones a browser window's options.
*
- * \param *leaving The wimp pointer leaving event data block.
- * \param *data The GUI window that the pointer is leaving.
+ * \param new_gui the new gui window
+ * \param old_gui the gui window to clone from, or NULL for default
*/
-
-static void ro_gui_window_track_end(wimp_leaving *leaving, void *data)
+static void
+ro_gui_window_clone_options(struct gui_window *new_gui,
+ struct gui_window *old_gui)
{
- struct gui_window *g = (struct gui_window *) data;
+ assert(new_gui);
- if (g != NULL)
- gui_window_set_pointer(g, GUI_POINTER_DEFAULT);
+ /* Clone the basic options
+ */
+ if (!old_gui) {
+ new_gui->option.buffer_animations = nsoption_bool(buffer_animations);
+ new_gui->option.buffer_everything = nsoption_bool(buffer_everything);
+ } else {
+ new_gui->option = old_gui->option;
+ }
+
+ /* Set up the toolbar
+ */
+ if (new_gui->toolbar) {
+ ro_toolbar_set_display_buttons(new_gui->toolbar,
+ nsoption_bool(toolbar_show_buttons));
+ ro_toolbar_set_display_url(new_gui->toolbar,
+ nsoption_bool(toolbar_show_address));
+ ro_toolbar_set_display_throbber(new_gui->toolbar,
+ nsoption_bool(toolbar_show_throbber));
+ if ((old_gui) && (old_gui->toolbar)) {
+ ro_toolbar_set_display_buttons(new_gui->toolbar,
+ ro_toolbar_get_display_buttons(
+ old_gui->toolbar));
+ ro_toolbar_set_display_url(new_gui->toolbar,
+ ro_toolbar_get_display_url(
+ old_gui->toolbar));
+ ro_toolbar_set_display_throbber(new_gui->toolbar,
+ ro_toolbar_get_display_throbber(
+ old_gui->toolbar));
+ ro_toolbar_process(new_gui->toolbar, -1, true);
+ }
+ }
}
/**
- * Scroll a browser window, either via the core or directly using the
- * normal Wimp_OpenWindow interface.
- *
- * Scroll steps are supplied in terms of the (extended) Scroll Event direction
- * values returned by Wimp_Poll. Special values of 0x7fffffff and 0x80000000
- * are added to mean "Home" and "End".
+ * Create and open a new browser window.
*
- * \param *g The GUI Window to be scrolled.
- * \param scroll_x The X scroll step to be applied.
- * \param scroll_y The Y scroll step to be applied.
+ * \param bw bw to create gui_window for
+ * \param existing an existing gui_window, may be NULL
+ * \param flags flags for gui window creation
+ * \return gui window, or NULL on error
*/
-
-void ro_gui_window_scroll_action(struct gui_window *g,
- wimp_scroll_direction scroll_x, wimp_scroll_direction scroll_y)
+static struct gui_window *gui_window_create(struct browser_window *bw,
+ struct gui_window *existing,
+ gui_window_create_flags flags)
{
- int visible_x, visible_y;
- int step_x = 0, step_y = 0;
- int toolbar_y;
- wimp_window_state state;
- wimp_pointer pointer;
- os_error *error;
- os_coord pos;
- bool handled = false;
- struct toolbar *toolbar;
+ int screen_width, screen_height;
+ static int window_count = 2;
+ wimp_window window;
+ wimp_window_state state;
+ os_error *error;
+ bool open_centred = true;
+ struct gui_window *g;
- if (g == NULL)
- return;
+ g = malloc(sizeof *g);
+ if (!g) {
+ ro_warn_user("NoMemory", 0);
+ return 0;
+ }
+ g->bw = bw;
+ g->toolbar = 0;
+ g->status_bar = 0;
+ g->old_width = 0;
+ g->old_height = 0;
+ g->update_extent = true;
+ g->active = false;
+ strcpy(g->title, "NetSurf");
+ g->iconise_icon = -1;
+ g->scale = browser_window_get_scale(bw);
- /* Get the current window, toolbar and pointer details. */
+ /* Set the window position */
+ if (existing != NULL &&
+ flags & GW_CREATE_CLONE &&
+ nsoption_bool(window_size_clone)) {
+ state.w = existing->window;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_state: 0x%x: %s",
+ error->errnum,
+ error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ }
+ window.visible.x0 = state.visible.x0;
+ window.visible.x1 = state.visible.x1;
+ window.visible.y0 = state.visible.y0 - 48;
+ window.visible.y1 = state.visible.y1 - 48;
+ open_centred = false;
+ } else {
+ int win_width, win_height;
+ ro_gui_screen_size(&screen_width, &screen_height);
- state.w = g->window;
- error = xwimp_get_window_state(&state);
- if (error) {
- LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess);
- return;
+ /* Check if we have a preferred position */
+ if ((nsoption_int(window_screen_width) != 0) &&
+ (nsoption_int(window_screen_height) != 0)) {
+ win_width = (nsoption_int(window_width) *
+ screen_width) /
+ nsoption_int(window_screen_width);
+ win_height = (nsoption_int(window_height) *
+ screen_height) /
+ nsoption_int(window_screen_height);
+ window.visible.x0 = (nsoption_int(window_x) *
+ screen_width) /
+ nsoption_int(window_screen_width);
+ window.visible.y0 = (nsoption_int(window_y) *
+ screen_height) /
+ nsoption_int(window_screen_height);
+ if (nsoption_bool(window_stagger)) {
+ window.visible.y0 += 96 -
+ (48 * (window_count % 5));
+ }
+ open_centred = false;
+ if (win_width < 100)
+ win_width = 100;
+ if (win_height < 100)
+ win_height = 100;
+ } else {
+
+ /* Base how we define the window height/width
+ on the compile time options set */
+ win_width = screen_width * 3 / 4;
+ if (1600 < win_width)
+ win_width = 1600;
+ win_height = win_width * 3 / 4;
+
+ window.visible.x0 = (screen_width - win_width) / 2;
+ window.visible.y0 = ((screen_height - win_height) / 2) +
+ 96 - (48 * (window_count % 5));
+ }
+ window.visible.x1 = window.visible.x0 + win_width;
+ window.visible.y1 = window.visible.y0 + win_height;
}
- toolbar = ro_toolbar_parent_window_lookup(g->window);
- assert(g == NULL || g->toolbar == NULL || g->toolbar == toolbar);
+ /* General flags for a non-movable, non-resizable, no-title bar window */
+ window.xscroll = 0;
+ window.yscroll = 0;
+ window.next = wimp_TOP;
+ window.flags = wimp_WINDOW_MOVEABLE |
+ wimp_WINDOW_NEW_FORMAT |
+ wimp_WINDOW_VSCROLL |
+ wimp_WINDOW_HSCROLL |
+ wimp_WINDOW_IGNORE_XEXTENT |
+ wimp_WINDOW_IGNORE_YEXTENT |
+ wimp_WINDOW_SCROLL_REPEAT;
+ window.title_fg = wimp_COLOUR_BLACK;
+ window.title_bg = wimp_COLOUR_LIGHT_GREY;
+ window.work_fg = wimp_COLOUR_LIGHT_GREY;
+ window.work_bg = wimp_COLOUR_TRANSPARENT;
+ window.scroll_outer = wimp_COLOUR_DARK_GREY;
+ window.scroll_inner = wimp_COLOUR_MID_LIGHT_GREY;
+ window.highlight_bg = wimp_COLOUR_CREAM;
+ window.extra_flags = wimp_WINDOW_USE_EXTENDED_SCROLL_REQUEST |
+ wimp_WINDOW_GIVE_SHADED_ICON_INFO;
+ window.extent.x0 = 0;
+ window.extent.y0 = -(window.visible.y1 - window.visible.y0);
+ window.extent.x1 = window.visible.x1 - window.visible.x0;
+ window.extent.y1 = 0;
+ window.title_flags = wimp_ICON_TEXT |
+ wimp_ICON_INDIRECTED |
+ wimp_ICON_HCENTRED;
+ window.work_flags = wimp_BUTTON_DOUBLE_CLICK_DRAG <<
+ wimp_ICON_BUTTON_TYPE_SHIFT;
+ window.sprite_area = wimpspriteop_AREA;
+ window.xmin = 1;
+ window.ymin = 1;
+ window.title_data.indirected_text.text = g->title;
+ window.title_data.indirected_text.validation = (char *) -1;
+ window.title_data.indirected_text.size = 255;
+ window.icon_count = 0;
- toolbar_y = (toolbar == NULL) ? 0 : ro_toolbar_full_height(toolbar);
+ /* Add in flags */
+ window.flags |= wimp_WINDOW_SIZE_ICON |
+ wimp_WINDOW_BACK_ICON |
+ wimp_WINDOW_CLOSE_ICON |
+ wimp_WINDOW_TITLE_ICON |
+ wimp_WINDOW_TOGGLE_ICON;
- visible_x = state.visible.x1 - state.visible.x0 - 32;
- visible_y = state.visible.y1 - state.visible.y0 - 32 - toolbar_y;
+ if (open_centred) {
+ int scroll_width = ro_get_vscroll_width(NULL);
+ window.visible.x0 -= scroll_width;
+ }
- error = xwimp_get_pointer_info(&pointer);
+ error = xwimp_create_window(&window, &g->window);
if (error) {
- LOG("xwimp_get_pointer_info 0x%x : %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
- return;
+ free(g);
+ return 0;
}
- /* Turn the scroll requirement from Scroll Event codes into coordinates
- * that the core can understand.
- */
+ /* Link into window list */
+ g->prev = 0;
+ g->next = window_list;
+ if (window_list)
+ window_list->prev = g;
+ window_list = g;
+ window_count++;
- switch (scroll_x) {
- case wimp_SCROLL_PAGE_LEFT:
- step_x = SCROLL_PAGE_DOWN;
- break;
- case wimp_SCROLL_AUTO_LEFT:
- case wimp_SCROLL_COLUMN_LEFT:
- step_x = -16;
- break;
- case wimp_SCROLL_AUTO_RIGHT:
- case wimp_SCROLL_COLUMN_RIGHT:
- step_x = 16;
- break;
- case wimp_SCROLL_PAGE_RIGHT:
- step_x = SCROLL_PAGE_UP;
- break;
- case 0x80000000:
- step_x = SCROLL_BOTTOM;
- break;
- case 0x7fffffff:
- step_x = SCROLL_TOP;
- break;
- default:
- step_x = (visible_x * (scroll_x>>2)) >> 2;
- break;
+ /* Add in a toolbar and status bar */
+ g->status_bar = ro_gui_status_bar_create(g->window,
+ nsoption_int(toolbar_status_size));
+ g->toolbar = ro_toolbar_create(NULL, g->window,
+ THEME_STYLE_BROWSER_TOOLBAR, TOOLBAR_FLAGS_NONE,
+ &ro_gui_window_toolbar_callbacks, g,
+ "HelpToolbar");
+ if (g->toolbar != NULL) {
+ ro_toolbar_add_buttons(g->toolbar,
+ brower_toolbar_buttons,
+ nsoption_charp(toolbar_browser));
+ ro_toolbar_add_url(g->toolbar);
+ ro_toolbar_add_throbber(g->toolbar);
+ ro_toolbar_rebuild(g->toolbar);
}
- switch (scroll_y) {
- case wimp_SCROLL_PAGE_UP:
- step_y = SCROLL_PAGE_UP;
- break;
- case wimp_SCROLL_AUTO_UP:
- case wimp_SCROLL_LINE_UP:
- step_y = -16;
- break;
- case wimp_SCROLL_AUTO_DOWN:
- case wimp_SCROLL_LINE_DOWN:
- step_y = 16;
- break;
- case wimp_SCROLL_PAGE_DOWN:
- step_y = SCROLL_PAGE_DOWN;
- break;
- case 0x80000000:
- step_y = SCROLL_BOTTOM;
- break;
- case 0x7fffffff:
- step_y = SCROLL_TOP;
- break;
- default:
- step_y = -((visible_y * (scroll_y>>2)) >> 2);
- break;
- }
+ /* Register event handlers. Do this quickly, as some of the things
+ * that follow will indirectly look up our user data: this MUST
+ * be set first!
+ */
+ ro_gui_wimp_event_set_user_data(g->window, g);
+ ro_gui_wimp_event_register_open_window(g->window,
+ ro_gui_window_open);
+ ro_gui_wimp_event_register_close_window(g->window,
+ ro_gui_window_close);
+ ro_gui_wimp_event_register_redraw_window(g->window,
+ ro_gui_window_redraw);
+ ro_gui_wimp_event_register_scroll_window(g->window,
+ ro_gui_window_scroll);
+ ro_gui_wimp_event_register_pointer_entering_window(g->window,
+ ro_gui_window_pointer_entering);
+ ro_gui_wimp_event_register_keypress(g->window,
+ ro_gui_window_keypress);
+ ro_gui_wimp_event_register_mouse_click(g->window,
+ ro_gui_window_click);
+ ro_gui_wimp_event_register_menu(g->window,
+ ro_gui_browser_window_menu,
+ true, false);
+ ro_gui_wimp_event_register_menu_prepare(g->window,
+ ro_gui_window_menu_prepare);
+ ro_gui_wimp_event_register_menu_selection(g->window,
+ ro_gui_window_menu_select);
+ ro_gui_wimp_event_register_menu_warning(g->window,
+ ro_gui_window_menu_warning);
+ ro_gui_wimp_event_register_menu_close(g->window,
+ ro_gui_window_menu_close);
- /* If no scrolling is required, there's no point trying to do any. */
+ /* Set the window options */
+ ro_gui_window_clone_options(g, existing);
+ ro_gui_window_update_toolbar_buttons(g);
- if (step_x == 0 && step_y == 0)
- return;
+ /* Open the window at the top of the stack */
+ state.w = g->window;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return g;
+ }
- /* If the pointer is over the window being scrolled, then try to get
- * the core to do the scrolling on the object under the pointer.
- */
+ state.next = wimp_TOP;
- if (pointer.w == g->window &&
- ro_gui_window_to_window_pos(g,
- pointer.pos.x, pointer.pos.y, &pos))
- handled = browser_window_scroll_at_point(g->bw, pos.x, pos.y,
- step_x, step_y);
+ ro_gui_window_open(PTR_WIMP_OPEN(&state));
- /* If the core didn't do the scrolling, handle it via the Wimp.
- * Windows which contain frames can only be scrolled by the core,
- * because it implements frame scroll bars.
- */
+ /* Claim the caret */
+ if (ro_toolbar_take_caret(g->toolbar)) {
+ ro_gui_url_complete_start(g->toolbar);
+ } else {
+ gui_window_place_caret(g, -100, -100, 0, NULL);
+ }
- if (!handled && (browser_window_is_frameset(g->bw) == false)) {
- switch (step_x) {
- case SCROLL_TOP:
- state.xscroll -= 0x10000000;
- break;
- case SCROLL_BOTTOM:
- state.xscroll += 0x10000000;
- break;
- case SCROLL_PAGE_UP:
- state.xscroll += visible_x;
- break;
- case SCROLL_PAGE_DOWN:
- state.xscroll -= visible_x;
- break;
- default:
- state.xscroll += 2 * step_x;
- break;
- }
+ return g;
+}
- switch (step_y) {
- case SCROLL_TOP:
- state.yscroll += 0x10000000;
- break;
- case SCROLL_BOTTOM:
- state.yscroll -= 0x10000000;
- break;
- case SCROLL_PAGE_UP:
- state.yscroll += visible_y;
- break;
- case SCROLL_PAGE_DOWN:
- state.yscroll -= visible_y;
- break;
- default:
- state.yscroll -= 2 * step_y;
- break;
- }
- error = xwimp_open_window((wimp_open *) &state);
- if (error) {
- LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess);
+/**
+ * Remove all pending update boxes for a window
+ *
+ * \param g gui_window
+ */
+static void ro_gui_window_remove_update_boxes(struct gui_window *g)
+{
+ struct update_box *cur;
+
+ for (cur = pending_updates; cur != NULL; cur = cur->next) {
+ if (cur->g == g) {
+ cur->g = NULL;
}
}
}
/**
- * Handle Message_DataLoad (file dragged in) for a window.
- *
- * \param g window
- * \param message Message_DataLoad block
- * \return true if the load was processed
+ * Close a browser window and free any related resources.
*
- * If the file was dragged into a form file input, it is used as the value.
+ * \param g gui_window to destroy
*/
-
-bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message)
+static void gui_window_destroy(struct gui_window *g)
{
os_error *error;
- os_coord pos;
+ wimp_w w;
- /* Ignore directories etc. */
- if (0x1000 <= message->data.data_xfer.file_type)
- return false;
+ assert(g);
- if (!ro_gui_window_to_window_pos(g, message->data.data_xfer.pos.x,
- message->data.data_xfer.pos.y, &pos))
- return false;
+ /* stop any tracking */
+ ro_mouse_kill(g);
- if (browser_window_drop_file_at_point(g->bw, pos.x, pos.y,
- message->data.data_xfer.file_name) == false)
- return false;
+ /* remove from list */
+ if (g->prev)
+ g->prev->next = g->next;
+ else
+ window_list = g->next;
+ if (g->next)
+ g->next->prev = g->prev;
- /* send DataLoadAck */
- message->action = message_DATA_LOAD_ACK;
- message->your_ref = message->my_ref;
- error = xwimp_send_message(wimp_USER_MESSAGE, message, message->sender);
+ /* destroy toolbar */
+ if (g->toolbar)
+ ro_toolbar_destroy(g->toolbar);
+ if (g->status_bar)
+ ro_gui_status_bar_destroy(g->status_bar);
+
+ w = g->window;
+ ro_gui_url_complete_close();
+ ro_gui_dialog_close_persistent(w);
+ if (current_menu_window == w)
+ ro_gui_menu_destroy();
+ ro_gui_window_remove_update_boxes(g);
+
+ /* delete window */
+ error = xwimp_delete_window(w);
if (error) {
- LOG("xwimp_send_message: 0x%x: %s\n", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
+ ro_gui_wimp_event_finalise(w);
- return true;
+ free(g);
}
/**
- * Handle pointer movements in a browser window.
+ * Set the title of a browser window.
*
- * \param *pointer new mouse position
- * \param *data browser window that the pointer is in
+ * \param g gui_window to update
+ * \param title new window title, copied
*/
-
-void ro_gui_window_mouse_at(wimp_pointer *pointer, void *data)
+static void gui_window_set_title(struct gui_window *g, const char *title)
{
- os_coord pos;
- struct gui_window *g = (struct gui_window *) data;
+ assert(g);
+ assert(title);
- if (ro_gui_window_to_window_pos(g, pointer->pos.x, pointer->pos.y, &pos))
- browser_window_mouse_track(g->bw,
- ro_gui_mouse_drag_state(pointer->buttons,
- wimp_BUTTON_DOUBLE_CLICK_DRAG),
- pos.x, pos.y);
+ if (g->scale != 1.0) {
+ int scale_disp = g->scale * 100;
+
+ if (ABS((float)scale_disp - g->scale * 100) >= 0.05)
+ snprintf(g->title, sizeof g->title, "%s (%.1f%%)",
+ title, g->scale * 100);
+ else
+ snprintf(g->title, sizeof g->title, "%s (%i%%)",
+ title, scale_disp);
+ } else {
+ strncpy(g->title, title, sizeof g->title);
+ }
+
+ ro_gui_set_window_title(g->window, g->title);
}
/**
- * Window is being iconised. Create a suitable thumbnail sprite
- * (which, sadly, must be in the Wimp sprite pool), and return
- * the sprite name and truncated title to the iconiser
+ * Get the scroll position of a browser window.
*
- * \param g the gui window being iconised
- * \param wi the WindowInfo message from the iconiser
+ * \param g gui_window
+ * \param sx receives x ordinate of point at top-left of window
+ * \param sy receives y ordinate of point at top-left of window
+ * \return true iff successful
*/
+static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
+{
+ wimp_window_state state;
+ os_error *error;
+ int toolbar_height = 0;
+
+ assert(g);
+
+ state.w = g->window;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return false;
+ }
+
+ if (g->toolbar)
+ toolbar_height = ro_toolbar_full_height(g->toolbar);
+ *sx = state.xscroll / (2 * g->scale);
+ *sy = -(state.yscroll - toolbar_height) / (2 * g->scale);
+ return true;
+}
+
-void ro_gui_window_iconise(struct gui_window *g,
- wimp_full_message_window_info *wi)
+/**
+ * Set the scroll position of a riscos browser window.
+ *
+ * Scrolls the viewport to ensure the specified rectangle of the
+ * content is shown.
+ *
+ * \param g gui window to scroll
+ * \param rect The rectangle to ensure is shown.
+ * \return NSERROR_OK on success or apropriate error code.
+ */
+static nserror
+gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
{
- /* sadly there is no 'legal' way to get the sprite into
- * the Wimp sprite pool other than via a filing system */
- const char *temp_fname = "Pipe:$._tmpfile";
- struct browser_window *bw = g->bw;
- osspriteop_header *overlay = NULL;
- osspriteop_header *sprite_header;
- struct bitmap *bitmap;
- osspriteop_area *area;
- int width = 34, height = 34;
- struct hlcache_handle *h;
+ wimp_window_state state;
os_error *error;
- int len, id;
+ int toolbar_height = 0;
- assert(bw);
+ assert(g);
- h = browser_window_get_content(bw);
- if (!h) return;
+ state.w = g->window;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_BAD_PARAMETER;
+ }
- /* if an overlay sprite is defined, locate it and gets its dimensions
- * so that we can produce a thumbnail with the same dimensions */
- if (!ro_gui_wimp_get_sprite("ic_netsfxx", &overlay)) {
- error = xosspriteop_read_sprite_info(osspriteop_PTR,
- (osspriteop_area *)0x100,
- (osspriteop_id)overlay, &width, &height, NULL,
- NULL);
- if (error) {
- LOG("xosspriteop_read_sprite_info: 0x%x: %s", error->errnum, error->errmess);
- ro_warn_user("MiscError", error->errmess);
- overlay = NULL;
+ if (g->toolbar) {
+ toolbar_height = ro_toolbar_full_height(g->toolbar);
+ }
+
+ if ((rect->x0 == rect->x1) && (rect->y0 == rect->y1)) {
+ /* scroll to top */
+ state.xscroll = rect->x0 * 2 * g->scale;
+ state.yscroll = (-rect->y0 * 2 * g->scale) + toolbar_height;
+ } else {
+ /* scroll area into view with padding */
+ int x0, y0, x1, y1;
+ int cx0, cy0, width, height;
+ int padding_available;
+ int correction;
+
+ x0 = rect->x0 * 2 * g->scale;
+ y0 = rect->y0 * 2 * g->scale;
+ x1 = rect->x1 * 2 * g->scale;
+ y1 = rect->y1 * 2 * g->scale;
+
+ cx0 = state.xscroll;
+ cy0 = -state.yscroll + toolbar_height;
+ width = state.visible.x1 - state.visible.x0;
+ height = state.visible.y1 - state.visible.y0 - toolbar_height;
+
+ /* make sure we're visible */
+ correction = (x1 - cx0 - width);
+ if (correction > 0) {
+ cx0 += correction;
}
- else if (sprite_bpp(overlay) != 8) {
- LOG("overlay sprite is not 8bpp");
- overlay = NULL;
+ correction = (y1 - cy0 - height);
+ if (correction > 0) {
+ cy0 += correction;
+ }
+ if (x0 < cx0) {
+ cx0 = x0;
+ }
+ if (y0 < cy0) {
+ cy0 = y0;
}
- }
- /* create the thumbnail sprite */
- bitmap = riscos_bitmap_create(width, height, BITMAP_NEW | BITMAP_OPAQUE |
- BITMAP_CLEAR_MEMORY);
- if (!bitmap) {
- LOG("Thumbnail initialisation failed.");
- return;
+ /* try to give a SCROLL_VISIBLE_PADDING border of space around us */
+ padding_available = (width - x1 + x0) / 2;
+ if (padding_available > 0) {
+ if (padding_available > SCROLL_VISIBLE_PADDING) {
+ padding_available = SCROLL_VISIBLE_PADDING;
+ }
+ correction = (cx0 + width - x1);
+ if (correction < padding_available) {
+ cx0 += padding_available;
+ }
+ correction = (x0 - cx0);
+ if (correction < padding_available) {
+ cx0 -= padding_available;
+ }
+ }
+ padding_available = (height - y1 + y0) / 2;
+ if (padding_available > 0) {
+ if (padding_available > SCROLL_VISIBLE_PADDING) {
+ padding_available = SCROLL_VISIBLE_PADDING;
+ }
+ correction = (cy0 + height - y1);
+ if (correction < padding_available) {
+ cy0 += padding_available;
+ }
+ correction = (y0 - cy0);
+ if (correction < padding_available) {
+ cy0 -= padding_available;
+ }
+ }
+
+ state.xscroll = cx0;
+ state.yscroll = -cy0 + toolbar_height;
}
- riscos_bitmap_render(bitmap, h);
- if (overlay) {
- riscos_bitmap_overlay_sprite(bitmap, overlay);
+ ro_gui_window_open(PTR_WIMP_OPEN(&state));
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Find the current dimensions of a browser window's content area.
+ *
+ * \param gw gui window to measure
+ * \param width receives width of window
+ * \param height receives height of window
+ * \param scaled whether to return scaled values
+ */
+static nserror
+gui_window_get_dimensions(struct gui_window *gw,
+ int *width, int *height,
+ bool scaled)
+{
+ /* use the cached window sizes */
+ *width = gw->old_width / 2;
+ *height = gw->old_height / 2;
+
+ if (scaled) {
+ *width /= gw->scale;
+ *height /= gw->scale;
}
- area = riscos_bitmap_convert_8bpp(bitmap);
- riscos_bitmap_destroy(bitmap);
- if (!area) {
- LOG("Thumbnail conversion failed.");
- return;
+ return NSERROR_OK;
+}
+
+
+/**
+ * Set the status bar of a browser window.
+ *
+ * \param g gui_window to update
+ * \param text new status text
+ */
+static void riscos_window_set_status(struct gui_window *g, const char *text)
+{
+ if (g->status_bar) {
+ ro_gui_status_bar_set_text(g->status_bar, text);
}
+}
- /* choose a suitable sprite name */
- id = 0;
- while (iconise_used[id])
- if ((unsigned)++id >= NOF_ELEMENTS(iconise_used)) {
- id = iconise_next;
- if ((unsigned)++iconise_next >=
- NOF_ELEMENTS(iconise_used))
- iconise_next = 0;
- break;
- }
- sprite_header = (osspriteop_header *)(area + 1);
- len = sprintf(sprite_header->name, "ic_netsf%.2d", id);
+/**
+ * Update the interface to reflect start of page loading.
+ *
+ * \param g window with start of load
+ */
+static void gui_window_start_throbber(struct gui_window *g)
+{
+ ro_gui_window_update_toolbar_buttons(g);
+ ro_gui_menu_refresh(ro_gui_browser_window_menu);
+ if (g->toolbar != NULL)
+ ro_toolbar_start_throbbing(g->toolbar);
+ g->active = true;
+}
- error = xosspriteop_save_sprite_file(osspriteop_USER_AREA,
- area, temp_fname);
- if (error) {
- LOG("xosspriteop_save_sprite_file: 0x%x:%s", error->errnum, error->errmess);
- ro_warn_user("MiscError", error->errmess);
- free(area);
- return;
- }
- error = xwimpspriteop_merge_sprite_file(temp_fname);
- if (error) {
- LOG("xwimpspriteop_merge_sprite_file: 0x%x:%s", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- remove(temp_fname);
- free(area);
+
+/**
+ * Update the interface to reflect page loading stopped.
+ *
+ * \param g window with start of load
+ */
+static void gui_window_stop_throbber(struct gui_window *g)
+{
+ ro_gui_window_update_toolbar_buttons(g);
+ ro_gui_menu_refresh(ro_gui_browser_window_menu);
+ if (g->toolbar != NULL)
+ ro_toolbar_stop_throbbing(g->toolbar);
+ g->active = false;
+}
+
+/**
+ * set favicon
+ */
+static void
+gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
+{
+ if (g == NULL || g->toolbar == NULL)
return;
- }
- memcpy(wi->sprite_name, sprite_header->name + 3, len - 2); /* inc NUL */
- strncpy(wi->title, g->title, sizeof(wi->title));
- wi->title[sizeof(wi->title) - 1] = '\0';
+ ro_toolbar_set_site_favicon(g->toolbar, icon);
+}
- if (wimptextop_string_width(wi->title, 0) > 182) {
- /* work around bug in Pinboard where it will fail to display
- * the icon if the text is very wide */
- if (strlen(wi->title) > 10)
- wi->title[10] = '\0'; /* pinboard does this anyway */
- while (wimptextop_string_width(wi->title, 0) > 182)
- wi->title[strlen(wi->title) - 1] = '\0';
- }
- wi->size = sizeof(wimp_full_message_window_info);
- wi->your_ref = wi->my_ref;
- error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message*)wi,
- wi->sender);
+
+/**
+ * Remove the caret, if present.
+ *
+ * \param g window with caret
+ */
+static void gui_window_remove_caret(struct gui_window *g)
+{
+ wimp_caret caret;
+ os_error *error;
+
+ error = xwimp_get_caret_position(&caret);
if (error) {
- LOG("xwimp_send_message: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
+ return;
}
- else {
- g->iconise_icon = id;
- iconise_used[id] = true;
+
+ if (caret.w == g->window) {
+ /* we have the caret: hide caret, but keep input focus */
+ gui_window_place_caret(g, -100, -100, 0, NULL);
}
+}
- free(area);
+
+/**
+ * Called when the gui_window has new content.
+ *
+ * \param g the gui_window that has new content
+ */
+static void gui_window_new_content(struct gui_window *g)
+{
+ ro_gui_menu_refresh(ro_gui_browser_window_menu);
+ ro_gui_window_update_toolbar_buttons(g);
+ ro_gui_dialog_close_persistent(g->window);
+ ro_toolbar_set_content_favicon(g->toolbar, g);
}
/**
* Completes scrolling of a browser window
*
- * \param *drag The DragEnd event data block.
- * \param *data gui window block pointer.
+ * \param drag The DragEnd event data block.
+ * \param data gui window block pointer.
*/
-
static void ro_gui_window_scroll_end(wimp_dragged *drag, void *data)
{
wimp_pointer pointer;
@@ -3481,20 +3813,25 @@ static void ro_gui_window_scroll_end(wimp_dragged *drag, void *data)
error = xwimp_drag_box((wimp_drag*)-1);
if (error) {
- LOG("xwimp_drag_box: 0x%x : %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x : %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
}
error = xwimp_get_pointer_info(&pointer);
if (error) {
- LOG("xwimp_get_pointer_info 0x%x : %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info 0x%x : %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return;
}
error = xwimpspriteop_set_pointer_shape("ptr_default", 0x31, 0, 0, 0, 0);
if (error) {
- LOG("xwimpspriteop_set_pointer_shape: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimpspriteop_set_pointer_shape: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
}
@@ -3504,630 +3841,736 @@ static void ro_gui_window_scroll_end(wimp_dragged *drag, void *data)
/**
- * Process Mouse_Click events in a toolbar's button bar. This does not handle
- * other clicks in a toolbar: these are handled by the toolbar module itself.
+ * Starts drag scrolling of a browser window
*
- * \param *data The GUI window associated with the click.
- * \param action_type The action type to be handled.
- * \param action The action to process.
+ * \param g the window to scroll
*/
-
-void ro_gui_window_toolbar_click(void *data,
- toolbar_action_type action_type, union toolbar_action action)
+static bool gui_window_scroll_start(struct gui_window *g)
{
- struct gui_window *g = data;
- nserror err;
-
- if (g == NULL)
- return;
-
-
- if (action_type == TOOLBAR_ACTION_URL) {
- switch (action.url) {
- case TOOLBAR_URL_DRAG_URL:
- {
- gui_save_type save_type;
-
- if (!browser_window_has_content(g->bw))
- break;
-
- if (ro_gui_shift_pressed())
- save_type = GUI_SAVE_LINK_URL;
- else
- save_type = GUI_SAVE_LINK_TEXT;
-
- ro_gui_drag_save_link(save_type,
- browser_window_get_url(g->bw),
- browser_window_get_title(g->bw), g);
- }
- break;
-
- case TOOLBAR_URL_SELECT_HOTLIST:
- ro_gui_window_action_add_bookmark(g);
- break;
-
- case TOOLBAR_URL_ADJUST_HOTLIST:
- ro_gui_window_action_remove_bookmark(g);
- break;
-
- default:
- break;
- }
+ wimp_window_info_base info;
+ wimp_pointer pointer;
+ os_error *error;
+ wimp_drag drag;
+ int height;
+ int width;
- return;
+ error = xwimp_get_pointer_info(&pointer);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info 0x%x : %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return false;
}
+ info.w = g->window;
+ error = xwimp_get_window_info_header_only((wimp_window_info*)&info);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x : %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return false;
+ }
- /* By now, the only valid action left is a button click. If it isn't
- * one of those, give up.
- */
-
- if (action_type != TOOLBAR_ACTION_BUTTON)
- return;
-
- switch (action.button) {
- case TOOLBAR_BUTTON_BACK:
- if (g->bw != NULL)
- browser_window_history_back(g->bw, false);
- break;
-
- case TOOLBAR_BUTTON_BACK_NEW:
- if (g->bw != NULL)
- browser_window_history_back(g->bw, true);
- break;
-
- case TOOLBAR_BUTTON_FORWARD:
- if (g->bw != NULL)
- browser_window_history_forward(g->bw, false);
- break;
-
- case TOOLBAR_BUTTON_FORWARD_NEW:
- if (g->bw != NULL)
- browser_window_history_forward(g->bw, true);
- break;
-
- case TOOLBAR_BUTTON_STOP:
- if (g->bw != NULL)
- browser_window_stop(g->bw);
- break;
-
- case TOOLBAR_BUTTON_RELOAD:
- if (g->bw != NULL)
- browser_window_reload(g->bw, false);
- break;
-
- case TOOLBAR_BUTTON_RELOAD_ALL:
- if (g->bw != NULL)
- browser_window_reload(g->bw, true);
- break;
-
- case TOOLBAR_BUTTON_HISTORY_LOCAL:
- ro_gui_window_action_local_history(g);
- break;
-
- case TOOLBAR_BUTTON_HISTORY_GLOBAL:
- ro_gui_global_history_present();
- break;
+ width = info.extent.x1 - info.extent.x0;
+ height = info.extent.y1 - info.extent.y0;
- case TOOLBAR_BUTTON_HOME:
- ro_gui_window_action_home(g);
- break;
+ drag.type = wimp_DRAG_USER_POINT;
+ drag.bbox.x1 = pointer.pos.x + info.xscroll;
+ drag.bbox.y0 = pointer.pos.y + info.yscroll;
+ drag.bbox.x0 = drag.bbox.x1 - (width - (info.visible.x1 - info.visible.x0));
+ drag.bbox.y1 = drag.bbox.y0 + (height - (info.visible.y1 - info.visible.y0));
- case TOOLBAR_BUTTON_SEARCH:
- ro_gui_window_action_search(g);
- break;
+ if (g->toolbar) {
+ int tbar_height = ro_toolbar_full_height(g->toolbar);
+ drag.bbox.y0 -= tbar_height;
+ drag.bbox.y1 -= tbar_height;
+ }
- case TOOLBAR_BUTTON_SCALE:
- ro_gui_window_action_zoom(g);
- break;
+ error = xwimp_drag_box(&drag);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x : %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return false;
+ }
- case TOOLBAR_BUTTON_BOOKMARK_OPEN:
- ro_gui_hotlist_present();
- break;
+ ro_mouse_drag_start(ro_gui_window_scroll_end, ro_gui_window_mouse_at,
+ NULL, g);
+ return true;
+}
- case TOOLBAR_BUTTON_BOOKMARK_ADD:
- ro_gui_window_action_add_bookmark(g);
- break;
- case TOOLBAR_BUTTON_SAVE_SOURCE:
- ro_gui_window_action_save(g, GUI_SAVE_SOURCE);
- break;
+/**
+ * Platform-dependent part of starting drag operation.
+ *
+ * \param g gui window containing the drag
+ * \param type type of drag the core is performing
+ * \param rect rectangle to constrain pointer to (relative to drag start coord)
+ * \return true iff succesful
+ */
+static bool
+gui_window_drag_start(struct gui_window *g,
+ gui_drag_type type,
+ const struct rect *rect)
+{
+ wimp_pointer pointer;
+ wimp_drag drag;
- case TOOLBAR_BUTTON_SAVE_COMPLETE:
- ro_gui_window_action_save(g, GUI_SAVE_COMPLETE);
- break;
+ if (rect != NULL) {
+ /* We have a box to constrain the pointer to, for the drag
+ * duration */
+ os_error *error = xwimp_get_pointer_info(&pointer);
+ if (error) {
+ NSLOG(netsurf, INFO,
+ "xwimp_get_pointer_info 0x%x : %s",
+ error->errnum,
+ error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return false;
+ }
- case TOOLBAR_BUTTON_PRINT:
- ro_gui_window_action_print(g);
- break;
+ drag.type = wimp_DRAG_USER_POINT;
+ drag.bbox.x0 = pointer.pos.x +
+ (int)(rect->x0 * 2 * g->scale);
+ drag.bbox.y0 = pointer.pos.y +
+ (int)(rect->y0 * 2 * g->scale);
+ drag.bbox.x1 = pointer.pos.x +
+ (int)(rect->x1 * 2 * g->scale);
+ drag.bbox.y1 = pointer.pos.y +
+ (int)(rect->y1 * 2 * g->scale);
- case TOOLBAR_BUTTON_UP:
- err = browser_window_navigate_up(g->bw, false);
- if (err != NSERROR_OK) {
- ro_warn_user(messages_get_errorcode(err), NULL);
+ error = xwimp_drag_box(&drag);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x : %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return false;
}
- break;
+ }
- case TOOLBAR_BUTTON_UP_NEW:
- err = browser_window_navigate_up(g->bw, true);
- if (err != NSERROR_OK) {
- ro_warn_user(messages_get_errorcode(err), NULL);
- }
+ switch (type) {
+ case GDRAGGING_SCROLLBAR:
+ /* Dragging a core scrollbar */
+ ro_mouse_drag_start(ro_gui_window_scroll_end, ro_gui_window_mouse_at,
+ NULL, g);
break;
default:
+ /* Not handled here yet */
break;
}
- ro_gui_window_update_toolbar_buttons(g);
+ return true;
}
/**
- * Handle Message_DataLoad (file dragged in) for a toolbar
- *
- * @todo This belongs in the toolbar module, and should be moved there
- * once the module is able to usefully handle its own events.
+ * Save the specified content as a link.
*
- * \param g window
- * \param message Message_DataLoad block
- * \return true if the load was processed
+ * \param g The window containing the content
+ * \param url The url of the link
+ * \param title The title of the link
*/
-
-bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message)
+static nserror
+gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
{
- if (message->data.data_xfer.file_type == osfile_TYPE_TEXT &&
- ro_gui_window_import_text(g,
- message->data.data_xfer.file_name)) {
- os_error *error;
-
- /* send DataLoadAck */
- message->action = message_DATA_LOAD_ACK;
- message->your_ref = message->my_ref;
- error = xwimp_send_message(wimp_USER_MESSAGE, message,
- message->sender);
- if (error) {
- LOG("xwimp_send_message: 0x%x: %s\n", error->errnum, error->errmess);
- ro_warn_user("WimpError", error->errmess);
- }
- return true;
- }
- return false;
+ ro_gui_save_prepare(GUI_SAVE_LINK_URL, NULL, NULL, url, title);
+ ro_gui_dialog_open_persistent(g->window, dialog_saveas, true);
+ return NSERROR_OK;
}
-/*
- * Helper code for the Wimp Event Handlers.
- */
-
/**
- * Check if a particular menu handle is a browser window menu
+ * Display a menu of options for a form select control.
*
- * \param *menu The menu in question.
- * \return true if this menu is a browser window menu
+ * \param g gui window containing form control
+ * \param control form control of type GADGET_SELECT
*/
-
-bool ro_gui_window_check_menu(wimp_menu *menu)
+static void
+gui_window_create_form_select_menu(struct gui_window *g,
+ struct form_control *control)
{
- return (ro_gui_browser_window_menu == menu) ? true : false;
-}
-
-
-/**
- * Return boolean flags to show what RISC OS types we can sensibly convert
- * the given object into.
- *
- * \todo This should probably be somewhere else but in window.c, and
- * should probably even be done in content_().
- *
- * \param h The object to test.
- * \param export_draw true on exit if a drawfile would be possible.
- * \param export_sprite true on exit if a sprite would be possible.
- * \return true if valid data is returned; else false.
- */
+ os_error *error;
+ wimp_pointer pointer;
-bool ro_gui_window_content_export_types(struct hlcache_handle *h,
- bool *export_draw, bool *export_sprite)
-{
- bool found_type = false;
+ /* The first time the menu is opened, control bypasses the normal
+ * Menu Prepare event and so we prepare here. On any re-opens,
+ * ro_gui_window_prepare_form_select_menu() is called from the
+ * normal wimp event.
+ */
- if (export_draw != NULL)
- *export_draw = false;
- if (export_sprite != NULL)
- *export_sprite = false;
+ if (!ro_gui_window_prepare_form_select_menu(g, control))
+ return;
- if (h != NULL && content_get_type(h) == CONTENT_IMAGE) {
- switch (ro_content_native_type(h)) {
- case osfile_TYPE_SPRITE:
- /* bitmap types (Sprite export possible) */
- found_type = true;
- if (export_sprite != NULL)
- *export_sprite = true;
- break;
- case osfile_TYPE_DRAW:
- /* vector types (Draw export possible) */
- found_type = true;
- if (export_draw != NULL)
- *export_draw = true;
- break;
- default:
- break;
- }
+ error = xwimp_get_pointer_info(&pointer);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ ro_gui_menu_destroy();
+ return;
}
- return found_type;
+ gui_form_select_control = control;
+ ro_gui_menu_create(gui_form_select_menu,
+ pointer.pos.x, pointer.pos.y, g->window);
}
/**
- * Prepare the page info window for use.
+ * Import text file into window
*
- * \param *g The GUI window block to use.
+ * \param g gui window containing textarea
+ * \param filename pathname of file to be imported
+ * \return true iff successful
*/
-
-void ro_gui_window_prepare_pageinfo(struct gui_window *g)
+static bool
+ro_gui_window_import_text(struct gui_window *g, const char *filename)
{
- struct hlcache_handle *h = browser_window_get_content(g->bw);
- char icon_buf[20] = "file_xxx";
- char enc_buf[40];
- const char *icon = icon_buf;
- const char *title, *url;
- lwc_string *mime;
- const char *enc = "-";
-
- assert(h);
-
- title = content_get_title(h);
- if (title == NULL)
- title = "-";
- url = nsurl_access(hlcache_handle_get_url(h));
- if (url == NULL)
- url = "-";
- mime = content_get_mime_type(h);
-
- sprintf(icon_buf, "file_%x", ro_content_filetype(h));
- if (!ro_gui_wimp_sprite_exists(icon_buf))
- sprintf(icon_buf, "file_xxx");
+ fileswitch_object_type obj_type;
+ os_error *error;
+ char *buf, *utf8_buf, *sp;
+ int size;
+ nserror ret;
+ const char *ep;
+ char *p;
- if (content_get_type(h) == CONTENT_HTML) {
- if (content_get_encoding(h, CONTENT_ENCODING_NORMAL)) {
- snprintf(enc_buf, sizeof enc_buf, "%s (%s)",
- content_get_encoding(h, CONTENT_ENCODING_NORMAL),
- content_get_encoding(h, CONTENT_ENCODING_SOURCE));
- enc = enc_buf;
- } else {
- enc = messages_get("EncodingUnk");
- }
+ error = xosfile_read_stamped(filename, &obj_type, NULL, NULL,
+ &size, NULL, NULL);
+ if (error) {
+ NSLOG(netsurf, INFO, "xosfile_read_stamped: 0x%x:%s",
+ error->errnum, error->errmess);
+ ro_warn_user("FileError", error->errmess);
+ return true; /* was for us, but it didn't work! */
}
- ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_ICON,
- icon, true);
- ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_TITLE,
- title, true);
- ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_URL,
- url, true);
- ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_ENC,
- enc, true);
- ro_gui_set_icon_string(dialog_pageinfo, ICON_PAGEINFO_TYPE,
- lwc_string_data(mime), true);
-
- lwc_string_unref(mime);
-}
-
+ /* Allocate one byte more than needed to ensure that the buffer is
+ * always terminated, regardless of file contents.
+ */
-/**
- * Prepare the object info window for use
- *
- * \param *object the object for which information is to be displayed
- * \param *target_url corresponding url, if any
- */
+ buf = calloc(size + 1, sizeof(char));
+ if (!buf) {
+ ro_warn_user("NoMemory", NULL);
+ return true;
+ }
-void ro_gui_window_prepare_objectinfo(struct hlcache_handle *object, nsurl *target_url)
-{
- char icon_buf[20] = "file_xxx";
- const char *url;
- lwc_string *mime;
- const char *target = "-";
+ error = xosfile_load_stamped(filename, (byte*)buf,
+ NULL, NULL, NULL, NULL, NULL);
- sprintf(icon_buf, "file_%.3x",ro_content_filetype(object));
- if (!ro_gui_wimp_sprite_exists(icon_buf)) {
- sprintf(icon_buf, "file_xxx");
+ if (error) {
+ NSLOG(netsurf, INFO, "xosfile_load_stamped: 0x%x:%s",
+ error->errnum, error->errmess);
+ ro_warn_user("LoadError", error->errmess);
+ free(buf);
+ return true;
}
- url = nsurl_access(hlcache_handle_get_url(object));
- if (url == NULL) {
- url = "-";
+ ret = utf8_from_local_encoding(buf, size, &utf8_buf);
+ if (ret != NSERROR_OK) {
+ /* bad encoding shouldn't happen */
+ assert(ret != NSERROR_BAD_ENCODING);
+ NSLOG(netsurf, INFO, "utf8_from_local_encoding failed");
+ free(buf);
+ ro_warn_user("NoMemory", NULL);
+ return true;
}
- mime = content_get_mime_type(object);
+ size = strlen(utf8_buf);
- if (target_url != NULL) {
- target = nsurl_access(target_url);
- }
+ ep = utf8_buf + size;
+ p = utf8_buf;
- ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_ICON,
- icon_buf, true);
- ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_URL,
- url, true);
- ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_TARGET,
- target, true);
- ro_gui_set_icon_string(dialog_objinfo, ICON_OBJINFO_TYPE,
- lwc_string_data(mime), true);
+ /* skip leading whitespace */
+ while (isspace(*p)) p++;
- lwc_string_unref(mime);
-}
+ sp = p;
+ while (*p && *p != '\r' && *p != '\n')
+ p += utf8_next(p, ep - p, 0);
+ *p = '\0';
+ if (p > sp)
+ ro_gui_window_launch_url(g, sp);
+
+ free(buf);
+ free(utf8_buf);
+ return true;
+}
-/*
- * User Actions in the browser window
- */
/**
- * Launch a new url in the given window.
- *
- * \param g gui_window to update
- * \param url1 url to be launched
+ * RISC OS browser window operation table
*/
+static struct gui_window_table window_table = {
+ .create = gui_window_create,
+ .destroy = gui_window_destroy,
+ .invalidate = ro_gui_window_invalidate_area,
+ .get_scroll = gui_window_get_scroll,
+ .set_scroll = gui_window_set_scroll,
+ .get_dimensions = gui_window_get_dimensions,
+ .update_extent = gui_window_update_extent,
-void ro_gui_window_launch_url(struct gui_window *g, const char *url1)
-{
- nserror error;
- nsurl *url;
+ .set_title = gui_window_set_title,
+ .set_url = ro_gui_window_set_url,
+ .set_icon = gui_window_set_icon,
+ .set_status = riscos_window_set_status,
+ .set_pointer = gui_window_set_pointer,
+ .place_caret = gui_window_place_caret,
+ .remove_caret = gui_window_remove_caret,
+ .save_link = gui_window_save_link,
+ .drag_start = gui_window_drag_start,
+ .scroll_start = gui_window_scroll_start,
+ .new_content = gui_window_new_content,
+ .start_throbber = gui_window_start_throbber,
+ .stop_throbber = gui_window_stop_throbber,
+ .create_form_select_menu = gui_window_create_form_select_menu,
- if (url1 == NULL)
- return;
+ /* from save */
+ .drag_save_object = gui_drag_save_object,
+ .drag_save_selection =gui_drag_save_selection,
- ro_gui_url_complete_close();
+ /* from textselection */
+ .start_selection = gui_start_selection,
+};
- error = nsurl_create(url1, &url);
- if (error != NSERROR_OK) {
- ro_warn_user(messages_get_errorcode(error), 0);
- } else {
- ro_gui_window_set_url(g, url);
+struct gui_window_table *riscos_window_table = &window_table;
- browser_window_navigate(g->bw, url,
- NULL, BW_NAVIGATE_HISTORY,
- NULL, NULL, NULL);
- nsurl_unref(url);
- }
-}
+/* exported interface documented in riscos/window.h */
+void ro_gui_window_initialise(void)
+{
+ /* Build the browser window menu. */
-/**
- * Perform a Navigate Home action on a browser window.
- *
- * \param *g The browser window to act on.
- */
+ static const struct ns_menu browser_definition = {
+ "NetSurf", {
+ { "Page", BROWSER_PAGE, 0 },
+ { "Page.PageInfo",BROWSER_PAGE_INFO, &dialog_pageinfo },
+ { "Page.Save", BROWSER_SAVE, &dialog_saveas },
+ { "Page.SaveComp", BROWSER_SAVE_COMPLETE, &dialog_saveas },
+ { "Page.Export", NO_ACTION, 0 },
+#ifdef WITH_DRAW_EXPORT
+ { "Page.Export.Draw", BROWSER_EXPORT_DRAW, &dialog_saveas },
+#endif
+#ifdef WITH_PDF_EXPORT
+ { "Page.Export.PDF", BROWSER_EXPORT_PDF, &dialog_saveas },
+#endif
+ { "Page.Export.Text", BROWSER_EXPORT_TEXT, &dialog_saveas },
+ { "Page.SaveURL", NO_ACTION, 0 },
+ { "Page.SaveURL.URI", BROWSER_SAVE_URL_URI, &dialog_saveas },
+ { "Page.SaveURL.URL", BROWSER_SAVE_URL_URL, &dialog_saveas },
+ { "Page.SaveURL.LinkText", BROWSER_SAVE_URL_TEXT, &dialog_saveas },
+ { "_Page.Print", BROWSER_PRINT, &dialog_print },
+ { "Page.NewWindow", BROWSER_NEW_WINDOW, 0 },
+ { "Page.FindText", BROWSER_FIND_TEXT, &dialog_search },
+ { "Page.ViewSrc", BROWSER_VIEW_SOURCE, 0 },
+ { "Object", BROWSER_OBJECT, 0 },
+ { "Object.Object", BROWSER_OBJECT_OBJECT, 0 },
+ { "Object.Object.ObjInfo", BROWSER_OBJECT_INFO, &dialog_objinfo },
+ { "Object.Object.ObjSave", BROWSER_OBJECT_SAVE, &dialog_saveas },
+ { "Object.Object.Export", BROWSER_OBJECT_EXPORT, 0 },
+ { "Object.Object.Export.Sprite", BROWSER_OBJECT_EXPORT_SPRITE, &dialog_saveas },
+#ifdef WITH_DRAW_EXPORT
+ { "Object.Object.Export.ObjDraw", BROWSER_OBJECT_EXPORT_DRAW, &dialog_saveas },
+#endif
+ { "Object.Object.SaveURL", NO_ACTION, 0 },
+ { "Object.Object.SaveURL.URI", BROWSER_OBJECT_SAVE_URL_URI, &dialog_saveas },
+ { "Object.Object.SaveURL.URL", BROWSER_OBJECT_SAVE_URL_URL, &dialog_saveas },
+ { "Object.Object.SaveURL.LinkText", BROWSER_OBJECT_SAVE_URL_TEXT, &dialog_saveas },
+ { "Object.Object.ObjPrint", BROWSER_OBJECT_PRINT, 0 },
+ { "Object.Object.ObjReload", BROWSER_OBJECT_RELOAD, 0 },
+ { "Object.Link", BROWSER_OBJECT_LINK, 0 },
+ { "Object.Link.LinkSave", BROWSER_LINK_SAVE, 0 },
+ { "Object.Link.LinkSave.URI", BROWSER_LINK_SAVE_URI, &dialog_saveas },
+ { "Object.Link.LinkSave.URL", BROWSER_LINK_SAVE_URL, &dialog_saveas },
+ { "Object.Link.LinkSave.LinkText", BROWSER_LINK_SAVE_TEXT, &dialog_saveas },
+ { "_Object.Link.LinkDload", BROWSER_LINK_DOWNLOAD, 0 },
+ { "Object.Link.LinkNew", BROWSER_LINK_NEW_WINDOW, 0 },
+ { "Selection", BROWSER_SELECTION, 0 },
+ { "_Selection.SelSave", BROWSER_SELECTION_SAVE, &dialog_saveas },
+ { "Selection.Copy", BROWSER_SELECTION_COPY, 0 },
+ { "Selection.Cut", BROWSER_SELECTION_CUT, 0 },
+ { "_Selection.Paste", BROWSER_SELECTION_PASTE, 0 },
+ { "Selection.Clear", BROWSER_SELECTION_CLEAR, 0 },
+ { "Selection.SelectAll", BROWSER_SELECTION_ALL, 0 },
+ { "Navigate", NO_ACTION, 0 },
+ { "Navigate.Home", BROWSER_NAVIGATE_HOME, 0 },
+ { "Navigate.Back", BROWSER_NAVIGATE_BACK, 0 },
+ { "Navigate.Forward", BROWSER_NAVIGATE_FORWARD, 0 },
+ { "_Navigate.UpLevel", BROWSER_NAVIGATE_UP, 0 },
+ { "Navigate.Reload", BROWSER_NAVIGATE_RELOAD_ALL, 0 },
+ { "Navigate.Stop", BROWSER_NAVIGATE_STOP, 0 },
+ { "View", NO_ACTION, 0 },
+ { "View.ScaleView", BROWSER_SCALE_VIEW, &dialog_zoom },
+ { "View.Images", NO_ACTION, 0 },
+ { "View.Images.ForeImg", BROWSER_IMAGES_FOREGROUND, 0 },
+ { "View.Images.BackImg", BROWSER_IMAGES_BACKGROUND, 0 },
+ { "View.Toolbars", NO_ACTION, 0 },
+ { "View.Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
+ { "View.Toolbars.ToolAddress", TOOLBAR_ADDRESS_BAR, 0 },
+ { "_View.Toolbars.ToolThrob", TOOLBAR_THROBBER, 0 },
+ { "View.Toolbars.EditToolbar", TOOLBAR_EDIT, 0 },
+ { "_View.Render", NO_ACTION, 0 },
+ { "View.Render.RenderAnims", BROWSER_BUFFER_ANIMS, 0 },
+ { "View.Render.RenderAll", BROWSER_BUFFER_ALL, 0 },
+ { "_View.OptDefault", BROWSER_SAVE_VIEW, 0 },
+ { "View.Window", NO_ACTION, 0 },
+ { "View.Window.WindowSave", BROWSER_WINDOW_DEFAULT, 0 },
+ { "View.Window.WindowStagr", BROWSER_WINDOW_STAGGER, 0 },
+ { "_View.Window.WindowSize", BROWSER_WINDOW_COPY, 0 },
+ { "View.Window.WindowReset", BROWSER_WINDOW_RESET, 0 },
+ { "Utilities", NO_ACTION, 0 },
+ { "Utilities.Hotlist", HOTLIST_SHOW, 0 },
+ { "Utilities.Hotlist.HotlistAdd", HOTLIST_ADD_URL, 0 },
+ { "Utilities.Hotlist.HotlistShow", HOTLIST_SHOW, 0 },
+ { "Utilities.History", HISTORY_SHOW_GLOBAL, 0 },
+ { "Utilities.History.HistLocal", HISTORY_SHOW_LOCAL, 0 },
+ { "Utilities.History.HistGlobal", HISTORY_SHOW_GLOBAL, 0 },
+ { "Utilities.Cookies", COOKIES_SHOW, 0 },
+ { "Utilities.Cookies.ShowCookies", COOKIES_SHOW, 0 },
+ { "Utilities.Cookies.DeleteCookies", COOKIES_DELETE, 0 },
+ { "Help", HELP_OPEN_CONTENTS, 0 },
+ { "Help.HelpContent", HELP_OPEN_CONTENTS, 0 },
+ { "Help.HelpGuide", HELP_OPEN_GUIDE, 0 },
+ { "_Help.HelpInfo", HELP_OPEN_INFORMATION, 0 },
+ { "Help.HelpCredits", HELP_OPEN_CREDITS, 0 },
+ { "_Help.HelpLicence", HELP_OPEN_LICENCE, 0 },
+ { "Help.HelpInter", HELP_LAUNCH_INTERACTIVE, 0 },
+ {NULL, 0, 0}
+ }
+ };
+ ro_gui_browser_window_menu =
+ ro_gui_menu_define_menu(&browser_definition);
+
+}
-void ro_gui_window_action_home(struct gui_window *g)
+
+/* exported interface documented in riscos/window.h */
+nserror
+ro_gui_window_invalidate_area(struct gui_window *g, const struct rect *rect)
{
- static const char *addr = NETSURF_HOMEPAGE;
- nsurl *url;
- nserror error;
+ bool use_buffer;
+ int x0, y0, x1, y1;
+ struct update_box *cur;
+ wimp_window_info info;
+ os_error *error;
- if (g == NULL || g->bw == NULL)
- return;
+ assert(g);
- if (nsoption_charp(homepage_url) != NULL) {
- addr = nsoption_charp(homepage_url);
+ if (rect == NULL) {
+ info.w = g->window;
+ error = xwimp_get_window_info_header_only(&info);
+ if (error) {
+ NSLOG(netsurf, INFO,
+ "xwimp_get_window_info_header_only: 0x%x: %s",
+ error->errnum,
+ error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_INVALID;
+ }
+
+ error = xwimp_force_redraw(g->window,
+ info.extent.x0, info.extent.y0,
+ info.extent.x1, info.extent.y1);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ return NSERROR_INVALID;
+ }
+ return NSERROR_OK;
}
- error = nsurl_create(addr, &url);
- if (error == NSERROR_OK) {
- error = browser_window_navigate(g->bw,
- url,
- NULL,
- BW_NAVIGATE_HISTORY,
- NULL,
- NULL,
- NULL);
- nsurl_unref(url);
+ x0 = floorf(rect->x0 * 2 * g->scale);
+ y0 = -ceilf(rect->y1 * 2 * g->scale);
+ x1 = ceilf(rect->x1 * 2 * g->scale) + 1;
+ y1 = -floorf(rect->y0 * 2 * g->scale) + 1;
+ use_buffer =
+ (g->option.buffer_everything || g->option.buffer_animations);
+
+ /* try to optimise buffered redraws */
+ if (use_buffer) {
+ for (cur = pending_updates; cur != NULL; cur = cur->next) {
+ if ((cur->g != g) || (!cur->use_buffer)) {
+ continue;
+ }
+ if ((((cur->x0 - x1) < MARGIN) ||
+ ((cur->x1 - x0) < MARGIN)) &&
+ (((cur->y0 - y1) < MARGIN) ||
+ ((cur->y1 - y0) < MARGIN))) {
+ cur->x0 = min(cur->x0, x0);
+ cur->y0 = min(cur->y0, y0);
+ cur->x1 = max(cur->x1, x1);
+ cur->y1 = max(cur->y1, y1);
+ return NSERROR_OK;
+ }
+ }
}
- if (error != NSERROR_OK) {
- ro_warn_user(messages_get_errorcode(error), 0);
+ cur = malloc(sizeof(struct update_box));
+ if (!cur) {
+ NSLOG(netsurf, INFO, "No memory for malloc.");
+ return NSERROR_NOMEM;
}
-}
+ cur->x0 = x0;
+ cur->y0 = y0;
+ cur->x1 = x1;
+ cur->y1 = y1;
+ cur->next = pending_updates;
+ pending_updates = cur;
+ cur->g = g;
+ cur->use_buffer = use_buffer;
+
+ return NSERROR_OK;
+}
-/**
- * Open a new browser window.
- *
- * \param *g The browser window to act on.
- */
-void ro_gui_window_action_new_window(struct gui_window *g)
+/* exported function documented in riscos/window.h */
+nserror ro_gui_window_set_url(struct gui_window *g, nsurl *url)
{
- nserror error;
+ size_t idn_url_l;
+ char *idn_url_s = NULL;
- if (g == NULL || g->bw == NULL)
- return;
+ if (g->toolbar) {
+ if (nsoption_bool(display_decoded_idn) == true) {
+ if (nsurl_get_utf8(url, &idn_url_s, &idn_url_l) != NSERROR_OK)
+ idn_url_s = NULL;
+ }
- error = browser_window_create(BW_CREATE_CLONE,
- browser_window_get_url(g->bw),
- NULL, g->bw, NULL);
+ ro_toolbar_set_url(g->toolbar, idn_url_s ? idn_url_s : nsurl_access(url), true, false);
- if (error != NSERROR_OK) {
- ro_warn_user(messages_get_errorcode(error), 0);
+ if (idn_url_s)
+ free(idn_url_s);
+
+ ro_gui_url_complete_start(g->toolbar);
}
-}
+ return NSERROR_OK;
+}
-/**
- * Open a local history pane for a browser window.
- *
- * \param *g The browser window to act on.
- */
-void ro_gui_window_action_local_history(struct gui_window *g)
+/* exported interface documented in riscos/window.h */
+void ro_gui_window_set_scale(struct gui_window *g, float scale)
{
- if (g != NULL && g->bw != NULL)
- ro_gui_history_open(g, true);
+ g->scale = scale;
+ browser_window_set_scale(g->bw, scale, true);
}
-/**
- * Open a save dialogue for a browser window contents.
- *
- * \param *g The browser window to act on.
- * \param save_type The type of save to open.
- */
-
-void ro_gui_window_action_save(struct gui_window *g, gui_save_type save_type)
+/* exported interface documented in riscos/window.h */
+bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message)
{
- struct hlcache_handle *h;
-
- if (g == NULL || g->bw == NULL || !browser_window_has_content(g->bw))
- return;
-
- h = browser_window_get_content(g->bw);
- if (h == NULL)
- return;
+ os_error *error;
+ os_coord pos;
- ro_gui_save_prepare(save_type, h, NULL, NULL, NULL);
- ro_gui_dialog_open_persistent(g->window, dialog_saveas, true);
-}
+ /* Ignore directories etc. */
+ if (0x1000 <= message->data.data_xfer.file_type)
+ return false;
+ if (!ro_gui_window_to_window_pos(g, message->data.data_xfer.pos.x,
+ message->data.data_xfer.pos.y, &pos))
+ return false;
-/**
- * Open a text search dialogue for a browser window.
- *
- * \param *g The browser window to act on.
- */
+ if (browser_window_drop_file_at_point(g->bw, pos.x, pos.y,
+ message->data.data_xfer.file_name) == false)
+ return false;
-void ro_gui_window_action_search(struct gui_window *g)
-{
- if (g == NULL || g->bw == NULL || !browser_window_can_search(g->bw))
- return;
+ /* send DataLoadAck */
+ message->action = message_DATA_LOAD_ACK;
+ message->your_ref = message->my_ref;
+ error = xwimp_send_message(wimp_USER_MESSAGE, message, message->sender);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s\n",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ }
- ro_gui_search_prepare(g->bw);
- ro_gui_dialog_open_persistent(g->window, dialog_search, true);
+ return true;
}
-/**
- * Open a zoom dialogue for a browser window.
- *
- * \param *g The browser window to act on.
- */
-
-void ro_gui_window_action_zoom(struct gui_window *g)
+/* exported interface documented in riscos/window.h */
+void ro_gui_window_mouse_at(wimp_pointer *pointer, void *data)
{
- if (g == NULL)
- return;
+ os_coord pos;
+ struct gui_window *g = (struct gui_window *) data;
- ro_gui_dialog_prepare_zoom(g);
- ro_gui_dialog_open_persistent(g->window, dialog_zoom, true);
+ if (ro_gui_window_to_window_pos(g, pointer->pos.x, pointer->pos.y, &pos))
+ browser_window_mouse_track(g->bw,
+ ro_gui_mouse_drag_state(pointer->buttons,
+ wimp_BUTTON_DOUBLE_CLICK_DRAG),
+ pos.x, pos.y);
}
-/**
- * Add a hotlist entry for a browser window.
- *
- * \param *g The browser window to act on.
- */
-
-static void ro_gui_window_action_add_bookmark(struct gui_window *g)
+/* exported interface documented in riscos/window.h */
+void
+ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi)
{
- nsurl *url;
+ /* sadly there is no 'legal' way to get the sprite into
+ * the Wimp sprite pool other than via a filing system */
+ const char *temp_fname = "Pipe:$._tmpfile";
+ struct browser_window *bw = g->bw;
+ osspriteop_header *overlay = NULL;
+ osspriteop_header *sprite_header;
+ struct bitmap *bitmap;
+ osspriteop_area *area;
+ int width = 34, height = 34;
+ struct hlcache_handle *h;
+ os_error *error;
+ int len, id;
- if (g == NULL || g->bw == NULL || g->toolbar == NULL ||
- browser_window_has_content(g->bw) == false)
- return;
+ assert(bw);
- url = browser_window_get_url(g->bw);
+ h = browser_window_get_content(bw);
+ if (!h) return;
- ro_gui_hotlist_add_page(url);
- ro_toolbar_update_hotlist(g->toolbar);
-}
+ /* if an overlay sprite is defined, locate it and gets its dimensions
+ * so that we can produce a thumbnail with the same dimensions */
+ if (!ro_gui_wimp_get_sprite("ic_netsfxx", &overlay)) {
+ error = xosspriteop_read_sprite_info(osspriteop_PTR,
+ (osspriteop_area *)0x100,
+ (osspriteop_id)overlay, &width, &height, NULL,
+ NULL);
+ if (error) {
+ NSLOG(netsurf, INFO,
+ "xosspriteop_read_sprite_info: 0x%x: %s",
+ error->errnum,
+ error->errmess);
+ ro_warn_user("MiscError", error->errmess);
+ overlay = NULL;
+ } else if (sprite_bpp(overlay) != 8) {
+ NSLOG(netsurf, INFO, "overlay sprite is not 8bpp");
+ overlay = NULL;
+ }
+ }
+ /* create the thumbnail sprite */
+ bitmap = riscos_bitmap_create(width, height,
+ BITMAP_NEW | BITMAP_OPAQUE | BITMAP_CLEAR_MEMORY);
+ if (!bitmap) {
+ NSLOG(netsurf, INFO, "Thumbnail initialisation failed.");
+ return;
+ }
+ riscos_bitmap_render(bitmap, h);
+ if (overlay) {
+ riscos_bitmap_overlay_sprite(bitmap, overlay);
+ }
+ area = riscos_bitmap_convert_8bpp(bitmap);
+ riscos_bitmap_destroy(bitmap);
+ if (!area) {
+ NSLOG(netsurf, INFO, "Thumbnail conversion failed.");
+ return;
+ }
-/**
- * Remove a hotlist entry for a browser window.
- *
- * \param *g The browser window to act on.
- */
+ /* choose a suitable sprite name */
+ id = 0;
+ while (iconise_used[id])
+ if ((unsigned)++id >= NOF_ELEMENTS(iconise_used)) {
+ id = iconise_next;
+ if ((unsigned)++iconise_next >=
+ NOF_ELEMENTS(iconise_used))
+ iconise_next = 0;
+ break;
+ }
-static void ro_gui_window_action_remove_bookmark(struct gui_window *g)
-{
- nsurl *url;
+ sprite_header = (osspriteop_header *)(area + 1);
+ len = sprintf(sprite_header->name, "ic_netsf%.2d", id);
- if (g == NULL || g->bw == NULL || g->toolbar == NULL ||
- browser_window_has_content(g->bw) == false)
+ error = xosspriteop_save_sprite_file(osspriteop_USER_AREA,
+ area, temp_fname);
+ if (error) {
+ NSLOG(netsurf, INFO, "xosspriteop_save_sprite_file: 0x%x:%s",
+ error->errnum, error->errmess);
+ ro_warn_user("MiscError", error->errmess);
+ free(area);
return;
+ }
- url = browser_window_get_url(g->bw);
-
- ro_gui_hotlist_remove_page(url);
-}
+ error = xwimpspriteop_merge_sprite_file(temp_fname);
+ if (error) {
+ NSLOG(netsurf, INFO,
+ "xwimpspriteop_merge_sprite_file: 0x%x:%s",
+ error->errnum,
+ error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ remove(temp_fname);
+ free(area);
+ return;
+ }
+ memcpy(wi->sprite_name, sprite_header->name + 3, len - 2); /* inc NUL */
+ strncpy(wi->title, g->title, sizeof(wi->title));
+ wi->title[sizeof(wi->title) - 1] = '\0';
-/**
- * Open a print dialogue for a browser window.
- *
- * \param *g The browser window to act on.
- */
+ if (wimptextop_string_width(wi->title, 0) > 182) {
+ /* work around bug in Pinboard where it will fail to display
+ * the icon if the text is very wide */
+ if (strlen(wi->title) > 10)
+ wi->title[10] = '\0'; /* pinboard does this anyway */
+ while (wimptextop_string_width(wi->title, 0) > 182)
+ wi->title[strlen(wi->title) - 1] = '\0';
+ }
-void ro_gui_window_action_print(struct gui_window *g)
-{
- if (g == NULL)
- return;
+ wi->size = sizeof(wimp_full_message_window_info);
+ wi->your_ref = wi->my_ref;
+ error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message*)wi,
+ wi->sender);
+ if (error) {
+ NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x:%s",
+ error->errnum, error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ }
+ else {
+ g->iconise_icon = id;
+ iconise_used[id] = true;
+ }
- ro_gui_print_prepare(g);
- ro_gui_dialog_open_persistent(g->window, dialog_print, true);
+ free(area);
}
-/**
- * Open a page info box for a browser window.
- *
- * \param *g The browser window to act on.
- */
-
-void ro_gui_window_action_page_info(struct gui_window *g)
+/* exported interface documented in riscos/window.h */
+bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message)
{
- if (g == NULL || g->bw == NULL ||
- browser_window_has_content(g->bw) == false)
- return;
+ if (message->data.data_xfer.file_type == osfile_TYPE_TEXT &&
+ ro_gui_window_import_text(g,
+ message->data.data_xfer.file_name)) {
+ os_error *error;
- ro_gui_window_prepare_pageinfo(g);
- ro_gui_dialog_open_persistent(g->window, dialog_pageinfo, false);
+ /* send DataLoadAck */
+ message->action = message_DATA_LOAD_ACK;
+ message->your_ref = message->my_ref;
+ error = xwimp_send_message(wimp_USER_MESSAGE, message,
+ message->sender);
+ if (error) {
+ NSLOG(netsurf, INFO,
+ "xwimp_send_message: 0x%x: %s\n",
+ error->errnum,
+ error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ }
+ return true;
+ }
+ return false;
}
-/*
- * Window and Toolbar Redraw and Update
- */
-
-/**
- * Redraws the content for all windows.
- */
-
-void ro_gui_window_redraw_all(void)
+/* exported interface documented in riscos/window.h */
+bool ro_gui_window_check_menu(wimp_menu *menu)
{
- struct gui_window *g;
- for (g = window_list; g; g = g->next)
- gui_window_redraw_window(g);
+ return (ro_gui_browser_window_menu == menu) ? true : false;
}
-/**
- * Remove all pending update boxes for a window
- *
- * \param g gui_window
- */
-void ro_gui_window_remove_update_boxes(struct gui_window *g)
+/* exported interface documented in riscos/window.h */
+void ro_gui_window_redraw_all(void)
{
- struct update_box *cur;
-
- for (cur = pending_updates; cur != NULL; cur = cur->next) {
- if (cur->g == g)
- cur->g = NULL;
+ struct gui_window *g;
+ for (g = window_list; g; g = g->next) {
+ ro_gui_window_invalidate_area(g, NULL);
}
}
-/**
- * Redraw any pending update boxes.
- */
+/* exported interface documented in riscos/window.h */
void ro_gui_window_update_boxes(void)
{
osbool more;
@@ -4158,7 +4601,8 @@ void ro_gui_window_update_boxes(void)
error = xwimp_update_window(&update, &more);
if (error) {
- LOG("xwimp_update_window: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_update_window: 0x%x: %s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
continue;
}
@@ -4191,7 +4635,10 @@ void ro_gui_window_update_boxes(void)
* found. This appears to be a bug in RISC OS. */
if (error && !(use_buffer &&
error->errnum == error_WIMP_GET_RECT)) {
- LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO,
+ "xwimp_get_rectangle: 0x%x: %s",
+ error->errnum,
+ error->errmess);
ro_warn_user("WimpError", error->errmess);
ro_gui_current_redraw_gui = NULL;
continue;
@@ -4210,22 +4657,7 @@ void ro_gui_window_update_boxes(void)
}
-/**
- * callback from core to reformat a window.
- */
-static void riscos_window_reformat(struct gui_window *gw)
-{
- if (gw != NULL) {
- browser_window_reformat(gw->bw, false,
- gw->old_width / 2,
- gw->old_height / 2);
- }
-}
-
-/**
- * Destroy all browser windows.
- */
-
+/* exported interface documented in riscos/window.h */
void ro_gui_window_quit(void)
{
while (window_list) {
@@ -4237,13 +4669,10 @@ void ro_gui_window_quit(void)
}
-/**
- * Animate the "throbbers" of all browser windows.
- */
-
+/* exported interface documented in riscos/window.h */
void ro_gui_throb(void)
{
- struct gui_window *g;
+ struct gui_window *g;
for (g = window_list; g; g = g->next) {
if (!g->active)
@@ -4254,245 +4683,7 @@ void ro_gui_throb(void)
}
-/**
- * Update the toolbar buttons for a given browser window to reflect the
- * current state of its contents.
- *
- * Note that the parameters to this function are arranged so that it can be
- * supplied to the toolbar module as an button state update callback.
- *
- * \param *g The browser window to update.
- */
-
-void ro_gui_window_update_toolbar_buttons(struct gui_window *g)
-{
- struct browser_window *bw;
- struct toolbar *toolbar;
-
- if (g == NULL || g->toolbar == NULL)
- return;
-
- bw = g->bw;
- toolbar = g->toolbar;
-
- ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_RELOAD,
- !browser_window_reload_available(bw));
-
- ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_STOP,
- !browser_window_stop_available(bw));
-
- ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_BACK,
- !browser_window_back_available(bw));
-
- ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_FORWARD,
- !browser_window_forward_available(bw));
-
- ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_UP,
- !browser_window_up_available(bw));
-
- ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_SEARCH,
- !browser_window_can_search(bw));
-
- ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_SCALE,
- !browser_window_has_content(bw));
-
- ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_PRINT,
- !browser_window_has_content(bw));
-
- ro_toolbar_set_button_shaded_state(toolbar, TOOLBAR_BUTTON_SAVE_SOURCE,
- !browser_window_has_content(bw));
-
- ro_toolbar_update_urlsuggest(toolbar);
-}
-
-
-/**
- * Update a window to reflect a change in toolbar size: used as a callback by
- * the toolbar module when a toolbar height changes.
- *
- * \param *data void pointer the window's gui_window struct
- */
-
-void ro_gui_window_update_toolbar(void *data)
-{
- struct gui_window *g = (struct gui_window *) data;
-
- if (g != NULL)
- gui_window_update_extent(g);
-}
-
-
-/**
- * Save a new toolbar button configuration: used as a callback by the toolbar
- * module when a buttonbar edit has finished.
- *
- * \param *data void pointer to the window's gui_window struct
- * \param *config pointer to a malloc()'d button config string.
- */
-
-void ro_gui_window_save_toolbar_buttons(void *data, char *config)
-{
- nsoption_set_charp(toolbar_browser, config);
- ro_gui_save_options();
-}
-
-
-/**
- * Update a window and its toolbar to reflect a new theme: used as a callback
- * by the toolbar module when a theme change affects a toolbar.
- *
- * \param *data void pointer to the window's gui_window struct
- * \param ok true if the bar still exists; else false.
- */
-
-void ro_gui_window_update_theme(void *data, bool ok)
-{
- struct gui_window *g = (struct gui_window *) data;
-
- if (g != NULL && g->toolbar != NULL) {
- if (ok) {
- gui_window_update_extent(g);
- } else {
- g->toolbar = NULL;
- }
- }
-}
-
-
-/*
- * General Window Support
- */
-
-/**
- * Import text file into window
- *
- * \param g gui window containing textarea
- * \param filename pathname of file to be imported
- * \return true iff successful
- */
-
-bool ro_gui_window_import_text(struct gui_window *g, const char *filename)
-{
- fileswitch_object_type obj_type;
- os_error *error;
- char *buf, *utf8_buf, *sp;
- int size;
- nserror ret;
- const char *ep;
- char *p;
-
- error = xosfile_read_stamped(filename, &obj_type, NULL, NULL,
- &size, NULL, NULL);
- if (error) {
- LOG("xosfile_read_stamped: 0x%x:%s", error->errnum, error->errmess);
- ro_warn_user("FileError", error->errmess);
- return true; /* was for us, but it didn't work! */
- }
-
- /* Allocate one byte more than needed to ensure that the buffer is
- * always terminated, regardless of file contents.
- */
-
- buf = calloc(size + 1, sizeof(char));
- if (!buf) {
- ro_warn_user("NoMemory", NULL);
- return true;
- }
-
- error = xosfile_load_stamped(filename, (byte*)buf,
- NULL, NULL, NULL, NULL, NULL);
-
- if (error) {
- LOG("xosfile_load_stamped: 0x%x:%s", error->errnum, error->errmess);
- ro_warn_user("LoadError", error->errmess);
- free(buf);
- return true;
- }
-
- ret = utf8_from_local_encoding(buf, size, &utf8_buf);
- if (ret != NSERROR_OK) {
- /* bad encoding shouldn't happen */
- assert(ret != NSERROR_BAD_ENCODING);
- LOG("utf8_from_local_encoding failed");
- free(buf);
- ro_warn_user("NoMemory", NULL);
- return true;
- }
- size = strlen(utf8_buf);
-
- ep = utf8_buf + size;
- p = utf8_buf;
-
- /* skip leading whitespace */
- while (isspace(*p)) p++;
-
- sp = p;
- while (*p && *p != '\r' && *p != '\n')
- p += utf8_next(p, ep - p, 0);
- *p = '\0';
-
- if (p > sp)
- ro_gui_window_launch_url(g, sp);
-
- free(buf);
- free(utf8_buf);
- return true;
-}
-
-
-/**
- * Clones a browser window's options.
- *
- * \param new_gui the new gui window
- * \param old_gui the gui window to clone from, or NULL for default
- */
-
-void ro_gui_window_clone_options(
- struct gui_window *new_gui,
- struct gui_window *old_gui)
-{
- assert(new_gui);
-
- /* Clone the basic options
- */
- if (!old_gui) {
- new_gui->option.buffer_animations = nsoption_bool(buffer_animations);
- new_gui->option.buffer_everything = nsoption_bool(buffer_everything);
- } else {
- new_gui->option = old_gui->option;
- }
-
- /* Set up the toolbar
- */
- if (new_gui->toolbar) {
- ro_toolbar_set_display_buttons(new_gui->toolbar,
- nsoption_bool(toolbar_show_buttons));
- ro_toolbar_set_display_url(new_gui->toolbar,
- nsoption_bool(toolbar_show_address));
- ro_toolbar_set_display_throbber(new_gui->toolbar,
- nsoption_bool(toolbar_show_throbber));
- if ((old_gui) && (old_gui->toolbar)) {
- ro_toolbar_set_display_buttons(new_gui->toolbar,
- ro_toolbar_get_display_buttons(
- old_gui->toolbar));
- ro_toolbar_set_display_url(new_gui->toolbar,
- ro_toolbar_get_display_url(
- old_gui->toolbar));
- ro_toolbar_set_display_throbber(new_gui->toolbar,
- ro_toolbar_get_display_throbber(
- old_gui->toolbar));
- ro_toolbar_process(new_gui->toolbar, -1, true);
- }
- }
-}
-
-
-/**
- * Makes a browser window's options the default.
- *
- * \param gui The riscos gui window to set default options in.
- */
-
+/* exported interface documented in riscos/window.h */
void ro_gui_window_default_options(struct gui_window *gui)
{
if (gui == NULL)
@@ -4520,179 +4711,20 @@ void ro_gui_window_default_options(struct gui_window *gui)
}
-/*
- * Custom Menu Support
- */
-
-/**
- * Prepare or reprepare a form select menu, setting up the menu handle
- * globals in the process.
- *
- * \param g The RISC OS gui window the menu is in.
- * \param control The form control needing a menu.
- * \return true if the menu is OK to be opened; else false.
- */
-
-bool ro_gui_window_prepare_form_select_menu(struct gui_window *g,
- struct form_control *control)
-{
- unsigned int item, entries;
- char *text_convert, *temp;
- struct form_option *option;
- bool reopen = true;
- nserror err;
-
- assert(control);
-
- /* enumerate the entries */
- entries = 0;
- option = form_select_get_option(control, entries);
- while (option != NULL) {
- entries++;
- option = form_select_get_option(control, entries);
- }
-
- if (entries == 0) {
- /* no menu to display */
- ro_gui_menu_destroy();
- return false;
- }
-
- /* free riscos menu if there already is one */
- if ((gui_form_select_menu) && (control != gui_form_select_control)) {
- for (item = 0; ; item++) {
- free(gui_form_select_menu->entries[item].data.
- indirected_text.text);
- if (gui_form_select_menu->entries[item].menu_flags &
- wimp_MENU_LAST)
- break;
- }
- free(gui_form_select_menu->title_data.indirected_text.text);
- free(gui_form_select_menu);
- gui_form_select_menu = 0;
- }
-
- /* allocate new riscos menu */
- if (!gui_form_select_menu) {
- reopen = false;
- gui_form_select_menu = malloc(wimp_SIZEOF_MENU(entries));
- if (!gui_form_select_menu) {
- ro_warn_user("NoMemory", 0);
- ro_gui_menu_destroy();
- return false;
- }
- err = utf8_to_local_encoding(messages_get("SelectMenu"), 0,
- &text_convert);
- if (err != NSERROR_OK) {
- /* badenc should never happen */
- assert(err != NSERROR_BAD_ENCODING);
- LOG("utf8_to_local_encoding failed");
- ro_warn_user("NoMemory", 0);
- ro_gui_menu_destroy();
- return false;
- }
- gui_form_select_menu->title_data.indirected_text.text =
- text_convert;
- ro_gui_menu_init_structure(gui_form_select_menu, entries);
- }
-
- /* initialise menu entries from form control */
- for (item = 0; item < entries; item++) {
- option = form_select_get_option(control, item);
- gui_form_select_menu->entries[item].menu_flags = 0;
- if (option->selected)
- gui_form_select_menu->entries[item].menu_flags =
- wimp_MENU_TICKED;
- if (!reopen) {
-
- /* convert spaces to hard spaces to stop things
- * like 'Go Home' being treated as if 'Home' is a
- * keyboard shortcut and right aligned in the menu.
- */
-
- temp = cnv_space2nbsp(option->text);
- if (!temp) {
- LOG("cnv_space2nbsp failed");
- ro_warn_user("NoMemory", 0);
- ro_gui_menu_destroy();
- return false;
- }
-
- err = utf8_to_local_encoding(temp,
- 0, &text_convert);
- if (err != NSERROR_OK) {
- /* A bad encoding should never happen,
- * so assert this */
- assert(err != NSERROR_BAD_ENCODING);
- LOG("utf8_to_enc failed");
- ro_warn_user("NoMemory", 0);
- ro_gui_menu_destroy();
- return false;
- }
-
- free(temp);
-
- gui_form_select_menu->entries[item].data.indirected_text.text =
- text_convert;
- gui_form_select_menu->entries[item].data.indirected_text.size =
- strlen(gui_form_select_menu->entries[item].
- data.indirected_text.text) + 1;
- }
- }
-
- gui_form_select_menu->entries[0].menu_flags |=
- wimp_MENU_TITLE_INDIRECTED;
- gui_form_select_menu->entries[item - 1].menu_flags |= wimp_MENU_LAST;
-
- return true;
-}
-
-/**
- * Process selections from a form select menu, passing them back to the core.
- *
- * \param *g The browser window affected by the menu.
- * \param *selection The menu selection.
- */
-
-void ro_gui_window_process_form_select_menu(struct gui_window *g,
- wimp_selection *selection)
-{
- assert(g != NULL);
-
- if (selection->items[0] >= 0)
- form_select_process_selection(gui_form_select_control,
- selection->items[0]);
-}
-
-
-/*
- * Window and Toolbar Lookup
- */
-
-/**
- * Convert a RISC OS window handle to a gui_window.
- *
- * \param window RISC OS window handle.
- * \return A pointer to a riscos gui window if found or NULL.
- */
-
+/* exported interface documented in riscos/window.h */
struct gui_window *ro_gui_window_lookup(wimp_w window)
{
struct gui_window *g;
- for (g = window_list; g; g = g->next)
- if (g->window == window)
+ for (g = window_list; g; g = g->next) {
+ if (g->window == window) {
return g;
+ }
+ }
return NULL;
}
-/**
- * Convert a toolbar RISC OS window handle to a gui_window.
- *
- * \param window RISC OS window handle of a toolbar
- * \return pointer to a structure if found, NULL otherwise
- */
-
+/* exported interface documented in riscos/window.h */
struct gui_window *ro_gui_toolbar_lookup(wimp_w window)
{
struct gui_window *g = NULL;
@@ -4710,22 +4742,9 @@ struct gui_window *ro_gui_toolbar_lookup(wimp_w window)
}
-/*
- * Core to RISC OS Conversions
- */
-
-/**
- * Convert x,y screen co-ordinates into window co-ordinates.
- *
- * \param g gui window
- * \param x x ordinate
- * \param y y ordinate
- * \param pos receives position in window co-ordinatates
- * \return true iff conversion successful
- */
-
-bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y,
- os_coord *pos)
+/* exported interface documented in riscos/window.h */
+bool
+ro_gui_window_to_window_pos(struct gui_window *g, int x, int y, os_coord *pos)
{
wimp_window_state state;
os_error *error;
@@ -4735,7 +4754,8 @@ bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y,
state.w = g->window;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x:%s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -4745,18 +4765,11 @@ bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y,
}
-/**
- * Convert x,y window co-ordinates into screen co-ordinates.
- *
- * \param g gui window
- * \param x x ordinate
- * \param y y ordinate
- * \param pos receives position in screen co-ordinatates
- * \return true iff conversion successful
- */
-
-bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y,
- os_coord *pos)
+/* exported interface documented in riscos/window.h */
+bool ro_gui_window_to_screen_pos(struct gui_window *g,
+ int x,
+ int y,
+ os_coord *pos)
{
wimp_window_state state;
os_error *error;
@@ -4766,7 +4779,8 @@ bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y,
state.w = g->window;
error = xwimp_get_window_state(&state);
if (error) {
- LOG("xwimp_get_window_state: 0x%x:%s", error->errnum, error->errmess);
+ NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x:%s",
+ error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
return false;
}
@@ -4776,24 +4790,9 @@ bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y,
}
-/*
- * Miscellaneous Functions
- *
- * \TODO -- These items might well belong elsewhere.
- */
-
-/**
- * Returns the state of the mouse buttons and modifiers keys for a
- * mouse action, suitable for passing to the OS-independent
- * browser window/ treeview/ etc code.
- *
- * \param buttons Wimp button state.
- * \param type Wimp work-area/icon type for decoding.
- * \return NetSurf core button state.
- */
-
-browser_mouse_state ro_gui_mouse_click_state(wimp_mouse_state buttons,
- wimp_icon_flags type)
+/* exported interface documented in riscos/window.h */
+enum browser_mouse_state
+ro_gui_mouse_click_state(wimp_mouse_state buttons, wimp_icon_flags type)
{
browser_mouse_state state = 0; /* Blank state with nothing set */
static struct {
@@ -4908,18 +4907,9 @@ browser_mouse_state ro_gui_mouse_click_state(wimp_mouse_state buttons,
}
-/**
- * Returns the state of the mouse buttons and modifiers keys whilst
- * dragging, for passing to the OS-independent browser window/ treeview/
- * etc code
- *
- * \param buttons Wimp button state.
- * \param type Wimp work-area/icon type for decoding.
- * \return NetSurf core button state.
- */
-
-browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons,
- wimp_icon_flags type)
+/* exported interface documented in riscos/window.h */
+browser_mouse_state
+ro_gui_mouse_drag_state(wimp_mouse_state buttons, wimp_icon_flags type)
{
browser_mouse_state state = 0; /* Blank state with nothing set */
@@ -4947,10 +4937,7 @@ browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons,
}
-/**
- * Returns true iff one or more Shift keys is held down
- */
-
+/* exported interface documented in riscos/window.h */
bool ro_gui_shift_pressed(void)
{
int shift = 0;
@@ -4959,10 +4946,7 @@ bool ro_gui_shift_pressed(void)
}
-/**
- * Returns true iff one or more Ctrl keys is held down
- */
-
+/* exported interface documented in riscos/window.h */
bool ro_gui_ctrl_pressed(void)
{
int ctrl = 0;
@@ -4971,10 +4955,7 @@ bool ro_gui_ctrl_pressed(void)
}
-/**
- * Returns true iff one or more Alt keys is held down
- */
-
+/* exported interface documented in riscos/window.h */
bool ro_gui_alt_pressed(void)
{
int alt = 0;
@@ -4982,39 +4963,47 @@ bool ro_gui_alt_pressed(void)
return (alt == 0xff);
}
-static struct gui_window_table window_table = {
- .create = gui_window_create,
- .destroy = gui_window_destroy,
- .redraw = gui_window_redraw_window,
- .update = gui_window_update_box,
- .get_scroll = gui_window_get_scroll,
- .set_scroll = gui_window_set_scroll,
- .get_dimensions = gui_window_get_dimensions,
- .update_extent = gui_window_update_extent,
- .reformat = riscos_window_reformat,
- .set_title = gui_window_set_title,
- .set_url = ro_gui_window_set_url,
- .set_icon = gui_window_set_icon,
- .set_status = riscos_window_set_status,
- .set_pointer = gui_window_set_pointer,
- .place_caret = gui_window_place_caret,
- .remove_caret = gui_window_remove_caret,
- .save_link = gui_window_save_link,
- .drag_start = gui_window_drag_start,
- .scroll_visible = gui_window_scroll_visible,
- .scroll_start = gui_window_scroll_start,
- .new_content = gui_window_new_content,
- .start_throbber = gui_window_start_throbber,
- .stop_throbber = gui_window_stop_throbber,
- .create_form_select_menu = gui_window_create_form_select_menu,
+/* exported interface documented in riscos/window.h */
+void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
+{
+ static gui_pointer_shape curr_pointer = GUI_POINTER_DEFAULT;
+ struct ro_gui_pointer_entry *entry;
+ os_error *error;
- /* from save */
- .drag_save_object = gui_drag_save_object,
- .drag_save_selection =gui_drag_save_selection,
+ if (shape == curr_pointer)
+ return;
- /* from textselection */
- .start_selection = gui_start_selection,
-};
+ assert(shape < sizeof ro_gui_pointer_table /
+ sizeof ro_gui_pointer_table[0]);
-struct gui_window_table *riscos_window_table = &window_table;
+ entry = &ro_gui_pointer_table[shape];
+
+ if (entry->wimp_area) {
+ /* pointer in the Wimp's sprite area */
+ error = xwimpspriteop_set_pointer_shape(entry->sprite_name,
+ 1, entry->xactive, entry->yactive, 0, 0);
+ if (error) {
+ NSLOG(netsurf, INFO,
+ "xwimpspriteop_set_pointer_shape: 0x%x: %s",
+ error->errnum,
+ error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ }
+ } else {
+ /* pointer in our own sprite area */
+ error = xosspriteop_set_pointer_shape(osspriteop_USER_AREA,
+ gui_sprites,
+ (osspriteop_id) entry->sprite_name,
+ 1, entry->xactive, entry->yactive, 0, 0);
+ if (error) {
+ NSLOG(netsurf, INFO,
+ "xosspriteop_set_pointer_shape: 0x%x: %s",
+ error->errnum,
+ error->errmess);
+ ro_warn_user("WimpError", error->errmess);
+ }
+ }
+
+ curr_pointer = shape;
+}
diff --git a/frontends/riscos/window.h b/frontends/riscos/window.h
index 2e6f6e9aa..0a5bd43c2 100644
--- a/frontends/riscos/window.h
+++ b/frontends/riscos/window.h
@@ -30,10 +30,21 @@ struct nsurl;
extern struct gui_window_table *riscos_window_table;
+/**
+ * Initialise the browser window module and its menus.
+ */
void ro_gui_window_initialise(void);
+
+/**
+ * Check if a particular menu handle is a browser window menu
+ *
+ * \param menu The menu in question.
+ * \return true if this menu is a browser window menu
+ */
bool ro_gui_window_check_menu(wimp_menu *menu);
+
/**
* Set the contents of a window's address bar.
*
@@ -42,5 +53,201 @@ bool ro_gui_window_check_menu(wimp_menu *menu);
*/
nserror ro_gui_window_set_url(struct gui_window *g, struct nsurl *url);
+
+/**
+ * Cause an area of a window to be invalidated
+ *
+ * The specified area of the window should now be considered out of
+ * date. If the entire window is invalidated this simply calls
+ * wimp_force_redraw() otherwise the area is added to a queue of
+ * pending updates which will be processed from a wimp poll allowing
+ * multiple invalidation requests to be agregated.
+ *
+ * \param g The window to update
+ * \param rect The area of the window to update or NULL to redraw entire contents.
+ */
+nserror ro_gui_window_invalidate_area(struct gui_window *g, const struct rect *rect);
+
+
+/**
+ * Set a gui_window's scale
+ */
+void ro_gui_window_set_scale(struct gui_window *g, float scale);
+
+
+/**
+ * Handle Message_DataLoad (file dragged in) for a window.
+ *
+ * If the file was dragged into a form file input, it is used as the value.
+ *
+ * \param g window
+ * \param message Message_DataLoad block
+ * \return true if the load was processed
+ */
+bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message);
+
+
+/**
+ * Handle pointer movements in a browser window.
+ *
+ * \param pointer new mouse position
+ * \param data browser window that the pointer is in
+ */
+void ro_gui_window_mouse_at(wimp_pointer *pointer, void *data);
+
+
+/**
+ * Window is being iconised.
+ *
+ * Create a suitable thumbnail sprite (which, sadly, must be in the
+ * Wimp sprite pool), and return the sprite name and truncated title
+ * to the iconiser
+ *
+ * \param g the gui window being iconised
+ * \param wi the WindowInfo message from the iconiser
+ */
+void ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi);
+
+
+/**
+ * Handle Message_DataLoad (file dragged in) for a toolbar
+ *
+ * @todo This belongs in the toolbar module, and should be moved there
+ * once the module is able to usefully handle its own events.
+ *
+ * \param g window
+ * \param message Message_DataLoad block
+ * \return true if the load was processed
+ */
+bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message);
+
+
+/**
+ * Redraws the content for all windows.
+ */
+void ro_gui_window_redraw_all(void);
+
+
+/**
+ * Redraw any pending update boxes.
+ */
+void ro_gui_window_update_boxes(void);
+
+
+/**
+ * Destroy all browser windows.
+ */
+void ro_gui_window_quit(void);
+
+
+/**
+ * Close all browser windows
+ *
+ * no need for a separate fn same operation as quit
+*/
+#define ro_gui_window_close_all ro_gui_window_quit
+
+
+/**
+ * Animate the "throbbers" of all browser windows.
+ */
+void ro_gui_throb(void);
+
+/**
+ * Makes a browser window's options the default.
+ *
+ * \param gui The riscos gui window to set default options in.
+ */
+void ro_gui_window_default_options(struct gui_window *gui);
+
+
+/**
+ * Convert a RISC OS window handle to a gui_window.
+ *
+ * \param window RISC OS window handle.
+ * \return A pointer to a riscos gui window if found or NULL.
+ */
+struct gui_window *ro_gui_window_lookup(wimp_w window);
+
+
+/**
+ * Convert a toolbar RISC OS window handle to a gui_window.
+ *
+ * \param window RISC OS window handle of a toolbar
+ * \return pointer to a structure if found, NULL otherwise
+ */
+struct gui_window *ro_gui_toolbar_lookup(wimp_w window);
+
+
+/**
+ * Convert x,y screen co-ordinates into window co-ordinates.
+ *
+ * \param g gui window
+ * \param x x ordinate
+ * \param y y ordinate
+ * \param pos receives position in window co-ordinatates
+ * \return true iff conversion successful
+ */
+bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y, os_coord *pos);
+
+
+/**
+ * Convert x,y window co-ordinates into screen co-ordinates.
+ *
+ * \param g gui window
+ * \param x x ordinate
+ * \param y y ordinate
+ * \param pos receives position in screen co-ordinatates
+ * \return true iff conversion successful
+ */
+bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y, os_coord *pos);
+
+/**
+ * Returns the state of the mouse buttons and modifiers keys for a
+ * mouse action, suitable for passing to the OS-independent
+ * browser window/ treeview/ etc code.
+ *
+ * \param buttons Wimp button state.
+ * \param type Wimp work-area/icon type for decoding.
+ * \return NetSurf core button state.
+ */
+enum browser_mouse_state ro_gui_mouse_click_state(wimp_mouse_state buttons, wimp_icon_flags type);
+
+
+/**
+ * Returns the state of the mouse buttons and modifiers keys whilst
+ * dragging, for passing to the OS-independent browser window/ treeview/
+ * etc code
+ *
+ * \param buttons Wimp button state.
+ * \param type Wimp work-area/icon type for decoding.
+ * \return NetSurf core button state.
+ */
+enum browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons, wimp_icon_flags type);
+
+
+/**
+ * Returns true iff one or more Shift keys is held down
+ */
+bool ro_gui_shift_pressed(void);
+
+
+/**
+ * Returns true iff one or more Ctrl keys is held down
+ */
+bool ro_gui_ctrl_pressed(void);
+
+
+/**
+ * Returns true iff one or more Alt keys is held down
+ */
+bool ro_gui_alt_pressed(void);
+
+
+/**
+ * Change mouse pointer shape
+ */
+void gui_window_set_pointer(struct gui_window *g, enum gui_pointer_shape shape);
+
#endif
diff --git a/frontends/windows/Makefile b/frontends/windows/Makefile
index 1b93e4cc7..de01ce33a 100644
--- a/frontends/windows/Makefile
+++ b/frontends/windows/Makefile
@@ -15,7 +15,7 @@ $(eval $(call pkg_config_find_and_add,libcares,Cares))
$(eval $(call pkg_config_find_and_add,zlib,ZLib))
# libraries for windows API
-LDFLAGS += -lgnurx -lgdi32 -lcomctl32 -lws2_32 -lmsimg32 -lshlwapi -mwindows
+LDFLAGS += -lgnurx -lgdi32 -lcomctl32 -lws2_32 -lmsimg32 -lshlwapi -lcrypt32 -mwindows
CFLAGS += -U__STRICT_ANSI__ -mwin32
# only windows versions after XP are supported
@@ -50,7 +50,7 @@ S_RESOURCES := windows_resource.o
# sources purely for the windows build
S_FRONTEND := main.c window.c gui.c drawable.c plot.c findfile.c \
font.c bitmap.c about.c prefs.c download.c filetype.c file.c \
- localhistory.c schedule.c windbg.c pointers.c \
+ local_history.c schedule.c windbg.c pointers.c \
corewindow.c hotlist.c cookies.c global_history.c ssl_cert.c
# This is the final source build list
@@ -84,6 +84,7 @@ endif
# installer messages generation
$(OBJROOT)/messages-en: resources/FatMessages
$(VQ)echo "MSGSPLIT: Language: en Filter: win"
+ $(Q)$(RM) $@
$(Q)$(SPLIT_MESSAGES) -l en -p win -f messages -o $@ $<
netsurf-installer.exe: $(EXETARGET) $(WIN_RES_INS_OBJ)
diff --git a/frontends/windows/about.c b/frontends/windows/about.c
index 65c81cd7d..2cd855b55 100644
--- a/frontends/windows/about.c
+++ b/frontends/windows/about.c
@@ -52,7 +52,7 @@ static BOOL init_about_dialog(HWND hwnd)
hFont=CreateFont (26, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "Arial");
if (hFont != NULL) {
- LOG("Setting font object");
+ NSLOG(netsurf, INFO, "Setting font object");
SendMessage(dlg_itm, WM_SETFONT, (WPARAM)hFont, 0);
}
@@ -85,7 +85,7 @@ static BOOL destroy_about_dialog(HWND hwnd)
if (dlg_itm != NULL) {
hFont = (HFONT)SendMessage(dlg_itm, WM_GETFONT, 0, 0);
if (hFont != NULL) {
- LOG("Destroyed font object");
+ NSLOG(netsurf, INFO, "Destroyed font object");
DeleteObject(hFont);
}
}
@@ -107,12 +107,12 @@ nsws_about_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
case WM_COMMAND:
switch(LOWORD(wparam)) {
case IDOK:
- LOG("OK clicked");
+ NSLOG(netsurf, INFO, "OK clicked");
EndDialog(hwnd, IDOK);
break;
case IDCANCEL:
- LOG("Cancel clicked");
+ NSLOG(netsurf, INFO, "Cancel clicked");
EndDialog(hwnd, IDOK);
break;
diff --git a/frontends/windows/bitmap.c b/frontends/windows/bitmap.c
index f60dab613..eed3d3a15 100644
--- a/frontends/windows/bitmap.c
+++ b/frontends/windows/bitmap.c
@@ -52,7 +52,8 @@ void *win32_bitmap_create(int width, int height, unsigned int state)
HBITMAP windib;
uint8_t *pixdata;
- LOG("width %d, height %d, state %u", width, height, state);
+ NSLOG(netsurf, INFO, "width %d, height %d, state %u", width, height,
+ state);
pbmi = calloc(1, sizeof(BITMAPV5HEADER));
if (pbmi == NULL) {
@@ -96,7 +97,7 @@ void *win32_bitmap_create(int width, int height, unsigned int state)
bitmap->opaque = false;
}
- LOG("bitmap %p", bitmap);
+ NSLOG(netsurf, INFO, "bitmap %p", bitmap);
return bitmap;
}
@@ -115,7 +116,7 @@ static unsigned char *bitmap_get_buffer(void *bitmap)
{
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return NULL;
}
@@ -134,7 +135,7 @@ static size_t bitmap_get_rowstride(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return 0;
}
@@ -152,7 +153,7 @@ void win32_bitmap_destroy(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return;
}
@@ -195,11 +196,12 @@ static void bitmap_set_opaque(void *bitmap, bool opaque)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return;
}
- LOG("setting bitmap %p to %s", bm, opaque ? "opaque" : "transparent");
+ NSLOG(netsurf, INFO, "setting bitmap %p to %s", bm,
+ opaque ? "opaque" : "transparent");
bm->opaque = opaque;
}
@@ -216,7 +218,7 @@ static bool bitmap_test_opaque(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return false;
}
@@ -224,11 +226,11 @@ static bool bitmap_test_opaque(void *bitmap)
while (tst-- > 0) {
if (bm->pixdata[(tst << 2) + 3] != 0xff) {
- LOG("bitmap %p has transparency", bm);
+ NSLOG(netsurf, INFO, "bitmap %p has transparency", bm);
return false;
}
}
- LOG("bitmap %p is opaque", bm);
+ NSLOG(netsurf, INFO, "bitmap %p is opaque", bm);
return true;
}
@@ -243,7 +245,7 @@ static bool bitmap_get_opaque(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return false;
}
@@ -255,7 +257,7 @@ static int bitmap_get_width(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return 0;
}
@@ -267,7 +269,7 @@ static int bitmap_get_height(void *bitmap)
struct bitmap *bm = bitmap;
if (bitmap == NULL) {
- LOG("NULL bitmap!");
+ NSLOG(netsurf, INFO, "NULL bitmap!");
return 0;
}
@@ -324,12 +326,12 @@ bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content)
.plot = &win_plotters
};
- width = min(content_get_width(content), 1024);
+ width = min(max(content_get_width(content), bitmap->width), 1024);
height = ((width * bitmap->height) + (bitmap->width / 2)) /
bitmap->width;
- LOG("bitmap %p for content %p width %d, height %d",
- bitmap, content, width, height);
+ NSLOG(netsurf, INFO, "bitmap %p for content %p width %d, height %d",
+ bitmap, content, width, height);
/* create two memory device contexts to put the bitmaps in */
bufferdc = CreateCompatibleDC(NULL);
diff --git a/frontends/windows/cookies.c b/frontends/windows/cookies.c
index 27949fac1..b3c56da8c 100644
--- a/frontends/windows/cookies.c
+++ b/frontends/windows/cookies.c
@@ -58,6 +58,7 @@ nsw32_cookie_key(struct nsw32_corewindow *nsw32_cw, uint32_t nskey)
return NSERROR_NOT_IMPLEMENTED;
}
+
/**
* callback for mouse action on cookie window
*
@@ -69,18 +70,21 @@ nsw32_cookie_key(struct nsw32_corewindow *nsw32_cw, uint32_t nskey)
*/
static nserror
nsw32_cookie_mouse(struct nsw32_corewindow *nsw32_cw,
- browser_mouse_state mouse_state,
- int x, int y)
+ browser_mouse_state mouse_state,
+ int x, int y)
{
cookie_manager_mouse_action(mouse_state, x, y);
return NSERROR_OK;
}
+
/**
* callback on draw event for cookie window
*
* \param nsw32_cw The nsw32 core window structure.
+ * \param scrollx The horizontal scroll offset.
+ * \param scrolly The vertical scroll offset.
* \param r The rectangle of the window that needs updating.
* \return NSERROR_OK on success otherwise apropriate error code
*/
@@ -102,6 +106,12 @@ nsw32_cookie_draw(struct nsw32_corewindow *nsw32_cw,
}
+/**
+ * callback on close event for cookie window
+ *
+ * \param nsw32_cw The nsw32 core window structure.
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
static nserror
nsw32_cookie_close(struct nsw32_corewindow *nsw32_cw)
{
@@ -110,9 +120,11 @@ nsw32_cookie_close(struct nsw32_corewindow *nsw32_cw)
return NSERROR_OK;
}
+
/**
* Creates the window for the cookie tree.
*
+ * \param hInstance The application instance
* \return NSERROR_OK on success else appropriate error code on faliure.
*/
static nserror nsw32_cookie_init(HINSTANCE hInstance)
@@ -124,7 +136,7 @@ static nserror nsw32_cookie_init(HINSTANCE hInstance)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsw32_cookie_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
@@ -169,6 +181,7 @@ nserror nsw32_cookies_present(HINSTANCE hInstance)
return res;
}
+
/* exported interface documented in windows/cookie.h */
nserror nsw32_cookies_finalise(void)
{
diff --git a/frontends/windows/corewindow.c b/frontends/windows/corewindow.c
index 754e0e561..7d88ce7c4 100644
--- a/frontends/windows/corewindow.c
+++ b/frontends/windows/corewindow.c
@@ -155,7 +155,7 @@ nsw32_corewindow_vscroll(struct nsw32_corewindow *nsw32_cw,
SCROLLINFO si; /* current scroll information */
SCROLLINFO usi; /* updated scroll infomation for scrollwindowex */
- LOG("VSCROLL");
+ NSLOG(netsurf, INFO, "VSCROLL");
si.cbSize = sizeof(si);
si.fMask = SIF_ALL;
@@ -221,20 +221,105 @@ nsw32_corewindow_vscroll(struct nsw32_corewindow *nsw32_cw,
return 0;
}
+
+static LRESULT
+nsw32_corewindow_hscroll(struct nsw32_corewindow *nsw32_cw,
+ HWND hwnd,
+ WPARAM wparam)
+{
+ SCROLLINFO si; /* current scroll information */
+ SCROLLINFO usi; /* updated scroll infomation for scrollwindowex */
+
+ NSLOG(netsurf, INFO, "VSCROLL");
+
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_ALL;
+ GetScrollInfo(hwnd, SB_HORZ, &si);
+ usi = si;
+
+ switch (LOWORD(wparam)) {
+ case SB_LINELEFT:
+ usi.nPos -= 30;
+ break;
+
+ case SB_LINERIGHT:
+ usi.nPos += 30;
+ break;
+
+ case SB_PAGELEFT:
+ usi.nPos -= si.nPage;
+ break;
+
+ case SB_PAGERIGHT:
+ usi.nPos += si.nPage;
+ break;
+
+ case SB_THUMBTRACK:
+ usi.nPos = si.nTrackPos;
+ break;
+
+ default:
+ break;
+ }
+
+ if (usi.nPos < si.nMin) {
+ usi.nPos = si.nMin;
+ }
+ if (usi.nPos > si.nMax) {
+ usi.nPos = si.nMax;
+ }
+
+ SetScrollInfo(hwnd, SB_HORZ, &usi, TRUE);
+
+ ScrollWindowEx(hwnd,
+ si.nPos - usi.nPos,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ SW_INVALIDATE);
+
+ return 0;
+}
+
+
static LRESULT
nsw32_corewindow_mousedown(struct nsw32_corewindow *nsw32_cw,
+ HWND hwnd,
int x, int y,
browser_mouse_state button)
{
+ SCROLLINFO si; /* scroll information */
+
+ /* get scroll positions */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_POS;
+ GetScrollInfo(hwnd, SB_HORZ, &si);
+ x += si.nPos;
+ GetScrollInfo(hwnd, SB_VERT, &si);
+ y += si.nPos;
+
nsw32_cw->mouse(nsw32_cw, button, x, y);
return 0;
}
static LRESULT
nsw32_corewindow_mouseup(struct nsw32_corewindow *nsw32_cw,
+ HWND hwnd,
int x, int y,
browser_mouse_state button)
{
+ SCROLLINFO si; /* scroll information */
+
+ /* get scroll positions */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_POS;
+ GetScrollInfo(hwnd, SB_HORZ, &si);
+ x += si.nPos;
+ GetScrollInfo(hwnd, SB_VERT, &si);
+ y += si.nPos;
+
nsw32_cw->mouse(nsw32_cw, button, x, y);
return 0;
}
@@ -275,26 +360,29 @@ nsw32_window_corewindow_event_callback(HWND hwnd,
case WM_VSCROLL:
return nsw32_corewindow_vscroll(nsw32_cw, hwnd, wparam);
+ case WM_HSCROLL:
+ return nsw32_corewindow_hscroll(nsw32_cw, hwnd, wparam);
+
case WM_LBUTTONDOWN:
- return nsw32_corewindow_mousedown(nsw32_cw,
+ return nsw32_corewindow_mousedown(nsw32_cw, hwnd,
GET_X_LPARAM(lparam),
GET_Y_LPARAM(lparam),
BROWSER_MOUSE_PRESS_1);
case WM_RBUTTONDOWN:
- return nsw32_corewindow_mousedown(nsw32_cw,
+ return nsw32_corewindow_mousedown(nsw32_cw, hwnd,
GET_X_LPARAM(lparam),
GET_Y_LPARAM(lparam),
BROWSER_MOUSE_PRESS_2);
case WM_LBUTTONUP:
- return nsw32_corewindow_mouseup(nsw32_cw,
+ return nsw32_corewindow_mouseup(nsw32_cw, hwnd,
GET_X_LPARAM(lparam),
GET_Y_LPARAM(lparam),
BROWSER_MOUSE_CLICK_1);
case WM_RBUTTONUP:
- return nsw32_corewindow_mouseup(nsw32_cw,
+ return nsw32_corewindow_mouseup(nsw32_cw, hwnd,
GET_X_LPARAM(lparam),
GET_Y_LPARAM(lparam),
BROWSER_MOUSE_CLICK_2);
@@ -307,21 +395,48 @@ nsw32_window_corewindow_event_callback(HWND hwnd,
return DefWindowProc(hwnd, msg, wparam, lparam);
}
+
/**
- * callback from core to request a redraw
+ * callback from core to request an invalidation of a window area.
+ *
+ * The specified area of the window should now be considered
+ * out of date. If the area is NULL the entire window must be
+ * invalidated.
+ *
+ * \param[in] cw The core window to invalidate.
+ * \param[in] rect area to redraw or NULL for the entire window area.
+ * \return NSERROR_OK on success or appropriate error code.
*/
-static void
-nsw32_cw_redraw_request(struct core_window *cw, const struct rect *r)
+static nserror
+nsw32_cw_invalidate_area(struct core_window *cw, const struct rect *rect)
{
struct nsw32_corewindow *nsw32_cw = (struct nsw32_corewindow *)cw;
- RECT wr;
+ RECT *redrawrectp = NULL;
+ RECT redrawrect;
+
+ if (rect != NULL) {
+ SCROLLINFO si; /* scroll information */
- wr.left = r->x0;
- wr.top = r->y0;
- wr.right = r->x1;
- wr.bottom = r->y1;
+ /* get scroll positions */
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_POS;
+ GetScrollInfo(nsw32_cw->hWnd, SB_HORZ, &si);
+ redrawrect.left = (long)rect->x0 - si.nPos;
+ redrawrect.right = (long)rect->x1 - si.nPos;
- RedrawWindow(nsw32_cw->hWnd, &wr, NULL, RDW_INVALIDATE | RDW_NOERASE);
+ GetScrollInfo(nsw32_cw->hWnd, SB_VERT, &si);
+ redrawrect.top = (long)rect->y0 - si.nPos;
+ redrawrect.bottom = (long)rect->y1 - si.nPos;
+
+ redrawrectp = &redrawrect;
+ }
+
+ RedrawWindow(nsw32_cw->hWnd,
+ redrawrectp,
+ NULL,
+ RDW_INVALIDATE | RDW_NOERASE);
+
+ return NSERROR_OK;
}
@@ -335,7 +450,7 @@ nsw32_cw_update_size(struct core_window *cw, int width, int height)
nsw32_cw->content_width = width;
nsw32_cw->content_height = height;
- LOG("new content size w:%d h:%d", width, height);
+ NSLOG(netsurf, INFO, "new content size w:%d h:%d", width, height);
update_scrollbars(nsw32_cw);
}
@@ -371,12 +486,12 @@ static void
nsw32_cw_drag_status(struct core_window *cw, core_window_drag_status ds)
{
struct nsw32_corewindow *nsw32_cw = (struct nsw32_corewindow *)cw;
- nsw32_cw->drag_staus = ds;
+ nsw32_cw->drag_status = ds;
}
struct core_window_callback_table nsw32_cw_cb_table = {
- .redraw_request = nsw32_cw_redraw_request,
+ .invalidate = nsw32_cw_invalidate_area,
.update_size = nsw32_cw_update_size,
.scroll_visible = nsw32_cw_scroll_visible,
.get_window_dimensions = nsw32_cw_get_window_dimensions,
@@ -393,6 +508,7 @@ nsw32_corewindow_init(HINSTANCE hInstance,
/* setup the core window callback table */
nsw32_cw->cb_table = &nsw32_cw_cb_table;
+ nsw32_cw->drag_status = CORE_WINDOW_DRAG_NONE;
/* start with the content area being as small as possible */
nsw32_cw->content_width = -1;
@@ -411,7 +527,7 @@ nsw32_corewindow_init(HINSTANCE hInstance,
CS_DBLCLKS;
}
- LOG("creating hInstance %p core window", hInstance);
+ NSLOG(netsurf, INFO, "creating hInstance %p core window", hInstance);
nsw32_cw->hWnd = CreateWindowEx(0,
windowclassname_corewindow,
nsw32_cw->title,
@@ -425,7 +541,7 @@ nsw32_corewindow_init(HINSTANCE hInstance,
hInstance,
NULL);
if (nsw32_cw->hWnd == NULL) {
- LOG("Window create failed");
+ NSLOG(netsurf, INFO, "Window create failed");
return NSERROR_NOMEM;
}
diff --git a/frontends/windows/corewindow.h b/frontends/windows/corewindow.h
index b78c72e8c..cffae3cbd 100644
--- a/frontends/windows/corewindow.h
+++ b/frontends/windows/corewindow.h
@@ -38,7 +38,7 @@ struct nsw32_corewindow {
const char *title;
/** drag status set by core */
- core_window_drag_status drag_staus;
+ core_window_drag_status drag_status;
/** table of callbacks for core window operations */
struct core_window_callback_table *cb_table;
diff --git a/frontends/windows/download.c b/frontends/windows/download.c
index 3a969834e..dfcd2b5a4 100644
--- a/frontends/windows/download.c
+++ b/frontends/windows/download.c
@@ -253,7 +253,8 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui)
strcat(destination, "/");
if (strlen(destination) + strlen(filename) < PATH_MAX - 1)
strcat(destination, filename);
- LOG("download %s [%s] from %s to %s", filename, size, domain, destination);
+ NSLOG(netsurf, INFO, "download %s [%s] from %s to %s", filename,
+ size, domain, destination);
w->title = filename;
w->domain = domain;
w->size = total_size;
@@ -313,7 +314,8 @@ gui_download_window_data(struct gui_download_window *w, const char *data,
struct timeval val;
res = fwrite((void *)data, 1, size, w->file);
if (res != size)
- LOG("file write error %d of %d", size - res, size);
+ NSLOG(netsurf, INFO, "file write error %d of %d", size - res,
+ size);
w->downloaded += res;
w->progress = (unsigned int)(((long long)(w->downloaded) * 10000)
/ w->size);
@@ -327,7 +329,7 @@ gui_download_window_data(struct gui_download_window *w, const char *data,
static void gui_download_window_error(struct gui_download_window *w,
const char *error_msg)
{
- LOG("error %s", error_msg);
+ NSLOG(netsurf, INFO, "error %s", error_msg);
}
static void gui_download_window_done(struct gui_download_window *w)
diff --git a/frontends/windows/drawable.c b/frontends/windows/drawable.c
index cb9429139..f491e0a2a 100644
--- a/frontends/windows/drawable.c
+++ b/frontends/windows/drawable.c
@@ -16,6 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * win32 implementation of drawable window showing browser context
+ */
+
#include <stdbool.h>
#include <stdint.h>
@@ -33,11 +38,12 @@
#include "windows/windbg.h"
#include "windows/plot.h"
#include "windows/window.h"
-#include "windows/localhistory.h"
+#include "windows/local_history.h"
#include "windows/drawable.h"
static const char windowclassname_drawable[] = "nswsdrawablewindow";
+
/**
* Handle wheel scroll messages.
*/
@@ -66,6 +72,7 @@ nsws_drawable_wheel(struct gui_window *gw, HWND hwnd, WPARAM wparam)
return 0;
}
+
/**
* Handle vertical scroll messages.
*/
@@ -76,7 +83,7 @@ nsws_drawable_vscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
SCROLLINFO si;
int mem;
- LOG("VSCROLL %d", gw->requestscrolly);
+ NSLOG(netsurf, INFO, "VSCROLL %d", gw->requestscrolly);
if (gw->requestscrolly != 0)
return 0;
@@ -121,8 +128,8 @@ nsws_drawable_vscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
si.fMask = SIF_POS;
if ((gw->bw != NULL) &&
- (browser_window_get_extents(gw->bw, true,
- &width, &height) == NSERROR_OK)) {
+ (browser_window_get_extents(gw->bw, true,
+ &width, &height) == NSERROR_OK)) {
si.nPos = min(si.nPos, height - gw->height);
}
@@ -130,8 +137,10 @@ nsws_drawable_vscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
GetScrollInfo(hwnd, SB_VERT, &si);
if (si.nPos != mem) {
- win32_window_set_scroll(gw, gw->scrollx, gw->scrolly +
- gw->requestscrolly + si.nPos - mem);
+ struct rect rect;
+ rect.x0 = rect.x1 = gw->scrollx;
+ rect.y0 = rect.y1 = gw->scrolly + gw->requestscrolly + si.nPos - mem;
+ win32_window_set_scroll(gw, &rect);
}
return 0;
@@ -148,7 +157,7 @@ nsws_drawable_hscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
SCROLLINFO si;
int mem;
- LOG("HSCROLL %d", gw->requestscrollx);
+ NSLOG(netsurf, INFO, "HSCROLL %d", gw->requestscrollx);
if (gw->requestscrollx != 0)
return 0;
@@ -186,22 +195,24 @@ nsws_drawable_hscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam)
si.fMask = SIF_POS;
if ((gw->bw != NULL) &&
- (browser_window_get_extents(gw->bw, true,
- &width, &height) == NSERROR_OK)) {
+ (browser_window_get_extents(gw->bw, true,
+ &width, &height) == NSERROR_OK)) {
si.nPos = min(si.nPos, width - gw->width);
}
si.nPos = max(si.nPos, 0);
SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
GetScrollInfo(hwnd, SB_HORZ, &si);
if (si.nPos != mem) {
- win32_window_set_scroll(gw,
- gw->scrollx + gw->requestscrollx + si.nPos - mem,
- gw->scrolly);
+ struct rect rect;
+ rect.x0 = rect.x1 = gw->scrollx + gw->requestscrollx + si.nPos - mem;
+ rect.y0 = rect.y1 = gw->scrolly;
+ win32_window_set_scroll(gw, &rect);
}
return 0;
}
+
/**
* Handle resize events.
*/
@@ -212,6 +223,7 @@ nsws_drawable_resize(struct gui_window *gw)
return 0;
}
+
/**
* Handle key press messages.
*/
@@ -289,7 +301,7 @@ nsws_drawable_key(struct gui_window *gw, HWND hwnd, WPARAM wparam)
break;
}
- if ((i >= 'A') &&
+ if ((i >= 'A') &&
(i <= 'Z') &&
(((!capslock) && (!shift)) || ((capslock) && (shift)))) {
i += 'a' - 'A';
@@ -357,7 +369,8 @@ nsws_drawable_mouseup(struct gui_window *gw,
(gw->bw == NULL))
return 0;
- LOG("state 0x%x, press 0x%x", gw->mouse->state, press);
+ NSLOG(netsurf, INFO, "state 0x%x, press 0x%x", gw->mouse->state,
+ press);
if ((gw->mouse->state & press) != 0) {
gw->mouse->state &= ~press;
gw->mouse->state |= click;
@@ -371,7 +384,10 @@ nsws_drawable_mouseup(struct gui_window *gw,
gw->mouse->state &= ~BROWSER_MOUSE_MOD_3;
if ((gw->mouse->state & click) != 0) {
- LOG("mouse click bw %p, state 0x%x, x %f, y %f", gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale, (y + gw->scrolly) / gw->scale);
+ NSLOG(netsurf, INFO,
+ "mouse click bw %p, state 0x%x, x %f, y %f", gw->bw,
+ gw->mouse->state, (x + gw->scrollx) / gw->scale,
+ (y + gw->scrolly) / gw->scale);
browser_window_mouse_click(gw->bw,
gw->mouse->state,
@@ -400,7 +416,7 @@ nsws_drawable_mousedown(struct gui_window *gw,
if ((gw == NULL) ||
(gw->mouse == NULL) ||
(gw->bw == NULL)) {
- nsws_localhistory_close(gw);
+ nsw32_local_history_hide();
return 0;
}
@@ -415,7 +431,9 @@ nsws_drawable_mousedown(struct gui_window *gw,
gw->mouse->pressed_x = (x + gw->scrollx) / gw->scale;
gw->mouse->pressed_y = (y + gw->scrolly) / gw->scale;
- LOG("mouse click bw %p, state %x, x %f, y %f", gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale, (y + gw->scrolly) / gw->scale);
+ NSLOG(netsurf, INFO, "mouse click bw %p, state %x, x %f, y %f",
+ gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale,
+ (y + gw->scrolly) / gw->scale);
browser_window_mouse_click(gw->bw, gw->mouse->state,
(x + gw->scrollx) / gw->scale,
@@ -424,6 +442,7 @@ nsws_drawable_mousedown(struct gui_window *gw,
return 0;
}
+
/**
* Handle mouse movement messages.
*/
@@ -447,7 +466,8 @@ nsws_drawable_mousemove(struct gui_window *gw, int x, int y)
(abs(x - gw->mouse->pressed_x) >= 5) &&
(abs(y - gw->mouse->pressed_y) >= 5)) {
- LOG("Drag start state 0x%x", gw->mouse->state);
+ NSLOG(netsurf, INFO, "Drag start state 0x%x",
+ gw->mouse->state);
if ((gw->mouse->state & BROWSER_MOUSE_PRESS_1) != 0) {
browser_window_mouse_click(gw->bw, BROWSER_MOUSE_DRAG_1,
@@ -480,6 +500,7 @@ nsws_drawable_mousemove(struct gui_window *gw, int x, int y)
return 0;
}
+
/**
* Called when activity occours within the drawable window.
*/
@@ -495,7 +516,8 @@ nsws_window_drawable_event_callback(HWND hwnd,
gw = nsws_get_gui_window(hwnd);
if (gw == NULL) {
- LOG("Unable to find gui window structure for hwnd %p", hwnd);
+ NSLOG(netsurf, INFO,
+ "Unable to find gui window structure for hwnd %p", hwnd);
return DefWindowProc(hwnd, msg, wparam, lparam);
}
@@ -512,9 +534,8 @@ nsws_window_drawable_event_callback(HWND hwnd,
GET_Y_LPARAM(lparam),
BROWSER_MOUSE_PRESS_1);
SetFocus(hwnd);
- nsws_localhistory_close(gw);
+ nsw32_local_history_hide();
return 0;
- break;
case WM_RBUTTONDOWN:
nsws_drawable_mousedown(gw,
@@ -564,12 +585,13 @@ nsws_window_drawable_event_callback(HWND hwnd,
return DefWindowProc(hwnd, msg, wparam, lparam);
}
+
/**
* Create a drawable window.
*/
HWND
-nsws_window_create_drawable(HINSTANCE hinstance,
- HWND hparent,
+nsws_window_create_drawable(HINSTANCE hinstance,
+ HWND hparent,
struct gui_window *gw)
{
HWND hwnd;
@@ -584,7 +606,7 @@ nsws_window_create_drawable(HINSTANCE hinstance,
if (hwnd == NULL) {
win_perror("WindowCreateDrawable");
- LOG("Window creation failed");
+ NSLOG(netsurf, INFO, "Window creation failed");
return NULL;
}
@@ -594,6 +616,7 @@ nsws_window_create_drawable(HINSTANCE hinstance,
return hwnd;
}
+
/**
* Create the drawable window class.
*/
diff --git a/frontends/windows/filetype.c b/frontends/windows/filetype.c
index ed07dd5fc..a5fd9e95e 100644
--- a/frontends/windows/filetype.c
+++ b/frontends/windows/filetype.c
@@ -16,6 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * Fetch operation implementation for win32
+ */
+
#include <stdlib.h>
#include <string.h>
@@ -26,12 +31,15 @@
#include "windows/filetype.h"
/**
- * filetype -- determine the MIME type of a local file
+ * determine the MIME type of a local file.
+ *
+ * \param unix_path The unix style path to the file.
+ * \return The mime type of the file.
*/
static const char *fetch_filetype(const char *unix_path)
{
int l;
- LOG("unix path %s", unix_path);
+ NSLOG(netsurf, INFO, "unix path %s", unix_path);
l = strlen(unix_path);
if (2 < l && strcasecmp(unix_path + l - 3, "css") == 0)
return "text/css";
@@ -52,6 +60,7 @@ static const char *fetch_filetype(const char *unix_path)
return "text/html";
}
+/** win32 fetch operation table */
static struct gui_fetch_table fetch_table = {
.filetype = fetch_filetype,
};
diff --git a/frontends/windows/findfile.c b/frontends/windows/findfile.c
index e1c9595eb..e665530ba 100644
--- a/frontends/windows/findfile.c
+++ b/frontends/windows/findfile.c
@@ -99,7 +99,7 @@ char *nsws_find_resource(char *buf, const char *filename, const char *def)
char t[PATH_MAX];
if (cdir != NULL) {
- LOG("Found Home %s", cdir);
+ NSLOG(netsurf, INFO, "Found Home %s", cdir);
strcpy(t, cdir);
strcat(t, "/.netsurf/");
strcat(t, filename);
@@ -126,7 +126,7 @@ char *nsws_find_resource(char *buf, const char *filename, const char *def)
getcwd(t, PATH_MAX - SLEN("\\res\\") - strlen(filename));
strcat(t, "\\res\\");
strcat(t, filename);
- LOG("looking in %s", t);
+ NSLOG(netsurf, INFO, "looking in %s", t);
if ((realpath(t, buf) != NULL) && (access(buf, R_OK) == 0))
return buf;
diff --git a/frontends/windows/font.c b/frontends/windows/font.c
index f50ba6e9e..7389bd8c1 100644
--- a/frontends/windows/font.c
+++ b/frontends/windows/font.c
@@ -19,7 +19,7 @@
/**
* \file
- * Windows font handling implementation.
+ * Windows font handling and character encoding implementation.
*/
#include "utils/config.h"
@@ -38,36 +38,57 @@
HWND font_hwnd;
-nserror utf8_to_font_encoding(const struct font_desc* font,
- const char *string,
- size_t len,
- char **result)
+/* exported interface documented in windows/font.h */
+nserror
+utf8_to_font_encoding(const struct font_desc* font,
+ const char *string,
+ size_t len,
+ char **result)
{
return utf8_to_enc(string, font->encoding, len, result);
}
-static nserror utf8_to_local_encoding(const char *string,
- size_t len,
- char **result)
+
+/**
+ * Convert a string to UCS2 from UTF8
+ *
+ * \param[in] string source string
+ * \param[in] len source string length
+ * \param[out] result The UCS2 string
+ */
+static nserror
+utf8_to_local_encoding(const char *string, size_t len, char **result)
{
return utf8_to_enc(string, "UCS-2", len, result);
}
-static nserror utf8_from_local_encoding(const char *string, size_t len,
- char **result)
+
+/**
+ * Convert a string to UTF8 from local encoding
+ *
+ * \param[in] string source string
+ * \param[in] len source string length
+ * \param[out] result The UTF8 string
+ */
+static nserror
+utf8_from_local_encoding(const char *string, size_t len, char **result)
{
assert(string && result);
- if (len == 0)
+ if (len == 0) {
len = strlen(string);
+ }
*result = strndup(string, len);
- if (!(*result))
+ if (!(*result)) {
return NSERROR_NOMEM;
+ }
return NSERROR_OK;
}
+
+/* exported interface documented in windows/font.h */
HFONT get_font(const plot_font_style_t *style)
{
char *face = NULL;
@@ -99,7 +120,7 @@ HFONT get_font(const plot_font_style_t *style)
int nHeight = -10;
HDC hdc = GetDC(font_hwnd);
- nHeight = -MulDiv(style->size, GetDeviceCaps(hdc, LOGPIXELSY), 72 * FONT_SIZE_SCALE);
+ nHeight = -MulDiv(style->size, GetDeviceCaps(hdc, LOGPIXELSY), 72 * PLOT_STYLE_SCALE);
ReleaseDC(font_hwnd, hdc);
HFONT font = CreateFont(
@@ -122,16 +143,18 @@ HFONT get_font(const plot_font_style_t *style)
free(face);
if (font == NULL) {
- if (style->family == PLOT_FONT_FAMILY_MONOSPACE)
+ if (style->family == PLOT_FONT_FAMILY_MONOSPACE) {
font = (HFONT) GetStockObject(ANSI_FIXED_FONT);
- else
+ } else {
font = (HFONT) GetStockObject(ANSI_VAR_FONT);
+ }
}
if (font == NULL)
font = (HFONT) GetStockObject(SYSTEM_FONT);
return font;
}
+
/**
* Measure the width of a string.
*
@@ -139,13 +162,13 @@ HFONT get_font(const plot_font_style_t *style)
* \param[in] string UTF-8 string to measure
* \param[in] length length of string, in bytes
* \param[out] width updated to width of string[0..length)
- * \return NSERROR_OK on success otherwise apropriate error code
+ * \return NSERROR_OK on success otherwise appropriate error code
*/
static nserror
win32_font_width(const plot_font_style_t *style,
- const char *string,
- size_t length,
- int *width)
+ const char *string,
+ size_t length,
+ int *width)
{
HDC hdc;
HFONT font;
@@ -184,15 +207,15 @@ win32_font_width(const plot_font_style_t *style,
* \param x x coordinate to search for
* \param char_offset updated to offset in string of actual_x, [0..length]
* \param actual_x updated to x coordinate of character closest to x
- * \return NSERROR_OK on success otherwise apropriate error code
+ * \return NSERROR_OK on success otherwise appropriate error code
*/
static nserror
win32_font_position(const plot_font_style_t *style,
- const char *string,
- size_t length,
- int x,
- size_t *char_offset,
- int *actual_x)
+ const char *string,
+ size_t length,
+ int x,
+ size_t *char_offset,
+ int *actual_x)
{
HDC hdc;
HFONT font;
@@ -211,8 +234,8 @@ win32_font_position(const plot_font_style_t *style,
if ((GetTextExtentExPointA(hdc, string, length, x, &offset, NULL,&s) != 0) &&
(GetTextExtentPoint32A(hdc, string, offset, &s) != 0)) {
- *char_offset = (size_t)offset;
- *actual_x = s.cx;
+ *char_offset = (size_t)offset;
+ *actual_x = s.cx;
} else {
ret = NSERROR_UNKNOWN;
}
@@ -235,7 +258,7 @@ win32_font_position(const plot_font_style_t *style,
* \param x width available
* \param char_offset updated to offset in string of actual_x, [0..length]
* \param actual_x updated to x coordinate of character closest to x
- * \return NSERROR_OK on success otherwise apropriate error code
+ * \return NSERROR_OK on success otherwise appropriate error code
*
* On exit, [char_offset == 0 ||
* string[char_offset] == ' ' ||
@@ -243,16 +266,21 @@ win32_font_position(const plot_font_style_t *style,
*/
static nserror
win32_font_split(const plot_font_style_t *style,
- const char *string,
- size_t length,
- int x,
- size_t *char_offset,
- int *actual_x)
+ const char *string,
+ size_t length,
+ int x,
+ size_t *char_offset,
+ int *actual_x)
{
int c_off;
nserror ret = NSERROR_UNKNOWN;
- if (win32_font_position(style, string, length, x, char_offset, actual_x)) {
+ if (win32_font_position(style,
+ string,
+ length,
+ x,
+ char_offset,
+ actual_x) == NSERROR_OK) {
c_off = *char_offset;
if (*char_offset == length) {
ret = NSERROR_OK;
@@ -271,21 +299,26 @@ win32_font_split(const plot_font_style_t *style,
}
}
- success = win32_font_width(style, string, *char_offset, actual_x);
+ success = win32_font_width(style,
+ string,
+ *char_offset,
+ actual_x);
if (success) {
ret = NSERROR_OK;
}
}
}
-/*
- LOG("ret %d Split %u chars at %ipx: Split at char %i (%ipx) - %.*s",
- ret, length, x, *char_offset, *actual_x, *char_offset, string);
-*/
+
+ NSLOG(netsurf, DEEPDEBUG,
+ "ret %d Split %u chars at %ipx: Split at char %i (%ipx) - %.*s",
+ ret, length, x, *char_offset, *actual_x, *char_offset, string);
+
return ret;
}
+/** win32 font operations table */
static struct gui_layout_table layout_table = {
.width = win32_font_width,
.position = win32_font_position,
@@ -294,7 +327,7 @@ static struct gui_layout_table layout_table = {
struct gui_layout_table *win32_layout_table = &layout_table;
-
+/** win32 utf8 encoding operations table */
static struct gui_utf8_table utf8_table = {
.utf8_to_local = utf8_to_local_encoding,
.local_to_utf8 = utf8_from_local_encoding,
diff --git a/frontends/windows/font.h b/frontends/windows/font.h
index a1077e041..ec2c262ff 100644
--- a/frontends/windows/font.h
+++ b/frontends/windows/font.h
@@ -38,10 +38,15 @@ struct font_desc {
struct gui_layout_table *win32_layout_table;
struct gui_utf8_table *win32_utf8_table;
-extern nserror utf8_to_font_encoding(const struct font_desc* font,
- const char *string,
- size_t len,
- char **result);
+/**
+ * convert from utf-8 to win32 font encoding.
+ *
+ * \param[in] font font descriptor
+ * \param[in] string source utf-8 string
+ * \param[in] len The length of the utf-8 data
+ * \param[out] result The reencoded string.
+ */
+extern nserror utf8_to_font_encoding(const struct font_desc* font, const char *string, size_t len, char **result);
/**
* generate a win32 font handle from a generic font style
diff --git a/frontends/windows/global_history.c b/frontends/windows/global_history.c
index 0ef09632d..dcc75ba21 100644
--- a/frontends/windows/global_history.c
+++ b/frontends/windows/global_history.c
@@ -18,7 +18,7 @@
/**
* \file
- * Implementation of win32 cookie manager.
+ * Implementation of win32 global history interface.
*/
#include <stdint.h>
@@ -81,6 +81,8 @@ nsw32_global_history_mouse(struct nsw32_corewindow *nsw32_cw,
* callback on draw event for global_history window
*
* \param nsw32_cw The nsw32 core window structure.
+ * \param scrollx The horizontal scroll offset.
+ * \param scrolly The vertical scroll offset.
* \param r The rectangle of the window that needs updating.
* \return NSERROR_OK on success otherwise apropriate error code
*/
@@ -124,7 +126,7 @@ static nserror nsw32_global_history_init(HINSTANCE hInstance)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsw32_global_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/windows/gui.c b/frontends/windows/gui.c
index f5808de86..890bfae42 100644
--- a/frontends/windows/gui.c
+++ b/frontends/windows/gui.c
@@ -17,6 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * win32 gui implementation.
+ */
+
#include <stdbool.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -47,6 +52,7 @@ HINSTANCE hinst;
static bool win32_quit = false;
+/* exported interface documented in gui.h */
void win32_set_quit(bool q)
{
win32_quit = q;
@@ -60,7 +66,7 @@ void win32_run(void)
int timeout; /* timeout in miliseconds */
UINT timer_id = 0;
- LOG("Starting messgae dispatcher");
+ NSLOG(netsurf, INFO, "Starting messgae dispatcher");
while (!win32_quit) {
/* run the scheduler and discover how long to wait for
@@ -98,7 +104,7 @@ void win32_run(void)
nserror win32_warning(const char *warning, const char *detail)
{
size_t len = 1 + ((warning != NULL) ? strlen(messages_get(warning)) :
- 0) + ((detail != 0) ? strlen(detail) : 0);
+ 0) + ((detail != 0) ? strlen(detail) : 0);
char message[len];
snprintf(message, len, messages_get(warning), detail);
MessageBox(NULL, message, "Warning", MB_ICONWARNING);
@@ -110,8 +116,8 @@ nserror win32_warning(const char *warning, const char *detail)
/**
* Core asks front end for clipboard contents.
*
- * \param buffer UTF-8 text, allocated by front end, ownership yeilded to core
- * \param length Byte length of UTF-8 text in buffer
+ * \param buffer UTF-8 text, allocated by front end, ownership yeilded to core
+ * \param length Byte length of UTF-8 text in buffer
*/
static void gui_get_clipboard(char **buffer, size_t *length)
{
@@ -122,7 +128,7 @@ static void gui_get_clipboard(char **buffer, size_t *length)
clipboard_handle = GetClipboardData(CF_TEXT);
if (clipboard_handle != NULL) {
content = GlobalLock(clipboard_handle);
- LOG("pasting %s", content);
+ NSLOG(netsurf, INFO, "pasting %s", content);
GlobalUnlock(clipboard_handle);
}
}
@@ -137,7 +143,7 @@ static void gui_get_clipboard(char **buffer, size_t *length)
* \param n_styles Number of text run styles in array
*/
static void gui_set_clipboard(const char *buffer, size_t length,
- nsclipboard_styles styles[], int n_styles)
+ nsclipboard_styles styles[], int n_styles)
{
/* TODO: Implement this */
HANDLE hnew;
@@ -169,5 +175,3 @@ static struct gui_clipboard_table clipboard_table = {
};
struct gui_clipboard_table *win32_clipboard_table = &clipboard_table;
-
-
diff --git a/frontends/windows/hotlist.c b/frontends/windows/hotlist.c
index c184619bf..e8dd90b34 100644
--- a/frontends/windows/hotlist.c
+++ b/frontends/windows/hotlist.c
@@ -85,6 +85,8 @@ nsw32_hotlist_mouse(struct nsw32_corewindow *nsw32_cw,
* callback on draw event for hotlist window
*
* \param nsw32_cw The nsw32 core window structure.
+ * \param scrollx The horizontal scroll offset.
+ * \param scrolly The vertical scroll offset.
* \param r The rectangle of the window that needs updating.
* \return NSERROR_OK on success otherwise apropriate error code
*/
@@ -128,7 +130,7 @@ static nserror nsw32_hotlist_init(HINSTANCE hInstance)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsw32_hotlist_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
@@ -182,7 +184,7 @@ nserror nsw32_hotlist_finalise(void)
return NSERROR_OK;
}
- res = hotlist_fini(nsoption_charp(hotlist_path));
+ res = hotlist_fini();
if (res == NSERROR_OK) {
res = nsw32_corewindow_fini(&hotlist_window->core);
DestroyWindow(hotlist_window->core.hWnd);
diff --git a/frontends/windows/local_history.c b/frontends/windows/local_history.c
new file mode 100644
index 000000000..722d365e7
--- /dev/null
+++ b/frontends/windows/local_history.c
@@ -0,0 +1,255 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Implementation of win32 local history interface.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <windows.h>
+
+#include "utils/log.h"
+#include "utils/nsoption.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "desktop/local_history.h"
+
+#include "windows/plot.h"
+#include "windows/corewindow.h"
+#include "windows/local_history.h"
+
+
+struct nsw32_local_history_window {
+ struct nsw32_corewindow core;
+
+ struct local_history_session *session;
+};
+
+static struct nsw32_local_history_window *local_history_window = NULL;
+
+/**
+ * callback for keypress on local_history window
+ *
+ * \param nsw32_cw The nsw32 core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+nsw32_local_history_key(struct nsw32_corewindow *nsw32_cw, uint32_t nskey)
+{
+ struct nsw32_local_history_window *lhw;
+
+ lhw = (struct nsw32_local_history_window *)nsw32_cw;
+
+ if (local_history_keypress(lhw->session,nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
+/**
+ * callback for mouse action on local_history window
+ *
+ * \param nsw32_cw The nsw32 core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+nsw32_local_history_mouse(struct nsw32_corewindow *nsw32_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ struct nsw32_local_history_window *lhw;
+
+ lhw = (struct nsw32_local_history_window *)nsw32_cw;
+
+ local_history_mouse_action(lhw->session, mouse_state, x, y);
+
+ return NSERROR_OK;
+}
+
+/**
+ * callback on draw event for local_history window
+ *
+ * \param nsw32_cw The nsw32 core window structure.
+ * \param scrollx The horizontal scroll offset.
+ * \param scrolly The vertical scroll offset.
+ * \param r The rectangle of the window that needs updating.
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+nsw32_local_history_draw(struct nsw32_corewindow *nsw32_cw,
+ int scrollx,
+ int scrolly,
+ struct rect *r)
+{
+ struct nsw32_local_history_window *lhw;
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &win_plotters
+ };
+
+ lhw = (struct nsw32_local_history_window *)nsw32_cw;
+
+ local_history_redraw(lhw->session, -scrollx, -scrolly, r, &ctx);
+
+ return NSERROR_OK;
+}
+
+
+static nserror
+nsw32_local_history_close(struct nsw32_corewindow *nsw32_cw)
+{
+ ShowWindow(nsw32_cw->hWnd, SW_HIDE);
+
+ return NSERROR_OK;
+}
+
+/**
+ * Creates the window for the local_history tree.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+static nserror
+nsw32_local_history_init(HINSTANCE hInstance,
+ struct browser_window *bw,
+ struct nsw32_local_history_window **win_out)
+{
+ struct nsw32_local_history_window *ncwin;
+ nserror res;
+
+ if ((*win_out) != NULL) {
+ res = local_history_set((*win_out)->session, bw);
+ return res;
+ }
+
+ ncwin = calloc(1, sizeof(*ncwin));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ ncwin->core.title = "NetSurf Local History";
+ ncwin->core.draw = nsw32_local_history_draw;
+ ncwin->core.key = nsw32_local_history_key;
+ ncwin->core.mouse = nsw32_local_history_mouse;
+ ncwin->core.close = nsw32_local_history_close;
+
+ res = nsw32_corewindow_init(hInstance, NULL, &ncwin->core);
+ if (res != NSERROR_OK) {
+ free(ncwin);
+ return res;
+ }
+
+ res = local_history_init(ncwin->core.cb_table,
+ (struct core_window *)ncwin,
+ bw,
+ &ncwin->session);
+ if (res != NSERROR_OK) {
+ free(ncwin);
+ return res;
+ }
+
+ /* memoise window so it can be represented when necessary
+ * instead of recreating every time.
+ */
+ *win_out = ncwin;
+
+ return NSERROR_OK;
+}
+
+
+/* exported interface documented in windows/local_history.h */
+nserror
+nsw32_local_history_present(HWND hWndParent, struct browser_window *bw)
+{
+ nserror res;
+ HINSTANCE hInstance;
+ RECT parentr;
+ int width, height;
+ int margin = 50;
+
+ hInstance = (HINSTANCE)GetWindowLongPtr(hWndParent, GWLP_HINSTANCE);
+
+ res = nsw32_local_history_init(hInstance, bw, &local_history_window);
+ if (res == NSERROR_OK) {
+ GetWindowRect(hWndParent, &parentr);
+
+ /* resize history widget ensureing the drawing area is
+ * no larger than parent window
+ */
+ res = local_history_get_size(local_history_window->session,
+ &width,
+ &height);
+ width += margin;
+ height += margin;
+ if ((parentr.right - parentr.left - margin) < width) {
+ width = parentr.right - parentr.left - margin;
+ }
+ if ((parentr.bottom - parentr.top - margin) < height) {
+ height = parentr.bottom - parentr.top - margin;
+ }
+ SetWindowPos(local_history_window->core.hWnd,
+ HWND_TOP,
+ parentr.left + (margin/2),
+ parentr.top + (margin/2),
+ width,
+ height,
+ SWP_SHOWWINDOW);
+ }
+ return res;
+}
+
+
+/* exported interface documented in windows/local_history.h */
+nserror nsw32_local_history_hide(void)
+{
+ nserror res = NSERROR_OK;
+
+ if (local_history_window != NULL) {
+ ShowWindow(local_history_window->core.hWnd, SW_HIDE);
+
+ res = local_history_set(local_history_window->session, NULL);
+ }
+
+ return res;
+}
+
+/* exported interface documented in windows/local_history.h */
+nserror nsw32_local_history_finalise(void)
+{
+ nserror res;
+
+ if (local_history_window == NULL) {
+ return NSERROR_OK;
+ }
+
+ res = local_history_fini(local_history_window->session);
+ if (res == NSERROR_OK) {
+ res = nsw32_corewindow_fini(&local_history_window->core);
+ DestroyWindow(local_history_window->core.hWnd);
+ free(local_history_window);
+ local_history_window = NULL;
+ }
+
+ return res;
+}
diff --git a/frontends/cocoa/apple_image.h b/frontends/windows/local_history.h
index 11248a6fb..a6e2180b9 100644
--- a/frontends/cocoa/apple_image.h
+++ b/frontends/windows/local_history.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,24 +16,30 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * Interface to win32 local history manager using nsw32 core window
+ */
-#ifndef _NETSURF_COCOA_APPLE_IMAGE_H_
-#define _NETSURF_COCOA_APPLE_IMAGE_H_
-
-#include "utils/config.h"
-#include "utils/errors.h"
-
-#ifdef WITH_APPLE_IMAGE
+#ifndef NETSURF_WINDOWS_LOCAL_HISTORY_H
+#define NETSURF_WINDOWS_LOCAL_HISTORY_H
/**
- * Initialise apple image handlers instead of generic core ones.
+ * make the local history window visible.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
*/
-nserror apple_image_init(void);
+nserror nsw32_local_history_present(HWND hWndParent, struct browser_window *bw);
-#else
-
-#define apple_image_init() NSERROR_OK
+/**
+ * hide the local history window.
+ */
+nserror nsw32_local_history_hide(void);
-#endif /* WITH_APPLE_IMAGE */
+/**
+ * Destroys the local history window and performs any other necessary cleanup
+ * actions.
+ */
+nserror nsw32_local_history_finalise(void);
#endif
diff --git a/frontends/windows/localhistory.c b/frontends/windows/localhistory.c
deleted file mode 100644
index ae3b7f521..000000000
--- a/frontends/windows/localhistory.c
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin@dfgh.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "utils/config.h"
-
-#include <windows.h>
-#include <windowsx.h>
-#include <commctrl.h>
-
-#include "desktop/browser_history.h"
-#include "netsurf/plotters.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-
-#include "windows/window.h"
-#include "windows/localhistory.h"
-#include "windows/gui.h"
-#include "windows/plot.h"
-#include "windows/resourceid.h"
-#include "windows/windbg.h"
-
-static const char windowclassname_localhistory[] = "nswslocalhistorywindow";
-
-struct nsws_localhistory {
- HWND hwnd; /**< the window handle */
- int width; /**< the width of the memory history */
- int height; /**< the height of the memory history */
- int guiwidth; /**< the width of the history window */
- int guiheight; /**< the height of the history window */
- int vscroll; /**< the vertical scroll location */
- int hscroll; /**< the horizontal scroll location */
-};
-
-
-static void
-nsws_localhistory_scroll_check(struct nsws_localhistory *l,
- struct gui_window *gw)
-{
- SCROLLINFO si;
-
- if ((gw->bw == NULL) || (l->hwnd == NULL))
- return;
-
- browser_window_history_size(gw->bw, &(l->width), &(l->height));
-
- si.cbSize = sizeof(si);
- si.fMask = SIF_ALL;
- si.nMin = 0;
- si.nMax = l->height;
- si.nPage = l->guiheight;
- si.nPos = 0;
- SetScrollInfo(l->hwnd, SB_VERT, &si, TRUE);
-
- si.nMax = l->width;
- si.nPage = l->guiwidth;
- SetScrollInfo(l->hwnd, SB_HORZ, &si, TRUE);
- if (l->guiheight >= l->height)
- l->vscroll = 0;
- if (l->guiwidth >= l->width)
- l->hscroll = 0;
- SendMessage(l->hwnd, WM_PAINT, 0, 0);
-}
-
-
-static void
-nsws_localhistory_up(struct nsws_localhistory *l, struct gui_window *gw)
-{
- HDC tmp_hdc;
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &win_plotters
- };
-
- LOG("gui window %p", gw);
-
- l->vscroll = 0;
- l->hscroll = 0;
-
- if (gw->bw != NULL) {
- /* set global HDC for the plotters */
- tmp_hdc = plot_hdc;
- plot_hdc = GetDC(l->hwnd);
-
- browser_window_history_redraw(gw->bw, &ctx);
-
- ReleaseDC(l->hwnd, plot_hdc);
-
- plot_hdc = tmp_hdc;
- }
-
- nsws_localhistory_scroll_check(l, gw);
-}
-
-
-void nsws_localhistory_close(struct gui_window *w)
-{
- struct nsws_localhistory *l = gui_window_localhistory(w);
- if (l != NULL)
- CloseWindow(l->hwnd);
-}
-
-
-static LRESULT CALLBACK
-nsws_localhistory_event_callback(HWND hwnd, UINT msg,
- WPARAM wparam, LPARAM lparam)
-{
- int x,y;
- struct gui_window *gw;
-
- LOG_WIN_MSG(hwnd, msg, wparam, lparam);
-
- gw = nsws_get_gui_window(hwnd);
- if (gw == NULL) {
- LOG("Unable to find gui window structure for hwnd %p", hwnd);
- return DefWindowProc(hwnd, msg, wparam, lparam);
- }
-
- switch(msg) {
-
- case WM_CREATE:
- nsws_localhistory_scroll_check(gw->localhistory, gw);
- break;
-
- case WM_SIZE:
- gw->localhistory->guiheight = HIWORD(lparam);
- gw->localhistory->guiwidth = LOWORD(lparam);
- nsws_localhistory_scroll_check(gw->localhistory, gw);
- break;
-
- case WM_LBUTTONUP:
- if (gw->bw == NULL)
- break;
-
- x = GET_X_LPARAM(lparam);
- y = GET_Y_LPARAM(lparam);
-
- if (browser_window_history_click(gw->bw,
- gw->localhistory->hscroll + x,
- gw->localhistory->vscroll + y,
- false)) {
- DestroyWindow(hwnd);
- }
-
- break;
-
- case WM_MOUSEMOVE:
- x = GET_X_LPARAM(lparam);
- y = GET_Y_LPARAM(lparam);
- return DefWindowProc(hwnd, msg, wparam, lparam);
- break;
-
-
- case WM_VSCROLL:
- {
- SCROLLINFO si;
- int mem;
- si.cbSize = sizeof(si);
- si.fMask = SIF_ALL;
- GetScrollInfo(hwnd, SB_VERT, &si);
- mem = si.nPos;
- switch (LOWORD(wparam)) {
- case SB_TOP:
- si.nPos = si.nMin;
- break;
- case SB_BOTTOM:
- si.nPos = si.nMax;
- break;
- case SB_LINEUP:
- si.nPos -= 30;
- break;
- case SB_LINEDOWN:
- si.nPos += 30;
- break;
- case SB_PAGEUP:
- si.nPos -= gw->localhistory->guiheight;
- break;
- case SB_PAGEDOWN:
- si.nPos += gw->localhistory->guiheight;
- break;
- case SB_THUMBTRACK:
- si.nPos = si.nTrackPos;
- break;
- default:
- break;
- }
- si.nPos = min(si.nPos, gw->localhistory->height);
- si.nPos = min(si.nPos, 0);
- si.fMask = SIF_POS;
- SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- GetScrollInfo(hwnd, SB_VERT, &si);
- if (si.nPos != mem) {
- gw->localhistory->vscroll += si.nPos - mem;
- ScrollWindowEx(hwnd, 0, -(si.nPos - mem), NULL, NULL, NULL, NULL, SW_ERASE | SW_INVALIDATE);
- }
- break;
- }
-
- case WM_HSCROLL:
- {
- SCROLLINFO si;
- int mem;
-
- si.cbSize = sizeof(si);
- si.fMask = SIF_ALL;
- GetScrollInfo(hwnd, SB_HORZ, &si);
- mem = si.nPos;
-
- switch (LOWORD(wparam)) {
- case SB_LINELEFT:
- si.nPos -= 30;
- break;
- case SB_LINERIGHT:
- si.nPos += 30;
- break;
- case SB_PAGELEFT:
- si.nPos -= gw->localhistory->guiwidth;
- break;
- case SB_PAGERIGHT:
- si.nPos += gw->localhistory->guiwidth;
- break;
- case SB_THUMBTRACK:
- si.nPos = si.nTrackPos;
- break;
- default:
- break;
- }
- si.nPos = min(si.nPos, gw->localhistory->width);
- si.nPos = max(si.nPos, 0);
- si.fMask = SIF_POS;
- SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
- GetScrollInfo(hwnd, SB_HORZ, &si);
- if (si.nPos != mem) {
- gw->localhistory->hscroll += si.nPos - mem;
- ScrollWindowEx(hwnd, -(si.nPos - mem), 0, NULL, NULL, NULL, NULL, SW_ERASE | SW_INVALIDATE);
- }
- break;
- }
-
- case WM_PAINT: {
- PAINTSTRUCT ps;
- HDC hdc, tmp_hdc;
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &win_plotters
- };
-
- hdc = BeginPaint(hwnd, &ps);
- if (gw->bw != NULL) {
- /* set global HDC for the plotters */
- tmp_hdc = plot_hdc;
- plot_hdc = hdc;
-
- browser_window_history_redraw_rectangle(gw->bw,
- gw->localhistory->hscroll + ps.rcPaint.left,
- gw->localhistory->vscroll + ps.rcPaint.top,
- gw->localhistory->hscroll + (ps.rcPaint.right - ps.rcPaint.left),
- gw->localhistory->vscroll + (ps.rcPaint.bottom - ps.rcPaint.top),
- ps.rcPaint.left,
- ps.rcPaint.top, &ctx);
-
- plot_hdc = tmp_hdc;
-
- }
- EndPaint(hwnd, &ps);
-
- break;
- }
-
- case WM_CLOSE:
- DestroyWindow(hwnd);
- return 1;
-
- case WM_DESTROY:
- free(gw->localhistory);
- gw->localhistory = NULL;
- break;
-
- default:
- return DefWindowProc(hwnd, msg, wparam, lparam);
-
- }
- return 0;
-}
-
-
-/* exported method documented in windows/localhistory.h */
-struct nsws_localhistory *nsws_window_create_localhistory(struct gui_window *gw)
-{
- struct nsws_localhistory *localhistory;
- INITCOMMONCONTROLSEX icc;
- int margin = 50;
- RECT r;
-
- LOG("gui window %p", gw);
-
- /* if we already have a window, just update and re-show it */
- if (gw->localhistory != NULL) {
- nsws_localhistory_up(gw->localhistory, gw);
- UpdateWindow(gw->localhistory->hwnd);
- ShowWindow(gw->localhistory->hwnd, SW_SHOWNORMAL);
- return gw->localhistory;
- }
-
- localhistory = calloc(1, sizeof(struct nsws_localhistory));
-
- if (localhistory == NULL) {
- return NULL;
- }
- gw->localhistory = localhistory;
-
- localhistory->width = 0;
- localhistory->height = 0;
-
- if (gw->bw != NULL) {
- browser_window_history_size(gw->bw,
- &(localhistory->width),
- &(localhistory->height));
- }
-
- GetWindowRect(gw->main, &r);
- SetWindowPos(gw->main, HWND_NOTOPMOST, 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE);
-
- localhistory->guiwidth = min(r.right - r.left - margin,
- localhistory->width + margin);
- localhistory->guiheight = min(r.bottom - r.top - margin,
- localhistory->height + margin);
-
- icc.dwSize = sizeof(icc);
- icc.dwICC = ICC_BAR_CLASSES | ICC_WIN95_CLASSES;
-#if WINVER > 0x0501
- icc.dwICC |= ICC_STANDARD_CLASSES;
-#endif
- InitCommonControlsEx(&icc);
-
- LOG("creating local history window for hInstance %p", hinst);
- localhistory->hwnd = CreateWindow(windowclassname_localhistory,
- "NetSurf History",
- WS_THICKFRAME |
- WS_HSCROLL |
- WS_VSCROLL |
- WS_CLIPCHILDREN |
- WS_CLIPSIBLINGS |
- WS_SYSMENU |
- CS_DBLCLKS,
- r.left + margin/2,
- r.top + margin/2,
- localhistory->guiwidth,
- localhistory->guiheight,
- NULL,
- NULL,
- hinst,
- NULL);
-
- /* set the gui window associated with this browser */
- SetProp(localhistory->hwnd, TEXT("GuiWnd"), (HANDLE)gw);
-
- LOG("gui_window %p width %d height %d hwnd %p",
- gw, localhistory->guiwidth, localhistory->guiheight,
- localhistory->hwnd);
-
- nsws_localhistory_up(localhistory, gw);
- UpdateWindow(localhistory->hwnd);
- ShowWindow(localhistory->hwnd, SW_SHOWNORMAL);
-
- return localhistory;
-}
-
-
-/* exported method documented in windows/localhistory.h */
-nserror
-nsws_create_localhistory_class(HINSTANCE hinstance) {
- nserror ret = NSERROR_OK;
- WNDCLASSEX w;
-
- /* localhistory window */
- w.cbSize = sizeof(WNDCLASSEX);
- w.style = 0;
- w.lpfnWndProc = nsws_localhistory_event_callback;
- w.cbClsExtra = 0;
- w.cbWndExtra = 0;
- w.hInstance = hinstance;
- w.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(IDR_NETSURF_ICON));
- w.hCursor = LoadCursor(NULL, IDC_ARROW);
- w.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
- w.lpszMenuName = NULL;
- w.lpszClassName = windowclassname_localhistory;
- w.hIconSm = LoadIcon(hinstance, MAKEINTRESOURCE(IDR_NETSURF_ICON));
-
- if (RegisterClassEx(&w) == 0) {
- win_perror("DrawableClass");
- ret = NSERROR_INIT_FAILED;
- }
-
- return ret;
-}
diff --git a/frontends/windows/localhistory.h b/frontends/windows/localhistory.h
deleted file mode 100644
index b0ad07491..000000000
--- a/frontends/windows/localhistory.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-* Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin@dfgh.net>
-*
-* This file is part of NetSurf, http://www.netsurf-browser.org/
-*
-* NetSurf is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; version 2 of the License.
-*
-* NetSurf is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _NETSURF_WINDOWS_LOCALHISTORY_H_
-#define _NETSURF_WINDOWS_LOCALHISTORY_H_
-
-struct nsws_localhistory;
-
-void nsws_localhistory_open(struct gui_window *gw);
-void nsws_localhistory_close(struct gui_window *gw);
-
-/* creates localhistory window */
-struct nsws_localhistory *nsws_window_create_localhistory(struct gui_window *gw);
-
-nserror nsws_create_localhistory_class(HINSTANCE hinstance);
-
-#endif
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 442c71b06..a3a7c2b39 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -46,7 +46,7 @@
#include "windows/corewindow.h"
#include "windows/ssl_cert.h"
#include "windows/download.h"
-#include "windows/localhistory.h"
+#include "windows/local_history.h"
#include "windows/window.h"
#include "windows/schedule.h"
#include "windows/font.h"
@@ -99,7 +99,7 @@ static nserror get_config_home(char **config_home_out)
*config_home_out = strdup(adPath);
- LOG("using config path \"%s\"", *config_home_out);
+ NSLOG(netsurf, INFO, "using config path \"%s\"", *config_home_out);
return NSERROR_OK;
}
@@ -343,15 +343,16 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
/* Locate the correct user configuration directory path */
ret = get_config_home(&nsw32_config_home);
if (ret != NSERROR_OK) {
- LOG("Unable to locate a configuration directory.");
+ NSLOG(netsurf, INFO,
+ "Unable to locate a configuration directory.");
nsw32_config_home = NULL;
}
/* Initialise user options */
ret = nsw32_option_init(&argc, argv);
if (ret != NSERROR_OK) {
- LOG("Options failed to initialise (%s)\n",
- messages_get_errorcode(ret));
+ NSLOG(netsurf, INFO, "Options failed to initialise (%s)\n",
+ messages_get_errorcode(ret));
return 1;
}
@@ -365,17 +366,17 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
/* common initialisation */
ret = netsurf_init(NULL);
if (ret != NSERROR_OK) {
- LOG("NetSurf failed to initialise");
+ NSLOG(netsurf, INFO, "NetSurf failed to initialise");
return 1;
}
urldb_load(nsoption_charp(url_file));
urldb_load_cookies(nsoption_charp(cookie_file));
- hotlist_init(nsoption_charp(hotlist_path));
+ hotlist_init(nsoption_charp(hotlist_path),
+ nsoption_charp(hotlist_path));
ret = nsws_create_main_class(hInstance);
ret = nsws_create_drawable_class(hInstance);
- ret = nsws_create_localhistory_class(hInstance);
ret = nsw32_create_corewindow_class(hInstance);
ret = nsws_create_cert_verify_class(hInstance);
@@ -392,7 +393,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
addr = NETSURF_HOMEPAGE;
}
- LOG("calling browser_window_create");
+ NSLOG(netsurf, INFO, "calling browser_window_create");
ret = nsurl_create(addr, &url);
if (ret == NSERROR_OK) {
@@ -418,5 +419,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
/* finalise options */
nsoption_finalise(nsoptions, nsoptions_default);
+ /* finalise logging */
+ nslog_finalise();
+
return 0;
}
diff --git a/frontends/windows/plot.c b/frontends/windows/plot.c
index fd2961957..4d9096d75 100644
--- a/frontends/windows/plot.c
+++ b/frontends/windows/plot.c
@@ -17,6 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * win32 plotter implementation.
+ */
+
#include "utils/config.h"
#include <sys/types.h>
#include <stdint.h>
@@ -36,458 +41,23 @@
#include "windows/gui.h"
#include "windows/plot.h"
-
-/* set NSWS_PLOT_DEBUG to 0 for no debugging, 1 for debugging */
-/* #define NSWS_PLOT_DEBUG */
-
-#ifdef NSWS_PLOT_DEBUG
-#define PLOT_LOG(x...) LOG(x)
-#else
-#define PLOT_LOG(x...) ((void) 0)
-#endif
-
HDC plot_hdc;
-static RECT plot_clip; /* currently set clipping rectangle */
-
-static bool clip(const struct rect *clip)
-{
- PLOT_LOG("clip %d,%d to %d,%d", clip->x0, clip->y0, clip->x1, clip->y1);
-
- plot_clip.left = clip->x0;
- plot_clip.top = clip->y0;
- plot_clip.right = clip->x1 + 1; /* co-ordinates are exclusive */
- plot_clip.bottom = clip->y1 + 1; /* co-ordinates are exclusive */
-
- return true;
-}
-
-static bool line(int x0, int y0, int x1, int y1, const plot_style_t *style)
-{
- PLOT_LOG("from %d,%d to %d,%d", x0, y0, x1, y1);
-
- /* ensure the plot HDC is set */
- if (plot_hdc == NULL) {
- LOG("HDC not set on call to plotters");
- return false;
- }
-
- HRGN clipregion = CreateRectRgnIndirect(&plot_clip);
- if (clipregion == NULL) {
- return false;
- }
-
- COLORREF col = (DWORD)(style->stroke_colour & 0x00FFFFFF);
- /* windows 0x00bbggrr */
- DWORD penstyle = PS_GEOMETRIC | ((style->stroke_type ==
- PLOT_OP_TYPE_DOT) ? PS_DOT :
- (style->stroke_type == PLOT_OP_TYPE_DASH) ? PS_DASH:
- 0);
- LOGBRUSH lb = {BS_SOLID, col, 0};
- HPEN pen = ExtCreatePen(penstyle, style->stroke_width, &lb, 0, NULL);
- if (pen == NULL) {
- DeleteObject(clipregion);
- return false;
- }
- HGDIOBJ bak = SelectObject(plot_hdc, (HGDIOBJ) pen);
- if (bak == NULL) {
- DeleteObject(pen);
- DeleteObject(clipregion);
- return false;
- }
-/*
- RECT r;
- r.left = x0;
- r.top = y0;
- r.right = x1;
- r.bottom = y1;
-*/
- SelectClipRgn(plot_hdc, clipregion);
-
- MoveToEx(plot_hdc, x0, y0, (LPPOINT) NULL);
-
- LineTo(plot_hdc, x1, y1);
-
- SelectClipRgn(plot_hdc, NULL);
- pen = SelectObject(plot_hdc, bak);
-
- DeleteObject(pen);
- DeleteObject(clipregion);
-
- return true;
-}
-
-static bool rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
-{
- PLOT_LOG("rectangle from %d,%d to %d,%d", x0, y0, x1, y1);
-
- /* ensure the plot HDC is set */
- if (plot_hdc == NULL) {
- LOG("HDC not set on call to plotters");
- return false;
- }
-
- HRGN clipregion = CreateRectRgnIndirect(&plot_clip);
- if (clipregion == NULL) {
- return false;
- }
-
- x1++;
- y1++;
-
- COLORREF pencol = (DWORD)(style->stroke_colour & 0x00FFFFFF);
- DWORD penstyle = PS_GEOMETRIC |
- (style->stroke_type == PLOT_OP_TYPE_DOT ? PS_DOT :
- (style->stroke_type == PLOT_OP_TYPE_DASH ? PS_DASH :
- (style->stroke_type == PLOT_OP_TYPE_NONE ? PS_NULL :
- 0)));
- LOGBRUSH lb = {BS_SOLID, pencol, 0};
- LOGBRUSH lb1 = {BS_SOLID, style->fill_colour, 0};
- if (style->fill_type == PLOT_OP_TYPE_NONE)
- lb1.lbStyle = BS_HOLLOW;
-
- HPEN pen = ExtCreatePen(penstyle, style->stroke_width, &lb, 0, NULL);
- if (pen == NULL) {
- return false;
- }
- HGDIOBJ penbak = SelectObject(plot_hdc, (HGDIOBJ) pen);
- if (penbak == NULL) {
- DeleteObject(pen);
- return false;
- }
- HBRUSH brush = CreateBrushIndirect(&lb1);
- if (brush == NULL) {
- SelectObject(plot_hdc, penbak);
- DeleteObject(pen);
- return false;
- }
- HGDIOBJ brushbak = SelectObject(plot_hdc, (HGDIOBJ) brush);
- if (brushbak == NULL) {
- SelectObject(plot_hdc, penbak);
- DeleteObject(pen);
- DeleteObject(brush);
- return false;
- }
-
- SelectClipRgn(plot_hdc, clipregion);
-
- Rectangle(plot_hdc, x0, y0, x1, y1);
-
- pen = SelectObject(plot_hdc, penbak);
- brush = SelectObject(plot_hdc, brushbak);
- SelectClipRgn(plot_hdc, NULL);
- DeleteObject(pen);
- DeleteObject(brush);
- DeleteObject(clipregion);
-
- return true;
-}
-
-
-static bool polygon(const int *p, unsigned int n, const plot_style_t *style)
-{
- PLOT_LOG("polygon %d points", n);
-
- /* ensure the plot HDC is set */
- if (plot_hdc == NULL) {
- LOG("HDC not set on call to plotters");
- return false;
- }
-
- POINT points[n];
- unsigned int i;
- HRGN clipregion = CreateRectRgnIndirect(&plot_clip);
- if (clipregion == NULL) {
- return false;
- }
-
- COLORREF pencol = (DWORD)(style->fill_colour & 0x00FFFFFF);
- COLORREF brushcol = (DWORD)(style->fill_colour & 0x00FFFFFF);
- HPEN pen = CreatePen(PS_GEOMETRIC | PS_NULL, 1, pencol);
- if (pen == NULL) {
- DeleteObject(clipregion);
- return false;
- }
- HPEN penbak = SelectObject(plot_hdc, pen);
- if (penbak == NULL) {
- DeleteObject(clipregion);
- DeleteObject(pen);
- return false;
- }
- HBRUSH brush = CreateSolidBrush(brushcol);
- if (brush == NULL) {
- DeleteObject(clipregion);
- SelectObject(plot_hdc, penbak);
- DeleteObject(pen);
- return false;
- }
- HBRUSH brushbak = SelectObject(plot_hdc, brush);
- if (brushbak == NULL) {
- DeleteObject(clipregion);
- SelectObject(plot_hdc, penbak);
- DeleteObject(pen);
- DeleteObject(brush);
- return false;
- }
- SetPolyFillMode(plot_hdc, WINDING);
- for (i = 0; i < n; i++) {
- points[i].x = (long) p[2 * i];
- points[i].y = (long) p[2 * i + 1];
-
- PLOT_LOG("%ld,%ld ", points[i].x, points[i].y);
- }
-
- SelectClipRgn(plot_hdc, clipregion);
-
- if (n >= 2)
- Polygon(plot_hdc, points, n);
-
- SelectClipRgn(plot_hdc, NULL);
-
- pen = SelectObject(plot_hdc, penbak);
- brush = SelectObject(plot_hdc, brushbak);
- DeleteObject(clipregion);
- DeleteObject(pen);
- DeleteObject(brush);
-
- return true;
-}
-
-
-static bool text(int x, int y, const char *text, size_t length,
- const plot_font_style_t *style)
-{
- PLOT_LOG("words %s at %d,%d", text, x, y);
-
- /* ensure the plot HDC is set */
- if (plot_hdc == NULL) {
- LOG("HDC not set on call to plotters");
- return false;
- }
-
- HRGN clipregion = CreateRectRgnIndirect(&plot_clip);
- if (clipregion == NULL) {
- return false;
- }
-
- HFONT fontbak, font = get_font(style);
- if (font == NULL) {
- DeleteObject(clipregion);
- return false;
- }
- int wlen;
- SIZE s;
- LPWSTR wstring;
- fontbak = (HFONT) SelectObject(plot_hdc, font);
- GetTextExtentPoint(plot_hdc, text, length, &s);
-
-/*
- RECT r;
- r.left = x;
- r.top = y - (3 * s.cy) / 4;
- r.right = x + s.cx;
- r.bottom = y + s.cy / 4;
-*/
- SelectClipRgn(plot_hdc, clipregion);
-
- SetTextAlign(plot_hdc, TA_BASELINE | TA_LEFT);
- if ((style->background & 0xFF000000) != 0x01000000)
- /* 100% alpha */
- SetBkColor(plot_hdc, (DWORD) (style->background & 0x00FFFFFF));
- SetBkMode(plot_hdc, TRANSPARENT);
- SetTextColor(plot_hdc, (DWORD) (style->foreground & 0x00FFFFFF));
-
- wlen = MultiByteToWideChar(CP_UTF8, 0, text, length, NULL, 0);
- wstring = malloc(2 * (wlen + 1));
- if (wstring == NULL) {
- return false;
- }
- MultiByteToWideChar(CP_UTF8, 0, text, length, wstring, wlen);
- TextOutW(plot_hdc, x, y, wstring, wlen);
-
- SelectClipRgn(plot_hdc, NULL);
- free(wstring);
- font = SelectObject(plot_hdc, fontbak);
- DeleteObject(clipregion);
- DeleteObject(font);
-
- return true;
-}
-
-static bool disc(int x, int y, int radius, const plot_style_t *style)
-{
- PLOT_LOG("disc at %d,%d radius %d", x, y, radius);
-
- /* ensure the plot HDC is set */
- if (plot_hdc == NULL) {
- LOG("HDC not set on call to plotters");
- return false;
- }
-
- HRGN clipregion = CreateRectRgnIndirect(&plot_clip);
- if (clipregion == NULL) {
- return false;
- }
-
- COLORREF col = (DWORD)((style->fill_colour | style->stroke_colour)
- & 0x00FFFFFF);
- HPEN pen = CreatePen(PS_GEOMETRIC | PS_SOLID, 1, col);
- if (pen == NULL) {
- DeleteObject(clipregion);
- return false;
- }
- HGDIOBJ penbak = SelectObject(plot_hdc, (HGDIOBJ) pen);
- if (penbak == NULL) {
- DeleteObject(clipregion);
- DeleteObject(pen);
- return false;
- }
- HBRUSH brush = CreateSolidBrush(col);
- if (brush == NULL) {
- DeleteObject(clipregion);
- SelectObject(plot_hdc, penbak);
- DeleteObject(pen);
- return false;
- }
- HGDIOBJ brushbak = SelectObject(plot_hdc, (HGDIOBJ) brush);
- if (brushbak == NULL) {
- DeleteObject(clipregion);
- SelectObject(plot_hdc, penbak);
- DeleteObject(pen);
- DeleteObject(brush);
- return false;
- }
-/*
- RECT r;
- r.left = x - radius;
- r.top = y - radius;
- r.right = x + radius;
- r.bottom = y + radius;
-*/
- SelectClipRgn(plot_hdc, clipregion);
-
- if (style->fill_type == PLOT_OP_TYPE_NONE)
- Arc(plot_hdc, x - radius, y - radius, x + radius, y + radius,
- x - radius, y - radius,
- x - radius, y - radius);
- else
- Ellipse(plot_hdc, x - radius, y - radius, x + radius, y + radius);
-
- SelectClipRgn(plot_hdc, NULL);
- pen = SelectObject(plot_hdc, penbak);
- brush = SelectObject(plot_hdc, brushbak);
- DeleteObject(clipregion);
- DeleteObject(pen);
- DeleteObject(brush);
-
- return true;
-}
-
-static bool arc(int x, int y, int radius, int angle1, int angle2,
- const plot_style_t *style)
-{
- PLOT_LOG("arc centre %d,%d radius %d from %d to %d", x, y, radius,
- angle1, angle2);
-
- /* ensure the plot HDC is set */
- if (plot_hdc == NULL) {
- LOG("HDC not set on call to plotters");
- return false;
- }
-
- HRGN clipregion = CreateRectRgnIndirect(&plot_clip);
- if (clipregion == NULL) {
- return false;
- }
-
- COLORREF col = (DWORD)(style->stroke_colour & 0x00FFFFFF);
- HPEN pen = CreatePen(PS_GEOMETRIC | PS_SOLID, 1, col);
- if (pen == NULL) {
- DeleteObject(clipregion);
- return false;
- }
- HGDIOBJ penbak = SelectObject(plot_hdc, (HGDIOBJ) pen);
- if (penbak == NULL) {
- DeleteObject(clipregion);
- DeleteObject(pen);
- return false;
- }
-
- int q1, q2;
- double a1=1.0, a2=1.0, b1=1.0, b2=1.0;
- q1 = (int) ((angle1 + 45) / 90) - 45;
- q2 = (int) ((angle2 + 45) / 90) - 45;
- while (q1 > 4)
- q1 -= 4;
- while (q2 > 4)
- q2 -= 4;
- while (q1 <= 0)
- q1 += 4;
- while (q2 <= 0)
- q2 += 4;
- angle1 = ((angle1 + 45) % 90) - 45;
- angle2 = ((angle2 + 45) % 90) - 45;
+/** currently set clipping rectangle */
+static RECT plot_clip;
- switch(q1) {
- case 1:
- a1 = 1.0;
- b1 = -tan((M_PI / 180) * angle1);
- break;
- case 2:
- b1 = -1.0;
- a1 = -tan((M_PI / 180) * angle1);
- break;
- case 3:
- a1 = -1.0;
- b1 = tan((M_PI / 180) * angle1);
- break;
- case 4:
- b1 = 1.0;
- a1 = tan((M_PI / 180) * angle1);
- break;
- }
- switch(q2) {
- case 1:
- a2 = 1.0;
- b2 = -tan((M_PI / 180) * angle2);
- break;
- case 2:
- b2 = -1.0;
- a2 = -tan((M_PI / 180) * angle2);
- break;
- case 3:
- a2 = -1.0;
- b2 = tan((M_PI / 180) * angle2);
- break;
- case 4:
- b2 = 1.0;
- a2 = tan((M_PI / 180) * angle2);
- break;
- }
-
-/*
- RECT r;
- r.left = x - radius;
- r.top = y - radius;
- r.right = x + radius;
- r.bottom = y + radius;
-*/
- SelectClipRgn(plot_hdc, clipregion);
-
- Arc(plot_hdc, x - radius, y - radius, x + radius, y + radius,
- x + (int)(a1 * radius), y + (int)(b1 * radius),
- x + (int)(a2 * radius), y + (int)(b2 * radius));
-
- SelectClipRgn(plot_hdc, NULL);
- pen = SelectObject(plot_hdc, penbak);
- DeleteObject(clipregion);
- DeleteObject(pen);
-
- return true;
-}
-
-static bool
+/**
+ * bitmap helper to plot a solid block of colour
+ *
+ * \param col colour to plot with
+ * \param x the x coordinate to plot at
+ * \param y the y coordinate to plot at
+ * \param width the width of block to plot
+ * \param height the height to plot
+ * \return NSERROR_OK on sucess else error code.
+ */
+static nserror
plot_block(COLORREF col, int x, int y, int width, int height)
{
HRGN clipregion;
@@ -499,24 +69,24 @@ plot_block(COLORREF col, int x, int y, int width, int height)
(y >= plot_clip.bottom) ||
((y + height) < plot_clip.top)) {
/* Image completely outside clip region */
- return true;
- }
+ return NSERROR_OK;
+ }
/* ensure the plot HDC is set */
if (plot_hdc == NULL) {
- LOG("HDC not set on call to plotters");
- return false;
+ NSLOG(netsurf, INFO, "HDC not set on call to plotters");
+ return NSERROR_INVALID;
}
clipregion = CreateRectRgnIndirect(&plot_clip);
if (clipregion == NULL) {
- return false;
+ return NSERROR_INVALID;
}
SelectClipRgn(plot_hdc, clipregion);
/* Saving the original pen object */
- original = SelectObject(plot_hdc,GetStockObject(DC_PEN));
+ original = SelectObject(plot_hdc,GetStockObject(DC_PEN));
SelectObject(plot_hdc, GetStockObject(DC_PEN));
SelectObject(plot_hdc, GetStockObject(DC_BRUSH));
@@ -528,15 +98,28 @@ plot_block(COLORREF col, int x, int y, int width, int height)
DeleteObject(clipregion);
- return true;
+ return NSERROR_OK;
}
-/* blunt force truma way of achiving alpha blended plotting */
-static bool
-plot_alpha_bitmap(HDC hdc,
- struct bitmap *bitmap,
- int x, int y,
+
+/**
+ * plot an alpha blended bitmap
+ *
+ * blunt force truma way of achiving alpha blended plotting
+ *
+ * \param hdc drawing cotext
+ * \param bitmap bitmap to render
+ * \param x x coordinate to plot at
+ * \param y y coordinate to plot at
+ * \param width The width to plot the bitmap into
+ * \param height The height to plot the bitmap into
+ * \return NSERROR_OK on success else appropriate error code.
+ */
+static nserror
+plot_alpha_bitmap(HDC hdc,
+ struct bitmap *bitmap,
+ int x, int y,
int width, int height)
{
#ifdef WINDOWS_GDI_ALPHA_WORKED
@@ -545,15 +128,17 @@ plot_alpha_bitmap(HDC hdc,
bool bltres;
bmihdc = CreateCompatibleDC(hdc);
SelectObject(bmihdc, bitmap->windib);
- bltres = AlphaBlend(hdc,
- x, y,
+ bltres = AlphaBlend(hdc,
+ x, y,
width, height,
bmihdc,
- 0, 0,
+ 0, 0,
bitmap->width, bitmap->height,
blnd);
DeleteDC(bmihdc);
- return bltres;
+ if (!bltres) {
+ return NSERROR_INVALID;
+ }
#else
HDC Memhdc;
BITMAPINFOHEADER bmih;
@@ -564,21 +149,25 @@ plot_alpha_bitmap(HDC hdc,
BITMAPINFO *bmi;
HBITMAP MemBMh;
- PLOT_LOG("%p bitmap %d,%d width %d height %d", bitmap, x, y, width, height);
- PLOT_LOG("clipped %ld,%ld to %ld,%ld",plot_clip.left, plot_clip.top, plot_clip.right, plot_clip.bottom);
+ NSLOG(plot, DEEPDEBUG, "%p bitmap %d,%d width %d height %d",
+ bitmap, x, y, width, height);
+ NSLOG(plot, DEEPDEBUG, "clipped %ld,%ld to %ld,%ld",
+ plot_clip.left, plot_clip.top,
+ plot_clip.right, plot_clip.bottom);
Memhdc = CreateCompatibleDC(hdc);
if (Memhdc == NULL) {
- return false;
+ return NSERROR_INVALID;
}
- if ((bitmap->width != width) ||
+ if ((bitmap->width != width) ||
(bitmap->height != height)) {
- PLOT_LOG("scaling from %d,%d to %d,%d",
- bitmap->width, bitmap->height, width, height);
+ NSLOG(plot, DEEPDEBUG, "scaling from %d,%d to %d,%d",
+ bitmap->width, bitmap->height, width, height);
bitmap = bitmap_scale(bitmap, width, height);
- if (bitmap == NULL)
- return false;
+ if (bitmap == NULL) {
+ return NSERROR_INVALID;
+ }
isscaled = true;
}
@@ -586,14 +175,14 @@ plot_alpha_bitmap(HDC hdc,
(bitmap->width * bitmap->height * 4));
if (bmi == NULL) {
DeleteDC(Memhdc);
- return false;
+ return NSERROR_INVALID;
}
MemBMh = CreateCompatibleBitmap(hdc, bitmap->width, bitmap->height);
if (MemBMh == NULL){
free(bmi);
DeleteDC(Memhdc);
- return false;
+ return NSERROR_INVALID;
}
/* save 'background' data for alpha channel work */
@@ -655,7 +244,7 @@ plot_alpha_bitmap(HDC hdc,
}
}
SetDIBitsToDevice(hdc, x, y, bitmap->width, bitmap->height,
- 0, 0, 0, bitmap->height,
+ 0, 0, 0, bitmap->height,
(const void *) bmi->bmiColors,
bmi, DIB_RGB_COLORS);
@@ -667,16 +256,27 @@ plot_alpha_bitmap(HDC hdc,
free(bmi);
DeleteObject(MemBMh);
DeleteDC(Memhdc);
- return true;
#endif
+
+ return NSERROR_OK;
}
-static bool
+/**
+ * Internal bitmap plotting
+ *
+ * \param bitmap The bitmap to plot
+ * \param x x coordinate to plot at
+ * \param y y coordinate to plot at
+ * \param width The width to plot the bitmap into
+ * \param height The height to plot the bitmap into
+ * \return NSERROR_OK on success else appropriate error code.
+ */
+static nserror
plot_bitmap(struct bitmap *bitmap, int x, int y, int width, int height)
{
- int bltres;
HRGN clipregion;
+ nserror res = NSERROR_OK;
/* Bail early if we can */
if ((x >= plot_clip.right) ||
@@ -684,25 +284,26 @@ plot_bitmap(struct bitmap *bitmap, int x, int y, int width, int height)
(y >= plot_clip.bottom) ||
((y + height) < plot_clip.top)) {
/* Image completely outside clip region */
- return true;
- }
+ return NSERROR_OK;
+ }
/* ensure the plot HDC is set */
if (plot_hdc == NULL) {
- LOG("HDC not set on call to plotters");
- return false;
+ NSLOG(netsurf, INFO, "HDC not set on call to plotters");
+ return NSERROR_INVALID;
}
clipregion = CreateRectRgnIndirect(&plot_clip);
if (clipregion == NULL) {
- return false;
+ return NSERROR_INVALID;
}
SelectClipRgn(plot_hdc, clipregion);
if (bitmap->opaque) {
+ int bltres;
/* opaque bitmap */
- if ((bitmap->width == width) &&
+ if ((bitmap->width == width) &&
(bitmap->height == height)) {
/* unscaled */
bltres = SetDIBitsToDevice(plot_hdc,
@@ -717,36 +318,549 @@ plot_bitmap(struct bitmap *bitmap, int x, int y, int width, int height)
} else {
/* scaled */
SetStretchBltMode(plot_hdc, COLORONCOLOR);
- bltres = StretchDIBits(plot_hdc,
- x, y,
+ bltres = StretchDIBits(plot_hdc,
+ x, y,
width, height,
- 0, 0,
+ 0, 0,
bitmap->width, bitmap->height,
- bitmap->pixdata,
- (BITMAPINFO *)bitmap->pbmi,
- DIB_RGB_COLORS,
+ bitmap->pixdata,
+ (BITMAPINFO *)bitmap->pbmi,
+ DIB_RGB_COLORS,
SRCCOPY);
}
+ /* check to see if GDI operation failed */
+ if (bltres == 0) {
+ res = NSERROR_INVALID;
+ }
+ NSLOG(plot, DEEPDEBUG, "bltres = %d", bltres);
} else {
/* Bitmap with alpha.*/
- bltres = plot_alpha_bitmap(plot_hdc, bitmap, x, y, width, height);
+ res = plot_alpha_bitmap(plot_hdc, bitmap, x, y, width, height);
}
- PLOT_LOG("bltres = %d", bltres);
+ DeleteObject(clipregion);
+
+ return res;
+}
+
+/**
+ * \brief Sets a clip rectangle for subsequent plot operations.
+ *
+ * \param ctx The current redraw context.
+ * \param clip The rectangle to limit all subsequent plot
+ * operations within.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
+{
+ NSLOG(plot, DEEPDEBUG, "clip %d,%d to %d,%d", clip->x0, clip->y0, clip->x1, clip->y1);
+
+ plot_clip.left = clip->x0;
+ plot_clip.top = clip->y0;
+ plot_clip.right = clip->x1 + 1; /* co-ordinates are exclusive */
+ plot_clip.bottom = clip->y1 + 1; /* co-ordinates are exclusive */
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plots an arc
+ *
+ * plot an arc segment around (x,y), anticlockwise from angle1
+ * to angle2. Angles are measured anticlockwise from
+ * horizontal, in degrees.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the arc plot.
+ * \param x The x coordinate of the arc.
+ * \param y The y coordinate of the arc.
+ * \param radius The radius of the arc.
+ * \param angle1 The start angle of the arc.
+ * \param angle2 The finish angle of the arc.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+arc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y,
+ int radius, int angle1, int angle2)
+{
+ NSLOG(plot, DEEPDEBUG, "arc centre %d,%d radius %d from %d to %d", x, y, radius,
+ angle1, angle2);
+
+ /* ensure the plot HDC is set */
+ if (plot_hdc == NULL) {
+ NSLOG(netsurf, INFO, "HDC not set on call to plotters");
+ return NSERROR_INVALID;
+ }
+
+ HRGN clipregion = CreateRectRgnIndirect(&plot_clip);
+ if (clipregion == NULL) {
+ return NSERROR_INVALID;
+ }
+
+ COLORREF col = (DWORD)(style->stroke_colour & 0x00FFFFFF);
+ HPEN pen = CreatePen(PS_GEOMETRIC | PS_SOLID, 1, col);
+ if (pen == NULL) {
+ DeleteObject(clipregion);
+ return NSERROR_INVALID;
+ }
+ HGDIOBJ penbak = SelectObject(plot_hdc, (HGDIOBJ) pen);
+ if (penbak == NULL) {
+ DeleteObject(clipregion);
+ DeleteObject(pen);
+ return NSERROR_INVALID;
+ }
+
+ int q1, q2;
+ double a1=1.0, a2=1.0, b1=1.0, b2=1.0;
+ q1 = (int) ((angle1 + 45) / 90) - 45;
+ q2 = (int) ((angle2 + 45) / 90) - 45;
+ while (q1 > 4)
+ q1 -= 4;
+ while (q2 > 4)
+ q2 -= 4;
+ while (q1 <= 0)
+ q1 += 4;
+ while (q2 <= 0)
+ q2 += 4;
+ angle1 = ((angle1 + 45) % 90) - 45;
+ angle2 = ((angle2 + 45) % 90) - 45;
+
+ switch(q1) {
+ case 1:
+ a1 = 1.0;
+ b1 = -tan((M_PI / 180) * angle1);
+ break;
+ case 2:
+ b1 = -1.0;
+ a1 = -tan((M_PI / 180) * angle1);
+ break;
+ case 3:
+ a1 = -1.0;
+ b1 = tan((M_PI / 180) * angle1);
+ break;
+ case 4:
+ b1 = 1.0;
+ a1 = tan((M_PI / 180) * angle1);
+ break;
+ }
+
+ switch(q2) {
+ case 1:
+ a2 = 1.0;
+ b2 = -tan((M_PI / 180) * angle2);
+ break;
+ case 2:
+ b2 = -1.0;
+ a2 = -tan((M_PI / 180) * angle2);
+ break;
+ case 3:
+ a2 = -1.0;
+ b2 = tan((M_PI / 180) * angle2);
+ break;
+ case 4:
+ b2 = 1.0;
+ a2 = tan((M_PI / 180) * angle2);
+ break;
+ }
+
+ SelectClipRgn(plot_hdc, clipregion);
+
+ Arc(plot_hdc, x - radius, y - radius, x + radius, y + radius,
+ x + (int)(a1 * radius), y + (int)(b1 * radius),
+ x + (int)(a2 * radius), y + (int)(b2 * radius));
+
+ SelectClipRgn(plot_hdc, NULL);
+ pen = SelectObject(plot_hdc, penbak);
DeleteObject(clipregion);
+ DeleteObject(pen);
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plots a circle
+ *
+ * Plot a circle centered on (x,y), which is optionally filled.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the circle plot.
+ * \param x x coordinate of circle centre.
+ * \param y y coordinate of circle centre.
+ * \param radius circle radius.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+disc(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ int x, int y, int radius)
+{
+ NSLOG(plot, DEEPDEBUG, "disc at %d,%d radius %d", x, y, radius);
+
+ /* ensure the plot HDC is set */
+ if (plot_hdc == NULL) {
+ NSLOG(netsurf, INFO, "HDC not set on call to plotters");
+ return NSERROR_INVALID;
+ }
+
+ HRGN clipregion = CreateRectRgnIndirect(&plot_clip);
+ if (clipregion == NULL) {
+ return NSERROR_INVALID;
+ }
+
+ COLORREF col = (DWORD)((style->fill_colour | style->stroke_colour)
+ & 0x00FFFFFF);
+ HPEN pen = CreatePen(PS_GEOMETRIC | PS_SOLID, 1, col);
+ if (pen == NULL) {
+ DeleteObject(clipregion);
+ return NSERROR_INVALID;
+ }
+ HGDIOBJ penbak = SelectObject(plot_hdc, (HGDIOBJ) pen);
+ if (penbak == NULL) {
+ DeleteObject(clipregion);
+ DeleteObject(pen);
+ return NSERROR_INVALID;
+ }
+ HBRUSH brush = CreateSolidBrush(col);
+ if (brush == NULL) {
+ DeleteObject(clipregion);
+ SelectObject(plot_hdc, penbak);
+ DeleteObject(pen);
+ return NSERROR_INVALID;
+ }
+ HGDIOBJ brushbak = SelectObject(plot_hdc, (HGDIOBJ) brush);
+ if (brushbak == NULL) {
+ DeleteObject(clipregion);
+ SelectObject(plot_hdc, penbak);
+ DeleteObject(pen);
+ DeleteObject(brush);
+ return NSERROR_INVALID;
+ }
- return true;
+ SelectClipRgn(plot_hdc, clipregion);
+ if (style->fill_type == PLOT_OP_TYPE_NONE) {
+ Arc(plot_hdc, x - radius, y - radius, x + radius, y + radius,
+ x - radius, y - radius,
+ x - radius, y - radius);
+ } else {
+ Ellipse(plot_hdc, x - radius, y - radius, x + radius, y + radius);
+ }
+
+ SelectClipRgn(plot_hdc, NULL);
+ pen = SelectObject(plot_hdc, penbak);
+ brush = SelectObject(plot_hdc, brushbak);
+ DeleteObject(clipregion);
+ DeleteObject(pen);
+ DeleteObject(brush);
+
+ return NSERROR_OK;
}
-static bool
-windows_plot_bitmap(int x, int y,
- int width, int height,
- struct bitmap *bitmap, colour bg,
- bitmap_flags_t flags)
+
+/**
+ * Plots a line
+ *
+ * plot a line from (x0,y0) to (x1,y1). Coordinates are at
+ * centre of line width/thickness.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the line plot.
+ * \param line A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+line(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *line)
+{
+ NSLOG(plot, DEEPDEBUG, "from %d,%d to %d,%d",
+ line->x0, line->y0, line->x1, line->y1);
+
+ /* ensure the plot HDC is set */
+ if (plot_hdc == NULL) {
+ NSLOG(netsurf, INFO, "HDC not set on call to plotters");
+ return NSERROR_INVALID;
+ }
+
+ HRGN clipregion = CreateRectRgnIndirect(&plot_clip);
+ if (clipregion == NULL) {
+ return NSERROR_INVALID;
+ }
+
+ COLORREF col = (DWORD)(style->stroke_colour & 0x00FFFFFF);
+ /* windows 0x00bbggrr */
+ DWORD penstyle = PS_GEOMETRIC |
+ ((style->stroke_type == PLOT_OP_TYPE_DOT) ? PS_DOT :
+ (style->stroke_type == PLOT_OP_TYPE_DASH) ? PS_DASH:
+ 0);
+ LOGBRUSH lb = {BS_SOLID, col, 0};
+ HPEN pen = ExtCreatePen(penstyle,
+ plot_style_fixed_to_int(style->stroke_width),
+ &lb, 0, NULL);
+ if (pen == NULL) {
+ DeleteObject(clipregion);
+ return NSERROR_INVALID;
+ }
+ HGDIOBJ bak = SelectObject(plot_hdc, (HGDIOBJ) pen);
+ if (bak == NULL) {
+ DeleteObject(pen);
+ DeleteObject(clipregion);
+ return NSERROR_INVALID;
+ }
+
+ SelectClipRgn(plot_hdc, clipregion);
+
+ MoveToEx(plot_hdc, line->x0, line->y0, (LPPOINT) NULL);
+
+ LineTo(plot_hdc, line->x1, line->y1);
+
+ SelectClipRgn(plot_hdc, NULL);
+ pen = SelectObject(plot_hdc, bak);
+
+ DeleteObject(pen);
+ DeleteObject(clipregion);
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plots a rectangle.
+ *
+ * The rectangle can be filled an outline or both controlled
+ * by the plot style The line can be solid, dotted or
+ * dashed. Top left corner at (x0,y0) and rectangle has given
+ * width and height.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the rectangle plot.
+ * \param rect A rectangle defining the line to be drawn
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+rectangle(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const struct rect *rect)
+{
+ NSLOG(plot, DEEPDEBUG, "rectangle from %d,%d to %d,%d",
+ rect->x0, rect->y0, rect->x1, rect->y1);
+
+ /* ensure the plot HDC is set */
+ if (plot_hdc == NULL) {
+ NSLOG(netsurf, INFO, "HDC not set on call to plotters");
+ return NSERROR_INVALID;
+ }
+
+ HRGN clipregion = CreateRectRgnIndirect(&plot_clip);
+ if (clipregion == NULL) {
+ return NSERROR_INVALID;
+ }
+
+ COLORREF pencol = (DWORD)(style->stroke_colour & 0x00FFFFFF);
+ DWORD penstyle = PS_GEOMETRIC |
+ (style->stroke_type == PLOT_OP_TYPE_DOT ? PS_DOT :
+ (style->stroke_type == PLOT_OP_TYPE_DASH ? PS_DASH :
+ (style->stroke_type == PLOT_OP_TYPE_NONE ? PS_NULL :
+ 0)));
+ LOGBRUSH lb = {BS_SOLID, pencol, 0};
+ LOGBRUSH lb1 = {BS_SOLID, style->fill_colour, 0};
+ if (style->fill_type == PLOT_OP_TYPE_NONE)
+ lb1.lbStyle = BS_HOLLOW;
+
+ HPEN pen = ExtCreatePen(penstyle,
+ plot_style_fixed_to_int(style->stroke_width),
+ &lb, 0, NULL);
+ if (pen == NULL) {
+ return NSERROR_INVALID;
+ }
+ HGDIOBJ penbak = SelectObject(plot_hdc, (HGDIOBJ) pen);
+ if (penbak == NULL) {
+ DeleteObject(pen);
+ return NSERROR_INVALID;
+ }
+ HBRUSH brush = CreateBrushIndirect(&lb1);
+ if (brush == NULL) {
+ SelectObject(plot_hdc, penbak);
+ DeleteObject(pen);
+ return NSERROR_INVALID;
+ }
+ HGDIOBJ brushbak = SelectObject(plot_hdc, (HGDIOBJ) brush);
+ if (brushbak == NULL) {
+ SelectObject(plot_hdc, penbak);
+ DeleteObject(pen);
+ DeleteObject(brush);
+ return NSERROR_INVALID;
+ }
+
+ SelectClipRgn(plot_hdc, clipregion);
+
+ /* windows GDI call coordinates are inclusive */
+ Rectangle(plot_hdc, rect->x0, rect->y0, rect->x1 + 1, rect->y1 + 1);
+
+ pen = SelectObject(plot_hdc, penbak);
+ brush = SelectObject(plot_hdc, brushbak);
+ SelectClipRgn(plot_hdc, NULL);
+ DeleteObject(pen);
+ DeleteObject(brush);
+ DeleteObject(clipregion);
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plot a polygon
+ *
+ * Plots a filled polygon with straight lines between
+ * points. The lines around the edge of the ploygon are not
+ * plotted. The polygon is filled with the non-zero winding
+ * rule.
+ *
+ * \param ctx The current redraw context.
+ * \param style Style controlling the polygon plot.
+ * \param p verticies of polygon
+ * \param n number of verticies.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+polygon(const struct redraw_context *ctx,
+ const plot_style_t *style,
+ const int *p,
+ unsigned int n)
+{
+ NSLOG(plot, DEEPDEBUG, "polygon %d points", n);
+
+ /* ensure the plot HDC is set */
+ if (plot_hdc == NULL) {
+ NSLOG(netsurf, INFO, "HDC not set on call to plotters");
+ return NSERROR_INVALID;
+ }
+
+ POINT points[n];
+ unsigned int i;
+ HRGN clipregion = CreateRectRgnIndirect(&plot_clip);
+ if (clipregion == NULL) {
+ return NSERROR_INVALID;
+ }
+
+ COLORREF pencol = (DWORD)(style->fill_colour & 0x00FFFFFF);
+ COLORREF brushcol = (DWORD)(style->fill_colour & 0x00FFFFFF);
+ HPEN pen = CreatePen(PS_GEOMETRIC | PS_NULL, 1, pencol);
+ if (pen == NULL) {
+ DeleteObject(clipregion);
+ return NSERROR_INVALID;
+ }
+ HPEN penbak = SelectObject(plot_hdc, pen);
+ if (penbak == NULL) {
+ DeleteObject(clipregion);
+ DeleteObject(pen);
+ return NSERROR_INVALID;
+ }
+ HBRUSH brush = CreateSolidBrush(brushcol);
+ if (brush == NULL) {
+ DeleteObject(clipregion);
+ SelectObject(plot_hdc, penbak);
+ DeleteObject(pen);
+ return NSERROR_INVALID;
+ }
+ HBRUSH brushbak = SelectObject(plot_hdc, brush);
+ if (brushbak == NULL) {
+ DeleteObject(clipregion);
+ SelectObject(plot_hdc, penbak);
+ DeleteObject(pen);
+ DeleteObject(brush);
+ return NSERROR_INVALID;
+ }
+ SetPolyFillMode(plot_hdc, WINDING);
+ for (i = 0; i < n; i++) {
+ points[i].x = (long) p[2 * i];
+ points[i].y = (long) p[2 * i + 1];
+
+ NSLOG(plot, DEEPDEBUG, "%ld,%ld ", points[i].x, points[i].y);
+ }
+
+ SelectClipRgn(plot_hdc, clipregion);
+
+ if (n >= 2) {
+ Polygon(plot_hdc, points, n);
+ }
+
+ SelectClipRgn(plot_hdc, NULL);
+
+ pen = SelectObject(plot_hdc, penbak);
+ brush = SelectObject(plot_hdc, brushbak);
+ DeleteObject(clipregion);
+ DeleteObject(pen);
+ DeleteObject(brush);
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plots a path.
+ *
+ * Path plot consisting of cubic Bezier curves. Line and fill colour is
+ * controlled by the plot style.
+ *
+ * \param ctx The current redraw context.
+ * \param pstyle Style controlling the path plot.
+ * \param p elements of path
+ * \param n nunber of elements on path
+ * \param transform A transform to apply to the path.
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+path(const struct redraw_context *ctx,
+ const plot_style_t *pstyle,
+ const float *p,
+ unsigned int n,
+ const float transform[6])
+{
+ NSLOG(plot, DEEPDEBUG, "path unimplemented");
+ return NSERROR_OK;
+}
+
+
+/**
+ * Plot a bitmap
+ *
+ * Tiled plot of a bitmap image. (x,y) gives the top left
+ * coordinate of an explicitly placed tile. From this tile the
+ * image can repeat in all four directions -- up, down, left
+ * and right -- to the extents given by the current clip
+ * rectangle.
+ *
+ * The bitmap_flags say whether to tile in the x and y
+ * directions. If not tiling in x or y directions, the single
+ * image is plotted. The width and height give the dimensions
+ * the image is to be scaled to.
+ *
+ * \param ctx The current redraw context.
+ * \param bitmap The bitmap to plot
+ * \param x The x coordinate to plot the bitmap
+ * \param y The y coordiante to plot the bitmap
+ * \param width The width of area to plot the bitmap into
+ * \param height The height of area to plot the bitmap into
+ * \param bg the background colour to alpha blend into
+ * \param flags the flags controlling the type of plot operation
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+bitmap(const struct redraw_context *ctx,
+ struct bitmap *bitmap,
+ int x, int y,
+ int width,
+ int height,
+ colour bg,
+ bitmap_flags_t flags)
{
int xf,yf;
bool repeat_x = (flags & BITMAPF_REPEAT_X);
@@ -754,16 +868,16 @@ windows_plot_bitmap(int x, int y,
/* Bail early if we can */
- PLOT_LOG("Plotting %p at %d,%d by %d,%d",bitmap, x,y,width,height);
+ NSLOG(plot, DEEPDEBUG, "Plotting %p at %d,%d by %d,%d",bitmap, x,y,width,height);
if (bitmap == NULL) {
- LOG("Passed null bitmap!");
- return true;
+ NSLOG(netsurf, INFO, "Passed null bitmap!");
+ return NSERROR_OK;
}
/* check if nothing to plot */
if (width == 0 || height == 0)
- return true;
+ return NSERROR_OK;
/* x and y define coordinate of top left of of the initial explicitly
* placed tile. The width and height are the image scaling and the
@@ -775,9 +889,13 @@ windows_plot_bitmap(int x, int y,
/* Not repeating at all, so just plot it */
if ((bitmap->width == 1) && (bitmap->height == 1)) {
if ((*(bitmap->pixdata + 3) & 0xff) == 0) {
- return true;
+ return NSERROR_OK;
}
- return plot_block((*(COLORREF *)bitmap->pixdata) & 0xffffff, x, y, x + width, y + height);
+ return plot_block((*(COLORREF *)bitmap->pixdata) & 0xffffff,
+ x,
+ y,
+ x + width,
+ y + height);
} else {
return plot_bitmap(bitmap, x, y, width, height);
@@ -788,41 +906,47 @@ windows_plot_bitmap(int x, int y,
* of the area. Can only be done when image is fully opaque. */
if ((bitmap->width == 1) && (bitmap->height == 1)) {
if ((*(COLORREF *)bitmap->pixdata & 0xff000000) != 0) {
- return plot_block((*(COLORREF *)bitmap->pixdata) & 0xffffff,
- plot_clip.left,
- plot_clip.top,
- plot_clip.right,
+ return plot_block((*(COLORREF *)bitmap->pixdata) & 0xffffff,
+ plot_clip.left,
+ plot_clip.top,
+ plot_clip.right,
plot_clip.bottom);
}
}
/* Optimise tiled plots of bitmaps scaled to 1x1 by replacing with
* a flat fill of the area. Can only be done when image is fully
- * opaque. */
+ * opaque.
+ */
if ((width == 1) && (height == 1)) {
if (bitmap->opaque) {
/** TODO: Currently using top left pixel. Maybe centre
* pixel or average value would be better. */
- return plot_block((*(COLORREF *)bitmap->pixdata) & 0xffffff,
- plot_clip.left,
- plot_clip.top,
- plot_clip.right,
+ return plot_block((*(COLORREF *)bitmap->pixdata) & 0xffffff,
+ plot_clip.left,
+ plot_clip.top,
+ plot_clip.right,
plot_clip.bottom);
}
}
- PLOT_LOG("Tiled plotting %d,%d by %d,%d",x,y,width,height);
- PLOT_LOG("clipped %ld,%ld to %ld,%ld",plot_clip.left, plot_clip.top, plot_clip.right, plot_clip.bottom);
+ NSLOG(plot, DEEPDEBUG, "Tiled plotting %d,%d by %d,%d", x, y, width, height);
+ NSLOG(plot, DEEPDEBUG, "clipped %ld,%ld to %ld,%ld",
+ plot_clip.left, plot_clip.top,
+ plot_clip.right, plot_clip.bottom);
/* get left most tile position */
- if (repeat_x)
+ if (repeat_x) {
for (; x > plot_clip.left; x -= width);
+ }
/* get top most tile position */
- if (repeat_y)
+ if (repeat_y) {
for (; y > plot_clip.top; y -= height);
+ }
- PLOT_LOG("repeat from %d,%d to %ld,%ld", x, y, plot_clip.right, plot_clip.bottom);
+ NSLOG(plot, DEEPDEBUG, "repeat from %d,%d to %ld,%ld",
+ x, y, plot_clip.right, plot_clip.bottom);
/* tile down and across to extents */
for (xf = x; xf < plot_clip.right; xf += width) {
@@ -833,25 +957,86 @@ windows_plot_bitmap(int x, int y,
break;
}
if (!repeat_x)
- break;
+ break;
}
- return true;
+ return NSERROR_OK;
}
-static bool flush(void)
+/**
+ * Text plotting.
+ *
+ * \param ctx The current redraw context.
+ * \param fstyle plot style for this text
+ * \param x x coordinate
+ * \param y y coordinate
+ * \param text UTF-8 string to plot
+ * \param length length of string, in bytes
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+text(const struct redraw_context *ctx,
+ const struct plot_font_style *fstyle,
+ int x,
+ int y,
+ const char *text,
+ size_t length)
{
- PLOT_LOG("flush unimplemented");
- return true;
-}
+ NSLOG(plot, DEEPDEBUG, "words %s at %d,%d", text, x, y);
-static bool path(const float *p, unsigned int n, colour fill, float width,
- colour c, const float transform[6])
-{
- PLOT_LOG("path unimplemented");
- return true;
+ /* ensure the plot HDC is set */
+ if (plot_hdc == NULL) {
+ NSLOG(netsurf, INFO, "HDC not set on call to plotters");
+ return NSERROR_INVALID;
+ }
+
+ HRGN clipregion = CreateRectRgnIndirect(&plot_clip);
+ if (clipregion == NULL) {
+ return NSERROR_INVALID;
+ }
+
+ HFONT fontbak, font = get_font(fstyle);
+ if (font == NULL) {
+ DeleteObject(clipregion);
+ return NSERROR_INVALID;
+ }
+ int wlen;
+ SIZE s;
+ LPWSTR wstring;
+ fontbak = (HFONT) SelectObject(plot_hdc, font);
+ GetTextExtentPoint(plot_hdc, text, length, &s);
+
+ SelectClipRgn(plot_hdc, clipregion);
+
+ SetTextAlign(plot_hdc, TA_BASELINE | TA_LEFT);
+ if ((fstyle->background & 0xFF000000) != 0x01000000) {
+ /* 100% alpha */
+ SetBkColor(plot_hdc, (DWORD) (fstyle->background & 0x00FFFFFF));
+ }
+ SetBkMode(plot_hdc, TRANSPARENT);
+ SetTextColor(plot_hdc, (DWORD) (fstyle->foreground & 0x00FFFFFF));
+
+ wlen = MultiByteToWideChar(CP_UTF8, 0, text, length, NULL, 0);
+ wstring = malloc(2 * (wlen + 1));
+ if (wstring == NULL) {
+ return NSERROR_INVALID;
+ }
+ MultiByteToWideChar(CP_UTF8, 0, text, length, wstring, wlen);
+ TextOutW(plot_hdc, x, y, wstring, wlen);
+
+ SelectClipRgn(plot_hdc, NULL);
+ free(wstring);
+ font = SelectObject(plot_hdc, fontbak);
+ DeleteObject(clipregion);
+ DeleteObject(font);
+
+ return NSERROR_OK;
}
+
+/**
+ * win32 API plot operation table
+ */
const struct plotter_table win_plotters = {
.rectangle = rectangle,
.line = line,
@@ -860,8 +1045,7 @@ const struct plotter_table win_plotters = {
.text = text,
.disc = disc,
.arc = arc,
- .bitmap = windows_plot_bitmap,
- .flush = flush,
+ .bitmap = bitmap,
.path = path,
.option_knockout = true,
};
diff --git a/frontends/windows/prefs.c b/frontends/windows/prefs.c
index 03414ee9f..591b57426 100644
--- a/frontends/windows/prefs.c
+++ b/frontends/windows/prefs.c
@@ -16,6 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * \file
+ * win32 preferences dialog implementation.
+ */
+
#include "utils/config.h"
#include <windows.h>
@@ -31,9 +36,19 @@
#include "windows/resourceid.h"
#include "windows/windbg.h"
+/** Preferences dialog width */
#define NSWS_PREFS_WINDOW_WIDTH 600
+/** Preferences dialog height */
#define NSWS_PREFS_WINDOW_HEIGHT 400
+
+/**
+ * Prepare preferences dialog font tab
+ *
+ * \param fontfamily The font family
+ * \param parent The parent window win32 handle
+ * \return The selected font or NULL on error
+ */
static CHOOSEFONT *nsws_prefs_font_prepare(int fontfamily, HWND parent)
{
CHOOSEFONT *cf = malloc(sizeof(CHOOSEFONT));
@@ -81,6 +96,15 @@ static CHOOSEFONT *nsws_prefs_font_prepare(int fontfamily, HWND parent)
return cf;
}
+
+/**
+ * Update value in spinner control when it is changed
+ *
+ * \param sub The window handle of the spinner control
+ * \param change The amount the control changed by
+ * \param minval The minimum allowed value of the control
+ * \param maxval The maximum allowed value of the control
+ */
static void change_spinner(HWND sub, double change, double minval, double maxval)
{
char *temp, number[6];
@@ -90,8 +114,9 @@ static void change_spinner(HWND sub, double change, double minval, double maxval
len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
temp = malloc(len + 1);
- if (temp == NULL)
+ if (temp == NULL) {
return;
+ }
SendMessage(sub, WM_GETTEXT, (WPARAM)(len + 1), (LPARAM) temp);
@@ -101,17 +126,29 @@ static void change_spinner(HWND sub, double change, double minval, double maxval
value = max(value, minval);
value = min(value, maxval);
- if ((change == 1.0) || (change == -1.0))
+ if ((change == 1.0) || (change == -1.0)) {
snprintf(number, 6, "%.0f", value);
- else
+ } else {
snprintf(number, 6, "%.1f", value);
+ }
SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
}
+/**
+ * Handle messages to the appearance preference dialog
+ *
+ * \param hwnd The win32 handle of the appearance dialog
+ * \param msg The message code
+ * \param wparam The message w parameter
+ * \param lParam The message l parameter
+ * \return result appropriate for message
+ */
static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd,
- UINT msg, WPARAM wparam, LPARAM lParam)
+ UINT msg,
+ WPARAM wparam,
+ LPARAM lParam)
{
int len;
char *temp, number[6];
@@ -192,7 +229,7 @@ static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd,
/* animation */
sub = GetDlgItem(hwnd, IDC_PREFS_NOANIMATION);
SendMessage(sub, BM_SETCHECK, (WPARAM)((nsoption_bool(animate_images))
- ? BST_UNCHECKED : BST_CHECKED), 0);
+ ? BST_UNCHECKED : BST_CHECKED), 0);
if (nsoption_int(minimum_gif_delay) != 0) {
sub = GetDlgItem(hwnd, IDC_PREFS_ANIMATIONDELAY);
@@ -222,13 +259,13 @@ static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd,
if (temp != NULL) {
SendMessage(sub, WM_GETTEXT, (WPARAM)
(len + 1), (LPARAM) temp);
- nsoption_set_int(font_min_size,
+ nsoption_set_int(font_min_size,
(int)(10 * strtod(temp, NULL)));
free(temp);
}
/* animation */
- nsoption_set_bool(animate_images,
+ nsoption_set_bool(animate_images,
(IsDlgButtonChecked(hwnd, IDC_PREFS_NOANIMATION) == BST_CHECKED) ? true : false);
@@ -259,7 +296,7 @@ static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd,
case IDC_PREFS_ANIMATIONDELAY_SPIN:
change_spinner(GetDlgItem(hwnd, IDC_PREFS_ANIMATIONDELAY), 0.1 * ud->iDelta, 0.1, 100.0);
return TRUE;
-
+
}
}
break;
@@ -267,7 +304,8 @@ static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd,
case WM_COMMAND:
- LOG("WM_COMMAND Identifier 0x%x",LOWORD(wparam));
+ NSLOG(netsurf, INFO, "WM_COMMAND Identifier 0x%x",
+ LOWORD(wparam));
switch(LOWORD(wparam)) {
case IDC_PREFS_PROXYTYPE:
@@ -276,8 +314,8 @@ static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd,
SendMessage(sub, CB_GETCURSEL, 0, 0) - 1);
nsoption_set_bool(http_proxy,
(nsoption_int(http_proxy_auth) != -1));
- nsoption_set_int(http_proxy_auth,
- nsoption_int(http_proxy_auth) +
+ nsoption_set_int(http_proxy_auth,
+ nsoption_int(http_proxy_auth) +
(nsoption_bool(http_proxy)) ? 0 : 1);
break;
@@ -288,7 +326,7 @@ static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd,
}
if (ChooseFont(cf) == TRUE) {
- nsoption_set_charp(font_sans,
+ nsoption_set_charp(font_sans,
strdup(cf->lpLogFont->lfFaceName));
}
@@ -390,12 +428,12 @@ static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd,
break;
}
- case IDC_PREFS_FONTDEF:
+ case IDC_PREFS_FONTDEF:
sub = GetDlgItem(hwnd, IDC_PREFS_FONTDEF);
nsoption_set_int(font_default,
SendMessage(sub, CB_GETCURSEL, 0, 0) + 1);
break;
-
+
}
break;
@@ -403,8 +441,20 @@ static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd,
return FALSE;
}
+
+/**
+ * Handle messages to the connections preference dialog
+ *
+ * \param hwnd The win32 handle of the connections dialog
+ * \param msg The message code
+ * \param wparam The message w parameter
+ * \param lParam The message l parameter
+ * \return result appropriate for message
+ */
static BOOL CALLBACK options_connections_dialog_handler(HWND hwnd,
- UINT msg, WPARAM wparam, LPARAM lParam)
+ UINT msg,
+ WPARAM wparam,
+ LPARAM lParam)
{
int len;
char *temp, number[6];
@@ -562,8 +612,20 @@ static BOOL CALLBACK options_connections_dialog_handler(HWND hwnd,
return FALSE;
}
+
+/**
+ * Handle messages to the general preference dialog
+ *
+ * \param hwnd The win32 handle of the general dialog
+ * \param msg The message code
+ * \param wparam The message w parameter
+ * \param lParam The message l parameter
+ * \return result appropriate for message
+ */
static BOOL CALLBACK options_general_dialog_handler(HWND hwnd,
- UINT msg, WPARAM wparam, LPARAM lParam)
+ UINT msg,
+ WPARAM wparam,
+ LPARAM lParam)
{
HWND sub;
@@ -577,21 +639,21 @@ static BOOL CALLBACK options_general_dialog_handler(HWND hwnd,
/* Display images */
sub = GetDlgItem(hwnd, IDC_PREFS_IMAGES);
- SendMessage(sub, BM_SETCHECK,
- (WPARAM) ((nsoption_bool(suppress_images)) ?
- BST_CHECKED : BST_UNCHECKED), 0);
+ SendMessage(sub, BM_SETCHECK,
+ (WPARAM) ((nsoption_bool(suppress_images)) ?
+ BST_CHECKED : BST_UNCHECKED), 0);
/* advert blocking */
sub = GetDlgItem(hwnd, IDC_PREFS_ADVERTS);
- SendMessage(sub, BM_SETCHECK,
- (WPARAM) ((nsoption_bool(block_advertisements)) ?
- BST_CHECKED : BST_UNCHECKED), 0);
+ SendMessage(sub, BM_SETCHECK,
+ (WPARAM) ((nsoption_bool(block_advertisements)) ?
+ BST_CHECKED : BST_UNCHECKED), 0);
/* Referrer sending */
sub = GetDlgItem(hwnd, IDC_PREFS_REFERER);
- SendMessage(sub, BM_SETCHECK,
+ SendMessage(sub, BM_SETCHECK,
(WPARAM)((nsoption_bool(send_referer)) ?
- BST_CHECKED : BST_UNCHECKED), 0);
+ BST_CHECKED : BST_UNCHECKED), 0);
break;
case WM_NOTIFY:
@@ -602,8 +664,8 @@ static BOOL CALLBACK options_general_dialog_handler(HWND hwnd,
if (sub != NULL) {
int text_length;
char *text;
- text_length = SendMessage(sub,
- WM_GETTEXTLENGTH, 0, 0);
+ text_length = SendMessage(sub,
+ WM_GETTEXTLENGTH, 0, 0);
text = malloc(text_length + 1);
if (text != NULL) {
SendMessage(sub, WM_GETTEXT,
@@ -616,19 +678,20 @@ static BOOL CALLBACK options_general_dialog_handler(HWND hwnd,
nsoption_set_bool(suppress_images,
(IsDlgButtonChecked(hwnd, IDC_PREFS_IMAGES) == BST_CHECKED) ? true : false);
- nsoption_set_bool(block_advertisements, (IsDlgButtonChecked(hwnd,
- IDC_PREFS_ADVERTS) == BST_CHECKED) ? true : false);
+ nsoption_set_bool(block_advertisements,
+ (IsDlgButtonChecked(hwnd, IDC_PREFS_ADVERTS) == BST_CHECKED) ? true : false);
- nsoption_set_bool(send_referer, (IsDlgButtonChecked(hwnd,
- IDC_PREFS_REFERER) == BST_CHECKED) ? true : false);
+ nsoption_set_bool(send_referer,
+ (IsDlgButtonChecked(hwnd, IDC_PREFS_REFERER) == BST_CHECKED) ? true : false);
break;
-
+
}
}
return FALSE;
}
+
/* exported interface documented in windows/prefs.h */
nserror nsws_prefs_save(void)
{
@@ -644,6 +707,7 @@ nserror nsws_prefs_save(void)
return res;
}
+
/* exported interface documented in windows/prefs.h */
void nsws_prefs_dialog_init(HINSTANCE hinst, HWND parent)
{
diff --git a/frontends/windows/res/adblock.css b/frontends/windows/res/adblock.css
index ff2485622..0d12aaa7c 120000
--- a/frontends/windows/res/adblock.css
+++ b/frontends/windows/res/adblock.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/AdBlock,f79 \ No newline at end of file
+../../../resources/adblock.css \ No newline at end of file
diff --git a/frontends/windows/res/ca-bundle.crt b/frontends/windows/res/ca-bundle.crt
index 0b0e416ad..1187fa51a 120000
--- a/frontends/windows/res/ca-bundle.crt
+++ b/frontends/windows/res/ca-bundle.crt
@@ -1 +1 @@
-../../../!NetSurf/Resources/ca-bundle \ No newline at end of file
+../../../resources/ca-bundle \ No newline at end of file
diff --git a/frontends/windows/res/credits.html b/frontends/windows/res/credits.html
index 1ba17392b..b43a1a06c 120000
--- a/frontends/windows/res/credits.html
+++ b/frontends/windows/res/credits.html
@@ -1 +1 @@
-../../../!NetSurf/Resources/en/credits.html,faf \ No newline at end of file
+../../../resources/en/credits.html \ No newline at end of file
diff --git a/frontends/windows/res/default.css b/frontends/windows/res/default.css
index a8579eb7c..fa3ae6c26 120000
--- a/frontends/windows/res/default.css
+++ b/frontends/windows/res/default.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/CSS,f79 \ No newline at end of file
+../../../resources/default.css \ No newline at end of file
diff --git a/frontends/windows/res/internal.css b/frontends/windows/res/internal.css
index 17f9f1504..5583a9811 120000
--- a/frontends/windows/res/internal.css
+++ b/frontends/windows/res/internal.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/internal.css,f79 \ No newline at end of file
+../../../resources/internal.css \ No newline at end of file
diff --git a/frontends/windows/res/licence.html b/frontends/windows/res/licence.html
index 147dd6db2..c0c1e6630 120000
--- a/frontends/windows/res/licence.html
+++ b/frontends/windows/res/licence.html
@@ -1 +1 @@
-../../../!NetSurf/Resources/en/licence.html,faf \ No newline at end of file
+../../../resources/en/licence.html \ No newline at end of file
diff --git a/frontends/windows/res/netsurf.png b/frontends/windows/res/netsurf.png
index 905512c25..d0ab72a5e 120000
--- a/frontends/windows/res/netsurf.png
+++ b/frontends/windows/res/netsurf.png
@@ -1 +1 @@
-../../../!NetSurf/Resources/netsurf.png,b60 \ No newline at end of file
+../../../resources/netsurf.png \ No newline at end of file
diff --git a/frontends/windows/res/quirks.css b/frontends/windows/res/quirks.css
index 88aabe48c..1e752cb9e 120000
--- a/frontends/windows/res/quirks.css
+++ b/frontends/windows/res/quirks.css
@@ -1 +1 @@
-../../../!NetSurf/Resources/Quirks,f79 \ No newline at end of file
+../../../resources/quirks.css \ No newline at end of file
diff --git a/frontends/windows/res/welcome.html b/frontends/windows/res/welcome.html
index 28362130a..d5220f90a 120000
--- a/frontends/windows/res/welcome.html
+++ b/frontends/windows/res/welcome.html
@@ -1 +1 @@
-../../../!NetSurf/Resources/en/welcome.html,faf \ No newline at end of file
+../../../resources/en/welcome.html \ No newline at end of file
diff --git a/frontends/windows/schedule.c b/frontends/windows/schedule.c
index eae6c1d63..76358ec68 100644
--- a/frontends/windows/schedule.c
+++ b/frontends/windows/schedule.c
@@ -25,12 +25,6 @@
#include "windows/schedule.h"
-#ifdef DEBUG_SCHEDULER
-#define SRLOG(x...) LOG(x)
-#else
-#define SRLOG(x...) ((void) 0)
-#endif
-
/* linked list of scheduled callbacks */
static struct nscallback *schedule_list = NULL;
@@ -66,7 +60,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
return NSERROR_OK;
}
- SRLOG("removing %p, %p", callback, p);
+ NSLOG(schedule, DEBUG, "removing %p, %p", callback, p);
cur_nscb = schedule_list;
prev_nscb = NULL;
@@ -76,8 +70,11 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
(cur_nscb->p == p)) {
/* item to remove */
- SRLOG("callback entry %p removing %p(%p)",
- cur_nscb, cur_nscb->callback, cur_nscb->p);
+ NSLOG(schedule, DEBUG,
+ "callback entry %p removing %p(%p)",
+ cur_nscb,
+ cur_nscb->callback,
+ cur_nscb->p);
/* remove callback */
unlnk_nscb = cur_nscb;
@@ -118,7 +115,8 @@ nserror win32_schedule(int ival, void (*callback)(void *p), void *p)
return NSERROR_NOMEM;
}
- SRLOG("adding callback %p for %p(%p) at %d cs",
+ NSLOG(schedule, DEBUG,
+ "adding callback %p for %p(%p) at %d cs",
nscb, callback, p, ival);
gettimeofday(&nscb->tv, NULL);
@@ -168,8 +166,11 @@ schedule_run(void)
prev_nscb->next = unlnk_nscb->next;
}
- SRLOG("callback entry %p running %p(%p)",
- unlnk_nscb, unlnk_nscb->callback, unlnk_nscb->p);
+ NSLOG(schedule, DEBUG,
+ "callback entry %p running %p(%p)",
+ unlnk_nscb,
+ unlnk_nscb->callback,
+ unlnk_nscb->p);
/* call callback */
unlnk_nscb->callback(unlnk_nscb->p);
@@ -201,8 +202,9 @@ schedule_run(void)
/* make returned time relative to now */
timersub(&nexttime, &tv, &rettime);
- SRLOG("returning time to next event as %ldms",
- (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000));
+ NSLOG(schedule, DEBUG,
+ "returning time to next event as %ldms",
+ (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000));
/* return next event time in milliseconds (24days max wait) */
return (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000);
@@ -216,12 +218,16 @@ void list_schedule(void)
gettimeofday(&tv, NULL);
- LOG("schedule list at %ld:%ld", tv.tv_sec, tv.tv_usec);
+ NSLOG(netsurf, INFO, "schedule list at %ld:%ld", tv.tv_sec, tv.tv_usec);
cur_nscb = schedule_list;
while (cur_nscb != NULL) {
- LOG("Schedule %p at %ld:%ld", cur_nscb, cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec);
+ NSLOG(netsurf, INFO,
+ "Schedule %p at %ld:%ld",
+ cur_nscb,
+ cur_nscb->tv.tv_sec,
+ cur_nscb->tv.tv_usec);
cur_nscb = cur_nscb->next;
}
}
diff --git a/frontends/windows/ssl_cert.c b/frontends/windows/ssl_cert.c
index 72d1d3b55..4db061626 100644
--- a/frontends/windows/ssl_cert.c
+++ b/frontends/windows/ssl_cert.c
@@ -41,13 +41,18 @@
/* spacing and sizes for dialog elements from
* https://msdn.microsoft.com/en-us/library/windows/desktop/dn742486(v=vs.85).aspx#sizingandspacing
*/
+/** dialog margin */
#define DLG_MRGN 11
+/** warning icon height */
#define WRN_ICO_H 32
+/** comand button width */
#define CMD_BTN_W 75
+/** command button height */
#define CMD_BTN_H 23
static const char windowclassname_sslcert[] = "nswssslcertwindow";
+/** win32 ssl certificate view context */
struct nsw32_sslcert_window {
struct nsw32_corewindow core;
@@ -65,15 +70,15 @@ struct nsw32_sslcert_window {
/** warning text handle */
HWND hTxt;
-
};
+
/**
- * callback for keypress on hotlist window
+ * callback for keypress on ssl certificate window
*
* \param nsw32_cw The nsw32 core window structure.
* \param nskey The netsurf key code
- * \return NSERROR_OK on success otherwise apropriate error code
+ * \return NSERROR_OK on success otherwise appropriate error code
*/
static nserror
nsw32_sslcert_viewer_key(struct nsw32_corewindow *nsw32_cw, uint32_t nskey)
@@ -89,19 +94,20 @@ nsw32_sslcert_viewer_key(struct nsw32_corewindow *nsw32_cw, uint32_t nskey)
return NSERROR_NOT_IMPLEMENTED;
}
+
/**
- * callback for mouse action on hotlist window
+ * callback for mouse action on ssl certificate window
*
* \param nsw32_cw The nsw32 core window structure.
* \param mouse_state netsurf mouse state on event
* \param x location of event
* \param y location of event
- * \return NSERROR_OK on success otherwise apropriate error code
+ * \return NSERROR_OK on success otherwise appropriate error code
*/
static nserror
nsw32_sslcert_viewer_mouse(struct nsw32_corewindow *nsw32_cw,
- browser_mouse_state mouse_state,
- int x, int y)
+ browser_mouse_state mouse_state,
+ int x, int y)
{
struct nsw32_sslcert_window *crtvrfy_win;
@@ -113,12 +119,15 @@ nsw32_sslcert_viewer_mouse(struct nsw32_corewindow *nsw32_cw,
return NSERROR_OK;
}
+
/**
- * callback on draw event for hotlist window
+ * callback on draw event for ssl certificate window
*
* \param nsw32_cw The nsw32 core window structure.
+ * \param scrollx The horizontal scroll offset.
+ * \param scrolly The vertical scroll offset.
* \param r The rectangle of the window that needs updating.
- * \return NSERROR_OK on success otherwise apropriate error code
+ * \return NSERROR_OK on success otherwise appropriate error code
*/
static nserror
nsw32_sslcert_viewer_draw(struct nsw32_corewindow *nsw32_cw,
@@ -144,6 +153,12 @@ nsw32_sslcert_viewer_draw(struct nsw32_corewindow *nsw32_cw,
}
+/**
+ * callback on close event for ssl certificate window
+ *
+ * \param nsw32_cw The nsw32 core window structure.
+ * \return NSERROR_OK on success otherwise appropriate error code
+ */
static nserror
nsw32_sslcert_viewer_close(struct nsw32_corewindow *nsw32_cw)
{
@@ -155,10 +170,10 @@ nsw32_sslcert_viewer_close(struct nsw32_corewindow *nsw32_cw)
/* exported interface documented in nsw32/ssl_cert.h */
nserror nsw32_cert_verify(struct nsurl *url,
- const struct ssl_cert_info *certs,
- unsigned long num,
- nserror (*cb)(bool proceed, void *pw),
- void *cbpw)
+ const struct ssl_cert_info *certs,
+ unsigned long num,
+ nserror (*cb)(bool proceed, void *pw),
+ void *cbpw)
{
struct nsw32_sslcert_window *ncwin;
nserror res;
@@ -176,7 +191,7 @@ nserror nsw32_cert_verify(struct nsurl *url,
return res;
}
- LOG("creating hInstance %p SSL window", hinst);
+ NSLOG(netsurf, INFO, "creating hInstance %p SSL window", hinst);
ncwin->hWnd = CreateWindowEx(0,
windowclassname_sslcert,
"SSL Certificate viewer",
@@ -193,7 +208,7 @@ nserror nsw32_cert_verify(struct nsurl *url,
hinst,
NULL);
if (ncwin->hWnd == NULL) {
- LOG("Window create failed");
+ NSLOG(netsurf, INFO, "Window create failed");
return NSERROR_NOMEM;
}
@@ -260,17 +275,17 @@ nserror nsw32_cert_verify(struct nsurl *url,
NULL,
NULL);
ncwin->hTxt = CreateWindowEx(0,
- "STATIC",
- "NetSurf failed to verify the authenticity of an SSL certificate. Verify the certificate details",
- WS_VISIBLE | WS_CHILD | SS_LEFT,
- DLG_MRGN + WRN_ICO_H + DLG_MRGN,
- DLG_MRGN + 5,
- 400,
- WRN_ICO_H - 5,
- ncwin->hWnd,
- NULL,
- NULL,
- NULL);
+ "STATIC",
+ "NetSurf failed to verify the authenticity of an SSL certificate. Verify the certificate details",
+ WS_VISIBLE | WS_CHILD | SS_LEFT,
+ DLG_MRGN + WRN_ICO_H + DLG_MRGN,
+ DLG_MRGN + 5,
+ 400,
+ WRN_ICO_H - 5,
+ ncwin->hWnd,
+ NULL,
+ NULL,
+ NULL);
SendMessage(ncwin->hTxt, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE,0));
SetProp(ncwin->hWnd, TEXT("CertWnd"), (HANDLE)ncwin);
@@ -280,8 +295,12 @@ nserror nsw32_cert_verify(struct nsurl *url,
return NSERROR_OK;
}
+
/**
* position and size ssl cert window widgets.
+ *
+ * \param hwnd The win32 handle of the window
+ * \param certwin The certificate viewer context
*/
static void
nsw32_window_ssl_cert_size(HWND hwnd, struct nsw32_sslcert_window *certwin)
@@ -318,6 +337,13 @@ nsw32_window_ssl_cert_size(HWND hwnd, struct nsw32_sslcert_window *certwin)
TRUE);
}
+
+/**
+ * Destroy a certificate viewing window
+ *
+ * \param crtwin The certificate viewer context
+ * \return NSERROR_OK on success otherwise appropriate error code
+ */
static nserror nsw32_crtvrfy_destroy(struct nsw32_sslcert_window *crtwin)
{
nserror res;
@@ -331,25 +357,29 @@ static nserror nsw32_crtvrfy_destroy(struct nsw32_sslcert_window *crtwin)
return res;
}
+
/**
- * handle command message on main browser window
+ * handle command message on ssl certificate viewing window.
*
- * \param hwnd The win32 window handle
- * \param gw win32 gui window
+ * \param hwnd The win32 window handle.
+ * \param crtwin certificate window context.
* \param notification_code notifiction code
* \param identifier notification identifier
* \param ctrl_window The win32 control window handle
- * \return apropriate response for command
+ * \return appropriate response for command
*/
static LRESULT
nsw32_window_ssl_cert_command(HWND hwnd,
- struct nsw32_sslcert_window *crtwin,
- int notification_code,
- int identifier,
- HWND ctrl_window)
+ struct nsw32_sslcert_window *crtwin,
+ int notification_code,
+ int identifier,
+ HWND ctrl_window)
{
- LOG("notification_code %x identifier %x ctrl_window %p",
- notification_code, identifier, ctrl_window);
+ NSLOG(netsurf, INFO,
+ "notification_code %x identifier %x ctrl_window %p",
+ notification_code,
+ identifier,
+ ctrl_window);
switch(identifier) {
case IDC_SSLCERT_BTN_ACCEPT:
@@ -368,6 +398,7 @@ nsw32_window_ssl_cert_command(HWND hwnd,
return 0; /* control message handled */
}
+
/**
* callback for SSL certificate window win32 events
*
@@ -378,9 +409,9 @@ nsw32_window_ssl_cert_command(HWND hwnd,
*/
static LRESULT CALLBACK
nsw32_window_ssl_cert_event_callback(HWND hwnd,
- UINT msg,
- WPARAM wparam,
- LPARAM lparam)
+ UINT msg,
+ WPARAM wparam,
+ LPARAM lparam)
{
struct nsw32_sslcert_window *crtwin;
crtwin = GetProp(hwnd, TEXT("CertWnd"));
@@ -410,6 +441,7 @@ nsw32_window_ssl_cert_event_callback(HWND hwnd,
return DefWindowProc(hwnd, msg, wparam, lparam);
}
+
/* exported interface documented in nsw32/ssl_cert.h */
nserror nsws_create_cert_verify_class(HINSTANCE hInstance)
{
diff --git a/frontends/windows/windbg.h b/frontends/windows/windbg.h
index b2d8640f4..6cd9f97f8 100644
--- a/frontends/windows/windbg.h
+++ b/frontends/windows/windbg.h
@@ -24,11 +24,13 @@
const char *msg_num_to_name(int msg);
void win_perror(const char *lpszFunction);
-#define LOG_WIN_MSG(h, m, w, l) \
- if (((m) != WM_SETCURSOR) && \
- ((m) != WM_MOUSEMOVE) && \
- ((m) != WM_NCHITTEST) && \
- ((m) != WM_ENTERIDLE)) \
- LOG("%s, hwnd %p, w 0x%x, l 0x%Ix", msg_num_to_name(m), h, w, l);
+#define LOG_WIN_MSG(h, m, w, l) \
+ if (((m) != WM_SETCURSOR) && \
+ ((m) != WM_MOUSEMOVE) && \
+ ((m) != WM_NCHITTEST) && \
+ ((m) != WM_ENTERIDLE)) \
+ NSLOG(netsurf, INFO, \
+ "%s, hwnd %p, w 0x%x, l 0x%Ix", \
+ msg_num_to_name(m), h, w, l)
#endif
diff --git a/frontends/windows/window.c b/frontends/windows/window.c
index 94dc7c10e..90d076812 100644
--- a/frontends/windows/window.c
+++ b/frontends/windows/window.c
@@ -49,7 +49,7 @@
#include "windows/drawable.h"
#include "windows/font.h"
#include "windows/prefs.h"
-#include "windows/localhistory.h"
+#include "windows/local_history.h"
#include "windows/hotlist.h"
#include "windows/cookies.h"
#include "windows/global_history.h"
@@ -75,7 +75,7 @@ static int open_windows = 0;
* Obtain the DPI of the display.
*
* \param hwnd A win32 window handle to get the DPI for
- * \return The DPI of the device teh window is displayed on.
+ * \return The DPI of the device the window is displayed on.
*/
static int get_window_dpi(HWND hwnd)
{
@@ -88,7 +88,7 @@ static int get_window_dpi(HWND hwnd)
ReleaseDC(hwnd, hdc);
- LOG("FIX DPI %d", dpi);
+ NSLOG(netsurf, INFO, "FIX DPI %d", dpi);
return dpi;
}
@@ -99,7 +99,7 @@ static int get_window_dpi(HWND hwnd)
*
* \param gw gui window context.
*/
-static void nsws_window_set_accels(struct gui_window *w)
+static void nsws_window_set_accels(struct gui_window *gw)
{
int i, nitems = 13;
ACCEL accels[nitems];
@@ -137,7 +137,7 @@ static void nsws_window_set_accels(struct gui_window *w)
accels[12].fVirt = FVIRTKEY;
accels[12].cmd = IDM_VIEW_FULLSCREEN;
- w->acceltable = CreateAcceleratorTable(accels, nitems);
+ gw->acceltable = CreateAcceleratorTable(accels, nitems);
}
@@ -163,7 +163,9 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw)
gw->mainmenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU_MAIN));
gw->rclick = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU_CONTEXT));
- LOG("creating hInstance %p GUI window %p", hInstance, gw);
+ NSLOG(netsurf, INFO,
+ "creating hInstance %p GUI window %p",
+ hInstance, gw);
hwnd = CreateWindowEx(0,
windowclassname_main,
"NetSurf Browser",
@@ -181,7 +183,7 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw)
NULL);
if (hwnd == NULL) {
- LOG("Window create failed");
+ NSLOG(netsurf, INFO, "Window create failed");
return NULL;
}
@@ -194,9 +196,10 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw)
(nsoption_int(window_height) >= 100) &&
(nsoption_int(window_x) >= 0) &&
(nsoption_int(window_y) >= 0)) {
- LOG("Setting Window position %d,%d %d,%d",
- nsoption_int(window_x), nsoption_int(window_y),
- nsoption_int(window_width), nsoption_int(window_height));
+ NSLOG(netsurf, INFO,
+ "Setting Window position %d,%d %d,%d",
+ nsoption_int(window_x), nsoption_int(window_y),
+ nsoption_int(window_width), nsoption_int(window_height));
SetWindowPos(hwnd, HWND_TOP,
nsoption_int(window_x),
nsoption_int(window_y),
@@ -223,51 +226,54 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw)
*/
static LRESULT
nsws_window_toolbar_command(struct gui_window *gw,
- int notification_code,
- int identifier,
- HWND ctrl_window)
+ int notification_code,
+ int identifier,
+ HWND ctrl_window)
{
- LOG("notification_code %d identifier %d ctrl_window %p",
- notification_code, identifier, ctrl_window);
+ NSLOG(netsurf, INFO,
+ "notification_code %d identifier %d ctrl_window %p",
+ notification_code,
+ identifier,
+ ctrl_window);
switch(identifier) {
case IDC_MAIN_URLBAR:
switch (notification_code) {
case EN_CHANGE:
- LOG("EN_CHANGE");
+ NSLOG(netsurf, INFO, "EN_CHANGE");
break;
case EN_ERRSPACE:
- LOG("EN_ERRSPACE");
+ NSLOG(netsurf, INFO, "EN_ERRSPACE");
break;
case EN_HSCROLL:
- LOG("EN_HSCROLL");
+ NSLOG(netsurf, INFO, "EN_HSCROLL");
break;
case EN_KILLFOCUS:
- LOG("EN_KILLFOCUS");
+ NSLOG(netsurf, INFO, "EN_KILLFOCUS");
break;
case EN_MAXTEXT:
- LOG("EN_MAXTEXT");
+ NSLOG(netsurf, INFO, "EN_MAXTEXT");
break;
case EN_SETFOCUS:
- LOG("EN_SETFOCUS");
+ NSLOG(netsurf, INFO, "EN_SETFOCUS");
break;
case EN_UPDATE:
- LOG("EN_UPDATE");
+ NSLOG(netsurf, INFO, "EN_UPDATE");
break;
case EN_VSCROLL:
- LOG("EN_VSCROLL");
+ NSLOG(netsurf, INFO, "EN_VSCROLL");
break;
default:
- LOG("Unknown notification_code");
+ NSLOG(netsurf, INFO, "Unknown notification_code");
break;
}
break;
@@ -421,7 +427,7 @@ nsws_window_urlbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
case WM_DESTROY:
hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0);
if (hFont != NULL) {
- LOG("Destroyed font object");
+ NSLOG(netsurf, INFO, "Destroyed font object");
DeleteObject(hFont);
}
@@ -446,7 +452,7 @@ nsws_window_urlbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
/**
* create a urlbar and message handler
*
- * Create an Edit control for enerting urls
+ * Create an Edit control for entering urls
*
* \param hInstance The application instance handle.
* \param hWndParent The containing window.
@@ -491,8 +497,8 @@ nsws_window_urlbar_create(HINSTANCE hInstance,
/* subclass the message handler */
urlproc = (WNDPROC)SetWindowLongPtr(hwnd,
- GWLP_WNDPROC,
- (LONG_PTR)nsws_window_urlbar_callback);
+ GWLP_WNDPROC,
+ (LONG_PTR)nsws_window_urlbar_callback);
/* save the real handler */
SetProp(hwnd, TEXT("OrigMsgProc"), (HANDLE)urlproc);
@@ -502,12 +508,13 @@ nsws_window_urlbar_create(HINSTANCE hInstance,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS, "Arial");
if (hFont != NULL) {
- LOG("Setting font object");
+ NSLOG(netsurf, INFO, "Setting font object");
SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont, 0);
}
- LOG("Created url bar hwnd:%p, x:%d, y:%d, w:%d, h:%d",
- hwnd, urlx, urly, urlwidth, urlheight);
+ NSLOG(netsurf, INFO,
+ "Created url bar hwnd:%p, x:%d, y:%d, w:%d, h:%d", hwnd, urlx,
+ urly, urlwidth, urlheight);
return hwnd;
}
@@ -548,7 +555,7 @@ nsws_window_throbber_create(HINSTANCE hInstance,
NULL);
nsws_find_resource(avi, "throbber.avi", "windows/res/throbber.avi");
- LOG("setting throbber avi as %s", avi);
+ NSLOG(netsurf, INFO, "setting throbber avi as %s", avi);
Animate_Open(hwnd, avi);
if (gw->throbbing) {
Animate_Play(hwnd, 0, -1, -1);
@@ -576,7 +583,8 @@ get_imagelist(HINSTANCE hInstance, int resid, int bsize, int bcnt)
HIMAGELIST hImageList;
HBITMAP hScrBM;
- LOG("resource id %d, bzize %d, bcnt %d", resid, bsize, bcnt);
+ NSLOG(netsurf, INFO, "resource id %d, bzize %d, bcnt %d", resid,
+ bsize, bcnt);
hImageList = ImageList_Create(bsize, bsize,
ILC_COLOR24 | ILC_MASK, 0,
@@ -654,8 +662,8 @@ nsws_window_create_toolbar(HINSTANCE hInstance,
/* subclass the message handler */
toolproc = (WNDPROC)SetWindowLongPtr(hWndToolbar,
- GWLP_WNDPROC,
- (LONG_PTR)nsws_window_toolbar_callback);
+ GWLP_WNDPROC,
+ (LONG_PTR)nsws_window_toolbar_callback);
/* save the real handler */
SetProp(hWndToolbar, TEXT("OrigMsgProc"), (HANDLE)toolproc);
@@ -754,7 +762,7 @@ nsws_window_create_statusbar(HINSTANCE hInstance,
static void nsws_update_edit(struct gui_window *w)
{
browser_editor_flags editor_flags = (w->bw == NULL) ?
- BW_EDITOR_NONE : browser_window_get_editor_flags(w->bw);
+ BW_EDITOR_NONE : browser_window_get_editor_flags(w->bw);
bool paste, copy, del;
bool sel = (editor_flags & BW_EDITOR_CAN_COPY);
@@ -809,11 +817,12 @@ static void nsws_update_edit(struct gui_window *w)
*
* \param gw win32 frontends graphical window.
* \param hwnd The win32 window handle
- * \param int x The x coordinate of the event.
- * \param y the y cooordiante of the event.
+ * \param x The x coordinate of the event.
+ * \param y the y coordinate of the event.
+ * \return true if menu displayed else false
*/
static bool
-nsws_ctx_menu(struct gui_window *w, HWND hwnd, int x, int y)
+nsws_ctx_menu(struct gui_window *gw, HWND hwnd, int x, int y)
{
RECT rc; /* client area of window */
POINT pt = { x, y }; /* location of mouse click */
@@ -827,8 +836,8 @@ nsws_ctx_menu(struct gui_window *w, HWND hwnd, int x, int y)
/* If the position is in the client area, display a shortcut menu. */
if (PtInRect(&rc, pt)) {
ClientToScreen(hwnd, &pt);
- nsws_update_edit(w);
- TrackPopupMenu(GetSubMenu(w->rclick, 0),
+ nsws_update_edit(gw);
+ TrackPopupMenu(GetSubMenu(gw->rclick, 0),
TPM_CENTERALIGN | TPM_TOPALIGN,
x,
y,
@@ -878,21 +887,40 @@ static void nsws_window_update_forward_back(struct gui_window *w)
MAKELONG((back ? TBSTATE_ENABLED :
TBSTATE_INDETERMINATE), 0));
}
+ nsw32_local_history_hide();
}
/**
- * redraw the whole window
+ * Invalidate an area of a win32 browser window
*
- * \param gw win32 frontends graphical window.
+ * \param gw The netsurf window being invalidated.
+ * \param rect area to redraw or NULL for entrire window area.
+ * \return NSERROR_OK or appropriate error code.
*/
-static void win32_window_redraw_window(struct gui_window *gw)
+static nserror
+win32_window_invalidate_area(struct gui_window *gw, const struct rect *rect)
{
- /* LOG("gw:%p", gw); */
- if (gw != NULL) {
- RedrawWindow(gw->drawingarea, NULL, NULL,
- RDW_INVALIDATE | RDW_NOERASE);
+ RECT *redrawrectp = NULL;
+ RECT redrawrect;
+
+ assert(gw != NULL);
+
+ if (rect != NULL) {
+ redrawrectp = &redrawrect;
+
+ redrawrect.left = (long)rect->x0 - (gw->scrollx / gw->scale);
+ redrawrect.top = (long)rect->y0 - (gw->scrolly / gw->scale);
+ redrawrect.right =(long)rect->x1;
+ redrawrect.bottom = (long)rect->y1;
+
}
+ RedrawWindow(gw->drawingarea,
+ redrawrectp,
+ NULL,
+ RDW_INVALIDATE | RDW_NOERASE);
+
+ return NSERROR_OK;
}
@@ -904,7 +932,7 @@ static void win32_window_redraw_window(struct gui_window *gw)
*/
static void nsws_set_scale(struct gui_window *gw, float scale)
{
- int x, y;
+ struct rect rect;
assert(gw != NULL);
@@ -912,8 +940,8 @@ static void nsws_set_scale(struct gui_window *gw, float scale)
return;
}
- x = gw->scrollx;
- y = gw->scrolly;
+ rect.x0 = rect.x1 = gw->scrollx;
+ rect.y0 = rect.y1 = gw->scrolly;
gw->scale = scale;
@@ -921,8 +949,8 @@ static void nsws_set_scale(struct gui_window *gw, float scale)
browser_window_set_scale(gw->bw, scale, true);
}
- win32_window_redraw_window(gw);
- win32_window_set_scroll(gw, x, y);
+ win32_window_invalidate_area(gw, NULL);
+ win32_window_set_scroll(gw, &rect);
}
@@ -963,10 +991,10 @@ static nserror win32_open_new_window(struct gui_window *gw)
*
* \param hwnd The win32 window handle
* \param gw win32 gui window
- * \param notification_code notifiction code
+ * \param notification_code notification code
* \param identifier notification identifier
* \param ctrl_window The win32 control window handle
- * \return apropriate response for command
+ * \return appropriate response for command
*/
static LRESULT
nsws_window_command(HWND hwnd,
@@ -977,8 +1005,11 @@ nsws_window_command(HWND hwnd,
{
nserror ret;
- LOG("notification_code %x identifier %x ctrl_window %p",
- notification_code, identifier, ctrl_window);
+ NSLOG(netsurf, INFO,
+ "notification_code %x identifier %x ctrl_window %p",
+ notification_code,
+ identifier,
+ ctrl_window);
switch(identifier) {
@@ -1053,7 +1084,7 @@ nsws_window_command(HWND hwnd,
HANDLE h = GetClipboardData(CF_TEXT);
if (h != NULL) {
char *content = GlobalLock(h);
- LOG("pasting %s\n", content);
+ NSLOG(netsurf, INFO, "pasting %s\n", content);
GlobalUnlock(h);
}
CloseClipboard();
@@ -1129,7 +1160,7 @@ nsws_window_command(HWND hwnd,
break;
case IDM_NAV_LOCALHISTORY:
- gw->localhistory = nsws_window_create_localhistory(gw);
+ nsw32_local_history_present(gw->main, gw->bw);
break;
case IDM_NAV_GLOBALHISTORY:
@@ -1217,7 +1248,7 @@ nsws_window_command(HWND hwnd,
browser_window_debug(gw->bw, CONTENT_DEBUG_REDRAW);
/* TODO: This should only redraw, not reformat.
* (Layout doesn't change, so reformat is a waste of time) */
- browser_window_reformat(gw->bw, false, gw->width, gw->height);
+ browser_window_schedule_reformat(gw->bw);
}
break;
@@ -1256,7 +1287,7 @@ nsws_window_command(HWND hwnd,
int len = SendMessage(gw->urlbar, WM_GETTEXTLENGTH, 0, 0);
char addr[len + 1];
SendMessage(gw->urlbar, WM_GETTEXT, (WPARAM)(len + 1), (LPARAM)addr);
- LOG("launching %s\n", addr);
+ NSLOG(netsurf, INFO, "launching %s\n", addr);
if (nsurl_create(addr, &url) != NSERROR_OK) {
win32_warning("NoMemory", 0);
@@ -1286,14 +1317,14 @@ nsws_window_command(HWND hwnd,
/**
* Get the scroll position of a win32 browser window.
*
- * \param g gui_window
- * \param sx receives x ordinate of point at top-left of window
- * \param sy receives y ordinate of point at top-left of window
+ * \param gw gui_window
+ * \param sx receives x ordinate of point at top-left of window
+ * \param sy receives y ordinate of point at top-left of window
* \return true iff successful
*/
static bool win32_window_get_scroll(struct gui_window *gw, int *sx, int *sy)
{
- LOG("get scroll");
+ NSLOG(netsurf, INFO, "get scroll");
if (gw == NULL)
return false;
@@ -1311,7 +1342,7 @@ static bool win32_window_get_scroll(struct gui_window *gw, int *sx, int *sy)
* \param hwnd The win32 window handle
* \param wparam The w win32 parameter
* \param lparam The l win32 parameter
- * \return apropriate response for resize
+ * \return appropriate response for resize
*/
static LRESULT
nsws_window_resize(struct gui_window *gw,
@@ -1319,7 +1350,6 @@ nsws_window_resize(struct gui_window *gw,
WPARAM wparam,
LPARAM lparam)
{
- int x, y;
RECT rstatus, rtool;
if ((gw->toolbar == NULL) ||
@@ -1332,7 +1362,6 @@ nsws_window_resize(struct gui_window *gw,
GetClientRect(gw->toolbar, &rtool);
GetWindowRect(gw->statusbar, &rstatus);
- win32_window_get_scroll(gw, &x, &y);
gw->width = LOWORD(lparam);
gw->height = HIWORD(lparam) - (rtool.bottom - rtool.top) - (rstatus.bottom - rstatus.top);
@@ -1346,7 +1375,7 @@ nsws_window_resize(struct gui_window *gw,
}
nsws_window_update_forward_back(gw);
- win32_window_set_scroll(gw, x, y);
+ browser_window_update(gw->bw, false);
if (gw->toolbar != NULL) {
SendMessage(gw->toolbar, TB_SETSTATE,
@@ -1392,7 +1421,8 @@ nsws_window_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
gw = nsws_get_gui_window(hwnd);
if (gw == NULL) {
- LOG("Unable to find gui window structure for hwnd %p", hwnd);
+ NSLOG(netsurf, INFO,
+ "Unable to find gui window structure for hwnd %p", hwnd);
return DefWindowProc(hwnd, msg, wparam, lparam);
}
@@ -1417,6 +1447,7 @@ nsws_window_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
case WM_NCDESTROY:
RemoveProp(hwnd, TEXT("GuiWnd"));
+ nsw32_local_history_hide();
browser_window_destroy(gw->bw);
if (--open_windows <= 0) {
win32_set_quit(true);
@@ -1444,7 +1475,7 @@ win32_window_create(struct browser_window *bw,
{
struct gui_window *gw;
- LOG("Creating gui window for browser window %p", bw);
+ NSLOG(netsurf, INFO, "Creating gui window for browser window %p", bw);
gw = calloc(1, sizeof(struct gui_window));
if (gw == NULL) {
@@ -1465,7 +1496,7 @@ win32_window_create(struct browser_window *bw,
gw->mouse = malloc(sizeof(struct browser_mouse));
if (gw->mouse == NULL) {
free(gw);
- LOG("Unable to allocate mouse state");
+ NSLOG(netsurf, INFO, "Unable to allocate mouse state");
return NULL;
}
gw->mouse->gui = gw;
@@ -1485,8 +1516,12 @@ win32_window_create(struct browser_window *bw,
gw->statusbar = nsws_window_create_statusbar(hinst, gw->main, gw);
gw->drawingarea = nsws_window_create_drawable(hinst, gw->main, gw);
- LOG("new window: main:%p toolbar:%p statusbar %p drawingarea %p",
- gw->main, gw->toolbar, gw->statusbar, gw->drawingarea);
+ NSLOG(netsurf, INFO,
+ "new window: main:%p toolbar:%p statusbar %p drawingarea %p",
+ gw->main,
+ gw->toolbar,
+ gw->statusbar,
+ gw->drawingarea);
font_hwnd = gw->drawingarea;
open_windows++;
@@ -1522,32 +1557,6 @@ static void win32_window_destroy(struct gui_window *w)
/**
- * Cause redraw of part of a win32 window.
- *
- * \param gw win32 gui window
- * \param rect area to redraw
- */
-static void
-win32_window_update(struct gui_window *gw, const struct rect *rect)
-{
- if (gw == NULL)
- return;
-
- RECT redrawrect;
-
- redrawrect.left = (long)rect->x0 - (gw->scrollx / gw->scale);
- redrawrect.top = (long)rect->y0 - (gw->scrolly / gw->scale);
- redrawrect.right =(long)rect->x1;
- redrawrect.bottom = (long)rect->y1;
-
- RedrawWindow(gw->drawingarea,
- &redrawrect,
- NULL,
- RDW_INVALIDATE | RDW_NOERASE);
-}
-
-
-/**
* Find the current dimensions of a win32 browser window's content area.
*
* \param gw gui_window to measure
@@ -1555,18 +1564,17 @@ win32_window_update(struct gui_window *gw, const struct rect *rect)
* \param height receives height of window
* \param scaled whether to return scaled values
*/
-static void
+static nserror
win32_window_get_dimensions(struct gui_window *gw,
int *width, int *height,
bool scaled)
{
- if (gw == NULL)
- return;
-
- LOG("get dimensions %p w=%d h=%d", gw, gw->width, gw->height);
-
*width = gw->width;
*height = gw->height;
+
+ NSLOG(netsurf, INFO, "gw:%p w=%d h=%d", gw, *width, *height);
+
+ return NSERROR_OK;
}
@@ -1583,19 +1591,6 @@ static void win32_window_update_extent(struct gui_window *w)
/**
- * callback from core to reformat a win32 window.
- *
- * \param gw The win32 gui window to reformat.
- */
-static void win32_window_reformat(struct gui_window *gw)
-{
- if (gw != NULL) {
- browser_window_reformat(gw->bw, false, gw->width, gw->height);
- }
-}
-
-
-/**
* set win32 browser window title
*
* \param w the win32 gui window.
@@ -1603,24 +1598,29 @@ static void win32_window_reformat(struct gui_window *gw)
*/
static void win32_window_set_title(struct gui_window *w, const char *title)
{
- if (w == NULL)
+ char *fulltitle;
+
+ if (w == NULL) {
return;
- LOG("%p, title %s", w, title);
- char *fulltitle = malloc(strlen(title) +
- SLEN(" - NetSurf") + 1);
+ }
+
+ NSLOG(netsurf, INFO, "%p, title %s", w, title);
+ fulltitle = malloc(strlen(title) + SLEN(" - NetSurf") + 1);
if (fulltitle == NULL) {
win32_warning("NoMemory", 0);
return;
}
+
strcpy(fulltitle, title);
strcat(fulltitle, " - NetSurf");
+
SendMessage(w->main, WM_SETTEXT, 0, (LPARAM)fulltitle);
free(fulltitle);
}
/**
- * Set the navigation url is a win32 browser window.
+ * Set the navigation url in a win32 browser window.
*
* \param gw window to update.
* \param url The url to use as icon.
@@ -1688,13 +1688,13 @@ win32_window_place_caret(struct gui_window *w, int x, int y,
/**
* Remove the win32 input focus from window
*
- * \param g window with caret
+ * \param gw window with caret
*/
-static void win32_window_remove_caret(struct gui_window *w)
+static void win32_window_remove_caret(struct gui_window *gw)
{
- if (w == NULL)
+ if (gw == NULL)
return;
- HideCaret(w->drawingarea);
+ HideCaret(gw->drawingarea);
}
@@ -1770,13 +1770,11 @@ static void win32_window_stop_throbber(struct gui_window *w)
static struct gui_window_table window_table = {
.create = win32_window_create,
.destroy = win32_window_destroy,
- .redraw = win32_window_redraw_window,
- .update = win32_window_update,
+ .invalidate = win32_window_invalidate_area,
.get_scroll = win32_window_get_scroll,
.set_scroll = win32_window_set_scroll,
.get_dimensions = win32_window_get_dimensions,
.update_extent = win32_window_update_extent,
- .reformat = win32_window_reformat,
.set_title = win32_window_set_title,
.set_url = win32_window_set_url,
@@ -1797,7 +1795,7 @@ struct gui_window *nsws_get_gui_window(HWND hwnd)
struct gui_window *gw = NULL;
HWND phwnd = hwnd;
- /* scan the window hierachy for gui window */
+ /* scan the window hierarchy for gui window */
while (phwnd != NULL) {
gw = GetProp(phwnd, TEXT("GuiWnd"));
if (gw != NULL)
@@ -1848,84 +1846,101 @@ bool nsws_window_go(HWND hwnd, const char *urltxt)
/* exported interface documented in windows/window.h */
-void win32_window_set_scroll(struct gui_window *w, int sx, int sy)
+nserror win32_window_set_scroll(struct gui_window *gw, const struct rect *rect)
{
SCROLLINFO si;
- nserror err;
+ nserror res;
int height;
int width;
POINT p;
- if ((w == NULL) || (w->bw == NULL))
- return;
-
- err = browser_window_get_extents(w->bw, true, &width, &height);
- if (err != NSERROR_OK) {
- return;
+ if ((gw == NULL) || (gw->bw == NULL)) {
+ return NSERROR_BAD_PARAMETER;
}
- /*LOG("scroll sx,sy:%d,%d x,y:%d,%d w.h:%d,%d",sx,sy,w->scrollx,w->scrolly, width,height);*/
+ res = browser_window_get_extents(gw->bw, true, &width, &height);
+ if (res != NSERROR_OK) {
+ return res;
+ }
- /* The resulting gui window scroll must remain withn the
+ /* The resulting gui window scroll must remain within the
* windows bounding box.
*/
- if (sx < 0) {
- w->requestscrollx = -w->scrollx;
- } else if (sx > (width - w->width)) {
- w->requestscrollx = (width - w->width) - w->scrollx;
+ if (rect->x0 < 0) {
+ gw->requestscrollx = -gw->scrollx;
+ } else if (rect->x0 > (width - gw->width)) {
+ gw->requestscrollx = (width - gw->width) - gw->scrollx;
} else {
- w->requestscrollx = sx - w->scrollx;
+ gw->requestscrollx = rect->x0 - gw->scrollx;
}
- if (sy < 0) {
- w->requestscrolly = -w->scrolly;
- } else if (sy > (height - w->height)) {
- w->requestscrolly = (height - w->height) - w->scrolly;
+ if (rect->y0 < 0) {
+ gw->requestscrolly = -gw->scrolly;
+ } else if (rect->y0 > (height - gw->height)) {
+ gw->requestscrolly = (height - gw->height) - gw->scrolly;
} else {
- w->requestscrolly = sy - w->scrolly;
+ gw->requestscrolly = rect->y0 - gw->scrolly;
}
- /*LOG("requestscroll x,y:%d,%d", w->requestscrollx, w->requestscrolly);*/
+ NSLOG(netsurf, DEEPDEBUG,
+ "requestscroll x,y:%d,%d",
+ gw->requestscrollx, gw->requestscrolly);
/* set the vertical scroll offset */
si.cbSize = sizeof(si);
si.fMask = SIF_ALL;
si.nMin = 0;
si.nMax = height - 1;
- si.nPage = w->height;
- si.nPos = max(w->scrolly + w->requestscrolly, 0);
- si.nPos = min(si.nPos, height - w->height);
- SetScrollInfo(w->drawingarea, SB_VERT, &si, TRUE);
- /*LOG("SetScrollInfo VERT min:%d max:%d page:%d pos:%d", si.nMin, si.nMax, si.nPage, si.nPos);*/
+ si.nPage = gw->height;
+ si.nPos = max(gw->scrolly + gw->requestscrolly, 0);
+ si.nPos = min(si.nPos, height - gw->height);
+ SetScrollInfo(gw->drawingarea, SB_VERT, &si, TRUE);
+ NSLOG(netsurf, DEEPDEBUG,
+ "SetScrollInfo VERT min:%d max:%d page:%d pos:%d",
+ si.nMin, si.nMax, si.nPage, si.nPos);
/* set the horizontal scroll offset */
si.cbSize = sizeof(si);
si.fMask = SIF_ALL;
si.nMin = 0;
si.nMax = width -1;
- si.nPage = w->width;
- si.nPos = max(w->scrollx + w->requestscrollx, 0);
- si.nPos = min(si.nPos, width - w->width);
- SetScrollInfo(w->drawingarea, SB_HORZ, &si, TRUE);
- /*LOG("SetScrollInfo HORZ min:%d max:%d page:%d pos:%d", si.nMin, si.nMax, si.nPage, si.nPos);*/
+ si.nPage = gw->width;
+ si.nPos = max(gw->scrollx + gw->requestscrollx, 0);
+ si.nPos = min(si.nPos, width - gw->width);
+ SetScrollInfo(gw->drawingarea, SB_HORZ, &si, TRUE);
+ NSLOG(netsurf, DEEPDEBUG,
+ "SetScrollInfo HORZ min:%d max:%d page:%d pos:%d",
+ si.nMin, si.nMax, si.nPage, si.nPos);
/* Set caret position */
GetCaretPos(&p);
- HideCaret(w->drawingarea);
- SetCaretPos(p.x - w->requestscrollx, p.y - w->requestscrolly);
- ShowCaret(w->drawingarea);
+ HideCaret(gw->drawingarea);
+ SetCaretPos(p.x - gw->requestscrollx, p.y - gw->requestscrolly);
+ ShowCaret(gw->drawingarea);
RECT r, redraw;
r.top = 0;
- r.bottom = w->height + 1;
+ r.bottom = gw->height + 1;
r.left = 0;
- r.right = w->width + 1;
- ScrollWindowEx(w->drawingarea, - w->requestscrollx, - w->requestscrolly, &r, NULL, NULL, &redraw, SW_INVALIDATE);
- /*LOG("ScrollWindowEx %d, %d", - w->requestscrollx, - w->requestscrolly);*/
- w->scrolly += w->requestscrolly;
- w->scrollx += w->requestscrollx;
- w->requestscrollx = 0;
- w->requestscrolly = 0;
+ r.right = gw->width + 1;
+ ScrollWindowEx(gw->drawingarea,
+ - gw->requestscrollx,
+ - gw->requestscrolly,
+ &r,
+ NULL,
+ NULL,
+ &redraw,
+ SW_INVALIDATE);
+ NSLOG(netsurf, DEEPDEBUG,
+ "ScrollWindowEx %d, %d",
+ - gw->requestscrollx,
+ - gw->requestscrolly);
+
+ gw->scrolly += gw->requestscrolly;
+ gw->scrollx += gw->requestscrollx;
+ gw->requestscrollx = 0;
+ gw->requestscrolly = 0;
+ return NSERROR_OK;
}
@@ -1966,12 +1981,3 @@ HWND gui_window_main_window(struct gui_window *w)
return NULL;
return w->main;
}
-
-
-/* exported interface documented in windows/window.h */
-struct nsws_localhistory *gui_window_localhistory(struct gui_window *w)
-{
- if (w == NULL)
- return NULL;
- return w->localhistory;
-}
diff --git a/frontends/windows/window.h b/frontends/windows/window.h
index d927c2899..3cdb9aefe 100644
--- a/frontends/windows/window.h
+++ b/frontends/windows/window.h
@@ -73,6 +73,7 @@ struct gui_window {
struct gui_window *next, *prev; /**< global linked list */
};
+struct rect;
/**
* Obtain gui window structure from window handle.
@@ -91,13 +92,17 @@ struct gui_window *nsws_get_gui_window(HWND hwnd);
bool nsws_window_go(HWND hwnd, const char *urltxt);
/**
- * scroll the window
+ * Set the scroll position of a win32 browser window.
*
- * \param w The win32 gui window to scroll.
- * \param sx the new 'absolute' horizontal scroll location
- * \param sy the new 'absolute' vertical scroll location
+ * Scrolls the viewport to ensure the specified rectangle of the
+ * content is shown. The win32 implementation scrolls the contents so
+ * the specified point in the content is at the top of the viewport.
+ *
+ * \param gw The win32 gui window to scroll.
+ * \param rect The rectangle to ensure is shown.
+ * \return NSERROR_OK on success or apropriate error code.
*/
-void win32_window_set_scroll(struct gui_window *w, int sx, int sy);
+nserror win32_window_set_scroll(struct gui_window *gw, const struct rect *rect);
/**
* Create the main browser window class.