This commit is contained in:
enn0x 2015-09-14 00:50:56 +02:00
commit b996af18dd
37 changed files with 1646 additions and 648 deletions

View File

@ -99,6 +99,9 @@ class Standalone:
if len(platforms) == 0:
Standalone.notify.warning("No platforms found to build for!")
if 'win32' in platforms and 'win_i386' in platforms:
platforms.remove('win32')
outputDir = Filename(outputDir + "/")
outputDir.makeDir()
for platform in platforms:
@ -669,6 +672,9 @@ class Installer:
if len(platforms) == 0:
Installer.notify.warning("No platforms found to build for!")
if 'win32' in platforms and 'win_i386' in platforms:
platforms.remove('win32')
outputDir = Filename(outputDir + "/")
outputDir.makeDir()
for platform in platforms:

View File

@ -137,7 +137,7 @@ class pyopengl(package):
module('OpenGL.GLU', 'OpenGL.GLUT', 'OpenGL.GLE', 'OpenGL.GLX')
class httplib2(package):
config(display_name = "httplib2")
config(display_name = "httplib2", platform_specific = False)
require('panda3d')
module('httplib2', required = True)
@ -149,7 +149,7 @@ class box2d(package):
module('Box2D', required = True)
class pyglet(package):
config(display_name = "pyglet")
require('panda3d')
config(display_name = "pyglet", platform_specific = False)
require('panda3d', 'morepy')
module('pyglet', required = True)

View File

@ -183,7 +183,7 @@ start_p3dcert() {
// These are the enviroment variables we forward from the current
// environment, if they are set.
const wchar_t *keep[] = {
L"TMP", L"TEMP", L"HOME", L"USER",
L"TMP", L"TEMP", L"HOME", L"USER",
L"SYSTEMROOT", L"USERPROFILE", L"COMSPEC",
NULL
};
@ -209,7 +209,8 @@ start_p3dcert() {
// These are the enviroment variables we forward from the current
// environment, if they are set.
const char *keep[] = {
"TMP", "TEMP", "HOME", "USER",
"TMP", "TEMP", "HOME", "USER",
"LANGUAGE", "LC_ALL", "LC_MESSAGES", "LANG",
#ifdef HAVE_X11
"DISPLAY", "XAUTHORITY",
#endif

View File

@ -13,6 +13,7 @@
////////////////////////////////////////////////////////////////////
#include "p3dCert.h"
#include "p3dCert_strings.h"
#include "wstring_encode.h"
#include "mkdir_complete.h"
@ -26,8 +27,9 @@
#include <sys/stat.h>
#include <string.h>
#include <limits.h>
#include <locale.h>
#define BUTTON_WIDTH 120
#define BUTTON_WIDTH 180 // fit the Russian text
#define BUTTON_SPACE 10
#include "ca_bundle_data_src.c"
@ -36,63 +38,152 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h>
#include <malloc.h>
#define snprintf sprintf_s
#endif
static const char
self_signed_cert_text[] =
"This Panda3D application uses a self-signed certificate. "
"This means the author's name can't be verified, and you have "
"no way of knowing for sure who wrote it.\n\n"
#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#endif
"We recommend you click Cancel to avoid running this application.";
static LanguageIndex li = LI_default;
static const char
unknown_auth_cert_text[] =
"This Panda3D application has been signed, but we don't recognize "
"the authority that verifies the signature. This means the author's "
"name can't be trusted, and you have no way of knowing "
"for sure who wrote it.\n\n"
#if defined(_WIN32)
static LanguageIndex detect_language() {
// This function was introduced in Windows Vista; it may not be available
// on older systems.
typedef BOOL (*GUPL)(DWORD, PULONG, PZZWSTR, PULONG);
GUPL pGetUserPreferredUILanguages = (GUPL)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
TEXT("GetUserPreferredUILanguages"));
if (pGetUserPreferredUILanguages != NULL) {
ULONG num_langs = 0;
ULONG buffer_size = 0;
pGetUserPreferredUILanguages(8, &num_langs, NULL, &buffer_size);
PZZWSTR buffer = (PZZWSTR)_alloca(buffer_size);
if (pGetUserPreferredUILanguages(8, &num_langs, buffer, &buffer_size)) {
for (ULONG i = 0; i < num_langs; ++i) {
size_t len = wcslen(buffer);
if (len >= 2 && (buffer[2] == 0 || buffer[2] == L'-')) {
// It may be a two-letter code; match it in our list.
for (int j = 0; j < LI_COUNT; ++j) {
const char *lang_code = language_codes[j];
if (lang_code != NULL && lang_code[0] == buffer[0] &&
lang_code[1] == buffer[1]) {
return (LanguageIndex)j;
}
}
}
buffer += len + 1;
}
}
}
"We recommend you click Cancel to avoid running this application.";
// Fall back to the old Windows XP function.
LANGID lang = GetUserDefaultUILanguage() & 0x3ff;
if (lang == 0) {
return LI_default;
}
static const char
verified_cert_text[] =
"This Panda3D application has been signed by %s. "
"If you trust %s, then click the Run button below "
"to run this application on your computer. This will also "
"automatically approve this and any other applications signed by "
"%s in the future.\n\n"
for (int i = 0; i < LI_COUNT; ++i) {
if (language_ids[i] != 0 && language_ids[i] == lang) {
return (LanguageIndex)i;
}
}
return LI_default;
}
"If you are unsure about this application, "
"you should click Cancel instead.";
#elif defined(__APPLE__)
static LanguageIndex detect_language() {
// Get and iterate through the list of preferred languages.
CFArrayRef langs = CFLocaleCopyPreferredLanguages();
CFIndex num_langs = CFArrayGetCount(langs);
static const char
expired_cert_text[] =
"This Panda3D application has been signed by %s, "
"but the certificate has expired.\n\n"
for (long i = 0; i < num_langs; ++i) {
CFStringRef lang = (CFStringRef)CFArrayGetValueAtIndex(langs, i);
"You should check the current date set on your computer's clock "
"to make sure it is correct.\n\n"
CFIndex length = CFStringGetLength(lang);
if (length < 2) {
continue;
}
"If your computer's date is correct, we recommend "
"you click Cancel to avoid running this application.";
CFIndex max_size = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8) + 1;
char *buffer = (char *)alloca(max_size);
if (!CFStringGetCString(lang, buffer, max_size, kCFStringEncodingUTF8)) {
continue;
}
static const char
generic_error_cert_text[] =
"This Panda3D application has been signed, but there is a problem "
"with the certificate (OpenSSL error code %d).\n\n"
if (isalnum(buffer[2])) {
// It's not a two-letter code.
continue;
}
"We recommend you click Cancel to avoid running this application.";
// See if we support this language.
for (int j = 0; j < LI_COUNT; ++j) {
const char *lang_code = language_codes[j];
if (lang_code != NULL && strncasecmp(buffer, lang_code, 2) == 0) {
CFRelease(langs);
return (LanguageIndex)j;
}
}
}
static const char
no_cert_text[] =
"This Panda3D application has not been signed. This means you have "
"no way of knowing for sure who wrote it.\n\n"
CFRelease(langs);
return LI_default;
}
"Click Cancel to avoid running this application.";
#else
static LanguageIndex detect_language() {
// First consult the LANGUAGE variable, which is a GNU extension that can
// contain multiple languages in order of preference.
const char *lang = getenv("LANGUAGE");
while (lang != NULL && lang[0] != 0) {
size_t len;
const char *next = strchr(lang, ':');
if (next == NULL) {
len = strlen(lang);
} else {
len = (next - lang);
++next;
}
if (len >= 2 && !isalnum(lang[2])) {
// It may be a two-letter language code; match it in our list.
for (int i = 0; i < LI_COUNT; ++i) {
const char *lang_code = language_codes[i];
if (lang_code != NULL && strncasecmp(lang, lang_code, 2) == 0) {
return (LanguageIndex)i;
}
}
}
lang = next;
}
// Fall back to the C locale functions.
setlocale(LC_ALL, "");
lang = setlocale(LC_MESSAGES, NULL);
if (lang == NULL || lang[0] == 0 || strcmp(lang, "C") == 0) {
// Try the LANG variable.
lang = getenv("LANG");
}
if (lang == NULL || strlen(lang) < 2 || isalnum(lang[2])) {
// Couldn't extract a meaningful two-letter code.
return LI_default;
}
// It may be a two-letter language code; match it in our list.
for (int i = 0; i < LI_COUNT; ++i) {
const char *lang_code = language_codes[i];
if (lang_code != NULL && strncasecmp(lang, lang_code, 2) == 0) {
return (LanguageIndex)i;
}
}
return LI_default;
}
#endif
#ifdef _WIN32
int WINAPI
@ -107,6 +198,8 @@ wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdS
return 1;
}
li = detect_language();
wstring cert_filename (argv[0]);
wstring cert_dir (argv[1]);
LocalFree(argv);
@ -126,6 +219,8 @@ int main(int argc, char **argv) {
return 1;
}
li = detect_language();
string cert_filename (argv[1]);
string cert_dir (argv[2]);
@ -148,7 +243,7 @@ AuthDialog(const wstring &cert_filename, const wstring &cert_dir) :
AuthDialog::
AuthDialog(const string &cert_filename, const string &cert_dir) :
#endif
Fl_Window(435, 242, "New Panda3D Application"),
Fl_Window(435, 242, new_application_title[li]),
_cert_dir(cert_dir)
{
_view_cert_dialog = NULL;
@ -315,12 +410,20 @@ read_cert_file(const string &cert_filename) {
#endif // _WIN32
if (fp == NULL) {
#ifdef _WIN32
wcerr << L"Couldn't read " << cert_filename.c_str() << L"\n";
#else
cerr << "Couldn't read " << cert_filename.c_str() << "\n";
#endif
return;
}
_cert = PEM_read_X509(fp, NULL, NULL, (void *)"");
if (_cert == NULL) {
#ifdef _WIN32
wcerr << L"Could not read certificate in " << cert_filename.c_str() << L".\n";
#else
cerr << "Could not read certificate in " << cert_filename.c_str() << ".\n";
#endif
fclose(fp);
return;
}
@ -510,19 +613,19 @@ layout() {
short bx = (w() - nbuttons * BUTTON_WIDTH - (nbuttons - 1) * BUTTON_SPACE) / 2;
if (_verify_result == 0 && _cert != NULL) {
Fl_Return_Button *run_button = new Fl_Return_Button(bx, next_y, BUTTON_WIDTH, 25, "Run");
Fl_Return_Button *run_button = new Fl_Return_Button(bx, next_y, BUTTON_WIDTH, 25, run_title[li]);
run_button->callback(this->run_clicked, this);
bx += BUTTON_WIDTH + BUTTON_SPACE;
}
if (_cert != NULL) {
Fl_Button *view_button = new Fl_Button(bx, next_y, BUTTON_WIDTH, 25, "View Certificate");
Fl_Button *view_button = new Fl_Button(bx, next_y, BUTTON_WIDTH, 25, show_cert_title[li]);
view_button->callback(this->view_cert_clicked, this);
bx += BUTTON_WIDTH + BUTTON_SPACE;
}
Fl_Button *cancel_button;
cancel_button = new Fl_Button(bx, next_y, BUTTON_WIDTH, 25, "Cancel");
cancel_button = new Fl_Button(bx, next_y, BUTTON_WIDTH, 25, cancel_title[li]);
cancel_button->callback(this->cancel_clicked, this);
next_y += 42;
@ -542,12 +645,12 @@ void AuthDialog::
get_text(char *header, size_t hlen, char *text, size_t tlen) {
switch (_verify_result) {
case -1:
strncpy(header, "No signature!", hlen);
strncpy(text, no_cert_text, tlen);
strncpy(header, no_cert_title[li], hlen);
strncpy(text, no_cert_text[li], tlen);
break;
case 0:
snprintf(text, tlen, verified_cert_text, _friendly_name.c_str(),
snprintf(text, tlen, verified_cert_text[li], _friendly_name.c_str(),
_friendly_name.c_str(), _friendly_name.c_str());
break;
@ -555,24 +658,24 @@ get_text(char *header, size_t hlen, char *text, size_t tlen) {
case X509_V_ERR_CERT_HAS_EXPIRED:
case X509_V_ERR_CRL_NOT_YET_VALID:
case X509_V_ERR_CRL_HAS_EXPIRED:
strncpy(header, "Expired signature!", hlen);
snprintf(text, tlen, expired_cert_text, _friendly_name.c_str());
strncpy(header, expired_cert_title[li], hlen);
snprintf(text, tlen, expired_cert_text[li], _friendly_name.c_str());
break;
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
strncpy(header, "Unverified signature!", hlen);
snprintf(text, tlen, unknown_auth_cert_text);
strncpy(header, unverified_cert_title[li], hlen);
strncpy(text, unknown_auth_cert_text[li], tlen);
break;
case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
strncpy(header, "Unverified signature!", hlen);
strncpy(text, self_signed_cert_text, tlen);
strncpy(header, unverified_cert_title[li], hlen);
strncpy(text, self_signed_cert_text[li], tlen);
break;
default:
strncpy(header, "Unverified signature!", hlen);
snprintf(text, tlen, generic_error_cert_text, _verify_result);
strncpy(header, unverified_cert_title[li], hlen);
snprintf(text, tlen, generic_error_cert_text[li], _verify_result);
}
}
@ -583,7 +686,7 @@ get_text(char *header, size_t hlen, char *text, size_t tlen) {
////////////////////////////////////////////////////////////////////
ViewCertDialog::
ViewCertDialog(AuthDialog *auth_dialog, X509 *cert) :
Fl_Window(600, 400, "View Certificate"),
Fl_Window(600, 400, show_cert_title[li]),
_auth_dialog(auth_dialog),
_cert(cert)
{
@ -660,12 +763,12 @@ layout() {
short bx = (w() - BUTTON_WIDTH * 2 - BUTTON_SPACE) / 2;
Fl_Return_Button *run_button = new Fl_Return_Button(bx, 360, BUTTON_WIDTH, 25, "Run");
Fl_Return_Button *run_button = new Fl_Return_Button(bx, 360, BUTTON_WIDTH, 25, run_title[li]);
run_button->callback(this->run_clicked, this);
bx += BUTTON_WIDTH + BUTTON_SPACE;
Fl_Button *cancel_button = new Fl_Button(bx, 360, BUTTON_WIDTH, 25, "Cancel");
Fl_Button *cancel_button = new Fl_Button(bx, 360, BUTTON_WIDTH, 25, cancel_title[li]);
cancel_button->callback(this->cancel_clicked, this);
end();

View File

@ -92,9 +92,9 @@ private:
X509 *_cert;
STACK_OF(X509) *_stack;
char _header[32];
char _text[512];
char _text_clean[1024];
char _header[64];
char _text[1024];
char _text_clean[2048];
string _friendly_name;
int _verify_result;

View File

@ -0,0 +1,571 @@
// Filename: p3dCert_strings.h
// Created by: rdb (25Mar15)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#include "p3dCert_strings.h"
// Translations kindly provided by:
// eng: drwr
// nld: rdb
// deu: Sebastian Hoffmann <TheCheapestPixels at googlemail dot com>
// spa: Imanol Celaya <imanol at celaya dot me>
// ita: Flavio Clava
// rus: montreal
const char *language_codes[LI_COUNT] =
{"en", "nl", "de", "es", "it", "eo", "ru"};
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd318693%28v=vs.85%29.aspx
const unsigned char language_ids[LI_COUNT] =
{0x09, 0x13, 0x07, 0x0A, 0x10, 0x8F, 0x19};
const char *
run_title[LI_COUNT] = {
"Run",
"Uitvoeren",
"Starten",
"Ejecutar",
"Lancia",
"Lan\304\211i",
"\320\227\320\260\320\277\321\203\321\201\321\202\320\270\321\202\321\214",
};
const char *
cancel_title[LI_COUNT] = {
"Cancel",
"Annuleren",
"Abbrechen",
"Cancelar",
"Cancella",
"Nuligi",
"\320\236\321\202\320\274\320\265\320\275\320\260",
};
const char *
show_cert_title[LI_COUNT] = {
"Show Certificate",
"Toon Certificaat",
"Zertifikat anzeigen",
"Mostrar certificado",
"Mostra certificato",
"Montri Ateston",
"\320\237\320\276\320\272\320\260\320\267\320\260\321\202\321\214 \321\201"
"\320\265\321\200\321\202\320\270\321\204\320\270\320\272\320\260\321\202",
};
const char *
new_application_title[LI_COUNT] = {
"New Panda3D Application",
"Nieuwe Panda3D Applicatie",
"Neue Panda3D-Anwendung",
"Nueva aplicaci\303\263n de Panda3D",
"Nuova applicazione Panda3D",
"Nova aplika\304\265o de Panda3D",
"\320\235\320\276\320\262\320\276\320\265 Panda3D-\320\277\321\200\320\270"
"\320\273\320\276\320\266\320\265\320\275\320\270\320\265",
};
const char *
no_cert_title[LI_COUNT] = {
"No signature!",
"Geen handtekening!",
"Keine Signatur!",
"Sin firma!",
"Nessuna firma!",
"Ne subskribo!",
"\320\235\320\265\321\202 \320\277\320\276\320\264\320\277\320\270\321\201"
"\320\270!",
};
const char *
unverified_cert_title[LI_COUNT] = {
"Unverified signature!",
"Ongeverifieerde handtekening!",
"Unbest\303\244tigte Signatur!",
"Firma sin verificar!",
"Firma non verificata!",
"Nekontrolita subskribo!",
"\320\235\320\265\320\277\321\200\320\276\320\262\320\265\321\200\320\265"
"\320\275\320\275\320\260\321\217 \320\277\320\276\320\264\320\277\320\270"
"\321\201\321\214!",
};
const char *
expired_cert_title[LI_COUNT] = {
"Expired signature!",
"Verlopen handtekening!",
"Abgelaufene Signatur!",
"Firma caducada!",
"Firma scaduta!",
"Eksvalidi\304\235inta subskribo!",
"\320\241\321\200\320\276\320\272 \320\264\320\265\320\271\321\201\321\202"
"\320\262\320\270\321\217 \320\277\320\276\320\264\320\277\320\270\321\201"
"\320\270 \320\270\321\201\321\202\321\221\320\272!",
};
const char *
self_signed_cert_text[LI_COUNT] = {
// eng
"This Panda3D application uses a self-signed certificate. "
"This means the author's name can't be verified, and you have "
"no way of knowing for sure who wrote it.\n"
"\n"
"We recommend you click Cancel to avoid running this application.",
// nld
"Deze Panda3D applicatie gebruikt een zelf-getekend certificaat. "
"Dit betekent dat de auteursnaam niet kan worden geverifieerd, en het "
"niet zeker is of de applicatie te vertrouwen is.\n"
"\n"
"Het is aanbevolen om op Annuleren te klikken om de applicatie af te "
"sluiten.",
// deu
"Diese Panda3D-Anwendung benutzt ein selbst-signiertes Zertifikat. Dies "
"bedeutet, dass weder der Name des Autors \303\274berpr\303\274ft werden "
"kann, noch dass garantiert werden kann, dass tats\303\244chlich die "
"angegebene Person diese Anwendung geschrieben hat.\n"
"\n"
"Wir empfehlen, dass Sie Abbrechen dr\303\274cken um diese Anwendung nicht "
"auszuf\303\274hren.",
// spa
"Esta aplicaci\303\263n de Panda3D usa un certificado autofirmado. "
"Esto significa que el nombre del autor no puede ser verificado y no se "
"puede conocer seguro quien la ha escrito.\n"
"\n"
"Se recomienda cancelar para evitar ejecutar esta aplicaci\303\263n.",
// ita
"Questa applicazione Panda3D usa un certificato autofirmato. Ci\303\262 "
"significa che il nome dell'autore non pu\303\262 essere verificato, e "
"che non hai modo di assicurarti circa chi la abbia scritta.\n"
"\n"
"Raccomandiamo di cliccare su Cancella per evitare di lanciare questa "
"applicazione.",
// epo
"\304\210i tiu aplika\304\265o de Panda3D uzas memsubskribitan ateston. "
"Tio signifas ke la nomo de la verkanto ne povas esti kontrolita, kaj vi "
"ne havas certan scimanieron pri la vera verkanto de la aplika\304\265o.\n"
"\n"
"Ni rekomendas ke vi premas la butonon 'Nuligi' por eviti lan\304\211on de "
"\304\211i tiu aplika\304\265o.",
// rus
"\320\255\321\202\320\276 \320\277\321\200\320\270\320\273\320\276\320\266"
"\320\265\320\275\320\270\320\265 \320\270\321\201\320\277\320\276\320\273"
"\321\214\320\267\321\203\320\265\321\202 \321\201\320\260\320\274\320\276"
"\320\267\320\260\320\262\320\265\321\200\320\265\320\275\320\275\321\213"
"\320\271 \321\201\320\265\321\200\321\202\320\270\321\204\320\270\320\272"
"\320\260\321\202. \320\255\321\202\320\276 \320\276\320\267\320\275"
"\320\260\321\207\320\260\320\265\321\202, \321\207\321\202\320\276 "
"\320\270\320\274\321\217 \320\260\320\262\321\202\320\276\321\200\320\260 "
"\320\275\320\265 \320\274\320\276\320\266\320\265\321\202 \320\261\321\213"
"\321\202\321\214 \320\277\320\276\320\264\321\202\320\262\320\265\320\266"
"\320\264\320\265\320\275\320\276, \320\270 \320\262\321\213 \320\275"
"\320\265 \320\274\320\276\320\266\320\265\321\202\320\265 \320\267\320\275"
"\320\260\321\202\321\214, \320\272\321\202\320\276 \320\275\320\260"
"\320\277\320\270\321\201\320\260\320\273 \321\215\321\202\320\276 \320\277"
"\321\200\320\270\320\273\320\276\320\266\320\265\320\275\320\270\320\265.\n"
"\n"
"\320\234\321\213 \321\200\320\265\320\272\320\276\320\274\320\265\320\275"
"\320\264\321\203\320\265\320\274 \320\262\320\260\320\274 \320\275\320\260"
"\320\266\320\260\321\202\321\214 \"\320\236\321\202\320\274\320\265"
"\320\275\320\260\" \320\270 \320\275\320\265 \320\267\320\260\320\277"
"\321\203\321\201\320\272\320\260\321\202\321\214 \321\215\321\202\320\276 "
"\320\277\321\200\320\270\320\273\320\276\320\266\320\265\320\275\320\270"
"\320\265.",
};
const char *
unknown_auth_cert_text[LI_COUNT] = {
"This Panda3D application has been signed, but we don't recognize "
"the authority that verifies the signature. This means the author's "
"name can't be verified, and you have no way of knowing "
"for sure who wrote it.\n"
"\n"
"We recommend you click Cancel to avoid running this application.",
// nld
"Deze Panda3D applicatie is ondertekend, maar de certificaatautoriteit "
"die het certificaat heeft uitgegeven wordt niet herkend. Dit betekent "
"dat de auteursnaam niet te vertrouwen is, en het niet zeker is wie de "
"applicatie gemaakt heeft.\n"
"\n"
"Het is aanbevolen om op Annuleren te klikken om de applicatie af te "
"sluiten.",
// deu
"Diese Panda3D-Anwendung wurde signiert, aber die "
"\303\234berpr\303\274fungsstelle wurde nicht anerkannt. Dies bedeutet, "
"dass weder der Name des Autors \303\274berpr\303\274ft werden kann, noch "
"dass garantiert werden kann, dass tats\303\244chlich die angegebene "
"Person diese Anwendung geschrieben hat.\n"
"\n"
"Wir empfehlen, dass Sie Abbrechen dr\303\274cken um diese Anwendung nicht "
"auszuf\303\274hren.",
// spa
"Esta aplicaci\303\263n de Panda3D esta firmada, pero no reconocemos la "
"autoridad que la verifica. Esto significa que el nombre del autor no "
"puede ser verificado y no se puede conocer seguro quien la ha escrito.\n"
"\n"
"Se recomienda cancelar para evitar ejecutar esta aplicaci\303\263n.",
// ita
"Questa applicazione Panda3D \303\250 stata firmata, ma non riconosciamo "
"l'autorit\303\240 che verifica la firma. Ci\303\262 significa che il "
"nome dell'autore non pu\303\262 essere verificato, e che non hai modo "
"di assicurarti circa chi la abbia scritta.\n"
"\n"
"Raccomandiamo di cliccare su Cancella per evitare di lanciare questa "
"applicazione.",
// epo
"\304\210i tiu aplika\304\265o estas subskribita, sed ni ne rekonas "
"la a\305\255toritaton, kiu kontrolas la subskribon. Tio signifas ke la "
"nomo de la verkanto ne povas esti konfidata, kaj vi ne havas certan "
"scimanieron pri la vera verkanto de la aplika\304\265o.\n"
"\n"
"Ni rekomendas ke vi premas la butonon 'Nuligi' por eviti lan\304\211on "
"de \304\211i tiu aplika\304\265o.",
// rus
"\320\243 \321\215\321\202\320\276\320\263\320\276 \320\277\321\200\320\270"
"\320\273\320\276\320\266\320\265\320\275\320\270\321\217 \320\265\321\201"
"\321\202\321\214 \320\277\320\276\320\264\320\277\320\270\321\201\321\214,"
" \320\277\320\276 \320\272\320\276\321\202\320\276\321\200\320\276\320\271"
" \320\274\321\213 \320\275\320\265 \320\274\320\276\320\266\320\265"
"\320\274 \321\200\320\260\321\201\320\277\320\276\320\267\320\275\320\260"
"\321\202\321\214 \320\262\320\273\320\260\320\264\320\265\320\273\321\214"
"\321\206\320\260. \320\255\321\202\320\276 \320\276\320\267\320\275"
"\320\260\321\207\320\260\320\265\321\202, \321\207\321\202\320\276 "
"\320\270\320\274\321\217 \320\260\320\262\321\202\320\276\321\200\320\260 "
"\320\275\320\265 \320\274\320\276\320\266\320\265\321\202 \320\261\321\213"
"\321\202\321\214 \320\276\320\277\321\200\320\265\320\264\320\265\320\273"
"\320\265\320\275\320\276, \320\270 \320\275\320\265\320\262\320\276"
"\320\267\320\274\320\276\320\266\320\275\320\276 \321\202\320\276\321\207"
"\320\275\320\276 \321\203\320\267\320\275\320\260\321\202\321\214, "
"\320\272\321\202\320\276 \320\275\320\260\320\277\320\270\321\201\320\260"
"\320\273 \321\215\321\202\320\276 \320\277\321\200\320\270\320\273\320\276"
"\320\266\320\265\320\275\320\270\320\265.\n"
"\n"
"\320\234\321\213 \321\200\320\265\320\272\320\276\320\274\320\265\320\275"
"\320\264\321\203\320\265\320\274 \320\262\320\260\320\274 \320\275\320\260"
"\320\266\320\260\321\202\321\214 \"\320\236\321\202\320\274\320\265"
"\320\275\320\260\" \320\270 \320\275\320\265 \320\267\320\260\320\277"
"\321\203\321\201\320\272\320\260\321\202\321\214 \321\215\321\202\320\276 "
"\320\277\321\200\320\270\320\273\320\276\320\266\320\265\320\275\320\270"
"\320\265.",
};
const char *
verified_cert_text[LI_COUNT] = {
// eng
"This Panda3D application has been signed by %s. "
"If you trust %s, then click the Run button below "
"to run this application on your computer. This will also "
"automatically approve this and any other applications signed by "
"%s in the future.\n"
"\n"
"If you are unsure about this application, "
"you should click Cancel instead.",
// nld
"Deze Panda3D applicatie is ondertekend door %s. "
"Als u %s vertrouwt, klik dan de onderstaande knop Uitvoeren om de applicatie "
"op uw computer uit te voeren. Dit zal ook deze en andere door %s getekende "
"applicaties in het vervolg toestaan.\n"
"\n"
"Als u niet zeker bent over deze applicatie is het aanbevolen om op "
"Annuleren te klikken.",
// deu
"Diese Panda3D-Anwendung wurde von %s signiert. Falls Sie %s vertrauen, "
"dr\303\274cken Sie den Starten-Knopf, um diese Anwendung auszuf\303\274hren. "
"Zudem werden in der Zukunft diese und alle anderen von %s signierten "
"Anwendungen automatisch als vertrauensw\303\274rdig anerkannt.\n"
"\n"
"Falls Sie sich unsicher \303\274ber diese Anwendung sind, sollten Sie "
"Abbrechen dr\303\274cken.",
// spa
"Esta aplicaci\303\263n de Panda3D ha sido firmada por %s. Si se considera %s"
"de confianza el bot\303\263n inferior ejecutar\303\241 la aplicaci\303\263n."
"Esto validara esta y cualquier otra applizacion firmada por %s en el futuro.\n"
"\n"
"Si se duda de la aplicaci\303\263nse recomienda cancelar."
// ita
"Questa applicazione Panda3D \303\250 stata firmata da %s. Se %s \303\250 "
"un'entit\303\240 fidata, allora clicca il bottone Lancia sottostante per "
"lanciare questa applicazione sul tuo computer. Inoltre, ci\303\262 "
"approver\303\240 automaticamente questa e ogni altra applicazione "
"firmata da %s in futuro.\n"
"\n"
"Se non sei sicuro circa questa applicazione, dovresti invece cliccare "
"su Cancella.",
// epo
"\304\210i tiu aplika\304\265o estas subskribita de %s. "
"Se %s estas fidinda la\305\255 vi, premu la butonon 'Lan\304\211i' sube por "
"lan\304\211i \304\211i tiun aplika\304\265on per via komputilo. Anka\305\255 "
"tio a\305\255tomate estonece aprobos \304\211i tiun kaj alian ajn "
"aplika\304\265on, kiu estas subskribita de %s.\n"
"\n"
"Se vi ne estas certa pri \304\211i tiu aplika\304\265o, "
"vi anstata\305\255e povus premi la butonon 'Nuligi'.",
// rus
"\320\255\321\202\320\276 \320\277\321\200\320\270\320\273\320\276\320\266"
"\320\265\320\275\320\270\320\265 \320\277\320\276\320\264\320\277\320\270"
"\321\201\320\260\320\275\320\276 %s. "
"\320\225\321\201\320\273\320\270 \320\262\321\213 \320\264\320\276\320\262"
"\320\265\321\200\321\217\320\265\321\202\320\265 %s, \320\275\320\260"
"\320\266\320\274\320\270\321\202\320\265 \320\272\320\275\320\276\320\277"
"\320\272\321\203 \"\320\227\320\260\320\277\321\203\321\201\321\202"
"\320\270\321\202\321\214\" \320\262\320\275\320\270\320\267\321\203, "
"\321\207\321\202\320\276\320\261\321\213 \320\267\320\260\320\277\321\203"
"\321\201\321\202\320\270\321\202\321\214 \321\215\321\202\320\276 \320\277"
"\321\200\320\270\320\273\320\276\320\266\320\265\320\275\320\270\320\265 "
"\320\275\320\260 \320\262\320\260\321\210\320\265\320\274 \320\272\320\276"
"\320\274\320\277\321\214\321\216\321\202\320\265\321\200\320\265. \320\255"
"\321\202\320\276 \321\202\320\260\320\272\320\266\320\265 \320\260\320\262"
"\321\202\320\276\320\274\320\260\321\202\320\270\321\207\320\265\321\201"
"\320\272\320\270 \320\277\320\276\320\264\321\202\320\262\320\265\321\200"
"\320\264\320\270\321\202 \321\215\321\202\320\276 \320\270 \320\264"
"\321\200\321\203\320\263\320\270\320\265 \320\277\321\200\320\270\320\273"
"\320\276\320\266\320\265\320\275\320\270\321\217, \320\275\320\260\320\277"
"\320\270\321\201\320\260\320\275\320\275\321\213\320\265 %s \320\262 "
"\320\261\321\203\320\264\321\203\321\211\320\265\320\274.\n"
"\n"
"\320\225\321\201\320\273\320\270 \320\262\321\213 \320\275\320\265 "
"\321\203\320\262\320\265\321\200\320\265\320\275\321\213 \320\262 \321\215"
"\321\202\320\276\320\274 \320\277\321\200\320\270\320\273\320\276\320\266"
"\320\265\320\275\320\270\320\270, \320\275\320\260\320\266\320\274\320\270"
"\321\202\320\265 \320\272\320\275\320\276\320\277\320\272\321\203 \""
"\320\236\321\202\320\274\320\265\320\275\320\260\".",
};
const char *
expired_cert_text[LI_COUNT] = {
// eng
"This Panda3D application has been signed by %s, "
"but the certificate has expired.\n"
"\n"
"You should check the current date set on your computer's clock "
"to make sure it is correct.\n"
"\n"
"If your computer's date is correct, we recommend "
"you click Cancel to avoid running this application.",
// nld
"Deze Panda3D applicatie is ondertekend door %s, maar de geldigheidsdatum "
"van het certificaat is verstreken.\n"
"\n"
"Controleer de datum op uw computerklok om te zorgen dat deze juist is "
"ingesteld.\n"
"\n"
"Als de datum op uw computer juist is, is het aanbevolen om op Annuleren te "
"klikken om de applicatie af te sluiten.",
// deu
"Diese Anwendung wurde von %s signiert, aber das Zertifikat ist abgelaufen.\n"
"\n"
"Sie sollten die aktuelle Uhrzeit auf Ihrem Computer "
"\303\274berpr\303\274fen, um sicherzugehen, dass sie korrekt ist.\n"
"\n"
"Falls die Uhrzeit auf Ihrem Computer korrekt ist, empfehlen wir Ihnen "
"Abbrechen zu dr\303\274cken.",
// spa
"Esta aplicaci\303\263n Panda3D ha sido firmada por %s pero el certificado ha"
"caducado.\n"
"\n"
"Se recomienda comprobar la fecha del reloj.\n"
"\n"
"Si la fecha del reloj es correcta se recomienda cancelar.",
// ita
"Questa applicazione Panda3D \303\250 stata firmata da %s, ma il "
"certificato \303\250 scaduto.\n"
"\n"
"Dovresti controllare la data attuale impostata nell'orologio del tuo "
"computer per assicurarti che sia corretta.\n"
"\n"
"Se la data del tuo computer \303\250 corretta, raccomandiamo di cliccare "
"Cancella per evitare di lanciare questa applicazione."
// epo
"\304\210i tiu aplika\304\265o de Panda3D estas subskribita de %s, "
"sed la atesto eksvalidi\304\235is.\n"
"\n"
"Vi povus kontroli la aktualan daton, kiu estas agordata sur la horlo\304\235o de "
"via komputilo por certigi ke \304\235i estas korekta.\n"
"\n"
"Se la dato de via komputilo estas korekta, ni rekomendas ke vi premas la "
"butonon 'Nuligi' por eviti lan\304\211on de \304\211i tiu aplika\304\265o.",
// rus
"\320\255\321\202\320\276 \320\277\321\200\320\270\320\273\320\276\320\266"
"\320\265\320\275\320\270\320\265 \320\277\320\276\320\264\320\277\320\270"
"\321\201\320\260\320\275\320\276 %s, \320\276\320\264\320\275\320\260"
"\320\272\320\276 \321\201\321\200\320\276\320\272 \320\264\320\265\320\271"
"\321\201\321\202\320\262\320\270\321\217 \321\201\320\265\321\200\321\202"
"\320\270\321\204\320\270\320\272\320\260\321\202\320\260 \320\270\321\201"
"\321\202\321\221\320\272.\n"
"\n"
"\320\237\321\200\320\276\320\262\320\265\321\200\321\214\321\202\320\265, "
"\320\277\320\276\320\266\320\260\320\273\321\203\320\271\321\201\321\202"
"\320\260, \320\264\320\260\321\202\321\203 \320\275\320\260 \320\262"
"\320\260\321\210\320\265\320\274 \320\272\320\276\320\274\320\277\321\214"
"\321\216\321\202\320\265\321\200\320\265.\n"
"\n"
"\320\225\321\201\320\273\320\270 \320\275\320\260 \320\262\320\260\321\210"
"\320\265\320\274 \320\272\320\276\320\274\320\277\321\214\321\216\321\202"
"\320\265\321\200\320\265 \321\203\321\201\321\202\320\260\320\275\320\276"
"\320\262\320\273\320\265\320\275\320\276 \320\277\321\200\320\260\320\262"
"\320\270\320\273\321\214\320\275\320\276\320\265 \320\262\321\200\320\265"
"\320\274\321\217, \320\274\321\213 \321\200\320\265\320\272\320\276"
"\320\274\320\265\320\275\320\264\321\203\320\265\320\274 \320\262\320\260"
"\320\274 \320\275\320\260\320\266\320\260\321\202\321\214 \320\272\320\275"
"\320\276\320\277\320\272\321\203 \"\320\236\321\202\320\274\320\265"
"\320\275\320\260\" \320\270 \320\275\320\265 \320\267\320\260\320\277"
"\321\203\321\201\320\272\320\260\321\202\321\214 \321\215\321\202\320\276 "
"\320\277\321\200\320\270\320\273\320\276\320\266\320\265\320\275\320\270"
"\320\265.",
};
const char *
generic_error_cert_text[LI_COUNT] = {
// eng
"This Panda3D application has been signed, but there is a problem "
"with the certificate (OpenSSL error code %d).\n"
"\n"
"We recommend you click Cancel to avoid running this application.",
// nld
"Deze Panda3D applicatie is ondertekend, maar er is een probleem "
"met het certificaat opgetreden (OpenSSL foutcode %d).\n"
"\n"
"Het is aanbevolen om op Annuleren te klikken om de applicatie af te "
"sluiten.",
// deu
"Diese Panda3D-Anwendung wurde signiert, aber es gibt ein Problem mit "
"dem Zertifikat (OpenSSL Fehlercode %d).\n"
"\n"
"Wir empfehlen, dass Sie Abbrechen dr\303\274cken um diese Anwendung nicht "
"auszuf\303\274hren.",
// spa
"Esta aplicaci\303\263n de Panda3D esta firmada pero hay un problema con el "
"certificado (Error de OpenSSL %d).\n"
"\n"
"Se recomienda cancelar para evitar ejecutar esta aplicaci\303\263n.",
// ita
"Questa applicazione Panda3D \303\250 stata firmata, ma c'\303\250 un "
"problema col certificato (codice di errore OpenSSL %s).\n"
"\n"
"Raccomandiamo di cliccare su Cancella per evitare di lanciare questa "
"applicazione.",
// epo
"\304\210i tiu aplika\304\265o de Panda3D estas subskribita, sed la "
"atesto havas problemon (OpenSSL erarkodo %d).\n"
"\n"
"Ni rekomendas ke vi premas la butonon 'Nuligi' por eviti lan\304\211on "
"de \304\211i tiu aplika\304\265o.",
// rus
"\320\243 \321\215\321\202\320\276\320\263\320\276 \320\277\321\200\320\270"
"\320\273\320\276\320\266\320\265\320\275\320\270\321\217 \320\265\321\201"
"\321\202\321\214 \320\277\320\276\320\264\320\277\320\270\321\201\321\214,"
" \320\275\320\276 \320\262\320\276\320\267\320\275\320\270\320\272\320\273"
"\320\260 \320\277\321\200\320\276\320\261\320\273\320\265\320\274\320\260 "
"\321\201 \321\201\320\265\321\200\321\202\320\270\321\204\320\270\320\272"
"\320\260\321\202\320\276\320\274 (\320\232\320\276\320\264 \320\276"
"\321\210\320\270\320\261\320\272\320\270 OpenSSL %d).\n"
"\n"
"\320\234\321\213 \321\200\320\265\320\272\320\276\320\274\320\265\320\275"
"\320\264\321\203\320\265\320\274 \320\262\320\260\320\274 \320\275\320\260"
"\320\266\320\260\321\202\321\214 \"\320\236\321\202\320\274\320\265"
"\320\275\320\260\" \320\270 \320\275\320\265 \320\267\320\260\320\277"
"\321\203\321\201\320\272\320\260\321\202\321\214 \321\215\321\202\320\276 "
"\320\277\321\200\320\270\320\273\320\276\320\266\320\265\320\275\320\270"
"\320\265.",
};
const char *
no_cert_text[LI_COUNT] = {
"This Panda3D application has not been signed. This means you have "
"no way of knowing for sure who wrote it.\n"
"\n"
"Click Cancel to avoid running this application.",
// nld
"Deze Panda3D applicatie is niet ondertekend. Dit betekent dat het niet "
"mogelijk is om de auteur te verifi\303\253ren.\n"
"\n"
"Klik op Annuleren om de applicatie af te sluiten.",
// deu
"Diese Panda3D-Anwendung wurde nicht signiert. Es gibt keine "
"M\303\266glichkeit festzustellen, wer diese entwickelt hat.\n"
"\n"
"Dr\303\274cken Sie Abbrechen, um diese Anwendung nicht auszuf\303\274hren.",
// spa
"Esta aplicaci\303\263n de Panda3D no esta firmada, no hay forma de conocer "
"quien la ha escrito.\n"
"\n"
"Cancelar para evitar ejecutar la aplicaci\303\263n.",
// ita
"Questa applicazione Panda3D non \303\250 stata firmata. Ci\303\262 "
"significa che non hai modo di assicurarti circa chi la abbia scritta.\n"
"\n"
"Clicca Cancella per evitare di lanciare questa applicazione.",
// epo
"\304\210i tiu aplika\304\265o de Panda3D ne estas subskribita. Tio "
"signifas ke vi ne havas certan scimanieron pri la vera verkanto de "
"la aplika\304\265o.\n"
"\n"
"Premu la butonon 'Nuligi' por eviti lan\304\211on de \304\211i tiu "
"aplika\304\265o.",
// rus
"\320\243 \321\215\321\202\320\276\320\263\320\276 \320\277\321\200\320\270"
"\320\273\320\276\320\266\320\265\320\275\320\270\321\217 \320\275\320\265"
"\321\202 \320\277\320\276\320\264\320\277\320\270\321\201\320\270. "
"\320\255\321\202\320\276 \320\276\320\267\320\275\320\260\321\207\320\260"
"\320\265\321\202, \321\207\321\202\320\276 \320\262\321\213 \320\275"
"\320\265 \320\274\320\276\320\266\320\265\321\202\320\265 \320\267\320\275"
"\320\260\321\202\321\214, \320\272\321\202\320\276 \320\265\320\263"
"\320\276 \320\275\320\260\320\277\320\270\321\201\320\260\320\273.\n"
"\n"
"\320\235\320\260\320\266\320\274\320\270\321\202\320\265 \"\320\236"
"\321\202\320\274\320\265\320\275\320\260\", \321\207\321\202\320\276"
"\320\261\321\213 \320\275\320\265 \320\267\320\260\320\277\321\203\321\201"
"\320\272\320\260\321\202\321\214 \320\277\321\200\320\270\320\273\320\276"
"\320\266\320\265\320\275\320\270\320\265.",
};

View File

@ -0,0 +1,45 @@
// Filename: p3dCert_strings.h
// Created by: rdb (25Mar15)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
enum LanguageIndex {
LI_en, // English
LI_nl, // Dutch
LI_de, // German
LI_es, // Spanish
LI_it, // Italian
LI_eo, // Esperanto
LI_ru, // Russian
LI_COUNT,
LI_default = LI_en
};
extern const char *language_codes[LI_COUNT];
extern const unsigned char language_ids[LI_COUNT];
extern const char *run_title[LI_COUNT];
extern const char *cancel_title[LI_COUNT];
extern const char *show_cert_title[LI_COUNT];
extern const char *new_application_title[LI_COUNT];
extern const char *no_cert_title[LI_COUNT];
extern const char *unverified_cert_title[LI_COUNT];
extern const char *expired_cert_title[LI_COUNT];
extern const char *self_signed_cert_text[LI_COUNT];
extern const char *unknown_auth_cert_text[LI_COUNT];
extern const char *verified_cert_text[LI_COUNT];
extern const char *expired_cert_text[LI_COUNT];
extern const char *generic_error_cert_text[LI_COUNT];
extern const char *no_cert_text[LI_COUNT];

View File

@ -36,6 +36,7 @@ P3DOsxSplashWindow::
P3DOsxSplashWindow(P3DInstance *inst, bool make_visible) :
P3DSplashWindow(inst, make_visible)
{
_font_attribs = NULL;
_install_progress = 0;
_progress_known = true;
_received_data = 0;
@ -59,6 +60,9 @@ P3DOsxSplashWindow::
DisposeWindow(_toplevel_window);
_toplevel_window = NULL;
}
if (_font_attribs != NULL) {
CFRelease(_font_attribs);
}
}
////////////////////////////////////////////////////////////////////
@ -123,6 +127,41 @@ set_wparams(const P3DWindowParams &wparams) {
}
}
}
// Determine the attributes of the font we're going to use.
int symbolic = 0;
if (_font_style != FS_normal) {
symbolic |= kCTFontItalicTrait;
}
if (_font_weight > 500) {
symbolic |= kCTFontBoldTrait;
}
CFNumberRef symbolic_ref = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &symbolic);
CFStringRef traits_keys[1] = { kCTFontSymbolicTrait };
CFTypeRef traits_values[1] = { symbolic_ref };
CFDictionaryRef traits = CFDictionaryCreate(kCFAllocatorDefault, (const void **)&traits_keys, (const void **)&traits_values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFStringRef family = CFStringCreateWithCString(NULL, _font_family.c_str(), kCFStringEncodingUTF8);
CFStringRef attribs_keys[2] = { kCTFontFamilyNameAttribute, kCTFontTraitsAttribute };
CFTypeRef attribs_values[2] = { family, traits };
CFDictionaryRef attribs = CFDictionaryCreate(kCFAllocatorDefault, (const void **)&attribs_keys, (const void **)&attribs_values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
// Create the font object.
CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes(attribs);
CTFontRef font = CTFontCreateWithFontDescriptor(font_desc, _font_size, NULL);
CFStringRef keys[1] = { kCTFontAttributeName };
CFTypeRef values[1] = { font };
_font_attribs = CFDictionaryCreate(kCFAllocatorDefault, (const void **)&keys, (const void **)&values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFRelease(font);
CFRelease(font_desc);
CFRelease(attribs);
CFRelease(traits);
CFRelease(family);
CFRelease(symbolic_ref);
}
////////////////////////////////////////////////////////////////////
@ -171,6 +210,9 @@ set_image_filename(const string &image_filename, ImagePlacement image_placement)
case IP_button_click:
load_image(_button_click_image, image_filename);
break;
default:
return;
}
refresh();
@ -333,10 +375,8 @@ paint_window_osx_cgcontext(CGContextRef context) {
CGColorRef bg = CGColorCreate(rgb_space, bg_components);
CGRect region = { { 0, 0 }, { _win_width, _win_height } };
CGContextBeginPath(context);
CGContextSetFillColorWithColor(context, bg);
CGContextAddRect(context, region);
CGContextFillPath(context);
CGContextFillRect(context, region);
CGColorRelease(bg);
CGColorSpaceRelease(rgb_space);
@ -445,8 +485,6 @@ handle_event_osx_event_record(const P3D_event_data &event) {
////////////////////////////////////////////////////////////////////
bool P3DOsxSplashWindow::
handle_event_osx_cocoa(const P3D_event_data &event) {
bool retval = false;
assert(event._event_type == P3D_ET_osx_cocoa);
const P3DCocoaEvent &ce = event._event._osx_cocoa._event;
@ -455,33 +493,31 @@ handle_event_osx_cocoa(const P3D_event_data &event) {
if (_visible) {
CGContextRef context = ce.data.draw.context;
paint_window_osx_cgcontext(context);
retval = true;
return true;
} else {
return false;
}
break;
case P3DCocoaEventMouseDown:
set_mouse_data((int)ce.data.mouse.pluginX, (int)ce.data.mouse.pluginY, true);
retval = true;
break;
return true;
case P3DCocoaEventMouseUp:
set_mouse_data((int)ce.data.mouse.pluginX, (int)ce.data.mouse.pluginY, false);
retval = true;
break;
return true;
case P3DCocoaEventMouseMoved:
case P3DCocoaEventMouseDragged:
set_mouse_data((int)ce.data.mouse.pluginX, (int)ce.data.mouse.pluginY, _mouse_down);
retval = true;
break;
return true;
case P3DCocoaEventFocusChanged:
_mouse_active = (ce.data.focus.hasFocus != 0);
retval = true;
break;
}
return true;
return retval;
default:
return false;
}
}
////////////////////////////////////////////////////////////////////
@ -612,42 +648,33 @@ paint_image(CGContextRef context, const OsxImageData &image) {
////////////////////////////////////////////////////////////////////
void P3DOsxSplashWindow::
paint_progress_bar(CGContextRef context) {
// Get some colors we'll need. We can't just use
// CGColorGetConstantColor(), since that requires 10.5.
CGFloat fg_components[] = { _fgcolor_r / 255.0f, _fgcolor_g / 255.0f, _fgcolor_b / 255.0f, 1 };
CGFloat bg_components[] = { _bgcolor_r / 255.0f, _bgcolor_g / 255.0f, _bgcolor_b / 255.0f, 1 };
CGFloat bar_components[] = { _barcolor_r / 255.0f, _barcolor_g / 255.0f, _barcolor_b / 255.0f, 1 };
CGFloat bar_bg_components[] = { _bar_bgcolor_r / 255.0f, _bar_bgcolor_g / 255.0f, _bar_bgcolor_b / 255.0f, 1 };
CGColorSpaceRef rgb_space = CGColorSpaceCreateDeviceRGB();
CGColorRef fg = CGColorCreate(rgb_space, fg_components);
CGColorRef bg = CGColorCreate(rgb_space, bg_components);
CGColorRef bar = CGColorCreate(rgb_space, bar_components);
CGColorRef bar_bg = CGColorCreate(rgb_space, bar_bg_components);
// Get the proper placement for the progress bar.
int bar_x, bar_y, bar_width, bar_height;
get_bar_placement(bar_x, bar_y, bar_width, bar_height);
// We offset the bar by half a pixel, so we'll be drawing the
// one-pixel line through the middle of a pixel, and it won't try to
// antialias itself into a half-black two-pixel line.
float bar_xf = bar_x + 0.5;
float bar_yf = bar_y - 0.5;
CGRect bar_rect = { { bar_xf, bar_yf }, { bar_width, bar_height } };
CGRect bar_rect = { { bar_x, bar_y }, { bar_width, bar_height } };
// Clear the entire progress bar to white (or the background color).
CGContextBeginPath(context);
CGContextSetFillColorWithColor(context, bg);
CGContextAddRect(context, bar_rect);
CGContextFillPath(context);
CGContextSetFillColorWithColor(context, bar_bg);
CGContextFillRect(context, bar_rect);
// Draw the interior of the progress bar in blue (or the bar color).
if (_progress_known) {
int progress_width = (int)(bar_width * _install_progress + 0.5);
if (progress_width != 0) {
CGRect prog = { { bar_xf, bar_yf }, { progress_width, bar_height } };
CGContextBeginPath(context);
CGRect prog = { { bar_x, bar_y }, { progress_width, bar_height } };
CGContextSetFillColorWithColor(context, bar);
CGContextAddRect(context, prog);
CGContextFillPath(context);
CGContextFillRect(context, prog);
}
} else {
// Progress is unknown. Draw a moving block, not a progress bar
@ -660,57 +687,58 @@ paint_progress_bar(CGContextRef context) {
progress = block_travel * 2 - progress;
}
CGRect prog = { { bar_xf + progress, bar_yf }, { block_width, bar_height } };
CGContextBeginPath(context);
CGRect prog = { { bar_x + progress, bar_y }, { block_width, bar_height } };
CGContextSetFillColorWithColor(context, bar);
CGContextAddRect(context, prog);
CGContextFillPath(context);
CGContextFillRect(context, prog);
}
// Draw the black stroke around the progress bar.
CGContextBeginPath(context);
CGContextSetLineWidth(context, 1);
CGContextSetStrokeColorWithColor(context, fg);
CGContextAddRect(context, bar_rect);
CGContextStrokePath(context);
if (_bar_border > 0) {
// We offset the border by half a pixel, so we'll be drawing the
// one-pixel line through the middle of a pixel, and it won't try to
// antialias itself into a half-black two-pixel line.
CGRect border_rect = { { bar_x - 0.5, bar_y - 0.5 },
{ bar_width + 1, bar_height + 1 } };
CGContextBeginPath(context);
CGContextSetLineWidth(context, 1);
CGContextSetStrokeColorWithColor(context, fg);
for (int i = 0; i < _bar_border; ++i) {
CGContextAddRect(context, border_rect);
border_rect.origin.x -= 1;
border_rect.origin.y -= 1;
border_rect.size.width += 2;
border_rect.size.height += 2;
}
CGContextStrokePath(context);
}
if (!_install_label.empty()) {
// Now draw the install_label right above it.
// Need to invert the text so it won't be upside-down.
CGAffineTransform text_xform = CGAffineTransformMakeScale(1, -1);
CGContextSetTextMatrix(context, text_xform);
// Choose a suitable font.
float text_height = 15.0;
CGContextSelectFont(context, _font_family.c_str(), text_height, kCGEncodingMacRoman);
// Now draw the install_label right above it.
CFStringRef string = CFStringCreateWithCString(NULL, _install_label.c_str(), kCFStringEncodingUTF8);
CFAttributedStringRef attr_string = CFAttributedStringCreate(NULL, string, _font_attribs);
CTLineRef line = CTLineCreateWithAttributedString(attr_string);
// Measure the text, for centering.
CGContextSetTextPosition(context, 0, 0);
CGContextSetTextDrawingMode(context, kCGTextInvisible);
CGContextShowText(context, _install_label.data(), _install_label.length());
CGPoint end_point = CGContextGetTextPosition(context);
float text_width = end_point.x;
int text_x = (int)(_win_width - text_width) / 2;
int text_y = (int)(bar_y - text_height * 1.5);
// Clear the rectangle behind the text to bg.
CGRect text_rect = { { text_x - 2, text_y - 2 }, { text_width + 4, text_height + 4 } };
CGContextBeginPath(context);
CGContextAddRect(context, text_rect);
CGContextSetFillColorWithColor(context, bg);
CGContextFillPath(context);
// Determine the placement based on the size of the text.
CGRect bounds = CTLineGetImageBounds(line, context);
float text_x = (_win_width - bounds.size.width) / 2.0f - bounds.origin.x;
float text_y = bar_y + bounds.origin.y - 4 - _bar_border;
// And finally, draw the text.
CGContextSetTextDrawingMode(context, kCGTextFill);
CGContextSetFillColorWithColor(context, fg);
CGContextSetTextPosition(context, text_x, text_y);
CTLineDraw(line, context);
CGContextShowTextAtPoint(context, text_x, text_y + text_height,
_install_label.data(), _install_label.length());
CFRelease(line);
CFRelease(attr_string);
CFRelease(string);
}
CGColorRelease(bar_bg);
CGColorRelease(bar);
CGColorRelease(bg);
CGColorRelease(fg);

View File

@ -83,6 +83,8 @@ private:
OsxImageData _button_rollover_image;
OsxImageData _button_click_image;
CFDictionaryRef _font_attribs;
string _install_label;
double _install_progress;
bool _progress_known;

View File

@ -891,11 +891,13 @@ start_p3dpython(P3DInstance *inst) {
// These are the enviroment variables we forward from the current
// environment, if they are set.
const char *keep[] = {
"HOME", "USER",
"HOME", "USER",
#ifdef _WIN32
"SYSTEMROOT", "USERPROFILE", "COMSPEC",
"SYSTEMDRIVE", "ALLUSERSPROFILE", "APPDATA", "COMMONPROGRAMFILES",
"PROGRAMFILES", "WINDIR", "PROGRAMDATA", "USERDOMAIN",
#else
"LANGUAGE", "LC_ALL", "LC_MESSAGES", "LANG",
#endif
#ifdef HAVE_X11
"DISPLAY", "XAUTHORITY",

View File

@ -34,6 +34,7 @@ P3DWinSplashWindow(P3DInstance *inst, bool make_visible) :
_thread = NULL;
_thread_id = 0;
_hwnd = NULL;
_font = NULL;
_fg_brush = NULL;
_bg_brush = NULL;
_bar_brush = NULL;
@ -498,6 +499,17 @@ make_window() {
ShowWindow(_hwnd, SW_HIDE);
}
// Load the requested font.
_font = CreateFontA(-_font_size, 0, 0, 0, _font_weight,
(_font_style != FS_normal), FALSE, FALSE,
ANSI_CHARSET, OUT_OUTLINE_PRECIS, CLIP_DEFAULT_PRECIS,
CLEARTYPE_QUALITY, VARIABLE_PITCH, _font_family.c_str());
if (_font == NULL) {
nout << "CreateFont failed: " << GetLastError() << "\n";
_font = (HFONT)GetStockObject(ANSI_VAR_FONT);
}
_fg_brush = CreateSolidBrush(RGB(_fgcolor_r, _fgcolor_g, _fgcolor_b));
_bg_brush = CreateSolidBrush(RGB(_bgcolor_r, _bgcolor_g, _bgcolor_b));
_bar_brush = CreateSolidBrush(RGB(_barcolor_r, _barcolor_g, _barcolor_b));
@ -840,12 +852,10 @@ paint_progress_bar(HDC dc) {
if (!_drawn_label.empty()) {
// Now draw the install_label right above it.
const char *text = _drawn_label.c_str();
HFONT font = (HFONT)GetStockObject(ANSI_VAR_FONT);
// Measure the text, for centering.
SelectObject(dc, font);
SelectObject(dc, _font);
SIZE text_size;
GetTextExtentPoint32(dc, text, strlen(text), &text_size);

View File

@ -109,6 +109,7 @@ private:
HANDLE _thread;
DWORD _thread_id;
HWND _hwnd;
HFONT _font;
HBRUSH _fg_brush;
HBRUSH _bg_brush;
HBRUSH _bar_brush;

View File

@ -342,7 +342,7 @@ make_parent_window() {
////////////////////////////////////////////////////////////////////
P3D_instance *Panda3DBase::
create_instance(const string &p3d, bool start_instance,
char **args, int num_args, const int &p3d_offset) {
char **args, int num_args, int p3d_offset) {
// Check to see if the p3d filename we were given is a URL, or a
// local file.
Filename p3d_filename = Filename::from_os_specific(p3d);
@ -356,9 +356,9 @@ create_instance(const string &p3d, bool start_instance,
p3d_filename.make_absolute();
os_p3d_filename = p3d_filename.to_os_specific();
}
}
if (is_local) {
read_p3d_info(p3d_filename);
read_p3d_info(p3d_filename, p3d_offset);
}
// Build up the token list.
@ -454,9 +454,9 @@ delete_instance(P3D_instance *inst) {
// parameters (like width and height).
////////////////////////////////////////////////////////////////////
bool Panda3DBase::
read_p3d_info(const Filename &p3d_filename) {
read_p3d_info(const Filename &p3d_filename, int p3d_offset) {
PT(Multifile) mf = new Multifile;
if (!mf->open_read(p3d_filename)) {
if (!mf->open_read(p3d_filename, p3d_offset)) {
return false;
}
int si = mf->find_subfile("p3d_info.xml");

View File

@ -49,10 +49,10 @@ protected:
P3D_instance *
create_instance(const string &p3d, bool start_instance,
char **args, int num_args, const int &p3d_offset = 0);
char **args, int num_args, int p3d_offset = 0);
void delete_instance(P3D_instance *instance);
bool read_p3d_info(const Filename &p3d_filename);
bool read_p3d_info(const Filename &p3d_filename, int p3d_offset = 0);
bool parse_token(const char *arg);
bool parse_int_pair(const char *arg, int &x, int &y);
string lookup_token(const string &keyword) const;

File diff suppressed because it is too large Load Diff

View File

@ -263,3 +263,18 @@ INLINE TypeHandle::
operator bool () const {
return (_index != 0);
}
////////////////////////////////////////////////////////////////////
// Function: TypeHandle::from_index
// Access: Public, Static
// Description: Creates a TypeHandle from a type index without
// error checking, for use by internal functions.
//
// See TypeRegistry::find_type_by_id().
////////////////////////////////////////////////////////////////////
INLINE TypeHandle TypeHandle::
from_index(int index) {
TypeHandle handle;
handle._index = index;
return handle;
}

View File

@ -82,7 +82,7 @@ class TypedObject;
// ancestry of a particular type may be queried, and the
// type name may be retrieved for run-time display.
////////////////////////////////////////////////////////////////////
class EXPCL_DTOOL TypeHandle {
class EXPCL_DTOOL TypeHandle FINAL {
PUBLISHED:
enum MemoryClass {
MC_singleton,
@ -140,6 +140,9 @@ PUBLISHED:
INLINE static TypeHandle none();
INLINE operator bool () const;
public:
INLINE static TypeHandle from_index(int index);
private:
int _index;
static TypeHandle _none;

View File

@ -17,6 +17,7 @@
#include "interrogate.h"
#include "parameterRemap.h"
#include "parameterRemapThis.h"
#include "parameterRemapHandleToInt.h"
#include "parameterRemapUnchanged.h"
#include "interfaceMaker.h"
#include "interrogateBuilder.h"
@ -146,8 +147,13 @@ call_function(ostream &out, int indent_level, bool convert_result,
} else if (_type == T_typecast_method) {
// A typecast method can be invoked implicitly.
string cast_expr =
"(" + _return_type->get_orig_type()->get_local_name(&parser) +
")(*" + container + ")";
"(" + _return_type->get_orig_type()->get_local_name(&parser) + ")";
if (TypeManager::is_handle(_cpptype)) {
cast_expr += "(" + container + ")";
} else {
cast_expr += "(*" + container + ")";
}
if (!convert_result) {
return_expr = cast_expr;
@ -177,10 +183,7 @@ call_function(ostream &out, int indent_level, bool convert_result,
} else if (_type == T_constructor) {
// A special case for constructors.
string defconstruct = builder.in_defconstruct(_cpptype->get_local_name(&parser));
if (pexprs.empty() && !defconstruct.empty()) {
return_expr = defconstruct;
} else if (_extension) {
if (_extension) {
// Extension constructors are a special case. We assume there is a
// default constructor for the class, and the actual construction is
// done by an __init__ method.
@ -192,8 +195,22 @@ call_function(ostream &out, int indent_level, bool convert_result,
<< get_call_str("result", pexprs) << ";\n";
return_expr = "result";
} else {
return_expr = "new " + get_call_str(container, pexprs);
string defconstruct = builder.in_defconstruct(_cpptype->get_local_name(&parser));
string call_expr;
if (pexprs.empty() && !defconstruct.empty()) {
call_expr = defconstruct;
} else {
call_expr = get_call_str(container, pexprs);
}
if (!_return_type->return_value_needs_management()) {
return_expr = _return_type->get_return_expr(call_expr);
} else {
return_expr = "new " + call_expr;
}
}
if (_void_return) {
nout << "Error, constructor for " << *_cpptype << " returning void.\n";
@ -448,12 +465,9 @@ get_call_str(const string &container, const vector_string &pexprs) const {
} else if (_has_this && !container.empty()) {
// If we have a "this" parameter, the calling convention is also
// a bit different.
if (container == "local_this") {
// This isn't important, it just looks a bit prettier.
call << container << "->" << _cppfunc->get_local_name();
} else {
call << "(" << container << ")->" << _cppfunc->get_local_name();
}
call << "(";
_parameters[0]._remap->pass_parameter(call, container);
call << ")." << _cppfunc->get_local_name();
} else {
call << _cppfunc->get_local_name(&parser);
@ -569,7 +583,13 @@ setup_properties(const InterrogateFunction &ifunc, InterfaceMaker *interface_mak
Parameter param;
param._name = "this";
param._has_name = true;
param._remap = new ParameterRemapThis(_cpptype, _const_method);
if (_const_method) {
CPPType *const_type = CPPType::new_type(new CPPConstType(_cpptype));
param._remap = interface_maker->remap_parameter(_cpptype, const_type);
} else {
param._remap = interface_maker->remap_parameter(_cpptype, _cpptype);
}
// param._remap = new ParameterRemapThis(_cpptype, _const_method);
_parameters.push_back(param);
_first_true_parameter = 1;
}

View File

@ -16,6 +16,7 @@
#include "interrogateBuilder.h"
#include "interrogate.h"
#include "functionRemap.h"
#include "parameterRemapHandleToInt.h"
#include "parameterRemapUnchanged.h"
#include "typeManager.h"
@ -53,6 +54,14 @@ InterfaceMakerC::
////////////////////////////////////////////////////////////////////
void InterfaceMakerC::
write_prototypes(ostream &out,ostream *out_h) {
// The 'used' attribute prevents emscripten from optimizing it out.
out <<
"#if __GNUC__ >= 4\n"
"#define EXPORT_FUNC extern \"C\" __attribute__((used, visibility(\"default\")))\n"
"#else\n"
"#define EXPORT_FUNC extern \"C\"\n"
"#endif\n\n";
FunctionsByIndex::iterator fi;
for (fi = _functions.begin(); fi != _functions.end(); ++fi) {
Function *func = (*fi).second;
@ -81,6 +90,32 @@ write_functions(ostream &out) {
InterfaceMaker::write_functions(out);
}
////////////////////////////////////////////////////////////////////
// Function: InterfaceMakerC::remap_parameter
// Access: Public, Virtual
// Description: Allocates a new ParameterRemap object suitable to the
// indicated parameter type. If struct_type is
// non-NULL, it is the type of the enclosing class for
// the function (method) in question.
//
// The return value is a newly-allocated ParameterRemap
// object, if the parameter type is acceptable, or NULL
// if the parameter type cannot be handled.
////////////////////////////////////////////////////////////////////
ParameterRemap *InterfaceMakerC::
remap_parameter(CPPType *struct_type, CPPType *param_type) {
// Wrap TypeHandle and ButtonHandle, which are practically just
// ints, as an integer instead of a pointer. It makes things easier
// on the scripting language, especially if there has to be a
// dynamic downcasting system on the scripting language side.
if (TypeManager::is_handle(param_type)) {
return new ParameterRemapHandleToInt(param_type);
} else {
return InterfaceMaker::remap_parameter(struct_type, param_type);
}
}
////////////////////////////////////////////////////////////////////
// Function: InterfaceMakerC::synthesize_this_parameter
// Access: Public, Virtual
@ -140,8 +175,13 @@ write_prototype_for(ostream &out, InterfaceMaker::Function *func) {
for (ri = func->_remaps.begin(); ri != func->_remaps.end(); ++ri) {
FunctionRemap *remap = (*ri);
if (remap->_extension || (remap->_flags & FunctionRemap::F_explicit_self)) {
continue;
}
if (output_function_names) {
out << "extern \"C\" ";
out << "EXPORT_FUNC ";
}
write_function_header(out, func, remap, false);
out << ";\n";
@ -216,10 +256,6 @@ write_function_instance(ostream &out, InterfaceMaker::Function *func,
void InterfaceMakerC::
write_function_header(ostream &out, InterfaceMaker::Function *func,
FunctionRemap *remap, bool newline) {
if (remap->_extension || (remap->_flags & FunctionRemap::F_explicit_self)) {
return;
}
if (remap->_void_return) {
out << "void";
} else {

View File

@ -36,6 +36,8 @@ public:
virtual void write_prototypes(ostream &out,ostream *out_h);
virtual void write_functions(ostream &out);
virtual ParameterRemap *remap_parameter(CPPType *struct_type, CPPType *param_type);
virtual bool synthesize_this_parameter();
protected:

View File

@ -1499,6 +1499,8 @@ write_module(ostream &out, ostream *out_h, InterrogateModuleDef *def) {
<< "\n"
<< "#ifdef _WIN32\n"
<< "extern \"C\" __declspec(dllexport) PyObject *PyInit_" << def->module_name << "();\n"
<< "#elif __GNUC__ >= 4\n"
<< "extern \"C\" __attribute__((visibility(\"default\"))) PyInit_" << def->module_name << "();\n"
<< "#else\n"
<< "extern \"C\" PyObject *PyInit_" << def->module_name << "();\n"
<< "#endif\n"
@ -1512,6 +1514,8 @@ write_module(ostream &out, ostream *out_h, InterrogateModuleDef *def) {
<< "\n"
<< "#ifdef _WIN32\n"
<< "extern \"C\" __declspec(dllexport) void init" << def->module_name << "();\n"
<< "#elif __GNUC__ >= 4\n"
<< "extern \"C\" __attribute__((visibility(\"default\"))) init" << def->module_name << "();\n"
<< "#else\n"
<< "extern \"C\" void init" << def->module_name << "();\n"
<< "#endif\n"

View File

@ -136,6 +136,8 @@ write_module(ostream &out,ostream *out_h, InterrogateModuleDef *def) {
<< "#ifdef _WIN32\n"
<< "extern \"C\" __declspec(dllexport) INIT_FUNC();\n"
<< "#elif __GNUC__ >= 4\n"
<< "extern \"C\" __attribute__((visibility(\"default\"))) INIT_FUNC();\n"
<< "#else\n"
<< "extern \"C\" INIT_FUNC();\n"
<< "#endif\n\n"

View File

@ -123,6 +123,8 @@ write_module(ostream &out,ostream *out_h, InterrogateModuleDef *def) {
<< "#ifdef _WIN32\n"
<< "extern \"C\" __declspec(dllexport) INIT_FUNC();\n"
<< "#elif __GNUC__ >= 4\n"
<< "extern \"C\" __attribute__((visibility(\"default\"))) INIT_FUNC();\n"
<< "#else\n"
<< "extern \"C\" INIT_FUNC();\n"
<< "#endif\n\n"

View File

@ -14,5 +14,6 @@
#include "parameterRemapReferenceToPointer.cxx"
#include "parameterRemapThis.cxx"
#include "parameterRemapToString.cxx"
#include "parameterRemapHandleToInt.cxx"
#include "parameterRemapUnchanged.cxx"

View File

@ -0,0 +1,65 @@
// Filename: parameterRemapHandleToInt.cxx
// Created by: rdb (08Sep15)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#include "parameterRemapHandleToInt.h"
#include "interrogate.h"
#include "interrogateBuilder.h"
#include "typeManager.h"
#include "cppType.h"
#include "cppDeclaration.h"
#include "cppConstType.h"
#include "cppPointerType.h"
////////////////////////////////////////////////////////////////////
// Function: ParameterRemapHandleToInt::Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
ParameterRemapHandleToInt::
ParameterRemapHandleToInt(CPPType *orig_type) :
ParameterRemap(orig_type)
{
_new_type = TypeManager::get_int_type();
}
////////////////////////////////////////////////////////////////////
// Function: ParameterRemapHandleToInt::pass_parameter
// Access: Public, Virtual
// Description: Outputs an expression that converts the indicated
// variable from the new type to the original type, for
// passing into the actual C++ function.
////////////////////////////////////////////////////////////////////
void ParameterRemapHandleToInt::
pass_parameter(ostream &out, const string &variable_name) {
CPPType *unwrapped = TypeManager::unwrap_const(_orig_type);
if (unwrapped->get_local_name(&parser) == "TypeHandle") {
out << "TypeHandle::from_index(" << variable_name << ")";
} else {
out << unwrapped->get_local_name(&parser) << "(" << variable_name << ")";
}
}
////////////////////////////////////////////////////////////////////
// Function: ParameterRemapHandleToInt::get_return_expr
// Access: Public, Virtual
// Description: Returns an expression that evalutes to the
// appropriate value type for returning from the
// function, given an expression of the original type.
////////////////////////////////////////////////////////////////////
string ParameterRemapHandleToInt::
get_return_expr(const string &expression) {
return "(" + expression + ").get_index()";
}

View File

@ -0,0 +1,40 @@
// Filename: parameterRemapHandleToInt.h
// Created by: rdb (08Sep15)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef PARAMETERREMAPHANDLETOINT_H
#define PARAMETERREMAPHANDLETOINT_H
#include "dtoolbase.h"
#include "parameterRemap.h"
////////////////////////////////////////////////////////////////////
// Class : ParameterRemapHandleToInt
// Description : A ParameterRemap class that handles remapping a
// Handle parameter to an integer. This makes it
// easier to set up a dynamic typing system on the
// scripting language side.
//
// It also applies to ButtonHandle or any other class
// with the same semantics, because why not.
////////////////////////////////////////////////////////////////////
class ParameterRemapHandleToInt : public ParameterRemap {
public:
ParameterRemapHandleToInt(CPPType *orig_type);
virtual void pass_parameter(ostream &out, const string &variable_name);
virtual string get_return_expr(const string &expression);
};
#endif

View File

@ -45,8 +45,8 @@ ParameterRemapThis(CPPType *type, bool is_const) :
// passing into the actual C++ function.
////////////////////////////////////////////////////////////////////
void ParameterRemapThis::
pass_parameter(ostream &out, const string &) {
out << "**invalid**";
pass_parameter(ostream &out, const string &variable_name) {
out << "(*" << variable_name << ")";
}
////////////////////////////////////////////////////////////////////

View File

@ -1820,6 +1820,31 @@ is_Py_buffer(CPPType *type) {
}
}
////////////////////////////////////////////////////////////////////
// Function: TypeManager::is_handle
// Access: Public, Static
// Description: Returns true if the indicated type is TypeHandle
// or a class with identical semantics like ButtonHandle.
////////////////////////////////////////////////////////////////////
bool TypeManager::
is_handle(CPPType *type) {
switch (type->get_subtype()) {
case CPPDeclaration::ST_const:
return is_handle(type->as_const_type()->_wrapped_around);
case CPPDeclaration::ST_extension:
case CPPDeclaration::ST_struct:
return (type->get_local_name(&parser) == "TypeHandle" ||
type->get_local_name(&parser) == "ButtonHandle");
case CPPDeclaration::ST_typedef:
return is_handle(type->as_typedef_type()->_type);
default:
return false;
}
}
////////////////////////////////////////////////////////////////////
// Function: TypeManager::is_ostream
// Access: Public, Static
@ -2631,7 +2656,7 @@ is_trivial(CPPType *source_type) {
return is_trivial(source_type->as_typedef_type()->_type);
default:
if (source_type->is_trivial()) {
if (source_type->is_trivial() || is_handle(source_type)) {
return true;
} else {
// This is a bit of a hack. is_trivial() returns false for types that

View File

@ -112,6 +112,7 @@ public:
static bool is_PyUnicodeObject(CPPType *type);
static bool is_pointer_to_Py_buffer(CPPType *type);
static bool is_Py_buffer(CPPType *type);
static bool is_handle(CPPType *type);
static bool involves_unpublished(CPPType *type);
static bool involves_protected(CPPType *type);

View File

@ -5055,9 +5055,11 @@ if (RTDIST or RUNTIME):
if (PkgSkip("FLTK")==0):
OPTS.append("FLTK")
TargetAdd('plugin_p3dCert.obj', opts=OPTS, input='p3dCert.cxx')
TargetAdd('plugin_p3dCert_strings.obj', opts=OPTS, input='p3dCert_strings.cxx')
TargetAdd('p3dcert.exe', input='plugin_mkdir_complete.obj')
TargetAdd('p3dcert.exe', input='plugin_wstring_encode.obj')
TargetAdd('p3dcert.exe', input='plugin_p3dCert.obj')
TargetAdd('p3dcert.exe', input='plugin_p3dCert_strings.obj')
OPTS=['OPENSSL', 'FLTK', 'X11', 'WINCOMCTL', 'WINSOCK', 'WINGDI', 'WINUSER', 'ADVAPI', 'WINOLE', 'WINSHELL', 'SUBSYSTEM:WINDOWS']
if GetTarget() == 'darwin':
OPTS += ['OPT:2']

View File

@ -1,4 +1,4 @@
defconstruct TypeHandle new TypeHandle(TypeHandle::none())
defconstruct TypeHandle TypeHandle(TypeHandle::none())
forcetype PandaSystem
forcetype DSearchPath

View File

@ -11331,7 +11331,6 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload,
if (_supports_clear_buffer) {
// For buffer textures we need to clear the underlying storage.
string clear_data = tex->get_clear_data();
cerr << "clearing buffer data\n";
_glClearBufferData(GL_TEXTURE_BUFFER, internal_format, external_format,
component_type, (const void *)clear_data.data());

View File

@ -1,46 +1,46 @@
defconstruct LPoint2f new LPoint2f(0.0f)
defconstruct LPoint3f new LPoint3f(0.0f)
defconstruct LPoint4f new LPoint4f(0.0f)
defconstruct LPoint2d new LPoint2d(0.0)
defconstruct LPoint3d new LPoint3d(0.0)
defconstruct LPoint4d new LPoint4d(0.0)
defconstruct LPoint2i new LPoint2i(0)
defconstruct LPoint3i new LPoint3i(0)
defconstruct LPoint4i new LPoint4i(0)
defconstruct LPoint2f LPoint2f(0.0f)
defconstruct LPoint3f LPoint3f(0.0f)
defconstruct LPoint4f LPoint4f(0.0f)
defconstruct LPoint2d LPoint2d(0.0)
defconstruct LPoint3d LPoint3d(0.0)
defconstruct LPoint4d LPoint4d(0.0)
defconstruct LPoint2i LPoint2i(0)
defconstruct LPoint3i LPoint3i(0)
defconstruct LPoint4i LPoint4i(0)
defconstruct LVecBase2f new LVecBase2f(0.0f)
defconstruct LVecBase3f new LVecBase3f(0.0f)
defconstruct LVecBase4f new LVecBase4f(0.0f)
defconstruct LVecBase2d new LVecBase2d(0.0)
defconstruct LVecBase3d new LVecBase3d(0.0)
defconstruct LVecBase4d new LVecBase4d(0.0)
defconstruct LVecBase2i new LVecBase2i(0)
defconstruct LVecBase3i new LVecBase3i(0)
defconstruct LVecBase4i new LVecBase4i(0)
defconstruct LVecBase2f LVecBase2f(0.0f)
defconstruct LVecBase3f LVecBase3f(0.0f)
defconstruct LVecBase4f LVecBase4f(0.0f)
defconstruct LVecBase2d LVecBase2d(0.0)
defconstruct LVecBase3d LVecBase3d(0.0)
defconstruct LVecBase4d LVecBase4d(0.0)
defconstruct LVecBase2i LVecBase2i(0)
defconstruct LVecBase3i LVecBase3i(0)
defconstruct LVecBase4i LVecBase4i(0)
defconstruct LVector2f new LVector2f(0.0f)
defconstruct LVector3f new LVector3f(0.0f)
defconstruct LVector4f new LVector4f(0.0f)
defconstruct LVector2d new LVector2d(0.0)
defconstruct LVector3d new LVector3d(0.0)
defconstruct LVector4d new LVector4d(0.0)
defconstruct LVector2i new LVector2i(0)
defconstruct LVector3i new LVector3i(0)
defconstruct LVector4i new LVector4i(0)
defconstruct LVector2f LVector2f(0.0f)
defconstruct LVector3f LVector3f(0.0f)
defconstruct LVector4f LVector4f(0.0f)
defconstruct LVector2d LVector2d(0.0)
defconstruct LVector3d LVector3d(0.0)
defconstruct LVector4d LVector4d(0.0)
defconstruct LVector2i LVector2i(0)
defconstruct LVector3i LVector3i(0)
defconstruct LVector4i LVector4i(0)
defconstruct LMatrix3f new LMatrix3f(LMatrix3f::ident_mat())
defconstruct LMatrix4f new LMatrix4f(LMatrix4f::ident_mat())
defconstruct LMatrix3d new LMatrix3d(LMatrix3d::ident_mat())
defconstruct LMatrix4d new LMatrix4d(LMatrix4d::ident_mat())
defconstruct LMatrix3f LMatrix3f(LMatrix3f::ident_mat())
defconstruct LMatrix4f LMatrix4f(LMatrix4f::ident_mat())
defconstruct LMatrix3d LMatrix3d(LMatrix3d::ident_mat())
defconstruct LMatrix4d LMatrix4d(LMatrix4d::ident_mat())
defconstruct LQuaternionf new LQuaternionf(LQuaternionf::ident_quat())
defconstruct LRotationf new LRotationf(LQuaternionf::ident_quat())
defconstruct LOrientationf new LOrientationf(LQuaternionf::ident_quat())
defconstruct LQuaternionf LQuaternionf(LQuaternionf::ident_quat())
defconstruct LRotationf LRotationf(LQuaternionf::ident_quat())
defconstruct LOrientationf LOrientationf(LQuaternionf::ident_quat())
defconstruct LQuaterniond new LQuaterniond(LQuaterniond::ident_quat())
defconstruct LRotationd new LRotationd(LQuaterniond::ident_quat())
defconstruct LOrientationd new LOrientationd(LQuaterniond::ident_quat())
defconstruct LQuaterniond LQuaterniond(LQuaterniond::ident_quat())
defconstruct LRotationd LRotationd(LQuaterniond::ident_quat())
defconstruct LOrientationd LOrientationd(LQuaterniond::ident_quat())
# We don't want to accidentally include any of the _src files in the
# generated output, since these files aren't intended to be included by

View File

@ -62,15 +62,12 @@ LightLensNode::
LightLensNode::
LightLensNode(const LightLensNode &copy) :
Light(copy),
Camera(copy)
Camera(copy),
_shadow_caster(copy._shadow_caster),
_sb_xsize(copy._sb_xsize),
_sb_ysize(copy._sb_ysize),
_sb_sort(-10)
{
_shadow_caster = false;
_sb_xsize = 512;
_sb_ysize = 512;
_sb_sort = -10;
// Backface culling helps eliminating artifacts.
set_initial_state(RenderState::make(CullFaceAttrib::make_reverse(),
ColorWriteAttrib::make(ColorWriteAttrib::C_off)));
}
////////////////////////////////////////////////////////////////////

View File

@ -69,22 +69,22 @@ PointLight(const string &name) :
{
PT(Lens) lens;
lens = new PerspectiveLens(90, 90);
lens->set_view_vector(1, 0, 0, 0, 0, 1);
lens->set_view_vector(1, 0, 0, 0, -1, 0);
set_lens(0, lens);
lens = new PerspectiveLens(90, 90);
lens->set_view_vector(-1, 0, 0, 0, 0, 1);
lens->set_view_vector(-1, 0, 0, 0, -1, 0);
set_lens(1, lens);
lens = new PerspectiveLens(90, 90);
lens->set_view_vector(0, 1, 0, 0, 0, 1);
set_lens(2, lens);
lens = new PerspectiveLens(90, 90);
lens->set_view_vector(0, -1, 0, 0, 0, 1);
lens->set_view_vector(0, -1, 0, 0, 0, -1);
set_lens(3, lens);
lens = new PerspectiveLens(90, 90);
lens->set_view_vector(0, 0, 1, 0, 0, 1);
lens->set_view_vector(0, 0, 1, 0, -1, 0);
set_lens(4, lens);
lens = new PerspectiveLens(90, 90);
lens->set_view_vector(0, 0, -1, 0, 0, 1);
lens->set_view_vector(0, 0, -1, 0, -1, 0);
set_lens(5, lens);
}
@ -100,25 +100,6 @@ PointLight(const PointLight &copy) :
LightLensNode(copy),
_cycler(copy._cycler)
{
PT(Lens) lens;
lens = new PerspectiveLens(90, 90);
lens->set_view_vector(1, 0, 0, 0, 0, 1);
set_lens(0, lens);
lens = new PerspectiveLens(90, 90);
lens->set_view_vector(-1, 0, 0, 0, 0, 1);
set_lens(1, lens);
lens = new PerspectiveLens(90, 90);
lens->set_view_vector(0, 1, 0, 0, 0, 1);
set_lens(2, lens);
lens = new PerspectiveLens(90, 90);
lens->set_view_vector(0, -1, 0, 0, 0, 1);
set_lens(3, lens);
lens = new PerspectiveLens(90, 90);
lens->set_view_vector(0, 0, 1, 0, 0, 1);
set_lens(4, lens);
lens = new PerspectiveLens(90, 90);
lens->set_view_vector(0, 0, -1, 0, 0, 1);
set_lens(5, lens);
}
////////////////////////////////////////////////////////////////////

View File

@ -25,7 +25,7 @@
// device, including keyboard buttons and mouse buttons
// (but see KeyboardButton and MouseButton).
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA_PUTIL ButtonHandle {
class EXPCL_PANDA_PUTIL ButtonHandle FINAL {
PUBLISHED:
INLINE ButtonHandle();
INLINE ButtonHandle(int index);

View File

@ -1,4 +1,4 @@
defconstruct ButtonHandle new ButtonHandle(0)
defconstruct ButtonHandle ButtonHandle(0)
ignoremember _factory
ignoremember get_factory