mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 04:26:50 +03:00
- when replicated, forbid creating windows, even though it initially works it crashes as soon as the menus are used.
- added an about box from the infos in the gtk code, still not perfect. svn path=/trunk/netsurf/; revision=5590
This commit is contained in:
parent
f74cd65518
commit
174a8dcca2
@ -68,7 +68,8 @@ S_GTK := font_pango.c gtk_bitmap.c gtk_gui.c gtk_schedule.c \
|
||||
S_GTK := $(addprefix gtk/,$(S_GTK))
|
||||
|
||||
# S_BEOS are sources purely for the BeOS build
|
||||
S_BEOS := beos_bitmap.cpp beos_fetch_rsrc.cpp beos_filetype.cpp \
|
||||
S_BEOS := beos_about.cpp beos_bitmap.cpp beos_fetch_rsrc.cpp \
|
||||
beos_filetype.cpp \
|
||||
beos_font.cpp beos_gui.cpp beos_history.cpp beos_login.cpp \
|
||||
beos_options.cpp beos_plotters.cpp beos_scaffolding.cpp \
|
||||
beos_schedule.cpp beos_thumbnail.cpp beos_treeview.cpp \
|
||||
|
145
beos/beos_about.cpp
Normal file
145
beos/beos_about.cpp
Normal file
@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright 2008 François Revol <mmu_man@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/>.
|
||||
*/
|
||||
|
||||
#define __STDBOOL_H__ 1
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
extern "C" {
|
||||
#include "utils/log.h"
|
||||
}
|
||||
#include "beos/beos_about.h"
|
||||
#include "beos/beos_scaffolding.h"
|
||||
#include "beos/beos_window.h"
|
||||
|
||||
#include <Alert.h>
|
||||
#include <ScrollView.h>
|
||||
#include <String.h>
|
||||
#include <TextView.h>
|
||||
|
||||
static const char *authors[] = {
|
||||
"John-Mark Bell", "James Bursa", "Michael Drake",
|
||||
"Rob Kendrick", "Adrian Lees", "Vincent Sanders",
|
||||
"Daniel Silverstone", "Richard Wilson",
|
||||
"\nContributors:", "Kevin Bagust", "Stefaan Claes",
|
||||
"Matthew Hambley", "Rob Jackson", "Jeffrey Lee", "Phil Mellor",
|
||||
"Philip Pemberton", "Darren Salt", "Andrew Timmins",
|
||||
"John Tytgat", "Chris Williams",
|
||||
"\nGoogle Summer of Code Contributors:", "Adam Blokus",
|
||||
"Sean Fox", "Michael Lester", "Andrew Sidwell", NULL
|
||||
};
|
||||
|
||||
static const char *translators[] = { "Sebastian Barthel", "Bruno D'Arcangeli",
|
||||
"Gerard van Katwijk", "Jérôme Mathevet", "Simon Voortman.", NULL
|
||||
};
|
||||
static const char *artists[] = {
|
||||
"Michael Drake", "\nContributors:", "Andrew Duffell",
|
||||
"John Duffell", "Richard Hallas", "Phil Mellor", NULL
|
||||
};
|
||||
|
||||
static const char *documenters[] = {
|
||||
"John-Mark Bell", "James Bursa", "Michael Drake",
|
||||
"Richard Wilson", "\nContributors:", "James Shaw", NULL
|
||||
};
|
||||
|
||||
static const char *name = "NetSurf";
|
||||
static const char *description =
|
||||
"Small as a mouse, fast as a cheetah, and available for free.\n"
|
||||
"NetSurf is a web browser for RISC OS and UNIX-like platforms.";
|
||||
static const char *url = "http://www.netsurf-browser.org/";
|
||||
static const char *url_label = "NetSurf Website";
|
||||
static const char *copyright =
|
||||
"Copyright © 2003 - 2008 The NetSurf Developers";
|
||||
|
||||
static void add_section(BTextView *textview, const char *header,
|
||||
const char *text)
|
||||
{
|
||||
BFont titleFont;
|
||||
titleFont.SetSize(titleFont.Size() + 10);
|
||||
BFont textFont;
|
||||
text_run_array titleRuns = { 1, { 0, titleFont, { 0, 0, 0, 255 } } };
|
||||
text_run_array textRuns = { 1, { 0, textFont, { 0, 0, 0, 255 } } };
|
||||
BString h(header);
|
||||
BString t(text);
|
||||
h << "\n";
|
||||
t << "\n\n";
|
||||
if (header)
|
||||
textview->Insert(h.String(), &titleRuns);
|
||||
if (text)
|
||||
textview->Insert(t.String(), &textRuns);
|
||||
}
|
||||
|
||||
static void add_section(BTextView *textview, const char *header,
|
||||
const char **texts)
|
||||
{
|
||||
BString t;
|
||||
while (*texts) {
|
||||
t << *texts;
|
||||
t << ", ";
|
||||
texts++;
|
||||
}
|
||||
add_section(textview, header, t.String());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the about alert
|
||||
*/
|
||||
void nsbeos_about(struct gui_window *gui)
|
||||
{
|
||||
BAlert *alert;
|
||||
alert = new BAlert("about", "", /*"HomePage",*/ "Ok");
|
||||
//XXX: i18n-ize
|
||||
BTextView *tv = alert->TextView();
|
||||
if (gui) {
|
||||
alert->SetFeel(B_MODAL_SUBSET_WINDOW_FEEL);
|
||||
nsbeos_scaffolding *s = nsbeos_get_scaffold(gui);
|
||||
if (s) {
|
||||
NSBrowserWindow *w = nsbeos_get_bwindow_for_scaffolding(s);
|
||||
if (w)
|
||||
alert->AddToSubset(w);
|
||||
}
|
||||
}
|
||||
tv->SetStylable(true);
|
||||
add_section(tv, name, description);
|
||||
add_section(tv, NULL, copyright);
|
||||
add_section(tv, "authors", authors);
|
||||
add_section(tv, "translators", translators);
|
||||
add_section(tv, "artists", artists);
|
||||
add_section(tv, "documenters", documenters);
|
||||
add_section(tv, url_label, url);
|
||||
#if 0
|
||||
BView *p = tv->Parent();
|
||||
//tv->MakeSelectable(true);
|
||||
|
||||
//tv->ResizeBy(-B_V_SCROLL_BAR_WIDTH, 0);
|
||||
//tv->ResizeBy(-B_V_SCROLL_BAR_WIDTH, 0);
|
||||
if (p && p->RemoveChild(tv)) {
|
||||
BScrollView *sv = new BScrollView("sv", tv, B_FOLLOW_ALL, 0,
|
||||
false, true, B_NO_BORDER);
|
||||
p->AddChild(sv);
|
||||
}
|
||||
|
||||
//tv->ResizeToPreferred();
|
||||
#endif
|
||||
// make space for controls
|
||||
alert->ResizeBy(200, 500);
|
||||
alert->MoveTo(alert->AlertPosition(alert->Frame().Width() + 1,
|
||||
alert->Frame().Height() + 1));
|
||||
|
||||
alert->Go(NULL);
|
||||
}
|
24
beos/beos_about.h
Normal file
24
beos/beos_about.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2008 François Revol <mmu_man@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/>.
|
||||
*/
|
||||
|
||||
#ifndef __BEOS_ABOUT_H__
|
||||
#define __BEOS_ABOUT_H__
|
||||
|
||||
void nsbeos_about(struct gui_window *gui);
|
||||
|
||||
#endif /* __BEOS_ABOUT_H__ */
|
@ -1612,7 +1612,13 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||
g->window = NULL;
|
||||
|
||||
|
||||
if (!replicated) {
|
||||
if (replicated && !replicant_view) {
|
||||
warn_user("Error: No subwindow allowed when replicated.", NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if (!replicant_view) {
|
||||
|
||||
BRect frame(0, 0, 600-1, 500-1);
|
||||
if (option_window_width > 0) {
|
||||
@ -1940,7 +1946,6 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||
} else { // replicant_view
|
||||
// the base view has already been created with the archive constructor
|
||||
g->top_view = replicant_view;
|
||||
replicant_view = NULL;
|
||||
}
|
||||
g->top_view->SetScaffolding(g);
|
||||
|
||||
@ -2053,7 +2058,10 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
|
||||
// will be added to the scrollview when adding the top view.
|
||||
|
||||
// notify the thread creating the replicant that we're done
|
||||
release_sem(replicant_done_sem);
|
||||
if (replicant_view)
|
||||
release_sem(replicant_done_sem);
|
||||
|
||||
replicant_view = NULL;
|
||||
|
||||
#warning XXX
|
||||
#if 0 /* GTK */
|
||||
|
@ -31,6 +31,7 @@ extern "C" {
|
||||
#include "utils/utf8.h"
|
||||
#include "utils/utils.h"
|
||||
}
|
||||
#include "beos/beos_about.h"
|
||||
#include "beos/beos_window.h"
|
||||
#include "beos/beos_font.h"
|
||||
#include "beos/beos_gui.h"
|
||||
@ -101,6 +102,8 @@ struct gui_window {
|
||||
struct gui_window *next, *prev;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static const rgb_color kWhiteColor = {255, 255, 255, 255};
|
||||
|
||||
static struct gui_window *window_list = 0; /**< first entry in win list*/
|
||||
@ -397,6 +400,8 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
} else {
|
||||
/* Now construct and attach a scaffold */
|
||||
g->scaffold = nsbeos_new_scaffolding(g);
|
||||
if (!g->scaffold)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Construct our primary elements */
|
||||
@ -688,8 +693,7 @@ void nsbeos_dispatch_event(BMessage *message)
|
||||
break;
|
||||
case B_ABOUT_REQUESTED:
|
||||
{
|
||||
//BAlert *alert;
|
||||
//XXX: i18n-ize
|
||||
nsbeos_about(gui);
|
||||
/* XXX: doesn't work yet! bug in rsrc:/
|
||||
BString url("rsrc:/about.en.html,text/html");
|
||||
browser_window_create(url.String(), NULL, NULL, true, false);
|
||||
@ -1287,6 +1291,9 @@ void nsbeos_window_destroy_browser(struct gui_window *g)
|
||||
|
||||
void gui_window_destroy(struct gui_window *g)
|
||||
{
|
||||
if (!g)
|
||||
return;
|
||||
|
||||
if (g->prev)
|
||||
g->prev->next = g->next;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user