NetSurf
|
#include <assert.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <sys/select.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <Alert.h>
#include <Application.h>
#include <BeBuild.h>
#include <FindDirectory.h>
#include <Mime.h>
#include <Path.h>
#include <PathFinder.h>
#include <Resources.h>
#include <Roster.h>
#include <Screen.h>
#include <String.h>
#include "utils/nsoption.h"
#include "utils/filename.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/url.h"
#include "utils/corestrings.h"
#include "utils/utf8.h"
#include "utils/utils.h"
#include "utils/nsurl.h"
#include "netsurf/misc.h"
#include "netsurf/clipboard.h"
#include "netsurf/search.h"
#include "netsurf/fetch.h"
#include "netsurf/netsurf.h"
#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/cookie_db.h"
#include "netsurf/url_db.h"
#include "content/fetch.h"
#include "beos/gui.h"
#include "beos/gui_options.h"
#include "beos/window.h"
#include "beos/throbber.h"
#include "beos/filetype.h"
#include "beos/download.h"
#include "beos/schedule.h"
#include "beos/fetch_rsrc.h"
#include "beos/scaffolding.h"
#include "beos/bitmap.h"
#include "beos/font.h"
Go to the source code of this file.
Macros | |
#define | __STDBOOL_H__ 1 |
#define | USE_RESOURCES 1 |
#define | B_PANEL_TEXT_COLOR ((color_which)10) |
#define | B_DOCUMENT_BACKGROUND_COLOR ((color_which)11) |
#define | B_DOCUMENT_TEXT_COLOR ((color_which)12) |
#define | B_CONTROL_BACKGROUND_COLOR ((color_which)13) |
#define | B_CONTROL_TEXT_COLOR ((color_which)14) |
#define | B_CONTROL_BORDER_COLOR ((color_which)15) |
#define | B_CONTROL_HIGHLIGHT_COLOR ((color_which)16) |
#define | B_NAVIGATION_BASE_COLOR ((color_which)4) |
#define | B_NAVIGATION_PULSE_COLOR ((color_which)17) |
#define | B_SHINE_COLOR ((color_which)18) |
#define | B_SHADOW_COLOR ((color_which)19) |
#define | B_MENU_SELECTED_BORDER_COLOR ((color_which)9) |
#define | B_TOOL_TIP_BACKGROUND_COLOR ((color_which)20) |
#define | B_TOOL_TIP_TEXT_COLOR ((color_which)21) |
#define | B_SUCCESS_COLOR ((color_which)100) |
#define | B_FAILURE_COLOR ((color_which)101) |
#define | B_MENU_SELECTED_BACKGROUND_COLOR B_MENU_SELECTION_BACKGROUND_COLOR |
#define | B_RANDOM_COLOR ((color_which)0x80000000) |
#define | B_MICHELANGELO_FAVORITE_COLOR ((color_which)0x80000001) |
#define | B_DSANDLER_FAVORITE_SKY_COLOR ((color_which)0x80000002) |
#define | B_DSANDLER_FAVORITE_INK_COLOR ((color_which)0x80000003) |
#define | B_DSANDLER_FAVORITE_SHOES_COLOR ((color_which)0x80000004) |
#define | B_DAVE_BROWN_FAVORITE_COLOR ((color_which)0x80000005) |
#define | NOCOL ((color_which)0) |
#define | STROF(n) #n |
#define | FIND_THROB(n) |
#define | SETFONTDEFAULT(OPTION, y) if (nsoption_charp(OPTION) == NULL) nsoption_set_charp(OPTION, strdup((y))) |
Functions | |
nserror | beos_warn_user (const char *warning, const char *detail) |
Display a warning for a serious problem (eg memory exhaustion). More... | |
char * | realpath (const char *f, char *buf) |
image_id | nsbeos_find_app_path (char *path) |
char * | find_resource (char *buf, const char *filename, const char *def) |
Locate a shared resource file by searching known places in order. More... | |
static void | check_homedir (void) |
Check that ~/.netsurf/ exists, and if it doesn't, create it. More... | |
static int32 | bapp_thread (void *arg) |
static nsurl * | gui_get_resource_url (const char *path) |
static nserror | set_colour_from_ui (struct nsoption_s *opts, color_which ui, enum nsoption_e option, colour def_colour) |
set option from pen More... | |
static nserror | set_defaults (struct nsoption_s *defaults) |
Set option defaults for framebuffer frontend. More... | |
void | nsbeos_update_system_ui_colors (void) |
static bool | nslog_stream_configure (FILE *fptr) |
Ensures output logging stream is correctly configured. More... | |
static BPath | get_messages_path () |
static void | gui_init (int argc, char **argv) |
void | nsbeos_pipe_message (BMessage *message, BView *_this, struct gui_window *gui) |
void | nsbeos_pipe_message_top (BMessage *message, BWindow *_this, struct beos_scaffolding *scaffold) |
void | nsbeos_gui_poll (void) |
static void | gui_quit (void) |
static char * | url_to_path (const char *url) |
void | nsbeos_gui_view_source (struct hlcache_handle *content) |
Send the source of a content to a text editor. More... | |
static nserror | gui_launch_url (struct nsurl *url) |
Broadcast an URL that we can't handle. More... | |
void | die (const char *const error) |
Cause an abnormal program termination. More... | |
int | main (int argc, char **argv) |
Normal entry point from OS. More... | |
int | gui_init_replicant (int argc, char **argv) |
called when replicated from NSBaseView::Instantiate() More... | |
Variables | |
bool | nsbeos_done = false |
bool | replicated = false |
if we are running as a replicant More... | |
char * | options_file_location |
char * | glade_file_location |
struct gui_window * | search_current_window = 0 |
BWindow * | wndAbout |
BWindow * | wndWarning |
BWindow * | wndTooltip |
BFilePanel * | wndOpenFile |
static thread_id | sBAppThreadID |
static BMessage * | gFirstRefsReceived = NULL |
static int | sEventPipe [2] |
static struct gui_fetch_table | beos_fetch_table |
static struct gui_misc_table | beos_misc_table |
#define B_DAVE_BROWN_FAVORITE_COLOR ((color_which)0x80000005) |
#define B_DSANDLER_FAVORITE_INK_COLOR ((color_which)0x80000003) |
#define B_DSANDLER_FAVORITE_SHOES_COLOR ((color_which)0x80000004) |
#define B_DSANDLER_FAVORITE_SKY_COLOR ((color_which)0x80000002) |
#define B_MENU_SELECTED_BACKGROUND_COLOR B_MENU_SELECTION_BACKGROUND_COLOR |
#define B_MICHELANGELO_FAVORITE_COLOR ((color_which)0x80000001) |
#define FIND_THROB | ( | n | ) |
#define SETFONTDEFAULT | ( | OPTION, | |
y | |||
) | if (nsoption_charp(OPTION) == NULL) nsoption_set_charp(OPTION, strdup((y))) |
#define STROF | ( | n | ) | #n |
|
static |
Definition at line 373 of file gui.cpp.
Referenced by gui_init().
nserror beos_warn_user | ( | const char * | warning, |
const char * | detail | ||
) |
Display a warning for a serious problem (eg memory exhaustion).
warning | message key for warning message |
detail | additional message, or 0 |
Definition at line 116 of file gui.cpp.
References NSERROR_OK, NSLOG, and text().
Referenced by beos_fetch_filetype_init(), fetch_rsrc_register(), gui_init(), gui_launch_url(), gui_window_create(), nsbeos_gui_view_source(), nsbeos_new_scaffolding(), nsbeos_plot_arc(), nsbeos_plot_bbitmap(), nsbeos_plot_bitmap(), nsbeos_plot_clip(), nsbeos_plot_disc(), nsbeos_plot_line(), nsbeos_plot_polygon(), nsbeos_plot_rectangle(), nsbeos_scaffolding_dispatch_event(), and nsfont_paint().
|
static |
void die | ( | const char *const | error | ) |
Cause an abnormal program termination.
error | The message to display to the user. |
Definition at line 970 of file gui.cpp.
References text().
Referenced by check_homedir(), gui_init(), gui_init_replicant(), and main().
char * find_resource | ( | char * | buf, |
const char * | filename, | ||
const char * | def | ||
) |
Locate a shared resource file by searching known places in order.
Search order is: ~/config/settings/NetSurf/, ~/.netsurf/, $NETSURFRES/ (where NETSURFRES is an environment variable), and finally the path specified by the macro at the top of this file.
buf | buffer to write to. must be at least PATH_MAX chars |
filename | file to look for |
def | default to return if file not found |
Definition at line 277 of file gui.cpp.
References find_resource(), path(), PATH_MAX, and realpath().
Referenced by find_resource(), gui_init(), and nsbeos_scaffolding_dispatch_event().
|
static |
Definition at line 519 of file gui.cpp.
References get_messages_path().
Referenced by get_messages_path(), gui_init_replicant(), and main().
|
static |
Definition at line 380 of file gui.cpp.
References NSLOG, nsurl_create(), path(), and gui_window::url.
|
static |
Definition at line 546 of file gui.cpp.
References bapp_thread(), beos_fetch_filetype_init(), beos_warn_user(), browser_window_create(), BW_CREATE_HISTORY, check_homedir(), die(), fetch_rsrc_register(), find_resource(), FIND_THROB, gFirstRefsReceived, messages_get_errorcode(), nsbeos_options_init(), nsbeos_throbber_initialise_from_png(), nsbeos_update_system_ui_colors(), NSERROR_OK, NSLOG, nsoption_charp, nsoption_read(), nsoption_set_bool, nsoption_set_charp, nsurl_create(), nsurl_unref(), options_file_location, PATH_MAX, replicated, sBAppThreadID, SETFONTDEFAULT, sEventPipe, TEMP_FILENAME_PREFIX, gui_window::url, urldb_load(), and urldb_load_cookies().
Referenced by gui_init_replicant(), and main().
int gui_init_replicant | ( | int | argc, |
char ** | argv | ||
) |
called when replicated from NSBaseView::Instantiate()
Definition at line 1102 of file gui.cpp.
References beos_bitmap_table, beos_clipboard_table, beos_download_table, beos_fetch_table, beos_layout_table, beos_misc_table, beos_window_table, die(), get_messages_path(), gui_init(), messages_add_from_file(), netsurf_init(), netsurf_register(), NSERROR_OK, nslog_init(), nslog_stream_configure(), nsoption_commandline(), nsoption_init(), nsoption_read(), nsoptions, nsoptions_default, options, and set_defaults().
Referenced by NSBaseView::Instantiate().
Broadcast an URL that we can't handle.
Definition at line 942 of file gui.cpp.
References beos_warn_user(), NSERROR_NO_FETCH_HANDLER, NSERROR_OK, and nsurl_access().
|
static |
Definition at line 800 of file gui.cpp.
References beos_fetch_filetype_fin(), fetch_rsrc_unregister(), nsoption_charp, urldb_save(), and urldb_save_cookies().
int main | ( | int | argc, |
char ** | argv | ||
) |
Normal entry point from OS.
Normal entry point from OS.
/param argc The number of arguments in the string vector. /param argv The argument string vector. /return The return code to the OS
Definition at line 1005 of file gui.cpp.
References beos_bitmap_table, beos_clipboard_table, beos_download_table, beos_fetch_table, beos_layout_table, beos_misc_table, beos_window_table, die(), get_messages_path(), gui_init(), main(), messages_add_from_file(), messages_add_from_inline(), netsurf_exit(), netsurf_init(), netsurf_register(), nsbeos_done, nsbeos_gui_poll(), NSERROR_OK, NSLOG, nslog_finalise(), nslog_init(), nslog_stream_configure(), nsoption_commandline(), nsoption_finalise(), nsoption_init(), nsoption_read(), nsoptions, nsoptions_default, options, path(), replicated, and set_defaults().
Referenced by main().
image_id nsbeos_find_app_path | ( | char * | path | ) |
Definition at line 246 of file gui.cpp.
References nsbeos_find_app_path(), and path().
Referenced by find_app_resources(), NSBaseView::Instantiate(), and nsbeos_find_app_path().
void nsbeos_gui_poll | ( | void | ) |
Definition at line 745 of file gui.cpp.
References earliest_callback_timeout, fetch_fdset(), nsbeos_dispatch_event(), NSLOG, schedule_run(), and sEventPipe.
Referenced by main(), and nsbeos_replicant_main_thread().
void nsbeos_gui_view_source | ( | struct hlcache_handle * | content | ) |
Send the source of a content to a text editor.
Definition at line 830 of file gui.cpp.
References beos_warn_user(), content_get_mime_type(), content_get_source_data(), filename_request(), hlcache_handle_get_url(), nsurl_access(), path(), TEMP_FILENAME_PREFIX, type, and url_to_path().
Referenced by nsbeos_scaffolding_dispatch_event().
void nsbeos_pipe_message | ( | BMessage * | message, |
BView * | _this, | ||
struct gui_window * | gui | ||
) |
Definition at line 717 of file gui.cpp.
References gui_window::gui, and sEventPipe.
Referenced by NSBrowserApplication::AboutRequested(), NSBrowserFrameView::Draw(), NSBrowserFrameView::FrameResized(), NSBrowserFrameView::KeyDown(), LoginAlert::MessageReceived(), NSBrowserFrameView::MouseDown(), NSBrowserFrameView::MouseMoved(), NSBrowserFrameView::MouseUp(), and NSBrowserApplication::QuitRequested().
void nsbeos_pipe_message_top | ( | BMessage * | message, |
BWindow * | _this, | ||
struct beos_scaffolding * | scaffold | ||
) |
Definition at line 731 of file gui.cpp.
References gui_window::scaffold, and sEventPipe.
Referenced by NSBrowserApplication::ArgvReceived(), NSBrowserWindow::DispatchMessage(), NSBaseView::MessageReceived(), NSBrowserWindow::MessageReceived(), NSBrowserFrameView::MessageReceived(), NSBrowserWindow::QuitRequested(), NSBrowserApplication::RefsReceived(), and NSBaseView::~NSBaseView().
void nsbeos_update_system_ui_colors | ( | void | ) |
Definition at line 503 of file gui.cpp.
References nsoptions, and set_defaults().
Referenced by gui_init(), nsbeos_dispatch_event(), and nsbeos_scaffolding_dispatch_event().
|
static |
Ensures output logging stream is correctly configured.
Definition at line 511 of file gui.cpp.
Referenced by gui_init_replicant(), and main().
char * realpath | ( | const char * | f, |
char * | buf | ||
) |
Definition at line 230 of file gui.cpp.
References path().
Referenced by filepath_sfinddef(), filepath_vsfindfile(), find_resource(), gemdos_realpath(), and nsgtk_setup().
|
static |
set option from pen
Definition at line 438 of file gui.cpp.
References nsoption_s::c, NOCOL, NSERROR_OK, gui_window::option, and nsoption_s::value.
Referenced by set_defaults().
|
static |
Set option defaults for framebuffer frontend.
defaults | The option table to update. |
Definition at line 468 of file gui.cpp.
References B_CONTROL_BACKGROUND_COLOR, B_CONTROL_HIGHLIGHT_COLOR, B_CONTROL_TEXT_COLOR, B_DOCUMENT_BACKGROUND_COLOR, B_DOCUMENT_TEXT_COLOR, B_TOOL_TIP_BACKGROUND_COLOR, B_TOOL_TIP_TEXT_COLOR, defaults, NOCOL, NSERROR_OK, and set_colour_from_ui().
Referenced by gui_init_replicant(), main(), and nsbeos_update_system_ui_colors().
|
static |
Definition at line 812 of file gui.cpp.
References FILE_SCHEME_PREFIX_LEN, NSERROR_OK, path(), and url_unescape().
Referenced by nsbeos_gui_view_source().
|
static |
Definition at line 986 of file gui.cpp.
Referenced by gui_init_replicant(), and main().
|
static |
Definition at line 994 of file gui.cpp.
Referenced by gui_init_replicant(), and main().
|
static |
Definition at line 108 of file gui.cpp.
Referenced by gui_init(), and NSBrowserApplication::RefsReceived().
bool nsbeos_done = false |
Definition at line 90 of file gui.cpp.
Referenced by main(), nsbeos_dispatch_event(), nsbeos_replicant_main_thread(), nsbeos_scaffolding_dispatch_event(), and nsbeos_window_destroy_event().
char* options_file_location |
Definition at line 94 of file gui.cpp.
Referenced by gui_init().
bool replicated = false |
if we are running as a replicant
Definition at line 92 of file gui.cpp.
Referenced by gui_init(), NSBaseView::Instantiate(), main(), nsbeos_new_scaffolding(), and NSBaseView::~NSBaseView().
|
static |
Definition at line 106 of file gui.cpp.
Referenced by gui_init().
struct gui_window* search_current_window = 0 |
|
static |
Definition at line 110 of file gui.cpp.
Referenced by gui_init(), nsbeos_gui_poll(), nsbeos_pipe_message(), and nsbeos_pipe_message_top().