mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-21 03:32:35 +03:00
BeOS/Haiku: improve menus management
* Embed language resources in executable, so they can be used without installing * Add a few strings we want to use * Remove most menus since they are not implemented yet Fixes http://bugs.netsurf-browser.org/mantis/view.php?id=2164
This commit is contained in:
parent
af66ed3194
commit
5546a3dbcd
@ -114,6 +114,7 @@ EXETARGET := NetSurf
|
||||
|
||||
# The filter and target for split messages
|
||||
MESSAGES_FILTER=beos
|
||||
MESSAGES_TARGET=beos/res
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Resources
|
||||
|
58
beos/gui.cpp
58
beos/gui.cpp
@ -38,6 +38,7 @@
|
||||
#include <Mime.h>
|
||||
#include <Path.h>
|
||||
#include <PathFinder.h>
|
||||
#include <Resources.h>
|
||||
#include <Roster.h>
|
||||
#include <Screen.h>
|
||||
#include <String.h>
|
||||
@ -81,8 +82,6 @@ extern "C" {
|
||||
#include "beos/scaffolding.h"
|
||||
#include "beos/bitmap.h"
|
||||
|
||||
static void *myrealloc(void *ptr, size_t len, void *pw);
|
||||
|
||||
//TODO: use resources
|
||||
// enable using resources instead of files
|
||||
#define USE_RESOURCES 1
|
||||
@ -550,7 +549,7 @@ static void gui_init(int argc, char** argv)
|
||||
#define STROF(n) #n
|
||||
#define FIND_THROB(n) filenames[(n)] = \
|
||||
"throbber/throbber" STROF(n) ".png";
|
||||
char *filenames[9];
|
||||
const char *filenames[9];
|
||||
FIND_THROB(0);
|
||||
FIND_THROB(1);
|
||||
FIND_THROB(2);
|
||||
@ -695,9 +694,7 @@ void nsbeos_pipe_message(BMessage *message, BView *_this, struct gui_window *gui
|
||||
message->AddPointer("View", _this);
|
||||
if (gui)
|
||||
message->AddPointer("gui_window", gui);
|
||||
int len = write(sEventPipe[1], &message, sizeof(void *));
|
||||
//LOG("nsbeos_pipe_message: %d written", len);
|
||||
//printf("nsbeos_pipe_message: %d written\n", len);
|
||||
write(sEventPipe[1], &message, sizeof(void *));
|
||||
}
|
||||
|
||||
|
||||
@ -711,9 +708,7 @@ void nsbeos_pipe_message_top(BMessage *message, BWindow *_this, struct beos_scaf
|
||||
message->AddPointer("Window", _this);
|
||||
if (scaffold)
|
||||
message->AddPointer("scaffolding", scaffold);
|
||||
int len = write(sEventPipe[1], &message, sizeof(void *));
|
||||
//LOG("nsbeos_pipe_message: %d written", len);
|
||||
//printf("nsbeos_pipe_message: %d written\n", len);
|
||||
write(sEventPipe[1], &message, sizeof(void *));
|
||||
}
|
||||
|
||||
|
||||
@ -952,33 +947,17 @@ void die(const char * const error)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static void nsbeos_create_ssl_verify_window(struct browser_window *bw,
|
||||
hlcache_handle *c, const struct ssl_cert_info *certs,
|
||||
unsigned long num)
|
||||
{
|
||||
CALLED();
|
||||
}
|
||||
|
||||
static void *myrealloc(void *ptr, size_t len, void *pw)
|
||||
{
|
||||
if (len == 0) {
|
||||
free(ptr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return realloc(ptr, len);
|
||||
}
|
||||
|
||||
|
||||
static struct gui_clipboard_table beos_clipboard_table = {
|
||||
gui_get_clipboard,
|
||||
gui_set_clipboard,
|
||||
};
|
||||
|
||||
static struct gui_fetch_table beos_fetch_table = {
|
||||
fetch_filetype,
|
||||
gui_get_resource_url,
|
||||
NULL //fetch_mimetype
|
||||
fetch_filetype,
|
||||
gui_get_resource_url,
|
||||
NULL, // ???
|
||||
NULL, // release_resource_data
|
||||
NULL, // fetch_mimetype
|
||||
};
|
||||
|
||||
static struct gui_browser_table beos_browser_table = {
|
||||
@ -986,7 +965,9 @@ static struct gui_browser_table beos_browser_table = {
|
||||
gui_quit,
|
||||
gui_launch_url,
|
||||
NULL, //cert_verify
|
||||
gui_401login_open
|
||||
gui_401login_open,
|
||||
NULL, // warning
|
||||
NULL, // pdf_password (if we have Haru support)
|
||||
};
|
||||
|
||||
|
||||
@ -1038,8 +1019,21 @@ int main(int argc, char** argv)
|
||||
nsoption_commandline(&argc, argv, NULL);
|
||||
|
||||
/* common initialisation */
|
||||
BPath messages = get_messages_path();
|
||||
BResources resources;
|
||||
resources.SetToImage((const void*)main);
|
||||
size_t size = 0;
|
||||
|
||||
char path[12];
|
||||
sprintf(path,"%.2s/Messages", getenv("LC_MESSAGES"));
|
||||
fprintf(stderr, "Loading messages from resource %s\n", path);
|
||||
|
||||
const uint8_t* res = (const uint8_t*)resources.LoadResource('data', path, &size);
|
||||
if (size > 0 && res != NULL) {
|
||||
ret = messages_add_from_inline(res, size);
|
||||
} else {
|
||||
BPath messages = get_messages_path();
|
||||
ret = messages_add_from_file(messages.Path());
|
||||
}
|
||||
|
||||
ret = netsurf_init(NULL);
|
||||
if (ret != NSERROR_OK) {
|
||||
|
@ -943,7 +943,6 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
|
||||
break;
|
||||
case B_NETPOSITIVE_OPEN_URL:
|
||||
{
|
||||
int32 i;
|
||||
BString url;
|
||||
if (message->FindString("be:url", &url) < B_OK)
|
||||
break;
|
||||
@ -1723,10 +1722,11 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||
menu = new BMenu(messages_get("NetSurf"));
|
||||
g->menu_bar->AddItem(menu);
|
||||
|
||||
message = new BMessage(NO_ACTION);
|
||||
item = make_menu_item("Info", message);
|
||||
message = new BMessage(B_ABOUT_REQUESTED);
|
||||
item = make_menu_item("Info", message, true);
|
||||
menu->AddItem(item);
|
||||
|
||||
#if 0
|
||||
message = new BMessage(NO_ACTION);
|
||||
item = make_menu_item("AppHelp", message);
|
||||
menu->AddItem(item);
|
||||
@ -1741,6 +1741,7 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||
message = new BMessage(CHOICES_SHOW);
|
||||
item = make_menu_item("Choices", message);
|
||||
menu->AddItem(item);
|
||||
#endif
|
||||
|
||||
message = new BMessage(APPLICATION_QUIT);
|
||||
item = make_menu_item("Quit", message, true);
|
||||
@ -1751,16 +1752,17 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||
menu = new BMenu(messages_get("Page"));
|
||||
g->menu_bar->AddItem(menu);
|
||||
|
||||
#if 0
|
||||
message = new BMessage(BROWSER_PAGE_INFO);
|
||||
item = make_menu_item("PageInfo", message);
|
||||
menu->AddItem(item);
|
||||
|
||||
message = new BMessage(BROWSER_SAVE);
|
||||
item = make_menu_item("Save", message);
|
||||
item = make_menu_item("SaveAsNS", message);
|
||||
menu->AddItem(item);
|
||||
|
||||
message = new BMessage(BROWSER_SAVE_COMPLETE);
|
||||
item = make_menu_item("SaveComp", message);
|
||||
item = make_menu_item("SaveCompNS", message);
|
||||
menu->AddItem(item);
|
||||
|
||||
submenu = new BMenu(messages_get("Export"));
|
||||
@ -1773,7 +1775,7 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||
*/
|
||||
|
||||
message = new BMessage(BROWSER_EXPORT_TEXT);
|
||||
item = make_menu_item("Text", message);
|
||||
item = make_menu_item("LinkText", message);
|
||||
submenu->AddItem(item);
|
||||
|
||||
|
||||
@ -1787,17 +1789,19 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||
|
||||
|
||||
message = new BMessage(BROWSER_PRINT);
|
||||
item = make_menu_item("Print", message);
|
||||
item = make_menu_item("PrintNS", message);
|
||||
menu->AddItem(item);
|
||||
#endif
|
||||
|
||||
message = new BMessage(BROWSER_NEW_WINDOW);
|
||||
item = make_menu_item("NewWindow", message, true);
|
||||
item = make_menu_item("NewWindowNS", message, true);
|
||||
menu->AddItem(item);
|
||||
|
||||
message = new BMessage(BROWSER_VIEW_SOURCE);
|
||||
item = make_menu_item("ViewSrc", message, true);
|
||||
menu->AddItem(item);
|
||||
|
||||
#if 0 // FIXME This is supposed to be a popup menu!
|
||||
// Object menu
|
||||
|
||||
menu = new BMenu(messages_get("Object"));
|
||||
@ -1815,6 +1819,7 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||
message = new BMessage(BROWSER_OBJECT_RELOAD);
|
||||
item = make_menu_item("ObjReload", message);
|
||||
menu->AddItem(item);
|
||||
#endif
|
||||
|
||||
// Navigate menu
|
||||
|
||||
@ -1845,6 +1850,7 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||
item = make_menu_item("Stop", message, true);
|
||||
menu->AddItem(item);
|
||||
|
||||
#if 0
|
||||
// View menu
|
||||
|
||||
menu = new BMenu(messages_get("View"));
|
||||
@ -1916,7 +1922,7 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||
submenu->AddItem(item);
|
||||
|
||||
message = new BMessage(HOTLIST_SHOW);
|
||||
item = make_menu_item("HotlistShow", message);
|
||||
item = make_menu_item("HotlistShowNS", message);
|
||||
submenu->AddItem(item);
|
||||
|
||||
|
||||
@ -1992,6 +1998,7 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||
message = new BMessage(HELP_LAUNCH_INTERACTIVE);
|
||||
item = make_menu_item("HelpInter", message);
|
||||
menu->AddItem(item);
|
||||
#endif
|
||||
|
||||
// the base view that receives the toolbar, statusbar and top-level view.
|
||||
rect = frame.OffsetToCopy(0,0);
|
||||
|
@ -56,6 +56,11 @@ de.ro.AppHelpNoShortcut:Hilfe...
|
||||
fr.ro.AppHelpNoShortcut:Aide...
|
||||
it.ro.AppHelpNoShortcut:Aiuto...
|
||||
nl.ro.AppHelpNoShortcut:Hulp...
|
||||
en.beos.AppHelp:Help...
|
||||
de.beos.AppHelp:Hilfe...
|
||||
fr.beos.AppHelp:Aide...
|
||||
it.beos.AppHelp:Aiuto...
|
||||
nl.beos.AppHelp:Hulp...
|
||||
en.ro.HotlistShowNoShortcut:Show hotlist...
|
||||
de.ro.HotlistShowNoShortcut:Hotlist zeigen...
|
||||
fr.ro.HotlistShowNoShortcut:Montrer les favoris...
|
||||
@ -162,6 +167,11 @@ de.ro.ViewSrc:Quellcode... F8
|
||||
fr.ro.ViewSrc:Voir le source... F8
|
||||
it.ro.ViewSrc:Mostra sorgente... F8
|
||||
nl.ro.ViewSrc:Toon HTML... F8
|
||||
en.beos.ViewSrc:View source...
|
||||
de.beos.ViewSrc:Quellcode...
|
||||
fr.beos.ViewSrc:Voir le source...
|
||||
it.beos.ViewSrc:Mostra sorgente...
|
||||
nl.beos.ViewSrc:Toon HTML...
|
||||
|
||||
# Main -> Page -> Export menu
|
||||
#
|
||||
@ -275,6 +285,11 @@ de.ro.Reload:Seite erneut laden ^F5
|
||||
fr.ro.Reload:Recharger cette page ^F5
|
||||
it.ro.Reload:Ricarica ^F5
|
||||
nl.ro.Reload:Laad pag. opnieuw ^F5
|
||||
en.beos.Reload:Reload this page
|
||||
de.beos.Reload:Seite erneut laden
|
||||
fr.beos.Reload:Recharger cette page
|
||||
it.beos.Reload:Ricarica
|
||||
nl.beos.Reload:Laad pag. opnieuw
|
||||
en.all.Stop:Stop loading this page
|
||||
de.all.Stop:Ladevorgang abbrechen
|
||||
fr.all.Stop:Arrêter le chargement de la page
|
||||
|
Loading…
Reference in New Issue
Block a user