r12470 chris_y - in /trunk/netsurf/amiga: context_menu.c filetype.c filetype.h plugin_hack.c
by netsurf@semichrome.net
Author: chris_y
Date: Thu Jun 9 17:29:46 2011
New Revision: 12470
URL: http://source.netsurf-browser.org?rev=12470&view=rev
Log:
Only show external app context menu item if an external app is actually defined
Modified:
trunk/netsurf/amiga/context_menu.c
trunk/netsurf/amiga/filetype.c
trunk/netsurf/amiga/filetype.h
trunk/netsurf/amiga/plugin_hack.c
Modified: trunk/netsurf/amiga/context_menu.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/context_menu.c?rev=...
==============================================================================
--- trunk/netsurf/amiga/context_menu.c (original)
+++ trunk/netsurf/amiga/context_menu.c Thu Jun 9 17:29:46 2011
@@ -367,15 +367,18 @@
if(curbox->object &&
(content_get_type(curbox->object) == CONTENT_PLUGIN))
{
- IDoMethod(gwin->objects[OID_MENU],PM_INSERT,
- NewObject(POPUPMENU_GetItemClass(), NULL,
- PMIA_Title, (ULONG)ctxmenulab[CMID_PLUGINCMD],
- PMIA_ID, CMID_PLUGINCMD,
- PMIA_UserData, curbox->object,
- TAG_DONE),
- ~0);
-
- menuhascontent = true;
+ if(ami_mime_content_to_cmd(curbox->object))
+ {
+ IDoMethod(gwin->objects[OID_MENU],PM_INSERT,
+ NewObject(POPUPMENU_GetItemClass(), NULL,
+ PMIA_Title, (ULONG)ctxmenulab[CMID_PLUGINCMD],
+ PMIA_ID, CMID_PLUGINCMD,
+ PMIA_UserData, curbox->object,
+ TAG_DONE),
+ ~0);
+
+ menuhascontent = true;
+ }
}
if (curbox->gadget)
{
Modified: trunk/netsurf/amiga/filetype.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/filetype.c?rev=1247...
==============================================================================
--- trunk/netsurf/amiga/filetype.c (original)
+++ trunk/netsurf/amiga/filetype.c Thu Jun 9 17:29:46 2011
@@ -564,6 +564,21 @@
}
}
+lwc_string *ami_mime_content_to_cmd(struct hlcache_handle *c)
+{
+ struct Node *node;
+ lwc_string *plugincmd;
+ lwc_string *mimetype;
+
+ mimetype = content_get_mime_type(c);
+
+ node = ami_mime_to_plugincmd(mimetype,
+ &plugincmd, NULL);
+
+ if(node && (plugincmd != NULL)) return plugincmd;
+ else return NULL;
+}
+
/**
* Compare the MIME type of an hlcache_handle to a DefIcons type
*/
@@ -595,7 +610,7 @@
void ami_mime_dump(void)
{
- struct Node *node;
+ struct Node *node = NULL;
struct ami_mime_entry *mimeentry;
while(mimeentry = ami_mime_entry_locate(NULL, AMI_MIME_MIMETYPE, &node))
Modified: trunk/netsurf/amiga/filetype.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/filetype.h?rev=1247...
==============================================================================
--- trunk/netsurf/amiga/filetype.h (original)
+++ trunk/netsurf/amiga/filetype.h Thu Jun 9 17:29:46 2011
@@ -36,9 +36,8 @@
lwc_string **mimetype, struct Node *start_node);
struct Node *ami_mime_to_filetype(lwc_string *mimetype,
lwc_string **filetype, struct Node *start_node);
-struct Node *ami_mime_to_plugincmd(lwc_string *mimetype,
- lwc_string **plugincmd, struct Node *start_node);
+lwc_string *ami_mime_content_to_cmd(struct hlcache_handle *c);
struct Node *ami_mime_has_cmd(lwc_string **mimetype, struct Node *start_node);
bool ami_mime_compare(struct hlcache_handle *c, const char *type);
Modified: trunk/netsurf/amiga/plugin_hack.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/plugin_hack.c?rev=1...
==============================================================================
--- trunk/netsurf/amiga/plugin_hack.c (original)
+++ trunk/netsurf/amiga/plugin_hack.c Thu Jun 9 17:29:46 2011
@@ -240,29 +240,25 @@
void amiga_plugin_hack_execute(struct hlcache_handle *c)
{
- lwc_string *mimetype;
lwc_string *plugincmd;
- struct Node *node;
char *full_cmd;
BPTR in, out;
if(c == NULL) return;
- mimetype = content_get_mime_type(c);
- node = ami_mime_to_plugincmd(mimetype, &plugincmd, NULL);
-
- if(node && plugincmd)
+ plugincmd = ami_mime_content_to_cmd(c);
+ if(plugincmd == NULL) return;
+
+ full_cmd = ASPrintf("%s %s", lwc_string_data(plugincmd), content_get_url(c));
+
+ if(full_cmd)
{
- full_cmd = ASPrintf("%s %s", lwc_string_data(plugincmd), content_get_url(c));
-
- if(full_cmd)
- {
- LOG(("Attempting to execute %s", full_cmd));
-
- in = Open("NIL:", MODE_OLDFILE);
- out = Open("NIL:", MODE_NEWFILE);
-
- SystemTags(full_cmd,
+ LOG(("Attempting to execute %s", full_cmd));
+
+ in = Open("NIL:", MODE_OLDFILE);
+ out = Open("NIL:", MODE_NEWFILE);
+
+ SystemTags(full_cmd,
SYS_Input, in,
SYS_Output, out,
SYS_Error, out,
@@ -270,7 +266,6 @@
NP_Name, "NetSurf External Process",
TAG_DONE);
- FreeVec(full_cmd);
- }
- }
-}
+ FreeVec(full_cmd);
+ }
+}
12 years
r12469 vince - in /trunk/netsurf/gtk: compat.c compat.h dialogs/options.c
by netsurf@semichrome.net
Author: vince
Date: Tue Jun 7 12:23:39 2011
New Revision: 12469
URL: http://source.netsurf-browser.org?rev=12469&view=rev
Log:
compatability fix for recent gtk API deprecation
Modified:
trunk/netsurf/gtk/compat.c
trunk/netsurf/gtk/compat.h
trunk/netsurf/gtk/dialogs/options.c
Modified: trunk/netsurf/gtk/compat.c
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/compat.c?rev=12469&r1...
==============================================================================
--- trunk/netsurf/gtk/compat.c (original)
+++ trunk/netsurf/gtk/compat.c Tue Jun 7 12:23:39 2011
@@ -97,3 +97,30 @@
#endif
}
+GtkWidget *nsgtk_combo_box_text_new(void)
+{
+ #if GTK_CHECK_VERSION(2,24,0)
+ return gtk_combo_box_text_new();
+ #else
+ return gtk_combo_box_new_text();
+ #endif
+}
+
+void nsgtk_combo_box_text_append_text(GtkWidget *combo_box, const gchar *text)
+{
+ #if GTK_CHECK_VERSION(2,24,0)
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), text);
+ #else
+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), text);
+ #endif
+
+}
+
+gchar *nsgtk_combo_box_text_get_active_text(GtkWidget *combo_box)
+{
+ #if GTK_CHECK_VERSION(2,24,0)
+ return gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo_box));
+ #else
+ return gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo_box));
+ #endif
+}
Modified: trunk/netsurf/gtk/compat.h
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/compat.h?rev=12469&r1...
==============================================================================
--- trunk/netsurf/gtk/compat.h (original)
+++ trunk/netsurf/gtk/compat.h Tue Jun 7 12:23:39 2011
@@ -33,5 +33,8 @@
gboolean nsgtk_widget_is_drawable(GtkWidget *widget);
GtkStateType nsgtk_widget_get_state(GtkWidget *widget);
void nsgtk_dialog_set_has_separator(GtkDialog *dialog, gboolean setting);
+GtkWidget *nsgtk_combo_box_text_new(void);
+void nsgtk_combo_box_text_append_text(GtkWidget *combo_box, const gchar *text);
+gchar *nsgtk_combo_box_text_get_active_text(GtkWidget *combo_box);
#endif /* NETSURF_GTK_COMPAT_H */
Modified: trunk/netsurf/gtk/dialogs/options.c
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/dialogs/options.c?rev...
==============================================================================
--- trunk/netsurf/gtk/dialogs/options.c (original)
+++ trunk/netsurf/gtk/dialogs/options.c Tue Jun 7 12:23:39 2011
@@ -30,6 +30,8 @@
#include "desktop/options.h"
#include "desktop/print.h"
#include "desktop/searchweb.h"
+
+#include "gtk/compat.h"
#include "gtk/options.h"
#include "gtk/gui.h"
#include "gtk/scaffolding.h"
@@ -297,7 +299,7 @@
/* Create combobox */
box = GTK_BOX(glade_xml_get_widget(gladeFile, "combolanguagevbox"));
- comboLanguage = gtk_combo_box_new_text();
+ comboLanguage = nsgtk_combo_box_text_new();
/* Populate combobox from languages file */
if ((languages_file_location != NULL) &&
@@ -311,7 +313,7 @@
/* Remove trailing \n */
buf[strlen(buf) - 1] = '\0';
- gtk_combo_box_append_text(GTK_COMBO_BOX(comboLanguage), buf);
+ nsgtk_combo_box_text_append_text(comboLanguage, buf);
if (strcmp(buf, default_accept_language) == 0)
active_language = combo_row_count;
@@ -323,7 +325,7 @@
} else {
LOG(("Failed opening languages file"));
warn_user("FileError", languages_file_location);
- gtk_combo_box_append_text(GTK_COMBO_BOX(comboLanguage), "en");
+ nsgtk_combo_box_text_append_text(comboLanguage, "en");
}
@@ -450,9 +452,11 @@
/* populate theme combo from themelist file */
GtkBox *box = GTK_BOX(glade_xml_get_widget(gladeFile, "themehbox"));
char buf[50];
- combotheme = gtk_combo_box_new_text();
size_t len = SLEN("themelist") + strlen(res_dir_location) + 1;
char themefile[len];
+
+ combotheme = nsgtk_combo_box_text_new();
+
if ((combotheme == NULL) || (box == NULL)) {
warn_user(messages_get("NoMemory"), 0);
return;
@@ -472,7 +476,7 @@
/* Remove trailing \n */
buf[strlen(buf) - 1] = '\0';
- gtk_combo_box_append_text(GTK_COMBO_BOX(combotheme), buf);
+ nsgtk_combo_box_text_append_text(combotheme, buf);
}
fclose(fp);
gtk_combo_box_set_active(GTK_COMBO_BOX(combotheme),
@@ -485,7 +489,7 @@
{
if (wndPreferences == NULL)
return false;
- gtk_combo_box_append_text(GTK_COMBO_BOX(combotheme), themename);
+ nsgtk_combo_box_text_append_text(combotheme, themename);
return true;
}
@@ -547,17 +551,17 @@
static gboolean on_comboLanguage_changed(GtkWidget *widget, gpointer data)
{
- char *old_lang = option_accept_language;
- gchar *lang =
- gtk_combo_box_get_active_text(GTK_COMBO_BOX(comboLanguage));
+ gchar *lang;
+
+ lang = nsgtk_combo_box_text_get_active_text(comboLanguage);
if (lang == NULL)
return FALSE;
- option_accept_language = strdup((const char *) lang);
- if (option_accept_language == NULL)
- option_accept_language = old_lang;
- else
- free(old_lang);
+ if (option_accept_language != NULL) {
+ free(option_accept_language);
+ }
+
+ option_accept_language = lang;
g_free(lang);
@@ -810,18 +814,17 @@
if (option_current_theme != 0) {
if (nsgtk_theme_name() != NULL)
free(nsgtk_theme_name());
- name = strdup(gtk_combo_box_get_active_text(
- GTK_COMBO_BOX(combotheme)));
- if (name == NULL) {
- warn_user(messages_get("NoMemory"), 0);
- continue;
+ name = nsgtk_combo_box_text_get_active_text(combotheme);
+ if (name != NULL) {
+ nsgtk_theme_set_name(name);
+ nsgtk_theme_prepare();
+ /* possible name leak */
}
- nsgtk_theme_set_name(name);
- nsgtk_theme_prepare();
} else if (nsgtk_theme_name() != NULL) {
free(nsgtk_theme_name());
nsgtk_theme_set_name(NULL);
}
+
while (current) {
nsgtk_theme_implement(current);
current = nsgtk_scaffolding_iterate(current);
12 years
r12467 chris_y - in /trunk/netsurf/amiga: filetype.c resources/mimetypes
by netsurf@semichrome.net
Author: chris_y
Date: Mon Jun 6 17:27:10 2011
New Revision: 12467
URL: http://source.netsurf-browser.org?rev=12467&view=rev
Log:
Don't modify the DataType name within the structure.
Update mimetypes file a bit, add some more descriptive text.
Modified:
trunk/netsurf/amiga/filetype.c
trunk/netsurf/amiga/resources/mimetypes
Modified: trunk/netsurf/amiga/filetype.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/filetype.c?rev=1246...
==============================================================================
--- trunk/netsurf/amiga/filetype.c (original)
+++ trunk/netsurf/amiga/filetype.c Mon Jun 6 17:27:10 2011
@@ -362,7 +362,8 @@
if (lerror != lwc_error_ok)
return NULL;
- dt_name_lwr = strlwr(dth->dth_Name);
+ dt_name_lwr = strdup(dth->dth_Name);
+ strlwr(dt_name_lwr);
p = dt_name_lwr;
while(*p != '\0')
Modified: trunk/netsurf/amiga/resources/mimetypes
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/resources/mimetypes...
==============================================================================
--- trunk/netsurf/amiga/resources/mimetypes (original)
+++ trunk/netsurf/amiga/resources/mimetypes Mon Jun 6 17:27:10 2011
@@ -1,13 +1,27 @@
; This file contains a list of MIME types that can be handled by NetSurf,
; mapping them to DataType and DefIcons format names.
+;
; It is parsed by ReadArgs with the following template:
; MIMETYPE/A,DT=DATATYPE/K,TYPE=DEFICON/K,CMD=PLUGINCMD/K
+;
+; Note: DataType name is case sensitive and is the name MultiView
+; displays in the "About" window, *not* the filename of the DataType
+; descriptor.
+;
+; The first entry for a type is the one which will be used for reverse
+; lookups (ie. translating from DataTypes to MIME)
+;
+; Any DataTypes installed that are not present in this list will be
+; assigned a MIME type constructed from the DataTypes superclass
+; and a lowercase version of the full format name (eg. ILBM becomes
+; image/ilbm)
+
+
+;
+; Image types
+;
; BMP
-application/bmp DT=BMP TYPE=bmp
-application/preview DT=BMP TYPE=bmp
-application/x-bmp DT=BMP TYPE=bmp
-application/x-win-bitmap DT=BMP TYPE=bmp
image/bmp DT=BMP TYPE=bmp
image/ms-bmp DT=BMP TYPE=bmp
image/x-bitmap DT=BMP TYPE=bmp
@@ -16,6 +30,10 @@
image/x-win-bitmap DT=BMP TYPE=bmp
image/x-windows-bmp DT=BMP TYPE=bmp
image/x-xbitmap DT=BMP TYPE=bmp
+application/bmp DT=BMP TYPE=bmp
+application/preview DT=BMP TYPE=bmp
+application/x-bmp DT=BMP TYPE=bmp
+application/x-win-bitmap DT=BMP TYPE=bmp
; GIF
; Expect problems with GIF anims if GIFANIM datatype installed
@@ -23,11 +41,11 @@
;image/gif DT=GIFANIM TYPE=gif
; ICO
-application/ico DT=ICO TYPE=ico
-application/x-ico DT=ICO TYPE=ico
image/ico DT=ICO TYPE=ico
image/vnd.microsoft.icon DT=ICO TYPE=ico
image/x-icon DT=ICO TYPE=ico
+application/ico DT=ICO TYPE=ico
+application/x-ico DT=ICO TYPE=ico
; .info
image/x-amiga-icon DT=INFO
@@ -64,7 +82,24 @@
; WebP
image/webp DT=WebP TYPE=webp
+
+;
+; Audio types
+;
+
+; RIFF WAVE
+audio/x-wav DT=WAVE TYPE=wav
+
+; MP3
+audio/mpeg DT=MPEG Audio TYPE=mp3
+
+
;
; Experimental
;
application/x-shockwave-flash CMD=gnash:aos4-gnash
+
+; video/mpeg CMD=APPDIR:MPlayer
+; video/quicktime CMD=APPDIR:MPlayer
+; video/x-msvideo CMD=APPDIR:MPlayer
+; video/x-ms-wmv CMD=APPDIR:MPlayer
12 years
r12466 chris_y - in /trunk/netsurf/amiga: Makefile.target datatypes.c datatypes.h dt_sound.c
by netsurf@semichrome.net
Author: chris_y
Date: Sun Jun 5 18:07:10 2011
New Revision: 12466
URL: http://source.netsurf-browser.org?rev=12466&view=rev
Log:
Sound DataTypes implementation. Currently has no interface, so only
autoplay/autoStart objects will play.
Added:
trunk/netsurf/amiga/dt_sound.c (with props)
Modified:
trunk/netsurf/amiga/Makefile.target
trunk/netsurf/amiga/datatypes.c
trunk/netsurf/amiga/datatypes.h
Modified: trunk/netsurf/amiga/Makefile.target
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/Makefile.target?rev...
==============================================================================
--- trunk/netsurf/amiga/Makefile.target (original)
+++ trunk/netsurf/amiga/Makefile.target Sun Jun 5 18:07:10 2011
@@ -73,7 +73,7 @@
cookies.c context_menu.c clipboard.c save_complete.c \
launch.c search.c history_local.c download.c iff_dr2d.c \
sslcert.c gui_options.c print.c theme.c drag.c icon.c system_colour.c \
- datatypes.c dt_picture.c dt_anim.c plugin_hack.c \
+ datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \
stringview/stringview.c stringview/urlhistory.c
S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
Modified: trunk/netsurf/amiga/datatypes.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/datatypes.c?rev=124...
==============================================================================
--- trunk/netsurf/amiga/datatypes.c (original)
+++ trunk/netsurf/amiga/datatypes.c Sun Jun 5 18:07:10 2011
@@ -29,6 +29,9 @@
err = amiga_dt_anim_init();
if(err != NSERROR_OK) return err;
+ err = amiga_dt_sound_init();
+ if(err != NSERROR_OK) return err;
+
return NSERROR_OK;
}
@@ -36,5 +39,6 @@
{
amiga_dt_picture_fini();
amiga_dt_anim_fini();
+ amiga_dt_sound_fini();
}
#endif
Modified: trunk/netsurf/amiga/datatypes.h
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/datatypes.h?rev=124...
==============================================================================
--- trunk/netsurf/amiga/datatypes.h (original)
+++ trunk/netsurf/amiga/datatypes.h Sun Jun 5 18:07:10 2011
@@ -33,6 +33,9 @@
nserror amiga_dt_anim_init(void);
void amiga_dt_anim_fini(void);
+nserror amiga_dt_sound_init(void);
+void amiga_dt_sound_fini(void);
+
#else
#define amiga_datatypes_init() NSERROR_OK
Added: trunk/netsurf/amiga/dt_sound.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/dt_sound.c?rev=1246...
==============================================================================
--- trunk/netsurf/amiga/dt_sound.c (added)
+++ trunk/netsurf/amiga/dt_sound.c Sun Jun 5 18:07:10 2011
@@ -1,0 +1,287 @@
+/*
+ * Copyright 2011 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ *
+ * 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/>.
+ */
+
+/** \file
+ * DataTypes sound handler (implementation)
+*/
+
+#ifdef WITH_AMIGA_DATATYPES
+#include "amiga/filetype.h"
+#include "amiga/datatypes.h"
+#include "content/content_protected.h"
+#include "desktop/plotters.h"
+#include "render/box.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/talloc.h"
+
+#include <proto/datatypes.h>
+#include <proto/dos.h>
+#include <proto/intuition.h>
+#include <datatypes/soundclass.h>
+#include <intuition/classusr.h>
+
+typedef struct amiga_dt_sound_content {
+ struct content base;
+
+ Object *dto;
+ bool immediate;
+} amiga_dt_sound_content;
+
+static nserror amiga_dt_sound_create(const content_handler *handler,
+ lwc_string *imime_type, const http_parameter *params,
+ llcache_handle *llcache, const char *fallback_charset,
+ bool quirks, struct content **c);
+static bool amiga_dt_sound_convert(struct content *c);
+static void amiga_dt_sound_destroy(struct content *c);
+static bool amiga_dt_sound_redraw(struct content *c, int x, int y,
+ int width, int height, const struct rect *clip,
+ float scale, colour background_colour,
+ bool repeat_x, bool repeat_y);
+static void amiga_dt_sound_open(struct content *c, struct browser_window *bw,
+ struct content *page, struct box *box,
+ struct object_params *params);
+static nserror amiga_dt_sound_clone(const struct content *old, struct content **newc);
+static content_type amiga_dt_sound_content_type(lwc_string *mime_type);
+
+static const content_handler amiga_dt_sound_content_handler = {
+ .create = amiga_dt_sound_create,
+ .data_complete = amiga_dt_sound_convert,
+ .destroy = amiga_dt_sound_destroy,
+ .redraw = amiga_dt_sound_redraw,
+ .open = amiga_dt_sound_open,
+ .clone = amiga_dt_sound_clone,
+ .type = amiga_dt_sound_content_type,
+ .no_share = false,
+};
+
+
+void amiga_dt_sound_play(Object *dto)
+{
+ LOG(("Playing..."));
+ IDoMethod(dto, DTM_TRIGGER, NULL, STM_PLAY, NULL);
+}
+
+
+nserror amiga_dt_sound_init(void)
+{
+ char dt_mime[50];
+ struct DataType *dt, *prevdt = NULL;
+ lwc_string *type;
+ lwc_error lerror;
+ nserror error;
+ BPTR fh = 0;
+ struct Node *node = NULL;
+
+ while((dt = ObtainDataType(DTST_RAM, NULL,
+ DTA_DataType, prevdt,
+ DTA_GroupID, GID_SOUND,
+ TAG_DONE)) != NULL)
+ {
+ ReleaseDataType(prevdt);
+ prevdt = dt;
+
+ do {
+ node = ami_mime_from_datatype(dt, &type, node);
+
+ if(node)
+ {
+ error = content_factory_register_handler(type,
+ &amiga_dt_sound_content_handler);
+
+ if (error != NSERROR_OK)
+ return error;
+ }
+
+ }while (node != NULL);
+
+ }
+
+ ReleaseDataType(prevdt);
+
+ return NSERROR_OK;
+}
+
+void amiga_dt_sound_fini(void)
+{
+ /* Nothing to do */
+}
+
+nserror amiga_dt_sound_create(const content_handler *handler,
+ lwc_string *imime_type, const http_parameter *params,
+ llcache_handle *llcache, const char *fallback_charset,
+ bool quirks, struct content **c)
+{
+ amiga_dt_sound_content *plugin;
+ nserror error;
+
+ LOG(("amiga_dt_sound_create"));
+
+ plugin = talloc_zero(0, amiga_dt_sound_content);
+ if (plugin == NULL)
+ return NSERROR_NOMEM;
+
+ error = content__init(&plugin->base, handler, imime_type, params,
+ llcache, fallback_charset, quirks);
+ if (error != NSERROR_OK) {
+ talloc_free(plugin);
+ return error;
+ }
+
+ *c = (struct content *) plugin;
+
+ return NSERROR_OK;
+}
+
+bool amiga_dt_sound_convert(struct content *c)
+{
+ LOG(("amiga_dt_sound_convert"));
+
+ amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
+ union content_msg_data msg_data;
+ int width, height;
+ char title[100];
+ const uint8 *data;
+ ULONG size;
+ Object *dto;
+
+ data = (uint8 *)content__get_source_data(c, &size);
+
+ plugin->dto = NewDTObject(NULL,
+ DTA_SourceType, DTST_MEMORY,
+ DTA_SourceAddress, data,
+ DTA_SourceSize, size,
+ DTA_GroupID, GID_SOUND,
+ TAG_DONE);
+
+ if(plugin->dto == NULL) return false;
+
+ c->width = width;
+ c->height = height;
+
+ if(plugin->immediate == true) amiga_dt_sound_play(plugin->dto);
+
+ content_set_ready(c);
+ content_set_done(c);
+
+ content_set_status(c, "");
+ return true;
+}
+
+void amiga_dt_sound_destroy(struct content *c)
+{
+ amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
+
+ LOG(("amiga_dt_sound_destroy"));
+
+ DisposeDTObject(plugin->dto);
+
+ return;
+}
+
+bool amiga_dt_sound_redraw(struct content *c, int x, int y,
+ int width, int height, const struct rect *clip,
+ float scale, colour background_colour,
+ bool repeat_x, bool repeat_y)
+{
+ plot_style_t pstyle = {
+ .fill_type = PLOT_OP_TYPE_SOLID,
+ .fill_colour = 0xffffff,
+ .stroke_colour = 0x000000,
+ .stroke_width = 1,
+ };
+
+ LOG(("amiga_dt_sound_redraw"));
+
+ /* this should be some sort of play/stop control */
+
+ plot.rectangle(x, y, x + width, y + height, &pstyle);
+ return plot.text(x, y+20, lwc_string_data(content__get_mime_type(c)),
+ lwc_string_length(content__get_mime_type(c)), plot_style_font);
+
+}
+
+
+void amiga_dt_sound_open(struct content *c, struct browser_window *bw,
+ struct content *page, struct box *box,
+ struct object_params *params)
+{
+ amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
+ struct object_param *param;
+
+ LOG(("amiga_dt_sound_open"));
+
+ plugin->immediate = false;
+
+ if(params && (param = params->params))
+ {
+ do
+ {
+ LOG(("%s = %s", param->name, param->value));
+ if((strcmp(param->name, "autoplay") == 0) &&
+ (strcmp(param->value, "true") == 0)) plugin->immediate = true;
+ if((strcmp(param->name, "autoStart") == 0) &&
+ (strcmp(param->value, "1") == 0)) plugin->immediate = true;
+ param = param->next;
+ } while(param != NULL);
+ }
+
+ if(plugin->dto && (plugin->immediate == true))
+ amiga_dt_sound_play(plugin->dto);
+
+ return;
+}
+
+
+nserror amiga_dt_sound_clone(const struct content *old, struct content **newc)
+{
+ amiga_dt_sound_content *plugin;
+ nserror error;
+
+ LOG(("amiga_dt_sound_clone"));
+
+ plugin = talloc_zero(0, amiga_dt_sound_content);
+ if (plugin == NULL)
+ return NSERROR_NOMEM;
+
+ error = content__clone(old, &plugin->base);
+ if (error != NSERROR_OK) {
+ content_destroy(&plugin->base);
+ return error;
+ }
+
+ /* We "clone" the old content by replaying conversion */
+ if (old->status == CONTENT_STATUS_READY ||
+ old->status == CONTENT_STATUS_DONE) {
+ if (amiga_dt_sound_convert(&plugin->base) == false) {
+ content_destroy(&plugin->base);
+ return NSERROR_CLONE_FAILED;
+ }
+ }
+
+ *newc = (struct content *) plugin;
+
+ return NSERROR_OK;
+}
+
+content_type amiga_dt_sound_content_type(lwc_string *mime_type)
+{
+ return CONTENT_PLUGIN;
+}
+
+#endif
Propchange: trunk/netsurf/amiga/dt_sound.c
------------------------------------------------------------------------------
amiga:protection = ----rw-d ---- ----
12 years
r12465 chris_y - in /trunk/netsurf/amiga: arexx.c version.c
by netsurf@semichrome.net
Author: chris_y
Date: Sun Jun 5 07:37:44 2011
New Revision: 12465
URL: http://source.netsurf-browser.org?rev=12465&view=rev
Log:
Avoid compiling arexx.c more than necessary
Modified:
trunk/netsurf/amiga/arexx.c
trunk/netsurf/amiga/version.c
Modified: trunk/netsurf/amiga/arexx.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/arexx.c?rev=12465&r...
==============================================================================
--- trunk/netsurf/amiga/arexx.c (original)
+++ trunk/netsurf/amiga/arexx.c Sun Jun 5 07:37:44 2011
@@ -23,7 +23,6 @@
#include "amiga/gui.h"
#include "amiga/options.h"
#include "desktop/browser.h"
-#include "utils/testament.h"
#include <string.h>
#include <math.h>
@@ -35,10 +34,11 @@
#include <gadgets/clicktab.h>
#include <reaction/reaction_macros.h>
-const char * const verarexx;
-const char * const netsurf_version;
-const int netsurf_version_major;
-const int netsurf_version_minor;
+extern const char * const verarexx;
+extern const char * const netsurf_version;
+extern const char * const wt_revid;
+extern const int netsurf_version_major;
+extern const int netsurf_version_minor;
enum
{
@@ -376,7 +376,7 @@
{
if(cmd->ac_ArgList[1])
{
- if((netsurf_version_major > *(ULONG *)cmd->ac_ArgList[0]) || ((atoi(WT_REVID) >= *(ULONG *)cmd->ac_ArgList[1]) && (netsurf_version_major == *(ULONG *)cmd->ac_ArgList[0])))
+ if((netsurf_version_major > *(ULONG *)cmd->ac_ArgList[0]) || ((atoi(wt_revid) >= *(ULONG *)cmd->ac_ArgList[1]) && (netsurf_version_major == *(ULONG *)cmd->ac_ArgList[0])))
{
strcpy(result,"1");
}
Modified: trunk/netsurf/amiga/version.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/version.c?rev=12465...
==============================================================================
--- trunk/netsurf/amiga/version.c (original)
+++ trunk/netsurf/amiga/version.c Sun Jun 5 07:37:44 2011
@@ -24,3 +24,4 @@
const char * const versvn = "SVN " WT_REVID;
const char * const verdate = WT_COMPILEDATE;
const char * const verarexx = NETSURF_VERSION_MAJOR "." WT_REVID;
+const char * const wt_revid = WT_REVID;
12 years
r12464 chris_y - in /trunk/netsurf: !NetSurf/Resources/de/Messages !NetSurf/Resources/en/Messages !NetSurf/Resources/fr/Messages !NetSurf/Resources/it/Messages !NetSurf/Resources/nl/Messages amiga/plugin_hack.c
by netsurf@semichrome.net
Author: chris_y
Date: Sun Jun 5 06:49:50 2011
New Revision: 12464
URL: http://source.netsurf-browser.org?rev=12464&view=rev
Log:
plugin_hack loose ends
Modified:
trunk/netsurf/!NetSurf/Resources/de/Messages
trunk/netsurf/!NetSurf/Resources/en/Messages
trunk/netsurf/!NetSurf/Resources/fr/Messages
trunk/netsurf/!NetSurf/Resources/it/Messages
trunk/netsurf/!NetSurf/Resources/nl/Messages
trunk/netsurf/amiga/plugin_hack.c
Modified: trunk/netsurf/!NetSurf/Resources/de/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/de/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/de/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/de/Messages Sun Jun 5 06:49:50 2011
@@ -301,6 +301,7 @@
SaveIFF:Speichern als IFF...
ObjShow:Zeige Objekt
SelectFile:Datei auswählen...
+ExternalApp:Open in external application
# Treeview interface tokens
# =========================
Modified: trunk/netsurf/!NetSurf/Resources/en/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/en/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/en/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/en/Messages Sun Jun 5 06:49:50 2011
@@ -303,6 +303,7 @@
SaveIFF:Save as IFF...
ObjShow:Show object
SelectFile:Select file...
+ExternalApp:Open in external application
# Treeview interface tokens
# =========================
Modified: trunk/netsurf/!NetSurf/Resources/fr/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/fr/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/fr/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/fr/Messages Sun Jun 5 06:49:50 2011
@@ -301,6 +301,7 @@
SaveIFF:Save as IFF...
ObjShow:Show object
SelectFile:Select file...
+ExternalApp:Open in external application
# Treeview interface tokens
# =========================
Modified: trunk/netsurf/!NetSurf/Resources/it/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/it/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/it/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/it/Messages Sun Jun 5 06:49:50 2011
@@ -305,6 +305,7 @@
SaveIFF:Salva come IFF...
ObjShow:Mostra oggetto
SelectFile:Seleziona file...
+ExternalApp:Open in external application
# Treeview interface tokens
# =========================
Modified: trunk/netsurf/!NetSurf/Resources/nl/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/nl/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/nl/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/nl/Messages Sun Jun 5 06:49:50 2011
@@ -301,6 +301,7 @@
SaveIFF:Save as IFF...
ObjShow:Show object
SelectFile:Select file...
+ExternalApp:Open in external application
# Treeview interface tokens
# =========================
Modified: trunk/netsurf/amiga/plugin_hack.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/plugin_hack.c?rev=1...
==============================================================================
--- trunk/netsurf/amiga/plugin_hack.c (original)
+++ trunk/netsurf/amiga/plugin_hack.c Sun Jun 5 06:49:50 2011
@@ -80,7 +80,7 @@
if(node)
{
- printf("plugin_hack registered %s\n",lwc_string_data(type));
+ LOG(("plugin_hack registered %s\n",lwc_string_data(type)));
error = content_factory_register_handler(type,
&amiga_plugin_hack_content_handler);
@@ -149,11 +149,16 @@
float scale, colour background_colour,
bool repeat_x, bool repeat_y)
{
- static plot_style_t pstyle;
+ plot_style_t pstyle = {
+ .fill_type = PLOT_OP_TYPE_SOLID,
+ .fill_colour = 0xffffff,
+ .stroke_colour = 0x000000,
+ .stroke_width = 1,
+ };
LOG(("amiga_plugin_hack_redraw"));
- plot.rectangle(x, y, x + width, y + height, plot_style_fill_red);
+ plot.rectangle(x, y, x + width, y + height, &pstyle);
return plot.text(x, y+20, lwc_string_data(content__get_mime_type(c)),
lwc_string_length(content__get_mime_type(c)), plot_style_font);
12 years
r12463 chris_y - /trunk/netsurf/desktop/tree.c
by netsurf@semichrome.net
Author: chris_y
Date: Sat Jun 4 16:33:33 2011
New Revision: 12463
URL: http://source.netsurf-browser.org?rev=12463&view=rev
Log:
Disable extra logging. Here treeview init is down to ~5 seconds from ~20.
Still more room for improvement, as adding nodes appears to recalculate the widths of
all the parent nodes even though (the text and icon of) those haven't changed.
Modified:
trunk/netsurf/desktop/tree.c
Modified: trunk/netsurf/desktop/tree.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/tree.c?rev=12463&...
==============================================================================
--- trunk/netsurf/desktop/tree.c (original)
+++ trunk/netsurf/desktop/tree.c Sat Jun 4 16:33:33 2011
@@ -42,7 +42,7 @@
#include "utils/utils.h"
#include "utils/url.h"
-#define TREE_NOISY_DEBUG 1
+#undef TREE_NOISY_DEBUG
#define MAXIMUM_URL_LENGTH 1024
12 years
r12461 chris_y - /trunk/netsurf/desktop/tree.c
by netsurf@semichrome.net
Author: chris_y
Date: Sat Jun 4 16:10:39 2011
New Revision: 12461
URL: http://source.netsurf-browser.org?rev=12461&view=rev
Log:
Rudimentary text width caching to speed up many duplicate "Today", "Yesterday" calcs
Modified:
trunk/netsurf/desktop/tree.c
Modified: trunk/netsurf/desktop/tree.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/tree.c?rev=12461&...
==============================================================================
--- trunk/netsurf/desktop/tree.c (original)
+++ trunk/netsurf/desktop/tree.c Sat Jun 4 16:10:39 2011
@@ -273,6 +273,8 @@
{
struct bitmap *bitmap = NULL;
int width, height;
+ static char *cache_text = NULL;
+ static int cache_size = 0;
assert(element != NULL);
@@ -286,10 +288,20 @@
textarea_get_dimensions(tree->textarea,
&element->box.width, NULL);
} else {
- nsfont.font_width(&plot_fstyle,
- element->text,
- strlen(element->text),
- &element->box.width);
+ if ((cache_text != NULL) &&
+ (strcmp(cache_text, element->text) == 0)) {
+ element->box.width = cache_size;
+ #ifdef TREE_NOISY_DEBUG
+ LOG(("Tree font width cache hit"));
+ #endif
+ } else {
+ nsfont.font_width(&plot_fstyle,
+ element->text,
+ strlen(element->text),
+ &cache_size);
+ element->box.width = cache_size;
+ cache_text = strdup(element->text);
+ }
}
element->box.width += 8;
12 years