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
|
# The filter and target for split messages
|
||||||
MESSAGES_FILTER=beos
|
MESSAGES_FILTER=beos
|
||||||
|
MESSAGES_TARGET=beos/res
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# Resources
|
# Resources
|
||||||
|
|
58
beos/gui.cpp
58
beos/gui.cpp
|
@ -38,6 +38,7 @@
|
||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <PathFinder.h>
|
#include <PathFinder.h>
|
||||||
|
#include <Resources.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
@ -81,8 +82,6 @@ extern "C" {
|
||||||
#include "beos/scaffolding.h"
|
#include "beos/scaffolding.h"
|
||||||
#include "beos/bitmap.h"
|
#include "beos/bitmap.h"
|
||||||
|
|
||||||
static void *myrealloc(void *ptr, size_t len, void *pw);
|
|
||||||
|
|
||||||
//TODO: use resources
|
//TODO: use resources
|
||||||
// enable using resources instead of files
|
// enable using resources instead of files
|
||||||
#define USE_RESOURCES 1
|
#define USE_RESOURCES 1
|
||||||
|
@ -550,7 +549,7 @@ static void gui_init(int argc, char** argv)
|
||||||
#define STROF(n) #n
|
#define STROF(n) #n
|
||||||
#define FIND_THROB(n) filenames[(n)] = \
|
#define FIND_THROB(n) filenames[(n)] = \
|
||||||
"throbber/throbber" STROF(n) ".png";
|
"throbber/throbber" STROF(n) ".png";
|
||||||
char *filenames[9];
|
const char *filenames[9];
|
||||||
FIND_THROB(0);
|
FIND_THROB(0);
|
||||||
FIND_THROB(1);
|
FIND_THROB(1);
|
||||||
FIND_THROB(2);
|
FIND_THROB(2);
|
||||||
|
@ -695,9 +694,7 @@ void nsbeos_pipe_message(BMessage *message, BView *_this, struct gui_window *gui
|
||||||
message->AddPointer("View", _this);
|
message->AddPointer("View", _this);
|
||||||
if (gui)
|
if (gui)
|
||||||
message->AddPointer("gui_window", gui);
|
message->AddPointer("gui_window", gui);
|
||||||
int len = write(sEventPipe[1], &message, sizeof(void *));
|
write(sEventPipe[1], &message, sizeof(void *));
|
||||||
//LOG("nsbeos_pipe_message: %d written", len);
|
|
||||||
//printf("nsbeos_pipe_message: %d written\n", len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -711,9 +708,7 @@ void nsbeos_pipe_message_top(BMessage *message, BWindow *_this, struct beos_scaf
|
||||||
message->AddPointer("Window", _this);
|
message->AddPointer("Window", _this);
|
||||||
if (scaffold)
|
if (scaffold)
|
||||||
message->AddPointer("scaffolding", scaffold);
|
message->AddPointer("scaffolding", scaffold);
|
||||||
int len = write(sEventPipe[1], &message, sizeof(void *));
|
write(sEventPipe[1], &message, sizeof(void *));
|
||||||
//LOG("nsbeos_pipe_message: %d written", len);
|
|
||||||
//printf("nsbeos_pipe_message: %d written\n", len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -952,33 +947,17 @@ void die(const char * const error)
|
||||||
exit(EXIT_FAILURE);
|
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 = {
|
static struct gui_clipboard_table beos_clipboard_table = {
|
||||||
gui_get_clipboard,
|
gui_get_clipboard,
|
||||||
gui_set_clipboard,
|
gui_set_clipboard,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct gui_fetch_table beos_fetch_table = {
|
static struct gui_fetch_table beos_fetch_table = {
|
||||||
fetch_filetype,
|
fetch_filetype,
|
||||||
gui_get_resource_url,
|
gui_get_resource_url,
|
||||||
NULL //fetch_mimetype
|
NULL, // ???
|
||||||
|
NULL, // release_resource_data
|
||||||
|
NULL, // fetch_mimetype
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct gui_browser_table beos_browser_table = {
|
static struct gui_browser_table beos_browser_table = {
|
||||||
|
@ -986,7 +965,9 @@ static struct gui_browser_table beos_browser_table = {
|
||||||
gui_quit,
|
gui_quit,
|
||||||
gui_launch_url,
|
gui_launch_url,
|
||||||
NULL, //cert_verify
|
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);
|
nsoption_commandline(&argc, argv, NULL);
|
||||||
|
|
||||||
/* common initialisation */
|
/* 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 = messages_add_from_file(messages.Path());
|
||||||
|
}
|
||||||
|
|
||||||
ret = netsurf_init(NULL);
|
ret = netsurf_init(NULL);
|
||||||
if (ret != NSERROR_OK) {
|
if (ret != NSERROR_OK) {
|
||||||
|
|
|
@ -943,7 +943,6 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
|
||||||
break;
|
break;
|
||||||
case B_NETPOSITIVE_OPEN_URL:
|
case B_NETPOSITIVE_OPEN_URL:
|
||||||
{
|
{
|
||||||
int32 i;
|
|
||||||
BString url;
|
BString url;
|
||||||
if (message->FindString("be:url", &url) < B_OK)
|
if (message->FindString("be:url", &url) < B_OK)
|
||||||
break;
|
break;
|
||||||
|
@ -1723,10 +1722,11 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||||
menu = new BMenu(messages_get("NetSurf"));
|
menu = new BMenu(messages_get("NetSurf"));
|
||||||
g->menu_bar->AddItem(menu);
|
g->menu_bar->AddItem(menu);
|
||||||
|
|
||||||
message = new BMessage(NO_ACTION);
|
message = new BMessage(B_ABOUT_REQUESTED);
|
||||||
item = make_menu_item("Info", message);
|
item = make_menu_item("Info", message, true);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
|
||||||
|
#if 0
|
||||||
message = new BMessage(NO_ACTION);
|
message = new BMessage(NO_ACTION);
|
||||||
item = make_menu_item("AppHelp", message);
|
item = make_menu_item("AppHelp", message);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
@ -1741,6 +1741,7 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||||
message = new BMessage(CHOICES_SHOW);
|
message = new BMessage(CHOICES_SHOW);
|
||||||
item = make_menu_item("Choices", message);
|
item = make_menu_item("Choices", message);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
#endif
|
||||||
|
|
||||||
message = new BMessage(APPLICATION_QUIT);
|
message = new BMessage(APPLICATION_QUIT);
|
||||||
item = make_menu_item("Quit", message, true);
|
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"));
|
menu = new BMenu(messages_get("Page"));
|
||||||
g->menu_bar->AddItem(menu);
|
g->menu_bar->AddItem(menu);
|
||||||
|
|
||||||
|
#if 0
|
||||||
message = new BMessage(BROWSER_PAGE_INFO);
|
message = new BMessage(BROWSER_PAGE_INFO);
|
||||||
item = make_menu_item("PageInfo", message);
|
item = make_menu_item("PageInfo", message);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
|
||||||
message = new BMessage(BROWSER_SAVE);
|
message = new BMessage(BROWSER_SAVE);
|
||||||
item = make_menu_item("Save", message);
|
item = make_menu_item("SaveAsNS", message);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
|
||||||
message = new BMessage(BROWSER_SAVE_COMPLETE);
|
message = new BMessage(BROWSER_SAVE_COMPLETE);
|
||||||
item = make_menu_item("SaveComp", message);
|
item = make_menu_item("SaveCompNS", message);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
|
||||||
submenu = new BMenu(messages_get("Export"));
|
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);
|
message = new BMessage(BROWSER_EXPORT_TEXT);
|
||||||
item = make_menu_item("Text", message);
|
item = make_menu_item("LinkText", message);
|
||||||
submenu->AddItem(item);
|
submenu->AddItem(item);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1787,17 +1789,19 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||||
|
|
||||||
|
|
||||||
message = new BMessage(BROWSER_PRINT);
|
message = new BMessage(BROWSER_PRINT);
|
||||||
item = make_menu_item("Print", message);
|
item = make_menu_item("PrintNS", message);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
#endif
|
||||||
|
|
||||||
message = new BMessage(BROWSER_NEW_WINDOW);
|
message = new BMessage(BROWSER_NEW_WINDOW);
|
||||||
item = make_menu_item("NewWindow", message, true);
|
item = make_menu_item("NewWindowNS", message, true);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
|
||||||
message = new BMessage(BROWSER_VIEW_SOURCE);
|
message = new BMessage(BROWSER_VIEW_SOURCE);
|
||||||
item = make_menu_item("ViewSrc", message, true);
|
item = make_menu_item("ViewSrc", message, true);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
|
||||||
|
#if 0 // FIXME This is supposed to be a popup menu!
|
||||||
// Object menu
|
// Object menu
|
||||||
|
|
||||||
menu = new BMenu(messages_get("Object"));
|
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);
|
message = new BMessage(BROWSER_OBJECT_RELOAD);
|
||||||
item = make_menu_item("ObjReload", message);
|
item = make_menu_item("ObjReload", message);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Navigate menu
|
// Navigate menu
|
||||||
|
|
||||||
|
@ -1845,6 +1850,7 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||||
item = make_menu_item("Stop", message, true);
|
item = make_menu_item("Stop", message, true);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
|
||||||
|
#if 0
|
||||||
// View menu
|
// View menu
|
||||||
|
|
||||||
menu = new BMenu(messages_get("View"));
|
menu = new BMenu(messages_get("View"));
|
||||||
|
@ -1916,7 +1922,7 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||||
submenu->AddItem(item);
|
submenu->AddItem(item);
|
||||||
|
|
||||||
message = new BMessage(HOTLIST_SHOW);
|
message = new BMessage(HOTLIST_SHOW);
|
||||||
item = make_menu_item("HotlistShow", message);
|
item = make_menu_item("HotlistShowNS", message);
|
||||||
submenu->AddItem(item);
|
submenu->AddItem(item);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1992,6 +1998,7 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||||
message = new BMessage(HELP_LAUNCH_INTERACTIVE);
|
message = new BMessage(HELP_LAUNCH_INTERACTIVE);
|
||||||
item = make_menu_item("HelpInter", message);
|
item = make_menu_item("HelpInter", message);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
#endif
|
||||||
|
|
||||||
// the base view that receives the toolbar, statusbar and top-level view.
|
// the base view that receives the toolbar, statusbar and top-level view.
|
||||||
rect = frame.OffsetToCopy(0,0);
|
rect = frame.OffsetToCopy(0,0);
|
||||||
|
|
|
@ -56,6 +56,11 @@ de.ro.AppHelpNoShortcut:Hilfe...
|
||||||
fr.ro.AppHelpNoShortcut:Aide...
|
fr.ro.AppHelpNoShortcut:Aide...
|
||||||
it.ro.AppHelpNoShortcut:Aiuto...
|
it.ro.AppHelpNoShortcut:Aiuto...
|
||||||
nl.ro.AppHelpNoShortcut:Hulp...
|
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...
|
en.ro.HotlistShowNoShortcut:Show hotlist...
|
||||||
de.ro.HotlistShowNoShortcut:Hotlist zeigen...
|
de.ro.HotlistShowNoShortcut:Hotlist zeigen...
|
||||||
fr.ro.HotlistShowNoShortcut:Montrer les favoris...
|
fr.ro.HotlistShowNoShortcut:Montrer les favoris...
|
||||||
|
@ -162,6 +167,11 @@ de.ro.ViewSrc:Quellcode... F8
|
||||||
fr.ro.ViewSrc:Voir le source... F8
|
fr.ro.ViewSrc:Voir le source... F8
|
||||||
it.ro.ViewSrc:Mostra sorgente... F8
|
it.ro.ViewSrc:Mostra sorgente... F8
|
||||||
nl.ro.ViewSrc:Toon HTML... 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
|
# Main -> Page -> Export menu
|
||||||
#
|
#
|
||||||
|
@ -275,6 +285,11 @@ de.ro.Reload:Seite erneut laden ^F5
|
||||||
fr.ro.Reload:Recharger cette page ^F5
|
fr.ro.Reload:Recharger cette page ^F5
|
||||||
it.ro.Reload:Ricarica ^F5
|
it.ro.Reload:Ricarica ^F5
|
||||||
nl.ro.Reload:Laad pag. opnieuw ^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
|
en.all.Stop:Stop loading this page
|
||||||
de.all.Stop:Ladevorgang abbrechen
|
de.all.Stop:Ladevorgang abbrechen
|
||||||
fr.all.Stop:Arrêter le chargement de la page
|
fr.all.Stop:Arrêter le chargement de la page
|
||||||
|
|
Loading…
Reference in New Issue